efficient-shell 12.3.0 → 12.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/{Browser-OE7IMID6.js → Browser-24JRQIPQ.js} +14 -14
- package/dist/Calculator-AHBFZ4EN.js +29 -0
- package/dist/{CurrencyConverter-TLI6PVRE.js → CurrencyConverter-PZYRBADV.js} +8 -8
- package/dist/Files-AZ4Q4LMK.js +121 -0
- package/dist/{Notepad-TUW4JP7M.js → Notepad-UPHHH3YU.js} +11 -11
- package/dist/PdfViewer-GUXUWGMG.js +1 -0
- package/dist/{PomodoroTimer-FPGRFPNT.js → PomodoroTimer-WGN2KNSB.js} +7 -7
- package/dist/{Preview-BJRRRU4N.js → Preview-K4TNRLKM.js} +61 -61
- package/dist/Sidebar-F7HHC5GY.js +44 -0
- package/dist/{Stock-P7D5WNKC.js → Stock-5GEEDQVT.js} +3 -3
- package/dist/{Weather-OUHUYBZ6.js → Weather-WMQQXWHH.js} +18 -18
- package/dist/{WorldClock-WXIV2KC6.js → WorldClock-IK3WTHVW.js} +7 -7
- package/dist/ai/index.js +33 -33
- package/dist/apps/ImageAnnotator.d.ts +21 -0
- package/dist/apps/ImageAnnotator.js +2 -0
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChartTooltip.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/charts/FunnelChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RadialBarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/{chunk-NRLTGGCS.js → chunk-2BMGV6DE.js} +8 -8
- package/dist/chunk-2YRLRMZH.js +23 -0
- package/dist/{chunk-5BV2WW74.js → chunk-3LTZ4N46.js} +11 -11
- package/dist/{chunk-MQKUGIN7.js → chunk-3PWI5IH7.js} +13 -13
- package/dist/{chunk-Q2MW334M.js → chunk-3UHTHQGK.js} +8 -8
- package/dist/{chunk-RQ4UIWWD.js → chunk-4UGFNTZ3.js} +11 -11
- package/dist/{chunk-Y7ANTS5W.js → chunk-4ZUV6WQT.js} +1 -1
- package/dist/{chunk-P4L74UA5.js → chunk-525O4AUQ.js} +1 -1
- package/dist/chunk-56GGBTAD.js +3 -0
- package/dist/{chunk-KDWK5WGU.js → chunk-57YY4J6T.js} +1 -1
- package/dist/{chunk-KZNJXV5I.js → chunk-5HJIFCDQ.js} +3 -3
- package/dist/{chunk-IL56C56I.js → chunk-5JUG74UR.js} +2 -2
- package/dist/{chunk-TKXUDCOI.js → chunk-5MO5JBBK.js} +1 -1
- package/dist/{chunk-6TLSXBKC.js → chunk-62275PI2.js} +1 -1
- package/dist/{chunk-5LZTYOYD.js → chunk-6BATVJBA.js} +17 -17
- package/dist/{chunk-SSUZAOGI.js → chunk-6U25ELYF.js} +10 -10
- package/dist/{chunk-QOQ6GXVA.js → chunk-75MSXRFY.js} +5 -5
- package/dist/{chunk-UDL2A2GT.js → chunk-7RRJPNYN.js} +3 -3
- package/dist/{chunk-ZXNJSSRV.js → chunk-A4KQKN32.js} +1 -1
- package/dist/chunk-A6WZF65N.js +22 -0
- package/dist/{chunk-DONZDILI.js → chunk-AAIUJJDQ.js} +1 -1
- package/dist/chunk-BG2OL3MO.js +7 -0
- package/dist/{chunk-ZZ67Q5HJ.js → chunk-BKKKIHHV.js} +6 -6
- package/dist/chunk-BTFBXZS2.js +1 -0
- package/dist/chunk-BUGTNNZQ.js +15 -0
- package/dist/chunk-C4IJONGO.js +1 -0
- package/dist/chunk-C57PNNAW.js +13 -0
- package/dist/{chunk-DULMOL3I.js → chunk-C5LBNLFJ.js} +1 -1
- package/dist/chunk-CAXOKGMB.js +27 -0
- package/dist/{chunk-WGLHB6WE.js → chunk-CJH2BGXY.js} +1 -1
- package/dist/chunk-CURXYF2R.js +9 -0
- package/dist/{chunk-ZRLWE3JM.js → chunk-DANLBFBD.js} +1 -1
- package/dist/{chunk-JYGUTY6R.js → chunk-DFYXIW4O.js} +1 -1
- package/dist/{chunk-GZJ5F7SB.js → chunk-DJ2XDBAO.js} +5 -5
- package/dist/{chunk-PFMZL3ZG.js → chunk-DW45EZHA.js} +2 -2
- package/dist/{chunk-GYDCXCJT.js → chunk-EB2UE6ZR.js} +1 -1
- package/dist/{chunk-OR5HUQSB.js → chunk-EEVLRCMA.js} +7 -7
- package/dist/{chunk-KT5LLPUV.js → chunk-EF3NPTHG.js} +1 -1
- package/dist/{chunk-FGCIEJPP.js → chunk-EIY6YGEZ.js} +1 -1
- package/dist/{chunk-THASH6OO.js → chunk-EUUCNDIS.js} +9 -9
- package/dist/{chunk-5PP435FL.js → chunk-EYPKBJYG.js} +1 -1
- package/dist/{chunk-ASQX3GXB.js → chunk-FLTPVFKA.js} +5 -5
- package/dist/chunk-FPYABAOX.js +69 -0
- package/dist/chunk-FVZXRGVM.js +8 -0
- package/dist/{chunk-67JHJO6V.js → chunk-G7I255HN.js} +13 -13
- package/dist/{chunk-2YBJQUYQ.js → chunk-GEXETMGL.js} +1 -1
- package/dist/chunk-GEZ45J4Z.js +2 -0
- package/dist/chunk-GUIJCTFJ.js +8 -0
- package/dist/{chunk-7JY3YYN4.js → chunk-GZQD6IBV.js} +3 -3
- package/dist/chunk-H7HRYFRQ.js +14 -0
- package/dist/{chunk-AANXPLMA.js → chunk-I5BS6AP6.js} +4 -4
- package/dist/chunk-I5CSYOOZ.js +28 -0
- package/dist/chunk-I64TVNHS.js +6 -0
- package/dist/{chunk-F44E76EC.js → chunk-IFQXTIMY.js} +4 -4
- package/dist/chunk-IHPAYSTJ.js +8 -0
- package/dist/{chunk-QTMRW6DK.js → chunk-IXBKWVEP.js} +1 -1
- package/dist/{chunk-2KNVUOWJ.js → chunk-J4KYZGHQ.js} +20 -20
- package/dist/{chunk-O6H2ZD32.js → chunk-J53LQWWY.js} +7 -7
- package/dist/{chunk-IXAYZNOZ.js → chunk-JM2IQC4J.js} +1 -1
- package/dist/{chunk-FZM3ZPW3.js → chunk-JPNAEN53.js} +1 -1
- package/dist/{chunk-S4FPYCUU.js → chunk-JQBVSPF5.js} +3 -3
- package/dist/{chunk-XGVMOV3O.js → chunk-KDTL6VEC.js} +8 -8
- package/dist/{chunk-2XQOK3CT.js → chunk-KUEYOJBN.js} +2 -2
- package/dist/{chunk-QA33EHHO.js → chunk-LCC3NXQX.js} +6 -6
- package/dist/{chunk-7JGR7WPD.js → chunk-LFYZ7NQ4.js} +3 -3
- package/dist/chunk-M54OL3YR.js +2 -0
- package/dist/chunk-MGW7SX53.js +11 -0
- package/dist/{chunk-3QYAYBJE.js → chunk-MOMOZVOW.js} +3 -3
- package/dist/{chunk-RYBYTUGZ.js → chunk-N442GPRJ.js} +1 -1
- package/dist/{chunk-6NHPL5JL.js → chunk-N6Q7HNAH.js} +1 -1
- package/dist/{chunk-RXHTIJ64.js → chunk-N7JX27JE.js} +1 -1
- package/dist/{chunk-SKFFBBAG.js → chunk-N7YHXL2F.js} +2 -2
- package/dist/{chunk-GR43CABV.js → chunk-ND5IZ37V.js} +5 -5
- package/dist/{chunk-LKVS4WCZ.js → chunk-NEYHBQLG.js} +3 -3
- package/dist/{chunk-ZDO62V4I.js → chunk-NIBE57KV.js} +1 -1
- package/dist/{chunk-6Y2BQI44.js → chunk-NS37Y5CN.js} +3 -3
- package/dist/chunk-OLVKHYHV.js +9 -0
- package/dist/{chunk-CVLWJBR5.js → chunk-PIWC3CAC.js} +1 -1
- package/dist/chunk-PMJMYH5O.js +5 -0
- package/dist/{chunk-6GDZUW3L.js → chunk-PVXX77MY.js} +6 -6
- package/dist/{chunk-NHNRNT4T.js → chunk-QIUIP6YZ.js} +2 -2
- package/dist/{chunk-NJN5IKWO.js → chunk-QQ2LDC6C.js} +1 -1
- package/dist/{chunk-FAIHSCOG.js → chunk-RBMZSZOH.js} +1 -1
- package/dist/{chunk-53WYJ5LZ.js → chunk-RFKCSRJX.js} +10 -10
- package/dist/{chunk-NDLXD4EY.js → chunk-RNQBWWYR.js} +5 -5
- package/dist/{chunk-N5KO2IHG.js → chunk-RQDVAUXD.js} +4 -4
- package/dist/{chunk-B5OYS65L.js → chunk-RVQUSPXC.js} +1 -1
- package/dist/chunk-SBZCJNNP.js +11 -0
- package/dist/{chunk-RDKIYORS.js → chunk-SYZLS2JA.js} +1 -1
- package/dist/chunk-TQWLJ5VM.js +7 -0
- package/dist/{chunk-RM74EAMV.js → chunk-TS36J7RW.js} +2 -2
- package/dist/{chunk-ZATTQ3FX.js → chunk-TTQ7K4AJ.js} +1 -1
- package/dist/{chunk-FPRQB5W6.js → chunk-UDHJTQBA.js} +12 -12
- package/dist/{chunk-P3BLJCTQ.js → chunk-UDVQORQM.js} +3 -3
- package/dist/chunk-UGOJLNYR.js +1 -0
- package/dist/chunk-UJJXWLHE.js +2 -0
- package/dist/{chunk-CF4YOJUQ.js → chunk-UPTKROT7.js} +9 -9
- package/dist/{chunk-SGNJ7I7P.js → chunk-UVBX5LEU.js} +4 -4
- package/dist/{chunk-HRMG2WMW.js → chunk-UWF45S5L.js} +23 -23
- package/dist/chunk-VIOILTE4.js +13 -0
- package/dist/{chunk-M3PUAGXJ.js → chunk-VWQNCYGQ.js} +7 -7
- package/dist/{chunk-2B4EKAZL.js → chunk-VYMM2BPX.js} +2 -2
- package/dist/{chunk-HNQKXOFU.js → chunk-WCPAQHHA.js} +1 -1
- package/dist/{chunk-36VIGB6J.js → chunk-WDQI3FV6.js} +6 -6
- package/dist/chunk-WUGQAZMC.js +14 -0
- package/dist/{chunk-74LZVJND.js → chunk-X32TVINY.js} +1 -1
- package/dist/{chunk-LBMC6GR5.js → chunk-XK4SMAVR.js} +1 -1
- package/dist/{chunk-U7PXMVIY.js → chunk-XK4U5MAS.js} +3 -3
- package/dist/{chunk-S6BGMLXI.js → chunk-XMH2JOZ2.js} +1 -1
- package/dist/{chunk-TE6R53YD.js → chunk-XWFLIGDQ.js} +1 -1
- package/dist/{chunk-PA273FZF.js → chunk-YMAU4EIK.js} +1 -1
- package/dist/{chunk-LDEFEPPL.js → chunk-YRJJKF5H.js} +1 -1
- package/dist/{chunk-7TZRICMH.js → chunk-YU6KOO6O.js} +4 -4
- package/dist/chunk-YZR4T5FZ.js +7 -0
- package/dist/{chunk-NC36LJCA.js → chunk-ZB2H2JJ2.js} +4 -4
- package/dist/{chunk-FLYOI6EW.js → chunk-ZOZEQZUA.js} +1 -1
- package/dist/data/DataTable.js +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/Kanban.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/AlignmentGrid.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Button.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/IconButton.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/NumericKeypad.js +1 -1
- package/dist/forms/PictureTiles.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/Segmented.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/payment.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.d.ts +2 -19
- package/dist/index.js +666 -666
- package/dist/map/index.js +2 -2
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/GlobalSearch.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/IconRail.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/ItemCount.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/MilestoneTimeline.js +1 -1
- package/dist/shell/Popover.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/ResizeHandle.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/StatusBadge.js +1 -1
- package/dist/shell/Tabs.js +1 -1
- package/dist/shell/TimelineTrack.js +1 -1
- package/dist/shell/Tooltip.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +10 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-W6YA44OY.js +0 -29
- package/dist/Files-5WRVSC5R.js +0 -121
- package/dist/PdfViewer-GFQAIHDP.js +0 -1
- package/dist/Sidebar-ROMFJHCD.js +0 -44
- package/dist/chunk-4DZVWK7U.js +0 -7
- package/dist/chunk-5N6AC3LN.js +0 -15
- package/dist/chunk-6JKSRXZM.js +0 -8
- package/dist/chunk-AUZKIL62.js +0 -23
- package/dist/chunk-B3PNZBZM.js +0 -27
- package/dist/chunk-DCICBH2L.js +0 -3
- package/dist/chunk-DICWZEGH.js +0 -2
- package/dist/chunk-EOVXFXVV.js +0 -2
- package/dist/chunk-F245EG2A.js +0 -9
- package/dist/chunk-FPZBHNZU.js +0 -7
- package/dist/chunk-GIUX7WUS.js +0 -7
- package/dist/chunk-GMLGR4R6.js +0 -8
- package/dist/chunk-IMRGGJIJ.js +0 -22
- package/dist/chunk-IWFWPFYQ.js +0 -13
- package/dist/chunk-KZD2AFH2.js +0 -13
- package/dist/chunk-LE5LWALR.js +0 -1
- package/dist/chunk-LJJSFJA2.js +0 -69
- package/dist/chunk-M3OEWPXZ.js +0 -1
- package/dist/chunk-NPQBJJLP.js +0 -9
- package/dist/chunk-NSOAHIQZ.js +0 -11
- package/dist/chunk-SEJAT3UE.js +0 -1
- package/dist/chunk-SPJIFRNY.js +0 -8
- package/dist/chunk-SYDGCECZ.js +0 -14
- package/dist/chunk-UCIOCS4X.js +0 -2
- package/dist/chunk-UMQLDWSS.js +0 -6
- package/dist/chunk-VF53GD6D.js +0 -5
- package/dist/chunk-WD3I7AEZ.js +0 -14
- package/dist/chunk-YAQ5RF3H.js +0 -28
- package/dist/chunk-ZICLAMMR.js +0 -11
- /package/dist/{chunk-R3K2BNFF.js → chunk-2762IAB7.js} +0 -0
- /package/dist/{chunk-K5A62ZS5.js → chunk-T75VCE6K.js} +0 -0
package/dist/chunk-AUZKIL62.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{Calendar as e}from"./chunk-LGK47SEN.js";import{toDateKey as t,fromDateKey as r,toMonthKey as n}from"./chunk-2HMNOLKX.js";import{END_ACTIONS_PAD as a,InputEndActionSlot as o,InputEndActionButton as l}from"./chunk-7JY3YYN4.js";import{FILTER_ON as i,FILTER_ON_INK as s,FILTER_OFF as c}from"./chunk-AYZY3YNC.js";import{calendarNames as d}from"./chunk-Y3JW2GW5.js";import{pad2 as m}from"./chunk-LF27WIN2.js";import{buttonClasses as u}from"./chunk-UQYNPYF4.js";import{Icon as h}from"./chunk-UIWGVOFH.js";import{onOverlayOpen as p}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as f}from"./chunk-62LW225J.js";import{useDropdownPosition as g}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as b}from"./chunk-D65T4H6J.js";import{glassStyle as x}from"./chunk-5FYDNH4Y.js";import{useShellStrings as v,useShellLocale as y}from"./chunk-43MCNASD.js";import{useState as w,useRef as N,useId as k,useEffect as C}from"react";import{createPortal as M}from"react-dom";import{jsxs as W,Fragment as j,jsx as D}from"react/jsx-runtime";var Y=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],$=t;function F(e,r){const n=r.getFullYear(),a=r.getMonth(),o=new Date(n,a,r.getDate()),l=new Date(n,a,0),i=e=>new Date(n,a-e,1);switch(e){case"last2Weeks":return{from:t(new Date(n,a,r.getDate()-14)),to:t(o)};case"lastMonth":return{from:t(i(1)),to:t(l)};case"last3Months":return{from:t(i(3)),to:t(l)};case"last6Months":return{from:t(i(6)),to:t(l)};case"last12Months":return{from:t(i(12)),to:t(l)}}}function S(e,t,r){const a=n(e);return t&&a<t.slice(0,7)?t.slice(0,7):r&&a>r.slice(0,7)?r.slice(0,7):a}function O(e){const t=r(e);return t?`${m(t.getDate())}/${m(t.getMonth()+1)}/${t.getFullYear()}`:e}var H=/* @__PURE__ */new Map;function L({from:t,to:n,onChange:m,formatDisplay:$,clearable:L,required:G=!1,name:B,id:E,"aria-labelledby":J,"aria-label":T,weekStartsOn:U,placeholder:A,fullWidth:I=!1,min:R,max:q,disabled:K=!1,allowOpenEnd:P=!1}){const V=v().dateRange,Z=y(),z=$??(Z?function(e){let t=H.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),H.set(e,t));const n=t;return e=>{const t=r(e);return t?n.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(Z):O),Q=A??V.placeholder,X=L??!G,[_,ee]=w(!1),[te,re]=w(t),[ne,ae]=w(n),[oe,le]=w(null),[ie,se]=w("from"),ce=N(null),de=N(null),me=N(null),ue=k(),he=k(),pe=k(),[fe,ge]=w(!1),be=g(ce,_,{preferredMaxWidth:520,preferredMaxHeight:fe?720:560,popupRef:me}),xe=N(null),ve=N(null),[ye,we]=w(!0);b(()=>{const e=ve.current;if(!_||!fe||!e)return;const t=getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length||1,r=parseFloat(getComputedStyle(e).columnGap)||0,n=(e.clientWidth-r*(t-1))/t,a=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=n+.5;a!==ye&&we(a)});const Ne=N(null);b(()=>{const e=me.current;if(!_||!be||!e)return;const t=getComputedStyle(e),r=be.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(fe)null!==Ne.current&&Ne.current<=r&&ge(!1);else{const e=xe.current?.offsetWidth??0;if(0===e)return;Ne.current=e,e>r+.5&&ge(!0)}});const[ke,Ce]=w(!1);b(()=>{const e=!!E&&(de.current?.labels?.length??0)>0;e!==ke&&Ce(e)});const Me=!!T||!!J||ke,We=/* @__PURE__ */new Date,[je,De]=w(()=>t?t.slice(0,7):S(We,R,q)),Ye=Y.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(F(e,We),R,q)),$e=e=>e?z(e):"";C(()=>{if(!_)return;const e=e=>{const t=e.target;ce.current?.contains(t)||me.current?.contains(t)||ee(!1)};document.addEventListener("mousedown",e);const t=p(()=>ee(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[_]),C(()=>{K&&ee(!1)},[K]);const Fe=()=>{m("",""),ee(!1)},Se=X&&!K&&Boolean(t||n),Oe=t&&n?`${$e(t)} — ${$e(n)}`:t?V.fromOnly($e(t)):n?V.toOnly($e(n)):"",He=d(Z),Le=e=>{const t=r(e);return t?He.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Ge=t&&n?V.range(Le(t),Le(n)):t?V.fromOnly(Le(t)):n?V.toOnly(Le(n)):Q,Be=e=>fe?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(oe===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(oe===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Ee=/* @__PURE__ */W(j,{children:[Ye.map(e=>/* @__PURE__ */D("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=F(e,We);re(t.from),ae(t.to),le(e),De(t.from.slice(0,7))})(e),className:Be(e),"aria-label":fe?V[e]:void 0,children:fe?ye?V[e]:V[`${e}Short`]:V[e]},e)),
|
|
2
|
-
/* @__PURE__ */D("button",{type:"button",onClick:()=>le("Custom"),className:Be("Custom"),children:V.custom})]}),Je=(e,t)=>P?/* @__PURE__ */D("button",{type:"button","data-range-end":e,"aria-pressed":ie===e,onClick:()=>se(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */D("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Te=e=>P&&ie===e?" ring-1 ring-blue-400":"",Ue=
|
|
3
|
-
/* @__PURE__ */D(e,{mode:"range",min:R,max:q,value:te||null,endValue:ne||null,month:je,onMonthChange:De,onSelect:e=>{le("Custom"),P?"from"===ie?(ne&&e>ne?(re(ne),ae(e)):re(e),se("to")):te&&e<te?(ae(te),re(e)):ae(e):!te||te&&ne?(re(e),ae("")):e<te?(ae(te),re(e)):ae(e)},weekStartsOn:U,"aria-label":V.dialog});/* @__PURE__ */
|
|
4
|
-
return W("div",{className:"relative"+(I?" w-full":""),ref:ce,children:[
|
|
5
|
-
/* @__PURE__ */W("div",{className:`relative ${I?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 ${Se?a[1]:""} text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${t||n?`${i} ${s}`:c}${K?" cursor-not-allowed opacity-60":""}`,children:[
|
|
6
|
-
/* @__PURE__ */W("button",{ref:de,type:"button",onClick:()=>{K||(re(t),ae(n),le(null),se(t&&!n?"to":"from"),De(t?t.slice(0,7):S(We,R,q)),ee(!0))},"aria-haspopup":"dialog","aria-expanded":_,id:E,disabled:K||void 0,"aria-label":T,"aria-labelledby":J,"aria-describedby":[Me?he:void 0,G?pe:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":_?ue:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(I?" min-w-0 flex-1 justify-start":""),children:[
|
|
7
|
-
/* @__PURE__ */D(h,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
|
|
8
|
-
/* @__PURE__ */D("span",{className:"truncate",children:Oe||Q})]}),Se&&/* @__PURE__ */D(o,{children:/* @__PURE__ */D(l,{action:{label:V.clearRange,icon:/* @__PURE__ */D(h,{name:"close"}),onClick:Fe}})})]}),Me&&/* @__PURE__ */D("span",{id:he,className:"sr-only",children:Ge}),G&&/* @__PURE__ */D("span",{id:pe,className:"sr-only",children:V.required}),B&&/* @__PURE__ */W(j,{children:[
|
|
9
|
-
/* @__PURE__ */D("input",{type:"hidden",name:B.from,value:t,disabled:K||void 0}),
|
|
10
|
-
/* @__PURE__ */D("input",{type:"hidden",name:B.to,value:n,disabled:K||void 0})]}),_&&M(
|
|
11
|
-
/* @__PURE__ */W("div",{ref:me,id:ue,role:"dialog","aria-label":V.dialog,"data-layout":fe?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:f.popup,left:be?.left,right:be?.right,top:be?.top,bottom:be?.bottom,width:fe&&be?be.maxWidth:"max-content",maxWidth:be?.maxWidth,maxHeight:be?.maxHeight,overflowY:"auto",visibility:be?void 0:"hidden",...x()},children:[
|
|
12
|
-
/* @__PURE__ */W("div",{className:fe?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Je("from",/* @__PURE__ */W(j,{children:[
|
|
13
|
-
/* @__PURE__ */D("span",{className:"text-xs font-medium text-gray-500",children:V.from}),
|
|
14
|
-
/* @__PURE__ */D("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${te?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Te("from")}`,children:te?$e(te):V.start})]})),!fe&&/* @__PURE__ */D("span",{className:"text-gray-300",children:"—"}),Je("to",/* @__PURE__ */W(j,{children:[
|
|
15
|
-
/* @__PURE__ */D("span",{className:"text-xs font-medium text-gray-500",children:V.to}),
|
|
16
|
-
/* @__PURE__ */D("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ne?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Te("to")}`,children:ne?$e(ne):V.end})]}))]}),fe?/* @__PURE__ */W(j,{children:[Ye.length>0&&/* @__PURE__ */W("div",{className:"mb-3 @container",children:[!ye&&/* @__PURE__ */D("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:V.lastHeading}),
|
|
17
|
-
/* @__PURE__ */W("div",{ref:ve,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Ee,Ye.map(e=>/* @__PURE__ */D("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:V[e]},e))]})]}),
|
|
18
|
-
/* @__PURE__ */D("div",{className:"w-full",children:Ue})]}):
|
|
19
|
-
/* @__PURE__ */W("div",{ref:xe,className:"flex w-max gap-4",children:[
|
|
20
|
-
/* @__PURE__ */D("div",{className:"w-64",children:Ue}),Ye.length>0&&/* @__PURE__ */D("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Ee})]}),
|
|
21
|
-
/* @__PURE__ */W("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[X&&/* @__PURE__ */D("button",{type:"button",onClick:Fe,className:u({variant:"ghost"}),children:V.clear}),
|
|
22
|
-
/* @__PURE__ */D("button",{type:"button",onClick:()=>ee(!1),className:u({variant:"secondary"}),children:V.cancel}),
|
|
23
|
-
/* @__PURE__ */D("button",{type:"button",onClick:()=>{m(te,ne),ee(!1)},disabled:P?!te&&!ne:!te||!ne,className:u({variant:"primary"}),children:V.apply})]})]}),document.body)]})}export{L as DateRangePicker,F as presetRange,$ as toISODate};
|
package/dist/chunk-B3PNZBZM.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import{Dialog as e}from"./chunk-VF53GD6D.js";import{buttonClasses as t}from"./chunk-UQYNPYF4.js";import{Icon as r}from"./chunk-UIWGVOFH.js";import{useShellStrings as n,splitAround as o}from"./chunk-43MCNASD.js";import{createContext as l,useContext as i,useState as s,useRef as a,useCallback as c,useEffect as u}from"react";import{jsxs as d,jsx as m,Fragment as h}from"react/jsx-runtime";var f=l(()=>Promise.resolve(!1)),b=()=>i(f),g=()=>Promise.resolve(!1),p=e=>g(e),v=()=>Promise.resolve(!1),y=e=>v(e),x=()=>Promise.resolve(null),N=e=>x(e),k={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-accent-tint-strong",button:t({variant:"primary"})}},w=t({variant:"secondary"}),C=t({variant:"primary"}),L="w-full rounded-md border border-line-strong h-8 px-3 text-sm";function P(){/* @__PURE__ */
|
|
2
|
-
return m(r,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function F(){/* @__PURE__ */
|
|
3
|
-
return m(r,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function j({children:t}){const[r,l]=s(!1),[i,b]=s({message:""}),[p,y]=s(0),N=a(),j=a(null),D=a(0),E=a([]),T=a(null),W=a(null),$=c(e=>{j.current=e.id,N.current=e.resolve,y(e.id),b(e.options),l(!0)},[]),V=c(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const r={id:++D.current,options:t,resolve:e};null===j.current?$(r):E.current.push(r)})},[$]),[G,K]=s(!1),[U,Y]=s({message:""}),[A,H]=s(""),I=a(),M=c(e=>(Y(e),H(""),K(!0),new Promise(e=>{I.current=e})),[]),[O,Q]=s(!1),[S,q]=s({}),[z,B]=s(""),J=a(),R=c(e=>{const t="string"==typeof e?{message:e}:e;return q(t),B(t.defaultValue??""),Q(!0),new Promise(e=>{J.current=e})},[]);u(()=>{g=V,v=M,x=R},[V,M,R]);const X=(e,t)=>{if(j.current!==e)return;const r=N.current,n=E.current.shift();n?$(n):(j.current=null,N.current=void 0,l(!1)),r?.(t)},Z=e=>{K(!1),H(""),I.current?.(e)},_=e=>{if(e){const e=z.trim();if(!e&&!S.allowEmpty)return Q(!1),void J.current?.(null);Q(!1),J.current?.(e)}else Q(!1),J.current?.(null)},ee=i.variant||(i.confirmLabel?.toLowerCase().includes("delete")||i.message.toLowerCase().includes("delete")?"danger":"info"),te=k[ee],re=k["warning"===U.variant?"warning":"danger"],ne=U.confirmWord,oe=null==ne||A===ne,le=n().dialog,[ie,se]=o(le.typeToConfirm);/* @__PURE__ */
|
|
4
|
-
return d(f.Provider,{value:V,children:[t,
|
|
5
|
-
/* @__PURE__ */m(e,{open:r,onClose:()=>X(p,!1),initialFocus:T,footer:/* @__PURE__ */d(h,{children:[
|
|
6
|
-
/* @__PURE__ */m("button",{ref:T,type:"button",onClick:()=>X(p,!1),className:w,children:i.cancelLabel||le.cancel}),
|
|
7
|
-
/* @__PURE__ */m("button",{type:"button",onClick:()=>X(p,!0),className:te.button,children:i.confirmLabel||le.ok})]}),children:/* @__PURE__ */d("div",{className:"flex gap-4",children:[
|
|
8
|
-
/* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */m(P,{})}),
|
|
9
|
-
/* @__PURE__ */d("div",{className:"flex-1",children:[
|
|
10
|
-
/* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900",children:i.title||le.confirmTitle}),
|
|
11
|
-
/* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:i.message})]})]})}),
|
|
12
|
-
/* @__PURE__ */d(e,{open:G,onClose:()=>Z(!1),initialFocus:null!=ne?void 0:W,footer:/* @__PURE__ */d(h,{children:[
|
|
13
|
-
/* @__PURE__ */m("button",{ref:W,type:"button",onClick:()=>Z(!1),className:w,children:U.cancelLabel||le.destructiveCancel}),
|
|
14
|
-
/* @__PURE__ */m("button",{type:"button",onClick:()=>Z(!0),disabled:!oe,className:re.button,children:ne??U.confirmLabel??le.destructiveConfirm})]}),children:[
|
|
15
|
-
/* @__PURE__ */m("button",{type:"button",onClick:()=>Z(!1),"aria-label":le.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */m(F,{})}),
|
|
16
|
-
/* @__PURE__ */d("div",{className:"flex gap-4",children:[
|
|
17
|
-
/* @__PURE__ */m("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${re.icon}`,children:/* @__PURE__ */m(P,{})}),
|
|
18
|
-
/* @__PURE__ */d("div",{className:"flex-1",children:[
|
|
19
|
-
/* @__PURE__ */m("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:U.title||le.destructiveTitle}),
|
|
20
|
-
/* @__PURE__ */m("p",{className:"mt-2 text-sm text-gray-600",children:U.message}),null!=ne&&/* @__PURE__ */d(h,{children:[
|
|
21
|
-
/* @__PURE__ */d("p",{className:"mt-3 text-sm text-gray-700",children:[ie,
|
|
22
|
-
/* @__PURE__ */m("kbd",{className:"rounded border border-line-strong bg-surface-sunken px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:ne}),se]}),
|
|
23
|
-
/* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:A,onChange:e=>H(e.target.value),onKeyDown:e=>{"Enter"===e.key&&A===ne&&Z(!0)},placeholder:ne,className:`mt-2 ${L} focus:border-red-500`})]})]})]})]}),
|
|
24
|
-
/* @__PURE__ */d(e,{open:O,onClose:()=>_(!1),title:S.title||le.promptTitle,footer:/* @__PURE__ */d(h,{children:[
|
|
25
|
-
/* @__PURE__ */m("button",{type:"button",onClick:()=>_(!1),className:w,children:S.cancelLabel||le.cancel}),
|
|
26
|
-
/* @__PURE__ */m("button",{type:"button",onClick:()=>_(!0),disabled:!S.allowEmpty&&!z.trim(),className:C,children:S.confirmLabel||le.ok})]}),children:[S.message&&/* @__PURE__ */m("p",{className:"text-sm text-gray-600",children:S.message}),
|
|
27
|
-
/* @__PURE__ */m("input",{autoFocus:!0,type:"text",value:z,onChange:e=>B(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:S.placeholder,className:`mt-3 ${L} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{j as ConfirmProvider,p as confirm,y as confirmDestructive,N as prompt,b as useConfirm};
|
package/dist/chunk-DCICBH2L.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{DropdownMenu as e}from"./chunk-4DZVWK7U.js";import{Button_default as i}from"./chunk-EOVXFXVV.js";import{iconButtonClasses as n}from"./chunk-UQYNPYF4.js";import{Icon as r}from"./chunk-UIWGVOFH.js";import{Tooltip as a}from"./chunk-NJN5IKWO.js";import{forwardRef as l,useId as o}from"react";import{jsxs as s,jsx as t}from"react/jsx-runtime";var d="relative focus-visible:z-10",m={secondary:"border-l-0",primary:"border-l border-white/30",warning:"border-l border-white/30"},c=l(function({children:l,onClick:c,type:b="button",items:h,menuLabel:u,variant:f="primary",size:p="md",loading:v=!1,leftIcon:k,disabled:N=!1,disabledReason:g,tooltip:w,menuDisabled:x=!1,menuDisabledReason:j,onMenuOpenChange:y,menuFooter:W,menuFooterLabel:C,align:F="end",side:O="bottom",menuMinWidth:V,linkAs:z,block:I=!1,className:D=""},L){const R=N&&(null!=g&&""!==g&&!1!==g)&&!v,U=x&&null!=j&&""!==j&&!1!==j,$=o(),A=/* @__PURE__ */t(i,{ref:L,type:b,variant:f,size:p,loading:v,leftIcon:k,block:I,disabled:N&&!R,"aria-disabled":!!R||void 0,disabledReason:R?g:void 0,onClick:c,className:`rounded-r-none ${d}`,children:l}),K=I?"relative flex min-w-0 flex-1":"relative inline-flex",M=p.startsWith("touch")?"h-5 w-5":"h-4 w-4";/* @__PURE__ */
|
|
2
|
-
return s("div",{className:[I?"flex w-full":"inline-flex","items-stretch",D].filter(Boolean).join(" "),children:[null==w||""===w||R?A:/* @__PURE__ */t(a,{content:w,className:K,children:A}),
|
|
3
|
-
/* @__PURE__ */t(a,{content:U?j:u,describe:!1,className:"relative inline-flex shrink-0",children:/* @__PURE__ */t(e,{"aria-label":u,"aria-describedby":U?$:void 0,items:h,align:F,side:O,minWidth:V,linkAs:z,disabled:x&&!U,"aria-disabled":U,onOpenChange:y,footer:W,footerLabel:C,triggerClassName:n({variant:f,size:p,className:`rounded-l-none ${m[f]} ${d}`}),trigger:/* @__PURE__ */t(r,{name:"chevron-down",className:M,strokeWidth:2,"aria-hidden":"true"})})}),U&&/* @__PURE__ */t("span",{id:$,className:"sr-only",children:j})]})});export{c as SplitButton_default};
|
package/dist/chunk-DICWZEGH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ChartTooltip as t}from"./chunk-36VIGB6J.js";import{CartesianPlot as o}from"./chunk-P4L74UA5.js";import{binValues as r}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as e,useShellLocale as i}from"./chunk-43MCNASD.js";import{formatPlain as m,formatFixed as n}from"./chunk-C3QOHMR6.js";import{jsx as l}from"react/jsx-runtime";function c({values:c,bins:s=10,precomputed:h,height:u=220,width:p,color:b,tone:f,formatBound:d,formatCount:x,yAxisLabel:g,label:k,className:y,emptyLabel:j}){const A=e().charts,L=i(),v=d??(t=>Number.isInteger(t)?m(t,L):n(t,1,L)),w=x??(t=>m(t,L)),M=g??A.countAxis,N=k??A.distribution,C=h??r(c??[],s),P=a(0,b,f),R=C.map(t=>v(t.from)),U=C.map(t=>t.count);/* @__PURE__ */
|
|
2
|
-
return l(o,{labels:R,values:U,height:u,width:p,bandPadding:0,xTickAnchor:"start",formatValue:w,yAxisLabel:M,className:y,emptyLabel:j,ariaLabel:A.histogram(N,C.length,(c??[]).length),tooltip:o=>/* @__PURE__ */l(t,{title:`${v(C[o].from)} – ${v(C[o].to)}`,rows:[{key:"count",label:A.observations,color:P,value:w(C[o].count)}]}),children:({x:t,y:o,bottom:r,active:a})=>/* @__PURE__ */l("g",{children:C.map((e,i)=>/* @__PURE__ */l("rect",{x:t(i)+.5,y:o(e.count),width:Math.max(1,t.bandwidth-1),height:Math.max(0,r-o(e.count)),fill:P,fillOpacity:null===a||a===i?.85:.42},i))})})}export{c as HistogramChart};
|
package/dist/chunk-EOVXFXVV.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{buttonClasses as e}from"./chunk-UQYNPYF4.js";import{isAriaDisabled as a,swallowPress as r,describedByWith as i,OffWithReason as s}from"./chunk-TE6R53YD.js";import{SpinnerRing as l}from"./chunk-R2VKEMZH.js";import{forwardRef as d,useId as n}from"react";import{jsxs as t,jsx as c}from"react/jsx-runtime";var o=d(function({variant:d="primary",size:o="md",loading:m=!1,leftIcon:p,rightIcon:b,block:f=!1,disabled:u,type:h="button",children:k,className:x="",disabledReason:N,onClick:y,pressed:v,"aria-disabled":g,"aria-describedby":j,...R},Y){const w=n(),z=u||m,C=null!=N&&""!==N,E=z&&C,I=!z&&a(g),D=I&&C,F=E||D?w:void 0,H=/* @__PURE__ */t("button",{ref:Y,type:h,disabled:z,"aria-busy":m||void 0,"aria-disabled":!!I||g,"aria-describedby":i(j,F),onClick:I?r:y,className:e({variant:d,size:o,block:f,pressed:v??(!0===R["aria-pressed"]||"true"===R["aria-pressed"]),className:x}),...R,children:[m?/* @__PURE__ */c(l,{className:"h-3.5 w-3.5",ink:""}):p,k,!m&&b]});return D?/* @__PURE__ */c(s,{reason:N,id:w,block:f,children:H}):E?/* @__PURE__ */t("span",{className:f?"flex w-full flex-col gap-1":"inline-flex flex-col items-start gap-1",children:[H,
|
|
2
|
-
/* @__PURE__ */c("span",{id:F,className:"text-xs text-red-600",children:N})]}):H});export{o as Button_default};
|
package/dist/chunk-F245EG2A.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{Segmented as e}from"./chunk-S4FPYCUU.js";import{ImageFocusPoint as a}from"./chunk-53EW4M5S.js";import{FormField as i}from"./chunk-6KBDNYRW.js";import{isVideoUrl as t,mediaPromptLine as o,mediaFileName as r,FilenameBadge as n,BusyOverlay as l,UploadGlyph as s,dropzoneClass as c,zoneFocusClass as d}from"./chunk-LBMC6GR5.js";import{TransferProgress as u}from"./chunk-HNQKXOFU.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-7KIDOIPY.js";import{Icon as p}from"./chunk-UIWGVOFH.js";import{useShellStrings as b}from"./chunk-43MCNASD.js";import{useState as g,useRef as v,useEffect as f,useId as y}from"react";import{jsxs as k,jsx as N,Fragment as j}from"react/jsx-runtime";var x=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:R,onFile:U,label:C,hint:F,error:O,required:P,className:$,accept:z="image/*",maxSizeBytes:H,fit:I="cover",height:S=112,placeholder:B,cta:K,acceptHint:W,showFilename:q=!0,allowReplace:D=!0,allowRemove:M=!0,replaceLabel:Y,removeLabel:A,busy:G=!1,busyLabel:V,choosingLabel:_,pickFailedLabel:E,progress:Q,disabled:X=!1,kind:J,onKindChange:T,focus:Z,onFocusChange:ee,focusLabel:ae}){const ie=b().media,te=K??ie.cta,oe=J??(/video/.test(z)&&!/image/.test(z)?"video":"image"),re="string"==typeof A&&A?A:ie.remove,[ne,le]=g(!1),[se,ce]=g(!1),de=v(!0);f(()=>()=>{de.current=!1},[]);const ue=G||ne,me=ne&&!G?_??ie.choosing:V??ie.uploading,he=O??(se?E??ie.pickFailed:void 0),pe=e=>{if(!R)return;ce(!1);const a=R(e);a&&"function"==typeof a.then&&(le(!0),a.then(e=>{de.current&&(le(!1),"string"==typeof e&&e&&L(e))},()=>{de.current&&(le(!1),ce(!0))}))},be=y(),ge=v(null),[ve,fe]=g(null);f(()=>()=>{ge.current&&URL.revokeObjectURL(ge.current)},[]);const ye=X||ue,ke=!!w&&(t(w,z)||w===ve),Ne=B??o(z,ie),je=Y??(ke||"video"===oe?ie.changeVideo:ie.changeImage),xe=e=>{R?pe(e):U?U(e):(e=>{ge.current&&URL.revokeObjectURL(ge.current);const a=URL.createObjectURL(e);ge.current=a,fe(e.type.startsWith("video/")?a:null),L(a)})(e)},we=m({accept:z,maxSizeBytes:H,acceptHint:W,multiple:!1,disabled:ye,onAccept:([e])=>xe(e)}),{dragOver:Le}=we,Re=()=>{ye||(R?pe():we.open())},Ue=w?r(w):"",Ce=!ke&&!!ee,Fe=X||!D&&!M?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:["absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[D&&/* @__PURE__ */k("button",{id:Ce?void 0:be,type:"button","aria-labelledby":`${be}-change`,onClick:()=>Re(),disabled:ue,className:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${x}`,children:[
|
|
2
|
-
/* @__PURE__ */N(p,{name:"swap","aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
|
|
3
|
-
/* @__PURE__ */N("span",{id:`${be}-change`,className:"truncate",children:je})]}),M&&/* @__PURE__ */N("button",{type:"button","aria-label":re,onClick:()=>{ge.current&&(URL.revokeObjectURL(ge.current),ge.current=null),fe(null),L("")},disabled:ue,className:`ml-auto w-8 shrink-0 ${x}`,children:/* @__PURE__ */N(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Oe=/* @__PURE__ */k("div",{...we.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden rounded-(--radius-control) border transition-colors",Ce?"":"bg-gray-100",Le?"border-blue-500":"border-line"].join(" "),style:Ce?void 0:{height:S},children:[Ce?
|
|
4
|
-
/* @__PURE__ */N(a,{value:Z??"",onChange:e=>ee?.(e),label:ae??ie.focus,image:w,hint:null,id:be,disabled:ye,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):ke?/* @__PURE__ */N("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Ue||void 0,className:"h-full w-full",style:{objectFit:I}}):/* @__PURE__ */N("img",{src:w??void 0,alt:Ue,className:"h-full w-full",style:{objectFit:I,objectPosition:Z||void 0}}),q&&w&&/* @__PURE__ */N(n,{children:Ue}),Fe,ue&&/* @__PURE__ */N(l,{label:me,progress:Q,rounded:"rounded-md"})]}),Pe=/* @__PURE__ */N("button",{type:"button",id:be,onClick:()=>Re(),disabled:ye,"aria-label":"string"==typeof Ne?Ne:ie.upload,"aria-busy":ue||void 0,"aria-invalid":!!he||void 0,"aria-required":P||void 0,"aria-describedby":he?`${be}-error`:F?`${be}-hint`:void 0,...we.zoneProps,className:c(Le,ye,d(ye)),style:{minHeight:S},children:ue?/* @__PURE__ */N(u,{state:"busy",verb:me,pct:Q}):/* @__PURE__ */k(j,{children:[
|
|
5
|
-
/* @__PURE__ */N("span",{className:"text-ink-faintest",children:/* @__PURE__ */N(s,{})}),
|
|
6
|
-
/* @__PURE__ */N("span",{className:"px-3 text-xs text-ink-faint",children:Ne}),
|
|
7
|
-
/* @__PURE__ */N("span",{className:"text-sm font-medium text-blue-600",children:te}),W&&/* @__PURE__ */N("span",{className:"text-xs text-ink-faintest",children:W})]})});/* @__PURE__ */
|
|
8
|
-
return k(i,{label:C,htmlFor:be,hint:F,error:he,required:P,className:$,children:[T&&/* @__PURE__ */N("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */N(e,{value:oe,onChange:e=>T(e),options:[{value:"image",label:ie.image,icon:/* @__PURE__ */N(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye},{value:"video",label:ie.video,icon:/* @__PURE__ */N(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye}],block:!0,size:"md",label:"string"==typeof C&&C?C:ie.upload})}),w?Oe:Pe,!R&&/* @__PURE__ */N("input",{...we.inputProps}),
|
|
9
|
-
/* @__PURE__ */N(h,{rejections:we.rejections})]})}export{w as MediaUploadField};
|
package/dist/chunk-FPZBHNZU.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{writeClipboard as e}from"./chunk-PH3P54QQ.js";import{IconButton_default as r}from"./chunk-LE5LWALR.js";import{toast_default as t}from"./chunk-TRWHVG3A.js";import{Icon as n}from"./chunk-UIWGVOFH.js";import{useShellStrings as a}from"./chunk-43MCNASD.js";import{useState as i,useRef as o,useEffect as c,useCallback as l}from"react";import{jsxs as m,jsx as s,Fragment as d}from"react/jsx-runtime";var u={bordered:"border border-gray-300 bg-white",flat:"bg-gray-100"},p={sm:{box:"gap-2 px-3 py-1 text-xs",button:"-my-1"},md:{box:"gap-2 px-3 min-h-8 py-1 text-sm",button:"-my-0.5"}};function b(){/* @__PURE__ */
|
|
2
|
-
return s(n,{name:"copy",className:"h-4 w-4","aria-hidden":"true"})}function h(){/* @__PURE__ */
|
|
3
|
-
return s(n,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function y({value:n,children:y,symbol:f,label:x,size:g="md",variant:k="bordered",hideCopyButton:N=!1,onCopy:v,multiline:w=!1,id:j,"aria-describedby":C,className:L=""}){const[T,A]=i(!1),H=o(null),W=a().copy;c(()=>()=>{H.current&&clearTimeout(H.current)},[]);const B=l(async()=>{await e(n)?(A(!0),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{A(!1),H.current=null},2e3),v?.(n)):t.error(W.failed)},[n,v,W]),{box:G,button:P}=p[g],Q=!N;/* @__PURE__ */
|
|
4
|
-
return m("div",{id:Q?void 0:j,"aria-describedby":Q?void 0:C,className:["inline-flex max-w-full items-center rounded-md",u[k],G,L].filter(Boolean).join(" "),children:[null!=f&&""!==f&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"shrink-0 select-none font-mono text-gray-400",children:f}),
|
|
5
|
-
/* @__PURE__ */s("span",{className:"min-w-0 font-mono text-gray-800 "+(w?"whitespace-pre-wrap break-all":"truncate"),title:w?void 0:n,children:y??n}),!N&&/* @__PURE__ */m(d,{children:[
|
|
6
|
-
/* @__PURE__ */s(r,{id:j,"aria-label":x?W.copyLabel(x):W.copy,"aria-describedby":C,onClick:B,className:`${P} text-gray-400`,children:/* @__PURE__ */s(T?h:b,{})}),
|
|
7
|
-
/* @__PURE__ */s("span",{"aria-live":"polite",className:"sr-only",children:T?W.copied:""})]})]})}export{y as Snippet};
|
package/dist/chunk-GIUX7WUS.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{squarify as e}from"./chunk-46BYGPGD.js";import{AccessibleTable as t}from"./chunk-5PP435FL.js";import{useHighlight as l}from"./chunk-CNYAHYE6.js";import{ChartTooltip as a}from"./chunk-36VIGB6J.js";import{usePlotWidth as r}from"./chunk-MAFUXCPZ.js";import{resolveSeriesColor as i,CHART_INK as o}from"./chunk-TZFACUMR.js";import{useShellStrings as n,useShellLocale as m}from"./chunk-43MCNASD.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{useRef as c,useState as u}from"react";import{jsx as s,jsxs as f}from"react/jsx-runtime";function p({items:p,height:d=320,width:v,gap:x=2,radius:g=3,formatValue:y,color:k,className:b,emptyLabel:j}){const M=n().charts,w=m(),N=y??(e=>h(e,w)),$=j??M.nothingToBreakDown,C=c(null),A=r(C),B=v??A,[F,P]=u(null),{highlighted:z}=l(),D=e(p,B,d);if(0===D.length)/* @__PURE__ */
|
|
2
|
-
return s("div",{className:b,ref:C,children:/* @__PURE__ */s("p",{className:"py-8 text-center text-sm text-gray-500",children:$})});const G=k??i(0),L=Math.max(...D.map(e=>e.value),1),S=e=>34+e/L*62,V=e=>`color-mix(in oklab, ${G} ${S(e).toFixed(0)}%, ${o.surface})`,Y=e=>S(e)>=55?o.surface:o.label,E=F??z,H=F?D.find(e=>e.key===F):void 0;/* @__PURE__ */
|
|
3
|
-
return f("div",{className:`relative ${b??""}`,ref:C,children:[
|
|
4
|
-
/* @__PURE__ */s("svg",{width:"100%",height:d,viewBox:`0 0 ${B} ${d}`,role:"img","aria-label":M.treemap(p.length),onMouseLeave:()=>P(null),children:D.map(e=>{const t=Math.max(0,e.width-x),l=Math.max(0,e.height-x),a=t>6.2*e.label.length+12&&l>30,r=a&&l>44;/* @__PURE__ */
|
|
5
|
-
return f("g",{opacity:E&&E!==e.key?.55:1,onMouseEnter:()=>P(e.key),children:[
|
|
6
|
-
/* @__PURE__ */s("rect",{x:e.x+x/2,y:e.y+x/2,width:t,height:l,rx:g,fill:V(e.value)}),a&&/* @__PURE__ */s("text",{x:e.x+x/2+8,y:e.y+x/2+18,fontSize:12,fontWeight:600,fill:Y(e.value),children:e.label}),r&&/* @__PURE__ */s("text",{x:e.x+x/2+8,y:e.y+x/2+34,fontSize:11,fill:Y(e.value),fillOpacity:.85,style:{fontVariantNumeric:"tabular-nums"},children:N(e.value)})]},e.key)})}),H&&/* @__PURE__ */s("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */s(a,{title:H.label,rows:[{key:"value",label:M.value,color:V(H.value),value:N(H.value)}]})}),
|
|
7
|
-
/* @__PURE__ */s(t,{caption:M.treemap(p.length),head:[M.tableItem,M.value],rows:D.map(e=>[e.label,N(e.value)])})]})}export{p as TreemapChart};
|
package/dist/chunk-GMLGR4R6.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{AccessibleTable as t}from"./chunk-5PP435FL.js";import{arcPath as e}from"./chunk-VFC6QUEN.js";import{useHighlight as o}from"./chunk-CNYAHYE6.js";import{ChartTooltip as n}from"./chunk-36VIGB6J.js";import{CHART_INK as r,resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as l,useShellLocale as i}from"./chunk-43MCNASD.js";import{formatPlain as s}from"./chunk-C3QOHMR6.js";import{useState as c}from"react";import{jsx as d,jsxs as m}from"react/jsx-runtime";function h(t,e,o,n){const r=(t,o)=>{const n=e[t]?.[o];return"number"==typeof n&&Number.isFinite(n)?n:0},a=t.map((e,o)=>t.reduce((t,e,n)=>t+r(o,n)+r(n,o),0)),l=Math.max(2,o),i=t.length>l,s=i?t.map((t,e)=>e).sort((t,e)=>a[e]-a[t]).slice(0,l-1).sort((t,e)=>t-e):t.map((t,e)=>e),c=new Map(s.map((t,e)=>[t,e])),d=i?s.length:-1,m=i?[...s.map(e=>t[e]),n]:[...t],h=m.map(()=>m.map(()=>0));let u=0;t.forEach((e,o)=>t.forEach((t,e)=>{const n=c.get(o)??d,a=c.get(e)??d;n!==d||a!==d?h[n][a]+=r(o,e):u+=r(o,e)}));const f=m.map((t,e)=>m.reduce((t,o,n)=>t+h[e][n]+h[n][e],0));return d>=0&&(f[d]+=u),{labels:m,matrix:h,totals:f,otherIndex:d,foldedCount:i?t.length-s.length:0}}function u({labels:u,matrix:f,size:p=340,maxNodes:x=8,padAngle:g=.04,arcWidth:b=12,formatValue:k,className:v,emptyLabel:M}){const $=l().charts,w=i(),N=k??(t=>s(t,w)),j=M??$.noFlows,[y,F]=c(null),{highlighted:C}=o(),E=h(u,f,x,$.other),{labels:A,matrix:I,otherIndex:z,foldedCount:L}=E,P=(t,e)=>I[t]?.[e]??0,O=t=>t===z?r.muted:a(t),Q=E.totals,V=A.map((t,e)=>e).sort((t,e)=>Q[e]-Q[t]),B=V.reduce((t,e)=>t+Q[e],0);if(B<=0)/* @__PURE__ */return d("p",{className:`text-sm text-gray-500 ${v??""}`,children:j});const H=p/2,R=p/2,S=p/2-44,T=S-b,U=g*V.length,W=/* @__PURE__ */new Map;let Y=-Math.PI/2;V.forEach((t,e)=>{const o=Q[t]/B*(2*Math.PI-U);W.set(t,{start:Y,end:Y+o,slot:e}),Y+=o+g});const D=/* @__PURE__ */new Map,G=[];for(const t of V)for(const e of V){const o=P(t,e);if(o<=0)continue;const n=W.get(t),r=o/Math.max(1,Q[t])*(n.end-n.start),a=D.get(t)??0;D.set(t,a+r),G.push({from:t,to:e,value:o,a:n.start+a+r/2,b:W.get(e).start+(W.get(e).end-W.get(e).start)/2})}const J=(t,e)=>[H+e*Math.cos(t),R+e*Math.sin(t)],Z="arc"===y?.kind?y.index:void 0,q="ribbon"===y?.kind?G[y.index]:void 0;/* @__PURE__ */
|
|
2
|
-
return m("div",{className:`relative ${v??""}`,children:[
|
|
3
|
-
/* @__PURE__ */m("svg",{width:"100%",height:p,viewBox:`0 0 ${p} ${p}`,role:"img","aria-label":$.chord(V.length),onMouseLeave:()=>F(null),children:[G.map((t,e)=>{const[o,n]=J(t.a,T),[r,a]=J(t.b,T),l=O(t.from),i=((t,e)=>y?"ribbon"===y.kind?y.index===e:y.index===t.from||y.index===t.to:null!==C?A[t.from]===C||A[t.to]===C:null)(t,e);/* @__PURE__ */
|
|
4
|
-
return d("path",{d:`M${o},${n} Q${H},${R} ${r},${a}`,fill:"none",stroke:l,strokeWidth:Math.max(1,t.value/B*p*.9),strokeOpacity:null===i||i?.34:.07,strokeLinecap:"round",onMouseEnter:()=>F({kind:"ribbon",index:e})},`${A[t.from]}→${A[t.to]}`)}),V.map(t=>{const o=W.get(t),n=(o.start+o.end)/2,[a,l]=J(n,S+16),i=(t=>y?"arc"===y.kind?y.index===t:G[y.index].from===t||G[y.index].to===t:null!==C?A[t]===C:null)(t);/* @__PURE__ */
|
|
5
|
-
return m("g",{onMouseEnter:()=>F({kind:"arc",index:t}),children:[
|
|
6
|
-
/* @__PURE__ */d("path",{d:e(H,R,T,S,o.start,o.end),fill:O(t),fillOpacity:null===i||i?1:.45}),
|
|
7
|
-
/* @__PURE__ */d("text",{x:a,y:l+4,fontSize:11,fill:r.label,textAnchor:Math.cos(n)>.15?"start":Math.cos(n)<-.15?"end":"middle",children:A[t]})]},t)})]}),L>0&&/* @__PURE__ */d("p",{className:"mt-1 text-xs text-ink-faint",children:$.chordFolded(L)}),void 0!==Z&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:A[Z],rows:[{key:"total",label:$.totalFlow,color:O(Z),value:N(Q[Z])}]})}),q&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(n,{title:`${A[q.from]} → ${A[q.to]}`,rows:[{key:"value",label:$.flow,color:O(q.from),value:N(q.value)}]})}),
|
|
8
|
-
/* @__PURE__ */d(t,{caption:$.chord(V.length),head:[$.tableFrom,$.tableTo,$.value],rows:G.map(t=>[A[t.from],A[t.to],N(t.value)])})]})}export{u as ChordChart,h as foldChord};
|
package/dist/chunk-IMRGGJIJ.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{ChartBrush as t}from"./chunk-WMLBMR4E.js";import{ChartDot as e}from"./chunk-CK2YOGUS.js";import{stepPath as a,curvePath as r,areaBetween as o,areaFrom as l}from"./chunk-VFC6QUEN.js";import{ChartDefs as n,MOTION as i,stagger as s,fillFor as c,dashFor as d,maskId as m}from"./chunk-465RRWBY.js";import{ChartSkeleton as h}from"./chunk-DZBGJ6X4.js";import{useHighlight as u,highlightOpacity as f}from"./chunk-CNYAHYE6.js";import{ChartTooltip as p}from"./chunk-36VIGB6J.js";import{useDragZoom as g,DragBand as y,ChartZoomSummary as k,tooltipBesideBand as x}from"./chunk-BFO72WQB.js";import{usePlotWidth as v}from"./chunk-MAFUXCPZ.js";import{pairedAxes as b,niceAxis as M,niceMax as N,linearScale as w,axisGutter as j,bandScale as $,ladderScale as V}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as z,CHART_INK as A,STATUS_VARS as W}from"./chunk-TZFACUMR.js";import{useShellStrings as L,useShellLocale as R}from"./chunk-43MCNASD.js";import{formatPercent as S,formatPlain as C}from"./chunk-C3QOHMR6.js";import{registerModalEscapeInterceptor as D}from"./chunk-TWVUQUUD.js";import{useRef as E,useState as B,useId as T,useEffect as U}from"react";import{jsx as I,jsxs as P}from"react/jsx-runtime";var F=12,O=16,Q=26,Y=52,G=t=>"number"==typeof t&&Number.isFinite(t);function J({series:J,labels:Z,height:H=200,stacked:K=!1,stackMode:X="value",levels:q,curve:_="linear",tension:tt=0,max:et,yTickCount:at=4,formatValue:rt,formatTooltipValue:ot,tooltipLabels:lt,yAxisLabel:nt,referenceLines:it,labelEndpoints:st=!1,dots:ct,dotVariant:dt="border",pulse:mt=!1,brush:ht=!1,range:ut,onRangeChange:ft,zoomable:pt=!0,columnStrip:gt,onSelect:yt,loading:kt=!1,animate:xt=!0,reveal:vt="left-to-right",fillVariant:bt="gradient",gridStyle:Mt="solid",width:Nt,className:wt,emptyLabel:jt}){const $t=L().charts,Vt=R(),zt=rt??(t=>C(t,Vt)),At=ot??zt,Wt=jt??$t.noData,Lt=E(null),Rt=v(Lt),St=Nt??Rt,[Ct,Dt]=B(null),[Et,Bt]=B(null),{highlighted:Tt}=u(),Ut=T(),It=ut??Et,Pt=g(ht&&It?It[1]-It[0]+1:Z.length,pt);if(U(()=>{if(null!==Ct)return D(t=>"Escape"===t.key&&(Dt(null),!0))},[Ct]),kt)/* @__PURE__ */
|
|
2
|
-
return I("div",{className:wt,ref:Lt,children:/* @__PURE__ */I(h,{height:H,width:Nt??Rt})});const Ft=Z,Ot=ut??Et??[0,Math.max(0,Ft.length-1)],[Qt,Yt]=Ot,Gt=t=>Pt.slice(ht?t.slice(Qt,Yt+1):t),Jt=lt?Gt(lt):void 0,Zt=J.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(G)).map(t=>({...t,data:Gt(t.data),pointTones:t.pointTones?Gt(t.pointTones):void 0})),Ht=t=>(ht?Qt:0)+(Pt.view?.[0]??0)+t;if(Z=Gt(Ft),0===Zt.length||0===Z.length)/* @__PURE__ */
|
|
3
|
-
return I("div",{className:wt,ref:Lt,children:/* @__PURE__ */I("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:H},children:Wt})});const Kt=Z.map((t,e)=>Zt.reduce((t,a)=>t+(G(a.data[e])?a.data[e]:0),0)),Xt=(t,e)=>Kt[e]>0?t/Kt[e]:null,qt=[];if(K){let t=Z.map(()=>0);for(const e of Zt)t=t.map((t,a)=>t+(G(e.data[a])?e.data[a]:0)),qt.push("percent"===X?t.map((t,e)=>Xt(t,e)):[...t])}const _t=!!q&&q.length>0,te=t=>"right"===t.axis,ee=!K&&!_t&&void 0===et&&Zt.some(te)&&Zt.some(t=>!te(t)),ae=gt&&!K?gt:null,re=t=>!!ae&&"column"===t.mode,oe=(ee?Zt.filter(t=>!te(t)):Zt).filter(t=>!re(t)),le=ee?Zt.filter(te).flatMap(t=>t.data.filter(G)):[],ne=K?(qt.at(-1)??[]).filter(G):oe.flatMap(t=>t.data.filter(G)),ie=ee?b([Math.min(0,...ne),Math.max(0,...ne)],[Math.min(0,...le),Math.max(0,...le)],{intervals:at+1,integerLeft:ne.every(Number.isInteger),integerRight:le.every(Number.isInteger)}):null,se=ie?ie.left:K&&"percent"===X||_t||void 0!==et?null:M(K?0:Math.min(0,...ne),Math.max(0,...ne),{intervals:at+1,integer:ne.every(Number.isInteger)}),ce=se?se.lo:0,de=K&&"percent"===X?1:se?se.hi:et??N(Math.max(...ne,0)),me=K&&"percent"===X?t=>S(Math.round(100*t),0,Vt):zt,he=_t?q:se?se.ticks:w([ce,de],{from:0,to:1}).ticks(at+1),ue=j(he.map(me),Y),fe=ie?j(ie.right.ticks.map(zt),O):O,pe={left:ue,right:Math.max(ue+1,St-fe),top:F,bottom:H-Q},ge=$(Z.length,{from:pe.left,to:pe.right}),ye=_t?V(q,{from:pe.bottom,to:pe.top}):null,ke=w([ce,de],{from:pe.bottom,to:pe.top}),xe=ke(Math.max(ce,0)),ve=t=>ye?ye(t):ke(t),be=Zt.filter(re),Me=Math.max(0,...Z.map((t,e)=>be.reduce((t,a)=>t+Math.max(0,G(a.data[e])?a.data[e]:0),0))),Ne=t=>xe-(Me>0?t/Me:0)*(pe.bottom-pe.top)*(ae??0),we=ie?w([ie.right.lo,ie.right.hi],{from:pe.bottom,to:pe.top}):null,je=t=>we&&te(t)?we:ve,$e=ye?ye.levels.map(t=>({value:t,y:ye(t)})):he.map(t=>({value:t,y:ke(t)})),Ve=t=>e=>{e.preventDefault(),Dt(e=>{const a=(e??0)+t;return Math.min(Z.length-1,Math.max(0,a))})},ze=Math.max(1,Math.ceil(Z.length/Math.max(1,Math.floor(St/96))));/* @__PURE__ */
|
|
4
|
-
return P("div",{className:`relative ${wt??""}`,ref:Lt,children:[
|
|
5
|
-
/* @__PURE__ */P("svg",{width:"100%",height:H,viewBox:`0 0 ${St} ${H}`,role:"img","aria-label":$t.overIntervals(Zt.map(t=>t.label),Z.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>Dt(null),onBlur:()=>Dt(null),style:pt?{userSelect:"none",touchAction:"pan-y"}:void 0,onKeyDown:t=>{if(yt&&null!==Ct&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void yt(Ht(Ct));"ArrowRight"===t.key&&Ve(1)(t),"ArrowLeft"===t.key&&Ve(-1)(t)},children:[
|
|
6
|
-
/* @__PURE__ */I("defs",{children:/* @__PURE__ */I("clipPath",{id:Ut,children:/* @__PURE__ */I("rect",{x:pe.left,y:pe.top,width:pe.right-pe.left,height:pe.bottom-pe.top})})}),
|
|
7
|
-
/* @__PURE__ */I(n,{id:Ut,fills:Zt.map((t,e)=>({color:z(t.slot,t.color,t.tone),variant:t.fillVariant??bt})),fadeFrom:K?.42:.3,reveal:!!xt&&vt}),$e.map(t=>/* @__PURE__ */I("line",{x1:pe.left,y1:t.y,x2:pe.right,y2:t.y,stroke:A.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===Mt?"3 3":void 0},`grid-${t.value}`)),
|
|
8
|
-
/* @__PURE__ */I("line",{x1:pe.left,y1:xe,x2:pe.right,y2:xe,stroke:A.axis,strokeWidth:1,shapeRendering:"crispEdges"}),$e.map(t=>/* @__PURE__ */I("text",{x:pe.left-8,y:t.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:me(t.value)},`ytick-${t.value}`)),ie&&$e.map((t,e)=>/* @__PURE__ */I("text",{x:pe.right+8,y:t.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:zt(ie.right.ticks[e])},`ytick-r-${t.value}`)),nt&&/* @__PURE__ */I("text",{x:12,y:(pe.top+pe.bottom)/2,transform:`rotate(-90 12 ${(pe.top+pe.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:A.label,children:nt}),
|
|
9
|
-
/* @__PURE__ */I("g",{clipPath:`url(#${Ut})`,mask:xt&&vt?`url(#${m(Ut)})`:void 0,children:Zt.map((t,e)=>{const n=z(t.slot,t.color,t.tone),m=t.mode??(K?"area":"line"),h=f(t.key,Tt);if("step"===m){const e=Z.map((e,a)=>({start:ge(a),end:ge.end(a),value:t.data[a]})).filter(t=>G(t.value)).map(e=>({start:e.start,end:e.end,y:je(t)(e.value)}));/* @__PURE__ */
|
|
10
|
-
return I("path",{d:a(e),fill:"none",stroke:n,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:h??void 0,className:"rosh-viz-mark"},t.key)}const u=Z.map((a,r)=>{const o=K?qt[e]?.[r]:t.data[r];return G(o)?[ge.center(r),je(t)(o)]:null}).filter(t=>null!==t);if(0===u.length)return null;if("column"===m){const a=Math.max(1,.62*ge.bandwidth),r="solid"===t.fillVariant,o=je(t);return re(t)?/* @__PURE__ */I("g",{opacity:h??void 0,className:"rosh-viz-mark",children:Z.map((o,l)=>{const i=t.data[l];if(!G(i)||i<=0)return null;const s=((t,e)=>be.slice(0,be.findIndex(e=>e.key===Zt[t]?.key)).reduce((t,a)=>t+Math.max(0,G(a.data[e])?a.data[e]:0),0))(e,l),c=Ne(s+i),d=Ne(s)-(s>0?1:0);/* @__PURE__ */
|
|
11
|
-
return I("rect",{x:ge.center(l)-a/2,y:c,width:a,height:Math.max(0,d-c),rx:2,fill:t.pointTones?.[l]?W[t.pointTones[l]]:n,fillOpacity:r?1:.55},l)})},t.key):/* @__PURE__ */I("g",{opacity:h??void 0,className:"rosh-viz-mark",children:Z.map((l,c)=>{const d=K?qt[e]?.[c]:t.data[c];if(!G(d))return null;const m=o(d);/* @__PURE__ */
|
|
12
|
-
return I("rect",{x:ge.center(c)-a/2,y:Math.min(m,xe),width:a,height:Math.abs(xe-m),rx:2,fill:n,fillOpacity:r?1:.35,className:xt?i.rise:void 0,style:xt?s(c,26):void 0},c)})},t.key)}const p=r(u,_,tt),g=K&&e>0?Z.map((t,a)=>[ge.center(a),ve(qt[e-1]?.[a]??0)-2]):null,y=g?o(p,g):l(p,u,xe);/* @__PURE__ */
|
|
13
|
-
return P("g",{opacity:h??void 0,className:"rosh-viz-mark",children:[("area"===m||K)&&
|
|
14
|
-
/* @__PURE__ */I("path",{d:y,fill:c(Ut,e,t.fillVariant??bt,n),stroke:"none"}),
|
|
15
|
-
/* @__PURE__ */I("path",{d:p,fill:"none",stroke:n,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:d(t.stroke??(t.forecast?"animated-dashed":"solid")),className:xt&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?i.march:void 0})]},t.key)})}),it?.map((t,e)=>{const a=t.color??W[t.tone??"critical"],r=ve(t.value);/* @__PURE__ */
|
|
16
|
-
return P("g",{children:[
|
|
17
|
-
/* @__PURE__ */I("line",{x1:pe.left,y1:r,x2:pe.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */I("text",{x:pe.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(ct??(st?"last":"none"))&&Zt.map((t,a)=>{if("column"===t.mode)return null;const r=ct??(st?"last":"none"),o=z(t.slot,t.color,t.tone),l=[...t.data].map(G).lastIndexOf(!0),n="all"===r?Z.map((t,e)=>e).filter(e=>G(K?qt[a]?.[e]:t.data[e])):l>=0?[l]:[];/* @__PURE__ */
|
|
18
|
-
return P("g",{children:[n.map(r=>{const n=K?qt[a]?.[r]:t.data[r];return G(n)?/* @__PURE__ */I(e,{cx:ge.center(r),cy:je(t)(n),color:o,variant:dt,pulse:mt&&r===l,title:`${Z[r]}: ${t.label} ${zt(n)}`},r):null}),st&&l>=0&&G(K?qt[a]?.[l]:t.data[l])&&/* @__PURE__ */I("text",{x:ge.center(l)-10,y:je(t)(K?qt[a]?.[l]:t.data[l])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:zt(K?qt[a]?.[l]:t.data[l])})]},`dots-${t.key}`)}),Z.map((t,e)=>e%ze===0?/* @__PURE__ */I("text",{x:ge.center(e),y:H-8,textAnchor:"middle",fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Ct&&/* @__PURE__ */I("line",{x1:ge.center(Ct),y1:pe.top,x2:ge.center(Ct),y2:pe.bottom,stroke:A.axis,strokeWidth:1}),ae&&Me>0&&
|
|
19
|
-
/* @__PURE__ */P("g",{pointerEvents:"none","data-column-strip":"true",children:[
|
|
20
|
-
/* @__PURE__ */I("line",{x1:pe.left,y1:Ne(Me),x2:pe.right,y2:Ne(Me),stroke:A.grid,strokeWidth:1,strokeDasharray:"2 3",shapeRendering:"crispEdges"}),
|
|
21
|
-
/* @__PURE__ */I("text",{x:pe.left+4,y:Ne(Me)-4,fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:zt(Me)})]}),Pt.drag&&/* @__PURE__ */I(y,{x0:ge(Pt.drag[0]),x1:ge(Pt.drag[1])+ge.bandwidth,top:pe.top,bottom:pe.bottom}),Z.map((t,e)=>/* @__PURE__ */I("rect",{x:ge(e),y:pe.top,width:Math.max(1,ge.bandwidth),height:pe.bottom-pe.top,fill:"transparent",onMouseEnter:()=>Dt(e),onPointerDown:()=>Pt.press(e),onPointerEnter:()=>Pt.over(e),onPointerUp:Pt.release,onClick:yt?()=>yt(Ht(e)):void 0,style:yt?{cursor:"pointer"}:void 0},`hit-${e}`))]}),Pt.view&&/* @__PURE__ */I(k,{from:Jt?.[0]??Z[0],to:Jt?.at(-1)??Z[Z.length-1],count:Z.length,total:K&&"percent"!==X?At(Kt.reduce((t,e)=>t+e,0)):ae?At(be.reduce((t,e)=>t+e.data.filter(G).reduce((t,e)=>t+e,0),0)):void 0,rows:(ae?be:Zt).filter(t=>t.data.some(G)).map(t=>{const e=t.data.filter(G),a=z(t.slot,t.color,t.tone);if(0===e.length)return{key:t.key,label:t.label,color:a,value:"—"};const r=e.reduce((t,e)=>t+e,0),o=K||"column"===t.mode?At(r):$t.zoomLevel(At(r/e.length),At(Math.max(...e)));return{key:t.key,label:t.label,color:a,value:o}}),onClear:Pt.clear}),ht&&Ft.length>2&&/* @__PURE__ */I(t,{className:"mt-1",labels:Ft,width:St,data:J[0]?.data??[],range:Ot,onRangeChange:t=>{ft?ft(t):Bt(t)}}),null!==Ct&&
|
|
22
|
-
/* @__PURE__ */I("div",{className:"pointer-events-none absolute top-2 z-10",style:x(ge.center(Ct),ge.bandwidth,St),children:/* @__PURE__ */I(p,{title:Jt?.[Ct]??Z[Ct],rows:Zt.map((t,e)=>({key:t.key,label:t.label,color:z(t.slot,t.color,t.tone),value:G(t.data[Ct])?K&&"percent"===X?`${S(100*(Xt(t.data[Ct],Ct)??0),1,Vt)} · ${At(t.data[Ct])}`:At(t.data[Ct]):void 0})),footnote:K&&"percent"===X?$t.inBucket(At(Kt[Ct])):void 0})})]})}export{J as TimeSeriesChart};
|
package/dist/chunk-IWFWPFYQ.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{copyToClipboard as e,selectionAt as t}from"./chunk-PH3P54QQ.js";import{escapeHtml as n}from"./chunk-G6DKCCWH.js";import{ListFooter as r}from"./chunk-4H5NTMOF.js";import{ListLoadError as o}from"./chunk-LDEFEPPL.js";import{ResizableTable as l}from"./chunk-MQKUGIN7.js";import{useTableNav as i}from"./chunk-ATMJ5ZPK.js";import{Checkbox_default as a}from"./chunk-CGZBDI6C.js";import{LoadingSpinner as c}from"./chunk-SCGBCBXP.js";import{toast_default as d}from"./chunk-TRWHVG3A.js";import{PopupMenu as s,PopupMenuLabel as h,PopupMenuItem as m,PopupMenuDivider as u}from"./chunk-F44E76EC.js";import{keepsNativeMenu as p}from"./chunk-5QFPTDQF.js";import{LoadingSpinner as f}from"./chunk-R2VKEMZH.js";import{shellHttp as g}from"./chunk-STKJA4PV.js";import{useShellStrings as y}from"./chunk-43MCNASD.js";import{useState as k,useRef as b}from"react";import{jsx as x,Fragment as w,jsxs as C}from"react/jsx-runtime";function j(e){return Array.from(e.children).filter(e=>void 0!==e.dataset?.colKey&&"_select"!==e.dataset.colKey)}function v(e){return("string"==typeof e.innerText?e.innerText:e.textContent??"").replace(/\s+/g," ").trim()}function S(S){const{items:N,isLoading:R,emptyState:L,totalCount:P,isError:T,onRetry:$,errorTitle:E,errorMessage:M,tableId:A,columns:F,renderCell:K,getRowId:D=e=>e.id,sort:H,onSort:I,selected:U,setSelected:B,onRowClick:G,onRowHover:O,getRowClassName:Q,footerLabel:W,footerExtra:_,sentinelRef:J,isFetchingNextPage:V,saveDefaultPerms:Z,exportEndpoint:z,exportFilename:X="export.csv",contextActions:q}=S,[Y,ee]=k(null),te=b(null),ne=y(),re=ne.entityList,oe=e=>{B(t=>{const n=new Set(t),r=D(e);return n.has(r)?n.delete(r):n.add(r),n})},le=()=>{B(e=>{const t=N.map(D),n=new Set(e);return t.every(t=>e.has(t))?t.forEach(e=>n.delete(e)):t.forEach(e=>n.add(e)),n})},ie=i(N,G,oe,le,(e,t)=>{B(n=>{const r=new Set(n);for(let n=e;n<=t;n++)r.add(D(N[n]));return r})},te),ae=N.filter(e=>U.has(D(e))),ce=()=>{const e=[...te.current?.querySelectorAll("tr[data-row-idx]")??[]].filter(e=>{const t=N[Number(e.dataset.rowIdx)];return void 0!==t&&U.has(D(t))}),t=e.length?j(e[0]).map(e=>e.dataset.colKey??""):[],n=new Map(F.map(e=>[e.key,e.label]));return{keys:t,header:t.map(e=>n.get(e)??e),body:e.map(e=>j(e).map(v))}},de=()=>{ee(null);const{header:t,body:r}=ce();if(!r.length)return;const o=[t,...r].map(e=>e.join("\t")).join("\n"),l="<table><thead><tr>"+t.map(e=>`<th>${n(e)}</th>`).join("")+"</tr></thead><tbody>"+r.map(e=>`<tr>${e.map(e=>`<td>${n(e)}</td>`).join("")}</tr>`).join("")+"</tbody></table>";e(re.copiedRows(r.length),o,l)},se=async()=>{ee(null);const e=ae.map(D);if(!e.length||!z)return;const t=new URLSearchParams({ids:e.join(",")}),n=(()=>{const e=new Map(F.map(e=>[e.key,e.exportLabel??e.label]));try{const t=localStorage.getItem(`col-config-${A}`);if(t){const n=JSON.parse(t).filter(t=>!t.hidden&&"_select"!==t.key&&e.has(t.key)).map(t=>`${t.key}|${e.get(t.key)}`);if(n.length)return n.join(",")}}catch{}return F.filter(e=>!e.defaultHidden).map(e=>`${e.key}|${e.exportLabel??e.label}`).join(",")})();n&&t.set("cols",n);const r=z.includes("?")?"&":"?";try{const n=await g.get(`${z}${r}${t}`,{responseType:"blob"}),o=window.URL.createObjectURL(new Blob([n.data],{type:"text/csv"})),l=document.createElement("a");l.href=o,l.download=X,l.click(),window.URL.revokeObjectURL(o);const i=n.headers??{},a=Number(i["x-row-count"]);if("true"===String(i["x-truncated"]))return void d.notify(Number.isFinite(a)?re.exportTruncated(a,e.length):re.exportTruncatedUnknown(e.length));d.success(re.exported(e.length))}catch{d.error(re.exportFailed)}};if(R)/* @__PURE__ */return x(c,{});if(T&&0===N.length)/* @__PURE__ */
|
|
2
|
-
return x(o,{title:E,message:M,onRetry:$});if(0===N.length)/* @__PURE__ */return x(w,{children:L});const he=N.length>0&&ae.length===N.length,me=ae.length>0&&!he,ue=U.size-ae.length,pe=[{key:"_select",label:"",defaultWidth:52,minWidth:52,headerNode:/* @__PURE__ */x(a,{"aria-label":ne.table.selectAll,checked:he,indeterminate:me,onChange:le,style:{height:14,width:14}})},...F],fe=/* @__PURE__ */x(r,{selectedCount:ae.length,hiddenSelectedCount:ue,loadedCount:N.length,totalCount:P,label:W,isFetchingMore:V,extra:_}),ge=J?/* @__PURE__ */C(w,{children:[
|
|
3
|
-
/* @__PURE__ */x("div",{ref:J}),V&&/* @__PURE__ */x(f,{size:"sm",padding:"py-3",label:ne.list.loadingMore})]}):void 0;let ye=null;if(Y){const{x:t,y:n,item:r,text:o,firstColumn:l}=Y,i=q?q(ae):[],a=ae.length,c=()=>ee(null),d=void 0!==P&&P>N.length;ye=/* @__PURE__ */C(s,{portal:!0,style:{left:t,top:n},onClose:c,minWidth:210,children:[
|
|
4
|
-
/* @__PURE__ */x(h,{children:ue>0?ne.list.selectedNotShown(a,ue):ne.list.selected(a)}),
|
|
5
|
-
/* @__PURE__ */x(m,{className:"font-medium",onClick:()=>{c(),G(r)},children:re.open}),
|
|
6
|
-
/* @__PURE__ */x(u,{}),o&&/* @__PURE__ */x(m,{onClick:()=>{c(),e(re.copiedText,o.text,o.html)},children:re.copy}),l&&/* @__PURE__ */x(m,{onClick:()=>(t=>{ee(null);const{keys:n,body:r}=ce(),o=n.indexOf(t.key);o<0||!r.length||e(t.label,r.map(e=>e[o]).join("\n"))})(l),children:re.copyColumn(l.label)}),
|
|
7
|
-
/* @__PURE__ */x(m,{disabled:0===a,onClick:de,children:re.copyRows(a)}),z&&/* @__PURE__ */x(m,{onClick:se,children:re.exportSelected}),i.map((e,t)=>/* @__PURE__ */C("div",{children:[(e.divider||0===t)&&/* @__PURE__ */x(u,{}),
|
|
8
|
-
/* @__PURE__ */x(m,{danger:e.danger,disabled:e.disabled,onClick:()=>{c(),e.onClick(ae)},children:e.label})]},t)),
|
|
9
|
-
/* @__PURE__ */x(u,{}),!he&&/* @__PURE__ */x(m,{onClick:()=>{c(),B(e=>/* @__PURE__ */new Set([...e,...N.map(D)]))},children:d?re.selectAllLoaded(N.length):re.selectAll}),
|
|
10
|
-
/* @__PURE__ */x(m,{onClick:()=>{c(),B(/* @__PURE__ */new Set)},children:re.clearSelection}),$&&/* @__PURE__ */x(m,{onClick:()=>{c(),$()},children:re.refresh})]})}/* @__PURE__ */
|
|
11
|
-
return C("div",{className:"flex-1 flex flex-col mb-1 bg-white rounded-lg shadow overflow-hidden",children:[
|
|
12
|
-
/* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(l,{tableId:A,columns:pe,sort:H,onSort:I,footer:fe,afterBody:ge,saveDefaultPerms:Z,children:e=>/* @__PURE__ */x("tbody",{ref:te,className:"divide-y divide-gray-100",children:N.map((n,r)=>{const o=D(n);/* @__PURE__ */
|
|
13
|
-
return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ie===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":U.has(o)?"bg-blue-50 hover:bg-blue-100":"hover:bg-gray-50"} ${Q?.(n)??""}`,onClick:()=>G(n),onContextMenu:e=>((e,n)=>{if(e.shiftKey||p(e.target))return;e.preventDefault();const r=D(n);U.has(r)||B(/* @__PURE__ */new Set([r]));const o=j(e.currentTarget)[0]?.dataset.colKey,l=o?F.find(e=>e.key===o)?.label:void 0;ee({x:e.clientX,y:e.clientY,item:n,text:t(e.target),firstColumn:o&&l?{key:o,label:l}:null})})(e,n),onMouseEnter:O?()=>O(n):void 0,children:e.map(e=>/* @__PURE__ */x("td",{"data-col-key":e.key,className:"px-4 py-3 whitespace-nowrap text-sm overflow-hidden",children:"_select"===e.key?/* @__PURE__ */x(a,{"aria-label":ne.table.selectRow,checked:U.has(o),onChange:()=>oe(n),onClick:e=>e.stopPropagation(),style:{height:14,width:14}}):K(n,e.key)},e.key))},o)})})})}),ye]})}export{S as EntityList};
|
package/dist/chunk-KZD2AFH2.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{nextEnabledIndex as e}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as t,filterOptionItems as n,optionMatches as r,groupedRows as l,OptionCheck as o,OptionSublabel as i}from"./chunk-7HIHQR3X.js";import{END_ACTIONS_PAD as a,InputEndActionSlot as s,InputEndActionButton as c}from"./chunk-7JY3YYN4.js";import{INPUT_BASE_ON as u,INPUT_BASE as d}from"./chunk-AYZY3YNC.js";import{Button_default as h}from"./chunk-EOVXFXVV.js";import{Icon as p}from"./chunk-UIWGVOFH.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import{Tooltip as f}from"./chunk-NJN5IKWO.js";import{onOverlayOpen as b}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as v,MENU_MAX_HEIGHT as w}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as y}from"./chunk-D65T4H6J.js";import{GLASS_DIVIDER as x,glassStyle as k}from"./chunk-5FYDNH4Y.js";import{useShellStrings as N}from"./chunk-43MCNASD.js";import{registerModalEscapeInterceptor as j}from"./chunk-TWVUQUUD.js";import{useState as $,useId as D,useRef as C,useMemo as S,useEffect as W}from"react";import{createPortal as F}from"react-dom";import{jsxs as M,jsx as R}from"react/jsx-runtime";function E(e,t){const n=e.length;if(0===n||t(e.join(", ")))return{shown:n,cut:!1};if(1===n)return{shown:1,cut:!0};let r=0;for(let l=1;l<n&&t(`${e.slice(0,l).join(", ")} +${n-l}`);l+=1)r=l;return{shown:r,cut:!1}}var O=["right-2","right-8","right-16"],z=[8,32,64];function A(A){const{options:H,placeholder:L,emptyOptionLabel:T,className:Y="",disabled:I,id:U,filter:V=!1,allowFreeText:J=!1,freeTextOption:B,onSearchChange:X,loading:G=!1,error:K,onRetry:Q,rightAdornment:Z,endAction:P,renderOption:q,clearable:_=!0,"aria-label":ee,"aria-labelledby":te,"aria-describedby":ne}=A,re=!0===A.multiple,le=A.multiple?A.value:A.value?[A.value]:[],oe=A.multiple?"":A.value,ie=e=>{A.multiple?A.onChange(e):A.onChange(e[0]??"")},ae=le.length>0,se=V&&ae&&!I,ce=re||V,ue=null!=B,de=J||ue,[he,pe]=$(!1),[me,fe]=$(-1),be=D(),ge=U??`${be}-input`,ve=`${be}-listbox`,we=e=>`${be}-opt-${e}`,[ye,xe]=$(""),ke=N(),Ne=T??ke.select.none,je=e=>{xe(e),fe(-1),X?.(e)},$e=C(null),De=C(null),Ce=C(null),Se=C(null),We=C(he);We.current=he;const Fe=C(!1),Me=e=>{We.current&&(We.current=!1,e&&J&&!ue&&et&&(re?le.includes(et)||ie([...le,et]):et!==oe&&ie([et])),pe(!1),je(""))},Re=(e,t)=>{if(!e.disabled){if(re)return ie(le.includes(e.value)?le.filter(t=>t!==e.value):[...le,e.value]),void(e===tt?je(""):fe(t));ie([e.value]),Me(!1)}},[Ee,Oe]=$(null);y(()=>{if(!Z||he)return void Oe(null);const e=Se.current?.offsetWidth??0;Oe(e?e+z[Ie]+6:null)});const ze=v(De,he,ce?{popupRef:Ce}:{matchTriggerWidth:!0}),Ae=S(()=>t(H),[H]),He=le.join("\0"),Le=S(()=>{const e=[],t=/* @__PURE__ */new Set;for(const n of Ae)le.includes(n.value)&&!t.has(n.value)&&(t.add(n.value),e.push(n.label));if(de)for(const n of le)t.has(n)||e.push(n);return e},[Ae,He,de]),Te=Le.join(", "),Ye=_&&ae&&!I,Ie=(Ye?1:0)+(P?1:0),[Ue,Ve]=$(null),Je=C(null),Be=C(""),Xe=C(()=>{});Xe.current=()=>{const e=De.current,t=Je.current;if(!re||!e||!t)return;const n=getComputedStyle(e),r=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),l=[n.fontStyle,n.fontWeight,n.fontSize,n.fontFamily,n.letterSpacing].join("|"),o=`${r}|${l}|${Le.join("\0")}`;if(o===Be.current)return;Be.current=o;let i=null;r>0&&Le.length>0&&(t.style.fontStyle=n.fontStyle,t.style.fontWeight=n.fontWeight,t.style.fontSize=n.fontSize,t.style.fontFamily=n.fontFamily,t.style.letterSpacing=n.letterSpacing,i=E(Le,e=>(t.textContent=e,t.getBoundingClientRect().width<=r)),t.textContent=""),Ve(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},y(()=>{Xe.current()}),W(()=>{const e=De.current;if(!re||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Xe.current());return t.observe(e),()=>t.disconnect()},[re]);const Ge=Le.length,Ke=!re||!Ue||Ue.shown>=Ge?Te:0===Ue.shown?ke.select.selectedCount(Ge):`${Le.slice(0,Ue.shown).join(", ")} +${Ge-Ue.shown}`,Qe=re&&null!==Ue&&(Ue.shown<Ge||Ue.cut),Ze=he&&ae&&ce;W(()=>{if(!he)return;const e=e=>{const t=e.target;$e.current?.contains(t)||Ce.current?.contains(t)||Me(!0)};document.addEventListener("mousedown",e);const t=b(()=>Me(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[he,J,ye,He,A.onChange]),W(()=>{if(he)return j(e=>!("Escape"!==e.key||!We.current)&&(Me(!1),De.current?.blur(),!0),()=>Ce.current)},[he]);const Pe=S(()=>{const e=/* @__PURE__ */new Set;return n(H,t=>!e.has(t.value)&&(e.add(t.value),!0))},[H]),qe=S(()=>{if(X)return Pe;const e=ye.trim().toLowerCase();return e?n(Pe,t=>r(t,e)):Pe},[Pe,ye,X]),_e=S(()=>t(qe),[qe]),et=ye.trim(),tt=S(()=>ue&&et?Ae.some(e=>e.label===et)||le.includes(et)?null:{value:et,label:et}:null,[ue,et,Ae,He]),nt=S(()=>tt?[..._e,tt]:_e,[_e,tt]);/* @__PURE__ */
|
|
2
|
-
return M("div",{ref:$e,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&($e.current?.contains(t)||Ce.current?.contains(t))||Fe.current||document.activeElement!==De.current&&Me(!0)},children:[(rt=/* @__PURE__ */R("input",{id:ge,ref:De,type:"text",autoComplete:"off",role:"combobox","aria-expanded":he,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":he?ve:void 0,"aria-activedescendant":he&&me>=0&&me<nt.length?we(me):void 0,"aria-label":te?void 0:ee,"aria-labelledby":te,"aria-describedby":ne,value:he?ye:Ke,onChange:e=>{je(e.target.value),pe(!0)},onFocus:()=>{I||(je(""),pe(!0))},onKeyDown:t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){if(I)return;if(t.preventDefault(),!he)return void pe(!0);if(0===nt.length)return;const n="ArrowDown"===t.key?1:-1;return void fe(t=>e(nt,t,n))}"Enter"===t.key?(t.preventDefault(),he&&me>=0&&me<nt.length?Re(nt[me],me):1!==_e.length||_e[0].disabled?J&&!ue&&et&&(re?(le.includes(et)||ie([...le,et]),je("")):(ie([et]),Me(!1),De.current?.blur())):Re(_e[0],0)):"Escape"===t.key?(Me(!1),De.current?.blur()):"Tab"===t.key&&Me(!0)},placeholder:Ze?Ke:L||Ne,className:`${se?u:d} ${Y} ${a[Ie]}${I?"bg-surface-sunken text-ink-faintest cursor-not-allowed":""} truncate${Ze?" rosh-field-shows-choice":""}`,style:Ee?{paddingRight:Ee}:void 0,disabled:I}),re?/* @__PURE__ */R(f,{content:!he&&Qe?Te:null,className:"block",children:rt}):rt),re&&
|
|
3
|
-
/* @__PURE__ */R("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */R("span",{ref:Je,className:"whitespace-pre"})}),Ie>0&&
|
|
4
|
-
/* @__PURE__ */M(s,{children:[Ye&&
|
|
5
|
-
/* @__PURE__ */R("span",{onMouseDown:e=>e.preventDefault(),className:"flex opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",children:/* @__PURE__ */R(c,{action:{label:ke.select.clear,icon:/* @__PURE__ */R(p,{name:"close"}),onClick:()=>{ie([]),Me(!1)}}})}),P&&/* @__PURE__ */R("span",{onMouseDown:e=>e.preventDefault(),className:"flex",children:/* @__PURE__ */R(c,{action:P})})]}),Z&&!he&&/* @__PURE__ */R("div",{ref:Se,className:`absolute top-1/2 -translate-y-1/2 ${O[Ie]} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:Z}),he&&F(
|
|
6
|
-
/* @__PURE__ */M("div",{ref:Ce,onMouseDownCapture:()=>{Fe.current=!0,setTimeout(()=>{Fe.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:g.popup,left:ze?.left,right:ze?.right,top:ze?.top,bottom:ze?.bottom,minWidth:ze?.minWidth,width:ze?.width,...ce&&{maxWidth:ze?.maxWidth},visibility:ze?void 0:"hidden",...k()},children:[re&&ae&&_&&!I&&
|
|
7
|
-
/* @__PURE__ */R("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),ie([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-row-hover border-b ${x}`,children:ke.select.clearAll}),G?
|
|
8
|
-
/* @__PURE__ */R(m,{size:"sm",padding:"py-2",label:ke.search.searching}):K?/* @__PURE__ */M("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
|
|
9
|
-
/* @__PURE__ */R("span",{className:"min-w-0 flex-1",children:K}),Q&&/* @__PURE__ */R(h,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:Q,className:"shrink-0",children:ke.list.retry})]}):null,
|
|
10
|
-
/* @__PURE__ */M("div",{id:ve,role:nt.length?"listbox":void 0,"aria-labelledby":nt.length?te??(ee?void 0:ge):void 0,"aria-label":nt.length&&!te?ee:void 0,"aria-multiselectable":!(!nt.length||!re)||void 0,className:"overflow-y-auto",style:{maxHeight:ze?.maxHeight??w},children:[0===nt.length?G||K?null:/* @__PURE__ */R("p",{className:"px-3 py-3 text-sm text-ink-faintest text-center",children:ke.select.noMatches}):0===_e.length?null:l(qe,(e,t)=>{const n=le.includes(e.value);/* @__PURE__ */
|
|
11
|
-
return M("button",{id:we(t),type:"button",role:"option","aria-selected":n,"aria-disabled":e.disabled||void 0,tabIndex:-1,onMouseDown:n=>{(e.disabled||re)&&n.preventDefault(),Re(e,t)},className:"w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center justify-between gap-2 whitespace-nowrap "+(e.disabled?"cursor-not-allowed text-gray-400":`hover:bg-gray-50 ${n?"text-blue-600 font-medium":"text-gray-700"} ${t===me?"bg-gray-100":n?"bg-blue-50/50":""}`),children:[re&&/* @__PURE__ */R(o,{selected:n}),
|
|
12
|
-
/* @__PURE__ */R("span",{className:`min-w-0 ${ce?"flex-auto":"flex-1"} truncate`,children:q?q(e,{selected:n,active:t===me}):e.label}),e.sublabel&&/* @__PURE__ */R(i,{grows:ce,children:e.sublabel})]},e.value)},be),tt&&B&&
|
|
13
|
-
/* @__PURE__ */R("button",{id:we(_e.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{re&&e.preventDefault(),Re(tt,_e.length)},className:`w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 whitespace-nowrap text-ink hover:bg-row-hover ${_e.length?`border-t ${x}`:""} ${me===_e.length?"bg-gray-100":""}`,children:/* @__PURE__ */R("span",{className:"min-w-0 flex-1 truncate",children:B(tt.value)})},`${be}-typed`)]})]}),document.body)]});var rt}export{A as SearchableSelect,E as fitChoice};
|
package/dist/chunk-LE5LWALR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{iconButtonClasses as e}from"./chunk-UQYNPYF4.js";import{isAriaDisabled as r,swallowPress as a,describedByWith as i,OffWithReason as s}from"./chunk-TE6R53YD.js";import{forwardRef as d,useId as n}from"react";import{jsx as o}from"react/jsx-runtime";var t=d(function({children:d,variant:t="ghost",size:c="md",type:l="button",className:m="",pressed:b,disabledReason:p,ink:u,disabled:f,onClick:h,"aria-disabled":k,"aria-describedby":v,...y},N){const j=n(),Y=(Boolean(f)||r(k))&&null!=p&&""!==p,x=Y||r(k),z=/* @__PURE__ */o("button",{ref:N,type:l,className:e({variant:t,size:c,pressed:b??(!0===y["aria-pressed"]||"true"===y["aria-pressed"]),ink:u,className:m}),...y,disabled:Y?void 0:f,"aria-disabled":!!x||k,"aria-describedby":i(v,Y?j:void 0),onClick:x?a:h,children:d});return Y?/* @__PURE__ */o(s,{reason:p,id:j,children:z}):z});export{t as IconButton_default};
|
package/dist/chunk-LJJSFJA2.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import{toast_default as e}from"./chunk-TRWHVG3A.js";import{useShellStrings as t}from"./chunk-43MCNASD.js";import{forwardRef as n,useRef as r,useState as o,useMemo as i,useEffect as a,useImperativeHandle as l}from"react";import{jsx as c,jsxs as s,Fragment as d}from"react/jsx-runtime";var u=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],h=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],p=()=>Math.random().toString(36).slice(2,9),x=n(function({src:n,filename:x,onApply:m,onCancel:g},N){const L=r(null),z=r(null),D=r(null),P=r(null),$=t().annotator,E=r($);E.current=$;const[I,S]=o("select"),[W,B]=o(u[0]),[R,j]=o(4),[H,T]=o(24),[F,A]=o(h[0].id),[U,O]=o(!0),[K,V]=o(!1),[Z,G]=o(!1),[X,q]=o(null),[Y,_]=o(null),[J,Q]=o(6),[ee,te]=o(12),[ne,re]=o([]),[oe,ie]=o(null),[ae,le]=o(null),[ce,se]=o(null),[de,ue]=o(1),[he,pe]=o(null),[xe,ye]=o(null),[me,ge]=o(null),fe=r(null),[we,be]=o(!1),ve=i(()=>ce?{w:ce.w*de,h:ce.h*de}:null,[ce,de]),ke=ve&&ae?ve.w/ae.w:1,Me=i(()=>ne.find(e=>e.id===oe)??null,[ne,oe]);a(()=>{"select"===I&&Me&&("color"in Me&&B(Me.color),"stroke"in Me&&j(Me.stroke),"rect"===Me.type&&te(Me.radius),"text"===Me.type&&(T(Me.size),A(Me.font),O(Me.bold),V(Me.italic),G(Me.underline),q(Me.borderColor),_(Me.background),Q(Me.padding)))},[oe]),a(()=>{const t=new Image;t.crossOrigin="anonymous",t.onload=()=>{P.current=t,le({w:t.naturalWidth,h:t.naturalHeight}),re([]),ie(null)},t.onerror=()=>e.error(E.current.loadFailed),t.src=n},[n]),a(()=>{if(!ae)return;const e=()=>{const e=L.current;if(!e)return;const t=e.getBoundingClientRect(),n=Math.max(0,t.width-32),r=Math.max(0,t.height-32);if(0===n||0===r)return;const o=ae.w/ae.h;let i=ae.w,a=ae.h;i>n&&(i=n,a=i/o),a>r&&(a=r,i=a*o),se({w:i,h:a})};e();const t=new ResizeObserver(e);return L.current&&t.observe(L.current),()=>t.disconnect()},[ae]);const Ne=i(()=>ne.filter(e=>"mosaic"===e.type),[ne]);a(()=>{const e=P.current,t=z.current;if(!e||!t||!ae)return;t.width=ae.w,t.height=ae.h;const n=t.getContext("2d");n.drawImage(e,0,0);for(const e of Ne)C(n,e)},[ae,Ne,ce]);const Ce=e=>{const t=D.current;if(!t)return{x:0,y:0};const n=t.createSVGPoint();n.x=e.clientX,n.y=e.clientY;const r=t.getScreenCTM();if(!r)return{x:0,y:0};const o=n.matrixTransform(r.inverse());return{x:o.x,y:o.y}},Le=e=>{fe.current=e,be(!0)};a(()=>{if(!we)return;const e=e=>{const t=fe.current;if(!t)return;const n=Ce(e);if("draw"===t.kind)pe(b(I,t.start,n,W,R,ee));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(n.x-e.x)>1||Math.abs(n.y-e.y)>1)&&(t.points.push(n),pe({id:"",type:"draw",points:t.points.slice(),color:W,stroke:R}))}else if("crop"===t.kind)ge(M(t.start,n));else if("move"===t.kind){const e=n.x-t.start.x,r=n.y-t.start.y;re(n=>n.map(n=>n.id===t.id?v(t.original,e,r):n))}else"resize"===t.kind&&re(e=>e.map(e=>e.id===t.id?function(e,t,n){if("arrow"===e.type)return"start"===t?{...e,x1:n.x,y1:n.y}:"end"===t?{...e,x2:n.x,y2:n.y}:e;if("text"===e.type||"draw"===e.type)return e;const r=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=r,c=i,s=o,d=a;"nw"===t&&(l=n.x,c=n.y);"ne"===t&&(s=n.x,c=n.y);"se"===t&&(s=n.x,d=n.y);"sw"===t&&(l=n.x,d=n.y);const u=M({x:l,y:c},{x:s,y:d});return{...e,x:u.x,y:u.y,w:u.w,h:u.h}}(t.original,t.corner,n):e))},t=()=>{const e=fe.current;if(fe.current=null,be(!1),"draw"===e?.kind)pe(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const n={...e,id:p()};return re(e=>[...e,n]),ie(n.id),S("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void pe(null);const t={id:p(),type:"draw",points:e.points,color:W,stroke:R};re(e=>[...e,t]),ie(t.id),S("select"),pe(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[we,I,W,R,ee]);a(()=>{const e=e=>{if(!document.activeElement||!/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName))return!e.metaKey&&!e.ctrlKey||"z"!==e.key&&"Z"!==e.key||e.shiftKey?void(oe&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),re(e=>e.filter(e=>e.id!==oe)),ie(null)):"Escape"===e.key&&ie(null))):(e.preventDefault(),re(e=>e.slice(0,-1)),void ie(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe]);const ze=e=>{const t=!{bold:U,italic:K,underline:Z}[e];"bold"===e&&O(t),"italic"===e&&V(t),"underline"===e&&G(t),oe&&re(n=>n.map(n=>n.id===oe&&"text"===n.type?{...n,[e]:t}:n))},De=e=>{q(e),oe&&re(t=>t.map(t=>t.id===oe&&"text"===t.type?{...t,borderColor:e}:t))},Pe=e=>{_(e),oe&&re(t=>t.map(t=>t.id===oe&&"text"===t.type?{...t,background:e}:t))},$e=e=>{if(!xe)return;const t=e??xe.value;if(!t.trim())return xe.editingId&&re(e=>e.filter(e=>e.id!==xe.editingId)),void ye(null);if(xe.editingId)re(e=>e.map(e=>e.id===xe.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:p(),type:"text",x:xe.x,y:xe.y,text:t,color:W,size:H,font:F,bold:U,italic:K,underline:Z,borderColor:X,background:Y,padding:J};re(t=>[...t,e]),ie(e.id),S("select")}ye(null)},Ee=async()=>{const e=z.current,t=D.current;if(!e||!t||!ae)return null;const n=document.createElement("canvas");n.width=ae.w,n.height=ae.h;const r=n.getContext("2d");r.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),c=new Image;return await new Promise(e=>{c.onload=()=>e(),c.onerror=()=>e(),c.src=l}),r.drawImage(c,0,0,ae.w,ae.h),URL.revokeObjectURL(l),n};l(N,()=>({save:async()=>{const t=await Ee();t&&t.toBlob(t=>{if(!t)return void e.error(E.current.exportFailed);const n=URL.createObjectURL(t),r=document.createElement("a");r.href=n;const o=x.replace(/\.[^.]+$/,"");r.download=`${o}-annotated.png`,r.click(),URL.revokeObjectURL(n)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void e.error(E.current.clipboardUnsupported);const t=await Ee();t&&t.toBlob(async t=>{if(t)try{await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),e.success(E.current.copied)}catch{e.error(E.current.copyRefused)}else e.error(E.current.copyFailed)},"image/png")}}),[ae,x]);const Ie=i(()=>[{id:"select",label:$.toolSelect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:$.toolDraw,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:$.toolRect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:$.toolEllipse,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:$.toolArrow,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:$.toolMosaic,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:$.toolText,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:$.toolCrop,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[$]),Se=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),We=Me?.type??("select"===I?null:I),Be="rect"===We||"circle"===We||"arrow"===We||"draw"===We,Re="rect"===We,je="text"===We;/* @__PURE__ */
|
|
2
|
-
return s("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
3
|
-
/* @__PURE__ */s("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Ie.map(e=>/* @__PURE__ */c("button",{onClick:()=>{S(e.id),ie(null)},title:e.label,className:Se(I===e.id),children:e.icon},e.id)),
|
|
4
|
-
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
5
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-1",children:u.map(e=>/* @__PURE__ */c("button",{onClick:()=>(e=>{B(e),oe&&re(t=>t.map(t=>t.id!==oe||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(W===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Be&&/* @__PURE__ */s(d,{children:[
|
|
6
|
-
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
7
|
-
/* @__PURE__ */s("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
8
|
-
/* @__PURE__ */c("span",{children:$.weight}),
|
|
9
|
-
/* @__PURE__ */c("input",{type:"range",min:1,max:20,step:1,value:R,onChange:e=>{return t=Number(e.target.value),j(t),void(oe&&re(e=>e.map(e=>e.id!==oe?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
10
|
-
/* @__PURE__ */c("span",{className:"tabular-nums w-5 text-right",children:R})]})]}),Re&&/* @__PURE__ */s(d,{children:[
|
|
11
|
-
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
12
|
-
/* @__PURE__ */s("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
13
|
-
/* @__PURE__ */c("span",{children:$.radius}),
|
|
14
|
-
/* @__PURE__ */c("input",{type:"range",min:0,max:48,step:1,value:ee,onChange:e=>{return t=Number(e.target.value),te(t),void(oe&&re(e=>e.map(e=>e.id===oe&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
15
|
-
/* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:ee})]})]}),je&&/* @__PURE__ */s(d,{children:[
|
|
16
|
-
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
17
|
-
/* @__PURE__ */c("select",{value:F,onChange:e=>{return t=e.target.value,A(t),void(oe&&re(e=>e.map(e=>e.id===oe&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:h.map(e=>/* @__PURE__ */c("option",{value:e.id,children:$[e.name]},e.id))}),
|
|
18
|
-
/* @__PURE__ */c("button",{onClick:()=>ze("bold"),className:Se(U),title:$.bold,children:/* @__PURE__ */c("span",{className:"font-bold",children:$.boldLetter})}),
|
|
19
|
-
/* @__PURE__ */c("button",{onClick:()=>ze("italic"),className:Se(K),title:$.italic,children:/* @__PURE__ */c("span",{className:"italic",children:$.italicLetter})}),
|
|
20
|
-
/* @__PURE__ */c("button",{onClick:()=>ze("underline"),className:Se(Z),title:$.underline,children:/* @__PURE__ */c("span",{className:"underline",children:$.underlineLetter})}),
|
|
21
|
-
/* @__PURE__ */s("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
22
|
-
/* @__PURE__ */c("span",{children:$.size}),
|
|
23
|
-
/* @__PURE__ */c("input",{type:"range",min:10,max:96,step:1,value:H,onChange:e=>{return t=Number(e.target.value),T(t),void(oe&&re(e=>e.map(e=>e.id===oe&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
24
|
-
/* @__PURE__ */c("span",{className:"tabular-nums w-7 text-right",children:H})]}),
|
|
25
|
-
/* @__PURE__ */s("label",{className:"flex items-center gap-1 text-gray-600",children:[
|
|
26
|
-
/* @__PURE__ */c("span",{children:$.border}),X?/* @__PURE__ */s(d,{children:[
|
|
27
|
-
/* @__PURE__ */c("input",{type:"color",value:X,onChange:e=>De(e.target.value),title:$.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
|
|
28
|
-
/* @__PURE__ */c("button",{onClick:()=>De(null),title:$.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>De(W),title:$.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:$.add})]}),
|
|
29
|
-
/* @__PURE__ */s("label",{className:"flex items-center gap-1 text-gray-600",children:[
|
|
30
|
-
/* @__PURE__ */c("span",{children:$.fill}),Y?/* @__PURE__ */s(d,{children:[
|
|
31
|
-
/* @__PURE__ */c("input",{type:"color",value:Y,onChange:e=>Pe(e.target.value),title:$.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
|
|
32
|
-
/* @__PURE__ */c("button",{onClick:()=>Pe(null),title:$.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>Pe("#ffffff"),title:$.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:$.add})]}),
|
|
33
|
-
/* @__PURE__ */s("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
34
|
-
/* @__PURE__ */c("span",{children:$.padding}),
|
|
35
|
-
/* @__PURE__ */c("input",{type:"range",min:0,max:40,step:1,value:J,onChange:e=>{return t=Number(e.target.value),Q(t),void(oe&&re(e=>e.map(e=>e.id===oe&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
|
|
36
|
-
/* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:J})]})]}),
|
|
37
|
-
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
38
|
-
/* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.max(.25,Math.round(100*(e-.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:$.zoomOut,children:"−"}),
|
|
39
|
-
/* @__PURE__ */s("span",{className:"text-gray-600 tabular-nums w-10 text-center",children:[Math.round(100*de),"%"]}),
|
|
40
|
-
/* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.min(4,Math.round(100*(e+.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:$.zoomIn,children:"+"}),
|
|
41
|
-
/* @__PURE__ */c("button",{onClick:()=>ue(1),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:$.fitHint,children:$.fit}),
|
|
42
|
-
/* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
43
|
-
/* @__PURE__ */c("button",{onClick:()=>{re(e=>e.slice(0,-1)),ie(null)},disabled:0===ne.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:$.undo}),
|
|
44
|
-
/* @__PURE__ */s("div",{className:"ml-auto flex items-center gap-2",children:[me&&/* @__PURE__ */s(d,{children:[
|
|
45
|
-
/* @__PURE__ */c("button",{onClick:()=>{if(!me||!P.current||!ae)return;const e=me,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const n=t.getContext("2d"),r=document.createElement("canvas");r.width=ae.w,r.height=ae.h;const o=r.getContext("2d");o.drawImage(P.current,0,0);for(const e of Ne)C(o,e);n.drawImage(r,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{P.current=i,le({w:i.naturalWidth,h:i.naturalHeight}),re(t=>t.filter(e=>"mosaic"!==e.type).map(t=>v(t,-e.x,-e.y)).filter(e=>function(e,t,n){const r=k(e);return r.x+r.w>0&&r.y+r.h>0&&r.x<t&&r.y<n}(e,i.naturalWidth,i.naturalHeight))),ge(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:$.applyCrop}),
|
|
46
|
-
/* @__PURE__ */c("button",{onClick:()=>ge(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:$.cancel})]}),m&&!me&&/* @__PURE__ */s(d,{children:[g&&/* @__PURE__ */c("button",{onClick:g,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:$.cancel}),
|
|
47
|
-
/* @__PURE__ */c("button",{onClick:async()=>{const t=await Ee();t?t.toBlob(t=>{t?m(t):e.error(E.current.exportFailed)},"image/png"):e.error(E.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:$.apply})]})]})]}),
|
|
48
|
-
/* @__PURE__ */c("div",{ref:L,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:ve&&ae&&/* @__PURE__ */s("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:ve.w,height:ve.h},children:[
|
|
49
|
-
/* @__PURE__ */c("canvas",{ref:z,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
|
|
50
|
-
/* @__PURE__ */s("svg",{ref:D,viewBox:`0 0 ${ae.w} ${ae.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===I?"default":"text"===I?"text":"crosshair"},onPointerDown:e=>{if("select"===I)return void ie(null);if("text"===I){if(xe)return void $e();const t=Ce(e);return void ye({x:t.x,y:t.y,value:""})}const t=Ce(e);if("crop"!==I){if("draw"===I)return Le({kind:"pen",points:[t]}),void pe({id:"",type:"draw",points:[t],color:W,stroke:R});pe(b(I,t,t,W,R,ee)),Le({kind:"draw",start:t})}else Le({kind:"crop",start:t})},children:[ne.map(e=>/* @__PURE__ */c(y,{anno:e,selected:oe===e.id,zoom:de,onPointerDown:t=>((e,t)=>{"select"===I&&(e.stopPropagation(),ie(t.id),Le({kind:"move",id:t.id,start:Ce(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&ye({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,n)=>((e,t,n)=>{e.stopPropagation(),Le({kind:"resize",id:t.id,corner:n,start:Ce(e),original:t})})(t,e,n)},e.id)),he&&/* @__PURE__ */c(y,{anno:{...he,id:"__preview"},preview:!0}),me&&/* @__PURE__ */c(f,{rect:me,imageSize:ae})]}),xe&&/* @__PURE__ */c(w,{pendingText:xe,color:W,size:H,font:h.find(e=>e.id===F)?.css??h[0].css,bold:U,italic:K,underline:Z,borderColor:X,background:Y,padding:J,scale:ke,onChange:e=>ye({...xe,value:e}),onCommit:$e,onCancel:()=>ye(null)})]})}),
|
|
51
|
-
/* @__PURE__ */c("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===I?oe?$.hintSelected:$.hintSelect:"text"===I?$.hintText:"crop"===I?$.hintCrop:"draw"===I?$.hintDraw:$.hintShape})]})});function y({anno:e,selected:t,preview:n,zoom:r=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=k(e),u=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},p=i?{onDoubleClick:i}:{};let x;if("rect"===e.type)x=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...u});else if("circle"===e.type)x=/* @__PURE__ */c("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...u});else if("arrow"===e.type)x=/* @__PURE__ */c(g,{anno:e,interactive:u});else if("draw"===e.type)x=/* @__PURE__ */c("path",{d:N(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...u});else if("mosaic"===e.type)x=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:t?"#3b82f6":"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...u});else{const t=h.find(t=>t.id===e.font)?.css??h[0].css,n=e.padding??0,r=!!e.borderColor||!!e.background,o=k(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;x=/* @__PURE__ */s("g",{...u,...p,children:[r&&/* @__PURE__ */c("rect",{x:o.x-n,y:o.y-n,width:Math.max(0,o.w)+2*n,height:Math.max(0,o.h)+2*n,rx:Math.min(8,n),ry:Math.min(8,n),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
|
|
52
|
-
/* @__PURE__ */c("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,n)=>/* @__PURE__ */c("tspan",{x:e.x,dy:0===n?0:1.2*e.size,children:t},n))})]})}/* @__PURE__ */
|
|
53
|
-
return s("g",{children:[x,t&&!n&&/* @__PURE__ */s(d,{children:[
|
|
54
|
-
/* @__PURE__ */c("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",stroke:"#3b82f6",strokeWidth:2/r,strokeDasharray:`${6/r},${4/r}`,pointerEvents:"none"}),a&&/* @__PURE__ */c(m,{anno:e,zoom:r,onHandlePointerDown:a})]})]})}function m({anno:e,zoom:t,onHandlePointerDown:n}){const r=6/t,o=1.5/t,i=e=>({fill:"#fff",stroke:"#3b82f6",strokeWidth:o,pointerEvents:"all",style:{cursor:e},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
|
|
55
|
-
return s(d,{children:[
|
|
56
|
-
/* @__PURE__ */c("circle",{cx:e.x1,cy:e.y1,r:r,...i("grab"),onPointerDown:e=>n(e,"start")}),
|
|
57
|
-
/* @__PURE__ */c("circle",{cx:e.x2,cy:e.y2,r:r,...i("grab"),onPointerDown:e=>n(e,"end")})]});if("text"===e.type||"draw"===e.type)return null;const a=e.x,l=e.y,u=e.w,h=e.h;/* @__PURE__ */
|
|
58
|
-
return s(d,{children:[
|
|
59
|
-
/* @__PURE__ */c("circle",{cx:a,cy:l,r:r,...i("nwse-resize"),onPointerDown:e=>n(e,"nw")}),
|
|
60
|
-
/* @__PURE__ */c("circle",{cx:a+u,cy:l,r:r,...i("nesw-resize"),onPointerDown:e=>n(e,"ne")}),
|
|
61
|
-
/* @__PURE__ */c("circle",{cx:a+u,cy:l+h,r:r,...i("nwse-resize"),onPointerDown:e=>n(e,"se")}),
|
|
62
|
-
/* @__PURE__ */c("circle",{cx:a,cy:l+h,r:r,...i("nesw-resize"),onPointerDown:e=>n(e,"sw")})]})}function g({anno:e,interactive:t}){const n=Math.max(12,4*e.stroke),r=Math.atan2(e.y2-e.y1,e.x2-e.x1),o=r+Math.PI-Math.PI/7,i=r+Math.PI+Math.PI/7,a=`M${e.x2},${e.y2} L${e.x2+n*Math.cos(o)},${e.y2+n*Math.sin(o)} L${e.x2+n*Math.cos(i)},${e.y2+n*Math.sin(i)} Z`;/* @__PURE__ */
|
|
63
|
-
return s("g",{...t,children:[
|
|
64
|
-
/* @__PURE__ */c("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round"}),
|
|
65
|
-
/* @__PURE__ */c("path",{d:a,fill:e.color})]})}function f({rect:e,imageSize:t}){/* @__PURE__ */
|
|
66
|
-
return s("g",{pointerEvents:"none",children:[
|
|
67
|
-
/* @__PURE__ */c("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fill:"rgba(0,0,0,0.45)",fillRule:"evenodd"}),
|
|
68
|
-
/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"#fff",strokeWidth:2,strokeDasharray:"8,6"})]})}function w({pendingText:e,color:n,size:o,font:i,bold:l,italic:s,underline:d,borderColor:u,background:h,padding:p,scale:x,onChange:y,onCommit:m,onCancel:g}){const f=r(null),w=t().annotator;a(()=>{const e=requestAnimationFrame(()=>{f.current?.focus(),f.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const b=()=>m(f.current?.value),v=u?Math.max(1,Math.round(o/12)):0;/* @__PURE__ */
|
|
69
|
-
return c("div",{style:{position:"absolute",left:e.x*x+"px",top:e.y*x+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */c("textarea",{ref:f,value:e.value,onChange:e=>y(e.target.value),onBlur:b,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),b())},placeholder:w.textPlaceholder,rows:1,className:"outline-none resize-none shadow-(--elevation-panel)",style:{color:n,fontSize:o*x+"px",fontFamily:i,fontWeight:l?700:400,fontStyle:s?"italic":"normal",textDecoration:d?"underline":void 0,minWidth:80,padding:p*x+"px",borderRadius:Math.min(8,p)*x+"px",border:u?`${v*x}px solid ${u}`:"1px dashed #60a5fa",background:h??"rgba(255,255,255,0.95)"}})})}function b(e,t,n,r,o,i){if("rect"===e){const e=M(t,n);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:r,stroke:o,radius:i}}if("circle"===e){const e=M(t,n);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:r,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:n.x,y2:n.y,color:r,stroke:o};if("mosaic"===e){const e=M(t,n);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function v(e,t,n){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+n,x2:e.x2+t,y2:e.y2+n}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+n}))}:(e.type,{...e,x:e.x+t,y:e.y+n})}function k(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,n=e.points[0].x,r=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>n&&(n=i.x),i.y<r&&(r=i.y),i.y>o&&(o=i.y);return{x:t,y:r,w:n-t,h:o-r}}if("text"===e.type){const t=e.text.split("\n"),n=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:n*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function M(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function N(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let n=1;n<e.length;n++)t+=` L ${e[n].x} ${e[n].y}`;return t}function C(e,t){const n=Math.round(Math.max(0,t.x)),r=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-n,t.w)),i=Math.round(Math.min(e.canvas.height-r,t.h));if(o<2||i<2)return;const a=e.getImageData(n,r,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let n=0,r=0,l=0,c=0,s=0;const d=Math.min(12,o-t),u=Math.min(12,i-e);for(let i=0;i<u;i++)for(let u=0;u<d;u++){const d=4*((e+i)*o+(t+u));n+=a.data[d],r+=a.data[d+1],l+=a.data[d+2],c+=a.data[d+3],s++}n=Math.round(n/s),r=Math.round(r/s),l=Math.round(l/s),c=Math.round(c/s);for(let i=0;i<u;i++)for(let s=0;s<d;s++){const d=4*((e+i)*o+(t+s));a.data[d]=n,a.data[d+1]=r,a.data[d+2]=l,a.data[d+3]=c}}e.putImageData(a,n,r)}export{x as ImageAnnotator_default};
|