@graphysdk/react-renderer 1.9.0-beta.1789369549494 → 1.9.0-beta.1789372403170

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 l=require("./history-chords-CqecMyRa.cjs"),W=require("./theme.contract.css-CEjZ4rbL.cjs");let p=require("@graphysdk/viz-engine"),b=require("react"),t=require("react/jsx-runtime"),se=require("zustand/react/shallow"),ln=require("@vanilla-extract/dynamic"),sn=require("react-dom"),$=require("clsx");$=l.__toESM($,1);let de=require("@floating-ui/react-dom"),cn=require("@tiptap/core"),lo=require("@tiptap/extension-bold"),ye=require("@tiptap/extension-document"),so=require("@tiptap/extension-hard-break"),co=require("@tiptap/extension-heading"),uo=require("@tiptap/extension-italic"),ho=require("@tiptap/extension-link"),po=require("@tiptap/extension-text"),mo=require("@tiptap/extension-text-align"),je=require("@tiptap/extension-text-style"),go=require("@tiptap/extension-underline"),Ee=require("@tiptap/extensions"),dn=require("@tiptap/extension-paragraph"),Me=require("@tiptap/react"),X=require("@base-ui/react/toolbar"),ae=require("@base-ui/react/tooltip"),V=require("@base-ui/react/popover"),Ct=require("react-colorful"),Z=require("@base-ui/react/slider"),N=require("@base-ui/react/menu"),xo=require("@base-ui/react/toggle"),Q=require("@base-ui/react"),le=require("lodash-es/clamp");le=l.__toESM(le,1);let he=require("@base-ui/react/accordion"),yt=require("@base-ui/react/number-field"),un=require("@base-ui/react/radio"),hn=require("@base-ui/react/radio-group"),K=require("@base-ui/react/select"),jt=require("@base-ui/react/switch"),vo=require("@base-ui/react/input");var fo={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},bo={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",radar:"راداري",radarFilled:"راداري معبأ",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:"داكن"}}},So={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:"متقطع",dotted:"منقّط"},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})`}}}},Co={common:fo,editor:bo,graph:So},yo={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"}},jo={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",radialBar:"Radial bar",rose:"Rose",roseStacked:"Stacked rose",radar:"Radar",radarFilled:"Filled radar",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"}}},Ao={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:"Dashed",dotted:"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})`}}}},To={common:yo,editor:jo,graph:Ao},wo={colorPanel:{backgroundSection:{grey:"Gray"},borderType:{grey:"Gray"}},highlighting:{highlightStyle:{grey:"Gray"}}},Po={editor:wo},ko={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"}},Lo={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",radialBar:"Barras radiais",radar:"Radar",radarFilled:"Radar preenchido",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"}}},Io={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:"Tracejada",dotted:"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})`}}}},Eo={common:ko,editor:Lo,graph:Io},Mo={"en-GB":To,"en-US":Po,ar:Co,"pt-PT":Eo},Ro=[Mo,l.dictionaries],pn=({children:e,...n})=>(0,t.jsx)(l.IntlProvider,{dictionaries:Ro,...n,children:e}),_o="data-variant",mn=dn.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[_o]:e.variant}:{}}}}}),Oo=cn.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}}}}),ot=()=>[po.Text,Ee.UndoRedo,co.Heading.configure({levels:[1,2,3]}),lo.Bold,uo.Italic,go.Underline,mo.TextAlign.configure({types:["heading","paragraph"]}),ho.Link.configure({openOnClick:!1,autolink:!0}),je.TextStyle,je.Color,so.HardBreak],No=({titlePlaceholder:e,subtitlePlaceholder:n,isTitleVisible:r,isSubtitleVisible:o})=>[Fo({isTitleVisible:r,isSubtitleVisible:o}),mn,...ot(),je.FontFamily,Oo.configure({isTitleVisible:r}),Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:i})=>{if(r&&a===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return o&&a===s?n:""}})],Do=({placeholder:e})=>[ye.Document,mn,...ot(),je.FontFamily,Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],Fo=({isTitleVisible:e,isSubtitleVisible:n})=>e&&n?ye.Document.extend({content:"block{2,}"}):ye.Document,gn="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))",zo="d0bl00";var xn="d0bl03",Ho="d0bl04",vn="d0bl05",$e="d0bl06",Bo="d0bl07",Go="d0bl08",fn="d0bl09",Vo="d0bl0a",Uo="d0bl0b",Wo="d0bl0c",$o="d0bl0d",qo="d0bl0e",Ko="owf1yg0",Zo="owf1yg1",Xo="owf1yg2",Yo="owf1yg3",Jo="owf1yg4",Qo=.01,ea=({value:e,onChange:n,label:r})=>(0,t.jsx)(Z.Slider.Root,{className:Ko,value:e,onValueChange:o=>n(o),min:0,max:1,step:Qo,children:(0,t.jsx)(Z.Slider.Control,{className:Zo,children:(0,t.jsxs)(Z.Slider.Track,{className:Xo,children:[(0,t.jsx)(Z.Slider.Indicator,{className:Yo}),(0,t.jsx)(Z.Slider.Thumb,{className:Jo,"aria-label":r})]})})}),bn="transparent",qe=W.CANVAS_COLOR_KEYS.map(e=>W.vars[e]),ta=Object.fromEntries(W.CANVAS_COLOR_KEYS.map(e=>[W.vars[e],e])),na=e=>qe.some(n=>Cn(n,e)),ra=({color:e,onChange:n,isOpen:r,onOpenChange:o,children:a,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const u=l.useI18n(),m=aa(),x=h?[bn,...qe]:qe,g=v=>{n(v),o(!1)};return(0,t.jsxs)(V.Popover.Root,{open:r,onOpenChange:o,children:[(0,t.jsx)(V.Popover.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":i??u("graph.toolbar.color.label"),className:zo,onMouseDown:v=>v.preventDefault(),children:a??(0,t.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,t.jsx)(V.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(V.Popover.Positioner,{sideOffset:6,align:"start",className:xn,children:(0,t.jsxs)(V.Popover.Popup,{className:Ho,onMouseDown:v=>v.preventDefault(),...s,children:[(0,t.jsx)(At,{title:u("graph.colorDropdown.colors"),colors:x,currentColor:e,onPick:g}),m.length>0&&(0,t.jsx)(At,{title:u("graph.colorDropdown.chartColors"),colors:m,currentColor:e,onPick:g}),(0,t.jsx)(oa,{value:e??"#000000",onChange:n,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,t.jsxs)("div",{className:"d0bl05",children:[(0,t.jsx)("div",{className:"d0bl06",children:u("graph.colorDropdown.opacity")}),(0,t.jsx)(ea,{value:c,onChange:d,label:u("graph.colorDropdown.opacity")})]})]})})})})]})},At=({title:e,colors:n,currentColor:r,onPick:o})=>{const a=l.useI18n();return(0,t.jsxs)("div",{className:vn,children:[(0,t.jsx)("div",{className:$e,children:e}),(0,t.jsx)("div",{className:Bo,children:n.map(i=>(0,t.jsx)("button",{type:"button","aria-label":i==="transparent"?a("graph.colorDropdown.transparent"):i,className:Go,"data-active":Cn(i,r),onMouseDown:s=>s.preventDefault(),onClick:()=>o(i),children:(0,t.jsx)("span",{className:fn,style:Sn(i)})},i))})]})},oa=({value:e,onChange:n,popupAttributes:r})=>{const o=l.useI18n(),[a,i]=(0,b.useState)(!1),s=l.isValidCssColor(e)?e:"#000000",c=ia(s);return(0,t.jsxs)(V.Popover.Root,{open:a,onOpenChange:i,children:[(0,t.jsxs)("div",{className:vn,children:[(0,t.jsx)("div",{className:$e,children:o("graph.colorDropdown.custom")}),(0,t.jsxs)(V.Popover.Trigger,{className:Vo,onMouseDown:d=>d.preventDefault(),"aria-label":o("graph.colorDropdown.pickCustom"),children:[(0,t.jsx)("span",{className:fn,style:Sn(s)}),(0,t.jsx)("span",{className:Uo,children:c})]})]}),(0,t.jsx)(V.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(V.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:xn,children:(0,t.jsxs)(V.Popover.Popup,{className:Wo,onMouseDown:d=>d.preventDefault(),...r,children:[(0,t.jsx)("div",{className:$e,children:o("graph.colorDropdown.pickColor")}),(0,t.jsx)(Ct.HexColorPicker,{color:c,onChange:n,className:$o}),(0,t.jsx)(Ct.HexColorInput,{color:c,onChange:n,prefixed:!0,className:qo,onMouseDown:d=>d.stopPropagation()})]})})})})]})},aa=()=>{const e=l.useCompiledSelector(n=>n.scales.color);return(0,b.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const n=new Set;for(const r of e.domain){const o=e.map(r);typeof o=="string"&&n.add(o)}return[...n]},[e])},Sn=e=>e==="transparent"?{background:gn,border:`1px solid ${W.vars.border100}`}:{background:e,border:`1px solid ${l.darkenCss(e,.1)}`},ia=e=>{const{themeValues:n}=l.useThemeContext();if(l.isHex(e))return e.toUpperCase();const r=ta[e];return r?n[r].toUpperCase():"#000000"},Cn=(e,n)=>n===null?!1:e.toLowerCase()===n.toLowerCase(),la="l9kff0",sa="l9kff1",ca="l9kff2",da="xn24px0",ua="xn24px1",ha="xn24px2",pa=({children:e,popupAttributes:n})=>(0,t.jsx)(N.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:da,children:(0,t.jsx)(N.Menu.Popup,{className:ua,onMouseDown:r=>r.preventDefault(),...n,children:e})})})}),ma=({children:e,isSelected:n=!1,isDisabled:r=!1,onClick:o})=>(0,t.jsx)(N.Menu.Item,{className:ha,"data-selected":n,disabled:r,onClick:o,children:e}),ga=({className:e,...n})=>(0,t.jsx)(ae.Tooltip.Provider,{children:(0,t.jsx)(X.Toolbar.Root,{...n,className:(0,$.default)(la,e)})}),xa=({className:e,...n})=>(0,t.jsx)(X.Toolbar.Group,{...n,className:(0,$.default)(sa,e)}),va=({className:e,...n})=>(0,t.jsx)(X.Toolbar.Separator,{...n,className:(0,$.default)(ca,e)}),fa=({children:e})=>{const n=l.resolvePortalContainer();return n===null?null:(0,sn.createPortal)((0,t.jsx)(l.PortalThemeProvider,{children:e}),n)},B={Portal:fa,Root:ga,Group:xa,Separator:va,Button:X.Toolbar.Button,ColorPicker:ra,MenuPopup:pa,MenuItem:ma},me=e=>(0,t.jsx)(l.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"})})}),ba="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Sa=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Ca="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",ya="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Ke=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Sa},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:ba},{id:"technical",label:"Technical",preview:"00",fontFamily:Ca},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:ya}],ja=e=>e?Ke.find(n=>n.fontFamily===e)??null:null,yn="_70l3rt0",jn="_70l3rt1",An="_70l3rt3",Tn="_70l3rt4",wn="_70l3rt5",Aa=({editor:e,currentFontFamily:n,isOpen:r,onOpenChange:o})=>{const a=l.useI18n(),i=ja(n)??Ke[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,t.jsxs)(N.Menu.Root,{open:r,onOpenChange:o,children:[(0,t.jsxs)(N.Menu.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:yn,onMouseDown:c=>c.preventDefault(),children:[(0,t.jsx)("span",{className:jn,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,t.jsx)(me,{size:"sm"})]}),(0,t.jsx)(N.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:An,children:(0,t.jsx)(N.Menu.Popup,{className:Tn,onMouseDown:c=>c.preventDefault(),children:Ke.map(c=>(0,t.jsx)(N.Menu.Item,{className:wn,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,t.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Pn={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:W.vars.fontTextEditorBody},Tt=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:W.vars.fontTextEditorH6},Pn,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:W.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:W.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:W.vars.fontTextEditorH1}],Ta=({editor:e,activeStyle:n,isOpen:r,onOpenChange:o})=>{const a=l.useI18n(),i=Tt.find(s=>s.id===n)??Pn;return(0,t.jsxs)(N.Menu.Root,{open:r,onOpenChange:o,children:[(0,t.jsxs)(N.Menu.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:yn,onMouseDown:s=>s.preventDefault(),children:[(0,t.jsx)("span",{className:jn,children:a(i.translationKey)}),(0,t.jsx)(me,{size:"sm"})]}),(0,t.jsx)(N.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:An,children:(0,t.jsx)(N.Menu.Popup,{className:Tn,onMouseDown:s=>s.preventDefault(),children:Tt.map(s=>(0,t.jsx)(N.Menu.Item,{className:wn,"data-selected":s.id===i.id,onClick:()=>wa(e,s.id),children:(0,t.jsx)(Pa,{font:s.previewFont,children:a(s.translationKey)})},s.id))})})})})]})},wa=(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()}},Pa=({font:e,children:n})=>(0,t.jsx)("span",{style:{font:e,margin:0},children:n}),kn=e=>(0,t.jsx)(l.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"})})}),ka=e=>(0,t.jsx)(l.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"})]})}),La=e=>(0,t.jsx)(l.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"})]})}),Ia=e=>!e.content||e.content.length===0?!0:e.content.every(n=>!n.content||n.content.length===0),Ea=e=>{const{$from:n}=e.state.selection,r=n.parent.textContent,o=n.parentOffset,a=n.start();let i=o;for(;i>0&&wt(r[i-1]);)i-=1;let s=o;for(;s<r.length&&wt(r[s]);)s+=1;return{from:a+i,to:a+s}},wt=e=>e!==void 0&&/\S/.test(e),Ma="fop13s0",Ra="fop13s1",_a="fop13s2",Oa="fop13s3",Pt="fop13s4",Na=({editor:e,currentUrl:n,isActive:r,isOpen:o,onOpenChange:a})=>{const i=l.useI18n(),[s,c]=(0,b.useState)(""),d=(0,b.useRef)(null);(0,b.useEffect)(()=>{o&&c(n??"")},[o,n]);const h=()=>{Da(e,s),a(!1)},u=()=>{c(""),a(!1)},m=g=>{c(g.target.value)},x=g=>{g.key==="Enter"&&(g.preventDefault(),h())};return(0,t.jsxs)(V.Popover.Root,{open:o,onOpenChange:a,children:[(0,t.jsx)(V.Popover.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:Ma,onMouseDown:g=>g.preventDefault(),children:(0,t.jsx)(ka,{})}),(0,t.jsx)(V.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(V.Popover.Positioner,{sideOffset:6,align:"end",className:Ra,children:(0,t.jsxs)(V.Popover.Popup,{className:_a,initialFocus:d,onMouseDown:g=>g.preventDefault(),children:[(0,t.jsx)("input",{ref:d,type:"url",value:s,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:Oa,onMouseDown:g=>g.stopPropagation(),onChange:m,onKeyDown:x}),(0,t.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:Pt,onClick:u,children:(0,t.jsx)(La,{})}),(0,t.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:Pt,onClick:h,children:(0,t.jsx)(kn,{})})]})})})})]})},Da=(e,n)=>{const r=n.trim(),{selection:o}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const a=Ea(e);e.chain().focus().setTextSelection(a).setLink({href:r}).run()},Ln=e=>(0,t.jsx)(l.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"})]})}),In=e=>(0,t.jsx)(l.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"})]})}),En=e=>(0,t.jsx)(l.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"})]})}),Fa="_1d66w570",za="_1d66w571",Ha=6,ie=({label:e,isActive:n,onToggle:r,children:o})=>{const a=i=>i.preventDefault();return(0,t.jsxs)(ae.Tooltip.Root,{children:[(0,t.jsx)(ae.Tooltip.Trigger,{render:(0,t.jsx)(xo.Toggle,{render:(0,t.jsx)(X.Toolbar.Button,{}),pressed:n,onPressedChange:()=>r()}),"aria-label":e,className:Fa,onMouseDown:a,children:o}),(0,t.jsx)(ae.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(ae.Tooltip.Positioner,{sideOffset:Ha,children:(0,t.jsx)(ae.Tooltip.Popup,{className:za,children:e})})})})]})},Ba=({editor:e,activeAlignment:n="left"})=>{const r=l.useI18n();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ie,{label:r("graph.toolbar.textAlign.left"),isActive:n==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,t.jsx)(En,{})}),(0,t.jsx)(ie,{label:r("graph.toolbar.textAlign.center"),isActive:n==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,t.jsx)(Ln,{})}),(0,t.jsx)(ie,{label:r("graph.toolbar.textAlign.right"),isActive:n==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,t.jsx)(In,{})})]})},Ga="_1u34vl40",Va=({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:Ua(e),textAlign:Wa(e)}),Ua=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",Wa=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",$a=8,qa=8,Ka=({editor:e})=>{const n=l.useI18n(),[r,o]=(0,b.useState)(!1),[a,i]=(0,b.useState)(null),s=a!==null,c=g=>v=>{i(v?g:null)},{refs:d,floatingStyles:h}=(0,de.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,de.offset)($a),(0,de.flip)(),(0,de.shift)({padding:qa})],whileElementsMounted:de.autoUpdate}),u=(0,b.useRef)(null),m=(0,Me.useEditorState)({editor:e,selector:Va}),x=(0,b.useCallback)(g=>{u.current=g,d.setFloating(g)},[d]);return(0,b.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,b.useEffect)(()=>{if(!e)return;const g=()=>o(!0),v=({event:S})=>{const{relatedTarget:y,currentTarget:P}=S,C=y instanceof Node&&u.current?.contains(y),k=y instanceof Node&&P instanceof Node&&P.contains(y);!C&&!k&&o(!1)};return e.on("focus",g),e.on("blur",v),()=>{e.off("focus",g),e.off("blur",v)}},[e]),!e||!r&&!s?null:(0,t.jsx)(B.Portal,{children:(0,t.jsxs)(B.Root,{ref:x,className:Ga,style:h,children:[(0,t.jsxs)(B.Group,{children:[(0,t.jsx)(B.ColorPicker,{color:m?.color??null,onChange:g=>e.chain().setColor(g).run(),isOpen:a==="color",onOpenChange:c("color")}),(0,t.jsx)(Aa,{editor:e,currentFontFamily:m?.fontFamily??null,isOpen:a==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,t.jsx)(B.Separator,{}),(0,t.jsx)(B.Group,{children:(0,t.jsx)(Ta,{editor:e,activeStyle:m?.fontSize??"text",isOpen:a==="fontSize",onOpenChange:c("fontSize")})}),(0,t.jsx)(B.Separator,{}),(0,t.jsxs)(B.Group,{children:[(0,t.jsx)(ie,{label:n("graph.toolbar.formatting.bold"),isActive:m?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,t.jsx)("strong",{children:"B"})}),(0,t.jsx)(ie,{label:n("graph.toolbar.formatting.italic"),isActive:m?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,t.jsx)("em",{children:"I"})}),(0,t.jsx)(ie,{label:n("graph.toolbar.formatting.underline"),isActive:m?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,t.jsx)("u",{children:"U"})})]}),(0,t.jsx)(B.Separator,{}),(0,t.jsx)(B.Group,{children:(0,t.jsx)(Ba,{editor:e,activeAlignment:m?.textAlign})}),(0,t.jsx)(B.Separator,{}),(0,t.jsx)(B.Group,{children:(0,t.jsx)(Na,{editor:e,currentUrl:m?.linkUrl??null,isActive:m?.isLink??!1,isOpen:a==="link",onOpenChange:c("link")})})]})})},Za="_1uy50v30",Mn=({editor:e,ariaLabel:n})=>(0,t.jsxs)("div",{className:Za,children:[(0,t.jsx)(Ka,{editor:e}),(0,t.jsx)(Me.EditorContent,{editor:e,"aria-label":n})]}),Xa=200,at=({content:e,extensions:n,isEditable:r,onUpdate:o,updateDebounceMs:a=Xa})=>{const i=(0,b.useRef)(kt(e)),s=(0,b.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,o?.(h)},a),d=(0,Me.useEditor)({extensions:n,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const u=h.getJSON();if(Be(s.current,u))return c.cancel();c.run(u)}});return(0,b.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,b.useEffect)(()=>{if(!d)return;const h=kt(e);Be(s.current,h)||(s.current=h,!Be(d.getJSON(),h)&&(c.cancel(),Ya(d,h)))},[d,e,c]),(0,b.useEffect)(()=>()=>c.flush(),[c]),d},kt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Ya=(e,n)=>{const{from:r,to:o}=e.state.selection;e.commands.setContent(n,{emitUpdate:!1});const a=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,a),to:Math.min(o,a)})},Be=(e,n)=>JSON.stringify(Ae(e))===JSON.stringify(Ae(n)),Ae=e=>Array.isArray(e)?e.map(Ae):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ae(r)]).filter(([,n])=>!Ja(n)).sort(([n],[r])=>String(n).localeCompare(String(r)))),Ja=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,Qa=({caption:e,captionStyle:n})=>{const{dispatch:r}=l.useGraphCommands(),o=at({content:e,extensions:(0,b.useMemo)(()=>Do({placeholder:"Add caption"}),[]),isEditable:!0,onUpdate:a=>{const i=Ia(a)?null:a;r(new p.SetContentCaptionCommand({caption:i}))}});return(0,t.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(n),children:(0,t.jsx)(Mn,{editor:o,ariaLabel:"Chart caption"})})},ei=e=>[ye.Document,dn.Paragraph,...ot(),ni,Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],ti=({annotation:e})=>{const n=l.useI18n(),{dispatch:r}=l.useGraphCommands(),o=l.useEditorStore(),a=(0,b.useMemo)(()=>ei(n("graph.annotations.text.placeholder")),[n]),i=at({content:e.content,extensions:a,isEditable:!0,onUpdate:s=>{r(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,b.useEffect)(()=>{const{setCaretEditor:s}=o.getState();return s(i),()=>s(null)},[i,o]),(0,b.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,t.jsx)(Me.EditorContent,{"aria-label":n("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},Lt=e=>{const n=l.resolveRichTextFontFamily(e);return n===void 0?{}:{style:`font-family: ${n}`}},ni=cn.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Lt(e.fontFamily)},font:{default:null,renderHTML:e=>Lt(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${W.vars.textScale})`}:{}}}}]}}),ri=3,oi=({title:e,isTitleVisible:n,subtitle:r,isSubtitleVisible:o})=>{const a=[];return n&&a.push({type:"heading",attrs:{level:ri},content:ii(e)}),o&&a.push(...li(r)),{type:"doc",content:a}},ai=e=>{const[n,...r]=e.content??[];return{title:si(n?.content??[]),subtitle:ci(r)}},it=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(it)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),ii=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??[],li=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(It):[It(e)],It=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},si=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(it)}},ci=e=>{const n=e.filter(o=>(o.content??[]).length>0);if(n.length===0)return null;const[r]=n;if(r&&n.length===1&&r.type==="paragraph"){const o=r.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:n.map(it)}},di={fontFamily:"var(--uwf6lt0)",fontSize:"var(--uwf6lt1)",fontWeight:"var(--uwf6lt2)",lineHeight:"var(--uwf6lt3)",textColor:"var(--uwf6lt4)"},ui="uwf6lt5",hi=({title:e,isTitleVisible:n,isSubtitleVisible:r,subtitle:o,headingStyle:a,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,b.useMemo)(()=>No({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:n,isSubtitleVisible:r}),[n,r]),d=at({content:(0,b.useMemo)(()=>oi({title:e,isTitleVisible:n,subtitle:o,isSubtitleVisible:r}),[e,n,o,r]),extensions:c,isEditable:!0,onUpdate:h=>{const u=ai(h);n&&s(new p.SetContentTitleCommand({title:u.title})),r&&s(new p.SetContentSubtitleCommand({subtitle:u.subtitle}))}});return(0,t.jsx)("div",{className:ui,"data-testid":"title-editor",style:{...l.toHtmlTextCss(a),...l.assignTextStyleVars(di,i)},children:(0,t.jsx)(Mn,{editor:d,ariaLabel:"Chart title and subtitle"})})},pi={Title:hi,Caption:Qa,TextAnnotation:ti},mi="data-graphy-chart-chrome",gi="data-graphy-chart-menu",Rn={[gi]:""},Re=e=>({[mi]:e}),Ce=(e,n)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(n)}"]`)!==null,xi=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,Ze=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,_n=(e,n,r)=>r!==null&&(0,p.isPointWithinEditMenuTrigger)({x:e.clientX-n.x,y:e.clientY-n.y},r),pe=(e,n,r)=>e instanceof Node&&(n.contains(e)||Ce(e,r)),vi="cml7ha0",On=(0,b.createContext)(null),fi=({children:e})=>{const{chartId:n}=l.useGraphContext(),[r]=(0,b.useState)(l.resolvePortalContainer),[o,a]=(0,b.useState)(null);return r===null?null:(0,t.jsxs)(t.Fragment,{children:[(0,sn.createPortal)((0,t.jsx)("div",{ref:a,className:vi,...Re(n)}),r),(0,t.jsx)(On.Provider,{value:o,children:e})]})},lt=()=>(0,b.useContext)(On),Nn=e=>(0,t.jsxs)(l.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 Dn="efjmb40",Fn="efjmb41",te="efjmb42",ne="efjmb43",bi="efjmb44",Si="efjmb45",Ci=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),st=({label:e,icon:n,onOpened:r,children:o})=>{const a=lt(),[i,s]=(0,b.useState)(!1),c=(d,h)=>{d?(s(!0),r?.()):Ci.has(h.reason)&&s(!1)};return(0,t.jsxs)(Q.Menu.SubmenuRoot,{open:i,onOpenChange:c,children:[(0,t.jsx)(yi,{label:e,icon:n}),(0,t.jsx)(Q.Menu.Portal,{container:a,children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(Q.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:Dn,...Rn,children:(0,t.jsx)(Q.Menu.Popup,{className:Fn,children:o})})})})]})},yi=({label:e,icon:n})=>(0,t.jsxs)(Q.Menu.SubmenuTrigger,{className:te,openOnHover:!1,children:[n,(0,t.jsx)("span",{className:ne,children:e}),(0,t.jsx)("span",{className:Si,children:(0,t.jsx)(me,{size:"sm"})})]}),ji="_1qe7q450",Ai="_1qe7q451",Ti="_1qe7q452",wi=({label:e,placeholder:n,addLabel:r,at:o,onRequestClose:a})=>{const i=(0,b.useRef)(null),[s,c]=(0,b.useState)(""),{dispatch:d}=l.useGraphCommands(),h=s.trim(),u=()=>{h.length!==0&&(d(new p.AddAnnotationCommand({kind:"comment",annotation:{at:o,content:Pi(h)}})),a())},m=v=>{v.key==="Enter"&&(v.preventDefault(),u()),v.key!=="Escape"&&v.stopPropagation()},x=v=>{c(v.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,t.jsx)(st,{label:e,icon:(0,t.jsx)(Nn,{}),onOpened:g,children:(0,t.jsxs)("div",{className:ji,children:[(0,t.jsx)("input",{ref:i,className:Ai,value:s,placeholder:n,onChange:x,onKeyDown:m}),(0,t.jsx)("button",{type:"button",className:Ti,disabled:h.length===0,onClick:u,children:r})]})})},Pi=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),ki=e=>(0,t.jsx)(l.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"})}),Li="relative-difference",Ii=({label:e,layer:n,at:r,onRequestClose:o})=>{const{dispatch:a}=l.useGraphCommands(),i=l.useCompiledSelector(d=>d.coordSystem),s=(0,b.useMemo)(()=>(0,p.inferDifferenceArrowEndpoints)({layer:n,at:r,coordSystem:i}),[n,r,i]);if(s===null)return null;const c=()=>{a(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...s,label:Li}})),o()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:c,children:[(0,t.jsx)(ki,{}),(0,t.jsx)("span",{className:ne,children:e})]})};function Ei(e,n){if(e.type==="polar"&&!Mi(n))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,p.hasMultipleGroups)(n.data,n.mapping);switch(n.geom){case"bar":{const o=[{scope:"data-point",labelKey:"bar"}];if(r){const a=n.position==="stack"||n.position==="fill";o.push({scope:"x-value",labelKey:a?"barStack":"barGroup"}),o.push({scope:"series",labelKey:"barSeries"})}return o}case"line":case"area":{const o=[{scope:"data-point",labelKey:"linePoint"}];return r&&o.push({scope:"series",labelKey:"lineSeries"}),o}case"point":{const o=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&o.push({scope:"series",labelKey:"scatterSeries"}),o}default:return[]}}var Mi=e=>{const n=(0,p.extractVariableName)(e.mapping.x);return n!==null&&n!==p.CONSTANT_VARIABLES.x},Ri=e=>(0,t.jsxs)(l.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"})]}),_i=e=>(0,t.jsxs)(l.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"})]}),Oi=e=>(0,t.jsxs)(l.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"})]}),Ni=e=>(0,t.jsxs)(l.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"})]}),Di=e=>(0,t.jsxs)(l.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"})]}),Fi=e=>(0,t.jsxs)(l.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"})]}),zi=e=>(0,t.jsxs)(l.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"})]}),Hi=e=>(0,t.jsxs)(l.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)"})]}),Bi=e=>(0,t.jsxs)(l.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)"})]}),Gi={bar:Ri,barGroup:_i,barStack:Ni,barSeries:Oi,linePoint:Di,lineSeries:Fi,scatterPoint:Hi,scatterSeries:Bi,pieSlice:zi},zn=({labelKey:e})=>{const n=Gi[e];return(0,t.jsx)(n,{})},Hn=e=>(0,t.jsxs)(l.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"})]}),Vi=({label:e,options:n,onSelect:r})=>{const o=l.useI18n();return(0,t.jsx)(st,{label:e,icon:(0,t.jsx)(Hn,{}),children:n.map(a=>(0,t.jsxs)(Q.Menu.Item,{className:te,onClick:()=>r(a.scope),children:[(0,t.jsx)(zn,{labelKey:a.labelKey}),(0,t.jsx)("span",{className:ne,children:o(`graph.annotations.highlights.labels.${a.labelKey}`)})]},a.scope))})},Ui=({label:e,layer:n,observation:r,highlights:o,onRequestClose:a})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),c=l.useCompiledSelector(g=>g.coordSystem),d=(0,b.useMemo)(()=>(0,p.buildObservationPredicate)(n,r),[n,r]),h=(0,b.useMemo)(()=>Ei(c,n),[c,n]),u=(0,b.useMemo)(()=>{const g=new Set(o.map(v=>v.scope));return h.filter(v=>!g.has(v.scope))},[h,o]),[m]=u;if(d===null||m===void 0)return null;const x=g=>{s(new p.AddHighlightCommand({predicate:d,scope:g,layerId:n.id})),a()};if(u.length===1){const g=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,t.jsxs)(Q.Menu.Item,{className:te,onClick:()=>x(m.scope),children:[(0,t.jsx)(zn,{labelKey:m.labelKey}),(0,t.jsx)("span",{className:ne,children:g})]})}return(0,t.jsx)(Vi,{label:e,options:u,onSelect:x})},Wi="_1aafi1g0",$i="_1aafi1g1",Bn=({children:e})=>(0,t.jsxs)("span",{className:Wi,"aria-hidden":"true",children:[e,(0,t.jsx)("span",{className:$i})]}),qi=({label:e,highlights:n,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=n.at(-1);if(a===void 0)return null;const i=()=>{o(new p.RemoveHighlightCommand({id:a.id})),r()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:i,children:[(0,t.jsx)(Bn,{children:(0,t.jsx)(Hn,{})}),(0,t.jsx)("span",{className:ne,children:e})]})},Ki=(e,n)=>{const r=l.useCompiledSelector(a=>a.spec.highlights),o=l.useCompiledSelector(a=>a.config.parsingLocale);return(0,b.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:r,observation:n,parsingLocale:o}),[e,r,n,o])},Gn=e=>(0,t.jsxs)(l.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"})]}),Zi=({label:e,at:n,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=()=>{o(new p.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:n}})),r()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:a,children:[(0,t.jsx)(Gn,{}),(0,t.jsx)("span",{className:ne,children:e})]})},Vn=e=>(0,t.jsxs)(l.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"})]}),Un={pinnedNumber:{icon:Gn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:Nn,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Vn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Xi=e=>(0,p.isObservationAttachmentKind)(e.kind)&&Un[e.kind]!==null,Yi=({attachment:e,onRequestClose:n})=>{const r=l.useI18n(),{dispatch:o}=l.useGraphCommands(),{icon:a,labelKey:i}=Un[e.kind],s=()=>{o(new p.RemoveAnnotationCommand({id:e.annotation.id})),n()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:s,children:[(0,t.jsx)(Bn,{children:(0,t.jsx)(a,{})}),(0,t.jsx)("span",{className:ne,children:r(i)})]})},Ji="ceeojg0",Qi="ceeojg1",el="ceeojg2",tl=({label:e,at:n,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=i=>{o(new p.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...n},sticker:i}})),r()};return(0,t.jsx)(st,{label:e,icon:(0,t.jsx)(Vn,{}),children:(0,t.jsx)("div",{className:Ji,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,t.jsx)(Q.Menu.Item,{className:Qi,"aria-label":i,onClick:()=>a(i),children:(0,t.jsx)("img",{className:el,src:s.src,alt:i})},i))})})},nl=({interaction:e,panelOrigin:n})=>{const r=l.useEditorStore(),o=l.useEditorState(i=>i.menuTrigger);if(e.kind!=="menu"||o===null)return null;const a=()=>{r.getState().releaseInteraction("menu")};return(0,t.jsx)(rl,{trigger:{x:n.x+o.center.x,y:n.y+o.center.y,radius:o.radius},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:a})},rl=({trigger:e,layer:n,at:r,observation:o,onClose:a})=>{const i=l.useI18n(),s=lt(),c=l.useCompiledSelector(C=>C.spec.annotations),d=l.useCompiledSelector(C=>C.config.parsingLocale),h=al(),{x:u,y:m,radius:x}=e,g=(0,b.useMemo)(()=>ol(u,m,x),[u,m,x]),v=(0,p.findObservationAttachment)(c,r,(0,b.useMemo)(()=>(0,p.createObservationAnchorParser)(n,d),[n,d])),S=v!==null&&Xi(v)?v:null,y=Ki(n,o),P=(C,k)=>{!C&&il(k.reason)&&a()};return(0,t.jsx)(N.Menu.Root,{open:h,modal:!1,onOpenChange:P,children:(0,t.jsx)(N.Menu.Portal,{container:s,children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:Dn,...Rn,children:(0,t.jsxs)(N.Menu.Popup,{className:Fn,"data-testid":"observation-menu",children:[S!==null&&(0,t.jsx)(Yi,{attachment:S,onRequestClose:a}),(0,t.jsx)(qi,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:y,onRequestClose:a}),(0,t.jsx)(N.Menu.Separator,{className:bi}),S===null&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Zi,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:a}),(0,t.jsx)(wi,{label:i("graph.annotations.baseMenu.annotate"),placeholder:i("graph.annotations.textMenu.placeholder"),addLabel:i("graph.annotations.textMenu.addButton"),at:r,onRequestClose:a}),(0,t.jsx)(tl,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:a})]}),n.highlight!==null&&(0,t.jsx)(Ui,{label:i("graph.annotations.baseMenu.highlight"),layer:n,observation:o,highlights:y,onRequestClose:a}),(0,t.jsx)(Ii,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:n,at:r,onRequestClose:a})]})})})})})},ol=(e,n,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,n-r,r*2,r*2)}),al=()=>{const[e,n]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{n(!0)},[]),e},il=e=>e==="outside-press"||e==="escape-key"||e==="item-press",ct="l8tsqe0",Wn=["start","end"],$n=({anchor:e,point:n,delta:r})=>{const o={x:Et(n.x,r.x),y:Et(1-n.y,r.y)};return{anchor:{...e,x:e.x+o.x,y:e.y+o.y},point:{x:n.x+o.x,y:n.y-o.y}}},dt=(e,n)=>({...e,[n.endpoint]:{...e[n.endpoint],...n.point}}),qn=(e,n)=>e.x===n.x&&e.y===n.y,ll=(e,n)=>{const r=(0,p.projectAnchorToPanel)(e,n);return{x:n.x+r.x,y:n.y+r.y}},sl=(e,n,r)=>{const o=(0,p.projectAnchorToPanel)(e,r),a=(0,p.projectAnchorToPanel)(n,r);return{x:Math.min(o.x,a.x),y:Math.min(o.y,a.y),width:Math.abs(a.x-o.x),height:Math.abs(a.y-o.y)}},Et=(e,n)=>!Number.isFinite(n)||!Number.isFinite(e)?0:(0,le.default)(n,Math.min(-e,0),Math.max(1-e,0)),cl=({panelRect:e})=>{const n=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,o=l.useArrowAnnotationStyles();if(n===null)return null;const a=r.find(c=>c.id===n.annotationId);if(a===void 0)return null;const i=o(a.id),s=(0,p.computeArrow)({arrow:dt(a,n),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ct,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)(l.ArrowAnnotation,{computed:s,style:i,isAddressable:!1})})},ge=()=>{const e=l.useGraphSelection();return Xe(e)},Xe=e=>{if(e.length!==1)return null;const[n]=e;return n?.kind==="annotation"?n.id:null},dl=e=>(0,t.jsx)(l.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"})]})}),Kn=e=>(0,t.jsx)(l.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"})]})}),ul=e=>(0,t.jsx)(l.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"})]})}),Zn=e=>(0,t.jsx)(l.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"})]})}),_e=e=>(0,t.jsx)(l.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"})]})}),hl="var(--pvjfpx0)",pl="var(--pvjfpx1)",ml="pvjfpx2",gl="pvjfpx3",xl="pvjfpx4",vl="pvjfpx6 pvjfpx5",fl="pvjfpx7 pvjfpx6 pvjfpx5",bl="pvjfpx8 pvjfpx5",ue=8,Sl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:o})=>{const a=n.y+e.y,i=a+e.height,s=a-8-36,c=i+8,d=(0,le.default)(s>=ue?s:c,ue,o-ue-36),h=ue;return{top:d,left:h,available:Math.max(0,r-ue*2),centre:n.x+e.x+e.width/2-h}},Cl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:o,label:a,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=Sl({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:o});return(0,t.jsx)("div",{className:ml,style:{top:d.top,left:d.left,width:d.available},children:(0,t.jsx)(B.Root,{"aria-label":a,className:gl,"data-testid":i,...Re(c),style:(0,ln.assignInlineVars)({[hl]:`${d.centre}px`,[pl]:`${d.available}px`}),children:s})})},yl=({label:e,trigger:n,isOpen:r,onOpenChange:o,isDisabled:a=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,t.jsxs)(N.Menu.Root,{open:r,modal:!1,onOpenChange:o,children:[(0,t.jsxs)(N.Menu.Trigger,{render:(0,t.jsx)(B.Button,{}),"aria-label":e,className:bl,disabled:a,onMouseDown:c=>c.preventDefault(),children:[n,(0,t.jsx)(me,{size:"sm"})]}),(0,t.jsx)(B.MenuPopup,{popupAttributes:Re(s),children:i})]})},jl=e=>{const{chartId:n}=l.useGraphContext();return(0,t.jsx)(B.ColorPicker,{...e,popupAttributes:Re(n)})},Al=({color:e,opacity:n})=>(0,t.jsx)("span",{className:xl,style:{background:e,opacity:n}}),Tl=({label:e,onClick:n,children:r})=>(0,t.jsx)(B.Button,{"aria-label":e,className:vl,onClick:n,children:r}),wl=({label:e,isPressed:n,onClick:r,children:o})=>(0,t.jsx)(B.Button,{"aria-label":e,"aria-pressed":n,className:fl,onClick:r,children:o}),E={Root:Cl,Dropdown:yl,MenuItem:B.MenuItem,ColorPicker:jl,Swatch:Al,IconButton:Tl,ToggleButton:wl,Button:B.Button,Separator:B.Separator},Pl={kind:"chrome-popup"},Oe=()=>{const{commands:e}=l.useGraphContext(),n=l.useEditorStore(),[r,o]=(0,b.useState)(null);(0,b.useEffect)(()=>()=>e.seal(),[e]),(0,b.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:s}=n.getState();return r===null?s("chrome-popup"):i(Pl),()=>s("chrome-popup")},[n,r]);const a=()=>{o(null),e.seal()};return{bind:i=>({isOpen:r===i,onOpenChange:s=>s?o(i):a()}),close:a}},kl=e=>(0,t.jsx)(l.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"})]})}),Ll=e=>(0,t.jsx)(l.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,t.jsx)("path",{d:"M5 19h0"}),(0,t.jsx)("path",{d:"M8.5 15.5h0"}),(0,t.jsx)("path",{d:"M12 12h0"}),(0,t.jsx)("path",{d:"M15.5 8.5h0"}),(0,t.jsx)("path",{d:"M19 5h0"})]})}),Il=e=>(0,t.jsx)(l.Icon,{...e,children:(0,t.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),El=[{value:p.ARROW_STROKE_WIDTHS.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:p.ARROW_STROKE_WIDTHS.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:p.ARROW_STROKE_WIDTHS.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],Mt=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Kn},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Rt=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:Il},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:kl},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:Ll}],Ml=(e,n)=>e.find(r=>r.value===n)??e[0];var Rl=({arrow:e,arrowBox:n,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useCompiledSelector(I=>I.spec.styles.overrides),h=Oe(),u=l.useArrowAnnotationStyles()(e.id),m=Ml(Rt,u.lineType),x=u.borderWidth>0||u.shadow!=="none",g=(0,b.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),v=(I,M)=>{const A=(0,p.findStyleRule)(d,{select:g})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:g,declarations:{...A,...I}}}),M)},S=I=>{v(I),h.close()},y=I=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:I})),h.close()},P=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},C=I=>v({color:I},{transient:!0}),k=I=>S({strokeWidth:I}),L=I=>y({startArrowheadStyle:I}),R=I=>S({lineType:I}),O=I=>y({endArrowheadStyle:I}),_=()=>v(x?{borderWidth:0,shadow:"none"}:p.ARROW_STICKER_DECLARATIONS);return(0,t.jsxs)(E.Root,{anchorBox:n,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,t.jsx)(E.ColorPicker,{color:u.color,label:s("graph.annotations.arrowToolbar.color"),onChange:C,...h.bind("color"),children:(0,t.jsx)(E.Swatch,{color:u.color})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,t.jsx)(Zn,{size:"sm",title:""}),...h.bind("thickness"),children:(0,t.jsx)(fe,{options:El,current:u.strokeWidth,onPick:k})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,t.jsx)(dl,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,t.jsx)(fe,{options:Mt,current:e.startArrowheadStyle,onPick:L})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:m?.Icon!==void 0&&(0,t.jsx)(m.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,t.jsx)(fe,{options:Rt,current:u.lineType,onPick:R})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,t.jsx)(Kn,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,t.jsx)(fe,{options:Mt,current:e.endArrowheadStyle,onPick:O})}),(0,t.jsx)(E.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),isPressed:x,onClick:_,children:(0,t.jsx)(ul,{size:"sm",title:""})}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:P,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},fe=({options:e,current:n,onPick:r})=>{const o=l.useI18n(),a=i=>()=>r(i);return(0,t.jsx)(t.Fragment,{children:e.map(i=>(0,t.jsxs)(E.MenuItem,{isSelected:i.value===n,onClick:a(i.value),children:[(0,t.jsx)("span",{children:o(i.key)}),i.Icon!==void 0&&(0,t.jsx)("span",{className:"_112xh5c0",children:(0,t.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},_l="_1me29t10",q=(e,n)=>n>0?e/n:0,Ne=(e,n,r)=>({x:q(n.x-e.x,r.width),y:q(n.y-e.y,r.height)}),Ol=e=>e.x!==0||e.y!==0,Xn=(e,n)=>({x:e.x*n.width,y:e.y*n.height});var Nl=(e,n)=>Math.hypot(n.x-e.x,n.y-e.y)>=3,xe=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 o={x:n.clientX,y:n.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,o))return;const a=this.resolvePreview(o);a!==null&&(r.claimInteraction(a),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 Nl(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)}},Te=(e,n,r)=>{const o=e.arrows.find(i=>i.id===n);if(o===void 0)return null;const a=o[r];return a.anchorType==="panel"?a:null},Yn=(e,n)=>e==="start"?{start:n}:{end:n},Dl=class extends xe{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:n,endpoint:r}=this.params;return l.readDraggedArrowEndpointFor(l.readStanding(e,"arrow-endpoint-drag"),n,r)}resolvePreview(e){const{annotationId:n,endpoint:r,press:o,readInputs:a}=this.params,{annotations:i,arrow:s,panelRect:c}=a(),d=Te(i,n,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:n,endpoint:r,...$n({anchor:d,point:s[r],delta:Ne(o,e,c)})}}commit({anchor:e}){const{annotationId:n,endpoint:r,dispatch:o,readInputs:a}=this.params,i=Te(a().annotations,n,r);i===null||qn(i,e)||o(new p.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Yn(r,e)}))}},Fl=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef({annotations:l.useCompiledSelector(c=>c.spec.annotations),arrow:n,panelRect:r}),s=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>s.current?.finish(!1),[]),(0,b.useCallback)(c=>({onPointerDown:d=>{if(d.button===0&&s.current===null){try{d.currentTarget.setPointerCapture(d.pointerId)}catch{return}d.currentTarget.focus({preventScroll:!0}),d.preventDefault(),s.current=new Dl({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:a,dispatch:o.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,a,o])},zl=[" ","Enter"],_t=4,Hl=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useCompiledSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(o.dispatch);return(0,b.useEffect)(()=>()=>{for(const d of Wn)Ot({editorStore:a,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[a,e,s,c]),(0,b.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(u,"arrow-endpoint-drag"),e,d);if(zl.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m!==null){Ot({editorStore:a,annotationId:e,endpoint:d,annotations:i,dispatch:o.dispatch});return}const g=Te(i,e,d);if(g===null)return;u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:g,point:n[d]});return}if(m===null)return;const x=Bl(h.key,r);x!==null&&(h.preventDefault(),u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...$n({anchor:m.anchor,point:m.point,delta:x})}))}}),[e,i,n,r,a,o])},Ot=({editorStore:e,annotationId:n,endpoint:r,annotations:o,dispatch:a})=>{const i=e.getState(),s=l.readDraggedArrowEndpointFor(l.readStanding(i,"arrow-endpoint-drag"),n,r);if(s===null)return;i.releaseInteraction("arrow-endpoint-drag");const c=Te(o,n,r);c===null||qn(c,s.anchor)||a(new p.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Yn(r,s.anchor)}))},Bl=(e,n)=>{const r=q(_t,n.width),o=q(_t,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},Gl=e=>{const n=ge(),r=Wl(n),o=$l(e.panelRect,n),a=ql(n);if(r===null||o===null)return null;const i=a.dragged===null?o:dt(o,a.dragged);return(0,t.jsx)(Vl,{arrow:r,committed:o,painted:i,isSettled:a.dragged===null&&!a.isMoved,isMoved:a.isMoved,...e})},Vl=({arrow:e,committed:n,painted:r,isSettled:o,isMoved:a,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=Fl({annotationId:e.id,arrow:n,panelRect:i}),u=Hl({annotationId:e.id,arrow:n,panelRect:i});return(0,t.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[o&&(0,t.jsx)(Rl,{arrow:e,arrowBox:sl(n.start,n.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!a&&Wn.filter(m=>e[m].anchorType==="panel").map(m=>(0,t.jsx)(Ul,{endpoint:m,point:ll(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:u(m)},m))]})},Ul=({endpoint:e,point:n,label:r,dragHandlers:o,keyboardHandlers:a})=>(0,t.jsx)("div",{"aria-label":r,className:_l,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:n.x,top:n.y},tabIndex:0,...o,...a}),Wl=e=>{const n=l.useCompiledSelector(r=>r.spec.annotations.arrows);return e===null?null:n.find(r=>r.id===e)??null},$l=(e,n)=>{const r=l.useResolvedAnnotations(e).arrows;return n===null?null:r.find(o=>o.id===n)??null},ql=e=>l.useEditorState((0,se.useShallow)(n=>{if(e===null)return{dragged:null,isMoved:!1};const r=l.readStanding(n,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:l.readMovedAnnotationFor(l.readStanding(n,"move-drag"),e)!==null}})),Kl=e=>(0,t.jsx)(l.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"})]})}),Zl="q7gcrz0",Xl="q7gcrz1",Yl="q7gcrz2";var Jl=["absolute-difference","relative-difference","proportion"],Nt=["absolute-difference","relative-difference"],Ql=["relative-difference","proportion"],es={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},ts=e=>{const{formattingLocale:n}=l.useGraphContext(),r=l.useCompiledSelector(a=>a.config.parsingLocale),o=n??r;return(0,b.useMemo)(()=>{const a=(0,p.areEndpointsComparable)(e.start,e.end);return Jl.filter(i=>a||!Nt.includes(i)||i===e.label).map(i=>({kind:i,key:es[i],preview:(0,p.formatDifferenceLabel)({locale:o,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:a||!Nt.includes(i),isSuspect:Ql.includes(i)&&e.start.measurementValue===0}))},[e,o])},Dt=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],ns=({arrow:e,color:n,labelBox:r,panelRect:o,frameWidth:a,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useCompiledSelector(f=>f.spec.styles.overrides),u=Oe(),m=ts(e),x=l.useDifferenceArrowAnnotationStyles()(e.id),g=(0,b.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),v=(0,b.useMemo)(()=>({...g,part:"label"}),[g]),S=m.find(f=>f.kind===e.label),y=m.some(f=>f.isPickable&&f.kind!==e.label),P=Dt.find(f=>p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[f.id].arrow.strokeWidth===x.strokeWidth),C=(f,w)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:f}),w)},k=f=>({...(0,p.findStyleRule)(h,{select:g})?.declarations,...f}),L=f=>({...(0,p.findStyleRule)(h,{select:v})?.declarations,...f}),R=f=>{C(f),u.close()},O=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},_=f=>d.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:g,declarations:k({color:f})}}),{transient:!0}),I=()=>C({start:e.end.anchor,end:e.start.anchor}),M=f=>()=>R({label:f}),A=f=>()=>{const w=p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[f];d.dispatch(new p.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:k(w.arrow),label:L(w.label)})),u.close()};return(0,t.jsxs)(E.Root,{anchorBox:r,panelRect:o,frameWidth:a,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,t.jsx)(E.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,t.jsx)(rs,{option:S}),isDisabled:!y,...u.bind("labelKind"),children:m.map(f=>(0,t.jsxs)(E.MenuItem,{isSelected:f.kind===e.label,isDisabled:!f.isPickable,onClick:M(f.kind),children:[(0,t.jsx)("span",{children:c(f.key)}),(f.isSuspect||!f.isPickable)&&(0,t.jsx)("span",{"aria-label":c(f.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,t.jsx)("span",{className:Yl,children:f.preview})]},f.kind))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.ColorPicker,{color:n,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:_,...u.bind("color"),children:(0,t.jsx)(E.Swatch,{color:n})}),(0,t.jsx)(E.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:P===void 0?"":c(P.key),...u.bind("size"),children:Dt.map(f=>(0,t.jsx)(E.MenuItem,{isSelected:f.id===P?.id,onClick:A(f.id),children:c(f.key)},f.id))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:I,children:(0,t.jsx)(Kl,{size:"sm",title:""})}),(0,t.jsx)(E.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:O,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},rs=({option:e})=>{const n=l.useI18n();return e===void 0?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:Xl,children:n(e.key)}),(0,t.jsxs)("span",{className:Zl,children:["(",e.preview,")"]})]})};var os="ydgo3h0",as="ydgo3h1",is="ydgo3h2",ls=({clientPoint:e,panelOrigin:n,panelRect:r,engine:o,layers:a,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=ss({x:e.x-n.x,y:e.y-n.y},r),{primary:u}=o.query((0,p.toPanelCursor)(h,r));if(u===null)return null;const m=a.find(g=>g.id===u.layerId);if(m===void 0)return null;const x=(0,p.resolveObservationPoint)({resolver:s,layer:m,observation:u.observation,observationIndex:(0,p.readObservationIndex)(u),coordSystem:i,align:d});return x===null||(0,p.areAnchorsEqual)(x.anchor,c)?null:x},ss=(e,n)=>({x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))}),Jn=e=>e==="start"?"end":"start",Qn=({dispatch:e,arrow:n,endpoint:r,anchor:o})=>{(0,p.areAnchorsEqual)(o,n[r].anchor)||e(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:n.id,patch:{[r]:o}}))},cs=class extends xe{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:n,readInputs:r}=this.params;return l.readDraggedDifferenceArrowEndpointFor(l.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,n)}resolvePreview(e){const{endpoint:n,readInputs:r,engine:o,anchorResolver:a}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=r(),u=ls({clientPoint:e,panelOrigin:s,panelRect:c,engine:o,layers:d,coordSystem:h,resolver:a,fixedAnchor:i[Jn(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:o}=this.params;Qn({dispatch:r,arrow:o().arrow,endpoint:n,anchor:e.anchor})}},ds=({arrow:e,panelOrigin:n,panelRect:r})=>{const{commands:o,anchorResolver:a}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:n,panelRect:r,...l.useCompiledSelector((0,se.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),d=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>d.current?.finish(!1),[]),(0,b.useCallback)(h=>({onPointerDown:u=>{if(u.button===0&&d.current===null){try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault(),d.current=new cs({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:a,dispatch:o.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,a,o])},us=[" ","Enter"],hs=({arrow:e})=>{const{commands:n,anchorResolver:r}=l.useGraphContext(),o=l.useEditorStore(),{layers:a,coordSystem:i,mainAxis:s}=l.useCompiledSelector((0,se.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:d.coordSystem.type==="cartesian"?d.coordSystem.mainAxis:"x"}))),c=e.id;return(0,b.useEffect)(()=>()=>{const d=o.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[o,c]),(0,b.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=o.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(u,"difference-arrow-endpoint-drag"),e.id,d);if(us.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});u.releaseInteraction("difference-arrow-endpoint-drag"),Qn({dispatch:n.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const x=ps(h.key,s);if(x===null)return;h.preventDefault();const g=ms({arrow:e,endpoint:d,from:m.point.anchor,move:x,layers:a,coordSystem:i,resolver:r});g!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:g})}}),[e,o,n,r,a,i,s])},ps=(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}},ms=({arrow:e,endpoint:n,from:r,move:o,layers:a,coordSystem:i,resolver:s})=>{const c=a.find(u=>u.id===r.layerId);if(c===void 0)return null;const d=s.createLayerMeasurement(c);if(d===null)return null;const{align:h}=e[n].anchor;return(0,p.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[Jn(n)].anchor,axis:o.axis,step:o.step,getObservationPoint:(u,m)=>(0,p.resolveObservationPoint)({resolver:s,layer:c,observation:u,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},gs=e=>{const n=ge();return n===null?null:(0,t.jsx)(xs,{annotationId:n,...e})},xs=({annotationId:e,...n})=>{const r=l.useDifferenceArrowGeometries(),o=(0,b.useMemo)(()=>r.find(a=>a.id===e),[r,e]);return o===void 0?null:(0,t.jsx)(vs,{committedArrow:o.committedArrow,color:o.color,labelCornerRadius:o.style.label.borderRadius,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,start:o.start,end:o.end,isDragged:o.isDragged,...n})},vs=({committedArrow:e,color:n,labelCornerRadius:r,committedLabelBox:o,labelBox:a,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:h,frameElement:u,isDragged:m})=>{const x=ds({arrow:e,panelOrigin:d,panelRect:c}),g=hs({arrow:e});return(0,t.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!m&&(0,t.jsx)(ns,{arrow:e,color:n,labelBox:o,panelRect:c,frameWidth:h.width,frameHeight:h.height,frameElement:u}),(0,t.jsx)("div",{"aria-hidden":"true",className:is,"data-testid":"difference-arrow-selection-label",style:{left:c.x+a.x-2,top:c.y+a.y-2,width:a.width+4,height:a.height+4,borderRadius:r+2}}),(0,t.jsx)(Ft,{endpoint:"start",point:i,panelRect:c,dragHandlers:x("start"),keyboardHandlers:g("start")}),(0,t.jsx)(Ft,{endpoint:"end",point:s,panelRect:c,dragHandlers:x("end"),keyboardHandlers:g("end")})]})},Ft=({endpoint:e,point:n,panelRect:r,dragHandlers:o,keyboardHandlers:a})=>(0,t.jsx)("div",{className:os,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+n.x,top:r.y+n.y},tabIndex:0,...o,...a,children:(0,t.jsx)("span",{"aria-hidden":"true",className:as})}),Ye=({start:e,extent:n,isStartMoving:r,delta:o,minExtent:a})=>{if(!Number.isFinite(o))return{start:e,extent:n};const i=e+n,s=Math.min(a,n);if(r){const h=Math.min(0,e),u=Math.min(Math.max(1,e),i-s),m=(0,le.default)(e+o,h,u);return{start:m,extent:i-m}}const c=Math.max(Math.min(0,i),e+s),d=Math.max(1,i);return{start:e,extent:(0,le.default)(i+o,c,d)-e}},fs=["top-left","top-right","bottom-right","bottom-left"];var er=({width:e,height:n})=>({x:q(16,e),y:q(16,n)}),bs=(e,n)=>({x:rr(n)?e.x:e.x+e.width,y:or(n)?e.y:e.y+e.height}),ut=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),tr=({region:e,corner:n,delta:r,minSize:o})=>{const a=Ye({start:e.x,extent:e.width,isStartMoving:rr(n),delta:r.x,minExtent:o.x}),i=Ye({start:e.y,extent:e.height,isStartMoving:or(n),delta:r.y,minExtent:o.y});return{anchorType:"panel",x:a.start,y:i.start,width:a.extent,height:i.extent}},nr=(e,n)=>e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height,rr=e=>e==="top-left"||e==="bottom-left",or=e=>e==="top-left"||e==="top-right",ar=(e,n,r,o)=>{const a=e.textAnnotations.find(i=>i.id===n);return a===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(a,r),o)};var Ss={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},Cs={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},ys=({panelRect:e})=>{const n=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),o=l.useChromeStyleReaders(),a=ge(),i=l.useEditorState(S=>l.readStanding(S,"move-drag")),s=l.useEditorState(S=>l.readStanding(S,"shape-resize-drag")),c=l.useEditorState(S=>l.readStanding(S,"arrow-endpoint-drag")),d=l.useEditorState(S=>l.readStanding(S,"text-resize-drag")),h=l.useEditorState(S=>{const y=S.editTargetUnderPointer;return y?.kind==="annotation"?y.id:null}),u=(0,b.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,chromeReaders:o}),[e.width,e.height,r,o]),m=zt(n,a,u),x=zt(n,h===a?null:h,u),g=S=>{if(s?.annotationId===S.id){const y=n.shapes.find(P=>P.id===S.id);return y===void 0?S.geometry:l.measureShapeRegion(ut(s.region),(0,p.resolveShapeAnnotationStyle)(o,y.id).borderWidth,u.panel)}if(c?.annotationId===S.id){const y=n.arrows.find(P=>P.id===S.id);return y===void 0?S.geometry:l.measureArrowEnds(dt(y,c),u.panel)??S.geometry}return d?.annotationId===S.id?ar(n,S.id,d,u)??S.geometry:S.geometry},v=S=>{if(i?.annotationId!==S)return e;const y=Xn(i.translation,e);return{x:e.x+y.x,y:e.y+y.y}};return(0,t.jsxs)(t.Fragment,{children:[x!==null&&(0,t.jsx)(Ht,{annotationId:x.id,geometry:g(x),state:"hovered",origin:v(x.id)}),m!==null&&(0,t.jsx)(Ht,{annotationId:m.id,geometry:g(m),state:"selected",origin:v(m.id)})]})},zt=(e,n,r)=>{if(n===null)return null;const o=l.resolveAnnotationChromeGeometry(e,n,r);return o===null?null:{id:n,geometry:o}},Ht=({annotationId:e,geometry:n,state:r,origin:o})=>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)(Bt,{point:n.start,state:r,origin:o}),(0,t.jsx)(Bt,{point:n.end,state:r,origin:o})]}):(0,t.jsx)("div",{"aria-hidden":"true",className:Ss[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:o.x+n.rect.x-2,top:o.y+n.rect.y-2,width:n.rect.width+4,height:n.rect.height+4}}),Bt=({point:e,state:n,origin:r})=>(0,t.jsx)("span",{className:Cs[n],style:{left:r.x+e.x,top:r.y+e.y}}),js=({panelRect:e})=>{const n=l.useEditorState(a=>l.readStanding(a,"move-drag")),r=l.useResolvedAnnotations(e);if(n===null)return null;const o=Xn(n.translation,e);return(0,t.jsx)("svg",{"aria-hidden":"true",className:ct,width:e.width,height:e.height,style:{left:e.x+o.x,top:e.y+o.y},"data-testid":"annotation-preview","data-annotation-id":n.annotationId,children:ws(r,n.annotationId,e)})},As=({annotation:e,panel:n})=>{const r=l.useMeasuredBoxRef(e.id);return(0,t.jsx)(l.TextAnnotation,{annotation:e,panel:n,style:l.useTextAnnotationStyles()(e.id),blockRef:r})},be=(e,n,r)=>{const o=e.find(a=>a.id===n);return o===void 0?null:r(o)},Ts={text:(e,n,r)=>be(e.textAnnotations,n,o=>(0,t.jsx)(As,{annotation:o,panel:r})),shape:(e,n,r)=>be(e.shapes,n,o=>(0,t.jsx)(ks,{shape:o,panelSize:r})),image:(e,n,r)=>be(e.images,n,o=>(0,t.jsx)(Ls,{image:o,panelSize:r})),arrow:(e,n,r)=>be(e.arrows,n,o=>(0,t.jsx)(Ps,{arrow:o,panelSize:r}))},ws=(e,n,r)=>{for(const o of Object.values(Ts)){const a=o(e,n,r);if(a!==null)return a}return null},Ps=({arrow:e,panelSize:n})=>{const r=l.useArrowAnnotationStyles()(e.id),o=(0,p.computeArrow)({arrow:e,style:r,panelWidth:n.width,panelHeight:n.height});return o===null?null:(0,t.jsx)(l.ArrowAnnotation,{computed:o,style:r,isAddressable:!1})},ks=({shape:e,panelSize:n})=>(0,t.jsx)(l.ShapeAnnotation,{shape:e,style:l.useShapeAnnotationStyles()(e.id),panel:n}),Ls=({image:e,panelSize:n})=>(0,t.jsx)(l.ImageAnnotation,{image:e,panel:n,style:l.useImageAnnotationStyles()(e.id)}),Is=({panelRect:e})=>{const n=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,o=l.useShapeAnnotationStyles();if(n===null)return null;const a=r.find(i=>i.id===n.annotationId);return a===void 0?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ct,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)(l.ShapeAnnotation,{shape:{...a,region:ut(n.region)},style:o(a.id),panel:e})})},Es={sm:"o49ib40",md:"o49ib41"},Ms={horizontal:"o49ib42",diagonalDown:"o49ib43",diagonalUp:"o49ib44"},ir=({point:e,label:n,pull:r,size:o,attributes:a,dragHandlers:i,keyboardHandlers:s})=>(0,t.jsx)("div",{"aria-label":n,className:Ms[r],role:"button",style:{left:e.x,top:e.y},tabIndex:0,...a,...i,...s,children:(0,t.jsx)("span",{"aria-hidden":"true",className:Es[o]})}),Je=[{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"}],Rs=e=>[...Je].reverse().find(n=>n.width<=e)??Je[0],_s=({shape:e,shapeBox:n,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useCompiledSelector(C=>C.spec.styles.overrides),h=Oe(),u=l.useShapeAnnotationStyles()(e.id),m=Rs(u.borderWidth),x=(0,b.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),g=(C,k)=>{const L=(0,p.findStyleRule)(d,{select:x})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...L,...C}}}),k)},v=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},S=C=>g({color:C},{transient:!0}),y=C=>g({alpha:C},{transient:!0}),P=C=>()=>{g({borderWidth:C}),h.close()};return(0,t.jsxs)(E.Root,{anchorBox:n,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,t.jsx)(E.ColorPicker,{color:u.color,label:s("graph.annotations.shapeToolbar.color"),onChange:S,opacity:u.alpha,onOpacityChange:y,...h.bind("color"),children:(0,t.jsx)(E.Swatch,{color:u.color,opacity:u.alpha})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,t.jsx)(Zn,{size:"sm",title:""}),...h.bind("border"),children:Je.map(C=>(0,t.jsx)(E.MenuItem,{isSelected:C.width===m?.width,onClick:P(C.width),children:s(C.key)},C.width))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:v,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},lr=e=>{const n=l.useLatestRef(e),r=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,b.useCallback)(o=>({onPointerDown:a=>{if(a.button!==0||r.current!==null)return;try{a.currentTarget.setPointerCapture(a.pointerId)}catch{return}a.currentTarget.focus({preventScroll:!0}),a.preventDefault();const i=n.current(o,{handle:a.currentTarget,pointerId:a.pointerId,press:{x:a.clientX,y:a.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[n])},we=(e,n)=>{const r=e.shapes.find(o=>o.id===n);return r===void 0||r.region.anchorType!=="panel"?null:r.region},Os=class extends xe{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return l.readResizedShapeFor(l.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,corner:r,press:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=we(i,n);return c===null?null:{kind:"shape-resize-drag",annotationId:n,region:tr({region:c,corner:r,delta:Ne(o,e,s),minSize:er(s)})}}commit({region:e}){const{annotationId:n,dispatch:r,readInputs:o}=this.params,a=we(o().annotations,n);a===null||nr(a,e)||r(new p.UpdateAnnotationCommand({kind:"shape",id:n,patch:{region:e}}))}},Ns=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return lr((i,s)=>new Os({...s,annotationId:e,corner:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},Ds=[" ","Enter"],sr=e=>{const n=l.useEditorStore(),r=l.useLatestRef(e);return(0,b.useEffect)(()=>()=>Gt(n,r.current),[n,r]),(0,b.useCallback)(o=>({onKeyDown:a=>{if(a.altKey||a.ctrlKey||a.metaKey||a.shiftKey)return;const i=n.getState(),s=r.current.readHeld();if(Ds.includes(a.key)){if(a.preventDefault(),a.repeat)return;if(s!==null){Gt(n,r.current);return}const d=r.current.claim(o);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,o,a.key);c!==null&&(a.preventDefault(),i.claimInteraction(c))}}),[n,r])},Gt=(e,n)=>{const r=n.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),n.commit(r))},Vt=4,Fs=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useCompiledSelector(i=>i.spec.annotations);return sr({readHeld:()=>l.readResizedShapeFor(l.readStanding(o.getState(),"shape-resize-drag"),e),claim:()=>{const i=we(a,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=zs(c,n);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:tr({region:i.region,corner:s,delta:d,minSize:er(n)})}},commit:({region:i})=>{const s=we(a,e);s===null||nr(s,i)||r.dispatch(new p.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},zs=(e,n)=>{const r=q(Vt,n.width),o=q(Vt,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},Hs={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},Bs=e=>{const n=ge(),r=Vs(n),o=Us(n);if(r===null)return null;const a=o.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return a===null?null:(0,t.jsx)(Gs,{shape:r,region:a,isSettled:o.resizedRegion===null&&!o.isMoved,isMoved:o.isMoved,...e})},Gs=({shape:e,region:n,isSettled:r,isMoved:o,panelRect:a,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=Ns({annotationId:e.id,panelRect:a}),h=Fs({annotationId:e.id,panelRect:a}),u=l.useShapeAnnotationStyles()(e.id),{rect:m}=l.measureShapeRegion(ut(n),u.borderWidth,a);return(0,t.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(_s,{shape:e,shapeBox:m,panelRect:a,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!o&&fs.map(x=>{const g=bs(m,x);return(0,t.jsx)(ir,{point:{x:a.x+g.x,y:a.y+g.y},label:c(`graph.annotations.shapeToolbar.resize.${x}`),pull:Hs[x],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":x},dragHandlers:d(x),keyboardHandlers:h(x)},x)})]})},Vs=e=>{const n=l.useCompiledSelector(r=>r.spec.annotations.shapes);return e===null?null:n.find(r=>r.id===e)??null},Us=e=>l.useEditorState((0,se.useShallow)(n=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(n,"shape-resize-drag"),e)?.region??null,isMoved:l.readMovedAnnotationFor(l.readStanding(n,"move-drag"),e)!==null})),Ws=({textColor:e,...n})=>(0,t.jsxs)(l.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 Pe="textStyle",cr=new Set(["paragraph","heading"]),$s=e=>{const n=dr(e),r=Js(e);return{color:Se(n.map(o=>Qs(Ge(o)?.color))),font:Se(n.map(o=>Ys(Ge(o)))),fontSize:Se(n.map(o=>ec(Ge(o)?.fontSize))),alignment:Se(r.map(o=>tc(o.attrs?.textAlign)))}},qs=(e,n)=>ht(e,r=>r.type==="text"?Xs(r,n):r),Ks=e=>dr(e).length>0,Zs=(e,n)=>ht(e,r=>cr.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:n}}:r),ht=(e,n)=>n(e.content===void 0?e:{...e,content:e.content.map(r=>ht(r,n))}),Xs=(e,n)=>{const r=e.marks??[],o=r.find(i=>i.type===Pe),a={type:Pe,attrs:{...o?.attrs,...n}};return{...e,marks:o===void 0?[...r,a]:r.map(i=>i===o?a:i)}},Ge=e=>e.marks?.find(n=>n.type===Pe)?.attrs,Ys=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),dr=e=>pt(e,n=>n.type==="text"),Js=e=>pt(e,n=>cr.has(n.type??"")),pt=(e,n)=>[...n(e)?[e]:[],...(e.content??[]).flatMap(r=>pt(r,n))],Se=e=>{const[n,...r]=e;return n===void 0?null:r.every(o=>o===n)?n:null},Qs=e=>typeof e=="string"&&e.length>0?e:void 0,ec=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,tc=e=>e==="left"||e==="center"||e==="right"?e:void 0;var ur=[{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:l.RICH_TEXT_FONT_FAMILIES[e]??e})),nc=e=>ur.find(n=>n.id===(e??"modern"))??null;var hr=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:15,key:"graph.annotations.textToolbar.fontSize.medium"},{size:18,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:30,key:"graph.annotations.textToolbar.fontSize.huge"}],rc=e=>hr.find(n=>n.size===(e??15))??null,oc=e=>`${e}px`,ac=[{alignment:"left",Icon:En},{alignment:"center",Icon:Ln},{alignment:"right",Icon:In}],ic=({annotation:e,textBox:n,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useCompiledSelector(f=>f.spec.styles.overrides),h=l.useEditorStore(),u=Oe(),m=l.useTextAnnotationStyles()(e.id),x=$s(e.content),g=nc(x.font),v=rc(x.fontSize),S=x.color??m.textColor,y=(0,b.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),P=(f,w)=>{const H=(0,p.findStyleRule)(d,{select:y})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:y,declarations:{...H,...f}}}),w)},C=(f,w)=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:f}),w)},k=()=>h.getState().caret?.editor?.getJSON()??e.content,L=(f,w)=>{const H=k(),U=h.getState().caret?.editor??null;if(U!==null&&!Ks(H)){U.chain().focus().setMark(Pe,f).run();return}C({content:qs(H,f)},w)},R=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},O=f=>P(lc(f),{transient:!0}),_=f=>L({color:f},{transient:!0}),I=f=>()=>{L({font:f}),u.close()},M=f=>()=>{L({fontSize:f}),u.close()},A=f=>C({content:Zs(k(),f)});return(0,t.jsxs)(E.Root,{anchorBox:n,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,t.jsx)(E.ColorPicker,{color:m.background,label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:O,...u.bind("background"),children:(0,t.jsx)(E.Swatch,{color:m.background==="transparent"?gn:m.background})}),(0,t.jsx)(E.ColorPicker,{color:S,label:s("graph.annotations.textToolbar.color"),onChange:_,...u.bind("color"),children:(0,t.jsx)(Ws,{size:"sm",textColor:S,title:""})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,t.jsx)("span",{style:{fontFamily:g?.fontFamily},children:"Aa"}),...u.bind("font"),children:ur.map(f=>(0,t.jsx)(E.MenuItem,{isSelected:f.id===g?.id,onClick:I(f.id),children:(0,t.jsx)("span",{style:{fontFamily:f.fontFamily},children:s(f.key)})},f.id))}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:v===null?"":s(v.key),...u.bind("fontSize"),children:hr.map(f=>(0,t.jsx)(E.MenuItem,{isSelected:f.size===v?.size,onClick:M(f.size),children:(0,t.jsx)("span",{style:{fontSize:oc(f.size)},children:s(f.key)})},f.size))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(sc,{current:x.alignment??"center",onPick:A}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:R,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},lc=e=>e==="transparent"?{background:bn}:{background:e,alpha:na(e)?p.TEXT_ANNOTATION_FADE_ALPHA:1},sc=({current:e,onPick:n})=>{const r=l.useI18n(),o=a=>()=>n(a);return(0,t.jsx)(t.Fragment,{children:ac.map(a=>(0,t.jsx)(E.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${a.alignment}`),isPressed:a.alignment===e,onClick:o(a.alignment),children:(0,t.jsx)(a.Icon,{size:"sm",title:""})},a.alignment))})},cc=["left","right"];var pr=({width:e})=>q(60,e),dc=(e,n)=>({x:n==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),mr=({at:e,width:n,align:r,edge:o,delta:a,minWidth:i,panelWidth:s})=>{if(a===0)return{at:e,width:n,shift:0};const c=(0,p.alignUnitFractions)(r).x,d=uc(e.offset,s),h=Ye({start:e.x+d-c*n,extent:n,isStartMoving:o==="left",delta:a,minExtent:i}),u=h.start+c*h.extent-d;return{at:{...e,x:u},width:h.extent,shift:u-e.x}},gr=(e,n)=>e.at.x===n.at.x&&e.width===n.width,uc=(e,n)=>e?.x===void 0?0:e.unit==="px"?q(e.x,n):e.x,ke=(e,n)=>{const r=e.textAnnotations.find(o=>o.id===n);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},hc=class extends xe{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return l.readResizedTextFor(l.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,edge:r,press:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=ke(i,n);if(c===null)return null;const d=Ne(o,e,s).x;return{kind:"text-resize-drag",annotationId:n,delta:d,...mr({...c,edge:r,delta:d,minWidth:pr(s),panelWidth:s.width})}}commit(e){const{annotationId:n,dispatch:r,readInputs:o}=this.params,a=ke(o().annotations,n);a===null||gr(a,e)||r(new p.UpdateAnnotationCommand({kind:"text",id:n,patch:{at:e.at,width:e.width}}))}},pc=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return lr((i,s)=>new hc({...s,annotationId:e,edge:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},mc=4,gc=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useCompiledSelector(s=>s.spec.annotations),i=(s,c)=>{const d=ke(a,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,...mr({...d,edge:s,delta:c,minWidth:pr(n),panelWidth:n.width})}};return sr({readHeld:()=>l.readResizedTextFor(l.readStanding(o.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const h=xc(d,n);return h===null?null:i(c,s.delta+h)},commit:s=>{const c=ke(a,e);c===null||gr(c,s)||r.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},xc=(e,n)=>{const r=q(mc,n.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},vc=e=>{const n=ge(),r=bc(n),o=Sc(n),a=l.useEditorState(s=>s.caret?.annotationId===n),i=Cc(e.panelRect,n,o.resized);return r===null||i===null?null:(0,t.jsx)(fc,{annotation:r,textBox:i,isSettled:o.resized===null&&!o.isMoved,isMoved:o.isMoved,isResizable:r.at.anchorType==="panel",hasCaret:a,...e})},fc=({annotation:e,textBox:n,isSettled:r,isMoved:o,isResizable:a,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),u=pc({annotationId:e.id,panelRect:s}),m=gc({annotationId:e.id,panelRect:s});return(0,t.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(ic,{annotation:e,textBox:n,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),a&&!o&&!i&&cc.map(x=>{const g=dc(n,x);return(0,t.jsx)(ir,{point:{x:s.x+g.x,y:s.y+g.y},label:h(`graph.annotations.textToolbar.resize.${x}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":x},dragHandlers:u(x),keyboardHandlers:m(x)},x)})]})},bc=e=>{const n=l.useCompiledSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:n.find(r=>r.id===e)??null},Sc=e=>l.useEditorState((0,se.useShallow)(n=>e===null?{resized:null,isMoved:!1}:{resized:l.readResizedTextFor(l.readStanding(n,"text-resize-drag"),e),isMoved:l.readMovedAnnotationFor(l.readStanding(n,"move-drag"),e)!==null})),Cc=(e,n,r)=>{const o=l.useResolvedAnnotations(e),a=l.useMeasuredBoxes(),i=l.useChromeStyleReaders(),s=(0,b.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:a,chromeReaders:i}),[e.width,e.height,a,i]);return n===null?null:ar(o,n,r,s)?.rect??null},yc=e=>(0,t.jsx)(l.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"})]})}),jc="var(--_1tyillx0)",Ac={rest:.5,hovered:.75,open:1};var Tc="_1tyillx1",wc={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},Pc="_1tyillx5",kc={closed:"_1tyillx6",open:"_1tyillx7"},Lc=({interaction:e,panelRect:n})=>{const r=l.useEditorStore(),o=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,a=Ic(e),i=(0,b.useMemo)(()=>{if(o===null)return null;const s=(0,p.projectAnchorToPanel)(o.position,n);return{center:s,radius:19*Ac[a],target:{kind:"observation",cursor:(0,p.toPanelCursor)(s,n)}}},[o,n,a]);return(0,b.useEffect)(()=>{r.getState().setMenuTrigger(i)},[r,i]),(0,b.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),o===null||i===null?null:(0,t.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":a,className:(0,$.default)(Tc,wc[a]),style:{left:n.x+i.center.x,top:n.y+i.center.y,...(0,ln.assignInlineVars)({[jc]:o.color})},children:(0,t.jsx)("span",{className:(0,$.default)(Pc,kc[a==="open"?"open":"closed"]),children:(0,t.jsx)(yc,{size:"lg"})})})},Ic=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",Ec='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Mc=(e,n)=>{const{chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,b.useEffect)(()=>{if(n===null)return;const a=i=>{if(i.key!=="Tab"||i.defaultPrevented||!pe(i.target,e,r)||o.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...n.querySelectorAll(Ec)];if(s.length===0)return;i.preventDefault();const c=s.findIndex(d=>d===document.activeElement);s[c===-1?i.shiftKey?s.length-1:0:(c+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,n,r,o])},Rc=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}]`,Le=(e,n,r)=>{if(typeof document.elementsFromPoint!="function")return null;const o=document.elementsFromPoint(e,n);return _c(o,r)},_c=(e,n)=>{for(const r of e){const o=r.closest(Rc);if(o===null||!n.contains(o))continue;const a=Oc(o);if(a!==null)return a;if(o!==r)return null}return null},Oc=e=>{const n=e.getAttribute(l.EDIT_TARGET_KIND_ATTRIBUTE);if(n!=="annotation")return null;const r=e.getAttribute(l.EDIT_TARGET_ID_ATTRIBUTE);return r===null||r===""?null:{kind:n,id:r}},Nc=e=>{const{selectionStore:n,chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,b.useEffect)(()=>{let a=null;const i=d=>{const{caret:h}=o.getState(),u=h===null?null:Le(d.clientX,d.clientY,e);u!==null&&u.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:u}=n.getState();h.length!==0&&(pe(d.target,e,r)||u())},c=d=>{n.getState().selection.length!==0&&pe(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(pe(document.activeElement,e,r)||n.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[o,n,e,r])},Dc=new Set(["discrete","datetime"]),Fc=({hover:e,layers:n,scales:r,parsingLocale:o})=>{const{primary:a,intersection:i}=e;if(a===null)return null;const s=n.find(v=>v.id===a.layerId);if(s===void 0)return null;const c=(0,p.readObservationIndex)(a),d=i?.intersects!==!1,h=(0,p.readBroadestObservationsScope)(s),u=d||!Hc(r)?h:"x-value",m=Bc(s,c,u,h,o);if(m===null)return null;const x=s.data.getAt(c),g=x===null?null:(0,p.buildObservationPredicate)(s,x);return{layerId:s.id,observationIndex:c,observationPredicate:g,target:m,isOnObservation:d}},zc=(e,n,r)=>{if(!e.isOnObservation||e.target.scope!=="series")return null;const o=n.find(a=>a.id===e.layerId);return o===void 0?null:(0,p.buildObservationsTarget)({layer:o,observationIndex:e.observationIndex,scope:"data-point",parsingLocale:r})},Hc=e=>{const n=e.x;return n?.kind!=="position"?!1:Dc.has(n.spec.scaleType)},Bc=(e,n,r,o,a)=>{const i=(0,p.buildObservationsTarget)({layer:e,observationIndex:n,scope:r,parsingLocale:a});return i!==null||r===o?i:(0,p.buildObservationsTarget)({layer:e,observationIndex:n,scope:o,parsingLocale:a})},xr=(e,n)=>e.x>=0&&e.x<=n.width&&e.y>=0&&e.y<=n.height,Gc=class extends xe{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return l.readMovedAnnotationFor(l.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,press:r,readInputs:o}=this.params,{annotations:a,panelRect:i}=o(),s=(0,p.findAnnotation)(a,n);if(s===null)return null;const c=(0,p.clampAnnotationTranslation)(s,Ne(r,e,i));return c===null?null:{kind:"move-drag",annotationId:n,translation:c}}commit({translation:e}){const{annotationId:n,dispatch:r}=this.params;Ol(e)&&r(new p.MoveAnnotationCommand({id:n,translation:e}))}},Vc=e=>{const{stampedTarget:n,observations:r,canSelectGraph:o,isWithinFrame:a,caretAnnotationId:i}=e;return i!==null&&n?.id===i?{kind:"keep-caret"}:n!==null?{kind:"select-annotation",target:n}:r!==null?Uc(r):o&&a?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},Uc=({layerId:e,observationIndex:n,observationPredicate:r,target:o,isOnObservation:a})=>o.scope==="x-value"?{kind:"select-band",target:o}:a?{kind:"select-observations",target:o,observation:{layerId:e,observationIndex:n,predicate:r}}:{kind:"select-observations",target:o,observation:null},Wc=(e,n,r)=>{const{commands:o,selectionStore:a,store:i}=l.useGraphContext(),s=l.useEditorStore(),{engine:c,overlayRef:d}=l.useHoverContext(),h=l.useCompiledSelector(C=>C.spec.annotations),u=l.MODE_SURFACES[l.useGraphMode()],m=u.observationsPress,x=u.tolerance,g=u.annotations,v=l.useLatestRef(u.graphPress),S=l.useLatestRef({annotations:h,panelRect:r}),y=l.useLatestRef(n),P=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>P.current?.finish(!1),[]),(0,b.useEffect)(()=>{const C=f=>{if(!g)return null;const{editTargetUnderPointer:w,standingInteraction:H}=s.getState();return w!==null&&H===null&&f.pointerType==="mouse"&&Ve(f.target,e)?w:Le(f.clientX,f.clientY,e)},k=()=>d.current?.getBoundingClientRect()??null,L=f=>{if(!m||!Ve(f.target,e))return null;const w=k();if(w===null)return null;const H={x:f.clientX-w.left,y:f.clientY-w.top};if(!xr(H,w))return null;c.setViewport({width:w.width,height:w.height});const U=c.query((0,p.toPanelCursor)(H,w),x??void 0),{layers:re,scales:Y,config:ce}=i.getState().compiled;return Fc({hover:U,layers:re,scales:Y,parsingLocale:ce.parsingLocale})},R=f=>{const w=e.getBoundingClientRect();return{x:f.clientX-w.left,y:f.clientY-w.top}},O=(f,w)=>{if(P.current!==null||!l.canMoveAnnotationOnCanvas(S.current.annotations,w.id))return;try{e.setPointerCapture(f.pointerId)}catch{return}f.preventDefault();const H=new Gc({handle:e,pointerId:f.pointerId,annotationId:w.id,press:{x:f.clientX,y:f.clientY},readInputs:()=>S.current,editorStore:s,dispatch:o.dispatch,onSettled:()=>{P.current=null}});P.current=H,H.start()},_=f=>({stampedTarget:C(f),observations:L(f),canSelectGraph:v.current,isWithinFrame:Ve(f.target,e),caretAnnotationId:s.getState().caret?.annotationId??null}),I=(f,w)=>{const H=a.getState(),{setPressContext:U}=s.getState();switch(w.kind){case"select-annotation":H.setSelection([w.target]),U(null),O(f,w.target);return;case"select-observations":H.setSelection([w.target]),U({point:R(f),observation:w.observation});return;case"select-band":case"select-graph":H.setSelection([w.target]),U({point:R(f),observation:null});return;case"clear":H.clearSelection(),U(null);return;default:throw new p.InternalError({message:`No press outcome for: ${JSON.stringify(w)}`})}},M=f=>{if(f.button!==0||Ze(f.target)||_n(f,y.current,s.getState().menuTrigger))return;const w=Vc(_(f));w.kind!=="keep-caret"&&(s.getState().setCaret(null),I(f,w))},A=f=>{if(Ze(f.target))return;const w=L(f),{layers:H,config:U}=i.getState().compiled,re=w===null?null:zc(w,H,U.parsingLocale);if(w!==null&&re!==null){a.getState().setSelection([re]),s.getState().setPressContext({point:R(f),observation:{layerId:w.layerId,observationIndex:w.observationIndex,predicate:w.observationPredicate}});return}if(!g)return;const Y=Le(f.clientX,f.clientY,e);Y!==null&&S.current.annotations.textAnnotations.some(ce=>ce.id===Y.id)&&(a.getState().setSelection([Y]),s.getState().setCaret(Y.id))};return document.addEventListener("pointerdown",M),document.addEventListener("dblclick",A),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("dblclick",A)}},[e,s,a,i,o,S,y,v,c,d,m,x,g])},Ve=(e,n)=>e instanceof Node&&n.contains(e),$c=e=>{const{selectionStore:n,commands:r,chartId:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef(l.useCompiledSelector(u=>u.spec.annotations.textAnnotations)),s=l.MODE_SURFACES[l.useGraphMode()].annotations,c=(0,b.useCallback)(u=>{const{selection:m}=n.getState(),x=s?Xe(m):null;x!==null&&(u.preventDefault(),r.dispatch(new p.RemoveAnnotationCommand({id:x})),e.focus({preventScroll:!0}))},[e,r,n,s]),d=(0,b.useCallback)(u=>{if(Ce(u.target,o))return;const m=s?Xe(n.getState().selection):null;m!==null&&i.current.some(x=>x.id===m)&&(u.preventDefault(),a.getState().setCaret(m))},[a,n,i,o,s]),h=(0,b.useCallback)(u=>{const m=a.getState(),x=m.standingInteraction?.kind;if(x!==void 0){x!=="chrome-popup"&&m.releaseInteraction(x);return}if(m.caret!==null){m.setCaret(null),e.focus({preventScroll:!0});return}return Ce(u.target,o)?e.focus({preventScroll:!0}):n.getState().clearSelection()},[a,n,e,o]);(0,b.useEffect)(()=>{const u=m=>{if(!pe(m.target,e,o)||xi(m.target))return;const x=qc(m.target),g=a.getState().caret!==null&&!Ce(m.target,o);if(!(x&&!g))switch(m.key){case"Escape":return h(m);case"Enter":return x?void 0:d(m);case"Delete":case"Backspace":return x?void 0:c(m);default:return}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c,d,h,o,a])},qc=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Kc=()=>{const e=l.MODE_SURFACES[l.useGraphMode()].observationMenu,n=l.useHoverState(s=>e?s.hover.primary:null),{layers:r,coordSystem:o}=l.useCompiledSelector((0,se.useShallow)(s=>({layers:s.layers,coordSystem:s.coordSystem}))),{anchorResolver:a}=l.useGraphContext(),i=l.useStyleResolver();return(0,b.useMemo)(()=>{if(n===null)return null;const s=r.find(h=>h.id===n.layerId);if(s===void 0)return null;const c=a.resolve(s.geom,n.observation,{coordSystem:o,position:s.position,purpose:"pin"});if(c===null)return null;const d=(0,p.createObservationAnchorBuilder)(s)(n.observation);return d===null?null:{position:c,color:i.geomReaders(s).get("color",n.observation),layer:s,at:d,observation:n.observation}},[n,r,o,a,i])},Zc={kind:"idle"},vr=()=>{const e=l.useEditorState(o=>o.standingInteraction),n=l.useEditorState(o=>o.chromeUnderPointer),r=Kc();return(0,b.useMemo)(()=>e!==null?e:r===null?Zc:{kind:"trigger",anchor:r,isEngaged:n==="menu-trigger"},[e,r,n])},Xc=(e,n,r)=>{const o=l.useEditorStore(),{selectionStore:a}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(n),h=l.useLatestRef(r);(0,b.useEffect)(()=>{const u=S=>_n(S,d.current,o.getState().menuTrigger),m=S=>{if(u(S)||a.getState().selection.length>0)return;const y=h.current,P=d.current,C={x:S.clientX-P.x,y:S.clientY-P.y},k=xr(C,y)?s.query((0,p.toPanelCursor)(C,y)):p.RESTING_HOVER_STATE;i.getState().setHoverState(k)};let x=!1;const g=()=>{x=c.current.kind==="menu"},v=S=>{if(Ze(S.target))return;const{claimInteraction:y,releaseInteraction:P}=o.getState();if(!u(S)||x){P("menu"),x&&m(S);return}const C=c.current;C.kind==="trigger"&&y({kind:"menu",anchor:C.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",v),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",v)}},[o,a,c,i,s,d,h])},Yc=(e,n)=>{const r=l.useEditorStore(),o=l.useLatestRef(n),a=l.MODE_SURFACES[l.useGraphMode()].annotations;(0,b.useEffect)(()=>{let i=null,s=null;const c=v=>{const{menuTrigger:S}=r.getState();return S===null?null:(0,p.isPointWithinEditMenuTrigger)(v,S)?"menu-trigger":null},d=()=>{i=null;const v=s;if(v===null)return;const S=o.current,y=r.getState();if(y.setChromeUnderPointer(c({x:v.x-S.x,y:v.y-S.y})),Ue(y.standingInteraction)||!a)return;const P=Le(v.x,v.y,e);y.setEditTargetUnderPointer(P)},h=()=>{i===null&&(i=requestAnimationFrame(d))},u=()=>{const v=r.getState();v.setChromeUnderPointer(null),v.setEditTargetUnderPointer(null)},m=v=>{s={x:v.clientX,y:v.clientY},h()},x=()=>{s=null,i!==null&&(cancelAnimationFrame(i),i=null),u()},g=r.subscribe((v,S)=>{!Ue(S.standingInteraction)||Ue(v.standingInteraction)||s!==null&&h()});return e.addEventListener("pointermove",m),e.addEventListener("pointerleave",x),()=>{i!==null&&cancelAnimationFrame(i),g(),e.removeEventListener("pointermove",m),e.removeEventListener("pointerleave",x),u()}},[e,r,o,a])},Ue=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}},Ut="editor",Wt=[],Jc=(e,n,r,o)=>{const a=vr(),{store:i}=l.useHoverContext(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useGraphSelection().length>0,h=l.MODE_SURFACES[l.useGraphMode()].holdsHoverWhileSelected,u=l.useEditorState(v=>v.menuTrigger),m=a.kind==="menu",x=(0,b.useMemo)(()=>u===null?Wt:[(0,p.buildEditMenuTriggerRegion)(u)],[u]);Yc(e,n),Wc(e,n,r),Xc(a,n,r),Nc(e),$c(e),Mc(e,o),(0,b.useEffect)(()=>s.subscribe((v,S)=>{v.selection!==S.selection&&c.getState().setPressContext(null)}),[c,s]),(0,b.useEffect)(()=>(i.getState().publishPointerRegions(Ut,x),()=>i.getState().publishPointerRegions(Ut,Wt)),[i,x]);const g=m||d&&h;(0,b.useEffect)(()=>(i.getState().setPointerSuspended(g),()=>i.getState().setPointerSuspended(!1)),[i,g]),(0,b.useEffect)(()=>{if(!d||!h)return;const v=i.getState();v.setHoverState(p.RESTING_HOVER_STATE),v.setTooltipAnchor(null)},[i,d,h])},Qc=({frameElement:e,panelRect:n})=>{const{measureRef:r,screenRect:o}=l.useElementScreenRect(),{selectionStore:a}=l.useGraphContext(),i=l.useEditorStore(),s=l.useEditorState(h=>h.caret?.annotationId??null),c=l.useGraphMode(),d=(0,b.useRef)(c);return(0,b.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,b.useEffect)(()=>()=>{const h=i.getState();h.releaseInteraction("menu"),h.setCaret(null)},[i]),(0,b.useEffect)(()=>{if(d.current===c)return;d.current=c;const h=i.getState();h.releaseInteraction("menu"),h.setCaret(null),h.setEditTargetUnderPointer(null),a.getState().clearSelection()},[c,i,a]),o===null?null:(0,t.jsxs)(fi,{children:[s!==null&&(0,t.jsx)(ed,{annotationId:s,panelRect:n}),(0,t.jsx)(td,{frameElement:e,frameRect:o,panelRect:n})]})},ed=({annotationId:e,panelRect:n})=>{const r=l.useEditorStore(),{textAnnotations:o}=l.useResolvedAnnotations(n);return(0,b.useEffect)(()=>{o.some(({id:a})=>a===e)||r.getState().setCaret(null)},[e,o,r]),null},td=({frameElement:e,frameRect:n,panelRect:r})=>{const o=(0,b.useMemo)(()=>({x:n.left+r.x,y:n.top+r.y}),[n.left,n.top,r.x,r.y]),[a,i]=(0,b.useState)(null);return Jc(e,o,r,a),(0,t.jsx)(nd,{frameElement:e,frameRect:n,panelOrigin:o,panelRect:r,boxRef:i})},nd=({frameElement:e,frameRect:n,panelOrigin:r,panelRect:o,boxRef:a})=>{const i=lt(),s=vr(),c=l.MODE_SURFACES[l.useGraphMode()].annotations;return(0,t.jsx)(l.OverlayPortal,{rect:n,zIndex:l.Z_INDEX.editorOverlay,container:i,"data-testid":"editor-overlay",boxRef:a,children:(0,t.jsxs)(l.PortalThemeProvider,{children:[c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(gs,{panelRect:o,panelOrigin:r,frameRect:n,frameElement:e}),(0,t.jsx)(Bs,{panelRect:o,frameRect:n,frameElement:e}),(0,t.jsx)(Gl,{panelRect:o,frameRect:n,frameElement:e}),(0,t.jsx)(vc,{panelRect:o,frameRect:n,frameElement:e}),(0,t.jsx)(js,{panelRect:o}),(0,t.jsx)(Is,{panelRect:o}),(0,t.jsx)(cl,{panelRect:o}),(0,t.jsx)(ys,{panelRect:o})]}),(0,t.jsx)(Lc,{interaction:s,panelRect:o}),(0,t.jsx)(nl,{interaction:s,panelOrigin:r})]})})},rd=({slots:e,mode:n,...r})=>(0,t.jsx)(pn,{locale:l.useGraphLocale(),children:(0,t.jsx)(l.EditorProvider,{children:(0,t.jsx)(l.InlineEditorsProvider,{editors:pi,children:(0,t.jsx)(l.GraphRendererBody,{slots:(0,b.useMemo)(()=>({EditorSurface:Qc,...e}),[e]),mode:n,...r})})})}),fr=(0,b.createContext)(null),br=({labelId:e,controlId:n,children:r})=>{const o=(0,b.useMemo)(()=>{let a=null;return{labelId:e,controlId:n,claimControlId:i=>(a??=i,a===i)}},[e,n]);return(0,t.jsx)(fr.Provider,{value:o,children:r})},ee=({id:e,ariaLabel:n,ariaLabelledBy:r},o=!0)=>{const a=(0,b.useContext)(fr),i=(0,b.useId)(),[s]=(0,b.useState)(()=>o?a?.claimControlId(i)??!1:!1),c=e??(s?a?.controlId:void 0),d=r??(n===void 0?a?.labelId:void 0);return{...c!==void 0&&{id:c},...n!==void 0&&{"aria-label":n},...d!==void 0&&{"aria-labelledby":d}}};var od={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},Sr=({label:e,icon:n,onClick:r,variant:o="default",isDisabled:a,ariaLabel:i,ariaLabelledBy:s,id:c})=>{const d=ee({id:c,ariaLabel:i,ariaLabelledBy:s}),h=o==="tile";return(0,t.jsxs)("button",{type:"button",className:od[o],disabled:a,onClick:r,...d,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})]})},mt=(0,b.createContext)(null),D=()=>{const e=(0,b.useContext)(mt);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},Cr=({children:e,onKeyDown:n,...r})=>{const o=(0,b.useContext)(mt),a=i=>{if(n?.(i),!o||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?o.undo():o.redo())};return(0,t.jsx)("div",{onKeyDown:a,...r,children:e})},yr="keyboard",De=e=>{const n=(0,b.useRef)(!1),r=(0,b.useRef)(!1),o=()=>{n.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(n.current){r.current=!0;return}e?.()},commitUnlessHeldKey:a=>{if(a){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{n.current=!0},onKeyUp:o,onBlur:a=>{a.relatedTarget instanceof Node&&a.currentTarget.contains(a.relatedTarget)||o()}}}},ad="eh8dvc0",id="eh8dvc1 uz3g760",ld="eh8dvc2 uz3g761";var jr=({value:e,onChange:n,onCommit:r,min:o,max:a,step:i,placeholder:s,prefix:c,suffix:d,isDisabled:h,hasError:u,ariaLabel:m,ariaLabelledBy:x,id:g})=>{const v=ee({id:g,ariaLabel:m,ariaLabelledBy:x}),{commitUnlessHeldKey:S,gestureHandlers:y}=De(r);return(0,t.jsx)(yt.NumberField.Root,{className:ad,value:e,onValueChange:P=>n(P),onValueCommitted:(P,C)=>{S(C.reason===yr)},min:o,max:a,step:i,disabled:h,children:(0,t.jsxs)(Cr,{className:id,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:c}),(0,t.jsx)(yt.NumberField.Input,{className:ld,placeholder:s,...y,"aria-invalid":u===!0?!0:void 0,...v}),d!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:d})]})})},sd="_1b7s5f0",oe={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},cd="_1b7s5f7";var dd=6,Ar=({options:e,value:n,onChange:r,onCommit:o,columns:a,itemLayout:i="tile",isDisabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const u=ee({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="swatch",{commitAfterChange:x,gestureHandlers:g}=De(o);return(0,t.jsx)(hn.RadioGroup,{className:(0,$.default)(sd,ud(a??e.length)),value:n,onValueChange:v=>{r(v),x()},...g,disabled:s,...u,children:e.map(v=>(0,t.jsxs)(un.Radio.Root,{value:v.value,disabled:v.isDisabled,className:(0,$.default)(cd,m&&"_1b7s5f8"),"aria-label":m?v.label:void 0,children:[v.icon,!m&&(0,t.jsx)("span",{className:"_1b7s5f9",children:v.label})]},v.value))})},ud=e=>{switch(Math.min(Math.max(Math.round(e),1),dd)){case 1:return oe[1];case 2:return oe[2];case 3:return oe[3];case 4:return oe[4];case 5:return oe[5];default:return oe[6]}},hd="_1g5x15w0 uz3g760",pd="_1g5x15w1",md="_1g5x15w2",$t="_1g5x15w3",gd="_1g5x15w4",xd="_1g5x15w5",vd="_1g5x15w6",fd="_1g5x15w7";var Tr=({options:e,value:n,onChange:r,placeholder:o,isDisabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,t.jsxs)(K.Select.Root,{value:n,onValueChange:u=>u!==null&&r(u),disabled:a,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,t.jsxs)(K.Select.Trigger,{className:hd,"data-error":i===!0,...h,children:[(0,t.jsx)(K.Select.Value,{className:pd,children:u=>bd(e,u,o)}),(0,t.jsx)(K.Select.Icon,{className:$t,children:(0,t.jsx)(me,{size:"sm"})})]}),(0,t.jsx)(K.Select.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(K.Select.Positioner,{className:gd,sideOffset:4,alignItemWithTrigger:!1,children:(0,t.jsx)(K.Select.Popup,{className:xd,children:e.map(u=>(0,t.jsxs)(K.Select.Item,{value:u.value,disabled:u.isDisabled,className:vd,children:[u.icon,(0,t.jsxs)("span",{className:fd,children:[(0,t.jsx)(K.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,t.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,t.jsx)(K.Select.ItemIndicator,{className:$t,children:(0,t.jsx)(kn,{size:"sm"})})]},u.value))})})})})]})},bd=(e,n,r)=>n===null?(0,t.jsx)("span",{className:md,children:r}):Sd(e,n),Sd=(e,n)=>e.find(r=>r.value===n)?.label??n,Cd="vod76w0",yd="vod76w1",jd="vod76w2",Ad="vod76w3",Td="vod76w4",wd="vod76w5";var wr=({value:e,onChange:n,onCommit:r,min:o,max:a,step:i,suffix:s,formatValue:c,isDisabled:d,ariaLabel:h,ariaLabelledBy:u})=>{const m=ee({ariaLabel:h,ariaLabelledBy:u},!1),x=Pd(e,s,c),{commitUnlessHeldKey:g,gestureHandlers:v}=De(r);return(0,t.jsxs)("div",{className:Cd,children:[(0,t.jsx)(Z.Slider.Root,{className:yd,value:e,onValueChange:S=>n(S),onValueCommitted:(S,y)=>{g(y.reason===yr)},min:o,max:a,step:i,disabled:d,children:(0,t.jsx)(Z.Slider.Control,{className:jd,children:(0,t.jsxs)(Z.Slider.Track,{className:Ad,children:[(0,t.jsx)(Z.Slider.Indicator,{className:Td}),(0,t.jsx)(Z.Slider.Thumb,{className:wd,...v,...m})]})})}),x!==null&&(0,t.jsx)("span",{className:"vod76w6",children:x})]})},Pd=(e,n,r)=>r!==void 0?r(e):n!==void 0?`${e}${n}`:null,kd="_1hyrlw60",Ld="_1hyrlw61",Pr=({isChecked:e,onChange:n,isDisabled:r,ariaLabel:o,ariaLabelledBy:a,id:i})=>{const s=ee({id:i,ariaLabel:o,ariaLabelledBy:a});return(0,t.jsx)(jt.Switch.Root,{checked:e,onCheckedChange:c=>n(c),disabled:r,className:kd,...s,children:(0,t.jsx)(jt.Switch.Thumb,{className:Ld})})},Id="uz3g761",Ed="tpcnun0 uz3g760",kr=({value:e,onChange:n,onCommit:r,placeholder:o,isDisabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,t.jsx)(Cr,{className:Ed,"data-error":i===!0,children:(0,t.jsx)(vo.Input,{className:Id,value:e,onValueChange:u=>n(u),onBlur:r,placeholder:o,disabled:a,"aria-invalid":i===!0?!0:void 0,...h})})},Md="cnu9yl0",Rd="cnu9yl1";var Lr=({options:e,value:n,onChange:r,onCommit:o,itemLayout:a="inline",isDisabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c}),u=a==="stacked",{commitAfterChange:m,gestureHandlers:x}=De(o);return(0,t.jsx)(hn.RadioGroup,{className:Md,value:n,onValueChange:g=>{r(g),m()},...x,disabled:i,...h,children:e.map(g=>(0,t.jsxs)(un.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,$.default)(Rd,u&&"cnu9yl2"),"aria-label":_d(g,u),children:[g.icon,Ir(g,u)&&(0,t.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Ir=(e,n)=>e.icon===void 0||n,_d=(e,n)=>{if(!Ir(e,n))return e.label},Er={ToggleGroup:Lr,Switch:Pr,Slider:wr,RadioGrid:Ar,Button:Sr,TextField:kr,NumberField:jr,Select:Tr},Mr=(0,b.createContext)(Er),Od=({controls:e,children:n})=>{const r=(0,b.useMemo)(()=>({...Er,...e}),[e]);return(0,t.jsx)(Mr.Provider,{value:r,children:n})},F=()=>(0,b.useContext)(Mr),Nd="_12lhx9e0",Rr=({children:e})=>(0,t.jsx)("div",{className:Nd,children:e}),Dd="_139ohwv0",G=({children:e})=>(0,t.jsx)("div",{className:Dd,children:e}),_r=(0,b.createContext)(null),Fd=_r.Provider,Or=()=>{const e=(0,b.useContext)(_r);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},zd="_1jlczkt0",Nr="data-graphy-editor-panel",Hd={List:G,Grid:Rr};function Bd(e){if(e===void 0)return!1;const n=e.split(/\s+/);return n.includes("_1ii3bsb0")||n.includes("_1ii3bsb1")}var Gd=({handle:e,children:n,controls:r,defaultExpandedSection:o=void 0,className:a})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,b.useState)(()=>o?[o]:[]),u=(0,b.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,t.jsx)(mt.Provider,{value:i,children:(0,t.jsx)(Od,{controls:r,children:(0,t.jsx)(Fd,{value:u,children:(0,t.jsx)(he.Accordion.Root,{[Nr]:"",className:(0,$.default)(zd,a,{[s]:!Bd(a)}),style:c,value:d,onValueChange:m=>h(m),children:n})})})})},gt={Root:Gd,Controls:Hd},qt={stack:"pr583x0",grid:"pr583x1"},Kt="pr583x2",Vd={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},j=({label:e,layout:n="grid",icon:r,children:o})=>{const a=(0,b.useId)(),i=(0,b.useId)();return e===void 0?(0,t.jsx)("div",{className:qt[n],children:(0,t.jsx)("div",{className:Kt,children:o})}):(0,t.jsxs)("div",{className:qt[n],children:[(0,t.jsxs)("label",{id:a,htmlFor:i,className:Vd[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,t.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,t.jsx)("div",{className:Kt,children:(0,t.jsx)(br,{labelId:a,controlId:i,children:o})})]})},Ud=e=>(0,t.jsx)(l.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"})})}),xt="_40zvwv0",vt="_40zvwv1",Wd="_40zvwv2",Dr="_40zvwv3",$d="_40zvwv4 _40zvwv3";var qd="_40zvwv6";var Kd="_40zvwv8",z=({title:e,layout:n="fixed",preview:r,accessory:o,onOpenChange:a,children:i})=>n==="collapsible"?(0,t.jsx)(Xd,{title:e,preview:r,accessory:o,onOpenChange:a,children:i}):n==="inline"&&r===void 0?(0,t.jsx)(Zd,{title:e,accessory:o,children:i}):(0,t.jsxs)("div",{className:xt,children:[(0,t.jsxs)("div",{className:vt,children:[(0,t.jsx)("span",{className:Dr,children:e}),r!==void 0&&(0,t.jsx)("span",{className:"_40zvwv5",children:r}),o!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:o})]}),(0,t.jsx)("div",{children:i})]}),Zd=({title:e,accessory:n,children:r})=>{const o=(0,b.useId)(),a=(0,b.useId)();return(0,t.jsx)("div",{className:xt,children:(0,t.jsxs)("div",{className:vt,children:[(0,t.jsx)("label",{id:o,htmlFor:a,className:$d,children:e}),(0,t.jsx)("span",{className:qd,children:(0,t.jsx)(br,{labelId:o,controlId:a,children:r})}),n!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:n})]})})},Xd=({title:e,preview:n,accessory:r,onOpenChange:o,children:a})=>{const i=l.useI18n();return(0,t.jsxs)(he.Accordion.Item,{value:e,className:xt,onOpenChange:o,children:[(0,t.jsxs)(he.Accordion.Header,{className:vt,render:(0,t.jsx)("div",{}),children:[(0,t.jsx)(he.Accordion.Trigger,{className:Wd,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,t.jsx)("span",{className:Dr,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:Kd,children:(0,t.jsx)(Ud,{size:"sm"})})]}),(0,t.jsx)(he.Accordion.Panel,{children:(0,t.jsx)("div",{children:a})})]})},Fr=({title:e,isChecked:n,onToggle:r,isDisabled:o,preview:a,children:i})=>{const{expandSection:s,collapseAllSections:c}=Or(),{Switch:d}=F(),h=m=>{r(m),m?s(e):c()},u=m=>{m&&!n&&o!==!0&&r(!0)};return(0,t.jsx)(z,{title:e,layout:"collapsible",preview:a,onOpenChange:u,accessory:(0,t.jsx)(d,{isChecked:n,onChange:h,isDisabled:o,ariaLabel:e}),children:i})},Yd={horizontal:["bottom","top"],vertical:["left","right"]},Jd={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Qd={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},Qe=({axis:e,title:n,layout:r="collapsible",preview:o})=>{const a=D(),i=l.useHandleCompiled(a),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:u}=F();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",x=i.config.axes[e],g=i.scales[e],v=g?.spec,S=v?.scaleType==="continuous"?v:void 0;if(m==="circular"||m==="radial"&&S===void 0)return null;const y=v!==void 0&&"reverse"in v?v:void 0,P=v?.scaleType==="continuous"||v?.scaleType==="datetime",C=e==="y"&&S!==void 0&&i.layers.some(T=>T.yScaleType==="primary"&&T.geom==="bar"),k=S?.transform==="log",L=S?.domainMax??null,R=eu(S),O=(T,J)=>T.map(ve=>({value:ve,label:J(ve)})),_=i.guides.axes.find(T=>T.scaleAestheticKey===e)?.position,I=Yd[_==="bottom"||_==="top"||_===void 0&&e==="x"?"horizontal":"vertical"],M=e==="y"?(0,p.readComboLineLayerId)(i.spec):null,A=M===null?void 0:i.spec.layers.find(T=>T.id===M),f=i.guides.legends.drawn.some(T=>I.some(J=>J===T.position)),w=I.map(T=>({value:T,label:s(Jd[T])})),H=O(["auto","edges"],T=>s(T==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),U=O(["linear","log"],T=>s(T==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),re=O(["auto","zero","custom"],T=>s(T==="zero"?"editor.axesPanel.startFrom.zero":T==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Y=O(["auto","custom"],T=>s(T==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),ce=O(["no","yes"],T=>s(T==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Kr=O(["single","double"],T=>s(T==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),Zr=T=>{a.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:T}))},Xr=T=>{a.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:T===""?null:T}),{transient:!0})},Yr=T=>{a.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:T}))},Jr=T=>{a.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:T==="edges"?"edges":"auto"}))},Qr=T=>{a.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:T==="yes"}))},eo=T=>{a.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:T==="log"?"log":"linear"}))},St=T=>{a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...T}),{transient:!0})},to=T=>{T!==null&&St({domainMin:T})},no=T=>{T!==null&&St({domainMax:T})},ro=T=>{if(S){if(T==="custom"){S.zero&&a.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:Zt(g?.domain,"start")}));return}S.domainMin!==null&&a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),a.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:T==="zero"}))}},oo=T=>{const J=T==="custom"?Zt(g?.domain,"end"):null;a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:J}))},ao=T=>{A!==void 0&&a.commands.dispatch(new p.SetLayerYScaleTypeCommand({layerId:A.id,yScaleType:T==="double"?"secondary":"primary"}))},io=T=>{const J=I.find(ve=>ve===T);J&&a.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:J}))};return(0,t.jsx)(z,{title:n??s(Qd[e]),layout:r,preview:o,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.visible"),children:(0,t.jsx)(d,{isChecked:x.isVisible,onChange:Zr})}),A!==void 0&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,t.jsx)(u,{value:A.yScaleType==="secondary"?"double":"single",options:Kr,onChange:ao})}),m==="linear"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.title"),children:(0,t.jsx)(h,{value:x.label??"",onChange:Xr,onCommit:a.commands.seal})}),(0,t.jsx)(j,{label:s("editor.axesPanel.controls.ticks"),children:(0,t.jsx)(d,{isChecked:x.ticks.isVisible,onChange:Yr})})]}),P&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.labels"),children:(0,t.jsx)(u,{value:x.ticks.mode,options:H,onChange:Jr})}),S&&m==="linear"&&!f&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.position"),children:(0,t.jsx)(u,{value:_??x.position,options:w,onChange:io})}),y!==void 0&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.reverse"),children:(0,t.jsx)(u,{value:y.reverse===!0?"yes":"no",options:ce,onChange:Qr})}),S&&!C&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.scale"),children:(0,t.jsx)(u,{value:k?"log":"linear",options:U,onChange:eo})}),S&&!k&&(0,t.jsxs)(t.Fragment,{children:[!C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.startFrom"),children:(0,t.jsx)(u,{value:R,options:re,onChange:ro})}),R==="custom"&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.value"),children:(0,t.jsx)(c,{value:S.domainMin??null,onChange:to,onCommit:a.commands.seal})})]}),(0,t.jsx)(j,{label:s("editor.axesPanel.controls.endAt"),children:(0,t.jsx)(u,{value:L===null?"auto":"custom",options:Y,onChange:oo})}),L!==null&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.value"),children:(0,t.jsx)(c,{value:L,onChange:no,onCommit:a.commands.seal})})]})]})})},eu=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",Zt=(e,n)=>{const r=n==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},ft=({value:e,onChange:n})=>{const r=D(),o=l.useI18n(),{TextField:a}=F(),i=e!==null&&typeof e!="string",s=c=>n(c===""?null:c);return(0,t.jsx)(j,{label:o("editor.elementsPanel.contentValue"),children:(0,t.jsx)(a,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.seal,isDisabled:i})})},zr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=u=>{o.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},h=u=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isCaptionVisible,onChange:d})}),(0,t.jsx)(ft,{value:c.caption,onChange:h})]})})},Xt=/^[a-z][a-z\d+.-]*:/i,tu={},Hr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isSourceVisible,onChange:d})}),(0,t.jsx)(nu,{source:c.source??tu})]})})},nu=({source:e})=>{const n=D(),r=l.useI18n(),{TextField:o}=F(),a=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";n.commands.dispatch(new p.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!Xt.test(d)&&a({...e,url:`https://${d}`}),n.commands.seal()},s=d=>a({...e,url:d}),c=d=>a({...e,label:d});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,t.jsx)(o,{value:e.url??"",onChange:s,onCommit:i,hasError:Xt.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,t.jsx)(j,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,t.jsx)(o,{value:e.label??"",onChange:c,onCommit:n.commands.seal})})]})},Br=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=u=>{o.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},h=u=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isSubtitleVisible,onChange:d})}),(0,t.jsx)(ft,{value:c.subtitle,onChange:h})]})})},et=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],ru=et.length/2,ou={select:{target:"graph"}},Gr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{RadioGrid:s}=F();if(!a)return null;const c=(0,p.createStyleResolver)().chromeReaders(a.chrome).graph.get("textScale"),d=m=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${m}`}),h=et.map(m=>({value:`${m}`,label:d(m)})),u=m=>{const x=et.find(v=>`${v}`===m);if(x===void 0)return;const g=(0,p.findStyleRule)(a.spec.styles.overrides,ou)?.declarations??{};o.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...g,textScale:x}}}))};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:n,preview:r??d(c),children:(0,t.jsx)(s,{value:`${c}`,options:h,columns:ru,onChange:u,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Vr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=u=>{o.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},h=u=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isTitleVisible,onChange:d})}),(0,t.jsx)(ft,{value:c.title,onChange:h})]})})},au=({children:e,...n})=>(0,t.jsx)(gt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Vr,{}),(0,t.jsx)(Br,{}),(0,t.jsx)(zr,{}),(0,t.jsx)(Hr,{}),(0,t.jsx)(Gr,{})]})}),iu=({children:e,...n})=>(0,t.jsx)(gt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Qe,{axis:"x"}),(0,t.jsx)(Qe,{axis:"y"})]})}),Fe=e=>`${e}px`,Ur=e=>`${Math.round(e*100)}%`,lu=e=>`${e}°`,su=24,cu={select:{target:"graph"}},Yt=["dim","desaturate"],du=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=F();if(!a)return null;const d=(0,p.createStyleResolver)().chromeReaders(a.chrome).graph.get("borderRadius"),h=(0,p.readHighlightDimStyle)(a.spec),u=Yt.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),m=g=>{const v=(0,p.findStyleRule)(a.spec.styles.overrides,cu)?.declarations??{};o.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...v,borderRadius:g}}}),{transient:!0})},x=g=>{const v=Yt.find(S=>S===g);v&&o.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:v}))};return(0,t.jsx)(z,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,t.jsx)(s,{value:d,min:0,max:su,step:1,formatValue:Fe,onChange:m,onCommit:o.commands.seal})}),(0,t.jsx)(j,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,t.jsx)(c,{value:h,options:u,onChange:x})})]})})},bt=(e,n)=>{const{colorScheme:r}=l.useThemeContext();return(0,b.useMemo)(()=>{const o=e?.layers.find(a=>a.id===n);return o===void 0?null:(0,p.createStyleResolver)({colorScheme:r}).geomReaders(o)},[e,n,r])},uu=.05,hu=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=F(),d=a?(0,p.findLayerByGeom)(a.spec.layers,"bar"):void 0,h=bt(a,d?.id??null);if(!a||!d||a.coordSystem.type==="polar"&&a.coordSystem.bandAxis===null)return null;const u=v=>{o.commands.dispatch(new p.SetBarWidthCommand({layerId:d.id,width:v}),{transient:!0})},m=v=>{const S=p.BORDER_RADIUS_TOKENS.find(y=>y===v);S&&o.commands.dispatch(new p.SetBarBorderRadiusCommand({layerId:d.id,borderRadius:S}))},x=p.BORDER_RADIUS_TOKENS.map(v=>({value:v,label:i(`editor.graphPanel.barSection.roundingOptions.${v}`)})),g=(0,p.resolveBarBandFraction)(d.params,a.coordSystem.type);return(0,t.jsx)(z,{title:e??i("editor.graphPanel.barSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.barSection.thickness"),children:(0,t.jsx)(s,{value:g,min:p.MIN_BAR_WIDTH,max:p.MAX_BAR_WIDTH,step:uu,formatValue:Ur,onChange:u,onCommit:o.commands.seal})}),(0,t.jsx)(j,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,t.jsx)(c,{value:h?.get("borderRadius")??p.DEFAULT_BAR_BORDER_RADIUS,options:x,onChange:m})})]})})},ze=({children:e})=>{const n=(0,b.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"})]})})]})},He="qdaoth0",pu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,t.jsx)(ze,{children:(0,t.jsx)("path",{className:He,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"})]}),mu=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,t.jsxs)(ze,{children:[(0,t.jsx)("path",{className:He,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"})]})}),gu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(ze,{children:(0,t.jsx)("path",{className:He,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"})]}),xu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(ze,{children:(0,t.jsx)("path",{className:He,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"})]}),vu={x:.5,y:.5},fu=.2,bu={x:.375,y:.25,width:.25,height:.5},Su={zOrder:"background"},Cu={x:.4,y:.6},yu={x:.6,y:.4},ju="relative-difference",Au=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Button:s}=F();if(!a)return null;const c=()=>{o.commands.dispatch(new p.AddAnnotationCommand({kind:"text",annotation:{...p.TEXT_ANNOTATION_DEFAULTS,content:Tu(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...vu},width:fu}}))},d=()=>{o.commands.dispatch(new p.AddAnnotationCommand({kind:"arrow",annotation:{...p.ARROW_DEFAULTS,start:{anchorType:"panel",...Cu},end:{anchorType:"panel",...yu}}}))},h=()=>{o.commands.dispatch(new p.AddAnnotationCommand({kind:"shape",annotation:{...p.SHAPE_DEFAULTS,...Su,region:{anchorType:"panel",...bu}}}))},u=()=>{const x=(0,p.inferDefaultDifferenceArrowEndpoints)(a);x!==null&&o.commands.dispatch(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...x,label:ju}}))},m=a.coordSystem.type==="cartesian";return(0,t.jsx)(z,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:n,preview:r,children:(0,t.jsxs)(Rr,{children:[(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(xu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(pu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(mu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(gu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},Tu=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),wu=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{ToggleGroup:s}=F();if(!a)return null;const c=(0,p.readChartType)(a.spec);if(c===null||!(0,p.isComboChartType)(c))return null;const d=p.COMBO_TYPES.map(u=>({value:u,label:i(`editor.graphPanel.comboSection.types.${u}`)})),h=u=>{const m=p.COMBO_TYPES.find(x=>x===u);m&&o.commands.dispatch(new p.SetChartTypeCommand({coordType:"cartesian",comboType:m}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.comboSection.title"),layout:n,preview:r??i(`editor.graphPanel.comboSection.types.${c.comboType}`),children:(0,t.jsx)(s,{value:c.comboType,options:d,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},Pu=.1,ku=20,Lu=({title:e,preview:n})=>{const r=D(),o=l.useHandleCompiled(r),a=l.useI18n(),{NumberField:i,TextField:s}=F();if(!o||o.coordSystem.type==="polar")return null;const c=(0,p.findGoalLineLayer)(o.spec.layers),d=e??a("editor.annotationsPanel.goalSection.title"),h=(0,p.extractConstantValue)(c?.mapping.y),u=typeof h=="number"?h:null,m=v=>{const S=new p.ToggleGoalLineCommand({showGoalLine:v,value:Iu(o),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(S)},x=v=>{if(c===void 0)return;const S=new p.SetRuleLabelCommand({layerId:c.id,label:v===""?null:v});r.commands.dispatch(S,{transient:!0})},g=v=>{if(c===void 0||v===null)return;const S=new p.SetRuleValueCommand({layerId:c.id,value:v});r.commands.dispatch(S,{transient:!0})};return(0,t.jsx)(Fr,{title:d,preview:n,isChecked:c!==void 0,onToggle:m,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:a("editor.annotationsPanel.goalSection.labelControl"),children:(0,t.jsx)(s,{value:c?.params.label??"",placeholder:a("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:x,onCommit:r.commands.seal,ariaLabel:a("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,t.jsx)(j,{label:a("editor.annotationsPanel.goalSection.valueControl"),children:(0,t.jsx)(i,{value:u,placeholder:a("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:a("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},Iu=e=>{const n=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(n.length===0)return 0;const r=Math.max(...n),o=r-Math.min(...n),a=o>0?o:Math.abs(r);if(a===0)return 0;const i=Math.min(ku,Math.max(0,1-Math.floor(Math.log10(a))));return Number((r+a*Pu).toFixed(i))},Eu=({layerId:e,title:n,layout:r="collapsible",preview:o})=>{const a=D(),i=l.useHandleCompiled(a),s=l.useI18n(),{Switch:c}=F();if(!i)return null;const d=e===void 0?i.spec.layers[0]:i.spec.layers.find(_=>_.id===e);if(!d)return null;const{showDataLabels:h,format:u,showStackTotals:m,showCategoryLabels:x}=d.dataLabels,g=i.coordSystem.type==="polar",v=d.geom==="bar",S=d.position==="stack"||d.position==="fill",y=v&&!g&&d.position==="stack",P=v&&(!g||h),C=v||d.geom==="area"&&S;if(!(0,p.canPlaceDataLabels)(d.geom,i.coordSystem.type))return null;const k=_=>{const I=new p.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:_});a.commands.dispatch(I)},L=_=>{const I=new p.SetDataLabelsFormatCommand({layerId:d.id,format:_?"percentage":"absolute"});a.commands.dispatch(I)},R=_=>{const I=new p.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:_});a.commands.dispatch(I)},O=_=>{const I=new p.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:_});a.commands.dispatch(I)};return(0,t.jsx)(z,{title:n??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:o,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,t.jsx)(c,{isChecked:h,onChange:k})}),h&&C&&(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,t.jsx)(c,{isChecked:u==="percentage",onChange:L})}),y&&(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,t.jsx)(c,{isChecked:m,onChange:R})}),P&&(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,t.jsx)(c,{isChecked:x,onChange:O})})]})})},Mu=e=>(0,t.jsxs)(l.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"})]}),Ru=e=>(0,t.jsx)(l.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"})]})}),_u=e=>(0,t.jsx)(l.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"})]})}),Ou=e=>(0,t.jsx)(l.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"})]})}),Nu=e=>(0,t.jsxs)(l.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"})]}),Du=e=>(0,t.jsxs)(l.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"})]}),Fu=e=>(0,t.jsxs)(l.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"})]}),zu=e=>(0,t.jsxs)(l.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"})]})]}),Hu=e=>(0,t.jsx)(l.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"})]})}),Bu=e=>(0,t.jsx)(l.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"})]})}),Gu=e=>(0,t.jsx)(l.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"})]})]})}),Vu=e=>(0,t.jsxs)(l.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"})]}),Uu=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",children:[(0,t.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",strokeOpacity:"0.3",strokeWidth:".8"}),(0,t.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",strokeOpacity:"0.8",strokeWidth:"1.2"})]})}),Wu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeOpacity:"0.3",strokeWidth:".8"}),(0,t.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",fill:"currentColor",fillOpacity:"0.6"})]}),$u=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",transform:"rotate(-90 8 8)",children:[(0,t.jsxs)("g",{strokeOpacity:"0.2",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.6"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"4.4"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2.2"})]}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.6",pathLength:"100",strokeDasharray:"72 100",strokeOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"4.4",pathLength:"100",strokeDasharray:"52 100",strokeOpacity:"0.6"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2.2",pathLength:"100",strokeDasharray:"34 100",strokeOpacity:"0.45"})]})}),qu=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.75",d:"M8.4 7.31 8.4 1.01A7 7 0 0 1 13.85 4.16ZM8.8 8 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8ZM8.4 8.69 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59ZM7.6 8.69 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74ZM7.2 8 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31ZM7.6 7.31 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52Z"})}),Ku=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("path",{fillOpacity:"0.35",d:"M8.4 3.82 8.4 1.01A7 7 0 0 1 13.85 4.16L11.42 5.56A4.2 4.2 0 0 0 8.4 3.82ZM11.46 6.47 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8L11.46 9.53A3.78 3.78 0 0 0 11.46 6.47ZM10.69 10.01 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59L8.4 11.34A3.36 3.36 0 0 0 10.69 10.01ZM7.6 10.85 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74L5.73 9.77A2.88 2.88 0 0 0 7.6 10.85ZM5.7 8.87 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31L5.7 7.13A2.46 2.46 0 0 0 5.7 8.87ZM6.41 6.62 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52L7.6 5.94A2.1 2.1 0 0 0 6.41 6.62Z"}),(0,t.jsx)("path",{fillOpacity:"0.9",d:"M8.4 7.31 8.4 3.82A4.2 4.2 0 0 1 11.42 5.56ZM8.8 8 11.46 6.47A3.78 3.78 0 0 1 11.46 9.53ZM8.4 8.69 10.69 10.01A3.36 3.36 0 0 1 8.4 11.34ZM7.6 8.69 7.6 10.85A2.88 2.88 0 0 1 5.73 9.77ZM7.2 8 5.7 8.87A2.46 2.46 0 0 1 5.7 7.13ZM7.6 7.31 6.41 6.62A2.1 2.1 0 0 1 7.6 5.94Z"})]})}),Zu=e=>(0,t.jsx)(l.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"})]})}),Xu=.55,Yu=.15,tt=[{name:"column",icon:Nu,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Fu,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Du,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Ru,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Ou,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:_u,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Gu,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Mu,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:zu,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:Zu,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Vu,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Hu,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Xu}},{name:"radialBar",icon:$u,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:Yu}},{name:"rose",icon:qu,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:Ku,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:Uu,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:Wu,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Bu,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Ju=.05,Qu=e=>e===null?null:tt.find(n=>t0(n.summary,e))??null,e0=(e,n)=>{const{summary:r}=e;return n===null||(0,p.isComboChartType)(r)?r:r.position==="dodge"&&Wr(n)?{...r,position:"identity"}:r.coordType!=="polar"||!Ie(r.innerRadius)||n.coordType!=="polar"||!Ie(n.innerRadius)?r:{...r,innerRadius:n.innerRadius}},Wr=e=>!(0,p.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",t0=(e,n)=>{if((0,p.isComboChartType)(e)||(0,p.isComboChartType)(n))return(0,p.isComboChartType)(e)&&(0,p.isComboChartType)(n);const r=e.position===n.position||e.position==="dodge"&&Wr(n);return e.coordType!==n.coordType||e.geom!==n.geom||!r?!1:e.coordType!=="polar"||n.coordType!=="polar"?!0:e.theta===n.theta&&Ie(e.innerRadius)===Ie(n.innerRadius)},Ie=e=>e>=Ju,n0=3,r0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{RadioGrid:s}=F(),c=(0,b.useMemo)(()=>tt.map(({name:m,icon:x})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,t.jsx)(x,{size:"md"}),isDisabled:m==="combo"&&!(0,p.canBecomeCombo)(a?.spec)||m==="heatmap"&&!(0,p.canBecomeHeatmap)(a?.spec)})),[i,a]);if(!a)return null;const d=(0,p.readChartType)(a.spec),h=Qu(d),u=m=>{const x=tt.find(g=>g.name===m);x&&o.commands.dispatch(new p.SetChartTypeCommand(e0(x,d)))};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)(s,{value:h?.name??"",options:c,columns:n0,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Jt=["solid","dashed","dotted"],o0=8,a0=0,i0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=F(),{colorScheme:h}=l.useThemeContext();if(!a)return null;const u=a.guides.axes.filter(l0);if(u.length===0)return null;const m=a.coordSystem.type!=="polar",x=u.some(C=>C.gridVisible),g=(0,p.resolveGridLineStyle)((0,p.createStyleResolver)({colorScheme:h}).chromeReaders(a.chrome),"y"),v=Jt.map(C=>({value:C,label:i(`editor.graphPanel.gridSection.lineStyles.${C}`)})),S=C=>k=>{o.commands.dispatch(new p.SetGridVisibilityCommand({axis:C,isVisible:k}))},y=C=>{const k=Jt.find(L=>L===C);k&&o.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:k}))},P=C=>{o.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:C}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.gridSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[u.map(C=>(0,t.jsx)(j,{label:i(s0(C)),children:(0,t.jsx)(c,{isChecked:C.gridVisible,onChange:S(C.scaleAestheticKey)})},C.scaleAestheticKey)),m&&x&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,t.jsx)(d,{value:g.lineType,options:v,onChange:y})}),(0,t.jsx)(j,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,t.jsx)(s,{value:g.strokeWidth,min:a0,max:o0,step:.5,formatValue:Fe,onChange:P,onCommit:o.commands.seal})})]})]})})},l0=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",s0=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",c0="total",$r=["total","average","current"],d0=["total"],Qt=["previous","first"],en=["auto","small","medium","large"],u0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s,ToggleGroup:c}=F();if(!a)return null;const d=a.config.headline,h=d.show!=="none",u=a.coordSystem,m=u.type==="polar",x=u.type==="polar"&&u.innerRadius>0,g=a.layers.some(A=>A.summary.grandTotal!==void 0);if(m&&!g)return null;const v=m?d0:$r,S=a.guides.headline,y=S?.kind==="perGroup"&&S.items.some(A=>A.comparison!==null),P=v.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.metrics.${A}`)})),C=Qt.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.comparison.${A}`)})),k=en.map(A=>({value:A,label:i(A==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${A}`)})),L=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],R=A=>{o.commands.dispatch(new p.SetHeadlineShowCommand({show:A?c0:"none"}))},O=A=>{const f=v.find(w=>w===A);f&&o.commands.dispatch(new p.SetHeadlineShowCommand({show:f}))},_=A=>{const f=Qt.find(w=>w===A);f&&o.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:f}))},I=A=>{const f=en.find(w=>w===A);f&&o.commands.dispatch(new p.SetHeadlineSizeCommand({size:f}))},M=A=>{o.commands.dispatch(new p.SetHeadlinePositionCommand({position:A==="center"?"center":"above"}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:n,preview:r??h0(i,d.show),children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,t.jsx)(s,{isChecked:h,onChange:R})}),h&&(0,t.jsxs)(t.Fragment,{children:[P.length>1&&(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,t.jsx)(c,{value:d.show,options:P,onChange:O})}),y&&(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,t.jsx)(c,{value:(0,p.resolveComparisonBasis)(d.compareWith),options:C,onChange:_})}),(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,t.jsx)(c,{value:d.size,options:k,onChange:I})}),x&&(0,t.jsx)(j,{label:i("editor.axesPanel.controls.position"),children:(0,t.jsx)(c,{value:d.position,options:L,onChange:M})})]})]})})},h0=(e,n)=>{const r=$r.find(o=>o===n);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},We=["top","bottom","left","right","none"],tn=["auto","start","center","end"],nn=["auto","pill","direct"],p0=({positions:e,title:n,layout:r="collapsible",preview:o})=>{const a=D(),i=l.useHandleCompiled(a),s=l.useI18n(),{ToggleGroup:c}=F();if(!i)return null;const d=i.config.legend.position,h=e??We,u=i.guides.legends.drawn[0],m=(0,p.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),x=i.guides.headline?.kind==="perGroup",g=i.guides.colorGroups.length>0;if(d==="auto"&&u===void 0&&!m&&(x||!g))return null;const v=u?.position??"none",S=d==="auto"?v:d,y=We.filter(M=>M===S||h.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),P=M=>{const A=We.find(f=>f===M);A&&a.commands.dispatch(new p.SetLegendPositionCommand({position:A}))},C=M=>{const A=tn.find(f=>f===M);A&&a.commands.dispatch(new p.SetLegendAlignCommand({align:A}))},k=M=>{const A=nn.find(f=>f===M);A&&a.commands.dispatch(new p.SetLegendDisplayCommand({display:A}))},L=tn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.align.${M}`)})),R=nn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),O=n??s("editor.graphPanel.legendSection.title"),_=y.find(M=>M.value===S)?.label,I=u!==void 0;return(0,t.jsx)(z,{title:O,layout:r,preview:o??_,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,t.jsx)(c,{value:S,options:y,onChange:P})}),I&&(0,t.jsx)(j,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,t.jsx)(c,{value:i.config.legend.align,options:L,onChange:C})}),m&&(0,t.jsx)(j,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,t.jsx)(c,{value:i.config.legend.display,options:R,onChange:k})})]})})},m0=1,g0=20,x0=.5,qr=({layerId:e})=>{const n=D(),r=l.useHandleCompiled(n),{Slider:o}=F(),a=bt(r,e);if(!r)return null;const i=s=>{const c=new p.SetPointSizeCommand({layerId:e,size:s});n.commands.dispatch(c,{transient:!0})};return(0,t.jsx)(o,{value:a?.get("size")??p.DEFAULT_POINT_SIZE,min:m0,max:g0,step:x0,formatValue:Fe,onChange:i,onCommit:n.commands.seal})},v0=1,f0=10,b0=.1,S0=["gap","zero","connect"],C0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=F(),u=a?.spec.layers??[],m=(0,p.findLayerByGeom)(u,"line","area"),x=bt(a,m?.id??null);if(!a||!m)return null;const g=a.coordSystem.type==="polar",v=A0(i,m),S=j0(m,u),y=rn(a.spec,m.geom,"strokeWidth",m.id),P=typeof y=="number",C=m.geom==="line"?m:void 0,k=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],L=A=>{o.commands.dispatch(new p.ToggleLinePointsVisibilityCommand({layerId:m.id,showPoints:A}))},R=A=>{C&&o.commands.dispatch(new p.ToggleLineFillCommand({layerId:C.id,showFill:A}))},O=A=>{o.commands.dispatch(new p.SetLineInterpolationCommand({layerId:m.id,interpolate:A?"catmull-rom":"linear"}))},_=A=>{const f=x?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH;o.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:A==="custom"?f:null}))},I=A=>{o.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:A}),{transient:!0})},M=A=>{const f=y0(A);f&&o.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:m.id,missingValues:f}))};return(0,t.jsx)(z,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,t.jsx)(d,{isChecked:S!==void 0,onChange:L})}),S&&(0,t.jsx)(j,{label:i("editor.graphPanel.pointSize.label"),children:(0,t.jsx)(qr,{layerId:S.id})}),C&&!g&&(0,t.jsx)(j,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,t.jsx)(d,{isChecked:rn(a.spec,"line","fillAlpha",C.id)!==void 0,onChange:R})}),!g&&(0,t.jsx)(j,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,t.jsx)(d,{isChecked:m.params.interpolate==="catmull-rom",onChange:O})}),(0,t.jsx)(j,{label:i("editor.graphPanel.lineThickness.label"),children:(0,t.jsx)(h,{value:P?"custom":"auto",options:k,onChange:_})}),P&&(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(c,{value:y,min:v0,max:f0,step:b0,formatValue:Fe,onChange:I,onCommit:o.commands.seal})}),!g&&v.length>1&&(0,t.jsx)(j,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,t.jsx)(s,{value:m.params.missingValues,options:v,onChange:M})})]})})},y0=e=>S0.find(n=>n===e),rn=(e,n,r,o)=>(0,p.findKindStyleDeclarations)(e.styles.overrides,(0,p.buildLayerStyleAddress)(n,o))?.[r],j0=(e,n)=>(0,p.filterLayersByGeoms)(n,"point").find(r=>(0,p.isCompanionLayer)(r,[e])),A0=(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(o=>o.value!=="gap"):r},nt="\0none",T0=["x","y","color","size","label"],w0={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"},P0=({title:e,layout:n="collapsible"})=>{const r=D(),o=l.useHandleCompiled(r),a=l.useI18n(),{Select:i}=F(),s=a("editor.graphPanel.mappingSection.none"),c=o?.spec,d=(0,b.useMemo)(()=>c===void 0?[]:(0,p.readMappableAesthetics)(c,T0).map(({aesthetic:h,variables:u,isRequired:m})=>{const x=(0,p.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:a(w0[h]),value:x??(m?null:nt),options:k0(u,x,m?null:s),chooseColumn:g=>{r.commands.dispatch(new p.SetMappingCommand({aesthetic:h,variable:g===nt?null:g}))}}}),[c,a,s,r]);return o?(0,t.jsx)(z,{title:e??a("editor.graphPanel.mappingSection.title"),layout:n,children:(0,t.jsx)(G,{children:d.map(({aesthetic:h,label:u,value:m,options:x,chooseColumn:g})=>(0,t.jsx)(j,{label:u,children:(0,t.jsx)(i,{value:m,options:x,placeholder:s,onChange:g})},h))})}):null},k0=(e,n,r)=>{const o=n!==null&&!e.includes(n)?[n,...e]:e;return[...r===null?[]:[{value:nt,label:r}],...o.map(a=>({value:a,label:a}))]},L0="k",I0=2,E0=0,M0=5,rt=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],R0=["auto","none"],_0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=F();if(!a)return null;const{abbreviation:d,decimals:h}=a.config.numberFormat,u=O0(d)!==void 0,m=h!=="auto",x=k=>k.map(L=>({value:L,label:i(`editor.graphPanel.numberFormat.options.${L}`)})),g=rt.map(({value:k,labelKey:L})=>({value:k,label:i(`common.abbreviations.${L}`)})),v=k=>{o.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:k}))},S=k=>{const L=R0.find(R=>R===k);v(L??L0)},y=k=>{const L=rt.find(R=>R.value===k);L&&v(L.value)},P=k=>{o.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k==="custom"?I0:"auto"}))},C=k=>{k!==null&&o.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,t.jsx)(c,{value:u?"custom":d,options:x(["auto","none","custom"]),onChange:S})}),u&&(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(c,{value:d,options:g,onChange:y})}),(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,t.jsx)(c,{value:m?"custom":"auto",options:x(["auto","custom"]),onChange:P})}),m&&(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(s,{value:h,min:E0,max:M0,onChange:C,onCommit:o.commands.seal})})]})})},O0=e=>rt.find(n=>n.value===e),N0=({title:e,layout:n="collapsible",preview:r})=>{const o=l.useHandleCompiled(D()),a=l.useI18n();if(!o)return null;const i=D0(o.spec.layers);return i?(0,t.jsx)(z,{title:e??a("editor.graphPanel.pointSize.label"),layout:n,preview:r,children:(0,t.jsx)(G,{children:(0,t.jsx)(j,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(qr,{layerId:i.id})})})}):null},D0=e=>{const n=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(r=>!(0,p.isCompanionLayer)(r,n))},F0=.9,z0=360,H0=.05,B0=15,G0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s}=F();if(!a||a.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=a.spec.coords.params,h=m=>{o.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{o.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.polarSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,t.jsx)(s,{value:c,min:0,max:F0,step:H0,formatValue:Ur,onChange:h,onCommit:o.commands.seal})}),(0,t.jsx)(j,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,t.jsx)(s,{value:d,min:0,max:z0-1,step:B0,formatValue:lu,onChange:u,onCommit:o.commands.seal})})]})})},V0=e=>(0,t.jsxs)(l.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"})]}),on=e=>(0,t.jsxs)(l.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"})]}),U0=e=>(0,b.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:n,numberFormat:r}=e.config,o=e.guides.colorGroups.map(a=>{const i=(0,p.createValueFormatter)({valueFormat:a.valueFormat,locale:n,numberFormat:r}),s=a.value instanceof Date?a.value.getTime():a.value;return{value:s,option:{value:String(s),label:a.label??i(a.value)}}});return{options:o.map(({option:a})=>a),findValue:a=>o.find(i=>i.option.value===a)?.value}},[e]),an=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],W0="linear",$0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Select:s,Switch:c}=F(),{options:d,findValue:h}=U0(a);if(!a||a.coordSystem.type==="polar")return null;const u=(0,p.findTrendLineLayer)(a.spec.layers),m=(0,p.findAverageLineLayer)(a.spec.layers),x=u?.stat.type==="smooth"?u.stat.method:W0,g=q0(m),v=an.map(L=>({value:L,label:i(`editor.annotationsPanel.trendType.options.${L}`)})),S=(L,R={})=>{const O=u??m,_=new p.SetStatLineCommand({line:L,...R,...O!==void 0&&{layerId:O.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});o.commands.dispatch(_)},y=L=>S(L?"trend":"none",{method:x}),P=L=>S(L?"average":"none",{group:g??h(d[0]?.value??"")}),C=L=>{const R=an.find(O=>O===L);R!==void 0&&S("trend",{method:R})},k=L=>{const R=L===null?void 0:h(L);R!==void 0&&S("average",{group:R})};return(0,t.jsx)(z,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:n,preview:r??(0,t.jsx)(on,{size:"lg"}),children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,t.jsx)(on,{size:"lg"}),children:(0,t.jsx)(c,{isChecked:u!==void 0,onChange:y})}),u!==void 0&&(0,t.jsx)(j,{label:i("editor.annotationsPanel.trendType.label"),children:(0,t.jsx)(s,{value:x,options:v,onChange:C,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,t.jsx)(j,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,t.jsx)(V0,{size:"lg"}),children:(0,t.jsx)(c,{isChecked:m!==void 0,onChange:P})}),m!==void 0&&d.length>0&&(0,t.jsx)(j,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,t.jsx)(s,{value:g===void 0?null:String(g),options:d,onChange:k,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},q0=e=>{const n=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return n instanceof Date?n.getTime():n};exports.AppearanceSection=du;exports.AxesPanel=iu;exports.AxisSection=Qe;exports.BarSection=hu;exports.Button=Sr;exports.CalloutsSection=Au;exports.CaptionSection=zr;exports.ComboSection=wu;exports.EditableGraphRenderer=rd;exports.EditorPanel=gt;exports.ElementsPanel=au;exports.GoalSection=Lu;exports.GraphOptionsSection=Eu;exports.GraphTypeSection=r0;exports.GridSection=i0;exports.HeadlineSection=u0;exports.IntlProvider=pn;exports.LegendSection=p0;exports.LineSection=C0;exports.MappingSection=P0;exports.NumberField=jr;exports.NumberFormatSection=_0;exports.PANEL_ROOT_ATTRIBUTE=Nr;exports.PointSection=N0;exports.PolarSection=G0;exports.RadioGrid=Ar;exports.Row=j;exports.Section=z;exports.Select=Tr;exports.Slider=wr;exports.SourceSection=Hr;exports.SubtitleSection=Br;exports.Switch=Pr;exports.TextField=kr;exports.TextSizeSection=Gr;exports.TitleSection=Vr;exports.ToggleGroup=Lr;exports.ToggledSection=Fr;exports.TrendsAndAveragesSection=$0;exports.useControls=F;exports.usePanelExpansion=Or;exports.usePanelGraph=D;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-CCWHvFhX.cjs"),W=require("./theme.contract.css-CEjZ4rbL.cjs");let p=require("@graphysdk/viz-engine"),b=require("react"),t=require("react/jsx-runtime"),se=require("zustand/react/shallow"),ln=require("@vanilla-extract/dynamic"),sn=require("react-dom"),$=require("clsx");$=l.__toESM($,1);let de=require("@floating-ui/react-dom"),cn=require("@tiptap/core"),lo=require("@tiptap/extension-bold"),ye=require("@tiptap/extension-document"),so=require("@tiptap/extension-hard-break"),co=require("@tiptap/extension-heading"),uo=require("@tiptap/extension-italic"),ho=require("@tiptap/extension-link"),po=require("@tiptap/extension-text"),mo=require("@tiptap/extension-text-align"),je=require("@tiptap/extension-text-style"),go=require("@tiptap/extension-underline"),Ee=require("@tiptap/extensions"),dn=require("@tiptap/extension-paragraph"),Me=require("@tiptap/react"),X=require("@base-ui/react/toolbar"),ae=require("@base-ui/react/tooltip"),V=require("@base-ui/react/popover"),Ct=require("react-colorful"),Z=require("@base-ui/react/slider"),N=require("@base-ui/react/menu"),xo=require("@base-ui/react/toggle"),Q=require("@base-ui/react"),le=require("lodash-es/clamp");le=l.__toESM(le,1);let he=require("@base-ui/react/accordion"),yt=require("@base-ui/react/number-field"),un=require("@base-ui/react/radio"),hn=require("@base-ui/react/radio-group"),K=require("@base-ui/react/select"),jt=require("@base-ui/react/switch"),vo=require("@base-ui/react/input");var fo={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},bo={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",radar:"راداري",radarFilled:"راداري معبأ",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:"داكن"}}},So={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:"متقطع",dotted:"منقّط"},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})`}}}},Co={common:fo,editor:bo,graph:So},yo={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"}},jo={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",radialBar:"Radial bar",rose:"Rose",roseStacked:"Stacked rose",radar:"Radar",radarFilled:"Filled radar",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"}}},Ao={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:"Dashed",dotted:"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})`}}}},To={common:yo,editor:jo,graph:Ao},wo={colorPanel:{backgroundSection:{grey:"Gray"},borderType:{grey:"Gray"}},highlighting:{highlightStyle:{grey:"Gray"}}},Po={editor:wo},ko={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"}},Lo={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",radialBar:"Barras radiais",radar:"Radar",radarFilled:"Radar preenchido",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"}}},Io={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:"Tracejada",dotted:"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})`}}}},Eo={common:ko,editor:Lo,graph:Io},Mo={"en-GB":To,"en-US":Po,ar:Co,"pt-PT":Eo},Ro=[Mo,l.dictionaries],pn=({children:e,...n})=>(0,t.jsx)(l.IntlProvider,{dictionaries:Ro,...n,children:e}),_o="data-variant",mn=dn.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[_o]:e.variant}:{}}}}}),Oo=cn.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}}}}),ot=()=>[po.Text,Ee.UndoRedo,co.Heading.configure({levels:[1,2,3]}),lo.Bold,uo.Italic,go.Underline,mo.TextAlign.configure({types:["heading","paragraph"]}),ho.Link.configure({openOnClick:!1,autolink:!0}),je.TextStyle,je.Color,so.HardBreak],No=({titlePlaceholder:e,subtitlePlaceholder:n,isTitleVisible:r,isSubtitleVisible:o})=>[Fo({isTitleVisible:r,isSubtitleVisible:o}),mn,...ot(),je.FontFamily,Oo.configure({isTitleVisible:r}),Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:i})=>{if(r&&a===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return o&&a===s?n:""}})],Do=({placeholder:e})=>[ye.Document,mn,...ot(),je.FontFamily,Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],Fo=({isTitleVisible:e,isSubtitleVisible:n})=>e&&n?ye.Document.extend({content:"block{2,}"}):ye.Document,gn="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))",zo="d0bl00";var xn="d0bl03",Ho="d0bl04",vn="d0bl05",$e="d0bl06",Bo="d0bl07",Go="d0bl08",fn="d0bl09",Vo="d0bl0a",Uo="d0bl0b",Wo="d0bl0c",$o="d0bl0d",qo="d0bl0e",Ko="owf1yg0",Zo="owf1yg1",Xo="owf1yg2",Yo="owf1yg3",Jo="owf1yg4",Qo=.01,ea=({value:e,onChange:n,label:r})=>(0,t.jsx)(Z.Slider.Root,{className:Ko,value:e,onValueChange:o=>n(o),min:0,max:1,step:Qo,children:(0,t.jsx)(Z.Slider.Control,{className:Zo,children:(0,t.jsxs)(Z.Slider.Track,{className:Xo,children:[(0,t.jsx)(Z.Slider.Indicator,{className:Yo}),(0,t.jsx)(Z.Slider.Thumb,{className:Jo,"aria-label":r})]})})}),bn="transparent",qe=W.CANVAS_COLOR_KEYS.map(e=>W.vars[e]),ta=Object.fromEntries(W.CANVAS_COLOR_KEYS.map(e=>[W.vars[e],e])),na=e=>qe.some(n=>Cn(n,e)),ra=({color:e,onChange:n,isOpen:r,onOpenChange:o,children:a,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const u=l.useI18n(),m=aa(),x=h?[bn,...qe]:qe,g=v=>{n(v),o(!1)};return(0,t.jsxs)(V.Popover.Root,{open:r,onOpenChange:o,children:[(0,t.jsx)(V.Popover.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":i??u("graph.toolbar.color.label"),className:zo,onMouseDown:v=>v.preventDefault(),children:a??(0,t.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,t.jsx)(V.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(V.Popover.Positioner,{sideOffset:6,align:"start",className:xn,children:(0,t.jsxs)(V.Popover.Popup,{className:Ho,onMouseDown:v=>v.preventDefault(),...s,children:[(0,t.jsx)(At,{title:u("graph.colorDropdown.colors"),colors:x,currentColor:e,onPick:g}),m.length>0&&(0,t.jsx)(At,{title:u("graph.colorDropdown.chartColors"),colors:m,currentColor:e,onPick:g}),(0,t.jsx)(oa,{value:e??"#000000",onChange:n,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,t.jsxs)("div",{className:"d0bl05",children:[(0,t.jsx)("div",{className:"d0bl06",children:u("graph.colorDropdown.opacity")}),(0,t.jsx)(ea,{value:c,onChange:d,label:u("graph.colorDropdown.opacity")})]})]})})})})]})},At=({title:e,colors:n,currentColor:r,onPick:o})=>{const a=l.useI18n();return(0,t.jsxs)("div",{className:vn,children:[(0,t.jsx)("div",{className:$e,children:e}),(0,t.jsx)("div",{className:Bo,children:n.map(i=>(0,t.jsx)("button",{type:"button","aria-label":i==="transparent"?a("graph.colorDropdown.transparent"):i,className:Go,"data-active":Cn(i,r),onMouseDown:s=>s.preventDefault(),onClick:()=>o(i),children:(0,t.jsx)("span",{className:fn,style:Sn(i)})},i))})]})},oa=({value:e,onChange:n,popupAttributes:r})=>{const o=l.useI18n(),[a,i]=(0,b.useState)(!1),s=l.isValidCssColor(e)?e:"#000000",c=ia(s);return(0,t.jsxs)(V.Popover.Root,{open:a,onOpenChange:i,children:[(0,t.jsxs)("div",{className:vn,children:[(0,t.jsx)("div",{className:$e,children:o("graph.colorDropdown.custom")}),(0,t.jsxs)(V.Popover.Trigger,{className:Vo,onMouseDown:d=>d.preventDefault(),"aria-label":o("graph.colorDropdown.pickCustom"),children:[(0,t.jsx)("span",{className:fn,style:Sn(s)}),(0,t.jsx)("span",{className:Uo,children:c})]})]}),(0,t.jsx)(V.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(V.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:xn,children:(0,t.jsxs)(V.Popover.Popup,{className:Wo,onMouseDown:d=>d.preventDefault(),...r,children:[(0,t.jsx)("div",{className:$e,children:o("graph.colorDropdown.pickColor")}),(0,t.jsx)(Ct.HexColorPicker,{color:c,onChange:n,className:$o}),(0,t.jsx)(Ct.HexColorInput,{color:c,onChange:n,prefixed:!0,className:qo,onMouseDown:d=>d.stopPropagation()})]})})})})]})},aa=()=>{const e=l.useCompiledSelector(n=>n.scales.color);return(0,b.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const n=new Set;for(const r of e.domain){const o=e.map(r);typeof o=="string"&&n.add(o)}return[...n]},[e])},Sn=e=>e==="transparent"?{background:gn,border:`1px solid ${W.vars.border100}`}:{background:e,border:`1px solid ${l.darkenCss(e,.1)}`},ia=e=>{const{themeValues:n}=l.useThemeContext();if(l.isHex(e))return e.toUpperCase();const r=ta[e];return r?n[r].toUpperCase():"#000000"},Cn=(e,n)=>n===null?!1:e.toLowerCase()===n.toLowerCase(),la="l9kff0",sa="l9kff1",ca="l9kff2",da="xn24px0",ua="xn24px1",ha="xn24px2",pa=({children:e,popupAttributes:n})=>(0,t.jsx)(N.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:da,children:(0,t.jsx)(N.Menu.Popup,{className:ua,onMouseDown:r=>r.preventDefault(),...n,children:e})})})}),ma=({children:e,isSelected:n=!1,isDisabled:r=!1,onClick:o})=>(0,t.jsx)(N.Menu.Item,{className:ha,"data-selected":n,disabled:r,onClick:o,children:e}),ga=({className:e,...n})=>(0,t.jsx)(ae.Tooltip.Provider,{children:(0,t.jsx)(X.Toolbar.Root,{...n,className:(0,$.default)(la,e)})}),xa=({className:e,...n})=>(0,t.jsx)(X.Toolbar.Group,{...n,className:(0,$.default)(sa,e)}),va=({className:e,...n})=>(0,t.jsx)(X.Toolbar.Separator,{...n,className:(0,$.default)(ca,e)}),fa=({children:e})=>{const n=l.resolvePortalContainer();return n===null?null:(0,sn.createPortal)((0,t.jsx)(l.PortalThemeProvider,{children:e}),n)},B={Portal:fa,Root:ga,Group:xa,Separator:va,Button:X.Toolbar.Button,ColorPicker:ra,MenuPopup:pa,MenuItem:ma},me=e=>(0,t.jsx)(l.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"})})}),ba="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Sa=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Ca="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",ya="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Ke=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Sa},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:ba},{id:"technical",label:"Technical",preview:"00",fontFamily:Ca},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:ya}],ja=e=>e?Ke.find(n=>n.fontFamily===e)??null:null,yn="_70l3rt0",jn="_70l3rt1",An="_70l3rt3",Tn="_70l3rt4",wn="_70l3rt5",Aa=({editor:e,currentFontFamily:n,isOpen:r,onOpenChange:o})=>{const a=l.useI18n(),i=ja(n)??Ke[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,t.jsxs)(N.Menu.Root,{open:r,onOpenChange:o,children:[(0,t.jsxs)(N.Menu.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:yn,onMouseDown:c=>c.preventDefault(),children:[(0,t.jsx)("span",{className:jn,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,t.jsx)(me,{size:"sm"})]}),(0,t.jsx)(N.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:An,children:(0,t.jsx)(N.Menu.Popup,{className:Tn,onMouseDown:c=>c.preventDefault(),children:Ke.map(c=>(0,t.jsx)(N.Menu.Item,{className:wn,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,t.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Pn={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:W.vars.fontTextEditorBody},Tt=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:W.vars.fontTextEditorH6},Pn,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:W.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:W.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:W.vars.fontTextEditorH1}],Ta=({editor:e,activeStyle:n,isOpen:r,onOpenChange:o})=>{const a=l.useI18n(),i=Tt.find(s=>s.id===n)??Pn;return(0,t.jsxs)(N.Menu.Root,{open:r,onOpenChange:o,children:[(0,t.jsxs)(N.Menu.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:yn,onMouseDown:s=>s.preventDefault(),children:[(0,t.jsx)("span",{className:jn,children:a(i.translationKey)}),(0,t.jsx)(me,{size:"sm"})]}),(0,t.jsx)(N.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:An,children:(0,t.jsx)(N.Menu.Popup,{className:Tn,onMouseDown:s=>s.preventDefault(),children:Tt.map(s=>(0,t.jsx)(N.Menu.Item,{className:wn,"data-selected":s.id===i.id,onClick:()=>wa(e,s.id),children:(0,t.jsx)(Pa,{font:s.previewFont,children:a(s.translationKey)})},s.id))})})})})]})},wa=(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()}},Pa=({font:e,children:n})=>(0,t.jsx)("span",{style:{font:e,margin:0},children:n}),kn=e=>(0,t.jsx)(l.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"})})}),ka=e=>(0,t.jsx)(l.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"})]})}),La=e=>(0,t.jsx)(l.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"})]})}),Ia=e=>!e.content||e.content.length===0?!0:e.content.every(n=>!n.content||n.content.length===0),Ea=e=>{const{$from:n}=e.state.selection,r=n.parent.textContent,o=n.parentOffset,a=n.start();let i=o;for(;i>0&&wt(r[i-1]);)i-=1;let s=o;for(;s<r.length&&wt(r[s]);)s+=1;return{from:a+i,to:a+s}},wt=e=>e!==void 0&&/\S/.test(e),Ma="fop13s0",Ra="fop13s1",_a="fop13s2",Oa="fop13s3",Pt="fop13s4",Na=({editor:e,currentUrl:n,isActive:r,isOpen:o,onOpenChange:a})=>{const i=l.useI18n(),[s,c]=(0,b.useState)(""),d=(0,b.useRef)(null);(0,b.useEffect)(()=>{o&&c(n??"")},[o,n]);const h=()=>{Da(e,s),a(!1)},u=()=>{c(""),a(!1)},m=g=>{c(g.target.value)},x=g=>{g.key==="Enter"&&(g.preventDefault(),h())};return(0,t.jsxs)(V.Popover.Root,{open:o,onOpenChange:a,children:[(0,t.jsx)(V.Popover.Trigger,{render:(0,t.jsx)(X.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:Ma,onMouseDown:g=>g.preventDefault(),children:(0,t.jsx)(ka,{})}),(0,t.jsx)(V.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(V.Popover.Positioner,{sideOffset:6,align:"end",className:Ra,children:(0,t.jsxs)(V.Popover.Popup,{className:_a,initialFocus:d,onMouseDown:g=>g.preventDefault(),children:[(0,t.jsx)("input",{ref:d,type:"url",value:s,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:Oa,onMouseDown:g=>g.stopPropagation(),onChange:m,onKeyDown:x}),(0,t.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:Pt,onClick:u,children:(0,t.jsx)(La,{})}),(0,t.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:Pt,onClick:h,children:(0,t.jsx)(kn,{})})]})})})})]})},Da=(e,n)=>{const r=n.trim(),{selection:o}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const a=Ea(e);e.chain().focus().setTextSelection(a).setLink({href:r}).run()},Ln=e=>(0,t.jsx)(l.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"})]})}),In=e=>(0,t.jsx)(l.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"})]})}),En=e=>(0,t.jsx)(l.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"})]})}),Fa="_1d66w570",za="_1d66w571",Ha=6,ie=({label:e,isActive:n,onToggle:r,children:o})=>{const a=i=>i.preventDefault();return(0,t.jsxs)(ae.Tooltip.Root,{children:[(0,t.jsx)(ae.Tooltip.Trigger,{render:(0,t.jsx)(xo.Toggle,{render:(0,t.jsx)(X.Toolbar.Button,{}),pressed:n,onPressedChange:()=>r()}),"aria-label":e,className:Fa,onMouseDown:a,children:o}),(0,t.jsx)(ae.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(ae.Tooltip.Positioner,{sideOffset:Ha,children:(0,t.jsx)(ae.Tooltip.Popup,{className:za,children:e})})})})]})},Ba=({editor:e,activeAlignment:n="left"})=>{const r=l.useI18n();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ie,{label:r("graph.toolbar.textAlign.left"),isActive:n==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,t.jsx)(En,{})}),(0,t.jsx)(ie,{label:r("graph.toolbar.textAlign.center"),isActive:n==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,t.jsx)(Ln,{})}),(0,t.jsx)(ie,{label:r("graph.toolbar.textAlign.right"),isActive:n==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,t.jsx)(In,{})})]})},Ga="_1u34vl40",Va=({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:Ua(e),textAlign:Wa(e)}),Ua=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",Wa=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",$a=8,qa=8,Ka=({editor:e})=>{const n=l.useI18n(),[r,o]=(0,b.useState)(!1),[a,i]=(0,b.useState)(null),s=a!==null,c=g=>v=>{i(v?g:null)},{refs:d,floatingStyles:h}=(0,de.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,de.offset)($a),(0,de.flip)(),(0,de.shift)({padding:qa})],whileElementsMounted:de.autoUpdate}),u=(0,b.useRef)(null),m=(0,Me.useEditorState)({editor:e,selector:Va}),x=(0,b.useCallback)(g=>{u.current=g,d.setFloating(g)},[d]);return(0,b.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,b.useEffect)(()=>{if(!e)return;const g=()=>o(!0),v=({event:S})=>{const{relatedTarget:y,currentTarget:P}=S,C=y instanceof Node&&u.current?.contains(y),k=y instanceof Node&&P instanceof Node&&P.contains(y);!C&&!k&&o(!1)};return e.on("focus",g),e.on("blur",v),()=>{e.off("focus",g),e.off("blur",v)}},[e]),!e||!r&&!s?null:(0,t.jsx)(B.Portal,{children:(0,t.jsxs)(B.Root,{ref:x,className:Ga,style:h,children:[(0,t.jsxs)(B.Group,{children:[(0,t.jsx)(B.ColorPicker,{color:m?.color??null,onChange:g=>e.chain().setColor(g).run(),isOpen:a==="color",onOpenChange:c("color")}),(0,t.jsx)(Aa,{editor:e,currentFontFamily:m?.fontFamily??null,isOpen:a==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,t.jsx)(B.Separator,{}),(0,t.jsx)(B.Group,{children:(0,t.jsx)(Ta,{editor:e,activeStyle:m?.fontSize??"text",isOpen:a==="fontSize",onOpenChange:c("fontSize")})}),(0,t.jsx)(B.Separator,{}),(0,t.jsxs)(B.Group,{children:[(0,t.jsx)(ie,{label:n("graph.toolbar.formatting.bold"),isActive:m?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,t.jsx)("strong",{children:"B"})}),(0,t.jsx)(ie,{label:n("graph.toolbar.formatting.italic"),isActive:m?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,t.jsx)("em",{children:"I"})}),(0,t.jsx)(ie,{label:n("graph.toolbar.formatting.underline"),isActive:m?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,t.jsx)("u",{children:"U"})})]}),(0,t.jsx)(B.Separator,{}),(0,t.jsx)(B.Group,{children:(0,t.jsx)(Ba,{editor:e,activeAlignment:m?.textAlign})}),(0,t.jsx)(B.Separator,{}),(0,t.jsx)(B.Group,{children:(0,t.jsx)(Na,{editor:e,currentUrl:m?.linkUrl??null,isActive:m?.isLink??!1,isOpen:a==="link",onOpenChange:c("link")})})]})})},Za="_1uy50v30",Mn=({editor:e,ariaLabel:n})=>(0,t.jsxs)("div",{className:Za,children:[(0,t.jsx)(Ka,{editor:e}),(0,t.jsx)(Me.EditorContent,{editor:e,"aria-label":n})]}),Xa=200,at=({content:e,extensions:n,isEditable:r,onUpdate:o,updateDebounceMs:a=Xa})=>{const i=(0,b.useRef)(kt(e)),s=(0,b.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,o?.(h)},a),d=(0,Me.useEditor)({extensions:n,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const u=h.getJSON();if(Be(s.current,u))return c.cancel();c.run(u)}});return(0,b.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,b.useEffect)(()=>{if(!d)return;const h=kt(e);Be(s.current,h)||(s.current=h,!Be(d.getJSON(),h)&&(c.cancel(),Ya(d,h)))},[d,e,c]),(0,b.useEffect)(()=>()=>c.flush(),[c]),d},kt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Ya=(e,n)=>{const{from:r,to:o}=e.state.selection;e.commands.setContent(n,{emitUpdate:!1});const a=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,a),to:Math.min(o,a)})},Be=(e,n)=>JSON.stringify(Ae(e))===JSON.stringify(Ae(n)),Ae=e=>Array.isArray(e)?e.map(Ae):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ae(r)]).filter(([,n])=>!Ja(n)).sort(([n],[r])=>String(n).localeCompare(String(r)))),Ja=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,Qa=({caption:e,captionStyle:n})=>{const{dispatch:r}=l.useGraphCommands(),o=at({content:e,extensions:(0,b.useMemo)(()=>Do({placeholder:"Add caption"}),[]),isEditable:!0,onUpdate:a=>{const i=Ia(a)?null:a;r(new p.SetContentCaptionCommand({caption:i}))}});return(0,t.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(n),children:(0,t.jsx)(Mn,{editor:o,ariaLabel:"Chart caption"})})},ei=e=>[ye.Document,dn.Paragraph,...ot(),ni,Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:n})=>n===0?e:""})],ti=({annotation:e})=>{const n=l.useI18n(),{dispatch:r}=l.useGraphCommands(),o=l.useEditorStore(),a=(0,b.useMemo)(()=>ei(n("graph.annotations.text.placeholder")),[n]),i=at({content:e.content,extensions:a,isEditable:!0,onUpdate:s=>{r(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,b.useEffect)(()=>{const{setCaretEditor:s}=o.getState();return s(i),()=>s(null)},[i,o]),(0,b.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,t.jsx)(Me.EditorContent,{"aria-label":n("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},Lt=e=>{const n=l.resolveRichTextFontFamily(e);return n===void 0?{}:{style:`font-family: ${n}`}},ni=cn.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Lt(e.fontFamily)},font:{default:null,renderHTML:e=>Lt(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${W.vars.textScale})`}:{}}}}]}}),ri=3,oi=({title:e,isTitleVisible:n,subtitle:r,isSubtitleVisible:o})=>{const a=[];return n&&a.push({type:"heading",attrs:{level:ri},content:ii(e)}),o&&a.push(...li(r)),{type:"doc",content:a}},ai=e=>{const[n,...r]=e.content??[];return{title:si(n?.content??[]),subtitle:ci(r)}},it=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(it)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),ii=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??[],li=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(It):[It(e)],It=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},si=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(it)}},ci=e=>{const n=e.filter(o=>(o.content??[]).length>0);if(n.length===0)return null;const[r]=n;if(r&&n.length===1&&r.type==="paragraph"){const o=r.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:n.map(it)}},di={fontFamily:"var(--uwf6lt0)",fontSize:"var(--uwf6lt1)",fontWeight:"var(--uwf6lt2)",lineHeight:"var(--uwf6lt3)",textColor:"var(--uwf6lt4)"},ui="uwf6lt5",hi=({title:e,isTitleVisible:n,isSubtitleVisible:r,subtitle:o,headingStyle:a,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,b.useMemo)(()=>No({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:n,isSubtitleVisible:r}),[n,r]),d=at({content:(0,b.useMemo)(()=>oi({title:e,isTitleVisible:n,subtitle:o,isSubtitleVisible:r}),[e,n,o,r]),extensions:c,isEditable:!0,onUpdate:h=>{const u=ai(h);n&&s(new p.SetContentTitleCommand({title:u.title})),r&&s(new p.SetContentSubtitleCommand({subtitle:u.subtitle}))}});return(0,t.jsx)("div",{className:ui,"data-testid":"title-editor",style:{...l.toHtmlTextCss(a),...l.assignTextStyleVars(di,i)},children:(0,t.jsx)(Mn,{editor:d,ariaLabel:"Chart title and subtitle"})})},pi={Title:hi,Caption:Qa,TextAnnotation:ti},mi="data-graphy-chart-chrome",gi="data-graphy-chart-menu",Rn={[gi]:""},Re=e=>({[mi]:e}),Ce=(e,n)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(n)}"]`)!==null,xi=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,Ze=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,_n=(e,n,r)=>r!==null&&(0,p.isPointWithinEditMenuTrigger)({x:e.clientX-n.x,y:e.clientY-n.y},r),pe=(e,n,r)=>e instanceof Node&&(n.contains(e)||Ce(e,r)),vi="cml7ha0",On=(0,b.createContext)(null),fi=({children:e})=>{const{chartId:n}=l.useGraphContext(),[r]=(0,b.useState)(l.resolvePortalContainer),[o,a]=(0,b.useState)(null);return r===null?null:(0,t.jsxs)(t.Fragment,{children:[(0,sn.createPortal)((0,t.jsx)("div",{ref:a,className:vi,...Re(n)}),r),(0,t.jsx)(On.Provider,{value:o,children:e})]})},lt=()=>(0,b.useContext)(On),Nn=e=>(0,t.jsxs)(l.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 Dn="efjmb40",Fn="efjmb41",te="efjmb42",ne="efjmb43",bi="efjmb44",Si="efjmb45",Ci=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),st=({label:e,icon:n,onOpened:r,children:o})=>{const a=lt(),[i,s]=(0,b.useState)(!1),c=(d,h)=>{d?(s(!0),r?.()):Ci.has(h.reason)&&s(!1)};return(0,t.jsxs)(Q.Menu.SubmenuRoot,{open:i,onOpenChange:c,children:[(0,t.jsx)(yi,{label:e,icon:n}),(0,t.jsx)(Q.Menu.Portal,{container:a,children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(Q.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:Dn,...Rn,children:(0,t.jsx)(Q.Menu.Popup,{className:Fn,children:o})})})})]})},yi=({label:e,icon:n})=>(0,t.jsxs)(Q.Menu.SubmenuTrigger,{className:te,openOnHover:!1,children:[n,(0,t.jsx)("span",{className:ne,children:e}),(0,t.jsx)("span",{className:Si,children:(0,t.jsx)(me,{size:"sm"})})]}),ji="_1qe7q450",Ai="_1qe7q451",Ti="_1qe7q452",wi=({label:e,placeholder:n,addLabel:r,at:o,onRequestClose:a})=>{const i=(0,b.useRef)(null),[s,c]=(0,b.useState)(""),{dispatch:d}=l.useGraphCommands(),h=s.trim(),u=()=>{h.length!==0&&(d(new p.AddAnnotationCommand({kind:"comment",annotation:{at:o,content:Pi(h)}})),a())},m=v=>{v.key==="Enter"&&(v.preventDefault(),u()),v.key!=="Escape"&&v.stopPropagation()},x=v=>{c(v.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,t.jsx)(st,{label:e,icon:(0,t.jsx)(Nn,{}),onOpened:g,children:(0,t.jsxs)("div",{className:ji,children:[(0,t.jsx)("input",{ref:i,className:Ai,value:s,placeholder:n,onChange:x,onKeyDown:m}),(0,t.jsx)("button",{type:"button",className:Ti,disabled:h.length===0,onClick:u,children:r})]})})},Pi=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),ki=e=>(0,t.jsx)(l.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"})}),Li="relative-difference",Ii=({label:e,layer:n,at:r,onRequestClose:o})=>{const{dispatch:a}=l.useGraphCommands(),i=l.useCompiledSelector(d=>d.coordSystem),s=(0,b.useMemo)(()=>(0,p.inferDifferenceArrowEndpoints)({layer:n,at:r,coordSystem:i}),[n,r,i]);if(s===null)return null;const c=()=>{a(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...s,label:Li}})),o()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:c,children:[(0,t.jsx)(ki,{}),(0,t.jsx)("span",{className:ne,children:e})]})};function Ei(e,n){if(e.type==="polar"&&!Mi(n))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,p.hasMultipleGroups)(n.data,n.mapping);switch(n.geom){case"bar":{const o=[{scope:"data-point",labelKey:"bar"}];if(r){const a=n.position==="stack"||n.position==="fill";o.push({scope:"x-value",labelKey:a?"barStack":"barGroup"}),o.push({scope:"series",labelKey:"barSeries"})}return o}case"line":case"area":{const o=[{scope:"data-point",labelKey:"linePoint"}];return r&&o.push({scope:"series",labelKey:"lineSeries"}),o}case"point":{const o=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&o.push({scope:"series",labelKey:"scatterSeries"}),o}default:return[]}}var Mi=e=>{const n=(0,p.extractVariableName)(e.mapping.x);return n!==null&&n!==p.CONSTANT_VARIABLES.x},Ri=e=>(0,t.jsxs)(l.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"})]}),_i=e=>(0,t.jsxs)(l.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"})]}),Oi=e=>(0,t.jsxs)(l.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"})]}),Ni=e=>(0,t.jsxs)(l.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"})]}),Di=e=>(0,t.jsxs)(l.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"})]}),Fi=e=>(0,t.jsxs)(l.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"})]}),zi=e=>(0,t.jsxs)(l.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"})]}),Hi=e=>(0,t.jsxs)(l.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)"})]}),Bi=e=>(0,t.jsxs)(l.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)"})]}),Gi={bar:Ri,barGroup:_i,barStack:Ni,barSeries:Oi,linePoint:Di,lineSeries:Fi,scatterPoint:Hi,scatterSeries:Bi,pieSlice:zi},zn=({labelKey:e})=>{const n=Gi[e];return(0,t.jsx)(n,{})},Hn=e=>(0,t.jsxs)(l.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"})]}),Vi=({label:e,options:n,onSelect:r})=>{const o=l.useI18n();return(0,t.jsx)(st,{label:e,icon:(0,t.jsx)(Hn,{}),children:n.map(a=>(0,t.jsxs)(Q.Menu.Item,{className:te,onClick:()=>r(a.scope),children:[(0,t.jsx)(zn,{labelKey:a.labelKey}),(0,t.jsx)("span",{className:ne,children:o(`graph.annotations.highlights.labels.${a.labelKey}`)})]},a.scope))})},Ui=({label:e,layer:n,observation:r,highlights:o,onRequestClose:a})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),c=l.useCompiledSelector(g=>g.coordSystem),d=(0,b.useMemo)(()=>(0,p.buildObservationPredicate)(n,r),[n,r]),h=(0,b.useMemo)(()=>Ei(c,n),[c,n]),u=(0,b.useMemo)(()=>{const g=new Set(o.map(v=>v.scope));return h.filter(v=>!g.has(v.scope))},[h,o]),[m]=u;if(d===null||m===void 0)return null;const x=g=>{s(new p.AddHighlightCommand({predicate:d,scope:g,layerId:n.id})),a()};if(u.length===1){const g=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,t.jsxs)(Q.Menu.Item,{className:te,onClick:()=>x(m.scope),children:[(0,t.jsx)(zn,{labelKey:m.labelKey}),(0,t.jsx)("span",{className:ne,children:g})]})}return(0,t.jsx)(Vi,{label:e,options:u,onSelect:x})},Wi="_1aafi1g0",$i="_1aafi1g1",Bn=({children:e})=>(0,t.jsxs)("span",{className:Wi,"aria-hidden":"true",children:[e,(0,t.jsx)("span",{className:$i})]}),qi=({label:e,highlights:n,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=n.at(-1);if(a===void 0)return null;const i=()=>{o(new p.RemoveHighlightCommand({id:a.id})),r()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:i,children:[(0,t.jsx)(Bn,{children:(0,t.jsx)(Hn,{})}),(0,t.jsx)("span",{className:ne,children:e})]})},Ki=(e,n)=>{const r=l.useCompiledSelector(a=>a.spec.highlights),o=l.useCompiledSelector(a=>a.config.parsingLocale);return(0,b.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:r,observation:n,parsingLocale:o}),[e,r,n,o])},Gn=e=>(0,t.jsxs)(l.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"})]}),Zi=({label:e,at:n,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=()=>{o(new p.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:n}})),r()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:a,children:[(0,t.jsx)(Gn,{}),(0,t.jsx)("span",{className:ne,children:e})]})},Vn=e=>(0,t.jsxs)(l.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"})]}),Un={pinnedNumber:{icon:Gn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:Nn,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Vn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Xi=e=>(0,p.isObservationAttachmentKind)(e.kind)&&Un[e.kind]!==null,Yi=({attachment:e,onRequestClose:n})=>{const r=l.useI18n(),{dispatch:o}=l.useGraphCommands(),{icon:a,labelKey:i}=Un[e.kind],s=()=>{o(new p.RemoveAnnotationCommand({id:e.annotation.id})),n()};return(0,t.jsxs)(N.Menu.Item,{className:te,onClick:s,children:[(0,t.jsx)(Bn,{children:(0,t.jsx)(a,{})}),(0,t.jsx)("span",{className:ne,children:r(i)})]})},Ji="ceeojg0",Qi="ceeojg1",el="ceeojg2",tl=({label:e,at:n,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=i=>{o(new p.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...n},sticker:i}})),r()};return(0,t.jsx)(st,{label:e,icon:(0,t.jsx)(Vn,{}),children:(0,t.jsx)("div",{className:Ji,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,t.jsx)(Q.Menu.Item,{className:Qi,"aria-label":i,onClick:()=>a(i),children:(0,t.jsx)("img",{className:el,src:s.src,alt:i})},i))})})},nl=({interaction:e,panelOrigin:n})=>{const r=l.useEditorStore(),o=l.useEditorState(i=>i.menuTrigger);if(e.kind!=="menu"||o===null)return null;const a=()=>{r.getState().releaseInteraction("menu")};return(0,t.jsx)(rl,{trigger:{x:n.x+o.center.x,y:n.y+o.center.y,radius:o.radius},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:a})},rl=({trigger:e,layer:n,at:r,observation:o,onClose:a})=>{const i=l.useI18n(),s=lt(),c=l.useCompiledSelector(C=>C.spec.annotations),d=l.useCompiledSelector(C=>C.config.parsingLocale),h=al(),{x:u,y:m,radius:x}=e,g=(0,b.useMemo)(()=>ol(u,m,x),[u,m,x]),v=(0,p.findObservationAttachment)(c,r,(0,b.useMemo)(()=>(0,p.createObservationAnchorParser)(n,d),[n,d])),S=v!==null&&Xi(v)?v:null,y=Ki(n,o),P=(C,k)=>{!C&&il(k.reason)&&a()};return(0,t.jsx)(N.Menu.Root,{open:h,modal:!1,onOpenChange:P,children:(0,t.jsx)(N.Menu.Portal,{container:s,children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(N.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:Dn,...Rn,children:(0,t.jsxs)(N.Menu.Popup,{className:Fn,"data-testid":"observation-menu",children:[S!==null&&(0,t.jsx)(Yi,{attachment:S,onRequestClose:a}),(0,t.jsx)(qi,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:y,onRequestClose:a}),(0,t.jsx)(N.Menu.Separator,{className:bi}),S===null&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Zi,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:a}),(0,t.jsx)(wi,{label:i("graph.annotations.baseMenu.annotate"),placeholder:i("graph.annotations.textMenu.placeholder"),addLabel:i("graph.annotations.textMenu.addButton"),at:r,onRequestClose:a}),(0,t.jsx)(tl,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:a})]}),n.highlight!==null&&(0,t.jsx)(Ui,{label:i("graph.annotations.baseMenu.highlight"),layer:n,observation:o,highlights:y,onRequestClose:a}),(0,t.jsx)(Ii,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:n,at:r,onRequestClose:a})]})})})})})},ol=(e,n,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,n-r,r*2,r*2)}),al=()=>{const[e,n]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{n(!0)},[]),e},il=e=>e==="outside-press"||e==="escape-key"||e==="item-press",ct="l8tsqe0",Wn=["start","end"],$n=({anchor:e,point:n,delta:r})=>{const o={x:Et(n.x,r.x),y:Et(1-n.y,r.y)};return{anchor:{...e,x:e.x+o.x,y:e.y+o.y},point:{x:n.x+o.x,y:n.y-o.y}}},dt=(e,n)=>({...e,[n.endpoint]:{...e[n.endpoint],...n.point}}),qn=(e,n)=>e.x===n.x&&e.y===n.y,ll=(e,n)=>{const r=(0,p.projectAnchorToPanel)(e,n);return{x:n.x+r.x,y:n.y+r.y}},sl=(e,n,r)=>{const o=(0,p.projectAnchorToPanel)(e,r),a=(0,p.projectAnchorToPanel)(n,r);return{x:Math.min(o.x,a.x),y:Math.min(o.y,a.y),width:Math.abs(a.x-o.x),height:Math.abs(a.y-o.y)}},Et=(e,n)=>!Number.isFinite(n)||!Number.isFinite(e)?0:(0,le.default)(n,Math.min(-e,0),Math.max(1-e,0)),cl=({panelRect:e})=>{const n=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,o=l.useArrowAnnotationStyles();if(n===null)return null;const a=r.find(c=>c.id===n.annotationId);if(a===void 0)return null;const i=o(a.id),s=(0,p.computeArrow)({arrow:dt(a,n),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ct,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)(l.ArrowAnnotation,{computed:s,style:i,isAddressable:!1})})},ge=()=>{const e=l.useGraphSelection();return Xe(e)},Xe=e=>{if(e.length!==1)return null;const[n]=e;return n?.kind==="annotation"?n.id:null},dl=e=>(0,t.jsx)(l.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"})]})}),Kn=e=>(0,t.jsx)(l.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"})]})}),ul=e=>(0,t.jsx)(l.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"})]})}),Zn=e=>(0,t.jsx)(l.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"})]})}),_e=e=>(0,t.jsx)(l.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"})]})}),hl="var(--pvjfpx0)",pl="var(--pvjfpx1)",ml="pvjfpx2",gl="pvjfpx3",xl="pvjfpx4",vl="pvjfpx6 pvjfpx5",fl="pvjfpx7 pvjfpx6 pvjfpx5",bl="pvjfpx8 pvjfpx5",ue=8,Sl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:o})=>{const a=n.y+e.y,i=a+e.height,s=a-8-36,c=i+8,d=(0,le.default)(s>=ue?s:c,ue,o-ue-36),h=ue;return{top:d,left:h,available:Math.max(0,r-ue*2),centre:n.x+e.x+e.width/2-h}},Cl=({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:o,label:a,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=Sl({anchorBox:e,panelRect:n,frameWidth:r,frameHeight:o});return(0,t.jsx)("div",{className:ml,style:{top:d.top,left:d.left,width:d.available},children:(0,t.jsx)(B.Root,{"aria-label":a,className:gl,"data-testid":i,...Re(c),style:(0,ln.assignInlineVars)({[hl]:`${d.centre}px`,[pl]:`${d.available}px`}),children:s})})},yl=({label:e,trigger:n,isOpen:r,onOpenChange:o,isDisabled:a=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,t.jsxs)(N.Menu.Root,{open:r,modal:!1,onOpenChange:o,children:[(0,t.jsxs)(N.Menu.Trigger,{render:(0,t.jsx)(B.Button,{}),"aria-label":e,className:bl,disabled:a,onMouseDown:c=>c.preventDefault(),children:[n,(0,t.jsx)(me,{size:"sm"})]}),(0,t.jsx)(B.MenuPopup,{popupAttributes:Re(s),children:i})]})},jl=e=>{const{chartId:n}=l.useGraphContext();return(0,t.jsx)(B.ColorPicker,{...e,popupAttributes:Re(n)})},Al=({color:e,opacity:n})=>(0,t.jsx)("span",{className:xl,style:{background:e,opacity:n}}),Tl=({label:e,onClick:n,children:r})=>(0,t.jsx)(B.Button,{"aria-label":e,className:vl,onClick:n,children:r}),wl=({label:e,isPressed:n,onClick:r,children:o})=>(0,t.jsx)(B.Button,{"aria-label":e,"aria-pressed":n,className:fl,onClick:r,children:o}),E={Root:Cl,Dropdown:yl,MenuItem:B.MenuItem,ColorPicker:jl,Swatch:Al,IconButton:Tl,ToggleButton:wl,Button:B.Button,Separator:B.Separator},Pl={kind:"chrome-popup"},Oe=()=>{const{commands:e}=l.useGraphContext(),n=l.useEditorStore(),[r,o]=(0,b.useState)(null);(0,b.useEffect)(()=>()=>e.seal(),[e]),(0,b.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:s}=n.getState();return r===null?s("chrome-popup"):i(Pl),()=>s("chrome-popup")},[n,r]);const a=()=>{o(null),e.seal()};return{bind:i=>({isOpen:r===i,onOpenChange:s=>s?o(i):a()}),close:a}},kl=e=>(0,t.jsx)(l.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"})]})}),Ll=e=>(0,t.jsx)(l.Icon,{...e,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,t.jsx)("path",{d:"M5 19h0"}),(0,t.jsx)("path",{d:"M8.5 15.5h0"}),(0,t.jsx)("path",{d:"M12 12h0"}),(0,t.jsx)("path",{d:"M15.5 8.5h0"}),(0,t.jsx)("path",{d:"M19 5h0"})]})}),Il=e=>(0,t.jsx)(l.Icon,{...e,children:(0,t.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),El=[{value:p.ARROW_STROKE_WIDTHS.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:p.ARROW_STROKE_WIDTHS.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:p.ARROW_STROKE_WIDTHS.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],Mt=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Kn},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Rt=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:Il},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:kl},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:Ll}],Ml=(e,n)=>e.find(r=>r.value===n)??e[0];var Rl=({arrow:e,arrowBox:n,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useCompiledSelector(I=>I.spec.styles.overrides),h=Oe(),u=l.useArrowAnnotationStyles()(e.id),m=Ml(Rt,u.lineType),x=u.borderWidth>0||u.shadow!=="none",g=(0,b.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),v=(I,M)=>{const A=(0,p.findStyleRule)(d,{select:g})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:g,declarations:{...A,...I}}}),M)},S=I=>{v(I),h.close()},y=I=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:I})),h.close()},P=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},C=I=>v({color:I},{transient:!0}),k=I=>S({strokeWidth:I}),L=I=>y({startArrowheadStyle:I}),R=I=>S({lineType:I}),O=I=>y({endArrowheadStyle:I}),_=()=>v(x?{borderWidth:0,shadow:"none"}:p.ARROW_STICKER_DECLARATIONS);return(0,t.jsxs)(E.Root,{anchorBox:n,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,t.jsx)(E.ColorPicker,{color:u.color,label:s("graph.annotations.arrowToolbar.color"),onChange:C,...h.bind("color"),children:(0,t.jsx)(E.Swatch,{color:u.color})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,t.jsx)(Zn,{size:"sm",title:""}),...h.bind("thickness"),children:(0,t.jsx)(fe,{options:El,current:u.strokeWidth,onPick:k})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,t.jsx)(dl,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,t.jsx)(fe,{options:Mt,current:e.startArrowheadStyle,onPick:L})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:m?.Icon!==void 0&&(0,t.jsx)(m.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,t.jsx)(fe,{options:Rt,current:u.lineType,onPick:R})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,t.jsx)(Kn,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,t.jsx)(fe,{options:Mt,current:e.endArrowheadStyle,onPick:O})}),(0,t.jsx)(E.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),isPressed:x,onClick:_,children:(0,t.jsx)(ul,{size:"sm",title:""})}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:P,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},fe=({options:e,current:n,onPick:r})=>{const o=l.useI18n(),a=i=>()=>r(i);return(0,t.jsx)(t.Fragment,{children:e.map(i=>(0,t.jsxs)(E.MenuItem,{isSelected:i.value===n,onClick:a(i.value),children:[(0,t.jsx)("span",{children:o(i.key)}),i.Icon!==void 0&&(0,t.jsx)("span",{className:"_112xh5c0",children:(0,t.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},_l="_1me29t10",q=(e,n)=>n>0?e/n:0,Ne=(e,n,r)=>({x:q(n.x-e.x,r.width),y:q(n.y-e.y,r.height)}),Ol=e=>e.x!==0||e.y!==0,Xn=(e,n)=>({x:e.x*n.width,y:e.y*n.height});var Nl=(e,n)=>Math.hypot(n.x-e.x,n.y-e.y)>=3,xe=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 o={x:n.clientX,y:n.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,o))return;const a=this.resolvePreview(o);a!==null&&(r.claimInteraction(a),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 Nl(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)}},Te=(e,n,r)=>{const o=e.arrows.find(i=>i.id===n);if(o===void 0)return null;const a=o[r];return a.anchorType==="panel"?a:null},Yn=(e,n)=>e==="start"?{start:n}:{end:n},Dl=class extends xe{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:n,endpoint:r}=this.params;return l.readDraggedArrowEndpointFor(l.readStanding(e,"arrow-endpoint-drag"),n,r)}resolvePreview(e){const{annotationId:n,endpoint:r,press:o,readInputs:a}=this.params,{annotations:i,arrow:s,panelRect:c}=a(),d=Te(i,n,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:n,endpoint:r,...$n({anchor:d,point:s[r],delta:Ne(o,e,c)})}}commit({anchor:e}){const{annotationId:n,endpoint:r,dispatch:o,readInputs:a}=this.params,i=Te(a().annotations,n,r);i===null||qn(i,e)||o(new p.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Yn(r,e)}))}},Fl=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef({annotations:l.useCompiledSelector(c=>c.spec.annotations),arrow:n,panelRect:r}),s=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>s.current?.finish(!1),[]),(0,b.useCallback)(c=>({onPointerDown:d=>{if(d.button===0&&s.current===null){try{d.currentTarget.setPointerCapture(d.pointerId)}catch{return}d.currentTarget.focus({preventScroll:!0}),d.preventDefault(),s.current=new Dl({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:a,dispatch:o.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,a,o])},zl=[" ","Enter"],_t=4,Hl=({annotationId:e,arrow:n,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useCompiledSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(o.dispatch);return(0,b.useEffect)(()=>()=>{for(const d of Wn)Ot({editorStore:a,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[a,e,s,c]),(0,b.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(u,"arrow-endpoint-drag"),e,d);if(zl.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m!==null){Ot({editorStore:a,annotationId:e,endpoint:d,annotations:i,dispatch:o.dispatch});return}const g=Te(i,e,d);if(g===null)return;u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:g,point:n[d]});return}if(m===null)return;const x=Bl(h.key,r);x!==null&&(h.preventDefault(),u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...$n({anchor:m.anchor,point:m.point,delta:x})}))}}),[e,i,n,r,a,o])},Ot=({editorStore:e,annotationId:n,endpoint:r,annotations:o,dispatch:a})=>{const i=e.getState(),s=l.readDraggedArrowEndpointFor(l.readStanding(i,"arrow-endpoint-drag"),n,r);if(s===null)return;i.releaseInteraction("arrow-endpoint-drag");const c=Te(o,n,r);c===null||qn(c,s.anchor)||a(new p.UpdateAnnotationCommand({kind:"arrow",id:n,patch:Yn(r,s.anchor)}))},Bl=(e,n)=>{const r=q(_t,n.width),o=q(_t,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},Gl=e=>{const n=ge(),r=Wl(n),o=$l(e.panelRect,n),a=ql(n);if(r===null||o===null)return null;const i=a.dragged===null?o:dt(o,a.dragged);return(0,t.jsx)(Vl,{arrow:r,committed:o,painted:i,isSettled:a.dragged===null&&!a.isMoved,isMoved:a.isMoved,...e})},Vl=({arrow:e,committed:n,painted:r,isSettled:o,isMoved:a,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=Fl({annotationId:e.id,arrow:n,panelRect:i}),u=Hl({annotationId:e.id,arrow:n,panelRect:i});return(0,t.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[o&&(0,t.jsx)(Rl,{arrow:e,arrowBox:sl(n.start,n.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!a&&Wn.filter(m=>e[m].anchorType==="panel").map(m=>(0,t.jsx)(Ul,{endpoint:m,point:ll(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:u(m)},m))]})},Ul=({endpoint:e,point:n,label:r,dragHandlers:o,keyboardHandlers:a})=>(0,t.jsx)("div",{"aria-label":r,className:_l,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:n.x,top:n.y},tabIndex:0,...o,...a}),Wl=e=>{const n=l.useCompiledSelector(r=>r.spec.annotations.arrows);return e===null?null:n.find(r=>r.id===e)??null},$l=(e,n)=>{const r=l.useResolvedAnnotations(e).arrows;return n===null?null:r.find(o=>o.id===n)??null},ql=e=>l.useEditorState((0,se.useShallow)(n=>{if(e===null)return{dragged:null,isMoved:!1};const r=l.readStanding(n,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:l.readMovedAnnotationFor(l.readStanding(n,"move-drag"),e)!==null}})),Kl=e=>(0,t.jsx)(l.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"})]})}),Zl="q7gcrz0",Xl="q7gcrz1",Yl="q7gcrz2";var Jl=["absolute-difference","relative-difference","proportion"],Nt=["absolute-difference","relative-difference"],Ql=["relative-difference","proportion"],es={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},ts=e=>{const{formattingLocale:n}=l.useGraphContext(),r=l.useCompiledSelector(a=>a.config.parsingLocale),o=n??r;return(0,b.useMemo)(()=>{const a=(0,p.areEndpointsComparable)(e.start,e.end);return Jl.filter(i=>a||!Nt.includes(i)||i===e.label).map(i=>({kind:i,key:es[i],preview:(0,p.formatDifferenceLabel)({locale:o,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:a||!Nt.includes(i),isSuspect:Ql.includes(i)&&e.start.measurementValue===0}))},[e,o])},Dt=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],ns=({arrow:e,color:n,labelBox:r,panelRect:o,frameWidth:a,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useCompiledSelector(f=>f.spec.styles.overrides),u=Oe(),m=ts(e),x=l.useDifferenceArrowAnnotationStyles()(e.id),g=(0,b.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),v=(0,b.useMemo)(()=>({...g,part:"label"}),[g]),S=m.find(f=>f.kind===e.label),y=m.some(f=>f.isPickable&&f.kind!==e.label),P=Dt.find(f=>p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[f.id].arrow.strokeWidth===x.strokeWidth),C=(f,w)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:f}),w)},k=f=>({...(0,p.findStyleRule)(h,{select:g})?.declarations,...f}),L=f=>({...(0,p.findStyleRule)(h,{select:v})?.declarations,...f}),R=f=>{C(f),u.close()},O=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},_=f=>d.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:g,declarations:k({color:f})}}),{transient:!0}),I=()=>C({start:e.end.anchor,end:e.start.anchor}),M=f=>()=>R({label:f}),A=f=>()=>{const w=p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[f];d.dispatch(new p.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:k(w.arrow),label:L(w.label)})),u.close()};return(0,t.jsxs)(E.Root,{anchorBox:r,panelRect:o,frameWidth:a,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,t.jsx)(E.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,t.jsx)(rs,{option:S}),isDisabled:!y,...u.bind("labelKind"),children:m.map(f=>(0,t.jsxs)(E.MenuItem,{isSelected:f.kind===e.label,isDisabled:!f.isPickable,onClick:M(f.kind),children:[(0,t.jsx)("span",{children:c(f.key)}),(f.isSuspect||!f.isPickable)&&(0,t.jsx)("span",{"aria-label":c(f.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,t.jsx)("span",{className:Yl,children:f.preview})]},f.kind))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.ColorPicker,{color:n,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:_,...u.bind("color"),children:(0,t.jsx)(E.Swatch,{color:n})}),(0,t.jsx)(E.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:P===void 0?"":c(P.key),...u.bind("size"),children:Dt.map(f=>(0,t.jsx)(E.MenuItem,{isSelected:f.id===P?.id,onClick:A(f.id),children:c(f.key)},f.id))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:I,children:(0,t.jsx)(Kl,{size:"sm",title:""})}),(0,t.jsx)(E.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:O,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},rs=({option:e})=>{const n=l.useI18n();return e===void 0?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:Xl,children:n(e.key)}),(0,t.jsxs)("span",{className:Zl,children:["(",e.preview,")"]})]})};var os="ydgo3h0",as="ydgo3h1",is="ydgo3h2",ls=({clientPoint:e,panelOrigin:n,panelRect:r,engine:o,layers:a,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=ss({x:e.x-n.x,y:e.y-n.y},r),{primary:u}=o.query((0,p.toPanelCursor)(h,r));if(u===null)return null;const m=a.find(g=>g.id===u.layerId);if(m===void 0)return null;const x=(0,p.resolveObservationPoint)({resolver:s,layer:m,observation:u.observation,observationIndex:(0,p.readObservationIndex)(u),coordSystem:i,align:d});return x===null||(0,p.areAnchorsEqual)(x.anchor,c)?null:x},ss=(e,n)=>({x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))}),Jn=e=>e==="start"?"end":"start",Qn=({dispatch:e,arrow:n,endpoint:r,anchor:o})=>{(0,p.areAnchorsEqual)(o,n[r].anchor)||e(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:n.id,patch:{[r]:o}}))},cs=class extends xe{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:n,readInputs:r}=this.params;return l.readDraggedDifferenceArrowEndpointFor(l.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,n)}resolvePreview(e){const{endpoint:n,readInputs:r,engine:o,anchorResolver:a}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=r(),u=ls({clientPoint:e,panelOrigin:s,panelRect:c,engine:o,layers:d,coordSystem:h,resolver:a,fixedAnchor:i[Jn(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:o}=this.params;Qn({dispatch:r,arrow:o().arrow,endpoint:n,anchor:e.anchor})}},ds=({arrow:e,panelOrigin:n,panelRect:r})=>{const{commands:o,anchorResolver:a}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:n,panelRect:r,...l.useCompiledSelector((0,se.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),d=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>d.current?.finish(!1),[]),(0,b.useCallback)(h=>({onPointerDown:u=>{if(u.button===0&&d.current===null){try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault(),d.current=new cs({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:a,dispatch:o.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,a,o])},us=[" ","Enter"],hs=({arrow:e})=>{const{commands:n,anchorResolver:r}=l.useGraphContext(),o=l.useEditorStore(),{layers:a,coordSystem:i,mainAxis:s}=l.useCompiledSelector((0,se.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:d.coordSystem.type==="cartesian"?d.coordSystem.mainAxis:"x"}))),c=e.id;return(0,b.useEffect)(()=>()=>{const d=o.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[o,c]),(0,b.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=o.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(u,"difference-arrow-endpoint-drag"),e.id,d);if(us.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});u.releaseInteraction("difference-arrow-endpoint-drag"),Qn({dispatch:n.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const x=ps(h.key,s);if(x===null)return;h.preventDefault();const g=ms({arrow:e,endpoint:d,from:m.point.anchor,move:x,layers:a,coordSystem:i,resolver:r});g!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:g})}}),[e,o,n,r,a,i,s])},ps=(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}},ms=({arrow:e,endpoint:n,from:r,move:o,layers:a,coordSystem:i,resolver:s})=>{const c=a.find(u=>u.id===r.layerId);if(c===void 0)return null;const d=s.createLayerMeasurement(c);if(d===null)return null;const{align:h}=e[n].anchor;return(0,p.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[Jn(n)].anchor,axis:o.axis,step:o.step,getObservationPoint:(u,m)=>(0,p.resolveObservationPoint)({resolver:s,layer:c,observation:u,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},gs=e=>{const n=ge();return n===null?null:(0,t.jsx)(xs,{annotationId:n,...e})},xs=({annotationId:e,...n})=>{const r=l.useDifferenceArrowGeometries(),o=(0,b.useMemo)(()=>r.find(a=>a.id===e),[r,e]);return o===void 0?null:(0,t.jsx)(vs,{committedArrow:o.committedArrow,color:o.color,labelCornerRadius:o.style.label.borderRadius,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,start:o.start,end:o.end,isDragged:o.isDragged,...n})},vs=({committedArrow:e,color:n,labelCornerRadius:r,committedLabelBox:o,labelBox:a,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:h,frameElement:u,isDragged:m})=>{const x=ds({arrow:e,panelOrigin:d,panelRect:c}),g=hs({arrow:e});return(0,t.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!m&&(0,t.jsx)(ns,{arrow:e,color:n,labelBox:o,panelRect:c,frameWidth:h.width,frameHeight:h.height,frameElement:u}),(0,t.jsx)("div",{"aria-hidden":"true",className:is,"data-testid":"difference-arrow-selection-label",style:{left:c.x+a.x-2,top:c.y+a.y-2,width:a.width+4,height:a.height+4,borderRadius:r+2}}),(0,t.jsx)(Ft,{endpoint:"start",point:i,panelRect:c,dragHandlers:x("start"),keyboardHandlers:g("start")}),(0,t.jsx)(Ft,{endpoint:"end",point:s,panelRect:c,dragHandlers:x("end"),keyboardHandlers:g("end")})]})},Ft=({endpoint:e,point:n,panelRect:r,dragHandlers:o,keyboardHandlers:a})=>(0,t.jsx)("div",{className:os,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+n.x,top:r.y+n.y},tabIndex:0,...o,...a,children:(0,t.jsx)("span",{"aria-hidden":"true",className:as})}),Ye=({start:e,extent:n,isStartMoving:r,delta:o,minExtent:a})=>{if(!Number.isFinite(o))return{start:e,extent:n};const i=e+n,s=Math.min(a,n);if(r){const h=Math.min(0,e),u=Math.min(Math.max(1,e),i-s),m=(0,le.default)(e+o,h,u);return{start:m,extent:i-m}}const c=Math.max(Math.min(0,i),e+s),d=Math.max(1,i);return{start:e,extent:(0,le.default)(i+o,c,d)-e}},fs=["top-left","top-right","bottom-right","bottom-left"];var er=({width:e,height:n})=>({x:q(16,e),y:q(16,n)}),bs=(e,n)=>({x:rr(n)?e.x:e.x+e.width,y:or(n)?e.y:e.y+e.height}),ut=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),tr=({region:e,corner:n,delta:r,minSize:o})=>{const a=Ye({start:e.x,extent:e.width,isStartMoving:rr(n),delta:r.x,minExtent:o.x}),i=Ye({start:e.y,extent:e.height,isStartMoving:or(n),delta:r.y,minExtent:o.y});return{anchorType:"panel",x:a.start,y:i.start,width:a.extent,height:i.extent}},nr=(e,n)=>e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height,rr=e=>e==="top-left"||e==="bottom-left",or=e=>e==="top-left"||e==="top-right",ar=(e,n,r,o)=>{const a=e.textAnnotations.find(i=>i.id===n);return a===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(a,r),o)};var Ss={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},Cs={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},ys=({panelRect:e})=>{const n=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),o=l.useChromeStyleReaders(),a=ge(),i=l.useEditorState(S=>l.readStanding(S,"move-drag")),s=l.useEditorState(S=>l.readStanding(S,"shape-resize-drag")),c=l.useEditorState(S=>l.readStanding(S,"arrow-endpoint-drag")),d=l.useEditorState(S=>l.readStanding(S,"text-resize-drag")),h=l.useEditorState(S=>{const y=S.editTargetUnderPointer;return y?.kind==="annotation"?y.id:null}),u=(0,b.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,chromeReaders:o}),[e.width,e.height,r,o]),m=zt(n,a,u),x=zt(n,h===a?null:h,u),g=S=>{if(s?.annotationId===S.id){const y=n.shapes.find(P=>P.id===S.id);return y===void 0?S.geometry:l.measureShapeRegion(ut(s.region),(0,p.resolveShapeAnnotationStyle)(o,y.id).borderWidth,u.panel)}if(c?.annotationId===S.id){const y=n.arrows.find(P=>P.id===S.id);return y===void 0?S.geometry:l.measureArrowEnds(dt(y,c),u.panel)??S.geometry}return d?.annotationId===S.id?ar(n,S.id,d,u)??S.geometry:S.geometry},v=S=>{if(i?.annotationId!==S)return e;const y=Xn(i.translation,e);return{x:e.x+y.x,y:e.y+y.y}};return(0,t.jsxs)(t.Fragment,{children:[x!==null&&(0,t.jsx)(Ht,{annotationId:x.id,geometry:g(x),state:"hovered",origin:v(x.id)}),m!==null&&(0,t.jsx)(Ht,{annotationId:m.id,geometry:g(m),state:"selected",origin:v(m.id)})]})},zt=(e,n,r)=>{if(n===null)return null;const o=l.resolveAnnotationChromeGeometry(e,n,r);return o===null?null:{id:n,geometry:o}},Ht=({annotationId:e,geometry:n,state:r,origin:o})=>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)(Bt,{point:n.start,state:r,origin:o}),(0,t.jsx)(Bt,{point:n.end,state:r,origin:o})]}):(0,t.jsx)("div",{"aria-hidden":"true",className:Ss[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:o.x+n.rect.x-2,top:o.y+n.rect.y-2,width:n.rect.width+4,height:n.rect.height+4}}),Bt=({point:e,state:n,origin:r})=>(0,t.jsx)("span",{className:Cs[n],style:{left:r.x+e.x,top:r.y+e.y}}),js=({panelRect:e})=>{const n=l.useEditorState(a=>l.readStanding(a,"move-drag")),r=l.useResolvedAnnotations(e);if(n===null)return null;const o=Xn(n.translation,e);return(0,t.jsx)("svg",{"aria-hidden":"true",className:ct,width:e.width,height:e.height,style:{left:e.x+o.x,top:e.y+o.y},"data-testid":"annotation-preview","data-annotation-id":n.annotationId,children:ws(r,n.annotationId,e)})},As=({annotation:e,panel:n})=>{const r=l.useMeasuredBoxRef(e.id);return(0,t.jsx)(l.TextAnnotation,{annotation:e,panel:n,style:l.useTextAnnotationStyles()(e.id),blockRef:r})},be=(e,n,r)=>{const o=e.find(a=>a.id===n);return o===void 0?null:r(o)},Ts={text:(e,n,r)=>be(e.textAnnotations,n,o=>(0,t.jsx)(As,{annotation:o,panel:r})),shape:(e,n,r)=>be(e.shapes,n,o=>(0,t.jsx)(ks,{shape:o,panelSize:r})),image:(e,n,r)=>be(e.images,n,o=>(0,t.jsx)(Ls,{image:o,panelSize:r})),arrow:(e,n,r)=>be(e.arrows,n,o=>(0,t.jsx)(Ps,{arrow:o,panelSize:r}))},ws=(e,n,r)=>{for(const o of Object.values(Ts)){const a=o(e,n,r);if(a!==null)return a}return null},Ps=({arrow:e,panelSize:n})=>{const r=l.useArrowAnnotationStyles()(e.id),o=(0,p.computeArrow)({arrow:e,style:r,panelWidth:n.width,panelHeight:n.height});return o===null?null:(0,t.jsx)(l.ArrowAnnotation,{computed:o,style:r,isAddressable:!1})},ks=({shape:e,panelSize:n})=>(0,t.jsx)(l.ShapeAnnotation,{shape:e,style:l.useShapeAnnotationStyles()(e.id),panel:n}),Ls=({image:e,panelSize:n})=>(0,t.jsx)(l.ImageAnnotation,{image:e,panel:n,style:l.useImageAnnotationStyles()(e.id)}),Is=({panelRect:e})=>{const n=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,o=l.useShapeAnnotationStyles();if(n===null)return null;const a=r.find(i=>i.id===n.annotationId);return a===void 0?null:(0,t.jsx)("svg",{"aria-hidden":"true",className:ct,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)(l.ShapeAnnotation,{shape:{...a,region:ut(n.region)},style:o(a.id),panel:e})})},Es={sm:"o49ib40",md:"o49ib41"},Ms={horizontal:"o49ib42",diagonalDown:"o49ib43",diagonalUp:"o49ib44"},ir=({point:e,label:n,pull:r,size:o,attributes:a,dragHandlers:i,keyboardHandlers:s})=>(0,t.jsx)("div",{"aria-label":n,className:Ms[r],role:"button",style:{left:e.x,top:e.y},tabIndex:0,...a,...i,...s,children:(0,t.jsx)("span",{"aria-hidden":"true",className:Es[o]})}),Je=[{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"}],Rs=e=>[...Je].reverse().find(n=>n.width<=e)??Je[0],_s=({shape:e,shapeBox:n,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useCompiledSelector(C=>C.spec.styles.overrides),h=Oe(),u=l.useShapeAnnotationStyles()(e.id),m=Rs(u.borderWidth),x=(0,b.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),g=(C,k)=>{const L=(0,p.findStyleRule)(d,{select:x})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...L,...C}}}),k)},v=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},S=C=>g({color:C},{transient:!0}),y=C=>g({alpha:C},{transient:!0}),P=C=>()=>{g({borderWidth:C}),h.close()};return(0,t.jsxs)(E.Root,{anchorBox:n,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,t.jsx)(E.ColorPicker,{color:u.color,label:s("graph.annotations.shapeToolbar.color"),onChange:S,opacity:u.alpha,onOpacityChange:y,...h.bind("color"),children:(0,t.jsx)(E.Swatch,{color:u.color,opacity:u.alpha})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,t.jsx)(Zn,{size:"sm",title:""}),...h.bind("border"),children:Je.map(C=>(0,t.jsx)(E.MenuItem,{isSelected:C.width===m?.width,onClick:P(C.width),children:s(C.key)},C.width))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:v,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},lr=e=>{const n=l.useLatestRef(e),r=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,b.useCallback)(o=>({onPointerDown:a=>{if(a.button!==0||r.current!==null)return;try{a.currentTarget.setPointerCapture(a.pointerId)}catch{return}a.currentTarget.focus({preventScroll:!0}),a.preventDefault();const i=n.current(o,{handle:a.currentTarget,pointerId:a.pointerId,press:{x:a.clientX,y:a.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[n])},we=(e,n)=>{const r=e.shapes.find(o=>o.id===n);return r===void 0||r.region.anchorType!=="panel"?null:r.region},Os=class extends xe{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return l.readResizedShapeFor(l.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,corner:r,press:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=we(i,n);return c===null?null:{kind:"shape-resize-drag",annotationId:n,region:tr({region:c,corner:r,delta:Ne(o,e,s),minSize:er(s)})}}commit({region:e}){const{annotationId:n,dispatch:r,readInputs:o}=this.params,a=we(o().annotations,n);a===null||nr(a,e)||r(new p.UpdateAnnotationCommand({kind:"shape",id:n,patch:{region:e}}))}},Ns=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return lr((i,s)=>new Os({...s,annotationId:e,corner:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},Ds=[" ","Enter"],sr=e=>{const n=l.useEditorStore(),r=l.useLatestRef(e);return(0,b.useEffect)(()=>()=>Gt(n,r.current),[n,r]),(0,b.useCallback)(o=>({onKeyDown:a=>{if(a.altKey||a.ctrlKey||a.metaKey||a.shiftKey)return;const i=n.getState(),s=r.current.readHeld();if(Ds.includes(a.key)){if(a.preventDefault(),a.repeat)return;if(s!==null){Gt(n,r.current);return}const d=r.current.claim(o);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,o,a.key);c!==null&&(a.preventDefault(),i.claimInteraction(c))}}),[n,r])},Gt=(e,n)=>{const r=n.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),n.commit(r))},Vt=4,Fs=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useCompiledSelector(i=>i.spec.annotations);return sr({readHeld:()=>l.readResizedShapeFor(l.readStanding(o.getState(),"shape-resize-drag"),e),claim:()=>{const i=we(a,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=zs(c,n);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:tr({region:i.region,corner:s,delta:d,minSize:er(n)})}},commit:({region:i})=>{const s=we(a,e);s===null||nr(s,i)||r.dispatch(new p.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},zs=(e,n)=>{const r=q(Vt,n.width),o=q(Vt,n.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},Hs={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},Bs=e=>{const n=ge(),r=Vs(n),o=Us(n);if(r===null)return null;const a=o.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return a===null?null:(0,t.jsx)(Gs,{shape:r,region:a,isSettled:o.resizedRegion===null&&!o.isMoved,isMoved:o.isMoved,...e})},Gs=({shape:e,region:n,isSettled:r,isMoved:o,panelRect:a,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=Ns({annotationId:e.id,panelRect:a}),h=Fs({annotationId:e.id,panelRect:a}),u=l.useShapeAnnotationStyles()(e.id),{rect:m}=l.measureShapeRegion(ut(n),u.borderWidth,a);return(0,t.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(_s,{shape:e,shapeBox:m,panelRect:a,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!o&&fs.map(x=>{const g=bs(m,x);return(0,t.jsx)(ir,{point:{x:a.x+g.x,y:a.y+g.y},label:c(`graph.annotations.shapeToolbar.resize.${x}`),pull:Hs[x],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":x},dragHandlers:d(x),keyboardHandlers:h(x)},x)})]})},Vs=e=>{const n=l.useCompiledSelector(r=>r.spec.annotations.shapes);return e===null?null:n.find(r=>r.id===e)??null},Us=e=>l.useEditorState((0,se.useShallow)(n=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(n,"shape-resize-drag"),e)?.region??null,isMoved:l.readMovedAnnotationFor(l.readStanding(n,"move-drag"),e)!==null})),Ws=({textColor:e,...n})=>(0,t.jsxs)(l.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 Pe="textStyle",cr=new Set(["paragraph","heading"]),$s=e=>{const n=dr(e),r=Js(e);return{color:Se(n.map(o=>Qs(Ge(o)?.color))),font:Se(n.map(o=>Ys(Ge(o)))),fontSize:Se(n.map(o=>ec(Ge(o)?.fontSize))),alignment:Se(r.map(o=>tc(o.attrs?.textAlign)))}},qs=(e,n)=>ht(e,r=>r.type==="text"?Xs(r,n):r),Ks=e=>dr(e).length>0,Zs=(e,n)=>ht(e,r=>cr.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:n}}:r),ht=(e,n)=>n(e.content===void 0?e:{...e,content:e.content.map(r=>ht(r,n))}),Xs=(e,n)=>{const r=e.marks??[],o=r.find(i=>i.type===Pe),a={type:Pe,attrs:{...o?.attrs,...n}};return{...e,marks:o===void 0?[...r,a]:r.map(i=>i===o?a:i)}},Ge=e=>e.marks?.find(n=>n.type===Pe)?.attrs,Ys=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),dr=e=>pt(e,n=>n.type==="text"),Js=e=>pt(e,n=>cr.has(n.type??"")),pt=(e,n)=>[...n(e)?[e]:[],...(e.content??[]).flatMap(r=>pt(r,n))],Se=e=>{const[n,...r]=e;return n===void 0?null:r.every(o=>o===n)?n:null},Qs=e=>typeof e=="string"&&e.length>0?e:void 0,ec=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,tc=e=>e==="left"||e==="center"||e==="right"?e:void 0;var ur=[{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:l.RICH_TEXT_FONT_FAMILIES[e]??e})),nc=e=>ur.find(n=>n.id===(e??"modern"))??null;var hr=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:15,key:"graph.annotations.textToolbar.fontSize.medium"},{size:18,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:30,key:"graph.annotations.textToolbar.fontSize.huge"}],rc=e=>hr.find(n=>n.size===(e??15))??null,oc=e=>`${e}px`,ac=[{alignment:"left",Icon:En},{alignment:"center",Icon:Ln},{alignment:"right",Icon:In}],ic=({annotation:e,textBox:n,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useCompiledSelector(f=>f.spec.styles.overrides),h=l.useEditorStore(),u=Oe(),m=l.useTextAnnotationStyles()(e.id),x=$s(e.content),g=nc(x.font),v=rc(x.fontSize),S=x.color??m.textColor,y=(0,b.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),P=(f,w)=>{const H=(0,p.findStyleRule)(d,{select:y})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:y,declarations:{...H,...f}}}),w)},C=(f,w)=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:f}),w)},k=()=>h.getState().caret?.editor?.getJSON()??e.content,L=(f,w)=>{const H=k(),U=h.getState().caret?.editor??null;if(U!==null&&!Ks(H)){U.chain().focus().setMark(Pe,f).run();return}C({content:qs(H,f)},w)},R=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},O=f=>P(lc(f),{transient:!0}),_=f=>L({color:f},{transient:!0}),I=f=>()=>{L({font:f}),u.close()},M=f=>()=>{L({fontSize:f}),u.close()},A=f=>C({content:Zs(k(),f)});return(0,t.jsxs)(E.Root,{anchorBox:n,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,t.jsx)(E.ColorPicker,{color:m.background,label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:O,...u.bind("background"),children:(0,t.jsx)(E.Swatch,{color:m.background==="transparent"?gn:m.background})}),(0,t.jsx)(E.ColorPicker,{color:S,label:s("graph.annotations.textToolbar.color"),onChange:_,...u.bind("color"),children:(0,t.jsx)(Ws,{size:"sm",textColor:S,title:""})}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,t.jsx)("span",{style:{fontFamily:g?.fontFamily},children:"Aa"}),...u.bind("font"),children:ur.map(f=>(0,t.jsx)(E.MenuItem,{isSelected:f.id===g?.id,onClick:I(f.id),children:(0,t.jsx)("span",{style:{fontFamily:f.fontFamily},children:s(f.key)})},f.id))}),(0,t.jsx)(E.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:v===null?"":s(v.key),...u.bind("fontSize"),children:hr.map(f=>(0,t.jsx)(E.MenuItem,{isSelected:f.size===v?.size,onClick:M(f.size),children:(0,t.jsx)("span",{style:{fontSize:oc(f.size)},children:s(f.key)})},f.size))}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(sc,{current:x.alignment??"center",onPick:A}),(0,t.jsx)(E.Separator,{}),(0,t.jsx)(E.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:R,children:(0,t.jsx)(_e,{size:"sm",title:""})})]})},lc=e=>e==="transparent"?{background:bn}:{background:e,alpha:na(e)?p.TEXT_ANNOTATION_FADE_ALPHA:1},sc=({current:e,onPick:n})=>{const r=l.useI18n(),o=a=>()=>n(a);return(0,t.jsx)(t.Fragment,{children:ac.map(a=>(0,t.jsx)(E.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${a.alignment}`),isPressed:a.alignment===e,onClick:o(a.alignment),children:(0,t.jsx)(a.Icon,{size:"sm",title:""})},a.alignment))})},cc=["left","right"];var pr=({width:e})=>q(60,e),dc=(e,n)=>({x:n==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),mr=({at:e,width:n,align:r,edge:o,delta:a,minWidth:i,panelWidth:s})=>{if(a===0)return{at:e,width:n,shift:0};const c=(0,p.alignUnitFractions)(r).x,d=uc(e.offset,s),h=Ye({start:e.x+d-c*n,extent:n,isStartMoving:o==="left",delta:a,minExtent:i}),u=h.start+c*h.extent-d;return{at:{...e,x:u},width:h.extent,shift:u-e.x}},gr=(e,n)=>e.at.x===n.at.x&&e.width===n.width,uc=(e,n)=>e?.x===void 0?0:e.unit==="px"?q(e.x,n):e.x,ke=(e,n)=>{const r=e.textAnnotations.find(o=>o.id===n);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},hc=class extends xe{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return l.readResizedTextFor(l.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,edge:r,press:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=ke(i,n);if(c===null)return null;const d=Ne(o,e,s).x;return{kind:"text-resize-drag",annotationId:n,delta:d,...mr({...c,edge:r,delta:d,minWidth:pr(s),panelWidth:s.width})}}commit(e){const{annotationId:n,dispatch:r,readInputs:o}=this.params,a=ke(o().annotations,n);a===null||gr(a,e)||r(new p.UpdateAnnotationCommand({kind:"text",id:n,patch:{at:e.at,width:e.width}}))}},pc=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useCompiledSelector(i=>i.spec.annotations),panelRect:n});return lr((i,s)=>new hc({...s,annotationId:e,edge:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},mc=4,gc=({annotationId:e,panelRect:n})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useCompiledSelector(s=>s.spec.annotations),i=(s,c)=>{const d=ke(a,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,...mr({...d,edge:s,delta:c,minWidth:pr(n),panelWidth:n.width})}};return sr({readHeld:()=>l.readResizedTextFor(l.readStanding(o.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const h=xc(d,n);return h===null?null:i(c,s.delta+h)},commit:s=>{const c=ke(a,e);c===null||gr(c,s)||r.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},xc=(e,n)=>{const r=q(mc,n.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},vc=e=>{const n=ge(),r=bc(n),o=Sc(n),a=l.useEditorState(s=>s.caret?.annotationId===n),i=Cc(e.panelRect,n,o.resized);return r===null||i===null?null:(0,t.jsx)(fc,{annotation:r,textBox:i,isSettled:o.resized===null&&!o.isMoved,isMoved:o.isMoved,isResizable:r.at.anchorType==="panel",hasCaret:a,...e})},fc=({annotation:e,textBox:n,isSettled:r,isMoved:o,isResizable:a,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),u=pc({annotationId:e.id,panelRect:s}),m=gc({annotationId:e.id,panelRect:s});return(0,t.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,t.jsx)(ic,{annotation:e,textBox:n,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),a&&!o&&!i&&cc.map(x=>{const g=dc(n,x);return(0,t.jsx)(ir,{point:{x:s.x+g.x,y:s.y+g.y},label:h(`graph.annotations.textToolbar.resize.${x}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":x},dragHandlers:u(x),keyboardHandlers:m(x)},x)})]})},bc=e=>{const n=l.useCompiledSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:n.find(r=>r.id===e)??null},Sc=e=>l.useEditorState((0,se.useShallow)(n=>e===null?{resized:null,isMoved:!1}:{resized:l.readResizedTextFor(l.readStanding(n,"text-resize-drag"),e),isMoved:l.readMovedAnnotationFor(l.readStanding(n,"move-drag"),e)!==null})),Cc=(e,n,r)=>{const o=l.useResolvedAnnotations(e),a=l.useMeasuredBoxes(),i=l.useChromeStyleReaders(),s=(0,b.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:a,chromeReaders:i}),[e.width,e.height,a,i]);return n===null?null:ar(o,n,r,s)?.rect??null},yc=e=>(0,t.jsx)(l.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"})]})}),jc="var(--_1tyillx0)",Ac={rest:.5,hovered:.75,open:1};var Tc="_1tyillx1",wc={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},Pc="_1tyillx5",kc={closed:"_1tyillx6",open:"_1tyillx7"},Lc=({interaction:e,panelRect:n})=>{const r=l.useEditorStore(),o=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,a=Ic(e),i=(0,b.useMemo)(()=>{if(o===null)return null;const s=(0,p.projectAnchorToPanel)(o.position,n);return{center:s,radius:19*Ac[a],target:{kind:"observation",cursor:(0,p.toPanelCursor)(s,n)}}},[o,n,a]);return(0,b.useEffect)(()=>{r.getState().setMenuTrigger(i)},[r,i]),(0,b.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),o===null||i===null?null:(0,t.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":a,className:(0,$.default)(Tc,wc[a]),style:{left:n.x+i.center.x,top:n.y+i.center.y,...(0,ln.assignInlineVars)({[jc]:o.color})},children:(0,t.jsx)("span",{className:(0,$.default)(Pc,kc[a==="open"?"open":"closed"]),children:(0,t.jsx)(yc,{size:"lg"})})})},Ic=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",Ec='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Mc=(e,n)=>{const{chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,b.useEffect)(()=>{if(n===null)return;const a=i=>{if(i.key!=="Tab"||i.defaultPrevented||!pe(i.target,e,r)||o.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...n.querySelectorAll(Ec)];if(s.length===0)return;i.preventDefault();const c=s.findIndex(d=>d===document.activeElement);s[c===-1?i.shiftKey?s.length-1:0:(c+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,n,r,o])},Rc=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}]`,Le=(e,n,r)=>{if(typeof document.elementsFromPoint!="function")return null;const o=document.elementsFromPoint(e,n);return _c(o,r)},_c=(e,n)=>{for(const r of e){const o=r.closest(Rc);if(o===null||!n.contains(o))continue;const a=Oc(o);if(a!==null)return a;if(o!==r)return null}return null},Oc=e=>{const n=e.getAttribute(l.EDIT_TARGET_KIND_ATTRIBUTE);if(n!=="annotation")return null;const r=e.getAttribute(l.EDIT_TARGET_ID_ATTRIBUTE);return r===null||r===""?null:{kind:n,id:r}},Nc=e=>{const{selectionStore:n,chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,b.useEffect)(()=>{let a=null;const i=d=>{const{caret:h}=o.getState(),u=h===null?null:Le(d.clientX,d.clientY,e);u!==null&&u.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:u}=n.getState();h.length!==0&&(pe(d.target,e,r)||u())},c=d=>{n.getState().selection.length!==0&&pe(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(pe(document.activeElement,e,r)||n.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[o,n,e,r])},Dc=new Set(["discrete","datetime"]),Fc=({hover:e,layers:n,scales:r,parsingLocale:o})=>{const{primary:a,intersection:i}=e;if(a===null)return null;const s=n.find(v=>v.id===a.layerId);if(s===void 0)return null;const c=(0,p.readObservationIndex)(a),d=i?.intersects!==!1,h=(0,p.readBroadestObservationsScope)(s),u=d||!Hc(r)?h:"x-value",m=Bc(s,c,u,h,o);if(m===null)return null;const x=s.data.getAt(c),g=x===null?null:(0,p.buildObservationPredicate)(s,x);return{layerId:s.id,observationIndex:c,observationPredicate:g,target:m,isOnObservation:d}},zc=(e,n,r)=>{if(!e.isOnObservation||e.target.scope!=="series")return null;const o=n.find(a=>a.id===e.layerId);return o===void 0?null:(0,p.buildObservationsTarget)({layer:o,observationIndex:e.observationIndex,scope:"data-point",parsingLocale:r})},Hc=e=>{const n=e.x;return n?.kind!=="position"?!1:Dc.has(n.spec.scaleType)},Bc=(e,n,r,o,a)=>{const i=(0,p.buildObservationsTarget)({layer:e,observationIndex:n,scope:r,parsingLocale:a});return i!==null||r===o?i:(0,p.buildObservationsTarget)({layer:e,observationIndex:n,scope:o,parsingLocale:a})},xr=(e,n)=>e.x>=0&&e.x<=n.width&&e.y>=0&&e.y<=n.height,Gc=class extends xe{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return l.readMovedAnnotationFor(l.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:n,press:r,readInputs:o}=this.params,{annotations:a,panelRect:i}=o(),s=(0,p.findAnnotation)(a,n);if(s===null)return null;const c=(0,p.clampAnnotationTranslation)(s,Ne(r,e,i));return c===null?null:{kind:"move-drag",annotationId:n,translation:c}}commit({translation:e}){const{annotationId:n,dispatch:r}=this.params;Ol(e)&&r(new p.MoveAnnotationCommand({id:n,translation:e}))}},Vc=e=>{const{stampedTarget:n,observations:r,canSelectGraph:o,isWithinFrame:a,caretAnnotationId:i}=e;return i!==null&&n?.id===i?{kind:"keep-caret"}:n!==null?{kind:"select-annotation",target:n}:r!==null?Uc(r):o&&a?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},Uc=({layerId:e,observationIndex:n,observationPredicate:r,target:o,isOnObservation:a})=>o.scope==="x-value"?{kind:"select-band",target:o}:a?{kind:"select-observations",target:o,observation:{layerId:e,observationIndex:n,predicate:r}}:{kind:"select-observations",target:o,observation:null},Wc=(e,n,r)=>{const{commands:o,selectionStore:a,store:i}=l.useGraphContext(),s=l.useEditorStore(),{engine:c,overlayRef:d}=l.useHoverContext(),h=l.useCompiledSelector(C=>C.spec.annotations),u=l.MODE_SURFACES[l.useGraphMode()],m=u.observationsPress,x=u.tolerance,g=u.annotations,v=l.useLatestRef(u.graphPress),S=l.useLatestRef({annotations:h,panelRect:r}),y=l.useLatestRef(n),P=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>P.current?.finish(!1),[]),(0,b.useEffect)(()=>{const C=f=>{if(!g)return null;const{editTargetUnderPointer:w,standingInteraction:H}=s.getState();return w!==null&&H===null&&f.pointerType==="mouse"&&Ve(f.target,e)?w:Le(f.clientX,f.clientY,e)},k=()=>d.current?.getBoundingClientRect()??null,L=f=>{if(!m||!Ve(f.target,e))return null;const w=k();if(w===null)return null;const H={x:f.clientX-w.left,y:f.clientY-w.top};if(!xr(H,w))return null;c.setViewport({width:w.width,height:w.height});const U=c.query((0,p.toPanelCursor)(H,w),x??void 0),{layers:re,scales:Y,config:ce}=i.getState().compiled;return Fc({hover:U,layers:re,scales:Y,parsingLocale:ce.parsingLocale})},R=f=>{const w=e.getBoundingClientRect();return{x:f.clientX-w.left,y:f.clientY-w.top}},O=(f,w)=>{if(P.current!==null||!l.canMoveAnnotationOnCanvas(S.current.annotations,w.id))return;try{e.setPointerCapture(f.pointerId)}catch{return}f.preventDefault();const H=new Gc({handle:e,pointerId:f.pointerId,annotationId:w.id,press:{x:f.clientX,y:f.clientY},readInputs:()=>S.current,editorStore:s,dispatch:o.dispatch,onSettled:()=>{P.current=null}});P.current=H,H.start()},_=f=>({stampedTarget:C(f),observations:L(f),canSelectGraph:v.current,isWithinFrame:Ve(f.target,e),caretAnnotationId:s.getState().caret?.annotationId??null}),I=(f,w)=>{const H=a.getState(),{setPressContext:U}=s.getState();switch(w.kind){case"select-annotation":H.setSelection([w.target]),U(null),O(f,w.target);return;case"select-observations":H.setSelection([w.target]),U({point:R(f),observation:w.observation});return;case"select-band":case"select-graph":H.setSelection([w.target]),U({point:R(f),observation:null});return;case"clear":H.clearSelection(),U(null);return;default:throw new p.InternalError({message:`No press outcome for: ${JSON.stringify(w)}`})}},M=f=>{if(f.button!==0||Ze(f.target)||_n(f,y.current,s.getState().menuTrigger))return;const w=Vc(_(f));w.kind!=="keep-caret"&&(s.getState().setCaret(null),I(f,w))},A=f=>{if(Ze(f.target))return;const w=L(f),{layers:H,config:U}=i.getState().compiled,re=w===null?null:zc(w,H,U.parsingLocale);if(w!==null&&re!==null){a.getState().setSelection([re]),s.getState().setPressContext({point:R(f),observation:{layerId:w.layerId,observationIndex:w.observationIndex,predicate:w.observationPredicate}});return}if(!g)return;const Y=Le(f.clientX,f.clientY,e);Y!==null&&S.current.annotations.textAnnotations.some(ce=>ce.id===Y.id)&&(a.getState().setSelection([Y]),s.getState().setCaret(Y.id))};return document.addEventListener("pointerdown",M),document.addEventListener("dblclick",A),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("dblclick",A)}},[e,s,a,i,o,S,y,v,c,d,m,x,g])},Ve=(e,n)=>e instanceof Node&&n.contains(e),$c=e=>{const{selectionStore:n,commands:r,chartId:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef(l.useCompiledSelector(u=>u.spec.annotations.textAnnotations)),s=l.MODE_SURFACES[l.useGraphMode()].annotations,c=(0,b.useCallback)(u=>{const{selection:m}=n.getState(),x=s?Xe(m):null;x!==null&&(u.preventDefault(),r.dispatch(new p.RemoveAnnotationCommand({id:x})),e.focus({preventScroll:!0}))},[e,r,n,s]),d=(0,b.useCallback)(u=>{if(Ce(u.target,o))return;const m=s?Xe(n.getState().selection):null;m!==null&&i.current.some(x=>x.id===m)&&(u.preventDefault(),a.getState().setCaret(m))},[a,n,i,o,s]),h=(0,b.useCallback)(u=>{const m=a.getState(),x=m.standingInteraction?.kind;if(x!==void 0){x!=="chrome-popup"&&m.releaseInteraction(x);return}if(m.caret!==null){m.setCaret(null),e.focus({preventScroll:!0});return}return Ce(u.target,o)?e.focus({preventScroll:!0}):n.getState().clearSelection()},[a,n,e,o]);(0,b.useEffect)(()=>{const u=m=>{if(!pe(m.target,e,o)||xi(m.target))return;const x=qc(m.target),g=a.getState().caret!==null&&!Ce(m.target,o);if(!(x&&!g))switch(m.key){case"Escape":return h(m);case"Enter":return x?void 0:d(m);case"Delete":case"Backspace":return x?void 0:c(m);default:return}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c,d,h,o,a])},qc=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Kc=()=>{const e=l.MODE_SURFACES[l.useGraphMode()].observationMenu,n=l.useHoverState(s=>e?s.hover.primary:null),{layers:r,coordSystem:o}=l.useCompiledSelector((0,se.useShallow)(s=>({layers:s.layers,coordSystem:s.coordSystem}))),{anchorResolver:a}=l.useGraphContext(),i=l.useStyleResolver();return(0,b.useMemo)(()=>{if(n===null)return null;const s=r.find(h=>h.id===n.layerId);if(s===void 0)return null;const c=a.resolve(s.geom,n.observation,{coordSystem:o,position:s.position,purpose:"pin"});if(c===null)return null;const d=(0,p.createObservationAnchorBuilder)(s)(n.observation);return d===null?null:{position:c,color:i.geomReaders(s).get("color",n.observation),layer:s,at:d,observation:n.observation}},[n,r,o,a,i])},Zc={kind:"idle"},vr=()=>{const e=l.useEditorState(o=>o.standingInteraction),n=l.useEditorState(o=>o.chromeUnderPointer),r=Kc();return(0,b.useMemo)(()=>e!==null?e:r===null?Zc:{kind:"trigger",anchor:r,isEngaged:n==="menu-trigger"},[e,r,n])},Xc=(e,n,r)=>{const o=l.useEditorStore(),{selectionStore:a}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(n),h=l.useLatestRef(r);(0,b.useEffect)(()=>{const u=S=>_n(S,d.current,o.getState().menuTrigger),m=S=>{if(u(S)||a.getState().selection.length>0)return;const y=h.current,P=d.current,C={x:S.clientX-P.x,y:S.clientY-P.y},k=xr(C,y)?s.query((0,p.toPanelCursor)(C,y)):p.RESTING_HOVER_STATE;i.getState().setHoverState(k)};let x=!1;const g=()=>{x=c.current.kind==="menu"},v=S=>{if(Ze(S.target))return;const{claimInteraction:y,releaseInteraction:P}=o.getState();if(!u(S)||x){P("menu"),x&&m(S);return}const C=c.current;C.kind==="trigger"&&y({kind:"menu",anchor:C.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",v),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",v)}},[o,a,c,i,s,d,h])},Yc=(e,n)=>{const r=l.useEditorStore(),o=l.useLatestRef(n),a=l.MODE_SURFACES[l.useGraphMode()].annotations;(0,b.useEffect)(()=>{let i=null,s=null;const c=v=>{const{menuTrigger:S}=r.getState();return S===null?null:(0,p.isPointWithinEditMenuTrigger)(v,S)?"menu-trigger":null},d=()=>{i=null;const v=s;if(v===null)return;const S=o.current,y=r.getState();if(y.setChromeUnderPointer(c({x:v.x-S.x,y:v.y-S.y})),Ue(y.standingInteraction)||!a)return;const P=Le(v.x,v.y,e);y.setEditTargetUnderPointer(P)},h=()=>{i===null&&(i=requestAnimationFrame(d))},u=()=>{const v=r.getState();v.setChromeUnderPointer(null),v.setEditTargetUnderPointer(null)},m=v=>{s={x:v.clientX,y:v.clientY},h()},x=()=>{s=null,i!==null&&(cancelAnimationFrame(i),i=null),u()},g=r.subscribe((v,S)=>{!Ue(S.standingInteraction)||Ue(v.standingInteraction)||s!==null&&h()});return e.addEventListener("pointermove",m),e.addEventListener("pointerleave",x),()=>{i!==null&&cancelAnimationFrame(i),g(),e.removeEventListener("pointermove",m),e.removeEventListener("pointerleave",x),u()}},[e,r,o,a])},Ue=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}},Ut="editor",Wt=[],Jc=(e,n,r,o)=>{const a=vr(),{store:i}=l.useHoverContext(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useGraphSelection().length>0,h=l.MODE_SURFACES[l.useGraphMode()].holdsHoverWhileSelected,u=l.useEditorState(v=>v.menuTrigger),m=a.kind==="menu",x=(0,b.useMemo)(()=>u===null?Wt:[(0,p.buildEditMenuTriggerRegion)(u)],[u]);Yc(e,n),Wc(e,n,r),Xc(a,n,r),Nc(e),$c(e),Mc(e,o),(0,b.useEffect)(()=>s.subscribe((v,S)=>{v.selection!==S.selection&&c.getState().setPressContext(null)}),[c,s]),(0,b.useEffect)(()=>(i.getState().publishPointerRegions(Ut,x),()=>i.getState().publishPointerRegions(Ut,Wt)),[i,x]);const g=m||d&&h;(0,b.useEffect)(()=>(i.getState().setPointerSuspended(g),()=>i.getState().setPointerSuspended(!1)),[i,g]),(0,b.useEffect)(()=>{if(!d||!h)return;const v=i.getState();v.setHoverState(p.RESTING_HOVER_STATE),v.setTooltipAnchor(null)},[i,d,h])},Qc=({frameElement:e,panelRect:n})=>{const{measureRef:r,screenRect:o}=l.useElementScreenRect(),{selectionStore:a}=l.useGraphContext(),i=l.useEditorStore(),s=l.useEditorState(h=>h.caret?.annotationId??null),c=l.useGraphMode(),d=(0,b.useRef)(c);return(0,b.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,b.useEffect)(()=>()=>{const h=i.getState();h.releaseInteraction("menu"),h.setCaret(null)},[i]),(0,b.useEffect)(()=>{if(d.current===c)return;d.current=c;const h=i.getState();h.releaseInteraction("menu"),h.setCaret(null),h.setEditTargetUnderPointer(null),a.getState().clearSelection()},[c,i,a]),o===null?null:(0,t.jsxs)(fi,{children:[s!==null&&(0,t.jsx)(ed,{annotationId:s,panelRect:n}),(0,t.jsx)(td,{frameElement:e,frameRect:o,panelRect:n})]})},ed=({annotationId:e,panelRect:n})=>{const r=l.useEditorStore(),{textAnnotations:o}=l.useResolvedAnnotations(n);return(0,b.useEffect)(()=>{o.some(({id:a})=>a===e)||r.getState().setCaret(null)},[e,o,r]),null},td=({frameElement:e,frameRect:n,panelRect:r})=>{const o=(0,b.useMemo)(()=>({x:n.left+r.x,y:n.top+r.y}),[n.left,n.top,r.x,r.y]),[a,i]=(0,b.useState)(null);return Jc(e,o,r,a),(0,t.jsx)(nd,{frameElement:e,frameRect:n,panelOrigin:o,panelRect:r,boxRef:i})},nd=({frameElement:e,frameRect:n,panelOrigin:r,panelRect:o,boxRef:a})=>{const i=lt(),s=vr(),c=l.MODE_SURFACES[l.useGraphMode()].annotations;return(0,t.jsx)(l.OverlayPortal,{rect:n,zIndex:l.Z_INDEX.editorOverlay,container:i,"data-testid":"editor-overlay",boxRef:a,children:(0,t.jsxs)(l.PortalThemeProvider,{children:[c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(gs,{panelRect:o,panelOrigin:r,frameRect:n,frameElement:e}),(0,t.jsx)(Bs,{panelRect:o,frameRect:n,frameElement:e}),(0,t.jsx)(Gl,{panelRect:o,frameRect:n,frameElement:e}),(0,t.jsx)(vc,{panelRect:o,frameRect:n,frameElement:e}),(0,t.jsx)(js,{panelRect:o}),(0,t.jsx)(Is,{panelRect:o}),(0,t.jsx)(cl,{panelRect:o}),(0,t.jsx)(ys,{panelRect:o})]}),(0,t.jsx)(Lc,{interaction:s,panelRect:o}),(0,t.jsx)(nl,{interaction:s,panelOrigin:r})]})})},rd=({slots:e,mode:n,...r})=>(0,t.jsx)(pn,{locale:l.useGraphLocale(),children:(0,t.jsx)(l.EditorProvider,{children:(0,t.jsx)(l.InlineEditorsProvider,{editors:pi,children:(0,t.jsx)(l.GraphRendererBody,{slots:(0,b.useMemo)(()=>({EditorSurface:Qc,...e}),[e]),mode:n,...r})})})}),fr=(0,b.createContext)(null),br=({labelId:e,controlId:n,children:r})=>{const o=(0,b.useMemo)(()=>{let a=null;return{labelId:e,controlId:n,claimControlId:i=>(a??=i,a===i)}},[e,n]);return(0,t.jsx)(fr.Provider,{value:o,children:r})},ee=({id:e,ariaLabel:n,ariaLabelledBy:r},o=!0)=>{const a=(0,b.useContext)(fr),i=(0,b.useId)(),[s]=(0,b.useState)(()=>o?a?.claimControlId(i)??!1:!1),c=e??(s?a?.controlId:void 0),d=r??(n===void 0?a?.labelId:void 0);return{...c!==void 0&&{id:c},...n!==void 0&&{"aria-label":n},...d!==void 0&&{"aria-labelledby":d}}};var od={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},Sr=({label:e,icon:n,onClick:r,variant:o="default",isDisabled:a,ariaLabel:i,ariaLabelledBy:s,id:c})=>{const d=ee({id:c,ariaLabel:i,ariaLabelledBy:s}),h=o==="tile";return(0,t.jsxs)("button",{type:"button",className:od[o],disabled:a,onClick:r,...d,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})]})},mt=(0,b.createContext)(null),D=()=>{const e=(0,b.useContext)(mt);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},Cr=({children:e,onKeyDown:n,...r})=>{const o=(0,b.useContext)(mt),a=i=>{if(n?.(i),!o||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?o.undo():o.redo())};return(0,t.jsx)("div",{onKeyDown:a,...r,children:e})},yr="keyboard",De=e=>{const n=(0,b.useRef)(!1),r=(0,b.useRef)(!1),o=()=>{n.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(n.current){r.current=!0;return}e?.()},commitUnlessHeldKey:a=>{if(a){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{n.current=!0},onKeyUp:o,onBlur:a=>{a.relatedTarget instanceof Node&&a.currentTarget.contains(a.relatedTarget)||o()}}}},ad="eh8dvc0",id="eh8dvc1 uz3g760",ld="eh8dvc2 uz3g761";var jr=({value:e,onChange:n,onCommit:r,min:o,max:a,step:i,placeholder:s,prefix:c,suffix:d,isDisabled:h,hasError:u,ariaLabel:m,ariaLabelledBy:x,id:g})=>{const v=ee({id:g,ariaLabel:m,ariaLabelledBy:x}),{commitUnlessHeldKey:S,gestureHandlers:y}=De(r);return(0,t.jsx)(yt.NumberField.Root,{className:ad,value:e,onValueChange:P=>n(P),onValueCommitted:(P,C)=>{S(C.reason===yr)},min:o,max:a,step:i,disabled:h,children:(0,t.jsxs)(Cr,{className:id,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:c}),(0,t.jsx)(yt.NumberField.Input,{className:ld,placeholder:s,...y,"aria-invalid":u===!0?!0:void 0,...v}),d!==void 0&&(0,t.jsx)("span",{className:"eh8dvc3",children:d})]})})},sd="_1b7s5f0",oe={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},cd="_1b7s5f7";var dd=6,Ar=({options:e,value:n,onChange:r,onCommit:o,columns:a,itemLayout:i="tile",isDisabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const u=ee({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="swatch",{commitAfterChange:x,gestureHandlers:g}=De(o);return(0,t.jsx)(hn.RadioGroup,{className:(0,$.default)(sd,ud(a??e.length)),value:n,onValueChange:v=>{r(v),x()},...g,disabled:s,...u,children:e.map(v=>(0,t.jsxs)(un.Radio.Root,{value:v.value,disabled:v.isDisabled,className:(0,$.default)(cd,m&&"_1b7s5f8"),"aria-label":m?v.label:void 0,children:[v.icon,!m&&(0,t.jsx)("span",{className:"_1b7s5f9",children:v.label})]},v.value))})},ud=e=>{switch(Math.min(Math.max(Math.round(e),1),dd)){case 1:return oe[1];case 2:return oe[2];case 3:return oe[3];case 4:return oe[4];case 5:return oe[5];default:return oe[6]}},hd="_1g5x15w0 uz3g760",pd="_1g5x15w1",md="_1g5x15w2",$t="_1g5x15w3",gd="_1g5x15w4",xd="_1g5x15w5",vd="_1g5x15w6",fd="_1g5x15w7";var Tr=({options:e,value:n,onChange:r,placeholder:o,isDisabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,t.jsxs)(K.Select.Root,{value:n,onValueChange:u=>u!==null&&r(u),disabled:a,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,t.jsxs)(K.Select.Trigger,{className:hd,"data-error":i===!0,...h,children:[(0,t.jsx)(K.Select.Value,{className:pd,children:u=>bd(e,u,o)}),(0,t.jsx)(K.Select.Icon,{className:$t,children:(0,t.jsx)(me,{size:"sm"})})]}),(0,t.jsx)(K.Select.Portal,{container:l.resolvePortalContainer(),children:(0,t.jsx)(l.PortalThemeProvider,{children:(0,t.jsx)(K.Select.Positioner,{className:gd,sideOffset:4,alignItemWithTrigger:!1,children:(0,t.jsx)(K.Select.Popup,{className:xd,children:e.map(u=>(0,t.jsxs)(K.Select.Item,{value:u.value,disabled:u.isDisabled,className:vd,children:[u.icon,(0,t.jsxs)("span",{className:fd,children:[(0,t.jsx)(K.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,t.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,t.jsx)(K.Select.ItemIndicator,{className:$t,children:(0,t.jsx)(kn,{size:"sm"})})]},u.value))})})})})]})},bd=(e,n,r)=>n===null?(0,t.jsx)("span",{className:md,children:r}):Sd(e,n),Sd=(e,n)=>e.find(r=>r.value===n)?.label??n,Cd="vod76w0",yd="vod76w1",jd="vod76w2",Ad="vod76w3",Td="vod76w4",wd="vod76w5";var wr=({value:e,onChange:n,onCommit:r,min:o,max:a,step:i,suffix:s,formatValue:c,isDisabled:d,ariaLabel:h,ariaLabelledBy:u})=>{const m=ee({ariaLabel:h,ariaLabelledBy:u},!1),x=Pd(e,s,c),{commitUnlessHeldKey:g,gestureHandlers:v}=De(r);return(0,t.jsxs)("div",{className:Cd,children:[(0,t.jsx)(Z.Slider.Root,{className:yd,value:e,onValueChange:S=>n(S),onValueCommitted:(S,y)=>{g(y.reason===yr)},min:o,max:a,step:i,disabled:d,children:(0,t.jsx)(Z.Slider.Control,{className:jd,children:(0,t.jsxs)(Z.Slider.Track,{className:Ad,children:[(0,t.jsx)(Z.Slider.Indicator,{className:Td}),(0,t.jsx)(Z.Slider.Thumb,{className:wd,...v,...m})]})})}),x!==null&&(0,t.jsx)("span",{className:"vod76w6",children:x})]})},Pd=(e,n,r)=>r!==void 0?r(e):n!==void 0?`${e}${n}`:null,kd="_1hyrlw60",Ld="_1hyrlw61",Pr=({isChecked:e,onChange:n,isDisabled:r,ariaLabel:o,ariaLabelledBy:a,id:i})=>{const s=ee({id:i,ariaLabel:o,ariaLabelledBy:a});return(0,t.jsx)(jt.Switch.Root,{checked:e,onCheckedChange:c=>n(c),disabled:r,className:kd,...s,children:(0,t.jsx)(jt.Switch.Thumb,{className:Ld})})},Id="uz3g761",Ed="tpcnun0 uz3g760",kr=({value:e,onChange:n,onCommit:r,placeholder:o,isDisabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,t.jsx)(Cr,{className:Ed,"data-error":i===!0,children:(0,t.jsx)(vo.Input,{className:Id,value:e,onValueChange:u=>n(u),onBlur:r,placeholder:o,disabled:a,"aria-invalid":i===!0?!0:void 0,...h})})},Md="cnu9yl0",Rd="cnu9yl1";var Lr=({options:e,value:n,onChange:r,onCommit:o,itemLayout:a="inline",isDisabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c}),u=a==="stacked",{commitAfterChange:m,gestureHandlers:x}=De(o);return(0,t.jsx)(hn.RadioGroup,{className:Md,value:n,onValueChange:g=>{r(g),m()},...x,disabled:i,...h,children:e.map(g=>(0,t.jsxs)(un.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,$.default)(Rd,u&&"cnu9yl2"),"aria-label":_d(g,u),children:[g.icon,Ir(g,u)&&(0,t.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Ir=(e,n)=>e.icon===void 0||n,_d=(e,n)=>{if(!Ir(e,n))return e.label},Er={ToggleGroup:Lr,Switch:Pr,Slider:wr,RadioGrid:Ar,Button:Sr,TextField:kr,NumberField:jr,Select:Tr},Mr=(0,b.createContext)(Er),Od=({controls:e,children:n})=>{const r=(0,b.useMemo)(()=>({...Er,...e}),[e]);return(0,t.jsx)(Mr.Provider,{value:r,children:n})},F=()=>(0,b.useContext)(Mr),Nd="_12lhx9e0",Rr=({children:e})=>(0,t.jsx)("div",{className:Nd,children:e}),Dd="_139ohwv0",G=({children:e})=>(0,t.jsx)("div",{className:Dd,children:e}),_r=(0,b.createContext)(null),Fd=_r.Provider,Or=()=>{const e=(0,b.useContext)(_r);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},zd="_1jlczkt0",Nr="data-graphy-editor-panel",Hd={List:G,Grid:Rr};function Bd(e){if(e===void 0)return!1;const n=e.split(/\s+/);return n.includes("_1ii3bsb0")||n.includes("_1ii3bsb1")}var Gd=({handle:e,children:n,controls:r,defaultExpandedSection:o=void 0,className:a})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,b.useState)(()=>o?[o]:[]),u=(0,b.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,t.jsx)(mt.Provider,{value:i,children:(0,t.jsx)(Od,{controls:r,children:(0,t.jsx)(Fd,{value:u,children:(0,t.jsx)(he.Accordion.Root,{[Nr]:"",className:(0,$.default)(zd,a,{[s]:!Bd(a)}),style:c,value:d,onValueChange:m=>h(m),children:n})})})})},gt={Root:Gd,Controls:Hd},qt={stack:"pr583x0",grid:"pr583x1"},Kt="pr583x2",Vd={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},j=({label:e,layout:n="grid",icon:r,children:o})=>{const a=(0,b.useId)(),i=(0,b.useId)();return e===void 0?(0,t.jsx)("div",{className:qt[n],children:(0,t.jsx)("div",{className:Kt,children:o})}):(0,t.jsxs)("div",{className:qt[n],children:[(0,t.jsxs)("label",{id:a,htmlFor:i,className:Vd[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,t.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,t.jsx)("div",{className:Kt,children:(0,t.jsx)(br,{labelId:a,controlId:i,children:o})})]})},Ud=e=>(0,t.jsx)(l.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"})})}),xt="_40zvwv0",vt="_40zvwv1",Wd="_40zvwv2",Dr="_40zvwv3",$d="_40zvwv4 _40zvwv3";var qd="_40zvwv6";var Kd="_40zvwv8",z=({title:e,layout:n="fixed",preview:r,accessory:o,onOpenChange:a,children:i})=>n==="collapsible"?(0,t.jsx)(Xd,{title:e,preview:r,accessory:o,onOpenChange:a,children:i}):n==="inline"&&r===void 0?(0,t.jsx)(Zd,{title:e,accessory:o,children:i}):(0,t.jsxs)("div",{className:xt,children:[(0,t.jsxs)("div",{className:vt,children:[(0,t.jsx)("span",{className:Dr,children:e}),r!==void 0&&(0,t.jsx)("span",{className:"_40zvwv5",children:r}),o!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:o})]}),(0,t.jsx)("div",{children:i})]}),Zd=({title:e,accessory:n,children:r})=>{const o=(0,b.useId)(),a=(0,b.useId)();return(0,t.jsx)("div",{className:xt,children:(0,t.jsxs)("div",{className:vt,children:[(0,t.jsx)("label",{id:o,htmlFor:a,className:$d,children:e}),(0,t.jsx)("span",{className:qd,children:(0,t.jsx)(br,{labelId:o,controlId:a,children:r})}),n!==void 0&&(0,t.jsx)("span",{className:"_40zvwv7",children:n})]})})},Xd=({title:e,preview:n,accessory:r,onOpenChange:o,children:a})=>{const i=l.useI18n();return(0,t.jsxs)(he.Accordion.Item,{value:e,className:xt,onOpenChange:o,children:[(0,t.jsxs)(he.Accordion.Header,{className:vt,render:(0,t.jsx)("div",{}),children:[(0,t.jsx)(he.Accordion.Trigger,{className:Wd,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,t.jsx)("span",{className:Dr,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:Kd,children:(0,t.jsx)(Ud,{size:"sm"})})]}),(0,t.jsx)(he.Accordion.Panel,{children:(0,t.jsx)("div",{children:a})})]})},Fr=({title:e,isChecked:n,onToggle:r,isDisabled:o,preview:a,children:i})=>{const{expandSection:s,collapseAllSections:c}=Or(),{Switch:d}=F(),h=m=>{r(m),m?s(e):c()},u=m=>{m&&!n&&o!==!0&&r(!0)};return(0,t.jsx)(z,{title:e,layout:"collapsible",preview:a,onOpenChange:u,accessory:(0,t.jsx)(d,{isChecked:n,onChange:h,isDisabled:o,ariaLabel:e}),children:i})},Yd={horizontal:["bottom","top"],vertical:["left","right"]},Jd={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Qd={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},Qe=({axis:e,title:n,layout:r="collapsible",preview:o})=>{const a=D(),i=l.useHandleCompiled(a),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:u}=F();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",x=i.config.axes[e],g=i.scales[e],v=g?.spec,S=v?.scaleType==="continuous"?v:void 0;if(m==="circular"||m==="radial"&&S===void 0)return null;const y=v!==void 0&&"reverse"in v?v:void 0,P=v?.scaleType==="continuous"||v?.scaleType==="datetime",C=e==="y"&&S!==void 0&&i.layers.some(T=>T.yScaleType==="primary"&&T.geom==="bar"),k=S?.transform==="log",L=S?.domainMax??null,R=eu(S),O=(T,J)=>T.map(ve=>({value:ve,label:J(ve)})),_=i.guides.axes.find(T=>T.scaleAestheticKey===e)?.position,I=Yd[_==="bottom"||_==="top"||_===void 0&&e==="x"?"horizontal":"vertical"],M=e==="y"?(0,p.readComboLineLayerId)(i.spec):null,A=M===null?void 0:i.spec.layers.find(T=>T.id===M),f=i.guides.legends.drawn.some(T=>I.some(J=>J===T.position)),w=I.map(T=>({value:T,label:s(Jd[T])})),H=O(["auto","edges"],T=>s(T==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),U=O(["linear","log"],T=>s(T==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),re=O(["auto","zero","custom"],T=>s(T==="zero"?"editor.axesPanel.startFrom.zero":T==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Y=O(["auto","custom"],T=>s(T==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),ce=O(["no","yes"],T=>s(T==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Kr=O(["single","double"],T=>s(T==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),Zr=T=>{a.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:T}))},Xr=T=>{a.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:T===""?null:T}),{transient:!0})},Yr=T=>{a.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:T}))},Jr=T=>{a.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:T==="edges"?"edges":"auto"}))},Qr=T=>{a.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:T==="yes"}))},eo=T=>{a.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:T==="log"?"log":"linear"}))},St=T=>{a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...T}),{transient:!0})},to=T=>{T!==null&&St({domainMin:T})},no=T=>{T!==null&&St({domainMax:T})},ro=T=>{if(S){if(T==="custom"){S.zero&&a.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:Zt(g?.domain,"start")}));return}S.domainMin!==null&&a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),a.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:T==="zero"}))}},oo=T=>{const J=T==="custom"?Zt(g?.domain,"end"):null;a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:J}))},ao=T=>{A!==void 0&&a.commands.dispatch(new p.SetLayerYScaleTypeCommand({layerId:A.id,yScaleType:T==="double"?"secondary":"primary"}))},io=T=>{const J=I.find(ve=>ve===T);J&&a.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:J}))};return(0,t.jsx)(z,{title:n??s(Qd[e]),layout:r,preview:o,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.visible"),children:(0,t.jsx)(d,{isChecked:x.isVisible,onChange:Zr})}),A!==void 0&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,t.jsx)(u,{value:A.yScaleType==="secondary"?"double":"single",options:Kr,onChange:ao})}),m==="linear"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.title"),children:(0,t.jsx)(h,{value:x.label??"",onChange:Xr,onCommit:a.commands.seal})}),(0,t.jsx)(j,{label:s("editor.axesPanel.controls.ticks"),children:(0,t.jsx)(d,{isChecked:x.ticks.isVisible,onChange:Yr})})]}),P&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.labels"),children:(0,t.jsx)(u,{value:x.ticks.mode,options:H,onChange:Jr})}),S&&m==="linear"&&!f&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.position"),children:(0,t.jsx)(u,{value:_??x.position,options:w,onChange:io})}),y!==void 0&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.reverse"),children:(0,t.jsx)(u,{value:y.reverse===!0?"yes":"no",options:ce,onChange:Qr})}),S&&!C&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.scale"),children:(0,t.jsx)(u,{value:k?"log":"linear",options:U,onChange:eo})}),S&&!k&&(0,t.jsxs)(t.Fragment,{children:[!C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.startFrom"),children:(0,t.jsx)(u,{value:R,options:re,onChange:ro})}),R==="custom"&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.value"),children:(0,t.jsx)(c,{value:S.domainMin??null,onChange:to,onCommit:a.commands.seal})})]}),(0,t.jsx)(j,{label:s("editor.axesPanel.controls.endAt"),children:(0,t.jsx)(u,{value:L===null?"auto":"custom",options:Y,onChange:oo})}),L!==null&&(0,t.jsx)(j,{label:s("editor.axesPanel.controls.value"),children:(0,t.jsx)(c,{value:L,onChange:no,onCommit:a.commands.seal})})]})]})})},eu=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",Zt=(e,n)=>{const r=n==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},ft=({value:e,onChange:n})=>{const r=D(),o=l.useI18n(),{TextField:a}=F(),i=e!==null&&typeof e!="string",s=c=>n(c===""?null:c);return(0,t.jsx)(j,{label:o("editor.elementsPanel.contentValue"),children:(0,t.jsx)(a,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.seal,isDisabled:i})})},zr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=u=>{o.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},h=u=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isCaptionVisible,onChange:d})}),(0,t.jsx)(ft,{value:c.caption,onChange:h})]})})},Xt=/^[a-z][a-z\d+.-]*:/i,tu={},Hr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isSourceVisible,onChange:d})}),(0,t.jsx)(nu,{source:c.source??tu})]})})},nu=({source:e})=>{const n=D(),r=l.useI18n(),{TextField:o}=F(),a=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";n.commands.dispatch(new p.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!Xt.test(d)&&a({...e,url:`https://${d}`}),n.commands.seal()},s=d=>a({...e,url:d}),c=d=>a({...e,label:d});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,t.jsx)(o,{value:e.url??"",onChange:s,onCommit:i,hasError:Xt.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,t.jsx)(j,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,t.jsx)(o,{value:e.label??"",onChange:c,onCommit:n.commands.seal})})]})},Br=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=u=>{o.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},h=u=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isSubtitleVisible,onChange:d})}),(0,t.jsx)(ft,{value:c.subtitle,onChange:h})]})})},et=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],ru=et.length/2,ou={select:{target:"graph"}},Gr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{RadioGrid:s}=F();if(!a)return null;const c=(0,p.createStyleResolver)().chromeReaders(a.chrome).graph.get("textScale"),d=m=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${m}`}),h=et.map(m=>({value:`${m}`,label:d(m)})),u=m=>{const x=et.find(v=>`${v}`===m);if(x===void 0)return;const g=(0,p.findStyleRule)(a.spec.styles.overrides,ou)?.declarations??{};o.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...g,textScale:x}}}))};return(0,t.jsx)(z,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:n,preview:r??d(c),children:(0,t.jsx)(s,{value:`${c}`,options:h,columns:ru,onChange:u,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Vr=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s}=F();if(!a)return null;const c=a.config.content,d=u=>{o.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},h=u=>{o.commands.dispatch(new p.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)(G,{children:[(0,t.jsx)(j,{label:i("editor.elementsPanel.contentVisible"),children:(0,t.jsx)(s,{isChecked:c.isTitleVisible,onChange:d})}),(0,t.jsx)(ft,{value:c.title,onChange:h})]})})},au=({children:e,...n})=>(0,t.jsx)(gt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Vr,{}),(0,t.jsx)(Br,{}),(0,t.jsx)(zr,{}),(0,t.jsx)(Hr,{}),(0,t.jsx)(Gr,{})]})}),iu=({children:e,...n})=>(0,t.jsx)(gt.Root,{...n,children:e??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Qe,{axis:"x"}),(0,t.jsx)(Qe,{axis:"y"})]})}),Fe=e=>`${e}px`,Ur=e=>`${Math.round(e*100)}%`,lu=e=>`${e}°`,su=24,cu={select:{target:"graph"}},Yt=["dim","desaturate"],du=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=F();if(!a)return null;const d=(0,p.createStyleResolver)().chromeReaders(a.chrome).graph.get("borderRadius"),h=(0,p.readHighlightDimStyle)(a.spec),u=Yt.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),m=g=>{const v=(0,p.findStyleRule)(a.spec.styles.overrides,cu)?.declarations??{};o.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...v,borderRadius:g}}}),{transient:!0})},x=g=>{const v=Yt.find(S=>S===g);v&&o.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:v}))};return(0,t.jsx)(z,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,t.jsx)(s,{value:d,min:0,max:su,step:1,formatValue:Fe,onChange:m,onCommit:o.commands.seal})}),(0,t.jsx)(j,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,t.jsx)(c,{value:h,options:u,onChange:x})})]})})},bt=(e,n)=>{const{colorScheme:r}=l.useThemeContext();return(0,b.useMemo)(()=>{const o=e?.layers.find(a=>a.id===n);return o===void 0?null:(0,p.createStyleResolver)({colorScheme:r}).geomReaders(o)},[e,n,r])},uu=.05,hu=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=F(),d=a?(0,p.findLayerByGeom)(a.spec.layers,"bar"):void 0,h=bt(a,d?.id??null);if(!a||!d||a.coordSystem.type==="polar"&&a.coordSystem.bandAxis===null)return null;const u=v=>{o.commands.dispatch(new p.SetBarWidthCommand({layerId:d.id,width:v}),{transient:!0})},m=v=>{const S=p.BORDER_RADIUS_TOKENS.find(y=>y===v);S&&o.commands.dispatch(new p.SetBarBorderRadiusCommand({layerId:d.id,borderRadius:S}))},x=p.BORDER_RADIUS_TOKENS.map(v=>({value:v,label:i(`editor.graphPanel.barSection.roundingOptions.${v}`)})),g=(0,p.resolveBarBandFraction)(d.params,a.coordSystem.type);return(0,t.jsx)(z,{title:e??i("editor.graphPanel.barSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.barSection.thickness"),children:(0,t.jsx)(s,{value:g,min:p.MIN_BAR_WIDTH,max:p.MAX_BAR_WIDTH,step:uu,formatValue:Ur,onChange:u,onCommit:o.commands.seal})}),(0,t.jsx)(j,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,t.jsx)(c,{value:h?.get("borderRadius")??p.DEFAULT_BAR_BORDER_RADIUS,options:x,onChange:m})})]})})},ze=({children:e})=>{const n=(0,b.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"})]})})]})},He="qdaoth0",pu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,t.jsx)(ze,{children:(0,t.jsx)("path",{className:He,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"})]}),mu=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,t.jsxs)(ze,{children:[(0,t.jsx)("path",{className:He,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"})]})}),gu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(ze,{children:(0,t.jsx)("path",{className:He,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"})]}),xu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,t.jsx)(ze,{children:(0,t.jsx)("path",{className:He,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"})]}),vu={x:.5,y:.5},fu=.2,bu={x:.375,y:.25,width:.25,height:.5},Su={zOrder:"background"},Cu={x:.4,y:.6},yu={x:.6,y:.4},ju="relative-difference",Au=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Button:s}=F();if(!a)return null;const c=()=>{o.commands.dispatch(new p.AddAnnotationCommand({kind:"text",annotation:{...p.TEXT_ANNOTATION_DEFAULTS,content:Tu(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...vu},width:fu}}))},d=()=>{o.commands.dispatch(new p.AddAnnotationCommand({kind:"arrow",annotation:{...p.ARROW_DEFAULTS,start:{anchorType:"panel",...Cu},end:{anchorType:"panel",...yu}}}))},h=()=>{o.commands.dispatch(new p.AddAnnotationCommand({kind:"shape",annotation:{...p.SHAPE_DEFAULTS,...Su,region:{anchorType:"panel",...bu}}}))},u=()=>{const x=(0,p.inferDefaultDifferenceArrowEndpoints)(a);x!==null&&o.commands.dispatch(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...x,label:ju}}))},m=a.coordSystem.type==="cartesian";return(0,t.jsx)(z,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:n,preview:r,children:(0,t.jsxs)(Rr,{children:[(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(xu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(pu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(mu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,t.jsx)(s,{variant:"tile",icon:(0,t.jsx)(gu,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},Tu=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),wu=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{ToggleGroup:s}=F();if(!a)return null;const c=(0,p.readChartType)(a.spec);if(c===null||!(0,p.isComboChartType)(c))return null;const d=p.COMBO_TYPES.map(u=>({value:u,label:i(`editor.graphPanel.comboSection.types.${u}`)})),h=u=>{const m=p.COMBO_TYPES.find(x=>x===u);m&&o.commands.dispatch(new p.SetChartTypeCommand({coordType:"cartesian",comboType:m}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.comboSection.title"),layout:n,preview:r??i(`editor.graphPanel.comboSection.types.${c.comboType}`),children:(0,t.jsx)(s,{value:c.comboType,options:d,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},Pu=.1,ku=20,Lu=({title:e,preview:n})=>{const r=D(),o=l.useHandleCompiled(r),a=l.useI18n(),{NumberField:i,TextField:s}=F();if(!o||o.coordSystem.type==="polar")return null;const c=(0,p.findGoalLineLayer)(o.spec.layers),d=e??a("editor.annotationsPanel.goalSection.title"),h=(0,p.extractConstantValue)(c?.mapping.y),u=typeof h=="number"?h:null,m=v=>{const S=new p.ToggleGoalLineCommand({showGoalLine:v,value:Iu(o),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(S)},x=v=>{if(c===void 0)return;const S=new p.SetRuleLabelCommand({layerId:c.id,label:v===""?null:v});r.commands.dispatch(S,{transient:!0})},g=v=>{if(c===void 0||v===null)return;const S=new p.SetRuleValueCommand({layerId:c.id,value:v});r.commands.dispatch(S,{transient:!0})};return(0,t.jsx)(Fr,{title:d,preview:n,isChecked:c!==void 0,onToggle:m,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:a("editor.annotationsPanel.goalSection.labelControl"),children:(0,t.jsx)(s,{value:c?.params.label??"",placeholder:a("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:x,onCommit:r.commands.seal,ariaLabel:a("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,t.jsx)(j,{label:a("editor.annotationsPanel.goalSection.valueControl"),children:(0,t.jsx)(i,{value:u,placeholder:a("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:a("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},Iu=e=>{const n=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(n.length===0)return 0;const r=Math.max(...n),o=r-Math.min(...n),a=o>0?o:Math.abs(r);if(a===0)return 0;const i=Math.min(ku,Math.max(0,1-Math.floor(Math.log10(a))));return Number((r+a*Pu).toFixed(i))},Eu=({layerId:e,title:n,layout:r="collapsible",preview:o})=>{const a=D(),i=l.useHandleCompiled(a),s=l.useI18n(),{Switch:c}=F();if(!i)return null;const d=e===void 0?i.spec.layers[0]:i.spec.layers.find(_=>_.id===e);if(!d)return null;const{showDataLabels:h,format:u,showStackTotals:m,showCategoryLabels:x}=d.dataLabels,g=i.coordSystem.type==="polar",v=d.geom==="bar",S=d.position==="stack"||d.position==="fill",y=v&&!g&&d.position==="stack",P=v&&(!g||h),C=v||d.geom==="area"&&S;if(!(0,p.canPlaceDataLabels)(d.geom,i.coordSystem.type))return null;const k=_=>{const I=new p.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:_});a.commands.dispatch(I)},L=_=>{const I=new p.SetDataLabelsFormatCommand({layerId:d.id,format:_?"percentage":"absolute"});a.commands.dispatch(I)},R=_=>{const I=new p.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:_});a.commands.dispatch(I)},O=_=>{const I=new p.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:_});a.commands.dispatch(I)};return(0,t.jsx)(z,{title:n??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:o,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,t.jsx)(c,{isChecked:h,onChange:k})}),h&&C&&(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,t.jsx)(c,{isChecked:u==="percentage",onChange:L})}),y&&(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,t.jsx)(c,{isChecked:m,onChange:R})}),P&&(0,t.jsx)(j,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,t.jsx)(c,{isChecked:x,onChange:O})})]})})},Mu=e=>(0,t.jsxs)(l.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"})]}),Ru=e=>(0,t.jsx)(l.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"})]})}),_u=e=>(0,t.jsx)(l.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"})]})}),Ou=e=>(0,t.jsx)(l.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"})]})}),Nu=e=>(0,t.jsxs)(l.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"})]}),Du=e=>(0,t.jsxs)(l.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"})]}),Fu=e=>(0,t.jsxs)(l.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"})]}),zu=e=>(0,t.jsxs)(l.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"})]})]}),Hu=e=>(0,t.jsx)(l.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"})]})}),Bu=e=>(0,t.jsx)(l.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"})]})}),Gu=e=>(0,t.jsx)(l.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"})]})]})}),Vu=e=>(0,t.jsxs)(l.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"})]}),Uu=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",children:[(0,t.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",strokeOpacity:"0.3",strokeWidth:".8"}),(0,t.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",strokeOpacity:"0.8",strokeWidth:"1.2"})]})}),Wu=e=>(0,t.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,t.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeOpacity:"0.3",strokeWidth:".8"}),(0,t.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",fill:"currentColor",fillOpacity:"0.6"})]}),$u=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",transform:"rotate(-90 8 8)",children:[(0,t.jsxs)("g",{strokeOpacity:"0.2",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.6"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"4.4"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2.2"})]}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.6",pathLength:"100",strokeDasharray:"72 100",strokeOpacity:"0.8"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"4.4",pathLength:"100",strokeDasharray:"52 100",strokeOpacity:"0.6"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2.2",pathLength:"100",strokeDasharray:"34 100",strokeOpacity:"0.45"})]})}),qu=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsx)("path",{fill:"currentColor",fillOpacity:"0.75",d:"M8.4 7.31 8.4 1.01A7 7 0 0 1 13.85 4.16ZM8.8 8 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8ZM8.4 8.69 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59ZM7.6 8.69 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74ZM7.2 8 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31ZM7.6 7.31 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52Z"})}),Ku=e=>(0,t.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("path",{fillOpacity:"0.35",d:"M8.4 3.82 8.4 1.01A7 7 0 0 1 13.85 4.16L11.42 5.56A4.2 4.2 0 0 0 8.4 3.82ZM11.46 6.47 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8L11.46 9.53A3.78 3.78 0 0 0 11.46 6.47ZM10.69 10.01 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59L8.4 11.34A3.36 3.36 0 0 0 10.69 10.01ZM7.6 10.85 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74L5.73 9.77A2.88 2.88 0 0 0 7.6 10.85ZM5.7 8.87 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31L5.7 7.13A2.46 2.46 0 0 0 5.7 8.87ZM6.41 6.62 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52L7.6 5.94A2.1 2.1 0 0 0 6.41 6.62Z"}),(0,t.jsx)("path",{fillOpacity:"0.9",d:"M8.4 7.31 8.4 3.82A4.2 4.2 0 0 1 11.42 5.56ZM8.8 8 11.46 6.47A3.78 3.78 0 0 1 11.46 9.53ZM8.4 8.69 10.69 10.01A3.36 3.36 0 0 1 8.4 11.34ZM7.6 8.69 7.6 10.85A2.88 2.88 0 0 1 5.73 9.77ZM7.2 8 5.7 8.87A2.46 2.46 0 0 1 5.7 7.13ZM7.6 7.31 6.41 6.62A2.1 2.1 0 0 1 7.6 5.94Z"})]})}),Zu=e=>(0,t.jsx)(l.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"})]})}),Xu=.55,Yu=.15,tt=[{name:"column",icon:Nu,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Fu,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Du,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Ru,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Ou,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:_u,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Gu,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Mu,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:zu,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:Zu,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Vu,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Hu,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Xu}},{name:"radialBar",icon:$u,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:Yu}},{name:"rose",icon:qu,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:Ku,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:Uu,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:Wu,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Bu,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Ju=.05,Qu=e=>e===null?null:tt.find(n=>t0(n.summary,e))??null,e0=(e,n)=>{const{summary:r}=e;return n===null||(0,p.isComboChartType)(r)?r:r.position==="dodge"&&Wr(n)?{...r,position:"identity"}:r.coordType!=="polar"||!Ie(r.innerRadius)||n.coordType!=="polar"||!Ie(n.innerRadius)?r:{...r,innerRadius:n.innerRadius}},Wr=e=>!(0,p.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",t0=(e,n)=>{if((0,p.isComboChartType)(e)||(0,p.isComboChartType)(n))return(0,p.isComboChartType)(e)&&(0,p.isComboChartType)(n);const r=e.position===n.position||e.position==="dodge"&&Wr(n);return e.coordType!==n.coordType||e.geom!==n.geom||!r?!1:e.coordType!=="polar"||n.coordType!=="polar"?!0:e.theta===n.theta&&Ie(e.innerRadius)===Ie(n.innerRadius)},Ie=e=>e>=Ju,n0=3,r0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{RadioGrid:s}=F(),c=(0,b.useMemo)(()=>tt.map(({name:m,icon:x})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,t.jsx)(x,{size:"md"}),isDisabled:m==="combo"&&!(0,p.canBecomeCombo)(a?.spec)||m==="heatmap"&&!(0,p.canBecomeHeatmap)(a?.spec)})),[i,a]);if(!a)return null;const d=(0,p.readChartType)(a.spec),h=Qu(d),u=m=>{const x=tt.find(g=>g.name===m);x&&o.commands.dispatch(new p.SetChartTypeCommand(e0(x,d)))};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)(s,{value:h?.name??"",options:c,columns:n0,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Jt=["solid","dashed","dotted"],o0=8,a0=0,i0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=F(),{colorScheme:h}=l.useThemeContext();if(!a)return null;const u=a.guides.axes.filter(l0);if(u.length===0)return null;const m=a.coordSystem.type!=="polar",x=u.some(C=>C.gridVisible),g=(0,p.resolveGridLineStyle)((0,p.createStyleResolver)({colorScheme:h}).chromeReaders(a.chrome),"y"),v=Jt.map(C=>({value:C,label:i(`editor.graphPanel.gridSection.lineStyles.${C}`)})),S=C=>k=>{o.commands.dispatch(new p.SetGridVisibilityCommand({axis:C,isVisible:k}))},y=C=>{const k=Jt.find(L=>L===C);k&&o.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:k}))},P=C=>{o.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:C}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.gridSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[u.map(C=>(0,t.jsx)(j,{label:i(s0(C)),children:(0,t.jsx)(c,{isChecked:C.gridVisible,onChange:S(C.scaleAestheticKey)})},C.scaleAestheticKey)),m&&x&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,t.jsx)(d,{value:g.lineType,options:v,onChange:y})}),(0,t.jsx)(j,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,t.jsx)(s,{value:g.strokeWidth,min:a0,max:o0,step:.5,formatValue:Fe,onChange:P,onCommit:o.commands.seal})})]})]})})},l0=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",s0=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",c0="total",$r=["total","average","current"],d0=["total"],Qt=["previous","first"],en=["auto","small","medium","large"],u0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Switch:s,ToggleGroup:c}=F();if(!a)return null;const d=a.config.headline,h=d.show!=="none",u=a.coordSystem,m=u.type==="polar",x=u.type==="polar"&&u.innerRadius>0,g=a.layers.some(A=>A.summary.grandTotal!==void 0);if(m&&!g)return null;const v=m?d0:$r,S=a.guides.headline,y=S?.kind==="perGroup"&&S.items.some(A=>A.comparison!==null),P=v.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.metrics.${A}`)})),C=Qt.map(A=>({value:A,label:i(`editor.graphPanel.headlineNumberSection.comparison.${A}`)})),k=en.map(A=>({value:A,label:i(A==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${A}`)})),L=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],R=A=>{o.commands.dispatch(new p.SetHeadlineShowCommand({show:A?c0:"none"}))},O=A=>{const f=v.find(w=>w===A);f&&o.commands.dispatch(new p.SetHeadlineShowCommand({show:f}))},_=A=>{const f=Qt.find(w=>w===A);f&&o.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:f}))},I=A=>{const f=en.find(w=>w===A);f&&o.commands.dispatch(new p.SetHeadlineSizeCommand({size:f}))},M=A=>{o.commands.dispatch(new p.SetHeadlinePositionCommand({position:A==="center"?"center":"above"}))};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:n,preview:r??h0(i,d.show),children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,t.jsx)(s,{isChecked:h,onChange:R})}),h&&(0,t.jsxs)(t.Fragment,{children:[P.length>1&&(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,t.jsx)(c,{value:d.show,options:P,onChange:O})}),y&&(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,t.jsx)(c,{value:(0,p.resolveComparisonBasis)(d.compareWith),options:C,onChange:_})}),(0,t.jsx)(j,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,t.jsx)(c,{value:d.size,options:k,onChange:I})}),x&&(0,t.jsx)(j,{label:i("editor.axesPanel.controls.position"),children:(0,t.jsx)(c,{value:d.position,options:L,onChange:M})})]})]})})},h0=(e,n)=>{const r=$r.find(o=>o===n);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},We=["top","bottom","left","right","none"],tn=["auto","start","center","end"],nn=["auto","pill","direct"],p0=({positions:e,title:n,layout:r="collapsible",preview:o})=>{const a=D(),i=l.useHandleCompiled(a),s=l.useI18n(),{ToggleGroup:c}=F();if(!i)return null;const d=i.config.legend.position,h=e??We,u=i.guides.legends.drawn[0],m=(0,p.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),x=i.guides.headline?.kind==="perGroup",g=i.guides.colorGroups.length>0;if(d==="auto"&&u===void 0&&!m&&(x||!g))return null;const v=u?.position??"none",S=d==="auto"?v:d,y=We.filter(M=>M===S||h.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),P=M=>{const A=We.find(f=>f===M);A&&a.commands.dispatch(new p.SetLegendPositionCommand({position:A}))},C=M=>{const A=tn.find(f=>f===M);A&&a.commands.dispatch(new p.SetLegendAlignCommand({align:A}))},k=M=>{const A=nn.find(f=>f===M);A&&a.commands.dispatch(new p.SetLegendDisplayCommand({display:A}))},L=tn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.align.${M}`)})),R=nn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),O=n??s("editor.graphPanel.legendSection.title"),_=y.find(M=>M.value===S)?.label,I=u!==void 0;return(0,t.jsx)(z,{title:O,layout:r,preview:o??_,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,t.jsx)(c,{value:S,options:y,onChange:P})}),I&&(0,t.jsx)(j,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,t.jsx)(c,{value:i.config.legend.align,options:L,onChange:C})}),m&&(0,t.jsx)(j,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,t.jsx)(c,{value:i.config.legend.display,options:R,onChange:k})})]})})},m0=1,g0=20,x0=.5,qr=({layerId:e})=>{const n=D(),r=l.useHandleCompiled(n),{Slider:o}=F(),a=bt(r,e);if(!r)return null;const i=s=>{const c=new p.SetPointSizeCommand({layerId:e,size:s});n.commands.dispatch(c,{transient:!0})};return(0,t.jsx)(o,{value:a?.get("size")??p.DEFAULT_POINT_SIZE,min:m0,max:g0,step:x0,formatValue:Fe,onChange:i,onCommit:n.commands.seal})},v0=1,f0=10,b0=.1,S0=["gap","zero","connect"],C0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=F(),u=a?.spec.layers??[],m=(0,p.findLayerByGeom)(u,"line","area"),x=bt(a,m?.id??null);if(!a||!m)return null;const g=a.coordSystem.type==="polar",v=A0(i,m),S=j0(m,u),y=rn(a.spec,m.geom,"strokeWidth",m.id),P=typeof y=="number",C=m.geom==="line"?m:void 0,k=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],L=A=>{o.commands.dispatch(new p.ToggleLinePointsVisibilityCommand({layerId:m.id,showPoints:A}))},R=A=>{C&&o.commands.dispatch(new p.ToggleLineFillCommand({layerId:C.id,showFill:A}))},O=A=>{o.commands.dispatch(new p.SetLineInterpolationCommand({layerId:m.id,interpolate:A?"catmull-rom":"linear"}))},_=A=>{const f=x?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH;o.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:A==="custom"?f:null}))},I=A=>{o.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:A}),{transient:!0})},M=A=>{const f=y0(A);f&&o.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:m.id,missingValues:f}))};return(0,t.jsx)(z,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,t.jsx)(d,{isChecked:S!==void 0,onChange:L})}),S&&(0,t.jsx)(j,{label:i("editor.graphPanel.pointSize.label"),children:(0,t.jsx)(qr,{layerId:S.id})}),C&&!g&&(0,t.jsx)(j,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,t.jsx)(d,{isChecked:rn(a.spec,"line","fillAlpha",C.id)!==void 0,onChange:R})}),!g&&(0,t.jsx)(j,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,t.jsx)(d,{isChecked:m.params.interpolate==="catmull-rom",onChange:O})}),(0,t.jsx)(j,{label:i("editor.graphPanel.lineThickness.label"),children:(0,t.jsx)(h,{value:P?"custom":"auto",options:k,onChange:_})}),P&&(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(c,{value:y,min:v0,max:f0,step:b0,formatValue:Fe,onChange:I,onCommit:o.commands.seal})}),!g&&v.length>1&&(0,t.jsx)(j,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,t.jsx)(s,{value:m.params.missingValues,options:v,onChange:M})})]})})},y0=e=>S0.find(n=>n===e),rn=(e,n,r,o)=>(0,p.findKindStyleDeclarations)(e.styles.overrides,(0,p.buildLayerStyleAddress)(n,o))?.[r],j0=(e,n)=>(0,p.filterLayersByGeoms)(n,"point").find(r=>(0,p.isCompanionLayer)(r,[e])),A0=(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(o=>o.value!=="gap"):r},nt="\0none",T0=["x","y","color","size","label"],w0={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"},P0=({title:e,layout:n="collapsible"})=>{const r=D(),o=l.useHandleCompiled(r),a=l.useI18n(),{Select:i}=F(),s=a("editor.graphPanel.mappingSection.none"),c=o?.spec,d=(0,b.useMemo)(()=>c===void 0?[]:(0,p.readMappableAesthetics)(c,T0).map(({aesthetic:h,variables:u,isRequired:m})=>{const x=(0,p.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:a(w0[h]),value:x??(m?null:nt),options:k0(u,x,m?null:s),chooseColumn:g=>{r.commands.dispatch(new p.SetMappingCommand({aesthetic:h,variable:g===nt?null:g}))}}}),[c,a,s,r]);return o?(0,t.jsx)(z,{title:e??a("editor.graphPanel.mappingSection.title"),layout:n,children:(0,t.jsx)(G,{children:d.map(({aesthetic:h,label:u,value:m,options:x,chooseColumn:g})=>(0,t.jsx)(j,{label:u,children:(0,t.jsx)(i,{value:m,options:x,placeholder:s,onChange:g})},h))})}):null},k0=(e,n,r)=>{const o=n!==null&&!e.includes(n)?[n,...e]:e;return[...r===null?[]:[{value:nt,label:r}],...o.map(a=>({value:a,label:a}))]},L0="k",I0=2,E0=0,M0=5,rt=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],R0=["auto","none"],_0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=F();if(!a)return null;const{abbreviation:d,decimals:h}=a.config.numberFormat,u=O0(d)!==void 0,m=h!=="auto",x=k=>k.map(L=>({value:L,label:i(`editor.graphPanel.numberFormat.options.${L}`)})),g=rt.map(({value:k,labelKey:L})=>({value:k,label:i(`common.abbreviations.${L}`)})),v=k=>{o.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:k}))},S=k=>{const L=R0.find(R=>R===k);v(L??L0)},y=k=>{const L=rt.find(R=>R.value===k);L&&v(L.value)},P=k=>{o.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k==="custom"?I0:"auto"}))},C=k=>{k!==null&&o.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,t.jsx)(c,{value:u?"custom":d,options:x(["auto","none","custom"]),onChange:S})}),u&&(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(c,{value:d,options:g,onChange:y})}),(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,t.jsx)(c,{value:m?"custom":"auto",options:x(["auto","custom"]),onChange:P})}),m&&(0,t.jsx)(j,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(s,{value:h,min:E0,max:M0,onChange:C,onCommit:o.commands.seal})})]})})},O0=e=>rt.find(n=>n.value===e),N0=({title:e,layout:n="collapsible",preview:r})=>{const o=l.useHandleCompiled(D()),a=l.useI18n();if(!o)return null;const i=D0(o.spec.layers);return i?(0,t.jsx)(z,{title:e??a("editor.graphPanel.pointSize.label"),layout:n,preview:r,children:(0,t.jsx)(G,{children:(0,t.jsx)(j,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,t.jsx)(qr,{layerId:i.id})})})}):null},D0=e=>{const n=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(r=>!(0,p.isCompanionLayer)(r,n))},F0=.9,z0=360,H0=.05,B0=15,G0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Slider:s}=F();if(!a||a.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=a.spec.coords.params,h=m=>{o.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{o.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,t.jsx)(z,{title:e??i("editor.graphPanel.polarSection.title"),layout:n,preview:r,children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,t.jsx)(s,{value:c,min:0,max:F0,step:H0,formatValue:Ur,onChange:h,onCommit:o.commands.seal})}),(0,t.jsx)(j,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,t.jsx)(s,{value:d,min:0,max:z0-1,step:B0,formatValue:lu,onChange:u,onCommit:o.commands.seal})})]})})},V0=e=>(0,t.jsxs)(l.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"})]}),on=e=>(0,t.jsxs)(l.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"})]}),U0=e=>(0,b.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:n,numberFormat:r}=e.config,o=e.guides.colorGroups.map(a=>{const i=(0,p.createValueFormatter)({valueFormat:a.valueFormat,locale:n,numberFormat:r}),s=a.value instanceof Date?a.value.getTime():a.value;return{value:s,option:{value:String(s),label:a.label??i(a.value)}}});return{options:o.map(({option:a})=>a),findValue:a=>o.find(i=>i.option.value===a)?.value}},[e]),an=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],W0="linear",$0=({title:e,layout:n="collapsible",preview:r})=>{const o=D(),a=l.useHandleCompiled(o),i=l.useI18n(),{Select:s,Switch:c}=F(),{options:d,findValue:h}=U0(a);if(!a||a.coordSystem.type==="polar")return null;const u=(0,p.findTrendLineLayer)(a.spec.layers),m=(0,p.findAverageLineLayer)(a.spec.layers),x=u?.stat.type==="smooth"?u.stat.method:W0,g=q0(m),v=an.map(L=>({value:L,label:i(`editor.annotationsPanel.trendType.options.${L}`)})),S=(L,R={})=>{const O=u??m,_=new p.SetStatLineCommand({line:L,...R,...O!==void 0&&{layerId:O.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});o.commands.dispatch(_)},y=L=>S(L?"trend":"none",{method:x}),P=L=>S(L?"average":"none",{group:g??h(d[0]?.value??"")}),C=L=>{const R=an.find(O=>O===L);R!==void 0&&S("trend",{method:R})},k=L=>{const R=L===null?void 0:h(L);R!==void 0&&S("average",{group:R})};return(0,t.jsx)(z,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:n,preview:r??(0,t.jsx)(on,{size:"lg"}),children:(0,t.jsxs)(G,{children:[(0,t.jsx)(j,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,t.jsx)(on,{size:"lg"}),children:(0,t.jsx)(c,{isChecked:u!==void 0,onChange:y})}),u!==void 0&&(0,t.jsx)(j,{label:i("editor.annotationsPanel.trendType.label"),children:(0,t.jsx)(s,{value:x,options:v,onChange:C,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,t.jsx)(j,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,t.jsx)(V0,{size:"lg"}),children:(0,t.jsx)(c,{isChecked:m!==void 0,onChange:P})}),m!==void 0&&d.length>0&&(0,t.jsx)(j,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,t.jsx)(s,{value:g===void 0?null:String(g),options:d,onChange:k,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},q0=e=>{const n=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return n instanceof Date?n.getTime():n};exports.AppearanceSection=du;exports.AxesPanel=iu;exports.AxisSection=Qe;exports.BarSection=hu;exports.Button=Sr;exports.CalloutsSection=Au;exports.CaptionSection=zr;exports.ComboSection=wu;exports.EditableGraphRenderer=rd;exports.EditorPanel=gt;exports.ElementsPanel=au;exports.GoalSection=Lu;exports.GraphOptionsSection=Eu;exports.GraphTypeSection=r0;exports.GridSection=i0;exports.HeadlineSection=u0;exports.IntlProvider=pn;exports.LegendSection=p0;exports.LineSection=C0;exports.MappingSection=P0;exports.NumberField=jr;exports.NumberFormatSection=_0;exports.PANEL_ROOT_ATTRIBUTE=Nr;exports.PointSection=N0;exports.PolarSection=G0;exports.RadioGrid=Ar;exports.Row=j;exports.Section=z;exports.Select=Tr;exports.Slider=wr;exports.SourceSection=Hr;exports.SubtitleSection=Br;exports.Switch=Pr;exports.TextField=kr;exports.TextSizeSection=Gr;exports.TitleSection=Vr;exports.ToggleGroup=Lr;exports.ToggledSection=Fr;exports.TrendsAndAveragesSection=$0;exports.useControls=F;exports.usePanelExpansion=Or;exports.usePanelGraph=D;