@cntrl-site/components 1.0.79-alpha.0 → 1.0.79-alpha.2

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.
@@ -5,6 +5,10 @@ export declare const BurgerComponent: {
5
5
  name: string;
6
6
  category: string;
7
7
  version: number;
8
+ preview: {
9
+ type: "image";
10
+ url: string;
11
+ };
8
12
  layoutMode: "navigation";
9
13
  defaultSize: {
10
14
  d: {
package/dist/index.js CHANGED
@@ -26420,7 +26420,7 @@ export function Burger({
26420
26420
  </div>
26421
26421
  );
26422
26422
  }
26423
- `;function Zo(e){return{type:"number",scope:"layout",title:e,min:0,max:100,display:{type:"range-control"}}}const Di={fontSettings:{type:"object",display:{type:"font-settings-weight",hideLabel:!0,useTabDesign:!0},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}},fontSize:{type:"number",display:{type:"font-size"}},lineHeight:{type:"number",display:{type:"line-height-input"}},letterSpacing:{type:"number",display:{type:"letter-spacing-input"}},wordSpacing:{type:"number",display:{type:"word-spacing-input"}},textAlign:{type:"string",enum:["left","center","right","justify"],display:{type:"vertical-text-aligh-options"}},textAppearance:{type:"object",display:{type:"text-appearance",useTabDesign:!0},properties:{textTransform:{type:"string",enum:["none","uppercase","lowercase","capitalize"]},textDecoration:{type:"string",enum:["none","underline"]},fontVariant:{type:"string",enum:["normal","small-caps"]}}}};function mi(e,t){return e?`${e}${t.charAt(0).toUpperCase()}${t.slice(1)}`:t}function Pl(e){return{[mi(e,"fontFamily")]:{type:"string",scope:"common",title:"",display:{type:"font-family-select",hideLabel:!0,useTabDesign:!0}},[mi(e,"fontSettings")]:{...Di.fontSettings,scope:"common",title:""},[mi(e,"fontSize")]:{...Di.fontSize,scope:"layout",title:""},[mi(e,"lineHeight")]:{...Di.lineHeight,scope:"layout",title:""},[mi(e,"letterSpacing")]:{...Di.letterSpacing,scope:"layout",title:""},[mi(e,"wordSpacing")]:{...Di.wordSpacing,scope:"layout",title:""},[mi(e,"textAlign")]:{...Di.textAlign,scope:"layout",title:""},[mi(e,"textAppearance")]:{...Di.textAppearance,scope:"layout",title:""}}}const Kw=Pl(""),Yw=Pl("open"),Zw=Pl("compact"),Jw=["__componentName__",{type:"row",items:["panelHeight","navTextWidth"]},{type:"row",title:"Logo",items:["logoMaxHeight","logoPosition"]},{type:"row",title:"Hamburger",items:["showIcon","iconSize"]},"fontFamily","fontSettings",{type:"row",items:["fontSize","lineHeight","letterSpacing","wordSpacing"]},"textAlign","textAppearance","navGap","navPaddingLeft","navPaddingRight"],Qw=["__componentName__",{type:"row",items:["compactPanelHeight","compactNavTextWidth"]},{type:"row",title:"Logo",items:["compactLogoMaxHeight","compactLogoPosition"]},{type:"row",title:"Hamburger",items:["compactShowIcon","compactIconSize"]},"compactFontFamily","compactFontSettings",{type:"row",items:["compactFontSize","compactLineHeight","compactLetterSpacing","compactWordSpacing"]},"compactTextAlign","compactTextAppearance","compactNavGap","compactNavPaddingLeft","compactNavPaddingRight"],e$=["__componentName__",{type:"row",items:["textWidth","effect"]},"position","openFontFamily","openFontSettings",{type:"row",items:["openFontSize","openLineHeight","openLetterSpacing","openWordSpacing"]},"openTextAlign","openTextAppearance"],Yn={textTransform:"none",textDecoration:"none",fontVariant:"normal"},gs={fontWeight:400,fontStyle:"normal"},t$=["left-top","center-top","right-top","left-center","center","right-center","left-bottom","center-bottom","right-bottom"],n$=["iconColor","logoColor","closeButtonColor","linkColor","backgroundColor"],i$={type:"object",version:1,settings:{sizing:"auto manual",properties:{link:{type:"array",scope:"common",display:{type:"page-url-link"},items:{type:"object",properties:{mode:{type:"string",enum:["page","url"]},page:{type:"string"},url:{type:"string",message:"Paste URL here..."},label:{type:"string"},anchor:{type:"string"},openIn:{type:"string"},showIn:{type:"string",enum:["always","open only","open and compact","default and open"]}}}},logo:{type:"object",scope:"common",title:"Logo",display:{type:"button-icon-switch"},properties:{mode:{type:"string",enum:["On","Off"]},icon:{type:["string","null"],title:"Logo",display:{type:"settings-image-input"}}}},logoMaxHeight:{type:"number",scope:"layout",title:"Height",display:{type:"numeric-input"},min:0,max:9999},logoPosition:{type:"string",scope:"layout",title:"Position",display:{type:"toggle-cycle",enum:["left","center","right"]}},compactLogoPosition:{type:"string",scope:"layout",title:"Position",display:{type:"toggle-cycle",enum:["left","center","right"]}},logoColor:{type:"string",scope:"common",title:"Logo Default",titleByState:{default:"Logo Default",hover:"Logo Hover"},display:{type:"palette-color-picker"}},panelHeight:{type:"number",scope:"layout",title:"Menu Height",display:{type:"numeric-input"},min:0,max:9999},backgroundColor:{type:"string",scope:"common",title:"BG Default",display:{type:"palette-color-picker"}},iconColor:{type:"string",scope:"common",title:"Icon Default",titleByState:{default:"Icon Default",hover:"Icon Hover"},display:{type:"palette-color-picker"}},showIcon:{type:"string",scope:"layout",title:"Show",display:{type:"toggle-cycle",enum:["on","off"]}},iconSize:{type:"number",scope:"layout",title:"Size",display:{type:"numeric-input"},min:0,max:9999},linkColor:{type:"string",scope:"common",title:"Link Default",titleByState:{default:"Link Default",hover:"Link Hover"},display:{type:"palette-color-picker"}},compactShowIcon:{type:"string",scope:"layout",title:"Show",display:{type:"toggle-cycle",enum:["on","off"]}},compactIconColor:{type:"string",scope:"common",title:"Icon Default",titleByState:{compact:"Icon Default","compact-hover":"Icon Hover"},display:{type:"palette-color-picker"}},compactCloseButtonColor:{type:"string",scope:"common",title:"Close Default",titleByState:{compact:"Close Default","compact-hover":"Close Hover"},display:{type:"palette-color-picker"}},compactLinkColor:{type:"string",scope:"common",title:"Link Default",titleByState:{compact:"Link Default","compact-hover":"Link Hover"},display:{type:"palette-color-picker"}},compactLogoColor:{type:"string",scope:"common",title:"Logo Default",titleByState:{compact:"Logo Default","compact-hover":"Logo Hover"},display:{type:"palette-color-picker"}},compactBackgroundColor:{type:"string",scope:"common",title:"BG Default",display:{type:"palette-color-picker"}},openLinkColor:{type:"string",scope:"common",title:"Link Default",titleByState:{open:"Link Default","open-hover":"Link Hover"},display:{type:"palette-color-picker"}},openLogoColor:{type:"string",scope:"common",title:"Logo Default",titleByState:{open:"Logo Default","open-hover":"Logo Hover"},display:{type:"palette-color-picker"}},menuBackgroundColor:{type:"string",scope:"common",title:"BG Default",display:{type:"palette-color-picker"}},overlayColor:{type:"string",scope:"common",title:"Overlay Default",display:{type:"palette-color-picker"}},closeButtonColor:{type:"string",scope:"common",title:"Close Default",titleByState:{default:"Close Default",hover:"Close Hover",open:"Close Default","open-hover":"Close Hover"},display:{type:"palette-color-picker"}},effect:{type:"string",scope:"layout",title:"Effect",display:{type:"toggle-cycle",enum:["fade","left","top","right","bottom"]}},textWidth:{type:"number",scope:"layout",title:"Text width",display:{type:"numeric-input"},min:0,max:9999},navTextWidth:{type:"number",scope:"layout",title:"Text width",display:{type:"numeric-input"},min:0,max:9999},position:{type:"string",scope:"layout",title:"Position",display:{type:"toggle-cycle",enum:[...t$]}},stateOverrides:{type:"object",scope:"common"},gap:Zo("Gap"),navGap:{type:"number",scope:"layout",title:"Nav gap",min:0,max:100,display:{type:"range-control",visible:!1}},navPaddingLeft:{type:"number",scope:"layout",title:"Nav padding left",min:0,max:100,display:{type:"range-control",visible:!1}},navPaddingRight:{type:"number",scope:"layout",title:"Nav padding right",min:0,max:100,display:{type:"range-control",visible:!1}},textPaddingLeft:Zo("Text padding left"),textPaddingRight:Zo("Text padding right"),textPaddingTop:Zo("Text padding top"),textPaddingBottom:Zo("Text padding bottom"),compactLogoMaxHeight:{type:"number",scope:"layout",title:"Height",display:{type:"numeric-input"},min:0,max:9999},compactPanelHeight:{type:"number",scope:"layout",title:"Menu Height",display:{type:"numeric-input"},min:0,max:9999},compactIconSize:{type:"number",scope:"layout",title:"Size",display:{type:"numeric-input"},min:0,max:9999},compactNavTextWidth:{type:"number",scope:"layout",title:"Text width",display:{type:"numeric-input"},min:0,max:9999},compactNavGap:{type:"number",scope:"layout",title:"Nav gap",min:0,max:100,display:{type:"range-control",visible:!1}},compactNavPaddingLeft:{type:"number",scope:"layout",title:"Nav padding left",min:0,max:100,display:{type:"range-control",visible:!1}},compactNavPaddingRight:{type:"number",scope:"layout",title:"Nav padding right",min:0,max:100,display:{type:"range-control",visible:!1}},...Kw,...Yw,...Zw},defaults:{link:[{mode:"page",page:"",url:"",label:"Home",anchor:"",openIn:"Same Tab",showIn:"always"},{mode:"page",page:"",url:"",label:"Works",anchor:"",openIn:"Same Tab",showIn:"always"},{mode:"page",page:"",url:"",label:"About",anchor:"",openIn:"Same Tab",showIn:"always"},{mode:"page",page:"",url:"",label:"Contact",anchor:"",openIn:"Same Tab",showIn:"always"}],logo:{mode:"On",icon:null},backgroundColor:"#ffffff",logoColor:"#000000",iconColor:"#000000",linkColor:"#000000",openLinkColor:"#000000",compactIconColor:"#000000",compactCloseButtonColor:"#000000",compactLinkColor:"#000000",compactLogoColor:"#000000",compactBackgroundColor:"#ffffff",openLogoColor:"#000000",menuBackgroundColor:"#ffffff",overlayColor:"rgba(0, 0, 0, 0.45)",closeButtonColor:"#000000",effect:"fade",showIcon:"on",compactShowIcon:"on",logoPosition:"left",compactLogoPosition:"left",position:"left-top",fontFamily:"Goudy Bookletter 1911",fontSettings:gs,textAlign:"left",openFontFamily:"Goudy Bookletter 1911",openFontSettings:gs,openTextAlign:"left",compactFontFamily:"Goudy Bookletter 1911",compactFontSettings:gs,compactTextAlign:"left",stateOverrides:{hover:{linkColor:"#666666",iconColor:"#666666",logoColor:"#666666",closeButtonColor:"#666666"}}},displayRules:[{if:{name:"logo.mode",value:"Off"},then:{name:"properties.logoMaxHeight.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.logoPosition.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.compactLogoMaxHeight.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.compactLogoPosition.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.logoColor.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.compactLogoColor.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.openLogoColor.display.visible",value:!1}},{if:{name:"showIcon",value:"off"},then:{name:"properties.iconSize.display.visible",value:!1}},{if:{name:"showIcon",value:"off"},then:{name:"properties.iconColor.display.visible",value:!1}},{if:{name:"compactShowIcon",value:"off"},then:{name:"properties.compactIconSize.display.visible",value:!1}},{if:{name:"compactShowIcon",value:"off"},then:{name:"properties.compactIconColor.display.visible",value:!1}}],layoutDefaults:{m:{position:"left-top",panelHeight:56/375,logoMaxHeight:80/375,logoPosition:"left",compactLogoPosition:"left",showIcon:"on",iconSize:16/375,textWidth:240/375,navTextWidth:120/375,gap:24/375,navGap:24/375,navPaddingLeft:10/375,navPaddingRight:10/375,textPaddingLeft:10/375,textPaddingRight:10/375,textPaddingTop:10/375,textPaddingBottom:10/375,fontSize:16/375,lineHeight:20/375,letterSpacing:0,wordSpacing:0,textAppearance:Yn,openFontSize:16/375,openLineHeight:20/375,openLetterSpacing:0,openWordSpacing:0,openTextAppearance:Yn,compactPanelHeight:56/375,compactLogoMaxHeight:80/375,compactShowIcon:"on",compactIconSize:16/375,compactNavTextWidth:120/375,compactNavGap:24/375,compactNavPaddingLeft:10/375,compactNavPaddingRight:10/375,compactFontSize:16/375,compactLineHeight:20/375,compactLetterSpacing:0,compactWordSpacing:0,compactTextAppearance:Yn},t:{position:"left-top",panelHeight:60/768,logoMaxHeight:100/768,logoPosition:"left",compactLogoPosition:"left",showIcon:"on",iconSize:16/768,textWidth:260/768,navTextWidth:140/768,gap:32/768,navGap:32/768,navPaddingLeft:10/768,navPaddingRight:10/768,textPaddingLeft:10/768,textPaddingRight:10/768,textPaddingTop:10/768,textPaddingBottom:10/768,fontSize:16/768,lineHeight:20/768,letterSpacing:0,wordSpacing:0,textAppearance:Yn,openFontSize:16/768,openLineHeight:20/768,openLetterSpacing:0,openWordSpacing:0,openTextAppearance:Yn,compactPanelHeight:60/768,compactLogoMaxHeight:100/768,compactShowIcon:"on",compactIconSize:16/768,compactNavTextWidth:140/768,compactNavGap:32/768,compactNavPaddingLeft:10/768,compactNavPaddingRight:10/768,compactFontSize:16/768,compactLineHeight:20/768,compactLetterSpacing:0,compactWordSpacing:0,compactTextAppearance:Yn},d:{position:"left-top",panelHeight:40/1440,logoMaxHeight:120/1440,logoPosition:"left",compactLogoPosition:"left",showIcon:"on",iconSize:16/1440,textWidth:60/1440,navTextWidth:60/1440,gap:12/1440,navGap:12/1440,navPaddingLeft:10/1440,navPaddingRight:10/1440,textPaddingLeft:10/1440,textPaddingRight:10/1440,textPaddingTop:10/1440,textPaddingBottom:10/1440,fontSize:16/1440,lineHeight:16/1440,letterSpacing:0,wordSpacing:0,textAppearance:Yn,textAlign:"center",openFontSize:16/1440,openLineHeight:16/1440,openLetterSpacing:0,openWordSpacing:0,openTextAppearance:Yn,openTextAlign:"center",compactPanelHeight:40/1440,compactLogoMaxHeight:120/1440,compactShowIcon:"on",compactIconSize:16/1440,compactNavTextWidth:60/1440,compactNavGap:12/1440,compactNavPaddingLeft:10/1440,compactNavPaddingRight:10/1440,compactFontSize:16/1440,compactLineHeight:16/1440,compactLetterSpacing:0,compactWordSpacing:0,compactTextAppearance:Yn,compactTextAlign:"center"}},layout:["__componentName__","link","logo","logoMaxHeight","logoPosition","panelHeight","backgroundColor","logoColor","iconColor","showIcon","iconSize","linkColor","openLinkColor","compactShowIcon","compactIconColor","compactCloseButtonColor","compactLinkColor","compactLogoColor","compactBackgroundColor","compactLogoMaxHeight","compactLogoPosition","compactPanelHeight","compactIconSize","compactNavTextWidth","compactNavGap","compactNavPaddingLeft","compactNavPaddingRight","compactFontFamily","compactFontSettings","compactFontSize","compactLineHeight","compactLetterSpacing","compactWordSpacing","compactTextAlign","compactTextAppearance","openLogoColor","menuBackgroundColor","overlayColor","closeButtonColor","effect","textWidth","navTextWidth","position","gap","navGap","navPaddingLeft","navPaddingRight","textPaddingLeft","textPaddingRight","textPaddingTop","textPaddingBottom","fontFamily","fontSettings","fontSize","lineHeight","letterSpacing","wordSpacing","textAlign","textAppearance","openFontFamily","openFontSettings","openFontSize","openLineHeight","openLetterSpacing","openWordSpacing","openTextAlign","openTextAppearance"]},panels:[{id:"general",icon:"settings",title:"General",tooltip:"General Settings",layout:["__componentName__","logo"]},{id:"default",icon:"default",title:"Default",tooltip:"Default State",layout:Jw},{id:"compact",icon:"compact",title:"Compact",tooltip:"Compact State",layout:Qw,availableWhen:{navigationPosition:["switch"]}},{id:"open",icon:"open",title:"Open",tooltip:"Open State",layout:e$},{id:"links",icon:"content",title:"Links",tooltip:"Link Settings",layout:["__componentName__","link"]}],paletteBookmark:{items:[...n$],panelIds:["default","compact","open"],stateItems:{default:["iconColor","logoColor","closeButtonColor","linkColor","backgroundColor"],hover:["iconColor","logoColor","closeButtonColor","linkColor"],compact:["compactIconColor","compactLogoColor","compactCloseButtonColor","compactLinkColor","compactBackgroundColor"],"compact-hover":["compactIconColor","compactLogoColor","compactCloseButtonColor","compactLinkColor"],open:["closeButtonColor","openLogoColor","openLinkColor","menuBackgroundColor","overlayColor"],"open-hover":["closeButtonColor","openLogoColor","openLinkColor"]}},states:["default","hover"],statePanels:["default","compact","open"]},o$={element:qw,id:"basic-burger",name:"Basic Burger",category:"navigation",version:1,layoutMode:"navigation",defaultSize:{d:{width:"100%",height:60/1440},t:{width:"100%",height:60/768},m:{width:"100%",height:56/375}},schema:i$,sourceCode:Uw,assetsPaths:{content:[],parameters:[{path:"logo.icon"}]},fontSettingsPaths:{content:[],parameters:[{path:"fontFamily"},{path:"openFontFamily"},{path:"compactFontFamily"}]},fontRelations:{fontSettings:"fontFamily",openFontSettings:"openFontFamily",compactFontSettings:"compactFontFamily"}},ud=120,pd=3,r$=.12,El={x:0,y:0,width:100,height:100};function So(e,t){return e.map(n=>n.map(i=>({x:(i.x-t.x)/t.width,y:(i.y-t.y)/t.height})))}function ga(e){return e<0?0:e>1?1:e}function md(e,t){return e.filter(n=>n.length>0).map(n=>`M ${n.map(i=>`${i.x*t.width} ${i.y*t.height}`).join(" L ")} Z`).join(" ")}function a$(e,t){let n=1/0,i=1/0,o=-1/0,r=-1/0;for(const c of e)for(const u of c){const p=u.x*t.width,x=u.y*t.height;p<n&&(n=p),p>o&&(o=p),x<i&&(i=x),x>r&&(r=x)}const l=o-n,d=r-i;return!isFinite(l)||!isFinite(d)||l<=0||d<=0?null:{x:n,y:i,width:l,height:d}}function s$(e){return e.map(([t,n])=>({x:t,y:n}))}function hs(e){let t=1/0,n=1/0,i=-1/0,o=-1/0;for(const d of e)for(const c of d)c.x<t&&(t=c.x),c.x>i&&(i=c.x),c.y<n&&(n=c.y),c.y>o&&(o=c.y);const r=i-t,l=o-n;return!isFinite(r)||!isFinite(l)||r<=0||l<=0?e:e.map(d=>d.map(c=>({x:(c.x-t)/r,y:(c.y-n)/l})))}function l$(e,t){const n=[];for(const o of e)for(let r=0;r<o.length;r+=1){const l=o[r],d=o[(r+1)%o.length];(l.y<=t&&d.y>t||d.y<=t&&l.y>t)&&n.push(l.x+(t-l.y)/(d.y-l.y)*(d.x-l.x))}n.sort((o,r)=>o-r);const i=[];for(let o=0;o+1<n.length;o+=2){const r=ga(n[o]),l=ga(n[o+1]);l>r&&i.push({x0:r,x1:l})}return c$(i)}function c$(e){if(e.length<2)return e;const t=[...e].sort((i,o)=>i.x0-o.x0),n=[t[0]];for(let i=1;i<t.length;i+=1){const o=n[n.length-1],r=t[i];r.x0<=o.x1?o.x1=Math.max(o.x1,r.x1):n.push({...r})}return n}function d$(e,t){const n=[];let i=0,o=0;for(;i<e.length&&o<t.length;){const r=Math.max(e[i].x0,t[o].x0),l=Math.min(e[i].x1,t[o].x1);l>r&&n.push({x0:r,x1:l}),e[i].x1<t[o].x1?i+=1:o+=1}return n}function u$(e){const t=[];let n=0;for(const i of e)i.x0>n&&t.push({x0:n,x1:i.x0}),n=Math.max(n,i.x1);return n<1&&t.push({x0:n,x1:1}),t}function p$(e,t){const n=[];for(const i of e){if(t.x1<=i.x0||t.x0>=i.x1){n.push(i);continue}t.x0>i.x0&&n.push({x0:i.x0,x1:t.x0}),t.x1<i.x1&&n.push({x0:t.x1,x1:i.x1})}return n}function m$(e,t,n,i){let o=null;for(let r=0;r<pd;r+=1){const l=ga(t+(n-t)*r/Math.max(1,pd-1)),d=l$(e,l),c=i==="avoid"?u$(d):d;if(o=o===null?c:d$(o,c),o.length===0)return[]}return o??[]}function gd(e,t="stretch",n=El){const i=e.trim();if(!i)return null;if(/^[Mm]/.test(i)){const l=Li(i),d=yr(l);if(d.length)return t==="viewbox"?So(d,n):hs(d);if(typeof document>"u")return null;const c=i.split(/(?=[Mm])/).map(x=>x.trim()).filter(Boolean),u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p=[];for(const x of c){const v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",x),u.appendChild(v);let m=0;try{m=v.getTotalLength()}catch{m=0}if(!m)continue;const h=[];for(let y=0;y<ud;y+=1){const b=v.getPointAtLength(y/ud*m);h.push({x:b.x,y:b.y})}p.push(h)}return p.length?t==="viewbox"?So(p,n):hs(p):null}const o=i.split(/[\s,]+/).map(Number).filter(l=>!Number.isNaN(l));if(o.length<6)return null;const r=[];for(let l=0;l+1<o.length;l+=2)r.push({x:o[l],y:o[l+1]});return t==="viewbox"?So([r],n):hs([r])}const Ml={bobbin:"M57.63,0 L57.63,37.24 L74.66,37.24 L74.66,56.07 L57.63,100 L33.84,100 L16.81,56.07 L16.81,37.24 L33.84,37.24 L33.84,0 Z",circle:"M50,0 C77.61,0 100,22.39 100,50 C100,77.61 77.61,100 50,100 C22.39,100 0,77.61 0,50 C0,22.39 22.39,0 50,0 Z",shield:"M0,0 L100,0 L100,50 L50,100 L0,50 Z",vase:"M25.37,0 L91.55,0 C91.55,0 74.8,25.14 83.07,50.03 C91.34,74.92 74.61,100 74.61,100 L8.43,100 C8.43,100 32.3,75.08 23.9,50 C15.5,24.92 25.37,0 25.37,0 Z",parallelogram:"M25.37,0 L91.55,0 L74.61,100 L8.43,100 Z",diamond:"M50,0 L80,50 L50,100 L20,50 Z"},Ws="0 0 100 100",ha=100,Hs=16,g$=12,h$=16,fs=/([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g,f$=/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g,hd=Math.PI/4,y$=8,v$=Math.PI/18,x$=8,go=24,ho=[];function b$(){return[{closed:!0,nodes:[{p:{x:0,y:0},in:null,out:null},{p:{x:1,y:0},in:null,out:null},{p:{x:1,y:1},in:null,out:null},{p:{x:0,y:1},in:null,out:null}]}]}function ys(e,t){return ln(e,n=>({x:(n.x-t.x)/t.width,y:(n.y-t.y)/t.height}))}function S$(e){const t=Si(e),n=t.maxX-t.minX,i=t.maxY-t.minY;return!isFinite(n)||!isFinite(i)||n<=0||i<=0?e:ln(e,o=>({x:(o.x-t.minX)/n,y:(o.y-t.minY)/i}))}function w$(e,t){if(!(t.width>0)||!(t.height>0))return e;const n=Math.min(t.width,t.height),i=(t.width-n)/2,o=(t.height-n)/2;return ln(e,r=>({x:(i+r.x*n)/t.width,y:(o+r.y*n)/t.height}))}function fd(e,t,n,i,o,r){let l=[];if(t&&t.length)l=ys(t,i);else{const d=e.trim();if(d&&/^[Mm]/.test(d)){const c=Li(d);c.length&&(l=n==="viewbox"?ys(c,i):S$(c))}if(!l.length){const c=o!=="custom"?Ml[o]:void 0;c?l=ys(Li(c),El):l=b$()}}return o==="circle"?w$(l,r):l}function yd(e,t){return!(t.width>0)||!(t.height>0)||!e.length?"":No(ln(e,n=>({x:n.x*t.width,y:n.y*t.height})))}function Os(e){const t=e==="rectangle"||e==="custom"?void 0:Ml[e];return t?So(yr(Li(t)),El):[s$([[0,0],[1,0],[1,1],[0,1]])]}function $$(e){const t=e.match(f$);return t?t.map(Number).filter(n=>!Number.isNaN(n)):[]}function $n(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ds(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function cn(e){return{x:e.x,y:e.y}}function C$(e){return{p:cn(e.p),in:e.in?cn(e.in):null,out:e.out?cn(e.out):null}}function zn(e){return e.map(t=>({closed:t.closed,nodes:t.nodes.map(C$)}))}function ln(e,t){return e.map(n=>({closed:n.closed,nodes:n.nodes.map(i=>({p:t(i.p),in:i.in?t(i.in):null,out:i.out?t(i.out):null}))}))}function vd(e,t,n,i=n){return ln(e,o=>({x:t.x+(o.x-t.x)*n,y:t.y+(o.y-t.y)*i}))}function T$(e,t,n,i,o,r,l){let d=Math.abs(t),c=Math.abs(n);if(!d||!c||e.x===l.x&&e.y===l.y)return[{c1:cn(e),c2:cn(l),p:cn(l)}];const u=i*Math.PI/180,p=Math.cos(u),x=Math.sin(u),v=(e.x-l.x)/2,m=(e.y-l.y)/2,h=p*v+x*m,y=-x*v+p*m,b=h*h/(d*d)+y*y/(c*c);if(b>1){const Z=Math.sqrt(b);d*=Z,c*=Z}const C=o===r?-1:1,S=d*d*y*y+c*c*h*h,w=Math.max(0,d*d*c*c-S),D=S===0?0:C*Math.sqrt(w/S),_=D*d*y/c,z=-D*c*h/d,H=p*_-x*z+(e.x+l.x)/2,L=x*_+p*z+(e.y+l.y)/2,V=Math.atan2((y-z)/c,(h-_)/d);let E=Math.atan2((-y-z)/c,(-h-_)/d)-V;!r&&E>0&&(E-=Math.PI*2),r&&E<0&&(E+=Math.PI*2);const F=Math.max(1,Math.ceil(Math.abs(E)/(Math.PI/2))),W=E/F,g=4/3*Math.tan(W/4),M=(Z,T)=>({x:H+p*d*Z-x*c*T,y:L+x*d*Z+p*c*T}),R=[];let G=V;for(let Z=0;Z<F;Z+=1){const T=G+W,j=Math.cos(G),Y=Math.sin(G),le=Math.cos(T),se=Math.sin(T);R.push({c1:M(j-g*Y,Y+g*j),c2:M(le+g*se,se-g*le),p:Z===F-1?cn(l):M(le,se)}),G=T}return R}function Li(e){const t=(e??"").trim();if(!t)return[];const n=[];let i=[],o=!1,r={x:0,y:0},l={x:0,y:0},d=null,c=null;const u=()=>{if(o&&i.length>2){const m=i[0],h=i[i.length-1];Math.abs(m.p.x-h.p.x)<1e-6&&Math.abs(m.p.y-h.p.y)<1e-6&&(m.in=h.in??m.in,i.pop())}i.length>1&&n.push({nodes:i,closed:o}),i=[],o=!1},p=(m,h)=>{i.push({p:m,in:Vn(h??null,m),out:null}),r=m},x=m=>{if(!i.length)return;const h=i[i.length-1];h.out=Vn(m,h.p)};fs.lastIndex=0;let v=fs.exec(t);for(;v!==null;){const m=v[1],h=m.toUpperCase(),y=m!==h,b=$$(v[2]),C=S=>y?{x:r.x+b[S],y:r.y+b[S+1]}:{x:b[S],y:b[S+1]};if(h==="Z")o=!0,u(),r=cn(l),d=null,c=null;else if(h==="M"){for(let S=0;S+1<b.length;S+=2){const w=C(S);S===0&&(u(),l=cn(w)),p(w)}d=null,c=null}else if(h==="L"){for(let S=0;S+1<b.length;S+=2)p(C(S));d=null,c=null}else if(h==="H"){for(const S of b)p({x:y?r.x+S:S,y:r.y});d=null,c=null}else if(h==="V"){for(const S of b)p({x:r.x,y:y?r.y+S:S});d=null,c=null}else if(h==="C"){for(let S=0;S+5<b.length;S+=6){const w=C(S),D=C(S+2),_=C(S+4);x(w),p(_,D),d=D}c=null}else if(h==="S"){for(let S=0;S+3<b.length;S+=4){const w=d?Ds(d,r):cn(r),D=C(S),_=C(S+2);x(w),p(_,D),d=D}c=null}else if(h==="Q")for(let S=0;S+3<b.length;S+=4){const w=C(S),D=C(S+2);x($n(r,w,2/3)),p(D,$n(D,w,2/3)),c=w,d=null}else if(h==="T")for(let S=0;S+1<b.length;S+=2){const w=c?Ds(c,r):cn(r),D=C(S);x($n(r,w,2/3)),p(D,$n(D,w,2/3)),c=w,d=null}else if(h==="A")for(let S=0;S+6<b.length;S+=7){const w=y?{x:r.x+b[S+5],y:r.y+b[S+6]}:{x:b[S+5],y:b[S+6]};for(const D of T$(r,b[S],b[S+1],b[S+2],b[S+3]!==0,b[S+4]!==0,w))x(D.c1),p(D.p,D.c2);d=null,c=null}v=fs.exec(t)}return u(),n}function On(e){return`${Number(e.toFixed(2))}`}function Vn(e,t){return!e||Math.abs(e.x-t.x)<1e-6&&Math.abs(e.y-t.y)<1e-6?null:e}function lp(e){return!!(Vn(e.in,e.p)||Vn(e.out,e.p))}function Bo(e,t){return!Vn(e.out,e.p)&&!Vn(t.in,t.p)}function xd(e,t){if(Bo(e,t))return`L${On(t.p.x)},${On(t.p.y)}`;const n=Vn(e.out,e.p)??e.p,i=Vn(t.in,t.p)??t.p;return`C${On(n.x)},${On(n.y)} ${On(i.x)},${On(i.y)} ${On(t.p.x)},${On(t.p.y)}`}function No(e){const t=[];for(const n of e){if(n.nodes.length<2)continue;const[i,...o]=n.nodes;t.push(`M${On(i.p.x)},${On(i.p.y)}`);let r=i;for(const l of o)t.push(xd(r,l)),r=l;if(n.closed){const l=xd(r,i);l.charAt(0)==="C"&&t.push(l),t.push("Z")}}return t.join(" ")}function cp(e){const t=[];for(let n=0;n+1<e.nodes.length;n+=1)t.push({from:e.nodes[n],to:e.nodes[n+1],index:n});if(e.closed&&e.nodes.length>2){const n=e.nodes.length-1;t.push({from:e.nodes[n],to:e.nodes[0],index:n})}return t}function zs(e,t,n){if(Bo(e,t))return $n(e.p,t.p,n);const i=e.out??e.p,o=t.in??t.p,r=1-n,l=r*r*r,d=3*r*r*n,c=3*r*n*n,u=n*n*n;return{x:l*e.p.x+d*i.x+c*o.x+u*t.p.x,y:l*e.p.y+d*i.y+c*o.y+u*t.p.y}}function yr(e){const t=[];for(const n of e){if(n.nodes.length<2)continue;const i=[];for(const o of cp(n)){if(Bo(o.from,o.to)){i.push(cn(o.from.p));continue}for(let r=0;r<Hs;r+=1)i.push(zs(o.from,o.to,r/Hs))}n.closed||i.push(cn(n.nodes[n.nodes.length-1].p)),i.length>2&&t.push(i)}return t}function Si(e){let t=1/0,n=1/0,i=-1/0,o=-1/0;for(const r of yr(e))for(const l of r)l.x<t&&(t=l.x),l.x>i&&(i=l.x),l.y<n&&(n=l.y),l.y>o&&(o=l.y);return{minX:t,minY:n,maxX:i,maxY:o}}function L$(e){const t=Si(e);return!isFinite(t.minX)||!isFinite(t.maxX)||!isFinite(t.minY)||!isFinite(t.maxY)?null:{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}}function dp(e,t,n){const i={x:(n.x-e.x)/6,y:(n.y-e.y)/6};return{in:{x:t.x-i.x,y:t.y-i.y},out:{x:t.x+i.x,y:t.y+i.y}}}function up(e){return e.filter(t=>t.length>2).map(t=>{if(t.length<=g$)return{closed:!0,nodes:t.map(r=>({p:cn(r),in:null,out:null}))};const n=Math.max(1,Math.round(t.length/h$)),i=[];for(let r=0;r<t.length;r+=n)i.push(t[r]);const o=i.length;return{closed:!0,nodes:i.map((r,l)=>({p:cn(r),...dp(i[(l-1+o)%o],r,i[(l+1)%o])}))}})}function pp(e,t,n=1){if(!e.length)return!1;const i=Si(e);if(!isFinite(i.minX)||!isFinite(i.maxX))return!1;const o=i.maxX-i.minX,r=i.maxY-i.minY;if(o<=t.width*2.5&&r<=t.height*2.5)return!1;const l=Math.max(n,t.width*.5),d=Math.max(n,t.height*.5);return i.minX<t.x-l||i.minY<t.y-d||i.maxX>t.x+t.width+l||i.maxY>t.y+t.height+d}function I$(e,t,n,i,o,r,l){const d=t.width>0?n.width/t.width:1,c=t.height>0?n.height/t.height:1;return!(r>0)||!(l>0)||!(d>0)||!(c>0)?e:ln(e,u=>{const p=i+(u.x-t.x)*r,x=o+(u.y-t.y)*l;return{x:t.x+p/d,y:t.y+x/c}})}function R$(e,t){if(!e.length)return e;const n=Si(e),i=n.maxX-n.minX,o=n.maxY-n.minY;if(!(i>0)||!(o>0)||n.minX>=t.x-1e-6&&n.minY>=t.y-1e-6&&n.maxX<=t.x+t.width+1e-6&&n.maxY<=t.y+t.height+1e-6)return e;const l=Math.min(t.width/i,t.height/o),d=t.x+(t.width-i*l)/2,c=t.y+(t.height-o*l)/2;return ln(e,u=>({x:d+(u.x-n.minX)*l,y:c+(u.y-n.minY)*l}))}function mp(e){const t={x:0,y:0,width:ha,height:ha},n=e!=="custom"?Ml[e]:void 0,i=n?ln(Li(n),r=>({x:r.x/100*t.width+t.x,y:r.y/100*t.height+t.y})):ln(up(Os("rectangle")),r=>({x:r.x*t.width+t.x,y:r.y*t.height+t.y})),o=R$(i,t);return{shape:e,customPath:No(o),pathFit:"viewbox",pathViewBox:Ws}}function Vr(e,t){return t>0?Math.round(e/t)*t:e}function P$(e,t,n,i){var u;const o=(u=e[t])==null?void 0:u.nodes[n];if(!o)return e;const r=i.x-o.p.x,l=i.y-o.p.y,d=zn(e),c=d[t].nodes[n];return c.p={x:o.p.x+r,y:o.p.y+l},c.in&&(c.in={x:c.in.x+r,y:c.in.y+l}),c.out&&(c.out={x:c.out.x+r,y:c.out.y+l}),d}function bd(e,t,n,i){var r;if(!t.length)return e;const o=zn(e);for(const{contour:l,node:d}of t){const c=(r=o[l])==null?void 0:r.nodes[d];c&&(c.p={x:c.p.x+n,y:c.p.y+i},c.in&&(c.in={x:c.in.x+n,y:c.in.y+i}),c.out&&(c.out={x:c.out.x+n,y:c.out.y+i}))}return o}function E$(e,t){const n=new Map;for(const{contour:o,node:r}of t){const l=n.get(o)??[];l.push(r),n.set(o,l)}let i=e;return n.forEach((o,r)=>{const l=[...o].sort((d,c)=>c-d);for(const d of l)i=gp(i,r,d)}),i}function M$(e,t,n,i,o,r){var u;if(!((u=e[t])==null?void 0:u.nodes[n]))return e;const d=zn(e),c=d[t].nodes[n];if(c[i]=cn(o),r){const p=i==="in"?"out":"in";c[p]=Ds(o,c.p)}return d}function k$(e,t,n,i){var l;const o=(l=e[t])==null?void 0:l.nodes[n];if(!o||!o[i])return e;const r=zn(e);return r[t].nodes[n][i]=null,r}function A$(e,t,n,i){const o=e[t];if(!o)return{contours:e,nodeIndex:-1};const r=o.nodes[n],l=o.nodes[(n+1)%o.nodes.length];if(!r||!l)return{contours:e,nodeIndex:-1};const d=zn(e),c=d[t].nodes,u=n+1;if(Bo(r,l))return c.splice(u,0,{p:$n(r.p,l.p,i),in:null,out:null}),{contours:d,nodeIndex:u};const p=r.out??r.p,x=l.in??l.p,v=$n(r.p,p,i),m=$n(p,x,i),h=$n(x,l.p,i),y=$n(v,m,i),b=$n(m,h,i),C=$n(y,b,i),S=(n+1)%o.nodes.length;return c[n].out=v,c[S].in=h,c.splice(u,0,{p:C,in:y,out:b}),{contours:d,nodeIndex:u}}function gp(e,t,n){const i=e[t];if(!i||i.nodes.length<=3)return e;const o=zn(e);return o[t].nodes.splice(n,1),o}function Sd(e,t,n){const i=e[t];if(!(i==null?void 0:i.nodes[n]))return e;const r=zn(e),l=r[t].nodes,d=l[n],c=l.length,u=(n-1+c)%c,p=(n+1)%c,x=!!Vn(l[u].out,l[u].p),v=!!Vn(l[p].in,l[p].p);if(lp(d)||x||v)return d.in=null,d.out=null,l[u].out=null,l[p].in=null,r;const m=dp(l[u].p,d.p,l[p].p);return d.in=m.in,d.out=m.out,r}function F$(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,l=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)),d={x:t.x+i*l,y:t.y+o*l};return{t:l,distance:Math.hypot(e.x-d.x,e.y-d.y),point:d}}function wd(e,t){let n=null;return e.forEach((i,o)=>{for(const r of cp(i)){const l=Bo(r.from,r.to)?1:Hs;for(let d=0;d<l;d+=1){const c=d/l,u=(d+1)/l,p=F$(t,zs(r.from,r.to,c),zs(r.from,r.to,u));(!n||p.distance<n.distance)&&(n={contour:o,segment:r.index,t:c+(u-c)*p.t,distance:p.distance,point:p.point})}}}),n}function N$(e,t){const n=[];return e.forEach((i,o)=>{i.nodes.forEach((r,l)=>{o===t.contour&&l===t.node||n.push(r.p)})}),n}function $d(e,t,n){const i=t.filter((r,l)=>isFinite(r)&&t.findIndex(d=>Math.abs(d-r)<1e-6)===l),o=i.map(r=>({value:r,axis:r,from:null}));for(const r of e)o.push({value:r[n],axis:null,from:r});for(const r of i)for(const l of e)o.push({value:r*2-l[n],axis:r,from:l});return o}function Cd(e,t,n,i,o){const r=i(t)[n];let l=null,d=1/0;for(const c of e){const u=n==="x"?{x:c.value,y:t.y}:{x:t.x,y:c.value},p=Math.abs(i(u)[n]-r);p>o||l&&p>=d||(l=c,d=p)}return l}function _$(e,t){return e.length===t.length&&e.every((n,i)=>n.kind===t[i].kind&&n.a.x===t[i].a.x&&n.a.y===t[i].a.y&&n.b.x===t[i].b.x&&n.b.y===t[i].b.y)}function W$(e){const t=Math.PI*2;return((e+Math.PI)%t+t)%t-Math.PI}function Bs(e,t){const n=t.x-e.x,i=t.y-e.y,o=Math.hypot(n,i);return o<1e-6?null:{x:n/o,y:i/o}}function H$(e,t){const n=Bs(e,t);return n?{kind:"align",a:{x:e.x-n.x*go,y:e.y-n.y*go},b:{x:t.x+n.x*go,y:t.y+n.y*go}}:{kind:"align",a:e,b:t}}function js(e,t,n){return t==="x"?{kind:"center",a:{x:e,y:0},b:{x:e,y:n.height}}:{kind:"center",a:{x:0,y:e},b:{x:n.width,y:e}}}function Td(e,t,n,i,o){if(e.axis===null)return H$(n,o(e.from??n));const r=t==="x"?{x:e.axis,y:0}:{x:0,y:e.axis};return js(o(r)[t],t,i)}function O$(e,t,n,i,o){const r=[],l=o(e);return t&&e.x===t.value&&r.push(Td(t,"x",l,i,o)),n&&e.y===n.value&&r.push(Td(n,"y",l,i,o)),r}function D$(e,t,n,i){const o=e==null?void 0:e.nodes[t];if(!e||!o)return null;const r=i(o.p),l=n==="in"?o.out:o.in;if(l)return Bs(i(l),r);const d=e.nodes.length,c=t+(n==="in"?1:-1);if(!e.closed&&(c<0||c>=d))return null;const u=e.nodes[(c+d)%d];if(!u)return null;const p=(n==="in"?u.in:u.out)??u.p;return Bs(i(p),r)}function z$(e,t,n,i,o,r,l){const d=r(t),c=r(e),u=c.x-d.x,p=c.y-d.y,x=Math.hypot(u,p);if(x<1e-6)return{point:e,guides:ho};const v=Math.atan2(p,u),m=Math.round(v/hd)*hd;let h=o?m:null,y=!1;if(!o){const z=[];n&&z.push({angle:Math.atan2(n.y,n.x),smooth:!0}),z.push({angle:m,smooth:!1});for(const H of z){const L=W$(H.angle-v);if(!(Math.abs(L)>v$)&&!(Math.abs(Math.sin(L))*x>y$)){h=H.angle,y=H.smooth;break}}}const b=i!==null&&i>0&&Math.abs(x-i)<=x$;if(h===null&&!b)return{point:e,guides:ho};const C=h??v,S=b?i:x,w={x:Math.cos(C),y:Math.sin(C)},D=S+(h===null?0:go),_=b?S:y?go:0;return{point:l({x:d.x+w.x*S,y:d.y+w.y*S}),guides:[{kind:"angle",a:{x:d.x-w.x*_,y:d.y-w.y*_},b:{x:d.x+w.x*D,y:d.y+w.y*D}}]}}const Vs=.1,Gs=8,B$=4,Ld=10,fa=(e,t)=>{switch(t){case"nw":return{x:e.minX,y:e.minY};case"ne":return{x:e.maxX,y:e.minY};case"se":return{x:e.maxX,y:e.maxY};case"sw":return{x:e.minX,y:e.maxY}}},hp=e=>{switch(e){case"nw":return"se";case"ne":return"sw";case"se":return"nw";case"sw":return"ne"}},Xs=(e,t)=>{const n=fa(e,t),i=t==="nw"||t==="sw"?-1:1,o=t==="nw"||t==="ne"?-1:1;return{x:n.x+i*Ld,y:n.y+o*Ld}},qs=(e,t)=>!(t.width>0)||!(t.height>0)||!(e.width>0)||!(e.height>0)?1:Math.max(e.width/t.width,e.height/t.height),Gi=(e,t,n)=>{const i=qs(e,t)*n;return{width:t.width*i,height:t.height*i}},Dn=(e,t,n)=>(e-t)*n,fo=(e,t,n,i)=>{const o=e-t;if(Math.abs(o)<1e-6)return .5;const r=n/o;return(i==null?void 0:i.clamp)===!1?r:Math.abs(o)<B$?.5:ga(r)},j$=(e,t,n,i,o,r)=>{const l=Gi(e,n,r),d=e.x+Dn(e.width,l.width,i),c=e.y+Dn(e.height,l.height,o),u=qs(e,n),p=qs(t,n),x=Math.min(Gs,Math.max(Vs,p>0?r*(u/p):r)),v=Gi(t,n,x);return{focalX:fo(t.width,v.width,d-t.x,{clamp:!1}),focalY:fo(t.height,v.height,c-t.y,{clamp:!1}),scale:x}},Id=1.08,Gr=14,Xr=8;function V$({P:e,box:t,bounds:n,natural:i,imageUrl:o,maskPath:r,stage:l,onStageChange:d,focalX:c,focalY:u,scale:p,onChange:x,onCommit:v}){const m=s.useRef(null),h=`pretext-image-ghost-${s.useId().replace(/:/g,"")}`,y=s.useRef(null),b=s.useRef(null),C=s.useRef({focalX:c,focalY:u,scale:p});C.current={focalX:c,focalY:u,scale:p};const S=l==="image";s.useEffect(()=>{var W;S&&((W=m.current)==null||W.focus({preventScroll:!0}))},[S]);const w=s.useCallback((W,g)=>{var R;const M=(R=m.current)==null?void 0:R.getBoundingClientRect();return!M||M.width<=0||M.height<=0?{x:0,y:0}:{x:(W-M.left)/M.width*t.width,y:(g-M.top)/M.height*t.height}},[t.width,t.height]),D=W=>{var M,R;if(!i)return;W.stopPropagation(),W.preventDefault(),(M=m.current)==null||M.focus({preventScroll:!0});const g=Gi(n,i,p);y.current={pointerId:W.pointerId,origin:w(W.clientX,W.clientY),startX:Dn(n.width,g.width,c),startY:Dn(n.height,g.height,u),width:g.width,height:g.height,moved:!1},(R=m.current)==null||R.setPointerCapture(W.pointerId)},_=(W,g)=>{var le,se;if(!i)return;W.stopPropagation(),W.preventDefault(),(le=m.current)==null||le.focus({preventScroll:!0});const M=Gi(n,i,p),R=Dn(n.width,M.width,c),G=Dn(n.height,M.height,u),Z={minX:R,minY:G,maxX:R+M.width,maxY:G+M.height},T=fa(Z,hp(g)),j=fa(Z,g),Y=Math.hypot(j.x-T.x,j.y-T.y);!isFinite(Y)||Y<=0||(b.current={pointerId:W.pointerId,anchor:T,startDistance:Y,startScale:p,startX:R,startY:G,moved:!1},(se=m.current)==null||se.setPointerCapture(W.pointerId))},z=W=>{if(!i)return;const g=b.current;if(g&&W.pointerId===g.pointerId){W.stopPropagation(),W.preventDefault();const R=w(W.clientX,W.clientY),G={x:R.x-n.x,y:R.y-n.y},Z=Math.hypot(G.x-g.anchor.x,G.y-g.anchor.y),T=Math.min(Gs,Math.max(Vs,g.startScale*(Z/g.startDistance)));if(!g.moved&&Math.abs(T-g.startScale)<1e-4)return;g.moved=!0;const j=T/g.startScale,Y=g.anchor.x+(g.startX-g.anchor.x)*j,le=g.anchor.y+(g.startY-g.anchor.y)*j,se=Gi(n,i,T);x({focalX:fo(n.width,se.width,Y),focalY:fo(n.height,se.height,le),scale:T});return}const M=y.current;if(M&&W.pointerId===M.pointerId){W.stopPropagation(),W.preventDefault();const R=w(W.clientX,W.clientY),G=R.x-M.origin.x,Z=R.y-M.origin.y;if(!M.moved&&G===0&&Z===0)return;M.moved=!0,x({focalX:fo(n.width,M.width,M.startX+G),focalY:fo(n.height,M.height,M.startY+Z),scale:p})}},H=W=>{var R,G;const g=y.current;if(g&&W.pointerId===g.pointerId){y.current=null,W.stopPropagation(),(R=m.current)!=null&&R.hasPointerCapture(g.pointerId)&&m.current.releasePointerCapture(g.pointerId),g.moved&&v(C.current);return}const M=b.current;M&&W.pointerId===M.pointerId&&(b.current=null,W.stopPropagation(),(G=m.current)!=null&&G.hasPointerCapture(M.pointerId)&&m.current.releasePointerCapture(M.pointerId),M.moved&&v(C.current))},L=W=>{if(W.key==="Escape"){W.stopPropagation(),d("none");return}if(W.key==="="||W.key==="+"||W.key==="-"||W.key==="_"){W.preventDefault(),W.stopPropagation();const g=W.key==="="||W.key==="+",M=Math.min(Gs,Math.max(Vs,p*(g?Id:1/Id))),R={focalX:c,focalY:u,scale:M};x(R),v(R)}},V=["nw","ne","se","sw"],$={minX:n.x,minY:n.y,maxX:n.x+n.width,maxY:n.y+n.height},E=s.useMemo(()=>{const W=i??{width:n.width,height:n.height},g=Gi(n,W,p);return!(g.width>0)||!(g.height>0)?null:{x:n.x+Dn(n.width,g.width,c),y:n.y+Dn(n.height,g.height,u),width:g.width,height:g.height}},[i,n.x,n.y,n.width,n.height,c,u,p]),F=E?{minX:E.x,minY:E.y,maxX:E.x+E.width,maxY:E.y+E.height}:$;return a.jsxs("svg",{ref:m,className:`${e}-editor${S?` ${e}-editor-armed`:""}`,width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,tabIndex:0,onKeyDown:L,onPointerMove:z,onPointerUp:H,onPointerCancel:H,onLostPointerCapture:H,"data-pretext-image-editor":!0,children:[a.jsx("rect",{className:`${e}-editor-surface`,width:t.width,height:t.height,onPointerDown:()=>d("none")}),S&&o&&E&&r&&a.jsxs(a.Fragment,{children:[a.jsx("defs",{children:a.jsxs("mask",{id:h,maskUnits:"userSpaceOnUse",x:E.x,y:E.y,width:E.width,height:E.height,children:[a.jsx("rect",{x:E.x,y:E.y,width:E.width,height:E.height,fill:"#FFFFFF"}),a.jsx("path",{d:r,fillRule:"evenodd",fill:"#000000"})]})}),a.jsx("image",{className:`${e}-editor-ghost`,href:o??void 0,x:E.x,y:E.y,width:E.width,height:E.height,preserveAspectRatio:"none",mask:`url(#${h})`}),a.jsx("rect",{className:`${e}-editor-image-bounds`,x:E.x,y:E.y,width:E.width,height:E.height})]}),S&&a.jsxs(a.Fragment,{children:[a.jsx("rect",{className:`${e}-editor-bbox`,x:n.x,y:n.y,width:n.width,height:n.height}),a.jsx("rect",{className:`${e}-editor-body`,x:n.x,y:n.y,width:n.width,height:n.height,onPointerDown:D}),V.map(W=>{const g=Xs(F,W),M=W==="ne"||W==="sw";return a.jsxs("g",{children:[a.jsx("rect",{className:`${e}-editor-scale`,x:g.x-Xr/2,y:g.y-Xr/2,width:Xr,height:Xr}),a.jsx("rect",{className:`${e}-editor-scale-grab${M?` ${e}-editor-scale-grab-nesw`:""}`,x:g.x-Gr/2,y:g.y-Gr/2,width:Gr,height:Gr,onPointerDown:R=>_(R,W)})]},W)})]})]})}const Us=10,G$=Us*2,Hn=7,X$=4,ao=9,q$=3.5,Rd=1.08,U$=.05,qr=14,K$=1,Ur=14,Kr=8;function Y$({P:e,box:t,viewBox:n,contours:i,snap:o,stretchToBox:r,uniformStretch:l=!1,stage:d,onStageChange:c,onSelectionChange:u,onChange:p,onCommit:x}){const v=s.useRef(null),m=s.useRef(null),h=s.useRef(i);h.current=i;const y=s.useRef(null),b=s.useRef(null),C=s.useRef(null),S=s.useRef(null),[w,D]=s.useState([]),[_,z]=s.useState(ho),[H,L]=s.useState(null),V=s.useCallback(f=>{z(X=>_$(X,f)?X:f)},[]),$=d==="shape";s.useEffect(()=>{var f;$&&((f=v.current)==null||f.focus({preventScroll:!0}))},[$]),s.useEffect(()=>{$||D(f=>f.length?[]:f)},[$]);const E=w.length>0;s.useEffect(()=>{u==null||u(E)},[E,u]),s.useEffect(()=>()=>u==null?void 0:u(!1),[u]);const F=n.width>0?t.width/n.width:1,W=n.height>0?t.height/n.height:1,g=Math.min(F,W),M=r&&l?g:F,R=r&&l?g:W,G=r&&l?(t.width-n.width*g)/2:0,Z=r&&l?(t.height-n.height*g)/2:0,T=s.useCallback(f=>r?{x:G+(f.x-n.x)*M,y:Z+(f.y-n.y)*R}:{x:f.x-n.x,y:f.y-n.y},[r,n,M,R,G,Z]),j=s.useCallback(f=>r?{x:n.x+(M>0?(f.x-G)/M:0),y:n.y+(R>0?(f.y-Z)/R:0)}:{x:n.x+f.x,y:n.y+f.y},[r,n,M,R,G,Z]),Y=s.useMemo(()=>j({x:t.width/2,y:t.height/2}),[j,t.width,t.height]),le=s.useCallback((f,X)=>{var U;const N=(U=v.current)==null?void 0:U.getBoundingClientRect();if(!N||N.width<=0||N.height<=0)return{x:0,y:0};if(r){const me=(f-N.left)/N.width*t.width,K=(X-N.top)/N.height*t.height;return{x:n.x+(M>0?(me-G)/M:0),y:n.y+(R>0?(K-Z)/R:0)}}return{x:n.x+(f-N.left),y:n.y+(X-N.top)}},[r,n,t.width,t.height,M,R,G,Z]),se=s.useCallback((f,X)=>{var U;const N=(U=v.current)==null?void 0:U.getBoundingClientRect();return!N||N.width<=0||N.height<=0?{x:0,y:0}:{x:(f-N.left)/N.width*t.width,y:(X-N.top)/N.height*t.height}},[t.width,t.height]),k=s.useCallback((f,X)=>{const N=l&&!(X!=null&&X.preserveShape)?I$(f,n,t,G,Z,M,R):f;x(N,X)},[x,l,n,t,G,Z,M,R]),re=s.useCallback(()=>{L(null)},[]),q=s.useCallback((f,X,N)=>{if(!N||y.current||b.current||C.current||S.current){re();return}const U=se(f,X),me=ln(h.current,T);for(const te of me)for(const Ae of te.nodes)if(Math.hypot(Ae.p.x-U.x,Ae.p.y-U.y)<=ao){re();return}const K=wd(me,U);if(!K||K.distance>Us){re();return}const I=me[K.contour],ie=I==null?void 0:I.nodes[K.segment],oe=I==null?void 0:I.nodes[(K.segment+1)%((I==null?void 0:I.nodes.length)??1)],B=!!(ie&&oe&&!Bo(ie,oe));L(te=>te&&te.curved===B&&Math.hypot(te.point.x-K.point.x,te.point.y-K.point.y)<.25?te:{point:K.point,curved:B})},[se,T,re]),ce=f=>{var Fe;const X=f.metaKey||f.ctrlKey,N=C.current;if(N&&f.pointerId===N.pointerId){if(f.stopPropagation(),f.preventDefault(),N.startDistance<=0)return;const et=le(f.clientX,f.clientY),Ue=Math.hypot(et.x-N.origin.x,et.y-N.origin.y),nt=Math.max(U$,Ue/N.startDistance);if(!N.moved&&Math.abs(nt-1)<1e-4)return;N.moved=!0,p(vd(N.startContours,N.origin,nt));return}const U=b.current;if(U&&f.pointerId===U.pointerId){f.stopPropagation(),f.preventDefault();const et=le(f.clientX,f.clientY),{bbox:Ue}=U,nt=Ue.maxX-Ue.minX,tt=Ue.maxY-Ue.minY,Ve=et.x-U.origin.x,fe=et.y-U.origin.y;let He=Ve,Be=fe;if(isFinite(nt)&&isFinite(tt))if(r){let Ce=n.x,De=n.x+n.width,Xe=n.y,ge=n.y+n.height;l&&(M>0&&(Ce=n.x+(0-G)/M,De=n.x+(t.width-G)/M),R>0&&(Xe=n.y+(0-Z)/R,ge=n.y+(t.height-Z)/R));const Me=Math.min(Ce,De-nt),ze=Math.max(Ce,De-nt),Re=Math.min(Xe,ge-tt),xe=Math.max(Xe,ge-tt),Ie=Math.min(ze,Math.max(Me,Ue.minX+Ve)),Ke=Math.min(xe,Math.max(Re,Ue.minY+fe));He=Ie-Ue.minX,Be=Ke-Ue.minY}else{const Ce=Ue.minX-n.x,De=Ue.minY-n.y,Xe=Math.min(0,t.width-nt),ge=Math.max(0,t.width-nt),Me=Math.min(0,t.height-tt),ze=Math.max(0,t.height-tt),Re=Math.min(ge,Math.max(Xe,Ce+Ve)),xe=Math.min(ze,Math.max(Me,De+fe));He=Re-Ce,Be=xe-De}const Je=[];if(!X&&isFinite(nt)&&isFinite(tt)){const Ce=T({x:Ue.minX+nt/2+He,y:Ue.minY+tt/2+Be}),De={x:t.width/2,y:t.height/2};Math.abs(Ce.x-De.x)<=qr&&(He=Y.x-Ue.minX-nt/2,Je.push(js(De.x,"x",t))),Math.abs(Ce.y-De.y)<=qr&&(Be=Y.y-Ue.minY-tt/2,Je.push(js(De.y,"y",t)))}if(!U.moved&&He===0&&Be===0)return;U.moved=!0,V(Je.length?Je:ho),p(ln(U.startContours,Ce=>({x:Ce.x+He,y:Ce.y+Be})),{carryImage:!0});return}const me=S.current;if(me&&f.pointerId===me.pointerId){f.stopPropagation(),f.preventDefault();const et=le(f.clientX,f.clientY);let Ue=et.x-me.origin.x,nt=et.y-me.origin.y;if(f.shiftKey&&(Math.abs(Ue)>Math.abs(nt)?nt=0:Ue=0),!me.moved&&Ue===0&&nt===0)return;me.moved=!0,p(bd(me.startContours,me.selection,Ue,nt));return}const K=y.current;if(!K||f.pointerId!==K.pointerId){q(f.clientX,f.clientY,w.length>0||$);return}re(),f.stopPropagation(),f.preventDefault();const I=le(f.clientX,f.clientY);if(K.kind==="anchor"){const et={x:K.anchor.x+(I.x-K.origin.x),y:K.anchor.y+(I.y-K.origin.y)},Ue=X?[]:N$(h.current,{contour:K.contour,node:K.node}),nt=X||!K.center?[]:[K.center],tt=Cd($d(Ue,nt.map(He=>He.x),"x"),et,"x",T,qr),Ve=Cd($d(Ue,nt.map(He=>He.y),"y"),et,"y",T,qr),fe=X?et:{x:(tt==null?void 0:tt.value)??Vr(et.x,o),y:(Ve==null?void 0:Ve.value)??Vr(et.y,o)};if(f.shiftKey&&(Math.abs(fe.x-K.anchor.x)>Math.abs(fe.y-K.anchor.y)?fe.y=K.anchor.y:fe.x=K.anchor.x),!K.moved&&fe.x===K.anchor.x&&fe.y===K.anchor.y)return;K.moved=!0,V(O$(fe,tt,Ve,t,T)),p(P$(h.current,K.contour,K.node,fe));return}const ie=(Fe=h.current[K.contour])==null?void 0:Fe.nodes[K.node],oe=K.mirror&&!f.altKey,B=oe||X?null:K.kind==="in"?ie==null?void 0:ie.out:ie==null?void 0:ie.in,te=ie?T(ie.p):null,Ae=B?T(B):null,he=ie&&(!X||f.shiftKey)?z$(I,ie.p,oe||X?null:D$(h.current[K.contour],K.node,K.kind,T),te&&Ae?Math.hypot(Ae.x-te.x,Ae.y-te.y):null,f.shiftKey,T,j):{point:I,guides:ho},Q=he.guides.length?he.point:X?I:{x:Vr(I.x,o),y:Vr(I.y,o)},Ze=K.kind==="in"?ie==null?void 0:ie.in:ie==null?void 0:ie.out;!K.moved&&Ze&&Q.x===Ze.x&&Q.y===Ze.y||(K.moved=!0,V(he.guides),p(M$(h.current,K.contour,K.node,K.kind,Q,oe)))},J=f=>{V(ho);const X=C.current;if(X&&f.pointerId===X.pointerId){C.current=null,f.stopPropagation();const B=v.current;B!=null&&B.hasPointerCapture(X.pointerId)&&B.releasePointerCapture(X.pointerId),X.moved&&k(h.current,{preserveShape:!0});return}const N=b.current;if(N&&f.pointerId===N.pointerId){b.current=null,f.stopPropagation();const B=v.current;B!=null&&B.hasPointerCapture(N.pointerId)&&B.releasePointerCapture(N.pointerId),N.moved?k(h.current,{preserveShape:!0}):D([]);return}const U=S.current;if(U&&f.pointerId===U.pointerId){S.current=null,f.stopPropagation();const B=v.current;B!=null&&B.hasPointerCapture(U.pointerId)&&B.releasePointerCapture(U.pointerId),U.moved&&k(h.current);return}const me=y.current;if(!me||f.pointerId!==me.pointerId)return;y.current=null,f.stopPropagation();const K=v.current;K!=null&&K.hasPointerCapture(me.pointerId)&&K.releasePointerCapture(me.pointerId);const I=Math.hypot(f.clientX-me.clientOrigin.x,f.clientY-me.clientOrigin.y);if(me.moved||I>X$){me.moved&&k(h.current);return}if(!me.toggleOnRelease||f.type!=="pointerup")return;const oe=Sd(h.current,me.contour,me.node);oe!==h.current&&(p(oe),k(oe))},be=f=>{f.stopPropagation()},We=f=>{var X,N;f.stopPropagation(),f.preventDefault(),re(),(X=v.current)==null||X.focus({preventScroll:!0}),b.current={pointerId:f.pointerId,origin:le(f.clientX,f.clientY),startContours:zn(i),bbox:Si(i),moved:!1},(N=v.current)==null||N.setPointerCapture(f.pointerId)},ye=(f,X)=>{var I,ie;f.stopPropagation(),f.preventDefault(),re(),(I=v.current)==null||I.focus({preventScroll:!0}),D([]),c("shape");const N=Si(i),U=fa(N,hp(X)),me=Xs(N,X),K=Math.hypot(me.x-U.x,me.y-U.y);!isFinite(K)||K<=0||(C.current={pointerId:f.pointerId,corner:X,origin:U,startDistance:K,startContours:zn(i),moved:!1},(ie=v.current)==null||ie.setPointerCapture(f.pointerId))},ue=(f,X,N,U)=>{var I,ie,oe,B;f.stopPropagation(),f.preventDefault(),re(),(I=v.current)==null||I.focus({preventScroll:!0});const me=(ie=i[N])==null?void 0:ie.nodes[U];if(!me)return;if(f.altKey){const te=X==="anchor"?gp(i,N,U):k$(i,N,U,X);if(te===i)return;D(X==="anchor"?[]:[{contour:N,node:U}]),p(te),k(te);return}const K=f.metaKey||f.ctrlKey;if(X==="anchor"&&f.shiftKey&&!K){D(te=>te.some(Ae=>Ae.contour===N&&Ae.node===U)?te.filter(Ae=>!(Ae.contour===N&&Ae.node===U)):[...te,{contour:N,node:U}]);return}if(X==="anchor"&&!K&&w.length>1&&w.some(te=>te.contour===N&&te.node===U)){S.current={pointerId:f.pointerId,origin:le(f.clientX,f.clientY),startContours:zn(i),selection:w,moved:!1},(oe=v.current)==null||oe.setPointerCapture(f.pointerId);return}D([{contour:N,node:U}]),y.current={kind:X,contour:N,node:U,pointerId:f.pointerId,origin:le(f.clientX,f.clientY),clientOrigin:{x:f.clientX,y:f.clientY},anchor:me.p,center:L$(i),mirror:X!=="anchor"&&!!(me.in&&me.out),toggleOnRelease:K,moved:!1},(B=v.current)==null||B.setPointerCapture(f.pointerId)},ee=f=>{f.stopPropagation(),f.preventDefault(),re();const X=ln(i,T),N=wd(X,se(f.clientX,f.clientY));if(!N||N.distance>Us)return;const{contours:U,nodeIndex:me}=A$(i,N.contour,N.segment,N.t);me<0||(D([{contour:N.contour,node:me}]),p(U),k(U))},de=f=>{if(f.key==="="||f.key==="+"||f.key==="-"||f.key==="_"){f.preventDefault(),f.stopPropagation();const K=Si(i);if(!isFinite(K.minX)||!isFinite(K.maxX))return;const I={x:(K.minX+K.maxX)/2,y:(K.minY+K.maxY)/2},oe=f.key==="="||f.key==="+"?Rd:1/Rd,B=vd(i,I,oe);p(B),k(B,{preserveShape:!0});return}if(f.key==="Escape"){f.stopPropagation(),D([]),c("none");return}if(!w.length)return;if(f.key==="Backspace"||f.key==="Delete"){f.preventDefault(),f.stopPropagation();const K=E$(i,w);if(K===i)return;D([]),p(K),k(K);return}const X=o>0?o:K$,N=f.shiftKey?X*10:X,U={ArrowLeft:[-N,0],ArrowRight:[N,0],ArrowUp:[0,-N],ArrowDown:[0,N]}[f.key];if(!U)return;f.preventDefault(),f.stopPropagation();const me=bd(i,w,U[0],U[1]);p(me),k(me)},ne=s.useMemo(()=>No(ln(i,T)),[i,T]),Pe=s.useMemo(()=>Si(i),[i]),Te=T({x:Pe.minX,y:Pe.minY}),Oe={width:T({x:Pe.maxX,y:Pe.minY}).x-Te.x,height:T({x:Pe.minX,y:Pe.maxY}).y-Te.y},ve=$&&w.length===0&&isFinite(Pe.minX)&&isFinite(Pe.maxX)&&Pe.maxX>Pe.minX&&Pe.maxY>Pe.minY,Se=w.length>0||$,$e=Se;return a.jsxs("svg",{ref:v,className:`${e}-editor${Se?` ${e}-editor-armed`:""}`,width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,tabIndex:0,onKeyDown:de,onPointerDown:()=>{var f;return(f=v.current)==null?void 0:f.focus({preventScroll:!0})},onPointerMove:ce,onPointerLeave:re,onPointerUp:J,onPointerCancel:J,onLostPointerCapture:J,onContextMenu:f=>{f.preventDefault()},"data-pretext-path-editor":!0,"data-selection":"none",children:[a.jsx("rect",{className:`${e}-editor-surface`,width:t.width,height:t.height,onPointerDown:()=>{D([]),c("none")},onClick:ee}),$e&&a.jsx("path",{className:`${e}-editor-outline`,d:ne}),$e&&_.map((f,X)=>a.jsx("line",{className:`${e}-editor-snap ${e}-editor-snap-${f.kind}`,x1:f.a.x,y1:f.a.y,x2:f.b.x,y2:f.b.y},`${f.kind}-${X}`)),a.jsx("path",{ref:m,className:`${e}-editor-body`,d:ne,fillRule:"evenodd",onPointerDown:We,onClick:ee}),$e&&a.jsx("path",{className:`${e}-editor-hit`,d:ne,style:{strokeWidth:G$},onClick:ee}),$e&&H&&a.jsx("rect",{className:`${e}-editor-add-preview`,x:H.point.x-Hn/2,y:H.point.y-Hn/2,width:Hn,height:Hn,rx:H.curved?Hn/2:0}),$e&&i.map((f,X)=>f.nodes.map((N,U)=>{const me=w.some(I=>I.contour===X&&I.node===U),K=T(N.p);return a.jsxs("g",{children:[me&&w.length===1&&["in","out"].map(I=>{const ie=N[I];if(!ie)return null;const oe=T(ie);return a.jsxs("g",{children:[a.jsx("line",{className:`${e}-editor-handle-line`,x1:K.x,y1:K.y,x2:oe.x,y2:oe.y}),a.jsx("circle",{className:`${e}-editor-handle`,cx:oe.x,cy:oe.y,r:q$}),a.jsx("circle",{className:`${e}-editor-grab`,cx:oe.x,cy:oe.y,r:ao,onPointerDown:B=>ue(B,I,X,U),onClick:be})]},I)}),a.jsx("rect",{className:`${e}-editor-anchor${me?` ${e}-editor-anchor-selected`:""}`,x:K.x-Hn/2,y:K.y-Hn/2,width:Hn,height:Hn,rx:lp(N)?Hn/2:0}),a.jsx("rect",{className:`${e}-editor-grab`,x:K.x-ao,y:K.y-ao,width:ao*2,height:ao*2,onPointerDown:I=>ue(I,"anchor",X,U),onClick:be,onDoubleClick:I=>{I.stopPropagation(),I.preventDefault();const ie=Sd(i,X,U);p(ie),k(ie)}})]},`${X}-${U}`)})),ve&&a.jsxs("g",{children:[a.jsx("rect",{className:`${e}-editor-bbox`,x:Te.x,y:Te.y,width:Oe.width,height:Oe.height}),["nw","ne","se","sw"].map(f=>{const X=T(Xs(Pe,f)),N=f==="ne"||f==="sw";return a.jsxs("g",{children:[a.jsx("rect",{className:`${e}-editor-scale`,x:X.x-Kr/2,y:X.y-Kr/2,width:Kr,height:Kr}),a.jsx("rect",{className:`${e}-editor-scale-grab${N?` ${e}-editor-scale-grab-nesw`:""}`,x:X.x-Ur/2,y:X.y-Ur/2,width:Ur,height:Ur,onPointerDown:U=>ye(U,f),onClick:be})]},f)})]})]})}const Z$=4e3,J$=/^(?:https?:|mailto:|tel:)/i;function fp(e){return!!e&&typeof e=="object"&&e.type==="link"}function Q$(e){if(!e)return;const t=e.replace(/\s+/g,"");if(!(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!J$.test(t)))return t}function eC(e){const t=[];return e.forEach((n,i)=>{const o=(r,l,d)=>{for(const c of r){if(fp(c)){o(c.children??[],Q$(c.value),c.target);continue}const u=c,p=(u==null?void 0:u.text)??"";if(p.trim())for(const x of p.split(/\s+/))x&&t.push({text:x,leaf:u,href:l,target:d,para:i})}};o((n==null?void 0:n.children)??[])}),t}function Pd(e){return{...e.fontFamily&&{fontFamily:Oo(e.fontFamily)},...e.fontWeight&&{fontWeight:e.fontWeight},...e.fontStyle&&{fontStyle:e.fontStyle},...e.textDecoration&&{textDecoration:e.textDecoration},...e.textTransform&&{textTransform:e.textTransform},...e.fontVariant&&{fontVariant:e.fontVariant},...e.verticalAlign&&{verticalAlign:e.verticalAlign,lineHeight:"0px"}}}function tC(e){return e.map(t=>{const n=[],i=o=>{for(const r of o){if(fp(r)){i(r.children??[]);continue}n.push((r==null?void 0:r.text)??"")}};return i((t==null?void 0:t.children)??[]),n.join("")})}function Ed(e){const{tokens:t,widths:n,rings:i,mode:o,align:r,scale:l,width:d,height:c,allowOverflow:u,capInset:p,capLines:x}=e,v=e.lineHeight*l,m=e.spaceWidth*l,h=[];if(!t.length||d<=0||v<=0)return{segments:h,placed:0,height:0,capLeft:0,capTop:0};const y=Math.max(1,m*.5),b=v*r$;let C=0,S=0,w=0,D=t[0].para,_=0,z=0,H=null;for(;C<t.length&&w<Z$;){const L=S+v>c;if(L&&!u)break;const V=t[C].para;if(V>D+1){S+=v*(V-D-1),D=V-1,w+=1;continue}let $=L?[{x0:0,x1:d}]:m$(i,(S+b)/c,(S+v-b)/c,o).map(F=>({x0:F.x0*d,x1:F.x1*d}));p>0&&x>0&&!L&&$.length&&(H===null&&(H=w,_=$[0].x0,z=S),w-H<x&&($=p$($,{x0:_,x1:_+p})));const E=$.reduce((F,W)=>Math.max(F,W.x1-W.x0),0);for(const F of $){const W=F.x1-F.x0;if(W<y)continue;if(C>=t.length||t[C].para!==V)break;const g=C;let M=0;for(;C<t.length&&t[C].para===V;){const R=n[C]*l,G=C===g?R:m+R;if(M+G>W&&!(C===g&&W>=E-.5&&R>d-.5))break;M+=G,C+=1}if(C>g){const R=C>=t.length||t[C].para!==V;h.push({top:S,left:F.x0,width:W,from:g,to:C,justify:r==="justify"&&!R})}if(C>=t.length||t[C].para!==V)break}D=V,S+=v,w+=1}return{segments:h,placed:C,height:h.length?S:0,capLeft:_,capTop:z}}const nC=.12,iC=2,oC=10,vs=.25,rC=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},aC=(e,t)=>Math.abs(e.top-t.top)<.5&&Math.abs(e.left-t.left)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5,sC=(e,t)=>{const[n,i]=s.useState(null);return s.useEffect(()=>{if(!e||!t){i(null);return}let o=0,r=null;const l=()=>{const d=rC(e);(!r||!aC(r,d))&&(r=d,i(d)),o=requestAnimationFrame(l)};return l(),()=>cancelAnimationFrame(o)},[e,t]),n},xs=(e,t)=>{if(!(t.width>0)||!(t.height>0))return e;const n=Math.min(t.width,t.height),i=(t.width-n)/2,o=(t.height-n)/2;return e.map(r=>r.map(l=>({x:(i+l.x*n)/t.width,y:(o+l.y*n)/t.height})))},Yr=typeof window>"u"?s.useEffect:s.useLayoutEffect;function lC(){return typeof document>"u"?null:document.body}function cC({P:e,item:t,shape:n,customPath:i,pathFit:o,viewBox:r,mode:l,align:d,allowOverflow:c,fitEnabled:u,scale:p,onFitScale:x,dropCapLines:v,dropCapSize:m,showGuides:h,typography:y,imageUrl:b,imageFocalX:C,imageFocalY:S,imageScale:w,imageCustomPath:D,pathDragActive:_,pathCarryImage:z,onCarryImageConsumed:H,pathEditor:L,imageEditor:V}){var De,Xe;const $=`pretext-shape-image-${s.useId().replace(/:/g,"")}`,[E,F]=s.useState(null),W=s.useRef(null),[g,M]=s.useState({width:0,height:0}),[R,G]=s.useState(null),[Z,T]=s.useState(0),[j,Y]=s.useState("none");s.useEffect(()=>{!L&&!V&&Y("none")},[L,V]);const[le,se]=s.useState(null);s.useEffect(()=>{if(!b||typeof Image>"u"){se(null);return}let ge=!1;const Me=new Image;return Me.onload=()=>{ge||se({width:Me.naturalWidth,height:Me.naturalHeight})},Me.src=b,()=>{ge=!0}},[b]);const k=s.useMemo(()=>Array.isArray(t==null?void 0:t.text)?t.text:[],[t]),re=s.useMemo(()=>eC(k),[k]),q=s.useMemo(()=>tC(k),[k]),ce=v>0&&m>1?((Xe=(De=re[0])==null?void 0:De.text)==null?void 0:Xe.charAt(0))??"":"",J=(L==null?void 0:L.contours)??null,be=s.useMemo(()=>{let ge=[];if(J){const Me=yr(J);Me.length&&(ge=So(Me,r))}if(!ge.length){const Me=i.trim(),ze=Me?gd(Me,o,r):null;ze&&ze.length?ge=ze:ge=Os(n==="custom"?"rectangle":n)}return n==="circle"?xs(ge,g):ge},[J,n,i,o,r,g.width,g.height]),We=L==null?void 0:L.onConvert,ye=(L==null?void 0:L.needsConversion)??!1,ue=s.useMemo(()=>{if(n==="circle")return!1;const ge=J??(i.trim()?Li(i):null);return!!(ge&&pp(ge,r))},[J,i,r,n]),[ee,de]=s.useState(null);Yr(()=>{if(!ue){ee&&de(null);return}!ee&&g.width>0&&g.height>0&&de({width:g.width,height:g.height})},[ue,g.width,g.height,ee]);const ne=s.useMemo(()=>{if(!ue||g.width<=0||g.height<=0)return be;const ge=ee??g,Me=r.width/ge.width,ze=r.height/ge.height;return be.map(Re=>Re.map(xe=>({x:xe.x*Me,y:xe.y*ze})))},[be,ue,ee,r.width,r.height,g.width,g.height]),Pe=s.useMemo(()=>{if(J){const Re=yr(J);if(Re.length){const xe=So(Re,r);return n==="circle"?xs(xe,g):xe}}const ge=D.trim(),Me=ge?gd(ge,o,r):null,ze=Me&&Me.length?Me:Os(n==="custom"?"rectangle":n);return n==="circle"?xs(ze,g):ze},[J,n,D,o,r,g.width,g.height]),Te=s.useMemo(()=>{if(!ue||g.width<=0||g.height<=0)return Pe;const ge=ee??g,Me=r.width/ge.width,ze=r.height/ge.height;return Pe.map(Re=>Re.map(xe=>({x:xe.x*Me,y:xe.y*ze})))},[Pe,ue,ee,r.width,r.height,g.width,g.height]),Oe=s.useRef(null),ve=s.useRef(!1);s.useEffect(()=>{if(!(!We||g.width<=0||g.height<=0)){if(ue){if(Oe.current===i)return;const ge=J??(i.trim()?Li(i):null);if(!(ge!=null&&ge.length))return;const Me=ln(ge,ze=>({x:r.x+(ze.x-r.x)/g.width*r.width,y:r.y+(ze.y-r.y)/g.height*r.height}));Oe.current=No(Me),We(Me);return}!ye||!be.length||ve.current||(ve.current=!0,We(ln(up(be),ge=>({x:ge.x*ha,y:ge.y*ha}))))}},[ye,ue,We,be,J,i,r,g.width,g.height]),Yr(()=>{const ge=E;if(!ge||typeof ResizeObserver>"u")return;const Me=()=>{const Re=ge.getBoundingClientRect();M(xe=>Math.abs(xe.width-Re.width)<.5&&Math.abs(xe.height-Re.height)<.5?xe:{width:Re.width,height:Re.height})};Me();const ze=new ResizeObserver(Me);return ze.observe(ge),()=>ze.disconnect()},[E]),s.useEffect(()=>{const ge=typeof document<"u"?document.fonts:void 0;ge!=null&&ge.ready&&ge.ready.then(()=>{T(Me=>Me+1)})},[]),Yr(()=>{const ge=W.current;if(!ge)return;if(!re.length){G(null);return}const Me=[],ze=document.createDocumentFragment();for(const Qe of re){const dt=document.createElement("span");Object.assign(dt.style,Pd(Qe.leaf)),dt.textContent=Qe.text,ze.appendChild(dt),Me.push(dt)}const Re=document.createElement("span");Re.textContent=" ",ze.appendChild(Re);const xe=ce||"H",Ie=document.createElement("span");Ie.textContent=xe,Ie.style.lineHeight="1",ze.appendChild(Ie),ge.replaceChildren(ze);const Ke=window.getComputedStyle(ge),Ne=parseFloat(Ke.fontSize)||16,it=parseFloat(Ke.lineHeight),ot=Number.isNaN(it)?Ne*1.2:it,rt=Math.max(ot,Ne),ht=document.createElement("span");ht.textContent=xe,ht.style.lineHeight=`${rt}px`;const Pt=document.createElement("span");Pt.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",ht.appendChild(Pt),ge.appendChild(ht);const Et=ht.getBoundingClientRect().top,ut=Pt.getBoundingClientRect().top,gt=Math.max(1,ut-Et);ht.remove();let $t=gt*.8;const ft=document.createElement("canvas").getContext("2d"),At=Qe=>`${Ke.fontStyle} ${Ke.fontWeight} ${Qe}px ${Ke.fontFamily}`;if(ft){ft.font=At(Ne);const Qe=ft.measureText(xe).actualBoundingBoxAscent;Qe>0&&($t=Qe)}const zt=m>1?(m-1)*rt+$t:$t;let jt=Ne*(zt/$t);if(ft){ft.font=At(jt);const Qe=ft.measureText(xe).actualBoundingBoxAscent;Qe>0&&(jt=jt*(zt/Qe))}Ie.style.fontSize=`${jt}px`,Ie.style.lineHeight=`${jt}px`;const Zt=document.createElement("span");Zt.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",Ie.appendChild(Zt);const Ct=Math.max(1,Zt.getBoundingClientRect().top-Ie.getBoundingClientRect().top);Zt.remove();const rn=(m-1)*rt+gt-Ct,lt=Me.map(Qe=>Qe.getBoundingClientRect().width),Ee=Re.getBoundingClientRect().width,je=ce?Ie.getBoundingClientRect().width:0;ge.replaceChildren(),G({widths:lt,spaceWidth:Ee,lineHeight:rt,capWidth:je,dropCapFontSize:jt,dropCapTopAdjust:rn})},[re,y,ce,v,m,Z,g.width]);const Se=R&&ce?R.capWidth+R.lineHeight*nC:0,$e=Math.max(v,Math.ceil(m)),f=s.useMemo(()=>{if(!R||!re.length||g.width<=0||g.height<=0||!u)return 1;const ge=Re=>Ed({tokens:re,widths:R.widths,spaceWidth:R.spaceWidth,lineHeight:R.lineHeight,width:g.width,height:g.height,rings:ne,mode:l,align:d,scale:Re,allowOverflow:!1,capInset:Se*Re,capLines:ce?$e:0});if(ge(1).placed>=re.length)return 1;if(ge(vs).placed<re.length)return vs;let Me=vs,ze=1;for(let Re=0;Re<oC;Re+=1){const xe=(Me+ze)/2;ge(xe).placed>=re.length?Me=xe:ze=xe}return Me},[R,re,g.width,g.height,ne,l,d,u,Se,ce,$e]);s.useEffect(()=>{x(f)},[f,x]);const X=u?Math.min(p,f):1,N=s.useMemo(()=>!R||!re.length||g.width<=0||g.height<=0?{segments:[],placed:0,height:0,capLeft:0,capTop:0}:Ed({tokens:re,widths:R.widths,spaceWidth:R.spaceWidth,lineHeight:R.lineHeight,width:g.width,height:g.height,rings:ne,mode:l,align:d,scale:X,allowOverflow:c,capInset:Se*X,capLines:ce?$e:0}),[R,re,g.width,g.height,ne,l,d,X,c,Se,ce,$e]),U=R?R.dropCapFontSize*X:0,me=R?R.dropCapTopAdjust*X:0,K=d==="justify"?"left":d,I=!!(L&&J&&g.width>0&&g.height>0),ie=!!V,oe=(I||ie)&&g.width>0&&g.height>0,B=sC(E,oe),te=oe&&B?lC():null,Ae=s.useRef(!1),he=s.useCallback(ge=>{Ae.current=ge},[]);s.useEffect(()=>{if(!I&&!ie)return;const ge=Me=>{const ze=E;if(!ze)return;const Re=ze.getBoundingClientRect();Me.clientX>=Re.left&&Me.clientX<=Re.right&&Me.clientY>=Re.top&&Me.clientY<=Re.bottom&&(Me.preventDefault(),Me.stopPropagation(),Y(Ie=>Ie==="shape"&&Ae.current?Ie:Ie==="shape"&&ie?"image":I?"shape":"image"))};return document.addEventListener("dblclick",ge,!0),()=>document.removeEventListener("dblclick",ge,!0)},[I,ie,E]);const Q=s.useMemo(()=>b&&g.width>0&&g.height>0?a$(Te,g):null,[b,Te,g.width,g.height]),Ze=s.useRef(null),Fe=(()=>{const ge=Ze.current;return z||!V||!le||!Q||!ge||D===ge.customPath||ge.shape!==n&&n!=="custom"?null:j$(ge.bounds,Q,le,ge.focalX,ge.focalY,ge.scale)})();Yr(()=>{if(_||!V||!le||!Q)return;const ge=Ze.current,Me=!!(ge&&D!==ge.customPath);Me&&Fe&&V.onCommit(Fe),Me&&z&&(H==null||H()),Ze.current={rings:Te,bounds:Q,focalX:(Fe==null?void 0:Fe.focalX)??C,focalY:(Fe==null?void 0:Fe.focalY)??S,scale:(Fe==null?void 0:Fe.scale)??w,customPath:D,shape:n}},[_,z,D,n,Te,Q,V,le,C,S,w,Fe,H]);const et=Ze.current,Ue=!!(_&&!z&&et&&!Fe),nt=Ue&&et?et.focalX:(Fe==null?void 0:Fe.focalX)??C,tt=Ue&&et?et.focalY:(Fe==null?void 0:Fe.focalY)??S,Ve=Ue&&et?et.scale:(Fe==null?void 0:Fe.scale)??w,fe=Ue&&et?et.bounds:Q,He=s.useMemo(()=>{if(!(g.width>0)||!(g.height>0))return"";let ge=fd(i,J,o,r,n,g);if(ue){const Me=ee??g,ze=r.width/Me.width,Re=r.height/Me.height;ge=ln(ge,xe=>({x:xe.x*ze,y:xe.y*Re}))}return yd(ge,g)||md(ne,g)},[i,J,o,r,n,g.width,g.height,ue,ee,ne]),Be=s.useMemo(()=>{if(!b||!(g.width>0)||!(g.height>0))return"";let ge=fd(D,J,o,r,n,g);if(ue){const Me=ee??g,ze=r.width/Me.width,Re=r.height/Me.height;ge=ln(ge,xe=>({x:xe.x*ze,y:xe.y*Re}))}return yd(ge,g)||md(Te,g)},[b,D,J,o,r,n,g.width,g.height,ue,ee,Te]),Je=`${$}-clip`,Ce=s.useMemo(()=>{if(!fe)return null;const ge=le??{width:fe.width,height:fe.height},Me=Gi(fe,ge,Ve);return{x:Dn(fe.width,Me.width,nt),y:Dn(fe.height,Me.height,tt),width:Me.width,height:Me.height}},[fe,le,nt,tt,Ve]);return a.jsxs("div",{className:`${e}-column`,ref:F,children:[He?a.jsxs("svg",{className:`${e}-shape-fill`,viewBox:`0 0 ${g.width} ${g.height}`,preserveAspectRatio:"none","aria-hidden":!0,children:[a.jsx("path",{className:`${e}-shape-fill-path`,d:He,fillRule:"evenodd"}),b&&Be&&fe&&Ce?a.jsxs(a.Fragment,{children:[a.jsx("defs",{children:a.jsx("clipPath",{id:Je,clipPathUnits:"userSpaceOnUse",children:a.jsx("path",{d:Be,fillRule:"evenodd"})})}),a.jsx("image",{href:b,x:fe.x+Ce.x,y:fe.y+Ce.y,width:Ce.width,height:Ce.height,preserveAspectRatio:"none",clipPath:`url(#${Je})`})]}):null]}):null,a.jsxs("div",{className:`${e}-flow${c?"":` ${e}-clip`}`,style:{...y,["--"+e+"-fit"]:X},children:[a.jsx("div",{className:`${e}-measure`,ref:W,style:y,"aria-hidden":!0}),N.segments.map((ge,Me)=>{const ze=re.slice(ge.from,ge.to),Re=Me===0;return a.jsx("div",{className:`${e}-line${ge.justify?` ${e}-line-justify`:""}`,"aria-hidden":!0,style:{top:`${ge.top}px`,left:`${ge.left}px`,width:`${ge.width}px`,textAlign:ge.justify?void 0:K},children:ze.map((xe,Ie)=>{const Ne=ce&&Re&&ge.from===0&&Ie===0?xe.text.slice(1):xe.text,it=Pd(xe.leaf),ot=xe.href?a.jsx("a",{className:`${e}-link`,href:xe.href,target:xe.target,rel:xe.target?"noopener noreferrer":void 0,style:it,children:Ne}):a.jsx("span",{style:it,children:Ne});return a.jsxs("span",{children:[!ge.justify&&Ie>0?" ":null,ot]},Ie)})},`${ge.from}-${ge.to}-${Me}`)}),h&&!J&&a.jsx("svg",{className:`${e}-guides`,viewBox:"0 0 1 1",preserveAspectRatio:"none","aria-hidden":!0,children:ne.map((ge,Me)=>a.jsx("polygon",{points:ge.map(ze=>`${ze.x},${ze.y}`).join(" ")},Me))})]}),ce&&R&&a.jsx("div",{className:`${e}-drop-cap`,"aria-hidden":!0,style:{...y,top:`${N.capTop+me}px`,left:`${N.capLeft}px`,fontSize:`${U}px`,lineHeight:`${U}px`},children:ce}),te&&B&&(J&&L||V)&&ri.createPortal(a.jsxs("div",{"data-selection":"none",style:{position:"fixed",top:B.top,left:B.left,width:B.width,height:B.height,zIndex:iC,pointerEvents:"none"},children:[J&&L&&a.jsx(Y$,{P:e,box:{width:B.width,height:B.height},viewBox:r,contours:J,snap:L.snap,stretchToBox:!ue,uniformStretch:n==="circle",stage:j,onStageChange:Y,onSelectionChange:he,onChange:L.onChange,onCommit:L.onCommit}),V&&fe&&a.jsx(V$,{P:e,box:{width:B.width,height:B.height},bounds:fe,natural:le,imageUrl:b,maskPath:Be,stage:j,onStageChange:Y,focalX:nt,focalY:tt,scale:Ve,onChange:V.onChange,onCommit:V.onCommit})]}),te),a.jsx("div",{className:`${e}-a11y`,children:q.map((ge,Me)=>a.jsx("p",{children:ge},Me))})]})}const yp=["diamond","parallelogram","vase","circle","shield","bobbin","custom"],dC={x:0,y:0,width:100,height:100},uC=e=>{const t=(e??"").trim().split(/[\s,]+/).map(Number).filter(n=>!Number.isNaN(n));return t.length<4||t[2]<=0||t[3]<=0?dC:{x:t[0],y:t[1],width:t[2],height:t[3]}},pC=e=>`
26423
+ `;function Zo(e){return{type:"number",scope:"layout",title:e,min:0,max:100,display:{type:"range-control"}}}const Di={fontSettings:{type:"object",display:{type:"font-settings-weight",hideLabel:!0,useTabDesign:!0},properties:{fontWeight:{type:"number"},fontStyle:{type:"string"}}},fontSize:{type:"number",display:{type:"font-size"}},lineHeight:{type:"number",display:{type:"line-height-input"}},letterSpacing:{type:"number",display:{type:"letter-spacing-input"}},wordSpacing:{type:"number",display:{type:"word-spacing-input"}},textAlign:{type:"string",enum:["left","center","right","justify"],display:{type:"vertical-text-aligh-options"}},textAppearance:{type:"object",display:{type:"text-appearance",useTabDesign:!0},properties:{textTransform:{type:"string",enum:["none","uppercase","lowercase","capitalize"]},textDecoration:{type:"string",enum:["none","underline"]},fontVariant:{type:"string",enum:["normal","small-caps"]}}}};function mi(e,t){return e?`${e}${t.charAt(0).toUpperCase()}${t.slice(1)}`:t}function Pl(e){return{[mi(e,"fontFamily")]:{type:"string",scope:"common",title:"",display:{type:"font-family-select",hideLabel:!0,useTabDesign:!0}},[mi(e,"fontSettings")]:{...Di.fontSettings,scope:"common",title:""},[mi(e,"fontSize")]:{...Di.fontSize,scope:"layout",title:""},[mi(e,"lineHeight")]:{...Di.lineHeight,scope:"layout",title:""},[mi(e,"letterSpacing")]:{...Di.letterSpacing,scope:"layout",title:""},[mi(e,"wordSpacing")]:{...Di.wordSpacing,scope:"layout",title:""},[mi(e,"textAlign")]:{...Di.textAlign,scope:"layout",title:""},[mi(e,"textAppearance")]:{...Di.textAppearance,scope:"layout",title:""}}}const Kw=Pl(""),Yw=Pl("open"),Zw=Pl("compact"),Jw=["__componentName__",{type:"row",items:["panelHeight","navTextWidth"]},{type:"row",title:"Logo",items:["logoMaxHeight","logoPosition"]},{type:"row",title:"Hamburger",items:["showIcon","iconSize"]},"fontFamily","fontSettings",{type:"row",items:["fontSize","lineHeight","letterSpacing","wordSpacing"]},"textAlign","textAppearance","navGap","navPaddingLeft","navPaddingRight"],Qw=["__componentName__",{type:"row",items:["compactPanelHeight","compactNavTextWidth"]},{type:"row",title:"Logo",items:["compactLogoMaxHeight","compactLogoPosition"]},{type:"row",title:"Hamburger",items:["compactShowIcon","compactIconSize"]},"compactFontFamily","compactFontSettings",{type:"row",items:["compactFontSize","compactLineHeight","compactLetterSpacing","compactWordSpacing"]},"compactTextAlign","compactTextAppearance","compactNavGap","compactNavPaddingLeft","compactNavPaddingRight"],e$=["__componentName__",{type:"row",items:["textWidth","effect"]},"position","openFontFamily","openFontSettings",{type:"row",items:["openFontSize","openLineHeight","openLetterSpacing","openWordSpacing"]},"openTextAlign","openTextAppearance"],Yn={textTransform:"none",textDecoration:"none",fontVariant:"normal"},gs={fontWeight:400,fontStyle:"normal"},t$=["left-top","center-top","right-top","left-center","center","right-center","left-bottom","center-bottom","right-bottom"],n$=["iconColor","logoColor","closeButtonColor","linkColor","backgroundColor"],i$={type:"object",version:1,settings:{sizing:"auto manual",properties:{link:{type:"array",scope:"common",display:{type:"page-url-link"},items:{type:"object",properties:{mode:{type:"string",enum:["page","url"]},page:{type:"string"},url:{type:"string",message:"Paste URL here..."},label:{type:"string"},anchor:{type:"string"},openIn:{type:"string"},showIn:{type:"string",enum:["always","open only","open and compact","default and open"]}}}},logo:{type:"object",scope:"common",title:"Logo",display:{type:"button-icon-switch"},properties:{mode:{type:"string",enum:["On","Off"]},icon:{type:["string","null"],title:"Logo",display:{type:"settings-image-input"}}}},logoMaxHeight:{type:"number",scope:"layout",title:"Height",display:{type:"numeric-input"},min:0,max:9999},logoPosition:{type:"string",scope:"layout",title:"Position",display:{type:"toggle-cycle",enum:["left","center","right"]}},compactLogoPosition:{type:"string",scope:"layout",title:"Position",display:{type:"toggle-cycle",enum:["left","center","right"]}},logoColor:{type:"string",scope:"common",title:"Logo Default",titleByState:{default:"Logo Default",hover:"Logo Hover"},display:{type:"palette-color-picker"}},panelHeight:{type:"number",scope:"layout",title:"Menu Height",display:{type:"numeric-input"},min:0,max:9999},backgroundColor:{type:"string",scope:"common",title:"BG Default",display:{type:"palette-color-picker"}},iconColor:{type:"string",scope:"common",title:"Icon Default",titleByState:{default:"Icon Default",hover:"Icon Hover"},display:{type:"palette-color-picker"}},showIcon:{type:"string",scope:"layout",title:"Show",display:{type:"toggle-cycle",enum:["on","off"]}},iconSize:{type:"number",scope:"layout",title:"Size",display:{type:"numeric-input"},min:0,max:9999},linkColor:{type:"string",scope:"common",title:"Link Default",titleByState:{default:"Link Default",hover:"Link Hover"},display:{type:"palette-color-picker"}},compactShowIcon:{type:"string",scope:"layout",title:"Show",display:{type:"toggle-cycle",enum:["on","off"]}},compactIconColor:{type:"string",scope:"common",title:"Icon Default",titleByState:{compact:"Icon Default","compact-hover":"Icon Hover"},display:{type:"palette-color-picker"}},compactCloseButtonColor:{type:"string",scope:"common",title:"Close Default",titleByState:{compact:"Close Default","compact-hover":"Close Hover"},display:{type:"palette-color-picker"}},compactLinkColor:{type:"string",scope:"common",title:"Link Default",titleByState:{compact:"Link Default","compact-hover":"Link Hover"},display:{type:"palette-color-picker"}},compactLogoColor:{type:"string",scope:"common",title:"Logo Default",titleByState:{compact:"Logo Default","compact-hover":"Logo Hover"},display:{type:"palette-color-picker"}},compactBackgroundColor:{type:"string",scope:"common",title:"BG Default",display:{type:"palette-color-picker"}},openLinkColor:{type:"string",scope:"common",title:"Link Default",titleByState:{open:"Link Default","open-hover":"Link Hover"},display:{type:"palette-color-picker"}},openLogoColor:{type:"string",scope:"common",title:"Logo Default",titleByState:{open:"Logo Default","open-hover":"Logo Hover"},display:{type:"palette-color-picker"}},menuBackgroundColor:{type:"string",scope:"common",title:"BG Default",display:{type:"palette-color-picker"}},overlayColor:{type:"string",scope:"common",title:"Overlay Default",display:{type:"palette-color-picker"}},closeButtonColor:{type:"string",scope:"common",title:"Close Default",titleByState:{default:"Close Default",hover:"Close Hover",open:"Close Default","open-hover":"Close Hover"},display:{type:"palette-color-picker"}},effect:{type:"string",scope:"layout",title:"Effect",display:{type:"toggle-cycle",enum:["fade","left","top","right","bottom"]}},textWidth:{type:"number",scope:"layout",title:"Text width",display:{type:"numeric-input"},min:0,max:9999},navTextWidth:{type:"number",scope:"layout",title:"Text width",display:{type:"numeric-input"},min:0,max:9999},position:{type:"string",scope:"layout",title:"Position",display:{type:"toggle-cycle",enum:[...t$]}},stateOverrides:{type:"object",scope:"common"},gap:Zo("Gap"),navGap:{type:"number",scope:"layout",title:"Nav gap",min:0,max:100,display:{type:"range-control",visible:!1}},navPaddingLeft:{type:"number",scope:"layout",title:"Nav padding left",min:0,max:100,display:{type:"range-control",visible:!1}},navPaddingRight:{type:"number",scope:"layout",title:"Nav padding right",min:0,max:100,display:{type:"range-control",visible:!1}},textPaddingLeft:Zo("Text padding left"),textPaddingRight:Zo("Text padding right"),textPaddingTop:Zo("Text padding top"),textPaddingBottom:Zo("Text padding bottom"),compactLogoMaxHeight:{type:"number",scope:"layout",title:"Height",display:{type:"numeric-input"},min:0,max:9999},compactPanelHeight:{type:"number",scope:"layout",title:"Menu Height",display:{type:"numeric-input"},min:0,max:9999},compactIconSize:{type:"number",scope:"layout",title:"Size",display:{type:"numeric-input"},min:0,max:9999},compactNavTextWidth:{type:"number",scope:"layout",title:"Text width",display:{type:"numeric-input"},min:0,max:9999},compactNavGap:{type:"number",scope:"layout",title:"Nav gap",min:0,max:100,display:{type:"range-control",visible:!1}},compactNavPaddingLeft:{type:"number",scope:"layout",title:"Nav padding left",min:0,max:100,display:{type:"range-control",visible:!1}},compactNavPaddingRight:{type:"number",scope:"layout",title:"Nav padding right",min:0,max:100,display:{type:"range-control",visible:!1}},...Kw,...Yw,...Zw},defaults:{link:[{mode:"page",page:"",url:"",label:"Home",anchor:"",openIn:"Same Tab",showIn:"always"},{mode:"page",page:"",url:"",label:"Works",anchor:"",openIn:"Same Tab",showIn:"always"},{mode:"page",page:"",url:"",label:"About",anchor:"",openIn:"Same Tab",showIn:"always"},{mode:"page",page:"",url:"",label:"Contact",anchor:"",openIn:"Same Tab",showIn:"always"}],logo:{mode:"On",icon:null},backgroundColor:"#ffffff",logoColor:"#000000",iconColor:"#000000",linkColor:"#000000",openLinkColor:"#000000",compactIconColor:"#000000",compactCloseButtonColor:"#000000",compactLinkColor:"#000000",compactLogoColor:"#000000",compactBackgroundColor:"#ffffff",openLogoColor:"#000000",menuBackgroundColor:"#ffffff",overlayColor:"rgba(0, 0, 0, 0.45)",closeButtonColor:"#000000",effect:"fade",showIcon:"on",compactShowIcon:"on",logoPosition:"left",compactLogoPosition:"left",position:"left-top",fontFamily:"Goudy Bookletter 1911",fontSettings:gs,textAlign:"left",openFontFamily:"Goudy Bookletter 1911",openFontSettings:gs,openTextAlign:"left",compactFontFamily:"Goudy Bookletter 1911",compactFontSettings:gs,compactTextAlign:"left",stateOverrides:{hover:{linkColor:"#666666",iconColor:"#666666",logoColor:"#666666",closeButtonColor:"#666666"}}},displayRules:[{if:{name:"logo.mode",value:"Off"},then:{name:"properties.logoMaxHeight.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.logoPosition.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.compactLogoMaxHeight.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.compactLogoPosition.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.logoColor.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.compactLogoColor.display.visible",value:!1}},{if:{name:"logo.mode",value:"Off"},then:{name:"properties.openLogoColor.display.visible",value:!1}},{if:{name:"showIcon",value:"off"},then:{name:"properties.iconSize.display.visible",value:!1}},{if:{name:"showIcon",value:"off"},then:{name:"properties.iconColor.display.visible",value:!1}},{if:{name:"compactShowIcon",value:"off"},then:{name:"properties.compactIconSize.display.visible",value:!1}},{if:{name:"compactShowIcon",value:"off"},then:{name:"properties.compactIconColor.display.visible",value:!1}}],layoutDefaults:{m:{position:"left-top",panelHeight:56/375,logoMaxHeight:80/375,logoPosition:"left",compactLogoPosition:"left",showIcon:"on",iconSize:16/375,textWidth:240/375,navTextWidth:120/375,gap:24/375,navGap:24/375,navPaddingLeft:10/375,navPaddingRight:10/375,textPaddingLeft:10/375,textPaddingRight:10/375,textPaddingTop:10/375,textPaddingBottom:10/375,fontSize:16/375,lineHeight:20/375,letterSpacing:0,wordSpacing:0,textAppearance:Yn,openFontSize:16/375,openLineHeight:20/375,openLetterSpacing:0,openWordSpacing:0,openTextAppearance:Yn,compactPanelHeight:56/375,compactLogoMaxHeight:80/375,compactShowIcon:"on",compactIconSize:16/375,compactNavTextWidth:120/375,compactNavGap:24/375,compactNavPaddingLeft:10/375,compactNavPaddingRight:10/375,compactFontSize:16/375,compactLineHeight:20/375,compactLetterSpacing:0,compactWordSpacing:0,compactTextAppearance:Yn},t:{position:"left-top",panelHeight:60/768,logoMaxHeight:100/768,logoPosition:"left",compactLogoPosition:"left",showIcon:"on",iconSize:16/768,textWidth:260/768,navTextWidth:140/768,gap:32/768,navGap:32/768,navPaddingLeft:10/768,navPaddingRight:10/768,textPaddingLeft:10/768,textPaddingRight:10/768,textPaddingTop:10/768,textPaddingBottom:10/768,fontSize:16/768,lineHeight:20/768,letterSpacing:0,wordSpacing:0,textAppearance:Yn,openFontSize:16/768,openLineHeight:20/768,openLetterSpacing:0,openWordSpacing:0,openTextAppearance:Yn,compactPanelHeight:60/768,compactLogoMaxHeight:100/768,compactShowIcon:"on",compactIconSize:16/768,compactNavTextWidth:140/768,compactNavGap:32/768,compactNavPaddingLeft:10/768,compactNavPaddingRight:10/768,compactFontSize:16/768,compactLineHeight:20/768,compactLetterSpacing:0,compactWordSpacing:0,compactTextAppearance:Yn},d:{position:"left-top",panelHeight:40/1440,logoMaxHeight:120/1440,logoPosition:"left",compactLogoPosition:"left",showIcon:"on",iconSize:16/1440,textWidth:60/1440,navTextWidth:60/1440,gap:12/1440,navGap:12/1440,navPaddingLeft:10/1440,navPaddingRight:10/1440,textPaddingLeft:10/1440,textPaddingRight:10/1440,textPaddingTop:10/1440,textPaddingBottom:10/1440,fontSize:16/1440,lineHeight:16/1440,letterSpacing:0,wordSpacing:0,textAppearance:Yn,textAlign:"center",openFontSize:16/1440,openLineHeight:16/1440,openLetterSpacing:0,openWordSpacing:0,openTextAppearance:Yn,openTextAlign:"center",compactPanelHeight:40/1440,compactLogoMaxHeight:120/1440,compactShowIcon:"on",compactIconSize:16/1440,compactNavTextWidth:60/1440,compactNavGap:12/1440,compactNavPaddingLeft:10/1440,compactNavPaddingRight:10/1440,compactFontSize:16/1440,compactLineHeight:16/1440,compactLetterSpacing:0,compactWordSpacing:0,compactTextAppearance:Yn,compactTextAlign:"center"}},layout:["__componentName__","link","logo","logoMaxHeight","logoPosition","panelHeight","backgroundColor","logoColor","iconColor","showIcon","iconSize","linkColor","openLinkColor","compactShowIcon","compactIconColor","compactCloseButtonColor","compactLinkColor","compactLogoColor","compactBackgroundColor","compactLogoMaxHeight","compactLogoPosition","compactPanelHeight","compactIconSize","compactNavTextWidth","compactNavGap","compactNavPaddingLeft","compactNavPaddingRight","compactFontFamily","compactFontSettings","compactFontSize","compactLineHeight","compactLetterSpacing","compactWordSpacing","compactTextAlign","compactTextAppearance","openLogoColor","menuBackgroundColor","overlayColor","closeButtonColor","effect","textWidth","navTextWidth","position","gap","navGap","navPaddingLeft","navPaddingRight","textPaddingLeft","textPaddingRight","textPaddingTop","textPaddingBottom","fontFamily","fontSettings","fontSize","lineHeight","letterSpacing","wordSpacing","textAlign","textAppearance","openFontFamily","openFontSettings","openFontSize","openLineHeight","openLetterSpacing","openWordSpacing","openTextAlign","openTextAppearance"]},panels:[{id:"general",icon:"settings",title:"General",tooltip:"General Settings",layout:["__componentName__","logo"]},{id:"default",icon:"default",title:"Default",tooltip:"Default State",layout:Jw},{id:"compact",icon:"compact",title:"Compact",tooltip:"Compact State",layout:Qw,availableWhen:{navigationPosition:["switch"]}},{id:"open",icon:"open",title:"Open",tooltip:"Open State",layout:e$},{id:"links",icon:"content",title:"Links",tooltip:"Link Settings",layout:["__componentName__","link"]}],paletteBookmark:{items:[...n$],panelIds:["default","compact","open"],stateItems:{default:["iconColor","logoColor","closeButtonColor","linkColor","backgroundColor"],hover:["iconColor","logoColor","closeButtonColor","linkColor"],compact:["compactIconColor","compactLogoColor","compactCloseButtonColor","compactLinkColor","compactBackgroundColor"],"compact-hover":["compactIconColor","compactLogoColor","compactCloseButtonColor","compactLinkColor"],open:["closeButtonColor","openLogoColor","openLinkColor","menuBackgroundColor","overlayColor"],"open-hover":["closeButtonColor","openLogoColor","openLinkColor"]}},states:["default","hover"],statePanels:["default","compact","open"]},o$={element:qw,id:"basic-burger",name:"Basic Burger",category:"navigation",version:1,preview:{type:"image",url:"https://cdn.cntrl.site/component-assets/Simple Burger.png"},layoutMode:"navigation",defaultSize:{d:{width:"100%",height:60/1440},t:{width:"100%",height:60/768},m:{width:"100%",height:56/375}},schema:i$,sourceCode:Uw,assetsPaths:{content:[],parameters:[{path:"logo.icon"}]},fontSettingsPaths:{content:[],parameters:[{path:"fontFamily"},{path:"openFontFamily"},{path:"compactFontFamily"}]},fontRelations:{fontSettings:"fontFamily",openFontSettings:"openFontFamily",compactFontSettings:"compactFontFamily"}},ud=120,pd=3,r$=.12,El={x:0,y:0,width:100,height:100};function So(e,t){return e.map(n=>n.map(i=>({x:(i.x-t.x)/t.width,y:(i.y-t.y)/t.height})))}function ga(e){return e<0?0:e>1?1:e}function md(e,t){return e.filter(n=>n.length>0).map(n=>`M ${n.map(i=>`${i.x*t.width} ${i.y*t.height}`).join(" L ")} Z`).join(" ")}function a$(e,t){let n=1/0,i=1/0,o=-1/0,r=-1/0;for(const c of e)for(const u of c){const p=u.x*t.width,x=u.y*t.height;p<n&&(n=p),p>o&&(o=p),x<i&&(i=x),x>r&&(r=x)}const l=o-n,d=r-i;return!isFinite(l)||!isFinite(d)||l<=0||d<=0?null:{x:n,y:i,width:l,height:d}}function s$(e){return e.map(([t,n])=>({x:t,y:n}))}function hs(e){let t=1/0,n=1/0,i=-1/0,o=-1/0;for(const d of e)for(const c of d)c.x<t&&(t=c.x),c.x>i&&(i=c.x),c.y<n&&(n=c.y),c.y>o&&(o=c.y);const r=i-t,l=o-n;return!isFinite(r)||!isFinite(l)||r<=0||l<=0?e:e.map(d=>d.map(c=>({x:(c.x-t)/r,y:(c.y-n)/l})))}function l$(e,t){const n=[];for(const o of e)for(let r=0;r<o.length;r+=1){const l=o[r],d=o[(r+1)%o.length];(l.y<=t&&d.y>t||d.y<=t&&l.y>t)&&n.push(l.x+(t-l.y)/(d.y-l.y)*(d.x-l.x))}n.sort((o,r)=>o-r);const i=[];for(let o=0;o+1<n.length;o+=2){const r=ga(n[o]),l=ga(n[o+1]);l>r&&i.push({x0:r,x1:l})}return c$(i)}function c$(e){if(e.length<2)return e;const t=[...e].sort((i,o)=>i.x0-o.x0),n=[t[0]];for(let i=1;i<t.length;i+=1){const o=n[n.length-1],r=t[i];r.x0<=o.x1?o.x1=Math.max(o.x1,r.x1):n.push({...r})}return n}function d$(e,t){const n=[];let i=0,o=0;for(;i<e.length&&o<t.length;){const r=Math.max(e[i].x0,t[o].x0),l=Math.min(e[i].x1,t[o].x1);l>r&&n.push({x0:r,x1:l}),e[i].x1<t[o].x1?i+=1:o+=1}return n}function u$(e){const t=[];let n=0;for(const i of e)i.x0>n&&t.push({x0:n,x1:i.x0}),n=Math.max(n,i.x1);return n<1&&t.push({x0:n,x1:1}),t}function p$(e,t){const n=[];for(const i of e){if(t.x1<=i.x0||t.x0>=i.x1){n.push(i);continue}t.x0>i.x0&&n.push({x0:i.x0,x1:t.x0}),t.x1<i.x1&&n.push({x0:t.x1,x1:i.x1})}return n}function m$(e,t,n,i){let o=null;for(let r=0;r<pd;r+=1){const l=ga(t+(n-t)*r/Math.max(1,pd-1)),d=l$(e,l),c=i==="avoid"?u$(d):d;if(o=o===null?c:d$(o,c),o.length===0)return[]}return o??[]}function gd(e,t="stretch",n=El){const i=e.trim();if(!i)return null;if(/^[Mm]/.test(i)){const l=Li(i),d=yr(l);if(d.length)return t==="viewbox"?So(d,n):hs(d);if(typeof document>"u")return null;const c=i.split(/(?=[Mm])/).map(x=>x.trim()).filter(Boolean),u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p=[];for(const x of c){const v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",x),u.appendChild(v);let m=0;try{m=v.getTotalLength()}catch{m=0}if(!m)continue;const h=[];for(let y=0;y<ud;y+=1){const b=v.getPointAtLength(y/ud*m);h.push({x:b.x,y:b.y})}p.push(h)}return p.length?t==="viewbox"?So(p,n):hs(p):null}const o=i.split(/[\s,]+/).map(Number).filter(l=>!Number.isNaN(l));if(o.length<6)return null;const r=[];for(let l=0;l+1<o.length;l+=2)r.push({x:o[l],y:o[l+1]});return t==="viewbox"?So([r],n):hs([r])}const Ml={bobbin:"M57.63,0 L57.63,37.24 L74.66,37.24 L74.66,56.07 L57.63,100 L33.84,100 L16.81,56.07 L16.81,37.24 L33.84,37.24 L33.84,0 Z",circle:"M50,0 C77.61,0 100,22.39 100,50 C100,77.61 77.61,100 50,100 C22.39,100 0,77.61 0,50 C0,22.39 22.39,0 50,0 Z",shield:"M0,0 L100,0 L100,50 L50,100 L0,50 Z",vase:"M25.37,0 L91.55,0 C91.55,0 74.8,25.14 83.07,50.03 C91.34,74.92 74.61,100 74.61,100 L8.43,100 C8.43,100 32.3,75.08 23.9,50 C15.5,24.92 25.37,0 25.37,0 Z",parallelogram:"M25.37,0 L91.55,0 L74.61,100 L8.43,100 Z",diamond:"M50,0 L80,50 L50,100 L20,50 Z"},Ws="0 0 100 100",ha=100,Hs=16,g$=12,h$=16,fs=/([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g,f$=/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g,hd=Math.PI/4,y$=8,v$=Math.PI/18,x$=8,go=24,ho=[];function b$(){return[{closed:!0,nodes:[{p:{x:0,y:0},in:null,out:null},{p:{x:1,y:0},in:null,out:null},{p:{x:1,y:1},in:null,out:null},{p:{x:0,y:1},in:null,out:null}]}]}function ys(e,t){return ln(e,n=>({x:(n.x-t.x)/t.width,y:(n.y-t.y)/t.height}))}function S$(e){const t=Si(e),n=t.maxX-t.minX,i=t.maxY-t.minY;return!isFinite(n)||!isFinite(i)||n<=0||i<=0?e:ln(e,o=>({x:(o.x-t.minX)/n,y:(o.y-t.minY)/i}))}function w$(e,t){if(!(t.width>0)||!(t.height>0))return e;const n=Math.min(t.width,t.height),i=(t.width-n)/2,o=(t.height-n)/2;return ln(e,r=>({x:(i+r.x*n)/t.width,y:(o+r.y*n)/t.height}))}function fd(e,t,n,i,o,r){let l=[];if(t&&t.length)l=ys(t,i);else{const d=e.trim();if(d&&/^[Mm]/.test(d)){const c=Li(d);c.length&&(l=n==="viewbox"?ys(c,i):S$(c))}if(!l.length){const c=o!=="custom"?Ml[o]:void 0;c?l=ys(Li(c),El):l=b$()}}return o==="circle"?w$(l,r):l}function yd(e,t){return!(t.width>0)||!(t.height>0)||!e.length?"":No(ln(e,n=>({x:n.x*t.width,y:n.y*t.height})))}function Os(e){const t=e==="rectangle"||e==="custom"?void 0:Ml[e];return t?So(yr(Li(t)),El):[s$([[0,0],[1,0],[1,1],[0,1]])]}function $$(e){const t=e.match(f$);return t?t.map(Number).filter(n=>!Number.isNaN(n)):[]}function $n(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ds(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function cn(e){return{x:e.x,y:e.y}}function C$(e){return{p:cn(e.p),in:e.in?cn(e.in):null,out:e.out?cn(e.out):null}}function zn(e){return e.map(t=>({closed:t.closed,nodes:t.nodes.map(C$)}))}function ln(e,t){return e.map(n=>({closed:n.closed,nodes:n.nodes.map(i=>({p:t(i.p),in:i.in?t(i.in):null,out:i.out?t(i.out):null}))}))}function vd(e,t,n,i=n){return ln(e,o=>({x:t.x+(o.x-t.x)*n,y:t.y+(o.y-t.y)*i}))}function T$(e,t,n,i,o,r,l){let d=Math.abs(t),c=Math.abs(n);if(!d||!c||e.x===l.x&&e.y===l.y)return[{c1:cn(e),c2:cn(l),p:cn(l)}];const u=i*Math.PI/180,p=Math.cos(u),x=Math.sin(u),v=(e.x-l.x)/2,m=(e.y-l.y)/2,h=p*v+x*m,y=-x*v+p*m,b=h*h/(d*d)+y*y/(c*c);if(b>1){const Z=Math.sqrt(b);d*=Z,c*=Z}const C=o===r?-1:1,S=d*d*y*y+c*c*h*h,w=Math.max(0,d*d*c*c-S),D=S===0?0:C*Math.sqrt(w/S),_=D*d*y/c,z=-D*c*h/d,H=p*_-x*z+(e.x+l.x)/2,L=x*_+p*z+(e.y+l.y)/2,V=Math.atan2((y-z)/c,(h-_)/d);let E=Math.atan2((-y-z)/c,(-h-_)/d)-V;!r&&E>0&&(E-=Math.PI*2),r&&E<0&&(E+=Math.PI*2);const F=Math.max(1,Math.ceil(Math.abs(E)/(Math.PI/2))),W=E/F,g=4/3*Math.tan(W/4),M=(Z,T)=>({x:H+p*d*Z-x*c*T,y:L+x*d*Z+p*c*T}),R=[];let G=V;for(let Z=0;Z<F;Z+=1){const T=G+W,j=Math.cos(G),Y=Math.sin(G),le=Math.cos(T),se=Math.sin(T);R.push({c1:M(j-g*Y,Y+g*j),c2:M(le+g*se,se-g*le),p:Z===F-1?cn(l):M(le,se)}),G=T}return R}function Li(e){const t=(e??"").trim();if(!t)return[];const n=[];let i=[],o=!1,r={x:0,y:0},l={x:0,y:0},d=null,c=null;const u=()=>{if(o&&i.length>2){const m=i[0],h=i[i.length-1];Math.abs(m.p.x-h.p.x)<1e-6&&Math.abs(m.p.y-h.p.y)<1e-6&&(m.in=h.in??m.in,i.pop())}i.length>1&&n.push({nodes:i,closed:o}),i=[],o=!1},p=(m,h)=>{i.push({p:m,in:Vn(h??null,m),out:null}),r=m},x=m=>{if(!i.length)return;const h=i[i.length-1];h.out=Vn(m,h.p)};fs.lastIndex=0;let v=fs.exec(t);for(;v!==null;){const m=v[1],h=m.toUpperCase(),y=m!==h,b=$$(v[2]),C=S=>y?{x:r.x+b[S],y:r.y+b[S+1]}:{x:b[S],y:b[S+1]};if(h==="Z")o=!0,u(),r=cn(l),d=null,c=null;else if(h==="M"){for(let S=0;S+1<b.length;S+=2){const w=C(S);S===0&&(u(),l=cn(w)),p(w)}d=null,c=null}else if(h==="L"){for(let S=0;S+1<b.length;S+=2)p(C(S));d=null,c=null}else if(h==="H"){for(const S of b)p({x:y?r.x+S:S,y:r.y});d=null,c=null}else if(h==="V"){for(const S of b)p({x:r.x,y:y?r.y+S:S});d=null,c=null}else if(h==="C"){for(let S=0;S+5<b.length;S+=6){const w=C(S),D=C(S+2),_=C(S+4);x(w),p(_,D),d=D}c=null}else if(h==="S"){for(let S=0;S+3<b.length;S+=4){const w=d?Ds(d,r):cn(r),D=C(S),_=C(S+2);x(w),p(_,D),d=D}c=null}else if(h==="Q")for(let S=0;S+3<b.length;S+=4){const w=C(S),D=C(S+2);x($n(r,w,2/3)),p(D,$n(D,w,2/3)),c=w,d=null}else if(h==="T")for(let S=0;S+1<b.length;S+=2){const w=c?Ds(c,r):cn(r),D=C(S);x($n(r,w,2/3)),p(D,$n(D,w,2/3)),c=w,d=null}else if(h==="A")for(let S=0;S+6<b.length;S+=7){const w=y?{x:r.x+b[S+5],y:r.y+b[S+6]}:{x:b[S+5],y:b[S+6]};for(const D of T$(r,b[S],b[S+1],b[S+2],b[S+3]!==0,b[S+4]!==0,w))x(D.c1),p(D.p,D.c2);d=null,c=null}v=fs.exec(t)}return u(),n}function On(e){return`${Number(e.toFixed(2))}`}function Vn(e,t){return!e||Math.abs(e.x-t.x)<1e-6&&Math.abs(e.y-t.y)<1e-6?null:e}function lp(e){return!!(Vn(e.in,e.p)||Vn(e.out,e.p))}function Bo(e,t){return!Vn(e.out,e.p)&&!Vn(t.in,t.p)}function xd(e,t){if(Bo(e,t))return`L${On(t.p.x)},${On(t.p.y)}`;const n=Vn(e.out,e.p)??e.p,i=Vn(t.in,t.p)??t.p;return`C${On(n.x)},${On(n.y)} ${On(i.x)},${On(i.y)} ${On(t.p.x)},${On(t.p.y)}`}function No(e){const t=[];for(const n of e){if(n.nodes.length<2)continue;const[i,...o]=n.nodes;t.push(`M${On(i.p.x)},${On(i.p.y)}`);let r=i;for(const l of o)t.push(xd(r,l)),r=l;if(n.closed){const l=xd(r,i);l.charAt(0)==="C"&&t.push(l),t.push("Z")}}return t.join(" ")}function cp(e){const t=[];for(let n=0;n+1<e.nodes.length;n+=1)t.push({from:e.nodes[n],to:e.nodes[n+1],index:n});if(e.closed&&e.nodes.length>2){const n=e.nodes.length-1;t.push({from:e.nodes[n],to:e.nodes[0],index:n})}return t}function zs(e,t,n){if(Bo(e,t))return $n(e.p,t.p,n);const i=e.out??e.p,o=t.in??t.p,r=1-n,l=r*r*r,d=3*r*r*n,c=3*r*n*n,u=n*n*n;return{x:l*e.p.x+d*i.x+c*o.x+u*t.p.x,y:l*e.p.y+d*i.y+c*o.y+u*t.p.y}}function yr(e){const t=[];for(const n of e){if(n.nodes.length<2)continue;const i=[];for(const o of cp(n)){if(Bo(o.from,o.to)){i.push(cn(o.from.p));continue}for(let r=0;r<Hs;r+=1)i.push(zs(o.from,o.to,r/Hs))}n.closed||i.push(cn(n.nodes[n.nodes.length-1].p)),i.length>2&&t.push(i)}return t}function Si(e){let t=1/0,n=1/0,i=-1/0,o=-1/0;for(const r of yr(e))for(const l of r)l.x<t&&(t=l.x),l.x>i&&(i=l.x),l.y<n&&(n=l.y),l.y>o&&(o=l.y);return{minX:t,minY:n,maxX:i,maxY:o}}function L$(e){const t=Si(e);return!isFinite(t.minX)||!isFinite(t.maxX)||!isFinite(t.minY)||!isFinite(t.maxY)?null:{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}}function dp(e,t,n){const i={x:(n.x-e.x)/6,y:(n.y-e.y)/6};return{in:{x:t.x-i.x,y:t.y-i.y},out:{x:t.x+i.x,y:t.y+i.y}}}function up(e){return e.filter(t=>t.length>2).map(t=>{if(t.length<=g$)return{closed:!0,nodes:t.map(r=>({p:cn(r),in:null,out:null}))};const n=Math.max(1,Math.round(t.length/h$)),i=[];for(let r=0;r<t.length;r+=n)i.push(t[r]);const o=i.length;return{closed:!0,nodes:i.map((r,l)=>({p:cn(r),...dp(i[(l-1+o)%o],r,i[(l+1)%o])}))}})}function pp(e,t,n=1){if(!e.length)return!1;const i=Si(e);if(!isFinite(i.minX)||!isFinite(i.maxX))return!1;const o=i.maxX-i.minX,r=i.maxY-i.minY;if(o<=t.width*2.5&&r<=t.height*2.5)return!1;const l=Math.max(n,t.width*.5),d=Math.max(n,t.height*.5);return i.minX<t.x-l||i.minY<t.y-d||i.maxX>t.x+t.width+l||i.maxY>t.y+t.height+d}function I$(e,t,n,i,o,r,l){const d=t.width>0?n.width/t.width:1,c=t.height>0?n.height/t.height:1;return!(r>0)||!(l>0)||!(d>0)||!(c>0)?e:ln(e,u=>{const p=i+(u.x-t.x)*r,x=o+(u.y-t.y)*l;return{x:t.x+p/d,y:t.y+x/c}})}function R$(e,t){if(!e.length)return e;const n=Si(e),i=n.maxX-n.minX,o=n.maxY-n.minY;if(!(i>0)||!(o>0)||n.minX>=t.x-1e-6&&n.minY>=t.y-1e-6&&n.maxX<=t.x+t.width+1e-6&&n.maxY<=t.y+t.height+1e-6)return e;const l=Math.min(t.width/i,t.height/o),d=t.x+(t.width-i*l)/2,c=t.y+(t.height-o*l)/2;return ln(e,u=>({x:d+(u.x-n.minX)*l,y:c+(u.y-n.minY)*l}))}function mp(e){const t={x:0,y:0,width:ha,height:ha},n=e!=="custom"?Ml[e]:void 0,i=n?ln(Li(n),r=>({x:r.x/100*t.width+t.x,y:r.y/100*t.height+t.y})):ln(up(Os("rectangle")),r=>({x:r.x*t.width+t.x,y:r.y*t.height+t.y})),o=R$(i,t);return{shape:e,customPath:No(o),pathFit:"viewbox",pathViewBox:Ws}}function Vr(e,t){return t>0?Math.round(e/t)*t:e}function P$(e,t,n,i){var u;const o=(u=e[t])==null?void 0:u.nodes[n];if(!o)return e;const r=i.x-o.p.x,l=i.y-o.p.y,d=zn(e),c=d[t].nodes[n];return c.p={x:o.p.x+r,y:o.p.y+l},c.in&&(c.in={x:c.in.x+r,y:c.in.y+l}),c.out&&(c.out={x:c.out.x+r,y:c.out.y+l}),d}function bd(e,t,n,i){var r;if(!t.length)return e;const o=zn(e);for(const{contour:l,node:d}of t){const c=(r=o[l])==null?void 0:r.nodes[d];c&&(c.p={x:c.p.x+n,y:c.p.y+i},c.in&&(c.in={x:c.in.x+n,y:c.in.y+i}),c.out&&(c.out={x:c.out.x+n,y:c.out.y+i}))}return o}function E$(e,t){const n=new Map;for(const{contour:o,node:r}of t){const l=n.get(o)??[];l.push(r),n.set(o,l)}let i=e;return n.forEach((o,r)=>{const l=[...o].sort((d,c)=>c-d);for(const d of l)i=gp(i,r,d)}),i}function M$(e,t,n,i,o,r){var u;if(!((u=e[t])==null?void 0:u.nodes[n]))return e;const d=zn(e),c=d[t].nodes[n];if(c[i]=cn(o),r){const p=i==="in"?"out":"in";c[p]=Ds(o,c.p)}return d}function k$(e,t,n,i){var l;const o=(l=e[t])==null?void 0:l.nodes[n];if(!o||!o[i])return e;const r=zn(e);return r[t].nodes[n][i]=null,r}function A$(e,t,n,i){const o=e[t];if(!o)return{contours:e,nodeIndex:-1};const r=o.nodes[n],l=o.nodes[(n+1)%o.nodes.length];if(!r||!l)return{contours:e,nodeIndex:-1};const d=zn(e),c=d[t].nodes,u=n+1;if(Bo(r,l))return c.splice(u,0,{p:$n(r.p,l.p,i),in:null,out:null}),{contours:d,nodeIndex:u};const p=r.out??r.p,x=l.in??l.p,v=$n(r.p,p,i),m=$n(p,x,i),h=$n(x,l.p,i),y=$n(v,m,i),b=$n(m,h,i),C=$n(y,b,i),S=(n+1)%o.nodes.length;return c[n].out=v,c[S].in=h,c.splice(u,0,{p:C,in:y,out:b}),{contours:d,nodeIndex:u}}function gp(e,t,n){const i=e[t];if(!i||i.nodes.length<=3)return e;const o=zn(e);return o[t].nodes.splice(n,1),o}function Sd(e,t,n){const i=e[t];if(!(i==null?void 0:i.nodes[n]))return e;const r=zn(e),l=r[t].nodes,d=l[n],c=l.length,u=(n-1+c)%c,p=(n+1)%c,x=!!Vn(l[u].out,l[u].p),v=!!Vn(l[p].in,l[p].p);if(lp(d)||x||v)return d.in=null,d.out=null,l[u].out=null,l[p].in=null,r;const m=dp(l[u].p,d.p,l[p].p);return d.in=m.in,d.out=m.out,r}function F$(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,l=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)),d={x:t.x+i*l,y:t.y+o*l};return{t:l,distance:Math.hypot(e.x-d.x,e.y-d.y),point:d}}function wd(e,t){let n=null;return e.forEach((i,o)=>{for(const r of cp(i)){const l=Bo(r.from,r.to)?1:Hs;for(let d=0;d<l;d+=1){const c=d/l,u=(d+1)/l,p=F$(t,zs(r.from,r.to,c),zs(r.from,r.to,u));(!n||p.distance<n.distance)&&(n={contour:o,segment:r.index,t:c+(u-c)*p.t,distance:p.distance,point:p.point})}}}),n}function N$(e,t){const n=[];return e.forEach((i,o)=>{i.nodes.forEach((r,l)=>{o===t.contour&&l===t.node||n.push(r.p)})}),n}function $d(e,t,n){const i=t.filter((r,l)=>isFinite(r)&&t.findIndex(d=>Math.abs(d-r)<1e-6)===l),o=i.map(r=>({value:r,axis:r,from:null}));for(const r of e)o.push({value:r[n],axis:null,from:r});for(const r of i)for(const l of e)o.push({value:r*2-l[n],axis:r,from:l});return o}function Cd(e,t,n,i,o){const r=i(t)[n];let l=null,d=1/0;for(const c of e){const u=n==="x"?{x:c.value,y:t.y}:{x:t.x,y:c.value},p=Math.abs(i(u)[n]-r);p>o||l&&p>=d||(l=c,d=p)}return l}function _$(e,t){return e.length===t.length&&e.every((n,i)=>n.kind===t[i].kind&&n.a.x===t[i].a.x&&n.a.y===t[i].a.y&&n.b.x===t[i].b.x&&n.b.y===t[i].b.y)}function W$(e){const t=Math.PI*2;return((e+Math.PI)%t+t)%t-Math.PI}function Bs(e,t){const n=t.x-e.x,i=t.y-e.y,o=Math.hypot(n,i);return o<1e-6?null:{x:n/o,y:i/o}}function H$(e,t){const n=Bs(e,t);return n?{kind:"align",a:{x:e.x-n.x*go,y:e.y-n.y*go},b:{x:t.x+n.x*go,y:t.y+n.y*go}}:{kind:"align",a:e,b:t}}function js(e,t,n){return t==="x"?{kind:"center",a:{x:e,y:0},b:{x:e,y:n.height}}:{kind:"center",a:{x:0,y:e},b:{x:n.width,y:e}}}function Td(e,t,n,i,o){if(e.axis===null)return H$(n,o(e.from??n));const r=t==="x"?{x:e.axis,y:0}:{x:0,y:e.axis};return js(o(r)[t],t,i)}function O$(e,t,n,i,o){const r=[],l=o(e);return t&&e.x===t.value&&r.push(Td(t,"x",l,i,o)),n&&e.y===n.value&&r.push(Td(n,"y",l,i,o)),r}function D$(e,t,n,i){const o=e==null?void 0:e.nodes[t];if(!e||!o)return null;const r=i(o.p),l=n==="in"?o.out:o.in;if(l)return Bs(i(l),r);const d=e.nodes.length,c=t+(n==="in"?1:-1);if(!e.closed&&(c<0||c>=d))return null;const u=e.nodes[(c+d)%d];if(!u)return null;const p=(n==="in"?u.in:u.out)??u.p;return Bs(i(p),r)}function z$(e,t,n,i,o,r,l){const d=r(t),c=r(e),u=c.x-d.x,p=c.y-d.y,x=Math.hypot(u,p);if(x<1e-6)return{point:e,guides:ho};const v=Math.atan2(p,u),m=Math.round(v/hd)*hd;let h=o?m:null,y=!1;if(!o){const z=[];n&&z.push({angle:Math.atan2(n.y,n.x),smooth:!0}),z.push({angle:m,smooth:!1});for(const H of z){const L=W$(H.angle-v);if(!(Math.abs(L)>v$)&&!(Math.abs(Math.sin(L))*x>y$)){h=H.angle,y=H.smooth;break}}}const b=i!==null&&i>0&&Math.abs(x-i)<=x$;if(h===null&&!b)return{point:e,guides:ho};const C=h??v,S=b?i:x,w={x:Math.cos(C),y:Math.sin(C)},D=S+(h===null?0:go),_=b?S:y?go:0;return{point:l({x:d.x+w.x*S,y:d.y+w.y*S}),guides:[{kind:"angle",a:{x:d.x-w.x*_,y:d.y-w.y*_},b:{x:d.x+w.x*D,y:d.y+w.y*D}}]}}const Vs=.1,Gs=8,B$=4,Ld=10,fa=(e,t)=>{switch(t){case"nw":return{x:e.minX,y:e.minY};case"ne":return{x:e.maxX,y:e.minY};case"se":return{x:e.maxX,y:e.maxY};case"sw":return{x:e.minX,y:e.maxY}}},hp=e=>{switch(e){case"nw":return"se";case"ne":return"sw";case"se":return"nw";case"sw":return"ne"}},Xs=(e,t)=>{const n=fa(e,t),i=t==="nw"||t==="sw"?-1:1,o=t==="nw"||t==="ne"?-1:1;return{x:n.x+i*Ld,y:n.y+o*Ld}},qs=(e,t)=>!(t.width>0)||!(t.height>0)||!(e.width>0)||!(e.height>0)?1:Math.max(e.width/t.width,e.height/t.height),Gi=(e,t,n)=>{const i=qs(e,t)*n;return{width:t.width*i,height:t.height*i}},Dn=(e,t,n)=>(e-t)*n,fo=(e,t,n,i)=>{const o=e-t;if(Math.abs(o)<1e-6)return .5;const r=n/o;return(i==null?void 0:i.clamp)===!1?r:Math.abs(o)<B$?.5:ga(r)},j$=(e,t,n,i,o,r)=>{const l=Gi(e,n,r),d=e.x+Dn(e.width,l.width,i),c=e.y+Dn(e.height,l.height,o),u=qs(e,n),p=qs(t,n),x=Math.min(Gs,Math.max(Vs,p>0?r*(u/p):r)),v=Gi(t,n,x);return{focalX:fo(t.width,v.width,d-t.x,{clamp:!1}),focalY:fo(t.height,v.height,c-t.y,{clamp:!1}),scale:x}},Id=1.08,Gr=14,Xr=8;function V$({P:e,box:t,bounds:n,natural:i,imageUrl:o,maskPath:r,stage:l,onStageChange:d,focalX:c,focalY:u,scale:p,onChange:x,onCommit:v}){const m=s.useRef(null),h=`pretext-image-ghost-${s.useId().replace(/:/g,"")}`,y=s.useRef(null),b=s.useRef(null),C=s.useRef({focalX:c,focalY:u,scale:p});C.current={focalX:c,focalY:u,scale:p};const S=l==="image";s.useEffect(()=>{var W;S&&((W=m.current)==null||W.focus({preventScroll:!0}))},[S]);const w=s.useCallback((W,g)=>{var R;const M=(R=m.current)==null?void 0:R.getBoundingClientRect();return!M||M.width<=0||M.height<=0?{x:0,y:0}:{x:(W-M.left)/M.width*t.width,y:(g-M.top)/M.height*t.height}},[t.width,t.height]),D=W=>{var M,R;if(!i)return;W.stopPropagation(),W.preventDefault(),(M=m.current)==null||M.focus({preventScroll:!0});const g=Gi(n,i,p);y.current={pointerId:W.pointerId,origin:w(W.clientX,W.clientY),startX:Dn(n.width,g.width,c),startY:Dn(n.height,g.height,u),width:g.width,height:g.height,moved:!1},(R=m.current)==null||R.setPointerCapture(W.pointerId)},_=(W,g)=>{var le,se;if(!i)return;W.stopPropagation(),W.preventDefault(),(le=m.current)==null||le.focus({preventScroll:!0});const M=Gi(n,i,p),R=Dn(n.width,M.width,c),G=Dn(n.height,M.height,u),Z={minX:R,minY:G,maxX:R+M.width,maxY:G+M.height},T=fa(Z,hp(g)),j=fa(Z,g),Y=Math.hypot(j.x-T.x,j.y-T.y);!isFinite(Y)||Y<=0||(b.current={pointerId:W.pointerId,anchor:T,startDistance:Y,startScale:p,startX:R,startY:G,moved:!1},(se=m.current)==null||se.setPointerCapture(W.pointerId))},z=W=>{if(!i)return;const g=b.current;if(g&&W.pointerId===g.pointerId){W.stopPropagation(),W.preventDefault();const R=w(W.clientX,W.clientY),G={x:R.x-n.x,y:R.y-n.y},Z=Math.hypot(G.x-g.anchor.x,G.y-g.anchor.y),T=Math.min(Gs,Math.max(Vs,g.startScale*(Z/g.startDistance)));if(!g.moved&&Math.abs(T-g.startScale)<1e-4)return;g.moved=!0;const j=T/g.startScale,Y=g.anchor.x+(g.startX-g.anchor.x)*j,le=g.anchor.y+(g.startY-g.anchor.y)*j,se=Gi(n,i,T);x({focalX:fo(n.width,se.width,Y),focalY:fo(n.height,se.height,le),scale:T});return}const M=y.current;if(M&&W.pointerId===M.pointerId){W.stopPropagation(),W.preventDefault();const R=w(W.clientX,W.clientY),G=R.x-M.origin.x,Z=R.y-M.origin.y;if(!M.moved&&G===0&&Z===0)return;M.moved=!0,x({focalX:fo(n.width,M.width,M.startX+G),focalY:fo(n.height,M.height,M.startY+Z),scale:p})}},H=W=>{var R,G;const g=y.current;if(g&&W.pointerId===g.pointerId){y.current=null,W.stopPropagation(),(R=m.current)!=null&&R.hasPointerCapture(g.pointerId)&&m.current.releasePointerCapture(g.pointerId),g.moved&&v(C.current);return}const M=b.current;M&&W.pointerId===M.pointerId&&(b.current=null,W.stopPropagation(),(G=m.current)!=null&&G.hasPointerCapture(M.pointerId)&&m.current.releasePointerCapture(M.pointerId),M.moved&&v(C.current))},L=W=>{if(W.key==="Escape"){W.stopPropagation(),d("none");return}if(W.key==="="||W.key==="+"||W.key==="-"||W.key==="_"){W.preventDefault(),W.stopPropagation();const g=W.key==="="||W.key==="+",M=Math.min(Gs,Math.max(Vs,p*(g?Id:1/Id))),R={focalX:c,focalY:u,scale:M};x(R),v(R)}},V=["nw","ne","se","sw"],$={minX:n.x,minY:n.y,maxX:n.x+n.width,maxY:n.y+n.height},E=s.useMemo(()=>{const W=i??{width:n.width,height:n.height},g=Gi(n,W,p);return!(g.width>0)||!(g.height>0)?null:{x:n.x+Dn(n.width,g.width,c),y:n.y+Dn(n.height,g.height,u),width:g.width,height:g.height}},[i,n.x,n.y,n.width,n.height,c,u,p]),F=E?{minX:E.x,minY:E.y,maxX:E.x+E.width,maxY:E.y+E.height}:$;return a.jsxs("svg",{ref:m,className:`${e}-editor${S?` ${e}-editor-armed`:""}`,width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,tabIndex:0,onKeyDown:L,onPointerMove:z,onPointerUp:H,onPointerCancel:H,onLostPointerCapture:H,"data-pretext-image-editor":!0,children:[a.jsx("rect",{className:`${e}-editor-surface`,width:t.width,height:t.height,onPointerDown:()=>d("none")}),S&&o&&E&&r&&a.jsxs(a.Fragment,{children:[a.jsx("defs",{children:a.jsxs("mask",{id:h,maskUnits:"userSpaceOnUse",x:E.x,y:E.y,width:E.width,height:E.height,children:[a.jsx("rect",{x:E.x,y:E.y,width:E.width,height:E.height,fill:"#FFFFFF"}),a.jsx("path",{d:r,fillRule:"evenodd",fill:"#000000"})]})}),a.jsx("image",{className:`${e}-editor-ghost`,href:o??void 0,x:E.x,y:E.y,width:E.width,height:E.height,preserveAspectRatio:"none",mask:`url(#${h})`}),a.jsx("rect",{className:`${e}-editor-image-bounds`,x:E.x,y:E.y,width:E.width,height:E.height})]}),S&&a.jsxs(a.Fragment,{children:[a.jsx("rect",{className:`${e}-editor-bbox`,x:n.x,y:n.y,width:n.width,height:n.height}),a.jsx("rect",{className:`${e}-editor-body`,x:n.x,y:n.y,width:n.width,height:n.height,onPointerDown:D}),V.map(W=>{const g=Xs(F,W),M=W==="ne"||W==="sw";return a.jsxs("g",{children:[a.jsx("rect",{className:`${e}-editor-scale`,x:g.x-Xr/2,y:g.y-Xr/2,width:Xr,height:Xr}),a.jsx("rect",{className:`${e}-editor-scale-grab${M?` ${e}-editor-scale-grab-nesw`:""}`,x:g.x-Gr/2,y:g.y-Gr/2,width:Gr,height:Gr,onPointerDown:R=>_(R,W)})]},W)})]})]})}const Us=10,G$=Us*2,Hn=7,X$=4,ao=9,q$=3.5,Rd=1.08,U$=.05,qr=14,K$=1,Ur=14,Kr=8;function Y$({P:e,box:t,viewBox:n,contours:i,snap:o,stretchToBox:r,uniformStretch:l=!1,stage:d,onStageChange:c,onSelectionChange:u,onChange:p,onCommit:x}){const v=s.useRef(null),m=s.useRef(null),h=s.useRef(i);h.current=i;const y=s.useRef(null),b=s.useRef(null),C=s.useRef(null),S=s.useRef(null),[w,D]=s.useState([]),[_,z]=s.useState(ho),[H,L]=s.useState(null),V=s.useCallback(f=>{z(X=>_$(X,f)?X:f)},[]),$=d==="shape";s.useEffect(()=>{var f;$&&((f=v.current)==null||f.focus({preventScroll:!0}))},[$]),s.useEffect(()=>{$||D(f=>f.length?[]:f)},[$]);const E=w.length>0;s.useEffect(()=>{u==null||u(E)},[E,u]),s.useEffect(()=>()=>u==null?void 0:u(!1),[u]);const F=n.width>0?t.width/n.width:1,W=n.height>0?t.height/n.height:1,g=Math.min(F,W),M=r&&l?g:F,R=r&&l?g:W,G=r&&l?(t.width-n.width*g)/2:0,Z=r&&l?(t.height-n.height*g)/2:0,T=s.useCallback(f=>r?{x:G+(f.x-n.x)*M,y:Z+(f.y-n.y)*R}:{x:f.x-n.x,y:f.y-n.y},[r,n,M,R,G,Z]),j=s.useCallback(f=>r?{x:n.x+(M>0?(f.x-G)/M:0),y:n.y+(R>0?(f.y-Z)/R:0)}:{x:n.x+f.x,y:n.y+f.y},[r,n,M,R,G,Z]),Y=s.useMemo(()=>j({x:t.width/2,y:t.height/2}),[j,t.width,t.height]),le=s.useCallback((f,X)=>{var U;const N=(U=v.current)==null?void 0:U.getBoundingClientRect();if(!N||N.width<=0||N.height<=0)return{x:0,y:0};if(r){const me=(f-N.left)/N.width*t.width,K=(X-N.top)/N.height*t.height;return{x:n.x+(M>0?(me-G)/M:0),y:n.y+(R>0?(K-Z)/R:0)}}return{x:n.x+(f-N.left),y:n.y+(X-N.top)}},[r,n,t.width,t.height,M,R,G,Z]),se=s.useCallback((f,X)=>{var U;const N=(U=v.current)==null?void 0:U.getBoundingClientRect();return!N||N.width<=0||N.height<=0?{x:0,y:0}:{x:(f-N.left)/N.width*t.width,y:(X-N.top)/N.height*t.height}},[t.width,t.height]),k=s.useCallback((f,X)=>{const N=l&&!(X!=null&&X.preserveShape)?I$(f,n,t,G,Z,M,R):f;x(N,X)},[x,l,n,t,G,Z,M,R]),re=s.useCallback(()=>{L(null)},[]),q=s.useCallback((f,X,N)=>{if(!N||y.current||b.current||C.current||S.current){re();return}const U=se(f,X),me=ln(h.current,T);for(const te of me)for(const Ae of te.nodes)if(Math.hypot(Ae.p.x-U.x,Ae.p.y-U.y)<=ao){re();return}const K=wd(me,U);if(!K||K.distance>Us){re();return}const I=me[K.contour],ie=I==null?void 0:I.nodes[K.segment],oe=I==null?void 0:I.nodes[(K.segment+1)%((I==null?void 0:I.nodes.length)??1)],B=!!(ie&&oe&&!Bo(ie,oe));L(te=>te&&te.curved===B&&Math.hypot(te.point.x-K.point.x,te.point.y-K.point.y)<.25?te:{point:K.point,curved:B})},[se,T,re]),ce=f=>{var Fe;const X=f.metaKey||f.ctrlKey,N=C.current;if(N&&f.pointerId===N.pointerId){if(f.stopPropagation(),f.preventDefault(),N.startDistance<=0)return;const et=le(f.clientX,f.clientY),Ue=Math.hypot(et.x-N.origin.x,et.y-N.origin.y),nt=Math.max(U$,Ue/N.startDistance);if(!N.moved&&Math.abs(nt-1)<1e-4)return;N.moved=!0,p(vd(N.startContours,N.origin,nt));return}const U=b.current;if(U&&f.pointerId===U.pointerId){f.stopPropagation(),f.preventDefault();const et=le(f.clientX,f.clientY),{bbox:Ue}=U,nt=Ue.maxX-Ue.minX,tt=Ue.maxY-Ue.minY,Ve=et.x-U.origin.x,fe=et.y-U.origin.y;let He=Ve,Be=fe;if(isFinite(nt)&&isFinite(tt))if(r){let Ce=n.x,De=n.x+n.width,Xe=n.y,ge=n.y+n.height;l&&(M>0&&(Ce=n.x+(0-G)/M,De=n.x+(t.width-G)/M),R>0&&(Xe=n.y+(0-Z)/R,ge=n.y+(t.height-Z)/R));const Me=Math.min(Ce,De-nt),ze=Math.max(Ce,De-nt),Re=Math.min(Xe,ge-tt),xe=Math.max(Xe,ge-tt),Ie=Math.min(ze,Math.max(Me,Ue.minX+Ve)),Ke=Math.min(xe,Math.max(Re,Ue.minY+fe));He=Ie-Ue.minX,Be=Ke-Ue.minY}else{const Ce=Ue.minX-n.x,De=Ue.minY-n.y,Xe=Math.min(0,t.width-nt),ge=Math.max(0,t.width-nt),Me=Math.min(0,t.height-tt),ze=Math.max(0,t.height-tt),Re=Math.min(ge,Math.max(Xe,Ce+Ve)),xe=Math.min(ze,Math.max(Me,De+fe));He=Re-Ce,Be=xe-De}const Je=[];if(!X&&isFinite(nt)&&isFinite(tt)){const Ce=T({x:Ue.minX+nt/2+He,y:Ue.minY+tt/2+Be}),De={x:t.width/2,y:t.height/2};Math.abs(Ce.x-De.x)<=qr&&(He=Y.x-Ue.minX-nt/2,Je.push(js(De.x,"x",t))),Math.abs(Ce.y-De.y)<=qr&&(Be=Y.y-Ue.minY-tt/2,Je.push(js(De.y,"y",t)))}if(!U.moved&&He===0&&Be===0)return;U.moved=!0,V(Je.length?Je:ho),p(ln(U.startContours,Ce=>({x:Ce.x+He,y:Ce.y+Be})),{carryImage:!0});return}const me=S.current;if(me&&f.pointerId===me.pointerId){f.stopPropagation(),f.preventDefault();const et=le(f.clientX,f.clientY);let Ue=et.x-me.origin.x,nt=et.y-me.origin.y;if(f.shiftKey&&(Math.abs(Ue)>Math.abs(nt)?nt=0:Ue=0),!me.moved&&Ue===0&&nt===0)return;me.moved=!0,p(bd(me.startContours,me.selection,Ue,nt));return}const K=y.current;if(!K||f.pointerId!==K.pointerId){q(f.clientX,f.clientY,w.length>0||$);return}re(),f.stopPropagation(),f.preventDefault();const I=le(f.clientX,f.clientY);if(K.kind==="anchor"){const et={x:K.anchor.x+(I.x-K.origin.x),y:K.anchor.y+(I.y-K.origin.y)},Ue=X?[]:N$(h.current,{contour:K.contour,node:K.node}),nt=X||!K.center?[]:[K.center],tt=Cd($d(Ue,nt.map(He=>He.x),"x"),et,"x",T,qr),Ve=Cd($d(Ue,nt.map(He=>He.y),"y"),et,"y",T,qr),fe=X?et:{x:(tt==null?void 0:tt.value)??Vr(et.x,o),y:(Ve==null?void 0:Ve.value)??Vr(et.y,o)};if(f.shiftKey&&(Math.abs(fe.x-K.anchor.x)>Math.abs(fe.y-K.anchor.y)?fe.y=K.anchor.y:fe.x=K.anchor.x),!K.moved&&fe.x===K.anchor.x&&fe.y===K.anchor.y)return;K.moved=!0,V(O$(fe,tt,Ve,t,T)),p(P$(h.current,K.contour,K.node,fe));return}const ie=(Fe=h.current[K.contour])==null?void 0:Fe.nodes[K.node],oe=K.mirror&&!f.altKey,B=oe||X?null:K.kind==="in"?ie==null?void 0:ie.out:ie==null?void 0:ie.in,te=ie?T(ie.p):null,Ae=B?T(B):null,he=ie&&(!X||f.shiftKey)?z$(I,ie.p,oe||X?null:D$(h.current[K.contour],K.node,K.kind,T),te&&Ae?Math.hypot(Ae.x-te.x,Ae.y-te.y):null,f.shiftKey,T,j):{point:I,guides:ho},Q=he.guides.length?he.point:X?I:{x:Vr(I.x,o),y:Vr(I.y,o)},Ze=K.kind==="in"?ie==null?void 0:ie.in:ie==null?void 0:ie.out;!K.moved&&Ze&&Q.x===Ze.x&&Q.y===Ze.y||(K.moved=!0,V(he.guides),p(M$(h.current,K.contour,K.node,K.kind,Q,oe)))},J=f=>{V(ho);const X=C.current;if(X&&f.pointerId===X.pointerId){C.current=null,f.stopPropagation();const B=v.current;B!=null&&B.hasPointerCapture(X.pointerId)&&B.releasePointerCapture(X.pointerId),X.moved&&k(h.current,{preserveShape:!0});return}const N=b.current;if(N&&f.pointerId===N.pointerId){b.current=null,f.stopPropagation();const B=v.current;B!=null&&B.hasPointerCapture(N.pointerId)&&B.releasePointerCapture(N.pointerId),N.moved?k(h.current,{preserveShape:!0}):D([]);return}const U=S.current;if(U&&f.pointerId===U.pointerId){S.current=null,f.stopPropagation();const B=v.current;B!=null&&B.hasPointerCapture(U.pointerId)&&B.releasePointerCapture(U.pointerId),U.moved&&k(h.current);return}const me=y.current;if(!me||f.pointerId!==me.pointerId)return;y.current=null,f.stopPropagation();const K=v.current;K!=null&&K.hasPointerCapture(me.pointerId)&&K.releasePointerCapture(me.pointerId);const I=Math.hypot(f.clientX-me.clientOrigin.x,f.clientY-me.clientOrigin.y);if(me.moved||I>X$){me.moved&&k(h.current);return}if(!me.toggleOnRelease||f.type!=="pointerup")return;const oe=Sd(h.current,me.contour,me.node);oe!==h.current&&(p(oe),k(oe))},be=f=>{f.stopPropagation()},We=f=>{var X,N;f.stopPropagation(),f.preventDefault(),re(),(X=v.current)==null||X.focus({preventScroll:!0}),b.current={pointerId:f.pointerId,origin:le(f.clientX,f.clientY),startContours:zn(i),bbox:Si(i),moved:!1},(N=v.current)==null||N.setPointerCapture(f.pointerId)},ye=(f,X)=>{var I,ie;f.stopPropagation(),f.preventDefault(),re(),(I=v.current)==null||I.focus({preventScroll:!0}),D([]),c("shape");const N=Si(i),U=fa(N,hp(X)),me=Xs(N,X),K=Math.hypot(me.x-U.x,me.y-U.y);!isFinite(K)||K<=0||(C.current={pointerId:f.pointerId,corner:X,origin:U,startDistance:K,startContours:zn(i),moved:!1},(ie=v.current)==null||ie.setPointerCapture(f.pointerId))},ue=(f,X,N,U)=>{var I,ie,oe,B;f.stopPropagation(),f.preventDefault(),re(),(I=v.current)==null||I.focus({preventScroll:!0});const me=(ie=i[N])==null?void 0:ie.nodes[U];if(!me)return;if(f.altKey){const te=X==="anchor"?gp(i,N,U):k$(i,N,U,X);if(te===i)return;D(X==="anchor"?[]:[{contour:N,node:U}]),p(te),k(te);return}const K=f.metaKey||f.ctrlKey;if(X==="anchor"&&f.shiftKey&&!K){D(te=>te.some(Ae=>Ae.contour===N&&Ae.node===U)?te.filter(Ae=>!(Ae.contour===N&&Ae.node===U)):[...te,{contour:N,node:U}]);return}if(X==="anchor"&&!K&&w.length>1&&w.some(te=>te.contour===N&&te.node===U)){S.current={pointerId:f.pointerId,origin:le(f.clientX,f.clientY),startContours:zn(i),selection:w,moved:!1},(oe=v.current)==null||oe.setPointerCapture(f.pointerId);return}D([{contour:N,node:U}]),y.current={kind:X,contour:N,node:U,pointerId:f.pointerId,origin:le(f.clientX,f.clientY),clientOrigin:{x:f.clientX,y:f.clientY},anchor:me.p,center:L$(i),mirror:X!=="anchor"&&!!(me.in&&me.out),toggleOnRelease:K,moved:!1},(B=v.current)==null||B.setPointerCapture(f.pointerId)},ee=f=>{f.stopPropagation(),f.preventDefault(),re();const X=ln(i,T),N=wd(X,se(f.clientX,f.clientY));if(!N||N.distance>Us)return;const{contours:U,nodeIndex:me}=A$(i,N.contour,N.segment,N.t);me<0||(D([{contour:N.contour,node:me}]),p(U),k(U))},de=f=>{if(f.key==="="||f.key==="+"||f.key==="-"||f.key==="_"){f.preventDefault(),f.stopPropagation();const K=Si(i);if(!isFinite(K.minX)||!isFinite(K.maxX))return;const I={x:(K.minX+K.maxX)/2,y:(K.minY+K.maxY)/2},oe=f.key==="="||f.key==="+"?Rd:1/Rd,B=vd(i,I,oe);p(B),k(B,{preserveShape:!0});return}if(f.key==="Escape"){f.stopPropagation(),D([]),c("none");return}if(!w.length)return;if(f.key==="Backspace"||f.key==="Delete"){f.preventDefault(),f.stopPropagation();const K=E$(i,w);if(K===i)return;D([]),p(K),k(K);return}const X=o>0?o:K$,N=f.shiftKey?X*10:X,U={ArrowLeft:[-N,0],ArrowRight:[N,0],ArrowUp:[0,-N],ArrowDown:[0,N]}[f.key];if(!U)return;f.preventDefault(),f.stopPropagation();const me=bd(i,w,U[0],U[1]);p(me),k(me)},ne=s.useMemo(()=>No(ln(i,T)),[i,T]),Pe=s.useMemo(()=>Si(i),[i]),Te=T({x:Pe.minX,y:Pe.minY}),Oe={width:T({x:Pe.maxX,y:Pe.minY}).x-Te.x,height:T({x:Pe.minX,y:Pe.maxY}).y-Te.y},ve=$&&w.length===0&&isFinite(Pe.minX)&&isFinite(Pe.maxX)&&Pe.maxX>Pe.minX&&Pe.maxY>Pe.minY,Se=w.length>0||$,$e=Se;return a.jsxs("svg",{ref:v,className:`${e}-editor${Se?` ${e}-editor-armed`:""}`,width:t.width,height:t.height,viewBox:`0 0 ${t.width} ${t.height}`,tabIndex:0,onKeyDown:de,onPointerDown:()=>{var f;return(f=v.current)==null?void 0:f.focus({preventScroll:!0})},onPointerMove:ce,onPointerLeave:re,onPointerUp:J,onPointerCancel:J,onLostPointerCapture:J,onContextMenu:f=>{f.preventDefault()},"data-pretext-path-editor":!0,"data-selection":"none",children:[a.jsx("rect",{className:`${e}-editor-surface`,width:t.width,height:t.height,onPointerDown:()=>{D([]),c("none")},onClick:ee}),$e&&a.jsx("path",{className:`${e}-editor-outline`,d:ne}),$e&&_.map((f,X)=>a.jsx("line",{className:`${e}-editor-snap ${e}-editor-snap-${f.kind}`,x1:f.a.x,y1:f.a.y,x2:f.b.x,y2:f.b.y},`${f.kind}-${X}`)),a.jsx("path",{ref:m,className:`${e}-editor-body`,d:ne,fillRule:"evenodd",onPointerDown:We,onClick:ee}),$e&&a.jsx("path",{className:`${e}-editor-hit`,d:ne,style:{strokeWidth:G$},onClick:ee}),$e&&H&&a.jsx("rect",{className:`${e}-editor-add-preview`,x:H.point.x-Hn/2,y:H.point.y-Hn/2,width:Hn,height:Hn,rx:H.curved?Hn/2:0}),$e&&i.map((f,X)=>f.nodes.map((N,U)=>{const me=w.some(I=>I.contour===X&&I.node===U),K=T(N.p);return a.jsxs("g",{children:[me&&w.length===1&&["in","out"].map(I=>{const ie=N[I];if(!ie)return null;const oe=T(ie);return a.jsxs("g",{children:[a.jsx("line",{className:`${e}-editor-handle-line`,x1:K.x,y1:K.y,x2:oe.x,y2:oe.y}),a.jsx("circle",{className:`${e}-editor-handle`,cx:oe.x,cy:oe.y,r:q$}),a.jsx("circle",{className:`${e}-editor-grab`,cx:oe.x,cy:oe.y,r:ao,onPointerDown:B=>ue(B,I,X,U),onClick:be})]},I)}),a.jsx("rect",{className:`${e}-editor-anchor${me?` ${e}-editor-anchor-selected`:""}`,x:K.x-Hn/2,y:K.y-Hn/2,width:Hn,height:Hn,rx:lp(N)?Hn/2:0}),a.jsx("rect",{className:`${e}-editor-grab`,x:K.x-ao,y:K.y-ao,width:ao*2,height:ao*2,onPointerDown:I=>ue(I,"anchor",X,U),onClick:be,onDoubleClick:I=>{I.stopPropagation(),I.preventDefault();const ie=Sd(i,X,U);p(ie),k(ie)}})]},`${X}-${U}`)})),ve&&a.jsxs("g",{children:[a.jsx("rect",{className:`${e}-editor-bbox`,x:Te.x,y:Te.y,width:Oe.width,height:Oe.height}),["nw","ne","se","sw"].map(f=>{const X=T(Xs(Pe,f)),N=f==="ne"||f==="sw";return a.jsxs("g",{children:[a.jsx("rect",{className:`${e}-editor-scale`,x:X.x-Kr/2,y:X.y-Kr/2,width:Kr,height:Kr}),a.jsx("rect",{className:`${e}-editor-scale-grab${N?` ${e}-editor-scale-grab-nesw`:""}`,x:X.x-Ur/2,y:X.y-Ur/2,width:Ur,height:Ur,onPointerDown:U=>ye(U,f),onClick:be})]},f)})]})]})}const Z$=4e3,J$=/^(?:https?:|mailto:|tel:)/i;function fp(e){return!!e&&typeof e=="object"&&e.type==="link"}function Q$(e){if(!e)return;const t=e.replace(/\s+/g,"");if(!(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!J$.test(t)))return t}function eC(e){const t=[];return e.forEach((n,i)=>{const o=(r,l,d)=>{for(const c of r){if(fp(c)){o(c.children??[],Q$(c.value),c.target);continue}const u=c,p=(u==null?void 0:u.text)??"";if(p.trim())for(const x of p.split(/\s+/))x&&t.push({text:x,leaf:u,href:l,target:d,para:i})}};o((n==null?void 0:n.children)??[])}),t}function Pd(e){return{...e.fontFamily&&{fontFamily:Oo(e.fontFamily)},...e.fontWeight&&{fontWeight:e.fontWeight},...e.fontStyle&&{fontStyle:e.fontStyle},...e.textDecoration&&{textDecoration:e.textDecoration},...e.textTransform&&{textTransform:e.textTransform},...e.fontVariant&&{fontVariant:e.fontVariant},...e.verticalAlign&&{verticalAlign:e.verticalAlign,lineHeight:"0px"}}}function tC(e){return e.map(t=>{const n=[],i=o=>{for(const r of o){if(fp(r)){i(r.children??[]);continue}n.push((r==null?void 0:r.text)??"")}};return i((t==null?void 0:t.children)??[]),n.join("")})}function Ed(e){const{tokens:t,widths:n,rings:i,mode:o,align:r,scale:l,width:d,height:c,allowOverflow:u,capInset:p,capLines:x}=e,v=e.lineHeight*l,m=e.spaceWidth*l,h=[];if(!t.length||d<=0||v<=0)return{segments:h,placed:0,height:0,capLeft:0,capTop:0};const y=Math.max(1,m*.5),b=v*r$;let C=0,S=0,w=0,D=t[0].para,_=0,z=0,H=null;for(;C<t.length&&w<Z$;){const L=S+v>c;if(L&&!u)break;const V=t[C].para;if(V>D+1){S+=v*(V-D-1),D=V-1,w+=1;continue}let $=L?[{x0:0,x1:d}]:m$(i,(S+b)/c,(S+v-b)/c,o).map(F=>({x0:F.x0*d,x1:F.x1*d}));p>0&&x>0&&!L&&$.length&&(H===null&&(H=w,_=$[0].x0,z=S),w-H<x&&($=p$($,{x0:_,x1:_+p})));const E=$.reduce((F,W)=>Math.max(F,W.x1-W.x0),0);for(const F of $){const W=F.x1-F.x0;if(W<y)continue;if(C>=t.length||t[C].para!==V)break;const g=C;let M=0;for(;C<t.length&&t[C].para===V;){const R=n[C]*l,G=C===g?R:m+R;if(M+G>W&&!(C===g&&W>=E-.5&&R>d-.5))break;M+=G,C+=1}if(C>g){const R=C>=t.length||t[C].para!==V;h.push({top:S,left:F.x0,width:W,from:g,to:C,justify:r==="justify"&&!R})}if(C>=t.length||t[C].para!==V)break}D=V,S+=v,w+=1}return{segments:h,placed:C,height:h.length?S:0,capLeft:_,capTop:z}}const nC=.12,iC=2,oC=10,vs=.25,rC=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},aC=(e,t)=>Math.abs(e.top-t.top)<.5&&Math.abs(e.left-t.left)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5,sC=(e,t)=>{const[n,i]=s.useState(null);return s.useEffect(()=>{if(!e||!t){i(null);return}let o=0,r=null;const l=()=>{const d=rC(e);(!r||!aC(r,d))&&(r=d,i(d)),o=requestAnimationFrame(l)};return l(),()=>cancelAnimationFrame(o)},[e,t]),n},xs=(e,t)=>{if(!(t.width>0)||!(t.height>0))return e;const n=Math.min(t.width,t.height),i=(t.width-n)/2,o=(t.height-n)/2;return e.map(r=>r.map(l=>({x:(i+l.x*n)/t.width,y:(o+l.y*n)/t.height})))},Yr=typeof window>"u"?s.useEffect:s.useLayoutEffect;function lC(){return typeof document>"u"?null:document.body}function cC({P:e,item:t,shape:n,customPath:i,pathFit:o,viewBox:r,mode:l,align:d,allowOverflow:c,fitEnabled:u,scale:p,onFitScale:x,dropCapLines:v,dropCapSize:m,showGuides:h,typography:y,imageUrl:b,imageFocalX:C,imageFocalY:S,imageScale:w,imageCustomPath:D,pathDragActive:_,pathCarryImage:z,onCarryImageConsumed:H,pathEditor:L,imageEditor:V}){var De,Xe;const $=`pretext-shape-image-${s.useId().replace(/:/g,"")}`,[E,F]=s.useState(null),W=s.useRef(null),[g,M]=s.useState({width:0,height:0}),[R,G]=s.useState(null),[Z,T]=s.useState(0),[j,Y]=s.useState("none");s.useEffect(()=>{!L&&!V&&Y("none")},[L,V]);const[le,se]=s.useState(null);s.useEffect(()=>{if(!b||typeof Image>"u"){se(null);return}let ge=!1;const Me=new Image;return Me.onload=()=>{ge||se({width:Me.naturalWidth,height:Me.naturalHeight})},Me.src=b,()=>{ge=!0}},[b]);const k=s.useMemo(()=>Array.isArray(t==null?void 0:t.text)?t.text:[],[t]),re=s.useMemo(()=>eC(k),[k]),q=s.useMemo(()=>tC(k),[k]),ce=v>0&&m>1?((Xe=(De=re[0])==null?void 0:De.text)==null?void 0:Xe.charAt(0))??"":"",J=(L==null?void 0:L.contours)??null,be=s.useMemo(()=>{let ge=[];if(J){const Me=yr(J);Me.length&&(ge=So(Me,r))}if(!ge.length){const Me=i.trim(),ze=Me?gd(Me,o,r):null;ze&&ze.length?ge=ze:ge=Os(n==="custom"?"rectangle":n)}return n==="circle"?xs(ge,g):ge},[J,n,i,o,r,g.width,g.height]),We=L==null?void 0:L.onConvert,ye=(L==null?void 0:L.needsConversion)??!1,ue=s.useMemo(()=>{if(n==="circle")return!1;const ge=J??(i.trim()?Li(i):null);return!!(ge&&pp(ge,r))},[J,i,r,n]),[ee,de]=s.useState(null);Yr(()=>{if(!ue){ee&&de(null);return}!ee&&g.width>0&&g.height>0&&de({width:g.width,height:g.height})},[ue,g.width,g.height,ee]);const ne=s.useMemo(()=>{if(!ue||g.width<=0||g.height<=0)return be;const ge=ee??g,Me=r.width/ge.width,ze=r.height/ge.height;return be.map(Re=>Re.map(xe=>({x:xe.x*Me,y:xe.y*ze})))},[be,ue,ee,r.width,r.height,g.width,g.height]),Pe=s.useMemo(()=>{if(J){const Re=yr(J);if(Re.length){const xe=So(Re,r);return n==="circle"?xs(xe,g):xe}}const ge=D.trim(),Me=ge?gd(ge,o,r):null,ze=Me&&Me.length?Me:Os(n==="custom"?"rectangle":n);return n==="circle"?xs(ze,g):ze},[J,n,D,o,r,g.width,g.height]),Te=s.useMemo(()=>{if(!ue||g.width<=0||g.height<=0)return Pe;const ge=ee??g,Me=r.width/ge.width,ze=r.height/ge.height;return Pe.map(Re=>Re.map(xe=>({x:xe.x*Me,y:xe.y*ze})))},[Pe,ue,ee,r.width,r.height,g.width,g.height]),Oe=s.useRef(null),ve=s.useRef(!1);s.useEffect(()=>{if(!(!We||g.width<=0||g.height<=0)){if(ue){if(Oe.current===i)return;const ge=J??(i.trim()?Li(i):null);if(!(ge!=null&&ge.length))return;const Me=ln(ge,ze=>({x:r.x+(ze.x-r.x)/g.width*r.width,y:r.y+(ze.y-r.y)/g.height*r.height}));Oe.current=No(Me),We(Me);return}!ye||!be.length||ve.current||(ve.current=!0,We(ln(up(be),ge=>({x:ge.x*ha,y:ge.y*ha}))))}},[ye,ue,We,be,J,i,r,g.width,g.height]),Yr(()=>{const ge=E;if(!ge||typeof ResizeObserver>"u")return;const Me=()=>{const Re=ge.getBoundingClientRect();M(xe=>Math.abs(xe.width-Re.width)<.5&&Math.abs(xe.height-Re.height)<.5?xe:{width:Re.width,height:Re.height})};Me();const ze=new ResizeObserver(Me);return ze.observe(ge),()=>ze.disconnect()},[E]),s.useEffect(()=>{const ge=typeof document<"u"?document.fonts:void 0;ge!=null&&ge.ready&&ge.ready.then(()=>{T(Me=>Me+1)})},[]),Yr(()=>{const ge=W.current;if(!ge)return;if(!re.length){G(null);return}const Me=[],ze=document.createDocumentFragment();for(const Qe of re){const dt=document.createElement("span");Object.assign(dt.style,Pd(Qe.leaf)),dt.textContent=Qe.text,ze.appendChild(dt),Me.push(dt)}const Re=document.createElement("span");Re.textContent=" ",ze.appendChild(Re);const xe=ce||"H",Ie=document.createElement("span");Ie.textContent=xe,Ie.style.lineHeight="1",ze.appendChild(Ie),ge.replaceChildren(ze);const Ke=window.getComputedStyle(ge),Ne=parseFloat(Ke.fontSize)||16,it=parseFloat(Ke.lineHeight),ot=Number.isNaN(it)?Ne*1.2:it,rt=Math.max(ot,Ne),ht=document.createElement("span");ht.textContent=xe,ht.style.lineHeight=`${rt}px`;const Pt=document.createElement("span");Pt.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",ht.appendChild(Pt),ge.appendChild(ht);const Et=ht.getBoundingClientRect().top,ut=Pt.getBoundingClientRect().top,gt=Math.max(1,ut-Et);ht.remove();let $t=gt*.8;const ft=document.createElement("canvas").getContext("2d"),At=Qe=>`${Ke.fontStyle} ${Ke.fontWeight} ${Qe}px ${Ke.fontFamily}`;if(ft){ft.font=At(Ne);const Qe=ft.measureText(xe).actualBoundingBoxAscent;Qe>0&&($t=Qe)}const zt=m>1?(m-1)*rt+$t:$t;let jt=Ne*(zt/$t);if(ft){ft.font=At(jt);const Qe=ft.measureText(xe).actualBoundingBoxAscent;Qe>0&&(jt=jt*(zt/Qe))}Ie.style.fontSize=`${jt}px`,Ie.style.lineHeight=`${jt}px`;const Zt=document.createElement("span");Zt.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",Ie.appendChild(Zt);const Ct=Math.max(1,Zt.getBoundingClientRect().top-Ie.getBoundingClientRect().top);Zt.remove();const rn=(m-1)*rt+gt-Ct,lt=Me.map(Qe=>Qe.getBoundingClientRect().width),Ee=Re.getBoundingClientRect().width,je=ce?Ie.getBoundingClientRect().width:0;ge.replaceChildren(),G({widths:lt,spaceWidth:Ee,lineHeight:rt,capWidth:je,dropCapFontSize:jt,dropCapTopAdjust:rn})},[re,y,ce,v,m,Z,g.width]);const Se=R&&ce?R.capWidth+R.lineHeight*nC:0,$e=Math.max(v,Math.ceil(m)),f=s.useMemo(()=>{if(!R||!re.length||g.width<=0||g.height<=0||!u)return 1;const ge=Re=>Ed({tokens:re,widths:R.widths,spaceWidth:R.spaceWidth,lineHeight:R.lineHeight,width:g.width,height:g.height,rings:ne,mode:l,align:d,scale:Re,allowOverflow:!1,capInset:Se*Re,capLines:ce?$e:0});if(ge(1).placed>=re.length)return 1;if(ge(vs).placed<re.length)return vs;let Me=vs,ze=1;for(let Re=0;Re<oC;Re+=1){const xe=(Me+ze)/2;ge(xe).placed>=re.length?Me=xe:ze=xe}return Me},[R,re,g.width,g.height,ne,l,d,u,Se,ce,$e]);s.useEffect(()=>{x(f)},[f,x]);const X=u?Math.min(p,f):1,N=s.useMemo(()=>!R||!re.length||g.width<=0||g.height<=0?{segments:[],placed:0,height:0,capLeft:0,capTop:0}:Ed({tokens:re,widths:R.widths,spaceWidth:R.spaceWidth,lineHeight:R.lineHeight,width:g.width,height:g.height,rings:ne,mode:l,align:d,scale:X,allowOverflow:c,capInset:Se*X,capLines:ce?$e:0}),[R,re,g.width,g.height,ne,l,d,X,c,Se,ce,$e]),U=R?R.dropCapFontSize*X:0,me=R?R.dropCapTopAdjust*X:0,K=d==="justify"?"left":d,I=!!(L&&J&&g.width>0&&g.height>0),ie=!!V,oe=(I||ie)&&g.width>0&&g.height>0,B=sC(E,oe),te=oe&&B?lC():null,Ae=s.useRef(!1),he=s.useCallback(ge=>{Ae.current=ge},[]);s.useEffect(()=>{if(!I&&!ie)return;const ge=Me=>{const ze=E;if(!ze)return;const Re=ze.getBoundingClientRect();Me.clientX>=Re.left&&Me.clientX<=Re.right&&Me.clientY>=Re.top&&Me.clientY<=Re.bottom&&(Me.preventDefault(),Me.stopPropagation(),Y(Ie=>Ie==="shape"&&Ae.current?Ie:Ie==="shape"&&ie?"image":I?"shape":"image"))};return document.addEventListener("dblclick",ge,!0),()=>document.removeEventListener("dblclick",ge,!0)},[I,ie,E]);const Q=s.useMemo(()=>b&&g.width>0&&g.height>0?a$(Te,g):null,[b,Te,g.width,g.height]),Ze=s.useRef(null),Fe=(()=>{const ge=Ze.current;return z||!V||!le||!Q||!ge||D===ge.customPath||ge.shape!==n&&n!=="custom"?null:j$(ge.bounds,Q,le,ge.focalX,ge.focalY,ge.scale)})();Yr(()=>{if(_||!V||!le||!Q)return;const ge=Ze.current,Me=!!(ge&&D!==ge.customPath);Me&&Fe&&V.onCommit(Fe),Me&&z&&(H==null||H()),Ze.current={rings:Te,bounds:Q,focalX:(Fe==null?void 0:Fe.focalX)??C,focalY:(Fe==null?void 0:Fe.focalY)??S,scale:(Fe==null?void 0:Fe.scale)??w,customPath:D,shape:n}},[_,z,D,n,Te,Q,V,le,C,S,w,Fe,H]);const et=Ze.current,Ue=!!(_&&!z&&et&&!Fe),nt=Ue&&et?et.focalX:(Fe==null?void 0:Fe.focalX)??C,tt=Ue&&et?et.focalY:(Fe==null?void 0:Fe.focalY)??S,Ve=Ue&&et?et.scale:(Fe==null?void 0:Fe.scale)??w,fe=Ue&&et?et.bounds:Q,He=s.useMemo(()=>{if(!(g.width>0)||!(g.height>0))return"";let ge=fd(i,J,o,r,n,g);if(ue){const Me=ee??g,ze=r.width/Me.width,Re=r.height/Me.height;ge=ln(ge,xe=>({x:xe.x*ze,y:xe.y*Re}))}return yd(ge,g)||md(ne,g)},[i,J,o,r,n,g.width,g.height,ue,ee,ne]),Be=s.useMemo(()=>{if(!b||!(g.width>0)||!(g.height>0))return"";let ge=fd(D,J,o,r,n,g);if(ue){const Me=ee??g,ze=r.width/Me.width,Re=r.height/Me.height;ge=ln(ge,xe=>({x:xe.x*ze,y:xe.y*Re}))}return yd(ge,g)||md(Te,g)},[b,D,J,o,r,n,g.width,g.height,ue,ee,Te]),Je=`${$}-clip`,Ce=s.useMemo(()=>{if(!fe)return null;const ge=le??{width:fe.width,height:fe.height},Me=Gi(fe,ge,Ve);return{x:Dn(fe.width,Me.width,nt),y:Dn(fe.height,Me.height,tt),width:Me.width,height:Me.height}},[fe,le,nt,tt,Ve]);return a.jsxs("div",{className:`${e}-column`,ref:F,children:[He?a.jsxs("svg",{className:`${e}-shape-fill`,viewBox:`0 0 ${g.width} ${g.height}`,preserveAspectRatio:"none","aria-hidden":!0,children:[a.jsx("path",{className:`${e}-shape-fill-path`,d:He,fillRule:"evenodd"}),b&&Be&&fe&&Ce?a.jsxs(a.Fragment,{children:[a.jsx("defs",{children:a.jsx("clipPath",{id:Je,clipPathUnits:"userSpaceOnUse",children:a.jsx("path",{d:Be,fillRule:"evenodd"})})}),a.jsx("image",{href:b,x:fe.x+Ce.x,y:fe.y+Ce.y,width:Ce.width,height:Ce.height,preserveAspectRatio:"none",clipPath:`url(#${Je})`})]}):null]}):null,a.jsxs("div",{className:`${e}-flow${c?"":` ${e}-clip`}`,style:{...y,["--"+e+"-fit"]:X},children:[a.jsx("div",{className:`${e}-measure`,ref:W,style:y,"aria-hidden":!0}),N.segments.map((ge,Me)=>{const ze=re.slice(ge.from,ge.to),Re=Me===0;return a.jsx("div",{className:`${e}-line${ge.justify?` ${e}-line-justify`:""}`,"aria-hidden":!0,style:{top:`${ge.top}px`,left:`${ge.left}px`,width:`${ge.width}px`,textAlign:ge.justify?void 0:K},children:ze.map((xe,Ie)=>{const Ne=ce&&Re&&ge.from===0&&Ie===0?xe.text.slice(1):xe.text,it=Pd(xe.leaf),ot=xe.href?a.jsx("a",{className:`${e}-link`,href:xe.href,target:xe.target,rel:xe.target?"noopener noreferrer":void 0,style:it,children:Ne}):a.jsx("span",{style:it,children:Ne});return a.jsxs("span",{children:[!ge.justify&&Ie>0?" ":null,ot]},Ie)})},`${ge.from}-${ge.to}-${Me}`)}),h&&!J&&a.jsx("svg",{className:`${e}-guides`,viewBox:"0 0 1 1",preserveAspectRatio:"none","aria-hidden":!0,children:ne.map((ge,Me)=>a.jsx("polygon",{points:ge.map(ze=>`${ze.x},${ze.y}`).join(" ")},Me))})]}),ce&&R&&a.jsx("div",{className:`${e}-drop-cap`,"aria-hidden":!0,style:{...y,top:`${N.capTop+me}px`,left:`${N.capLeft}px`,fontSize:`${U}px`,lineHeight:`${U}px`},children:ce}),te&&B&&(J&&L||V)&&ri.createPortal(a.jsxs("div",{"data-selection":"none",style:{position:"fixed",top:B.top,left:B.left,width:B.width,height:B.height,zIndex:iC,pointerEvents:"none"},children:[J&&L&&a.jsx(Y$,{P:e,box:{width:B.width,height:B.height},viewBox:r,contours:J,snap:L.snap,stretchToBox:!ue,uniformStretch:n==="circle",stage:j,onStageChange:Y,onSelectionChange:he,onChange:L.onChange,onCommit:L.onCommit}),V&&fe&&a.jsx(V$,{P:e,box:{width:B.width,height:B.height},bounds:fe,natural:le,imageUrl:b,maskPath:Be,stage:j,onStageChange:Y,focalX:nt,focalY:tt,scale:Ve,onChange:V.onChange,onCommit:V.onCommit})]}),te),a.jsx("div",{className:`${e}-a11y`,children:q.map((ge,Me)=>a.jsx("p",{children:ge},Me))})]})}const yp=["diamond","parallelogram","vase","circle","shield","bobbin","custom"],dC={x:0,y:0,width:100,height:100},uC=e=>{const t=(e??"").trim().split(/[\s,]+/).map(Number).filter(n=>!Number.isNaN(n));return t.length<4||t[2]<=0||t[3]<=0?dC:{x:t[0],y:t[1],width:t[2],height:t[3]}},pC=e=>`
26424
26424
  .${e}-wrapper {
26425
26425
  box-sizing: border-box;
26426
26426
  display: flex;
package/dist/index.mjs CHANGED
@@ -55917,6 +55917,10 @@ const d$ = zs(""), u$ = zs("open"), p$ = zs("compact"), m$ = [
55917
55917
  name: "Basic Burger",
55918
55918
  category: "navigation",
55919
55919
  version: 1,
55920
+ preview: {
55921
+ type: "image",
55922
+ url: "https://cdn.cntrl.site/component-assets/Simple Burger.png"
55923
+ },
55920
55924
  layoutMode: "navigation",
55921
55925
  defaultSize: {
55922
55926
  d: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.79-alpha.0",
3
+ "version": "1.0.79-alpha.2",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",