efficient-shell 8.22.0 → 8.23.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 +31 -0
- package/dist/{Browser-VZU2MTSA.js → Browser-NSOMITHS.js} +14 -14
- package/dist/Calculator-WZIBSVDK.js +29 -0
- package/dist/{CurrencyConverter-BSQCX3HS.js → CurrencyConverter-BX5HDEX6.js} +8 -8
- package/dist/{Documents-NR3T434J.js → Documents-LEB2ZSZD.js} +20 -20
- package/dist/{Files-QMV2E74S.js → Files-4P5YEYDE.js} +23 -23
- package/dist/{Notepad-M5MCY5DV.js → Notepad-UNPC3Q4F.js} +10 -10
- package/dist/{PdfViewer-OODU3XIT.js → PdfViewer-67VBUIRD.js} +1 -1
- package/dist/PomodoroTimer-LBFYGZHA.js +91 -0
- package/dist/{Preview-QTDCPMCL.js → Preview-3FABZUXV.js} +27 -27
- package/dist/Sidebar-OIWVKYUU.js +43 -0
- package/dist/{Spreadsheet-V2EWOJML.js → Spreadsheet-AADGH3IX.js} +14 -14
- package/dist/{Stock-U3G45T36.js → Stock-5TKATE4I.js} +3 -3
- package/dist/{Weather-GEC4VHLM.js → Weather-NQJCUUUN.js} +17 -17
- package/dist/{WorldClock-6ORV4NHF.js → WorldClock-QYZF2JCO.js} +6 -6
- package/dist/ai/index.js +13 -13
- package/dist/apps/index.d.ts +1 -1
- 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/ChartBrush.js +1 -1
- package/dist/charts/ChartFrame.js +1 -1
- package/dist/charts/ChartSkeleton.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.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/Meter.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/RankedBars.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/StatTile.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-74QAQXSB.js → chunk-2C6IG7LG.js} +1 -1
- package/dist/{chunk-XUQQCKKD.js → chunk-37CCKGHU.js} +1 -1
- package/dist/chunk-3EKWDVBV.js +29 -0
- package/dist/{chunk-W7ZAFS7C.js → chunk-3GHBY2FP.js} +7 -7
- package/dist/{chunk-C3ZZDCBU.js → chunk-3IYMTPGR.js} +18 -18
- package/dist/{chunk-WXIEWJF7.js → chunk-3PGK3VFS.js} +1 -1
- package/dist/{chunk-I2FHDMIN.js → chunk-3PNKI44X.js} +6 -6
- package/dist/{chunk-KFSNSDTW.js → chunk-3V5Z2BJY.js} +12 -12
- package/dist/{chunk-Q6A6W3DI.js → chunk-3XQGEILM.js} +1 -1
- package/dist/{chunk-QSN7X27F.js → chunk-4CFOKYVR.js} +7 -7
- package/dist/{chunk-D3BDPSVV.js → chunk-4F3IKYUO.js} +6 -6
- package/dist/{chunk-QUS3C264.js → chunk-4NXMMWL6.js} +1 -1
- package/dist/{chunk-PHYI7M45.js → chunk-4VLKDANH.js} +1 -1
- package/dist/{chunk-6AJM3QNG.js → chunk-4YUCXIRP.js} +1 -1
- package/dist/{chunk-VWMTQLVS.js → chunk-5PY4H4ZJ.js} +1 -1
- package/dist/{chunk-R4JU7MU2.js → chunk-64FIE4SX.js} +7 -7
- package/dist/chunk-6CRERVSV.js +1 -0
- package/dist/chunk-6NMDKOQA.js +7 -0
- package/dist/{chunk-PFB2NSSS.js → chunk-6WSTN5A3.js} +5 -5
- package/dist/{chunk-R5FFVK2W.js → chunk-72YFU346.js} +1 -1
- package/dist/{chunk-SDORX5C2.js → chunk-77FLITYM.js} +6 -6
- package/dist/{chunk-DIZW2GZP.js → chunk-7CFH6Y4T.js} +1 -1
- package/dist/{chunk-3UL7IB25.js → chunk-BI6ZLD4X.js} +7 -7
- package/dist/{chunk-X2U5XB7J.js → chunk-BMZSMXE6.js} +1 -1
- package/dist/chunk-BOBUSE33.js +2 -0
- package/dist/{chunk-VNYFGNHO.js → chunk-BRHIRE4D.js} +4 -4
- package/dist/{chunk-QZRH7L2E.js → chunk-BSNWVZHW.js} +1 -1
- package/dist/{chunk-74HUZZPT.js → chunk-BY2OWWKC.js} +1 -1
- package/dist/chunk-CRLSG5AY.js +9 -0
- package/dist/{chunk-F6YMKW5G.js → chunk-CZ25A5RS.js} +1 -1
- package/dist/{chunk-V4WNEJ63.js → chunk-D2AUUIKG.js} +1 -1
- package/dist/{chunk-RIGW3E5M.js → chunk-D7FT2PXG.js} +5 -5
- package/dist/{chunk-SSOLRTVS.js → chunk-DFDDRKIJ.js} +1 -1
- package/dist/{chunk-5EK4DFB5.js → chunk-DISSJYKV.js} +7 -7
- package/dist/{chunk-BUWOFJGM.js → chunk-DITCVBR7.js} +10 -10
- package/dist/chunk-DODH46ZQ.js +8 -0
- package/dist/{chunk-IMDLBXO3.js → chunk-DTSCO7VM.js} +1 -1
- package/dist/{chunk-ZY62UQI2.js → chunk-DZNG34DC.js} +19 -19
- package/dist/{chunk-YF7A3BWA.js → chunk-E5ALJIXV.js} +4 -4
- package/dist/chunk-E6UCGCOC.js +1 -0
- package/dist/{chunk-PZFETJAG.js → chunk-EJUR35JG.js} +1 -1
- package/dist/{chunk-DIW6WT5L.js → chunk-ERMZ75FO.js} +1 -1
- package/dist/{chunk-F3AROMIU.js → chunk-ETF7LAYZ.js} +6 -6
- package/dist/{chunk-F6YIUCIJ.js → chunk-EYKUKN32.js} +4 -4
- package/dist/{chunk-NYLXA2EG.js → chunk-EZ3BQ6PK.js} +7 -7
- package/dist/{chunk-SFWIYB4T.js → chunk-FL2PUQX7.js} +1 -1
- package/dist/{chunk-X7JK22X2.js → chunk-GATKJSGL.js} +5 -5
- package/dist/{chunk-56C5SEZ7.js → chunk-GIM2422N.js} +1 -1
- package/dist/{chunk-HLZZ5Q5E.js → chunk-GQACKEKW.js} +16 -16
- package/dist/{chunk-TCN7XUCY.js → chunk-GWIPZKZJ.js} +4 -4
- package/dist/chunk-H33Z4ZIY.js +11 -0
- package/dist/{chunk-GVNDUNQL.js → chunk-H3BC4KDE.js} +1 -1
- package/dist/{chunk-IUBWN3OA.js → chunk-HVX37PKU.js} +1 -1
- package/dist/chunk-I4VD5D43.js +8 -0
- package/dist/chunk-IFDW5QW6.js +2 -0
- package/dist/{chunk-OPFCLDVM.js → chunk-IHQX4GYD.js} +1 -1
- package/dist/{chunk-6PWLY2LQ.js → chunk-IZCODCSC.js} +1 -1
- package/dist/{chunk-KBLMTCTD.js → chunk-JEXXJK7H.js} +1 -1
- package/dist/{chunk-MRLQH2GZ.js → chunk-JNDBRSYZ.js} +2 -2
- package/dist/{chunk-ONEF47LG.js → chunk-JPP7UWQA.js} +3 -3
- package/dist/{chunk-TYZ4IY7F.js → chunk-JUGPTBMS.js} +2 -2
- package/dist/{chunk-SH6ZLK4K.js → chunk-JWIKHVF4.js} +8 -8
- package/dist/{chunk-L2JOLPJR.js → chunk-JYLVX2FW.js} +1 -1
- package/dist/{chunk-SO4WAMVA.js → chunk-K7KQDPLW.js} +5 -5
- package/dist/{chunk-5OGWWBJY.js → chunk-KDZUWQEG.js} +1 -1
- package/dist/{chunk-CJKDYVNE.js → chunk-KKSW5IZ7.js} +6 -6
- package/dist/{chunk-POMS7YQN.js → chunk-KZHPX4FM.js} +2 -2
- package/dist/{chunk-35VA5UFB.js → chunk-LK2SICMI.js} +1 -1
- package/dist/{chunk-3APQ5V6P.js → chunk-LLLAIPFX.js} +1 -1
- package/dist/{chunk-WBU7NZBP.js → chunk-M5P6A7KS.js} +1 -1
- package/dist/{chunk-52L6IBTN.js → chunk-MAOJENIB.js} +1 -1
- package/dist/{chunk-ZLGU4VYO.js → chunk-MEYYQC43.js} +5 -5
- package/dist/{chunk-7AINUMUA.js → chunk-MMFJBWJC.js} +1 -1
- package/dist/{chunk-MIZO6SQ3.js → chunk-MTXTJLFK.js} +2 -2
- package/dist/{chunk-BJKZYQFA.js → chunk-MXHEREC6.js} +3 -3
- package/dist/{chunk-BBYHBN3R.js → chunk-NHCRQ7SW.js} +1 -1
- package/dist/chunk-NID6MGGC.js +13 -0
- package/dist/{chunk-SLORZA7W.js → chunk-NMK4UQXZ.js} +12 -12
- package/dist/{chunk-QLAQ6ASB.js → chunk-NT26CWMZ.js} +5 -5
- package/dist/{chunk-GTKNEJ3X.js → chunk-NVE6L27I.js} +8 -8
- package/dist/{chunk-CQZEO4UV.js → chunk-NWP6IJYK.js} +9 -9
- package/dist/{chunk-AXQBQH55.js → chunk-OFOLUFNB.js} +15 -15
- package/dist/{chunk-LQHWFL5Y.js → chunk-OHVAD3NO.js} +2 -2
- package/dist/{chunk-IOESXYEI.js → chunk-OVVXSAGE.js} +8 -8
- package/dist/{chunk-Z4UKLPGE.js → chunk-PDXD6DT7.js} +1 -1
- package/dist/{chunk-ALYBCDHU.js → chunk-PNGL4ZW2.js} +6 -6
- package/dist/{chunk-2TBC254V.js → chunk-PNQ4EYYM.js} +3 -3
- package/dist/{chunk-JXGYIV44.js → chunk-PPFMXLEX.js} +9 -9
- package/dist/{chunk-IJICE6KT.js → chunk-Q3OCGLW7.js} +2 -2
- package/dist/{chunk-TSOBVLV5.js → chunk-QEV346OG.js} +1 -1
- package/dist/{chunk-D7AA5WE2.js → chunk-QFA5COE6.js} +1 -1
- package/dist/{chunk-ZI7P5YGF.js → chunk-QQCHLRKG.js} +1 -1
- package/dist/{chunk-XCHY6QVH.js → chunk-QQK3XS6H.js} +8 -8
- package/dist/{chunk-46M6AYFJ.js → chunk-R6DGLGB3.js} +1 -1
- package/dist/chunk-RGBX3EVC.js +11 -0
- package/dist/{chunk-GKTCCPME.js → chunk-RUQEB2ZC.js} +3 -3
- package/dist/{chunk-5LNFW5E4.js → chunk-RYBJ6MMM.js} +1 -1
- package/dist/{chunk-2RJKMYON.js → chunk-S7VSXUKS.js} +3 -3
- package/dist/{chunk-O3NLPJH2.js → chunk-SB7OTZI4.js} +19 -19
- package/dist/{chunk-5B73MLXV.js → chunk-SBHFEWR6.js} +1 -1
- package/dist/chunk-SG2MTCA2.js +100 -0
- package/dist/chunk-SXORVKIZ.js +9 -0
- package/dist/{chunk-CREVU3AF.js → chunk-TW7TA2AB.js} +1 -1
- package/dist/{chunk-JLPTSC66.js → chunk-TXS6JKFV.js} +1 -1
- package/dist/{chunk-DQB3ORB7.js → chunk-UB4BTRSB.js} +5 -5
- package/dist/{chunk-4ELYV3L6.js → chunk-UKB2I3UK.js} +1 -1
- package/dist/{chunk-XFIMTNUH.js → chunk-UVUBZL7K.js} +1 -1
- package/dist/{chunk-JGZLLQAN.js → chunk-UX6HNRFV.js} +7 -7
- package/dist/chunk-VTVOQS5L.js +20 -0
- package/dist/{chunk-V23TPYHO.js → chunk-VU6VPKM3.js} +6 -6
- package/dist/{chunk-WQKGBPOQ.js → chunk-WJ3XSJ6B.js} +1 -1
- package/dist/chunk-WSPO4N72.js +19 -0
- package/dist/{chunk-TJPPV7KZ.js → chunk-WTY3SXO7.js} +1 -1
- package/dist/{chunk-2IV4XF3Y.js → chunk-WYN5KVU4.js} +3 -3
- package/dist/chunk-X6PPP6NX.js +14 -0
- package/dist/{chunk-6DT7HG3F.js → chunk-XHBQPVNG.js} +1 -1
- package/dist/{chunk-5BBDUKQP.js → chunk-Y2D2YMFY.js} +12 -12
- package/dist/{chunk-ZVTOB4RE.js → chunk-Y4MI6NRI.js} +1 -1
- package/dist/{chunk-ZMLRNHMS.js → chunk-Y5T257HX.js} +3 -3
- package/dist/{chunk-FW2EEIDB.js → chunk-YCQVEJOT.js} +2 -2
- package/dist/{chunk-JACPHDTK.js → chunk-YDYDR72S.js} +1 -1
- package/dist/chunk-YSFLXPUS.js +7 -0
- package/dist/{chunk-BJEBOXTR.js → chunk-YW2DH6YQ.js} +3 -3
- package/dist/{chunk-U4QZIU7X.js → chunk-ZEKM6HAA.js} +2 -2
- package/dist/{chunk-352MVBF7.js → chunk-ZN3O2KJ7.js} +18 -18
- package/dist/chunk-ZNCU3UIW.js +8 -0
- package/dist/{chunk-FDENTKSM.js → chunk-ZNXBKFV7.js} +5 -5
- package/dist/{chunk-SRMRRJ5K.js → chunk-ZSRRV44J.js} +1 -1
- package/dist/{chunk-2JYQF3PJ.js → chunk-ZTB6EMC7.js} +1 -1
- package/dist/data/DataTable.js +1 -1
- package/dist/data/Kanban.js +1 -1
- package/dist/data/ListFooter.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/Pagination.js +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Calendar.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/DateTimePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/FormErrorSummary.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/ImageFocusPoint.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/PositionInput.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/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/TimePicker.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/mediaLibraryMenu.js +1 -1
- package/dist/forms/mediaMoveItems.js +1 -1
- package/dist/forms/useFileIntake.js +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.js +377 -377
- package/dist/locales/zh-Hans.js +1 -1
- 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/Accordion.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/Avatar.js +1 -1
- package/dist/shell/Banner.js +1 -1
- package/dist/shell/Breadcrumbs.js +1 -1
- package/dist/shell/BudgetBar.js +1 -1
- package/dist/shell/Card.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContainerFillChart.js +1 -1
- package/dist/shell/CountBadge.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/EmptyState.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/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/MetricBar.js +1 -1
- package/dist/shell/MetricBarLegend.js +1 -1
- package/dist/shell/MilestoneTimeline.js +1 -1
- package/dist/shell/PageHeader.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/ResizeHandle.js +1 -1
- package/dist/shell/Result.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/Statistic.js +1 -1
- package/dist/shell/TimeAgo.js +1 -1
- package/dist/shell/TimelineTrack.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/language.js +1 -1
- package/dist/shell/strings.d.ts +5 -0
- package/dist/shell/strings.js +1 -1
- package/dist/shell/toast.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/ErrorPage.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/{types-BOinJXUf.d.ts → types-ClT92-8Z.d.ts} +13 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-DKZHOHOD.js +0 -29
- package/dist/PomodoroTimer-I423ZZOQ.js +0 -91
- package/dist/Sidebar-UVBEI4DQ.js +0 -43
- package/dist/chunk-6JCIQ7XL.js +0 -8
- package/dist/chunk-6UBBY54N.js +0 -2
- package/dist/chunk-B73YLHD2.js +0 -99
- package/dist/chunk-CPM3BQGV.js +0 -14
- package/dist/chunk-DSYIKLOK.js +0 -11
- package/dist/chunk-EUOFKZI3.js +0 -19
- package/dist/chunk-LVAGFIWK.js +0 -2
- package/dist/chunk-MWNZY33B.js +0 -13
- package/dist/chunk-NE42BDQX.js +0 -9
- package/dist/chunk-NHFLTKPK.js +0 -11
- package/dist/chunk-O5KDTFK5.js +0 -8
- package/dist/chunk-PMOGQHYX.js +0 -20
- package/dist/chunk-RPK3U2K2.js +0 -9
- package/dist/chunk-RPTQCFLR.js +0 -29
- package/dist/chunk-URFWJZTV.js +0 -7
- package/dist/chunk-VKMEQKYT.js +0 -1
- package/dist/chunk-W7NZKU27.js +0 -7
- package/dist/chunk-YPXVOPL4.js +0 -1
- package/dist/chunk-Z5TCGLCM.js +0 -8
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-
|
|
2
|
-
/* @__PURE__ */v("input",{ref:M,type:"file",accept:".pdf,.dxf,.jpg,.jpeg,.png,.gif,.webp,.svg,.avif,.bmp,.stp,.step,.stl,.obj,.gltf,.glb,.3mf,.iges,.igs,.ply,.fbx",onChange:e=>{const t=e.target.files?.[0];t&&
|
|
3
|
-
/* @__PURE__ */w("button",{onClick:
|
|
1
|
+
import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-QQK3XS6H.js";import{ImageAnnotator_default as r}from"./chunk-SB7OTZI4.js";import{AboutApp as s}from"./chunk-OHVAD3NO.js";import{peekPdfPreviewStage as i,claimPdfPreviewStage as a,PDF_PREVIEW_UPDATE_EVENT as o}from"./chunk-ESL5TDNA.js";import{WindowTitle as l,getActiveModalId as c}from"./chunk-SG2MTCA2.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-JDCM2VHG.js";import"./chunk-KNUR2UEG.js";import"./chunk-HVX37PKU.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-FL2PUQX7.js";import"./chunk-ZN3O2KJ7.js";import"./chunk-YCQVEJOT.js";import"./chunk-KC3EX26K.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as d}from"./chunk-4NXMMWL6.js";import"./chunk-O6JX6RDX.js";import"./chunk-5QFPTDQF.js";import"./chunk-BY2OWWKC.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-D323R2FT.js";import"./chunk-CDAJKLGL.js";import"./chunk-6KO5VTL7.js";import"./chunk-6CRERVSV.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as u}from"./chunk-KIBL6M3T.js";import"./chunk-J75ZT2JQ.js";import{SpinnerRing as p,LoadingSpinner as m}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as y,splitAround as x}from"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as f,useState as g,useEffect as b}from"react";import{jsxs as w,jsx as v,Fragment as k}from"react/jsx-runtime";var N=!1;function C(e,t){return e?.url&&e.url!==t.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url),t}function A(){const n=f(void 0);void 0===n.current&&(n.current=i());const[r,p]=g(n.current?.data??null);b(()=>{const e=n.current;null!=e&&(a(e),p(t=>t===e.data?t:C(t,e.data)))},[]),b(()=>{const e=n.current?.token;if(null==e)return;const t=t=>{const n=t.detail;n&&n.token===e&&p(e=>C(e,n.data))};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const m=f(void 0);b(()=>{m.current=r?.url},[r?.url]);const h=f(null);b(()=>(null!==h.current&&(clearTimeout(h.current),h.current=null),()=>{const e=m.current;e?.startsWith("blob:")&&(h.current=setTimeout(()=>URL.revokeObjectURL(e),0))}),[]);const N=y().preview,A=r?.filename?(L=r.filename).length>24?`${L.slice(0,23)}…`:L:N.untitled;var L;const M=f(null),z=f(null),[j,T]=g(null),[R,D]=g(!1),W=f(0),H=()=>M.current?.click(),P=()=>{W.current=0,D(!1)},I=e=>{const t=e.closest("[data-modal-id]");return!t||c()===t.dataset.modalId};b(()=>{const e=()=>P(),t=()=>P(),n=e=>{"Escape"===e.key&&P()};return window.addEventListener("dragend",e),window.addEventListener("drop",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",t),window.removeEventListener("keydown",n)}},[]);const X=e=>{const t=(e.name.split(".").pop()||"").toLowerCase(),n="pdf"===t?"pdf":"dxf"===t?"dxf":["jpg","jpeg","png","gif","webp","svg","avif","bmp"].includes(t)?"image":["stp","step","stl","obj","gltf","glb","3mf","iges","igs","ply","fbx"].includes(t)?"3d":void 0;if(!n)return void("dwg"===t?d.error(N.dwgUnsupported):d.error(N.unsupportedType(t)));const r=URL.createObjectURL(e);p(t=>(t?.url?.startsWith("blob:")&&t.url!==r&&URL.revokeObjectURL(t.url),{url:r,filename:e.name,kind:n}))},B=/* @__PURE__ */w("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
2
|
+
/* @__PURE__ */v("input",{ref:M,type:"file",accept:".pdf,.dxf,.jpg,.jpeg,.png,.gif,.webp,.svg,.avif,.bmp,.stp,.step,.stl,.obj,.gltf,.glb,.3mf,.iges,.igs,.ply,.fbx",onChange:e=>{const t=e.target.files?.[0];t&&X(t),M.current&&(M.current.value="")},className:"hidden"}),
|
|
3
|
+
/* @__PURE__ */w("button",{onClick:H,className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
4
4
|
/* @__PURE__ */v(u,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),N.open]}),
|
|
5
5
|
/* @__PURE__ */v("span",{className:"text-2xs text-gray-400 ml-1",children:N.formats}),r?.filename&&/* @__PURE__ */w(k,{children:[
|
|
6
6
|
/* @__PURE__ */v("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
7
7
|
/* @__PURE__ */v("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:r.filename,children:r.filename})]}),
|
|
8
|
-
/* @__PURE__ */v("div",{ref:T,className:"ml-auto flex items-center gap-1 text-xs"})]});let U;if(r)U=r.converting||!r.url?/* @__PURE__ */v(E,{filename:r.filename,message:r.convertingMessage}):"dxf"===r.kind?/* @__PURE__ */v(S,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"3d"===r.kind?/* @__PURE__ */v(F,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"image"===r.kind?/* @__PURE__ */v(
|
|
8
|
+
/* @__PURE__ */v("div",{ref:T,className:"ml-auto flex items-center gap-1 text-xs"})]});let U;if(r)U=r.converting||!r.url?/* @__PURE__ */v(E,{filename:r.filename,message:r.convertingMessage}):"dxf"===r.kind?/* @__PURE__ */v(S,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"3d"===r.kind?/* @__PURE__ */v(F,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):"image"===r.kind?/* @__PURE__ */v(O,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url):/* @__PURE__ */v(e,{url:r.url,filename:r.filename,onDownload:r.onDownload,onEmail:r.onEmail},r.url);else{const[e,t]=x(N.dropHere),[n,r]=x(N.formatDxf),[s,i]=x(N.format3d);U=/* @__PURE__ */w("div",{className:"flex flex-1 flex-col items-center justify-center text-gray-500 text-sm gap-3 p-8 text-center",children:[
|
|
9
9
|
/* @__PURE__ */v(u,{name:"page",className:"h-12 w-12 text-gray-300",strokeWidth:1.5}),
|
|
10
10
|
/* @__PURE__ */w("p",{className:"font-medium text-gray-700",children:[e,
|
|
11
|
-
/* @__PURE__ */v("button",{onClick:
|
|
11
|
+
/* @__PURE__ */v("button",{onClick:H,className:"text-blue-600 hover:underline",children:N.open}),t]}),
|
|
12
12
|
/* @__PURE__ */w("div",{className:"text-xs text-gray-500 max-w-sm",children:[
|
|
13
13
|
/* @__PURE__ */v("p",{className:"font-semibold uppercase tracking-wide text-3xs text-gray-400 mb-1",children:N.supportedFormats}),
|
|
14
14
|
/* @__PURE__ */w("ul",{className:"space-y-0.5",children:[
|
|
@@ -23,9 +23,9 @@ import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-XCH
|
|
|
23
23
|
/* @__PURE__ */w("li",{children:[
|
|
24
24
|
/* @__PURE__ */v("span",{className:"font-mono text-gray-700",children:".jpg .jpeg .png .gif .webp .svg .avif .bmp"})," — ",N.formatImage]})]}),
|
|
25
25
|
/* @__PURE__ */v("p",{className:"mt-2 text-2xs text-gray-400 italic",children:N.dwgNote})]})]})}/* @__PURE__ */
|
|
26
|
-
return w("div",{className:"relative flex flex-col h-full",ref:z,onDragEnter:e=>{e.dataTransfer?.types?.includes?.("Files")&&
|
|
26
|
+
return w("div",{className:"relative flex flex-col h-full",ref:z,onDragEnter:e=>{e.dataTransfer?.types?.includes?.("Files")&&I(e.currentTarget)&&(e.preventDefault(),W.current++,R||D(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&I(e.currentTarget)&&e.preventDefault()},onDragLeave:()=>{W.current>0&&W.current--,0===W.current&&D(!1)},onDrop:e=>{I(e.currentTarget)?(e=>{e.preventDefault(),P();const t=e.dataTransfer.files?.[0];t&&X(t)})(e):P()},children:[
|
|
27
27
|
/* @__PURE__ */v(l,{title:N.windowTitle(A)}),
|
|
28
|
-
/* @__PURE__ */v(s,{app:"preview"}),
|
|
28
|
+
/* @__PURE__ */v(s,{app:"preview"}),B,
|
|
29
29
|
/* @__PURE__ */v(t.Provider,{value:j,children:/* @__PURE__ */v("div",{className:"flex-1 min-h-0",children:U})}),R&&/* @__PURE__ */v("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */v("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:N.dropToOpen})})]})}function E({filename:e,message:t}){const n=y().preview;/* @__PURE__ */
|
|
30
30
|
return w("div",{className:"flex flex-col items-center justify-center h-full bg-gray-100 gap-4 px-8",children:[
|
|
31
31
|
/* @__PURE__ */w("div",{className:"flex flex-col items-center gap-3",children:[
|
|
@@ -33,22 +33,22 @@ return w("div",{className:"flex flex-col items-center justify-center h-full bg-g
|
|
|
33
33
|
/* @__PURE__ */v("div",{className:"text-base font-semibold tracking-wide text-gray-700 uppercase",children:t||n.converting}),
|
|
34
34
|
/* @__PURE__ */v("div",{className:"text-xs text-gray-400 truncate max-w-md",children:e})]}),
|
|
35
35
|
/* @__PURE__ */v("div",{className:"w-72 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */v("div",{className:"h-full w-1/3 bg-blue-500 rounded-full animate-pulse",style:{animation:"preview-bar 1.4s ease-in-out infinite"}})}),
|
|
36
|
-
/* @__PURE__ */v("style",{children:"@keyframes preview-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }"})]})}var L=["https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/Roboto-LightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NanumGothic-Regular.ttf"],M={l:"LINE",line:"LINE",pl:"PLINE",pline:"PLINE",ex:"EXTEND",extend:"EXTEND",tr:"TRIM",trim:"TRIM",e:"ERASE",erase:"ERASE",m:"MOVE",move:"MOVE",co:"COPY",cp:"COPY",copy:"COPY",o:"OFFSET",offset:"OFFSET",f:"FILLET",fillet:"FILLET",cha:"CHAMFER",chamfer:"CHAMFER",x:"EXPLODE",explode:"EXPLODE",mi:"MIRROR",mirror:"MIRROR",ro:"ROTATE",rotate:"ROTATE",sc:"SCALE",scale:"SCALE",s:"STRETCH",stretch:"STRETCH",ar:"ARRAY",array:"ARRAY",rec:"RECTANG",rectang:"RECTANG",rectangle:"RECTANG",c:"CIRCLE",circle:"CIRCLE",a:"ARC",arc:"ARC",el:"ELLIPSE",ellipse:"ELLIPSE",t:"MTEXT",mt:"MTEXT",mtext:"MTEXT",text:"TEXT",b:"BLOCK",block:"BLOCK",i:"INSERT",insert:"INSERT",ha:"HATCH",hatch:"HATCH"};function S({url:e,filename:t,onDownload:r,onEmail:s}){const i=f(null),a=f(null),[o,l]=g(!0),[d,p]=g(null),[N,C]=g([]),[A,E]=g(!1),[S,z]=g(!0),j=y(),T=j.drawing,R=j.preview,F=f(T);F.current=T;const[H,P]=g(!1),[W,I]=g("auto"),[O,B]=g(null),[X,U]=g(null),[G,V]=g(null),[_,Y]=g(""),$=f(W),K=f(G);b(()=>{$.current=W},[W]),b(()=>{K.current=G},[G]);const Q=f(null),Z=f(null),q=f(null),[J,ee]=g(""),[te,ne]=g(null),re=f(""),se=f(null),ie=f(null),ae=f(null);b(()=>{let t=!1,n=null;return l(!0),p(null),C([]),(async()=>{let r;try{r=(await(import("dxf-viewer"))).DxfViewer}catch(e){return void(t||(p(F.current.notInstalled),l(!1)))}if(!t&&i.current)try{if(await new Promise(e=>{const t=()=>{const n=i.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),t||!i.current)return;const s={autoResize:!0},o=r.DefaultOptions?.clearColor;"function"==typeof o?.clone&&(s.clearColor=o.clone().setHex(16777215)),n=new r(i.current,s),a.current=n;const c="undefined"!=typeof window&&window.__REACT_OS_SHELL_DXF_FONTS__||L;if(await n.Load({url:e,fonts:c,workerFactory:null}),t)return;try{const e=n.GetLayers?.()??[];Array.isArray(e)&&C(e.map(e=>({name:e.name,displayName:e.displayName??e.name,color:"number"==typeof e.color?e.color:void 0,visible:!0})))}catch{}const d=()=>{try{const e=i.current?.getBoundingClientRect();e&&e.width>0&&e.height>0&&n.SetSize?.(Math.round(e.width),Math.round(e.height));const t=n.GetBounds?.(),r=n.GetOrigin?.();t&&r&&n.FitView(t.minX-r.x,t.maxX-r.x,t.minY-r.y,t.maxY-r.y),n.Render?.()}catch(e){console.warn("[Preview] DXF refit failed",e)}};d(),requestAnimationFrame(d),l(!1)}catch(e){t||(p(e?.message||F.current.renderFailed),l(!1))}})(),()=>{t=!0;try{n?.Destroy?.()}catch{}a.current=null}},[e]),b(()=>{if(!S||o)return;const e=setTimeout(()=>z(!1),5e3);return()=>clearTimeout(e)},[S,o]);const oe=N.map(e=>e.visible?"1":"0").join("");b(()=>{const e=a.current;if(o||d||!e)return;const t=e.GetScene?.(),n=e.GetCamera?.(),r=e.GetCanvas?.();if(!(t&&n&&r&&i.current))return;const s=()=>{const e=ae.current;e&&(e.overlay&&e.overlay.parentElement&&e.overlay.parentElement.removeChild(e.overlay),ae.current=null)};if(!H)return s(),B(null),void U(null);const l=document.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:5;",i.current.appendChild(l);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;pointer-events:none;");const u=document.createElementNS("http://www.w3.org/2000/svg","defs"),p=document.createElementNS("http://www.w3.org/2000/svg","marker");p.setAttribute("id","dxf-measure-arrow"),p.setAttribute("viewBox","0 0 10 10"),p.setAttribute("refX","9"),p.setAttribute("refY","5"),p.setAttribute("markerWidth","6"),p.setAttribute("markerHeight","6"),p.setAttribute("orient","auto-start-reverse");const m=document.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),m.setAttribute("fill","#ff8800"),p.appendChild(m),u.appendChild(p),c.appendChild(u),l.appendChild(c);const h=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","line");return e.setAttribute("stroke","#ff8800"),e.setAttribute("stroke-width","1"),e.setAttribute("stroke-dasharray","6,4"),e.setAttribute("opacity","0.55"),e.style.display="none",c.appendChild(e),e},y=h(),x=h(),f=document.createElementNS("http://www.w3.org/2000/svg","line");f.setAttribute("stroke","#ff8800"),f.setAttribute("stroke-width","1"),f.setAttribute("opacity","0.85"),f.style.display="none",c.appendChild(f);const g=document.createElementNS("http://www.w3.org/2000/svg","line");g.setAttribute("stroke","#ff8800"),g.setAttribute("stroke-width","1"),g.setAttribute("opacity","0.85"),g.style.display="none",c.appendChild(g);const b=document.createElementNS("http://www.w3.org/2000/svg","line");b.setAttribute("stroke","#ff8800"),b.setAttribute("stroke-width","1.5"),b.setAttribute("stroke-linecap","round"),b.style.display="none",c.appendChild(b);const w=document.createElementNS("http://www.w3.org/2000/svg","line");w.setAttribute("stroke","#ff8800"),w.setAttribute("stroke-width","1.5"),w.setAttribute("stroke-linecap","round"),w.style.display="none",c.appendChild(w);const v=document.createElement("div");v.style.cssText="position:absolute;transform:translate(-50%,-50%);pointer-events:none;display:none;";const k="http://www.w3.org/2000/svg",N=document.createElementNS(k,"svg");N.setAttribute("width","22"),N.setAttribute("height","22"),N.setAttribute("viewBox","0 0 22 22"),N.setAttribute("style","overflow:visible;display:block"),v.appendChild(N);const C=e=>{const t=document.createElementNS(k,"g");return e(t),t.style.display="none",N.appendChild(t),t},A=C(e=>{const t=document.createElementNS(k,"rect");t.setAttribute("x","4"),t.setAttribute("y","4"),t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t)}),E=C(e=>{const t=(e,t,n,r)=>{const s=document.createElementNS(k,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(n)),s.setAttribute("y2",String(r)),s.setAttribute("stroke","#ff8800"),s.setAttribute("stroke-width","2.2"),s.setAttribute("stroke-linecap","round"),s};e.appendChild(t(4,4,18,18)),e.appendChild(t(18,4,4,18))}),L=C(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","4,4 18,4 4,18 18,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),M=C(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","11,3 19,18 3,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),S=C(e=>{const t=document.createElementNS(k,"circle");t.setAttribute("cx","11"),t.setAttribute("cy","11"),t.setAttribute("r","7"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t);const n=(e,t,n,r)=>{const s=document.createElementNS(k,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(n)),s.setAttribute("y2",String(r)),s.setAttribute("stroke","#ff8800"),s.setAttribute("stroke-width","1.6"),s.setAttribute("stroke-linecap","round"),s};e.appendChild(n(6.5,6.5,15.5,15.5)),e.appendChild(n(15.5,6.5,6.5,15.5))});l.appendChild(v),ae.current={picks:[],rawSecondClick:null,overlay:l,svg:c,line:b,fixedLine:w,fixedLabel:null,refLine:y,refLineV:x,extLineA:f,extLineB:g,markers:[],label:null,snap:v,segs:null,nodes:null};const z=n?.position?.constructor??t?.position?.constructor??null;let j=!1;const T=(e,t)=>{if(!z)return{x:0,y:0};const s=new z(e,t,0).project(n),i=r.clientWidth,a=r.clientHeight;return{x:(s.x+1)/2*i,y:(1-s.y)/2*a}};(()=>{try{const e=ae.current;if(!e)return;const n=[],r=[];let s=!1;const i=e=>{const t=e?.attributes?.instanceTransform0,n=e?.attributes?.instanceTransform1;if(t&&n){const e=[],r=Math.min(t.count,n.count);for(let s=0;s<r;s++)e.push([t.getX(s),t.getY(s),t.getZ(s),n.getX(s),n.getY(s),n.getZ(s)]);return e}const r=e?.attributes?.instanceTransform;if(r){const e=[];for(let t=0;t<r.count;t++)e.push([1,0,r.getX(t),0,1,r.getY(t)]);return e}return[[1,0,0,0,1,0]]},a=e=>{const t=!!e?.isLineSegments;if(!t&&!!!e?.isPoints)return;const a=e.geometry,o=a?.attributes?.position;if(!o)return;const l=i(a);if(t){const e=a.index,t=Math.floor((e?e.count:o.count)/2);for(let r=0;r<t;r++){const t=e?e.getX(2*r):2*r,i=e?e.getX(2*r+1):2*r+1,a=o.getX(t),c=o.getY(t),d=o.getX(i),u=o.getY(i);if(Number.isFinite(a+c+d+u))for(const e of l){if(n.length>=16e5)return void(s=!0);const t=e[0]*a+e[1]*c+e[2],r=e[3]*a+e[4]*c+e[5],i=e[0]*d+e[1]*u+e[2],o=e[3]*d+e[4]*u+e[5];t===i&&r===o||n.push(t,r,i,o)}}}else for(let e=0;e<o.count;e++){const t=o.getX(e),n=o.getY(e);if(Number.isFinite(t+n))for(const e of l)r.push(e[0]*t+e[1]*n+e[2],e[3]*t+e[4]*n+e[5])}};"function"==typeof t.traverseVisible?t.traverseVisible(a):t.traverse(a),e.segs=new Float64Array(n),e.nodes=new Float64Array(r),s&&console.warn("[Preview] DXF snap cache truncated at 400000 segments — snapping may miss some geometry."),j=!0}catch{}})();const R=(e,t,n,r,s,i,a,o)=>{const l=(n-e)*(o-i)-(r-t)*(a-s);if(Math.abs(l)<1e-9)return null;const c=((s-e)*(o-i)-(i-t)*(a-s))/l,d=((s-e)*(r-t)-(i-t)*(n-e))/l,u=1e-4;return c<-u||c>1+u||d<-u||d>1+u?null:{px:e+c*(n-e),py:t+c*(r-t),t:c}},W=()=>{const e=document.createElement("div");return e.style.cssText="position:absolute;width:10px;height:10px;border-radius:50%;background:#ff8800;border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,0.25);transform:translate(-50%,-50%);pointer-events:none;",l.appendChild(e),e},I=(e,t,n)=>{const r=T(t,n);e.style.left=`${r.x}px`,e.style.top=`${r.y}px`},O=()=>{const e=ae.current;if(!e||!e.rawSecondClick||e.picks.length<2)return;const t=e.picks[0],n=e.rawSecondClick,r=K.current,s=$.current;if(null===r||!Number.isFinite(r)||"horizontal"!==s&&"vertical"!==s)e.picks[1]={x:n.x,y:n.y};else if("horizontal"===s){const s=n.x>=t.x?1:-1;e.picks[1]={x:t.x+s*Math.abs(r),y:n.y}}else{const s=n.y>=t.y?1:-1;e.picks[1]={x:n.x,y:t.y+s*Math.abs(r)}}},X=(e,t)=>{const n=$.current;return"auto"!==n?n:e&&t?Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"horizontal":"vertical":"horizontal"},G=()=>{const e=ae.current;if(!e)return;O();const t=$.current,n=K.current,s=null!==n&&Number.isFinite(n)&&("horizontal"===t||"vertical"===t);e.markers[0]&&I(e.markers[0],e.picks[0].x,e.picks[0].y),e.markers[1]&&I(e.markers[1],e.picks[1].x,e.picks[1].y);const i=(t,n,s)=>{if(!t)return;if(!s||e.picks.length<1)return void(t.style.display="none");const i=e.picks[0],a=r.clientWidth,o=r.clientHeight,l=4*Math.hypot(a,o),c=T(i.x,i.y),d=T(i.x+n.dx,i.y+n.dy),u=l/(Math.hypot(d.x-c.x,d.y-c.y)||1),p=T(i.x-n.dx*u,i.y-n.dy*u),m=T(i.x+n.dx*u,i.y+n.dy*u);t.setAttribute("x1",String(p.x)),t.setAttribute("y1",String(p.y)),t.setAttribute("x2",String(m.x)),t.setAttribute("y2",String(m.y)),t.style.display=""};let a="horizontal"===t,o="vertical"===t;if("auto"===t)if(e.picks.length>=2){const t=X(e.picks[0],e.picks[1]);a="horizontal"===t,o="vertical"===t}else a=!0,o=!0;if(i(e.refLine,{dx:1,dy:0},a),i(e.refLineV,{dx:0,dy:1},o),2===e.picks.length){const t=e.picks[0],i=e.picks[1],a=X(t,i),o=(()=>{const e=ae.current,t=e.picks[0],n=e.picks[1],r=X(t,n),s=$.current,i=K.current;return null!==i&&Number.isFinite(i)&&"horizontal"===s?{from:{x:n.x,y:t.y},to:{x:n.x,y:n.y}}:null!==i&&Number.isFinite(i)&&"vertical"===s?{from:{x:t.x,y:n.y},to:{x:n.x,y:n.y}}:"horizontal"===r?{from:t,to:{x:n.x,y:t.y}}:"vertical"===r?{from:t,to:{x:t.x,y:n.y}}:{from:t,to:n}})(),l=T(o.from.x,o.from.y),c=T(o.to.x,o.to.y);e.line.setAttribute("x1",String(l.x)),e.line.setAttribute("y1",String(l.y)),e.line.setAttribute("x2",String(c.x)),e.line.setAttribute("y2",String(c.y)),e.line.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.line.setAttribute("marker-end","url(#dxf-measure-arrow)");const d=Math.hypot(c.x-l.x,c.y-l.y);if(e.line.style.display=d>.5?"":"none",s&&e.fixedLine){const s="horizontal"===a?{x:i.x,y:t.y}:{x:t.x,y:i.y},o=T(t.x,t.y),l=T(s.x,s.y);e.fixedLine.setAttribute("x1",String(o.x)),e.fixedLine.setAttribute("y1",String(o.y)),e.fixedLine.setAttribute("x2",String(l.x)),e.fixedLine.setAttribute("y2",String(l.y)),e.fixedLine.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.fixedLine.setAttribute("marker-end","url(#dxf-measure-arrow)"),e.fixedLine.style.display="";const c=V();c.textContent=D(Math.abs(n));const d=(o.x+l.x)/2,u=(o.y+l.y)/2;c.style.left=`${d}px`,c.style.top=`${u}px`;const p=r.clientWidth,m=r.clientHeight;c.style.display=d<0||u<0||d>p||u>m?"none":""}else e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none");const u=e.extLineA,p=e.extLineB;if(!s&&"horizontal"===a&&Math.abs(i.y-t.y)>1e-9){const e=T(i.x,t.y),n=T(i.x,i.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else if(!s&&"vertical"===a&&Math.abs(i.x-t.x)>1e-9){const e=T(t.x,i.y),n=T(i.x,i.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else u.style.display="none",p.style.display="none";if(e.label){const t=(l.x+c.x)/2,n=(l.y+c.y)/2;e.label.style.left=`${t}px`,e.label.style.top=`${n}px`;const s=r.clientWidth,i=r.clientHeight;e.label.style.display=t<0||n<0||t>s||n>i?"none":"",d<=.5&&(e.label.style.display="none")}}else e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none")},V=()=>{const e=ae.current;if(e.fixedLabel)return e.fixedLabel;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:var(--text-2xs);font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.75);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.fixedLabel=t,t};let _=0,Y=0,J=0,ee=!1,te=!1,re=null;const se=e=>{const t=e?.detail;t&&0===t.domEvent?.button&&(_=t.canvasCoord.x,Y=t.canvasCoord.y,J=performance.now(),te=!1,ee=!0)},ie=e=>{const t=r.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;ee&&(n-_)**2+(s-Y)**2>16&&(te=!0);const i=ae.current;var a;if(i&&i.snap)if(ee&&te)i.snap.style.display="none";else if(re=((e,t)=>{const n=ae.current;if(!n||!j||!n.segs)return null;const r=T(0,0),s=T(1,0),i=T(0,1),a=s.x-r.x,o=s.y-r.y,l=i.x-r.x,c=i.y-r.y,d=a*c-l*o;if(!d)return null;const u=((e-r.x)*c-(t-r.y)*l)/d,p=((t-r.y)*a-(e-r.x)*o)/d,m=18/(Math.hypot(a,o)||1),h=18/(Math.hypot(l,c)||1),y=u-m,x=u+m,f=p-h,g=p+h,b=324;let w=null,v=b,k=null,N=b,C=null,A=b,E=null,L=b;const M=[],S=n.segs;for(let n=0;n<S.length;n+=4){const s=S[n],i=S[n+1],d=S[n+2],u=S[n+3];if(s<y&&d<y||s>x&&d>x||i<f&&u<f||i>g&&u>g)continue;const p=r.x+a*s+l*i,m=r.y+o*s+c*i,h=r.x+a*d+l*u,E=r.y+o*d+c*u;let L=!1,z=e-p,j=t-m,T=z*z+j*j;T<b&&(L=!0,T<v&&(v=T,w={sx:s,sy:i,type:"endpoint"})),z=e-h,j=t-E,T=z*z+j*j,T<b&&(L=!0,T<v&&(v=T,w={sx:d,sy:u,type:"endpoint"})),z=e-(p+h)/2,j=t-(m+E)/2,T=z*z+j*j,T<b&&(L=!0,T<N&&(N=T,k={sx:(s+d)/2,sy:(i+u)/2,type:"midpoint"}));const R=h-p,D=E-m,F=R*R+D*D;if(F>0){const n=((e-p)*R+(t-m)*D)/F;n>0&&n<1&&(z=e-(p+n*R),j=t-(m+n*D),T=z*z+j*j,T<b&&(L=!0,T<A&&(A=T,C={sx:s+n*(d-s),sy:i+n*(u-i),type:"line"})))}L&&M.push({ax:s,ay:i,bx:d,by:u,apx:p,apy:m,bpx:h,bpy:E})}const z=n.nodes;if(z)for(let n=0;n<z.length;n+=2){const s=z[n],i=z[n+1];if(s<y||s>x||i<f||i>g)continue;const d=e-(r.x+a*s+l*i),u=t-(r.y+o*s+c*i),p=d*d+u*u;p<v&&(v=p,w={sx:s,sy:i,type:"node"})}for(let n=0;n<M.length;n++){const r=M[n];for(let s=n+1;s<M.length;s++){const n=M[s],i=R(r.apx,r.apy,r.bpx,r.bpy,n.apx,n.apy,n.bpx,n.bpy);if(!i)continue;const a=e-i.px,o=t-i.py,l=a*a+o*o;l>=b||l>=L||(L=l,E={sx:r.ax+i.t*(r.bx-r.ax),sy:r.ay+i.t*(r.by-r.ay),type:"intersection"})}}return(E&&w?L<v-1?E:w:E??w)??k??C})(n,s),re){const e=T(re.sx,re.sy);i.snap.style.left=`${e.x}px`,i.snap.style.top=`${e.y}px`,i.snap.style.display="",a=re.type,A.style.display="endpoint"===a?"":"none",E.style.display="intersection"===a?"":"none",L.style.display="line"===a?"":"none",M.style.display="midpoint"===a?"":"none",S.style.display="node"===a?"":"none"}else i.snap.style.display="none"},oe=e=>{if(!ee)return;ee=!1;const t=performance.now()-J;if(te||t>350)return;const n=e?.detail?.position;if(!n)return;const r=re?{x:re.sx,y:re.sy}:{x:n.x,y:n.y};ue(r)},le=()=>{const e=ae.current;if(!e||2!==e.picks.length)return;O();const t=e.picks[0],n=e.picks[1],r=$.current,s=X(t,n),i=K.current,a=null!==i&&Number.isFinite(i)&&("horizontal"===r||"vertical"===r);let o,c,d="",u=s;const p=Math.abs(n.x-t.x),m=Math.abs(n.y-t.y);if(a&&"horizontal"===r?(o=m,d=" ↕",u="vertical",c=F.current.echoLocked("ΔY",D(m),"ΔX",D(Math.abs(i)))):a&&"vertical"===r?(o=p,d=" ↔",u="horizontal",c=F.current.echoLocked("ΔX",D(p),"ΔY",D(Math.abs(i)))):"horizontal"===s?(o=p,d=" ↔",c=F.current.echoLinear(D(p),"ΔX")):"vertical"===s?(o=m,d=" ↕",c=F.current.echoLinear(D(m),"ΔY")):(o=Math.hypot(n.x-t.x,n.y-t.y),c=F.current.echoDistance(D(o),D(p),D(m))),!Number.isFinite(o))return B(null),U(null),void(e.label&&(e.label.style.opacity="0"));B(o),U(u),ne(c);const h=(()=>{const e=ae.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:var(--text-2xs);font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.95);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.label=t,t})();h.style.opacity="1",h.textContent=`${D(o)}${d}`};Q.current=()=>{le(),G()};const ce=e=>{e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none"),e.label&&(e.label.style.opacity="0"),B(null),U(null)},de=()=>{const e=ae.current;if(e){for(const t of e.markers)t.parentElement?.removeChild(t);e.markers=[],e.picks=[],e.rawSecondClick=null,e.refLine&&(e.refLine.style.display="none"),e.refLineV&&(e.refLineV.style.display="none"),ce(e)}};Z.current=de,q.current=()=>{const e=ae.current;if(!e||0===e.picks.length)return;e.picks.pop();const t=e.markers.pop();t?.parentElement?.removeChild(t),e.rawSecondClick=null,ce(e),G()};const ue=e=>{const t=ae.current;t&&(2===t.picks.length&&de(),0===t.picks.length?(t.picks.push({x:e.x,y:e.y}),t.markers.push(W())):(t.rawSecondClick={x:e.x,y:e.y},t.picks.push({x:e.x,y:e.y}),t.markers.push(W()),le()),G())},pe=e=>{"Escape"===e.key&&P(!1)};r.style.cursor="crosshair";try{e.Subscribe?.("pointerdown",se)}catch{}try{e.Subscribe?.("pointerup",oe)}catch{}try{e.Subscribe?.("viewChanged",G)}catch{}return r.addEventListener("pointermove",ie),window.addEventListener("keydown",pe),()=>{r.style.cursor="";try{e.Unsubscribe?.("pointerdown",se)}catch{}try{e.Unsubscribe?.("pointerup",oe)}catch{}try{e.Unsubscribe?.("viewChanged",G)}catch{}r.removeEventListener("pointermove",ie),window.removeEventListener("keydown",pe),Q.current=null,Z.current=null,q.current=null,s(),B(null),U(null)}},[H,o,d,oe]),b(()=>{Q.current?.()},[W,G]);const le=e=>{C(t=>t.map(t=>{if(t.visible===e)return t;try{a.current?.ShowLayer?.(t.name,e)}catch{}return{...t,visible:e}}))},ce=()=>{try{const e=a.current,t=e?.GetBounds?.(),n=e?.GetOrigin?.();t&&n?e.FitView(t.minX-n.x,t.maxX-n.x,t.minY-n.y,t.maxY-n.y):e?.FitView?.(),e?.Render?.()}catch{}};b(()=>{const e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)return;if(1!==e.key.length||" "===e.key)return;const t=e.target;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))return;const n=ie.current;if(!n)return;const r=n.closest("[data-modal-id]");r&&c()!==r.dataset.modalId||se.current?.focus()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const de=f(J),ue=f(H);b(()=>{de.current=J},[J]),b(()=>{ue.current=H},[H]),b(()=>h(()=>{const e=ie.current;if(!e)return!1;const t=e.closest("[data-modal-id]");return!(!t||c()!==t.dataset.modalId)&&(de.current?(ee(""),ne(F.current.cancelled),!0):!!ue.current&&(P(!1),ne(F.current.measureOff),!0))}),[]);const pe="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1",[me,he]=x(T.typeToMeasure);/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */v("style",{children:"@keyframes preview-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }"})]})}var L=["https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/Roboto-LightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf","https://cdn.jsdelivr.net/gh/vagran/dxf-viewer-example-src@master/src/assets/fonts/NanumGothic-Regular.ttf"],M={l:"LINE",line:"LINE",pl:"PLINE",pline:"PLINE",ex:"EXTEND",extend:"EXTEND",tr:"TRIM",trim:"TRIM",e:"ERASE",erase:"ERASE",m:"MOVE",move:"MOVE",co:"COPY",cp:"COPY",copy:"COPY",o:"OFFSET",offset:"OFFSET",f:"FILLET",fillet:"FILLET",cha:"CHAMFER",chamfer:"CHAMFER",x:"EXPLODE",explode:"EXPLODE",mi:"MIRROR",mirror:"MIRROR",ro:"ROTATE",rotate:"ROTATE",sc:"SCALE",scale:"SCALE",s:"STRETCH",stretch:"STRETCH",ar:"ARRAY",array:"ARRAY",rec:"RECTANG",rectang:"RECTANG",rectangle:"RECTANG",c:"CIRCLE",circle:"CIRCLE",a:"ARC",arc:"ARC",el:"ELLIPSE",ellipse:"ELLIPSE",t:"MTEXT",mt:"MTEXT",mtext:"MTEXT",text:"TEXT",b:"BLOCK",block:"BLOCK",i:"INSERT",insert:"INSERT",ha:"HATCH",hatch:"HATCH"};function S({url:e,filename:t,onDownload:r,onEmail:s}){const i=f(null),a=f(null),[o,l]=g(!0),[d,p]=g(null),[N,C]=g([]),[A,E]=g(!1),[S,z]=g(!0),j=y(),T=j.drawing,R=j.preview,F=f(T);F.current=T;const[O,W]=g(!1),[H,P]=g("auto"),[I,X]=g(null),[B,U]=g(null),[G,V]=g(null),[_,Y]=g(""),$=f(H),K=f(G);b(()=>{$.current=H},[H]),b(()=>{K.current=G},[G]);const Q=f(null),J=f(null),Z=f(null),[q,ee]=g(""),[te,ne]=g(null),re=f(""),se=f(null),ie=f(null),ae=f(null);b(()=>{let t=!1,n=null;return l(!0),p(null),C([]),(async()=>{let r;try{r=(await(import("dxf-viewer"))).DxfViewer}catch(e){return void(t||(p(F.current.notInstalled),l(!1)))}if(!t&&i.current)try{if(await new Promise(e=>{const t=()=>{const n=i.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),t||!i.current)return;const s={autoResize:!0},o=r.DefaultOptions?.clearColor;"function"==typeof o?.clone&&(s.clearColor=o.clone().setHex(16777215)),n=new r(i.current,s),a.current=n;const c="undefined"!=typeof window&&window.__REACT_OS_SHELL_DXF_FONTS__||L;if(await n.Load({url:e,fonts:c,workerFactory:null}),t)return;try{const e=n.GetLayers?.()??[];Array.isArray(e)&&C(e.map(e=>({name:e.name,displayName:e.displayName??e.name,color:"number"==typeof e.color?e.color:void 0,visible:!0})))}catch{}const d=()=>{try{const e=i.current?.getBoundingClientRect();e&&e.width>0&&e.height>0&&n.SetSize?.(Math.round(e.width),Math.round(e.height));const t=n.GetBounds?.(),r=n.GetOrigin?.();t&&r&&n.FitView(t.minX-r.x,t.maxX-r.x,t.minY-r.y,t.maxY-r.y),n.Render?.()}catch(e){console.warn("[Preview] DXF refit failed",e)}};d(),requestAnimationFrame(d),l(!1)}catch(e){t||(p(e?.message||F.current.renderFailed),l(!1))}})(),()=>{t=!0;try{n?.Destroy?.()}catch{}a.current=null}},[e]),b(()=>{if(!S||o)return;const e=setTimeout(()=>z(!1),5e3);return()=>clearTimeout(e)},[S,o]);const oe=N.map(e=>e.visible?"1":"0").join("");b(()=>{const e=a.current;if(o||d||!e)return;const t=e.GetScene?.(),n=e.GetCamera?.(),r=e.GetCanvas?.();if(!(t&&n&&r&&i.current))return;const s=()=>{const e=ae.current;e&&(e.overlay&&e.overlay.parentElement&&e.overlay.parentElement.removeChild(e.overlay),ae.current=null)};if(!O)return s(),X(null),void U(null);const l=document.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:5;",i.current.appendChild(l);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;pointer-events:none;");const u=document.createElementNS("http://www.w3.org/2000/svg","defs"),p=document.createElementNS("http://www.w3.org/2000/svg","marker");p.setAttribute("id","dxf-measure-arrow"),p.setAttribute("viewBox","0 0 10 10"),p.setAttribute("refX","9"),p.setAttribute("refY","5"),p.setAttribute("markerWidth","6"),p.setAttribute("markerHeight","6"),p.setAttribute("orient","auto-start-reverse");const m=document.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("d","M 0 0 L 10 5 L 0 10 z"),m.setAttribute("fill","#ff8800"),p.appendChild(m),u.appendChild(p),c.appendChild(u),l.appendChild(c);const h=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","line");return e.setAttribute("stroke","#ff8800"),e.setAttribute("stroke-width","1"),e.setAttribute("stroke-dasharray","6,4"),e.setAttribute("opacity","0.55"),e.style.display="none",c.appendChild(e),e},y=h(),x=h(),f=document.createElementNS("http://www.w3.org/2000/svg","line");f.setAttribute("stroke","#ff8800"),f.setAttribute("stroke-width","1"),f.setAttribute("opacity","0.85"),f.style.display="none",c.appendChild(f);const g=document.createElementNS("http://www.w3.org/2000/svg","line");g.setAttribute("stroke","#ff8800"),g.setAttribute("stroke-width","1"),g.setAttribute("opacity","0.85"),g.style.display="none",c.appendChild(g);const b=document.createElementNS("http://www.w3.org/2000/svg","line");b.setAttribute("stroke","#ff8800"),b.setAttribute("stroke-width","1.5"),b.setAttribute("stroke-linecap","round"),b.style.display="none",c.appendChild(b);const w=document.createElementNS("http://www.w3.org/2000/svg","line");w.setAttribute("stroke","#ff8800"),w.setAttribute("stroke-width","1.5"),w.setAttribute("stroke-linecap","round"),w.style.display="none",c.appendChild(w);const v=document.createElement("div");v.style.cssText="position:absolute;transform:translate(-50%,-50%);pointer-events:none;display:none;";const k="http://www.w3.org/2000/svg",N=document.createElementNS(k,"svg");N.setAttribute("width","22"),N.setAttribute("height","22"),N.setAttribute("viewBox","0 0 22 22"),N.setAttribute("style","overflow:visible;display:block"),v.appendChild(N);const C=e=>{const t=document.createElementNS(k,"g");return e(t),t.style.display="none",N.appendChild(t),t},A=C(e=>{const t=document.createElementNS(k,"rect");t.setAttribute("x","4"),t.setAttribute("y","4"),t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t)}),E=C(e=>{const t=(e,t,n,r)=>{const s=document.createElementNS(k,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(n)),s.setAttribute("y2",String(r)),s.setAttribute("stroke","#ff8800"),s.setAttribute("stroke-width","2.2"),s.setAttribute("stroke-linecap","round"),s};e.appendChild(t(4,4,18,18)),e.appendChild(t(18,4,4,18))}),L=C(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","4,4 18,4 4,18 18,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),M=C(e=>{const t=document.createElementNS(k,"polygon");t.setAttribute("points","11,3 19,18 3,18"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linejoin","round"),e.appendChild(t)}),S=C(e=>{const t=document.createElementNS(k,"circle");t.setAttribute("cx","11"),t.setAttribute("cy","11"),t.setAttribute("r","7"),t.setAttribute("fill","rgba(255,255,255,0.9)"),t.setAttribute("stroke","#ff8800"),t.setAttribute("stroke-width","1.8"),e.appendChild(t);const n=(e,t,n,r)=>{const s=document.createElementNS(k,"line");return s.setAttribute("x1",String(e)),s.setAttribute("y1",String(t)),s.setAttribute("x2",String(n)),s.setAttribute("y2",String(r)),s.setAttribute("stroke","#ff8800"),s.setAttribute("stroke-width","1.6"),s.setAttribute("stroke-linecap","round"),s};e.appendChild(n(6.5,6.5,15.5,15.5)),e.appendChild(n(15.5,6.5,6.5,15.5))});l.appendChild(v),ae.current={picks:[],rawSecondClick:null,overlay:l,svg:c,line:b,fixedLine:w,fixedLabel:null,refLine:y,refLineV:x,extLineA:f,extLineB:g,markers:[],label:null,snap:v,segs:null,nodes:null};const z=n?.position?.constructor??t?.position?.constructor??null;let j=!1;const T=(e,t)=>{if(!z)return{x:0,y:0};const s=new z(e,t,0).project(n),i=r.clientWidth,a=r.clientHeight;return{x:(s.x+1)/2*i,y:(1-s.y)/2*a}};(()=>{try{const e=ae.current;if(!e)return;const n=[],r=[];let s=!1;const i=e=>{const t=e?.attributes?.instanceTransform0,n=e?.attributes?.instanceTransform1;if(t&&n){const e=[],r=Math.min(t.count,n.count);for(let s=0;s<r;s++)e.push([t.getX(s),t.getY(s),t.getZ(s),n.getX(s),n.getY(s),n.getZ(s)]);return e}const r=e?.attributes?.instanceTransform;if(r){const e=[];for(let t=0;t<r.count;t++)e.push([1,0,r.getX(t),0,1,r.getY(t)]);return e}return[[1,0,0,0,1,0]]},a=e=>{const t=!!e?.isLineSegments;if(!t&&!!!e?.isPoints)return;const a=e.geometry,o=a?.attributes?.position;if(!o)return;const l=i(a);if(t){const e=a.index,t=Math.floor((e?e.count:o.count)/2);for(let r=0;r<t;r++){const t=e?e.getX(2*r):2*r,i=e?e.getX(2*r+1):2*r+1,a=o.getX(t),c=o.getY(t),d=o.getX(i),u=o.getY(i);if(Number.isFinite(a+c+d+u))for(const e of l){if(n.length>=16e5)return void(s=!0);const t=e[0]*a+e[1]*c+e[2],r=e[3]*a+e[4]*c+e[5],i=e[0]*d+e[1]*u+e[2],o=e[3]*d+e[4]*u+e[5];t===i&&r===o||n.push(t,r,i,o)}}}else for(let e=0;e<o.count;e++){const t=o.getX(e),n=o.getY(e);if(Number.isFinite(t+n))for(const e of l)r.push(e[0]*t+e[1]*n+e[2],e[3]*t+e[4]*n+e[5])}};"function"==typeof t.traverseVisible?t.traverseVisible(a):t.traverse(a),e.segs=new Float64Array(n),e.nodes=new Float64Array(r),s&&console.warn("[Preview] DXF snap cache truncated at 400000 segments — snapping may miss some geometry."),j=!0}catch{}})();const R=(e,t,n,r,s,i,a,o)=>{const l=(n-e)*(o-i)-(r-t)*(a-s);if(Math.abs(l)<1e-9)return null;const c=((s-e)*(o-i)-(i-t)*(a-s))/l,d=((s-e)*(r-t)-(i-t)*(n-e))/l,u=1e-4;return c<-u||c>1+u||d<-u||d>1+u?null:{px:e+c*(n-e),py:t+c*(r-t),t:c}},H=()=>{const e=document.createElement("div");return e.style.cssText="position:absolute;width:10px;height:10px;border-radius:50%;background:#ff8800;border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,0.25);transform:translate(-50%,-50%);pointer-events:none;",l.appendChild(e),e},P=(e,t,n)=>{const r=T(t,n);e.style.left=`${r.x}px`,e.style.top=`${r.y}px`},I=()=>{const e=ae.current;if(!e||!e.rawSecondClick||e.picks.length<2)return;const t=e.picks[0],n=e.rawSecondClick,r=K.current,s=$.current;if(null===r||!Number.isFinite(r)||"horizontal"!==s&&"vertical"!==s)e.picks[1]={x:n.x,y:n.y};else if("horizontal"===s){const s=n.x>=t.x?1:-1;e.picks[1]={x:t.x+s*Math.abs(r),y:n.y}}else{const s=n.y>=t.y?1:-1;e.picks[1]={x:n.x,y:t.y+s*Math.abs(r)}}},B=(e,t)=>{const n=$.current;return"auto"!==n?n:e&&t?Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"horizontal":"vertical":"horizontal"},G=()=>{const e=ae.current;if(!e)return;I();const t=$.current,n=K.current,s=null!==n&&Number.isFinite(n)&&("horizontal"===t||"vertical"===t);e.markers[0]&&P(e.markers[0],e.picks[0].x,e.picks[0].y),e.markers[1]&&P(e.markers[1],e.picks[1].x,e.picks[1].y);const i=(t,n,s)=>{if(!t)return;if(!s||e.picks.length<1)return void(t.style.display="none");const i=e.picks[0],a=r.clientWidth,o=r.clientHeight,l=4*Math.hypot(a,o),c=T(i.x,i.y),d=T(i.x+n.dx,i.y+n.dy),u=l/(Math.hypot(d.x-c.x,d.y-c.y)||1),p=T(i.x-n.dx*u,i.y-n.dy*u),m=T(i.x+n.dx*u,i.y+n.dy*u);t.setAttribute("x1",String(p.x)),t.setAttribute("y1",String(p.y)),t.setAttribute("x2",String(m.x)),t.setAttribute("y2",String(m.y)),t.style.display=""};let a="horizontal"===t,o="vertical"===t;if("auto"===t)if(e.picks.length>=2){const t=B(e.picks[0],e.picks[1]);a="horizontal"===t,o="vertical"===t}else a=!0,o=!0;if(i(e.refLine,{dx:1,dy:0},a),i(e.refLineV,{dx:0,dy:1},o),2===e.picks.length){const t=e.picks[0],i=e.picks[1],a=B(t,i),o=(()=>{const e=ae.current,t=e.picks[0],n=e.picks[1],r=B(t,n),s=$.current,i=K.current;return null!==i&&Number.isFinite(i)&&"horizontal"===s?{from:{x:n.x,y:t.y},to:{x:n.x,y:n.y}}:null!==i&&Number.isFinite(i)&&"vertical"===s?{from:{x:t.x,y:n.y},to:{x:n.x,y:n.y}}:"horizontal"===r?{from:t,to:{x:n.x,y:t.y}}:"vertical"===r?{from:t,to:{x:t.x,y:n.y}}:{from:t,to:n}})(),l=T(o.from.x,o.from.y),c=T(o.to.x,o.to.y);e.line.setAttribute("x1",String(l.x)),e.line.setAttribute("y1",String(l.y)),e.line.setAttribute("x2",String(c.x)),e.line.setAttribute("y2",String(c.y)),e.line.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.line.setAttribute("marker-end","url(#dxf-measure-arrow)");const d=Math.hypot(c.x-l.x,c.y-l.y);if(e.line.style.display=d>.5?"":"none",s&&e.fixedLine){const s="horizontal"===a?{x:i.x,y:t.y}:{x:t.x,y:i.y},o=T(t.x,t.y),l=T(s.x,s.y);e.fixedLine.setAttribute("x1",String(o.x)),e.fixedLine.setAttribute("y1",String(o.y)),e.fixedLine.setAttribute("x2",String(l.x)),e.fixedLine.setAttribute("y2",String(l.y)),e.fixedLine.setAttribute("marker-start","url(#dxf-measure-arrow)"),e.fixedLine.setAttribute("marker-end","url(#dxf-measure-arrow)"),e.fixedLine.style.display="";const c=V();c.textContent=D(Math.abs(n));const d=(o.x+l.x)/2,u=(o.y+l.y)/2;c.style.left=`${d}px`,c.style.top=`${u}px`;const p=r.clientWidth,m=r.clientHeight;c.style.display=d<0||u<0||d>p||u>m?"none":""}else e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none");const u=e.extLineA,p=e.extLineB;if(!s&&"horizontal"===a&&Math.abs(i.y-t.y)>1e-9){const e=T(i.x,t.y),n=T(i.x,i.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else if(!s&&"vertical"===a&&Math.abs(i.x-t.x)>1e-9){const e=T(t.x,i.y),n=T(i.x,i.y);p.setAttribute("x1",String(e.x)),p.setAttribute("y1",String(e.y)),p.setAttribute("x2",String(n.x)),p.setAttribute("y2",String(n.y)),p.style.display="",u.style.display="none"}else u.style.display="none",p.style.display="none";if(e.label){const t=(l.x+c.x)/2,n=(l.y+c.y)/2;e.label.style.left=`${t}px`,e.label.style.top=`${n}px`;const s=r.clientWidth,i=r.clientHeight;e.label.style.display=t<0||n<0||t>s||n>i?"none":"",d<=.5&&(e.label.style.display="none")}}else e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none")},V=()=>{const e=ae.current;if(e.fixedLabel)return e.fixedLabel;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:var(--text-2xs);font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.75);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.fixedLabel=t,t};let _=0,Y=0,q=0,ee=!1,te=!1,re=null;const se=e=>{const t=e?.detail;t&&0===t.domEvent?.button&&(_=t.canvasCoord.x,Y=t.canvasCoord.y,q=performance.now(),te=!1,ee=!0)},ie=e=>{const t=r.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;ee&&(n-_)**2+(s-Y)**2>16&&(te=!0);const i=ae.current;var a;if(i&&i.snap)if(ee&&te)i.snap.style.display="none";else if(re=((e,t)=>{const n=ae.current;if(!n||!j||!n.segs)return null;const r=T(0,0),s=T(1,0),i=T(0,1),a=s.x-r.x,o=s.y-r.y,l=i.x-r.x,c=i.y-r.y,d=a*c-l*o;if(!d)return null;const u=((e-r.x)*c-(t-r.y)*l)/d,p=((t-r.y)*a-(e-r.x)*o)/d,m=18/(Math.hypot(a,o)||1),h=18/(Math.hypot(l,c)||1),y=u-m,x=u+m,f=p-h,g=p+h,b=324;let w=null,v=b,k=null,N=b,C=null,A=b,E=null,L=b;const M=[],S=n.segs;for(let n=0;n<S.length;n+=4){const s=S[n],i=S[n+1],d=S[n+2],u=S[n+3];if(s<y&&d<y||s>x&&d>x||i<f&&u<f||i>g&&u>g)continue;const p=r.x+a*s+l*i,m=r.y+o*s+c*i,h=r.x+a*d+l*u,E=r.y+o*d+c*u;let L=!1,z=e-p,j=t-m,T=z*z+j*j;T<b&&(L=!0,T<v&&(v=T,w={sx:s,sy:i,type:"endpoint"})),z=e-h,j=t-E,T=z*z+j*j,T<b&&(L=!0,T<v&&(v=T,w={sx:d,sy:u,type:"endpoint"})),z=e-(p+h)/2,j=t-(m+E)/2,T=z*z+j*j,T<b&&(L=!0,T<N&&(N=T,k={sx:(s+d)/2,sy:(i+u)/2,type:"midpoint"}));const R=h-p,D=E-m,F=R*R+D*D;if(F>0){const n=((e-p)*R+(t-m)*D)/F;n>0&&n<1&&(z=e-(p+n*R),j=t-(m+n*D),T=z*z+j*j,T<b&&(L=!0,T<A&&(A=T,C={sx:s+n*(d-s),sy:i+n*(u-i),type:"line"})))}L&&M.push({ax:s,ay:i,bx:d,by:u,apx:p,apy:m,bpx:h,bpy:E})}const z=n.nodes;if(z)for(let n=0;n<z.length;n+=2){const s=z[n],i=z[n+1];if(s<y||s>x||i<f||i>g)continue;const d=e-(r.x+a*s+l*i),u=t-(r.y+o*s+c*i),p=d*d+u*u;p<v&&(v=p,w={sx:s,sy:i,type:"node"})}for(let n=0;n<M.length;n++){const r=M[n];for(let s=n+1;s<M.length;s++){const n=M[s],i=R(r.apx,r.apy,r.bpx,r.bpy,n.apx,n.apy,n.bpx,n.bpy);if(!i)continue;const a=e-i.px,o=t-i.py,l=a*a+o*o;l>=b||l>=L||(L=l,E={sx:r.ax+i.t*(r.bx-r.ax),sy:r.ay+i.t*(r.by-r.ay),type:"intersection"})}}return(E&&w?L<v-1?E:w:E??w)??k??C})(n,s),re){const e=T(re.sx,re.sy);i.snap.style.left=`${e.x}px`,i.snap.style.top=`${e.y}px`,i.snap.style.display="",a=re.type,A.style.display="endpoint"===a?"":"none",E.style.display="intersection"===a?"":"none",L.style.display="line"===a?"":"none",M.style.display="midpoint"===a?"":"none",S.style.display="node"===a?"":"none"}else i.snap.style.display="none"},oe=e=>{if(!ee)return;ee=!1;const t=performance.now()-q;if(te||t>350)return;const n=e?.detail?.position;if(!n)return;const r=re?{x:re.sx,y:re.sy}:{x:n.x,y:n.y};ue(r)},le=()=>{const e=ae.current;if(!e||2!==e.picks.length)return;I();const t=e.picks[0],n=e.picks[1],r=$.current,s=B(t,n),i=K.current,a=null!==i&&Number.isFinite(i)&&("horizontal"===r||"vertical"===r);let o,c,d="",u=s;const p=Math.abs(n.x-t.x),m=Math.abs(n.y-t.y);if(a&&"horizontal"===r?(o=m,d=" ↕",u="vertical",c=F.current.echoLocked("ΔY",D(m),"ΔX",D(Math.abs(i)))):a&&"vertical"===r?(o=p,d=" ↔",u="horizontal",c=F.current.echoLocked("ΔX",D(p),"ΔY",D(Math.abs(i)))):"horizontal"===s?(o=p,d=" ↔",c=F.current.echoLinear(D(p),"ΔX")):"vertical"===s?(o=m,d=" ↕",c=F.current.echoLinear(D(m),"ΔY")):(o=Math.hypot(n.x-t.x,n.y-t.y),c=F.current.echoDistance(D(o),D(p),D(m))),!Number.isFinite(o))return X(null),U(null),void(e.label&&(e.label.style.opacity="0"));X(o),U(u),ne(c);const h=(()=>{const e=ae.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-9999px;top:-9999px;transform:translate(-50%,-50%);padding:2px 6px;font-size:var(--text-2xs);font-weight:600;font-family:system-ui,-apple-system,sans-serif;background:rgba(255,136,0,0.95);color:#fff;border-radius:4px;white-space:nowrap;box-shadow:0 1px 4px rgba(0,0,0,0.25);pointer-events:none;",l.appendChild(t),e.label=t,t})();h.style.opacity="1",h.textContent=`${D(o)}${d}`};Q.current=()=>{le(),G()};const ce=e=>{e.line.style.display="none",e.fixedLine&&(e.fixedLine.style.display="none"),e.fixedLabel&&(e.fixedLabel.style.display="none"),e.extLineA&&(e.extLineA.style.display="none"),e.extLineB&&(e.extLineB.style.display="none"),e.label&&(e.label.style.opacity="0"),X(null),U(null)},de=()=>{const e=ae.current;if(e){for(const t of e.markers)t.parentElement?.removeChild(t);e.markers=[],e.picks=[],e.rawSecondClick=null,e.refLine&&(e.refLine.style.display="none"),e.refLineV&&(e.refLineV.style.display="none"),ce(e)}};J.current=de,Z.current=()=>{const e=ae.current;if(!e||0===e.picks.length)return;e.picks.pop();const t=e.markers.pop();t?.parentElement?.removeChild(t),e.rawSecondClick=null,ce(e),G()};const ue=e=>{const t=ae.current;t&&(2===t.picks.length&&de(),0===t.picks.length?(t.picks.push({x:e.x,y:e.y}),t.markers.push(H())):(t.rawSecondClick={x:e.x,y:e.y},t.picks.push({x:e.x,y:e.y}),t.markers.push(H()),le()),G())},pe=e=>{"Escape"===e.key&&W(!1)};r.style.cursor="crosshair";try{e.Subscribe?.("pointerdown",se)}catch{}try{e.Subscribe?.("pointerup",oe)}catch{}try{e.Subscribe?.("viewChanged",G)}catch{}return r.addEventListener("pointermove",ie),window.addEventListener("keydown",pe),()=>{r.style.cursor="";try{e.Unsubscribe?.("pointerdown",se)}catch{}try{e.Unsubscribe?.("pointerup",oe)}catch{}try{e.Unsubscribe?.("viewChanged",G)}catch{}r.removeEventListener("pointermove",ie),window.removeEventListener("keydown",pe),Q.current=null,J.current=null,Z.current=null,s(),X(null),U(null)}},[O,o,d,oe]),b(()=>{Q.current?.()},[H,G]);const le=e=>{C(t=>t.map(t=>{if(t.visible===e)return t;try{a.current?.ShowLayer?.(t.name,e)}catch{}return{...t,visible:e}}))},ce=()=>{try{const e=a.current,t=e?.GetBounds?.(),n=e?.GetOrigin?.();t&&n?e.FitView(t.minX-n.x,t.maxX-n.x,t.minY-n.y,t.maxY-n.y):e?.FitView?.(),e?.Render?.()}catch{}};b(()=>{const e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)return;if(1!==e.key.length||" "===e.key)return;const t=e.target;if(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))return;const n=ie.current;if(!n)return;const r=n.closest("[data-modal-id]");r&&c()!==r.dataset.modalId||se.current?.focus()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const de=f(q),ue=f(O);b(()=>{de.current=q},[q]),b(()=>{ue.current=O},[O]),b(()=>h(()=>{const e=ie.current;if(!e)return!1;const t=e.closest("[data-modal-id]");return!(!t||c()!==t.dataset.modalId)&&(de.current?(ee(""),ne(F.current.cancelled),!0):!!ue.current&&(W(!1),ne(F.current.measureOff),!0))}),[]);const pe="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1",[me,he]=x(T.typeToMeasure);/* @__PURE__ */
|
|
37
37
|
return w("div",{ref:ie,className:"flex flex-col h-full",children:[
|
|
38
38
|
/* @__PURE__ */w(n,{children:[
|
|
39
39
|
/* @__PURE__ */w("button",{onClick:()=>E(e=>!e),className:pe+(A?" bg-gray-200":""),title:T.layersHint,disabled:0===N.length,children:[
|
|
40
40
|
/* @__PURE__ */v(u,{name:"layers",className:"h-3.5 w-3.5",strokeWidth:1.5}),T.layers," ",N.length>0&&/* @__PURE__ */w("span",{className:"text-gray-400",children:["(",N.filter(e=>e.visible).length,"/",N.length,")"]})]}),
|
|
41
41
|
/* @__PURE__ */v("button",{onClick:()=>z(e=>!e),className:pe,title:R.howToNavigate,children:/* @__PURE__ */v(u,{name:"help",className:"h-3.5 w-3.5",strokeWidth:1.5})}),
|
|
42
|
-
/* @__PURE__ */w("button",{onClick:()=>
|
|
42
|
+
/* @__PURE__ */w("button",{onClick:()=>W(e=>!e),className:pe+(O?" bg-gray-200":""),title:O?R.stopMeasuring:T.measureHint,children:[
|
|
43
43
|
/* @__PURE__ */w("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[
|
|
44
44
|
/* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 14.25l6-6 6 6 4.5-4.5M9.75 8.25v3M12.75 11.25v3M15.75 14.25v3"}),
|
|
45
|
-
/* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75h19.5"})]}),T.measure]}),
|
|
45
|
+
/* @__PURE__ */v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75h19.5"})]}),T.measure]}),O&&/* @__PURE__ */w(k,{children:[
|
|
46
46
|
/* @__PURE__ */w("div",{className:"flex items-stretch h-7 rounded border border-gray-200 overflow-hidden text-2xs font-semibold",children:[
|
|
47
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
48
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
49
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
50
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
51
|
-
/* @__PURE__ */v("input",{type:"number",inputMode:"decimal",step:"any",value:_,placeholder:"horizontal"===
|
|
47
|
+
/* @__PURE__ */v("button",{onClick:()=>P("auto"),className:"px-2 transition-colors "+("auto"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:T.autoHint,children:T.auto}),
|
|
48
|
+
/* @__PURE__ */v("button",{onClick:()=>P("horizontal"),className:"px-2 transition-colors "+("horizontal"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:T.horizontalHint,children:"H"}),
|
|
49
|
+
/* @__PURE__ */v("button",{onClick:()=>P("vertical"),className:"px-2 transition-colors "+("vertical"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:T.verticalHint,children:"V"}),
|
|
50
|
+
/* @__PURE__ */v("button",{onClick:()=>P("point"),className:"px-2 transition-colors "+("point"===H?"bg-orange-500 text-white":"bg-white text-gray-600 hover:bg-gray-50"),title:T.pointHint,children:T.point})]}),("horizontal"===H||"vertical"===H)&&/* @__PURE__ */w("div",{className:"flex items-center gap-1",children:[
|
|
51
|
+
/* @__PURE__ */v("input",{type:"number",inputMode:"decimal",step:"any",value:_,placeholder:"horizontal"===H?T.fixX:T.fixY,onChange:e=>{const t=e.target.value;if(Y(t),""===t.trim())V(null);else{const e=parseFloat(t);V(Number.isFinite(e)&&0!==e?e:null)}},className:"h-7 w-20 px-2 text-2xs font-mono rounded border border-gray-200 bg-white text-gray-700 focus:outline-none focus:border-orange-400",title:T.fixHint}),null!==G&&/* @__PURE__ */v("button",{onClick:()=>{V(null),Y("")},className:"text-gray-400 hover:text-gray-600 text-2xs px-1",title:T.clearFixed,children:"×"})]})]}),O&&null!==I&&/* @__PURE__ */w("div",{className:"px-2 py-1 text-2xs font-mono font-semibold text-orange-600 bg-orange-50 border border-orange-200 rounded whitespace-nowrap",title:"horizontal"===B?T.horizontalDistance("auto"===H):"vertical"===B?T.verticalDistance("auto"===H):T.straightDistance,children:[D(I),"horizontal"===B?" ↔":"vertical"===B?" ↕":""]}),
|
|
52
52
|
/* @__PURE__ */v("button",{onClick:ce,className:pe,title:T.fitHint,children:T.fit}),
|
|
53
53
|
/* @__PURE__ */w("button",{onClick:r??(()=>{const n=document.createElement("a");n.href=e,n.download=t,n.click()}),className:pe,children:[
|
|
54
54
|
/* @__PURE__ */v(u,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),R.download]}),s&&/* @__PURE__ */w("button",{onClick:s,className:pe,children:[
|
|
@@ -79,7 +79,7 @@ return w("div",{ref:ie,className:"flex flex-col h-full",children:[
|
|
|
79
79
|
/* @__PURE__ */w("div",{className:"shrink-0 border-t border-gray-200 bg-gray-50",children:[te&&/* @__PURE__ */v("div",{className:"px-3 pt-1 text-2xs font-mono text-gray-500 truncate",title:te,children:te}),
|
|
80
80
|
/* @__PURE__ */w("div",{className:"flex items-center gap-2 px-3 h-7",children:[
|
|
81
81
|
/* @__PURE__ */v("span",{className:"text-2xs font-mono font-semibold text-gray-400 select-none",children:">"}),
|
|
82
|
-
/* @__PURE__ */v("input",{ref:se,value:J,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),(e=>{const t=e.trim()||re.current;if(ee(""),!t)return;const n=t.toLowerCase().split(/\s+/)[0],r=()=>{re.current=t},s=(e,t)=>{P(!0),I(e),Z.current?.(),ne(t),r()};if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))if(!H||"horizontal"!==W&&"vertical"!==W)ne(T.fixedNeedsAxis);else{const e=parseFloat(n);e?(Y(n),V(e),ne(T.axisLocked("horizontal"===W?"ΔX":"ΔY",D(Math.abs(e))))):(Y(""),V(null),ne(T.fixedCleared))}else switch(n){case"di":case"dist":case"mea":case"measuregeom":s("point",T.echoDist);break;case"dim":case"dli":case"dimlin":case"dimlinear":s("auto",T.echoDimLinear);break;case"h":case"hor":case"horizontal":P(!0),I("horizontal"),ne(T.echoHorizontal),r();break;case"v":case"ver":case"vertical":P(!0),I("vertical"),ne(T.echoVertical),r();break;case"au":case"auto":P(!0),I("auto"),ne(T.echoAuto),r();break;case"measure":P(!H),ne(H?T.measureOff:T.measureOn),r();break;case"u":case"undo":q.current?.(),ne(T.pickRemoved),r();break;case"z":case"ze":case"zoom":case"fit":case"zoomextents":ce(),ne(T.zoomExtents),r();break;case"la":case"layer":case"layers":E(e=>!e),ne(T.layersToggled),r();break;case"off":case"clear":V(null),Y(""),Z.current?.(),ne(T.measurementCleared),r();break;case"?":case"help":ne(T.commandHelp);break;default:{const e=M[n];ne(e?T.readOnly(e):T.unknownCommand(n.toUpperCase()))}}})(J)):"Escape"===e.key&&(J?(e.stopPropagation(),ee(""),ne(T.cancelled)):e.target.blur())},placeholder:T.commandPlaceholder,spellCheck:!1,autoComplete:"off",className:"flex-1 min-w-0 bg-transparent text-2xs font-mono text-gray-700 focus:outline-none placeholder:text-gray-300"})]})]})]})}var z="https://cdn.jsdelivr.net/npm/online-3d-viewer@0.18.0/libs/";function j(e,t,n=0){return{id:e.GetId?.()??0,name:e.GetName?.()||(0===n?t.root:t.node),isMeshNode:!!e.IsMeshNode?.(),meshIndices:e.GetMeshIndices?.()??[],children:(e.GetChildNodes?.()??[]).map(e=>j(e,t,n+1))}}function T(e,t){t.add(e.id);for(const n of e.children)T(n,t)}function R(e,t){const n=/^#?([0-9a-f]{6})$/i.exec(t),r=n?parseInt(n[1],16):0;return new e.RGBColor(r>>16&255,r>>8&255,255&r)}function D(e){return e>=1e3?`${(e/1e3).toFixed(3)} m`:`${e.toFixed(2)} mm`}function F({url:e,filename:t,onDownload:r,onEmail:s}){const i=f(null),a=f(null),o=f(null),[l,c]=g(!0),[d,p]=g(null),[h,x]=g(!0),k=y(),C=k.model,A=k.preview,E=f(C);E.current=C;const[L,M]=g(null),[S,F]=g({}),[H,P]=g(/* @__PURE__ */new Set),[W,I]=g("#f5f6f8"),[O,B]=g(!0),[X,U]=g("#000000"),[G,V]=g(1),[_,Y]=g(!1),[$,K]=g(!1),[Q,Z]=g(!1),[q,J]=g(!1),[ee,te]=g("x"),[ne,re]=g(!1),[se,ie]=g(.5),[ae,oe]=g(0),[le,ce]=g(!1),[de,ue]=g("point"),[pe,me]=g(null),he=f(null),ye=f(null);b(()=>{let n=!1,r=null,s=null;return c(!0),p(null),M(null),F({}),P(/* @__PURE__ */new Set),(async()=>{let l;try{l=await(import("online-3d-viewer"))}catch{return void(n||(p(E.current.notInstalled),c(!1)))}if(o.current=l,!n&&i.current&&(await new Promise(e=>{const t=()=>{const n=i.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),!n&&i.current))try{const o="undefined"!=typeof window&&window.__REACT_OS_SHELL_O3DV_LIBS__||z;l.SetExternalLibLocation?.(o),function(){if(N)return;if("undefined"==typeof HTMLCanvasElement)return;N=!0;const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(t,n){return"webgl"!==t&&"webgl2"!==t&&"experimental-webgl"!==t||(n={...n||{},stencil:!0}),e.call(this,t,n)},console.info("[Preview] section: canvas getContext patched (force stencil=true)")}(),r=new l.EmbeddedViewer(i.current,{backgroundColor:new l.RGBAColor(245,246,248,255),defaultColor:new l.RGBColor(180,188,200),edgeSettings:new l.EdgeSettings(!0,new l.RGBColor(0,0,0),1),onModelLoaded:()=>{if(!n){try{const e=r.GetModel?.(),t=e?.GetRootNode?.();if(t){const e=j(t,{root:E.current.rootNode,node:E.current.node});M(e);const n={[e.id]:!0};for(const t of e.children)n[t.id]=!0;F(n)}}catch(e){console.warn("[Preview] mesh tree extraction failed",e)}c(!1)}},onModelLoadFailed:()=>{n||(p(E.current.loadFailed),c(!1))}}),a.current=r;const d=new l.InputFile(t,l.FileSource.Url,e);r.LoadModelFromInputFiles([d]),i.current&&"undefined"!=typeof ResizeObserver&&(s=new ResizeObserver(()=>{try{const e=a.current;e?.Resize?e.Resize():e?.viewer?.Resize&&e.viewer.Resize(),e?.viewer?.Render?.()}catch{}}),s.observe(i.current))}catch(e){n||(p(e?.message||E.current.loadFailed),c(!1))}})(),()=>{n=!0;try{s?.disconnect()}catch{}try{r?.Destroy?.()}catch{}a.current=null}},[e,t]),b(()=>{const e=a.current;if(e?.viewer)try{const t=e=>{if(e.userData?.__sectionHelper)return;const t=e.userData?.originalMeshInstance??e.userData,n=t?.id?.nodeId??t?.nodeId;"number"==typeof n&&(e.visible=!H.has(n))};e.viewer.mainModel?.EnumerateMeshesAndLines?.(t),e.viewer.mainModel?.EnumerateEdges?.(t),e.viewer.Render?.()}catch(e){console.warn("[Preview] visibility update failed",e)}},[H,L]),b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer)try{t.viewer.SetEdgeSettings(new e.EdgeSettings(O,R(e,X),G));const n=ye.current;if(n){const e=[];t.viewer.mainModel?.EnumerateEdges?.(t=>{t.userData?.__sectionHelper&&e.push(t)});for(const t of e)t.parent?.remove(t),t.geometry?.dispose?.(),t.material?.dispose?.();const r=n.plane,s=e=>{e&&!n.materialState.has(e)&&(n.materialState.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[r],e.clipShadows=!0,e.needsUpdate=!0)};t.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)s(e);else s(t)})}t.viewer.Render?.()}catch{}},[O,X,G]),b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer)try{const n=R(e,W);t.viewer.SetBackgroundColor(new e.RGBAColor(n.r,n.g,n.b,255)),t.viewer.Render?.()}catch{}},[W]),b(()=>{const e=a.current;if(!e?.viewer||l)return;const t=e.viewer.renderer,n=e.viewer.scene;if(!t||!n)return;if(ye.current){const e=ye.current;for(const[t,n]of e.materialState.entries())t.clippingPlanes=n.clippingPlanes,t.clipShadows=n.clipShadows,t.needsUpdate=!0;for(const t of e.helpers)t.parent?.remove(t),t.material?.dispose?.();e.capMesh&&(n.remove(e.capMesh),e.capMesh.geometry?.dispose?.(),e.capMesh.material?.dispose?.()),ye.current=null}if(!q)return t.localClippingEnabled=!1,void e.viewer.Render?.();const r=e.viewer.GetBoundingBox?.(()=>!0);if(!r)return;const s=[];if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{e.userData?.__sectionHelper||s.push(e)}),!s.length)return t.localClippingEnabled=!1,void e.viewer.Render?.();const i=s[0],o=i.constructor,c=i.material?.constructor,d=i.geometry?.constructor,u=i.geometry?.attributes?.position?.constructor;o&&c&&d&&u||console.warn("[Preview] section: missing THREE constructors, falling back to no cap");const p=7681;let m=!0;try{const e=t.getContext?.(),n=e?.getContextAttributes?.();m=!1!==n?.stencil,t.autoClearStencil=!0,console.info("[Preview] section: stencil buffer =",m,"targets =",s.length)}catch{}t.localClippingEnabled=!0;const h={normal:{x:0,y:0,z:-1},constant:0,clone:function e(){const t={normal:{x:this.normal.x,y:this.normal.y,z:this.normal.z},constant:this.constant};return t.clone=e,t}},y=[],x=/* @__PURE__ */new Map,f=e=>{e&&!x.has(e)&&(x.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[h],e.clipShadows=!0,e.needsUpdate=!0)};for(const e of s){const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t);const n=Array.isArray(t)?t[0]:t;if(o&&m&&n?.clone){const t=(t,r)=>{const s=n.clone();s.depthWrite=!1,s.depthTest=!1,s.colorWrite=!1,s.stencilWrite=!0,s.stencilFunc=519,s.stencilFail=r,s.stencilZFail=r,s.stencilZPass=r,s.side=t,s.transparent=!1,s.clippingPlanes=[h],s.clipShadows=!0,s.needsUpdate=!0;const i=new o(e.geometry,s);i.matrixAutoUpdate=!1,i.renderOrder=1,i.userData.__sectionHelper=!0,e.add(i),y.push(i)};t(1,7682),t(0,7683)}}e.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t)});let g=null;const b=s[0]?.material&&(Array.isArray(s[0].material)?s[0].material[0]:s[0].material);if(m&&o&&d&&u&&b?.clone){const e=r.max.x-r.min.x,t=r.max.y-r.min.y,s=r.max.z-r.min.z,i=2*Math.max(e,t,s,1)/2,a=new d,l=new Float32Array([-i,-i,0,i,-i,0,i,i,0,-i,i,0]),c=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]);a.setAttribute("position",new u(l,3)),a.setAttribute("normal",new u(c,3)),a.setIndex([0,1,2,0,2,3]);const m=b.clone(),h=b.color?.getHex?.()??11844808;m.emissive?.setHex?.(h),"emissiveIntensity"in m&&(m.emissiveIntensity=.25),m.side=2,m.transparent=!1,m.opacity=1,m.stencilWrite=!0,m.stencilRef=0,m.stencilFunc=517,m.stencilFail=p,m.stencilZFail=p,m.stencilZPass=p,m.clippingPlanes=[],m.polygonOffset=!0,m.polygonOffsetFactor=-1,m.polygonOffsetUnits=-1,m.needsUpdate=!0,g=new o(a,m),g.renderOrder=2,g.userData.__sectionHelper=!0,n.add(g)}ye.current={plane:h,capMesh:g,helpers:y,materialState:x,bbox:r},console.info("[Preview] section: helpers =",y.length,"cap =",!!g),e.viewer.Render?.()},[q,l,L]),b(()=>{const e=a.current,t=ye.current;if(e?.viewer&&t&&q)try{const n=t.bbox,r="x"===ee?0:"y"===ee?1:2,s=[n.min.x,n.min.y,n.min.z][r],i=s+([n.max.x,n.max.y,n.max.z][r]-s)*se,a=ae*Math.PI/180,o=Math.cos(a),l=Math.sin(a),c=ne?-1:1;let d=0,u=0,p=0;"x"===ee?(d=c*o,p=c*l):"y"===ee?(u=c*o,d=c*l):(p=c*o,u=c*l);const m={x:(n.min.x+n.max.x)/2,y:(n.min.y+n.max.y)/2,z:(n.min.z+n.max.z)/2},h="x"===ee?i:m.x,y="y"===ee?i:m.y,x="z"===ee?i:m.z;if(t.plane.normal.x=d,t.plane.normal.y=u,t.plane.normal.z=p,t.plane.constant=-(d*h+u*y+p*x),t.capMesh){const e=m.x,n=m.y,r=m.z,s=d*e+u*n+p*r+t.plane.constant,i=e-d*s,a=n-u*s,o=r-p*s;t.capMesh.position.set(i,a,o),t.capMesh.lookAt?.(i+d,a+u,o+p)}e.viewer.Render?.()}catch(e){console.warn("[Preview] section update failed",e)}},[q,ee,ne,se,ae]),b(()=>{const e=a.current;if(!e?.viewer||l||!i.current)return;const t=e.viewer.renderer,n=e.viewer.scene,r=t?.domElement;if(!t||!n||!r)return;let s=null;if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{s||e.userData?.__sectionHelper||e.userData?.__measureHelper||(s=e)}),!s)return;const c=s.position.constructor,d=s.constructor,u=(Array.isArray(s.material)?s.material[0]:s.material)?.constructor,p=s.geometry.constructor,m=s.geometry.attributes?.position?.constructor;if(!(c&&d&&u&&p&&m))return;let h=null,y=null;n.traverse(e=>{if(h&&y)return;if(!e?.isLineSegments)return;h=e.constructor;const t=Array.isArray(e.material)?e.material[0]:e.material;t?.constructor&&(y=t.constructor)});const x=()=>{const t=he.current;if(t){null!==t.rafId&&cancelAnimationFrame(t.rafId);for(const e of t.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();t.line&&(n.remove(t.line),t.line.geometry?.dispose?.(),t.line.material?.dispose?.()),t.label&&t.label.parentElement&&t.label.parentElement.removeChild(t.label),he.current=null,e.viewer.Render?.()}};if(!le)return x(),void me(null);he.current={points:[],normals:[],markers:[],line:null,label:null,rafId:null};const f=o.current,g=f?.IntersectionMode?.MeshOnly??1,b=e.viewer.GetBoundingBox?.(()=>!0),w=b?Math.sqrt((b.max.x-b.min.x)**2+(b.max.y-b.min.y)**2+(b.max.z-b.min.z)**2):100,v=Math.max(.005*w,.2),k=e=>{const t=[],r=[];for(let e=0;e<=12;e++){const n=e/12*Math.PI;for(let e=0;e<=16;e++){const r=e/16*Math.PI*2;t.push(v*Math.sin(n)*Math.cos(r),v*Math.cos(n),v*Math.sin(n)*Math.sin(r))}}for(let e=0;e<12;e++)for(let t=0;t<16;t++){const n=17*e+t,s=n+16+1;r.push(n,s,n+1,s,s+1,n+1)}const s=new p;s.setAttribute("position",new m(new Float32Array(t),3)),s.setIndex(r),s.computeVertexNormals?.();const i=new u;i.color?.setHex?.(16746496),i.depthTest=!1,i.depthWrite=!1,i.transparent=!0,i.opacity=.95;const a=new d(s,i);return a.position.copy(e),a.renderOrder=9999,a.userData.__measureHelper=!0,n.add(a),a},N=()=>{const t=he.current;t&&((()=>{const t=he.current;if(!t||t.points.length<2||!t.label)return;const n=e.viewer.camera;if(!n)return;const s=t.points[0],i=t.points[1],a=new c((s.x+i.x)/2,(s.y+i.y)/2,(s.z+i.z)/2).clone();a.project?.(n);const o=r.getBoundingClientRect(),l=(a.x+1)/2*o.width,d=(1-a.y)/2*o.height;t.label.style.left=`${l}px`,t.label.style.top=`${d}px`;const u=l<0||d<0||l>o.width||d>o.height;t.label.style.opacity=a.z>1||u?"0":"1"})(),t.rafId=requestAnimationFrame(N))};he.current.rafId=requestAnimationFrame(N);let C=0,A=0,E=0,L=!1,M=!1;const S=t=>{if(!e.viewer.camera)return;const s=r.getBoundingClientRect(),a={x:t.clientX-s.left,y:t.clientY-s.top},o=e.viewer.GetMeshIntersectionUnderMouse?.(g,a);if(!o)return;const l=he.current,x=new c(o.point.x,o.point.y,o.point.z),f=(e=>{const t=e?.face?.normal,n=e?.object;if(!t||!n)return null;try{const e=new c(t.x,t.y,t.z);return e.transformDirection?.(n.matrixWorld),{x:e.x,y:e.y,z:e.z}}catch{return{x:t.x,y:t.y,z:t.z}}})(o);if(2===l.points.length){for(const e of l.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();l.line&&(n.remove(l.line),l.line.geometry?.dispose?.(),l.line.material?.dispose?.()),l.label&&(l.label.style.opacity="0"),l.points=[],l.markers=[],l.line=null,l.normals=[],me(null)}if(l.points.push(x),l.normals.push(f),"perp"===de){const e=((e,t)=>{const r=e?.geometry,s=r?.attributes?.position;if(!r||!s||!t?.face?.normal)return null;const i=s.array,a=r.index?r.index.array:null,o=new c(t.point.x,t.point.y,t.point.z);e.worldToLocal?.(o);const l=t.face.normal,h=-(l.x*o.x+l.y*o.y+l.z*o.z);r.computeBoundingBox?.();const y=r.boundingBox,x=y?Math.sqrt((y.max.x-y.min.x)**2+(y.max.y-y.min.y)**2+(y.max.z-y.min.z)**2):100,f=Math.max(.001*x,.005),g=a?a.length/3:s.count/3,b=[],w=new c;for(let t=0;t<g;t++){const n=a?a[3*t]:3*t,r=a?a[3*t+1]:3*t+1,s=a?a[3*t+2]:3*t+2,o=i[3*n],c=i[3*n+1],d=i[3*n+2],u=i[3*r],p=i[3*r+1],m=i[3*r+2],y=i[3*s],x=i[3*s+1],g=i[3*s+2],v=u-o,k=p-c,N=m-d,C=y-o,A=x-c,E=g-d;let L=k*E-N*A,M=N*C-v*E,S=v*A-k*C;const z=Math.sqrt(L*L+M*M+S*S);if(0===z)continue;if(L/=z,M/=z,S/=z,L*l.x+M*l.y+S*l.z<.9995)continue;const j=(o+u+y)/3,T=(c+p+x)/3,R=(d+m+g)/3;if(!(Math.abs(l.x*j+l.y*T+l.z*R+h)>f))for(const[t,n,r]of[[o,c,d],[u,p,m],[y,x,g]])w.set?.(t,n,r),e.localToWorld?.(w),b.push(w.x,w.y,w.z)}if(0===b.length)return null;const v=new p;v.setAttribute("position",new m(new Float32Array(b),3)),v.computeVertexNormals?.();const k=new u;k.color?.setHex?.(16746496),k.transparent=!0,k.opacity=.45,k.depthWrite=!1,k.polygonOffset=!0,k.polygonOffsetFactor=-2,k.polygonOffsetUnits=-2;const N=new d(v,k);return N.renderOrder=9998,N.userData.__measureHelper=!0,n.add(N),N})(o.object,o);l.markers.push(e??k(x))}else l.markers.push(k(x));if(2===l.points.length){const e=l.points[0];let t,r=l.points[1],s="";if("perp"===de){const n=l.normals[0]??l.normals[1];if(n){const i=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)||1,a=n.x/i,o=n.y/i,d=n.z/i,u=(r.x-e.x)*a+(r.y-e.y)*o+(r.z-e.z)*d,p=new c(e.x+a*u,e.y+o*u,e.z+d*u);l.points[1]=p,r=p,t=Math.abs(u),s=" ⊥"}else{const n=r.x-e.x,s=r.y-e.y,i=r.z-e.z;t=Math.sqrt(n*n+s*s+i*i)}}else{const n=r.x-e.x,s=r.y-e.y,i=r.z-e.z;t=Math.sqrt(n*n+s*s+i*i)}l.line=((e,t)=>{const r=new p;r.setAttribute("position",new m(new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z]),3));const s=new(h??d)(r,new(y??u)({color:16746496,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.95}));return s.renderOrder=9998,s.userData.__measureHelper=!0,n.add(s),s})(e,r),me(t);const a=(()=>{const e=he.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.transform="translate(-50%, -50%)",t.style.padding="2px 6px",t.style.fontSize="11px",t.style.fontWeight="600",t.style.fontFamily="system-ui, -apple-system, sans-serif",t.style.background="rgba(255, 136, 0, 0.95)",t.style.color="#fff",t.style.borderRadius="4px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.boxShadow="0 1px 4px rgba(0,0,0,0.25)",t.style.zIndex="5",i.current.appendChild(t),e.label=t,t})();a.textContent=`${D(t)}${s}`}e.viewer.Render?.()},z=e=>{0===e.button&&(C=e.clientX,A=e.clientY,E=performance.now(),L=!1,M=!0)},j=e=>{if(!M)return;const t=e.clientX-C,n=e.clientY-A;t*t+n*n>16&&(L=!0)},T=e=>{if(0!==e.button||!M)return;const t=performance.now()-E;M=!1,!L&&t<350&&S(e)},R=e=>{"Escape"===e.key&&ce(!1)};return r.style.cursor="crosshair",r.addEventListener("pointerdown",z),r.addEventListener("pointermove",j),r.addEventListener("pointerup",T),r.addEventListener("pointercancel",T),window.addEventListener("keydown",R),()=>{r.style.cursor="",r.removeEventListener("pointerdown",z),r.removeEventListener("pointermove",j),r.removeEventListener("pointerup",T),r.removeEventListener("pointercancel",T),window.removeEventListener("keydown",R),x(),me(null)}},[le,de,l,L]),b(()=>{if(!h||l)return;const e=setTimeout(()=>x(!1),5e3);return()=>clearTimeout(e)},[h,l]);const xe=e=>{const t=/* @__PURE__ */new Set;T(e,t),P(e=>{const n=new Set(e),r=[...t].some(e=>!n.has(e));for(const e of t)r?n.add(e):n.delete(e);return n})},fe=()=>{try{const e=a.current,t=e?.viewer?.GetBoundingSphere?.(()=>!0);t&&e.viewer.FitSphereToWindow(t,!0),e?.viewer?.Render?.()}catch{}};b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer&&!l)try{t.viewer.SetProjectionMode(Q?e.ProjectionMode.Perspective:e.ProjectionMode.Orthographic)}catch{}},[Q,l]);const ge=e=>{const t=o.current,n=a.current;if(t&&n?.viewer)try{const r=n.viewer.GetBoundingSphere?.(()=>!0);if(!r)return;const s=r.center,i=3*(r.radius||1),a=s.x??0,o=s.y??0,l=s.z??0;let c,d;switch(e){case"top":c=new t.Coord3D(a,o,l+i),d=new t.Coord3D(0,1,0);break;case"front":c=new t.Coord3D(a,o-i,l),d=new t.Coord3D(0,0,1);break;case"side":c=new t.Coord3D(a+i,o,l),d=new t.Coord3D(0,0,1);break;default:{const e=i/Math.sqrt(3);c=new t.Coord3D(a+e,o-e,l+e),d=new t.Coord3D(0,0,1);break}}const u=new t.Coord3D(a,o,l),p=new t.Camera(c,u,d,45);n.viewer.SetCamera(p),n.viewer.AdjustClippingPlanesToSphere?.(r),n.viewer.Render?.()}catch{}},be=(t.split(".").pop()||"").toUpperCase(),we=(e,t=0)=>{const n=e.children.length>0,r=!1!==S[e.id],s=!H.has(e.id);/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */v("input",{ref:se,value:q,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),(e=>{const t=e.trim()||re.current;if(ee(""),!t)return;const n=t.toLowerCase().split(/\s+/)[0],r=()=>{re.current=t},s=(e,t)=>{W(!0),P(e),J.current?.(),ne(t),r()};if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))if(!O||"horizontal"!==H&&"vertical"!==H)ne(T.fixedNeedsAxis);else{const e=parseFloat(n);e?(Y(n),V(e),ne(T.axisLocked("horizontal"===H?"ΔX":"ΔY",D(Math.abs(e))))):(Y(""),V(null),ne(T.fixedCleared))}else switch(n){case"di":case"dist":case"mea":case"measuregeom":s("point",T.echoDist);break;case"dim":case"dli":case"dimlin":case"dimlinear":s("auto",T.echoDimLinear);break;case"h":case"hor":case"horizontal":W(!0),P("horizontal"),ne(T.echoHorizontal),r();break;case"v":case"ver":case"vertical":W(!0),P("vertical"),ne(T.echoVertical),r();break;case"au":case"auto":W(!0),P("auto"),ne(T.echoAuto),r();break;case"measure":W(!O),ne(O?T.measureOff:T.measureOn),r();break;case"u":case"undo":Z.current?.(),ne(T.pickRemoved),r();break;case"z":case"ze":case"zoom":case"fit":case"zoomextents":ce(),ne(T.zoomExtents),r();break;case"la":case"layer":case"layers":E(e=>!e),ne(T.layersToggled),r();break;case"off":case"clear":V(null),Y(""),J.current?.(),ne(T.measurementCleared),r();break;case"?":case"help":ne(T.commandHelp);break;default:{const e=M[n];ne(e?T.readOnly(e):T.unknownCommand(n.toUpperCase()))}}})(q)):"Escape"===e.key&&(q?(e.stopPropagation(),ee(""),ne(T.cancelled)):e.target.blur())},placeholder:T.commandPlaceholder,spellCheck:!1,autoComplete:"off",className:"flex-1 min-w-0 bg-transparent text-2xs font-mono text-gray-700 focus:outline-none placeholder:text-gray-300"})]})]})]})}var z="https://cdn.jsdelivr.net/npm/online-3d-viewer@0.18.0/libs/";function j(e,t,n=0){return{id:e.GetId?.()??0,name:e.GetName?.()||(0===n?t.root:t.node),isMeshNode:!!e.IsMeshNode?.(),meshIndices:e.GetMeshIndices?.()??[],children:(e.GetChildNodes?.()??[]).map(e=>j(e,t,n+1))}}function T(e,t){t.add(e.id);for(const n of e.children)T(n,t)}function R(e,t){const n=/^#?([0-9a-f]{6})$/i.exec(t),r=n?parseInt(n[1],16):0;return new e.RGBColor(r>>16&255,r>>8&255,255&r)}function D(e){return e>=1e3?`${(e/1e3).toFixed(3)} m`:`${e.toFixed(2)} mm`}function F({url:e,filename:t,onDownload:r,onEmail:s}){const i=f(null),a=f(null),o=f(null),[l,c]=g(!0),[d,p]=g(null),[h,x]=g(!0),k=y(),C=k.model,A=k.preview,E=f(C);E.current=C;const[L,M]=g(null),[S,F]=g({}),[O,W]=g(/* @__PURE__ */new Set),[H,P]=g("#f5f6f8"),[I,X]=g(!0),[B,U]=g("#000000"),[G,V]=g(1),[_,Y]=g(!1),[$,K]=g(!1),[Q,J]=g(!1),[Z,q]=g(!1),[ee,te]=g("x"),[ne,re]=g(!1),[se,ie]=g(.5),[ae,oe]=g(0),[le,ce]=g(!1),[de,ue]=g("point"),[pe,me]=g(null),he=f(null),ye=f(null);b(()=>{let n=!1,r=null,s=null;return c(!0),p(null),M(null),F({}),W(/* @__PURE__ */new Set),(async()=>{let l;try{l=await(import("online-3d-viewer"))}catch{return void(n||(p(E.current.notInstalled),c(!1)))}if(o.current=l,!n&&i.current&&(await new Promise(e=>{const t=()=>{const n=i.current?.getBoundingClientRect();n&&n.width>4&&n.height>4?e():requestAnimationFrame(t)};t()}),!n&&i.current))try{const o="undefined"!=typeof window&&window.__REACT_OS_SHELL_O3DV_LIBS__||z;l.SetExternalLibLocation?.(o),function(){if(N)return;if("undefined"==typeof HTMLCanvasElement)return;N=!0;const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(t,n){return"webgl"!==t&&"webgl2"!==t&&"experimental-webgl"!==t||(n={...n||{},stencil:!0}),e.call(this,t,n)},console.info("[Preview] section: canvas getContext patched (force stencil=true)")}(),r=new l.EmbeddedViewer(i.current,{backgroundColor:new l.RGBAColor(245,246,248,255),defaultColor:new l.RGBColor(180,188,200),edgeSettings:new l.EdgeSettings(!0,new l.RGBColor(0,0,0),1),onModelLoaded:()=>{if(!n){try{const e=r.GetModel?.(),t=e?.GetRootNode?.();if(t){const e=j(t,{root:E.current.rootNode,node:E.current.node});M(e);const n={[e.id]:!0};for(const t of e.children)n[t.id]=!0;F(n)}}catch(e){console.warn("[Preview] mesh tree extraction failed",e)}c(!1)}},onModelLoadFailed:()=>{n||(p(E.current.loadFailed),c(!1))}}),a.current=r;const d=new l.InputFile(t,l.FileSource.Url,e);r.LoadModelFromInputFiles([d]),i.current&&"undefined"!=typeof ResizeObserver&&(s=new ResizeObserver(()=>{try{const e=a.current;e?.Resize?e.Resize():e?.viewer?.Resize&&e.viewer.Resize(),e?.viewer?.Render?.()}catch{}}),s.observe(i.current))}catch(e){n||(p(e?.message||E.current.loadFailed),c(!1))}})(),()=>{n=!0;try{s?.disconnect()}catch{}try{r?.Destroy?.()}catch{}a.current=null}},[e,t]),b(()=>{const e=a.current;if(e?.viewer)try{const t=e=>{if(e.userData?.__sectionHelper)return;const t=e.userData?.originalMeshInstance??e.userData,n=t?.id?.nodeId??t?.nodeId;"number"==typeof n&&(e.visible=!O.has(n))};e.viewer.mainModel?.EnumerateMeshesAndLines?.(t),e.viewer.mainModel?.EnumerateEdges?.(t),e.viewer.Render?.()}catch(e){console.warn("[Preview] visibility update failed",e)}},[O,L]),b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer)try{t.viewer.SetEdgeSettings(new e.EdgeSettings(I,R(e,B),G));const n=ye.current;if(n){const e=[];t.viewer.mainModel?.EnumerateEdges?.(t=>{t.userData?.__sectionHelper&&e.push(t)});for(const t of e)t.parent?.remove(t),t.geometry?.dispose?.(),t.material?.dispose?.();const r=n.plane,s=e=>{e&&!n.materialState.has(e)&&(n.materialState.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[r],e.clipShadows=!0,e.needsUpdate=!0)};t.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)s(e);else s(t)})}t.viewer.Render?.()}catch{}},[I,B,G]),b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer)try{const n=R(e,H);t.viewer.SetBackgroundColor(new e.RGBAColor(n.r,n.g,n.b,255)),t.viewer.Render?.()}catch{}},[H]),b(()=>{const e=a.current;if(!e?.viewer||l)return;const t=e.viewer.renderer,n=e.viewer.scene;if(!t||!n)return;if(ye.current){const e=ye.current;for(const[t,n]of e.materialState.entries())t.clippingPlanes=n.clippingPlanes,t.clipShadows=n.clipShadows,t.needsUpdate=!0;for(const t of e.helpers)t.parent?.remove(t),t.material?.dispose?.();e.capMesh&&(n.remove(e.capMesh),e.capMesh.geometry?.dispose?.(),e.capMesh.material?.dispose?.()),ye.current=null}if(!Z)return t.localClippingEnabled=!1,void e.viewer.Render?.();const r=e.viewer.GetBoundingBox?.(()=>!0);if(!r)return;const s=[];if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{e.userData?.__sectionHelper||s.push(e)}),!s.length)return t.localClippingEnabled=!1,void e.viewer.Render?.();const i=s[0],o=i.constructor,c=i.material?.constructor,d=i.geometry?.constructor,u=i.geometry?.attributes?.position?.constructor;o&&c&&d&&u||console.warn("[Preview] section: missing THREE constructors, falling back to no cap");const p=7681;let m=!0;try{const e=t.getContext?.(),n=e?.getContextAttributes?.();m=!1!==n?.stencil,t.autoClearStencil=!0,console.info("[Preview] section: stencil buffer =",m,"targets =",s.length)}catch{}t.localClippingEnabled=!0;const h={normal:{x:0,y:0,z:-1},constant:0,clone:function e(){const t={normal:{x:this.normal.x,y:this.normal.y,z:this.normal.z},constant:this.constant};return t.clone=e,t}},y=[],x=/* @__PURE__ */new Map,f=e=>{e&&!x.has(e)&&(x.set(e,{clippingPlanes:e.clippingPlanes,clipShadows:e.clipShadows}),e.clippingPlanes=[h],e.clipShadows=!0,e.needsUpdate=!0)};for(const e of s){const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t);const n=Array.isArray(t)?t[0]:t;if(o&&m&&n?.clone){const t=(t,r)=>{const s=n.clone();s.depthWrite=!1,s.depthTest=!1,s.colorWrite=!1,s.stencilWrite=!0,s.stencilFunc=519,s.stencilFail=r,s.stencilZFail=r,s.stencilZPass=r,s.side=t,s.transparent=!1,s.clippingPlanes=[h],s.clipShadows=!0,s.needsUpdate=!0;const i=new o(e.geometry,s);i.matrixAutoUpdate=!1,i.renderOrder=1,i.userData.__sectionHelper=!0,e.add(i),y.push(i)};t(1,7682),t(0,7683)}}e.viewer.mainModel?.EnumerateEdges?.(e=>{const t=e.material;if(Array.isArray(t))for(const e of t)f(e);else f(t)});let g=null;const b=s[0]?.material&&(Array.isArray(s[0].material)?s[0].material[0]:s[0].material);if(m&&o&&d&&u&&b?.clone){const e=r.max.x-r.min.x,t=r.max.y-r.min.y,s=r.max.z-r.min.z,i=2*Math.max(e,t,s,1)/2,a=new d,l=new Float32Array([-i,-i,0,i,-i,0,i,i,0,-i,i,0]),c=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]);a.setAttribute("position",new u(l,3)),a.setAttribute("normal",new u(c,3)),a.setIndex([0,1,2,0,2,3]);const m=b.clone(),h=b.color?.getHex?.()??11844808;m.emissive?.setHex?.(h),"emissiveIntensity"in m&&(m.emissiveIntensity=.25),m.side=2,m.transparent=!1,m.opacity=1,m.stencilWrite=!0,m.stencilRef=0,m.stencilFunc=517,m.stencilFail=p,m.stencilZFail=p,m.stencilZPass=p,m.clippingPlanes=[],m.polygonOffset=!0,m.polygonOffsetFactor=-1,m.polygonOffsetUnits=-1,m.needsUpdate=!0,g=new o(a,m),g.renderOrder=2,g.userData.__sectionHelper=!0,n.add(g)}ye.current={plane:h,capMesh:g,helpers:y,materialState:x,bbox:r},console.info("[Preview] section: helpers =",y.length,"cap =",!!g),e.viewer.Render?.()},[Z,l,L]),b(()=>{const e=a.current,t=ye.current;if(e?.viewer&&t&&Z)try{const n=t.bbox,r="x"===ee?0:"y"===ee?1:2,s=[n.min.x,n.min.y,n.min.z][r],i=s+([n.max.x,n.max.y,n.max.z][r]-s)*se,a=ae*Math.PI/180,o=Math.cos(a),l=Math.sin(a),c=ne?-1:1;let d=0,u=0,p=0;"x"===ee?(d=c*o,p=c*l):"y"===ee?(u=c*o,d=c*l):(p=c*o,u=c*l);const m={x:(n.min.x+n.max.x)/2,y:(n.min.y+n.max.y)/2,z:(n.min.z+n.max.z)/2},h="x"===ee?i:m.x,y="y"===ee?i:m.y,x="z"===ee?i:m.z;if(t.plane.normal.x=d,t.plane.normal.y=u,t.plane.normal.z=p,t.plane.constant=-(d*h+u*y+p*x),t.capMesh){const e=m.x,n=m.y,r=m.z,s=d*e+u*n+p*r+t.plane.constant,i=e-d*s,a=n-u*s,o=r-p*s;t.capMesh.position.set(i,a,o),t.capMesh.lookAt?.(i+d,a+u,o+p)}e.viewer.Render?.()}catch(e){console.warn("[Preview] section update failed",e)}},[Z,ee,ne,se,ae]),b(()=>{const e=a.current;if(!e?.viewer||l||!i.current)return;const t=e.viewer.renderer,n=e.viewer.scene,r=t?.domElement;if(!t||!n||!r)return;let s=null;if(e.viewer.mainModel?.EnumerateMeshes?.(e=>{s||e.userData?.__sectionHelper||e.userData?.__measureHelper||(s=e)}),!s)return;const c=s.position.constructor,d=s.constructor,u=(Array.isArray(s.material)?s.material[0]:s.material)?.constructor,p=s.geometry.constructor,m=s.geometry.attributes?.position?.constructor;if(!(c&&d&&u&&p&&m))return;let h=null,y=null;n.traverse(e=>{if(h&&y)return;if(!e?.isLineSegments)return;h=e.constructor;const t=Array.isArray(e.material)?e.material[0]:e.material;t?.constructor&&(y=t.constructor)});const x=()=>{const t=he.current;if(t){null!==t.rafId&&cancelAnimationFrame(t.rafId);for(const e of t.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();t.line&&(n.remove(t.line),t.line.geometry?.dispose?.(),t.line.material?.dispose?.()),t.label&&t.label.parentElement&&t.label.parentElement.removeChild(t.label),he.current=null,e.viewer.Render?.()}};if(!le)return x(),void me(null);he.current={points:[],normals:[],markers:[],line:null,label:null,rafId:null};const f=o.current,g=f?.IntersectionMode?.MeshOnly??1,b=e.viewer.GetBoundingBox?.(()=>!0),w=b?Math.sqrt((b.max.x-b.min.x)**2+(b.max.y-b.min.y)**2+(b.max.z-b.min.z)**2):100,v=Math.max(.005*w,.2),k=e=>{const t=[],r=[];for(let e=0;e<=12;e++){const n=e/12*Math.PI;for(let e=0;e<=16;e++){const r=e/16*Math.PI*2;t.push(v*Math.sin(n)*Math.cos(r),v*Math.cos(n),v*Math.sin(n)*Math.sin(r))}}for(let e=0;e<12;e++)for(let t=0;t<16;t++){const n=17*e+t,s=n+16+1;r.push(n,s,n+1,s,s+1,n+1)}const s=new p;s.setAttribute("position",new m(new Float32Array(t),3)),s.setIndex(r),s.computeVertexNormals?.();const i=new u;i.color?.setHex?.(16746496),i.depthTest=!1,i.depthWrite=!1,i.transparent=!0,i.opacity=.95;const a=new d(s,i);return a.position.copy(e),a.renderOrder=9999,a.userData.__measureHelper=!0,n.add(a),a},N=()=>{const t=he.current;t&&((()=>{const t=he.current;if(!t||t.points.length<2||!t.label)return;const n=e.viewer.camera;if(!n)return;const s=t.points[0],i=t.points[1],a=new c((s.x+i.x)/2,(s.y+i.y)/2,(s.z+i.z)/2).clone();a.project?.(n);const o=r.getBoundingClientRect(),l=(a.x+1)/2*o.width,d=(1-a.y)/2*o.height;t.label.style.left=`${l}px`,t.label.style.top=`${d}px`;const u=l<0||d<0||l>o.width||d>o.height;t.label.style.opacity=a.z>1||u?"0":"1"})(),t.rafId=requestAnimationFrame(N))};he.current.rafId=requestAnimationFrame(N);let C=0,A=0,E=0,L=!1,M=!1;const S=t=>{if(!e.viewer.camera)return;const s=r.getBoundingClientRect(),a={x:t.clientX-s.left,y:t.clientY-s.top},o=e.viewer.GetMeshIntersectionUnderMouse?.(g,a);if(!o)return;const l=he.current,x=new c(o.point.x,o.point.y,o.point.z),f=(e=>{const t=e?.face?.normal,n=e?.object;if(!t||!n)return null;try{const e=new c(t.x,t.y,t.z);return e.transformDirection?.(n.matrixWorld),{x:e.x,y:e.y,z:e.z}}catch{return{x:t.x,y:t.y,z:t.z}}})(o);if(2===l.points.length){for(const e of l.markers)n.remove(e),e.geometry?.dispose?.(),e.material?.dispose?.();l.line&&(n.remove(l.line),l.line.geometry?.dispose?.(),l.line.material?.dispose?.()),l.label&&(l.label.style.opacity="0"),l.points=[],l.markers=[],l.line=null,l.normals=[],me(null)}if(l.points.push(x),l.normals.push(f),"perp"===de){const e=((e,t)=>{const r=e?.geometry,s=r?.attributes?.position;if(!r||!s||!t?.face?.normal)return null;const i=s.array,a=r.index?r.index.array:null,o=new c(t.point.x,t.point.y,t.point.z);e.worldToLocal?.(o);const l=t.face.normal,h=-(l.x*o.x+l.y*o.y+l.z*o.z);r.computeBoundingBox?.();const y=r.boundingBox,x=y?Math.sqrt((y.max.x-y.min.x)**2+(y.max.y-y.min.y)**2+(y.max.z-y.min.z)**2):100,f=Math.max(.001*x,.005),g=a?a.length/3:s.count/3,b=[],w=new c;for(let t=0;t<g;t++){const n=a?a[3*t]:3*t,r=a?a[3*t+1]:3*t+1,s=a?a[3*t+2]:3*t+2,o=i[3*n],c=i[3*n+1],d=i[3*n+2],u=i[3*r],p=i[3*r+1],m=i[3*r+2],y=i[3*s],x=i[3*s+1],g=i[3*s+2],v=u-o,k=p-c,N=m-d,C=y-o,A=x-c,E=g-d;let L=k*E-N*A,M=N*C-v*E,S=v*A-k*C;const z=Math.sqrt(L*L+M*M+S*S);if(0===z)continue;if(L/=z,M/=z,S/=z,L*l.x+M*l.y+S*l.z<.9995)continue;const j=(o+u+y)/3,T=(c+p+x)/3,R=(d+m+g)/3;if(!(Math.abs(l.x*j+l.y*T+l.z*R+h)>f))for(const[t,n,r]of[[o,c,d],[u,p,m],[y,x,g]])w.set?.(t,n,r),e.localToWorld?.(w),b.push(w.x,w.y,w.z)}if(0===b.length)return null;const v=new p;v.setAttribute("position",new m(new Float32Array(b),3)),v.computeVertexNormals?.();const k=new u;k.color?.setHex?.(16746496),k.transparent=!0,k.opacity=.45,k.depthWrite=!1,k.polygonOffset=!0,k.polygonOffsetFactor=-2,k.polygonOffsetUnits=-2;const N=new d(v,k);return N.renderOrder=9998,N.userData.__measureHelper=!0,n.add(N),N})(o.object,o);l.markers.push(e??k(x))}else l.markers.push(k(x));if(2===l.points.length){const e=l.points[0];let t,r=l.points[1],s="";if("perp"===de){const n=l.normals[0]??l.normals[1];if(n){const i=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)||1,a=n.x/i,o=n.y/i,d=n.z/i,u=(r.x-e.x)*a+(r.y-e.y)*o+(r.z-e.z)*d,p=new c(e.x+a*u,e.y+o*u,e.z+d*u);l.points[1]=p,r=p,t=Math.abs(u),s=" ⊥"}else{const n=r.x-e.x,s=r.y-e.y,i=r.z-e.z;t=Math.sqrt(n*n+s*s+i*i)}}else{const n=r.x-e.x,s=r.y-e.y,i=r.z-e.z;t=Math.sqrt(n*n+s*s+i*i)}l.line=((e,t)=>{const r=new p;r.setAttribute("position",new m(new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z]),3));const s=new(h??d)(r,new(y??u)({color:16746496,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.95}));return s.renderOrder=9998,s.userData.__measureHelper=!0,n.add(s),s})(e,r),me(t);const a=(()=>{const e=he.current;if(e.label)return e.label;const t=document.createElement("div");return t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.transform="translate(-50%, -50%)",t.style.padding="2px 6px",t.style.fontSize="11px",t.style.fontWeight="600",t.style.fontFamily="system-ui, -apple-system, sans-serif",t.style.background="rgba(255, 136, 0, 0.95)",t.style.color="#fff",t.style.borderRadius="4px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.boxShadow="0 1px 4px rgba(0,0,0,0.25)",t.style.zIndex="5",i.current.appendChild(t),e.label=t,t})();a.textContent=`${D(t)}${s}`}e.viewer.Render?.()},z=e=>{0===e.button&&(C=e.clientX,A=e.clientY,E=performance.now(),L=!1,M=!0)},j=e=>{if(!M)return;const t=e.clientX-C,n=e.clientY-A;t*t+n*n>16&&(L=!0)},T=e=>{if(0!==e.button||!M)return;const t=performance.now()-E;M=!1,!L&&t<350&&S(e)},R=e=>{"Escape"===e.key&&ce(!1)};return r.style.cursor="crosshair",r.addEventListener("pointerdown",z),r.addEventListener("pointermove",j),r.addEventListener("pointerup",T),r.addEventListener("pointercancel",T),window.addEventListener("keydown",R),()=>{r.style.cursor="",r.removeEventListener("pointerdown",z),r.removeEventListener("pointermove",j),r.removeEventListener("pointerup",T),r.removeEventListener("pointercancel",T),window.removeEventListener("keydown",R),x(),me(null)}},[le,de,l,L]),b(()=>{if(!h||l)return;const e=setTimeout(()=>x(!1),5e3);return()=>clearTimeout(e)},[h,l]);const xe=e=>{const t=/* @__PURE__ */new Set;T(e,t),W(e=>{const n=new Set(e),r=[...t].some(e=>!n.has(e));for(const e of t)r?n.add(e):n.delete(e);return n})},fe=()=>{try{const e=a.current,t=e?.viewer?.GetBoundingSphere?.(()=>!0);t&&e.viewer.FitSphereToWindow(t,!0),e?.viewer?.Render?.()}catch{}};b(()=>{const e=o.current,t=a.current;if(e&&t?.viewer&&!l)try{t.viewer.SetProjectionMode(Q?e.ProjectionMode.Perspective:e.ProjectionMode.Orthographic)}catch{}},[Q,l]);const ge=e=>{const t=o.current,n=a.current;if(t&&n?.viewer)try{const r=n.viewer.GetBoundingSphere?.(()=>!0);if(!r)return;const s=r.center,i=3*(r.radius||1),a=s.x??0,o=s.y??0,l=s.z??0;let c,d;switch(e){case"top":c=new t.Coord3D(a,o,l+i),d=new t.Coord3D(0,1,0);break;case"front":c=new t.Coord3D(a,o-i,l),d=new t.Coord3D(0,0,1);break;case"side":c=new t.Coord3D(a+i,o,l),d=new t.Coord3D(0,0,1);break;default:{const e=i/Math.sqrt(3);c=new t.Coord3D(a+e,o-e,l+e),d=new t.Coord3D(0,0,1);break}}const u=new t.Coord3D(a,o,l),p=new t.Camera(c,u,d,45);n.viewer.SetCamera(p),n.viewer.AdjustClippingPlanesToSphere?.(r),n.viewer.Render?.()}catch{}},be=(t.split(".").pop()||"").toUpperCase(),we=(e,t=0)=>{const n=e.children.length>0,r=!1!==S[e.id],s=!O.has(e.id);/* @__PURE__ */
|
|
83
83
|
return w("div",{children:[
|
|
84
84
|
/* @__PURE__ */w("div",{className:"group flex items-center gap-1 px-2 py-1 hover:bg-gray-100 cursor-default text-xs text-gray-700",style:{paddingLeft:12*t+6+"px"},children:[n?/* @__PURE__ */v("button",{onClick:()=>{return t=e.id,void F(e=>({...e,[t]:!e[t]}));var t},className:"h-4 w-4 shrink-0 flex items-center justify-center text-gray-500 hover:text-gray-900",title:r?C.collapse:C.expand,children:/* @__PURE__ */v(u,r?{name:"chevron-down",className:"h-3 w-3",strokeWidth:2}:{name:"chevron-right",className:"h-3 w-3",strokeWidth:2})}):/* @__PURE__ */v("span",{className:"h-4 w-4 shrink-0 flex items-center justify-center",children:/* @__PURE__ */v("span",{className:"h-1 w-1 rounded-full bg-gray-400"})}),
|
|
85
85
|
/* @__PURE__ */v("span",{className:"flex-1 truncate "+(s?"":"opacity-40"),title:e.name,children:e.name}),
|
|
@@ -93,7 +93,7 @@ return w("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
93
93
|
/* @__PURE__ */v("button",{onClick:()=>ge("top"),className:ve,title:C.topView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.top})}),
|
|
94
94
|
/* @__PURE__ */v("button",{onClick:()=>ge("front"),className:ve,title:C.frontView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.front})}),
|
|
95
95
|
/* @__PURE__ */v("button",{onClick:()=>ge("side"),className:ve,title:C.sideView,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold",children:C.side})}),
|
|
96
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
96
|
+
/* @__PURE__ */v("button",{onClick:()=>J(e=>!e),className:Q?"h-8 shrink-0 flex items-center justify-center px-2 rounded bg-gray-200 text-gray-900":"h-8 shrink-0 flex items-center justify-center px-2 rounded text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-colors",title:Q?C.toOrthographic:C.toPerspective,children:/* @__PURE__ */v("span",{className:"text-2xs font-semibold whitespace-nowrap",children:Q?C.perspective:C.orthographic})}),
|
|
97
97
|
/* @__PURE__ */v("div",{className:Ne}),
|
|
98
98
|
/* @__PURE__ */v("button",{onClick:()=>{try{const e=a.current,n=e?.viewer?.GetCanvasSize?.()??{width:1280,height:720},r=e?.viewer?.GetImageAsDataUrl?.(n.width,n.height,!1);if(!r)return;const s=document.createElement("a");s.href=r,s.download=`${t.replace(/\.[^.]+$/,"")}-snapshot.png`,s.click()}catch{}},className:ve,title:C.snapshot,children:/* @__PURE__ */v(u,{name:"camera",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
99
99
|
/* @__PURE__ */v("button",{onClick:()=>x(e=>!e),className:ve,title:A.howToNavigate,children:/* @__PURE__ */v(u,{name:"help",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
@@ -106,12 +106,12 @@ return w("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
106
106
|
/* @__PURE__ */v("button",{onClick:()=>Y(e=>!e),className:_?ke:ve,title:C.meshesHint,children:/* @__PURE__ */v(u,{name:"menu",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
107
107
|
/* @__PURE__ */v("button",{onClick:()=>K(e=>!e),className:$?ke:ve,title:C.displayHint,children:/* @__PURE__ */v(u,{name:"settings",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
108
108
|
/* @__PURE__ */v("button",{onClick:r??(()=>{const n=document.createElement("a");n.href=e,n.download=t,n.click()}),className:ve,title:C.downloadOriginal,children:/* @__PURE__ */v(u,{name:"download",className:"h-4 w-4",strokeWidth:1.5})}),s&&/* @__PURE__ */v("button",{onClick:s,className:ve,title:A.email,children:/* @__PURE__ */v(u,{name:"email",className:"h-4 w-4",strokeWidth:1.5})})]}),
|
|
109
|
-
/* @__PURE__ */v("div",{className:"flex-1 flex min-h-0",children:/* @__PURE__ */w("div",{className:"relative flex-1 min-w-0",style:{background:
|
|
109
|
+
/* @__PURE__ */v("div",{className:"flex-1 flex min-h-0",children:/* @__PURE__ */w("div",{className:"relative flex-1 min-w-0",style:{background:H},children:[
|
|
110
110
|
/* @__PURE__ */v("div",{ref:i,style:{width:"100%",height:"100%"}}),_&&/* @__PURE__ */w("div",{className:"absolute top-2 left-2 w-64 max-h-[80%] flex flex-col bg-white/95 backdrop-blur border border-gray-200 rounded-md shadow-xl z-10 text-xs",children:[
|
|
111
111
|
/* @__PURE__ */w("div",{className:"flex items-center justify-between px-2 min-h-8 py-1 border-b border-gray-200 bg-gray-50",children:[
|
|
112
112
|
/* @__PURE__ */v("span",{className:"font-medium text-gray-700",children:C.meshes}),
|
|
113
113
|
/* @__PURE__ */v("button",{onClick:()=>Y(!1),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-600",title:A.closePanel,children:"×"})]}),
|
|
114
|
-
/* @__PURE__ */v("div",{className:"flex-1 overflow-y-auto py-1",children:L?we(L):l?/* @__PURE__ */v(m,{size:"sm",padding:"py-3",label:C.readingModel}):/* @__PURE__ */v("div",{className:"px-3 py-3 text-2xs text-gray-500 italic",children:C.noStructure})}),L&&/* @__PURE__ */v("div",{className:"px-3 py-2 text-2xs text-gray-500 border-t border-gray-200",children:0===
|
|
114
|
+
/* @__PURE__ */v("div",{className:"flex-1 overflow-y-auto py-1",children:L?we(L):l?/* @__PURE__ */v(m,{size:"sm",padding:"py-3",label:C.readingModel}):/* @__PURE__ */v("div",{className:"px-3 py-3 text-2xs text-gray-500 italic",children:C.noStructure})}),L&&/* @__PURE__ */v("div",{className:"px-3 py-2 text-2xs text-gray-500 border-t border-gray-200",children:0===O.size?C.allVisible:C.hiddenCount(O.size)})]}),h&&!l&&!d&&/* @__PURE__ */w("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-gray-900/85 text-white text-2xs px-3 min-h-8 py-1 rounded-full shadow-lg flex items-center gap-3 z-10 pointer-events-none",children:[
|
|
115
115
|
/* @__PURE__ */v("span",{children:C.dragToRotate}),
|
|
116
116
|
/* @__PURE__ */v("span",{className:"text-white/40",children:"•"}),
|
|
117
117
|
/* @__PURE__ */v("span",{children:C.rightDragToPan}),
|
|
@@ -124,14 +124,14 @@ return w("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
124
124
|
/* @__PURE__ */w("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 text-xs text-gray-700",children:[
|
|
125
125
|
/* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
|
|
126
126
|
/* @__PURE__ */v("span",{children:C.backgroundColor}),
|
|
127
|
-
/* @__PURE__ */v("input",{type:"color",value:
|
|
127
|
+
/* @__PURE__ */v("input",{type:"color",value:H,onChange:e=>P(e.target.value),className:"h-6 w-10 rounded border border-gray-300 bg-white"})]}),
|
|
128
128
|
/* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
|
|
129
129
|
/* @__PURE__ */v("span",{children:C.showEdges}),
|
|
130
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
130
|
+
/* @__PURE__ */v("button",{onClick:()=>X(e=>!e),role:"switch","aria-checked":I,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors "+(I?"bg-blue-500":"bg-gray-300"),children:/* @__PURE__ */v("span",{className:"inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform "+(I?"translate-x-[18px]":"translate-x-0.5")})})]}),
|
|
131
131
|
/* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
|
|
132
|
-
/* @__PURE__ */v("span",{className:
|
|
133
|
-
/* @__PURE__ */v("input",{type:"color",value:
|
|
134
|
-
/* @__PURE__ */w("div",{className:
|
|
132
|
+
/* @__PURE__ */v("span",{className:I?"":"opacity-40",children:C.edgeColor}),
|
|
133
|
+
/* @__PURE__ */v("input",{type:"color",value:B,onChange:e=>U(e.target.value),disabled:!I,className:"h-6 w-10 rounded border border-gray-300 bg-white disabled:opacity-40"})]}),
|
|
134
|
+
/* @__PURE__ */w("div",{className:I?"":"opacity-40 pointer-events-none",children:[
|
|
135
135
|
/* @__PURE__ */w("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
|
|
136
136
|
/* @__PURE__ */v("span",{children:C.edgeThreshold}),
|
|
137
137
|
/* @__PURE__ */w("span",{className:"text-gray-500 tabular-nums",children:[G,"°"]})]}),
|
|
@@ -139,8 +139,8 @@ return w("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
139
139
|
/* @__PURE__ */w("div",{className:"border-t border-gray-200 -mx-3 px-3 pt-3 mt-1",children:[
|
|
140
140
|
/* @__PURE__ */w("label",{className:"flex items-center justify-between gap-2",children:[
|
|
141
141
|
/* @__PURE__ */v("span",{className:"font-medium",children:C.sectionView}),
|
|
142
|
-
/* @__PURE__ */v("button",{onClick:()=>
|
|
143
|
-
/* @__PURE__ */w("div",{className:
|
|
142
|
+
/* @__PURE__ */v("button",{onClick:()=>q(e=>!e),role:"switch","aria-checked":Z,className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors "+(Z?"bg-blue-500":"bg-gray-300"),children:/* @__PURE__ */v("span",{className:"inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform "+(Z?"translate-x-[18px]":"translate-x-0.5")})})]}),
|
|
143
|
+
/* @__PURE__ */w("div",{className:Z?"mt-2 space-y-2":"mt-2 space-y-2 opacity-40 pointer-events-none",children:[
|
|
144
144
|
/* @__PURE__ */w("div",{children:[
|
|
145
145
|
/* @__PURE__ */w("div",{className:"flex items-center justify-between gap-2 mb-1",children:[
|
|
146
146
|
/* @__PURE__ */v("span",{children:C.angle}),
|
|
@@ -156,7 +156,7 @@ return w("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
156
156
|
/* @__PURE__ */v("span",{children:C.position}),
|
|
157
157
|
/* @__PURE__ */w("span",{className:"text-gray-500 tabular-nums",children:[Math.round(100*se),"%"]})]}),
|
|
158
158
|
/* @__PURE__ */v("input",{type:"range",min:0,max:1,step:.01,value:se,onChange:e=>ie(Number(e.target.value)),className:"w-full accent-blue-500"})]})]})]})]}),
|
|
159
|
-
/* @__PURE__ */v("div",{className:"px-3 py-2 border-t border-gray-200",children:/* @__PURE__ */v("button",{onClick:()=>{
|
|
159
|
+
/* @__PURE__ */v("div",{className:"px-3 py-2 border-t border-gray-200",children:/* @__PURE__ */v("button",{onClick:()=>{P("#f5f6f8"),X(!0),U("#000000"),V(1),q(!1),te("x"),re(!1),ie(.5),oe(0)},className:"w-full text-2xs text-gray-700 bg-gray-100 hover:bg-gray-200 rounded py-2 transition-colors",children:C.resetDisplay})})]})]})})]})}function O({url:e,filename:t,onDownload:s,onEmail:i}){const[a,o]=g(1),[l,c]=g(!1),[p,m]=g(!1),h=f(null),x=y().preview,b="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
160
160
|
return w("div",{className:"flex flex-col h-full",children:[
|
|
161
161
|
/* @__PURE__ */w(n,{children:[!p&&/* @__PURE__ */w(k,{children:[
|
|
162
162
|
/* @__PURE__ */v("button",{onClick:()=>o(e=>Math.max(.1,Math.round(100*(e-.25))/100)),className:b,children:"−"}),
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import{useAuth as e,parseOpenSections as t,readStored as a,RAIL_OPEN_SECTIONS_KEY as r,RAIL_WIDTH_KEY as n,toggleOpenSection as i,writeStored as l}from"./chunk-Y65MPP3M.js";import{ResizeHandle as o}from"./chunk-KZHPX4FM.js";import{openGlobalSearch as s}from"./chunk-K7KQDPLW.js";import{partitionNav as c,flyoutGroups as d,visibleSectionItems as m,rowsContainRoute as h,visibleNavChildren as u}from"./chunk-WGRS6QBT.js";import{BrandMark as p}from"./chunk-MI67DI3H.js";import{IconButton_default as b}from"./chunk-4CANQ3B3.js";import{RAIL_MENU_GAP as g,navSections as f,startMenuCategories as y,TAB_STRIP_H as x,RAIL_COLLAPSED_INSET as k,RAIL_W as v,RAIL_MAX_W as N,RAIL_MIN_W as C,navIcons as j,sectionIcons as w}from"./chunk-CY5N5OA3.js";import"./chunk-5A7MWTXX.js";import"./chunk-PKXQDCNR.js";import{PopupMenu as S,PopupMenuItem as L,PopupMenuDivider as W,PopupMenuLabel as z}from"./chunk-O6JX6RDX.js";import"./chunk-5QFPTDQF.js";import"./chunk-QR4RM7PO.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import{Icon as $}from"./chunk-KIBL6M3T.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import{useShellStrings as M}from"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useMemo as R,useState as A,useRef as I,useEffect as K,isValidElement as T,cloneElement as D}from"react";import{jsx as H,jsxs as Q,Fragment as P}from"react/jsx-runtime";var B="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform);function J(e,t,a){const r=Math.max(8,a-t.bottom);return{left:e+g,bottom:r,maxHeight:a-r-8,overflowY:"auto"}}var O=(e,t)=>["flex h-(--row-height-menu) w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium transition-colors",t?"justify-center px-0":"",e?"bg-gray-100 text-gray-900":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"].join(" "),U="flex size-[18px] shrink-0 items-center justify-center [&>svg]:size-[18px]";function X({open:e}){/* @__PURE__ */
|
|
2
|
+
return H($,{name:"chevron-down",className:"size-4 shrink-0 transition-transform "+(e?"rotate-180":""),strokeWidth:2,"aria-hidden":"true"})}function G({dir:e}){/* @__PURE__ */
|
|
3
|
+
return H($,"left"===e?{name:"chevron-double-left",className:"size-[18px] shrink-0",strokeWidth:1.5,"aria-hidden":"true"}:{name:"chevron-double-right",className:"size-[18px] shrink-0",strokeWidth:1.5,"aria-hidden":"true"})}function _({className:e}){/* @__PURE__ */
|
|
4
|
+
return H($,{name:"search",className:e,strokeWidth:2,"aria-hidden":"true"})}var F=e=>.75+1.75*e+"rem";function V({width:V,collapsed:Y,onToggleCollapsed:Z,onResize:E,onHome:q,onOpen:ee,activeRoute:te,profile:ae,user:re,onLogout:ne,onSwitchToDesktop:ie,onReportBug:le,onClose:oe,navSections:se=f,navIcons:ce=j,sectionIcons:de=w,categories:me=y,productName:he,productIcon:ue,tagline:pe,adaptiveLogo:be=!1,logoHasAlpha:ge=null,logoIsLight:fe=null}){const ye=M().layout,{hasAnyPerm:xe}=e(),ke=R(()=>c(se,me,xe),[se,me,xe]),[ve,Ne]=A(()=>t(a(r))),Ce=e=>Ne(t=>{const a=i(t,e);return l(r,JSON.stringify([...a])),a}),[je,we]=A(null),[Se,Le]=A(!1),We=I(null);K(()=>{Y||we(null)},[Y]);const ze=(e,t)=>{we(null),e.onSelect?e.onSelect():ee(e.to,!!t&&(e=>e.metaKey||e.ctrlKey||1===e.button)(t))},$e=(e,t)=>{const a=t[e];/* @__PURE__ */
|
|
5
|
+
return H("span",{className:U,"aria-hidden":"true",children:a&&T(a)?D(a,{className:"size-[18px]"}):a})},Me=(e,t)=>{const a=u(e,xe),r=e.menuLabel??e.label;if(a.length>0){const n=`child:${e.to}`,i=ve.has(n),l=!i&&h(a,te,xe);/* @__PURE__ */
|
|
6
|
+
return Q("div",{children:[
|
|
7
|
+
/* @__PURE__ */Q("button",{type:"button",onClick:()=>Ce(n),"aria-expanded":i,className:O(l,!1),style:t>0?{paddingLeft:F(t)}:void 0,children:[0===t&&$e(e.to,ce),
|
|
8
|
+
/* @__PURE__ */H("span",{className:"min-w-0 flex-1 truncate",children:r}),
|
|
9
|
+
/* @__PURE__ */H(X,{open:i})]}),i&&/* @__PURE__ */H("div",{className:"space-y-0.5 pt-0.5",children:a.map(e=>Me(e,t+1))}),e.dividerAfter&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200",style:{marginLeft:F(t)},"aria-hidden":"true"})]},e.to)}const n=e.to===te;/* @__PURE__ */
|
|
10
|
+
return Q("div",{children:[
|
|
11
|
+
/* @__PURE__ */Q("button",{type:"button",onClick:t=>ze(e,t),onAuxClick:t=>{1===t.button&&ze(e,t)},"aria-current":n?"page":void 0,className:O(n,!1),style:t>0?{paddingLeft:F(t)}:void 0,children:[0===t&&$e(e.to,ce),
|
|
12
|
+
/* @__PURE__ */H("span",{className:"min-w-0 flex-1 truncate",children:r})]}),e.dividerAfter&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200",style:{marginLeft:F(t)},"aria-hidden":"true"})]},e.to)},Re=(e,t)=>{const a=t?e.items:m(e,xe);if(0===a.length)return null;const r="icon"in e&&e.icon?/* @__PURE__ */H("span",{className:U,"aria-hidden":"true",children:e.icon}):$e(e.label,de),n=e.menuLabel??e.label,i=h(a,te,xe),l="dividerAfter"in e&&e.dividerAfter;if(Y)/* @__PURE__ */
|
|
13
|
+
return Q("div",{children:[
|
|
14
|
+
/* @__PURE__ */H("button",{type:"button",title:n,"aria-label":n,"aria-haspopup":"menu","aria-expanded":je?.label===e.label,onClick:t=>{const r=t.currentTarget.getBoundingClientRect();we(t=>t?.label===e.label?null:{label:e.label,items:a,top:r.top})},className:O(i||je?.label===e.label,!0),children:r}),l&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.label);const o=ve.has(e.label),s=`rosh-rail-${e.label.replace(/[^a-z0-9]+/gi,"-").toLowerCase()}`;/* @__PURE__ */
|
|
15
|
+
return Q("div",{children:[
|
|
16
|
+
/* @__PURE__ */Q("button",{type:"button",onClick:()=>Ce(e.label),"aria-expanded":o,"aria-controls":s,className:O(!o&&i,!1),children:[r,
|
|
17
|
+
/* @__PURE__ */H("span",{className:"min-w-0 flex-1 truncate",children:n}),
|
|
18
|
+
/* @__PURE__ */H(X,{open:o})]}),
|
|
19
|
+
/* @__PURE__ */H("div",{id:s,role:"group","aria-label":n,hidden:!o,className:"space-y-0.5 pt-0.5",children:o&&a.map(e=>Me(e,1))}),l&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.label)},Ae=ae?.first_name?`${ae.first_name} ${ae.last_name||""}`.trim():re?.email||"",Ie=(ae?.first_name?.charAt(0)||re?.email?.charAt(0)||"?").toUpperCase(),Ke=ae?.avatar_url?/* @__PURE__ */H("img",{src:ae.avatar_url,alt:"",className:"size-8 shrink-0 rounded-full object-cover"}):/* @__PURE__ */H("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-blue-600 text-xs font-semibold text-white",children:Ie}),Te=Se?We.current?.getBoundingClientRect():void 0,De=Y?"":"px-3",He=Y?{paddingInline:k}:void 0,Qe=`${Y?ye.expandSidebar:ye.collapseSidebar} (${B?"⌘":"Ctrl"} .)`,Pe=q?{run:q,label:ye.goHome,title:ye.goHome}:oe?null:{run:Z,label:Y?ye.expandSidebar:ye.collapseSidebar,title:Qe},Be=/* @__PURE__ */Q(P,{children:[ue&&/* @__PURE__ */H(p,{src:ue,alt:"",slot:"compact",surface:"light",adaptive:be,hasAlpha:ge,isLight:fe,size:28,decorative:!0}),!Y&&/* @__PURE__ */Q("span",{className:"min-w-0 text-left leading-tight",children:[
|
|
20
|
+
/* @__PURE__ */H("span",{className:"block truncate text-base font-bold tracking-wide text-gray-900",children:he??"Apps"}),pe&&/* @__PURE__ */H("span",{className:"block truncate text-2xs font-medium text-gray-500",children:pe})]})]}),Je=ke.erpSections.length>0||ke.systemSections.length>0||ke.virtualSections.length>0;/* @__PURE__ */
|
|
21
|
+
return Q("aside",{"aria-label":ye.navLabel,className:"fixed left-0 top-0 z-(--z-sidebar) flex h-dvh flex-col border-r border-gray-200 bg-white text-gray-800",style:{width:V},children:[
|
|
22
|
+
/* @__PURE__ */Q("div",{className:"flex shrink-0 items-center border-b border-gray-200 "+(Y?"justify-center":"justify-between gap-2 pl-4 pr-2"),style:{height:x},children:[Pe?/* @__PURE__ */H("button",{type:"button",onClick:Pe.run,"aria-label":Pe.label,title:Pe.title,className:"flex min-w-0 items-center gap-2 rounded-md transition-colors hover:bg-gray-100 "+(Y?"justify-center p-0.5":"-ml-1 p-1"),children:Be}):/* @__PURE__ */H("span",{className:"flex min-w-0 items-center gap-2",children:Be}),oe?/* @__PURE__ */H(b,{onClick:oe,"aria-label":ye.closeMenu,children:/* @__PURE__ */H($,{name:"close",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"})}):!Y&&/* @__PURE__ */H("button",{type:"button",onClick:Z,"aria-label":ye.collapseSidebar,title:`${ye.collapseSidebar} (${B?"⌘":"Ctrl"} .)`,className:"flex size-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900",children:/* @__PURE__ */H(G,{dir:"left"})})]}),
|
|
23
|
+
/* @__PURE__ */H("div",{className:`shrink-0 pt-3 ${De}`,style:He,children:Y?/* @__PURE__ */H("button",{type:"button",onClick:s,"aria-label":ye.search,title:`${ye.search} (${B?"⌘K":"Ctrl K"})`,className:O(!1,!0),children:/* @__PURE__ */H(_,{className:"size-[18px] shrink-0"})}):/* @__PURE__ */Q("button",{type:"button",onClick:s,className:"flex h-(--row-height-menu) w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-3 text-left transition-colors hover:bg-gray-100",children:[
|
|
24
|
+
/* @__PURE__ */H(_,{className:"size-3.5 text-gray-500"}),
|
|
25
|
+
/* @__PURE__ */H("span",{className:"min-w-0 flex-1 truncate text-sm text-gray-500",children:ye.search}),
|
|
26
|
+
/* @__PURE__ */H("kbd",{className:"rounded border border-gray-200 bg-gray-100 px-2 py-0.5 font-mono text-2xs font-semibold text-gray-500",children:B?"⌘K":"Ctrl K"})]})}),
|
|
27
|
+
/* @__PURE__ */Q("nav",{"aria-label":ye.navLabel,className:`min-h-0 flex-1 overflow-y-auto pb-4 pt-3 ${De} ${Y?"space-y-1":"space-y-0.5"}`,style:He,children:[Y&&/* @__PURE__ */H("button",{type:"button",onClick:Z,"aria-label":ye.expandSidebar,title:`${ye.expandSidebar} (${B?"⌘":"Ctrl"} .)`,className:`${O(!1,!0)} mb-3`,children:/* @__PURE__ */H(G,{dir:"right"})}),ke.topItems.map(e=>{if(!Y)return Me(e,0);const t=u(e,xe),a=e.to===te||h(t,te,xe),r=e.menuLabel??e.label;/* @__PURE__ */
|
|
28
|
+
return Q("div",{children:[
|
|
29
|
+
/* @__PURE__ */H("button",{type:"button",title:r,"aria-label":r,onClick:a=>{if(0===t.length)return void ze(e,a);const r=a.currentTarget.getBoundingClientRect();we(a=>a?.label===e.to?null:{label:e.to,items:t,top:r.top})},className:O(a,!0),children:$e(e.to,ce)}),e.dividerAfter&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)}),ke.topItems.length>0&&Je&&!ke.topItems[ke.topItems.length-1].dividerAfter&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"}),ke.erpSections.map(e=>Re(e,!1)),ke.systemSections.map(e=>Re(e,!1)),ke.virtualSections.map(e=>Re(e,!0)),ke.footerSections.length>0&&/* @__PURE__ */H("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"}),ke.footerSections.map(e=>Re(e,!1))]}),
|
|
30
|
+
/* @__PURE__ */H("div",{className:`shrink-0 border-t border-gray-200 py-2 ${De}`,style:He,children:/* @__PURE__ */Q("button",{ref:We,type:"button",onClick:()=>Le(e=>!e),"aria-haspopup":"menu","aria-expanded":Se,"aria-label":Y?ye.accountMenu(Ae):void 0,className:"flex w-full items-center gap-3 rounded-md hover:bg-gray-100 "+(Y?"justify-center py-2":"px-2 py-2"),children:[Ke,!Y&&/* @__PURE__ */Q("span",{className:"min-w-0 flex-1 text-left",children:[
|
|
31
|
+
/* @__PURE__ */H("span",{className:"block truncate text-sm font-semibold text-gray-800",children:Ae}),re?.email&&Ae!==re.email&&/* @__PURE__ */H("span",{className:"block truncate text-2xs text-gray-500",children:re.email})]})]})}),E&&!Y&&!oe&&/* @__PURE__ */H(o,{side:"left",width:V,onResize:E,min:C,max:N,defaultWidth:v,storageKey:n,label:ye.resizeSidebar}),Se&&Te&&/* @__PURE__ */Q(S,{portal:!0,minWidth:224,onClose:()=>Le(!1),style:J(V,Te,window.innerHeight),children:[Y&&/* @__PURE__ */Q("div",{className:"border-b border-gray-200 px-3 py-3",children:[
|
|
32
|
+
/* @__PURE__ */H("p",{className:"truncate text-sm font-semibold text-gray-800",children:Ae}),re?.email&&/* @__PURE__ */H("p",{className:"truncate text-xs text-gray-500",children:re.email})]}),
|
|
33
|
+
/* @__PURE__ */Q(L,{onClick:()=>{Le(!1),ee("/profile",!1)},children:[
|
|
34
|
+
/* @__PURE__ */H($,{name:"account",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ye.profile]}),ke.footerItems.map(e=>/* @__PURE__ */Q(L,{onClick:()=>{Le(!1),ze(e)},children:[
|
|
35
|
+
/* @__PURE__ */H("span",{className:"h-4 w-4 [&>svg]:size-4","aria-hidden":"true",children:ce[e.to]}),e.menuLabel??e.label]},e.to)),le&&/* @__PURE__ */Q(L,{onClick:()=>{Le(!1),le()},children:[
|
|
36
|
+
/* @__PURE__ */H($,{name:"error",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ye.reportIssue]}),
|
|
37
|
+
/* @__PURE__ */H(W,{}),ie&&/* @__PURE__ */Q(P,{children:[
|
|
38
|
+
/* @__PURE__ */Q(L,{onClick:()=>{Le(!1),ie()},children:[
|
|
39
|
+
/* @__PURE__ */H($,{name:"desktop",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ye.switchToDesktop]}),
|
|
40
|
+
/* @__PURE__ */H(W,{})]}),
|
|
41
|
+
/* @__PURE__ */Q(L,{danger:!0,onClick:()=>{Le(!1),ne()},children:[
|
|
42
|
+
/* @__PURE__ */H($,{name:"logout",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ye.signOut]})]}),je&&Y&&/* @__PURE__ */H(S,{portal:!0,minWidth:220,onClose:()=>we(null),style:{left:V+g,top:Math.min(je.top,window.innerHeight-48*Math.min(je.items.length,10)-16)},children:d(je.items,xe).map((e,t)=>/* @__PURE__ */Q("div",{role:e.heading?"group":void 0,"aria-label":e.heading?e.heading.menuLabel??e.heading.label:void 0,children:[t>0&&/* @__PURE__ */H(W,{}),e.heading&&/* @__PURE__ */H(z,{children:e.heading.menuLabel??e.heading.label}),e.items.map(e=>/* @__PURE__ */Q(L,{onClick:()=>ze(e),children:[$e(e.to,ce),
|
|
43
|
+
/* @__PURE__ */H("span",{className:e.to===te?"font-semibold":"",children:e.menuLabel??e.label})]},e.to))]},e.heading?.to??`run-${t}`))})]})}export{J as accountMenuPosition,V as default};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{EditableGrid as e}from"./chunk-
|
|
1
|
+
import{EditableGrid as e}from"./chunk-PPFMXLEX.js";import"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-OHVAD3NO.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-SG2MTCA2.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-JDCM2VHG.js";import"./chunk-KNUR2UEG.js";import"./chunk-HVX37PKU.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-FL2PUQX7.js";import"./chunk-ZN3O2KJ7.js";import"./chunk-YCQVEJOT.js";import"./chunk-KC3EX26K.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-O6JX6RDX.js";import"./chunk-5QFPTDQF.js";import"./chunk-BY2OWWKC.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-D323R2FT.js";import"./chunk-CDAJKLGL.js";import"./chunk-6KO5VTL7.js";import"./chunk-6CRERVSV.js";import"./chunk-4IU5BSVE.js";import"./chunk-K7U4RWXJ.js";import"./chunk-VH6GB73Q.js";import"./chunk-KIBL6M3T.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-22S6LG6D.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-E6UCGCOC.js";import"./chunk-C3QOHMR6.js";import{useRef as l,useState as s,useEffect as c,useCallback as i}from"react";import{jsxs as u,jsx as d,Fragment as h}from"react/jsx-runtime";var m="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p=10,x=30;function g(e){return e<26?m[e]:m[Math.floor(e/26)-1]+m[e%26]}function y(e){return Array.from({length:e},(e,t)=>({key:`col_${t}`,title:g(t),width:100}))}function b(e,t){return Array.from({length:e},()=>Array(t).fill(""))}function f(e){return{id:crypto.randomUUID(),name:e,columns:y(p),data:b(x,p),cellStyles:{}}}function v(e){return e.split("\n").map(e=>{if(e.includes("\t"))return e.split("\t").map(e=>e.trim());const t=[];let r="",n=!1;for(const o of e)'"'!==o?","!==o||n?r+=o:(t.push(r.trim()),r=""):n=!n;return t.push(r.trim()),t}).filter(e=>e.some(e=>e.trim()))}function k(e,t){const r=v(e);if(0===r.length)return null;const n=Math.max(p,r.reduce((e,t)=>Math.max(e,t.length),0)),o=r.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));return{id:crypto.randomUUID(),name:t,columns:y(n),data:o,cellStyles:{}}}function w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),j=(()=>{const e=g.current;if(!e)return null;const t=k(e.data.csv,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[C,N]=s(j?[j.sheet]:[f("Sheet 1")]),[S,U]=s(0),M=l([]),E=l(C),R=l(!1);c(()=>{R.current?R.current=!1:E.current!==C&&(M.current.push(E.current),M.current.length>50&&M.current.shift()),E.current=C},[C]);const D=i(()=>{const e=M.current.pop();e&&(R.current=!0,N(e))},[]);c(()=>{const e=e=>{if(!m.current?.contains(document.activeElement)&&!m.current?.matches(":focus-within"))return;(e.ctrlKey||e.metaKey)&&!e.shiftKey&&("z"===e.key||"Z"===e.key)&&(e.preventDefault(),D())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D]);const[L,A]=s(j?.title??"Untitled"),[K,$]=s(()=>g.current?.data.onEmail),V=i(e=>{const t=k(e.csv,"Sheet 1");t&&(N([t]),U(0),A(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),$(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&V(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&V(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[O,T]=s(!1),[X,B]=s(null),[F,J]=s(""),W=l(null),[Q,G]=s("1"),[I,P]=s("10"),H=C[S]||C[0],Y=H.data,Z=H.columns,z=H.cellStyles??{},[_,q]=s(null),[ee,te]=s(null),re=i(()=>{if(ee){const e=Math.min(ee.anchor.row,ee.end.row),t=Math.max(ee.anchor.row,ee.end.row),r=Math.min(ee.anchor.col,ee.end.col),n=Math.max(ee.anchor.col,ee.end.col),o=[];for(let a=e;a<=t;a++)for(let e=r;e<=n;e++)o.push({row:a,col:e});return o}return _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&N(n=>n.map((n,o)=>{if(o!==S)return n;const a={...n.cellStyles??{}},l=`${r[0].row}:${r[0].col}`,s=void 0!==t?t:!(a[l]??{})[e];for(const{row:t,col:n}of r){const r=`${t}:${n}`;a[r]={...a[r]??{},[e]:s}}return{...n,cellStyles:a}}))},[re,S]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?z[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{N(t=>t.map((t,r)=>r===S?{...t,...e}:t))},[S]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==Z.length?se({data:e,columns:y(t)}):se({data:e})},[se,Z.length]),ie=(e,t)=>{N(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),B(null)},ue=()=>Y.filter(e=>e.some(e=>e.trim())).map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n"),de=[];Y.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=Y.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
|
|
2
2
|
return u("div",{ref:m,className:"flex flex-col h-full",children:[
|
|
3
|
-
/* @__PURE__ */d(a,{title:`${me=
|
|
3
|
+
/* @__PURE__ */d(a,{title:`${me=L||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
|
|
4
4
|
/* @__PURE__ */d(t,{app:"spreadsheet"}),
|
|
5
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
5
|
+
/* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[O?/* @__PURE__ */d("input",{type:"text",value:L,onChange:e=>A(e.target.value),onBlur:()=>T(!1),onKeyDown:e=>{"Enter"===e.key&&T(!1)},autoFocus:!0,className:"text-sm font-medium text-gray-900 border border-gray-300 rounded px-2 py-0.5 w-40 focus:border-blue-500 focus:ring-blue-500"}):/* @__PURE__ */d("button",{onClick:()=>T(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:L||"Untitled"}),
|
|
6
6
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
7
|
-
/* @__PURE__ */d("input",{ref:
|
|
8
|
-
/* @__PURE__ */d("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${
|
|
7
|
+
/* @__PURE__ */d("input",{ref:W,type:"file",accept:".csv,.tsv,.txt,.xlsx,.xls,.ods",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");if(/\.(xlsx|xls|ods)$/i.test(t.name)){const e=new Uint8Array(await t.arrayBuffer()),n=await(import("xlsx")),o=n.read(e,{type:"array"}),a=o.SheetNames.map(e=>{const t=n.utils.sheet_to_json(o.Sheets[e],{header:1,defval:""}),r=Math.max(p,t.reduce((e,t)=>Math.max(e,t.length),0)),a=t.map(e=>{const t=e.map(e=>String(e??""));for(;t.length<r;)t.push("");return t});for(;a.length<x;)a.push(Array(r).fill(""));return{id:crypto.randomUUID(),name:e,columns:y(r),data:a}});N(a),U(0),A(r)}else{const e=v(await t.text());if(0===e.length)return;const n=Math.max(p,e.reduce((e,t)=>Math.max(e,t.length),0)),o=e.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));se({columns:y(n),data:o}),A(r)}W.current&&(W.current.value="")},className:"hidden"}),
|
|
8
|
+
/* @__PURE__ */d("button",{onClick:()=>W.current?.click(),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Open"}),
|
|
9
|
+
/* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${L||"spreadsheet"}.csv`,r.click(),URL.revokeObjectURL(t)},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save CSV"}),K&&/* @__PURE__ */d("button",{onClick:()=>K(ue(),`${L||"spreadsheet"}.csv`),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Email"}),
|
|
10
10
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
11
11
|
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
12
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:
|
|
13
|
-
/* @__PURE__ */d("button",{onClick:()=>(e=>{const t=Z.length+e;se({columns:y(t),data:
|
|
12
|
+
/* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:Q,onChange:e=>G(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
|
|
13
|
+
/* @__PURE__ */d("button",{onClick:()=>(e=>{const t=Z.length+e;se({columns:y(t),data:Y.map(t=>[...t,...Array(e).fill("")])})})(parseInt(Q)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
|
|
14
14
|
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
15
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:
|
|
16
|
-
/* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(
|
|
15
|
+
/* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:I,onChange:e=>P(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
|
|
16
|
+
/* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(I)||10,void se({data:[...Y,...Array.from({length:e},()=>Array(Z.length).fill(""))]});var e},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Row"})]}),
|
|
17
17
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
18
18
|
/* @__PURE__ */d("button",{onClick:()=>{se({columns:y(p),data:b(x,p)})},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Clear"}),
|
|
19
19
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
@@ -26,12 +26,12 @@ return u("div",{ref:m,className:"flex flex-col h-full",children:[
|
|
|
26
26
|
/* @__PURE__ */d("option",{value:"base",children:"S"}),
|
|
27
27
|
/* @__PURE__ */d("option",{value:"lg",children:"M"}),
|
|
28
28
|
/* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
|
|
29
|
-
/* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:Z,data:
|
|
29
|
+
/* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:Z,data:Y,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:z,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
|
|
30
30
|
/* @__PURE__ */u("div",{className:"flex items-center border-t border-gray-200 bg-gray-50 shrink-0",children:[
|
|
31
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[
|
|
32
|
-
/* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${
|
|
31
|
+
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[C.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>U(t),onDoubleClick:()=>{B(t),J(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(N(t=>t.filter((t,r)=>r!==e)),S>=e&&S>0&&U(S-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===S?"bg-white text-blue-700 border border-t-0 border-gray-300 -mt-px relative z-10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:X===t?/* @__PURE__ */d("input",{type:"text",value:F,onChange:e=>J(e.target.value),onBlur:()=>ie(t,F||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,F||e.name),"Escape"===r.key&&B(null)},onClick:e=>e.stopPropagation(),autoFocus:!0,className:"w-20 text-xs border border-blue-400 rounded px-1 py-0 focus:ring-0 focus:outline-none"}):e.name},e.id)),
|
|
32
|
+
/* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;N(t=>[...t,f(e)]),U(C.length)},className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Add sheet",children:"+"})]}),
|
|
33
33
|
/* @__PURE__ */u("div",{className:"flex items-center gap-4 px-3 py-1 text-xs text-gray-500 shrink-0 border-l border-gray-200",children:[
|
|
34
34
|
/* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
|
|
35
35
|
/* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
|
|
36
36
|
/* @__PURE__ */u("span",{children:["Avg: ",(de.reduce((e,t)=>e+t,0)/de.length).toLocaleString(void 0,{maximumFractionDigits:2})]})]}),
|
|
37
|
-
/* @__PURE__ */u("span",{children:[
|
|
37
|
+
/* @__PURE__ */u("span",{children:[Y.length," × ",Z.length]})]})]})]});var me}export{w as default};
|