@graphysdk/react-renderer 2.0.0-beta.1787253424098 → 2.0.0-beta.1787255264612

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/editable.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const s=require("./history-chords-CL6oqQ1F.cjs"),G=require("./dev.utils-DiNE92pC.cjs");let m=require("@graphysdk/viz-engine"),v=require("react"),t=require("react/jsx-runtime"),oe=require("zustand/react/shallow"),en=require("react-dom"),V=require("clsx");V=s.__toESM(V,1);let ae=require("@floating-ui/react-dom"),tn=require("@vanilla-extract/dynamic"),nn=require("@tiptap/core"),ro=require("@tiptap/extension-bold"),fe=require("@tiptap/extension-document"),oo=require("@tiptap/extension-hard-break"),ao=require("@tiptap/extension-heading"),io=require("@tiptap/extension-italic"),lo=require("@tiptap/extension-link"),so=require("@tiptap/extension-text"),co=require("@tiptap/extension-text-align"),ve=require("@tiptap/extension-text-style"),uo=require("@tiptap/extension-underline"),Ae=require("@tiptap/extensions"),rn=require("@tiptap/extension-paragraph"),Pe=require("@tiptap/react"),W=require("@base-ui/react/toolbar"),te=require("@base-ui/react/tooltip"),B=require("@base-ui/react/popover"),xt=require("react-colorful"),q=require("@base-ui/react/slider"),M=require("@base-ui/react/menu"),ho=require("@base-ui/react/toggle"),X=require("@base-ui/react"),re=require("lodash-es/clamp");re=s.__toESM(re,1);let le=require("@base-ui/react/accordion"),ft=require("@base-ui/react/number-field"),on=require("@base-ui/react/radio"),an=require("@base-ui/react/radio-group"),$=require("@base-ui/react/select"),vt=require("@base-ui/react/switch"),po=require("@base-ui/react/input");var mo={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},go={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",scatter:"نقطي",bubble:"فقاعي",funnel:"قمعي",combo:"مركب",heatmap:"خريطة حرارية",waterfall:"شلالي",mekko:"ميكو",table:"جدول"},sizePanel:{toolbarButton:"الحجم",presetsSection:{title:"إعدادات مسبقة"},customSizeSection:{title:"حجم مخصص"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"ويب / بريد إلكتروني",linkedIn:"منشور LinkedIn",instagram:"منشور Instagram",tiktok:"TikTok / قصة Instagram",twitter:"X (Twitter)",mobile:"جوال"},inputs:{unitLabel:"بكسل"},validation:{maxSizeError:e=>`≤ ${e.max} بكسل`,minSizeError:e=>`≥ ${e.min} بكسل`}},graphPanel:{toolbarButton:"الرسم البياني",graphTypeSection:{title:"نوع الرسم البياني"},mappingSection:{title:"البيانات",x:"المحور السيني",y:"القيمة",color:"اللون",size:"الحجم",label:"التسمية",none:"بلا"},comboSection:{title:"مظهر الرسم البياني المركب",types:{"grouped-bars":"أعمدة مجمعة","stacked-bars":"أعمدة مكدسة",lines:"خطوط فقط"}},polarSection:{title:"قطبي",innerRadius:"نصف القطر الداخلي",startAngle:"زاوية البداية"},barSection:{title:"الأعمدة",thickness:"سمك العمود",rounding:"التدوير",roundingOptions:{none:"بلا",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"كامل"}},graphOptionsSection:{title:"خيارات الرسم البياني"},gridSection:{title:"الشبكة",horizontalGridLines:"خطوط أفقية",verticalGridLines:"خطوط رأسية",rings:"حلقات",spokes:"أشعة",gridStyle:"نمط الشبكة",gridThickness:"سمك الشبكة",lineStyles:{solid:"متصل",dashed:"متقطع",dotted:"منقط"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",start:"البداية",center:"الوسط",end:"النهاية"},displayLabel:"النمط",display:{auto:"تلقائي",pill:"شارات",direct:"على الرسم"}},numberFormatSection:{title:"تنسيق الأرقام"},numberFormat:{abbreviationLabel:"الاختصار",valueLabel:"القيمة",decimalPlacesLabel:"المنازل العشرية",options:{auto:"تلقائي",custom:"مخصص",none:"بدون"}},headlineNumberSize:{sizeLabel:"الحجم",valueLabel:"القيمة",sizes:{small:"ص",medium:"م",large:"ك"}},lineThickness:{label:"سمك الخط"},pointSize:{label:"حجم النقطة",options:{auto:"تلقائي",custom:"مخصص"}},headlineNumberSection:{title:"الرقم الرئيسي",toggle:"مرئي",metricLabel:"المقياس",compareWithLabel:"مقارنة مع",metrics:{total:"المجموع",average:"المتوسط",current:"الأخير",conversion:"التحويل",left:"يسار"},comparison:{first:"الأول",previous:"السابق"},position:{above:"أعلى",center:"وسط"}},treatEmptyValues:{leaveGap:{label:"ترك فجوة في الرسم البياني",description:"يترك فاصلاً مرئياً في الخط حيث تكون البيانات مفقودة"},fillZero:{label:"ملء بالصفر",description:"يعرض نقاط البيانات المفقودة كصفر"},connectGaps:{label:"الاتصال عبر الفجوات",description:"يربط الخط بين النقاط المتاحة، متخطياً الفجوة"}},comboChartAppearance:{title:"مظهر الرسم البياني المركب",groupedBars:"أشرطة مجمعة",stackedBars:"أشرطة مكدسة",linesOnly:"خطوط فقط"}},axesPanel:{toolbarButton:"المحاور",mainAxisSection:{yAxis:"المحور الصادي",xAxis:"المحور السيني"},crossAxisSection:{xAxis:"المحور السيني",yAxis:"المحور الصادي"},controls:{title:"العنوان",visible:"مرئي",ticks:"العلامات",labels:"التسميات",position:"الموضع",scale:"المقياس",startFrom:"البدء من",endAt:"الانتهاء عند",value:"القيمة",numberOfAxes:"عدد المحاور",reverse:"عكس"},labelMode:{auto:"تلقائي",edges:"الحواف"},scale:{auto:"تلقائي",log:"لوغاريتمي"},startFrom:{auto:"تلقائي",zero:"صفر",custom:"مخصص"},endAt:{auto:"تلقائي",custom:"مخصص"},axisCount:{single:"مفرد",double:"مزدوج"},position:{left:"يسار",right:"يمين",top:"أعلى",bottom:"أسفل"},yesNo:{yes:"نعم",no:"لا"}},colorPanel:{toolbarButton:"اللون",themeSection:{title:"السمة"},appearanceSection:{title:"المظهر",highlightStyle:"التمييز"},paletteSection:{title:"لوحة الألوان",colorScheme:"نظام الألوان",colors:"الألوان",colorPalettes:"لوحات الألوان"},paletteMode:{preset:"مسبق",brand:"العلامة التجارية",freestyle:"حر"},paletteThemes:{colorful:"ملون",pastel:"باستيل",neon:"نيون"},backgroundSection:{title:"الخلفية",black:"أسود",white:"أبيض",grey:"رمادي",tint:"صبغة",custom:"مخصص",none:"بدون"},borderSection:{title:"الحدود",borderColor:"لون الحدود",thickness:"السمك",cornerRadius:"نصف قطر الزاوية"},borderType:{solid:"صلب",gradient:"متدرج",grey:"رمادي",preset:"مسبق",custom:"مخصص",none:"بدون"},presetGradients:{lilac:"ليلكي",neonPink:"وردي نيون",blackberry:"توت أسود",sun:"شمس",iceland:"آيسلندا",sunset:"غروب",ultraviolet:"فوق بنفسجي",purple:"أرجواني",iceCream:"آيس كريم",mint:"نعناع",cool:"بارد",fresh:"منعش"}},designPanel:{toolbarButton:"التصميم",defaultExpanded:"لوحة الألوان"},annotatePanel:{toolbarButton:"التعليقات",callOutSection:{title:"وسائل الشرح",text:"نص",arrow:"سهم",box:"مربع",difference:"الفرق"},highlightSection:{title:"التمييز",button:"تمييز",colorLabel:"لون التمييز"}},annotationsPanel:{toolbarButton:"التعليقات",freeformSection:{title:"حر",text:"نص",arrow:"سهم",box:"مربع",difference:"فرق"},goalSection:{title:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",valueAriaLabel:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:"(اختياري)"},trendsAndAveragesSection:{title:"الاتجاهات والمتوسطات",trend:"الاتجاه",average:"المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},averageLineSeries:{label:"سلسلة خط المتوسط",placeholder:"اختر السلسلة",ariaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},highlightSection:{title:"التمييز",button:"تمييز",fadeColorLabel:"لون التلاشي"},titleAndSubtitleSection:{title:"العنوان والعنوان الفرعي",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},captionAndSourceSection:{title:"التسمية التوضيحية والمصدر",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"}},elementsPanel:{contentVisible:"مرئي",contentValue:"القيمة",toolbarButton:"العناصر",headerSection:{title:"الرأس",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},footerSection:{title:"التذييل",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"},textSizeSection:{title:"حجم النص",scaleFormat:e=>`${e.value}x`},fontSection:{title:"الخط"},sourceSection:{title:"المصدر",url:"الرابط",name:"الاسم"}},powerUpPanel:{toolbarButton:"التحسينات",goalSection:{title:"الهدف",toggle:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:" (اختياري)",xAxisReferenceAriaLabel:"قيمة مرجعية للمحور السيني",anyXAxisValue:"أي قيمة للمحور السيني",selectValuePlaceholder:"اختر القيمة"},trendSection:{title:"الاتجاه",toggle:"الاتجاه"},averageSection:{title:"المتوسط",toggle:"المتوسط",seriesLabel:"سلسلة خط المتوسط",seriesPlaceholder:"اختر السلسلة",seriesAriaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},valueInput:{percentagePlaceholder:"النسبة المئوية",numberPlaceholder:"الرقم",percentageSymbol:"٪"}},highlighting:{modeHelper:{title:"وضع التمييز",hover:"مرر",toHighlight:"للتمييز",anyElement:"أي عنصر",escToExit:"للخروج",esc:"ESC"},emptyState:"لا تتوفر خيارات تمييز",deleteAriaLabel:"حذف التمييز",highlightStyle:{tint:"صبغة",grey:"رمادي"}},fineTunePanel:{toolbarButton:"الضبط الدقيق",detailSection:{title:"التفاصيل",missingValues:"القيم المفقودة"},lineStyleSection:{title:"نمط الخط",lineCurve:"انحناء الخط",sharp:"حاد",smooth:"ناعم"}},customThemeEditor:{patternDropdownAriaLabel:"قائمة منسدلة للنمط للسلسلة",patterns:{solid:"صلب",pattern:"نمط",dotted:"منقط",dashed:"متقطع",hatched:"مظلل"},heatmapColorLabel:"اللون"},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},xo={titleEditor:{titlePlaceholder:"بدون عنوان",subtitlePlaceholder:"إضافة عنوان فرعي"},toolbar:{formatting:{bold:"عريض",italic:"مائل",underline:"تحته خط",link:"رابط"},link:{ariaLabel:"إنشاء رابط",placeholder:"اكتب أو الصق رابطاً...",submit:"إرسال",urlLabel:"عنوان الرابط",apply:"تطبيق الرابط"},font:{label:"الخط",ariaLabel:"عائلة الخط"},heading:{label:"مستوى العنوان",ariaLabel:"نمط النص",text:"نص",caption:"تسمية توضيحية",heading1:"عنوان 1",heading2:"عنوان 2",heading3:"عنوان 3"},textAlign:{left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين"},color:{label:"لون النص"}},colorDropdown:{colors:"الألوان",chartColors:"ألوان الرسم البياني",custom:"مخصص",opacity:"الشفافية",transparent:"شفاف",pickCustom:"اختيار لون مخصص",pickColor:"اختيار لون"},annotations:{differenceArrowToolbar:{label:"خيارات سهم الفرق",labelKind:{ariaLabel:"التسمية",absoluteDifference:"التغير المطلق",relativeDifference:"التغير المئوي",proportion:"النسبة",suspectValue:"تقسم هذه القيمة على أساس يساوي صفرًا.",incomparableEnds:"يقيس الطرفان كميتين مختلفتين، لذا لا معنى للفرق بينهما."},color:"لون السهم",size:{ariaLabel:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},swap:"عكس الاتجاه",remove:"إزالة السهم"},shapeToolbar:{label:"خيارات الشكل",color:"لون الشكل",border:{ariaLabel:"الحد",none:"بلا",thin:"رفيع (2 بكسل)",medium:"متوسط (8 بكسل)",thick:"سميك (16 بكسل)"},remove:"إزالة الشكل",resize:{"top-left":"تغيير الحجم من الزاوية العلوية اليسرى","top-right":"تغيير الحجم من الزاوية العلوية اليمنى","bottom-right":"تغيير الحجم من الزاوية السفلية اليمنى","bottom-left":"تغيير الحجم من الزاوية السفلية اليسرى"}},arrowToolbar:{label:"خيارات السهم",color:"لون السهم",thickness:{ariaLabel:"السماكة",thin:"رفيع",medium:"متوسط",thick:"سميك"},startArrowhead:"بداية السهم",endArrowhead:"نهاية السهم",arrowhead:{lineArrow:"رأس سهم",none:"بلا"},lineStyle:{ariaLabel:"نمط الخط",solid:"متصل",dashed:"منقّط"},sticker:"تأثير الملصق",remove:"إزالة السهم",moveEndpoint:{start:"تحريك بداية السهم",end:"تحريك نهاية السهم"}},textToolbar:{label:"خيارات النص",background:"لون الخلفية",color:"لون النص",font:{ariaLabel:"الخط",modern:"عصري",fresh:"منعش",timeless:"كلاسيكي",technical:"تقني",fineliner:"قلم رفيع"},fontSize:{ariaLabel:"حجم الخط",small:"صغير",medium:"متوسط",large:"كبير",extraLarge:"كبير جدًا",huge:"ضخم"},align:{left:"محاذاة إلى اليسار",center:"محاذاة إلى الوسط",right:"محاذاة إلى اليمين"},remove:"إزالة النص",resize:{left:"تغيير الحجم من اليسار",right:"تغيير الحجم من اليمين"}},text:{editLabel:"تحرير النص",placeholder:"اكتب شيئًا"},baseMenu:{pinNumber:"تثبيت الرقم",unpinNumber:"إلغاء تثبيت الرقم",annotate:"تعليق",removeAnnotation:"إزالة التعليق",highlight:"تمييز",highlightWithLabel:e=>`تمييز ${e.label}`,removeHighlight:"إزالة التمييز",differenceArrow:"سهم الفرق",addSticker:"إضافة ملصق",removeSticker:"إزالة الملصق"},textMenu:{title:"تعليق",placeholder:"إضافة تعليق",addButton:"إضافة"},highlights:{menuTitle:"تمييز",labels:{bar:"شريط",barGroup:"مجموعة",barStack:"مكدس",barSeries:"سلسلة",line:"خط",linePoint:"نقطة",lineSeries:"سلسلة",scatterPoint:"نقطة",scatterSeries:"سلسلة",pieSlice:"شريحة",pointOrBar:"نقطة / شريط",lineOrSeries:"خط / سلسلة"}},stickerMenu:{title:"إضافة ملصق"},delete:"حذف",arrow:{thickness:{label:"السمك",thin:"رفيع",medium:"متوسط",thick:"سميك"},arrowhead:{startPoint:"نقطة البداية",endPoint:"نقطة النهاية",lineArrow:"سهم الخط",none:"بدون"},lineStyle:{label:"نمط الخط",solid:"صلب",dotted:"منقط"},stickerEffect:"تأثير الملصق",toolbarAriaLabel:"شريط أدوات السهم الحر",editorAriaLabel:"محرر السهم"},differenceArrow:{type:{proportion:"النسبة",difference:({absoluteDifference:e})=>`الفرق (${e})`,increase:({absoluteDifference:e})=>`الزيادة (${e})`,decrease:({absoluteDifference:e})=>`النقصان (${e})`,percentageChange:({percentageChange:e})=>`تغيير النسبة المئوية (${e})`,percentIncrease:({percentageChange:e})=>`زيادة النسبة المئوية (${e})`,percentDecrease:({percentageChange:e})=>`نقصان النسبة المئوية (${e})`},size:{label:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},flipArrow:"عكس السهم",color:"اللون",toolbarAriaLabel:"شريط أدوات سهم الفرق",editorAriaLabel:"محرر سهم الفرق"},shape:{color:"اللون",border:{label:"الحدود",none:"بدون",thin:({value:e})=>`رفيع (${e})`,medium:({value:e})=>`متوسط (${e})`,thick:({value:e})=>`سميك (${e})`}}}},fo={common:mo,editor:go,graph:xo},vo={save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",confirmDelete:e=>`Are you sure you want to delete ${e.item}?`,abbreviations:{thousands:"k",millions:"m",billions:"b"}},bo={title:"Graphy Editor",description:"Edit your content here",graphTypes:{column:"Column",columnStacked:"Stacked column",columnStackedFill:"100% stacked column",bar:"Bar",barStacked:"Stacked bar",barStackedFill:"100% stacked bar",line:"Line",areaStacked:"Stacked area",pie:"Pie",donut:"Donut",scatter:"Scatter",bubble:"Bubble",funnel:"Funnel",combo:"Combo",heatmap:"Heatmap",waterfall:"Waterfall",mekko:"Mekko",table:"Table"},sizePanel:{toolbarButton:"Size",presetsSection:{title:"Presets"},customSizeSection:{title:"Custom size"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"LinkedIn post",instagram:"Instagram post",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Mobile"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Graph",graphTypeSection:{title:"Graph type"},mappingSection:{title:"Data",x:"X-axis",y:"Value",color:"Colour",size:"Size",label:"Label",none:"None"},comboSection:{title:"Combo chart appearance",types:{"grouped-bars":"Grouped bars","stacked-bars":"Stacked bars",lines:"Lines only"}},polarSection:{title:"Polar",innerRadius:"Inner radius",startAngle:"Start angle"},barSection:{title:"Bars",thickness:"Bar thickness",rounding:"Rounding",roundingOptions:{none:"None",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Full"}},graphOptionsSection:{title:"Graph options"},gridSection:{title:"Grid",horizontalGridLines:"Horizontal lines",verticalGridLines:"Vertical lines",rings:"Rings",spokes:"Spokes",gridStyle:"Grid style",gridThickness:"Grid thickness",lineStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",stackTotals:"Stack totals",dataLabels:"Data labels",showPercentages:"Show percentages",categoryLabels:"Category labels"},legendSection:{title:"Legend",auto:"Auto",top:"Top",bottom:"Bottom",left:"Left",right:"Right",none:"None",alignLabel:"Alignment",align:{auto:"Auto",start:"Start",center:"Center",end:"End"},displayLabel:"Style",display:{auto:"Auto",pill:"Pills",direct:"Direct"}},numberFormatSection:{title:"Number format"},numberFormat:{abbreviationLabel:"Abbreviation",valueLabel:"Value",decimalPlacesLabel:"Decimal places",options:{auto:"Auto",custom:"Custom",none:"None"}},headlineNumberSize:{sizeLabel:"Size",valueLabel:"Value",sizes:{small:"S",medium:"M",large:"L"}},lineThickness:{label:"Line thickness"},pointSize:{label:"Point size",options:{auto:"Auto",custom:"Custom"}},headlineNumberSection:{title:"Headline number",toggle:"Visible",metricLabel:"Metric",compareWithLabel:"Compare with",metrics:{total:"Total",average:"Avg.",current:"Last",conversion:"Conversion",left:"Left"},comparison:{first:"First",previous:"Previous"},position:{above:"Above",center:"Center"}},treatEmptyValues:{leaveGap:{label:"Leave gap in chart",description:"Leaves a visible break in the line where data is missing"},fillZero:{label:"Fill with zero",description:"Displays missing data points as zero"},connectGaps:{label:"Connect across gaps",description:"Joins the line between available points, skipping the gap"}},comboChartAppearance:{title:"Combo chart appearance",groupedBars:"Grouped bars",stackedBars:"Stacked bars",linesOnly:"Lines only"}},axesPanel:{toolbarButton:"Axes",mainAxisSection:{yAxis:"Y-axis",xAxis:"X-axis"},crossAxisSection:{xAxis:"X-axis",yAxis:"Y-axis"},controls:{title:"Title",visible:"Visible",ticks:"Ticks",labels:"Labels",position:"Position",scale:"Scale",startFrom:"Start from",endAt:"End at",value:"Value",numberOfAxes:"Number of axes",reverse:"Reverse"},labelMode:{auto:"Auto",edges:"Edges"},scale:{auto:"Auto",log:"Log"},startFrom:{auto:"Auto",zero:"Zero",custom:"Custom"},endAt:{auto:"Auto",custom:"Custom"},axisCount:{single:"Single",double:"Double"},position:{left:"Left",right:"Right",top:"Top",bottom:"Bottom"},yesNo:{yes:"Yes",no:"No"}},colorPanel:{toolbarButton:"Color",themeSection:{title:"Theme"},appearanceSection:{title:"Appearance",highlightStyle:"Highlight"},paletteSection:{title:"Palette",colorScheme:"Color scheme",colors:"Colors",colorPalettes:"Color palettes"},paletteMode:{preset:"Preset",freestyle:"Freestyle"},paletteThemes:{colorful:"Colorful",pastel:"Pastel",neon:"Neon"},backgroundSection:{title:"Background",black:"Black",white:"White",grey:"Grey",tint:"Tint",custom:"Custom",none:"None"},borderSection:{title:"Border",borderColor:"Border color",thickness:"Thickness",cornerRadius:"Corner radius"},borderType:{solid:"Solid",gradient:"Gradient",grey:"Grey",preset:"Preset",custom:"Custom",none:"None"},presetGradients:{lilac:"Lilac",neonPink:"Neon Pink",blackberry:"Blackberry",sun:"Sun",iceland:"Iceland",sunset:"Sunset",ultraviolet:"Ultraviolet",purple:"Purple",iceCream:"Ice Cream",mint:"Mint",cool:"Cool",fresh:"Fresh"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Palette"},annotatePanel:{toolbarButton:"Annotate",callOutSection:{title:"Callouts",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},highlightSection:{title:"Highlight",button:"Highlight",colorLabel:"Highlight color"}},annotationsPanel:{toolbarButton:"Annotate",freeformSection:{title:"Freeform",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},goalSection:{title:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",valueAriaLabel:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:"(optional)"},trendsAndAveragesSection:{title:"Trends and Averages",trend:"Trend",average:"Average"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},averageLineSeries:{label:"Average line series",placeholder:"Select series",ariaLabel:"Series dropdown for average line"},highlightSection:{title:"Highlight",button:"Highlight",fadeColorLabel:"Fade color"},titleAndSubtitleSection:{title:"Title & Subtitle",toggleTitle:"Title",subtitle:"Subtitle"},captionAndSourceSection:{title:"Caption & Source",caption:"Caption",source:"Source",url:"URL",name:"Name"}},elementsPanel:{contentVisible:"Visible",contentValue:"Value",toolbarButton:"Elements",headerSection:{title:"Header",toggleTitle:"Title",subtitle:"Subtitle"},footerSection:{title:"Footer",caption:"Caption",source:"Source",url:"URL",name:"Name"},textSizeSection:{title:"Text size",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Font"},sourceSection:{title:"Source",url:"URL",name:"Name"}},powerUpPanel:{toolbarButton:"Power-ups",goalSection:{title:"Goal",toggle:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:" (optional)",xAxisReferenceAriaLabel:"X-axis reference value",anyXAxisValue:"Any x-axis value",selectValuePlaceholder:"Select value"},trendSection:{title:"Trend",toggle:"Trend"},averageSection:{title:"Average",toggle:"Average",seriesLabel:"Average line series",seriesPlaceholder:"Select series",seriesAriaLabel:"Series dropdown for average line"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentage",numberPlaceholder:"Number",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Highlight mode",hover:"Hover",toHighlight:"to highlight",anyElement:"any element",escToExit:"to exit",esc:"ESC"},emptyState:"No highlight options available",deleteAriaLabel:"Delete highlight",highlightStyle:{tint:"Tint",grey:"Grey"}},fineTunePanel:{toolbarButton:"Fine tune",detailSection:{title:"Detail",missingValues:"Missing values"},lineStyleSection:{title:"Line style",lineCurve:"Line curve",sharp:"Sharp",smooth:"Smooth"}},customThemeEditor:{patternDropdownAriaLabel:"Pattern dropdown for series",patterns:{solid:"Solid",pattern:"Pattern",dotted:"Dotted",dashed:"Dashed",hatched:"Hatched"},heatmapColorLabel:"Color"},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},Co={titleEditor:{titlePlaceholder:"Untitled",subtitlePlaceholder:"Add a subtitle"},toolbar:{formatting:{bold:"Bold",italic:"Italic",underline:"Underline",link:"Link"},link:{ariaLabel:"Create link",placeholder:"Type or paste a link...",submit:"Submit",urlLabel:"Link URL",apply:"Apply link"},font:{label:"Font",ariaLabel:"Font family"},heading:{label:"Heading level",ariaLabel:"Text style",text:"Text",caption:"Caption",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},textAlign:{left:"Align left",center:"Align center",right:"Align right"},color:{label:"Text color"}},colorDropdown:{colors:"Colors",chartColors:"Chart colors",custom:"Custom",opacity:"Opacity",transparent:"Transparent",pickCustom:"Pick custom color",pickColor:"Pick color"},annotations:{differenceArrowToolbar:{label:"Difference arrow options",labelKind:{ariaLabel:"Label",absoluteDifference:"Absolute change",relativeDifference:"Percentage change",proportion:"Proportion",suspectValue:"This value divides by a baseline of zero.",incomparableEnds:"The two ends measure different quantities, so a difference between them has no meaning."},color:"Arrow colour",size:{ariaLabel:"Size",small:"Small",medium:"Medium",large:"Large"},swap:"Swap direction",remove:"Remove arrow"},shapeToolbar:{label:"Shape options",color:"Shape colour",border:{ariaLabel:"Border",none:"None",thin:"Thin (2px)",medium:"Medium (8px)",thick:"Thick (16px)"},remove:"Remove shape",resize:{"top-left":"Resize from the top left","top-right":"Resize from the top right","bottom-right":"Resize from the bottom right","bottom-left":"Resize from the bottom left"}},arrowToolbar:{label:"Arrow options",color:"Arrow colour",thickness:{ariaLabel:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},startArrowhead:"Start of the arrow",endArrowhead:"End of the arrow",arrowhead:{lineArrow:"Line arrow",none:"None"},lineStyle:{ariaLabel:"Line style",solid:"Solid",dashed:"Dotted"},sticker:"Sticker effect",remove:"Remove arrow",moveEndpoint:{start:"Move the start of the arrow",end:"Move the end of the arrow"}},textToolbar:{label:"Text options",background:"Background colour",color:"Text colour",font:{ariaLabel:"Font",modern:"Modern",fresh:"Fresh",timeless:"Timeless",technical:"Technical",fineliner:"Fineliner"},fontSize:{ariaLabel:"Font size",small:"Small",medium:"Medium",large:"Large",extraLarge:"Extra Large",huge:"Huge"},align:{left:"Align left",center:"Align centre",right:"Align right"},remove:"Remove text",resize:{left:"Resize from the left",right:"Resize from the right"}},text:{editLabel:"Edit text",placeholder:"Type something"},baseMenu:{pinNumber:"Pin number",unpinNumber:"Unpin number",annotate:"Annotate",removeAnnotation:"Remove annotation",highlight:"Highlight",highlightWithLabel:e=>`Highlight ${e.label}`,removeHighlight:"Remove highlight",differenceArrow:"Difference arrow",addSticker:"Add sticker",removeSticker:"Remove sticker"},textMenu:{title:"Annotate",placeholder:"Add a comment",addButton:"Add"},highlights:{menuTitle:"Highlight",labels:{bar:"bar",barGroup:"group",barStack:"stack",barSeries:"series",line:"line",linePoint:"point",lineSeries:"series",scatterPoint:"point",scatterSeries:"series",pieSlice:"slice",pointOrBar:"point / bar",lineOrSeries:"line / series"}},stickerMenu:{title:"Add sticker"},delete:"Delete",arrow:{thickness:{label:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},arrowhead:{startPoint:"Start point",endPoint:"End point",lineArrow:"Line arrow",none:"None"},lineStyle:{label:"Line style",solid:"Solid",dotted:"Dotted"},stickerEffect:"Sticker effect",toolbarAriaLabel:"Free-form arrow toolbar",editorAriaLabel:"Arrow editor"},differenceArrow:{type:{proportion:"Proportion",difference:({absoluteDifference:e})=>`Difference (${e})`,increase:({absoluteDifference:e})=>`Increase (${e})`,decrease:({absoluteDifference:e})=>`Decrease (${e})`,percentageChange:({percentageChange:e})=>`Percentage change (${e})`,percentIncrease:({percentageChange:e})=>`Percent increase (${e})`,percentDecrease:({percentageChange:e})=>`Percent decrease (${e})`},size:{label:"Size",small:"Small",medium:"Medium",large:"Large"},flipArrow:"Flip arrow",color:"Color",toolbarAriaLabel:"Difference arrow toolbar",editorAriaLabel:"Difference arrow editor"},shape:{color:"Color",border:{label:"Border",none:"None",thin:({value:e})=>`Thin (${e})`,medium:({value:e})=>`Medium (${e})`,thick:({value:e})=>`Thick (${e})`}}}},So={common:vo,editor:bo,graph:Co},yo={colorPanel:{backgroundSection:{grey:"Gray"},borderType:{grey:"Gray"}},highlighting:{highlightStyle:{grey:"Gray"}}},jo={editor:yo},To={save:"Guardar",cancel:"Cancelar",confirm:"Confirmar",delete:"Eliminar",confirmDelete:e=>`Tem a certeza que deseja eliminar ${e.item}?`,abbreviations:{thousands:"mil",millions:"M",billions:"MM"}},wo={title:"Editor Graphy",description:"Edite o seu conteúdo aqui",graphTypes:{column:"Colunas",columnStacked:"Colunas sobrepostas",columnStackedFill:"100% Colunas sobrepostas",bar:"Barras",barStacked:"Barras sobrepostas",barStackedFill:"100% Barras sobrepostas",line:"Linha",areaStacked:"Área sobreposta",pie:"Circular",donut:"Donut",scatter:"Dispersão",bubble:"Bolhas",funnel:"Funil",combo:"Combinado",heatmap:"Mapa de Calor",waterfall:"Cascata",mekko:"Mekko",table:"Tabela"},sizePanel:{toolbarButton:"Tamanho",presetsSection:{title:"Predefinições"},customSizeSection:{title:"Tamanho personalizado"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"Publicação LinkedIn",instagram:"Publicação Instagram",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Móvel"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Gráfico",graphTypeSection:{title:"Tipo de gráfico"},mappingSection:{title:"Dados",x:"Eixo X",y:"Valor",color:"Cor",size:"Tamanho",label:"Etiqueta",none:"Nenhum"},comboSection:{title:"Aspeto do gráfico combinado",types:{"grouped-bars":"Barras agrupadas","stacked-bars":"Barras empilhadas",lines:"Apenas linhas"}},polarSection:{title:"Polar",innerRadius:"Raio interno",startAngle:"Ângulo inicial"},barSection:{title:"Barras",thickness:"Espessura da barra",rounding:"Arredondamento",roundingOptions:{none:"Nenhum",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Total"}},graphOptionsSection:{title:"Opções do gráfico"},gridSection:{title:"Grelha",horizontalGridLines:"Linhas horizontais",verticalGridLines:"Linhas verticais",rings:"Anéis",spokes:"Raios",gridStyle:"Estilo da grelha",gridThickness:"Espessura da grelha",lineStyles:{solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",stackTotals:"Totais sobrepostos",dataLabels:"Etiquetas de dados",showPercentages:"Mostrar percentagens",categoryLabels:"Etiquetas de categorias"},legendSection:{title:"Legenda",auto:"Automático",top:"Topo",bottom:"Fundo",left:"Esquerda",right:"Direita",none:"Nenhuma",alignLabel:"Alinhamento",align:{auto:"Automático",start:"Início",center:"Centro",end:"Fim"},displayLabel:"Estilo",display:{auto:"Automático",pill:"Etiquetas",direct:"No gráfico"}},numberFormatSection:{title:"Formato numérico"},numberFormat:{abbreviationLabel:"Abreviação",valueLabel:"Valor",decimalPlacesLabel:"Casas decimais",options:{auto:"Automático",custom:"Personalizado",none:"Nenhum"}},headlineNumberSize:{sizeLabel:"Tamanho",valueLabel:"Valor",sizes:{small:"P",medium:"M",large:"G"}},lineThickness:{label:"Espessura da linha"},pointSize:{label:"Tamanho do ponto",options:{auto:"Automático",custom:"Personalizado"}},headlineNumberSection:{title:"Número destaque",toggle:"Visível",metricLabel:"Métrica",compareWithLabel:"Comparar com",metrics:{total:"Total",average:"Média",current:"Último",conversion:"Conversão",left:"Esquerda"},comparison:{first:"Primeiro",previous:"Anterior"},position:{above:"Acima",center:"Centro"}},treatEmptyValues:{leaveGap:{label:"Deixar espaço no gráfico",description:"Deixa uma quebra visível na linha onde faltam dados"},fillZero:{label:"Preencher com zero",description:"Exibe pontos de dados em falta como zero"},connectGaps:{label:"Ligar através dos espaços",description:"Une a linha entre pontos disponíveis, ignorando o espaço"}},comboChartAppearance:{title:"Aparência do gráfico combinado",groupedBars:"Barras agrupadas",stackedBars:"Barras sobrepostas",linesOnly:"Apenas linhas"}},axesPanel:{toolbarButton:"Eixos",mainAxisSection:{yAxis:"Eixo Y",xAxis:"Eixo X"},crossAxisSection:{xAxis:"Eixo X",yAxis:"Eixo Y"},controls:{title:"Título",visible:"Visível",ticks:"Marcas",labels:"Etiquetas",position:"Posição",scale:"Escala",startFrom:"Iniciar de",endAt:"Terminar em",value:"Valor",numberOfAxes:"Número de eixos",reverse:"Inverter"},labelMode:{auto:"Automático",edges:"Extremos"},scale:{auto:"Automático",log:"Logarítmico"},startFrom:{auto:"Automático",zero:"Zero",custom:"Personalizado"},endAt:{auto:"Automático",custom:"Personalizado"},axisCount:{single:"Único",double:"Duplo"},position:{left:"Esquerda",right:"Direita",top:"Topo",bottom:"Fundo"},yesNo:{yes:"Sim",no:"Não"}},colorPanel:{toolbarButton:"Cor",themeSection:{title:"Tema"},appearanceSection:{title:"Aparência",highlightStyle:"Destaque"},paletteSection:{title:"Paleta",colorScheme:"Esquema de cores",colors:"Cores",colorPalettes:"Paletas de cores"},paletteMode:{preset:"Predefinido",brand:"Marca",freestyle:"Livre"},paletteThemes:{colorful:"Colorido",pastel:"Pastel",neon:"Néon"},backgroundSection:{title:"Fundo",black:"Preto",white:"Branco",grey:"Cinzento",tint:"Tonalidade",custom:"Personalizado",none:"Nenhum"},borderSection:{title:"Contorno",borderColor:"Cor do contorno",thickness:"Espessura",cornerRadius:"Raio dos cantos"},borderType:{solid:"Sólido",gradient:"Gradiente",grey:"Cinzento",preset:"Predefinido",custom:"Personalizado",none:"Nenhum"},presetGradients:{lilac:"Lilás",neonPink:"Rosa Néon",blackberry:"Amora",sun:"Sol",iceland:"Islândia",sunset:"Pôr do Sol",ultraviolet:"Ultravioleta",purple:"Roxo",iceCream:"Gelado",mint:"Menta",cool:"Frio",fresh:"Fresco"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Paleta"},annotatePanel:{toolbarButton:"Anotar",callOutSection:{title:"Destaques",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},highlightSection:{title:"Realce",button:"Realçar",colorLabel:"Cor do realce"}},annotationsPanel:{toolbarButton:"Anotar",freeformSection:{title:"Forma livre",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},goalSection:{title:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",valueAriaLabel:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:"(opcional)"},trendsAndAveragesSection:{title:"Tendências e Médias",trend:"Tendência",average:"Média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},averageLineSeries:{label:"Série da linha de média",placeholder:"Selecionar série",ariaLabel:"Dropdown de séries para linha de média"},highlightSection:{title:"Realce",button:"Realçar",fadeColorLabel:"Cor de esmaecimento"},titleAndSubtitleSection:{title:"Título e Subtítulo",toggleTitle:"Título",subtitle:"Subtítulo"},captionAndSourceSection:{title:"Legenda e Fonte",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"}},elementsPanel:{contentVisible:"Visível",contentValue:"Valor",toolbarButton:"Elementos",headerSection:{title:"Cabeçalho",toggleTitle:"Título",subtitle:"Subtítulo"},footerSection:{title:"Rodapé",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"},textSizeSection:{title:"Tamanho do texto",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Tipo de letra"},sourceSection:{title:"Fonte",url:"URL",name:"Nome"}},powerUpPanel:{toolbarButton:"Extras",goalSection:{title:"Objetivo",toggle:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:" (opcional)",xAxisReferenceAriaLabel:"Valor de referência do eixo X",anyXAxisValue:"Qualquer valor do eixo X",selectValuePlaceholder:"Selecionar valor"},trendSection:{title:"Tendência",toggle:"Tendência"},averageSection:{title:"Média",toggle:"Média",seriesLabel:"Série da linha de média",seriesPlaceholder:"Selecionar série",seriesAriaLabel:"Dropdown de séries para linha de média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentagem",numberPlaceholder:"Número",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Modo de realce",hover:"Passe",toHighlight:"para realçar",anyElement:"qualquer elemento",escToExit:"para sair",esc:"ESC"},emptyState:"Sem opções de realce disponíveis",deleteAriaLabel:"Eliminar realce",highlightStyle:{tint:"Tonalidade",grey:"Cinzento"}},fineTunePanel:{toolbarButton:"Ajuste fino",detailSection:{title:"Detalhe",missingValues:"Valores em falta"},lineStyleSection:{title:"Estilo de linha",lineCurve:"Curva da linha",sharp:"Angulosa",smooth:"Suave"}},customThemeEditor:{patternDropdownAriaLabel:"Dropdown de padrões para série",patterns:{solid:"Sólido",pattern:"Padrão",dotted:"Pontilhado",dashed:"Tracejado",hatched:"Hachurado"},heatmapColorLabel:"Cor"},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},Ao={titleEditor:{titlePlaceholder:"Sem título",subtitlePlaceholder:"Adicionar subtítulo"},toolbar:{formatting:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",link:"Ligação"},link:{ariaLabel:"Criar ligação",placeholder:"Escreva ou cole uma ligação...",submit:"Submeter",urlLabel:"URL da ligação",apply:"Aplicar ligação"},font:{label:"Tipo de letra",ariaLabel:"Família do tipo de letra"},heading:{label:"Nível de título",ariaLabel:"Estilo de texto",text:"Texto",caption:"Legenda",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3"},textAlign:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},color:{label:"Cor do texto"}},colorDropdown:{colors:"Cores",chartColors:"Cores do gráfico",custom:"Personalizado",opacity:"Opacidade",transparent:"Transparente",pickCustom:"Escolher cor personalizada",pickColor:"Escolher cor"},annotations:{differenceArrowToolbar:{label:"Opções da seta de diferença",labelKind:{ariaLabel:"Etiqueta",absoluteDifference:"Variação absoluta",relativeDifference:"Variação percentual",proportion:"Proporção",suspectValue:"Este valor divide por uma base igual a zero.",incomparableEnds:"As duas pontas medem quantidades diferentes, pelo que a diferença entre elas não tem significado."},color:"Cor da seta",size:{ariaLabel:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},swap:"Inverter sentido",remove:"Remover seta"},shapeToolbar:{label:"Opções da forma",color:"Cor da forma",border:{ariaLabel:"Contorno",none:"Nenhum",thin:"Fino (2px)",medium:"Médio (8px)",thick:"Espesso (16px)"},remove:"Remover forma",resize:{"top-left":"Redimensionar a partir do canto superior esquerdo","top-right":"Redimensionar a partir do canto superior direito","bottom-right":"Redimensionar a partir do canto inferior direito","bottom-left":"Redimensionar a partir do canto inferior esquerdo"}},arrowToolbar:{label:"Opções da seta",color:"Cor da seta",thickness:{ariaLabel:"Espessura",thin:"Fina",medium:"Média",thick:"Espessa"},startArrowhead:"Início da seta",endArrowhead:"Fim da seta",arrowhead:{lineArrow:"Ponta de seta",none:"Nenhuma"},lineStyle:{ariaLabel:"Estilo da linha",solid:"Sólida",dashed:"Pontilhada"},sticker:"Efeito autocolante",remove:"Remover seta",moveEndpoint:{start:"Mover o início da seta",end:"Mover o fim da seta"}},textToolbar:{label:"Opções do texto",background:"Cor de fundo",color:"Cor do texto",font:{ariaLabel:"Tipo de letra",modern:"Moderno",fresh:"Fresco",timeless:"Intemporal",technical:"Técnico",fineliner:"Caneta fina"},fontSize:{ariaLabel:"Tamanho da letra",small:"Pequeno",medium:"Médio",large:"Grande",extraLarge:"Muito grande",huge:"Enorme"},align:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},remove:"Remover texto",resize:{left:"Redimensionar a partir da esquerda",right:"Redimensionar a partir da direita"}},text:{editLabel:"Editar texto",placeholder:"Escreva algo"},baseMenu:{pinNumber:"Fixar número",unpinNumber:"Desafixar número",annotate:"Anotar",removeAnnotation:"Remover anotação",highlight:"Realçar",highlightWithLabel:e=>`Realçar ${e.label}`,removeHighlight:"Remover realce",differenceArrow:"Seta de diferença",addSticker:"Adicionar autocolante",removeSticker:"Remover autocolante"},textMenu:{title:"Anotar",placeholder:"Adicionar comentário",addButton:"Adicionar"},highlights:{menuTitle:"Realçar",labels:{bar:"Barra",barGroup:"Grupo",barStack:"Pilha",barSeries:"Série",line:"Linha",linePoint:"Ponto",lineSeries:"Série",scatterPoint:"Ponto",scatterSeries:"Série",pieSlice:"Fatia",pointOrBar:"Ponto / barra",lineOrSeries:"Linha / série"}},stickerMenu:{title:"Adicionar autocolante"},delete:"Eliminar",arrow:{thickness:{label:"Espessura",thin:"Fina",medium:"Média",thick:"Grossa"},arrowhead:{startPoint:"Ponto inicial",endPoint:"Ponto final",lineArrow:"Seta de linha",none:"Nenhuma"},lineStyle:{label:"Estilo de linha",solid:"Sólida",dotted:"Pontilhada"},stickerEffect:"Efeito de autocolante",toolbarAriaLabel:"Barra de ferramentas de seta livre",editorAriaLabel:"Editor de seta"},differenceArrow:{type:{proportion:"Proporção",difference:({absoluteDifference:e})=>`Diferença (${e})`,increase:({absoluteDifference:e})=>`Aumento (${e})`,decrease:({absoluteDifference:e})=>`Diminuição (${e})`,percentageChange:({percentageChange:e})=>`Variação percentual (${e})`,percentIncrease:({percentageChange:e})=>`Aumento percentual (${e})`,percentDecrease:({percentageChange:e})=>`Diminuição percentual (${e})`},size:{label:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},flipArrow:"Inverter seta",color:"Cor",toolbarAriaLabel:"Barra de ferramentas de seta de diferença",editorAriaLabel:"Editor de seta de diferença"},shape:{color:"Cor",border:{label:"Contorno",none:"Nenhum",thin:({value:e})=>`Fino (${e})`,medium:({value:e})=>`Médio (${e})`,thick:({value:e})=>`Grosso (${e})`}}}},Po={common:To,editor:wo,graph:Ao},Lo={"en-GB":So,"en-US":jo,ar:fo,"pt-PT":Po},ko=[Lo,s.dictionaries],ln=({children:e,...n})=>(0,t.jsx)(s.IntlProvider,{dictionaries:ko,...n,children:e}),Io="data-variant",sn=rn.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[Io]:e.variant}:{}}}}}),Eo=nn.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:n}=e.state;if(!n.empty)return!1;const{$from:r}=n;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),Qe=()=>[so.Text,Ae.UndoRedo,ao.Heading.configure({levels:[1,2,3]}),ro.Bold,io.Italic,uo.Underline,co.TextAlign.configure({types:["heading","paragraph"]}),lo.Link.configure({openOnClick:!1,autolink:!0}),ve.TextStyle,ve.Color,oo.HardBreak],Mo=({titlePlaceholder:e,subtitlePlaceholder:n,isTitleVisible:r,isSubtitleVisible:a})=>[No({isTitleVisible:r,isSubtitleVisible:a}),sn,...Qe(),ve.FontFamily,Eo.configure({isTitleVisible:r}),Ae.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const l=r?i.state.doc.firstChild?.nodeSize??-1:0;return a&&o===l?n:""}})],_o=({placeholder:e})=>[fe.Document,sn,...Qe(),ve.FontFamily,Ae.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],No=({isTitleVisible:e,isSubtitleVisible:n})=>e&&n?fe.Document.extend({content:"block{2,}"}):fe.Document,Ro="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",Oo="d0bl00";var cn="d0bl03",Do="d0bl04",dn="d0bl05",Be="d0bl06",zo="d0bl07",Fo="d0bl08",un="d0bl09",Ho="d0bl0a",Bo="d0bl0b",Go="d0bl0c",Vo="d0bl0d",Uo="d0bl0e",$o="owf1yg0",qo="owf1yg1",Wo="owf1yg2",Ko="owf1yg3",Xo="owf1yg4",Zo=.01,Yo=({value:e,onChange:n,label:r})=>(0,t.jsx)(q.Slider.Root,{className:$o,value:e,onValueChange:a=>n(a),min:0,max:1,step:Zo,children:(0,t.jsx)(q.Slider.Control,{className:qo,children:(0,t.jsxs)(q.Slider.Track,{className:Wo,children:[(0,t.jsx)(q.Slider.Indicator,{className:Ko}),(0,t.jsx)(q.Slider.Thumb,{className:Xo,"aria-label":r})]})})}),Jo="transparent",Ge=G.CANVAS_COLOR_KEYS.map(e=>G.vars[e]),Qo=Object.fromEntries(G.CANVAS_COLOR_KEYS.map(e=>[G.vars[e],e])),ea=e=>Ge.some(n=>pn(n,e)),ta=({color:e,onChange:n,isOpen:r,onOpenChange:a,children:o,label:i,popupAttributes:l,opacity:d,onOpacityChange:c,hasTransparentOption:h=!1})=>{const u=s.useI18n(),p=ra(),f=h?[Jo,...Ge]:Ge,g=x=>{n(x),a(!1)};return(0,t.jsxs)(B.Popover.Root,{open:r,onOpenChange:a,children:[(0,t.jsx)(B.Popover.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":i??u("graph.toolbar.color.label"),className:Oo,onMouseDown:x=>x.preventDefault(),children:o??(0,t.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,t.jsx)(B.Popover.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(B.Popover.Positioner,{sideOffset:6,align:"start",className:cn,children:(0,t.jsxs)(B.Popover.Popup,{className:Do,onMouseDown:x=>x.preventDefault(),...l,children:[(0,t.jsx)(bt,{title:u("graph.colorDropdown.colors"),colors:f,currentColor:e,onPick:g}),p.length>0&&(0,t.jsx)(bt,{title:u("graph.colorDropdown.chartColors"),colors:p,currentColor:e,onPick:g}),(0,t.jsx)(na,{value:e??"#000000",onChange:n,popupAttributes:l}),d!==void 0&&c!==void 0&&(0,t.jsxs)("div",{className:"d0bl05",children:[(0,t.jsx)("div",{className:"d0bl06",children:u("graph.colorDropdown.opacity")}),(0,t.jsx)(Yo,{value:d,onChange:c,label:u("graph.colorDropdown.opacity")})]})]})})})})]})},bt=({title:e,colors:n,currentColor:r,onPick:a})=>{const o=s.useI18n();return(0,t.jsxs)("div",{className:dn,children:[(0,t.jsx)("div",{className:Be,children:e}),(0,t.jsx)("div",{className:zo,children:n.map(i=>(0,t.jsx)("button",{type:"button","aria-label":i==="transparent"?o("graph.colorDropdown.transparent"):i,className:Fo,"data-active":pn(i,r),onMouseDown:l=>l.preventDefault(),onClick:()=>a(i),children:(0,t.jsx)("span",{className:un,style:hn(i)})},i))})]})},na=({value:e,onChange:n,popupAttributes:r})=>{const a=s.useI18n(),[o,i]=(0,v.useState)(!1),l=s.isValidCssColor(e)?e:"#000000",d=oa(l);return(0,t.jsxs)(B.Popover.Root,{open:o,onOpenChange:i,children:[(0,t.jsxs)("div",{className:dn,children:[(0,t.jsx)("div",{className:Be,children:a("graph.colorDropdown.custom")}),(0,t.jsxs)(B.Popover.Trigger,{className:Ho,onMouseDown:c=>c.preventDefault(),"aria-label":a("graph.colorDropdown.pickCustom"),children:[(0,t.jsx)("span",{className:un,style:hn(l)}),(0,t.jsx)("span",{className:Bo,children:d})]})]}),(0,t.jsx)(B.Popover.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(B.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:cn,children:(0,t.jsxs)(B.Popover.Popup,{className:Go,onMouseDown:c=>c.preventDefault(),...r,children:[(0,t.jsx)("div",{className:Be,children:a("graph.colorDropdown.pickColor")}),(0,t.jsx)(xt.HexColorPicker,{color:d,onChange:n,className:Vo}),(0,t.jsx)(xt.HexColorInput,{color:d,onChange:n,prefixed:!0,className:Uo,onMouseDown:c=>c.stopPropagation()})]})})})})]})},ra=()=>{const e=s.useCompiledSelector(n=>n.scales.color);return(0,v.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const n=new Set;for(const r of e.domain){const a=e.map(r);typeof a=="string"&&n.add(a)}return[...n]},[e])},hn=e=>e==="transparent"?{background:Ro,border:`1px solid ${G.vars.border100}`}:{background:e,border:`1px solid ${s.darkenCss(e,.1)}`},oa=e=>{const{themeValues:n}=s.useThemeContext();if(s.isHex(e))return e.toUpperCase();const r=Qo[e];return r?n[r].toUpperCase():"#000000"},pn=(e,n)=>n===null?!1:e.toLowerCase()===n.toLowerCase(),aa="l9kff0",ia="l9kff1",la="l9kff2",sa="xn24px0",ca="xn24px1",da="xn24px2",ua=({children:e,popupAttributes:n})=>(0,t.jsx)(M.Menu.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:sa,children:(0,t.jsx)(M.Menu.Popup,{className:ca,onMouseDown:r=>r.preventDefault(),...n,children:e})})})}),ha=({children:e,isSelected:n=!1,isDisabled:r=!1,onClick:a})=>(0,t.jsx)(M.Menu.Item,{className:da,"data-selected":n,disabled:r,onClick:a,children:e}),pa=({className:e,...n})=>(0,t.jsx)(te.Tooltip.Provider,{children:(0,t.jsx)(W.Toolbar.Root,{...n,className:(0,V.default)(aa,e)})}),ma=({className:e,...n})=>(0,t.jsx)(W.Toolbar.Group,{...n,className:(0,V.default)(ia,e)}),ga=({className:e,...n})=>(0,t.jsx)(W.Toolbar.Separator,{...n,className:(0,V.default)(la,e)}),xa=({children:e})=>{const n=s.resolvePortalContainer();return n===null?null:(0,en.createPortal)((0,t.jsx)(s.PortalThemeProvider,{children:e}),n)},F={Portal:xa,Root:pa,Group:ma,Separator:ga,Button:W.Toolbar.Button,ColorPicker:ta,MenuPopup:ua,MenuItem:ha},ce=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m6 9 6 6 6-6"})})}),fa="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",va=`'Aeonik', 'Aeonik Fallback', ${G.DEFAULT_FONT_FAMILY}`,ba="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",Ca="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Ve=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:G.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:va},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:fa},{id:"technical",label:"Technical",preview:"00",fontFamily:ba},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:Ca}],Sa=e=>e?Ve.find(n=>n.fontFamily===e)??null:null,mn="_70l3rt0",gn="_70l3rt1",xn="_70l3rt3",fn="_70l3rt4",vn="_70l3rt5",ya=({editor:e,currentFontFamily:n,isOpen:r,onOpenChange:a})=>{const o=s.useI18n(),i=Sa(n)??Ve[0],l=d=>{e.chain().focus().setFontFamily(d.fontFamily).run()};return(0,t.jsxs)(M.Menu.Root,{open:r,onOpenChange:a,children:[(0,t.jsxs)(M.Menu.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":o("graph.toolbar.font.ariaLabel"),className:mn,onMouseDown:d=>d.preventDefault(),children:[(0,t.jsx)("span",{className:gn,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,t.jsx)(ce,{size:"sm"})]}),(0,t.jsx)(M.Menu.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:xn,children:(0,t.jsx)(M.Menu.Popup,{className:fn,onMouseDown:d=>d.preventDefault(),children:Ve.map(d=>(0,t.jsx)(M.Menu.Item,{className:vn,"data-selected":d.id===i?.id,onClick:()=>l(d),children:(0,t.jsx)("span",{style:{fontFamily:d.fontFamily},children:d.label})},d.id))})})})})]})},bn={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:G.vars.fontTextEditorBody},Ct=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:G.vars.fontTextEditorH6},bn,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:G.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:G.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:G.vars.fontTextEditorH1}],ja=({editor:e,activeStyle:n,isOpen:r,onOpenChange:a})=>{const o=s.useI18n(),i=Ct.find(l=>l.id===n)??bn;return(0,t.jsxs)(M.Menu.Root,{open:r,onOpenChange:a,children:[(0,t.jsxs)(M.Menu.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":o("graph.toolbar.heading.ariaLabel"),className:mn,onMouseDown:l=>l.preventDefault(),children:[(0,t.jsx)("span",{className:gn,children:o(i.translationKey)}),(0,t.jsx)(ce,{size:"sm"})]}),(0,t.jsx)(M.Menu.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:xn,children:(0,t.jsx)(M.Menu.Popup,{className:fn,onMouseDown:l=>l.preventDefault(),children:Ct.map(l=>(0,t.jsx)(M.Menu.Item,{className:vn,"data-selected":l.id===i.id,onClick:()=>Ta(e,l.id),children:(0,t.jsx)(wa,{font:l.previewFont,children:o(l.translationKey)})},l.id))})})})})]})},Ta=(e,n)=>{switch(n){case"caption":e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return;case"text":e.chain().focus().setNode("paragraph",{variant:null}).run();return;case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},wa=({font:e,children:n})=>(0,t.jsx)("span",{style:{font:e,margin:0},children:n}),Cn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),Aa=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,t.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),Pa=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M18 6 6 18"}),(0,t.jsx)("path",{d:"m6 6 12 12"})]})}),La=e=>!e.content||e.content.length===0?!0:e.content.every(n=>!n.content||n.content.length===0),ka=e=>{const{$from:n}=e.state.selection,r=n.parent.textContent,a=n.parentOffset,o=n.start();let i=a;for(;i>0&&St(r[i-1]);)i-=1;let l=a;for(;l<r.length&&St(r[l]);)l+=1;return{from:o+i,to:o+l}},St=e=>e!==void 0&&/\S/.test(e),Ia="fop13s0",Ea="fop13s1",Ma="fop13s2",_a="fop13s3",yt="fop13s4",Na=({editor:e,currentUrl:n,isActive:r,isOpen:a,onOpenChange:o})=>{const i=s.useI18n(),[l,d]=(0,v.useState)(""),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{a&&d(n??"")},[a,n]);const h=()=>{Ra(e,l),o(!1)},u=()=>{d(""),o(!1)},p=g=>{d(g.target.value)},f=g=>{g.key==="Enter"&&(g.preventDefault(),h())};return(0,t.jsxs)(B.Popover.Root,{open:a,onOpenChange:o,children:[(0,t.jsx)(B.Popover.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:Ia,onMouseDown:g=>g.preventDefault(),children:(0,t.jsx)(Aa,{})}),(0,t.jsx)(B.Popover.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(B.Popover.Positioner,{sideOffset:6,align:"end",className:Ea,children:(0,t.jsxs)(B.Popover.Popup,{className:Ma,initialFocus:c,onMouseDown:g=>g.preventDefault(),children:[(0,t.jsx)("input",{ref:c,type:"url",value:l,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:_a,onMouseDown:g=>g.stopPropagation(),onChange:p,onKeyDown:f}),(0,t.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:yt,onClick:u,children:(0,t.jsx)(Pa,{})}),(0,t.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:yt,onClick:h,children:(0,t.jsx)(Cn,{})})]})})})})]})},Ra=(e,n)=>{const r=n.trim(),{selection:a}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!a.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=ka(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Sn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 5H3"}),(0,t.jsx)("path",{d:"M17 12H7"}),(0,t.jsx)("path",{d:"M19 19H5"})]})}),yn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 5H3"}),(0,t.jsx)("path",{d:"M21 12H9"}),(0,t.jsx)("path",{d:"M21 19H7"})]})}),jn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 5H3"}),(0,t.jsx)("path",{d:"M15 12H3"}),(0,t.jsx)("path",{d:"M17 19H3"})]})}),Oa="_1d66w570",Da="_1d66w571",za=6,ne=({label:e,isActive:n,onToggle:r,children:a})=>{const o=i=>i.preventDefault();return(0,t.jsxs)(te.Tooltip.Root,{children:[(0,t.jsx)(te.Tooltip.Trigger,{render:(0,t.jsx)(ho.Toggle,{render:(0,t.jsx)(W.Toolbar.Button,{}),pressed:n,onPressedChange:()=>r()}),"aria-label":e,className:Oa,onMouseDown:o,children:a}),(0,t.jsx)(te.Tooltip.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(te.Tooltip.Positioner,{sideOffset:za,children:(0,t.jsx)(te.Tooltip.Popup,{className:Da,children:e})})})})]})},Fa=({editor:e,activeAlignment:n="left"})=>{const r=s.useI18n();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ne,{label:r("graph.toolbar.textAlign.left"),isActive:n==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,t.jsx)(jn,{})}),(0,t.jsx)(ne,{label:r("graph.toolbar.textAlign.center"),isActive:n==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,t.jsx)(Sn,{})}),(0,t.jsx)(ne,{label:r("graph.toolbar.textAlign.right"),isActive:n==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,t.jsx)(yn,{})})]})},Ha="_1u34vl40",Ba=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:Ga(e),textAlign:Va(e)}),Ga=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",Va=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Ua=8,$a=8,qa=({editor:e})=>{const n=s.useI18n(),[r,a]=(0,v.useState)(!1),[o,i]=(0,v.useState)(null),l=o!==null,d=g=>x=>{i(x?g:null)},{refs:c,floatingStyles:h}=(0,ae.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,ae.offset)(Ua),(0,ae.flip)(),(0,ae.shift)({padding:$a})],whileElementsMounted:ae.autoUpdate}),u=(0,v.useRef)(null),p=(0,Pe.useEditorState)({editor:e,selector:Ba}),f=(0,v.useCallback)(g=>{u.current=g,c.setFloating(g)},[c]);return(0,v.useEffect)(()=>{e&&c.setReference(e.view.dom)},[e,c]),(0,v.useEffect)(()=>{if(!e)return;const g=()=>a(!0),x=({event:b})=>{const{relatedTarget:T,currentTarget:w}=b,y=T instanceof Node&&u.current?.contains(T),P=T instanceof Node&&w instanceof Node&&w.contains(T);!y&&!P&&a(!1)};return e.on("focus",g),e.on("blur",x),()=>{e.off("focus",g),e.off("blur",x)}},[e]),!e||!r&&!l?null:(0,t.jsx)(F.Portal,{children:(0,t.jsxs)(F.Root,{ref:f,className:Ha,style:h,children:[(0,t.jsxs)(F.Group,{children:[(0,t.jsx)(F.ColorPicker,{color:p?.color??null,onChange:g=>e.chain().setColor(g).run(),isOpen:o==="color",onOpenChange:d("color")}),(0,t.jsx)(ya,{editor:e,currentFontFamily:p?.fontFamily??null,isOpen:o==="fontFamily",onOpenChange:d("fontFamily")})]}),(0,t.jsx)(F.Separator,{}),(0,t.jsx)(F.Group,{children:(0,t.jsx)(ja,{editor:e,activeStyle:p?.fontSize??"text",isOpen:o==="fontSize",onOpenChange:d("fontSize")})}),(0,t.jsx)(F.Separator,{}),(0,t.jsxs)(F.Group,{children:[(0,t.jsx)(ne,{label:n("graph.toolbar.formatting.bold"),isActive:p?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,t.jsx)("strong",{children:"B"})}),(0,t.jsx)(ne,{label:n("graph.toolbar.formatting.italic"),isActive:p?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,t.jsx)("em",{children:"I"})}),(0,t.jsx)(ne,{label:n("graph.toolbar.formatting.underline"),isActive:p?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,t.jsx)("u",{children:"U"})})]}),(0,t.jsx)(F.Separator,{}),(0,t.jsx)(F.Group,{children:(0,t.jsx)(Fa,{editor:e,activeAlignment:p?.textAlign})}),(0,t.jsx)(F.Separator,{}),(0,t.jsx)(F.Group,{children:(0,t.jsx)(Na,{editor:e,currentUrl:p?.linkUrl??null,isActive:p?.isLink??!1,isOpen:o==="link",onOpenChange:d("link")})})]})})},Wa="_1uy50v30",Tn=({editor:e,ariaLabel:n})=>(0,t.jsxs)("div",{className:Wa,children:[(0,t.jsx)(qa,{editor:e}),(0,t.jsx)(Pe.EditorContent,{editor:e,"aria-label":n})]}),Ka=200,et=({content:e,extensions:n,isEditable:r,onUpdate:a,updateDebounceMs:o=Ka})=>{const i=(0,v.useRef)(jt(e)),l=(0,v.useRef)(i.current),d=s.useDebouncedCallback(h=>{l.current=h,a?.(h)},o),c=(0,Pe.useEditor)({extensions:n,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const u=h.getJSON();if(Oe(l.current,u))return d.cancel();d.run(u)}});return(0,v.useEffect)(()=>{c?.setEditable(r)},[c,r]),(0,v.useEffect)(()=>{if(!c)return;const h=jt(e);Oe(l.current,h)||(l.current=h,!Oe(c.getJSON(),h)&&(d.cancel(),Xa(c,h)))},[c,e,d]),(0,v.useEffect)(()=>()=>d.flush(),[d]),c},jt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Xa=(e,n)=>{const{from:r,to:a}=e.state.selection;e.commands.setContent(n,{emitUpdate:!1});const o=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,o),to:Math.min(a,o)})},Oe=(e,n)=>JSON.stringify(be(e))===JSON.stringify(be(n)),be=e=>Array.isArray(e)?e.map(be):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,be(r)]).filter(([,n])=>!Za(n)).sort(([n],[r])=>String(n).localeCompare(String(r)))),Za=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,Ya=({caption:e})=>{const{dispatch:n}=s.useGraphCommands();return(0,t.jsx)(Tn,{editor:et({content:e,extensions:(0,v.useMemo)(()=>_o({placeholder:"Add caption"}),[]),isEditable:!0,onUpdate:r=>{const a=La(r)?null:r;n(new m.SetContentCaptionCommand({caption:a}))}}),ariaLabel:"Chart caption"})},Ja=e=>[fe.Document,rn.Paragraph,...Qe(),ei,Ae.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],Qa=({annotation:e})=>{const n=s.useI18n(),{dispatch:r}=s.useGraphCommands(),a=s.useEditorStore(),o=(0,v.useMemo)(()=>Ja(n("graph.annotations.text.placeholder")),[n]),i=et({content:e.content,extensions:o,isEditable:!0,onUpdate:l=>{r(new m.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:l}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:l}=a.getState();return l(i),()=>l(null)},[i,a]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,t.jsx)(Pe.EditorContent,{"aria-label":n("graph.annotations.text.editLabel"),className:s.editor,editor:i,"data-testid":"text-annotation-editor"})},Tt=e=>{const n=s.resolveRichTextFontFamily(e);return n===void 0?{}:{style:`font-family: ${n}`}},ei=nn.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Tt(e.fontFamily)},font:{default:null,renderHTML:e=>Tt(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: ${e.fontSize/10}em`}:{}}}}]}}),ti=3,ni=({title:e,isTitleVisible:n,subtitle:r,isSubtitleVisible:a})=>{const o=[];return n&&o.push({type:"heading",attrs:{level:ti},content:oi(e)}),a&&o.push(...ai(r)),{type:"doc",content:o}},ri=e=>{const[n,...r]=e.content??[];return{title:ii(n?.content??[]),subtitle:li(r)}},tt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(tt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),oi=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(n=>n.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],ai=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(wt):[wt(e)],wt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},ii=e=>{if(e.length===0)return null;const[n]=e;return n&&e.length===1&&n.type==="text"&&(!n.marks||n.marks.length===0)?n.text??null:{type:"paragraph",content:e.map(tt)}},li=e=>{const n=e.filter(a=>(a.content??[]).length>0);if(n.length===0)return null;const[r]=n;if(r&&n.length===1&&r.type==="paragraph"){const a=r.content??[],[o]=a;if(o&&a.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:n.map(tt)}},si=({title:e,isTitleVisible:n,isSubtitleVisible:r,subtitle:a})=>{const{dispatch:o}=s.useGraphCommands(),i=(0,v.useMemo)(()=>Mo({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:n,isSubtitleVisible:r}),[n,r]);return(0,t.jsx)(Tn,{editor:et({content:(0,v.useMemo)(()=>ni({title:e,isTitleVisible:n,subtitle:a,isSubtitleVisible:r}),[e,n,a,r]),extensions:i,isEditable:!0,onUpdate:l=>{const d=ri(l);n&&o(new m.SetContentTitleCommand({title:d.title})),r&&o(new m.SetContentSubtitleCommand({subtitle:d.subtitle}))}}),ariaLabel:"Chart title and subtitle"})},ci={Title:si,Caption:Ya,TextAnnotation:Qa},di="data-graphy-chart-chrome",ui="data-graphy-chart-menu",wn={[ui]:""},Le=e=>({[di]:e}),xe=(e,n)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(n)}"]`)!==null,hi=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,Ue=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,An=(e,n,r)=>r!==null&&(0,m.isPointWithinEditMenuTrigger)({x:e.clientX-n.x,y:e.clientY-n.y},r),se=(e,n,r)=>e instanceof Node&&(n.contains(e)||xe(e,r)),pi="cml7ha0",Pn=(0,v.createContext)(null),mi=({children:e})=>{const{chartId:n}=s.useGraphContext(),[r]=(0,v.useState)(s.resolvePortalContainer),[a,o]=(0,v.useState)(null);return r===null?null:(0,t.jsxs)(t.Fragment,{children:[(0,en.createPortal)((0,t.jsx)("div",{ref:o,className:pi,...Le(n)}),r),(0,t.jsx)(Pn.Provider,{value:a,children:e})]})},nt=()=>(0,v.useContext)(Pn),Ln=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",opacity:".12"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M3.325 3.156a.836.836 0 0 0-.836.836v6.832c0 .462.375.836.836.836h2.131a.5.5 0 0 1 .352.145L8 13.975l2.193-2.17a.5.5 0 0 1 .352-.145h2.13a.84.84 0 0 0 .836-.836V3.992a.84.84 0 0 0-.836-.836zm-1.836.836c0-1.014.822-1.836 1.836-1.836h9.35c1.015 0 1.836.825 1.836 1.836v6.832a1.84 1.84 0 0 1-1.836 1.836H10.75l-2.398 2.374a.5.5 0 0 1-.704 0L5.25 12.66H3.325a1.836 1.836 0 0 1-1.836-1.836z",clipRule:"evenodd"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M8 4.505a.5.5 0 0 1 .5.5v2.172h2.171a.5.5 0 0 1 0 1H8.5v2.171a.5.5 0 0 1-1 0V8.177H5.329a.5.5 0 0 1 0-1H7.5V5.005a.5.5 0 0 1 .5-.5",clipRule:"evenodd"})]});var kn="efjmb40",In="efjmb41",J="efjmb42",Q="efjmb43",gi="efjmb44",xi="efjmb45",fi=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),rt=({label:e,icon:n,onOpened:r,children:a})=>{const o=nt(),[i,l]=(0,v.useState)(!1),d=(c,h)=>{c?(l(!0),r?.()):fi.has(h.reason)&&l(!1)};return(0,t.jsxs)(X.Menu.SubmenuRoot,{open:i,onOpenChange:d,children:[(0,t.jsx)(vi,{label:e,icon:n}),(0,t.jsx)(X.Menu.Portal,{container:o,children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(X.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:kn,...wn,children:(0,t.jsx)(X.Menu.Popup,{className:In,children:a})})})})]})},vi=({label:e,icon:n})=>(0,t.jsxs)(X.Menu.SubmenuTrigger,{className:J,openOnHover:!1,children:[n,(0,t.jsx)("span",{className:Q,children:e}),(0,t.jsx)("span",{className:xi,children:(0,t.jsx)(ce,{size:"sm"})})]}),bi="_1qe7q450",Ci="_1qe7q451",Si="_1qe7q452",yi=({label:e,placeholder:n,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,v.useRef)(null),[l,d]=(0,v.useState)(""),{dispatch:c}=s.useGraphCommands(),h=l.trim(),u=()=>{h.length!==0&&(c(new m.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:ji(h)}})),o())},p=x=>{x.key==="Enter"&&(x.preventDefault(),u()),x.key!=="Escape"&&x.stopPropagation()},f=x=>{d(x.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,t.jsx)(rt,{label:e,icon:(0,t.jsx)(Ln,{}),onOpened:g,children:(0,t.jsxs)("div",{className:bi,children:[(0,t.jsx)("input",{ref:i,className:Ci,value:l,placeholder:n,onChange:f,onKeyDown:p}),(0,t.jsx)("button",{type:"button",className:Si,disabled:h.length===0,onClick:u,children:r})]})})},ji=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Ti=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 15 14",...e,children:(0,t.jsx)("path",{d:"M14.0146 5.20703C14.2118 5.40459 14.2121 5.72447 14.0146 5.92187L12.3291 7.6084C12.2343 7.70313 12.1047 7.75579 11.9707 7.75586C11.8369 7.75573 11.708 7.70291 11.6133 7.6084L9.92773 5.92187C9.73024 5.72438 9.73031 5.40457 9.92773 5.20703C10.1253 5.0095 10.445 5.0095 10.6426 5.20703L11.4658 6.03027L11.4658 1.68652L7.75586 1.68652L7.75586 12.6455C7.75563 12.9246 7.5291 13.1512 7.25 13.1514L2.5293 13.1514C2.2501 13.1514 2.02367 12.9247 2.02344 12.6455L2.02344 5.00781C0.868958 4.77348 0.000106647 3.7528 -1.10559e-07 2.5293C-4.95071e-08 1.13259 1.13261 9.74645e-05 2.5293 -5.23256e-07C3.92588 0.000220668 5.05859 1.13267 5.05859 2.5293C5.05849 3.75251 4.1892 4.77219 3.03516 5.00684L3.03516 12.1396L6.74414 12.1396L6.74414 1.18066C6.74414 0.901394 6.97076 0.674939 7.25 0.674804L11.9707 0.674805C12.2499 0.674939 12.4766 0.901394 12.4766 1.18066L12.4766 6.03027L13.2998 5.20703C13.4973 5.0095 13.8171 5.0095 14.0146 5.20703ZM4.04687 2.5293C4.04687 1.69137 3.36717 1.01194 2.5293 1.01172C1.69132 1.01182 1.01172 1.6913 1.01172 2.5293C1.01184 3.36719 1.6914 4.04678 2.5293 4.04687C3.36709 4.04665 4.04675 3.36712 4.04687 2.5293ZM14.5 11.2969C14.4998 12.6935 13.3673 13.8262 11.9707 13.8262C10.5742 13.826 9.4416 12.6934 9.44141 11.2969C9.44141 9.90018 10.574 8.7677 11.9707 8.76758C13.3675 8.76758 14.5 9.90011 14.5 11.2969ZM13.4883 11.2969C13.4883 10.4588 12.8088 9.7793 11.9707 9.7793C11.1327 9.77942 10.4531 10.4589 10.4531 11.2969C10.4533 12.1347 11.1329 12.8143 11.9707 12.8145C12.8086 12.8145 13.4881 12.1348 13.4883 11.2969Z",fill:"currentColor",fillOpacity:"0.8"})}),wi="relative-difference",Ai=({label:e,layer:n,at:r,onRequestClose:a})=>{const{dispatch:o}=s.useGraphCommands(),i=s.useCompiledSelector(c=>c.coordSystem),l=(0,v.useMemo)(()=>(0,m.inferDifferenceArrowEndpoints)({layer:n,at:r,coordSystem:i}),[n,r,i]);if(l===null)return null;const d=()=>{o(new m.AddAnnotationCommand({kind:"differenceArrow",annotation:{...m.DIFFERENCE_ARROW_DEFAULTS,...l,label:wi}})),a()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:d,children:[(0,t.jsx)(Ti,{}),(0,t.jsx)("span",{className:Q,children:e})]})};function Pi(e,n){if(e.type==="polar"&&!Li(n))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,m.hasMultipleGroups)(n.data,n.mapping);switch(n.geom){case"bar":{const a=[{scope:"data-point",labelKey:"bar"}];if(r){const o=n.position==="stack"||n.position==="fill";a.push({scope:"x-value",labelKey:o?"barStack":"barGroup"}),a.push({scope:"series",labelKey:"barSeries"})}return a}case"line":case"area":{const a=[{scope:"data-point",labelKey:"linePoint"}];return r&&a.push({scope:"series",labelKey:"lineSeries"}),a}case"point":{const a=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&a.push({scope:"series",labelKey:"scatterSeries"}),a}default:return[]}}var Li=e=>{const n=(0,m.extractVariableName)(e.mapping.x);return n!==null&&n!==m.CONSTANT_VARIABLES.x},ki=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Ii=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Ei=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),Mi=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),_i=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:".8",strokeWidth:"1.163",d:"m-1.618 15.96 9.118-5.3 11 2.34"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",stroke:"currentColor",strokeOpacity:"0.3",d:"M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,t.jsx)("rect",{width:"9.795",height:"6",x:"3",y:"2",fill:"currentColor",fillOpacity:"0.3",rx:"1.513"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.29 6.62a1.3 1.3 0 0 1-.424-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.262-.45 2.1 2.1 0 0 1-.096-.699q0-.389.082-.693.083-.304.238-.514a1.05 1.05 0 0 1 .374-.322q.22-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.321-.105.54.54 0 0 0-.485.273q-.168.273-.17.75h.021a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .813.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.571.134m-.003-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.07-.294.54.54 0 0 0-.484-.285.55.55 0 0 0-.403.173.596.596 0 0 0 .108.914.53.53 0 0 0 .288.08M6.88 6.579v-.396l1.05-1.03q.15-.15.25-.27a1 1 0 0 0 .151-.229.6.6 0 0 0 .05-.236.432.432 0 0 0-.244-.405.6.6 0 0 0-.258-.056q-.15 0-.261.062a.43.43 0 0 0-.175.173.56.56 0 0 0-.06.267H6.86q0-.288.132-.5a.9.9 0 0 1 .362-.33q.231-.117.532-.117.303 0 .534.114.23.114.358.312a.8.8 0 0 1 .128.452.9.9 0 0 1-.065.334q-.065.164-.229.363-.162.2-.456.483l-.522.53v.021h1.318v.458zM10.57 6.62a1.3 1.3 0 0 1-.423-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.263-.45 2.1 2.1 0 0 1-.096-.699q0-.389.083-.693t.238-.514a1.05 1.05 0 0 1 .374-.322q.219-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.322-.105.54.54 0 0 0-.484.273q-.168.273-.17.75h.02a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .814.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.572.134m-.002-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.071-.294.54.54 0 0 0-.483-.285.54.54 0 0 0-.403.173.597.597 0 0 0 .107.914.53.53 0 0 0 .289.08"})]}),Ni=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:".993",d:"M1.5 12 6 6.5l4 3.5 4-5.5"}),(0,t.jsx)("circle",{cx:"1.493",cy:"11.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"5.993",cy:"6.493",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"9.993",cy:"9.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"13.993",cy:"4.493",r:".993",fill:"currentColor",fillOpacity:"0.8"})]}),Ri=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Oi=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Di=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),zi={bar:ki,barGroup:Ii,barStack:Mi,barSeries:Ei,linePoint:_i,lineSeries:Ni,scatterPoint:Oi,scatterSeries:Di,pieSlice:Ri},En=({labelKey:e})=>{const n=zi[e];return(0,t.jsx)(n,{})},Mn=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M5.01683 15.3331C4.84407 15.3343 4.67292 15.2997 4.51421 15.2314C4.3555 15.1632 4.21268 15.0627 4.09476 14.9365L3.88656 14.7283L3.62877 14.8968L3.19253 15.3331H0L2.24072 13.0923L2.03251 12.8445C1.89423 12.7191 1.78392 12.566 1.70875 12.3952C1.63359 12.2244 1.59526 12.0396 1.59626 11.853C1.59579 11.6818 1.63078 11.5124 1.69904 11.3554C1.76729 11.1984 1.86733 11.0573 1.99285 10.9409L11.2036 1.73012C11.3215 1.60384 11.4643 1.5034 11.623 1.43514C11.7817 1.36688 11.9529 1.33228 12.1257 1.33353C12.2969 1.33245 12.4665 1.36716 12.6236 1.43546C12.7807 1.50375 12.9218 1.60412 13.0378 1.73012L15.1496 3.92126C15.2748 4.03899 15.3745 4.1811 15.4427 4.33882C15.5108 4.49654 15.546 4.66655 15.546 4.83837C15.546 5.01019 15.5108 5.1802 15.4427 5.33792C15.3745 5.49564 15.2748 5.63774 15.1496 5.75548L5.93889 14.9662C5.81806 15.0866 5.67403 15.1812 5.51552 15.2443C5.35702 15.3074 5.18736 15.3376 5.01683 15.3331ZM2.48858 11.9125L5.01683 14.4407L9.47843 9.97913L6.95019 7.4608L2.48858 11.9125ZM7.68388 6.72712L10.2022 9.24544L14.644 4.80367L12.1257 2.28534L7.68388 6.72712Z",fill:"currentColor",fillOpacity:"0.8"})]}),Fi=({label:e,options:n,onSelect:r})=>{const a=s.useI18n();return(0,t.jsx)(rt,{label:e,icon:(0,t.jsx)(Mn,{}),children:n.map(o=>(0,t.jsxs)(X.Menu.Item,{className:J,onClick:()=>r(o.scope),children:[(0,t.jsx)(En,{labelKey:o.labelKey}),(0,t.jsx)("span",{className:Q,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},Hi=({label:e,layer:n,observation:r,highlights:a,onRequestClose:o})=>{const i=s.useI18n(),{dispatch:l}=s.useGraphCommands(),d=s.useCompiledSelector(g=>g.coordSystem),c=(0,v.useMemo)(()=>(0,m.buildObservationPredicate)(n,r),[n,r]),h=(0,v.useMemo)(()=>Pi(d,n),[d,n]),u=(0,v.useMemo)(()=>{const g=new Set(a.map(x=>x.scope));return h.filter(x=>!g.has(x.scope))},[h,a]),[p]=u;if(c===null||p===void 0)return null;const f=g=>{l(new m.AddHighlightCommand({predicate:c,scope:g,layerId:n.id})),o()};if(u.length===1){const g=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${p.labelKey}`)});return(0,t.jsxs)(X.Menu.Item,{className:J,onClick:()=>f(p.scope),children:[(0,t.jsx)(En,{labelKey:p.labelKey}),(0,t.jsx)("span",{className:Q,children:g})]})}return(0,t.jsx)(Fi,{label:e,options:u,onSelect:f})},Bi="_1aafi1g0",Gi="_1aafi1g1",_n=({children:e})=>(0,t.jsxs)("span",{className:Bi,"aria-hidden":"true",children:[e,(0,t.jsx)("span",{className:Gi})]}),Vi=({label:e,highlights:n,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=n.at(-1);if(o===void 0)return null;const i=()=>{a(new m.RemoveHighlightCommand({id:o.id})),r()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:i,children:[(0,t.jsx)(_n,{children:(0,t.jsx)(Mn,{})}),(0,t.jsx)("span",{className:Q,children:e})]})},Ui=(e,n)=>{const r=s.useCompiledSelector(o=>o.spec.highlights),a=s.useCompiledSelector(o=>o.config.parsingLocale);return(0,v.useMemo)(()=>(0,m.findHighlightsAtObservation)({layer:e,highlights:r,observation:n,parsingLocale:a}),[e,r,n,a])},Nn=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{opacity:"0.12",d:"M13.5948 4.29016C13.8724 6.22367 12.5301 8.01618 10.5966 8.29384C8.66309 8.57151 6.87058 7.22918 6.59292 5.29567C6.31525 3.36216 7.65758 1.56965 9.59109 1.29198C11.5246 1.01432 13.3171 2.35665 13.5948 4.29016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.71886 3.51052C6.25611 1.3626 8.43287 0.0568985 10.5808 0.594151C12.7287 1.1314 14.0344 3.30817 13.4972 5.45609C13.0316 7.31748 11.3347 8.54637 9.49237 8.49145L7.50898 12.492C7.46485 12.581 7.40179 12.6548 7.32702 12.7108C7.20005 12.8073 7.03703 12.8532 6.87248 12.8303C6.80957 12.822 6.74697 12.8038 6.68687 12.7749C6.39369 12.6342 6.26689 12.2915 6.3923 11.9963L7.63393 7.97371C6.10249 7.10872 5.27136 5.29962 5.71886 3.51052ZM10.2785 1.80253C8.79799 1.4322 7.29756 2.33222 6.92723 3.81277C6.55691 5.29332 7.45692 6.79375 8.93747 7.16408C10.418 7.5344 11.9185 6.63439 12.2888 5.15384C12.6591 3.67329 11.7591 2.17285 10.2785 1.80253Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M5.42977 11.1572C5.70072 11.104 5.8772 10.8411 5.82393 10.5702C5.77067 10.2992 5.50784 10.1227 5.23688 10.176C4.31848 10.3565 3.57421 10.6423 3.04695 11.0266C2.51409 11.4149 2.16666 11.936 2.16666 12.557C2.16666 13.0322 2.41215 13.4327 2.74425 13.7433C3.07553 14.0531 3.52776 14.3091 4.04484 14.5137C5.08193 14.9239 6.48048 15.1666 7.99999 15.1666C9.5195 15.1666 10.9181 14.9239 11.9551 14.5137C12.4722 14.3091 12.9244 14.0531 13.2557 13.7433C13.5878 13.4327 13.8333 13.0322 13.8333 12.557C13.8333 11.936 13.4859 11.4149 12.953 11.0266C12.4258 10.6423 11.6815 10.3565 10.7631 10.176C10.4921 10.1227 10.2293 10.2992 10.176 10.5702C10.1228 10.8411 10.2993 11.104 10.5702 11.1572C11.4079 11.3219 11.997 11.5672 12.364 11.8347C12.7255 12.0981 12.8333 12.3496 12.8333 12.557C12.8333 12.6643 12.7803 12.8187 12.5727 13.013C12.3642 13.2079 12.0354 13.4065 11.5873 13.5838C10.6941 13.9371 9.426 14.1666 7.99999 14.1666C6.57398 14.1666 5.30586 13.9371 4.41267 13.5838C3.9646 13.4065 3.63578 13.2079 3.4273 13.013C3.21964 12.8187 3.16666 12.6643 3.16666 12.557C3.16666 12.3496 3.2745 12.0981 3.63595 11.8347C4.00299 11.5672 4.59206 11.3219 5.42977 11.1572Z",fill:"currentColor",fillOpacity:"0.8"})]}),$i=({label:e,at:n,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=()=>{a(new m.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:n}})),r()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:o,children:[(0,t.jsx)(Nn,{}),(0,t.jsx)("span",{className:Q,children:e})]})},Rn=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{opacity:"0.12",d:"M1.33334 8.00016C1.33334 4.31826 4.31811 1.3335 8.00001 1.3335C11.6819 1.3335 14.6667 4.31826 14.6667 8.00016C14.6667 11.6821 11.6819 14.6668 8.00001 14.6668C4.31811 14.6668 1.33334 11.6821 1.33334 8.00016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M5.7328 9.69963C5.56696 9.47884 5.25352 9.43429 5.03273 9.60013C4.81193 9.76598 4.76739 10.0794 4.93323 10.3002C5.63175 11.2302 6.74548 11.8333 7.99993 11.8333C9.25438 11.8333 10.3681 11.2302 11.0666 10.3002C11.2325 10.0794 11.1879 9.76598 10.9671 9.60013C10.7463 9.43429 10.4329 9.47884 10.2671 9.69963C9.74929 10.3889 8.92657 10.8333 7.99993 10.8333C7.07329 10.8333 6.25057 10.3889 5.7328 9.69963Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M6.66668 6.66658C6.66668 7.03478 6.3682 7.33325 6.00001 7.33325C5.63182 7.33325 5.33334 7.03478 5.33334 6.66658C5.33334 6.29839 5.63182 5.99992 6.00001 5.99992C6.3682 5.99992 6.66668 6.29839 6.66668 6.66658Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M10 7.33325C10.3682 7.33325 10.6667 7.03478 10.6667 6.66658C10.6667 6.29839 10.3682 5.99992 10 5.99992C9.63182 5.99992 9.33334 6.29839 9.33334 6.66658C9.33334 7.03478 9.63182 7.33325 10 7.33325Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00001 0.833252C4.04197 0.833252 0.833344 4.04188 0.833344 7.99992C0.833344 11.958 4.04197 15.1666 8.00001 15.1666C11.9581 15.1666 15.1667 11.958 15.1667 7.99992C15.1667 4.04188 11.9581 0.833252 8.00001 0.833252ZM14.1667 7.99992C14.1667 11.4057 11.4058 14.1666 8.00001 14.1666C4.59425 14.1666 1.83334 11.4057 1.83334 7.99992C1.83334 4.59416 4.59425 1.83325 8.00001 1.83325C11.4058 1.83325 14.1667 4.59416 14.1667 7.99992Z",fill:"currentColor",fillOpacity:"0.8"})]}),On={pinnedNumber:{icon:Nn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:Ln,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Rn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},qi=e=>(0,m.isObservationAttachmentKind)(e.kind)&&On[e.kind]!==null,Wi=({attachment:e,onRequestClose:n})=>{const r=s.useI18n(),{dispatch:a}=s.useGraphCommands(),{icon:o,labelKey:i}=On[e.kind],l=()=>{a(new m.RemoveAnnotationCommand({id:e.annotation.id})),n()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:l,children:[(0,t.jsx)(_n,{children:(0,t.jsx)(o,{})}),(0,t.jsx)("span",{className:Q,children:r(i)})]})},Ki="ceeojg0",Xi="ceeojg1",Zi="ceeojg2",Yi=({label:e,at:n,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=i=>{a(new m.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...n},sticker:i}})),r()};return(0,t.jsx)(rt,{label:e,icon:(0,t.jsx)(Rn,{}),children:(0,t.jsx)("div",{className:Ki,children:Object.entries(s.STICKER_ASSETS).map(([i,l])=>(0,t.jsx)(X.Menu.Item,{className:Xi,"aria-label":i,onClick:()=>o(i),children:(0,t.jsx)("img",{className:Zi,src:l.src,alt:i})},i))})})},Ji=({interaction:e,panelOrigin:n})=>{const r=s.useEditorStore(),a=s.useEditorState(i=>i.menuTrigger);if(e.kind!=="menu"||a===null)return null;const o=()=>{r.getState().releaseInteraction("menu")};return(0,t.jsx)(Qi,{trigger:{x:n.x+a.center.x,y:n.y+a.center.y,radius:a.radius},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:o})},Qi=({trigger:e,layer:n,at:r,observation:a,onClose:o})=>{const i=s.useI18n(),l=nt(),d=s.useCompiledSelector(y=>y.spec.annotations),c=s.useCompiledSelector(y=>y.config.parsingLocale),h=tl(),{x:u,y:p,radius:f}=e,g=(0,v.useMemo)(()=>el(u,p,f),[u,p,f]),x=(0,m.findObservationAttachment)(d,r,(0,v.useMemo)(()=>(0,m.createObservationAnchorParser)(n,c),[n,c])),b=x!==null&&qi(x)?x:null,T=Ui(n,a),w=(y,P)=>{!y&&nl(P.reason)&&o()};return(0,t.jsx)(M.Menu.Root,{open:h,modal:!1,onOpenChange:w,children:(0,t.jsx)(M.Menu.Portal,{container:l,children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:kn,...wn,children:(0,t.jsxs)(M.Menu.Popup,{className:In,"data-testid":"observation-menu",children:[b!==null&&(0,t.jsx)(Wi,{attachment:b,onRequestClose:o}),(0,t.jsx)(Vi,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:T,onRequestClose:o}),(0,t.jsx)(M.Menu.Separator,{className:gi}),b===null&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($i,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:o}),(0,t.jsx)(yi,{label:i("graph.annotations.baseMenu.annotate"),placeholder:i("graph.annotations.textMenu.placeholder"),addLabel:i("graph.annotations.textMenu.addButton"),at:r,onRequestClose:o}),(0,t.jsx)(Yi,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:o})]}),n.highlight!==null&&(0,t.jsx)(Hi,{label:i("graph.annotations.baseMenu.highlight"),layer:n,observation:a,highlights:T,onRequestClose:o}),(0,t.jsx)(Ai,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:n,at:r,onRequestClose:o})]})})})})})},el=(e,n,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,n-r,r*2,r*2)}),tl=()=>{const[e,n]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{n(!0)},[]),e},nl=e=>e==="outside-press"||e==="escape-key"||e==="item-press",ot="l8tsqe0",Dn=["start","end"],zn=({anchor:e,point:n,delta:r})=>{const a={x:At(n.x,r.x),y:At(1-n.y,r.y)};return{anchor:{...e,x:e.x+a.x,y:e.y+a.y},point:{x:n.x+a.x,y:n.y-a.y}}},at=(e,n)=>({...e,[n.endpoint]:{...e[n.endpoint],...n.point}}),Fn=(e,n)=>e.x===n.x&&e.y===n.y,rl=(e,n)=>({x:n.x+e.x*n.width,y:n.y+(1-e.y)*n.height}),ol=(e,n,r)=>{const a=e.x*r.width,o=n.x*r.width,i=(1-e.y)*r.height,l=(1-n.y)*r.height;return{x:Math.min(a,o),y:Math.min(i,l),width:Math.abs(o-a),height:Math.abs(l-i)}},At=(e,n)=>!Number.isFinite(n)||!Number.isFinite(e)?0:(0,re.default)(n,Math.min(-e,0),Math.max(1-e,0)),al=({panelRect:e})=>{const n=s.useEditorState(i=>s.readStanding(i,"arrow-endpoint-drag")),r=s.useResolvedAnnotations(e).arrows;if(n===null)return null;const a=r.find(i=>i.id===n.annotationId);if(a===void 0)return null;const o=(0,m.computeArrow)({arrow:at(a,n),panelWidth:e.width,panelHeight:e.height});return o===null?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ot,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":n.annotationId,children:(0,t.jsx)(s.ArrowAnnotation,{computed:o,isAddressable:!1})})},de=()=>{const e=s.useGraphSelection();return $e(e)},$e=e=>{if(e.length!==1)return null;const[n]=e;return n?.kind==="annotation"?n.id:null},il=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,t.jsx)("path",{d:"M19 12H5"})]})}),Hn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M5 12h14"}),(0,t.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),ll=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M7 17 17 7"}),(0,t.jsx)("path",{d:"M7 7h10v10"})]})}),Bn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"18",height:"1.5",rx:"0.75"}),(0,t.jsx)("rect",{x:"3",y:"10",width:"18",height:"3",rx:"1.5"}),(0,t.jsx)("rect",{x:"3",y:"16.5",width:"18",height:"4.5",rx:"2.25"})]})}),ke=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M4 7h16"}),(0,t.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,t.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,t.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),sl="var(--pvjfpx0)",cl="var(--pvjfpx1)",dl="pvjfpx2",ul="pvjfpx3",hl="pvjfpx4",pl="pvjfpx6 pvjfpx5",ml="pvjfpx7 pvjfpx6 pvjfpx5",gl="pvjfpx8 pvjfpx5",ie=8,xl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:a})=>{const o=n.y+e.y,i=o+e.height,l=o-8-36,d=i+8,c=(0,re.default)(l>=ie?l:d,ie,a-ie-36),h=ie;return{top:c,left:h,available:Math.max(0,r-ie*2),centre:n.x+e.x+e.width/2-h}},fl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:a,label:o,testId:i,children:l})=>{const{chartId:d}=s.useGraphContext(),c=xl({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:a});return(0,t.jsx)("div",{className:dl,style:{top:c.top,left:c.left,width:c.available},children:(0,t.jsx)(F.Root,{"aria-label":o,className:ul,"data-testid":i,...Le(d),style:(0,tn.assignInlineVars)({[sl]:`${c.centre}px`,[cl]:`${c.available}px`}),children:l})})},vl=({label:e,trigger:n,isOpen:r,onOpenChange:a,isDisabled:o=!1,children:i})=>{const{chartId:l}=s.useGraphContext();return(0,t.jsxs)(M.Menu.Root,{open:r,modal:!1,onOpenChange:a,children:[(0,t.jsxs)(M.Menu.Trigger,{render:(0,t.jsx)(F.Button,{}),"aria-label":e,className:gl,disabled:o,onMouseDown:d=>d.preventDefault(),children:[n,(0,t.jsx)(ce,{size:"sm"})]}),(0,t.jsx)(F.MenuPopup,{popupAttributes:Le(l),children:i})]})},bl=e=>{const{chartId:n}=s.useGraphContext();return(0,t.jsx)(F.ColorPicker,{...e,popupAttributes:Le(n)})},Cl=({color:e,opacity:n})=>(0,t.jsx)("span",{className:hl,style:{background:e,opacity:n}}),Sl=({label:e,onClick:n,children:r})=>(0,t.jsx)(F.Button,{"aria-label":e,className:pl,onClick:n,children:r}),yl=({label:e,isPressed:n,onClick:r,children:a})=>(0,t.jsx)(F.Button,{"aria-label":e,"aria-pressed":n,className:ml,onClick:r,children:a}),k={Root:fl,Dropdown:vl,MenuItem:F.MenuItem,ColorPicker:bl,Swatch:Cl,IconButton:Sl,ToggleButton:yl,Button:F.Button,Separator:F.Separator},jl={kind:"chrome-popup"},Ie=()=>{const{commands:e}=s.useGraphContext(),n=s.useEditorStore(),[r,a]=(0,v.useState)(null);(0,v.useEffect)(()=>()=>e.seal(),[e]),(0,v.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:l}=n.getState();return r===null?l("chrome-popup"):i(jl),()=>l("chrome-popup")},[n,r]);const o=()=>{a(null),e.seal()};return{bind:i=>({isOpen:r===i,onOpenChange:l=>l?a(i):o()}),close:o}},Tl=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,t.jsx)("path",{d:"M5 19 8 16"}),(0,t.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,t.jsx)("path",{d:"M16 8 19 5"})]})}),wl=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),Al=[{value:"thin",key:"graph.annotations.arrowToolbar.thickness.thin"},{value:"medium",key:"graph.annotations.arrowToolbar.thickness.medium"},{value:"thick",key:"graph.annotations.arrowToolbar.thickness.thick"}],Pt=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Hn},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:s.MinusIcon}],Lt=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:wl},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:Tl}],Pl=(e,n)=>e.find(r=>r.value===n)??e[0];var Ll=({arrow:e,arrowBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=Ie(),u=e.color??c.defaultAnnotationArrowStroke,p=Pl(Lt,e.lineStyle),f=(I,D)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:I}),D)},g=I=>{f(I),h.close()},x=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},b=I=>f({color:I},{transient:!0}),T=I=>g({thickness:I}),w=I=>g({startArrowheadStyle:I}),y=I=>g({lineStyle:I}),P=I=>g({endArrowheadStyle:I}),C=()=>f({hasStickerStyle:!e.hasStickerStyle});return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,t.jsx)(k.ColorPicker,{color:u,label:l("graph.annotations.arrowToolbar.color"),onChange:b,...h.bind("color"),children:(0,t.jsx)(k.Swatch,{color:u})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,t.jsx)(Bn,{size:"sm",title:""}),...h.bind("thickness"),children:(0,t.jsx)(pe,{options:Al,current:e.thickness,onPick:T})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,t.jsx)(il,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,t.jsx)(pe,{options:Pt,current:e.startArrowheadStyle,onPick:w})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:p?.Icon!==void 0&&(0,t.jsx)(p.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,t.jsx)(pe,{options:Lt,current:e.lineStyle,onPick:y})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,t.jsx)(Hn,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,t.jsx)(pe,{options:Pt,current:e.endArrowheadStyle,onPick:P})}),(0,t.jsx)(k.ToggleButton,{label:l("graph.annotations.arrowToolbar.sticker"),isPressed:e.hasStickerStyle,onClick:C,children:(0,t.jsx)(ll,{size:"sm",title:""})}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.arrowToolbar.remove"),onClick:x,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},pe=({options:e,current:n,onPick:r})=>{const a=s.useI18n(),o=i=>()=>r(i);return(0,t.jsx)(t.Fragment,{children:e.map(i=>(0,t.jsxs)(k.MenuItem,{isSelected:i.value===n,onClick:o(i.value),children:[(0,t.jsx)("span",{children:a(i.key)}),i.Icon!==void 0&&(0,t.jsx)("span",{className:"_112xh5c0",children:(0,t.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},kl="_1me29t10",U=(e,n)=>n>0?e/n:0,Ee=(e,n,r)=>({x:U(n.x-e.x,r.width),y:U(n.y-e.y,r.height)}),Il=e=>e.x!==0||e.y!==0,Gn=(e,n)=>({x:e.x*n.width,y:e.y*n.height});var El=(e,n)=>Math.hypot(n.x-e.x,n.y-e.y)>=3,ue=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=n=>{n.pointerId===this.params.pointerId&&(this.pendingEvent=n,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=n=>{n.pointerId===this.params.pointerId&&(this.pendingEvent=n,this.finish(!0))},this.handleLost=n=>{n.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const n=this.pendingEvent;if(this.pendingEvent=null,n===null)return;const r=this.params.editorStore.getState();if(this.hasPublished&&this.readOwn(r)===null)return;const a={x:n.clientX,y:n.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,a))return;const o=this.resolvePreview(a);o!==null&&(r.claimInteraction(o),this.hasPublished=!0)}}start(){const{handle:e}=this.params,{signal:n}=this.listeners;e.addEventListener("pointermove",this.handleMove,{signal:n}),e.addEventListener("pointerup",this.handleUp,{signal:n}),e.addEventListener("lostpointercapture",this.handleLost,{signal:n})}finish(e){this.params.onSettled(),this.listeners.abort(),this.cancelFrame();try{e&&this.hasMoved&&this.runFrame()}finally{this.settle(e)}}isDragConfirmed(e,n){return El(e,n)}settle(e){this.pendingEvent=null;const n=this.params.editorStore.getState(),r=this.readOwn(n);r!==null&&n.releaseInteraction(this.kind),!(!e||r===null)&&this.commit(r)}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Ce=(e,n,r)=>{const a=e.arrows.find(i=>i.id===n);if(a===void 0)return null;const o=a[r];return o.anchorType==="panel"?o:null},Vn=(e,n)=>e==="start"?{start:n}:{end:n},Ml=class extends ue{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:n,endpoint:r}=this.params;return s.readDraggedArrowEndpointFor(s.readStanding(e,"arrow-endpoint-drag"),n,r)}resolvePreview(e){const{annotationId:n,endpoint:r,press:a,readInputs:o}=this.params,{annotations:i,arrow:l,panelRect:d}=o(),c=Ce(i,n,r);return c===null?null:{kind:"arrow-endpoint-drag",annotationId:n,endpoint:r,...zn({anchor:c,point:l[r],delta:Ee(a,e,d)})}}commit({anchor:e}){const{annotationId:n,endpoint:r,dispatch:a,readInputs:o}=this.params,i=Ce(o().annotations,n,r);i===null||Fn(i,e)||a(new m.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Vn(r,e)}))}},_l=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useLatestRef({annotations:s.useCompiledSelector(d=>d.spec.annotations),arrow:n,panelRect:r}),l=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>l.current?.finish(!1),[]),(0,v.useCallback)(d=>({onPointerDown:c=>{if(c.button===0&&l.current===null){try{c.currentTarget.setPointerCapture(c.pointerId)}catch{return}c.currentTarget.focus({preventScroll:!0}),c.preventDefault(),l.current=new Ml({handle:c.currentTarget,pointerId:c.pointerId,annotationId:e,endpoint:d,press:{x:c.clientX,y:c.clientY},readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch,onSettled:()=>{l.current=null}}),l.current.start()}}}),[e,i,o,a])},Nl=[" ","Enter"],kt=4,Rl=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useCompiledSelector(c=>c.spec.annotations),l=s.useLatestRef(i),d=s.useLatestRef(a.dispatch);return(0,v.useEffect)(()=>()=>{for(const c of Dn)It({editorStore:o,annotationId:e,endpoint:c,annotations:l.current,dispatch:d.current})},[o,e,l,d]),(0,v.useCallback)(c=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=o.getState(),p=s.readDraggedArrowEndpointFor(s.readStanding(u,"arrow-endpoint-drag"),e,c);if(Nl.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(p!==null){It({editorStore:o,annotationId:e,endpoint:c,annotations:i,dispatch:a.dispatch});return}const g=Ce(i,e,c);if(g===null)return;u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:c,anchor:g,point:n[c]});return}if(p===null)return;const f=Ol(h.key,r);f!==null&&(h.preventDefault(),u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:c,...zn({anchor:p.anchor,point:p.point,delta:f})}))}}),[e,i,n,r,o,a])},It=({editorStore:e,annotationId:n,endpoint:r,annotations:a,dispatch:o})=>{const i=e.getState(),l=s.readDraggedArrowEndpointFor(s.readStanding(i,"arrow-endpoint-drag"),n,r);if(l===null)return;i.releaseInteraction("arrow-endpoint-drag");const d=Ce(a,n,r);d===null||Fn(d,l.anchor)||o(new m.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Vn(r,l.anchor)}))},Ol=(e,n)=>{const r=U(kt,n.width),a=U(kt,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},Dl=e=>{const n=de(),r=Hl(n),a=Bl(e.panelRect,n),o=Gl(n);if(r===null||a===null)return null;const i=o.dragged===null?a:at(a,o.dragged);return(0,t.jsx)(zl,{arrow:r,committed:a,painted:i,isSettled:o.dragged===null&&!o.isMoved,isMoved:o.isMoved,...e})},zl=({arrow:e,committed:n,painted:r,isSettled:a,isMoved:o,panelRect:i,frameRect:l,frameElement:d})=>{const c=s.useI18n(),h=_l({annotationId:e.id,arrow:n,panelRect:i}),u=Rl({annotationId:e.id,arrow:n,panelRect:i});return(0,t.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[a&&(0,t.jsx)(Ll,{arrow:e,arrowBox:ol(n.start,n.end,i),panelRect:i,frameWidth:l.width,frameHeight:l.height,frameElement:d}),!o&&Dn.filter(p=>e[p].anchorType==="panel").map(p=>(0,t.jsx)(Fl,{endpoint:p,point:rl(r[p],i),label:c(`graph.annotations.arrowToolbar.moveEndpoint.${p}`),dragHandlers:h(p),keyboardHandlers:u(p)},p))]})},Fl=({endpoint:e,point:n,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,t.jsx)("div",{"aria-label":r,className:kl,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:n.x,top:n.y},tabIndex:0,...a,...o}),Hl=e=>{const n=s.useCompiledSelector(r=>r.spec.annotations.arrows);return e===null?null:n.find(r=>r.id===e)??null},Bl=(e,n)=>{const r=s.useResolvedAnnotations(e).arrows;return n===null?null:r.find(a=>a.id===n)??null},Gl=e=>s.useEditorState((0,oe.useShallow)(n=>{if(e===null)return{dragged:null,isMoved:!1};const r=s.readStanding(n,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:s.readMovedAnnotationFor(s.readStanding(n,"move-drag"),e)!==null}})),Vl=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,t.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Ul="q7gcrz0",$l="q7gcrz1",ql="q7gcrz2";var Wl=["absolute-difference","relative-difference","proportion"],Et=["absolute-difference","relative-difference"],Kl=["relative-difference","proportion"],Xl={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},Zl=e=>{const{formattingLocale:n}=s.useGraphContext(),r=s.useCompiledSelector(o=>o.config.parsingLocale),a=n??r;return(0,v.useMemo)(()=>{const o=(0,m.areEndpointsComparable)(e.start,e.end);return Wl.filter(i=>o||!Et.includes(i)||i===e.label).map(i=>({kind:i,key:Xl[i],preview:(0,m.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!Et.includes(i),isSuspect:Kl.includes(i)&&e.start.measurementValue===0}))},[e,a])},De=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],Yl=({arrow:e,labelBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),c=Ie(),h=Zl(e),u=h.find(C=>C.kind===e.label),p=h.some(C=>C.isPickable&&C.kind!==e.label),f=De.find(C=>C.id===e.size)??De[0],g=(C,I)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:C}),I)},x=C=>{g(C),c.close()},b=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},T=C=>g({color:C},{transient:!0}),w=()=>g({start:e.end.anchor,end:e.start.anchor}),y=C=>()=>x({label:C}),P=C=>()=>x({size:C});return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,t.jsx)(Jl,{option:u}),isDisabled:!p,...c.bind("labelKind"),children:h.map(C=>(0,t.jsxs)(k.MenuItem,{isSelected:C.kind===e.label,isDisabled:!C.isPickable,onClick:y(C.kind),children:[(0,t.jsx)("span",{children:l(C.key)}),(C.isSuspect||!C.isPickable)&&(0,t.jsx)("span",{"aria-label":l(C.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,t.jsx)("span",{className:ql,children:C.preview})]},C.kind))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.ColorPicker,{color:e.color,label:l("graph.annotations.differenceArrowToolbar.color"),onChange:T,...c.bind("color"),children:(0,t.jsx)(k.Swatch,{color:e.color??"transparent"})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:f===void 0?"":l(f.key),...c.bind("size"),children:De.map(C=>(0,t.jsx)(k.MenuItem,{isSelected:C.id===e.size,onClick:P(C.id),children:l(C.key)},C.id))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.differenceArrowToolbar.swap"),onClick:w,children:(0,t.jsx)(Vl,{size:"sm",title:""})}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.differenceArrowToolbar.remove"),onClick:b,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},Jl=({option:e})=>{const n=s.useI18n();return e===void 0?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:$l,children:n(e.key)}),(0,t.jsxs)("span",{className:Ul,children:["(",e.preview,")"]})]})};var Ql="ydgo3h0",es="ydgo3h1",ts="ydgo3h2",ns=({clientPoint:e,panelOrigin:n,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:l,fixedAnchor:d,align:c})=>{const h=rs({x:e.x-n.x,y:e.y-n.y},r),{primary:u}=a.query((0,m.toPanelCursor)(h,r));if(u===null)return null;const p=o.find(g=>g.id===u.layerId);if(p===void 0)return null;const f=(0,m.resolveObservationPoint)({resolver:l,layer:p,observation:u.observation,coordSystem:i,align:c});return f===null||(0,m.areAnchorsEqual)(f.anchor,d)?null:f},rs=(e,n)=>({x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))}),Un=e=>e==="start"?"end":"start",$n=({dispatch:e,arrow:n,endpoint:r,anchor:a})=>{(0,m.areAnchorsEqual)(a,n[r].anchor)||e(new m.UpdateAnnotationCommand({kind:"differenceArrow",id:n.id,patch:{[r]:a}}))},os=class extends ue{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:n,readInputs:r}=this.params;return s.readDraggedDifferenceArrowEndpointFor(s.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,n)}resolvePreview(e){const{endpoint:n,readInputs:r,engine:a,anchorResolver:o}=this.params,{arrow:i,panelOrigin:l,panelRect:d,layers:c,coordSystem:h}=r(),u=ns({clientPoint:e,panelOrigin:l,panelRect:d,engine:a,layers:c,coordSystem:h,resolver:o,fixedAnchor:i[Un(n)].anchor,align:i[n].anchor.align});return u===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:n,point:u}}commit({point:e,endpoint:n}){const{dispatch:r,readInputs:a}=this.params;$n({dispatch:r,arrow:a().arrow,endpoint:n,anchor:e.anchor})}},as=({arrow:e,panelOrigin:n,panelRect:r})=>{const{commands:a,anchorResolver:o}=s.useGraphContext(),{engine:i}=s.useHoverContext(),l=s.useEditorStore(),d=s.useLatestRef({arrow:e,panelOrigin:n,panelRect:r,...s.useCompiledSelector((0,oe.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),c=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,v.useCallback)(h=>({onPointerDown:u=>{if(u.button===0&&c.current===null){try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault(),c.current=new os({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>d.current,editorStore:l,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{c.current=null}}),c.current.start()}}}),[d,l,i,o,a])},is=[" ","Enter"],ls=({arrow:e})=>{const{commands:n,anchorResolver:r}=s.useGraphContext(),a=s.useEditorStore(),{layers:o,coordSystem:i,mainAxis:l}=s.useCompiledSelector((0,oe.useShallow)(c=>({layers:c.layers,coordSystem:c.coordSystem,mainAxis:c.coordSystem.type==="cartesian"?c.coordSystem.mainAxis:"x"}))),d=e.id;return(0,v.useEffect)(()=>()=>{const c=a.getState();s.readStanding(c,"difference-arrow-endpoint-drag")?.annotationId===d&&c.releaseInteraction("difference-arrow-endpoint-drag")},[a,d]),(0,v.useCallback)(c=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),p=s.readDraggedDifferenceArrowEndpointFor(s.readStanding(u,"difference-arrow-endpoint-drag"),e.id,c);if(is.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(p===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:e[c]});u.releaseInteraction("difference-arrow-endpoint-drag"),$n({dispatch:n.dispatch,arrow:e,endpoint:c,anchor:p.point.anchor});return}if(p===null)return;const f=ss(h.key,l);if(f===null)return;h.preventDefault();const g=cs({arrow:e,endpoint:c,from:p.point.anchor,move:f,layers:o,coordSystem:i,resolver:r});g!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:g})}}),[e,a,n,r,o,i,l])},ss=(e,n)=>{const r=e==="ArrowUp"||e==="ArrowDown";return!r&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:n==="x"===r?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},cs=({arrow:e,endpoint:n,from:r,move:a,layers:o,coordSystem:i,resolver:l})=>{const d=o.find(h=>h.id===r.layerId);if(d===void 0)return null;const c=(0,m.stepDifferenceArrowEndpoint)({layer:d,from:r,partner:e[Un(n)].anchor,axis:a.axis,step:a.step,canLandOn:h=>(0,m.resolveObservationPoint)({resolver:l,layer:d,observation:h,coordSystem:i,align:e[n].anchor.align})!==null});return c===null?null:(0,m.resolveObservationPoint)({resolver:l,layer:d,observation:c.observation,coordSystem:i,align:e[n].anchor.align})},ds=e=>{const n=de();return n===null?null:(0,t.jsx)(us,{annotationId:n,...e})},us=({annotationId:e,...n})=>{const r=s.useDifferenceArrowGeometries(),a=(0,v.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,t.jsx)(hs,{committedArrow:a.committedArrow,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...n})},hs=({committedArrow:e,committedLabelBox:n,labelBox:r,start:a,end:o,panelRect:i,panelOrigin:l,frameRect:d,frameElement:c,isDragged:h})=>{const u=as({arrow:e,panelOrigin:l,panelRect:i}),p=ls({arrow:e});return(0,t.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!h&&(0,t.jsx)(Yl,{arrow:e,labelBox:n,panelRect:i,frameWidth:d.width,frameHeight:d.height,frameElement:c}),(0,t.jsx)("div",{"aria-hidden":"true",className:ts,"data-testid":"difference-arrow-selection-label",style:{left:i.x+r.x-2,top:i.y+r.y-2,width:r.width+4,height:r.height+4}}),(0,t.jsx)(Mt,{endpoint:"start",point:a,panelRect:i,dragHandlers:u("start"),keyboardHandlers:p("start")}),(0,t.jsx)(Mt,{endpoint:"end",point:o,panelRect:i,dragHandlers:u("end"),keyboardHandlers:p("end")})]})},Mt=({endpoint:e,point:n,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,t.jsx)("div",{className:Ql,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+n.x,top:r.y+n.y},tabIndex:0,...a,...o,children:(0,t.jsx)("span",{"aria-hidden":"true",className:es})}),qe=({start:e,extent:n,isStartMoving:r,delta:a,minExtent:o})=>{if(!Number.isFinite(a))return{start:e,extent:n};const i=e+n,l=Math.min(o,n);if(r){const h=Math.min(0,e),u=Math.min(Math.max(1,e),i-l),p=(0,re.default)(e+a,h,u);return{start:p,extent:i-p}}const d=Math.max(Math.min(0,i),e+l),c=Math.max(1,i);return{start:e,extent:(0,re.default)(i+a,d,c)-e}},ps=["top-left","top-right","bottom-right","bottom-left"];var qn=({width:e,height:n})=>({x:U(16,e),y:U(16,n)}),ms=(e,n)=>({x:Xn(n)?e.x:e.x+e.width,y:Zn(n)?e.y:e.y+e.height}),it=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Wn=({region:e,corner:n,delta:r,minSize:a})=>{const o=qe({start:e.x,extent:e.width,isStartMoving:Xn(n),delta:r.x,minExtent:a.x}),i=qe({start:e.y,extent:e.height,isStartMoving:Zn(n),delta:r.y,minExtent:a.y});return{anchorType:"panel",x:o.start,y:i.start,width:o.extent,height:i.extent}},Kn=(e,n)=>e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height,Xn=e=>e==="top-left"||e==="bottom-left",Zn=e=>e==="top-left"||e==="top-right",Yn=(e,n,r,a)=>{const o=e.textAnnotations.find(i=>i.id===n);return o===void 0?null:s.measureTextAnnotationBox(s.previewResizedText(o,r),a)};var gs={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},xs={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},fs=({panelRect:e})=>{const n=s.useResolvedAnnotations(e),r=s.useMeasuredBoxes(),a=de(),o=s.useEditorState(x=>s.readStanding(x,"move-drag")),i=s.useEditorState(x=>s.readStanding(x,"shape-resize-drag")),l=s.useEditorState(x=>s.readStanding(x,"arrow-endpoint-drag")),d=s.useEditorState(x=>s.readStanding(x,"text-resize-drag")),c=s.useEditorState(x=>{const b=x.editTargetUnderPointer;return b?.kind==="annotation"?b.id:null}),h=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r}),[e.width,e.height,r]),u=_t(n,a,h),p=_t(n,c===a?null:c,h),f=x=>{if(i?.annotationId===x.id){const b=n.shapes.find(T=>T.id===x.id);return b===void 0?x.geometry:s.measureShapeRegion(it(i.region),b.strokeWidth,h.panel)}if(l?.annotationId===x.id){const b=n.arrows.find(T=>T.id===x.id);return b===void 0?x.geometry:s.measureArrowEnds(at(b,l),h.panel)??x.geometry}return d?.annotationId===x.id?Yn(n,x.id,d,h)??x.geometry:x.geometry},g=x=>{if(o?.annotationId!==x)return e;const b=Gn(o.translation,e);return{x:e.x+b.x,y:e.y+b.y}};return(0,t.jsxs)(t.Fragment,{children:[p!==null&&(0,t.jsx)(Nt,{annotationId:p.id,geometry:f(p),state:"hovered",origin:g(p.id)}),u!==null&&(0,t.jsx)(Nt,{annotationId:u.id,geometry:f(u),state:"selected",origin:g(u.id)})]})},_t=(e,n,r)=>{if(n===null)return null;const a=s.resolveAnnotationChromeGeometry(e,n,r);return a===null?null:{id:n,geometry:a}},Nt=({annotationId:e,geometry:n,state:r,origin:a})=>n.shape==="segment"?(0,t.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,children:[(0,t.jsx)(Rt,{point:n.start,state:r,origin:a}),(0,t.jsx)(Rt,{point:n.end,state:r,origin:a})]}):(0,t.jsx)("div",{"aria-hidden":"true",className:gs[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:a.x+n.rect.x-2,top:a.y+n.rect.y-2,width:n.rect.width+4,height:n.rect.height+4}}),Rt=({point:e,state:n,origin:r})=>(0,t.jsx)("span",{className:xs[n],style:{left:r.x+e.x,top:r.y+e.y}}),vs=({panelRect:e})=>{const n=s.useEditorState(o=>s.readStanding(o,"move-drag")),r=s.useResolvedAnnotations(e);if(n===null)return null;const a=Gn(n.translation,e);return(0,t.jsx)("svg",{"aria-hidden":"true",className:ot,width:e.width,height:e.height,style:{left:e.x+a.x,top:e.y+a.y},"data-testid":"annotation-preview","data-annotation-id":n.annotationId,children:Ss(r,n.annotationId,e)})},bs=({annotation:e})=>(0,t.jsx)(s.TextAnnotation,{annotation:e,blockRef:s.useMeasuredBoxRef(e.id)}),me=(e,n,r)=>{const a=e.find(o=>o.id===n);return a===void 0?null:r(a)},Cs={text:(e,n)=>me(e.textAnnotations,n,r=>(0,t.jsx)(bs,{annotation:r})),shape:(e,n)=>me(e.shapes,n,r=>(0,t.jsx)(s.ShapeAnnotation,{shape:r})),image:(e,n)=>me(e.images,n,r=>(0,t.jsx)(s.ImageAnnotation,{image:r})),arrow:(e,n,r)=>me(e.arrows,n,a=>{const o=(0,m.computeArrow)({arrow:a,panelWidth:r.width,panelHeight:r.height});return o===null?null:(0,t.jsx)(s.ArrowAnnotation,{computed:o,isAddressable:!1})})},Ss=(e,n,r)=>{for(const a of Object.values(Cs)){const o=a(e,n,r);if(o!==null)return o}return null},ys=({panelRect:e})=>{const n=s.useEditorState(o=>s.readStanding(o,"shape-resize-drag")),r=s.useResolvedAnnotations(e).shapes;if(n===null)return null;const a=r.find(o=>o.id===n.annotationId);return a===void 0?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ot,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"shape-resize-preview","data-annotation-id":n.annotationId,children:(0,t.jsx)(s.ShapeAnnotation,{shape:{...a,region:it(n.region)}})})},js={sm:"o49ib40",md:"o49ib41"},Ts={horizontal:"o49ib42",diagonalDown:"o49ib43",diagonalUp:"o49ib44"},Jn=({point:e,label:n,pull:r,size:a,attributes:o,dragHandlers:i,keyboardHandlers:l})=>(0,t.jsx)("div",{"aria-label":n,className:Ts[r],role:"button",style:{left:e.x,top:e.y},tabIndex:0,...o,...i,...l,children:(0,t.jsx)("span",{"aria-hidden":"true",className:js[a]})}),We=[{width:0,key:"graph.annotations.shapeToolbar.border.none"},{width:2,key:"graph.annotations.shapeToolbar.border.thin"},{width:8,key:"graph.annotations.shapeToolbar.border.medium"},{width:16,key:"graph.annotations.shapeToolbar.border.thick"}],ws=e=>[...We].reverse().find(n=>n.width<=e)??We[0],As=({shape:e,shapeBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=Ie(),u=e.fillColor??c.defaultAnnotationShapeFill,p=ws(e.strokeWidth),f=(w,y)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"shape",id:e.id,patch:w}),y)},g=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},x=w=>f({fillColor:w,strokeColor:null},{transient:!0}),b=w=>f({fillOpacity:w},{transient:!0}),T=w=>()=>{f({strokeWidth:w}),h.close()};return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,t.jsx)(k.ColorPicker,{color:u,label:l("graph.annotations.shapeToolbar.color"),onChange:x,opacity:e.fillOpacity,onOpacityChange:b,...h.bind("color"),children:(0,t.jsx)(k.Swatch,{color:u,opacity:e.fillOpacity})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,t.jsx)(Bn,{size:"sm",title:""}),...h.bind("border"),children:We.map(w=>(0,t.jsx)(k.MenuItem,{isSelected:w.width===p?.width,onClick:T(w.width),children:l(w.key)},w.width))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.shapeToolbar.remove"),onClick:g,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},Qn=e=>{const n=s.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(a=>({onPointerDown:o=>{if(o.button!==0||r.current!==null)return;try{o.currentTarget.setPointerCapture(o.pointerId)}catch{return}o.currentTarget.focus({preventScroll:!0}),o.preventDefault();const i=n.current(a,{handle:o.currentTarget,pointerId:o.pointerId,press:{x:o.clientX,y:o.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[n])},Se=(e,n)=>{const r=e.shapes.find(a=>a.id===n);return r===void 0||r.region.anchorType!=="panel"?null:r.region},Ps=class extends ue{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return s.readResizedShapeFor(s.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,corner:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:l}=o(),d=Se(i,n);return d===null?null:{kind:"shape-resize-drag",annotationId:n,region:Wn({region:d,corner:r,delta:Ee(a,e,l),minSize:qn(l)})}}commit({region:e}){const{annotationId:n,dispatch:r,readInputs:a}=this.params,o=Se(a().annotations,n);o===null||Kn(o,e)||r(new m.UpdateAnnotationCommand({kind:"shape",id:n,patch:{region:e}}))}},Ls=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useLatestRef({annotations:s.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return Qn((i,l)=>new Ps({...l,annotationId:e,corner:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},ks=[" ","Enter"],er=e=>{const n=s.useEditorStore(),r=s.useLatestRef(e);return(0,v.useEffect)(()=>()=>Ot(n,r.current),[n,r]),(0,v.useCallback)(a=>({onKeyDown:o=>{if(o.altKey||o.ctrlKey||o.metaKey||o.shiftKey)return;const i=n.getState(),l=r.current.readHeld();if(ks.includes(o.key)){if(o.preventDefault(),o.repeat)return;if(l!==null){Ot(n,r.current);return}const c=r.current.claim(a);if(c===null)return;i.claimInteraction(c);return}if(l===null)return;const d=r.current.step(l,a,o.key);d!==null&&(o.preventDefault(),i.claimInteraction(d))}}),[n,r])},Ot=(e,n)=>{const r=n.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),n.commit(r))},Dt=4,Is=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useCompiledSelector(i=>i.spec.annotations);return er({readHeld:()=>s.readResizedShapeFor(s.readStanding(a.getState(),"shape-resize-drag"),e),claim:()=>{const i=Se(o,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,l,d)=>{const c=Es(d,n);return c===null?null:{kind:"shape-resize-drag",annotationId:e,region:Wn({region:i.region,corner:l,delta:c,minSize:qn(n)})}},commit:({region:i})=>{const l=Se(o,e);l===null||Kn(l,i)||r.dispatch(new m.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},Es=(e,n)=>{const r=U(Dt,n.width),a=U(Dt,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},Ms={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},_s=e=>{const n=de(),r=Rs(n),a=Os(n);if(r===null)return null;const o=a.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return o===null?null:(0,t.jsx)(Ns,{shape:r,region:o,isSettled:a.resizedRegion===null&&!a.isMoved,isMoved:a.isMoved,...e})},Ns=({shape:e,region:n,isSettled:r,isMoved:a,panelRect:o,frameRect:i,frameElement:l})=>{const d=s.useI18n(),c=Ls({annotationId:e.id,panelRect:o}),h=Is({annotationId:e.id,panelRect:o}),{rect:u}=s.measureShapeRegion(it(n),e.strokeWidth,o);return(0,t.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(As,{shape:e,shapeBox:u,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:l}),!a&&ps.map(p=>{const f=ms(u,p);return(0,t.jsx)(Jn,{point:{x:o.x+f.x,y:o.y+f.y},label:d(`graph.annotations.shapeToolbar.resize.${p}`),pull:Ms[p],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":p},dragHandlers:c(p),keyboardHandlers:h(p)},p)})]})},Rs=e=>{const n=s.useCompiledSelector(r=>r.spec.annotations.shapes);return e===null?null:n.find(r=>r.id===e)??null},Os=e=>s.useEditorState((0,oe.useShallow)(n=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:s.readResizedShapeFor(s.readStanding(n,"shape-resize-drag"),e)?.region??null,isMoved:s.readMovedAnnotationFor(s.readStanding(n,"move-drag"),e)!==null})),Ds=({textColor:e,...n})=>(0,t.jsxs)(s.Icon,{...n,children:[(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,t.jsx)("path",{d:"M6 4h12"}),(0,t.jsx)("path",{d:"M12 4v12"})]}),(0,t.jsx)("path",{d:"M5 20h14",stroke:e??"currentColor",strokeWidth:3,strokeLinecap:"round"})]});var ye="textStyle",tr=new Set(["paragraph","heading"]),zs=e=>{const n=nr(e),r=Us(e);return{color:ge(n.map(a=>$s(ze(a)?.color))),font:ge(n.map(a=>Vs(ze(a)))),fontSize:ge(n.map(a=>qs(ze(a)?.fontSize))),alignment:ge(r.map(a=>Ws(a.attrs?.textAlign)))}},Fs=(e,n)=>lt(e,r=>r.type==="text"?Gs(r,n):r),Hs=e=>nr(e).length>0,Bs=(e,n)=>lt(e,r=>tr.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:n}}:r),lt=(e,n)=>n(e.content===void 0?e:{...e,content:e.content.map(r=>lt(r,n))}),Gs=(e,n)=>{const r=e.marks??[],a=r.find(i=>i.type===ye),o={type:ye,attrs:{...a?.attrs,...n}};return{...e,marks:a===void 0?[...r,o]:r.map(i=>i===a?o:i)}},ze=e=>e.marks?.find(n=>n.type===ye)?.attrs,Vs=e=>s.readRichTextFontId(e?.font)??s.readRichTextFontId(e?.fontFamily),nr=e=>st(e,n=>n.type==="text"),Us=e=>st(e,n=>tr.has(n.type??"")),st=(e,n)=>[...n(e)?[e]:[],...(e.content??[]).flatMap(r=>st(r,n))],ge=e=>{const[n,...r]=e;return n===void 0?null:r.every(a=>a===n)?n:null},$s=e=>typeof e=="string"&&e.length>0?e:void 0,qs=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ws=e=>e==="left"||e==="center"||e==="right"?e:void 0;var rr=[{id:"modern",key:"graph.annotations.textToolbar.font.modern"},{id:"fresh",key:"graph.annotations.textToolbar.font.fresh"},{id:"timeless",key:"graph.annotations.textToolbar.font.timeless"},{id:"technical",key:"graph.annotations.textToolbar.font.technical"},{id:"fineliner",key:"graph.annotations.textToolbar.font.fineliner"}].map(({id:e,key:n})=>({id:e,key:n,fontFamily:s.RICH_TEXT_FONT_FAMILIES[e]??e})),Ks=e=>rr.find(n=>n.id===(e??"modern"))??null;var or=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:16,key:"graph.annotations.textToolbar.fontSize.medium"},{size:20,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:32,key:"graph.annotations.textToolbar.fontSize.huge"}],Xs=e=>or.find(n=>n.size===(e??16))??null,Zs=e=>`${e/10}em`,Ys=[{alignment:"left",Icon:jn},{alignment:"center",Icon:Sn},{alignment:"right",Icon:yn}],Js=({annotation:e,textBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=s.useEditorStore(),u=Ie(),p=zs(e.content),f=Ks(p.font),g=Xs(p.fontSize),x=p.color??c.textPrimary,b=(L,E)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"text",id:e.id,patch:L}),E)},T=()=>h.getState().caret?.editor?.getJSON()??e.content,w=(L,E)=>{const A=T(),O=h.getState().caret?.editor??null;if(O!==null&&!Hs(A)){O.chain().focus().setMark(ye,L).run();return}b({content:Fs(A,L)},E)},y=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},P=L=>b(Qs(L),{transient:!0}),C=L=>w({color:L},{transient:!0}),I=L=>()=>{w({font:L}),u.close()},D=L=>()=>{w({fontSize:L}),u.close()},R=L=>b({content:Bs(T(),L)});return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,t.jsx)(k.ColorPicker,{color:e.backgroundColor??"transparent",label:l("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:P,...u.bind("background"),children:(0,t.jsx)(k.Swatch,{color:e.backgroundColor??"linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))"})}),(0,t.jsx)(k.ColorPicker,{color:x,label:l("graph.annotations.textToolbar.color"),onChange:C,...u.bind("color"),children:(0,t.jsx)(Ds,{size:"sm",textColor:x,title:""})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,t.jsx)("span",{style:{fontFamily:f?.fontFamily},children:"Aa"}),...u.bind("font"),children:rr.map(L=>(0,t.jsx)(k.MenuItem,{isSelected:L.id===f?.id,onClick:I(L.id),children:(0,t.jsx)("span",{style:{fontFamily:L.fontFamily},children:l(L.key)})},L.id))}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:g===null?"":l(g.key),...u.bind("fontSize"),children:or.map(L=>(0,t.jsx)(k.MenuItem,{isSelected:L.size===g?.size,onClick:D(L.size),children:(0,t.jsx)("span",{style:{fontSize:Zs(L.size)},children:l(L.key)})},L.size))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(ec,{current:p.alignment??"center",onPick:R}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.textToolbar.remove"),onClick:y,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},Qs=e=>e==="transparent"?{backgroundColor:null}:{backgroundColor:e,backgroundColorStyle:ea(e)?"fade":"opaque"},ec=({current:e,onPick:n})=>{const r=s.useI18n(),a=o=>()=>n(o);return(0,t.jsx)(t.Fragment,{children:Ys.map(o=>(0,t.jsx)(k.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${o.alignment}`),isPressed:o.alignment===e,onClick:a(o.alignment),children:(0,t.jsx)(o.Icon,{size:"sm",title:""})},o.alignment))})},tc=["left","right"];var ar=({width:e})=>U(60,e),nc=(e,n)=>({x:n==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),ir=({at:e,width:n,align:r,edge:a,delta:o,minWidth:i,panelWidth:l})=>{if(o===0)return{at:e,width:n,shift:0};const d=(0,m.alignUnitFractions)(r).x,c=rc(e.offset,l),h=qe({start:e.x+c-d*n,extent:n,isStartMoving:a==="left",delta:o,minExtent:i}),u=h.start+d*h.extent-c;return{at:{...e,x:u},width:h.extent,shift:u-e.x}},lr=(e,n)=>e.at.x===n.at.x&&e.width===n.width,rc=(e,n)=>e?.x===void 0?0:e.unit==="px"?U(e.x,n):e.x,je=(e,n)=>{const r=e.textAnnotations.find(a=>a.id===n);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},oc=class extends ue{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return s.readResizedTextFor(s.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,edge:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:l}=o(),d=je(i,n);if(d===null)return null;const c=Ee(a,e,l).x;return{kind:"text-resize-drag",annotationId:n,delta:c,...ir({...d,edge:r,delta:c,minWidth:ar(l),panelWidth:l.width})}}commit(e){const{annotationId:n,dispatch:r,readInputs:a}=this.params,o=je(a().annotations,n);o===null||lr(o,e)||r(new m.UpdateAnnotationCommand({kind:"text",id:n,patch:{at:e.at,width:e.width}}))}},ac=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useLatestRef({annotations:s.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return Qn((i,l)=>new oc({...l,annotationId:e,edge:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},ic=4,lc=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useCompiledSelector(l=>l.spec.annotations),i=(l,d)=>{const c=je(o,e);return c===null?null:{kind:"text-resize-drag",annotationId:e,delta:d,...ir({...c,edge:l,delta:d,minWidth:ar(n),panelWidth:n.width})}};return er({readHeld:()=>s.readResizedTextFor(s.readStanding(a.getState(),"text-resize-drag"),e),claim:l=>i(l,0),step:(l,d,c)=>{const h=sc(c,n);return h===null?null:i(d,l.delta+h)},commit:l=>{const d=je(o,e);d===null||lr(d,l)||r.dispatch(new m.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:l.at,width:l.width}}))}})},sc=(e,n)=>{const r=U(ic,n.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},cc=e=>{const n=de(),r=uc(n),a=hc(n),o=s.useEditorState(l=>l.caret?.annotationId===n),i=pc(e.panelRect,n,a.resized);return r===null||i===null?null:(0,t.jsx)(dc,{annotation:r,textBox:i,isSettled:a.resized===null&&!a.isMoved,isMoved:a.isMoved,isResizable:r.at.anchorType==="panel",hasCaret:o,...e})},dc=({annotation:e,textBox:n,isSettled:r,isMoved:a,isResizable:o,hasCaret:i,panelRect:l,frameRect:d,frameElement:c})=>{const h=s.useI18n(),u=ac({annotationId:e.id,panelRect:l}),p=lc({annotationId:e.id,panelRect:l});return(0,t.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(Js,{annotation:e,textBox:n,panelRect:l,frameWidth:d.width,frameHeight:d.height,frameElement:c}),o&&!a&&!i&&tc.map(f=>{const g=nc(n,f);return(0,t.jsx)(Jn,{point:{x:l.x+g.x,y:l.y+g.y},label:h(`graph.annotations.textToolbar.resize.${f}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":f},dragHandlers:u(f),keyboardHandlers:p(f)},f)})]})},uc=e=>{const n=s.useCompiledSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:n.find(r=>r.id===e)??null},hc=e=>s.useEditorState((0,oe.useShallow)(n=>e===null?{resized:null,isMoved:!1}:{resized:s.readResizedTextFor(s.readStanding(n,"text-resize-drag"),e),isMoved:s.readMovedAnnotationFor(s.readStanding(n,"move-drag"),e)!==null})),pc=(e,n,r)=>{const a=s.useResolvedAnnotations(e),o=s.useMeasuredBoxes(),i=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:o}),[e.width,e.height,o]);return n===null?null:Yn(a,n,r,i)?.rect??null},mc=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M12 5v14"}),(0,t.jsx)("path",{d:"M5 12h14"})]})}),gc="var(--_1tyillx0)",xc={rest:.5,hovered:.75,open:1};var fc="_1tyillx1",vc={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},bc="_1tyillx5",Cc={closed:"_1tyillx6",open:"_1tyillx7"},Sc=({interaction:e,panelRect:n})=>{const r=s.useEditorStore(),a=s.useCompiledSelector(d=>d.coordSystem),o=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,i=yc(e),l=(0,v.useMemo)(()=>{if(o===null)return null;const d=(0,m.projectAnchorToPanel)(o.position,n,a);return{center:d,radius:19*xc[i],target:{kind:"observation",cursor:(0,m.toPanelCursor)(d,n)}}},[o,n,a,i]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(l)},[r,l]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),o===null||l===null?null:(0,t.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,V.default)(fc,vc[i]),style:{left:n.x+l.center.x,top:n.y+l.center.y,...(0,tn.assignInlineVars)({[gc]:o.color??G.vars.border50})},children:(0,t.jsx)("span",{className:(0,V.default)(bc,Cc[i==="open"?"open":"closed"]),children:(0,t.jsx)(mc,{size:"lg"})})})},yc=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",jc='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Tc=(e,n)=>{const{chartId:r}=s.useGraphContext(),a=s.useEditorStore();(0,v.useEffect)(()=>{if(n===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!se(i.target,e,r)||a.getState().standingInteraction?.kind==="chrome-popup")return;const l=[...n.querySelectorAll(jc)];if(l.length===0)return;i.preventDefault();const d=l.findIndex(c=>c===document.activeElement);l[d===-1?i.shiftKey?l.length-1:0:(d+(i.shiftKey?-1:1)+l.length)%l.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,n,r,a])},wc=`[${s.EDIT_TARGET_KIND_ATTRIBUTE}]`,Te=(e,n,r)=>{if(typeof document.elementsFromPoint!="function")return null;const a=document.elementsFromPoint(e,n);return Ac(a,r)},Ac=(e,n)=>{for(const r of e){const a=r.closest(wc);if(a===null||!n.contains(a))continue;const o=Pc(a);if(o!==null)return o;if(a!==r)return null}return null},Pc=e=>{const n=e.getAttribute(s.EDIT_TARGET_KIND_ATTRIBUTE);if(n!=="annotation")return null;const r=e.getAttribute(s.EDIT_TARGET_ID_ATTRIBUTE);return r===null||r===""?null:{kind:n,id:r}},Lc=e=>{const{selectionStore:n,chartId:r}=s.useGraphContext(),a=s.useEditorStore();(0,v.useEffect)(()=>{let o=null;const i=c=>{const{caret:h}=a.getState(),u=h===null?null:Te(c.clientX,c.clientY,e);u!==null&&u.id===h?.annotationId||e.focus({preventScroll:!0})},l=c=>{const{selection:h,clearSelection:u}=n.getState();h.length!==0&&(se(c.target,e,r)||u())},d=c=>{n.getState().selection.length!==0&&se(c.target,e,r)&&c.relatedTarget===null&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{o=null,document.hasFocus()&&(se(document.activeElement,e,r)||n.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",l),document.addEventListener("focusout",d),()=>{o!==null&&cancelAnimationFrame(o),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",l),document.removeEventListener("focusout",d)}},[a,n,e,r])},kc=class extends ue{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return s.readMovedAnnotationFor(s.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,press:r,readInputs:a}=this.params,{annotations:o,panelRect:i}=a(),l=(0,m.findAnnotation)(o,n);if(l===null)return null;const d=(0,m.clampAnnotationTranslation)(l,Ee(r,e,i));return d===null?null:{kind:"move-drag",annotationId:n,translation:d}}commit({translation:e}){const{annotationId:n,dispatch:r}=this.params;Il(e)&&r(new m.MoveAnnotationCommand({id:n,translation:e}))}},Ic=(e,n,r)=>{const{commands:a,selectionStore:o}=s.useGraphContext(),i=s.useEditorStore(),l=s.useLatestRef({annotations:s.useCompiledSelector(h=>h.spec.annotations),panelRect:r}),d=s.useLatestRef(n),c=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,v.useEffect)(()=>{const h=g=>{const{editTargetUnderPointer:x,standingInteraction:b}=i.getState();return x!==null&&b===null&&g.pointerType==="mouse"&&Ec(g.target,e)?x:Te(g.clientX,g.clientY,e)},u=(g,x)=>{if(c.current!==null||!s.canMoveAnnotationOnCanvas(l.current.annotations,x.id))return;try{e.setPointerCapture(g.pointerId)}catch{return}g.preventDefault();const b=new kc({handle:e,pointerId:g.pointerId,annotationId:x.id,press:{x:g.clientX,y:g.clientY},readInputs:()=>l.current,editorStore:i,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=b,b.start()},p=g=>{if(g.button!==0||Ue(g.target)||An(g,d.current,i.getState().menuTrigger))return;const x=h(g),b=o.getState(),{caret:T,setCaret:w}=i.getState();if(!(T!==null&&x?.id===T.annotationId)){if(w(null),x===null){b.clearSelection();return}b.setSelection([x]),u(g,x)}},f=g=>{if(Ue(g.target))return;const x=Te(g.clientX,g.clientY,e);x!==null&&l.current.annotations.textAnnotations.some(b=>b.id===x.id)&&(o.getState().setSelection([x]),i.getState().setCaret(x.id))};return document.addEventListener("pointerdown",p),document.addEventListener("dblclick",f),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("dblclick",f)}},[e,i,o,a,l,d])},Ec=(e,n)=>e instanceof Node&&n.contains(e),Mc=e=>{const{selectionStore:n,commands:r,chartId:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useLatestRef(s.useCompiledSelector(h=>h.spec.annotations.textAnnotations)),l=(0,v.useCallback)(h=>{const{selection:u}=n.getState(),p=$e(u);p!==null&&(h.preventDefault(),r.dispatch(new m.RemoveAnnotationCommand({id:p})),e.focus({preventScroll:!0}))},[e,r,n]),d=(0,v.useCallback)(h=>{if(xe(h.target,a))return;const u=$e(n.getState().selection);u!==null&&i.current.some(p=>p.id===u)&&(h.preventDefault(),o.getState().setCaret(u))},[o,n,i,a]),c=(0,v.useCallback)(h=>{const u=o.getState(),p=u.standingInteraction?.kind;if(p!==void 0){p!=="chrome-popup"&&u.releaseInteraction(p);return}if(u.caret!==null){u.setCaret(null),e.focus({preventScroll:!0});return}return xe(h.target,a)?e.focus({preventScroll:!0}):n.getState().clearSelection()},[o,n,e,a]);(0,v.useEffect)(()=>{const h=u=>{if(!se(u.target,e,a)||hi(u.target))return;const p=_c(u.target),f=o.getState().caret!==null&&!xe(u.target,a);if(!(p&&!f))switch(u.key){case"Escape":return c(u);case"Enter":return p?void 0:d(u);case"Delete":case"Backspace":return p?void 0:l(u);default:return}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,l,d,c,a,o])},_c=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Nc=()=>{const e=s.useHoverState(o=>o.hover.primary),{layers:n,coordSystem:r}=s.useCompiledSelector((0,oe.useShallow)(o=>({layers:o.layers,coordSystem:o.coordSystem}))),{anchorResolver:a}=s.useGraphContext();return(0,v.useMemo)(()=>{if(e===null)return null;const o=n.find(d=>d.id===e.layerId);if(o===void 0)return null;const i=a.resolve(o.geom,e.observation,{coordSystem:r,position:o.position,purpose:"pin"});if(i===null)return null;const l=(0,m.buildObservationAnchor)(o,e.observation);return l===null?null:{position:i,color:(0,m.getColor)(e.observation),layer:o,at:l,observation:e.observation}},[e,n,r,a])},Rc={kind:"idle"},sr=()=>{const e=s.useEditorState(a=>a.standingInteraction),n=s.useEditorState(a=>a.chromeUnderPointer),r=Nc();return(0,v.useMemo)(()=>e!==null?e:r===null?Rc:{kind:"trigger",anchor:r,isEngaged:n==="menu-trigger"},[e,r,n])},Oc=(e,n,r)=>{const a=s.useEditorStore(),{selectionStore:o}=s.useGraphContext(),{store:i,engine:l}=s.useHoverContext(),d=s.useLatestRef(e),c=s.useLatestRef(n),h=s.useLatestRef(r);(0,v.useEffect)(()=>{const u=b=>An(b,c.current,a.getState().menuTrigger),p=b=>{if(u(b)||o.getState().selection.length>0)return;const T=h.current,w=c.current,y={x:b.clientX-w.x,y:b.clientY-w.y},P=Dc(y,T)?l.query((0,m.toPanelCursor)(y,T)):m.RESTING_HOVER_STATE;i.getState().setHoverState(P)};let f=!1;const g=()=>{f=d.current.kind==="menu"},x=b=>{if(Ue(b.target))return;const{claimInteraction:T,releaseInteraction:w}=a.getState();if(!u(b)||f){w("menu"),f&&p(b);return}const y=d.current;y.kind==="trigger"&&T({kind:"menu",anchor:y.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",x),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",x)}},[a,o,d,i,l,c,h])},Dc=(e,n)=>e.x>=0&&e.x<=n.width&&e.y>=0&&e.y<=n.height,zc=(e,n)=>{const r=s.useEditorStore(),a=s.useLatestRef(n);(0,v.useEffect)(()=>{let o=null,i=null;const l=g=>{const{menuTrigger:x}=r.getState();return x===null?null:(0,m.isPointWithinEditMenuTrigger)(g,x)?"menu-trigger":null},d=()=>{o=null;const g=i;if(g===null)return;const x=a.current,b=r.getState();if(b.setChromeUnderPointer(l({x:g.x-x.x,y:g.y-x.y})),Fe(b.standingInteraction))return;const T=Te(g.x,g.y,e);b.setEditTargetUnderPointer(T)},c=()=>{o===null&&(o=requestAnimationFrame(d))},h=()=>{const g=r.getState();g.setChromeUnderPointer(null),g.setEditTargetUnderPointer(null)},u=g=>{i={x:g.clientX,y:g.clientY},c()},p=()=>{i=null,o!==null&&(cancelAnimationFrame(o),o=null),h()},f=r.subscribe((g,x)=>{!Fe(x.standingInteraction)||Fe(g.standingInteraction)||i!==null&&c()});return e.addEventListener("pointermove",u),e.addEventListener("pointerleave",p),()=>{o!==null&&cancelAnimationFrame(o),f(),e.removeEventListener("pointermove",u),e.removeEventListener("pointerleave",p),h()}},[e,r,a])},Fe=e=>{if(e===null)return!1;switch(e.kind){case"menu":case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":case"text-resize-drag":return!0;case"chrome-popup":return!1}},zt="editor",Ft=[],Fc=(e,n,r,a)=>{const o=sr(),{store:i}=s.useHoverContext(),l=s.useGraphSelection().length>0,d=s.useEditorState(u=>u.menuTrigger),c=o.kind==="menu",h=(0,v.useMemo)(()=>d===null?Ft:[(0,m.buildEditMenuTriggerRegion)(d)],[d]);zc(e,n),Ic(e,n,r),Oc(o,n,r),Lc(e),Mc(e),Tc(e,a),(0,v.useEffect)(()=>(i.getState().publishPointerRegions(zt,h),()=>i.getState().publishPointerRegions(zt,Ft)),[i,h]),(0,v.useEffect)(()=>(i.getState().setPointerSuspended(c||l),()=>i.getState().setPointerSuspended(!1)),[i,c,l]),(0,v.useEffect)(()=>{if(!l)return;const u=i.getState();u.setHoverState(m.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[i,l])},Hc=({frameElement:e,panelRect:n})=>{const{measureRef:r,screenRect:a}=s.useElementScreenRect(),o=s.useEditorStore(),i=s.useEditorState(l=>l.caret?.annotationId??null);return(0,v.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,v.useEffect)(()=>()=>{const l=o.getState();l.releaseInteraction("menu"),l.setCaret(null)},[o]),a===null?null:(0,t.jsxs)(mi,{children:[i!==null&&(0,t.jsx)(Bc,{annotationId:i,panelRect:n}),(0,t.jsx)(Gc,{frameElement:e,frameRect:a,panelRect:n})]})},Bc=({annotationId:e,panelRect:n})=>{const r=s.useEditorStore(),{textAnnotations:a}=s.useResolvedAnnotations(n);return(0,v.useEffect)(()=>{a.some(({id:o})=>o===e)||r.getState().setCaret(null)},[e,a,r]),null},Gc=({frameElement:e,frameRect:n,panelRect:r})=>{const a=(0,v.useMemo)(()=>({x:n.left+r.x,y:n.top+r.y}),[n.left,n.top,r.x,r.y]),[o,i]=(0,v.useState)(null);return Fc(e,a,r,o),(0,t.jsx)(Vc,{frameElement:e,frameRect:n,panelOrigin:a,panelRect:r,boxRef:i})},Vc=({frameElement:e,frameRect:n,panelOrigin:r,panelRect:a,boxRef:o})=>{const i=nt(),l=sr();return(0,t.jsx)(s.OverlayPortal,{rect:n,zIndex:s.Z_INDEX.editorOverlay,container:i,"data-testid":"editor-overlay",boxRef:o,children:(0,t.jsxs)(s.PortalThemeProvider,{children:[(0,t.jsx)(ds,{panelRect:a,panelOrigin:r,frameRect:n,frameElement:e}),(0,t.jsx)(_s,{panelRect:a,frameRect:n,frameElement:e}),(0,t.jsx)(Dl,{panelRect:a,frameRect:n,frameElement:e}),(0,t.jsx)(cc,{panelRect:a,frameRect:n,frameElement:e}),(0,t.jsx)(vs,{panelRect:a}),(0,t.jsx)(ys,{panelRect:a}),(0,t.jsx)(al,{panelRect:a}),(0,t.jsx)(fs,{panelRect:a}),(0,t.jsx)(Sc,{interaction:l,panelRect:a}),(0,t.jsx)(Ji,{interaction:l,panelOrigin:r})]})})},Uc=({slots:e,...n})=>(0,t.jsx)(ln,{locale:s.useGraphLocale(),children:(0,t.jsx)(s.EditorProvider,{children:(0,t.jsx)(s.InlineEditorsProvider,{editors:ci,children:(0,t.jsx)(s.GraphRendererBody,{slots:(0,v.useMemo)(()=>({EditorSurface:Hc,...e}),[e]),...n})})})}),cr=(0,v.createContext)(null),dr=({labelId:e,controlId:n,children:r})=>{const a=(0,v.useMemo)(()=>{let o=null;return{labelId:e,controlId:n,claimControlId:i=>(o??=i,o===i)}},[e,n]);return(0,t.jsx)(cr.Provider,{value:a,children:r})},Z=({id:e,ariaLabel:n,ariaLabelledBy:r},a=!0)=>{const o=(0,v.useContext)(cr),i=(0,v.useId)(),[l]=(0,v.useState)(()=>a?o?.claimControlId(i)??!1:!1),d=e??(l?o?.controlId:void 0),c=r??(n===void 0?o?.labelId:void 0);return{...d!==void 0&&{id:d},...n!==void 0&&{"aria-label":n},...c!==void 0&&{"aria-labelledby":c}}};var $c={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},ur=({label:e,icon:n,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:l,id:d})=>{const c=Z({id:d,ariaLabel:i,ariaLabelledBy:l}),h=a==="tile";return(0,t.jsxs)("button",{type:"button",className:$c[a],disabled:o,onClick:r,...c,children:[n!==void 0&&(0,t.jsx)("span",{className:"woi4bh0",children:n}),e!==void 0&&(0,t.jsx)("span",{className:h?"woi4bh2":"woi4bh1",children:e})]})},ct=(0,v.createContext)(null),_=()=>{const e=(0,v.useContext)(ct);if(!e)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return e},hr=({children:e,onKeyDown:n,...r})=>{const a=(0,v.useContext)(ct),o=i=>{if(n?.(i),!a||i.defaultPrevented)return;const l=s.resolveHistoryStep(i.nativeEvent);l&&(i.preventDefault(),l==="undo"?a.undo():a.redo())};return(0,t.jsx)("div",{onKeyDown:o,...r,children:e})},pr="keyboard",Me=e=>{const n=(0,v.useRef)(!1),r=(0,v.useRef)(!1),a=()=>{n.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(n.current){r.current=!0;return}e?.()},commitUnlessHeldKey:o=>{if(o){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{n.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},qc="eh8dvc0",Wc="eh8dvc1 uz3g760",Kc="eh8dvc2 uz3g761";var mr=({value:e,onChange:n,onCommit:r,min:a,max:o,step:i,placeholder:l,prefix:d,suffix:c,isDisabled:h,hasError:u,ariaLabel:p,ariaLabelledBy:f,id:g})=>{const x=Z({id:g,ariaLabel:p,ariaLabelledBy:f}),{commitUnlessHeldKey:b,gestureHandlers:T}=Me(r);return(0,t.jsx)(ft.NumberField.Root,{className:qc,value:e,onValueChange:w=>n(w),onValueCommitted:(w,y)=>{b(y.reason===pr)},min:a,max:o,step:i,disabled:h,children:(0,t.jsxs)(hr,{className:Wc,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[d!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:d}),(0,t.jsx)(ft.NumberField.Input,{className:Kc,placeholder:l,...T,"aria-invalid":u===!0?!0:void 0,...x}),c!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:c})]})})},Xc="_1b7s5f0",ee={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Zc="_1b7s5f7";var Yc=6,gr=({options:e,value:n,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:l,ariaLabel:d,ariaLabelledBy:c,id:h})=>{const u=Z({id:h,ariaLabel:d,ariaLabelledBy:c}),p=i==="swatch",{commitAfterChange:f,gestureHandlers:g}=Me(a);return(0,t.jsx)(an.RadioGroup,{className:(0,V.default)(Xc,Jc(o??e.length)),value:n,onValueChange:x=>{r(x),f()},...g,disabled:l,...u,children:e.map(x=>(0,t.jsxs)(on.Radio.Root,{value:x.value,disabled:x.isDisabled,className:(0,V.default)(Zc,p&&"_1b7s5f8"),"aria-label":p?x.label:void 0,children:[x.icon,!p&&(0,t.jsx)("span",{className:"_1b7s5f9",children:x.label})]},x.value))})},Jc=e=>{switch(Math.min(Math.max(Math.round(e),1),Yc)){case 1:return ee[1];case 2:return ee[2];case 3:return ee[3];case 4:return ee[4];case 5:return ee[5];default:return ee[6]}},Qc="_1g5x15w0 uz3g760",ed="_1g5x15w1",td="_1g5x15w2",Ht="_1g5x15w3",nd="_1g5x15w4",rd="_1g5x15w5",od="_1g5x15w6",ad="_1g5x15w7";var xr=({options:e,value:n,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=Z({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,t.jsxs)($.Select.Root,{value:n,onValueChange:u=>u!==null&&r(u),disabled:o,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,t.jsxs)($.Select.Trigger,{className:Qc,"data-error":i===!0,...h,children:[(0,t.jsx)($.Select.Value,{className:ed,children:u=>id(e,u,a)}),(0,t.jsx)($.Select.Icon,{className:Ht,children:(0,t.jsx)(ce,{size:"sm"})})]}),(0,t.jsx)($.Select.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)($.Select.Positioner,{className:nd,sideOffset:4,alignItemWithTrigger:!1,children:(0,t.jsx)($.Select.Popup,{className:rd,children:e.map(u=>(0,t.jsxs)($.Select.Item,{value:u.value,disabled:u.isDisabled,className:od,children:[u.icon,(0,t.jsxs)("span",{className:ad,children:[(0,t.jsx)($.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,t.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,t.jsx)($.Select.ItemIndicator,{className:Ht,children:(0,t.jsx)(Cn,{size:"sm"})})]},u.value))})})})})]})},id=(e,n,r)=>n===null?(0,t.jsx)("span",{className:td,children:r}):ld(e,n),ld=(e,n)=>e.find(r=>r.value===n)?.label??n,sd="vod76w0",cd="vod76w1",dd="vod76w2",ud="vod76w3",hd="vod76w4",pd="vod76w5";var fr=({value:e,onChange:n,onCommit:r,min:a,max:o,step:i,suffix:l,formatValue:d,isDisabled:c,ariaLabel:h,ariaLabelledBy:u})=>{const p=Z({ariaLabel:h,ariaLabelledBy:u},!1),f=md(e,l,d),{commitUnlessHeldKey:g,gestureHandlers:x}=Me(r);return(0,t.jsxs)("div",{className:sd,children:[(0,t.jsx)(q.Slider.Root,{className:cd,value:e,onValueChange:b=>n(b),onValueCommitted:(b,T)=>{g(T.reason===pr)},min:a,max:o,step:i,disabled:c,children:(0,t.jsx)(q.Slider.Control,{className:dd,children:(0,t.jsxs)(q.Slider.Track,{className:ud,children:[(0,t.jsx)(q.Slider.Indicator,{className:hd}),(0,t.jsx)(q.Slider.Thumb,{className:pd,...x,...p})]})})}),f!==null&&(0,t.jsx)("span",{className:"vod76w6",children:f})]})},md=(e,n,r)=>r!==void 0?r(e):n!==void 0?`${e}${n}`:null,gd="_1hyrlw60",xd="_1hyrlw61",vr=({isChecked:e,onChange:n,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const l=Z({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,t.jsx)(vt.Switch.Root,{checked:e,onCheckedChange:d=>n(d),disabled:r,className:gd,...l,children:(0,t.jsx)(vt.Switch.Thumb,{className:xd})})},fd="uz3g761",vd="tpcnun0 uz3g760",br=({value:e,onChange:n,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=Z({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,t.jsx)(hr,{className:vd,"data-error":i===!0,children:(0,t.jsx)(po.Input,{className:fd,value:e,onValueChange:u=>n(u),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...h})})},bd="cnu9yl0",Cd="cnu9yl1";var Cr=({options:e,value:n,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=Z({id:c,ariaLabel:l,ariaLabelledBy:d}),u=o==="stacked",{commitAfterChange:p,gestureHandlers:f}=Me(a);return(0,t.jsx)(an.RadioGroup,{className:bd,value:n,onValueChange:g=>{r(g),p()},...f,disabled:i,...h,children:e.map(g=>(0,t.jsxs)(on.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,V.default)(Cd,u&&"cnu9yl2"),"aria-label":Sd(g,u),children:[g.icon,Sr(g,u)&&(0,t.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Sr=(e,n)=>e.icon===void 0||n,Sd=(e,n)=>{if(!Sr(e,n))return e.label},yr={ToggleGroup:Cr,Switch:vr,Slider:fr,RadioGrid:gr,Button:ur,TextField:br,NumberField:mr,Select:xr},jr=(0,v.createContext)(yr),yd=({controls:e,children:n})=>{const r=(0,v.useMemo)(()=>({...yr,...e}),[e]);return(0,t.jsx)(jr.Provider,{value:r,children:n})},N=()=>(0,v.useContext)(jr),jd="_12lhx9e0",Tr=({children:e})=>(0,t.jsx)("div",{className:jd,children:e}),Td="_139ohwv0",H=({children:e})=>(0,t.jsx)("div",{className:Td,children:e}),wr=(0,v.createContext)(null),wd=wr.Provider,Ar=()=>{const e=(0,v.useContext)(wr);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},Ad="_1jlczkt0",Pr="data-graphy-editor-panel",Pd={List:H,Grid:Tr};function Ld(e){if(e===void 0)return!1;const n=e.split(/\s+/);return n.includes("_1ii3bsb0")||n.includes("_1ii3bsb1")}var kd=({handle:e,children:n,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=s.useGraphHandle(e),{themeClass:l,inlineVarsStyle:d}=s.useThemeContext(),[c,h]=(0,v.useState)(()=>a?[a]:[]),u=(0,v.useMemo)(()=>({expandSection:p=>h([p]),collapseAllSections:()=>h([])}),[]);return(0,t.jsx)(ct.Provider,{value:i,children:(0,t.jsx)(yd,{controls:r,children:(0,t.jsx)(wd,{value:u,children:(0,t.jsx)(le.Accordion.Root,{[Pr]:"",className:(0,V.default)(Ad,o,{[l]:!Ld(o)}),style:d,value:c,onValueChange:p=>h(p),children:n})})})})},dt={Root:kd,Controls:Pd},Bt={stack:"pr583x0",grid:"pr583x1"},Gt="pr583x2",Id={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},S=({label:e,layout:n="grid",icon:r,children:a})=>{const o=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,t.jsx)("div",{className:Bt[n],children:(0,t.jsx)("div",{className:Gt,children:a})}):(0,t.jsxs)("div",{className:Bt[n],children:[(0,t.jsxs)("label",{id:o,htmlFor:i,className:Id[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,t.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,t.jsx)("div",{className:Gt,children:(0,t.jsx)(dr,{labelId:o,controlId:i,children:a})})]})},Ed=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m9 6 6 6-6 6"})})}),ut="_40zvwv0",ht="_40zvwv1",Md="_40zvwv2",Lr="_40zvwv3",_d="_40zvwv4 _40zvwv3";var Nd="_40zvwv6";var Rd="_40zvwv8",z=({title:e,layout:n="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>n==="collapsible"?(0,t.jsx)(Dd,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):n==="inline"&&r===void 0?(0,t.jsx)(Od,{title:e,accessory:a,children:i}):(0,t.jsxs)("div",{className:ut,children:[(0,t.jsxs)("div",{className:ht,children:[(0,t.jsx)("span",{className:Lr,children:e}),r!==void 0&&(0,t.jsx)("span",{className:"_40zvwv5",children:r}),a!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,t.jsx)("div",{children:i})]}),Od=({title:e,accessory:n,children:r})=>{const a=(0,v.useId)(),o=(0,v.useId)();return(0,t.jsx)("div",{className:ut,children:(0,t.jsxs)("div",{className:ht,children:[(0,t.jsx)("label",{id:a,htmlFor:o,className:_d,children:e}),(0,t.jsx)("span",{className:Nd,children:(0,t.jsx)(dr,{labelId:a,controlId:o,children:r})}),n!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:n})]})})},Dd=({title:e,preview:n,accessory:r,onOpenChange:a,children:o})=>{const i=s.useI18n();return(0,t.jsxs)(le.Accordion.Item,{value:e,className:ut,onOpenChange:a,children:[(0,t.jsxs)(le.Accordion.Header,{className:ht,render:(0,t.jsx)("div",{}),children:[(0,t.jsx)(le.Accordion.Trigger,{className:Md,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,t.jsx)("span",{className:Lr,children:e}),n!==void 0&&(0,t.jsx)("span",{className:"_40zvwv5",children:n}),r!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:r}),(0,t.jsx)("span",{className:Rd,children:(0,t.jsx)(Ed,{size:"sm"})})]}),(0,t.jsx)(le.Accordion.Panel,{children:(0,t.jsx)("div",{children:o})})]})},kr=({title:e,isChecked:n,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:l,collapseAllSections:d}=Ar(),{Switch:c}=N(),h=p=>{r(p),p?l(e):d()},u=p=>{p&&!n&&a!==!0&&r(!0)};return(0,t.jsx)(z,{title:e,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,t.jsx)(c,{isChecked:n,onChange:h,isDisabled:a,ariaLabel:e}),children:i})},zd={horizontal:["bottom","top"],vertical:["left","right"]},Fd={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Hd={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},Ke=({axis:e,title:n,layout:r="collapsible",preview:a})=>{const o=_(),i=s.useHandleCompiled(o),l=s.useI18n(),{NumberField:d,Switch:c,TextField:h,ToggleGroup:u}=N();if(!i)return null;const p=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",f=i.config.axes[e],g=i.scales[e],x=g?.spec,b=x?.scaleType==="continuous"?x:void 0;if(p==="circular"||p==="radial"&&b===void 0)return null;const T=x!==void 0&&"reverse"in x?x:void 0,w=x?.scaleType==="continuous"||x?.scaleType==="datetime",y=e==="y"&&b!==void 0&&i.layers.some(j=>j.yScaleType==="primary"&&j.geom==="bar"),P=b?.transform==="log",C=b?.domainMax??null,I=Bd(b),D=(j,K)=>j.map(he=>({value:he,label:K(he)})),R=i.guides.axes.find(j=>j.scaleAestheticKey===e)?.position,L=zd[R==="bottom"||R==="top"||R===void 0&&e==="x"?"horizontal":"vertical"],E=e==="y"?(0,m.readComboLineLayerId)(i.spec):null,A=E===null?void 0:i.spec.layers.find(j=>j.id===E),O=i.guides.legends.drawn.some(j=>L.some(K=>K===j.position)),Y=L.map(j=>({value:j,label:l(Fd[j])})),Fr=D(["auto","edges"],j=>l(j==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),Hr=D(["linear","log"],j=>l(j==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Br=D(["auto","zero","custom"],j=>l(j==="zero"?"editor.axesPanel.startFrom.zero":j==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Gr=D(["auto","custom"],j=>l(j==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Vr=D(["no","yes"],j=>l(j==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Ur=D(["single","double"],j=>l(j==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),$r=j=>{o.commands.dispatch(new m.SetAxisVisibilityCommand({axis:e,isVisible:j}))},qr=j=>{o.commands.dispatch(new m.SetAxisLabelCommand({axis:e,label:j===""?null:j}),{transient:!0})},Wr=j=>{o.commands.dispatch(new m.SetAxisTicksVisibilityCommand({axis:e,isVisible:j}))},Kr=j=>{o.commands.dispatch(new m.SetAxisTickModeCommand({axis:e,tickMode:j==="edges"?"edges":"auto"}))},Xr=j=>{o.commands.dispatch(new m.SetScaleReverseCommand({scaledAesthetic:e,reverse:j==="yes"}))},Zr=j=>{o.commands.dispatch(new m.SetScaleTransformCommand({scaledAesthetic:e,transform:j==="log"?"log":"linear"}))},gt=j=>{o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,...j}),{transient:!0})},Yr=j=>{j!==null&&gt({domainMin:j})},Jr=j=>{j!==null&&gt({domainMax:j})},Qr=j=>{if(b){if(j==="custom"){b.zero&&o.commands.dispatch(new m.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,domainMin:Vt(g?.domain,"start")}));return}b.domainMin!==null&&o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),o.commands.dispatch(new m.SetScaleZeroCommand({scaledAesthetic:e,zero:j==="zero"}))}},eo=j=>{const K=j==="custom"?Vt(g?.domain,"end"):null;o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,domainMax:K}))},to=j=>{A!==void 0&&o.commands.dispatch(new m.SetLayerYScaleTypeCommand({layerId:A.id,yScaleType:j==="double"?"secondary":"primary"}))},no=j=>{const K=L.find(he=>he===j);K&&o.commands.dispatch(new m.SetAxisPositionCommand({axis:e,position:K}))};return(0,t.jsx)(z,{title:n??l(Hd[e]),layout:r,preview:a,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.visible"),children:(0,t.jsx)(c,{isChecked:f.isVisible,onChange:$r})}),A!==void 0&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.numberOfAxes"),children:(0,t.jsx)(u,{value:A.yScaleType==="secondary"?"double":"single",options:Ur,onChange:to})}),p==="linear"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.title"),children:(0,t.jsx)(h,{value:f.label??"",onChange:qr,onCommit:o.commands.seal})}),(0,t.jsx)(S,{label:l("editor.axesPanel.controls.ticks"),children:(0,t.jsx)(c,{isChecked:f.ticks.isVisible,onChange:Wr})})]}),w&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.labels"),children:(0,t.jsx)(u,{value:f.ticks.mode,options:Fr,onChange:Kr})}),b&&p==="linear"&&!O&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.position"),children:(0,t.jsx)(u,{value:R??f.position,options:Y,onChange:no})}),T!==void 0&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.reverse"),children:(0,t.jsx)(u,{value:T.reverse===!0?"yes":"no",options:Vr,onChange:Xr})}),b&&!y&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.scale"),children:(0,t.jsx)(u,{value:P?"log":"linear",options:Hr,onChange:Zr})}),b&&!P&&(0,t.jsxs)(t.Fragment,{children:[!y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.startFrom"),children:(0,t.jsx)(u,{value:I,options:Br,onChange:Qr})}),I==="custom"&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.value"),children:(0,t.jsx)(d,{value:b.domainMin??null,onChange:Yr,onCommit:o.commands.seal})})]}),(0,t.jsx)(S,{label:l("editor.axesPanel.controls.endAt"),children:(0,t.jsx)(u,{value:C===null?"auto":"custom",options:Gr,onChange:eo})}),C!==null&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.value"),children:(0,t.jsx)(d,{value:C,onChange:Jr,onCommit:o.commands.seal})})]})]})})},Bd=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",Vt=(e,n)=>{const r=n==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},pt=({value:e,onChange:n})=>{const r=_(),a=s.useI18n(),{TextField:o}=N(),i=e!==null&&typeof e!="string",l=d=>n(d===""?null:d);return(0,t.jsx)(S,{label:a("editor.elementsPanel.contentValue"),children:(0,t.jsx)(o,{value:typeof e=="string"?e:"",onChange:l,onCommit:r.commands.seal,isDisabled:i})})},Ir=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},h=u=>{a.commands.dispatch(new m.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isCaptionVisible,onChange:c})}),(0,t.jsx)(pt,{value:d.caption,onChange:h})]})})},Ut=/^[a-z][a-z\d+.-]*:/i,Gd={},Er=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=h=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"source",isVisible:h}))};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isSourceVisible,onChange:c})}),(0,t.jsx)(Vd,{source:d.source??Gd})]})})},Vd=({source:e})=>{const n=_(),r=s.useI18n(),{TextField:a}=N(),o=c=>{const h=(c.label??"")!==""||(c.url??"")!=="";n.commands.dispatch(new m.SetContentSourceCommand({source:h?c:null}),{transient:!0})},i=()=>{const c=e.url??"";c!==""&&!Ut.test(c)&&o({...e,url:`https://${c}`}),n.commands.seal()},l=c=>o({...e,url:c}),d=c=>o({...e,label:c});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,t.jsx)(a,{value:e.url??"",onChange:l,onCommit:i,hasError:Ut.test(e.url??"")&&!(0,m.isSafeUrl)(e.url)})}),(0,t.jsx)(S,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,t.jsx)(a,{value:e.label??"",onChange:d,onCommit:n.commands.seal})})]})},Mr=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},h=u=>{a.commands.dispatch(new m.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isSubtitleVisible,onChange:c})}),(0,t.jsx)(pt,{value:d.subtitle,onChange:h})]})})},Xe=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],Ud=Xe.length/2,_r=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=N();if(!o)return null;const{textScale:d}=o.config.appearance,c=p=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${p}`}),h=Xe.map(p=>({value:`${p}`,label:c(p)})),u=p=>{const f=Xe.find(g=>`${g}`===p);f!==void 0&&a.commands.dispatch(new m.SetAppearanceTextScaleCommand({textScale:f}))};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:n,preview:r??c(d),children:(0,t.jsx)(l,{value:`${d}`,options:h,columns:Ud,onChange:u,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Nr=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},h=u=>{a.commands.dispatch(new m.SetContentTitleCommand({title:u}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isTitleVisible,onChange:c})}),(0,t.jsx)(pt,{value:d.title,onChange:h})]})})},$d=({children:e,...n})=>(0,t.jsx)(dt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Nr,{}),(0,t.jsx)(Mr,{}),(0,t.jsx)(Ir,{}),(0,t.jsx)(Er,{}),(0,t.jsx)(_r,{})]})}),qd=({children:e,...n})=>(0,t.jsx)(dt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ke,{axis:"x"}),(0,t.jsx)(Ke,{axis:"y"})]})}),_e=e=>`${e}px`,Rr=e=>`${Math.round(e*100)}%`,Wd=e=>`${e}°`,Kd=24,Xd={select:{target:"graph"}},$t=["dim","desaturate"],Zd=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=N();if(!o)return null;const c=(0,m.createStyleResolver)().chromeReaders(o.chrome).graph.get("borderRadius"),h=(0,m.readHighlightDimStyle)(o.spec),u=$t.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),p=g=>{const x=(0,m.findStyleRule)(o.spec.styles.overrides,Xd)?.declarations??{};a.commands.dispatch(new m.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...x,borderRadius:g}}}),{transient:!0})},f=g=>{const x=$t.find(b=>b===g);x&&a.commands.dispatch(new m.SetHighlightDimStyleCommand({dimStyle:x}))};return(0,t.jsx)(z,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,t.jsx)(l,{value:c,min:0,max:Kd,step:1,formatValue:_e,onChange:p,onCommit:a.commands.seal})}),(0,t.jsx)(S,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,t.jsx)(d,{value:h,options:u,onChange:f})})]})})},mt=(e,n)=>{const{colorScheme:r}=s.useThemeContext();return(0,v.useMemo)(()=>{const a=e?.layers.find(o=>o.id===n);return a===void 0?null:(0,m.createStyleResolver)({colorScheme:r}).geomReaders(a)},[e,n,r])},Yd=.05,Jd=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=N(),c=o?(0,m.findLayerByGeom)(o.spec.layers,"bar"):void 0,h=mt(o,c?.id??null);if(!o||!c||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=g=>{a.commands.dispatch(new m.SetBarWidthCommand({layerId:c.id,width:g}),{transient:!0})},p=g=>{const x=m.BORDER_RADIUS_TOKENS.find(b=>b===g);x&&a.commands.dispatch(new m.SetBarBorderRadiusCommand({layerId:c.id,borderRadius:x}))},f=m.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:i(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,t.jsx)(z,{title:e??i("editor.graphPanel.barSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.barSection.thickness"),children:(0,t.jsx)(l,{value:c.params.width,min:m.MIN_BAR_WIDTH,max:m.MAX_BAR_WIDTH,step:Yd,formatValue:Rr,onChange:u,onCommit:a.commands.seal})}),(0,t.jsx)(S,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,t.jsx)(d,{value:h?.get("borderRadius")??m.DEFAULT_BAR_BORDER_RADIUS,options:f,onChange:p})})]})})},Ne=({children:e})=>{const n=(0,v.useId)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("g",{filter:`url(#${n})`,children:e}),(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:n,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,t.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,t.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},Re="qdaoth0",Qd=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 31 33",...e,children:[(0,t.jsx)(Ne,{children:(0,t.jsx)("path",{className:Re,fillRule:"evenodd",clipRule:"evenodd",d:"M25.7417 6.23664C25.7417 6.09417 25.7076 5.95967 25.6471 5.84086C25.5633 5.67624 25.4288 5.54173 25.2641 5.4579C25.1453 5.39739 25.0108 5.36328 24.8684 5.36328H12.0591C11.5767 5.36328 11.1857 5.7543 11.1857 6.23664C11.1857 6.71899 11.5767 7.11 12.0591 7.11H22.7599L5.61908 24.2508C5.27801 24.5919 5.27801 25.1448 5.61908 25.4859C5.96015 25.827 6.51313 25.827 6.8542 25.4859L23.995 8.34513V19.0459C23.995 19.5283 24.386 19.9193 24.8684 19.9193C25.3507 19.9193 25.7417 19.5283 25.7417 19.0459V6.23664ZM20.995 15.5878V19.0459C20.995 21.1851 22.7292 22.9193 24.8684 22.9193C27.0076 22.9193 28.7417 21.1851 28.7417 19.0459V6.23664C28.7417 4.09744 27.0076 2.36328 24.8684 2.36328H12.0591C9.91985 2.36328 8.18569 4.09744 8.18569 6.23664C8.18569 8.37584 9.91985 10.11 12.0591 10.11H15.5172L3.49777 22.1295C1.98512 23.6421 1.98513 26.0946 3.49776 27.6072C5.0104 29.1199 7.46288 29.1199 8.97552 27.6072L20.995 15.5878Z"})}),(0,t.jsx)("path",{fill:"currentColor",d:"M12.0591 7.11C11.5767 7.11 11.1857 6.71899 11.1857 6.23664C11.1857 5.7543 11.5767 5.36328 12.0591 5.36328H24.8684C25.3507 5.36328 25.7417 5.7543 25.7417 6.23664V19.0459C25.7417 19.5283 25.3507 19.9193 24.8684 19.9193C24.386 19.9193 23.995 19.5283 23.995 19.0459V8.34512L6.8542 25.4859C6.51313 25.827 5.96015 25.827 5.61908 25.4859C5.27801 25.1448 5.27801 24.5919 5.61908 24.2508L22.7599 7.11H12.0591Z"})]}),eu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 32 32",...e,children:(0,t.jsxs)(Ne,{children:[(0,t.jsx)("path",{className:Re,d:"M11 21H21V11H11V21ZM29 23C29 26.3137 26.3137 29 23 29H9C5.68629 29 3 26.3137 3 23V9C3 5.68629 5.68629 3 9 3H23C26.3137 3 29 5.68629 29 9V23Z"}),(0,t.jsx)("path",{fill:"currentColor",d:"M24.25 9C24.25 8.30964 23.6904 7.75 23 7.75H9C8.30964 7.75 7.75 8.30964 7.75 9V23C7.75 23.6904 8.30964 24.25 9 24.25H23C23.6904 24.25 24.25 23.6904 24.25 23V9ZM25.75 23C25.75 24.5188 24.5188 25.75 23 25.75H9C7.48122 25.75 6.25 24.5188 6.25 23V9C6.25 7.48122 7.48122 6.25 9 6.25H23C24.5188 6.25 25.75 7.48122 25.75 9V23Z"})]})}),tu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(Ne,{children:(0,t.jsx)("path",{className:Re,fillRule:"evenodd",clipRule:"evenodd",d:"M4.89961 14.7968C3.08522 13.5116 1.89961 11.3966 1.89961 9.00039C1.89961 5.07917 5.07839 1.90039 8.99961 1.90039C10.7798 1.90039 12.4069 2.55553 13.6531 3.63785C14.3179 3.17306 15.1269 2.90039 15.9996 2.90039L22.9996 2.90039C25.264 2.90039 27.0996 4.73602 27.0996 7.00039L27.0996 9.7243C27.5717 9.92414 28.014 10.2165 28.3987 10.6013C29.9999 12.2024 29.9999 14.7984 28.3987 16.3995L27.9182 16.8801C29.2628 18.172 30.0996 19.9885 30.0996 22.0004C30.0996 25.9216 26.9208 29.1004 22.9996 29.1004C21.2195 29.1004 19.5923 28.4453 18.3461 27.3629C17.6813 27.8277 16.8723 28.1004 15.9996 28.1004L8.99961 28.1004C6.73524 28.1004 4.89961 26.2648 4.89961 24.0004L4.89961 14.7968Z"})}),(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M25.25 22C25.25 20.7574 24.2426 19.75 23 19.75C21.7574 19.75 20.75 20.7574 20.75 22C20.75 23.2426 21.7574 24.25 23 24.25C24.2426 24.25 25.25 23.2426 25.25 22ZM23 18.25C25.0711 18.25 26.75 19.9289 26.75 22C26.75 24.0711 25.0711 25.75 23 25.75C20.9289 25.75 19.25 24.0711 19.25 22C19.25 19.9289 20.9289 18.25 23 18.25ZM11.25 9C11.25 7.75736 10.2426 6.75 9 6.75C7.75736 6.75 6.75 7.75736 6.75 9C6.75 10.2426 7.75736 11.25 9 11.25C10.2426 11.25 11.25 10.2426 11.25 9ZM9.75 12.675C11.4617 12.3275 12.75 10.8142 12.75 9C12.75 6.92893 11.0711 5.25 9 5.25C6.92893 5.25 5.25 6.92893 5.25 9C5.25 10.8142 6.53832 12.3275 8.25 12.675L8.25 24C8.25 24.4142 8.58579 24.75 9 24.75L16 24.75C16.4142 24.75 16.75 24.4142 16.75 24L16.75 7.75L22.25 7.75L22.25 14.1893L21.0303 12.9697C20.7374 12.6768 20.2626 12.6768 19.9697 12.9697C19.6768 13.2626 19.6768 13.7374 19.9697 14.0303L22.4697 16.5303C22.7626 16.8232 23.2374 16.8232 23.5303 16.5303L26.0303 14.0303C26.3232 13.7374 26.3232 13.2626 26.0303 12.9697C25.7374 12.6768 25.2626 12.6768 24.9697 12.9697L23.75 14.1893L23.75 7C23.75 6.58579 23.4142 6.25 23 6.25L16 6.25C15.5858 6.25 15.25 6.58579 15.25 7L15.25 23.25L9.75 23.25L9.75 12.675Z"})]}),nu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(Ne,{children:(0,t.jsx)("path",{className:Re,d:"M20.7271 2C21.4372 2 21.7114 2.00463 22.0841 2.03504C22.8228 2.0954 23.4839 2.25122 24.1592 2.59527C25.1865 3.1188 26.0219 3.9541 26.5458 4.98208C26.8896 5.65706 27.0454 6.31812 27.1057 7.05672C27.1301 7.35469 27.1379 7.58979 27.14 8.03558L27.1408 9.10155C27.1408 11.2114 25.4304 12.922 23.3205 12.922C21.4083 12.922 19.8243 11.5172 19.5441 9.68336L19.538 9.64H18.39V21.687L20.0392 21.6877C22.149 21.6877 23.8595 23.398 23.8595 25.508C23.8595 27.6178 22.149 29.3283 20.0392 29.3283H9.10159C6.99169 29.3283 5.28127 27.6178 5.28127 25.508C5.28127 23.398 6.99172 21.6877 9.10159 21.6877L10.75 21.687V9.64H9.601L9.59661 9.68334C9.32609 11.4539 7.84018 12.8246 6.01692 12.917L5.82032 12.922C3.71035 12.922 2 11.2114 2 9.10155V8.41371C2 7.70349 2.00463 7.42929 2.03504 7.05674C2.09538 6.31803 2.25122 5.65681 2.59521 4.98173C3.11877 3.95419 3.95418 3.11876 4.98174 2.5952C5.65683 2.25122 6.31798 2.09539 7.057 2.03501C7.42935 2.00463 7.70354 2 8.41371 2H20.7271Z"})}),(0,t.jsx)("path",{fill:"currentColor",d:"M8.41371 5H20.7271C21.1595 5 21.5325 5 21.8398 5.02507C22.1641 5.05157 22.4867 5.11007 22.7971 5.26822C23.2601 5.50416 23.6366 5.88064 23.8726 6.3437C24.0307 6.65409 24.0892 6.97666 24.1157 7.30097C24.1408 7.60823 24.1408 7.98127 24.1408 8.41369V9.10155C24.1408 9.55465 23.7735 9.92195 23.3205 9.92195C22.8674 9.92195 22.5001 9.55465 22.5001 9.10155V8.44533C22.5001 7.97237 22.4995 7.66699 22.4805 7.43457C22.4623 7.21172 22.4314 7.12909 22.4107 7.08853C22.3321 6.93418 22.2066 6.80869 22.0522 6.73004C22.0117 6.70938 21.9291 6.67847 21.7062 6.66026C21.4738 6.64127 21.1684 6.64063 20.6954 6.64063H15.3907V24.6877H20.0392C20.4922 24.6877 20.8595 25.0549 20.8595 25.508C20.8595 25.961 20.4922 26.3283 20.0392 26.3283H9.10159C8.64854 26.3283 8.28127 25.961 8.28127 25.508C8.28127 25.0549 8.64854 24.6877 9.10159 24.6877H13.7501V6.64063H8.44533C7.97238 6.64063 7.66699 6.64127 7.43457 6.66026C7.21172 6.67847 7.1291 6.70938 7.08854 6.73004C6.93418 6.80869 6.80869 6.93418 6.73004 7.08853C6.70938 7.12909 6.67847 7.21172 6.66026 7.43457C6.64127 7.66699 6.64063 7.97237 6.64063 8.44533V9.10155C6.64063 9.55465 6.27337 9.92195 5.82032 9.92195C5.36727 9.92195 5 9.55465 5 9.10155V8.41371C5 7.98128 5 7.60823 5.02508 7.30097C5.05157 6.97666 5.11007 6.65409 5.26823 6.3437C5.50417 5.88064 5.88064 5.50416 6.3437 5.26822C6.65409 5.11007 6.97666 5.05157 7.30097 5.02507C7.60824 5 7.98129 5 8.41371 5Z"})]}),ru={x:.5,y:.5},ou=.2,au={x:.375,y:.25,width:.25,height:.5},iu={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},lu={x:.4,y:.6},su={x:.6,y:.4},cu="relative-difference",du=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Button:l}=N();if(!o)return null;const d=()=>{a.commands.dispatch(new m.AddAnnotationCommand({kind:"text",annotation:{...m.TEXT_ANNOTATION_DEFAULTS,content:uu(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...ru},width:ou}}))},c=()=>{a.commands.dispatch(new m.AddAnnotationCommand({kind:"arrow",annotation:{...m.ARROW_DEFAULTS,start:{anchorType:"panel",...lu},end:{anchorType:"panel",...su}}}))},h=()=>{a.commands.dispatch(new m.AddAnnotationCommand({kind:"shape",annotation:{...m.SHAPE_DEFAULTS,...iu,region:{anchorType:"panel",...au}}}))},u=()=>{const f=(0,m.inferDefaultDifferenceArrowEndpoints)(o);f!==null&&a.commands.dispatch(new m.AddAnnotationCommand({kind:"differenceArrow",annotation:{...m.DIFFERENCE_ARROW_DEFAULTS,...f,label:cu}}))},p=o.coordSystem.type==="cartesian";return(0,t.jsx)(z,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:n,preview:r,children:(0,t.jsxs)(Tr,{children:[(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(nu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(Qd,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:c}),(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(eu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),p&&(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(tu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},uu=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),hu=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{ToggleGroup:l}=N();if(!o)return null;const d=(0,m.readChartType)(o.spec);if(d===null||!(0,m.isComboChartType)(d))return null;const c=m.COMBO_TYPES.map(u=>({value:u,label:i(`editor.graphPanel.comboSection.types.${u}`)})),h=u=>{const p=m.COMBO_TYPES.find(f=>f===u);p&&a.commands.dispatch(new m.SetChartTypeCommand({coordType:"cartesian",comboType:p}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.comboSection.title"),layout:n,preview:r??i(`editor.graphPanel.comboSection.types.${d.comboType}`),children:(0,t.jsx)(l,{value:d.comboType,options:c,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},pu=.1,mu=20,gu=({title:e,preview:n})=>{const r=_(),a=s.useHandleCompiled(r),o=s.useI18n(),{NumberField:i,TextField:l}=N();if(!a||a.coordSystem.type==="polar")return null;const d=(0,m.findGoalLineLayer)(a.spec.layers),c=e??o("editor.annotationsPanel.goalSection.title"),h=(0,m.extractConstantValue)(d?.mapping.y),u=typeof h=="number"?h:null,p=x=>{const b=new m.ToggleGoalLineCommand({showGoalLine:x,value:xu(a),...d!==void 0&&{layerId:d.id}});r.commands.dispatch(b)},f=x=>{if(d===void 0)return;const b=new m.SetRuleLabelCommand({layerId:d.id,label:x===""?null:x});r.commands.dispatch(b,{transient:!0})},g=x=>{if(d===void 0||x===null)return;const b=new m.SetRuleValueCommand({layerId:d.id,value:x});r.commands.dispatch(b,{transient:!0})};return(0,t.jsx)(kr,{title:c,preview:n,isChecked:d!==void 0,onToggle:p,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,t.jsx)(l,{value:d?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:f,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,t.jsx)(S,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,t.jsx)(i,{value:u,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},xu=e=>{const n=(e.scales.y?.domain??[]).filter(l=>typeof l=="number");if(n.length===0)return 0;const r=Math.max(...n),a=r-Math.min(...n),o=a>0?a:Math.abs(r);if(o===0)return 0;const i=Math.min(mu,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*pu).toFixed(i))},fu=({layerId:e,title:n,layout:r="collapsible",preview:a})=>{const o=_(),i=s.useHandleCompiled(o),l=s.useI18n(),{Switch:d}=N();if(!i)return null;const c=e===void 0?i.spec.layers[0]:i.spec.layers.find(R=>R.id===e);if(!c)return null;const{showDataLabels:h,format:u,showStackTotals:p,showCategoryLabels:f}=c.dataLabels,g=i.coordSystem.type==="polar",x=c.geom==="bar",b=c.position==="stack"||c.position==="fill",T=x&&!g&&c.position==="stack",w=x&&(!g||h),y=x||c.geom==="area"&&b;if(!(0,m.canPlaceDataLabels)(c.geom,i.coordSystem.type))return null;const P=R=>{const L=new m.ToggleDataLabelsCommand({layerId:c.id,showDataLabels:R});o.commands.dispatch(L)},C=R=>{const L=new m.SetDataLabelsFormatCommand({layerId:c.id,format:R?"percentage":"absolute"});o.commands.dispatch(L)},I=R=>{const L=new m.ToggleStackTotalsCommand({layerId:c.id,showStackTotals:R});o.commands.dispatch(L)},D=R=>{const L=new m.ToggleCategoryLabelsCommand({layerId:c.id,showCategoryLabels:R});o.commands.dispatch(L)};return(0,t.jsx)(z,{title:n??l("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.dataLabels"),children:(0,t.jsx)(d,{isChecked:h,onChange:P})}),h&&y&&(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.showPercentages"),children:(0,t.jsx)(d,{isChecked:u==="percentage",onChange:C})}),T&&(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.stackTotals"),children:(0,t.jsx)(d,{isChecked:p,onChange:I})}),w&&(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.categoryLabels"),children:(0,t.jsx)(d,{isChecked:f,onChange:D})})]})})},vu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M5.744 5.565 0 11.826V8l5.744-6.957 4.718 2.087L16 0v6.957l-5.538 4z"})]}),bu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),Cu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Su=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),yu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),ju=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Tu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),wu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,t.jsx)("rect",{width:"3.2",height:"6.5",y:"9.5",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"8.5",x:"4.267",y:"7.5",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"5",x:"8.533",y:"11",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"7.5",x:"12.8",y:"8.5",rx:".533"})]}),(0,t.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,t.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,t.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),Au=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),Pu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,t.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,t.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,t.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,t.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,t.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,t.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),Lu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),ku=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,t.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,t.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,t.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,t.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,t.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,t.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,t.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),Iu=.55,Ze=[{name:"column",icon:yu,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Tu,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:ju,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:bu,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Su,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:Cu,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Pu,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:vu,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:wu,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:ku,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Lu,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Au,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Iu}}],Eu=.05,Mu=e=>e===null?null:Ze.find(n=>Nu(n.summary,e))??null,_u=(e,n)=>{const{summary:r}=e;return n===null||(0,m.isComboChartType)(r)?r:r.position==="dodge"&&Or(n)?{...r,position:"identity"}:r.coordType!=="polar"||!we(r.innerRadius)||n.coordType!=="polar"||!we(n.innerRadius)?r:{...r,innerRadius:n.innerRadius}},Or=e=>!(0,m.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",Nu=(e,n)=>{if((0,m.isComboChartType)(e)||(0,m.isComboChartType)(n))return(0,m.isComboChartType)(e)&&(0,m.isComboChartType)(n);const r=e.position===n.position||e.position==="dodge"&&Or(n);return e.coordType!==n.coordType||e.geom!==n.geom||!r?!1:e.coordType!=="polar"||n.coordType!=="polar"?!0:e.theta===n.theta&&we(e.innerRadius)===we(n.innerRadius)},we=e=>e>=Eu,Ru=3,Ou=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=N(),d=o!==null&&(0,m.canBecomeCombo)(o.spec),c=(0,v.useMemo)(()=>Ze.map(({name:f,icon:g})=>({value:f,label:i(`editor.graphTypes.${f}`),icon:(0,t.jsx)(g,{size:"md"}),isDisabled:f==="combo"&&!d})),[i,d]);if(!o)return null;const h=(0,m.readChartType)(o.spec),u=Mu(h),p=f=>{const g=Ze.find(x=>x.name===f);g&&a.commands.dispatch(new m.SetChartTypeCommand(_u(g,h)))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:n,preview:r??(u===null?void 0:i(`editor.graphTypes.${u.name}`)),children:(0,t.jsx)(l,{value:u?.name??"",options:c,columns:Ru,onChange:p,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},qt=["solid","dashed","dotted"],Du=8,zu=0,Fu=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,Switch:d,ToggleGroup:c}=N(),{colorScheme:h}=s.useThemeContext();if(!o)return null;const u=o.guides.axes.filter(Hu);if(u.length===0)return null;const p=o.coordSystem.type!=="polar",f=u.some(y=>y.gridVisible),g=(0,m.resolveGridLineStyle)((0,m.createStyleResolver)({colorScheme:h}).chromeReaders(o.chrome),"y"),x=qt.map(y=>({value:y,label:i(`editor.graphPanel.gridSection.lineStyles.${y}`)})),b=y=>P=>{a.commands.dispatch(new m.SetGridVisibilityCommand({axis:y,isVisible:P}))},T=y=>{const P=qt.find(C=>C===y);P&&a.commands.dispatch(new m.SetGridLineStyleCommand({axis:"both",lineStyle:P}))},w=y=>{a.commands.dispatch(new m.SetGridLineWidthCommand({axis:"both",lineWidth:y}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.gridSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[u.map(y=>(0,t.jsx)(S,{label:i(Bu(y)),children:(0,t.jsx)(d,{isChecked:y.gridVisible,onChange:b(y.scaleAestheticKey)})},y.scaleAestheticKey)),p&&f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,t.jsx)(c,{value:g.lineType,options:x,onChange:T})}),(0,t.jsx)(S,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,t.jsx)(l,{value:g.strokeWidth,min:zu,max:Du,step:.5,formatValue:_e,onChange:w,onCommit:a.commands.seal})})]})]})})},Hu=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",Bu=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaleAestheticKey==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",Gu="total",Dr=["total","average","current"],Vu=["total"],Wt=["previous","first"],Kt=["auto","small","medium","large"],Uu=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l,ToggleGroup:d}=N();if(!o)return null;const c=o.config.headline,h=c.show!=="none",u=o.coordSystem,p=u.type==="polar",f=u.type==="polar"&&u.innerRadius>0,g=o.layers.some(A=>A.summary.grandTotal!==void 0);if(p&&!g)return null;const x=p?Vu:Dr,b=o.guides.headline,T=b?.kind==="perGroup"&&b.items.some(A=>A.comparison!==null),w=x.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.metrics.${A}`)})),y=Wt.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.comparison.${A}`)})),P=Kt.map(A=>({value:A,label:i(A==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${A}`)})),C=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],I=A=>{a.commands.dispatch(new m.SetHeadlineShowCommand({show:A?Gu:"none"}))},D=A=>{const O=x.find(Y=>Y===A);O&&a.commands.dispatch(new m.SetHeadlineShowCommand({show:O}))},R=A=>{const O=Wt.find(Y=>Y===A);O&&a.commands.dispatch(new m.SetHeadlineCompareWithCommand({compareWith:O}))},L=A=>{const O=Kt.find(Y=>Y===A);O&&a.commands.dispatch(new m.SetHeadlineSizeCommand({size:O}))},E=A=>{a.commands.dispatch(new m.SetHeadlinePositionCommand({position:A==="center"?"center":"above"}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:n,preview:r??$u(i,c.show),children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,t.jsx)(l,{isChecked:h,onChange:I})}),h&&(0,t.jsxs)(t.Fragment,{children:[w.length>1&&(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,t.jsx)(d,{value:c.show,options:w,onChange:D})}),T&&(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,t.jsx)(d,{value:(0,m.resolveComparisonBasis)(c.compareWith),options:y,onChange:R})}),(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,t.jsx)(d,{value:c.size,options:P,onChange:L})}),f&&(0,t.jsx)(S,{label:i("editor.axesPanel.controls.position"),children:(0,t.jsx)(d,{value:c.position,options:C,onChange:E})})]})]})})},$u=(e,n)=>{const r=Dr.find(a=>a===n);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},He=["top","bottom","left","right","none"],Xt=["auto","start","center","end"],Zt=["auto","pill","direct"],qu=({positions:e,title:n,layout:r="collapsible",preview:a})=>{const o=_(),i=s.useHandleCompiled(o),l=s.useI18n(),{ToggleGroup:d}=N();if(!i)return null;const c=i.config.legend.position,h=e??He,u=i.guides.legends.drawn[0],p=(0,m.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),f=i.guides.headline?.kind==="perGroup",g=i.guides.colorGroups.length>0;if(c==="auto"&&u===void 0&&!p&&(f||!g))return null;const x=u?.position??"none",b=c==="auto"?x:c,T=He.filter(E=>E===b||h.includes(E)).map(E=>({value:E,label:l(`editor.graphPanel.legendSection.${E}`)})),w=E=>{const A=He.find(O=>O===E);A&&o.commands.dispatch(new m.SetLegendPositionCommand({position:A}))},y=E=>{const A=Xt.find(O=>O===E);A&&o.commands.dispatch(new m.SetLegendAlignCommand({align:A}))},P=E=>{const A=Zt.find(O=>O===E);A&&o.commands.dispatch(new m.SetLegendDisplayCommand({display:A}))},C=Xt.map(E=>({value:E,label:l(`editor.graphPanel.legendSection.align.${E}`)})),I=Zt.map(E=>({value:E,label:l(`editor.graphPanel.legendSection.display.${E}`)})),D=n??l("editor.graphPanel.legendSection.title"),R=T.find(E=>E.value===b)?.label,L=u!==void 0;return(0,t.jsx)(z,{title:D,layout:r,preview:a??R,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.position"),layout:"stack",children:(0,t.jsx)(d,{value:b,options:T,onChange:w})}),L&&(0,t.jsx)(S,{label:l("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,t.jsx)(d,{value:i.config.legend.align,options:C,onChange:y})}),p&&(0,t.jsx)(S,{label:l("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,t.jsx)(d,{value:i.config.legend.display,options:I,onChange:P})})]})})},Wu=1,Ku=20,Xu=.5,zr=({layerId:e})=>{const n=_(),r=s.useHandleCompiled(n),{Slider:a}=N(),o=mt(r,e);if(!r)return null;const i=l=>{const d=new m.SetPointSizeCommand({layerId:e,size:l});n.commands.dispatch(d,{transient:!0})};return(0,t.jsx)(a,{value:o?.get("size")??m.DEFAULT_POINT_SIZE,min:Wu,max:Ku,step:Xu,formatValue:_e,onChange:i,onCommit:n.commands.seal})},Zu=1,Yu=10,Ju=.1,Qu=["gap","zero","connect"],e0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Slider:d,Switch:c,ToggleGroup:h}=N(),u=o?.spec.layers??[],p=(0,m.findLayerByGeom)(u,"line","area"),f=mt(o,p?.id??null);if(!o||!p)return null;const g=o.coordSystem.type==="polar",x=r0(i,p),b=n0(p,u),T=Yt(o.spec,p.geom,"strokeWidth",p.id),w=typeof T=="number",y=p.geom==="line"?p:void 0,P=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],C=A=>{a.commands.dispatch(new m.ToggleLinePointsVisibilityCommand({layerId:p.id,showPoints:A}))},I=A=>{y&&a.commands.dispatch(new m.ToggleLineFillCommand({layerId:y.id,showFill:A}))},D=A=>{a.commands.dispatch(new m.SetLineInterpolationCommand({layerId:p.id,interpolate:A?"catmull-rom":"linear"}))},R=A=>{const O=f?.get("strokeWidth")??m.DEFAULT_STROKE_WIDTH;a.commands.dispatch(new m.SetLineWidthCommand({layerId:p.id,lineWidth:A==="custom"?O:null}))},L=A=>{a.commands.dispatch(new m.SetLineWidthCommand({layerId:p.id,lineWidth:A}),{transient:!0})},E=A=>{const O=t0(A);O&&a.commands.dispatch(new m.SetLineMissingValuesCommand({layerId:p.id,missingValues:O}))};return(0,t.jsx)(z,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,t.jsx)(c,{isChecked:b!==void 0,onChange:C})}),b&&(0,t.jsx)(S,{label:i("editor.graphPanel.pointSize.label"),children:(0,t.jsx)(zr,{layerId:b.id})}),y&&!g&&(0,t.jsx)(S,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,t.jsx)(c,{isChecked:Yt(o.spec,"line","fillAlpha",y.id)!==void 0,onChange:I})}),!g&&(0,t.jsx)(S,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,t.jsx)(c,{isChecked:p.params.interpolate==="catmull-rom",onChange:D})}),(0,t.jsx)(S,{label:i("editor.graphPanel.lineThickness.label"),children:(0,t.jsx)(h,{value:w?"custom":"auto",options:P,onChange:R})}),w&&(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(d,{value:T,min:Zu,max:Yu,step:Ju,formatValue:_e,onChange:L,onCommit:a.commands.seal})}),!g&&x.length>1&&(0,t.jsx)(S,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,t.jsx)(l,{value:p.params.missingValues,options:x,onChange:E})})]})})},t0=e=>Qu.find(n=>n===e),Yt=(e,n,r,a)=>(0,m.findKindStyleDeclarations)(e.styles.overrides,(0,m.buildLayerStyleAddress)(n,a))?.[r],n0=(e,n)=>(0,m.filterLayersByGeoms)(n,"point").find(r=>(0,m.isCompanionLayer)(r,[e])),r0=(e,n)=>{const r=[{value:"gap",label:e("editor.graphPanel.treatEmptyValues.leaveGap.label")},{value:"zero",label:e("editor.graphPanel.treatEmptyValues.fillZero.label")}];return n.position!=="stack"&&n.position!=="fill"&&r.push({value:"connect",label:e("editor.graphPanel.treatEmptyValues.connectGaps.label")}),n.geom==="area"?r.filter(a=>a.value!=="gap"):r},Ye="\0none",o0=["x","y","color","size","label"],a0={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},i0=({title:e,layout:n="collapsible"})=>{const r=_(),a=s.useHandleCompiled(r),o=s.useI18n(),{Select:i}=N(),l=o("editor.graphPanel.mappingSection.none"),d=a?.spec,c=(0,v.useMemo)(()=>d===void 0?[]:(0,m.readMappableAesthetics)(d,o0).map(({aesthetic:h,variables:u,isRequired:p})=>{const f=(0,m.readMappedVariable)(d.mapping,h);return{aesthetic:h,label:o(a0[h]),value:f??(p?null:Ye),options:l0(u,f,p?null:l),chooseColumn:g=>{r.commands.dispatch(new m.SetMappingCommand({aesthetic:h,variable:g===Ye?null:g}))}}}),[d,o,l,r]);return a?(0,t.jsx)(z,{title:e??o("editor.graphPanel.mappingSection.title"),layout:n,children:(0,t.jsx)(H,{children:c.map(({aesthetic:h,label:u,value:p,options:f,chooseColumn:g})=>(0,t.jsx)(S,{label:u,children:(0,t.jsx)(i,{value:p,options:f,placeholder:l,onChange:g})},h))})}):null},l0=(e,n,r)=>{const a=n!==null&&!e.includes(n)?[n,...e]:e;return[...r===null?[]:[{value:Ye,label:r}],...a.map(o=>({value:o,label:o}))]},s0="k",c0=2,d0=0,u0=5,Je=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],h0=["auto","none"],p0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{NumberField:l,ToggleGroup:d}=N();if(!o)return null;const{abbreviation:c,decimals:h}=o.config.numberFormat,u=m0(c)!==void 0,p=h!=="auto",f=P=>P.map(C=>({value:C,label:i(`editor.graphPanel.numberFormat.options.${C}`)})),g=Je.map(({value:P,labelKey:C})=>({value:P,label:i(`common.abbreviations.${C}`)})),x=P=>{a.commands.dispatch(new m.SetNumberFormatAbbreviationCommand({abbreviation:P}))},b=P=>{const C=h0.find(I=>I===P);x(C??s0)},T=P=>{const C=Je.find(I=>I.value===P);C&&x(C.value)},w=P=>{a.commands.dispatch(new m.SetNumberFormatDecimalsCommand({decimals:P==="custom"?c0:"auto"}))},y=P=>{P!==null&&a.commands.dispatch(new m.SetNumberFormatDecimalsCommand({decimals:P}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,t.jsx)(d,{value:u?"custom":c,options:f(["auto","none","custom"]),onChange:b})}),u&&(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(d,{value:c,options:g,onChange:T})}),(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,t.jsx)(d,{value:p?"custom":"auto",options:f(["auto","custom"]),onChange:w})}),p&&(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(l,{value:h,min:d0,max:u0,onChange:y,onCommit:a.commands.seal})})]})})},m0=e=>Je.find(n=>n.value===e),g0=({title:e,layout:n="collapsible",preview:r})=>{const a=s.useHandleCompiled(_()),o=s.useI18n();if(!a)return null;const i=x0(a.spec.layers);return i?(0,t.jsx)(z,{title:e??o("editor.graphPanel.pointSize.label"),layout:n,preview:r,children:(0,t.jsx)(H,{children:(0,t.jsx)(S,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(zr,{layerId:i.id})})})}):null},x0=e=>{const n=(0,m.filterLayersByGeoms)(e,"line","area");return(0,m.filterLayersByGeoms)(e,"point").find(r=>!(0,m.isCompanionLayer)(r,n))},f0=.9,v0=360,b0=.05,C0=15,S0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l}=N();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:c}=o.spec.coords.params,h=p=>{a.commands.dispatch(new m.SetPolarInnerRadiusCommand({innerRadius:p}),{transient:!0})},u=p=>{a.commands.dispatch(new m.SetPolarStartAngleCommand({startAngle:p}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.polarSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,t.jsx)(l,{value:d,min:0,max:f0,step:b0,formatValue:Rr,onChange:h,onCommit:a.commands.seal})}),(0,t.jsx)(S,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,t.jsx)(l,{value:c,min:0,max:v0-1,step:C0,formatValue:Wd,onChange:u,onCommit:a.commands.seal})})]})})},y0=e=>(0,t.jsxs)(s.Icon,{...e,children:[(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4796 12.2222L17.6085 12.2291L17.6029 10.7291L19.474 10.7222L19.4796 12.2222ZM15.3662 12.2375L13.124 12.2459L13.1184 10.7459L15.3606 10.7375L15.3662 12.2375ZM10.8817 12.2542L8.63945 12.2626L8.63386 10.7626L10.8761 10.7542L10.8817 12.2542ZM6.39719 12.2709L4.52607 12.2779L4.52048 10.7779L6.3916 10.7709L6.39719 12.2709Z",fill:"currentColor"})]}),Jt=e=>(0,t.jsxs)(s.Icon,{...e,children:[(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.6749 8.04877L17.1069 9.06975L16.2884 7.81273L17.8564 6.79175L18.6749 8.04877ZM15.2278 10.2932L13.3488 11.5167L12.5303 10.2597L14.4093 9.03622L15.2278 10.2932ZM11.4697 12.7402L9.59064 13.9637L8.77217 12.7067L10.6512 11.4832L11.4697 12.7402ZM7.71158 15.1872L6.14354 16.2082L5.32507 14.9511L6.89311 13.9302L7.71158 15.1872Z",fill:"currentColor"})]}),j0=e=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:n,numberFormat:r}=e.config,a=e.guides.colorGroups.map(o=>{const i=(0,m.createValueFormatter)({valueFormat:o.valueFormat,locale:n,numberFormat:r}),l=o.value instanceof Date?o.value.getTime():o.value;return{value:l,option:{value:String(l),label:o.label??i(o.value)}}});return{options:a.map(({option:o})=>o),findValue:o=>a.find(i=>i.option.value===o)?.value}},[e]),Qt=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],T0="linear",w0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Switch:d}=N(),{options:c,findValue:h}=j0(o);if(!o||o.coordSystem.type==="polar")return null;const u=(0,m.findTrendLineLayer)(o.spec.layers),p=(0,m.findAverageLineLayer)(o.spec.layers),f=u?.stat.type==="smooth"?u.stat.method:T0,g=A0(p),x=Qt.map(C=>({value:C,label:i(`editor.annotationsPanel.trendType.options.${C}`)})),b=(C,I={})=>{const D=u??p,R=new m.SetStatLineCommand({line:C,...I,...D!==void 0&&{layerId:D.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(R)},T=C=>b(C?"trend":"none",{method:f}),w=C=>b(C?"average":"none",{group:g??h(c[0]?.value??"")}),y=C=>{const I=Qt.find(D=>D===C);I!==void 0&&b("trend",{method:I})},P=C=>{const I=C===null?void 0:h(C);I!==void 0&&b("average",{group:I})};return(0,t.jsx)(z,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:n,preview:r??(0,t.jsx)(Jt,{size:"lg"}),children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,t.jsx)(Jt,{size:"lg"}),children:(0,t.jsx)(d,{isChecked:u!==void 0,onChange:T})}),u!==void 0&&(0,t.jsx)(S,{label:i("editor.annotationsPanel.trendType.label"),children:(0,t.jsx)(l,{value:f,options:x,onChange:y,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,t.jsx)(S,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,t.jsx)(y0,{size:"lg"}),children:(0,t.jsx)(d,{isChecked:p!==void 0,onChange:w})}),p!==void 0&&c.length>0&&(0,t.jsx)(S,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,t.jsx)(l,{value:g===void 0?null:String(g),options:c,onChange:P,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},A0=e=>{const n=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return n instanceof Date?n.getTime():n};exports.AppearanceSection=Zd;exports.AxesPanel=qd;exports.AxisSection=Ke;exports.BarSection=Jd;exports.Button=ur;exports.CalloutsSection=du;exports.CaptionSection=Ir;exports.ComboSection=hu;exports.EditableGraphRenderer=Uc;exports.EditorPanel=dt;exports.ElementsPanel=$d;exports.GoalSection=gu;exports.GraphOptionsSection=fu;exports.GraphTypeSection=Ou;exports.GridSection=Fu;exports.HeadlineSection=Uu;exports.IntlProvider=ln;exports.LegendSection=qu;exports.LineSection=e0;exports.MappingSection=i0;exports.NumberField=mr;exports.NumberFormatSection=p0;exports.PANEL_ROOT_ATTRIBUTE=Pr;exports.PointSection=g0;exports.PolarSection=S0;exports.RadioGrid=gr;exports.Row=S;exports.Section=z;exports.Select=xr;exports.Slider=fr;exports.SourceSection=Er;exports.SubtitleSection=Mr;exports.Switch=vr;exports.TextField=br;exports.TextSizeSection=_r;exports.TitleSection=Nr;exports.ToggleGroup=Cr;exports.ToggledSection=kr;exports.TrendsAndAveragesSection=w0;exports.useControls=N;exports.usePanelExpansion=Ar;exports.usePanelGraph=_;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const s=require("./history-chords-tkqLt7Jt.cjs"),G=require("./dev.utils-DiNE92pC.cjs");let m=require("@graphysdk/viz-engine"),v=require("react"),t=require("react/jsx-runtime"),oe=require("zustand/react/shallow"),en=require("react-dom"),V=require("clsx");V=s.__toESM(V,1);let ae=require("@floating-ui/react-dom"),tn=require("@vanilla-extract/dynamic"),nn=require("@tiptap/core"),ro=require("@tiptap/extension-bold"),fe=require("@tiptap/extension-document"),oo=require("@tiptap/extension-hard-break"),ao=require("@tiptap/extension-heading"),io=require("@tiptap/extension-italic"),lo=require("@tiptap/extension-link"),so=require("@tiptap/extension-text"),co=require("@tiptap/extension-text-align"),ve=require("@tiptap/extension-text-style"),uo=require("@tiptap/extension-underline"),Ae=require("@tiptap/extensions"),rn=require("@tiptap/extension-paragraph"),Pe=require("@tiptap/react"),W=require("@base-ui/react/toolbar"),te=require("@base-ui/react/tooltip"),B=require("@base-ui/react/popover"),xt=require("react-colorful"),q=require("@base-ui/react/slider"),M=require("@base-ui/react/menu"),ho=require("@base-ui/react/toggle"),X=require("@base-ui/react"),re=require("lodash-es/clamp");re=s.__toESM(re,1);let le=require("@base-ui/react/accordion"),ft=require("@base-ui/react/number-field"),on=require("@base-ui/react/radio"),an=require("@base-ui/react/radio-group"),$=require("@base-ui/react/select"),vt=require("@base-ui/react/switch"),po=require("@base-ui/react/input");var mo={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},go={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",scatter:"نقطي",bubble:"فقاعي",funnel:"قمعي",combo:"مركب",heatmap:"خريطة حرارية",waterfall:"شلالي",mekko:"ميكو",table:"جدول"},sizePanel:{toolbarButton:"الحجم",presetsSection:{title:"إعدادات مسبقة"},customSizeSection:{title:"حجم مخصص"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"ويب / بريد إلكتروني",linkedIn:"منشور LinkedIn",instagram:"منشور Instagram",tiktok:"TikTok / قصة Instagram",twitter:"X (Twitter)",mobile:"جوال"},inputs:{unitLabel:"بكسل"},validation:{maxSizeError:e=>`≤ ${e.max} بكسل`,minSizeError:e=>`≥ ${e.min} بكسل`}},graphPanel:{toolbarButton:"الرسم البياني",graphTypeSection:{title:"نوع الرسم البياني"},mappingSection:{title:"البيانات",x:"المحور السيني",y:"القيمة",color:"اللون",size:"الحجم",label:"التسمية",none:"بلا"},comboSection:{title:"مظهر الرسم البياني المركب",types:{"grouped-bars":"أعمدة مجمعة","stacked-bars":"أعمدة مكدسة",lines:"خطوط فقط"}},polarSection:{title:"قطبي",innerRadius:"نصف القطر الداخلي",startAngle:"زاوية البداية"},barSection:{title:"الأعمدة",thickness:"سمك العمود",rounding:"التدوير",roundingOptions:{none:"بلا",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"كامل"}},graphOptionsSection:{title:"خيارات الرسم البياني"},gridSection:{title:"الشبكة",horizontalGridLines:"خطوط أفقية",verticalGridLines:"خطوط رأسية",rings:"حلقات",spokes:"أشعة",gridStyle:"نمط الشبكة",gridThickness:"سمك الشبكة",lineStyles:{solid:"متصل",dashed:"متقطع",dotted:"منقط"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",start:"البداية",center:"الوسط",end:"النهاية"},displayLabel:"النمط",display:{auto:"تلقائي",pill:"شارات",direct:"على الرسم"}},numberFormatSection:{title:"تنسيق الأرقام"},numberFormat:{abbreviationLabel:"الاختصار",valueLabel:"القيمة",decimalPlacesLabel:"المنازل العشرية",options:{auto:"تلقائي",custom:"مخصص",none:"بدون"}},headlineNumberSize:{sizeLabel:"الحجم",valueLabel:"القيمة",sizes:{small:"ص",medium:"م",large:"ك"}},lineThickness:{label:"سمك الخط"},pointSize:{label:"حجم النقطة",options:{auto:"تلقائي",custom:"مخصص"}},headlineNumberSection:{title:"الرقم الرئيسي",toggle:"مرئي",metricLabel:"المقياس",compareWithLabel:"مقارنة مع",metrics:{total:"المجموع",average:"المتوسط",current:"الأخير",conversion:"التحويل",left:"يسار"},comparison:{first:"الأول",previous:"السابق"},position:{above:"أعلى",center:"وسط"}},treatEmptyValues:{leaveGap:{label:"ترك فجوة في الرسم البياني",description:"يترك فاصلاً مرئياً في الخط حيث تكون البيانات مفقودة"},fillZero:{label:"ملء بالصفر",description:"يعرض نقاط البيانات المفقودة كصفر"},connectGaps:{label:"الاتصال عبر الفجوات",description:"يربط الخط بين النقاط المتاحة، متخطياً الفجوة"}},comboChartAppearance:{title:"مظهر الرسم البياني المركب",groupedBars:"أشرطة مجمعة",stackedBars:"أشرطة مكدسة",linesOnly:"خطوط فقط"}},axesPanel:{toolbarButton:"المحاور",mainAxisSection:{yAxis:"المحور الصادي",xAxis:"المحور السيني"},crossAxisSection:{xAxis:"المحور السيني",yAxis:"المحور الصادي"},controls:{title:"العنوان",visible:"مرئي",ticks:"العلامات",labels:"التسميات",position:"الموضع",scale:"المقياس",startFrom:"البدء من",endAt:"الانتهاء عند",value:"القيمة",numberOfAxes:"عدد المحاور",reverse:"عكس"},labelMode:{auto:"تلقائي",edges:"الحواف"},scale:{auto:"تلقائي",log:"لوغاريتمي"},startFrom:{auto:"تلقائي",zero:"صفر",custom:"مخصص"},endAt:{auto:"تلقائي",custom:"مخصص"},axisCount:{single:"مفرد",double:"مزدوج"},position:{left:"يسار",right:"يمين",top:"أعلى",bottom:"أسفل"},yesNo:{yes:"نعم",no:"لا"}},colorPanel:{toolbarButton:"اللون",themeSection:{title:"السمة"},appearanceSection:{title:"المظهر",highlightStyle:"التمييز"},paletteSection:{title:"لوحة الألوان",colorScheme:"نظام الألوان",colors:"الألوان",colorPalettes:"لوحات الألوان"},paletteMode:{preset:"مسبق",brand:"العلامة التجارية",freestyle:"حر"},paletteThemes:{colorful:"ملون",pastel:"باستيل",neon:"نيون"},backgroundSection:{title:"الخلفية",black:"أسود",white:"أبيض",grey:"رمادي",tint:"صبغة",custom:"مخصص",none:"بدون"},borderSection:{title:"الحدود",borderColor:"لون الحدود",thickness:"السمك",cornerRadius:"نصف قطر الزاوية"},borderType:{solid:"صلب",gradient:"متدرج",grey:"رمادي",preset:"مسبق",custom:"مخصص",none:"بدون"},presetGradients:{lilac:"ليلكي",neonPink:"وردي نيون",blackberry:"توت أسود",sun:"شمس",iceland:"آيسلندا",sunset:"غروب",ultraviolet:"فوق بنفسجي",purple:"أرجواني",iceCream:"آيس كريم",mint:"نعناع",cool:"بارد",fresh:"منعش"}},designPanel:{toolbarButton:"التصميم",defaultExpanded:"لوحة الألوان"},annotatePanel:{toolbarButton:"التعليقات",callOutSection:{title:"وسائل الشرح",text:"نص",arrow:"سهم",box:"مربع",difference:"الفرق"},highlightSection:{title:"التمييز",button:"تمييز",colorLabel:"لون التمييز"}},annotationsPanel:{toolbarButton:"التعليقات",freeformSection:{title:"حر",text:"نص",arrow:"سهم",box:"مربع",difference:"فرق"},goalSection:{title:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",valueAriaLabel:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:"(اختياري)"},trendsAndAveragesSection:{title:"الاتجاهات والمتوسطات",trend:"الاتجاه",average:"المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},averageLineSeries:{label:"سلسلة خط المتوسط",placeholder:"اختر السلسلة",ariaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},highlightSection:{title:"التمييز",button:"تمييز",fadeColorLabel:"لون التلاشي"},titleAndSubtitleSection:{title:"العنوان والعنوان الفرعي",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},captionAndSourceSection:{title:"التسمية التوضيحية والمصدر",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"}},elementsPanel:{contentVisible:"مرئي",contentValue:"القيمة",toolbarButton:"العناصر",headerSection:{title:"الرأس",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},footerSection:{title:"التذييل",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"},textSizeSection:{title:"حجم النص",scaleFormat:e=>`${e.value}x`},fontSection:{title:"الخط"},sourceSection:{title:"المصدر",url:"الرابط",name:"الاسم"}},powerUpPanel:{toolbarButton:"التحسينات",goalSection:{title:"الهدف",toggle:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:" (اختياري)",xAxisReferenceAriaLabel:"قيمة مرجعية للمحور السيني",anyXAxisValue:"أي قيمة للمحور السيني",selectValuePlaceholder:"اختر القيمة"},trendSection:{title:"الاتجاه",toggle:"الاتجاه"},averageSection:{title:"المتوسط",toggle:"المتوسط",seriesLabel:"سلسلة خط المتوسط",seriesPlaceholder:"اختر السلسلة",seriesAriaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},valueInput:{percentagePlaceholder:"النسبة المئوية",numberPlaceholder:"الرقم",percentageSymbol:"٪"}},highlighting:{modeHelper:{title:"وضع التمييز",hover:"مرر",toHighlight:"للتمييز",anyElement:"أي عنصر",escToExit:"للخروج",esc:"ESC"},emptyState:"لا تتوفر خيارات تمييز",deleteAriaLabel:"حذف التمييز",highlightStyle:{tint:"صبغة",grey:"رمادي"}},fineTunePanel:{toolbarButton:"الضبط الدقيق",detailSection:{title:"التفاصيل",missingValues:"القيم المفقودة"},lineStyleSection:{title:"نمط الخط",lineCurve:"انحناء الخط",sharp:"حاد",smooth:"ناعم"}},customThemeEditor:{patternDropdownAriaLabel:"قائمة منسدلة للنمط للسلسلة",patterns:{solid:"صلب",pattern:"نمط",dotted:"منقط",dashed:"متقطع",hatched:"مظلل"},heatmapColorLabel:"اللون"},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},xo={titleEditor:{titlePlaceholder:"بدون عنوان",subtitlePlaceholder:"إضافة عنوان فرعي"},toolbar:{formatting:{bold:"عريض",italic:"مائل",underline:"تحته خط",link:"رابط"},link:{ariaLabel:"إنشاء رابط",placeholder:"اكتب أو الصق رابطاً...",submit:"إرسال",urlLabel:"عنوان الرابط",apply:"تطبيق الرابط"},font:{label:"الخط",ariaLabel:"عائلة الخط"},heading:{label:"مستوى العنوان",ariaLabel:"نمط النص",text:"نص",caption:"تسمية توضيحية",heading1:"عنوان 1",heading2:"عنوان 2",heading3:"عنوان 3"},textAlign:{left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين"},color:{label:"لون النص"}},colorDropdown:{colors:"الألوان",chartColors:"ألوان الرسم البياني",custom:"مخصص",opacity:"الشفافية",transparent:"شفاف",pickCustom:"اختيار لون مخصص",pickColor:"اختيار لون"},annotations:{differenceArrowToolbar:{label:"خيارات سهم الفرق",labelKind:{ariaLabel:"التسمية",absoluteDifference:"التغير المطلق",relativeDifference:"التغير المئوي",proportion:"النسبة",suspectValue:"تقسم هذه القيمة على أساس يساوي صفرًا.",incomparableEnds:"يقيس الطرفان كميتين مختلفتين، لذا لا معنى للفرق بينهما."},color:"لون السهم",size:{ariaLabel:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},swap:"عكس الاتجاه",remove:"إزالة السهم"},shapeToolbar:{label:"خيارات الشكل",color:"لون الشكل",border:{ariaLabel:"الحد",none:"بلا",thin:"رفيع (2 بكسل)",medium:"متوسط (8 بكسل)",thick:"سميك (16 بكسل)"},remove:"إزالة الشكل",resize:{"top-left":"تغيير الحجم من الزاوية العلوية اليسرى","top-right":"تغيير الحجم من الزاوية العلوية اليمنى","bottom-right":"تغيير الحجم من الزاوية السفلية اليمنى","bottom-left":"تغيير الحجم من الزاوية السفلية اليسرى"}},arrowToolbar:{label:"خيارات السهم",color:"لون السهم",thickness:{ariaLabel:"السماكة",thin:"رفيع",medium:"متوسط",thick:"سميك"},startArrowhead:"بداية السهم",endArrowhead:"نهاية السهم",arrowhead:{lineArrow:"رأس سهم",none:"بلا"},lineStyle:{ariaLabel:"نمط الخط",solid:"متصل",dashed:"منقّط"},sticker:"تأثير الملصق",remove:"إزالة السهم",moveEndpoint:{start:"تحريك بداية السهم",end:"تحريك نهاية السهم"}},textToolbar:{label:"خيارات النص",background:"لون الخلفية",color:"لون النص",font:{ariaLabel:"الخط",modern:"عصري",fresh:"منعش",timeless:"كلاسيكي",technical:"تقني",fineliner:"قلم رفيع"},fontSize:{ariaLabel:"حجم الخط",small:"صغير",medium:"متوسط",large:"كبير",extraLarge:"كبير جدًا",huge:"ضخم"},align:{left:"محاذاة إلى اليسار",center:"محاذاة إلى الوسط",right:"محاذاة إلى اليمين"},remove:"إزالة النص",resize:{left:"تغيير الحجم من اليسار",right:"تغيير الحجم من اليمين"}},text:{editLabel:"تحرير النص",placeholder:"اكتب شيئًا"},baseMenu:{pinNumber:"تثبيت الرقم",unpinNumber:"إلغاء تثبيت الرقم",annotate:"تعليق",removeAnnotation:"إزالة التعليق",highlight:"تمييز",highlightWithLabel:e=>`تمييز ${e.label}`,removeHighlight:"إزالة التمييز",differenceArrow:"سهم الفرق",addSticker:"إضافة ملصق",removeSticker:"إزالة الملصق"},textMenu:{title:"تعليق",placeholder:"إضافة تعليق",addButton:"إضافة"},highlights:{menuTitle:"تمييز",labels:{bar:"شريط",barGroup:"مجموعة",barStack:"مكدس",barSeries:"سلسلة",line:"خط",linePoint:"نقطة",lineSeries:"سلسلة",scatterPoint:"نقطة",scatterSeries:"سلسلة",pieSlice:"شريحة",pointOrBar:"نقطة / شريط",lineOrSeries:"خط / سلسلة"}},stickerMenu:{title:"إضافة ملصق"},delete:"حذف",arrow:{thickness:{label:"السمك",thin:"رفيع",medium:"متوسط",thick:"سميك"},arrowhead:{startPoint:"نقطة البداية",endPoint:"نقطة النهاية",lineArrow:"سهم الخط",none:"بدون"},lineStyle:{label:"نمط الخط",solid:"صلب",dotted:"منقط"},stickerEffect:"تأثير الملصق",toolbarAriaLabel:"شريط أدوات السهم الحر",editorAriaLabel:"محرر السهم"},differenceArrow:{type:{proportion:"النسبة",difference:({absoluteDifference:e})=>`الفرق (${e})`,increase:({absoluteDifference:e})=>`الزيادة (${e})`,decrease:({absoluteDifference:e})=>`النقصان (${e})`,percentageChange:({percentageChange:e})=>`تغيير النسبة المئوية (${e})`,percentIncrease:({percentageChange:e})=>`زيادة النسبة المئوية (${e})`,percentDecrease:({percentageChange:e})=>`نقصان النسبة المئوية (${e})`},size:{label:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},flipArrow:"عكس السهم",color:"اللون",toolbarAriaLabel:"شريط أدوات سهم الفرق",editorAriaLabel:"محرر سهم الفرق"},shape:{color:"اللون",border:{label:"الحدود",none:"بدون",thin:({value:e})=>`رفيع (${e})`,medium:({value:e})=>`متوسط (${e})`,thick:({value:e})=>`سميك (${e})`}}}},fo={common:mo,editor:go,graph:xo},vo={save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",confirmDelete:e=>`Are you sure you want to delete ${e.item}?`,abbreviations:{thousands:"k",millions:"m",billions:"b"}},bo={title:"Graphy Editor",description:"Edit your content here",graphTypes:{column:"Column",columnStacked:"Stacked column",columnStackedFill:"100% stacked column",bar:"Bar",barStacked:"Stacked bar",barStackedFill:"100% stacked bar",line:"Line",areaStacked:"Stacked area",pie:"Pie",donut:"Donut",scatter:"Scatter",bubble:"Bubble",funnel:"Funnel",combo:"Combo",heatmap:"Heatmap",waterfall:"Waterfall",mekko:"Mekko",table:"Table"},sizePanel:{toolbarButton:"Size",presetsSection:{title:"Presets"},customSizeSection:{title:"Custom size"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"LinkedIn post",instagram:"Instagram post",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Mobile"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Graph",graphTypeSection:{title:"Graph type"},mappingSection:{title:"Data",x:"X-axis",y:"Value",color:"Colour",size:"Size",label:"Label",none:"None"},comboSection:{title:"Combo chart appearance",types:{"grouped-bars":"Grouped bars","stacked-bars":"Stacked bars",lines:"Lines only"}},polarSection:{title:"Polar",innerRadius:"Inner radius",startAngle:"Start angle"},barSection:{title:"Bars",thickness:"Bar thickness",rounding:"Rounding",roundingOptions:{none:"None",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Full"}},graphOptionsSection:{title:"Graph options"},gridSection:{title:"Grid",horizontalGridLines:"Horizontal lines",verticalGridLines:"Vertical lines",rings:"Rings",spokes:"Spokes",gridStyle:"Grid style",gridThickness:"Grid thickness",lineStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",stackTotals:"Stack totals",dataLabels:"Data labels",showPercentages:"Show percentages",categoryLabels:"Category labels"},legendSection:{title:"Legend",auto:"Auto",top:"Top",bottom:"Bottom",left:"Left",right:"Right",none:"None",alignLabel:"Alignment",align:{auto:"Auto",start:"Start",center:"Center",end:"End"},displayLabel:"Style",display:{auto:"Auto",pill:"Pills",direct:"Direct"}},numberFormatSection:{title:"Number format"},numberFormat:{abbreviationLabel:"Abbreviation",valueLabel:"Value",decimalPlacesLabel:"Decimal places",options:{auto:"Auto",custom:"Custom",none:"None"}},headlineNumberSize:{sizeLabel:"Size",valueLabel:"Value",sizes:{small:"S",medium:"M",large:"L"}},lineThickness:{label:"Line thickness"},pointSize:{label:"Point size",options:{auto:"Auto",custom:"Custom"}},headlineNumberSection:{title:"Headline number",toggle:"Visible",metricLabel:"Metric",compareWithLabel:"Compare with",metrics:{total:"Total",average:"Avg.",current:"Last",conversion:"Conversion",left:"Left"},comparison:{first:"First",previous:"Previous"},position:{above:"Above",center:"Center"}},treatEmptyValues:{leaveGap:{label:"Leave gap in chart",description:"Leaves a visible break in the line where data is missing"},fillZero:{label:"Fill with zero",description:"Displays missing data points as zero"},connectGaps:{label:"Connect across gaps",description:"Joins the line between available points, skipping the gap"}},comboChartAppearance:{title:"Combo chart appearance",groupedBars:"Grouped bars",stackedBars:"Stacked bars",linesOnly:"Lines only"}},axesPanel:{toolbarButton:"Axes",mainAxisSection:{yAxis:"Y-axis",xAxis:"X-axis"},crossAxisSection:{xAxis:"X-axis",yAxis:"Y-axis"},controls:{title:"Title",visible:"Visible",ticks:"Ticks",labels:"Labels",position:"Position",scale:"Scale",startFrom:"Start from",endAt:"End at",value:"Value",numberOfAxes:"Number of axes",reverse:"Reverse"},labelMode:{auto:"Auto",edges:"Edges"},scale:{auto:"Auto",log:"Log"},startFrom:{auto:"Auto",zero:"Zero",custom:"Custom"},endAt:{auto:"Auto",custom:"Custom"},axisCount:{single:"Single",double:"Double"},position:{left:"Left",right:"Right",top:"Top",bottom:"Bottom"},yesNo:{yes:"Yes",no:"No"}},colorPanel:{toolbarButton:"Color",themeSection:{title:"Theme"},appearanceSection:{title:"Appearance",highlightStyle:"Highlight"},paletteSection:{title:"Palette",colorScheme:"Color scheme",colors:"Colors",colorPalettes:"Color palettes"},paletteMode:{preset:"Preset",freestyle:"Freestyle"},paletteThemes:{colorful:"Colorful",pastel:"Pastel",neon:"Neon"},backgroundSection:{title:"Background",black:"Black",white:"White",grey:"Grey",tint:"Tint",custom:"Custom",none:"None"},borderSection:{title:"Border",borderColor:"Border color",thickness:"Thickness",cornerRadius:"Corner radius"},borderType:{solid:"Solid",gradient:"Gradient",grey:"Grey",preset:"Preset",custom:"Custom",none:"None"},presetGradients:{lilac:"Lilac",neonPink:"Neon Pink",blackberry:"Blackberry",sun:"Sun",iceland:"Iceland",sunset:"Sunset",ultraviolet:"Ultraviolet",purple:"Purple",iceCream:"Ice Cream",mint:"Mint",cool:"Cool",fresh:"Fresh"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Palette"},annotatePanel:{toolbarButton:"Annotate",callOutSection:{title:"Callouts",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},highlightSection:{title:"Highlight",button:"Highlight",colorLabel:"Highlight color"}},annotationsPanel:{toolbarButton:"Annotate",freeformSection:{title:"Freeform",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},goalSection:{title:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",valueAriaLabel:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:"(optional)"},trendsAndAveragesSection:{title:"Trends and Averages",trend:"Trend",average:"Average"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},averageLineSeries:{label:"Average line series",placeholder:"Select series",ariaLabel:"Series dropdown for average line"},highlightSection:{title:"Highlight",button:"Highlight",fadeColorLabel:"Fade color"},titleAndSubtitleSection:{title:"Title & Subtitle",toggleTitle:"Title",subtitle:"Subtitle"},captionAndSourceSection:{title:"Caption & Source",caption:"Caption",source:"Source",url:"URL",name:"Name"}},elementsPanel:{contentVisible:"Visible",contentValue:"Value",toolbarButton:"Elements",headerSection:{title:"Header",toggleTitle:"Title",subtitle:"Subtitle"},footerSection:{title:"Footer",caption:"Caption",source:"Source",url:"URL",name:"Name"},textSizeSection:{title:"Text size",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Font"},sourceSection:{title:"Source",url:"URL",name:"Name"}},powerUpPanel:{toolbarButton:"Power-ups",goalSection:{title:"Goal",toggle:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:" (optional)",xAxisReferenceAriaLabel:"X-axis reference value",anyXAxisValue:"Any x-axis value",selectValuePlaceholder:"Select value"},trendSection:{title:"Trend",toggle:"Trend"},averageSection:{title:"Average",toggle:"Average",seriesLabel:"Average line series",seriesPlaceholder:"Select series",seriesAriaLabel:"Series dropdown for average line"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentage",numberPlaceholder:"Number",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Highlight mode",hover:"Hover",toHighlight:"to highlight",anyElement:"any element",escToExit:"to exit",esc:"ESC"},emptyState:"No highlight options available",deleteAriaLabel:"Delete highlight",highlightStyle:{tint:"Tint",grey:"Grey"}},fineTunePanel:{toolbarButton:"Fine tune",detailSection:{title:"Detail",missingValues:"Missing values"},lineStyleSection:{title:"Line style",lineCurve:"Line curve",sharp:"Sharp",smooth:"Smooth"}},customThemeEditor:{patternDropdownAriaLabel:"Pattern dropdown for series",patterns:{solid:"Solid",pattern:"Pattern",dotted:"Dotted",dashed:"Dashed",hatched:"Hatched"},heatmapColorLabel:"Color"},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},Co={titleEditor:{titlePlaceholder:"Untitled",subtitlePlaceholder:"Add a subtitle"},toolbar:{formatting:{bold:"Bold",italic:"Italic",underline:"Underline",link:"Link"},link:{ariaLabel:"Create link",placeholder:"Type or paste a link...",submit:"Submit",urlLabel:"Link URL",apply:"Apply link"},font:{label:"Font",ariaLabel:"Font family"},heading:{label:"Heading level",ariaLabel:"Text style",text:"Text",caption:"Caption",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},textAlign:{left:"Align left",center:"Align center",right:"Align right"},color:{label:"Text color"}},colorDropdown:{colors:"Colors",chartColors:"Chart colors",custom:"Custom",opacity:"Opacity",transparent:"Transparent",pickCustom:"Pick custom color",pickColor:"Pick color"},annotations:{differenceArrowToolbar:{label:"Difference arrow options",labelKind:{ariaLabel:"Label",absoluteDifference:"Absolute change",relativeDifference:"Percentage change",proportion:"Proportion",suspectValue:"This value divides by a baseline of zero.",incomparableEnds:"The two ends measure different quantities, so a difference between them has no meaning."},color:"Arrow colour",size:{ariaLabel:"Size",small:"Small",medium:"Medium",large:"Large"},swap:"Swap direction",remove:"Remove arrow"},shapeToolbar:{label:"Shape options",color:"Shape colour",border:{ariaLabel:"Border",none:"None",thin:"Thin (2px)",medium:"Medium (8px)",thick:"Thick (16px)"},remove:"Remove shape",resize:{"top-left":"Resize from the top left","top-right":"Resize from the top right","bottom-right":"Resize from the bottom right","bottom-left":"Resize from the bottom left"}},arrowToolbar:{label:"Arrow options",color:"Arrow colour",thickness:{ariaLabel:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},startArrowhead:"Start of the arrow",endArrowhead:"End of the arrow",arrowhead:{lineArrow:"Line arrow",none:"None"},lineStyle:{ariaLabel:"Line style",solid:"Solid",dashed:"Dotted"},sticker:"Sticker effect",remove:"Remove arrow",moveEndpoint:{start:"Move the start of the arrow",end:"Move the end of the arrow"}},textToolbar:{label:"Text options",background:"Background colour",color:"Text colour",font:{ariaLabel:"Font",modern:"Modern",fresh:"Fresh",timeless:"Timeless",technical:"Technical",fineliner:"Fineliner"},fontSize:{ariaLabel:"Font size",small:"Small",medium:"Medium",large:"Large",extraLarge:"Extra Large",huge:"Huge"},align:{left:"Align left",center:"Align centre",right:"Align right"},remove:"Remove text",resize:{left:"Resize from the left",right:"Resize from the right"}},text:{editLabel:"Edit text",placeholder:"Type something"},baseMenu:{pinNumber:"Pin number",unpinNumber:"Unpin number",annotate:"Annotate",removeAnnotation:"Remove annotation",highlight:"Highlight",highlightWithLabel:e=>`Highlight ${e.label}`,removeHighlight:"Remove highlight",differenceArrow:"Difference arrow",addSticker:"Add sticker",removeSticker:"Remove sticker"},textMenu:{title:"Annotate",placeholder:"Add a comment",addButton:"Add"},highlights:{menuTitle:"Highlight",labels:{bar:"bar",barGroup:"group",barStack:"stack",barSeries:"series",line:"line",linePoint:"point",lineSeries:"series",scatterPoint:"point",scatterSeries:"series",pieSlice:"slice",pointOrBar:"point / bar",lineOrSeries:"line / series"}},stickerMenu:{title:"Add sticker"},delete:"Delete",arrow:{thickness:{label:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},arrowhead:{startPoint:"Start point",endPoint:"End point",lineArrow:"Line arrow",none:"None"},lineStyle:{label:"Line style",solid:"Solid",dotted:"Dotted"},stickerEffect:"Sticker effect",toolbarAriaLabel:"Free-form arrow toolbar",editorAriaLabel:"Arrow editor"},differenceArrow:{type:{proportion:"Proportion",difference:({absoluteDifference:e})=>`Difference (${e})`,increase:({absoluteDifference:e})=>`Increase (${e})`,decrease:({absoluteDifference:e})=>`Decrease (${e})`,percentageChange:({percentageChange:e})=>`Percentage change (${e})`,percentIncrease:({percentageChange:e})=>`Percent increase (${e})`,percentDecrease:({percentageChange:e})=>`Percent decrease (${e})`},size:{label:"Size",small:"Small",medium:"Medium",large:"Large"},flipArrow:"Flip arrow",color:"Color",toolbarAriaLabel:"Difference arrow toolbar",editorAriaLabel:"Difference arrow editor"},shape:{color:"Color",border:{label:"Border",none:"None",thin:({value:e})=>`Thin (${e})`,medium:({value:e})=>`Medium (${e})`,thick:({value:e})=>`Thick (${e})`}}}},So={common:vo,editor:bo,graph:Co},yo={colorPanel:{backgroundSection:{grey:"Gray"},borderType:{grey:"Gray"}},highlighting:{highlightStyle:{grey:"Gray"}}},jo={editor:yo},To={save:"Guardar",cancel:"Cancelar",confirm:"Confirmar",delete:"Eliminar",confirmDelete:e=>`Tem a certeza que deseja eliminar ${e.item}?`,abbreviations:{thousands:"mil",millions:"M",billions:"MM"}},wo={title:"Editor Graphy",description:"Edite o seu conteúdo aqui",graphTypes:{column:"Colunas",columnStacked:"Colunas sobrepostas",columnStackedFill:"100% Colunas sobrepostas",bar:"Barras",barStacked:"Barras sobrepostas",barStackedFill:"100% Barras sobrepostas",line:"Linha",areaStacked:"Área sobreposta",pie:"Circular",donut:"Donut",scatter:"Dispersão",bubble:"Bolhas",funnel:"Funil",combo:"Combinado",heatmap:"Mapa de Calor",waterfall:"Cascata",mekko:"Mekko",table:"Tabela"},sizePanel:{toolbarButton:"Tamanho",presetsSection:{title:"Predefinições"},customSizeSection:{title:"Tamanho personalizado"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"Publicação LinkedIn",instagram:"Publicação Instagram",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Móvel"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Gráfico",graphTypeSection:{title:"Tipo de gráfico"},mappingSection:{title:"Dados",x:"Eixo X",y:"Valor",color:"Cor",size:"Tamanho",label:"Etiqueta",none:"Nenhum"},comboSection:{title:"Aspeto do gráfico combinado",types:{"grouped-bars":"Barras agrupadas","stacked-bars":"Barras empilhadas",lines:"Apenas linhas"}},polarSection:{title:"Polar",innerRadius:"Raio interno",startAngle:"Ângulo inicial"},barSection:{title:"Barras",thickness:"Espessura da barra",rounding:"Arredondamento",roundingOptions:{none:"Nenhum",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Total"}},graphOptionsSection:{title:"Opções do gráfico"},gridSection:{title:"Grelha",horizontalGridLines:"Linhas horizontais",verticalGridLines:"Linhas verticais",rings:"Anéis",spokes:"Raios",gridStyle:"Estilo da grelha",gridThickness:"Espessura da grelha",lineStyles:{solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",stackTotals:"Totais sobrepostos",dataLabels:"Etiquetas de dados",showPercentages:"Mostrar percentagens",categoryLabels:"Etiquetas de categorias"},legendSection:{title:"Legenda",auto:"Automático",top:"Topo",bottom:"Fundo",left:"Esquerda",right:"Direita",none:"Nenhuma",alignLabel:"Alinhamento",align:{auto:"Automático",start:"Início",center:"Centro",end:"Fim"},displayLabel:"Estilo",display:{auto:"Automático",pill:"Etiquetas",direct:"No gráfico"}},numberFormatSection:{title:"Formato numérico"},numberFormat:{abbreviationLabel:"Abreviação",valueLabel:"Valor",decimalPlacesLabel:"Casas decimais",options:{auto:"Automático",custom:"Personalizado",none:"Nenhum"}},headlineNumberSize:{sizeLabel:"Tamanho",valueLabel:"Valor",sizes:{small:"P",medium:"M",large:"G"}},lineThickness:{label:"Espessura da linha"},pointSize:{label:"Tamanho do ponto",options:{auto:"Automático",custom:"Personalizado"}},headlineNumberSection:{title:"Número destaque",toggle:"Visível",metricLabel:"Métrica",compareWithLabel:"Comparar com",metrics:{total:"Total",average:"Média",current:"Último",conversion:"Conversão",left:"Esquerda"},comparison:{first:"Primeiro",previous:"Anterior"},position:{above:"Acima",center:"Centro"}},treatEmptyValues:{leaveGap:{label:"Deixar espaço no gráfico",description:"Deixa uma quebra visível na linha onde faltam dados"},fillZero:{label:"Preencher com zero",description:"Exibe pontos de dados em falta como zero"},connectGaps:{label:"Ligar através dos espaços",description:"Une a linha entre pontos disponíveis, ignorando o espaço"}},comboChartAppearance:{title:"Aparência do gráfico combinado",groupedBars:"Barras agrupadas",stackedBars:"Barras sobrepostas",linesOnly:"Apenas linhas"}},axesPanel:{toolbarButton:"Eixos",mainAxisSection:{yAxis:"Eixo Y",xAxis:"Eixo X"},crossAxisSection:{xAxis:"Eixo X",yAxis:"Eixo Y"},controls:{title:"Título",visible:"Visível",ticks:"Marcas",labels:"Etiquetas",position:"Posição",scale:"Escala",startFrom:"Iniciar de",endAt:"Terminar em",value:"Valor",numberOfAxes:"Número de eixos",reverse:"Inverter"},labelMode:{auto:"Automático",edges:"Extremos"},scale:{auto:"Automático",log:"Logarítmico"},startFrom:{auto:"Automático",zero:"Zero",custom:"Personalizado"},endAt:{auto:"Automático",custom:"Personalizado"},axisCount:{single:"Único",double:"Duplo"},position:{left:"Esquerda",right:"Direita",top:"Topo",bottom:"Fundo"},yesNo:{yes:"Sim",no:"Não"}},colorPanel:{toolbarButton:"Cor",themeSection:{title:"Tema"},appearanceSection:{title:"Aparência",highlightStyle:"Destaque"},paletteSection:{title:"Paleta",colorScheme:"Esquema de cores",colors:"Cores",colorPalettes:"Paletas de cores"},paletteMode:{preset:"Predefinido",brand:"Marca",freestyle:"Livre"},paletteThemes:{colorful:"Colorido",pastel:"Pastel",neon:"Néon"},backgroundSection:{title:"Fundo",black:"Preto",white:"Branco",grey:"Cinzento",tint:"Tonalidade",custom:"Personalizado",none:"Nenhum"},borderSection:{title:"Contorno",borderColor:"Cor do contorno",thickness:"Espessura",cornerRadius:"Raio dos cantos"},borderType:{solid:"Sólido",gradient:"Gradiente",grey:"Cinzento",preset:"Predefinido",custom:"Personalizado",none:"Nenhum"},presetGradients:{lilac:"Lilás",neonPink:"Rosa Néon",blackberry:"Amora",sun:"Sol",iceland:"Islândia",sunset:"Pôr do Sol",ultraviolet:"Ultravioleta",purple:"Roxo",iceCream:"Gelado",mint:"Menta",cool:"Frio",fresh:"Fresco"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Paleta"},annotatePanel:{toolbarButton:"Anotar",callOutSection:{title:"Destaques",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},highlightSection:{title:"Realce",button:"Realçar",colorLabel:"Cor do realce"}},annotationsPanel:{toolbarButton:"Anotar",freeformSection:{title:"Forma livre",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},goalSection:{title:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",valueAriaLabel:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:"(opcional)"},trendsAndAveragesSection:{title:"Tendências e Médias",trend:"Tendência",average:"Média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},averageLineSeries:{label:"Série da linha de média",placeholder:"Selecionar série",ariaLabel:"Dropdown de séries para linha de média"},highlightSection:{title:"Realce",button:"Realçar",fadeColorLabel:"Cor de esmaecimento"},titleAndSubtitleSection:{title:"Título e Subtítulo",toggleTitle:"Título",subtitle:"Subtítulo"},captionAndSourceSection:{title:"Legenda e Fonte",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"}},elementsPanel:{contentVisible:"Visível",contentValue:"Valor",toolbarButton:"Elementos",headerSection:{title:"Cabeçalho",toggleTitle:"Título",subtitle:"Subtítulo"},footerSection:{title:"Rodapé",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"},textSizeSection:{title:"Tamanho do texto",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Tipo de letra"},sourceSection:{title:"Fonte",url:"URL",name:"Nome"}},powerUpPanel:{toolbarButton:"Extras",goalSection:{title:"Objetivo",toggle:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:" (opcional)",xAxisReferenceAriaLabel:"Valor de referência do eixo X",anyXAxisValue:"Qualquer valor do eixo X",selectValuePlaceholder:"Selecionar valor"},trendSection:{title:"Tendência",toggle:"Tendência"},averageSection:{title:"Média",toggle:"Média",seriesLabel:"Série da linha de média",seriesPlaceholder:"Selecionar série",seriesAriaLabel:"Dropdown de séries para linha de média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentagem",numberPlaceholder:"Número",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Modo de realce",hover:"Passe",toHighlight:"para realçar",anyElement:"qualquer elemento",escToExit:"para sair",esc:"ESC"},emptyState:"Sem opções de realce disponíveis",deleteAriaLabel:"Eliminar realce",highlightStyle:{tint:"Tonalidade",grey:"Cinzento"}},fineTunePanel:{toolbarButton:"Ajuste fino",detailSection:{title:"Detalhe",missingValues:"Valores em falta"},lineStyleSection:{title:"Estilo de linha",lineCurve:"Curva da linha",sharp:"Angulosa",smooth:"Suave"}},customThemeEditor:{patternDropdownAriaLabel:"Dropdown de padrões para série",patterns:{solid:"Sólido",pattern:"Padrão",dotted:"Pontilhado",dashed:"Tracejado",hatched:"Hachurado"},heatmapColorLabel:"Cor"},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},Ao={titleEditor:{titlePlaceholder:"Sem título",subtitlePlaceholder:"Adicionar subtítulo"},toolbar:{formatting:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",link:"Ligação"},link:{ariaLabel:"Criar ligação",placeholder:"Escreva ou cole uma ligação...",submit:"Submeter",urlLabel:"URL da ligação",apply:"Aplicar ligação"},font:{label:"Tipo de letra",ariaLabel:"Família do tipo de letra"},heading:{label:"Nível de título",ariaLabel:"Estilo de texto",text:"Texto",caption:"Legenda",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3"},textAlign:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},color:{label:"Cor do texto"}},colorDropdown:{colors:"Cores",chartColors:"Cores do gráfico",custom:"Personalizado",opacity:"Opacidade",transparent:"Transparente",pickCustom:"Escolher cor personalizada",pickColor:"Escolher cor"},annotations:{differenceArrowToolbar:{label:"Opções da seta de diferença",labelKind:{ariaLabel:"Etiqueta",absoluteDifference:"Variação absoluta",relativeDifference:"Variação percentual",proportion:"Proporção",suspectValue:"Este valor divide por uma base igual a zero.",incomparableEnds:"As duas pontas medem quantidades diferentes, pelo que a diferença entre elas não tem significado."},color:"Cor da seta",size:{ariaLabel:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},swap:"Inverter sentido",remove:"Remover seta"},shapeToolbar:{label:"Opções da forma",color:"Cor da forma",border:{ariaLabel:"Contorno",none:"Nenhum",thin:"Fino (2px)",medium:"Médio (8px)",thick:"Espesso (16px)"},remove:"Remover forma",resize:{"top-left":"Redimensionar a partir do canto superior esquerdo","top-right":"Redimensionar a partir do canto superior direito","bottom-right":"Redimensionar a partir do canto inferior direito","bottom-left":"Redimensionar a partir do canto inferior esquerdo"}},arrowToolbar:{label:"Opções da seta",color:"Cor da seta",thickness:{ariaLabel:"Espessura",thin:"Fina",medium:"Média",thick:"Espessa"},startArrowhead:"Início da seta",endArrowhead:"Fim da seta",arrowhead:{lineArrow:"Ponta de seta",none:"Nenhuma"},lineStyle:{ariaLabel:"Estilo da linha",solid:"Sólida",dashed:"Pontilhada"},sticker:"Efeito autocolante",remove:"Remover seta",moveEndpoint:{start:"Mover o início da seta",end:"Mover o fim da seta"}},textToolbar:{label:"Opções do texto",background:"Cor de fundo",color:"Cor do texto",font:{ariaLabel:"Tipo de letra",modern:"Moderno",fresh:"Fresco",timeless:"Intemporal",technical:"Técnico",fineliner:"Caneta fina"},fontSize:{ariaLabel:"Tamanho da letra",small:"Pequeno",medium:"Médio",large:"Grande",extraLarge:"Muito grande",huge:"Enorme"},align:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},remove:"Remover texto",resize:{left:"Redimensionar a partir da esquerda",right:"Redimensionar a partir da direita"}},text:{editLabel:"Editar texto",placeholder:"Escreva algo"},baseMenu:{pinNumber:"Fixar número",unpinNumber:"Desafixar número",annotate:"Anotar",removeAnnotation:"Remover anotação",highlight:"Realçar",highlightWithLabel:e=>`Realçar ${e.label}`,removeHighlight:"Remover realce",differenceArrow:"Seta de diferença",addSticker:"Adicionar autocolante",removeSticker:"Remover autocolante"},textMenu:{title:"Anotar",placeholder:"Adicionar comentário",addButton:"Adicionar"},highlights:{menuTitle:"Realçar",labels:{bar:"Barra",barGroup:"Grupo",barStack:"Pilha",barSeries:"Série",line:"Linha",linePoint:"Ponto",lineSeries:"Série",scatterPoint:"Ponto",scatterSeries:"Série",pieSlice:"Fatia",pointOrBar:"Ponto / barra",lineOrSeries:"Linha / série"}},stickerMenu:{title:"Adicionar autocolante"},delete:"Eliminar",arrow:{thickness:{label:"Espessura",thin:"Fina",medium:"Média",thick:"Grossa"},arrowhead:{startPoint:"Ponto inicial",endPoint:"Ponto final",lineArrow:"Seta de linha",none:"Nenhuma"},lineStyle:{label:"Estilo de linha",solid:"Sólida",dotted:"Pontilhada"},stickerEffect:"Efeito de autocolante",toolbarAriaLabel:"Barra de ferramentas de seta livre",editorAriaLabel:"Editor de seta"},differenceArrow:{type:{proportion:"Proporção",difference:({absoluteDifference:e})=>`Diferença (${e})`,increase:({absoluteDifference:e})=>`Aumento (${e})`,decrease:({absoluteDifference:e})=>`Diminuição (${e})`,percentageChange:({percentageChange:e})=>`Variação percentual (${e})`,percentIncrease:({percentageChange:e})=>`Aumento percentual (${e})`,percentDecrease:({percentageChange:e})=>`Diminuição percentual (${e})`},size:{label:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},flipArrow:"Inverter seta",color:"Cor",toolbarAriaLabel:"Barra de ferramentas de seta de diferença",editorAriaLabel:"Editor de seta de diferença"},shape:{color:"Cor",border:{label:"Contorno",none:"Nenhum",thin:({value:e})=>`Fino (${e})`,medium:({value:e})=>`Médio (${e})`,thick:({value:e})=>`Grosso (${e})`}}}},Po={common:To,editor:wo,graph:Ao},Lo={"en-GB":So,"en-US":jo,ar:fo,"pt-PT":Po},ko=[Lo,s.dictionaries],ln=({children:e,...n})=>(0,t.jsx)(s.IntlProvider,{dictionaries:ko,...n,children:e}),Io="data-variant",sn=rn.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[Io]:e.variant}:{}}}}}),Eo=nn.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:n}=e.state;if(!n.empty)return!1;const{$from:r}=n;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),Qe=()=>[so.Text,Ae.UndoRedo,ao.Heading.configure({levels:[1,2,3]}),ro.Bold,io.Italic,uo.Underline,co.TextAlign.configure({types:["heading","paragraph"]}),lo.Link.configure({openOnClick:!1,autolink:!0}),ve.TextStyle,ve.Color,oo.HardBreak],Mo=({titlePlaceholder:e,subtitlePlaceholder:n,isTitleVisible:r,isSubtitleVisible:a})=>[No({isTitleVisible:r,isSubtitleVisible:a}),sn,...Qe(),ve.FontFamily,Eo.configure({isTitleVisible:r}),Ae.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const l=r?i.state.doc.firstChild?.nodeSize??-1:0;return a&&o===l?n:""}})],_o=({placeholder:e})=>[fe.Document,sn,...Qe(),ve.FontFamily,Ae.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],No=({isTitleVisible:e,isSubtitleVisible:n})=>e&&n?fe.Document.extend({content:"block{2,}"}):fe.Document,Ro="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",Oo="d0bl00";var cn="d0bl03",Do="d0bl04",dn="d0bl05",Be="d0bl06",zo="d0bl07",Fo="d0bl08",un="d0bl09",Ho="d0bl0a",Bo="d0bl0b",Go="d0bl0c",Vo="d0bl0d",Uo="d0bl0e",$o="owf1yg0",qo="owf1yg1",Wo="owf1yg2",Ko="owf1yg3",Xo="owf1yg4",Zo=.01,Yo=({value:e,onChange:n,label:r})=>(0,t.jsx)(q.Slider.Root,{className:$o,value:e,onValueChange:a=>n(a),min:0,max:1,step:Zo,children:(0,t.jsx)(q.Slider.Control,{className:qo,children:(0,t.jsxs)(q.Slider.Track,{className:Wo,children:[(0,t.jsx)(q.Slider.Indicator,{className:Ko}),(0,t.jsx)(q.Slider.Thumb,{className:Xo,"aria-label":r})]})})}),Jo="transparent",Ge=G.CANVAS_COLOR_KEYS.map(e=>G.vars[e]),Qo=Object.fromEntries(G.CANVAS_COLOR_KEYS.map(e=>[G.vars[e],e])),ea=e=>Ge.some(n=>pn(n,e)),ta=({color:e,onChange:n,isOpen:r,onOpenChange:a,children:o,label:i,popupAttributes:l,opacity:d,onOpacityChange:c,hasTransparentOption:h=!1})=>{const u=s.useI18n(),p=ra(),f=h?[Jo,...Ge]:Ge,g=x=>{n(x),a(!1)};return(0,t.jsxs)(B.Popover.Root,{open:r,onOpenChange:a,children:[(0,t.jsx)(B.Popover.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":i??u("graph.toolbar.color.label"),className:Oo,onMouseDown:x=>x.preventDefault(),children:o??(0,t.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,t.jsx)(B.Popover.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(B.Popover.Positioner,{sideOffset:6,align:"start",className:cn,children:(0,t.jsxs)(B.Popover.Popup,{className:Do,onMouseDown:x=>x.preventDefault(),...l,children:[(0,t.jsx)(bt,{title:u("graph.colorDropdown.colors"),colors:f,currentColor:e,onPick:g}),p.length>0&&(0,t.jsx)(bt,{title:u("graph.colorDropdown.chartColors"),colors:p,currentColor:e,onPick:g}),(0,t.jsx)(na,{value:e??"#000000",onChange:n,popupAttributes:l}),d!==void 0&&c!==void 0&&(0,t.jsxs)("div",{className:"d0bl05",children:[(0,t.jsx)("div",{className:"d0bl06",children:u("graph.colorDropdown.opacity")}),(0,t.jsx)(Yo,{value:d,onChange:c,label:u("graph.colorDropdown.opacity")})]})]})})})})]})},bt=({title:e,colors:n,currentColor:r,onPick:a})=>{const o=s.useI18n();return(0,t.jsxs)("div",{className:dn,children:[(0,t.jsx)("div",{className:Be,children:e}),(0,t.jsx)("div",{className:zo,children:n.map(i=>(0,t.jsx)("button",{type:"button","aria-label":i==="transparent"?o("graph.colorDropdown.transparent"):i,className:Fo,"data-active":pn(i,r),onMouseDown:l=>l.preventDefault(),onClick:()=>a(i),children:(0,t.jsx)("span",{className:un,style:hn(i)})},i))})]})},na=({value:e,onChange:n,popupAttributes:r})=>{const a=s.useI18n(),[o,i]=(0,v.useState)(!1),l=s.isValidCssColor(e)?e:"#000000",d=oa(l);return(0,t.jsxs)(B.Popover.Root,{open:o,onOpenChange:i,children:[(0,t.jsxs)("div",{className:dn,children:[(0,t.jsx)("div",{className:Be,children:a("graph.colorDropdown.custom")}),(0,t.jsxs)(B.Popover.Trigger,{className:Ho,onMouseDown:c=>c.preventDefault(),"aria-label":a("graph.colorDropdown.pickCustom"),children:[(0,t.jsx)("span",{className:un,style:hn(l)}),(0,t.jsx)("span",{className:Bo,children:d})]})]}),(0,t.jsx)(B.Popover.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(B.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:cn,children:(0,t.jsxs)(B.Popover.Popup,{className:Go,onMouseDown:c=>c.preventDefault(),...r,children:[(0,t.jsx)("div",{className:Be,children:a("graph.colorDropdown.pickColor")}),(0,t.jsx)(xt.HexColorPicker,{color:d,onChange:n,className:Vo}),(0,t.jsx)(xt.HexColorInput,{color:d,onChange:n,prefixed:!0,className:Uo,onMouseDown:c=>c.stopPropagation()})]})})})})]})},ra=()=>{const e=s.useCompiledSelector(n=>n.scales.color);return(0,v.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const n=new Set;for(const r of e.domain){const a=e.map(r);typeof a=="string"&&n.add(a)}return[...n]},[e])},hn=e=>e==="transparent"?{background:Ro,border:`1px solid ${G.vars.border100}`}:{background:e,border:`1px solid ${s.darkenCss(e,.1)}`},oa=e=>{const{themeValues:n}=s.useThemeContext();if(s.isHex(e))return e.toUpperCase();const r=Qo[e];return r?n[r].toUpperCase():"#000000"},pn=(e,n)=>n===null?!1:e.toLowerCase()===n.toLowerCase(),aa="l9kff0",ia="l9kff1",la="l9kff2",sa="xn24px0",ca="xn24px1",da="xn24px2",ua=({children:e,popupAttributes:n})=>(0,t.jsx)(M.Menu.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:sa,children:(0,t.jsx)(M.Menu.Popup,{className:ca,onMouseDown:r=>r.preventDefault(),...n,children:e})})})}),ha=({children:e,isSelected:n=!1,isDisabled:r=!1,onClick:a})=>(0,t.jsx)(M.Menu.Item,{className:da,"data-selected":n,disabled:r,onClick:a,children:e}),pa=({className:e,...n})=>(0,t.jsx)(te.Tooltip.Provider,{children:(0,t.jsx)(W.Toolbar.Root,{...n,className:(0,V.default)(aa,e)})}),ma=({className:e,...n})=>(0,t.jsx)(W.Toolbar.Group,{...n,className:(0,V.default)(ia,e)}),ga=({className:e,...n})=>(0,t.jsx)(W.Toolbar.Separator,{...n,className:(0,V.default)(la,e)}),xa=({children:e})=>{const n=s.resolvePortalContainer();return n===null?null:(0,en.createPortal)((0,t.jsx)(s.PortalThemeProvider,{children:e}),n)},F={Portal:xa,Root:pa,Group:ma,Separator:ga,Button:W.Toolbar.Button,ColorPicker:ta,MenuPopup:ua,MenuItem:ha},ce=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m6 9 6 6 6-6"})})}),fa="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",va=`'Aeonik', 'Aeonik Fallback', ${G.DEFAULT_FONT_FAMILY}`,ba="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",Ca="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Ve=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:G.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:va},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:fa},{id:"technical",label:"Technical",preview:"00",fontFamily:ba},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:Ca}],Sa=e=>e?Ve.find(n=>n.fontFamily===e)??null:null,mn="_70l3rt0",gn="_70l3rt1",xn="_70l3rt3",fn="_70l3rt4",vn="_70l3rt5",ya=({editor:e,currentFontFamily:n,isOpen:r,onOpenChange:a})=>{const o=s.useI18n(),i=Sa(n)??Ve[0],l=d=>{e.chain().focus().setFontFamily(d.fontFamily).run()};return(0,t.jsxs)(M.Menu.Root,{open:r,onOpenChange:a,children:[(0,t.jsxs)(M.Menu.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":o("graph.toolbar.font.ariaLabel"),className:mn,onMouseDown:d=>d.preventDefault(),children:[(0,t.jsx)("span",{className:gn,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,t.jsx)(ce,{size:"sm"})]}),(0,t.jsx)(M.Menu.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:xn,children:(0,t.jsx)(M.Menu.Popup,{className:fn,onMouseDown:d=>d.preventDefault(),children:Ve.map(d=>(0,t.jsx)(M.Menu.Item,{className:vn,"data-selected":d.id===i?.id,onClick:()=>l(d),children:(0,t.jsx)("span",{style:{fontFamily:d.fontFamily},children:d.label})},d.id))})})})})]})},bn={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:G.vars.fontTextEditorBody},Ct=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:G.vars.fontTextEditorH6},bn,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:G.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:G.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:G.vars.fontTextEditorH1}],ja=({editor:e,activeStyle:n,isOpen:r,onOpenChange:a})=>{const o=s.useI18n(),i=Ct.find(l=>l.id===n)??bn;return(0,t.jsxs)(M.Menu.Root,{open:r,onOpenChange:a,children:[(0,t.jsxs)(M.Menu.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":o("graph.toolbar.heading.ariaLabel"),className:mn,onMouseDown:l=>l.preventDefault(),children:[(0,t.jsx)("span",{className:gn,children:o(i.translationKey)}),(0,t.jsx)(ce,{size:"sm"})]}),(0,t.jsx)(M.Menu.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:xn,children:(0,t.jsx)(M.Menu.Popup,{className:fn,onMouseDown:l=>l.preventDefault(),children:Ct.map(l=>(0,t.jsx)(M.Menu.Item,{className:vn,"data-selected":l.id===i.id,onClick:()=>Ta(e,l.id),children:(0,t.jsx)(wa,{font:l.previewFont,children:o(l.translationKey)})},l.id))})})})})]})},Ta=(e,n)=>{switch(n){case"caption":e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return;case"text":e.chain().focus().setNode("paragraph",{variant:null}).run();return;case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},wa=({font:e,children:n})=>(0,t.jsx)("span",{style:{font:e,margin:0},children:n}),Cn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),Aa=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,t.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),Pa=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M18 6 6 18"}),(0,t.jsx)("path",{d:"m6 6 12 12"})]})}),La=e=>!e.content||e.content.length===0?!0:e.content.every(n=>!n.content||n.content.length===0),ka=e=>{const{$from:n}=e.state.selection,r=n.parent.textContent,a=n.parentOffset,o=n.start();let i=a;for(;i>0&&St(r[i-1]);)i-=1;let l=a;for(;l<r.length&&St(r[l]);)l+=1;return{from:o+i,to:o+l}},St=e=>e!==void 0&&/\S/.test(e),Ia="fop13s0",Ea="fop13s1",Ma="fop13s2",_a="fop13s3",yt="fop13s4",Na=({editor:e,currentUrl:n,isActive:r,isOpen:a,onOpenChange:o})=>{const i=s.useI18n(),[l,d]=(0,v.useState)(""),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{a&&d(n??"")},[a,n]);const h=()=>{Ra(e,l),o(!1)},u=()=>{d(""),o(!1)},p=g=>{d(g.target.value)},f=g=>{g.key==="Enter"&&(g.preventDefault(),h())};return(0,t.jsxs)(B.Popover.Root,{open:a,onOpenChange:o,children:[(0,t.jsx)(B.Popover.Trigger,{render:(0,t.jsx)(W.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:Ia,onMouseDown:g=>g.preventDefault(),children:(0,t.jsx)(Aa,{})}),(0,t.jsx)(B.Popover.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(B.Popover.Positioner,{sideOffset:6,align:"end",className:Ea,children:(0,t.jsxs)(B.Popover.Popup,{className:Ma,initialFocus:c,onMouseDown:g=>g.preventDefault(),children:[(0,t.jsx)("input",{ref:c,type:"url",value:l,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:_a,onMouseDown:g=>g.stopPropagation(),onChange:p,onKeyDown:f}),(0,t.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:yt,onClick:u,children:(0,t.jsx)(Pa,{})}),(0,t.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:yt,onClick:h,children:(0,t.jsx)(Cn,{})})]})})})})]})},Ra=(e,n)=>{const r=n.trim(),{selection:a}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!a.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=ka(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Sn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 5H3"}),(0,t.jsx)("path",{d:"M17 12H7"}),(0,t.jsx)("path",{d:"M19 19H5"})]})}),yn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 5H3"}),(0,t.jsx)("path",{d:"M21 12H9"}),(0,t.jsx)("path",{d:"M21 19H7"})]})}),jn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 5H3"}),(0,t.jsx)("path",{d:"M15 12H3"}),(0,t.jsx)("path",{d:"M17 19H3"})]})}),Oa="_1d66w570",Da="_1d66w571",za=6,ne=({label:e,isActive:n,onToggle:r,children:a})=>{const o=i=>i.preventDefault();return(0,t.jsxs)(te.Tooltip.Root,{children:[(0,t.jsx)(te.Tooltip.Trigger,{render:(0,t.jsx)(ho.Toggle,{render:(0,t.jsx)(W.Toolbar.Button,{}),pressed:n,onPressedChange:()=>r()}),"aria-label":e,className:Oa,onMouseDown:o,children:a}),(0,t.jsx)(te.Tooltip.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(te.Tooltip.Positioner,{sideOffset:za,children:(0,t.jsx)(te.Tooltip.Popup,{className:Da,children:e})})})})]})},Fa=({editor:e,activeAlignment:n="left"})=>{const r=s.useI18n();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ne,{label:r("graph.toolbar.textAlign.left"),isActive:n==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,t.jsx)(jn,{})}),(0,t.jsx)(ne,{label:r("graph.toolbar.textAlign.center"),isActive:n==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,t.jsx)(Sn,{})}),(0,t.jsx)(ne,{label:r("graph.toolbar.textAlign.right"),isActive:n==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,t.jsx)(yn,{})})]})},Ha="_1u34vl40",Ba=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:Ga(e),textAlign:Va(e)}),Ga=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",Va=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Ua=8,$a=8,qa=({editor:e})=>{const n=s.useI18n(),[r,a]=(0,v.useState)(!1),[o,i]=(0,v.useState)(null),l=o!==null,d=g=>x=>{i(x?g:null)},{refs:c,floatingStyles:h}=(0,ae.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,ae.offset)(Ua),(0,ae.flip)(),(0,ae.shift)({padding:$a})],whileElementsMounted:ae.autoUpdate}),u=(0,v.useRef)(null),p=(0,Pe.useEditorState)({editor:e,selector:Ba}),f=(0,v.useCallback)(g=>{u.current=g,c.setFloating(g)},[c]);return(0,v.useEffect)(()=>{e&&c.setReference(e.view.dom)},[e,c]),(0,v.useEffect)(()=>{if(!e)return;const g=()=>a(!0),x=({event:b})=>{const{relatedTarget:T,currentTarget:w}=b,y=T instanceof Node&&u.current?.contains(T),P=T instanceof Node&&w instanceof Node&&w.contains(T);!y&&!P&&a(!1)};return e.on("focus",g),e.on("blur",x),()=>{e.off("focus",g),e.off("blur",x)}},[e]),!e||!r&&!l?null:(0,t.jsx)(F.Portal,{children:(0,t.jsxs)(F.Root,{ref:f,className:Ha,style:h,children:[(0,t.jsxs)(F.Group,{children:[(0,t.jsx)(F.ColorPicker,{color:p?.color??null,onChange:g=>e.chain().setColor(g).run(),isOpen:o==="color",onOpenChange:d("color")}),(0,t.jsx)(ya,{editor:e,currentFontFamily:p?.fontFamily??null,isOpen:o==="fontFamily",onOpenChange:d("fontFamily")})]}),(0,t.jsx)(F.Separator,{}),(0,t.jsx)(F.Group,{children:(0,t.jsx)(ja,{editor:e,activeStyle:p?.fontSize??"text",isOpen:o==="fontSize",onOpenChange:d("fontSize")})}),(0,t.jsx)(F.Separator,{}),(0,t.jsxs)(F.Group,{children:[(0,t.jsx)(ne,{label:n("graph.toolbar.formatting.bold"),isActive:p?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,t.jsx)("strong",{children:"B"})}),(0,t.jsx)(ne,{label:n("graph.toolbar.formatting.italic"),isActive:p?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,t.jsx)("em",{children:"I"})}),(0,t.jsx)(ne,{label:n("graph.toolbar.formatting.underline"),isActive:p?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,t.jsx)("u",{children:"U"})})]}),(0,t.jsx)(F.Separator,{}),(0,t.jsx)(F.Group,{children:(0,t.jsx)(Fa,{editor:e,activeAlignment:p?.textAlign})}),(0,t.jsx)(F.Separator,{}),(0,t.jsx)(F.Group,{children:(0,t.jsx)(Na,{editor:e,currentUrl:p?.linkUrl??null,isActive:p?.isLink??!1,isOpen:o==="link",onOpenChange:d("link")})})]})})},Wa="_1uy50v30",Tn=({editor:e,ariaLabel:n})=>(0,t.jsxs)("div",{className:Wa,children:[(0,t.jsx)(qa,{editor:e}),(0,t.jsx)(Pe.EditorContent,{editor:e,"aria-label":n})]}),Ka=200,et=({content:e,extensions:n,isEditable:r,onUpdate:a,updateDebounceMs:o=Ka})=>{const i=(0,v.useRef)(jt(e)),l=(0,v.useRef)(i.current),d=s.useDebouncedCallback(h=>{l.current=h,a?.(h)},o),c=(0,Pe.useEditor)({extensions:n,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const u=h.getJSON();if(Oe(l.current,u))return d.cancel();d.run(u)}});return(0,v.useEffect)(()=>{c?.setEditable(r)},[c,r]),(0,v.useEffect)(()=>{if(!c)return;const h=jt(e);Oe(l.current,h)||(l.current=h,!Oe(c.getJSON(),h)&&(d.cancel(),Xa(c,h)))},[c,e,d]),(0,v.useEffect)(()=>()=>d.flush(),[d]),c},jt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Xa=(e,n)=>{const{from:r,to:a}=e.state.selection;e.commands.setContent(n,{emitUpdate:!1});const o=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,o),to:Math.min(a,o)})},Oe=(e,n)=>JSON.stringify(be(e))===JSON.stringify(be(n)),be=e=>Array.isArray(e)?e.map(be):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,be(r)]).filter(([,n])=>!Za(n)).sort(([n],[r])=>String(n).localeCompare(String(r)))),Za=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,Ya=({caption:e})=>{const{dispatch:n}=s.useGraphCommands();return(0,t.jsx)(Tn,{editor:et({content:e,extensions:(0,v.useMemo)(()=>_o({placeholder:"Add caption"}),[]),isEditable:!0,onUpdate:r=>{const a=La(r)?null:r;n(new m.SetContentCaptionCommand({caption:a}))}}),ariaLabel:"Chart caption"})},Ja=e=>[fe.Document,rn.Paragraph,...Qe(),ei,Ae.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],Qa=({annotation:e})=>{const n=s.useI18n(),{dispatch:r}=s.useGraphCommands(),a=s.useEditorStore(),o=(0,v.useMemo)(()=>Ja(n("graph.annotations.text.placeholder")),[n]),i=et({content:e.content,extensions:o,isEditable:!0,onUpdate:l=>{r(new m.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:l}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:l}=a.getState();return l(i),()=>l(null)},[i,a]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,t.jsx)(Pe.EditorContent,{"aria-label":n("graph.annotations.text.editLabel"),className:s.editor,editor:i,"data-testid":"text-annotation-editor"})},Tt=e=>{const n=s.resolveRichTextFontFamily(e);return n===void 0?{}:{style:`font-family: ${n}`}},ei=nn.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Tt(e.fontFamily)},font:{default:null,renderHTML:e=>Tt(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: ${e.fontSize/10}em`}:{}}}}]}}),ti=3,ni=({title:e,isTitleVisible:n,subtitle:r,isSubtitleVisible:a})=>{const o=[];return n&&o.push({type:"heading",attrs:{level:ti},content:oi(e)}),a&&o.push(...ai(r)),{type:"doc",content:o}},ri=e=>{const[n,...r]=e.content??[];return{title:ii(n?.content??[]),subtitle:li(r)}},tt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(tt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),oi=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(n=>n.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],ai=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(wt):[wt(e)],wt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},ii=e=>{if(e.length===0)return null;const[n]=e;return n&&e.length===1&&n.type==="text"&&(!n.marks||n.marks.length===0)?n.text??null:{type:"paragraph",content:e.map(tt)}},li=e=>{const n=e.filter(a=>(a.content??[]).length>0);if(n.length===0)return null;const[r]=n;if(r&&n.length===1&&r.type==="paragraph"){const a=r.content??[],[o]=a;if(o&&a.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:n.map(tt)}},si=({title:e,isTitleVisible:n,isSubtitleVisible:r,subtitle:a})=>{const{dispatch:o}=s.useGraphCommands(),i=(0,v.useMemo)(()=>Mo({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:n,isSubtitleVisible:r}),[n,r]);return(0,t.jsx)(Tn,{editor:et({content:(0,v.useMemo)(()=>ni({title:e,isTitleVisible:n,subtitle:a,isSubtitleVisible:r}),[e,n,a,r]),extensions:i,isEditable:!0,onUpdate:l=>{const d=ri(l);n&&o(new m.SetContentTitleCommand({title:d.title})),r&&o(new m.SetContentSubtitleCommand({subtitle:d.subtitle}))}}),ariaLabel:"Chart title and subtitle"})},ci={Title:si,Caption:Ya,TextAnnotation:Qa},di="data-graphy-chart-chrome",ui="data-graphy-chart-menu",wn={[ui]:""},Le=e=>({[di]:e}),xe=(e,n)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(n)}"]`)!==null,hi=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,Ue=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,An=(e,n,r)=>r!==null&&(0,m.isPointWithinEditMenuTrigger)({x:e.clientX-n.x,y:e.clientY-n.y},r),se=(e,n,r)=>e instanceof Node&&(n.contains(e)||xe(e,r)),pi="cml7ha0",Pn=(0,v.createContext)(null),mi=({children:e})=>{const{chartId:n}=s.useGraphContext(),[r]=(0,v.useState)(s.resolvePortalContainer),[a,o]=(0,v.useState)(null);return r===null?null:(0,t.jsxs)(t.Fragment,{children:[(0,en.createPortal)((0,t.jsx)("div",{ref:o,className:pi,...Le(n)}),r),(0,t.jsx)(Pn.Provider,{value:a,children:e})]})},nt=()=>(0,v.useContext)(Pn),Ln=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",opacity:".12"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M3.325 3.156a.836.836 0 0 0-.836.836v6.832c0 .462.375.836.836.836h2.131a.5.5 0 0 1 .352.145L8 13.975l2.193-2.17a.5.5 0 0 1 .352-.145h2.13a.84.84 0 0 0 .836-.836V3.992a.84.84 0 0 0-.836-.836zm-1.836.836c0-1.014.822-1.836 1.836-1.836h9.35c1.015 0 1.836.825 1.836 1.836v6.832a1.84 1.84 0 0 1-1.836 1.836H10.75l-2.398 2.374a.5.5 0 0 1-.704 0L5.25 12.66H3.325a1.836 1.836 0 0 1-1.836-1.836z",clipRule:"evenodd"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M8 4.505a.5.5 0 0 1 .5.5v2.172h2.171a.5.5 0 0 1 0 1H8.5v2.171a.5.5 0 0 1-1 0V8.177H5.329a.5.5 0 0 1 0-1H7.5V5.005a.5.5 0 0 1 .5-.5",clipRule:"evenodd"})]});var kn="efjmb40",In="efjmb41",J="efjmb42",Q="efjmb43",gi="efjmb44",xi="efjmb45",fi=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),rt=({label:e,icon:n,onOpened:r,children:a})=>{const o=nt(),[i,l]=(0,v.useState)(!1),d=(c,h)=>{c?(l(!0),r?.()):fi.has(h.reason)&&l(!1)};return(0,t.jsxs)(X.Menu.SubmenuRoot,{open:i,onOpenChange:d,children:[(0,t.jsx)(vi,{label:e,icon:n}),(0,t.jsx)(X.Menu.Portal,{container:o,children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(X.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:kn,...wn,children:(0,t.jsx)(X.Menu.Popup,{className:In,children:a})})})})]})},vi=({label:e,icon:n})=>(0,t.jsxs)(X.Menu.SubmenuTrigger,{className:J,openOnHover:!1,children:[n,(0,t.jsx)("span",{className:Q,children:e}),(0,t.jsx)("span",{className:xi,children:(0,t.jsx)(ce,{size:"sm"})})]}),bi="_1qe7q450",Ci="_1qe7q451",Si="_1qe7q452",yi=({label:e,placeholder:n,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,v.useRef)(null),[l,d]=(0,v.useState)(""),{dispatch:c}=s.useGraphCommands(),h=l.trim(),u=()=>{h.length!==0&&(c(new m.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:ji(h)}})),o())},p=x=>{x.key==="Enter"&&(x.preventDefault(),u()),x.key!=="Escape"&&x.stopPropagation()},f=x=>{d(x.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,t.jsx)(rt,{label:e,icon:(0,t.jsx)(Ln,{}),onOpened:g,children:(0,t.jsxs)("div",{className:bi,children:[(0,t.jsx)("input",{ref:i,className:Ci,value:l,placeholder:n,onChange:f,onKeyDown:p}),(0,t.jsx)("button",{type:"button",className:Si,disabled:h.length===0,onClick:u,children:r})]})})},ji=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Ti=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 15 14",...e,children:(0,t.jsx)("path",{d:"M14.0146 5.20703C14.2118 5.40459 14.2121 5.72447 14.0146 5.92187L12.3291 7.6084C12.2343 7.70313 12.1047 7.75579 11.9707 7.75586C11.8369 7.75573 11.708 7.70291 11.6133 7.6084L9.92773 5.92187C9.73024 5.72438 9.73031 5.40457 9.92773 5.20703C10.1253 5.0095 10.445 5.0095 10.6426 5.20703L11.4658 6.03027L11.4658 1.68652L7.75586 1.68652L7.75586 12.6455C7.75563 12.9246 7.5291 13.1512 7.25 13.1514L2.5293 13.1514C2.2501 13.1514 2.02367 12.9247 2.02344 12.6455L2.02344 5.00781C0.868958 4.77348 0.000106647 3.7528 -1.10559e-07 2.5293C-4.95071e-08 1.13259 1.13261 9.74645e-05 2.5293 -5.23256e-07C3.92588 0.000220668 5.05859 1.13267 5.05859 2.5293C5.05849 3.75251 4.1892 4.77219 3.03516 5.00684L3.03516 12.1396L6.74414 12.1396L6.74414 1.18066C6.74414 0.901394 6.97076 0.674939 7.25 0.674804L11.9707 0.674805C12.2499 0.674939 12.4766 0.901394 12.4766 1.18066L12.4766 6.03027L13.2998 5.20703C13.4973 5.0095 13.8171 5.0095 14.0146 5.20703ZM4.04687 2.5293C4.04687 1.69137 3.36717 1.01194 2.5293 1.01172C1.69132 1.01182 1.01172 1.6913 1.01172 2.5293C1.01184 3.36719 1.6914 4.04678 2.5293 4.04687C3.36709 4.04665 4.04675 3.36712 4.04687 2.5293ZM14.5 11.2969C14.4998 12.6935 13.3673 13.8262 11.9707 13.8262C10.5742 13.826 9.4416 12.6934 9.44141 11.2969C9.44141 9.90018 10.574 8.7677 11.9707 8.76758C13.3675 8.76758 14.5 9.90011 14.5 11.2969ZM13.4883 11.2969C13.4883 10.4588 12.8088 9.7793 11.9707 9.7793C11.1327 9.77942 10.4531 10.4589 10.4531 11.2969C10.4533 12.1347 11.1329 12.8143 11.9707 12.8145C12.8086 12.8145 13.4881 12.1348 13.4883 11.2969Z",fill:"currentColor",fillOpacity:"0.8"})}),wi="relative-difference",Ai=({label:e,layer:n,at:r,onRequestClose:a})=>{const{dispatch:o}=s.useGraphCommands(),i=s.useCompiledSelector(c=>c.coordSystem),l=(0,v.useMemo)(()=>(0,m.inferDifferenceArrowEndpoints)({layer:n,at:r,coordSystem:i}),[n,r,i]);if(l===null)return null;const d=()=>{o(new m.AddAnnotationCommand({kind:"differenceArrow",annotation:{...m.DIFFERENCE_ARROW_DEFAULTS,...l,label:wi}})),a()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:d,children:[(0,t.jsx)(Ti,{}),(0,t.jsx)("span",{className:Q,children:e})]})};function Pi(e,n){if(e.type==="polar"&&!Li(n))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,m.hasMultipleGroups)(n.data,n.mapping);switch(n.geom){case"bar":{const a=[{scope:"data-point",labelKey:"bar"}];if(r){const o=n.position==="stack"||n.position==="fill";a.push({scope:"x-value",labelKey:o?"barStack":"barGroup"}),a.push({scope:"series",labelKey:"barSeries"})}return a}case"line":case"area":{const a=[{scope:"data-point",labelKey:"linePoint"}];return r&&a.push({scope:"series",labelKey:"lineSeries"}),a}case"point":{const a=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&a.push({scope:"series",labelKey:"scatterSeries"}),a}default:return[]}}var Li=e=>{const n=(0,m.extractVariableName)(e.mapping.x);return n!==null&&n!==m.CONSTANT_VARIABLES.x},ki=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Ii=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Ei=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),Mi=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),_i=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:".8",strokeWidth:"1.163",d:"m-1.618 15.96 9.118-5.3 11 2.34"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",stroke:"currentColor",strokeOpacity:"0.3",d:"M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,t.jsx)("rect",{width:"9.795",height:"6",x:"3",y:"2",fill:"currentColor",fillOpacity:"0.3",rx:"1.513"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.29 6.62a1.3 1.3 0 0 1-.424-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.262-.45 2.1 2.1 0 0 1-.096-.699q0-.389.082-.693.083-.304.238-.514a1.05 1.05 0 0 1 .374-.322q.22-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.321-.105.54.54 0 0 0-.485.273q-.168.273-.17.75h.021a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .813.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.571.134m-.003-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.07-.294.54.54 0 0 0-.484-.285.55.55 0 0 0-.403.173.596.596 0 0 0 .108.914.53.53 0 0 0 .288.08M6.88 6.579v-.396l1.05-1.03q.15-.15.25-.27a1 1 0 0 0 .151-.229.6.6 0 0 0 .05-.236.432.432 0 0 0-.244-.405.6.6 0 0 0-.258-.056q-.15 0-.261.062a.43.43 0 0 0-.175.173.56.56 0 0 0-.06.267H6.86q0-.288.132-.5a.9.9 0 0 1 .362-.33q.231-.117.532-.117.303 0 .534.114.23.114.358.312a.8.8 0 0 1 .128.452.9.9 0 0 1-.065.334q-.065.164-.229.363-.162.2-.456.483l-.522.53v.021h1.318v.458zM10.57 6.62a1.3 1.3 0 0 1-.423-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.263-.45 2.1 2.1 0 0 1-.096-.699q0-.389.083-.693t.238-.514a1.05 1.05 0 0 1 .374-.322q.219-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.322-.105.54.54 0 0 0-.484.273q-.168.273-.17.75h.02a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .814.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.572.134m-.002-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.071-.294.54.54 0 0 0-.483-.285.54.54 0 0 0-.403.173.597.597 0 0 0 .107.914.53.53 0 0 0 .289.08"})]}),Ni=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:".993",d:"M1.5 12 6 6.5l4 3.5 4-5.5"}),(0,t.jsx)("circle",{cx:"1.493",cy:"11.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"5.993",cy:"6.493",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"9.993",cy:"9.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"13.993",cy:"4.493",r:".993",fill:"currentColor",fillOpacity:"0.8"})]}),Ri=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Oi=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Di=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,t.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),zi={bar:ki,barGroup:Ii,barStack:Mi,barSeries:Ei,linePoint:_i,lineSeries:Ni,scatterPoint:Oi,scatterSeries:Di,pieSlice:Ri},En=({labelKey:e})=>{const n=zi[e];return(0,t.jsx)(n,{})},Mn=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M5.01683 15.3331C4.84407 15.3343 4.67292 15.2997 4.51421 15.2314C4.3555 15.1632 4.21268 15.0627 4.09476 14.9365L3.88656 14.7283L3.62877 14.8968L3.19253 15.3331H0L2.24072 13.0923L2.03251 12.8445C1.89423 12.7191 1.78392 12.566 1.70875 12.3952C1.63359 12.2244 1.59526 12.0396 1.59626 11.853C1.59579 11.6818 1.63078 11.5124 1.69904 11.3554C1.76729 11.1984 1.86733 11.0573 1.99285 10.9409L11.2036 1.73012C11.3215 1.60384 11.4643 1.5034 11.623 1.43514C11.7817 1.36688 11.9529 1.33228 12.1257 1.33353C12.2969 1.33245 12.4665 1.36716 12.6236 1.43546C12.7807 1.50375 12.9218 1.60412 13.0378 1.73012L15.1496 3.92126C15.2748 4.03899 15.3745 4.1811 15.4427 4.33882C15.5108 4.49654 15.546 4.66655 15.546 4.83837C15.546 5.01019 15.5108 5.1802 15.4427 5.33792C15.3745 5.49564 15.2748 5.63774 15.1496 5.75548L5.93889 14.9662C5.81806 15.0866 5.67403 15.1812 5.51552 15.2443C5.35702 15.3074 5.18736 15.3376 5.01683 15.3331ZM2.48858 11.9125L5.01683 14.4407L9.47843 9.97913L6.95019 7.4608L2.48858 11.9125ZM7.68388 6.72712L10.2022 9.24544L14.644 4.80367L12.1257 2.28534L7.68388 6.72712Z",fill:"currentColor",fillOpacity:"0.8"})]}),Fi=({label:e,options:n,onSelect:r})=>{const a=s.useI18n();return(0,t.jsx)(rt,{label:e,icon:(0,t.jsx)(Mn,{}),children:n.map(o=>(0,t.jsxs)(X.Menu.Item,{className:J,onClick:()=>r(o.scope),children:[(0,t.jsx)(En,{labelKey:o.labelKey}),(0,t.jsx)("span",{className:Q,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},Hi=({label:e,layer:n,observation:r,highlights:a,onRequestClose:o})=>{const i=s.useI18n(),{dispatch:l}=s.useGraphCommands(),d=s.useCompiledSelector(g=>g.coordSystem),c=(0,v.useMemo)(()=>(0,m.buildObservationPredicate)(n,r),[n,r]),h=(0,v.useMemo)(()=>Pi(d,n),[d,n]),u=(0,v.useMemo)(()=>{const g=new Set(a.map(x=>x.scope));return h.filter(x=>!g.has(x.scope))},[h,a]),[p]=u;if(c===null||p===void 0)return null;const f=g=>{l(new m.AddHighlightCommand({predicate:c,scope:g,layerId:n.id})),o()};if(u.length===1){const g=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${p.labelKey}`)});return(0,t.jsxs)(X.Menu.Item,{className:J,onClick:()=>f(p.scope),children:[(0,t.jsx)(En,{labelKey:p.labelKey}),(0,t.jsx)("span",{className:Q,children:g})]})}return(0,t.jsx)(Fi,{label:e,options:u,onSelect:f})},Bi="_1aafi1g0",Gi="_1aafi1g1",_n=({children:e})=>(0,t.jsxs)("span",{className:Bi,"aria-hidden":"true",children:[e,(0,t.jsx)("span",{className:Gi})]}),Vi=({label:e,highlights:n,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=n.at(-1);if(o===void 0)return null;const i=()=>{a(new m.RemoveHighlightCommand({id:o.id})),r()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:i,children:[(0,t.jsx)(_n,{children:(0,t.jsx)(Mn,{})}),(0,t.jsx)("span",{className:Q,children:e})]})},Ui=(e,n)=>{const r=s.useCompiledSelector(o=>o.spec.highlights),a=s.useCompiledSelector(o=>o.config.parsingLocale);return(0,v.useMemo)(()=>(0,m.findHighlightsAtObservation)({layer:e,highlights:r,observation:n,parsingLocale:a}),[e,r,n,a])},Nn=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{opacity:"0.12",d:"M13.5948 4.29016C13.8724 6.22367 12.5301 8.01618 10.5966 8.29384C8.66309 8.57151 6.87058 7.22918 6.59292 5.29567C6.31525 3.36216 7.65758 1.56965 9.59109 1.29198C11.5246 1.01432 13.3171 2.35665 13.5948 4.29016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.71886 3.51052C6.25611 1.3626 8.43287 0.0568985 10.5808 0.594151C12.7287 1.1314 14.0344 3.30817 13.4972 5.45609C13.0316 7.31748 11.3347 8.54637 9.49237 8.49145L7.50898 12.492C7.46485 12.581 7.40179 12.6548 7.32702 12.7108C7.20005 12.8073 7.03703 12.8532 6.87248 12.8303C6.80957 12.822 6.74697 12.8038 6.68687 12.7749C6.39369 12.6342 6.26689 12.2915 6.3923 11.9963L7.63393 7.97371C6.10249 7.10872 5.27136 5.29962 5.71886 3.51052ZM10.2785 1.80253C8.79799 1.4322 7.29756 2.33222 6.92723 3.81277C6.55691 5.29332 7.45692 6.79375 8.93747 7.16408C10.418 7.5344 11.9185 6.63439 12.2888 5.15384C12.6591 3.67329 11.7591 2.17285 10.2785 1.80253Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M5.42977 11.1572C5.70072 11.104 5.8772 10.8411 5.82393 10.5702C5.77067 10.2992 5.50784 10.1227 5.23688 10.176C4.31848 10.3565 3.57421 10.6423 3.04695 11.0266C2.51409 11.4149 2.16666 11.936 2.16666 12.557C2.16666 13.0322 2.41215 13.4327 2.74425 13.7433C3.07553 14.0531 3.52776 14.3091 4.04484 14.5137C5.08193 14.9239 6.48048 15.1666 7.99999 15.1666C9.5195 15.1666 10.9181 14.9239 11.9551 14.5137C12.4722 14.3091 12.9244 14.0531 13.2557 13.7433C13.5878 13.4327 13.8333 13.0322 13.8333 12.557C13.8333 11.936 13.4859 11.4149 12.953 11.0266C12.4258 10.6423 11.6815 10.3565 10.7631 10.176C10.4921 10.1227 10.2293 10.2992 10.176 10.5702C10.1228 10.8411 10.2993 11.104 10.5702 11.1572C11.4079 11.3219 11.997 11.5672 12.364 11.8347C12.7255 12.0981 12.8333 12.3496 12.8333 12.557C12.8333 12.6643 12.7803 12.8187 12.5727 13.013C12.3642 13.2079 12.0354 13.4065 11.5873 13.5838C10.6941 13.9371 9.426 14.1666 7.99999 14.1666C6.57398 14.1666 5.30586 13.9371 4.41267 13.5838C3.9646 13.4065 3.63578 13.2079 3.4273 13.013C3.21964 12.8187 3.16666 12.6643 3.16666 12.557C3.16666 12.3496 3.2745 12.0981 3.63595 11.8347C4.00299 11.5672 4.59206 11.3219 5.42977 11.1572Z",fill:"currentColor",fillOpacity:"0.8"})]}),$i=({label:e,at:n,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=()=>{a(new m.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:n}})),r()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:o,children:[(0,t.jsx)(Nn,{}),(0,t.jsx)("span",{className:Q,children:e})]})},Rn=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{opacity:"0.12",d:"M1.33334 8.00016C1.33334 4.31826 4.31811 1.3335 8.00001 1.3335C11.6819 1.3335 14.6667 4.31826 14.6667 8.00016C14.6667 11.6821 11.6819 14.6668 8.00001 14.6668C4.31811 14.6668 1.33334 11.6821 1.33334 8.00016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M5.7328 9.69963C5.56696 9.47884 5.25352 9.43429 5.03273 9.60013C4.81193 9.76598 4.76739 10.0794 4.93323 10.3002C5.63175 11.2302 6.74548 11.8333 7.99993 11.8333C9.25438 11.8333 10.3681 11.2302 11.0666 10.3002C11.2325 10.0794 11.1879 9.76598 10.9671 9.60013C10.7463 9.43429 10.4329 9.47884 10.2671 9.69963C9.74929 10.3889 8.92657 10.8333 7.99993 10.8333C7.07329 10.8333 6.25057 10.3889 5.7328 9.69963Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M6.66668 6.66658C6.66668 7.03478 6.3682 7.33325 6.00001 7.33325C5.63182 7.33325 5.33334 7.03478 5.33334 6.66658C5.33334 6.29839 5.63182 5.99992 6.00001 5.99992C6.3682 5.99992 6.66668 6.29839 6.66668 6.66658Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{d:"M10 7.33325C10.3682 7.33325 10.6667 7.03478 10.6667 6.66658C10.6667 6.29839 10.3682 5.99992 10 5.99992C9.63182 5.99992 9.33334 6.29839 9.33334 6.66658C9.33334 7.03478 9.63182 7.33325 10 7.33325Z",fill:"currentColor",fillOpacity:"0.8"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00001 0.833252C4.04197 0.833252 0.833344 4.04188 0.833344 7.99992C0.833344 11.958 4.04197 15.1666 8.00001 15.1666C11.9581 15.1666 15.1667 11.958 15.1667 7.99992C15.1667 4.04188 11.9581 0.833252 8.00001 0.833252ZM14.1667 7.99992C14.1667 11.4057 11.4058 14.1666 8.00001 14.1666C4.59425 14.1666 1.83334 11.4057 1.83334 7.99992C1.83334 4.59416 4.59425 1.83325 8.00001 1.83325C11.4058 1.83325 14.1667 4.59416 14.1667 7.99992Z",fill:"currentColor",fillOpacity:"0.8"})]}),On={pinnedNumber:{icon:Nn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:Ln,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Rn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},qi=e=>(0,m.isObservationAttachmentKind)(e.kind)&&On[e.kind]!==null,Wi=({attachment:e,onRequestClose:n})=>{const r=s.useI18n(),{dispatch:a}=s.useGraphCommands(),{icon:o,labelKey:i}=On[e.kind],l=()=>{a(new m.RemoveAnnotationCommand({id:e.annotation.id})),n()};return(0,t.jsxs)(M.Menu.Item,{className:J,onClick:l,children:[(0,t.jsx)(_n,{children:(0,t.jsx)(o,{})}),(0,t.jsx)("span",{className:Q,children:r(i)})]})},Ki="ceeojg0",Xi="ceeojg1",Zi="ceeojg2",Yi=({label:e,at:n,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=i=>{a(new m.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...n},sticker:i}})),r()};return(0,t.jsx)(rt,{label:e,icon:(0,t.jsx)(Rn,{}),children:(0,t.jsx)("div",{className:Ki,children:Object.entries(s.STICKER_ASSETS).map(([i,l])=>(0,t.jsx)(X.Menu.Item,{className:Xi,"aria-label":i,onClick:()=>o(i),children:(0,t.jsx)("img",{className:Zi,src:l.src,alt:i})},i))})})},Ji=({interaction:e,panelOrigin:n})=>{const r=s.useEditorStore(),a=s.useEditorState(i=>i.menuTrigger);if(e.kind!=="menu"||a===null)return null;const o=()=>{r.getState().releaseInteraction("menu")};return(0,t.jsx)(Qi,{trigger:{x:n.x+a.center.x,y:n.y+a.center.y,radius:a.radius},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:o})},Qi=({trigger:e,layer:n,at:r,observation:a,onClose:o})=>{const i=s.useI18n(),l=nt(),d=s.useCompiledSelector(y=>y.spec.annotations),c=s.useCompiledSelector(y=>y.config.parsingLocale),h=tl(),{x:u,y:p,radius:f}=e,g=(0,v.useMemo)(()=>el(u,p,f),[u,p,f]),x=(0,m.findObservationAttachment)(d,r,(0,v.useMemo)(()=>(0,m.createObservationAnchorParser)(n,c),[n,c])),b=x!==null&&qi(x)?x:null,T=Ui(n,a),w=(y,P)=>{!y&&nl(P.reason)&&o()};return(0,t.jsx)(M.Menu.Root,{open:h,modal:!1,onOpenChange:w,children:(0,t.jsx)(M.Menu.Portal,{container:l,children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)(M.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:kn,...wn,children:(0,t.jsxs)(M.Menu.Popup,{className:In,"data-testid":"observation-menu",children:[b!==null&&(0,t.jsx)(Wi,{attachment:b,onRequestClose:o}),(0,t.jsx)(Vi,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:T,onRequestClose:o}),(0,t.jsx)(M.Menu.Separator,{className:gi}),b===null&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($i,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:o}),(0,t.jsx)(yi,{label:i("graph.annotations.baseMenu.annotate"),placeholder:i("graph.annotations.textMenu.placeholder"),addLabel:i("graph.annotations.textMenu.addButton"),at:r,onRequestClose:o}),(0,t.jsx)(Yi,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:o})]}),n.highlight!==null&&(0,t.jsx)(Hi,{label:i("graph.annotations.baseMenu.highlight"),layer:n,observation:a,highlights:T,onRequestClose:o}),(0,t.jsx)(Ai,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:n,at:r,onRequestClose:o})]})})})})})},el=(e,n,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,n-r,r*2,r*2)}),tl=()=>{const[e,n]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{n(!0)},[]),e},nl=e=>e==="outside-press"||e==="escape-key"||e==="item-press",ot="l8tsqe0",Dn=["start","end"],zn=({anchor:e,point:n,delta:r})=>{const a={x:At(n.x,r.x),y:At(1-n.y,r.y)};return{anchor:{...e,x:e.x+a.x,y:e.y+a.y},point:{x:n.x+a.x,y:n.y-a.y}}},at=(e,n)=>({...e,[n.endpoint]:{...e[n.endpoint],...n.point}}),Fn=(e,n)=>e.x===n.x&&e.y===n.y,rl=(e,n)=>({x:n.x+e.x*n.width,y:n.y+(1-e.y)*n.height}),ol=(e,n,r)=>{const a=e.x*r.width,o=n.x*r.width,i=(1-e.y)*r.height,l=(1-n.y)*r.height;return{x:Math.min(a,o),y:Math.min(i,l),width:Math.abs(o-a),height:Math.abs(l-i)}},At=(e,n)=>!Number.isFinite(n)||!Number.isFinite(e)?0:(0,re.default)(n,Math.min(-e,0),Math.max(1-e,0)),al=({panelRect:e})=>{const n=s.useEditorState(i=>s.readStanding(i,"arrow-endpoint-drag")),r=s.useResolvedAnnotations(e).arrows;if(n===null)return null;const a=r.find(i=>i.id===n.annotationId);if(a===void 0)return null;const o=(0,m.computeArrow)({arrow:at(a,n),panelWidth:e.width,panelHeight:e.height});return o===null?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ot,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":n.annotationId,children:(0,t.jsx)(s.ArrowAnnotation,{computed:o,isAddressable:!1})})},de=()=>{const e=s.useGraphSelection();return $e(e)},$e=e=>{if(e.length!==1)return null;const[n]=e;return n?.kind==="annotation"?n.id:null},il=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,t.jsx)("path",{d:"M19 12H5"})]})}),Hn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M5 12h14"}),(0,t.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),ll=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M7 17 17 7"}),(0,t.jsx)("path",{d:"M7 7h10v10"})]})}),Bn=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"18",height:"1.5",rx:"0.75"}),(0,t.jsx)("rect",{x:"3",y:"10",width:"18",height:"3",rx:"1.5"}),(0,t.jsx)("rect",{x:"3",y:"16.5",width:"18",height:"4.5",rx:"2.25"})]})}),ke=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M4 7h16"}),(0,t.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,t.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,t.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),sl="var(--pvjfpx0)",cl="var(--pvjfpx1)",dl="pvjfpx2",ul="pvjfpx3",hl="pvjfpx4",pl="pvjfpx6 pvjfpx5",ml="pvjfpx7 pvjfpx6 pvjfpx5",gl="pvjfpx8 pvjfpx5",ie=8,xl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:a})=>{const o=n.y+e.y,i=o+e.height,l=o-8-36,d=i+8,c=(0,re.default)(l>=ie?l:d,ie,a-ie-36),h=ie;return{top:c,left:h,available:Math.max(0,r-ie*2),centre:n.x+e.x+e.width/2-h}},fl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:a,label:o,testId:i,children:l})=>{const{chartId:d}=s.useGraphContext(),c=xl({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:a});return(0,t.jsx)("div",{className:dl,style:{top:c.top,left:c.left,width:c.available},children:(0,t.jsx)(F.Root,{"aria-label":o,className:ul,"data-testid":i,...Le(d),style:(0,tn.assignInlineVars)({[sl]:`${c.centre}px`,[cl]:`${c.available}px`}),children:l})})},vl=({label:e,trigger:n,isOpen:r,onOpenChange:a,isDisabled:o=!1,children:i})=>{const{chartId:l}=s.useGraphContext();return(0,t.jsxs)(M.Menu.Root,{open:r,modal:!1,onOpenChange:a,children:[(0,t.jsxs)(M.Menu.Trigger,{render:(0,t.jsx)(F.Button,{}),"aria-label":e,className:gl,disabled:o,onMouseDown:d=>d.preventDefault(),children:[n,(0,t.jsx)(ce,{size:"sm"})]}),(0,t.jsx)(F.MenuPopup,{popupAttributes:Le(l),children:i})]})},bl=e=>{const{chartId:n}=s.useGraphContext();return(0,t.jsx)(F.ColorPicker,{...e,popupAttributes:Le(n)})},Cl=({color:e,opacity:n})=>(0,t.jsx)("span",{className:hl,style:{background:e,opacity:n}}),Sl=({label:e,onClick:n,children:r})=>(0,t.jsx)(F.Button,{"aria-label":e,className:pl,onClick:n,children:r}),yl=({label:e,isPressed:n,onClick:r,children:a})=>(0,t.jsx)(F.Button,{"aria-label":e,"aria-pressed":n,className:ml,onClick:r,children:a}),k={Root:fl,Dropdown:vl,MenuItem:F.MenuItem,ColorPicker:bl,Swatch:Cl,IconButton:Sl,ToggleButton:yl,Button:F.Button,Separator:F.Separator},jl={kind:"chrome-popup"},Ie=()=>{const{commands:e}=s.useGraphContext(),n=s.useEditorStore(),[r,a]=(0,v.useState)(null);(0,v.useEffect)(()=>()=>e.seal(),[e]),(0,v.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:l}=n.getState();return r===null?l("chrome-popup"):i(jl),()=>l("chrome-popup")},[n,r]);const o=()=>{a(null),e.seal()};return{bind:i=>({isOpen:r===i,onOpenChange:l=>l?a(i):o()}),close:o}},Tl=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,t.jsx)("path",{d:"M5 19 8 16"}),(0,t.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,t.jsx)("path",{d:"M16 8 19 5"})]})}),wl=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),Al=[{value:"thin",key:"graph.annotations.arrowToolbar.thickness.thin"},{value:"medium",key:"graph.annotations.arrowToolbar.thickness.medium"},{value:"thick",key:"graph.annotations.arrowToolbar.thickness.thick"}],Pt=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Hn},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:s.MinusIcon}],Lt=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:wl},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:Tl}],Pl=(e,n)=>e.find(r=>r.value===n)??e[0];var Ll=({arrow:e,arrowBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=Ie(),u=e.color??c.defaultAnnotationArrowStroke,p=Pl(Lt,e.lineStyle),f=(I,D)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:I}),D)},g=I=>{f(I),h.close()},x=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},b=I=>f({color:I},{transient:!0}),T=I=>g({thickness:I}),w=I=>g({startArrowheadStyle:I}),y=I=>g({lineStyle:I}),P=I=>g({endArrowheadStyle:I}),C=()=>f({hasStickerStyle:!e.hasStickerStyle});return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,t.jsx)(k.ColorPicker,{color:u,label:l("graph.annotations.arrowToolbar.color"),onChange:b,...h.bind("color"),children:(0,t.jsx)(k.Swatch,{color:u})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,t.jsx)(Bn,{size:"sm",title:""}),...h.bind("thickness"),children:(0,t.jsx)(pe,{options:Al,current:e.thickness,onPick:T})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,t.jsx)(il,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,t.jsx)(pe,{options:Pt,current:e.startArrowheadStyle,onPick:w})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:p?.Icon!==void 0&&(0,t.jsx)(p.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,t.jsx)(pe,{options:Lt,current:e.lineStyle,onPick:y})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,t.jsx)(Hn,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,t.jsx)(pe,{options:Pt,current:e.endArrowheadStyle,onPick:P})}),(0,t.jsx)(k.ToggleButton,{label:l("graph.annotations.arrowToolbar.sticker"),isPressed:e.hasStickerStyle,onClick:C,children:(0,t.jsx)(ll,{size:"sm",title:""})}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.arrowToolbar.remove"),onClick:x,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},pe=({options:e,current:n,onPick:r})=>{const a=s.useI18n(),o=i=>()=>r(i);return(0,t.jsx)(t.Fragment,{children:e.map(i=>(0,t.jsxs)(k.MenuItem,{isSelected:i.value===n,onClick:o(i.value),children:[(0,t.jsx)("span",{children:a(i.key)}),i.Icon!==void 0&&(0,t.jsx)("span",{className:"_112xh5c0",children:(0,t.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},kl="_1me29t10",U=(e,n)=>n>0?e/n:0,Ee=(e,n,r)=>({x:U(n.x-e.x,r.width),y:U(n.y-e.y,r.height)}),Il=e=>e.x!==0||e.y!==0,Gn=(e,n)=>({x:e.x*n.width,y:e.y*n.height});var El=(e,n)=>Math.hypot(n.x-e.x,n.y-e.y)>=3,ue=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=n=>{n.pointerId===this.params.pointerId&&(this.pendingEvent=n,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=n=>{n.pointerId===this.params.pointerId&&(this.pendingEvent=n,this.finish(!0))},this.handleLost=n=>{n.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const n=this.pendingEvent;if(this.pendingEvent=null,n===null)return;const r=this.params.editorStore.getState();if(this.hasPublished&&this.readOwn(r)===null)return;const a={x:n.clientX,y:n.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,a))return;const o=this.resolvePreview(a);o!==null&&(r.claimInteraction(o),this.hasPublished=!0)}}start(){const{handle:e}=this.params,{signal:n}=this.listeners;e.addEventListener("pointermove",this.handleMove,{signal:n}),e.addEventListener("pointerup",this.handleUp,{signal:n}),e.addEventListener("lostpointercapture",this.handleLost,{signal:n})}finish(e){this.params.onSettled(),this.listeners.abort(),this.cancelFrame();try{e&&this.hasMoved&&this.runFrame()}finally{this.settle(e)}}isDragConfirmed(e,n){return El(e,n)}settle(e){this.pendingEvent=null;const n=this.params.editorStore.getState(),r=this.readOwn(n);r!==null&&n.releaseInteraction(this.kind),!(!e||r===null)&&this.commit(r)}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Ce=(e,n,r)=>{const a=e.arrows.find(i=>i.id===n);if(a===void 0)return null;const o=a[r];return o.anchorType==="panel"?o:null},Vn=(e,n)=>e==="start"?{start:n}:{end:n},Ml=class extends ue{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:n,endpoint:r}=this.params;return s.readDraggedArrowEndpointFor(s.readStanding(e,"arrow-endpoint-drag"),n,r)}resolvePreview(e){const{annotationId:n,endpoint:r,press:a,readInputs:o}=this.params,{annotations:i,arrow:l,panelRect:d}=o(),c=Ce(i,n,r);return c===null?null:{kind:"arrow-endpoint-drag",annotationId:n,endpoint:r,...zn({anchor:c,point:l[r],delta:Ee(a,e,d)})}}commit({anchor:e}){const{annotationId:n,endpoint:r,dispatch:a,readInputs:o}=this.params,i=Ce(o().annotations,n,r);i===null||Fn(i,e)||a(new m.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Vn(r,e)}))}},_l=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useLatestRef({annotations:s.useCompiledSelector(d=>d.spec.annotations),arrow:n,panelRect:r}),l=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>l.current?.finish(!1),[]),(0,v.useCallback)(d=>({onPointerDown:c=>{if(c.button===0&&l.current===null){try{c.currentTarget.setPointerCapture(c.pointerId)}catch{return}c.currentTarget.focus({preventScroll:!0}),c.preventDefault(),l.current=new Ml({handle:c.currentTarget,pointerId:c.pointerId,annotationId:e,endpoint:d,press:{x:c.clientX,y:c.clientY},readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch,onSettled:()=>{l.current=null}}),l.current.start()}}}),[e,i,o,a])},Nl=[" ","Enter"],kt=4,Rl=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useCompiledSelector(c=>c.spec.annotations),l=s.useLatestRef(i),d=s.useLatestRef(a.dispatch);return(0,v.useEffect)(()=>()=>{for(const c of Dn)It({editorStore:o,annotationId:e,endpoint:c,annotations:l.current,dispatch:d.current})},[o,e,l,d]),(0,v.useCallback)(c=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=o.getState(),p=s.readDraggedArrowEndpointFor(s.readStanding(u,"arrow-endpoint-drag"),e,c);if(Nl.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(p!==null){It({editorStore:o,annotationId:e,endpoint:c,annotations:i,dispatch:a.dispatch});return}const g=Ce(i,e,c);if(g===null)return;u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:c,anchor:g,point:n[c]});return}if(p===null)return;const f=Ol(h.key,r);f!==null&&(h.preventDefault(),u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:c,...zn({anchor:p.anchor,point:p.point,delta:f})}))}}),[e,i,n,r,o,a])},It=({editorStore:e,annotationId:n,endpoint:r,annotations:a,dispatch:o})=>{const i=e.getState(),l=s.readDraggedArrowEndpointFor(s.readStanding(i,"arrow-endpoint-drag"),n,r);if(l===null)return;i.releaseInteraction("arrow-endpoint-drag");const d=Ce(a,n,r);d===null||Fn(d,l.anchor)||o(new m.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Vn(r,l.anchor)}))},Ol=(e,n)=>{const r=U(kt,n.width),a=U(kt,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},Dl=e=>{const n=de(),r=Hl(n),a=Bl(e.panelRect,n),o=Gl(n);if(r===null||a===null)return null;const i=o.dragged===null?a:at(a,o.dragged);return(0,t.jsx)(zl,{arrow:r,committed:a,painted:i,isSettled:o.dragged===null&&!o.isMoved,isMoved:o.isMoved,...e})},zl=({arrow:e,committed:n,painted:r,isSettled:a,isMoved:o,panelRect:i,frameRect:l,frameElement:d})=>{const c=s.useI18n(),h=_l({annotationId:e.id,arrow:n,panelRect:i}),u=Rl({annotationId:e.id,arrow:n,panelRect:i});return(0,t.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[a&&(0,t.jsx)(Ll,{arrow:e,arrowBox:ol(n.start,n.end,i),panelRect:i,frameWidth:l.width,frameHeight:l.height,frameElement:d}),!o&&Dn.filter(p=>e[p].anchorType==="panel").map(p=>(0,t.jsx)(Fl,{endpoint:p,point:rl(r[p],i),label:c(`graph.annotations.arrowToolbar.moveEndpoint.${p}`),dragHandlers:h(p),keyboardHandlers:u(p)},p))]})},Fl=({endpoint:e,point:n,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,t.jsx)("div",{"aria-label":r,className:kl,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:n.x,top:n.y},tabIndex:0,...a,...o}),Hl=e=>{const n=s.useCompiledSelector(r=>r.spec.annotations.arrows);return e===null?null:n.find(r=>r.id===e)??null},Bl=(e,n)=>{const r=s.useResolvedAnnotations(e).arrows;return n===null?null:r.find(a=>a.id===n)??null},Gl=e=>s.useEditorState((0,oe.useShallow)(n=>{if(e===null)return{dragged:null,isMoved:!1};const r=s.readStanding(n,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:s.readMovedAnnotationFor(s.readStanding(n,"move-drag"),e)!==null}})),Vl=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,t.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Ul="q7gcrz0",$l="q7gcrz1",ql="q7gcrz2";var Wl=["absolute-difference","relative-difference","proportion"],Et=["absolute-difference","relative-difference"],Kl=["relative-difference","proportion"],Xl={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},Zl=e=>{const{formattingLocale:n}=s.useGraphContext(),r=s.useCompiledSelector(o=>o.config.parsingLocale),a=n??r;return(0,v.useMemo)(()=>{const o=(0,m.areEndpointsComparable)(e.start,e.end);return Wl.filter(i=>o||!Et.includes(i)||i===e.label).map(i=>({kind:i,key:Xl[i],preview:(0,m.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!Et.includes(i),isSuspect:Kl.includes(i)&&e.start.measurementValue===0}))},[e,a])},De=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],Yl=({arrow:e,labelBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),c=Ie(),h=Zl(e),u=h.find(C=>C.kind===e.label),p=h.some(C=>C.isPickable&&C.kind!==e.label),f=De.find(C=>C.id===e.size)??De[0],g=(C,I)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:C}),I)},x=C=>{g(C),c.close()},b=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},T=C=>g({color:C},{transient:!0}),w=()=>g({start:e.end.anchor,end:e.start.anchor}),y=C=>()=>x({label:C}),P=C=>()=>x({size:C});return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,t.jsx)(Jl,{option:u}),isDisabled:!p,...c.bind("labelKind"),children:h.map(C=>(0,t.jsxs)(k.MenuItem,{isSelected:C.kind===e.label,isDisabled:!C.isPickable,onClick:y(C.kind),children:[(0,t.jsx)("span",{children:l(C.key)}),(C.isSuspect||!C.isPickable)&&(0,t.jsx)("span",{"aria-label":l(C.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,t.jsx)("span",{className:ql,children:C.preview})]},C.kind))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.ColorPicker,{color:e.color,label:l("graph.annotations.differenceArrowToolbar.color"),onChange:T,...c.bind("color"),children:(0,t.jsx)(k.Swatch,{color:e.color??"transparent"})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:f===void 0?"":l(f.key),...c.bind("size"),children:De.map(C=>(0,t.jsx)(k.MenuItem,{isSelected:C.id===e.size,onClick:P(C.id),children:l(C.key)},C.id))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.differenceArrowToolbar.swap"),onClick:w,children:(0,t.jsx)(Vl,{size:"sm",title:""})}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.differenceArrowToolbar.remove"),onClick:b,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},Jl=({option:e})=>{const n=s.useI18n();return e===void 0?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:$l,children:n(e.key)}),(0,t.jsxs)("span",{className:Ul,children:["(",e.preview,")"]})]})};var Ql="ydgo3h0",es="ydgo3h1",ts="ydgo3h2",ns=({clientPoint:e,panelOrigin:n,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:l,fixedAnchor:d,align:c})=>{const h=rs({x:e.x-n.x,y:e.y-n.y},r),{primary:u}=a.query((0,m.toPanelCursor)(h,r));if(u===null)return null;const p=o.find(g=>g.id===u.layerId);if(p===void 0)return null;const f=(0,m.resolveObservationPoint)({resolver:l,layer:p,observation:u.observation,coordSystem:i,align:c});return f===null||(0,m.areAnchorsEqual)(f.anchor,d)?null:f},rs=(e,n)=>({x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))}),Un=e=>e==="start"?"end":"start",$n=({dispatch:e,arrow:n,endpoint:r,anchor:a})=>{(0,m.areAnchorsEqual)(a,n[r].anchor)||e(new m.UpdateAnnotationCommand({kind:"differenceArrow",id:n.id,patch:{[r]:a}}))},os=class extends ue{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:n,readInputs:r}=this.params;return s.readDraggedDifferenceArrowEndpointFor(s.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,n)}resolvePreview(e){const{endpoint:n,readInputs:r,engine:a,anchorResolver:o}=this.params,{arrow:i,panelOrigin:l,panelRect:d,layers:c,coordSystem:h}=r(),u=ns({clientPoint:e,panelOrigin:l,panelRect:d,engine:a,layers:c,coordSystem:h,resolver:o,fixedAnchor:i[Un(n)].anchor,align:i[n].anchor.align});return u===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:n,point:u}}commit({point:e,endpoint:n}){const{dispatch:r,readInputs:a}=this.params;$n({dispatch:r,arrow:a().arrow,endpoint:n,anchor:e.anchor})}},as=({arrow:e,panelOrigin:n,panelRect:r})=>{const{commands:a,anchorResolver:o}=s.useGraphContext(),{engine:i}=s.useHoverContext(),l=s.useEditorStore(),d=s.useLatestRef({arrow:e,panelOrigin:n,panelRect:r,...s.useCompiledSelector((0,oe.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),c=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,v.useCallback)(h=>({onPointerDown:u=>{if(u.button===0&&c.current===null){try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault(),c.current=new os({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>d.current,editorStore:l,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{c.current=null}}),c.current.start()}}}),[d,l,i,o,a])},is=[" ","Enter"],ls=({arrow:e})=>{const{commands:n,anchorResolver:r}=s.useGraphContext(),a=s.useEditorStore(),{layers:o,coordSystem:i,mainAxis:l}=s.useCompiledSelector((0,oe.useShallow)(c=>({layers:c.layers,coordSystem:c.coordSystem,mainAxis:c.coordSystem.type==="cartesian"?c.coordSystem.mainAxis:"x"}))),d=e.id;return(0,v.useEffect)(()=>()=>{const c=a.getState();s.readStanding(c,"difference-arrow-endpoint-drag")?.annotationId===d&&c.releaseInteraction("difference-arrow-endpoint-drag")},[a,d]),(0,v.useCallback)(c=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),p=s.readDraggedDifferenceArrowEndpointFor(s.readStanding(u,"difference-arrow-endpoint-drag"),e.id,c);if(is.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(p===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:e[c]});u.releaseInteraction("difference-arrow-endpoint-drag"),$n({dispatch:n.dispatch,arrow:e,endpoint:c,anchor:p.point.anchor});return}if(p===null)return;const f=ss(h.key,l);if(f===null)return;h.preventDefault();const g=cs({arrow:e,endpoint:c,from:p.point.anchor,move:f,layers:o,coordSystem:i,resolver:r});g!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:g})}}),[e,a,n,r,o,i,l])},ss=(e,n)=>{const r=e==="ArrowUp"||e==="ArrowDown";return!r&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:n==="x"===r?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},cs=({arrow:e,endpoint:n,from:r,move:a,layers:o,coordSystem:i,resolver:l})=>{const d=o.find(u=>u.id===r.layerId);if(d===void 0)return null;const c=l.createLayerMeasurement(d);if(c===null)return null;const{align:h}=e[n].anchor;return(0,m.stepDifferenceArrowEndpoint)({layer:d,from:r,partner:e[Un(n)].anchor,axis:a.axis,step:a.step,getObservationPoint:u=>(0,m.resolveObservationPoint)({resolver:l,layer:d,observation:u,coordSystem:i,align:h,measurement:c})})?.point??null},ds=e=>{const n=de();return n===null?null:(0,t.jsx)(us,{annotationId:n,...e})},us=({annotationId:e,...n})=>{const r=s.useDifferenceArrowGeometries(),a=(0,v.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,t.jsx)(hs,{committedArrow:a.committedArrow,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...n})},hs=({committedArrow:e,committedLabelBox:n,labelBox:r,start:a,end:o,panelRect:i,panelOrigin:l,frameRect:d,frameElement:c,isDragged:h})=>{const u=as({arrow:e,panelOrigin:l,panelRect:i}),p=ls({arrow:e});return(0,t.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!h&&(0,t.jsx)(Yl,{arrow:e,labelBox:n,panelRect:i,frameWidth:d.width,frameHeight:d.height,frameElement:c}),(0,t.jsx)("div",{"aria-hidden":"true",className:ts,"data-testid":"difference-arrow-selection-label",style:{left:i.x+r.x-2,top:i.y+r.y-2,width:r.width+4,height:r.height+4}}),(0,t.jsx)(Mt,{endpoint:"start",point:a,panelRect:i,dragHandlers:u("start"),keyboardHandlers:p("start")}),(0,t.jsx)(Mt,{endpoint:"end",point:o,panelRect:i,dragHandlers:u("end"),keyboardHandlers:p("end")})]})},Mt=({endpoint:e,point:n,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,t.jsx)("div",{className:Ql,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+n.x,top:r.y+n.y},tabIndex:0,...a,...o,children:(0,t.jsx)("span",{"aria-hidden":"true",className:es})}),qe=({start:e,extent:n,isStartMoving:r,delta:a,minExtent:o})=>{if(!Number.isFinite(a))return{start:e,extent:n};const i=e+n,l=Math.min(o,n);if(r){const h=Math.min(0,e),u=Math.min(Math.max(1,e),i-l),p=(0,re.default)(e+a,h,u);return{start:p,extent:i-p}}const d=Math.max(Math.min(0,i),e+l),c=Math.max(1,i);return{start:e,extent:(0,re.default)(i+a,d,c)-e}},ps=["top-left","top-right","bottom-right","bottom-left"];var qn=({width:e,height:n})=>({x:U(16,e),y:U(16,n)}),ms=(e,n)=>({x:Xn(n)?e.x:e.x+e.width,y:Zn(n)?e.y:e.y+e.height}),it=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Wn=({region:e,corner:n,delta:r,minSize:a})=>{const o=qe({start:e.x,extent:e.width,isStartMoving:Xn(n),delta:r.x,minExtent:a.x}),i=qe({start:e.y,extent:e.height,isStartMoving:Zn(n),delta:r.y,minExtent:a.y});return{anchorType:"panel",x:o.start,y:i.start,width:o.extent,height:i.extent}},Kn=(e,n)=>e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height,Xn=e=>e==="top-left"||e==="bottom-left",Zn=e=>e==="top-left"||e==="top-right",Yn=(e,n,r,a)=>{const o=e.textAnnotations.find(i=>i.id===n);return o===void 0?null:s.measureTextAnnotationBox(s.previewResizedText(o,r),a)};var gs={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},xs={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},fs=({panelRect:e})=>{const n=s.useResolvedAnnotations(e),r=s.useMeasuredBoxes(),a=de(),o=s.useEditorState(x=>s.readStanding(x,"move-drag")),i=s.useEditorState(x=>s.readStanding(x,"shape-resize-drag")),l=s.useEditorState(x=>s.readStanding(x,"arrow-endpoint-drag")),d=s.useEditorState(x=>s.readStanding(x,"text-resize-drag")),c=s.useEditorState(x=>{const b=x.editTargetUnderPointer;return b?.kind==="annotation"?b.id:null}),h=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r}),[e.width,e.height,r]),u=_t(n,a,h),p=_t(n,c===a?null:c,h),f=x=>{if(i?.annotationId===x.id){const b=n.shapes.find(T=>T.id===x.id);return b===void 0?x.geometry:s.measureShapeRegion(it(i.region),b.strokeWidth,h.panel)}if(l?.annotationId===x.id){const b=n.arrows.find(T=>T.id===x.id);return b===void 0?x.geometry:s.measureArrowEnds(at(b,l),h.panel)??x.geometry}return d?.annotationId===x.id?Yn(n,x.id,d,h)??x.geometry:x.geometry},g=x=>{if(o?.annotationId!==x)return e;const b=Gn(o.translation,e);return{x:e.x+b.x,y:e.y+b.y}};return(0,t.jsxs)(t.Fragment,{children:[p!==null&&(0,t.jsx)(Nt,{annotationId:p.id,geometry:f(p),state:"hovered",origin:g(p.id)}),u!==null&&(0,t.jsx)(Nt,{annotationId:u.id,geometry:f(u),state:"selected",origin:g(u.id)})]})},_t=(e,n,r)=>{if(n===null)return null;const a=s.resolveAnnotationChromeGeometry(e,n,r);return a===null?null:{id:n,geometry:a}},Nt=({annotationId:e,geometry:n,state:r,origin:a})=>n.shape==="segment"?(0,t.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,children:[(0,t.jsx)(Rt,{point:n.start,state:r,origin:a}),(0,t.jsx)(Rt,{point:n.end,state:r,origin:a})]}):(0,t.jsx)("div",{"aria-hidden":"true",className:gs[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:a.x+n.rect.x-2,top:a.y+n.rect.y-2,width:n.rect.width+4,height:n.rect.height+4}}),Rt=({point:e,state:n,origin:r})=>(0,t.jsx)("span",{className:xs[n],style:{left:r.x+e.x,top:r.y+e.y}}),vs=({panelRect:e})=>{const n=s.useEditorState(o=>s.readStanding(o,"move-drag")),r=s.useResolvedAnnotations(e);if(n===null)return null;const a=Gn(n.translation,e);return(0,t.jsx)("svg",{"aria-hidden":"true",className:ot,width:e.width,height:e.height,style:{left:e.x+a.x,top:e.y+a.y},"data-testid":"annotation-preview","data-annotation-id":n.annotationId,children:Ss(r,n.annotationId,e)})},bs=({annotation:e})=>(0,t.jsx)(s.TextAnnotation,{annotation:e,blockRef:s.useMeasuredBoxRef(e.id)}),me=(e,n,r)=>{const a=e.find(o=>o.id===n);return a===void 0?null:r(a)},Cs={text:(e,n)=>me(e.textAnnotations,n,r=>(0,t.jsx)(bs,{annotation:r})),shape:(e,n)=>me(e.shapes,n,r=>(0,t.jsx)(s.ShapeAnnotation,{shape:r})),image:(e,n)=>me(e.images,n,r=>(0,t.jsx)(s.ImageAnnotation,{image:r})),arrow:(e,n,r)=>me(e.arrows,n,a=>{const o=(0,m.computeArrow)({arrow:a,panelWidth:r.width,panelHeight:r.height});return o===null?null:(0,t.jsx)(s.ArrowAnnotation,{computed:o,isAddressable:!1})})},Ss=(e,n,r)=>{for(const a of Object.values(Cs)){const o=a(e,n,r);if(o!==null)return o}return null},ys=({panelRect:e})=>{const n=s.useEditorState(o=>s.readStanding(o,"shape-resize-drag")),r=s.useResolvedAnnotations(e).shapes;if(n===null)return null;const a=r.find(o=>o.id===n.annotationId);return a===void 0?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ot,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"shape-resize-preview","data-annotation-id":n.annotationId,children:(0,t.jsx)(s.ShapeAnnotation,{shape:{...a,region:it(n.region)}})})},js={sm:"o49ib40",md:"o49ib41"},Ts={horizontal:"o49ib42",diagonalDown:"o49ib43",diagonalUp:"o49ib44"},Jn=({point:e,label:n,pull:r,size:a,attributes:o,dragHandlers:i,keyboardHandlers:l})=>(0,t.jsx)("div",{"aria-label":n,className:Ts[r],role:"button",style:{left:e.x,top:e.y},tabIndex:0,...o,...i,...l,children:(0,t.jsx)("span",{"aria-hidden":"true",className:js[a]})}),We=[{width:0,key:"graph.annotations.shapeToolbar.border.none"},{width:2,key:"graph.annotations.shapeToolbar.border.thin"},{width:8,key:"graph.annotations.shapeToolbar.border.medium"},{width:16,key:"graph.annotations.shapeToolbar.border.thick"}],ws=e=>[...We].reverse().find(n=>n.width<=e)??We[0],As=({shape:e,shapeBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=Ie(),u=e.fillColor??c.defaultAnnotationShapeFill,p=ws(e.strokeWidth),f=(w,y)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"shape",id:e.id,patch:w}),y)},g=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},x=w=>f({fillColor:w,strokeColor:null},{transient:!0}),b=w=>f({fillOpacity:w},{transient:!0}),T=w=>()=>{f({strokeWidth:w}),h.close()};return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,t.jsx)(k.ColorPicker,{color:u,label:l("graph.annotations.shapeToolbar.color"),onChange:x,opacity:e.fillOpacity,onOpacityChange:b,...h.bind("color"),children:(0,t.jsx)(k.Swatch,{color:u,opacity:e.fillOpacity})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,t.jsx)(Bn,{size:"sm",title:""}),...h.bind("border"),children:We.map(w=>(0,t.jsx)(k.MenuItem,{isSelected:w.width===p?.width,onClick:T(w.width),children:l(w.key)},w.width))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.shapeToolbar.remove"),onClick:g,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},Qn=e=>{const n=s.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(a=>({onPointerDown:o=>{if(o.button!==0||r.current!==null)return;try{o.currentTarget.setPointerCapture(o.pointerId)}catch{return}o.currentTarget.focus({preventScroll:!0}),o.preventDefault();const i=n.current(a,{handle:o.currentTarget,pointerId:o.pointerId,press:{x:o.clientX,y:o.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[n])},Se=(e,n)=>{const r=e.shapes.find(a=>a.id===n);return r===void 0||r.region.anchorType!=="panel"?null:r.region},Ps=class extends ue{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return s.readResizedShapeFor(s.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,corner:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:l}=o(),d=Se(i,n);return d===null?null:{kind:"shape-resize-drag",annotationId:n,region:Wn({region:d,corner:r,delta:Ee(a,e,l),minSize:qn(l)})}}commit({region:e}){const{annotationId:n,dispatch:r,readInputs:a}=this.params,o=Se(a().annotations,n);o===null||Kn(o,e)||r(new m.UpdateAnnotationCommand({kind:"shape",id:n,patch:{region:e}}))}},Ls=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useLatestRef({annotations:s.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return Qn((i,l)=>new Ps({...l,annotationId:e,corner:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},ks=[" ","Enter"],er=e=>{const n=s.useEditorStore(),r=s.useLatestRef(e);return(0,v.useEffect)(()=>()=>Ot(n,r.current),[n,r]),(0,v.useCallback)(a=>({onKeyDown:o=>{if(o.altKey||o.ctrlKey||o.metaKey||o.shiftKey)return;const i=n.getState(),l=r.current.readHeld();if(ks.includes(o.key)){if(o.preventDefault(),o.repeat)return;if(l!==null){Ot(n,r.current);return}const c=r.current.claim(a);if(c===null)return;i.claimInteraction(c);return}if(l===null)return;const d=r.current.step(l,a,o.key);d!==null&&(o.preventDefault(),i.claimInteraction(d))}}),[n,r])},Ot=(e,n)=>{const r=n.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),n.commit(r))},Dt=4,Is=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useCompiledSelector(i=>i.spec.annotations);return er({readHeld:()=>s.readResizedShapeFor(s.readStanding(a.getState(),"shape-resize-drag"),e),claim:()=>{const i=Se(o,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,l,d)=>{const c=Es(d,n);return c===null?null:{kind:"shape-resize-drag",annotationId:e,region:Wn({region:i.region,corner:l,delta:c,minSize:qn(n)})}},commit:({region:i})=>{const l=Se(o,e);l===null||Kn(l,i)||r.dispatch(new m.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},Es=(e,n)=>{const r=U(Dt,n.width),a=U(Dt,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},Ms={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},_s=e=>{const n=de(),r=Rs(n),a=Os(n);if(r===null)return null;const o=a.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return o===null?null:(0,t.jsx)(Ns,{shape:r,region:o,isSettled:a.resizedRegion===null&&!a.isMoved,isMoved:a.isMoved,...e})},Ns=({shape:e,region:n,isSettled:r,isMoved:a,panelRect:o,frameRect:i,frameElement:l})=>{const d=s.useI18n(),c=Ls({annotationId:e.id,panelRect:o}),h=Is({annotationId:e.id,panelRect:o}),{rect:u}=s.measureShapeRegion(it(n),e.strokeWidth,o);return(0,t.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(As,{shape:e,shapeBox:u,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:l}),!a&&ps.map(p=>{const f=ms(u,p);return(0,t.jsx)(Jn,{point:{x:o.x+f.x,y:o.y+f.y},label:d(`graph.annotations.shapeToolbar.resize.${p}`),pull:Ms[p],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":p},dragHandlers:c(p),keyboardHandlers:h(p)},p)})]})},Rs=e=>{const n=s.useCompiledSelector(r=>r.spec.annotations.shapes);return e===null?null:n.find(r=>r.id===e)??null},Os=e=>s.useEditorState((0,oe.useShallow)(n=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:s.readResizedShapeFor(s.readStanding(n,"shape-resize-drag"),e)?.region??null,isMoved:s.readMovedAnnotationFor(s.readStanding(n,"move-drag"),e)!==null})),Ds=({textColor:e,...n})=>(0,t.jsxs)(s.Icon,{...n,children:[(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,t.jsx)("path",{d:"M6 4h12"}),(0,t.jsx)("path",{d:"M12 4v12"})]}),(0,t.jsx)("path",{d:"M5 20h14",stroke:e??"currentColor",strokeWidth:3,strokeLinecap:"round"})]});var ye="textStyle",tr=new Set(["paragraph","heading"]),zs=e=>{const n=nr(e),r=Us(e);return{color:ge(n.map(a=>$s(ze(a)?.color))),font:ge(n.map(a=>Vs(ze(a)))),fontSize:ge(n.map(a=>qs(ze(a)?.fontSize))),alignment:ge(r.map(a=>Ws(a.attrs?.textAlign)))}},Fs=(e,n)=>lt(e,r=>r.type==="text"?Gs(r,n):r),Hs=e=>nr(e).length>0,Bs=(e,n)=>lt(e,r=>tr.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:n}}:r),lt=(e,n)=>n(e.content===void 0?e:{...e,content:e.content.map(r=>lt(r,n))}),Gs=(e,n)=>{const r=e.marks??[],a=r.find(i=>i.type===ye),o={type:ye,attrs:{...a?.attrs,...n}};return{...e,marks:a===void 0?[...r,o]:r.map(i=>i===a?o:i)}},ze=e=>e.marks?.find(n=>n.type===ye)?.attrs,Vs=e=>s.readRichTextFontId(e?.font)??s.readRichTextFontId(e?.fontFamily),nr=e=>st(e,n=>n.type==="text"),Us=e=>st(e,n=>tr.has(n.type??"")),st=(e,n)=>[...n(e)?[e]:[],...(e.content??[]).flatMap(r=>st(r,n))],ge=e=>{const[n,...r]=e;return n===void 0?null:r.every(a=>a===n)?n:null},$s=e=>typeof e=="string"&&e.length>0?e:void 0,qs=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ws=e=>e==="left"||e==="center"||e==="right"?e:void 0;var rr=[{id:"modern",key:"graph.annotations.textToolbar.font.modern"},{id:"fresh",key:"graph.annotations.textToolbar.font.fresh"},{id:"timeless",key:"graph.annotations.textToolbar.font.timeless"},{id:"technical",key:"graph.annotations.textToolbar.font.technical"},{id:"fineliner",key:"graph.annotations.textToolbar.font.fineliner"}].map(({id:e,key:n})=>({id:e,key:n,fontFamily:s.RICH_TEXT_FONT_FAMILIES[e]??e})),Ks=e=>rr.find(n=>n.id===(e??"modern"))??null;var or=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:16,key:"graph.annotations.textToolbar.fontSize.medium"},{size:20,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:32,key:"graph.annotations.textToolbar.fontSize.huge"}],Xs=e=>or.find(n=>n.size===(e??16))??null,Zs=e=>`${e/10}em`,Ys=[{alignment:"left",Icon:jn},{alignment:"center",Icon:Sn},{alignment:"right",Icon:yn}],Js=({annotation:e,textBox:n,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=s.useEditorStore(),u=Ie(),p=zs(e.content),f=Ks(p.font),g=Xs(p.fontSize),x=p.color??c.textPrimary,b=(L,E)=>{d.dispatch(new m.UpdateAnnotationCommand({kind:"text",id:e.id,patch:L}),E)},T=()=>h.getState().caret?.editor?.getJSON()??e.content,w=(L,E)=>{const A=T(),O=h.getState().caret?.editor??null;if(O!==null&&!Hs(A)){O.chain().focus().setMark(ye,L).run();return}b({content:Fs(A,L)},E)},y=()=>{d.dispatch(new m.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},P=L=>b(Qs(L),{transient:!0}),C=L=>w({color:L},{transient:!0}),I=L=>()=>{w({font:L}),u.close()},D=L=>()=>{w({fontSize:L}),u.close()},R=L=>b({content:Bs(T(),L)});return(0,t.jsxs)(k.Root,{anchorBox:n,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,t.jsx)(k.ColorPicker,{color:e.backgroundColor??"transparent",label:l("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:P,...u.bind("background"),children:(0,t.jsx)(k.Swatch,{color:e.backgroundColor??"linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))"})}),(0,t.jsx)(k.ColorPicker,{color:x,label:l("graph.annotations.textToolbar.color"),onChange:C,...u.bind("color"),children:(0,t.jsx)(Ds,{size:"sm",textColor:x,title:""})}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,t.jsx)("span",{style:{fontFamily:f?.fontFamily},children:"Aa"}),...u.bind("font"),children:rr.map(L=>(0,t.jsx)(k.MenuItem,{isSelected:L.id===f?.id,onClick:I(L.id),children:(0,t.jsx)("span",{style:{fontFamily:L.fontFamily},children:l(L.key)})},L.id))}),(0,t.jsx)(k.Dropdown,{label:l("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:g===null?"":l(g.key),...u.bind("fontSize"),children:or.map(L=>(0,t.jsx)(k.MenuItem,{isSelected:L.size===g?.size,onClick:D(L.size),children:(0,t.jsx)("span",{style:{fontSize:Zs(L.size)},children:l(L.key)})},L.size))}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(ec,{current:p.alignment??"center",onPick:R}),(0,t.jsx)(k.Separator,{}),(0,t.jsx)(k.IconButton,{label:l("graph.annotations.textToolbar.remove"),onClick:y,children:(0,t.jsx)(ke,{size:"sm",title:""})})]})},Qs=e=>e==="transparent"?{backgroundColor:null}:{backgroundColor:e,backgroundColorStyle:ea(e)?"fade":"opaque"},ec=({current:e,onPick:n})=>{const r=s.useI18n(),a=o=>()=>n(o);return(0,t.jsx)(t.Fragment,{children:Ys.map(o=>(0,t.jsx)(k.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${o.alignment}`),isPressed:o.alignment===e,onClick:a(o.alignment),children:(0,t.jsx)(o.Icon,{size:"sm",title:""})},o.alignment))})},tc=["left","right"];var ar=({width:e})=>U(60,e),nc=(e,n)=>({x:n==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),ir=({at:e,width:n,align:r,edge:a,delta:o,minWidth:i,panelWidth:l})=>{if(o===0)return{at:e,width:n,shift:0};const d=(0,m.alignUnitFractions)(r).x,c=rc(e.offset,l),h=qe({start:e.x+c-d*n,extent:n,isStartMoving:a==="left",delta:o,minExtent:i}),u=h.start+d*h.extent-c;return{at:{...e,x:u},width:h.extent,shift:u-e.x}},lr=(e,n)=>e.at.x===n.at.x&&e.width===n.width,rc=(e,n)=>e?.x===void 0?0:e.unit==="px"?U(e.x,n):e.x,je=(e,n)=>{const r=e.textAnnotations.find(a=>a.id===n);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},oc=class extends ue{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return s.readResizedTextFor(s.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,edge:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:l}=o(),d=je(i,n);if(d===null)return null;const c=Ee(a,e,l).x;return{kind:"text-resize-drag",annotationId:n,delta:c,...ir({...d,edge:r,delta:c,minWidth:ar(l),panelWidth:l.width})}}commit(e){const{annotationId:n,dispatch:r,readInputs:a}=this.params,o=je(a().annotations,n);o===null||lr(o,e)||r(new m.UpdateAnnotationCommand({kind:"text",id:n,patch:{at:e.at,width:e.width}}))}},ac=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useLatestRef({annotations:s.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return Qn((i,l)=>new oc({...l,annotationId:e,edge:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},ic=4,lc=({annotationId:e,panelRect:n})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useCompiledSelector(l=>l.spec.annotations),i=(l,d)=>{const c=je(o,e);return c===null?null:{kind:"text-resize-drag",annotationId:e,delta:d,...ir({...c,edge:l,delta:d,minWidth:ar(n),panelWidth:n.width})}};return er({readHeld:()=>s.readResizedTextFor(s.readStanding(a.getState(),"text-resize-drag"),e),claim:l=>i(l,0),step:(l,d,c)=>{const h=sc(c,n);return h===null?null:i(d,l.delta+h)},commit:l=>{const d=je(o,e);d===null||lr(d,l)||r.dispatch(new m.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:l.at,width:l.width}}))}})},sc=(e,n)=>{const r=U(ic,n.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},cc=e=>{const n=de(),r=uc(n),a=hc(n),o=s.useEditorState(l=>l.caret?.annotationId===n),i=pc(e.panelRect,n,a.resized);return r===null||i===null?null:(0,t.jsx)(dc,{annotation:r,textBox:i,isSettled:a.resized===null&&!a.isMoved,isMoved:a.isMoved,isResizable:r.at.anchorType==="panel",hasCaret:o,...e})},dc=({annotation:e,textBox:n,isSettled:r,isMoved:a,isResizable:o,hasCaret:i,panelRect:l,frameRect:d,frameElement:c})=>{const h=s.useI18n(),u=ac({annotationId:e.id,panelRect:l}),p=lc({annotationId:e.id,panelRect:l});return(0,t.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(Js,{annotation:e,textBox:n,panelRect:l,frameWidth:d.width,frameHeight:d.height,frameElement:c}),o&&!a&&!i&&tc.map(f=>{const g=nc(n,f);return(0,t.jsx)(Jn,{point:{x:l.x+g.x,y:l.y+g.y},label:h(`graph.annotations.textToolbar.resize.${f}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":f},dragHandlers:u(f),keyboardHandlers:p(f)},f)})]})},uc=e=>{const n=s.useCompiledSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:n.find(r=>r.id===e)??null},hc=e=>s.useEditorState((0,oe.useShallow)(n=>e===null?{resized:null,isMoved:!1}:{resized:s.readResizedTextFor(s.readStanding(n,"text-resize-drag"),e),isMoved:s.readMovedAnnotationFor(s.readStanding(n,"move-drag"),e)!==null})),pc=(e,n,r)=>{const a=s.useResolvedAnnotations(e),o=s.useMeasuredBoxes(),i=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:o}),[e.width,e.height,o]);return n===null?null:Yn(a,n,r,i)?.rect??null},mc=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M12 5v14"}),(0,t.jsx)("path",{d:"M5 12h14"})]})}),gc="var(--_1tyillx0)",xc={rest:.5,hovered:.75,open:1};var fc="_1tyillx1",vc={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},bc="_1tyillx5",Cc={closed:"_1tyillx6",open:"_1tyillx7"},Sc=({interaction:e,panelRect:n})=>{const r=s.useEditorStore(),a=s.useCompiledSelector(d=>d.coordSystem),o=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,i=yc(e),l=(0,v.useMemo)(()=>{if(o===null)return null;const d=(0,m.projectAnchorToPanel)(o.position,n,a);return{center:d,radius:19*xc[i],target:{kind:"observation",cursor:(0,m.toPanelCursor)(d,n)}}},[o,n,a,i]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(l)},[r,l]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),o===null||l===null?null:(0,t.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,V.default)(fc,vc[i]),style:{left:n.x+l.center.x,top:n.y+l.center.y,...(0,tn.assignInlineVars)({[gc]:o.color??G.vars.border50})},children:(0,t.jsx)("span",{className:(0,V.default)(bc,Cc[i==="open"?"open":"closed"]),children:(0,t.jsx)(mc,{size:"lg"})})})},yc=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",jc='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Tc=(e,n)=>{const{chartId:r}=s.useGraphContext(),a=s.useEditorStore();(0,v.useEffect)(()=>{if(n===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!se(i.target,e,r)||a.getState().standingInteraction?.kind==="chrome-popup")return;const l=[...n.querySelectorAll(jc)];if(l.length===0)return;i.preventDefault();const d=l.findIndex(c=>c===document.activeElement);l[d===-1?i.shiftKey?l.length-1:0:(d+(i.shiftKey?-1:1)+l.length)%l.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,n,r,a])},wc=`[${s.EDIT_TARGET_KIND_ATTRIBUTE}]`,Te=(e,n,r)=>{if(typeof document.elementsFromPoint!="function")return null;const a=document.elementsFromPoint(e,n);return Ac(a,r)},Ac=(e,n)=>{for(const r of e){const a=r.closest(wc);if(a===null||!n.contains(a))continue;const o=Pc(a);if(o!==null)return o;if(a!==r)return null}return null},Pc=e=>{const n=e.getAttribute(s.EDIT_TARGET_KIND_ATTRIBUTE);if(n!=="annotation")return null;const r=e.getAttribute(s.EDIT_TARGET_ID_ATTRIBUTE);return r===null||r===""?null:{kind:n,id:r}},Lc=e=>{const{selectionStore:n,chartId:r}=s.useGraphContext(),a=s.useEditorStore();(0,v.useEffect)(()=>{let o=null;const i=c=>{const{caret:h}=a.getState(),u=h===null?null:Te(c.clientX,c.clientY,e);u!==null&&u.id===h?.annotationId||e.focus({preventScroll:!0})},l=c=>{const{selection:h,clearSelection:u}=n.getState();h.length!==0&&(se(c.target,e,r)||u())},d=c=>{n.getState().selection.length!==0&&se(c.target,e,r)&&c.relatedTarget===null&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{o=null,document.hasFocus()&&(se(document.activeElement,e,r)||n.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",l),document.addEventListener("focusout",d),()=>{o!==null&&cancelAnimationFrame(o),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",l),document.removeEventListener("focusout",d)}},[a,n,e,r])},kc=class extends ue{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return s.readMovedAnnotationFor(s.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,press:r,readInputs:a}=this.params,{annotations:o,panelRect:i}=a(),l=(0,m.findAnnotation)(o,n);if(l===null)return null;const d=(0,m.clampAnnotationTranslation)(l,Ee(r,e,i));return d===null?null:{kind:"move-drag",annotationId:n,translation:d}}commit({translation:e}){const{annotationId:n,dispatch:r}=this.params;Il(e)&&r(new m.MoveAnnotationCommand({id:n,translation:e}))}},Ic=(e,n,r)=>{const{commands:a,selectionStore:o}=s.useGraphContext(),i=s.useEditorStore(),l=s.useLatestRef({annotations:s.useCompiledSelector(h=>h.spec.annotations),panelRect:r}),d=s.useLatestRef(n),c=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,v.useEffect)(()=>{const h=g=>{const{editTargetUnderPointer:x,standingInteraction:b}=i.getState();return x!==null&&b===null&&g.pointerType==="mouse"&&Ec(g.target,e)?x:Te(g.clientX,g.clientY,e)},u=(g,x)=>{if(c.current!==null||!s.canMoveAnnotationOnCanvas(l.current.annotations,x.id))return;try{e.setPointerCapture(g.pointerId)}catch{return}g.preventDefault();const b=new kc({handle:e,pointerId:g.pointerId,annotationId:x.id,press:{x:g.clientX,y:g.clientY},readInputs:()=>l.current,editorStore:i,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=b,b.start()},p=g=>{if(g.button!==0||Ue(g.target)||An(g,d.current,i.getState().menuTrigger))return;const x=h(g),b=o.getState(),{caret:T,setCaret:w}=i.getState();if(!(T!==null&&x?.id===T.annotationId)){if(w(null),x===null){b.clearSelection();return}b.setSelection([x]),u(g,x)}},f=g=>{if(Ue(g.target))return;const x=Te(g.clientX,g.clientY,e);x!==null&&l.current.annotations.textAnnotations.some(b=>b.id===x.id)&&(o.getState().setSelection([x]),i.getState().setCaret(x.id))};return document.addEventListener("pointerdown",p),document.addEventListener("dblclick",f),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("dblclick",f)}},[e,i,o,a,l,d])},Ec=(e,n)=>e instanceof Node&&n.contains(e),Mc=e=>{const{selectionStore:n,commands:r,chartId:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useLatestRef(s.useCompiledSelector(h=>h.spec.annotations.textAnnotations)),l=(0,v.useCallback)(h=>{const{selection:u}=n.getState(),p=$e(u);p!==null&&(h.preventDefault(),r.dispatch(new m.RemoveAnnotationCommand({id:p})),e.focus({preventScroll:!0}))},[e,r,n]),d=(0,v.useCallback)(h=>{if(xe(h.target,a))return;const u=$e(n.getState().selection);u!==null&&i.current.some(p=>p.id===u)&&(h.preventDefault(),o.getState().setCaret(u))},[o,n,i,a]),c=(0,v.useCallback)(h=>{const u=o.getState(),p=u.standingInteraction?.kind;if(p!==void 0){p!=="chrome-popup"&&u.releaseInteraction(p);return}if(u.caret!==null){u.setCaret(null),e.focus({preventScroll:!0});return}return xe(h.target,a)?e.focus({preventScroll:!0}):n.getState().clearSelection()},[o,n,e,a]);(0,v.useEffect)(()=>{const h=u=>{if(!se(u.target,e,a)||hi(u.target))return;const p=_c(u.target),f=o.getState().caret!==null&&!xe(u.target,a);if(!(p&&!f))switch(u.key){case"Escape":return c(u);case"Enter":return p?void 0:d(u);case"Delete":case"Backspace":return p?void 0:l(u);default:return}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,l,d,c,a,o])},_c=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Nc=()=>{const e=s.useHoverState(o=>o.hover.primary),{layers:n,coordSystem:r}=s.useCompiledSelector((0,oe.useShallow)(o=>({layers:o.layers,coordSystem:o.coordSystem}))),{anchorResolver:a}=s.useGraphContext();return(0,v.useMemo)(()=>{if(e===null)return null;const o=n.find(d=>d.id===e.layerId);if(o===void 0)return null;const i=a.resolve(o.geom,e.observation,{coordSystem:r,position:o.position,purpose:"pin"});if(i===null)return null;const l=(0,m.buildObservationAnchor)(o,e.observation);return l===null?null:{position:i,color:(0,m.getColor)(e.observation),layer:o,at:l,observation:e.observation}},[e,n,r,a])},Rc={kind:"idle"},sr=()=>{const e=s.useEditorState(a=>a.standingInteraction),n=s.useEditorState(a=>a.chromeUnderPointer),r=Nc();return(0,v.useMemo)(()=>e!==null?e:r===null?Rc:{kind:"trigger",anchor:r,isEngaged:n==="menu-trigger"},[e,r,n])},Oc=(e,n,r)=>{const a=s.useEditorStore(),{selectionStore:o}=s.useGraphContext(),{store:i,engine:l}=s.useHoverContext(),d=s.useLatestRef(e),c=s.useLatestRef(n),h=s.useLatestRef(r);(0,v.useEffect)(()=>{const u=b=>An(b,c.current,a.getState().menuTrigger),p=b=>{if(u(b)||o.getState().selection.length>0)return;const T=h.current,w=c.current,y={x:b.clientX-w.x,y:b.clientY-w.y},P=Dc(y,T)?l.query((0,m.toPanelCursor)(y,T)):m.RESTING_HOVER_STATE;i.getState().setHoverState(P)};let f=!1;const g=()=>{f=d.current.kind==="menu"},x=b=>{if(Ue(b.target))return;const{claimInteraction:T,releaseInteraction:w}=a.getState();if(!u(b)||f){w("menu"),f&&p(b);return}const y=d.current;y.kind==="trigger"&&T({kind:"menu",anchor:y.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",x),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",x)}},[a,o,d,i,l,c,h])},Dc=(e,n)=>e.x>=0&&e.x<=n.width&&e.y>=0&&e.y<=n.height,zc=(e,n)=>{const r=s.useEditorStore(),a=s.useLatestRef(n);(0,v.useEffect)(()=>{let o=null,i=null;const l=g=>{const{menuTrigger:x}=r.getState();return x===null?null:(0,m.isPointWithinEditMenuTrigger)(g,x)?"menu-trigger":null},d=()=>{o=null;const g=i;if(g===null)return;const x=a.current,b=r.getState();if(b.setChromeUnderPointer(l({x:g.x-x.x,y:g.y-x.y})),Fe(b.standingInteraction))return;const T=Te(g.x,g.y,e);b.setEditTargetUnderPointer(T)},c=()=>{o===null&&(o=requestAnimationFrame(d))},h=()=>{const g=r.getState();g.setChromeUnderPointer(null),g.setEditTargetUnderPointer(null)},u=g=>{i={x:g.clientX,y:g.clientY},c()},p=()=>{i=null,o!==null&&(cancelAnimationFrame(o),o=null),h()},f=r.subscribe((g,x)=>{!Fe(x.standingInteraction)||Fe(g.standingInteraction)||i!==null&&c()});return e.addEventListener("pointermove",u),e.addEventListener("pointerleave",p),()=>{o!==null&&cancelAnimationFrame(o),f(),e.removeEventListener("pointermove",u),e.removeEventListener("pointerleave",p),h()}},[e,r,a])},Fe=e=>{if(e===null)return!1;switch(e.kind){case"menu":case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":case"text-resize-drag":return!0;case"chrome-popup":return!1}},zt="editor",Ft=[],Fc=(e,n,r,a)=>{const o=sr(),{store:i}=s.useHoverContext(),l=s.useGraphSelection().length>0,d=s.useEditorState(u=>u.menuTrigger),c=o.kind==="menu",h=(0,v.useMemo)(()=>d===null?Ft:[(0,m.buildEditMenuTriggerRegion)(d)],[d]);zc(e,n),Ic(e,n,r),Oc(o,n,r),Lc(e),Mc(e),Tc(e,a),(0,v.useEffect)(()=>(i.getState().publishPointerRegions(zt,h),()=>i.getState().publishPointerRegions(zt,Ft)),[i,h]),(0,v.useEffect)(()=>(i.getState().setPointerSuspended(c||l),()=>i.getState().setPointerSuspended(!1)),[i,c,l]),(0,v.useEffect)(()=>{if(!l)return;const u=i.getState();u.setHoverState(m.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[i,l])},Hc=({frameElement:e,panelRect:n})=>{const{measureRef:r,screenRect:a}=s.useElementScreenRect(),o=s.useEditorStore(),i=s.useEditorState(l=>l.caret?.annotationId??null);return(0,v.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,v.useEffect)(()=>()=>{const l=o.getState();l.releaseInteraction("menu"),l.setCaret(null)},[o]),a===null?null:(0,t.jsxs)(mi,{children:[i!==null&&(0,t.jsx)(Bc,{annotationId:i,panelRect:n}),(0,t.jsx)(Gc,{frameElement:e,frameRect:a,panelRect:n})]})},Bc=({annotationId:e,panelRect:n})=>{const r=s.useEditorStore(),{textAnnotations:a}=s.useResolvedAnnotations(n);return(0,v.useEffect)(()=>{a.some(({id:o})=>o===e)||r.getState().setCaret(null)},[e,a,r]),null},Gc=({frameElement:e,frameRect:n,panelRect:r})=>{const a=(0,v.useMemo)(()=>({x:n.left+r.x,y:n.top+r.y}),[n.left,n.top,r.x,r.y]),[o,i]=(0,v.useState)(null);return Fc(e,a,r,o),(0,t.jsx)(Vc,{frameElement:e,frameRect:n,panelOrigin:a,panelRect:r,boxRef:i})},Vc=({frameElement:e,frameRect:n,panelOrigin:r,panelRect:a,boxRef:o})=>{const i=nt(),l=sr();return(0,t.jsx)(s.OverlayPortal,{rect:n,zIndex:s.Z_INDEX.editorOverlay,container:i,"data-testid":"editor-overlay",boxRef:o,children:(0,t.jsxs)(s.PortalThemeProvider,{children:[(0,t.jsx)(ds,{panelRect:a,panelOrigin:r,frameRect:n,frameElement:e}),(0,t.jsx)(_s,{panelRect:a,frameRect:n,frameElement:e}),(0,t.jsx)(Dl,{panelRect:a,frameRect:n,frameElement:e}),(0,t.jsx)(cc,{panelRect:a,frameRect:n,frameElement:e}),(0,t.jsx)(vs,{panelRect:a}),(0,t.jsx)(ys,{panelRect:a}),(0,t.jsx)(al,{panelRect:a}),(0,t.jsx)(fs,{panelRect:a}),(0,t.jsx)(Sc,{interaction:l,panelRect:a}),(0,t.jsx)(Ji,{interaction:l,panelOrigin:r})]})})},Uc=({slots:e,...n})=>(0,t.jsx)(ln,{locale:s.useGraphLocale(),children:(0,t.jsx)(s.EditorProvider,{children:(0,t.jsx)(s.InlineEditorsProvider,{editors:ci,children:(0,t.jsx)(s.GraphRendererBody,{slots:(0,v.useMemo)(()=>({EditorSurface:Hc,...e}),[e]),...n})})})}),cr=(0,v.createContext)(null),dr=({labelId:e,controlId:n,children:r})=>{const a=(0,v.useMemo)(()=>{let o=null;return{labelId:e,controlId:n,claimControlId:i=>(o??=i,o===i)}},[e,n]);return(0,t.jsx)(cr.Provider,{value:a,children:r})},Z=({id:e,ariaLabel:n,ariaLabelledBy:r},a=!0)=>{const o=(0,v.useContext)(cr),i=(0,v.useId)(),[l]=(0,v.useState)(()=>a?o?.claimControlId(i)??!1:!1),d=e??(l?o?.controlId:void 0),c=r??(n===void 0?o?.labelId:void 0);return{...d!==void 0&&{id:d},...n!==void 0&&{"aria-label":n},...c!==void 0&&{"aria-labelledby":c}}};var $c={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},ur=({label:e,icon:n,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:l,id:d})=>{const c=Z({id:d,ariaLabel:i,ariaLabelledBy:l}),h=a==="tile";return(0,t.jsxs)("button",{type:"button",className:$c[a],disabled:o,onClick:r,...c,children:[n!==void 0&&(0,t.jsx)("span",{className:"woi4bh0",children:n}),e!==void 0&&(0,t.jsx)("span",{className:h?"woi4bh2":"woi4bh1",children:e})]})},ct=(0,v.createContext)(null),_=()=>{const e=(0,v.useContext)(ct);if(!e)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return e},hr=({children:e,onKeyDown:n,...r})=>{const a=(0,v.useContext)(ct),o=i=>{if(n?.(i),!a||i.defaultPrevented)return;const l=s.resolveHistoryStep(i.nativeEvent);l&&(i.preventDefault(),l==="undo"?a.undo():a.redo())};return(0,t.jsx)("div",{onKeyDown:o,...r,children:e})},pr="keyboard",Me=e=>{const n=(0,v.useRef)(!1),r=(0,v.useRef)(!1),a=()=>{n.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(n.current){r.current=!0;return}e?.()},commitUnlessHeldKey:o=>{if(o){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{n.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},qc="eh8dvc0",Wc="eh8dvc1 uz3g760",Kc="eh8dvc2 uz3g761";var mr=({value:e,onChange:n,onCommit:r,min:a,max:o,step:i,placeholder:l,prefix:d,suffix:c,isDisabled:h,hasError:u,ariaLabel:p,ariaLabelledBy:f,id:g})=>{const x=Z({id:g,ariaLabel:p,ariaLabelledBy:f}),{commitUnlessHeldKey:b,gestureHandlers:T}=Me(r);return(0,t.jsx)(ft.NumberField.Root,{className:qc,value:e,onValueChange:w=>n(w),onValueCommitted:(w,y)=>{b(y.reason===pr)},min:a,max:o,step:i,disabled:h,children:(0,t.jsxs)(hr,{className:Wc,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[d!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:d}),(0,t.jsx)(ft.NumberField.Input,{className:Kc,placeholder:l,...T,"aria-invalid":u===!0?!0:void 0,...x}),c!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:c})]})})},Xc="_1b7s5f0",ee={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Zc="_1b7s5f7";var Yc=6,gr=({options:e,value:n,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:l,ariaLabel:d,ariaLabelledBy:c,id:h})=>{const u=Z({id:h,ariaLabel:d,ariaLabelledBy:c}),p=i==="swatch",{commitAfterChange:f,gestureHandlers:g}=Me(a);return(0,t.jsx)(an.RadioGroup,{className:(0,V.default)(Xc,Jc(o??e.length)),value:n,onValueChange:x=>{r(x),f()},...g,disabled:l,...u,children:e.map(x=>(0,t.jsxs)(on.Radio.Root,{value:x.value,disabled:x.isDisabled,className:(0,V.default)(Zc,p&&"_1b7s5f8"),"aria-label":p?x.label:void 0,children:[x.icon,!p&&(0,t.jsx)("span",{className:"_1b7s5f9",children:x.label})]},x.value))})},Jc=e=>{switch(Math.min(Math.max(Math.round(e),1),Yc)){case 1:return ee[1];case 2:return ee[2];case 3:return ee[3];case 4:return ee[4];case 5:return ee[5];default:return ee[6]}},Qc="_1g5x15w0 uz3g760",ed="_1g5x15w1",td="_1g5x15w2",Ht="_1g5x15w3",nd="_1g5x15w4",rd="_1g5x15w5",od="_1g5x15w6",ad="_1g5x15w7";var xr=({options:e,value:n,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=Z({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,t.jsxs)($.Select.Root,{value:n,onValueChange:u=>u!==null&&r(u),disabled:o,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,t.jsxs)($.Select.Trigger,{className:Qc,"data-error":i===!0,...h,children:[(0,t.jsx)($.Select.Value,{className:ed,children:u=>id(e,u,a)}),(0,t.jsx)($.Select.Icon,{className:Ht,children:(0,t.jsx)(ce,{size:"sm"})})]}),(0,t.jsx)($.Select.Portal,{container:s.resolvePortalContainer(),children:(0,t.jsx)(s.PortalThemeProvider,{children:(0,t.jsx)($.Select.Positioner,{className:nd,sideOffset:4,alignItemWithTrigger:!1,children:(0,t.jsx)($.Select.Popup,{className:rd,children:e.map(u=>(0,t.jsxs)($.Select.Item,{value:u.value,disabled:u.isDisabled,className:od,children:[u.icon,(0,t.jsxs)("span",{className:ad,children:[(0,t.jsx)($.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,t.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,t.jsx)($.Select.ItemIndicator,{className:Ht,children:(0,t.jsx)(Cn,{size:"sm"})})]},u.value))})})})})]})},id=(e,n,r)=>n===null?(0,t.jsx)("span",{className:td,children:r}):ld(e,n),ld=(e,n)=>e.find(r=>r.value===n)?.label??n,sd="vod76w0",cd="vod76w1",dd="vod76w2",ud="vod76w3",hd="vod76w4",pd="vod76w5";var fr=({value:e,onChange:n,onCommit:r,min:a,max:o,step:i,suffix:l,formatValue:d,isDisabled:c,ariaLabel:h,ariaLabelledBy:u})=>{const p=Z({ariaLabel:h,ariaLabelledBy:u},!1),f=md(e,l,d),{commitUnlessHeldKey:g,gestureHandlers:x}=Me(r);return(0,t.jsxs)("div",{className:sd,children:[(0,t.jsx)(q.Slider.Root,{className:cd,value:e,onValueChange:b=>n(b),onValueCommitted:(b,T)=>{g(T.reason===pr)},min:a,max:o,step:i,disabled:c,children:(0,t.jsx)(q.Slider.Control,{className:dd,children:(0,t.jsxs)(q.Slider.Track,{className:ud,children:[(0,t.jsx)(q.Slider.Indicator,{className:hd}),(0,t.jsx)(q.Slider.Thumb,{className:pd,...x,...p})]})})}),f!==null&&(0,t.jsx)("span",{className:"vod76w6",children:f})]})},md=(e,n,r)=>r!==void 0?r(e):n!==void 0?`${e}${n}`:null,gd="_1hyrlw60",xd="_1hyrlw61",vr=({isChecked:e,onChange:n,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const l=Z({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,t.jsx)(vt.Switch.Root,{checked:e,onCheckedChange:d=>n(d),disabled:r,className:gd,...l,children:(0,t.jsx)(vt.Switch.Thumb,{className:xd})})},fd="uz3g761",vd="tpcnun0 uz3g760",br=({value:e,onChange:n,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=Z({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,t.jsx)(hr,{className:vd,"data-error":i===!0,children:(0,t.jsx)(po.Input,{className:fd,value:e,onValueChange:u=>n(u),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...h})})},bd="cnu9yl0",Cd="cnu9yl1";var Cr=({options:e,value:n,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=Z({id:c,ariaLabel:l,ariaLabelledBy:d}),u=o==="stacked",{commitAfterChange:p,gestureHandlers:f}=Me(a);return(0,t.jsx)(an.RadioGroup,{className:bd,value:n,onValueChange:g=>{r(g),p()},...f,disabled:i,...h,children:e.map(g=>(0,t.jsxs)(on.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,V.default)(Cd,u&&"cnu9yl2"),"aria-label":Sd(g,u),children:[g.icon,Sr(g,u)&&(0,t.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Sr=(e,n)=>e.icon===void 0||n,Sd=(e,n)=>{if(!Sr(e,n))return e.label},yr={ToggleGroup:Cr,Switch:vr,Slider:fr,RadioGrid:gr,Button:ur,TextField:br,NumberField:mr,Select:xr},jr=(0,v.createContext)(yr),yd=({controls:e,children:n})=>{const r=(0,v.useMemo)(()=>({...yr,...e}),[e]);return(0,t.jsx)(jr.Provider,{value:r,children:n})},N=()=>(0,v.useContext)(jr),jd="_12lhx9e0",Tr=({children:e})=>(0,t.jsx)("div",{className:jd,children:e}),Td="_139ohwv0",H=({children:e})=>(0,t.jsx)("div",{className:Td,children:e}),wr=(0,v.createContext)(null),wd=wr.Provider,Ar=()=>{const e=(0,v.useContext)(wr);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},Ad="_1jlczkt0",Pr="data-graphy-editor-panel",Pd={List:H,Grid:Tr};function Ld(e){if(e===void 0)return!1;const n=e.split(/\s+/);return n.includes("_1ii3bsb0")||n.includes("_1ii3bsb1")}var kd=({handle:e,children:n,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=s.useGraphHandle(e),{themeClass:l,inlineVarsStyle:d}=s.useThemeContext(),[c,h]=(0,v.useState)(()=>a?[a]:[]),u=(0,v.useMemo)(()=>({expandSection:p=>h([p]),collapseAllSections:()=>h([])}),[]);return(0,t.jsx)(ct.Provider,{value:i,children:(0,t.jsx)(yd,{controls:r,children:(0,t.jsx)(wd,{value:u,children:(0,t.jsx)(le.Accordion.Root,{[Pr]:"",className:(0,V.default)(Ad,o,{[l]:!Ld(o)}),style:d,value:c,onValueChange:p=>h(p),children:n})})})})},dt={Root:kd,Controls:Pd},Bt={stack:"pr583x0",grid:"pr583x1"},Gt="pr583x2",Id={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},S=({label:e,layout:n="grid",icon:r,children:a})=>{const o=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,t.jsx)("div",{className:Bt[n],children:(0,t.jsx)("div",{className:Gt,children:a})}):(0,t.jsxs)("div",{className:Bt[n],children:[(0,t.jsxs)("label",{id:o,htmlFor:i,className:Id[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,t.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,t.jsx)("div",{className:Gt,children:(0,t.jsx)(dr,{labelId:o,controlId:i,children:a})})]})},Ed=e=>(0,t.jsx)(s.Icon,{...e,children:(0,t.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"m9 6 6 6-6 6"})})}),ut="_40zvwv0",ht="_40zvwv1",Md="_40zvwv2",Lr="_40zvwv3",_d="_40zvwv4 _40zvwv3";var Nd="_40zvwv6";var Rd="_40zvwv8",z=({title:e,layout:n="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>n==="collapsible"?(0,t.jsx)(Dd,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):n==="inline"&&r===void 0?(0,t.jsx)(Od,{title:e,accessory:a,children:i}):(0,t.jsxs)("div",{className:ut,children:[(0,t.jsxs)("div",{className:ht,children:[(0,t.jsx)("span",{className:Lr,children:e}),r!==void 0&&(0,t.jsx)("span",{className:"_40zvwv5",children:r}),a!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,t.jsx)("div",{children:i})]}),Od=({title:e,accessory:n,children:r})=>{const a=(0,v.useId)(),o=(0,v.useId)();return(0,t.jsx)("div",{className:ut,children:(0,t.jsxs)("div",{className:ht,children:[(0,t.jsx)("label",{id:a,htmlFor:o,className:_d,children:e}),(0,t.jsx)("span",{className:Nd,children:(0,t.jsx)(dr,{labelId:a,controlId:o,children:r})}),n!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:n})]})})},Dd=({title:e,preview:n,accessory:r,onOpenChange:a,children:o})=>{const i=s.useI18n();return(0,t.jsxs)(le.Accordion.Item,{value:e,className:ut,onOpenChange:a,children:[(0,t.jsxs)(le.Accordion.Header,{className:ht,render:(0,t.jsx)("div",{}),children:[(0,t.jsx)(le.Accordion.Trigger,{className:Md,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,t.jsx)("span",{className:Lr,children:e}),n!==void 0&&(0,t.jsx)("span",{className:"_40zvwv5",children:n}),r!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:r}),(0,t.jsx)("span",{className:Rd,children:(0,t.jsx)(Ed,{size:"sm"})})]}),(0,t.jsx)(le.Accordion.Panel,{children:(0,t.jsx)("div",{children:o})})]})},kr=({title:e,isChecked:n,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:l,collapseAllSections:d}=Ar(),{Switch:c}=N(),h=p=>{r(p),p?l(e):d()},u=p=>{p&&!n&&a!==!0&&r(!0)};return(0,t.jsx)(z,{title:e,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,t.jsx)(c,{isChecked:n,onChange:h,isDisabled:a,ariaLabel:e}),children:i})},zd={horizontal:["bottom","top"],vertical:["left","right"]},Fd={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Hd={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},Ke=({axis:e,title:n,layout:r="collapsible",preview:a})=>{const o=_(),i=s.useHandleCompiled(o),l=s.useI18n(),{NumberField:d,Switch:c,TextField:h,ToggleGroup:u}=N();if(!i)return null;const p=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",f=i.config.axes[e],g=i.scales[e],x=g?.spec,b=x?.scaleType==="continuous"?x:void 0;if(p==="circular"||p==="radial"&&b===void 0)return null;const T=x!==void 0&&"reverse"in x?x:void 0,w=x?.scaleType==="continuous"||x?.scaleType==="datetime",y=e==="y"&&b!==void 0&&i.layers.some(j=>j.yScaleType==="primary"&&j.geom==="bar"),P=b?.transform==="log",C=b?.domainMax??null,I=Bd(b),D=(j,K)=>j.map(he=>({value:he,label:K(he)})),R=i.guides.axes.find(j=>j.scaleAestheticKey===e)?.position,L=zd[R==="bottom"||R==="top"||R===void 0&&e==="x"?"horizontal":"vertical"],E=e==="y"?(0,m.readComboLineLayerId)(i.spec):null,A=E===null?void 0:i.spec.layers.find(j=>j.id===E),O=i.guides.legends.drawn.some(j=>L.some(K=>K===j.position)),Y=L.map(j=>({value:j,label:l(Fd[j])})),Fr=D(["auto","edges"],j=>l(j==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),Hr=D(["linear","log"],j=>l(j==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Br=D(["auto","zero","custom"],j=>l(j==="zero"?"editor.axesPanel.startFrom.zero":j==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Gr=D(["auto","custom"],j=>l(j==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Vr=D(["no","yes"],j=>l(j==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Ur=D(["single","double"],j=>l(j==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),$r=j=>{o.commands.dispatch(new m.SetAxisVisibilityCommand({axis:e,isVisible:j}))},qr=j=>{o.commands.dispatch(new m.SetAxisLabelCommand({axis:e,label:j===""?null:j}),{transient:!0})},Wr=j=>{o.commands.dispatch(new m.SetAxisTicksVisibilityCommand({axis:e,isVisible:j}))},Kr=j=>{o.commands.dispatch(new m.SetAxisTickModeCommand({axis:e,tickMode:j==="edges"?"edges":"auto"}))},Xr=j=>{o.commands.dispatch(new m.SetScaleReverseCommand({scaledAesthetic:e,reverse:j==="yes"}))},Zr=j=>{o.commands.dispatch(new m.SetScaleTransformCommand({scaledAesthetic:e,transform:j==="log"?"log":"linear"}))},gt=j=>{o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,...j}),{transient:!0})},Yr=j=>{j!==null&&gt({domainMin:j})},Jr=j=>{j!==null&&gt({domainMax:j})},Qr=j=>{if(b){if(j==="custom"){b.zero&&o.commands.dispatch(new m.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,domainMin:Vt(g?.domain,"start")}));return}b.domainMin!==null&&o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),o.commands.dispatch(new m.SetScaleZeroCommand({scaledAesthetic:e,zero:j==="zero"}))}},eo=j=>{const K=j==="custom"?Vt(g?.domain,"end"):null;o.commands.dispatch(new m.SetScaleDomainCommand({scaledAesthetic:e,domainMax:K}))},to=j=>{A!==void 0&&o.commands.dispatch(new m.SetLayerYScaleTypeCommand({layerId:A.id,yScaleType:j==="double"?"secondary":"primary"}))},no=j=>{const K=L.find(he=>he===j);K&&o.commands.dispatch(new m.SetAxisPositionCommand({axis:e,position:K}))};return(0,t.jsx)(z,{title:n??l(Hd[e]),layout:r,preview:a,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.visible"),children:(0,t.jsx)(c,{isChecked:f.isVisible,onChange:$r})}),A!==void 0&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.numberOfAxes"),children:(0,t.jsx)(u,{value:A.yScaleType==="secondary"?"double":"single",options:Ur,onChange:to})}),p==="linear"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.title"),children:(0,t.jsx)(h,{value:f.label??"",onChange:qr,onCommit:o.commands.seal})}),(0,t.jsx)(S,{label:l("editor.axesPanel.controls.ticks"),children:(0,t.jsx)(c,{isChecked:f.ticks.isVisible,onChange:Wr})})]}),w&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.labels"),children:(0,t.jsx)(u,{value:f.ticks.mode,options:Fr,onChange:Kr})}),b&&p==="linear"&&!O&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.position"),children:(0,t.jsx)(u,{value:R??f.position,options:Y,onChange:no})}),T!==void 0&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.reverse"),children:(0,t.jsx)(u,{value:T.reverse===!0?"yes":"no",options:Vr,onChange:Xr})}),b&&!y&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.scale"),children:(0,t.jsx)(u,{value:P?"log":"linear",options:Hr,onChange:Zr})}),b&&!P&&(0,t.jsxs)(t.Fragment,{children:[!y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.startFrom"),children:(0,t.jsx)(u,{value:I,options:Br,onChange:Qr})}),I==="custom"&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.value"),children:(0,t.jsx)(d,{value:b.domainMin??null,onChange:Yr,onCommit:o.commands.seal})})]}),(0,t.jsx)(S,{label:l("editor.axesPanel.controls.endAt"),children:(0,t.jsx)(u,{value:C===null?"auto":"custom",options:Gr,onChange:eo})}),C!==null&&(0,t.jsx)(S,{label:l("editor.axesPanel.controls.value"),children:(0,t.jsx)(d,{value:C,onChange:Jr,onCommit:o.commands.seal})})]})]})})},Bd=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",Vt=(e,n)=>{const r=n==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},pt=({value:e,onChange:n})=>{const r=_(),a=s.useI18n(),{TextField:o}=N(),i=e!==null&&typeof e!="string",l=d=>n(d===""?null:d);return(0,t.jsx)(S,{label:a("editor.elementsPanel.contentValue"),children:(0,t.jsx)(o,{value:typeof e=="string"?e:"",onChange:l,onCommit:r.commands.seal,isDisabled:i})})},Ir=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},h=u=>{a.commands.dispatch(new m.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isCaptionVisible,onChange:c})}),(0,t.jsx)(pt,{value:d.caption,onChange:h})]})})},Ut=/^[a-z][a-z\d+.-]*:/i,Gd={},Er=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=h=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"source",isVisible:h}))};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isSourceVisible,onChange:c})}),(0,t.jsx)(Vd,{source:d.source??Gd})]})})},Vd=({source:e})=>{const n=_(),r=s.useI18n(),{TextField:a}=N(),o=c=>{const h=(c.label??"")!==""||(c.url??"")!=="";n.commands.dispatch(new m.SetContentSourceCommand({source:h?c:null}),{transient:!0})},i=()=>{const c=e.url??"";c!==""&&!Ut.test(c)&&o({...e,url:`https://${c}`}),n.commands.seal()},l=c=>o({...e,url:c}),d=c=>o({...e,label:c});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,t.jsx)(a,{value:e.url??"",onChange:l,onCommit:i,hasError:Ut.test(e.url??"")&&!(0,m.isSafeUrl)(e.url)})}),(0,t.jsx)(S,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,t.jsx)(a,{value:e.label??"",onChange:d,onCommit:n.commands.seal})})]})},Mr=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},h=u=>{a.commands.dispatch(new m.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isSubtitleVisible,onChange:c})}),(0,t.jsx)(pt,{value:d.subtitle,onChange:h})]})})},Xe=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],Ud=Xe.length/2,_r=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=N();if(!o)return null;const{textScale:d}=o.config.appearance,c=p=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${p}`}),h=Xe.map(p=>({value:`${p}`,label:c(p)})),u=p=>{const f=Xe.find(g=>`${g}`===p);f!==void 0&&a.commands.dispatch(new m.SetAppearanceTextScaleCommand({textScale:f}))};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:n,preview:r??c(d),children:(0,t.jsx)(l,{value:`${d}`,options:h,columns:Ud,onChange:u,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Nr=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=N();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new m.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},h=u=>{a.commands.dispatch(new m.SetContentTitleCommand({title:u}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(l,{isChecked:d.isTitleVisible,onChange:c})}),(0,t.jsx)(pt,{value:d.title,onChange:h})]})})},$d=({children:e,...n})=>(0,t.jsx)(dt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Nr,{}),(0,t.jsx)(Mr,{}),(0,t.jsx)(Ir,{}),(0,t.jsx)(Er,{}),(0,t.jsx)(_r,{})]})}),qd=({children:e,...n})=>(0,t.jsx)(dt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ke,{axis:"x"}),(0,t.jsx)(Ke,{axis:"y"})]})}),_e=e=>`${e}px`,Rr=e=>`${Math.round(e*100)}%`,Wd=e=>`${e}°`,Kd=24,Xd={select:{target:"graph"}},$t=["dim","desaturate"],Zd=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=N();if(!o)return null;const c=(0,m.createStyleResolver)().chromeReaders(o.chrome).graph.get("borderRadius"),h=(0,m.readHighlightDimStyle)(o.spec),u=$t.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),p=g=>{const x=(0,m.findStyleRule)(o.spec.styles.overrides,Xd)?.declarations??{};a.commands.dispatch(new m.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...x,borderRadius:g}}}),{transient:!0})},f=g=>{const x=$t.find(b=>b===g);x&&a.commands.dispatch(new m.SetHighlightDimStyleCommand({dimStyle:x}))};return(0,t.jsx)(z,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,t.jsx)(l,{value:c,min:0,max:Kd,step:1,formatValue:_e,onChange:p,onCommit:a.commands.seal})}),(0,t.jsx)(S,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,t.jsx)(d,{value:h,options:u,onChange:f})})]})})},mt=(e,n)=>{const{colorScheme:r}=s.useThemeContext();return(0,v.useMemo)(()=>{const a=e?.layers.find(o=>o.id===n);return a===void 0?null:(0,m.createStyleResolver)({colorScheme:r}).geomReaders(a)},[e,n,r])},Yd=.05,Jd=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=N(),c=o?(0,m.findLayerByGeom)(o.spec.layers,"bar"):void 0,h=mt(o,c?.id??null);if(!o||!c||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=g=>{a.commands.dispatch(new m.SetBarWidthCommand({layerId:c.id,width:g}),{transient:!0})},p=g=>{const x=m.BORDER_RADIUS_TOKENS.find(b=>b===g);x&&a.commands.dispatch(new m.SetBarBorderRadiusCommand({layerId:c.id,borderRadius:x}))},f=m.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:i(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,t.jsx)(z,{title:e??i("editor.graphPanel.barSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.barSection.thickness"),children:(0,t.jsx)(l,{value:c.params.width,min:m.MIN_BAR_WIDTH,max:m.MAX_BAR_WIDTH,step:Yd,formatValue:Rr,onChange:u,onCommit:a.commands.seal})}),(0,t.jsx)(S,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,t.jsx)(d,{value:h?.get("borderRadius")??m.DEFAULT_BAR_BORDER_RADIUS,options:f,onChange:p})})]})})},Ne=({children:e})=>{const n=(0,v.useId)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("g",{filter:`url(#${n})`,children:e}),(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:n,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,t.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,t.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},Re="qdaoth0",Qd=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 31 33",...e,children:[(0,t.jsx)(Ne,{children:(0,t.jsx)("path",{className:Re,fillRule:"evenodd",clipRule:"evenodd",d:"M25.7417 6.23664C25.7417 6.09417 25.7076 5.95967 25.6471 5.84086C25.5633 5.67624 25.4288 5.54173 25.2641 5.4579C25.1453 5.39739 25.0108 5.36328 24.8684 5.36328H12.0591C11.5767 5.36328 11.1857 5.7543 11.1857 6.23664C11.1857 6.71899 11.5767 7.11 12.0591 7.11H22.7599L5.61908 24.2508C5.27801 24.5919 5.27801 25.1448 5.61908 25.4859C5.96015 25.827 6.51313 25.827 6.8542 25.4859L23.995 8.34513V19.0459C23.995 19.5283 24.386 19.9193 24.8684 19.9193C25.3507 19.9193 25.7417 19.5283 25.7417 19.0459V6.23664ZM20.995 15.5878V19.0459C20.995 21.1851 22.7292 22.9193 24.8684 22.9193C27.0076 22.9193 28.7417 21.1851 28.7417 19.0459V6.23664C28.7417 4.09744 27.0076 2.36328 24.8684 2.36328H12.0591C9.91985 2.36328 8.18569 4.09744 8.18569 6.23664C8.18569 8.37584 9.91985 10.11 12.0591 10.11H15.5172L3.49777 22.1295C1.98512 23.6421 1.98513 26.0946 3.49776 27.6072C5.0104 29.1199 7.46288 29.1199 8.97552 27.6072L20.995 15.5878Z"})}),(0,t.jsx)("path",{fill:"currentColor",d:"M12.0591 7.11C11.5767 7.11 11.1857 6.71899 11.1857 6.23664C11.1857 5.7543 11.5767 5.36328 12.0591 5.36328H24.8684C25.3507 5.36328 25.7417 5.7543 25.7417 6.23664V19.0459C25.7417 19.5283 25.3507 19.9193 24.8684 19.9193C24.386 19.9193 23.995 19.5283 23.995 19.0459V8.34512L6.8542 25.4859C6.51313 25.827 5.96015 25.827 5.61908 25.4859C5.27801 25.1448 5.27801 24.5919 5.61908 24.2508L22.7599 7.11H12.0591Z"})]}),eu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 32 32",...e,children:(0,t.jsxs)(Ne,{children:[(0,t.jsx)("path",{className:Re,d:"M11 21H21V11H11V21ZM29 23C29 26.3137 26.3137 29 23 29H9C5.68629 29 3 26.3137 3 23V9C3 5.68629 5.68629 3 9 3H23C26.3137 3 29 5.68629 29 9V23Z"}),(0,t.jsx)("path",{fill:"currentColor",d:"M24.25 9C24.25 8.30964 23.6904 7.75 23 7.75H9C8.30964 7.75 7.75 8.30964 7.75 9V23C7.75 23.6904 8.30964 24.25 9 24.25H23C23.6904 24.25 24.25 23.6904 24.25 23V9ZM25.75 23C25.75 24.5188 24.5188 25.75 23 25.75H9C7.48122 25.75 6.25 24.5188 6.25 23V9C6.25 7.48122 7.48122 6.25 9 6.25H23C24.5188 6.25 25.75 7.48122 25.75 9V23Z"})]})}),tu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(Ne,{children:(0,t.jsx)("path",{className:Re,fillRule:"evenodd",clipRule:"evenodd",d:"M4.89961 14.7968C3.08522 13.5116 1.89961 11.3966 1.89961 9.00039C1.89961 5.07917 5.07839 1.90039 8.99961 1.90039C10.7798 1.90039 12.4069 2.55553 13.6531 3.63785C14.3179 3.17306 15.1269 2.90039 15.9996 2.90039L22.9996 2.90039C25.264 2.90039 27.0996 4.73602 27.0996 7.00039L27.0996 9.7243C27.5717 9.92414 28.014 10.2165 28.3987 10.6013C29.9999 12.2024 29.9999 14.7984 28.3987 16.3995L27.9182 16.8801C29.2628 18.172 30.0996 19.9885 30.0996 22.0004C30.0996 25.9216 26.9208 29.1004 22.9996 29.1004C21.2195 29.1004 19.5923 28.4453 18.3461 27.3629C17.6813 27.8277 16.8723 28.1004 15.9996 28.1004L8.99961 28.1004C6.73524 28.1004 4.89961 26.2648 4.89961 24.0004L4.89961 14.7968Z"})}),(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M25.25 22C25.25 20.7574 24.2426 19.75 23 19.75C21.7574 19.75 20.75 20.7574 20.75 22C20.75 23.2426 21.7574 24.25 23 24.25C24.2426 24.25 25.25 23.2426 25.25 22ZM23 18.25C25.0711 18.25 26.75 19.9289 26.75 22C26.75 24.0711 25.0711 25.75 23 25.75C20.9289 25.75 19.25 24.0711 19.25 22C19.25 19.9289 20.9289 18.25 23 18.25ZM11.25 9C11.25 7.75736 10.2426 6.75 9 6.75C7.75736 6.75 6.75 7.75736 6.75 9C6.75 10.2426 7.75736 11.25 9 11.25C10.2426 11.25 11.25 10.2426 11.25 9ZM9.75 12.675C11.4617 12.3275 12.75 10.8142 12.75 9C12.75 6.92893 11.0711 5.25 9 5.25C6.92893 5.25 5.25 6.92893 5.25 9C5.25 10.8142 6.53832 12.3275 8.25 12.675L8.25 24C8.25 24.4142 8.58579 24.75 9 24.75L16 24.75C16.4142 24.75 16.75 24.4142 16.75 24L16.75 7.75L22.25 7.75L22.25 14.1893L21.0303 12.9697C20.7374 12.6768 20.2626 12.6768 19.9697 12.9697C19.6768 13.2626 19.6768 13.7374 19.9697 14.0303L22.4697 16.5303C22.7626 16.8232 23.2374 16.8232 23.5303 16.5303L26.0303 14.0303C26.3232 13.7374 26.3232 13.2626 26.0303 12.9697C25.7374 12.6768 25.2626 12.6768 24.9697 12.9697L23.75 14.1893L23.75 7C23.75 6.58579 23.4142 6.25 23 6.25L16 6.25C15.5858 6.25 15.25 6.58579 15.25 7L15.25 23.25L9.75 23.25L9.75 12.675Z"})]}),nu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(Ne,{children:(0,t.jsx)("path",{className:Re,d:"M20.7271 2C21.4372 2 21.7114 2.00463 22.0841 2.03504C22.8228 2.0954 23.4839 2.25122 24.1592 2.59527C25.1865 3.1188 26.0219 3.9541 26.5458 4.98208C26.8896 5.65706 27.0454 6.31812 27.1057 7.05672C27.1301 7.35469 27.1379 7.58979 27.14 8.03558L27.1408 9.10155C27.1408 11.2114 25.4304 12.922 23.3205 12.922C21.4083 12.922 19.8243 11.5172 19.5441 9.68336L19.538 9.64H18.39V21.687L20.0392 21.6877C22.149 21.6877 23.8595 23.398 23.8595 25.508C23.8595 27.6178 22.149 29.3283 20.0392 29.3283H9.10159C6.99169 29.3283 5.28127 27.6178 5.28127 25.508C5.28127 23.398 6.99172 21.6877 9.10159 21.6877L10.75 21.687V9.64H9.601L9.59661 9.68334C9.32609 11.4539 7.84018 12.8246 6.01692 12.917L5.82032 12.922C3.71035 12.922 2 11.2114 2 9.10155V8.41371C2 7.70349 2.00463 7.42929 2.03504 7.05674C2.09538 6.31803 2.25122 5.65681 2.59521 4.98173C3.11877 3.95419 3.95418 3.11876 4.98174 2.5952C5.65683 2.25122 6.31798 2.09539 7.057 2.03501C7.42935 2.00463 7.70354 2 8.41371 2H20.7271Z"})}),(0,t.jsx)("path",{fill:"currentColor",d:"M8.41371 5H20.7271C21.1595 5 21.5325 5 21.8398 5.02507C22.1641 5.05157 22.4867 5.11007 22.7971 5.26822C23.2601 5.50416 23.6366 5.88064 23.8726 6.3437C24.0307 6.65409 24.0892 6.97666 24.1157 7.30097C24.1408 7.60823 24.1408 7.98127 24.1408 8.41369V9.10155C24.1408 9.55465 23.7735 9.92195 23.3205 9.92195C22.8674 9.92195 22.5001 9.55465 22.5001 9.10155V8.44533C22.5001 7.97237 22.4995 7.66699 22.4805 7.43457C22.4623 7.21172 22.4314 7.12909 22.4107 7.08853C22.3321 6.93418 22.2066 6.80869 22.0522 6.73004C22.0117 6.70938 21.9291 6.67847 21.7062 6.66026C21.4738 6.64127 21.1684 6.64063 20.6954 6.64063H15.3907V24.6877H20.0392C20.4922 24.6877 20.8595 25.0549 20.8595 25.508C20.8595 25.961 20.4922 26.3283 20.0392 26.3283H9.10159C8.64854 26.3283 8.28127 25.961 8.28127 25.508C8.28127 25.0549 8.64854 24.6877 9.10159 24.6877H13.7501V6.64063H8.44533C7.97238 6.64063 7.66699 6.64127 7.43457 6.66026C7.21172 6.67847 7.1291 6.70938 7.08854 6.73004C6.93418 6.80869 6.80869 6.93418 6.73004 7.08853C6.70938 7.12909 6.67847 7.21172 6.66026 7.43457C6.64127 7.66699 6.64063 7.97237 6.64063 8.44533V9.10155C6.64063 9.55465 6.27337 9.92195 5.82032 9.92195C5.36727 9.92195 5 9.55465 5 9.10155V8.41371C5 7.98128 5 7.60823 5.02508 7.30097C5.05157 6.97666 5.11007 6.65409 5.26823 6.3437C5.50417 5.88064 5.88064 5.50416 6.3437 5.26822C6.65409 5.11007 6.97666 5.05157 7.30097 5.02507C7.60824 5 7.98129 5 8.41371 5Z"})]}),ru={x:.5,y:.5},ou=.2,au={x:.375,y:.25,width:.25,height:.5},iu={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},lu={x:.4,y:.6},su={x:.6,y:.4},cu="relative-difference",du=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Button:l}=N();if(!o)return null;const d=()=>{a.commands.dispatch(new m.AddAnnotationCommand({kind:"text",annotation:{...m.TEXT_ANNOTATION_DEFAULTS,content:uu(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...ru},width:ou}}))},c=()=>{a.commands.dispatch(new m.AddAnnotationCommand({kind:"arrow",annotation:{...m.ARROW_DEFAULTS,start:{anchorType:"panel",...lu},end:{anchorType:"panel",...su}}}))},h=()=>{a.commands.dispatch(new m.AddAnnotationCommand({kind:"shape",annotation:{...m.SHAPE_DEFAULTS,...iu,region:{anchorType:"panel",...au}}}))},u=()=>{const f=(0,m.inferDefaultDifferenceArrowEndpoints)(o);f!==null&&a.commands.dispatch(new m.AddAnnotationCommand({kind:"differenceArrow",annotation:{...m.DIFFERENCE_ARROW_DEFAULTS,...f,label:cu}}))},p=o.coordSystem.type==="cartesian";return(0,t.jsx)(z,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:n,preview:r,children:(0,t.jsxs)(Tr,{children:[(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(nu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(Qd,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:c}),(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(eu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),p&&(0,t.jsx)(l,{variant:"tile",icon:(0,t.jsx)(tu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},uu=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),hu=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{ToggleGroup:l}=N();if(!o)return null;const d=(0,m.readChartType)(o.spec);if(d===null||!(0,m.isComboChartType)(d))return null;const c=m.COMBO_TYPES.map(u=>({value:u,label:i(`editor.graphPanel.comboSection.types.${u}`)})),h=u=>{const p=m.COMBO_TYPES.find(f=>f===u);p&&a.commands.dispatch(new m.SetChartTypeCommand({coordType:"cartesian",comboType:p}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.comboSection.title"),layout:n,preview:r??i(`editor.graphPanel.comboSection.types.${d.comboType}`),children:(0,t.jsx)(l,{value:d.comboType,options:c,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},pu=.1,mu=20,gu=({title:e,preview:n})=>{const r=_(),a=s.useHandleCompiled(r),o=s.useI18n(),{NumberField:i,TextField:l}=N();if(!a||a.coordSystem.type==="polar")return null;const d=(0,m.findGoalLineLayer)(a.spec.layers),c=e??o("editor.annotationsPanel.goalSection.title"),h=(0,m.extractConstantValue)(d?.mapping.y),u=typeof h=="number"?h:null,p=x=>{const b=new m.ToggleGoalLineCommand({showGoalLine:x,value:xu(a),...d!==void 0&&{layerId:d.id}});r.commands.dispatch(b)},f=x=>{if(d===void 0)return;const b=new m.SetRuleLabelCommand({layerId:d.id,label:x===""?null:x});r.commands.dispatch(b,{transient:!0})},g=x=>{if(d===void 0||x===null)return;const b=new m.SetRuleValueCommand({layerId:d.id,value:x});r.commands.dispatch(b,{transient:!0})};return(0,t.jsx)(kr,{title:c,preview:n,isChecked:d!==void 0,onToggle:p,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,t.jsx)(l,{value:d?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:f,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,t.jsx)(S,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,t.jsx)(i,{value:u,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},xu=e=>{const n=(e.scales.y?.domain??[]).filter(l=>typeof l=="number");if(n.length===0)return 0;const r=Math.max(...n),a=r-Math.min(...n),o=a>0?a:Math.abs(r);if(o===0)return 0;const i=Math.min(mu,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*pu).toFixed(i))},fu=({layerId:e,title:n,layout:r="collapsible",preview:a})=>{const o=_(),i=s.useHandleCompiled(o),l=s.useI18n(),{Switch:d}=N();if(!i)return null;const c=e===void 0?i.spec.layers[0]:i.spec.layers.find(R=>R.id===e);if(!c)return null;const{showDataLabels:h,format:u,showStackTotals:p,showCategoryLabels:f}=c.dataLabels,g=i.coordSystem.type==="polar",x=c.geom==="bar",b=c.position==="stack"||c.position==="fill",T=x&&!g&&c.position==="stack",w=x&&(!g||h),y=x||c.geom==="area"&&b;if(!(0,m.canPlaceDataLabels)(c.geom,i.coordSystem.type))return null;const P=R=>{const L=new m.ToggleDataLabelsCommand({layerId:c.id,showDataLabels:R});o.commands.dispatch(L)},C=R=>{const L=new m.SetDataLabelsFormatCommand({layerId:c.id,format:R?"percentage":"absolute"});o.commands.dispatch(L)},I=R=>{const L=new m.ToggleStackTotalsCommand({layerId:c.id,showStackTotals:R});o.commands.dispatch(L)},D=R=>{const L=new m.ToggleCategoryLabelsCommand({layerId:c.id,showCategoryLabels:R});o.commands.dispatch(L)};return(0,t.jsx)(z,{title:n??l("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.dataLabels"),children:(0,t.jsx)(d,{isChecked:h,onChange:P})}),h&&y&&(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.showPercentages"),children:(0,t.jsx)(d,{isChecked:u==="percentage",onChange:C})}),T&&(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.stackTotals"),children:(0,t.jsx)(d,{isChecked:p,onChange:I})}),w&&(0,t.jsx)(S,{label:l("editor.graphPanel.graphOptions.categoryLabels"),children:(0,t.jsx)(d,{isChecked:f,onChange:D})})]})})},vu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M5.744 5.565 0 11.826V8l5.744-6.957 4.718 2.087L16 0v6.957l-5.538 4z"})]}),bu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),Cu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Su=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),yu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),ju=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Tu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),wu=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,t.jsx)("rect",{width:"3.2",height:"6.5",y:"9.5",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"8.5",x:"4.267",y:"7.5",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"5",x:"8.533",y:"11",rx:".533"}),(0,t.jsx)("rect",{width:"3.2",height:"7.5",x:"12.8",y:"8.5",rx:".533"})]}),(0,t.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,t.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,t.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),Au=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),Pu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("rect",{width:"4.267",height:"4.267",y:"0.533",fillOpacity:"0.3",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"0.533",fillOpacity:"0.55",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"0.533",fillOpacity:"0.2",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",y:"5.867",fillOpacity:"0.55",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"5.867",fillOpacity:"0.9",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"5.867",fillOpacity:"0.45",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",y:"11.2",fillOpacity:"0.2",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"11.2",fillOpacity:"0.45",rx:".533"}),(0,t.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"11.2",fillOpacity:"0.75",rx:".533"})]})}),Lu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,t.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,t.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,t.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,t.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,t.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,t.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,t.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),ku=e=>(0,t.jsxs)(s.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Iu=e=>(0,t.jsx)(s.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,t.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,t.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,t.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,t.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,t.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,t.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,t.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),Eu=.55,Ze=[{name:"column",icon:yu,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Tu,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:ju,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:bu,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Su,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:Cu,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Lu,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:vu,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:wu,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:Iu,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:ku,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Au,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Eu}},{name:"heatmap",icon:Pu,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Mu=.05,_u=e=>e===null?null:Ze.find(n=>Ru(n.summary,e))??null,Nu=(e,n)=>{const{summary:r}=e;return n===null||(0,m.isComboChartType)(r)?r:r.position==="dodge"&&Or(n)?{...r,position:"identity"}:r.coordType!=="polar"||!we(r.innerRadius)||n.coordType!=="polar"||!we(n.innerRadius)?r:{...r,innerRadius:n.innerRadius}},Or=e=>!(0,m.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",Ru=(e,n)=>{if((0,m.isComboChartType)(e)||(0,m.isComboChartType)(n))return(0,m.isComboChartType)(e)&&(0,m.isComboChartType)(n);const r=e.position===n.position||e.position==="dodge"&&Or(n);return e.coordType!==n.coordType||e.geom!==n.geom||!r?!1:e.coordType!=="polar"||n.coordType!=="polar"?!0:e.theta===n.theta&&we(e.innerRadius)===we(n.innerRadius)},we=e=>e>=Mu,Ou=3,Du=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=N(),d=(0,v.useMemo)(()=>Ze.map(({name:p,icon:f})=>({value:p,label:i(`editor.graphTypes.${p}`),icon:(0,t.jsx)(f,{size:"md"}),isDisabled:p==="combo"&&!(0,m.canBecomeCombo)(o?.spec)||p==="heatmap"&&!(0,m.canBecomeHeatmap)(o?.spec)})),[i,o]);if(!o)return null;const c=(0,m.readChartType)(o.spec),h=_u(c),u=p=>{const f=Ze.find(g=>g.name===p);f&&a.commands.dispatch(new m.SetChartTypeCommand(Nu(f,c)))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:n,preview:r??(h===null?void 0:i(`editor.graphTypes.${h.name}`)),children:(0,t.jsx)(l,{value:h?.name??"",options:d,columns:Ou,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},qt=["solid","dashed","dotted"],zu=8,Fu=0,Hu=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,Switch:d,ToggleGroup:c}=N(),{colorScheme:h}=s.useThemeContext();if(!o)return null;const u=o.guides.axes.filter(Bu);if(u.length===0)return null;const p=o.coordSystem.type!=="polar",f=u.some(y=>y.gridVisible),g=(0,m.resolveGridLineStyle)((0,m.createStyleResolver)({colorScheme:h}).chromeReaders(o.chrome),"y"),x=qt.map(y=>({value:y,label:i(`editor.graphPanel.gridSection.lineStyles.${y}`)})),b=y=>P=>{a.commands.dispatch(new m.SetGridVisibilityCommand({axis:y,isVisible:P}))},T=y=>{const P=qt.find(C=>C===y);P&&a.commands.dispatch(new m.SetGridLineStyleCommand({axis:"both",lineStyle:P}))},w=y=>{a.commands.dispatch(new m.SetGridLineWidthCommand({axis:"both",lineWidth:y}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.gridSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[u.map(y=>(0,t.jsx)(S,{label:i(Gu(y)),children:(0,t.jsx)(d,{isChecked:y.gridVisible,onChange:b(y.scaleAestheticKey)})},y.scaleAestheticKey)),p&&f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,t.jsx)(c,{value:g.lineType,options:x,onChange:T})}),(0,t.jsx)(S,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,t.jsx)(l,{value:g.strokeWidth,min:Fu,max:zu,step:.5,formatValue:_e,onChange:w,onCommit:a.commands.seal})})]})]})})},Bu=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",Gu=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaleAestheticKey==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",Vu="total",Dr=["total","average","current"],Uu=["total"],Wt=["previous","first"],Kt=["auto","small","medium","large"],$u=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l,ToggleGroup:d}=N();if(!o)return null;const c=o.config.headline,h=c.show!=="none",u=o.coordSystem,p=u.type==="polar",f=u.type==="polar"&&u.innerRadius>0,g=o.layers.some(A=>A.summary.grandTotal!==void 0);if(p&&!g)return null;const x=p?Uu:Dr,b=o.guides.headline,T=b?.kind==="perGroup"&&b.items.some(A=>A.comparison!==null),w=x.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.metrics.${A}`)})),y=Wt.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.comparison.${A}`)})),P=Kt.map(A=>({value:A,label:i(A==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${A}`)})),C=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],I=A=>{a.commands.dispatch(new m.SetHeadlineShowCommand({show:A?Vu:"none"}))},D=A=>{const O=x.find(Y=>Y===A);O&&a.commands.dispatch(new m.SetHeadlineShowCommand({show:O}))},R=A=>{const O=Wt.find(Y=>Y===A);O&&a.commands.dispatch(new m.SetHeadlineCompareWithCommand({compareWith:O}))},L=A=>{const O=Kt.find(Y=>Y===A);O&&a.commands.dispatch(new m.SetHeadlineSizeCommand({size:O}))},E=A=>{a.commands.dispatch(new m.SetHeadlinePositionCommand({position:A==="center"?"center":"above"}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:n,preview:r??qu(i,c.show),children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,t.jsx)(l,{isChecked:h,onChange:I})}),h&&(0,t.jsxs)(t.Fragment,{children:[w.length>1&&(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,t.jsx)(d,{value:c.show,options:w,onChange:D})}),T&&(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,t.jsx)(d,{value:(0,m.resolveComparisonBasis)(c.compareWith),options:y,onChange:R})}),(0,t.jsx)(S,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,t.jsx)(d,{value:c.size,options:P,onChange:L})}),f&&(0,t.jsx)(S,{label:i("editor.axesPanel.controls.position"),children:(0,t.jsx)(d,{value:c.position,options:C,onChange:E})})]})]})})},qu=(e,n)=>{const r=Dr.find(a=>a===n);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},He=["top","bottom","left","right","none"],Xt=["auto","start","center","end"],Zt=["auto","pill","direct"],Wu=({positions:e,title:n,layout:r="collapsible",preview:a})=>{const o=_(),i=s.useHandleCompiled(o),l=s.useI18n(),{ToggleGroup:d}=N();if(!i)return null;const c=i.config.legend.position,h=e??He,u=i.guides.legends.drawn[0],p=(0,m.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),f=i.guides.headline?.kind==="perGroup",g=i.guides.colorGroups.length>0;if(c==="auto"&&u===void 0&&!p&&(f||!g))return null;const x=u?.position??"none",b=c==="auto"?x:c,T=He.filter(E=>E===b||h.includes(E)).map(E=>({value:E,label:l(`editor.graphPanel.legendSection.${E}`)})),w=E=>{const A=He.find(O=>O===E);A&&o.commands.dispatch(new m.SetLegendPositionCommand({position:A}))},y=E=>{const A=Xt.find(O=>O===E);A&&o.commands.dispatch(new m.SetLegendAlignCommand({align:A}))},P=E=>{const A=Zt.find(O=>O===E);A&&o.commands.dispatch(new m.SetLegendDisplayCommand({display:A}))},C=Xt.map(E=>({value:E,label:l(`editor.graphPanel.legendSection.align.${E}`)})),I=Zt.map(E=>({value:E,label:l(`editor.graphPanel.legendSection.display.${E}`)})),D=n??l("editor.graphPanel.legendSection.title"),R=T.find(E=>E.value===b)?.label,L=u!==void 0;return(0,t.jsx)(z,{title:D,layout:r,preview:a??R,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:l("editor.axesPanel.controls.position"),layout:"stack",children:(0,t.jsx)(d,{value:b,options:T,onChange:w})}),L&&(0,t.jsx)(S,{label:l("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,t.jsx)(d,{value:i.config.legend.align,options:C,onChange:y})}),p&&(0,t.jsx)(S,{label:l("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,t.jsx)(d,{value:i.config.legend.display,options:I,onChange:P})})]})})},Ku=1,Xu=20,Zu=.5,zr=({layerId:e})=>{const n=_(),r=s.useHandleCompiled(n),{Slider:a}=N(),o=mt(r,e);if(!r)return null;const i=l=>{const d=new m.SetPointSizeCommand({layerId:e,size:l});n.commands.dispatch(d,{transient:!0})};return(0,t.jsx)(a,{value:o?.get("size")??m.DEFAULT_POINT_SIZE,min:Ku,max:Xu,step:Zu,formatValue:_e,onChange:i,onCommit:n.commands.seal})},Yu=1,Ju=10,Qu=.1,e0=["gap","zero","connect"],t0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Slider:d,Switch:c,ToggleGroup:h}=N(),u=o?.spec.layers??[],p=(0,m.findLayerByGeom)(u,"line","area"),f=mt(o,p?.id??null);if(!o||!p)return null;const g=o.coordSystem.type==="polar",x=o0(i,p),b=r0(p,u),T=Yt(o.spec,p.geom,"strokeWidth",p.id),w=typeof T=="number",y=p.geom==="line"?p:void 0,P=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],C=A=>{a.commands.dispatch(new m.ToggleLinePointsVisibilityCommand({layerId:p.id,showPoints:A}))},I=A=>{y&&a.commands.dispatch(new m.ToggleLineFillCommand({layerId:y.id,showFill:A}))},D=A=>{a.commands.dispatch(new m.SetLineInterpolationCommand({layerId:p.id,interpolate:A?"catmull-rom":"linear"}))},R=A=>{const O=f?.get("strokeWidth")??m.DEFAULT_STROKE_WIDTH;a.commands.dispatch(new m.SetLineWidthCommand({layerId:p.id,lineWidth:A==="custom"?O:null}))},L=A=>{a.commands.dispatch(new m.SetLineWidthCommand({layerId:p.id,lineWidth:A}),{transient:!0})},E=A=>{const O=n0(A);O&&a.commands.dispatch(new m.SetLineMissingValuesCommand({layerId:p.id,missingValues:O}))};return(0,t.jsx)(z,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,t.jsx)(c,{isChecked:b!==void 0,onChange:C})}),b&&(0,t.jsx)(S,{label:i("editor.graphPanel.pointSize.label"),children:(0,t.jsx)(zr,{layerId:b.id})}),y&&!g&&(0,t.jsx)(S,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,t.jsx)(c,{isChecked:Yt(o.spec,"line","fillAlpha",y.id)!==void 0,onChange:I})}),!g&&(0,t.jsx)(S,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,t.jsx)(c,{isChecked:p.params.interpolate==="catmull-rom",onChange:D})}),(0,t.jsx)(S,{label:i("editor.graphPanel.lineThickness.label"),children:(0,t.jsx)(h,{value:w?"custom":"auto",options:P,onChange:R})}),w&&(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(d,{value:T,min:Yu,max:Ju,step:Qu,formatValue:_e,onChange:L,onCommit:a.commands.seal})}),!g&&x.length>1&&(0,t.jsx)(S,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,t.jsx)(l,{value:p.params.missingValues,options:x,onChange:E})})]})})},n0=e=>e0.find(n=>n===e),Yt=(e,n,r,a)=>(0,m.findKindStyleDeclarations)(e.styles.overrides,(0,m.buildLayerStyleAddress)(n,a))?.[r],r0=(e,n)=>(0,m.filterLayersByGeoms)(n,"point").find(r=>(0,m.isCompanionLayer)(r,[e])),o0=(e,n)=>{const r=[{value:"gap",label:e("editor.graphPanel.treatEmptyValues.leaveGap.label")},{value:"zero",label:e("editor.graphPanel.treatEmptyValues.fillZero.label")}];return n.position!=="stack"&&n.position!=="fill"&&r.push({value:"connect",label:e("editor.graphPanel.treatEmptyValues.connectGaps.label")}),n.geom==="area"?r.filter(a=>a.value!=="gap"):r},Ye="\0none",a0=["x","y","color","size","label"],i0={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},l0=({title:e,layout:n="collapsible"})=>{const r=_(),a=s.useHandleCompiled(r),o=s.useI18n(),{Select:i}=N(),l=o("editor.graphPanel.mappingSection.none"),d=a?.spec,c=(0,v.useMemo)(()=>d===void 0?[]:(0,m.readMappableAesthetics)(d,a0).map(({aesthetic:h,variables:u,isRequired:p})=>{const f=(0,m.readMappedVariable)(d.mapping,h);return{aesthetic:h,label:o(i0[h]),value:f??(p?null:Ye),options:s0(u,f,p?null:l),chooseColumn:g=>{r.commands.dispatch(new m.SetMappingCommand({aesthetic:h,variable:g===Ye?null:g}))}}}),[d,o,l,r]);return a?(0,t.jsx)(z,{title:e??o("editor.graphPanel.mappingSection.title"),layout:n,children:(0,t.jsx)(H,{children:c.map(({aesthetic:h,label:u,value:p,options:f,chooseColumn:g})=>(0,t.jsx)(S,{label:u,children:(0,t.jsx)(i,{value:p,options:f,placeholder:l,onChange:g})},h))})}):null},s0=(e,n,r)=>{const a=n!==null&&!e.includes(n)?[n,...e]:e;return[...r===null?[]:[{value:Ye,label:r}],...a.map(o=>({value:o,label:o}))]},c0="k",d0=2,u0=0,h0=5,Je=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],p0=["auto","none"],m0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{NumberField:l,ToggleGroup:d}=N();if(!o)return null;const{abbreviation:c,decimals:h}=o.config.numberFormat,u=g0(c)!==void 0,p=h!=="auto",f=P=>P.map(C=>({value:C,label:i(`editor.graphPanel.numberFormat.options.${C}`)})),g=Je.map(({value:P,labelKey:C})=>({value:P,label:i(`common.abbreviations.${C}`)})),x=P=>{a.commands.dispatch(new m.SetNumberFormatAbbreviationCommand({abbreviation:P}))},b=P=>{const C=p0.find(I=>I===P);x(C??c0)},T=P=>{const C=Je.find(I=>I.value===P);C&&x(C.value)},w=P=>{a.commands.dispatch(new m.SetNumberFormatDecimalsCommand({decimals:P==="custom"?d0:"auto"}))},y=P=>{P!==null&&a.commands.dispatch(new m.SetNumberFormatDecimalsCommand({decimals:P}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,t.jsx)(d,{value:u?"custom":c,options:f(["auto","none","custom"]),onChange:b})}),u&&(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(d,{value:c,options:g,onChange:T})}),(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,t.jsx)(d,{value:p?"custom":"auto",options:f(["auto","custom"]),onChange:w})}),p&&(0,t.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(l,{value:h,min:u0,max:h0,onChange:y,onCommit:a.commands.seal})})]})})},g0=e=>Je.find(n=>n.value===e),x0=({title:e,layout:n="collapsible",preview:r})=>{const a=s.useHandleCompiled(_()),o=s.useI18n();if(!a)return null;const i=f0(a.spec.layers);return i?(0,t.jsx)(z,{title:e??o("editor.graphPanel.pointSize.label"),layout:n,preview:r,children:(0,t.jsx)(H,{children:(0,t.jsx)(S,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(zr,{layerId:i.id})})})}):null},f0=e=>{const n=(0,m.filterLayersByGeoms)(e,"line","area");return(0,m.filterLayersByGeoms)(e,"point").find(r=>!(0,m.isCompanionLayer)(r,n))},v0=.9,b0=360,C0=.05,S0=15,y0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l}=N();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:c}=o.spec.coords.params,h=p=>{a.commands.dispatch(new m.SetPolarInnerRadiusCommand({innerRadius:p}),{transient:!0})},u=p=>{a.commands.dispatch(new m.SetPolarStartAngleCommand({startAngle:p}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.polarSection.title"),layout:n,preview:r,children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,t.jsx)(l,{value:d,min:0,max:v0,step:C0,formatValue:Rr,onChange:h,onCommit:a.commands.seal})}),(0,t.jsx)(S,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,t.jsx)(l,{value:c,min:0,max:b0-1,step:S0,formatValue:Wd,onChange:u,onCommit:a.commands.seal})})]})})},j0=e=>(0,t.jsxs)(s.Icon,{...e,children:[(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4796 12.2222L17.6085 12.2291L17.6029 10.7291L19.474 10.7222L19.4796 12.2222ZM15.3662 12.2375L13.124 12.2459L13.1184 10.7459L15.3606 10.7375L15.3662 12.2375ZM10.8817 12.2542L8.63945 12.2626L8.63386 10.7626L10.8761 10.7542L10.8817 12.2542ZM6.39719 12.2709L4.52607 12.2779L4.52048 10.7779L6.3916 10.7709L6.39719 12.2709Z",fill:"currentColor"})]}),Jt=e=>(0,t.jsxs)(s.Icon,{...e,children:[(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.6749 8.04877L17.1069 9.06975L16.2884 7.81273L17.8564 6.79175L18.6749 8.04877ZM15.2278 10.2932L13.3488 11.5167L12.5303 10.2597L14.4093 9.03622L15.2278 10.2932ZM11.4697 12.7402L9.59064 13.9637L8.77217 12.7067L10.6512 11.4832L11.4697 12.7402ZM7.71158 15.1872L6.14354 16.2082L5.32507 14.9511L6.89311 13.9302L7.71158 15.1872Z",fill:"currentColor"})]}),T0=e=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:n,numberFormat:r}=e.config,a=e.guides.colorGroups.map(o=>{const i=(0,m.createValueFormatter)({valueFormat:o.valueFormat,locale:n,numberFormat:r}),l=o.value instanceof Date?o.value.getTime():o.value;return{value:l,option:{value:String(l),label:o.label??i(o.value)}}});return{options:a.map(({option:o})=>o),findValue:o=>a.find(i=>i.option.value===o)?.value}},[e]),Qt=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],w0="linear",A0=({title:e,layout:n="collapsible",preview:r})=>{const a=_(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Switch:d}=N(),{options:c,findValue:h}=T0(o);if(!o||o.coordSystem.type==="polar")return null;const u=(0,m.findTrendLineLayer)(o.spec.layers),p=(0,m.findAverageLineLayer)(o.spec.layers),f=u?.stat.type==="smooth"?u.stat.method:w0,g=P0(p),x=Qt.map(C=>({value:C,label:i(`editor.annotationsPanel.trendType.options.${C}`)})),b=(C,I={})=>{const D=u??p,R=new m.SetStatLineCommand({line:C,...I,...D!==void 0&&{layerId:D.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(R)},T=C=>b(C?"trend":"none",{method:f}),w=C=>b(C?"average":"none",{group:g??h(c[0]?.value??"")}),y=C=>{const I=Qt.find(D=>D===C);I!==void 0&&b("trend",{method:I})},P=C=>{const I=C===null?void 0:h(C);I!==void 0&&b("average",{group:I})};return(0,t.jsx)(z,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:n,preview:r??(0,t.jsx)(Jt,{size:"lg"}),children:(0,t.jsxs)(H,{children:[(0,t.jsx)(S,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,t.jsx)(Jt,{size:"lg"}),children:(0,t.jsx)(d,{isChecked:u!==void 0,onChange:T})}),u!==void 0&&(0,t.jsx)(S,{label:i("editor.annotationsPanel.trendType.label"),children:(0,t.jsx)(l,{value:f,options:x,onChange:y,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,t.jsx)(S,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,t.jsx)(j0,{size:"lg"}),children:(0,t.jsx)(d,{isChecked:p!==void 0,onChange:w})}),p!==void 0&&c.length>0&&(0,t.jsx)(S,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,t.jsx)(l,{value:g===void 0?null:String(g),options:c,onChange:P,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},P0=e=>{const n=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return n instanceof Date?n.getTime():n};exports.AppearanceSection=Zd;exports.AxesPanel=qd;exports.AxisSection=Ke;exports.BarSection=Jd;exports.Button=ur;exports.CalloutsSection=du;exports.CaptionSection=Ir;exports.ComboSection=hu;exports.EditableGraphRenderer=Uc;exports.EditorPanel=dt;exports.ElementsPanel=$d;exports.GoalSection=gu;exports.GraphOptionsSection=fu;exports.GraphTypeSection=Du;exports.GridSection=Hu;exports.HeadlineSection=$u;exports.IntlProvider=ln;exports.LegendSection=Wu;exports.LineSection=t0;exports.MappingSection=l0;exports.NumberField=mr;exports.NumberFormatSection=m0;exports.PANEL_ROOT_ATTRIBUTE=Pr;exports.PointSection=x0;exports.PolarSection=y0;exports.RadioGrid=gr;exports.Row=S;exports.Section=z;exports.Select=xr;exports.Slider=fr;exports.SourceSection=Er;exports.SubtitleSection=Mr;exports.Switch=vr;exports.TextField=br;exports.TextSizeSection=_r;exports.TitleSection=Nr;exports.ToggleGroup=Cr;exports.ToggledSection=kr;exports.TrendsAndAveragesSection=A0;exports.useControls=N;exports.usePanelExpansion=Ar;exports.usePanelGraph=_;