aitu-app 0.6.76 → 0.6.78
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 +3 -3
- package/assets/CanvasAudioPlayer-DutgwdiU.js +2 -0
- package/assets/ChatDrawer-E6Fog16I.js +11 -0
- package/assets/{ChatMessagesArea-CZkiRzmW.js → ChatMessagesArea-Bgwiz_XP.js} +3 -3
- package/assets/DeferredAIInputBar-CPkD8Cv9.js +8 -0
- package/assets/DeferredAIInputBar-szBPHiNW.css +1 -0
- package/assets/DrawnixDeferredFeatures-Cul76-88.js +2 -0
- package/assets/{KnowledgeBaseContent-Dan2DUqY.js → KnowledgeBaseContent-DcX5Jofx.js} +6 -6
- package/assets/{MVCreator-Dzjl2fXA.js → MVCreator-DllHozYg.js} +8 -8
- package/assets/{ModelBenchmarkWorkbench-oy2wue1u.js → ModelBenchmarkWorkbench-Dv9SNYTi.js} +2 -2
- package/assets/MusicAnalyzer-CHcQ5t4P.js +1 -0
- package/assets/{MusicAnalyzer-BO44f-db.js → MusicAnalyzer-DDeT6g3c.js} +2 -2
- package/assets/ResizableDivider-CaG9JQbJ.js +1 -0
- package/assets/TaskQueuePanel-BNhNzGp5.js +1 -0
- package/assets/{VideoAnalyzer-iiJpoWb6.js → VideoAnalyzer-BSLz1FaI.js} +2 -2
- package/assets/ai-generation-preferences-service-BF7QkuJp.js +1 -0
- package/assets/arc-BU2KKCa_.js +1 -0
- package/assets/arc-DmGoDCEL.js +1 -0
- package/assets/{batch-image-generation-B2R0hJW_.js → batch-image-generation-Bg68r_Ql.js} +5 -5
- package/assets/{blockDiagram-38ab4fdb-BmWPnNuS.js → blockDiagram-38ab4fdb-BCGEnMME.js} +1 -1
- package/assets/{blockDiagram-38ab4fdb-trArAOFP.js → blockDiagram-38ab4fdb-CsZR5uC5.js} +1 -1
- package/assets/board-utils-CpAtoKn2.js +1 -0
- package/assets/{browser-Dya3c6_X.js → browser-DpICcNby.js} +1 -1
- package/assets/{c4Diagram-3d4e48cf-Cvj3RMOv.js → c4Diagram-3d4e48cf-9fuiuFdV.js} +1 -1
- package/assets/{c4Diagram-3d4e48cf-CqJrO4Za.js → c4Diagram-3d4e48cf-WM4wd_GR.js} +1 -1
- package/assets/{canvas-insertion-Dq3gR9Nw.js → canvas-insertion-CdUQF7IV.js} +3 -3
- package/assets/channel-CZjE-WNp.js +1 -0
- package/assets/channel-SXZD6bG3.js +1 -0
- package/assets/classDiagram-70f12bd4-CBVHTwQu.js +2 -0
- package/assets/{classDiagram-70f12bd4-DvrRZ41d.js → classDiagram-70f12bd4-DcYDedz1.js} +2 -2
- package/assets/classDiagram-v2-f2320105-CsxWGkSy.js +2 -0
- package/assets/classDiagram-v2-f2320105-jpCwaHEd.js +2 -0
- package/assets/{clipper-B4i11tN1.js → clipper-jvd5rF5a.js} +1 -1
- package/assets/clone-C4mvvMDb.js +1 -0
- package/assets/{createText-2e5e7dd3-D7dXlVes.js → createText-2e5e7dd3-CkXS3l7I.js} +2 -2
- package/assets/{createText-2e5e7dd3-B8gnT5hD.js → createText-2e5e7dd3-x5lOIwut.js} +1 -1
- package/assets/edges-e0da2a9e-CbrF4nbD.js +4 -0
- package/assets/{edges-e0da2a9e-CyRAzEMi.js → edges-e0da2a9e-Ch6PBwWs.js} +2 -2
- package/assets/{erDiagram-9861fffd-D8yYsjoN.js → erDiagram-9861fffd-Bq07elcI.js} +3 -3
- package/assets/{erDiagram-9861fffd-BHbAa_Ka.js → erDiagram-9861fffd-DSlNVuAZ.js} +4 -4
- package/assets/{flowDb-956e92f1-DAqb8wjP.js → flowDb-956e92f1-BqPCJlZp.js} +3 -3
- package/assets/{flowDb-956e92f1-f30uG4pp.js → flowDb-956e92f1-Ti5YC4Vv.js} +3 -3
- package/assets/{flowDiagram-66a62f08-C4Gz9mOM.js → flowDiagram-66a62f08-CPDuG3rY.js} +3 -3
- package/assets/{flowDiagram-66a62f08-CBXypoEi.js → flowDiagram-66a62f08-D3GSABFi.js} +1 -1
- package/assets/flowDiagram-v2-96b9c2cf-BCcJ-cre.js +1 -0
- package/assets/flowDiagram-v2-96b9c2cf-DCVaFEgV.js +1 -0
- package/assets/{flowchart-elk-definition-4a651766-CSm5diF6.js → flowchart-elk-definition-4a651766-BH09NeLA.js} +1 -1
- package/assets/{flowchart-elk-definition-4a651766-BHB7pRxm.js → flowchart-elk-definition-4a651766-BLaLPCDV.js} +1 -1
- package/assets/{ganttDiagram-c361ad54-CU9a9DsJ.js → ganttDiagram-c361ad54-DL9ZeaEc.js} +4 -4
- package/assets/ganttDiagram-c361ad54-Sp9M1KHP.js +257 -0
- package/assets/{gitGraphDiagram-72cf32ee-B2zj8Xnu.js → gitGraphDiagram-72cf32ee-BSf1fsDV.js} +1 -1
- package/assets/{gitGraphDiagram-72cf32ee-BWOgrFeh.js → gitGraphDiagram-72cf32ee-BWwmRKo-.js} +1 -1
- package/assets/{graph-Bnmq4jgf.js → graph--nPw8zXQ.js} +1 -1
- package/assets/graph-g-2U7grQ.js +1 -0
- package/assets/{index-3862675e-CQLKy6RO.js → index-3862675e-BXwbZ2pz.js} +1 -1
- package/assets/{index-3862675e-BSxxidV_.js → index-3862675e-D6Zy95zZ.js} +1 -1
- package/assets/index-3eqA7Bag.js +1 -0
- package/assets/{index-D1ORCZqJ.js → index-7Q-aiwln.js} +2 -2
- package/assets/index-B2dttXd7.js +1 -0
- package/assets/index-B7V7-Vxz.js +1 -0
- package/assets/index-BHPTfCZM.js +1 -0
- package/assets/{index-vvV37Q1S.js → index-BP77pG9S.js} +4 -4
- package/assets/index-BPR_DyGD.js +1 -0
- package/assets/index-BWrcsh8u.js +1 -0
- package/assets/{index-D4qm_1m5.js → index-BXzGHPXz.js} +1 -1
- package/assets/index-BaCHOxhI.js +1 -0
- package/assets/{index-BoglETHF.js → index-Bq8mPedC.js} +2 -2
- package/assets/index-BqHZCcen.js +2 -0
- package/assets/index-Bti3m-iW.js +1 -0
- package/assets/{index-sPNG1_UN.js → index-BwSnJN93.js} +5 -5
- package/assets/{index-D5qxbeGT.js → index-C3qD42ws.js} +1 -1
- package/assets/{index-VzDb_AHs.js → index-C5eu4uSl.js} +5 -5
- package/assets/index-CLJUfzvO.js +1 -0
- package/assets/index-CfgvFFx3.js +271 -0
- package/assets/index-CmyOpFTN.js +1 -0
- package/assets/index-D4pIkh3S.js +1 -0
- package/assets/index-D7b5fX1d.js +1 -0
- package/assets/index-DH12_HTj.js +13 -0
- package/assets/index-DI0OV6F8.js +7 -0
- package/assets/index-DIiIUyb-.js +1 -0
- package/assets/index-DcZrElEK.js +2 -0
- package/assets/index-DllL1sx1.js +1 -0
- package/assets/index-DqMndQiP.js +1 -0
- package/assets/index-Dz8sghkK.js +1 -0
- package/assets/index-QkP3EC02.js +1 -0
- package/assets/index-TkfyNewx.js +1 -0
- package/assets/index-ZrVeQUWo.js +1 -0
- package/assets/index-eZfwJ9bV.js +3 -0
- package/assets/{index-VarwiJlL.js → index-gQ7LgvSv.js} +1 -1
- package/assets/{infoDiagram-f8f76790-d-BYTW2w.js → infoDiagram-f8f76790-DpFqCCNv.js} +3 -3
- package/assets/{infoDiagram-f8f76790-BMsVq8O_.js → infoDiagram-f8f76790-G2JpJJP7.js} +3 -3
- package/assets/{journeyDiagram-49397b02-DCtCkoaC.js → journeyDiagram-49397b02-BdESGMrv.js} +1 -1
- package/assets/{journeyDiagram-49397b02-CBqb8-ml.js → journeyDiagram-49397b02-DLLTobRM.js} +1 -1
- package/assets/{layout-DKqEkE_W.js → layout-CVkuImk4.js} +1 -1
- package/assets/layout-WSR0vNPO.js +1 -0
- package/assets/line-D3bnG227.js +1 -0
- package/assets/line-DQuMJveY.js +1 -0
- package/assets/{linear-C6OQYT56.js → linear-CciP-97N.js} +1 -1
- package/assets/linear-Z6vFvuwc.js +1 -0
- package/assets/{main-i0s2IJTn.css → main-8DNjLY6L.css} +1 -1
- package/assets/main-BFEkxCOK.js +56 -0
- package/assets/{mermaid.core-CI-VJEiw.js → mermaid.core-CwZQb0ud.js} +5 -5
- package/assets/{mindmap-definition-fc14e90a-k_RSypuP.js → mindmap-definition-fc14e90a-BnJ8OOTI.js} +1 -1
- package/assets/{mindmap-definition-fc14e90a-DrtlQLES.js → mindmap-definition-fc14e90a-CxQMydCW.js} +1 -1
- package/assets/model-benchmark-launcher-Ct3lYXVq.js +1 -0
- package/assets/photo-wall-splitter-BZ88W5Zy.js +1 -0
- package/assets/{pieDiagram-8a3498a8-CdknGxKY.js → pieDiagram-8a3498a8-BSDdkTeu.js} +5 -5
- package/assets/{pieDiagram-8a3498a8-Bpr5V3o5.js → pieDiagram-8a3498a8-D6VtAoja.js} +4 -4
- package/assets/ppt-generation-FzjP_rp0.js +48 -0
- package/assets/{quadrantDiagram-120e2f19-Dx3qoKDx.js → quadrantDiagram-120e2f19-BbFV0VXY.js} +3 -3
- package/assets/{quadrantDiagram-120e2f19-pVIXp9i6.js → quadrantDiagram-120e2f19-C8k2xuBd.js} +3 -3
- package/assets/{requirementDiagram-deff3bca-hM4oekUG.js → requirementDiagram-deff3bca-C3xMdzJV.js} +1 -1
- package/assets/{requirementDiagram-deff3bca-DD6NY75P.js → requirementDiagram-deff3bca-CpjqKjYZ.js} +1 -1
- package/assets/{sankeyDiagram-04a897e0-BsvEG71N.js → sankeyDiagram-04a897e0-BBJJgsFv.js} +5 -5
- package/assets/{sankeyDiagram-04a897e0-C9uf1jU5.js → sankeyDiagram-04a897e0-Bjvig9bW.js} +4 -4
- package/assets/{sequenceDiagram-704730f1-CNEBmz1G.js → sequenceDiagram-704730f1-DX1MmBN_.js} +4 -4
- package/assets/{sequenceDiagram-704730f1-Bpg54z74.js → sequenceDiagram-704730f1-PFC_9IFI.js} +4 -4
- package/assets/settings-dialog-CQM4v791.js +1 -0
- package/assets/{skill-dsl-parser-DS3VOBFI.js → skill-dsl-parser-syNWYxFu.js} +10 -10
- package/assets/{stateDiagram-587899a1-BN2ZP-3x.js → stateDiagram-587899a1-Dc3mI_B_.js} +1 -1
- package/assets/stateDiagram-587899a1-SFMUVAam.js +1 -0
- package/assets/{stateDiagram-v2-d93cdb3a-BtV1Ziy9.js → stateDiagram-v2-d93cdb3a-DmnBjHpC.js} +1 -1
- package/assets/{stateDiagram-v2-d93cdb3a-BLwIM8s1.js → stateDiagram-v2-d93cdb3a-P4Yt2p_j.js} +1 -1
- package/assets/{styles-6aaf32cf-aFVlX_lA.js → styles-6aaf32cf-C3jnr3hV.js} +1 -1
- package/assets/{styles-6aaf32cf-CGp3i5qu.js → styles-6aaf32cf-b6AdP7fu.js} +1 -1
- package/assets/{styles-9a916d00-BK7pejCH.js → styles-9a916d00-BUiD9iBe.js} +4 -4
- package/assets/{styles-9a916d00-CSwFWVnr.js → styles-9a916d00-ii0XTdIm.js} +1 -1
- package/assets/styles-c10674c1-Bt89Yy8Q.js +116 -0
- package/assets/styles-c10674c1-DbTSpy3W.js +116 -0
- package/assets/{svgDrawCommon-08f97a94-Cr4rWU-W.js → svgDrawCommon-08f97a94-BK6lD4D6.js} +1 -1
- package/assets/{svgDrawCommon-08f97a94-DypvMDvH.js → svgDrawCommon-08f97a94-D4gIV05W.js} +1 -1
- package/assets/{timeline-definition-85554ec2-D3-lXEL5.js → timeline-definition-85554ec2-Bl2y548G.js} +1 -1
- package/assets/{timeline-definition-85554ec2-DIwHE15c.js → timeline-definition-85554ec2-CWKg_JxG.js} +3 -3
- package/assets/{tool-windows-B-a9r3G3.css → tool-windows-CUNbW1Tz.css} +1 -1
- package/assets/tool-windows-DOIu9TAD.js +2975 -0
- package/assets/ttd-dialog-DI4kQSg8.js +99 -0
- package/assets/{useCharacters-DsZ779l-.js → useCharacters-Chv4Ky7x.js} +3 -3
- package/assets/useWorkflowSubmission-BizuDmuw.js +70 -0
- package/assets/video-analyze-6v3Y-rUE.js +1 -0
- package/assets/{video-generation-C7qCz-ZF.js → video-generation-DnmTlWnm.js} +2 -2
- package/assets/video-recovery-service-BeRoh0s2.js +1 -0
- package/assets/workflow-generation-utils-me381Cax.js +3 -0
- package/assets/workflow-submission-service-YOpo7g37.js +4 -0
- package/assets/{xychartDiagram-e933f94c-B17Evxfw.js → xychartDiagram-e933f94c-CJX9_9WF.js} +4 -4
- package/assets/{xychartDiagram-e933f94c-Dln5PJtU.js → xychartDiagram-e933f94c-Cep8CQEH.js} +3 -3
- package/changelog.json +50 -0
- package/idle-prefetch-manifest.json +300 -316
- package/manifest.json +3 -3
- package/package.json +1 -1
- package/precache-manifest.json +8 -8
- package/sw.js +5 -5
- package/version.json +19 -3
- package/assets/CanvasAudioPlayer-DwM6PU4W.js +0 -2
- package/assets/ChatDrawer-BQTaa6r6.js +0 -11
- package/assets/DeferredAIInputBar-BmPgFhXr.css +0 -1
- package/assets/DeferredAIInputBar-ObyfJQ0O.js +0 -7
- package/assets/DrawnixDeferredFeatures-CFHVLxc5.js +0 -2
- package/assets/ModelDropdown-CQTTHEI7.css +0 -1
- package/assets/ModelDropdown-DjvIvi8O.js +0 -1
- package/assets/MusicAnalyzer-BU5l2wPR.js +0 -1
- package/assets/ResizableDivider-CBgTphcS.js +0 -1
- package/assets/TaskQueuePanel-CTDuSScf.js +0 -1
- package/assets/ai-generation-preferences-service-CqwXb9Cs.js +0 -5
- package/assets/arc-BBE0LXa1.js +0 -1
- package/assets/arc-h476db6P.js +0 -1
- package/assets/channel-DMTz1UNN.js +0 -1
- package/assets/channel-DQOY3XLe.js +0 -1
- package/assets/classDiagram-70f12bd4-5ACx619h.js +0 -2
- package/assets/classDiagram-v2-f2320105-4zQ4jrwi.js +0 -2
- package/assets/classDiagram-v2-f2320105-CB4rof84.js +0 -2
- package/assets/clone-fuaXEdc-.js +0 -1
- package/assets/edges-e0da2a9e-DZalSm7f.js +0 -4
- package/assets/flowDiagram-v2-96b9c2cf-C-DFFh54.js +0 -1
- package/assets/flowDiagram-v2-96b9c2cf-CWjydvHB.js +0 -1
- package/assets/ganttDiagram-c361ad54-DDnbMkWm.js +0 -257
- package/assets/graph-BsYIlc-B.js +0 -1
- package/assets/index-B10kMZoq.js +0 -1
- package/assets/index-B2_XRj3U.js +0 -1
- package/assets/index-B4lLv-Sz.js +0 -1
- package/assets/index-BFZNUUCR.js +0 -1
- package/assets/index-BTSYG2Vy.js +0 -1
- package/assets/index-BY5Kvjqg.js +0 -1
- package/assets/index-Blf7J5yW.js +0 -1
- package/assets/index-BoQA7VaE.js +0 -3
- package/assets/index-BzqQ69oU.js +0 -1
- package/assets/index-CD2D1BYc.js +0 -2
- package/assets/index-CLRs5cWt.js +0 -1
- package/assets/index-CLU4LJjR.js +0 -1
- package/assets/index-CPDfMZkS.js +0 -1
- package/assets/index-CPfhqyDz.js +0 -316
- package/assets/index-CU4ySaQE.js +0 -1
- package/assets/index-CsCwwmYY.js +0 -1
- package/assets/index-Cyz_w8KS.js +0 -7
- package/assets/index-D489cJtb.js +0 -1
- package/assets/index-D6DebbcI.js +0 -1
- package/assets/index-DDtPG6Km.js +0 -1
- package/assets/index-DKhTnUBU.js +0 -1
- package/assets/index-DMIwLDS8.js +0 -13
- package/assets/index-DgsUJgRJ.js +0 -1
- package/assets/index-oT8mbA3U.js +0 -2
- package/assets/layout-B1ePJO5V.js +0 -1
- package/assets/line-C_jmJ6v1.js +0 -1
- package/assets/line-DfhCgsyz.js +0 -1
- package/assets/linear-ChY5Iu43.js +0 -1
- package/assets/main-LCg1nQGB.js +0 -69
- package/assets/model-benchmark-launcher-B2MsZXmV.js +0 -1
- package/assets/model-benchmark-service-CkIRp-Sq.js +0 -1
- package/assets/model-selection-BvdXmVGX.js +0 -1
- package/assets/photo-wall-splitter-CVrfkWnh.js +0 -1
- package/assets/prompt-optimize-dialog-DLdL2_a1.css +0 -1
- package/assets/settings-dialog-CAhU3cfG.js +0 -1
- package/assets/stateDiagram-587899a1-CMylUAYu.js +0 -1
- package/assets/styles-c10674c1-KfJINP7I.js +0 -116
- package/assets/styles-c10674c1-cccyjRUz.js +0 -116
- package/assets/tool-windows-CtLXQDGF.js +0 -2847
- package/assets/ttd-dialog-BRg3XE5k.js +0 -99
- package/assets/use-runtime-models-BH9r4Yc1.js +0 -1
- package/assets/use-runtime-models-BgWWl4Ng.css +0 -1
- package/assets/useWorkflowSubmission-BeJQ3BuO.js +0 -70
- package/assets/video-analyze-aDVIfgUi.js +0 -1
- package/assets/video-recovery-service-Dy0xiPr8.js +0 -1
- package/assets/workflow-generation-utils-CpMilOwA.js +0 -3
- package/assets/workflow-submission-service-CmBBMIis.js +0 -4
package/assets/main-LCg1nQGB.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tool-windows-B-a9r3G3.css","./MediaLibrarySidebar-CNCXXhfY.css","./useCharacters-OrDbG69o.css","./character-Bo9jcTNu.css","./use-runtime-models-BgWWl4Ng.css","./index-I7GscWS1.css","./ModelDropdown-CQTTHEI7.css","./ai-generation-preferences-service-CeFIqZqn.css","./prompt-optimize-dialog-DLdL2_a1.css","./DeferredAIInputBar-BmPgFhXr.css","./ChatDrawer-0jNvKIoI.css","./DrawnixDeferredFeatures-BBiW9_Pn.css","./ResizableDivider-ClzYJk-6.css","./ttd-dialog-BlUvpMr5.css","./settings-dialog-CdRrvvi_.css","./CanvasAudioPlayer-mm7y75Ol.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as p,B as Jc,P as F,a as vb,h as Eb,s as eu,W as fa,t as Ft,b as Ht,g as kb,d as Wa,i as Ep,c as Yo,u as or,e as Sb,f as Tb,k as Db,l as fe,Z as _b,m as tu,n as nu,I as iu,o as ou,p as jb,q as su,K as ru,v as Pb,w as $a,x as Xa,y as l,z as Y,H as Cb,A as Ab,C as Mb,D as Ib,E as jr,T as au,R as En,F as lu,G as Pr,J as sr,M as Vb,L as Ub,N as Ri,O as Rb,Q as qb,S as kp,U as Be,V as Zi,X as cu,Y as Bb,$ as Lb,a0 as Ob,a1 as Fb,a2 as Hb,a3 as zb,a4 as Gb,a5 as Wb,a6 as $b,a7 as Xb,a8 as Kb,a9 as Yb,aa as Zb,ab as Qb,ac as Jb,ad as e0,ae as ha,af as vs,ag as t0,ah as n0,ai as ge,aj as i0,ak as o0,al as re,am as s0,an as uu,ao as du,ap as r0,aq as mu,ar as a0,as as Vn,at as pu,au as l0,av as c0,aw as Ll,ax as u0,ay as d0,az as Sp,aA as Zo,aB as Qo,aC as Ka,aD as nn,aE as m0,aF as p0,aG as f0,aH as Cr,aI as _n,aJ as Hn,aK as zn,aL as cn,aM as Tp,aN as so,aO as Ol,aP as ue,aQ as Fl,aR as ho,aS as go,aT as Ct,aU as h0,aV as ki,aW as Dp,aX as _p,aY as Jn,aZ as Tt,a_ as At,a$ as Ee,b0 as Qi,b1 as Un,b2 as at,b3 as lt,b4 as ne,b5 as ct,b6 as Si,b7 as Mt,b8 as ke,b9 as jn,ba as Ar,bb as ei,bc as jp,bd as Pp,be as Cp,bf as g0,bg as b0,bh as Ap,bi as Mp,bj as Hs,bk as Mr,bl as fu,bm as Ir,bn as kn,bo as Pt,_ as Me,bp as Ip,bq as x0,br as N0,bs as y0,bt as Vr,bu as Ur,bv as Vp,bw as Hl,bx as ii,by as Up,bz as Jo,bA as w0,bB as v0,bC as Je,bD as Rr,bE as Ot,bF as E0,bG as k0,bH as S0,bI as wi,bJ as H,bK as $e,bL as Wt,bM as T0,bN as Ji,bO as D0,bP as qi,bQ as _0,bR as j0,bS as zl,bT as hu,bU as P0,bV as Dt,bW as C0,bX as A0,bY as M0,bZ as I0,b_ as V0,b$ as U0,c0 as R0,c1 as q0,c2 as rn,c3 as B0,c4 as L0,c5 as O0,c6 as F0,c7 as H0,c8 as z0,c9 as G0,ca as eo,cb as W0,cc as $0,cd as X0,ce as K0,cf as vn,cg as Y0,ch as Z0,ci as Q0,cj as J0,ck as ex,cl as tx,cm as nx,cn as gu,co as bu,cp as Es,cq as ix,cr as ox,cs as ks,ct as Rp,cu as sx,cv as rx,cw as ax,cx as lx,cy as cx,cz as Gl,cA as Wl,cB as qp,cC as $l,cD as wn,cE as Xl,cF as Kn,cG as xu,cH as Ss,cI as Ro,cJ as es,cK as ux,cL as dx,cM as Nu,cN as mx,cO as px,cP as fx,cQ as hx,cR as gx,cS as bx,cT as yu,cU as Bp,cV as xx,cW as wu,cX as ln,cY as qr,cZ as Br,c_ as Nx,c$ as yx,d0 as wx,d1 as vx,d2 as Ex,d3 as kx,d4 as Sx,d5 as Tx,d6 as Dx,d7 as oi,d8 as Ti,d9 as _x,da as vu,db as Ya,dc as Lp,dd as Op,de as jx,df as Px,dg as Cx,dh as Ax,di as rr,dj as Kl,dk as Fp,dl as Mx,dm as Ix,dn as Hp,dp as Vx,dq as zp,dr as Ux,ds as Lr,dt as Gp,du as Rx,dv as qx,dw as Yl,dx as Bx,dy as Lx,dz as Wp,dA as zs,dB as Ox,dC as Fx,dD as Hx,dE as zx,dF as Gx,dG as Wx,dH as $x,dI as Xx,dJ as hi,dK as $p,dL as Or,dM as en,dN as Xp,dO as Kp,dP as Kx,dQ as Yp,dR as Zl,dS as Zp,dT as Qp,dU as Yx,dV as Zx,dW as Qx,dX as Jx,dY as eN,dZ as Za,d_ as tN,d$ as nN,e0 as Ql,e1 as Ln,e2 as tt,e3 as rt,e4 as bo,e5 as iN,e6 as oN,e7 as sN,e8 as Jp,e9 as mt,ea as St,eb as De,ec as Jl,ed as ef,ee as tf,ef as nf,eg as of,eh as sf,ei as rf,ej as af,ek as Sn,el as rN,em as aN,en as lN,eo as Et,ep as ts,eq as Di,er as cN,es as ec,et as Fr,eu as lf,ev as tc,ew as cf,ex as uf,ey as df,ez as mf,eA as nc,eB as ic,eC as oc,eD as ar,eE as pf,eF as ff,eG as hf,eH as uN,eI as gf,eJ as dN,eK as mN,eL as pN,eM as fN,eN as hN,eO as gN,eP as bN,eQ as Hr,eR as Eu,eS as xN,eT as NN,eU as yN,eV as bf,eW as yn,eX as sc,eY as wN,eZ as qt,e_ as rc,e$ as xf,f0 as Nf,f1 as yf,f2 as zr,f3 as ac,f4 as lc,f5 as Qa,f6 as si,f7 as ku,f8 as wf,f9 as vf,fa as Ef,fb as kf,fc as Ci,fd as xo,fe as Ai,ff as Gr,fg as hs,fh as ui,fi as Su,fj as Ja,fk as vN,fl as EN,fm as Sf,fn as kN,fo as SN,fp as TN,fq as Tf,fr as Df,fs as DN,ft as Wr,fu as Tu,fv as _N,fw as jN,fx as Du,fy as yt,fz as _u,fA as PN,fB as CN,fC as AN,fD as MN,fE as ju,fF as IN,fG as lr,fH as _f,fI as jf,fJ as VN,fK as UN,fL as RN,fM as qN,fN as BN,fO as LN,fP as ON,fQ as FN,fR as ga,fS as HN,fT as zN,fU as GN,fV as Ts,fW as Bi,fX as Li,fY as WN,fZ as $N,f_ as XN,f$ as KN,g0 as YN,g1 as Pf,g2 as ZN,g3 as QN,g4 as JN,g5 as ey,g6 as ty,g7 as cc,g8 as ns,g9 as is,ga as Cf,gb as ny,gc as pt,gd as cr,ge as Af,gf as Mf,gg as If,gh as iy,gi as oy,gj as Pu,gk as sy,gl as os,gm as ry,gn as ay,go as ly,gp as cy,gq as uy,gr as dy,gs as my,gt as py,gu as fy,gv as hy,gw as gy,gx as by,gy as xy,gz as Ny,gA as yy,gB as wy,gC as vy,gD as Ey,gE as ky,gF as Sy,gG as Cu,gH as ba,gI as xa,gJ as Ty,gK as Vf,gL as Dy,gM as el,gN as Nn,gO as Uf,gP as Rf,gQ as $r,gR as bt,gS as Rn,gT as _y,gU as jy,gV as Oi,gW as Py,gX as Cy,gY as Au,gZ as Ay}from"./tool-windows-CtLXQDGF.js";const Se=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Xe=globalThis,vi="10.33.0";function Xr(){return Kr(Xe),Xe}function Kr(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||vi,t[vi]=t[vi]||{}}function No(e,t,n=Xe){const i=n.__SENTRY__=n.__SENTRY__||{},o=i[vi]=i[vi]||{};return o[e]||(o[e]=t())}const My=["debug","info","warn","error","log","assert","trace"],Iy="Sentry Logger ",ur={};function yo(e){if(!("console"in Xe))return e();const t=Xe.console,n={},i=Object.keys(ur);i.forEach(o=>{const s=ur[o];n[o]=t[o],t[o]=s});try{return e()}finally{i.forEach(o=>{t[o]=n[o]})}}function Vy(){dc().enabled=!0}function Uy(){dc().enabled=!1}function qf(){return dc().enabled}function Ry(...e){uc("log",...e)}function qy(...e){uc("warn",...e)}function By(...e){uc("error",...e)}function uc(e,...t){Se&&qf()&&yo(()=>{Xe.console[e](`${Iy}[${e}]:`,...t)})}function dc(){return Se?No("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const me={enable:Vy,disable:Uy,isEnabled:qf,log:Ry,warn:qy,error:By},Bf=50,_i="?",Mu=/\(error: (.*)\)/,Iu=/captureMessage|captureException/;function Lf(...e){const t=e.sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0,o=0)=>{const s=[],r=n.split(`
|
|
3
|
-
`);for(let a=i;a<r.length;a++){let c=r[a];c.length>1024&&(c=c.slice(0,1024));const u=Mu.test(c)?c.replace(Mu,"$1"):c;if(!u.match(/\S*Error: /)){for(const d of t){const m=d(u);if(m){s.push(m);break}}if(s.length>=Bf+o)break}}return Oy(s.slice(o))}}function Ly(e){return Array.isArray(e)?Lf(...e):e}function Oy(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Ds(t).function||"")&&t.pop(),t.reverse(),Iu.test(Ds(t).function||"")&&(t.pop(),Iu.test(Ds(t).function||"")&&t.pop()),t.slice(0,Bf).map(n=>({...n,filename:n.filename||Ds(t).filename,function:n.function||_i}))}function Ds(e){return e[e.length-1]||{}}const Na="<anonymous>";function ri(e){try{return!e||typeof e!="function"?Na:e.name||Na}catch{return Na}}function Vu(e){const t=e.exception;if(t){const n=[];try{return t.values.forEach(i=>{i.stacktrace.frames&&n.push(...i.stacktrace.frames)}),n}catch{return}}}function Of(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const Gs={},Uu={};function Mi(e,t){Gs[e]=Gs[e]||[],Gs[e].push(t)}function Ii(e,t){if(!Uu[e]){Uu[e]=!0;try{t()}catch(n){Se&&me.error(`Error while instrumenting ${e}`,n)}}}function bn(e,t){const n=e&&Gs[e];if(n)for(const i of n)try{i(t)}catch(o){Se&&me.error(`Error while triggering instrumentation handler.
|
|
4
|
-
Type: ${e}
|
|
5
|
-
Name: ${ri(i)}
|
|
6
|
-
Error:`,o)}}let ya=null;function Fy(e){const t="error";Mi(t,e),Ii(t,Hy)}function Hy(){ya=Xe.onerror,Xe.onerror=function(e,t,n,i,o){return bn("error",{column:i,error:o,line:n,msg:e,url:t}),ya?ya.apply(this,arguments):!1},Xe.onerror.__SENTRY_INSTRUMENTED__=!0}let wa=null;function zy(e){const t="unhandledrejection";Mi(t,e),Ii(t,Gy)}function Gy(){wa=Xe.onunhandledrejection,Xe.onunhandledrejection=function(e){return bn("unhandledrejection",e),wa?wa.apply(this,arguments):!0},Xe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Ff=Object.prototype.toString;function mc(e){switch(Ff.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ai(e,Error)}}function wo(e,t){return Ff.call(e)===`[object ${t}]`}function Hf(e){return wo(e,"ErrorEvent")}function Ru(e){return wo(e,"DOMError")}function Wy(e){return wo(e,"DOMException")}function qn(e){return wo(e,"String")}function pc(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Yr(e){return e===null||pc(e)||typeof e!="object"&&typeof e!="function"}function ss(e){return wo(e,"Object")}function Zr(e){return typeof Event<"u"&&ai(e,Event)}function $y(e){return typeof Element<"u"&&ai(e,Element)}function Xy(e){return wo(e,"RegExp")}function gs(e){return!!(e!=null&&e.then&&typeof e.then=="function")}function Ky(e){return ss(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function ai(e,t){try{return e instanceof t}catch{return!1}}function zf(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}function Gf(e){return typeof Request<"u"&&ai(e,Request)}const fc=Xe,Yy=80;function Wf(e,t={}){if(!e)return"<unknown>";try{let n=e;const i=5,o=[];let s=0,r=0;const a=" > ",c=a.length;let u;const d=Array.isArray(t)?t:t.keyAttrs,m=!Array.isArray(t)&&t.maxStringLength||Yy;for(;n&&s++<i&&(u=Zy(n,d),!(u==="html"||s>1&&r+o.length*c+u.length>=m));)o.push(u),r+=u.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function Zy(e,t){const n=e,i=[];if(!(n!=null&&n.tagName))return"";if(fc.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}i.push(n.tagName.toLowerCase());const o=t!=null&&t.length?t.filter(r=>n.getAttribute(r)).map(r=>[r,n.getAttribute(r)]):null;if(o!=null&&o.length)o.forEach(r=>{i.push(`[${r[0]}="${r[1]}"]`)});else{n.id&&i.push(`#${n.id}`);const r=n.className;if(r&&qn(r)){const a=r.split(/\s+/);for(const c of a)i.push(`.${c}`)}}const s=["aria-label","type","name","title","alt"];for(const r of s){const a=n.getAttribute(r);a&&i.push(`[${r}="${a}"]`)}return i.join("")}function hc(){try{return fc.document.location.href}catch{return""}}function Qy(e){if(!fc.HTMLElement)return null;let t=e;const n=5;for(let i=0;i<n;i++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function Qt(e,t,n){if(!(t in e))return;const i=e[t];if(typeof i!="function")return;const o=n(i);typeof o=="function"&&$f(o,i);try{e[t]=o}catch{Se&&me.log(`Failed to replace method "${t}" in object`,e)}}function ji(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Se&&me.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function $f(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,ji(e,"__sentry_original__",t)}catch{}}function gc(e){return e.__sentry_original__}function Xf(e){if(mc(e))return{message:e.message,name:e.name,stack:e.stack,...Bu(e)};if(Zr(e)){const t={type:e.type,target:qu(e.target),currentTarget:qu(e.currentTarget),...Bu(e)};return typeof CustomEvent<"u"&&ai(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function qu(e){try{return $y(e)?Wf(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Bu(e){if(typeof e=="object"&&e!==null){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Jy(e){const t=Object.keys(Xf(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}let Fi;function Qr(e){if(Fi!==void 0)return Fi?Fi(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=Xe;return t in n&&typeof n[t]=="function"?(Fi=n[t],Fi(e)):(Fi=null,e())}function dr(){return Qr(()=>Math.random())}function Jr(){return Qr(()=>Date.now())}function tl(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Lu(e,t){if(!Array.isArray(e))return"";const n=[];for(let i=0;i<e.length;i++){const o=e[i];try{zf(o)?n.push(Of(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Ws(e,t,n=!1){return qn(e)?Xy(t)?t.test(e):qn(t)?n?e===t:e.includes(t):!1:!1}function ea(e,t=[],n=!1){return t.some(i=>Ws(e,i,n))}function ew(){const e=Xe;return e.crypto||e.msCrypto}let va;function tw(){return dr()*16}function un(e=ew()){try{if(e!=null&&e.randomUUID)return Qr(()=>e.randomUUID()).replace(/-/g,"")}catch{}return va||(va="10000000100040008000"+1e11),va.replace(/[018]/g,t=>(t^(tw()&15)>>t/4).toString(16))}function Kf(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}function bi(e){const{message:t,event_id:n}=e;if(t)return t;const i=Kf(e);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||n||"<unknown>":n||"<unknown>"}function nl(e,t,n){const i=e.exception=e.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{};s.value||(s.value=t||""),s.type||(s.type="Error")}function ro(e,t){const n=Kf(e);if(!n)return;const i={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...i,...o,...t},t&&"data"in t){const s={...o==null?void 0:o.data,...t.data};n.mechanism.data=s}}function Ou(e){if(nw(e))return!0;try{ji(e,"__sentry_captured__",!0)}catch{}return!1}function nw(e){try{return e.__sentry_captured__}catch{}}const Yf=1e3;function bs(){return Jr()/Yf}function iw(){const{performance:e}=Xe;if(!(e!=null&&e.now)||!e.timeOrigin)return bs;const t=e.timeOrigin;return()=>(t+Qr(()=>e.now()))/Yf}let Fu;function Bn(){return(Fu??(Fu=iw()))()}function ow(e){const t=Bn(),n={sid:un(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>rw(n)};return e&&ao(n,e),n}function ao(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Bn(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:un()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function sw(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),ao(e,n)}function rw(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function xs(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;const i={...e};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=xs(i[o],t[o],n-1));return i}function Hu(){return un()}function Zf(){return un().substring(16)}const il="_sentrySpan";function zu(e,t){t?ji(e,il,t):delete e[il]}function Gu(e){return e[il]}const aw=100;class On{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Hu(),sampleRand:dr()}}clone(){const t=new On;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,zu(t,Gu(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&ao(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t,i=n instanceof On?n.getScopeData():ss(n)?t:void 0,{tags:o,attributes:s,extra:r,user:a,contexts:c,level:u,fingerprint:d=[],propagationContext:m}=i||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...r},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),d.length&&(this._fingerprint=d),m&&(this._propagationContext=m),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,zu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Hu(),sampleRand:dr()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){var s;const i=typeof n=="number"?n:aw;if(i<=0)return this;const o={timestamp:bs(),...t,message:t.message?tl(t.message,2048):t.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>i&&(this._breadcrumbs=this._breadcrumbs.slice(-i),(s=this._client)==null||s.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Gu(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=xs(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const i=(n==null?void 0:n.event_id)||un();if(!this._client)return Se&&me.warn("No client configured on scope - will not capture exception!"),i;const o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...n,event_id:i},this),i}captureMessage(t,n,i){const o=(i==null?void 0:i.event_id)||un();if(!this._client)return Se&&me.warn("No client configured on scope - will not capture message!"),o;const s=(i==null?void 0:i.syntheticException)??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:s,...i,event_id:o},this),o}captureEvent(t,n){const i=(n==null?void 0:n.event_id)||un();return this._client?(this._client.captureEvent(t,{...n,event_id:i},this),i):(Se&&me.warn("No client configured on scope - will not capture event!"),i)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function lw(){return No("defaultCurrentScope",()=>new On)}function cw(){return No("defaultIsolationScope",()=>new On)}class uw{constructor(t,n){let i;t?i=t:i=new On;let o;n?o=n:o=new On,this._stack=[{scope:i}],this._isolationScope=o}withScope(t){const n=this._pushScope();let i;try{i=t(n)}catch(o){throw this._popScope(),o}return gs(i)?i.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(this._popScope(),i)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function lo(){const e=Xr(),t=Kr(e);return t.stack=t.stack||new uw(lw(),cw())}function dw(e){return lo().withScope(e)}function mw(e,t){const n=lo();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Wu(e){return lo().withScope(()=>e(lo().getIsolationScope()))}function pw(){return{withIsolationScope:Wu,withScope:dw,withSetScope:mw,withSetIsolationScope:(e,t)=>Wu(t),getCurrentScope:()=>lo().getScope(),getIsolationScope:()=>lo().getIsolationScope()}}function bc(e){const t=Kr(e);return t.acs?t.acs:pw()}function di(){const e=Xr();return bc(e).getCurrentScope()}function Vi(){const e=Xr();return bc(e).getIsolationScope()}function fw(){return No("globalScope",()=>new On)}function hw(...e){const t=Xr(),n=bc(t);if(e.length===2){const[i,o]=e;return i?n.withSetScope(i,o):n.withScope(o)}return n.withScope(e[0])}function $t(){return di().getClient()}function gw(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:i,propagationSpanId:o}=t,s={trace_id:n,span_id:o||Zf()};return i&&(s.parent_span_id=i),s}const bw="sentry.source",xw="sentry.sample_rate",Nw="sentry.previous_trace_sample_rate",yw="sentry.op",ww="sentry.origin",Qf="sentry.profile_id",Jf="sentry.exclusive_time",vw=0,Ew=1,kw="_sentryScope",Sw="_sentryIsolationScope";function Tw(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function eh(e){const t=e;return{scope:t[kw],isolationScope:Tw(t[Sw])}}const Dw="sentry-",_w=/^sentry-/;function jw(e){const t=Pw(e);if(!t)return;const n=Object.entries(t).reduce((i,[o,s])=>{if(o.match(_w)){const r=o.slice(Dw.length);i[r]=s}return i},{});if(Object.keys(n).length>0)return n}function Pw(e){if(!(!e||!qn(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{const i=$u(n);return Object.entries(i).forEach(([o,s])=>{t[o]=s}),t},{}):$u(e)}function $u(e){return e.split(",").map(t=>{const n=t.indexOf("=");if(n===-1)return[];const i=t.slice(0,n),o=t.slice(n+1);return[i,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((t,[n,i])=>(n&&i&&(t[n]=i),t),{})}const Cw=/^o(\d+)\./,Aw=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Mw(e){return e==="http"||e==="https"}function Ns(e,t=!1){const{host:n,path:i,pass:o,port:s,projectId:r,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${i&&`${i}/`}${r}`}function Iw(e){const t=Aw.exec(e);if(!t){yo(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,i,o="",s="",r="",a=""]=t.slice(1);let c="",u=a;const d=u.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),u=d.pop()),u){const m=u.match(/^\d+/);m&&(u=m[0])}return th({host:s,pass:o,path:c,projectId:u,port:r,protocol:n,publicKey:i})}function th(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Vw(e){if(!Se)return!0;const{port:t,projectId:n,protocol:i}=e;return["protocol","publicKey","host","projectId"].find(r=>e[r]?!1:(me.error(`Invalid Sentry Dsn: ${r} missing`),!0))?!1:n.match(/^\d+$/)?Mw(i)?t&&isNaN(parseInt(t,10))?(me.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(me.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),!1):(me.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Uw(e){const t=e.match(Cw);return t==null?void 0:t[1]}function Rw(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let i;return t.orgId?i=String(t.orgId):n&&(i=Uw(n)),i}function qw(e){const t=typeof e=="string"?Iw(e):th(e);if(!(!t||!Vw(t)))return t}function Bw(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}const nh=1;let Xu=!1;function Lw(e){const{spanId:t,traceId:n,isRemote:i}=e.spanContext(),o=i?t:xc(e).parent_span_id,s=eh(e).scope,r=i?(s==null?void 0:s.getPropagationContext().propagationSpanId)||Zf():t;return{parent_span_id:o,span_id:r,trace_id:n}}function Ow(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:i,...o},attributes:s})=>({span_id:t,trace_id:n,sampled:i===nh,attributes:s,...o}))}function Ku(e){return typeof e=="number"?Yu(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Yu(e.getTime()):Bn()}function Yu(e){return e>9999999999?e/1e3:e}function xc(e){var i;if(Hw(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(Fw(e)){const{attributes:o,startTime:s,name:r,endTime:a,status:c,links:u}=e,d="parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?(i=e.parentSpanContext)==null?void 0:i.spanId:void 0;return{span_id:t,trace_id:n,data:o,description:r,parent_span_id:d,start_timestamp:Ku(s),timestamp:Ku(a)||void 0,status:Gw(c),op:o[yw],origin:o[ww],links:Ow(u)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Fw(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Hw(e){return typeof e.getSpanJSON=="function"}function zw(e){const{traceFlags:t}=e.spanContext();return t===nh}function Gw(e){if(!(!e||e.code===vw))return e.code===Ew?"ok":e.message||"internal_error"}const Ww="_sentryRootSpan";function ih(e){return e[Ww]||e}function Zu(){Xu||(yo(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Xu=!0)}function $w(e){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=(n=$t())==null?void 0:n.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Qu(e){me.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Ju(e,t){if(!(t!=null&&t.length)||!e.description)return!1;for(const n of t){if(Kw(n)){if(Ws(e.description,n))return Se&&Qu(e),!0;continue}if(!n.name&&!n.op)continue;const i=n.name?Ws(e.description,n.name):!0,o=n.op?e.op&&Ws(e.op,n.op):!0;if(i&&o)return Se&&Qu(e),!0}return!1}function Xw(e,t){const n=t.parent_span_id,i=t.span_id;if(n)for(const o of e)o.parent_span_id===i&&(o.parent_span_id=n)}function Kw(e){return typeof e=="string"||e instanceof RegExp}const Nc="production",Yw="_frozenDsc";function oh(e,t){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},o={environment:n.environment||Nc,release:n.release,public_key:i,trace_id:e,org_id:Rw(t)};return t.emit("createDsc",o),o}function Zw(e,t){const n=t.getPropagationContext();return n.dsc||oh(n.traceId,e)}function Qw(e){var g;const t=$t();if(!t)return{};const n=ih(e),i=xc(n),o=i.data,s=n.spanContext().traceState,r=(s==null?void 0:s.get("sentry.sample_rate"))??o[xw]??o[Nw];function a(b){return(typeof r=="number"||typeof r=="string")&&(b.sample_rate=`${r}`),b}const c=n[Yw];if(c)return a(c);const u=s==null?void 0:s.get("sentry.dsc"),d=u&&jw(u);if(d)return a(d);const m=oh(e.spanContext().traceId,t),f=o[bw],h=i.description;return f!=="url"&&h&&(m.transaction=h),$w()&&(m.sampled=String(zw(n)),m.sample_rand=(s==null?void 0:s.get("sentry.sample_rand"))??((g=eh(n).scope)==null?void 0:g.getPropagationContext().sampleRand.toString())),a(m),t.emit("createDsc",m,n),m}function An(e,t=100,n=1/0){try{return ol("",e,t,n)}catch(i){return{ERROR:`**non-serializable** (${i})`}}}function sh(e,t=3,n=100*1024){const i=An(e,t);return nv(i)>n?sh(e,t-1,n):i}function ol(e,t,n=1/0,i=1/0,o=iv()){const[s,r]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=Jw(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const c=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(t))return"[Circular ~]";const u=t;if(u&&typeof u.toJSON=="function")try{const h=u.toJSON();return ol("",h,c-1,i,o)}catch{}const d=Array.isArray(t)?[]:{};let m=0;const f=Xf(t);for(const h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(m>=i){d[h]="[MaxProperties ~]";break}const g=f[h];d[h]=ol(h,g,c-1,i,o),m++}return r(t),d}function Jw(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(zf(t))return Of(t);if(Ky(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${ri(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=ev(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function ev(e){const t=Object.getPrototypeOf(e);return t!=null&&t.constructor?t.constructor.name:"null prototype"}function tv(e){return~-encodeURI(e).split(/%..|./).length}function nv(e){return tv(JSON.stringify(e))}function iv(){const e=new WeakSet;function t(i){return e.has(i)?!0:(e.add(i),!1)}function n(i){e.delete(i)}return[t,n]}function vo(e,t=[]){return[e,t]}function ov(e,t){const[n,i]=e;return[n,[...i,t]]}function ed(e,t){const n=e[1];for(const i of n){const o=i[0].type;if(t(i,o))return!0}return!1}function sl(e){const t=Kr(Xe);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function rh(e){const[t,n]=e;let i=JSON.stringify(t);function o(s){typeof i=="string"?i=typeof s=="string"?i+s:[sl(i),s]:i.push(typeof s=="string"?sl(s):s)}for(const s of n){const[r,a]=s;if(o(`
|
|
7
|
-
${JSON.stringify(r)}
|
|
8
|
-
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(An(a))}o(c)}}return typeof i=="string"?i:sv(i)}function sv(e){const t=e.reduce((o,s)=>o+s.length,0),n=new Uint8Array(t);let i=0;for(const o of e)n.set(o,i),i+=o.length;return n}function rv(e){const t=typeof e.data=="string"?sl(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const av={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function td(e){return av[e]}function ah(e){if(!(e!=null&&e.sdk))return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function lv(e,t,n,i){var s;const o=(s=e.sdkProcessingMetadata)==null?void 0:s.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&i&&{dsn:Ns(i)},...o&&{trace:o}}}function cv(e,t){var i,o,s,r;if(!t)return e;const n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...((i=e.sdk)==null?void 0:i.integrations)||[],...t.integrations||[]],packages:[...((o=e.sdk)==null?void 0:o.packages)||[],...t.packages||[]],settings:(s=e.sdk)!=null&&s.settings||t.settings?{...(r=e.sdk)==null?void 0:r.settings,...t.settings}:void 0},e}function uv(e,t,n,i){const o=ah(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!i&&t&&{dsn:Ns(t)}},r="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return vo(s,[r])}function dv(e,t,n,i){const o=ah(n),s=e.type&&e.type!=="replay_event"?e.type:"event";cv(e,n==null?void 0:n.sdk);const r=lv(e,o,i,t);return delete e.sdkProcessingMetadata,vo(r,[[{type:s},e]])}const Ea=0,nd=1,id=2;function ta(e){return new rs(t=>{t(e)})}function yc(e){return new rs((t,n)=>{n(e)})}class rs{constructor(t){this._state=Ea,this._handlers=[],this._runExecutor(t)}then(t,n){return new rs((i,o)=>{this._handlers.push([!1,s=>{if(!t)i(s);else try{i(t(s))}catch(r){o(r)}},s=>{if(!n)o(s);else try{i(n(s))}catch(r){o(r)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new rs((n,i)=>{let o,s;return this.then(r=>{s=!1,o=r,t&&t()},r=>{s=!0,o=r,t&&t()}).then(()=>{if(s){i(o);return}n(o)})})}_executeHandlers(){if(this._state===Ea)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===nd&&n[1](this._value),this._state===id&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(s,r)=>{if(this._state===Ea){if(gs(r)){r.then(i,o);return}this._state=s,this._value=r,this._executeHandlers()}},i=s=>{n(nd,s)},o=s=>{n(id,s)};try{t(i,o)}catch(s){o(s)}}}function mv(e,t,n,i=0){try{const o=rl(t,n,e,i);return gs(o)?o:ta(o)}catch(o){return yc(o)}}function rl(e,t,n,i){const o=n[i];if(!e||!o)return e;const s=o({...e},t);return Se&&s===null&&me.log(`Event processor "${o.id||"?"}" dropped event`),gs(s)?s.then(r=>rl(r,t,n,i+1)):rl(s,t,n,i+1)}let Pn,od,sd,$n;function pv(e){const t=Xe._sentryDebugIds,n=Xe._debugIds;if(!t&&!n)return{};const i=t?Object.keys(t):[],o=n?Object.keys(n):[];if($n&&i.length===od&&o.length===sd)return $n;od=i.length,sd=o.length,$n={},Pn||(Pn={});const s=(r,a)=>{for(const c of r){const u=a[c],d=Pn==null?void 0:Pn[c];if(d&&$n&&u)$n[d[0]]=u,Pn&&(Pn[c]=[d[0],u]);else if(u){const m=e(c);for(let f=m.length-1;f>=0;f--){const h=m[f],g=h==null?void 0:h.filename;if(g&&$n&&Pn){$n[g]=u,Pn[c]=[g,u];break}}}}};return t&&s(i,t),n&&s(o,n),$n}function fv(e,t){const{fingerprint:n,span:i,breadcrumbs:o,sdkProcessingMetadata:s}=t;gv(e,t),i&&Nv(e,i),yv(e,n),bv(e,o),xv(e,s)}function rd(e,t){const{extra:n,tags:i,attributes:o,user:s,contexts:r,level:a,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:d,eventProcessors:m,attachments:f,propagationContext:h,transactionName:g,span:b}=t;ko(e,"extra",n),ko(e,"tags",i),ko(e,"attributes",o),ko(e,"user",s),ko(e,"contexts",r),e.sdkProcessingMetadata=xs(e.sdkProcessingMetadata,c,2),a&&(e.level=a),g&&(e.transactionName=g),b&&(e.span=b),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),m.length&&(e.eventProcessors=[...e.eventProcessors,...m]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...h}}function ko(e,t,n){e[t]=xs(e[t],n,1)}function hv(e,t){const n=fw().getScopeData();return e&&rd(n,e.getScopeData()),t&&rd(n,t.getScopeData()),n}function gv(e,t){const{extra:n,tags:i,user:o,contexts:s,level:r,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(i).length&&(e.tags={...i,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(s).length&&(e.contexts={...s,...e.contexts}),r&&(e.level=r),a&&e.type!=="transaction"&&(e.transaction=a)}function bv(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function xv(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Nv(e,t){e.contexts={trace:Lw(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Qw(t),...e.sdkProcessingMetadata};const n=ih(t),i=xc(n).description;i&&!e.transaction&&e.type==="transaction"&&(e.transaction=i)}function yv(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function wv(e,t,n,i,o,s){const{normalizeDepth:r=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||un(),timestamp:t.timestamp||bs()},u=n.integrations||e.integrations.map(x=>x.name);vv(c,e),Sv(c,u),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&Ev(c,e.stackParser);const d=Dv(i,n.captureContext);n.mechanism&&ro(c,n.mechanism);const m=o?o.getEventProcessors():[],f=hv(s,d),h=[...n.attachments||[],...f.attachments];h.length&&(n.attachments=h),fv(c,f);const g=[...m,...f.eventProcessors];return mv(g,c,n).then(x=>(x&&kv(x),typeof r=="number"&&r>0?Tv(x,r,a):x))}function vv(e,t){var a,c;const{environment:n,release:i,dist:o,maxValueLength:s}=t;e.environment=e.environment||n||Nc,!e.release&&i&&(e.release=i),!e.dist&&o&&(e.dist=o);const r=e.request;r!=null&&r.url&&s&&(r.url=tl(r.url,s)),s&&((c=(a=e.exception)==null?void 0:a.values)==null||c.forEach(u=>{u.value&&(u.value=tl(u.value,s))}))}function Ev(e,t){var i,o;const n=pv(t);(o=(i=e.exception)==null?void 0:i.values)==null||o.forEach(s=>{var r,a;(a=(r=s.stacktrace)==null?void 0:r.frames)==null||a.forEach(c=>{c.filename&&(c.debug_id=n[c.filename])})})}function kv(e){var i,o;const t={};if((o=(i=e.exception)==null?void 0:i.values)==null||o.forEach(s=>{var r,a;(a=(r=s.stacktrace)==null?void 0:r.frames)==null||a.forEach(c=>{c.debug_id&&(c.abs_path?t[c.abs_path]=c.debug_id:c.filename&&(t[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([s,r])=>{n.push({type:"sourcemap",code_file:s,debug_id:r})})}function Sv(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Tv(e,t,n){var o,s;if(!e)return null;const i={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(r=>({...r,...r.data&&{data:An(r.data,t,n)}}))},...e.user&&{user:An(e.user,t,n)},...e.contexts&&{contexts:An(e.contexts,t,n)},...e.extra&&{extra:An(e.extra,t,n)}};return(o=e.contexts)!=null&&o.trace&&i.contexts&&(i.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(i.contexts.trace.data=An(e.contexts.trace.data,t,n))),e.spans&&(i.spans=e.spans.map(r=>({...r,...r.data&&{data:An(r.data,t,n)}}))),(s=e.contexts)!=null&&s.flags&&i.contexts&&(i.contexts.flags=An(e.contexts.flags,3,n)),i}function Dv(e,t){if(!t)return e;const n=e?e.clone():new On;return n.update(t),n}function _v(e,t){return di().captureException(e,void 0)}function lh(e,t){return di().captureEvent(e,t)}function jv(e,t){Vi().setContext(e,t)}function na(e,t){Vi().setTag(e,t)}function ad(e){const t=Vi(),n=di(),{userAgent:i}=Xe.navigator||{},o=ow({user:n.getUser()||t.getUser(),...i&&{userAgent:i},...e}),s=t.getSession();return(s==null?void 0:s.status)==="ok"&&ao(s,{status:"exited"}),ch(),t.setSession(o),o}function ch(){const e=Vi(),n=di().getSession()||e.getSession();n&&sw(n),uh(),e.setSession()}function uh(){const e=Vi(),t=$t(),n=e.getSession();n&&t&&t.captureSession(n)}function ld(e=!1){if(e){ch();return}uh()}const Pv="7";function Cv(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function Av(e){return`${Cv(e)}${e.projectId}/envelope/`}function Mv(e,t){const n={sentry_version:Pv};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function Iv(e,t,n){return t||`${Av(e)}?${Mv(e,n)}`}const cd=[];function Vv(e){const t={};return e.forEach(n=>{const{name:i}=n,o=t[i];o&&!o.isDefaultInstance&&n.isDefaultInstance||(t[i]=n)}),Object.values(t)}function Uv(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let i;if(Array.isArray(n))i=[...t,...n];else if(typeof n=="function"){const o=n(t);i=Array.isArray(o)?o:[o]}else i=t;return Vv(i)}function Rv(e,t){const n={};return t.forEach(i=>{i&&dh(e,i,n)}),n}function ud(e,t){for(const n of t)n!=null&&n.afterAllSetup&&n.afterAllSetup(e)}function dh(e,t,n){if(n[t.name]){Se&&me.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!cd.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),cd.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const i=t.preprocessEvent.bind(t);e.on("preprocessEvent",(o,s)=>i(o,s,e))}if(typeof t.processEvent=="function"){const i=t.processEvent.bind(t),o=Object.assign((s,r)=>i(s,r,e),{id:t.name});e.addEventProcessor(o)}Se&&me.log(`Integration installed: ${t.name}`)}function qv(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function Bv(e,t,n,i){const o={};return t!=null&&t.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&i&&(o.dsn=Ns(i)),vo(o,[qv(e)])}function mh(e,t){const n=t??Lv(e)??[];if(n.length===0)return;const i=e.getOptions(),o=Bv(n,i._metadata,i.tunnel,e.getDsn());ph().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function Lv(e){return ph().get(e)}function ph(){return No("clientToLogBufferMap",()=>new WeakMap)}function Ov(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function Fv(e,t,n,i){const o={};return t!=null&&t.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&i&&(o.dsn=Ns(i)),vo(o,[Ov(e)])}function fh(e,t){const n=t??Hv(e)??[];if(n.length===0)return;const i=e.getOptions(),o=Fv(n,i._metadata,i.tunnel,e.getDsn());hh().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function Hv(e){return hh().get(e)}function hh(){return No("clientToMetricBufferMap",()=>new WeakMap)}const wc=Symbol.for("SentryBufferFullError");function vc(e=100){const t=new Set;function n(){return t.size<e}function i(r){t.delete(r)}function o(r){if(!n())return yc(wc);const a=r();return t.add(a),a.then(()=>i(a),()=>i(a)),a}function s(r){if(!t.size)return ta(!0);const a=Promise.allSettled(Array.from(t)).then(()=>!0);if(!r)return a;const c=[a,new Promise(u=>setTimeout(()=>u(!1),r))];return Promise.race(c)}return{get $(){return Array.from(t)},add:o,drain:s}}const zv=60*1e3;function Gv(e,t=Jr()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const i=Date.parse(`${e}`);return isNaN(i)?zv:i-t}function Wv(e,t){return e[t]||e.all||0}function $v(e,t,n=Jr()){return Wv(e,t)>n}function Xv(e,{statusCode:t,headers:n},i=Jr()){const o={...e},s=n==null?void 0:n["x-sentry-rate-limits"],r=n==null?void 0:n["retry-after"];if(s)for(const a of s.trim().split(",")){const[c,u,,,d]=a.split(":",5),m=parseInt(c,10),f=(isNaN(m)?60:m)*1e3;if(!u)o.all=i+f;else for(const h of u.split(";"))h==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(o[h]=i+f):o[h]=i+f}else r?o.all=i+Gv(r,i):t===429&&(o.all=i+60*1e3);return o}const gh=64;function Kv(e,t,n=vc(e.bufferSize||gh)){let i={};const o=r=>n.drain(r);function s(r){const a=[];if(ed(r,(m,f)=>{const h=td(f);$v(i,h)?e.recordDroppedEvent("ratelimit_backoff",h):a.push(m)}),a.length===0)return Promise.resolve({});const c=vo(r[0],a),u=m=>{ed(c,(f,h)=>{e.recordDroppedEvent(m,td(h))})},d=()=>t({body:rh(c)}).then(m=>(m.statusCode!==void 0&&(m.statusCode<200||m.statusCode>=300)&&Se&&me.warn(`Sentry responded with status code ${m.statusCode} to sent event.`),i=Xv(i,m),m),m=>{throw u("network_error"),Se&&me.error("Encountered error running transport request:",m),m});return n.add(d).then(m=>m,m=>{if(m===wc)return Se&&me.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw m})}return{send:s,flush:o}}function Yv(e,t,n){const i=[{type:"client_report"},{timestamp:bs(),discarded_events:e}];return vo(t?{dsn:t}:{},[i])}function bh(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n!=null&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Zv(e){var c;const{trace_id:t,parent_span_id:n,span_id:i,status:o,origin:s,data:r,op:a}=((c=e.contexts)==null?void 0:c.trace)??{};return{data:r??{},description:e.transaction,op:a,parent_span_id:n,span_id:i??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:s,profile_id:r==null?void 0:r[Qf],exclusive_time:r==null?void 0:r[Jf],measurements:e.measurements,is_segment:!0}}function Qv(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Qf]:e.profile_id},...e.exclusive_time&&{[Jf]:e.exclusive_time}}}},measurements:e.measurements}}const dd="Not capturing exception because it's already been captured.",md="Discarded session because of missing or non-string release",xh=Symbol.for("SentryInternalError"),Nh=Symbol.for("SentryDoNotSendEventError"),Jv=5e3;function $s(e){return{message:e,[xh]:!0}}function ka(e){return{message:e,[Nh]:!0}}function pd(e){return!!e&&typeof e=="object"&&xh in e}function fd(e){return!!e&&typeof e=="object"&&Nh in e}function hd(e,t,n,i,o){let s=0,r,a=!1;e.on(n,()=>{s=0,clearTimeout(r),a=!1}),e.on(t,c=>{s+=i(c),s>=8e5?o(e):a||(a=!0,r=setTimeout(()=>{o(e)},Jv))}),e.on("flush",()=>{o(e)})}class e1{constructor(t){var i,o,s;if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=vc(((i=t.transportOptions)==null?void 0:i.bufferSize)??gh),t.dsn?this._dsn=qw(t.dsn):Se&&me.warn("No DSN provided, client will not send events."),this._dsn){const r=Iv(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??((o=this._options._experiments)==null?void 0:o.enableLogs),this._options.enableLogs&&hd(this,"afterCaptureLog","flushLogs",o1,mh),(this._options.enableMetrics??((s=this._options._experiments)==null?void 0:s.enableMetrics)??!0)&&hd(this,"afterCaptureMetric","flushMetrics",i1,fh)}captureException(t,n,i){const o=un();if(Ou(t))return Se&&me.log(dd),o;const s={event_id:o,...n};return this._process(()=>this.eventFromException(t,s).then(r=>this._captureEvent(r,s,i)).then(r=>r),"error"),s.event_id}captureMessage(t,n,i,o){const s={event_id:un(),...i},r=pc(t)?t:String(t),a=Yr(t),c=a?this.eventFromMessage(r,n,s):this.eventFromException(t,s);return this._process(()=>c.then(u=>this._captureEvent(u,s,o)),a?"unknown":"error"),s.event_id}captureEvent(t,n,i){const o=un();if(n!=null&&n.originalException&&Ou(n.originalException))return Se&&me.log(dd),o;const s={event_id:o,...n},r=t.sdkProcessingMetadata||{},a=r.capturedSpanScope,c=r.capturedSpanIsolationScope,u=gd(t.type);return this._process(()=>this._captureEvent(t,s,a||i,c),u),s.event_id}captureSession(t){this.sendSession(t),ao(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const n=this._transport;if(!n)return!0;this.emit("flush");const i=await this._isClientDoneProcessing(t),o=await n.flush(t);return i&&o}async close(t){const n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const n=this._integrations[t.name];dh(this,t,this._integrations),n||ud(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let i=dv(t,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])i=ov(i,rv(o));this.sendEnvelope(i).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){const{release:n,environment:i=Nc}=this._options;if("aggregates"in t){const s=t.attrs||{};if(!s.release&&!n){Se&&me.warn(md);return}s.release=s.release||n,s.environment=s.environment||i,t.attrs=s}else{if(!t.release&&!n){Se&&me.warn(md);return}t.release=t.release||n,t.environment=t.environment||i}this.emit("beforeSendSession",t);const o=uv(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,n,i=1){if(this._options.sendClientReports){const o=`${t}:${n}`;Se&&me.log(`Recording outcome: "${o}"${i>1?` (${i} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+i}}on(t,n){const i=this._hooks[t]=this._hooks[t]||new Set,o=(...s)=>n(...s);return i.add(o),()=>{i.delete(o)}}emit(t,...n){const i=this._hooks[t];i&&i.forEach(o=>o(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return Se&&me.error("Error while sending envelope:",n),{}}return Se&&me.error("Transport disabled"),{}}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=Rv(this,t),ud(this,t)}_updateSessionFromEvent(t,n){var c,u;let i=n.level==="fatal",o=!1;const s=(c=n.exception)==null?void 0:c.values;if(s){o=!0,i=!1;for(const d of s)if(((u=d.mechanism)==null?void 0:u.handled)===!1){i=!0;break}}const r=t.status==="ok";(r&&t.errors===0||r&&i)&&(ao(t,{...i&&{status:"crashed"},errors:t.errors||Number(o||i)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(i=>setTimeout(i,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,i,o){const s=this.getOptions(),r=Object.keys(this._integrations);return!n.integrations&&(r!=null&&r.length)&&(n.integrations=r),this.emit("preprocessEvent",t,n),t.type||o.setLastEventId(t.event_id||n.event_id),wv(s,t,n,i,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:gw(i),...a.contexts};const c=Zw(this,i);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(t,n={},i=di(),o=Vi()){return Se&&al(t)&&me.log(`Captured error event \`${bh(t)[0]||"<unknown>"}\``),this._processEvent(t,n,i,o).then(s=>s.event_id,s=>{Se&&(fd(s)?me.log(s.message):pd(s)?me.warn(s.message):me.warn(s))})}_processEvent(t,n,i,o){const s=this.getOptions(),{sampleRate:r}=s,a=yh(t),c=al(t),d=`before send for type \`${t.type||"error"}\``,m=typeof r>"u"?void 0:Bw(r);if(c&&typeof m=="number"&&dr()>m)return this.recordDroppedEvent("sample_rate","error"),yc(ka(`Discarding event because it's not included in the random sample (sampling rate = ${r})`));const f=gd(t.type);return this._prepareEvent(t,n,i,o).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",f),ka("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return h;const b=n1(this,s,h,n);return t1(b,d)}).then(h=>{var x;if(h===null){if(this.recordDroppedEvent("before_send",f),a){const N=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",N)}throw ka(`${d} returned \`null\`, will not send event.`)}const g=i.getSession()||o.getSession();if(c&&g&&this._updateSessionFromEvent(g,h),a){const y=((x=h.sdkProcessingMetadata)==null?void 0:x.spanCountBeforeProcessing)||0,N=h.spans?h.spans.length:0,w=y-N;w>0&&this.recordDroppedEvent("before_send","span",w)}const b=h.transaction_info;if(a&&b&&h.transaction!==t.transaction){const y="custom";h.transaction_info={...b,source:y}}return this.sendEvent(h,n),h}).then(null,h=>{throw fd(h)||pd(h)?h:(this.captureException(h,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:h}),$s(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
9
|
-
Reason: ${h}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(i=>(this._numProcessing--,i),i=>(this._numProcessing--,i===wc&&this.recordDroppedEvent("queue_overflow",n),i))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,i])=>{const[o,s]=n.split(":");return{reason:o,category:s,quantity:i}})}_flushOutcomes(){Se&&me.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){Se&&me.log("No outcomes to send");return}if(!this._dsn){Se&&me.log("No dsn provided, will not send outcomes");return}Se&&me.log("Sending outcomes:",t);const n=Yv(t,this._options.tunnel&&Ns(this._dsn));this.sendEnvelope(n)}}function gd(e){return e==="replay_event"?"replay":e||"error"}function t1(e,t){const n=`${t} must return \`null\` or a valid event.`;if(gs(e))return e.then(i=>{if(!ss(i)&&i!==null)throw $s(n);return i},i=>{throw $s(`${t} rejected with ${i}`)});if(!ss(e)&&e!==null)throw $s(n);return e}function n1(e,t,n,i){const{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:r,ignoreSpans:a}=t;let c=n;if(al(c)&&o)return o(c,i);if(yh(c)){if(r||a){const u=Zv(c);if(a!=null&&a.length&&Ju(u,a))return null;if(r){const d=r(u);d?c=xs(n,Qv(d)):Zu()}if(c.spans){const d=[],m=c.spans;for(const h of m){if(a!=null&&a.length&&Ju(h,a)){Xw(m,h);continue}if(r){const g=r(h);g?d.push(g):(Zu(),d.push(h))}else d.push(h)}const f=c.spans.length-d.length;f&&e.recordDroppedEvent("before_send","span",f),c.spans=d}}if(s){if(c.spans){const u=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return s(c,i)}}return c}function al(e){return e.type===void 0}function yh(e){return e.type==="transaction"}function i1(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+wh(e.attributes)}function o1(e){let t=0;return e.message&&(t+=e.message.length*2),t+wh(e.attributes)}function wh(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*bd(n[0]):Yr(n)?t+=bd(n):t+=100}),t}function bd(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function s1(e,t){t.debug===!0&&(Se?me.enable():yo(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),di().update(t.initialScope);const i=new e(t);return r1(i),i.init(),i}function r1(e){di().setClient(e)}function Sa(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",i=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:i,relative:t[5]+n+i}}function a1(e){var t;"aggregates"in e?((t=e.attrs)==null?void 0:t.ip_address)===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function vh(e,t,n=[t],i="npm"){const o=e._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${t}`,packages:n.map(s=>({name:`${i}:@sentry/${s}`,version:vi})),version:vi}),e._metadata=o}const l1=100;function Pi(e,t){const n=$t(),i=Vi();if(!n)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:s=l1}=n.getOptions();if(s<=0)return;const a={timestamp:bs(),...e},c=o?yo(()=>o(a,t)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,t),i.addBreadcrumb(c,s))}let xd;const c1="FunctionToString",Nd=new WeakMap,u1=(()=>({name:c1,setupOnce(){xd=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=gc(this),n=Nd.has($t())&&t!==void 0?t:this;return xd.apply(n,e)}}catch{}},setup(e){Nd.set(e,!0)}})),d1=u1,m1=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],p1="EventFilters",f1=(e={})=>{let t;return{name:p1,setup(n){const i=n.getOptions();t=yd(e,i)},processEvent(n,i,o){if(!t){const s=o.getOptions();t=yd(e,s)}return g1(n,t)?null:n}}},h1=((e={})=>({...f1(e),name:"InboundFilters"}));function yd(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:m1],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function g1(e,t){if(e.type){if(e.type==="transaction"&&x1(e,t.ignoreTransactions))return Se&&me.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
10
|
-
Event: ${bi(e)}`),!0}else{if(b1(e,t.ignoreErrors))return Se&&me.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
11
|
-
Event: ${bi(e)}`),!0;if(v1(e))return Se&&me.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
12
|
-
Event: ${bi(e)}`),!0;if(N1(e,t.denyUrls))return Se&&me.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
13
|
-
Event: ${bi(e)}.
|
|
14
|
-
Url: ${mr(e)}`),!0;if(!y1(e,t.allowUrls))return Se&&me.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
15
|
-
Event: ${bi(e)}.
|
|
16
|
-
Url: ${mr(e)}`),!0}return!1}function b1(e,t){return t!=null&&t.length?bh(e).some(n=>ea(n,t)):!1}function x1(e,t){if(!(t!=null&&t.length))return!1;const n=e.transaction;return n?ea(n,t):!1}function N1(e,t){if(!(t!=null&&t.length))return!1;const n=mr(e);return n?ea(n,t):!1}function y1(e,t){if(!(t!=null&&t.length))return!0;const n=mr(e);return n?ea(n,t):!0}function w1(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function mr(e){var t,n;try{const i=[...((t=e.exception)==null?void 0:t.values)??[]].reverse().find(s=>{var r,a,c;return((r=s.mechanism)==null?void 0:r.parent_id)===void 0&&((c=(a=s.stacktrace)==null?void 0:a.frames)==null?void 0:c.length)}),o=(n=i==null?void 0:i.stacktrace)==null?void 0:n.frames;return o?w1(o):null}catch{return Se&&me.error(`Cannot extract url for event ${bi(e)}`),null}}function v1(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)!=null&&n.length?!e.message&&!e.exception.values.some(i=>i.stacktrace||i.type&&i.type!=="Error"||i.value):!1}function E1(e,t,n,i,o,s){var a;if(!((a=o.exception)!=null&&a.values)||!s||!ai(s.originalException,Error))return;const r=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;r&&(o.exception.values=ll(e,t,i,s.originalException,n,o.exception.values,r,0))}function ll(e,t,n,i,o,s,r,a){if(s.length>=n+1)return s;let c=[...s];if(ai(i[o],Error)){wd(r,a);const u=e(t,i[o]),d=c.length;vd(u,o,d,a),c=ll(e,t,n,i[o],o,[u,...c],u,d)}return Array.isArray(i.errors)&&i.errors.forEach((u,d)=>{if(ai(u,Error)){wd(r,a);const m=e(t,u),f=c.length;vd(m,`errors[${d}]`,f,a),c=ll(e,t,n,u,o,[m,...c],m,f)}}),c}function wd(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function vd(e,t,n,i){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:i}}function k1(e){const t="console";Mi(t,e),Ii(t,S1)}function S1(){"console"in Xe&&My.forEach(function(e){e in Xe.console&&Qt(Xe.console,e,function(t){return ur[e]=t,function(...n){bn("console",{args:n,level:e});const o=ur[e];o==null||o.apply(Xe.console,n)}})})}function T1(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const D1="Dedupe",_1=(()=>{let e;return{name:D1,processEvent(t){if(t.type)return t;try{if(P1(t,e))return Se&&me.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),j1=_1;function P1(e,t){return t?!!(C1(e,t)||A1(e,t)):!1}function C1(e,t){const n=e.message,i=t.message;return!(!n&&!i||n&&!i||!n&&i||n!==i||!kh(e,t)||!Eh(e,t))}function A1(e,t){const n=Ed(t),i=Ed(e);return!(!n||!i||n.type!==i.type||n.value!==i.value||!kh(e,t)||!Eh(e,t))}function Eh(e,t){let n=Vu(e),i=Vu(t);if(!n&&!i)return!0;if(n&&!i||!n&&i||(n=n,i=i,i.length!==n.length))return!1;for(let o=0;o<i.length;o++){const s=i[o],r=n[o];if(s.filename!==r.filename||s.lineno!==r.lineno||s.colno!==r.colno||s.function!==r.function)return!1}return!0}function kh(e,t){let n=e.fingerprint,i=t.fingerprint;if(!n&&!i)return!0;if(n&&!i||!n&&i)return!1;n=n,i=i;try{return n.join("")===i.join("")}catch{return!1}}function Ed(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}function Sh(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const as=Xe;function M1(){return"history"in as&&!!as.history}function I1(){if(!("fetch"in as))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function cl(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function V1(){var n;if(typeof EdgeRuntime=="string")return!0;if(!I1())return!1;if(cl(as.fetch))return!0;let e=!1;const t=as.document;if(t&&typeof t.createElement=="function")try{const i=t.createElement("iframe");i.hidden=!0,t.head.appendChild(i),(n=i.contentWindow)!=null&&n.fetch&&(e=cl(i.contentWindow.fetch)),t.head.removeChild(i)}catch(i){Se&&me.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return e}function U1(e,t){const n="fetch";Mi(n,e),Ii(n,()=>R1(void 0,t))}function R1(e,t=!1){t&&!V1()||Qt(Xe,"fetch",function(n){return function(...i){const o=new Error,{method:s,url:r}=q1(i),a={args:i,fetchData:{method:s,url:r},startTimestamp:Bn()*1e3,virtualError:o,headers:B1(i)};return bn("fetch",{...a}),n.apply(Xe,i).then(async c=>(bn("fetch",{...a,endTimestamp:Bn()*1e3,response:c}),c),c=>{if(bn("fetch",{...a,endTimestamp:Bn()*1e3,error:c}),mc(c)&&c.stack===void 0&&(c.stack=o.stack,ji(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const u=new URL(a.fetchData.url);c.message=`${c.message} (${u.host})`}catch{}throw c})}})}function Xs(e,t){return!!e&&typeof e=="object"&&!!e[t]}function kd(e){return typeof e=="string"?e:e?Xs(e,"url")?e.url:e.toString?e.toString():"":""}function q1(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,i]=e;return{url:kd(n),method:Xs(i,"method")?String(i.method).toUpperCase():Gf(n)&&Xs(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:kd(t),method:Xs(t,"method")?String(t.method).toUpperCase():"GET"}}function B1(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Gf(t))return new Headers(t.headers)}catch{}}function L1(){return"npm"}const kt=Xe;let ul=0;function Th(){return ul>0}function O1(){ul++,setTimeout(()=>{ul--})}function co(e,t={}){function n(o){return typeof o=="function"}if(!n(e))return e;try{const o=e.__sentry_wrapped__;if(o)return typeof o=="function"?o:e;if(gc(e))return e}catch{return e}const i=function(...o){try{const s=o.map(r=>co(r,t));return e.apply(this,s)}catch(s){throw O1(),hw(r=>{r.addEventProcessor(a=>(t.mechanism&&(nl(a,void 0),ro(a,t.mechanism)),a.extra={...a.extra,arguments:o},a)),_v(s)}),s}};try{for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=e[o])}catch{}$f(i,e),ji(e,"__sentry_wrapped__",i);try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get(){return e.name}})}catch{}return i}function F1(){const e=hc(),{referrer:t}=kt.document||{},{userAgent:n}=kt.navigator||{},i={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:i}}function Ec(e,t){const n=kc(e,t),i={type:$1(t),value:X1(t)};return n.length&&(i.stacktrace={frames:n}),i.type===void 0&&i.value===""&&(i.value="Unrecoverable error caught"),i}function H1(e,t,n,i){const o=$t(),s=o==null?void 0:o.getOptions().normalizeDepth,r=J1(t),a={__serialized__:sh(t,s)};if(r)return{exception:{values:[Ec(e,r)]},extra:a};const c={exception:{values:[{type:Zr(t)?t.constructor.name:i?"UnhandledRejection":"Error",value:Z1(t,{isUnhandledRejection:i})}]},extra:a};if(n){const u=kc(e,n);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function Ta(e,t){return{exception:{values:[Ec(e,t)]}}}function kc(e,t){const n=t.stacktrace||t.stack||"",i=G1(t),o=W1(t);try{return e(n,i,o)}catch{}return[]}const z1=/Minified React error #\d+;/i;function G1(e){return e&&z1.test(e.message)?1:0}function W1(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Dh(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function $1(e){const t=e==null?void 0:e.name;return!t&&Dh(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function X1(e){const t=e==null?void 0:e.message;return Dh(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function K1(e,t,n,i){const o=(n==null?void 0:n.syntheticException)||void 0,s=Sc(e,t,o,i);return ro(s),s.level="error",n!=null&&n.event_id&&(s.event_id=n.event_id),ta(s)}function Y1(e,t,n="info",i,o){const s=(i==null?void 0:i.syntheticException)||void 0,r=dl(e,t,s,o);return r.level=n,i!=null&&i.event_id&&(r.event_id=i.event_id),ta(r)}function Sc(e,t,n,i,o){let s;if(Hf(t)&&t.error)return Ta(e,t.error);if(Ru(t)||Wy(t)){const r=t;if("stack"in t)s=Ta(e,t);else{const a=r.name||(Ru(r)?"DOMError":"DOMException"),c=r.message?`${a}: ${r.message}`:a;s=dl(e,c,n,i),nl(s,c)}return"code"in r&&(s.tags={...s.tags,"DOMException.code":`${r.code}`}),s}return mc(t)?Ta(e,t):ss(t)||Zr(t)?(s=H1(e,t,n,o),ro(s,{synthetic:!0}),s):(s=dl(e,t,n,i),nl(s,`${t}`),ro(s,{synthetic:!0}),s)}function dl(e,t,n,i){const o={};if(i&&n){const s=kc(e,n);s.length&&(o.exception={values:[{value:t,stacktrace:{frames:s}}]}),ro(o,{synthetic:!0})}if(pc(t)){const{__sentry_template_string__:s,__sentry_template_values__:r}=t;return o.logentry={message:s,params:r},o}return o.message=t,o}function Z1(e,{isUnhandledRejection:t}){const n=Jy(e),i=t?"promise rejection":"exception";return Hf(e)?`Event \`ErrorEvent\` captured as ${i} with message \`${e.message}\``:Zr(e)?`Event \`${Q1(e)}\` (type=${e.type}) captured as ${i}`:`Object captured as ${i} with keys: ${n}`}function Q1(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function J1(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class eE extends e1{constructor(t){var d;const n=tE(t),i=kt.SENTRY_SDK_SOURCE||L1();vh(n,"browser",["browser"],i),(d=n._metadata)!=null&&d.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:o,sendClientReports:s,enableLogs:r,_experiments:a,enableMetrics:c}=this._options,u=c??(a==null?void 0:a.enableMetrics)??!0;kt.document&&(s||r||u)&&kt.document.addEventListener("visibilitychange",()=>{kt.document.visibilityState==="hidden"&&(s&&this._flushOutcomes(),r&&mh(this),u&&fh(this))}),o&&this.on("beforeSendSession",a1)}eventFromException(t,n){return K1(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",i){return Y1(this._options.stackParser,t,n,i,this._options.attachStacktrace)}_prepareEvent(t,n,i,o){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,i,o)}}function tE(e){var t;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(t=kt.SENTRY_RELEASE)==null?void 0:t.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const nE=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Gt=Xe,iE=1e3;let Sd,ml,pl;function oE(e){Mi("dom",e),Ii("dom",sE)}function sE(){if(!Gt.document)return;const e=bn.bind(null,"dom"),t=Td(e,!0);Gt.document.addEventListener("click",t,!1),Gt.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{var s,r;const o=(s=Gt[n])==null?void 0:s.prototype;(r=o==null?void 0:o.hasOwnProperty)!=null&&r.call(o,"addEventListener")&&(Qt(o,"addEventListener",function(a){return function(c,u,d){if(c==="click"||c=="keypress")try{const m=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},f=m[c]=m[c]||{refCount:0};if(!f.handler){const h=Td(e);f.handler=h,a.call(this,c,h,d)}f.refCount++}catch{}return a.call(this,c,u,d)}}),Qt(o,"removeEventListener",function(a){return function(c,u,d){if(c==="click"||c=="keypress")try{const m=this.__sentry_instrumentation_handlers__||{},f=m[c];f&&(f.refCount--,f.refCount<=0&&(a.call(this,c,f.handler,d),f.handler=void 0,delete m[c]),Object.keys(m).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,c,u,d)}}))})}function rE(e){if(e.type!==ml)return!1;try{if(!e.target||e.target._sentryId!==pl)return!1}catch{}return!0}function aE(e,t){return e!=="keypress"?!1:t!=null&&t.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function Td(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const i=lE(n);if(aE(n.type,i))return;ji(n,"_sentryCaptured",!0),i&&!i._sentryId&&ji(i,"_sentryId",un());const o=n.type==="keypress"?"input":n.type;rE(n)||(e({event:n,name:o,global:t}),ml=n.type,pl=i?i._sentryId:void 0),clearTimeout(Sd),Sd=Gt.setTimeout(()=>{pl=void 0,ml=void 0},iE)}}function lE(e){try{return e.target}catch{return null}}let _s;function _h(e){const t="history";Mi(t,e),Ii(t,cE)}function cE(){if(Gt.addEventListener("popstate",()=>{const t=Gt.location.href,n=_s;if(_s=t,n===t)return;bn("history",{from:n,to:t})}),!M1())return;function e(t){return function(...n){const i=n.length>2?n[2]:void 0;if(i){const o=_s,s=uE(String(i));if(_s=s,o===s)return t.apply(this,n);bn("history",{from:o,to:s})}return t.apply(this,n)}}Qt(Gt.history,"pushState",e),Qt(Gt.history,"replaceState",e)}function uE(e){try{return new URL(e,Gt.location.origin).toString()}catch{return e}}const Ks={};function jh(e){const t=Ks[e];if(t)return t;let n=Gt[e];if(cl(n))return Ks[e]=n.bind(Gt);const i=Gt.document;if(i&&typeof i.createElement=="function")try{const o=i.createElement("iframe");o.hidden=!0,i.head.appendChild(o);const s=o.contentWindow;s!=null&&s[e]&&(n=s[e]),i.head.removeChild(o)}catch(o){nE&&me.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,o)}return n&&(Ks[e]=n.bind(Gt))}function dE(e){Ks[e]=void 0}const qo="__sentry_xhr_v3__";function mE(e){Mi("xhr",e),Ii("xhr",pE)}function pE(){if(!Gt.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,i){const o=new Error,s=Bn()*1e3,r=qn(i[0])?i[0].toUpperCase():void 0,a=fE(i[1]);if(!r||!a)return t.apply(n,i);n[qo]={method:r,url:a,request_headers:{}},r==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const c=()=>{const u=n[qo];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:Bn()*1e3,startTimestamp:s,xhr:n,virtualError:o};bn("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,d,m){return c(),u.apply(d,m)}}):n.addEventListener("readystatechange",c),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,d,m){const[f,h]=m,g=d[qo];return g&&qn(f)&&qn(h)&&(g.request_headers[f.toLowerCase()]=h),u.apply(d,m)}}),t.apply(n,i)}}),e.send=new Proxy(e.send,{apply(t,n,i){const o=n[qo];if(!o)return t.apply(n,i);i[0]!==void 0&&(o.body=i[0]);const s={startTimestamp:Bn()*1e3,xhr:n};return bn("xhr",s),t.apply(n,i)}})}function fE(e){if(qn(e))return e;try{return e.toString()}catch{}}const hE=40;function gE(e,t=jh("fetch")){let n=0,i=0;async function o(s){const r=s.body.length;n+=r,i++;const a={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&i<15,...e.fetchOptions};try{const c=await t(e.url,a);return{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}}catch(c){throw dE("fetch"),c}finally{n-=r,i--}}return Kv(e,o,vc(e.bufferSize||hE))}const ys=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,bE=30,xE=50;function fl(e,t,n,i){const o={filename:e,function:t==="<anonymous>"?_i:t,in_app:!0};return n!==void 0&&(o.lineno=n),i!==void 0&&(o.colno=i),o}const NE=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,yE=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wE=/\((\S*)(?::(\d+))(?::(\d+))\)/,vE=/at (.+?) ?\(data:(.+?),/,EE=e=>{const t=e.match(vE);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=NE.exec(e);if(n){const[,o,s,r]=n;return fl(o,_i,+s,+r)}const i=yE.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const a=wE.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}const[s,r]=Ph(i[1]||_i,i[2]);return fl(r,s,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},kE=[bE,EE],SE=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,TE=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,DE=e=>{const t=SE.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const s=TE.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}let i=t[3],o=t[1]||_i;return[o,i]=Ph(o,i),fl(i,o,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},_E=[xE,DE],jE=[kE,_E],PE=Lf(...jE),Ph=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:_i,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},js=1024,CE="Breadcrumbs",AE=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:CE,setup(n){t.console&&k1(UE(n)),t.dom&&oE(VE(n,t.dom)),t.xhr&&mE(RE(n)),t.fetch&&U1(qE(n)),t.history&&_h(BE(n)),t.sentry&&n.on("beforeSendEvent",IE(n))}}}),ME=AE;function IE(e){return function(n){$t()===e&&Pi({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:bi(n)},{event:n})}}function VE(e,t){return function(i){if($t()!==e)return;let o,s,r=typeof t=="object"?t.serializeAttribute:void 0,a=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;a&&a>js&&(ys&&me.warn(`\`dom.maxStringLength\` cannot exceed ${js}, but a value of ${a} was configured. Sentry will use ${js} instead.`),a=js),typeof r=="string"&&(r=[r]);try{const u=i.event,d=LE(u)?u.target:u;o=Wf(d,{keyAttrs:r,maxStringLength:a}),s=Qy(d)}catch{o="<unknown>"}if(o.length===0)return;const c={category:`ui.${i.name}`,message:o};s&&(c.data={"ui.component_name":s}),Pi(c,{event:i.event,name:i.name,global:i.global})}}function UE(e){return function(n){if($t()!==e)return;const i={category:"console",data:{arguments:n.args,logger:"console"},level:T1(n.level),message:Lu(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)i.message=`Assertion failed: ${Lu(n.args.slice(1)," ")||"console.assert"}`,i.data.arguments=n.args.slice(1);else return;Pi(i,{input:n.args,level:n.level})}}function RE(e){return function(n){if($t()!==e)return;const{startTimestamp:i,endTimestamp:o}=n,s=n.xhr[qo];if(!i||!o||!s)return;const{method:r,url:a,status_code:c,body:u}=s,d={method:r,url:a,status_code:c},m={xhr:n.xhr,input:u,startTimestamp:i,endTimestamp:o},f={category:"xhr",data:d,type:"http",level:Sh(c)};e.emit("beforeOutgoingRequestBreadcrumb",f,m),Pi(f,m)}}function qE(e){return function(n){if($t()!==e)return;const{startTimestamp:i,endTimestamp:o}=n;if(o&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const s=n.fetchData,r={data:n.error,input:n.args,startTimestamp:i,endTimestamp:o},a={category:"fetch",data:s,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,r),Pi(a,r)}else{const s=n.response,r={...n.fetchData,status_code:s==null?void 0:s.status};n.fetchData.request_body_size,n.fetchData.response_body_size,s==null||s.status;const a={input:n.args,response:s,startTimestamp:i,endTimestamp:o},c={category:"fetch",data:r,type:"http",level:Sh(r.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",c,a),Pi(c,a)}}}function BE(e){return function(n){if($t()!==e)return;let i=n.from,o=n.to;const s=Sa(kt.location.href);let r=i?Sa(i):void 0;const a=Sa(o);r!=null&&r.path||(r=s),s.protocol===a.protocol&&s.host===a.host&&(o=a.relative),s.protocol===r.protocol&&s.host===r.host&&(i=r.relative),Pi({category:"navigation",data:{from:i,to:o}})}}function LE(e){return!!e&&!!e.target}const OE=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],FE="BrowserApiErrors",HE=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:FE,setupOnce(){t.setTimeout&&Qt(kt,"setTimeout",Dd),t.setInterval&&Qt(kt,"setInterval",Dd),t.requestAnimationFrame&&Qt(kt,"requestAnimationFrame",GE),t.XMLHttpRequest&&"XMLHttpRequest"in kt&&Qt(XMLHttpRequest.prototype,"send",WE);const n=t.eventTarget;n&&(Array.isArray(n)?n:OE).forEach(o=>$E(o,t))}}}),zE=HE;function Dd(e){return function(...t){const n=t[0];return t[0]=co(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ri(e)}`}}),e.apply(this,t)}}function GE(e){return function(t){return e.apply(this,[co(t,{mechanism:{data:{handler:ri(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function WE(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in n&&typeof n[o]=="function"&&Qt(n,o,function(s){const r={mechanism:{data:{handler:ri(s)},handled:!1,type:`auto.browser.browserapierrors.xhr.${o}`}},a=gc(s);return a&&(r.mechanism.data.handler=ri(a)),co(s,r)})}),e.apply(this,t)}}function $E(e,t){var o,s;const i=(o=kt[e])==null?void 0:o.prototype;(s=i==null?void 0:i.hasOwnProperty)!=null&&s.call(i,"addEventListener")&&(Qt(i,"addEventListener",function(r){return function(a,c,u){try{XE(c)&&(c.handleEvent=co(c.handleEvent,{mechanism:{data:{handler:ri(c),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&KE(this,a,c),r.apply(this,[a,co(c,{mechanism:{data:{handler:ri(c),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),u])}}),Qt(i,"removeEventListener",function(r){return function(a,c,u){try{const d=c.__sentry_wrapped__;d&&r.call(this,a,d,u)}catch{}return r.call(this,a,c,u)}}))}function XE(e){return typeof e.handleEvent=="function"}function KE(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const YE=()=>({name:"BrowserSession",setupOnce(){if(typeof kt.document>"u"){ys&&me.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}ad({ignoreDuration:!0}),ld(),_h(({from:e,to:t})=>{e!==void 0&&e!==t&&(ad({ignoreDuration:!0}),ld())})}}),ZE="GlobalHandlers",QE=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:ZE,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(ek(n),_d("onerror")),t.onunhandledrejection&&(tk(n),_d("onunhandledrejection"))}}}),JE=QE;function ek(e){Fy(t=>{const{stackParser:n,attachStacktrace:i}=Ch();if($t()!==e||Th())return;const{msg:o,url:s,line:r,column:a,error:c}=t,u=ok(Sc(n,c||o,void 0,i,!1),s,r,a);u.level="error",lh(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function tk(e){zy(t=>{const{stackParser:n,attachStacktrace:i}=Ch();if($t()!==e||Th())return;const o=nk(t),s=Yr(o)?ik(o):Sc(n,o,void 0,i,!0);s.level="error",lh(s,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function nk(e){if(Yr(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function ik(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function ok(e,t,n,i){const o=e.exception=e.exception||{},s=o.values=o.values||[],r=s[0]=s[0]||{},a=r.stacktrace=r.stacktrace||{},c=a.frames=a.frames||[],u=i,d=n,m=sk(t)??hc();return c.length===0&&c.push({colno:u,filename:m,function:_i,in_app:!0,lineno:d}),e}function _d(e){ys&&me.log(`Global Handler attached: ${e}`)}function Ch(){const e=$t();return(e==null?void 0:e.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function sk(e){if(!(!qn(e)||e.length===0)){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/),n=t?t[1]:"text/javascript",i=e.includes("base64,");return`<data:${n}${i?",base64":""}>`}return e}}const rk=()=>({name:"HttpContext",preprocessEvent(e){var i;if(!kt.navigator&&!kt.location&&!kt.document)return;const t=F1(),n={...t.headers,...(i=e.request)==null?void 0:i.headers};e.request={...t,...e.request,headers:n}}}),ak="cause",lk=5,ck="LinkedErrors",uk=((e={})=>{const t=e.limit||lk,n=e.key||ak;return{name:ck,preprocessEvent(i,o,s){const r=s.getOptions();E1(Ec,r.stackParser,n,t,i,o)}}}),dk=uk,mk="SpotlightBrowser",pk=((e={})=>{const t=e.sidecarUrl||"http://localhost:8969/stream";return{name:mk,setup:()=>{ys&&me.log("Using Sidecar URL",t)},processEvent:n=>gk(n)?null:n,afterAllSetup:n=>{fk(n,t)}}});function fk(e,t){const n=jh("fetch");let i=0;e.on("beforeEnvelope",o=>{if(i>3){me.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",i);return}n(t,{method:"POST",body:rh(o),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(s=>{s.status>=200&&s.status<400&&(i=0)},s=>{i++,me.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",s)})})}const hk=pk;function gk(e){var t;return!!(e.type==="transaction"&&e.spans&&((t=e.contexts)!=null&&t.trace)&&e.contexts.trace.op==="ui.action.click"&&e.spans.some(({description:n})=>n==null?void 0:n.includes("#sentry-spotlight")))}function bk(){return xk()?(ys&&yo(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function xk(){var s;if(typeof kt.window>"u")return!1;const e=kt;if(e.nw)return!1;const t=e.chrome||e.browser;if(!((s=t==null?void 0:t.runtime)!=null&&s.id))return!1;const n=hc(),i=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(kt===kt.top&&i.some(r=>n.startsWith(`${r}://`)))}function Nk(e){return[h1(),d1(),zE(),ME(),JE(),dk(),j1(),rk(),YE()]}function yk(e={}){const t=!e.skipBrowserExtensionCheck&&bk();let n=e.defaultIntegrations==null?Nk():e.defaultIntegrations;if(e.spotlight){n||(n=[]);const o=typeof e.spotlight=="string"?{sidecarUrl:e.spotlight}:void 0;n.push(hk(o))}const i={...e,enabled:t?!1:e.enabled,stackParser:Ly(e.stackParser||PE),integrations:Uv({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||gE};return s1(eE,i)}function wk(e){const t={...e};return vh(t,"react"),jv("react",{version:p.version}),yk(t)}function hl(e,t,n){if(e&&e.length){const[i,o]=t,s=Math.PI/180*n,r=Math.cos(s),a=Math.sin(s);for(const c of e){const[u,d]=c;c[0]=(u-i)*r-(d-o)*a+i,c[1]=(u-i)*a+(d-o)*r+o}}}function vk(e,t,n){const i=[];e.forEach(o=>i.push(...o)),hl(i,t,n)}function Ek(e,t){return e[0]===t[0]&&e[1]===t[1]}function kk(e,t,n,i=1){const o=n,s=Math.max(t,.1),r=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,a=[0,0];if(o)for(const u of r)hl(u,a,o);const c=Sk(r,s,i);if(o){for(const u of r)hl(u,a,-o);vk(c,a,-o)}return c}function Sk(e,t,n){const i=[];for(const u of e){const d=[...u];Ek(d[0],d[d.length-1])||d.push([d[0][0],d[0][1]]),d.length>2&&i.push(d)}const o=[];t=Math.max(t,.1);const s=[];for(const u of i)for(let d=0;d<u.length-1;d++){const m=u[d],f=u[d+1];if(m[1]!==f[1]){const h=Math.min(m[1],f[1]);s.push({ymin:h,ymax:Math.max(m[1],f[1]),x:h===m[1]?m[0]:f[0],islope:(f[0]-m[0])/(f[1]-m[1])})}}if(s.sort((u,d)=>u.ymin<d.ymin?-1:u.ymin>d.ymin?1:u.x<d.x?-1:u.x>d.x?1:u.ymax===d.ymax?0:(u.ymax-d.ymax)/Math.abs(u.ymax-d.ymax)),!s.length)return o;let r=[],a=s[0].ymin,c=0;for(;r.length||s.length;){if(s.length){let u=-1;for(let m=0;m<s.length&&!(s[m].ymin>a);m++)u=m;s.splice(0,u+1).forEach(m=>{r.push({s:a,edge:m})})}if(r=r.filter(u=>!(u.edge.ymax<=a)),r.sort((u,d)=>u.edge.x===d.edge.x?0:(u.edge.x-d.edge.x)/Math.abs(u.edge.x-d.edge.x)),(n!==1||c%t===0)&&r.length>1)for(let u=0;u<r.length;u=u+2){const d=u+1;if(d>=r.length)break;const m=r[u].edge,f=r[d].edge;o.push([[Math.round(m.x),a],[Math.round(f.x),a]])}a+=n,r.forEach(u=>{u.edge.x=u.edge.x+n*u.edge.islope}),c++}return o}function ws(e,t){var n;const i=t.hachureAngle+90;let o=t.hachureGap;o<0&&(o=t.strokeWidth*4),o=Math.round(Math.max(o,.1));let s=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(s=o),kk(e,o,i,s||1)}class Tc{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){const i=ws(t,n);return{type:"fillSketch",ops:this.renderLines(i,n)}}renderLines(t,n){const i=[];for(const o of t)i.push(...this.helper.doubleLineOps(o[0][0],o[0][1],o[1][0],o[1][1],n));return i}}function ia(e){const t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}class Tk extends Tc{fillPolygons(t,n){let i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);const o=Object.assign({},n,{hachureGap:i}),s=ws(t,o),r=Math.PI/180*n.hachureAngle,a=[],c=i*.5*Math.cos(r),u=i*.5*Math.sin(r);for(const[m,f]of s)ia([m,f])&&a.push([[m[0]-c,m[1]+u],[...f]],[[m[0]+c,m[1]-u],[...f]]);return{type:"fillSketch",ops:this.renderLines(a,n)}}}class Dk extends Tc{fillPolygons(t,n){const i=this._fillPolygons(t,n),o=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),s=this._fillPolygons(t,o);return i.ops=i.ops.concat(s.ops),i}}class _k{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});const i=ws(t,n);return this.dotsOnLines(i,n)}dotsOnLines(t,n){const i=[];let o=n.hachureGap;o<0&&(o=n.strokeWidth*4),o=Math.max(o,.1);let s=n.fillWeight;s<0&&(s=n.strokeWidth/2);const r=o/4;for(const a of t){const c=ia(a),u=c/o,d=Math.ceil(u)-1,m=c-d*o,f=(a[0][0]+a[1][0])/2-o/4,h=Math.min(a[0][1],a[1][1]);for(let g=0;g<d;g++){const b=h+m+g*o,x=f-r+Math.random()*2*r,y=b-r+Math.random()*2*r,N=this.helper.ellipse(x,y,s,s,n);i.push(...N.ops)}}return{type:"fillSketch",ops:i}}}class jk{constructor(t){this.helper=t}fillPolygons(t,n){const i=ws(t,n);return{type:"fillSketch",ops:this.dashedLine(i,n)}}dashedLine(t,n){const i=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,o=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,s=[];return t.forEach(r=>{const a=ia(r),c=Math.floor(a/(i+o)),u=(a+o-c*(i+o))/2;let d=r[0],m=r[1];d[0]>m[0]&&(d=r[1],m=r[0]);const f=Math.atan((m[1]-d[1])/(m[0]-d[0]));for(let h=0;h<c;h++){const g=h*(i+o),b=g+i,x=[d[0]+g*Math.cos(f)+u*Math.cos(f),d[1]+g*Math.sin(f)+u*Math.sin(f)],y=[d[0]+b*Math.cos(f)+u*Math.cos(f),d[1]+b*Math.sin(f)+u*Math.sin(f)];s.push(...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],n))}}),s}}class Pk{constructor(t){this.helper=t}fillPolygons(t,n){const i=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,o=n.zigzagOffset<0?i:n.zigzagOffset;n=Object.assign({},n,{hachureGap:i+o});const s=ws(t,n);return{type:"fillSketch",ops:this.zigzagLines(s,o,n)}}zigzagLines(t,n,i){const o=[];return t.forEach(s=>{const r=ia(s),a=Math.round(r/(2*n));let c=s[0],u=s[1];c[0]>u[0]&&(c=s[1],u=s[0]);const d=Math.atan((u[1]-c[1])/(u[0]-c[0]));for(let m=0;m<a;m++){const f=m*2*n,h=(m+1)*2*n,g=Math.sqrt(2*Math.pow(n,2)),b=[c[0]+f*Math.cos(d),c[1]+f*Math.sin(d)],x=[c[0]+h*Math.cos(d),c[1]+h*Math.sin(d)],y=[b[0]+g*Math.cos(d+Math.PI/4),b[1]+g*Math.sin(d+Math.PI/4)];o.push(...this.helper.doubleLineOps(b[0],b[1],y[0],y[1],i),...this.helper.doubleLineOps(y[0],y[1],x[0],x[1],i))}}),o}}const Xt={};function Ck(e,t){let n=e.fillStyle||"hachure";if(!Xt[n])switch(n){case"zigzag":Xt[n]||(Xt[n]=new Tk(t));break;case"cross-hatch":Xt[n]||(Xt[n]=new Dk(t));break;case"dots":Xt[n]||(Xt[n]=new _k(t));break;case"dashed":Xt[n]||(Xt[n]=new jk(t));break;case"zigzag-line":Xt[n]||(Xt[n]=new Pk(t));break;case"hachure":default:n="hachure",Xt[n]||(Xt[n]=new Tc(t));break}return Xt[n]}function Ak(){return Math.floor(Math.random()*2**31)}class Mk{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const Ik=0,gl=1,Ah=2,Ps={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Vk(e){const t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:Ik,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:gl,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:Ah,text:""},t}function Da(e,t){return e.type===t}function Dc(e){const t=[],n=Vk(e);let i="BOD",o=0,s=n[o];for(;!Da(s,Ah);){let r=0;const a=[];if(i==="BOD")if(s.text==="M"||s.text==="m")o++,r=Ps[s.text],i=s.text;else return Dc("M0,0"+e);else Da(s,gl)?r=Ps[i]:(o++,r=Ps[s.text],i=s.text);if(o+r<n.length){for(let c=o;c<o+r;c++){const u=n[c];if(Da(u,gl))a[a.length]=+u.text;else throw new Error("Param not a number: "+i+","+u.text)}if(typeof Ps[i]=="number"){const c={key:i,data:a};t.push(c),o+=r,s=n[o],i==="M"&&(i="L"),i==="m"&&(i="l")}else throw new Error("Bad segment: "+i)}else throw new Error("Path data ended short")}return t}function Mh(e){let t=0,n=0,i=0,o=0;const s=[];for(const{key:r,data:a}of e)switch(r){case"M":s.push({key:"M",data:[...a]}),[t,n]=a,[i,o]=a;break;case"m":t+=a[0],n+=a[1],s.push({key:"M",data:[t,n]}),i=t,o=n;break;case"L":s.push({key:"L",data:[...a]}),[t,n]=a;break;case"l":t+=a[0],n+=a[1],s.push({key:"L",data:[t,n]});break;case"C":s.push({key:"C",data:[...a]}),t=a[4],n=a[5];break;case"c":{const c=a.map((u,d)=>d%2?u+n:u+t);s.push({key:"C",data:c}),t=c[4],n=c[5];break}case"Q":s.push({key:"Q",data:[...a]}),t=a[2],n=a[3];break;case"q":{const c=a.map((u,d)=>d%2?u+n:u+t);s.push({key:"Q",data:c}),t=c[2],n=c[3];break}case"A":s.push({key:"A",data:[...a]}),t=a[5],n=a[6];break;case"a":t+=a[5],n+=a[6],s.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,n]});break;case"H":s.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],s.push({key:"H",data:[t]});break;case"V":s.push({key:"V",data:[...a]}),n=a[0];break;case"v":n+=a[0],s.push({key:"V",data:[n]});break;case"S":s.push({key:"S",data:[...a]}),t=a[2],n=a[3];break;case"s":{const c=a.map((u,d)=>d%2?u+n:u+t);s.push({key:"S",data:c}),t=c[2],n=c[3];break}case"T":s.push({key:"T",data:[...a]}),t=a[0],n=a[1];break;case"t":t+=a[0],n+=a[1],s.push({key:"T",data:[t,n]});break;case"Z":case"z":s.push({key:"Z",data:[]}),t=i,n=o;break}return s}function Ih(e){const t=[];let n="",i=0,o=0,s=0,r=0,a=0,c=0;for(const{key:u,data:d}of e){switch(u){case"M":t.push({key:"M",data:[...d]}),[i,o]=d,[s,r]=d;break;case"C":t.push({key:"C",data:[...d]}),i=d[4],o=d[5],a=d[2],c=d[3];break;case"L":t.push({key:"L",data:[...d]}),[i,o]=d;break;case"H":i=d[0],t.push({key:"L",data:[i,o]});break;case"V":o=d[0],t.push({key:"L",data:[i,o]});break;case"S":{let m=0,f=0;n==="C"||n==="S"?(m=i+(i-a),f=o+(o-c)):(m=i,f=o),t.push({key:"C",data:[m,f,...d]}),a=d[0],c=d[1],i=d[2],o=d[3];break}case"T":{const[m,f]=d;let h=0,g=0;n==="Q"||n==="T"?(h=i+(i-a),g=o+(o-c)):(h=i,g=o);const b=i+2*(h-i)/3,x=o+2*(g-o)/3,y=m+2*(h-m)/3,N=f+2*(g-f)/3;t.push({key:"C",data:[b,x,y,N,m,f]}),a=h,c=g,i=m,o=f;break}case"Q":{const[m,f,h,g]=d,b=i+2*(m-i)/3,x=o+2*(f-o)/3,y=h+2*(m-h)/3,N=g+2*(f-g)/3;t.push({key:"C",data:[b,x,y,N,h,g]}),a=m,c=f,i=h,o=g;break}case"A":{const m=Math.abs(d[0]),f=Math.abs(d[1]),h=d[2],g=d[3],b=d[4],x=d[5],y=d[6];m===0||f===0?(t.push({key:"C",data:[i,o,x,y,x,y]}),i=x,o=y):(i!==x||o!==y)&&(Vh(i,o,x,y,m,f,h,g,b).forEach(function(w){t.push({key:"C",data:w})}),i=x,o=y);break}case"Z":t.push({key:"Z",data:[]}),i=s,o=r;break}n=u}return t}function Uk(e){return Math.PI*e/180}function So(e,t,n){const i=e*Math.cos(n)-t*Math.sin(n),o=e*Math.sin(n)+t*Math.cos(n);return[i,o]}function Vh(e,t,n,i,o,s,r,a,c,u){const d=Uk(r);let m=[],f=0,h=0,g=0,b=0;if(u)[f,h,g,b]=u;else{[e,t]=So(e,t,-d),[n,i]=So(n,i,-d);const R=(e-n)/2,M=(t-i)/2;let _=R*R/(o*o)+M*M/(s*s);_>1&&(_=Math.sqrt(_),o=_*o,s=_*s);const I=a===c?-1:1,P=o*o,Z=s*s,pe=P*Z-P*M*M-Z*R*R,A=P*M*M+Z*R*R,G=I*Math.sqrt(Math.abs(pe/A));g=G*o*M/s+(e+n)/2,b=G*-s*R/o+(t+i)/2,f=Math.asin(parseFloat(((t-b)/s).toFixed(9))),h=Math.asin(parseFloat(((i-b)/s).toFixed(9))),e<g&&(f=Math.PI-f),n<g&&(h=Math.PI-h),f<0&&(f=Math.PI*2+f),h<0&&(h=Math.PI*2+h),c&&f>h&&(f=f-Math.PI*2),!c&&h>f&&(h=h-Math.PI*2)}let x=h-f;if(Math.abs(x)>Math.PI*120/180){const R=h,M=n,_=i;c&&h>f?h=f+Math.PI*120/180*1:h=f+Math.PI*120/180*-1,n=g+o*Math.cos(h),i=b+s*Math.sin(h),m=Vh(n,i,M,_,o,s,r,0,c,[h,R,g,b])}x=h-f;const y=Math.cos(f),N=Math.sin(f),w=Math.cos(h),T=Math.sin(h),S=Math.tan(x/4),v=4/3*o*S,E=4/3*s*S,U=[e,t],q=[e+v*N,t-E*y],$=[n+v*T,i-E*w],V=[n,i];if(q[0]=2*U[0]-q[0],q[1]=2*U[1]-q[1],u)return[q,$,V].concat(m);{m=[q,$,V].concat(m);const R=[];for(let M=0;M<m.length;M+=3){const _=So(m[M][0],m[M][1],d),I=So(m[M+1][0],m[M+1][1],d),P=So(m[M+2][0],m[M+2][1],d);R.push([_[0],_[1],I[0],I[1],P[0],P[1]])}return R}}const Rk={randOffset:Fk,randOffsetWithRange:Hk,ellipse:Lk,doubleLineOps:zk};function Uh(e,t,n,i,o){return{type:"path",ops:li(e,t,n,i,o)}}function Ys(e,t,n){const i=(e||[]).length;if(i>2){const o=[];for(let s=0;s<i-1;s++)o.push(...li(e[s][0],e[s][1],e[s+1][0],e[s+1][1],n));return t&&o.push(...li(e[i-1][0],e[i-1][1],e[0][0],e[0][1],n)),{type:"path",ops:o}}else if(i===2)return Uh(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function qk(e,t){return Ys(e,!0,t)}function Bk(e,t,n,i,o){const s=[[e,t],[e+n,t],[e+n,t+i],[e,t+i]];return qk(s,o)}function jd(e,t){if(e.length){const i=typeof e[0][0]=="number"?[e]:e,o=Cs(i[0],1*(1+t.roughness*.2),t),s=t.disableMultiStroke?[]:Cs(i[0],1.5*(1+t.roughness*.22),Ad(t));for(let r=1;r<i.length;r++){const a=i[r];if(a.length){const c=Cs(a,1*(1+t.roughness*.2),t),u=t.disableMultiStroke?[]:Cs(a,1.5*(1+t.roughness*.22),Ad(t));for(const d of c)d.op!=="move"&&o.push(d);for(const d of u)d.op!=="move"&&s.push(d)}}return{type:"path",ops:o.concat(s)}}return{type:"path",ops:[]}}function Lk(e,t,n,i,o){const s=Rh(n,i,o);return bl(e,t,o,s).opset}function Rh(e,t,n){const i=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),o=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*i)),s=Math.PI*2/o;let r=Math.abs(e/2),a=Math.abs(t/2);const c=1-n.curveFitting;return r+=he(r*c,n),a+=he(a*c,n),{increment:s,rx:r,ry:a}}function bl(e,t,n,i){const[o,s]=Md(i.increment,e,t,i.rx,i.ry,1,i.increment*pr(.1,pr(.4,1,n),n),n);let r=fr(o,null,n);if(!n.disableMultiStroke&&n.roughness!==0){const[a]=Md(i.increment,e,t,i.rx,i.ry,1.5,0,n),c=fr(a,null,n);r=r.concat(c)}return{estimatedPoints:s,opset:{type:"path",ops:r}}}function Pd(e,t,n,i,o,s,r,a,c){const u=e,d=t;let m=Math.abs(n/2),f=Math.abs(i/2);m+=he(m*.01,c),f+=he(f*.01,c);let h=o,g=s;for(;h<0;)h+=Math.PI*2,g+=Math.PI*2;g-h>Math.PI*2&&(h=0,g=Math.PI*2);const b=Math.PI*2/c.curveStepCount,x=Math.min(b/2,(g-h)/2),y=Id(x,u,d,m,f,h,g,1,c);if(!c.disableMultiStroke){const N=Id(x,u,d,m,f,h,g,1.5,c);y.push(...N)}return r&&(a?y.push(...li(u,d,u+m*Math.cos(h),d+f*Math.sin(h),c),...li(u,d,u+m*Math.cos(g),d+f*Math.sin(g),c)):y.push({op:"lineTo",data:[u,d]},{op:"lineTo",data:[u+m*Math.cos(h),d+f*Math.sin(h)]})),{type:"path",ops:y}}function Cd(e,t){const n=Ih(Mh(Dc(e))),i=[];let o=[0,0],s=[0,0];for(const{key:r,data:a}of n)switch(r){case"M":{s=[a[0],a[1]],o=[a[0],a[1]];break}case"L":i.push(...li(s[0],s[1],a[0],a[1],t)),s=[a[0],a[1]];break;case"C":{const[c,u,d,m,f,h]=a;i.push(...Gk(c,u,d,m,f,h,s,t)),s=[f,h];break}case"Z":i.push(...li(s[0],s[1],o[0],o[1],t)),s=[o[0],o[1]];break}return{type:"path",ops:i}}function _a(e,t){const n=[];for(const i of e)if(i.length){const o=t.maxRandomnessOffset||0,s=i.length;if(s>2){n.push({op:"move",data:[i[0][0]+he(o,t),i[0][1]+he(o,t)]});for(let r=1;r<s;r++)n.push({op:"lineTo",data:[i[r][0]+he(o,t),i[r][1]+he(o,t)]})}}return{type:"fillPath",ops:n}}function zi(e,t){return Ck(t,Rk).fillPolygons(e,t)}function Ok(e,t,n,i,o,s,r){const a=e,c=t;let u=Math.abs(n/2),d=Math.abs(i/2);u+=he(u*.01,r),d+=he(d*.01,r);let m=o,f=s;for(;m<0;)m+=Math.PI*2,f+=Math.PI*2;f-m>Math.PI*2&&(m=0,f=Math.PI*2);const h=(f-m)/r.curveStepCount,g=[];for(let b=m;b<=f;b=b+h)g.push([a+u*Math.cos(b),c+d*Math.sin(b)]);return g.push([a+u*Math.cos(f),c+d*Math.sin(f)]),g.push([a,c]),zi([g],r)}function Fk(e,t){return he(e,t)}function Hk(e,t,n){return pr(e,t,n)}function zk(e,t,n,i,o){return li(e,t,n,i,o,!0)}function Ad(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function qh(e){return e.randomizer||(e.randomizer=new Mk(e.seed||0)),e.randomizer.next()}function pr(e,t,n,i=1){return n.roughness*i*(qh(n)*(t-e)+e)}function he(e,t,n=1){return pr(-e,e,t,n)}function li(e,t,n,i,o,s=!1){const r=s?o.disableMultiStrokeFill:o.disableMultiStroke,a=xl(e,t,n,i,o,!0,!1);if(r)return a;const c=xl(e,t,n,i,o,!0,!0);return a.concat(c)}function xl(e,t,n,i,o,s,r){const a=Math.pow(e-n,2)+Math.pow(t-i,2),c=Math.sqrt(a);let u=1;c<200?u=1:c>500?u=.4:u=-.0016668*c+1.233334;let d=o.maxRandomnessOffset||0;d*d*100>a&&(d=c/10);const m=d/2,f=.2+qh(o)*.2;let h=o.bowing*o.maxRandomnessOffset*(i-t)/200,g=o.bowing*o.maxRandomnessOffset*(e-n)/200;h=he(h,o,u),g=he(g,o,u);const b=[],x=()=>he(m,o,u),y=()=>he(d,o,u),N=o.preserveVertices;return r?b.push({op:"move",data:[e+(N?0:x()),t+(N?0:x())]}):b.push({op:"move",data:[e+(N?0:he(d,o,u)),t+(N?0:he(d,o,u))]}),r?b.push({op:"bcurveTo",data:[h+e+(n-e)*f+x(),g+t+(i-t)*f+x(),h+e+2*(n-e)*f+x(),g+t+2*(i-t)*f+x(),n+(N?0:x()),i+(N?0:x())]}):b.push({op:"bcurveTo",data:[h+e+(n-e)*f+y(),g+t+(i-t)*f+y(),h+e+2*(n-e)*f+y(),g+t+2*(i-t)*f+y(),n+(N?0:y()),i+(N?0:y())]}),b}function Cs(e,t,n){if(!e.length)return[];const i=[];i.push([e[0][0]+he(t,n),e[0][1]+he(t,n)]),i.push([e[0][0]+he(t,n),e[0][1]+he(t,n)]);for(let o=1;o<e.length;o++)i.push([e[o][0]+he(t,n),e[o][1]+he(t,n)]),o===e.length-1&&i.push([e[o][0]+he(t,n),e[o][1]+he(t,n)]);return fr(i,null,n)}function fr(e,t,n){const i=e.length,o=[];if(i>3){const s=[],r=1-n.curveTightness;o.push({op:"move",data:[e[1][0],e[1][1]]});for(let a=1;a+2<i;a++){const c=e[a];s[0]=[c[0],c[1]],s[1]=[c[0]+(r*e[a+1][0]-r*e[a-1][0])/6,c[1]+(r*e[a+1][1]-r*e[a-1][1])/6],s[2]=[e[a+1][0]+(r*e[a][0]-r*e[a+2][0])/6,e[a+1][1]+(r*e[a][1]-r*e[a+2][1])/6],s[3]=[e[a+1][0],e[a+1][1]],o.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else i===3?(o.push({op:"move",data:[e[1][0],e[1][1]]}),o.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):i===2&&o.push(...xl(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return o}function Md(e,t,n,i,o,s,r,a){const c=a.roughness===0,u=[],d=[];if(c){e=e/4,d.push([t+i*Math.cos(-e),n+o*Math.sin(-e)]);for(let m=0;m<=Math.PI*2;m=m+e){const f=[t+i*Math.cos(m),n+o*Math.sin(m)];u.push(f),d.push(f)}d.push([t+i*Math.cos(0),n+o*Math.sin(0)]),d.push([t+i*Math.cos(e),n+o*Math.sin(e)])}else{const m=he(.5,a)-Math.PI/2;d.push([he(s,a)+t+.9*i*Math.cos(m-e),he(s,a)+n+.9*o*Math.sin(m-e)]);const f=Math.PI*2+m-.01;for(let h=m;h<f;h=h+e){const g=[he(s,a)+t+i*Math.cos(h),he(s,a)+n+o*Math.sin(h)];u.push(g),d.push(g)}d.push([he(s,a)+t+i*Math.cos(m+Math.PI*2+r*.5),he(s,a)+n+o*Math.sin(m+Math.PI*2+r*.5)]),d.push([he(s,a)+t+.98*i*Math.cos(m+r),he(s,a)+n+.98*o*Math.sin(m+r)]),d.push([he(s,a)+t+.9*i*Math.cos(m+r*.5),he(s,a)+n+.9*o*Math.sin(m+r*.5)])}return[d,u]}function Id(e,t,n,i,o,s,r,a,c){const u=s+he(.1,c),d=[];d.push([he(a,c)+t+.9*i*Math.cos(u-e),he(a,c)+n+.9*o*Math.sin(u-e)]);for(let m=u;m<=r;m=m+e)d.push([he(a,c)+t+i*Math.cos(m),he(a,c)+n+o*Math.sin(m)]);return d.push([t+i*Math.cos(r),n+o*Math.sin(r)]),d.push([t+i*Math.cos(r),n+o*Math.sin(r)]),fr(d,null,c)}function Gk(e,t,n,i,o,s,r,a){const c=[],u=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let d=[0,0];const m=a.disableMultiStroke?1:2,f=a.preserveVertices;for(let h=0;h<m;h++)h===0?c.push({op:"move",data:[r[0],r[1]]}):c.push({op:"move",data:[r[0]+(f?0:he(u[0],a)),r[1]+(f?0:he(u[0],a))]}),d=f?[o,s]:[o+he(u[h],a),s+he(u[h],a)],c.push({op:"bcurveTo",data:[e+he(u[h],a),t+he(u[h],a),n+he(u[h],a),i+he(u[h],a),d[0],d[1]]});return c}function To(e){return[...e]}function Vd(e,t=0){const n=e.length;if(n<3)throw new Error("A curve must have at least three points.");const i=[];if(n===3)i.push(To(e[0]),To(e[1]),To(e[2]),To(e[2]));else{const o=[];o.push(e[0],e[0]);for(let a=1;a<e.length;a++)o.push(e[a]),a===e.length-1&&o.push(e[a]);const s=[],r=1-t;i.push(To(o[0]));for(let a=1;a+2<o.length;a++){const c=o[a];s[0]=[c[0],c[1]],s[1]=[c[0]+(r*o[a+1][0]-r*o[a-1][0])/6,c[1]+(r*o[a+1][1]-r*o[a-1][1])/6],s[2]=[o[a+1][0]+(r*o[a][0]-r*o[a+2][0])/6,o[a+1][1]+(r*o[a][1]-r*o[a+2][1])/6],s[3]=[o[a+1][0],o[a+1][1]],i.push(s[1],s[2],s[3])}}return i}function Wk(e,t){return Math.sqrt(Zs(e,t))}function Zs(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function $k(e,t,n){const i=Zs(t,n);if(i===0)return Zs(e,t);let o=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/i;return o=Math.max(0,Math.min(1,o)),Zs(e,gi(t,n,o))}function gi(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Xk(e,t){const n=e[t+0],i=e[t+1],o=e[t+2],s=e[t+3];let r=3*i[0]-2*n[0]-s[0];r*=r;let a=3*i[1]-2*n[1]-s[1];a*=a;let c=3*o[0]-2*s[0]-n[0];c*=c;let u=3*o[1]-2*s[1]-n[1];return u*=u,r<c&&(r=c),a<u&&(a=u),r+a}function Nl(e,t,n,i){const o=i||[];if(Xk(e,t)<n){const s=e[t+0];o.length?Wk(o[o.length-1],s)>1&&o.push(s):o.push(s),o.push(e[t+3])}else{const r=e[t+0],a=e[t+1],c=e[t+2],u=e[t+3],d=gi(r,a,.5),m=gi(a,c,.5),f=gi(c,u,.5),h=gi(d,m,.5),g=gi(m,f,.5),b=gi(h,g,.5);Nl([r,d,h,b],0,n,o),Nl([b,g,f,u],0,n,o)}return o}function Kk(e,t){return hr(e,0,e.length,t)}function hr(e,t,n,i,o){const s=o||[],r=e[t],a=e[n-1];let c=0,u=1;for(let d=t+1;d<n-1;++d){const m=$k(e[d],r,a);m>c&&(c=m,u=d)}return Math.sqrt(c)>i?(hr(e,t,u+1,i,s),hr(e,u,n,i,s)):(s.length||s.push(r),s.push(a)),s}function yl(e,t=.15,n){const i=[],o=(e.length-1)/3;for(let s=0;s<o;s++){const r=s*3;Nl(e,r,t,i)}return n&&n>0?hr(i,0,i.length,n):i}function Yk(e,t,n){const i=Dc(e),o=Ih(Mh(i)),s=[];let r=[],a=[0,0],c=[];const u=()=>{c.length>=4&&r.push(...yl(c,t)),c=[]},d=()=>{u(),r.length&&(s.push(r),r=[])};for(const{key:f,data:h}of o)switch(f){case"M":d(),a=[h[0],h[1]],r.push(a);break;case"L":u(),r.push([h[0],h[1]]);break;case"C":if(!c.length){const g=r.length?r[r.length-1]:a;c.push([g[0],g[1]])}c.push([h[0],h[1]]),c.push([h[2],h[3]]),c.push([h[4],h[5]]);break;case"Z":u(),r.push([a[0],a[1]]);break}if(d(),!n)return s;const m=[];for(const f of s){const h=Kk(f,n);h.length&&m.push(h)}return m}const Zt="none";class gr{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Ak()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,i){return{shape:t,sets:n||[],options:i||this.defaultOptions}}line(t,n,i,o,s){const r=this._o(s);return this._d("line",[Uh(t,n,i,o,r)],r)}rectangle(t,n,i,o,s){const r=this._o(s),a=[],c=Bk(t,n,i,o,r);if(r.fill){const u=[[t,n],[t+i,n],[t+i,n+o],[t,n+o]];r.fillStyle==="solid"?a.push(_a([u],r)):a.push(zi([u],r))}return r.stroke!==Zt&&a.push(c),this._d("rectangle",a,r)}ellipse(t,n,i,o,s){const r=this._o(s),a=[],c=Rh(i,o,r),u=bl(t,n,r,c);if(r.fill)if(r.fillStyle==="solid"){const d=bl(t,n,r,c).opset;d.type="fillPath",a.push(d)}else a.push(zi([u.estimatedPoints],r));return r.stroke!==Zt&&a.push(u.opset),this._d("ellipse",a,r)}circle(t,n,i,o){const s=this.ellipse(t,n,i,i,o);return s.shape="circle",s}linearPath(t,n){const i=this._o(n);return this._d("linearPath",[Ys(t,!1,i)],i)}arc(t,n,i,o,s,r,a=!1,c){const u=this._o(c),d=[],m=Pd(t,n,i,o,s,r,a,!0,u);if(a&&u.fill)if(u.fillStyle==="solid"){const f=Object.assign({},u);f.disableMultiStroke=!0;const h=Pd(t,n,i,o,s,r,!0,!1,f);h.type="fillPath",d.push(h)}else d.push(Ok(t,n,i,o,s,r,u));return u.stroke!==Zt&&d.push(m),this._d("arc",d,u)}curve(t,n){const i=this._o(n),o=[],s=jd(t,i);if(i.fill&&i.fill!==Zt)if(i.fillStyle==="solid"){const r=jd(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));o.push({type:"fillPath",ops:this._mergedShape(r.ops)})}else{const r=[],a=t;if(a.length){const u=typeof a[0][0]=="number"?[a]:a;for(const d of u)d.length<3?r.push(...d):d.length===3?r.push(...yl(Vd([d[0],d[0],d[1],d[2]]),10,(1+i.roughness)/2)):r.push(...yl(Vd(d),10,(1+i.roughness)/2))}r.length&&o.push(zi([r],i))}return i.stroke!==Zt&&o.push(s),this._d("curve",o,i)}polygon(t,n){const i=this._o(n),o=[],s=Ys(t,!0,i);return i.fill&&(i.fillStyle==="solid"?o.push(_a([t],i)):o.push(zi([t],i))),i.stroke!==Zt&&o.push(s),this._d("polygon",o,i)}path(t,n){const i=this._o(n),o=[];if(!t)return this._d("path",o,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=i.fill&&i.fill!=="transparent"&&i.fill!==Zt,r=i.stroke!==Zt,a=!!(i.simplification&&i.simplification<1),c=a?4-4*(i.simplification||1):(1+i.roughness)/2,u=Yk(t,1,c),d=Cd(t,i);if(s)if(i.fillStyle==="solid")if(u.length===1){const m=Cd(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));o.push({type:"fillPath",ops:this._mergedShape(m.ops)})}else o.push(_a(u,i));else o.push(zi(u,i));return r&&(a?u.forEach(m=>{o.push(Ys(m,!1,i))}):o.push(d)),this._d("path",o,i)}opsToPath(t,n){let i="";for(const o of t.ops){const s=typeof n=="number"&&n>=0?o.data.map(r=>+r.toFixed(n)):o.data;switch(o.op){case"move":i+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":i+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":i+=`L${s[0]} ${s[1]} `;break}}return i.trim()}toPaths(t){const n=t.sets||[],i=t.options||this.defaultOptions,o=[];for(const s of n){let r=null;switch(s.type){case"path":r={d:this.opsToPath(s),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:Zt};break;case"fillPath":r={d:this.opsToPath(s),stroke:Zt,strokeWidth:0,fill:i.fill||Zt};break;case"fillSketch":r=this.fillSketch(s,i);break}r&&o.push(r)}return o}fillSketch(t,n){let i=n.fillWeight;return i<0&&(i=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||Zt,strokeWidth:i,fill:Zt}}_mergedShape(t){return t.filter((n,i)=>i===0?!0:n.op!=="move")}}class Zk{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new gr(n)}draw(t){const n=t.sets||[],i=t.options||this.getDefaultOptions(),o=this.ctx,s=t.options.fixedDecimalPlaceDigits;for(const r of n)switch(r.type){case"path":o.save(),o.strokeStyle=i.stroke==="none"?"transparent":i.stroke,o.lineWidth=i.strokeWidth,i.strokeLineDash&&o.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(o.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(o,r,s),o.restore();break;case"fillPath":{o.save(),o.fillStyle=i.fill||"";const a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(o,r,s,a),o.restore();break}case"fillSketch":this.fillSketch(o,r,i);break}}fillSketch(t,n,i){let o=i.fillWeight;o<0&&(o=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=o,this._drawToContext(t,n,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,i,o="nonzero"){t.beginPath();for(const s of n.ops){const r=typeof i=="number"&&i>=0?s.data.map(a=>+a.toFixed(i)):s.data;switch(s.op){case"move":t.moveTo(r[0],r[1]);break;case"bcurveTo":t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"lineTo":t.lineTo(r[0],r[1]);break}}n.type==="fillPath"?t.fill(o):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,i,o,s){const r=this.gen.line(t,n,i,o,s);return this.draw(r),r}rectangle(t,n,i,o,s){const r=this.gen.rectangle(t,n,i,o,s);return this.draw(r),r}ellipse(t,n,i,o,s){const r=this.gen.ellipse(t,n,i,o,s);return this.draw(r),r}circle(t,n,i,o){const s=this.gen.circle(t,n,i,o);return this.draw(s),s}linearPath(t,n){const i=this.gen.linearPath(t,n);return this.draw(i),i}polygon(t,n){const i=this.gen.polygon(t,n);return this.draw(i),i}arc(t,n,i,o,s,r,a=!1,c){const u=this.gen.arc(t,n,i,o,s,r,a,c);return this.draw(u),u}curve(t,n){const i=this.gen.curve(t,n);return this.draw(i),i}path(t,n){const i=this.gen.path(t,n);return this.draw(i),i}}const As="http://www.w3.org/2000/svg";class Qk{constructor(t,n){this.svg=t,this.gen=new gr(n)}draw(t){const n=t.sets||[],i=t.options||this.getDefaultOptions(),o=this.svg.ownerDocument||window.document,s=o.createElementNS(As,"g"),r=t.options.fixedDecimalPlaceDigits;for(const a of n){let c=null;switch(a.type){case"path":{c=o.createElementNS(As,"path"),c.setAttribute("d",this.opsToPath(a,r)),c.setAttribute("stroke",i.stroke),c.setAttribute("stroke-width",i.strokeWidth+""),c.setAttribute("fill","none"),i.strokeLineDash&&c.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&c.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break}case"fillPath":{c=o.createElementNS(As,"path"),c.setAttribute("d",this.opsToPath(a,r)),c.setAttribute("stroke","none"),c.setAttribute("stroke-width","0"),c.setAttribute("fill",i.fill||""),(t.shape==="curve"||t.shape==="polygon")&&c.setAttribute("fill-rule","evenodd");break}case"fillSketch":{c=this.fillSketch(o,a,i);break}}c&&s.appendChild(c)}return s}fillSketch(t,n,i){let o=i.fillWeight;o<0&&(o=i.strokeWidth/2);const s=t.createElementNS(As,"path");return s.setAttribute("d",this.opsToPath(n,i.fixedDecimalPlaceDigits)),s.setAttribute("stroke",i.fill||""),s.setAttribute("stroke-width",o+""),s.setAttribute("fill","none"),i.fillLineDash&&s.setAttribute("stroke-dasharray",i.fillLineDash.join(" ").trim()),i.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${i.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,i,o,s){const r=this.gen.line(t,n,i,o,s);return this.draw(r)}rectangle(t,n,i,o,s){const r=this.gen.rectangle(t,n,i,o,s);return this.draw(r)}ellipse(t,n,i,o,s){const r=this.gen.ellipse(t,n,i,o,s);return this.draw(r)}circle(t,n,i,o){const s=this.gen.circle(t,n,i,o);return this.draw(s)}linearPath(t,n){const i=this.gen.linearPath(t,n);return this.draw(i)}polygon(t,n){const i=this.gen.polygon(t,n);return this.draw(i)}arc(t,n,i,o,s,r,a=!1,c){const u=this.gen.arc(t,n,i,o,s,r,a,c);return this.draw(u)}curve(t,n){const i=this.gen.curve(t,n);return this.draw(i)}path(t,n){const i=this.gen.path(t,n);return this.draw(i)}}const Jk={canvas(e,t){return new Zk(e,t)},svg(e,t){return new Qk(e,t)},generator(e){return new gr(e)},newSeed(){return gr.newSeed()}};var Bh=function(e){return typeof e=="function"};function Ud(e,t){if(e===t)return!0;for(var n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Lh(e){var t=p.useRef(e);return t.current=e,t}var eS=function(e){Bh(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e));var t=Lh(e);p.useEffect(function(){return function(){t.current()}},[])},tS=!!(typeof window<"u"&&window.document&&window.document.createElement);function Oh(e,t){if(tS){if(!e)return t;var n;return Bh(e)?n=e():"current"in e?n=e.current:n=e,n}}var nS=function(e){var t=function(n,i,o){var s=p.useRef(!1),r=p.useRef([]),a=p.useRef([]),c=p.useRef(void 0);e(function(){var u,d=Array.isArray(o)?o:[o],m=d.map(function(f){return Oh(f)});if(!s.current){s.current=!0,r.current=m,a.current=i,c.current=n();return}(m.length!==r.current.length||!Ud(r.current,m)||!Ud(a.current,i))&&((u=c.current)===null||u===void 0||u.call(c),r.current=m,a.current=i,c.current=n())}),eS(function(){var u;(u=c.current)===null||u===void 0||u.call(c),s.current=!1})};return t},iS=nS(p.useEffect);function Rt(e,t,n){n===void 0&&(n={});var i=n.enable,o=i===void 0?!0:i,s=Lh(t);iS(function(){if(o){var r=Oh(n.target,window);if(r!=null&&r.addEventListener){var a=function(u){return s.current(u)},c=Array.isArray(e)?e:[e];return c.forEach(function(u){r.addEventListener(u,a,{capture:n.capture,once:n.once,passive:n.passive})}),function(){c.forEach(function(u){r.removeEventListener(u,a,{capture:n.capture})})}}}},[e,n.capture,n.once,n.passive,o],n.target)}const oS=(e,t,n)=>{Rt("pointerdown",i=>{e.pointerDown(i)},{target:n}),Rt("pointermove",i=>{Jc.set(e,[i.x,i.y]),e.pointerMove(i)},{target:t}),Rt("pointerleave",i=>{Jc.delete(e),e.pointerLeave(i)},{target:t}),Rt("pointerup",i=>{e.pointerUp(i)},{target:t}),Rt("dblclick",i=>{F.isFocus(e)&&!F.hasBeenTextEditing(e)&&e.dblClick(i)},{target:n}),Rt("pointermove",i=>{vb.set(e,[i.x,i.y]),e.globalPointerMove(i)}),Rt("pointerup",i=>{e.globalPointerUp(i)}),Rt("keydown",i=>{e.globalKeyDown(i),F.isFocus(e)&&!F.hasBeenTextEditing(e)&&!Eb(i.target)&&e.keyDown(i)}),Rt("keyup",i=>{F.isFocus(e)&&!F.hasBeenTextEditing(e)&&(e==null||e.keyUp(i))}),Rt("copy",i=>{F.isFocus(e)&&!F.hasBeenTextEditing(e)&&(i.preventDefault(),eu(e,fa.copy,i.clipboardData))}),Rt("paste",async i=>{if(F.isFocus(e)&&!F.isReadonly(e)&&!F.hasBeenTextEditing(e)){const o=F.getMovingPointInBoard(e);if(o){const s=Ft(e,Ht(e,o[0],o[1])),r=await kb(i.clipboardData);e.insertFragment(r,s,fa.paste)}}}),Rt("cut",i=>{F.isFocus(e)&&!F.isReadonly(e)&&!F.hasBeenTextEditing(e)&&(i.preventDefault(),eu(e,fa.cut,i.clipboardData),Wa(e))}),Rt("drop",i=>{F.isReadonly(e)||(i.preventDefault(),e.drop(i))},{target:t}),Rt("dragover",i=>{i.preventDefault()},{target:t})},sS=(e,t)=>{Rt("scroll",i=>{if(Sb(e))Tb(e,!1);else{const o=i.target;if(!o)return;const{scrollLeft:s,scrollTop:r}=o;Db(e,s,r)}},{target:t}),Rt("touchstart",i=>{i.preventDefault()},{target:t,passive:!1}),Rt("wheel",i=>{if(i.metaKey||i.ctrlKey){i.preventDefault();const{deltaX:o,deltaY:s}=i,r=e.viewport.zoom,a=Math.sign(s),c=_b*100,u=Math.abs(s);let d=s;u>c&&(d=c*a);let m=r-d/100;m+=Math.log10(Math.max(1,r))*-a*Math.min(1,u/20),fe.updateZoom(e,m,F.getMovingPointInBoard(e))}},{target:t,passive:!1});const n=p.useRef(!1);p.useEffect(()=>{const i=new ResizeObserver(()=>{if(!n.current){n.current=!0;return}Ep(e),Yo(e),or(e)});return i.observe(F.getBoardContainer(e)),()=>{i&&i.disconnect()}},[])},_c=p.createContext(null),xt=()=>{const e=p.useContext(_c);if(!e)throw new Error("The `useBoard` hook must be used inside the <Plait> component's context.");const{board:t}=e;return t},Fh=()=>{const e=p.useContext(_c);if(!e)throw new Error("The `useBoard` hook must be used inside the <Plait> component's context.");const{listRender:t}=e;return t},rS=({style:e,className:t,children:n,afterInit:i})=>{var g,b;const o=p.useRef(null),s=p.useRef(null),r=p.useRef(null),a=p.useRef(null),c=p.useRef(null),u=p.useRef(null),d=p.useRef(null),m=p.useRef(null),f=xt(),h=Fh();return p.useEffect(()=>{const x=Jk.svg(o.current,{options:{roughness:0,strokeWidth:1}});tu.set(f,x),nu.set(f,o.current),iu.set(f,!0),ou.set(f,{lowerHost:s.current,host:r.current,upperHost:a.current,topHost:c.current,activeHost:u.current,container:m.current,viewportContainer:d.current});const y=new jb;return su.set(f,y),ru.set(f,new Map),h.initialized||(h.initialize(f.children,{board:f,parent:f,parentG:F.getElementHost(f)}),i&&i(f)),Ep(f),Yo(f),Pb(f),()=>{su.delete(f),$a.delete(f),Xa.delete(f),ou.delete(f),iu.delete(f),nu.delete(f),tu.delete(f),ru.delete(f)}},[]),oS(f,d,o),sS(f,d),l.jsxDEV("div",{className:Y(t,Cb,`${aS()}`,`theme-${(g=f.theme)==null?void 0:g.themeColorMode}`,`pointer-${f.pointer}`,{focused:F.isFocus(f),readonly:F.isReadonly(f),"disabled-scroll":((b=f.options)==null?void 0:b.disabledScrollOnNonFocus)&&!F.isFocus(f)}),ref:m,style:e,children:l.jsxDEV("div",{className:"viewport-container",ref:d,style:{width:"100%",height:"100%",overflow:"auto"},children:[l.jsxDEV("svg",{ref:o,width:"100%",height:"100%",style:{position:"relative"},className:"board-host-svg",children:[l.jsxDEV("g",{className:"element-lower-host",ref:s},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:136,columnNumber:11},void 0),l.jsxDEV("g",{className:"element-host",ref:r},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:137,columnNumber:11},void 0),l.jsxDEV("g",{className:"element-upper-host",ref:a},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:138,columnNumber:11},void 0),l.jsxDEV("g",{className:"element-top-host",ref:c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:139,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:129,columnNumber:9},void 0),l.jsxDEV("svg",{width:"100%",height:"100%",className:"board-active-svg",children:l.jsxDEV("g",{className:"active-host-g",ref:u},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:142,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:141,columnNumber:9},void 0),n]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:124,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/board.tsx",lineNumber:106,columnNumber:5},void 0)},aS=()=>Ab?"safari":Mb?"chrome":Ib?"firefox":"",lS=e=>{const t=e;return t.renderText=(n,i)=>{const o=jr.createRoot(n);let s;const r=l.jsxDEV(au,{...i,afterInit:u=>{s=u,i.afterInit&&i.afterInit(u)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/plugins/with-react.tsx",lineNumber:22,columnNumber:7},void 0);o.render(r);let a={...i};return{destroy:()=>{setTimeout(()=>{o.unmount()},0)},update:u=>{if(!(u&&a&&!Object.keys(u).every(f=>u[f]===a[f])))return;const m=En.isReadOnly(s);a={...a,...u},o.render(l.jsxDEV(au,{...a},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/plugins/with-react.tsx",lineNumber:52,columnNumber:21},void 0)),m===!0&&a.readonly===!1?setTimeout(()=>{En.focus(s)},0):m===!1&&a.readonly===!0&&(En.blur(s),En.deselect(s))}}},t},cS=e=>{const{pointerDown:t,pointerMove:n,pointerUp:i,globalPointerUp:o}=e,s=[];let r=!1;return e.pointerDown=a=>{const c=[a.clientX,a.clientY];s.length<2&&(e.viewport.zoom,s.push({pointerId:a.pointerId,lastPoint:c,currentPoint:c,hasMoved:!1})),t(a)},e.pointerMove=a=>{const c=[a.clientX,a.clientY];if(s.length>=2){const u=s.find(d=>d.pointerId===a.pointerId);if(u&&(u.currentPoint=c,u.hasMoved=!0,s.length===2&&s.every(d=>d.hasMoved))){const d=s[0],m=s[1],f=lu(...d.lastPoint,...m.lastPoint),h=lu(...d.currentPoint,...m.currentPoint),g=h[0]-f[0],b=h[1]-f[1],x=F.getBoardContainer(e).getBoundingClientRect(),y=x.width/2,N=x.height/2,w=e.viewport.zoom,T=Pr(e);let S=T[0]+y/w-g/w,v=T[1]+N/w-b/w,E=[S-x.width/2/w,v-x.height/2/w],U=w;const q=sr(...d.lastPoint,...m.lastPoint),V=sr(...d.currentPoint,...m.currentPoint)/q,R=[d.currentPoint[0]-d.lastPoint[0],d.currentPoint[1]-d.lastPoint[1]],M=[m.currentPoint[0]-m.lastPoint[0],m.currentPoint[1]-m.lastPoint[1]],_=R[0]*M[0]+R[1]*M[1],I=Math.sqrt(R[0]*R[0]+R[1]*R[1]),P=Math.sqrt(M[0]*M[0]+M[1]*M[1]),Z=_/(I*P||1);if(Z<-.7||Z<=.8&&r&&V>=.01?r=!0:r=!1,r){U=Math.min(Math.max(e.viewport.zoom*V,Vb),Ub);const A=F.getBoardContainer(e).getBoundingClientRect(),G=h[0]-A.x,ce=h[1]-A.y;S=E[0]+G/w,v=E[1]+ce/w,E=[S-G/U,v-ce/U]}fe.updateViewport(e,E,U),s.forEach(pe=>{pe.lastPoint=pe.currentPoint,pe.hasMoved=!1})}return}n(a)},e.pointerUp=a=>{const c=s.findIndex(u=>u.pointerId===a.pointerId);c!==-1&&s.splice(c,1),i(a)},e.globalPointerUp=a=>{const c=s.findIndex(u=>u.pointerId===a.pointerId);c!==-1&&s.splice(c,1),o(a)},e},uS=({value:e,children:t,options:n,plugins:i,viewport:o,theme:s,onChange:r,onSelectionChange:a,onValueChange:c,onViewportChange:u,onThemeChange:d})=>{const[m,f]=p.useState(()=>{const N=dS(e,n,i,o,s),w=mS(N);return{v:0,board:N,listRender:w}}),{board:h,listRender:g}=m,b=p.useCallback(()=>{if(r){const v={children:h.children,operations:h.operations,viewport:h.viewport,selection:h.selection,theme:h.theme};r(v)}const N=h.operations.some(v=>Ri.isSetSelectionOperation(v)),w=h.operations.some(v=>Ri.isSetViewportOperation(v)),T=h.operations.some(v=>Ri.isSetThemeOperation(v)),S=h.operations.length>0&&!h.operations.every(v=>Ri.isSetSelectionOperation(v)||Ri.isSetViewportOperation(v)||Ri.isSetThemeOperation(v));c&&S&&c(h.children),a&&N&&a(h.selection),u&&w&&u(h.viewport),d&&T&&d(h.theme.themeColorMode),f(v=>({v:v.v+1,board:h,listRender:g}))},[h,r,a,c,u,d]);p.useEffect(()=>(Xa.set(h,()=>{if(h.operations.length&&h.operations.every(S=>S.type==="set_selection")){g.update(h.children,{board:h,parent:h,parentG:F.getElementHost(h)});return}const w=h.operations.length&&h.operations.some(S=>S.type==="set_viewport");if(w&&Rb(h)){qb(h,!1),g.update(h.children,{board:h,parent:h,parentG:F.getElementHost(h)});return}g.update(h.children,{board:h,parent:h,parentG:F.getElementHost(h)}),w?Yo(h):kp(h),or(h),Be(h).forEach(S=>{const v=Zi.getElementRef(S);v==null||v.updateActiveSection()})}),$a.set(h,()=>{b()}),()=>{Xa.delete(h),$a.delete(h)}),[h]);const x=p.useRef(!0),y=p.useRef(o);return p.useEffect(()=>{const N=y.current;if(y.current=o,o&&!cu.get(h)){const w=!N,T=N&&(N.zoom!==o.zoom||N.offsetX!==o.offsetX||N.offsetY!==o.offsetY);(w||T)&&(h.viewport=o,Yo(h),or(h))}},[o,h]),p.useEffect(()=>{if(x.current){x.current=!1;return}e!==m.board.children&&!cu.get(h)&&(h.children=e,g.update(h.children,{board:h,parent:h,parentG:F.getElementHost(h)}),o||fe.fitViewport(h))},[e,o]),l.jsxDEV(_c.Provider,{value:m,children:t},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/react-board/src/wrapper.tsx",lineNumber:235,columnNumber:5},void 0)},dS=(e,t,n,i,o)=>{let s=Bb(Lb(Ob(Fb(Hb(zb(Gb(Wb($b(lS(Xb(Kb(Yb(e,t)))))))))))));return n.forEach(r=>{s=r(s)}),cS(s),i&&(s.viewport=i),o&&(s.theme=o),s},mS=e=>new Zb(e);var ja={exports:{}},Rd;function pS(){return Rd||(Rd=1,(function(e){/*!mobile-detect v1.4.5 2021-03-13*//*!@license Copyright 2013, Heinrich Goebl, License: MIT, see https://github.com/hgoebl/mobile-detect.js*/(function(t,n){t(function(){var i={};i.mobileDetectRules={phones:{iPhone:"\\biPhone\\b|\\biPod\\b",BlackBerry:"BlackBerry|\\bBB10\\b|rim[0-9]+|\\b(BBA100|BBB100|BBD100|BBE100|BBF100|STH100)\\b-[0-9]+",Pixel:"; \\bPixel\\b",HTC:"HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\\bEVO\\b|T-Mobile G1|Z520m|Android [0-9.]+; Pixel",Nexus:"Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 5X|Nexus 6",Dell:"Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\\b001DL\\b|\\b101DL\\b|\\bGS01\\b",Motorola:"Motorola|DROIDX|DROID BIONIC|\\bDroid\\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\bMoto E\\b|XT1068|XT1092|XT1052",Samsung:"\\bSamsung\\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190|SM-J500FN|SM-G903F|SM-J330F|SM-G610F|SM-G981B|SM-G892A|SM-A530F",LG:"\\bLG\\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)|LM-G710",Sony:"SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533|SOV34|601SO|F8332",Asus:"Asus.*Galaxy|PadFone.*Mobile",Xiaomi:"^(?!.*\\bx11\\b).*xiaomi.*$|POCOPHONE F1|MI 8|Redmi Note 9S|Redmi Note 5A Prime|N2G47H|M2001J2G|M2001J2I|M1805E10A|M2004J11G|M1902F1G|M2002J9G|M2004J19G|M2003J6A1G",NokiaLumia:"Lumia [0-9]{3,4}",Micromax:"Micromax.*\\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\\b",Palm:"PalmSource|Palm",Vertu:"Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature",Pantech:"PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790",Fly:"IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250",Wiko:"KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA(?!nna)|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLIM|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM",iMobile:"i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)",SimValley:"\\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\\b",Wolfgang:"AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q",Alcatel:"Alcatel",Nintendo:"Nintendo (3DS|Switch)",Amoi:"Amoi",INQ:"INQ",OnePlus:"ONEPLUS",GenericPhone:"Tapatalk|PDA;|SAGEM|\\bmmp\\b|pocket|\\bpsp\\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\\bwap\\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser"},tablets:{iPad:"iPad|iPad.*Mobile",NexusTablet:"Android.*Nexus[\\s]+(7|9|10)",GoogleTablet:"Android.*Pixel C",SamsungTablet:"SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835|SM-T830|SM-T837V|SM-T720|SM-T510|SM-T387V|SM-P610|SM-T290|SM-T515|SM-T590|SM-T595|SM-T725|SM-T817P|SM-P585N0|SM-T395|SM-T295|SM-T865|SM-P610N|SM-P615|SM-T970|SM-T380|SM-T5950|SM-T905|SM-T231|SM-T500|SM-T860",Kindle:"Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\\b|Android.*Silk/[0-9.]+ like Chrome/[0-9.]+ (?!Mobile)",SurfaceTablet:"Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)",HPTablet:"HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10",AsusTablet:"^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\bK00F\\b|\\bK00C\\b|\\bK00E\\b|\\bK00L\\b|TX201LA|ME176C|ME102A|\\bM80TA\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\\bME70C\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z|\\bP027\\b|\\bP024\\b|\\bP00C\\b",BlackBerryTablet:"PlayBook|RIM Tablet",HTCtablet:"HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410",MotorolaTablet:"xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617",NookTablet:"Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2",AcerTablet:"Android.*; \\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\b|W3-810|\\bA3-A10\\b|\\bA3-A11\\b|\\bA3-A20\\b|\\bA3-A30|A3-A40",ToshibaTablet:"Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO",LGTablet:"\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\\b",FujitsuTablet:"Android.*\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\b",PrestigioTablet:"PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002",LenovoTablet:"Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304X|TB-X304F|TB-X304L|TB-X505F|TB-X505L|TB-X505X|TB-X605F|TB-X605L|TB-8703F|TB-8703X|TB-8703N|TB-8704N|TB-8704F|TB-8704X|TB-8704V|TB-7304F|TB-7304I|TB-7304X|Tab2A7-10F|Tab2A7-20F|TB2-X30L|YT3-X50L|YT3-X50F|YT3-X50M|YT-X705F|YT-X703F|YT-X703L|YT-X705L|YT-X705X|TB2-X30F|TB2-X30L|TB2-X30M|A2107A-F|A2107A-H|TB3-730F|TB3-730M|TB3-730X|TB-7504F|TB-7504X|TB-X704F|TB-X104F|TB3-X70F|TB-X705F|TB-8504F|TB3-X70L|TB3-710F|TB-X704L",DellTablet:"Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7",YarvikTablet:"Android.*\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\b",MedionTablet:"Android.*\\bOYO\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB",ArnovaTablet:"97G4|AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2",IntensoTablet:"INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004",IRUTablet:"M702pro",MegafonTablet:"MegaFon V9|\\bZTE V9\\b|Android.*\\bMT7A\\b",EbodaTablet:"E-Boda (Supreme|Impresspeed|Izzycomm|Essential)",AllViewTablet:"Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)",ArchosTablet:"\\b(101G9|80G9|A101IT)\\b|Qilive 97R|Archos5|\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|c|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\b",AinolTablet:"NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark",NokiaLumiaTablet:"Lumia 2520",SonyTablet:"Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP641|SGP612|SOT31|SGP771|SGP611|SGP612|SGP712",PhilipsTablet:"\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\b",CubeTablet:"Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT",CobyTablet:"MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010",MIDTablet:"M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10",MSITablet:"MSI \\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\b",SMiTTablet:"Android.*(\\bMID\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)",RockChipTablet:"Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A",FlyTablet:"IQ310|Fly Vision",bqTablet:"Android.*(bq)?.*\\b(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))\\b|Maxwell.*Lite|Maxwell.*Plus",HuaweiTablet:"MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09|AGS-L09|CMR-AL19",NecTablet:"\\bN-06D|\\bN-08D",PantechTablet:"Pantech.*P4100",BronchoTablet:"Broncho.*(N701|N708|N802|a710)",VersusTablet:"TOUCHPAD.*[78910]|\\bTOUCHTAB\\b",ZyncTablet:"z1000|Z99 2G|z930|z990|z909|Z919|z900",PositivoTablet:"TB07STA|TB10STA|TB07FTA|TB10FTA",NabiTablet:"Android.*\\bNabi",KoboTablet:"Kobo Touch|\\bK080\\b|\\bVox\\b Build|\\bArc\\b Build",DanewTablet:"DSlide.*\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\b",TexetTablet:"NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE",PlaystationTablet:"Playstation.*(Portable|Vita)",TrekstorTablet:"ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab",PyleAudioTablet:"\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\b",AdvanTablet:"Android.* \\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\b ",DanyTechTablet:"Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1",GalapadTablet:"Android [0-9.]+; [a-z-]+; \\bG1\\b",MicromaxTablet:"Funbook|Micromax.*\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\b",KarbonnTablet:"Android.*\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\b",AllFineTablet:"Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide",PROSCANTablet:"\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\b",YONESTablet:"BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026",ChangJiaTablet:"TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503",GUTablet:"TX-A1301|TX-M9002|Q702|kf026",PointOfViewTablet:"TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10",OvermaxTablet:"OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)|Qualcore 1027",HCLTablet:"HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync",DPSTablet:"DPS Dream 9|DPS Dual 7",VistureTablet:"V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10",CrestaTablet:"CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989",MediatekTablet:"\\bMT8125|MT8389|MT8135|MT8377\\b",ConcordeTablet:"Concorde([ ]+)?Tab|ConCorde ReadMan",GoCleverTablet:"GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042",ModecomTablet:"FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003",VoninoTablet:"\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\bQ8\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\b",ECSTablet:"V07OT2|TM105A|S10OT1|TR10CS1",StorexTablet:"eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab",VodafoneTablet:"SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497|VFD 1400",EssentielBTablet:"Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2",RossMoorTablet:"RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711",iMobileTablet:"i-mobile i-note",TolinoTablet:"tolino tab [0-9.]+|tolino shine",AudioSonicTablet:"\\bC-22Q|T7-QC|T-17B|T-17P\\b",AMPETablet:"Android.* A78 ",SkkTablet:"Android.* (SKYPAD|PHOENIX|CYCLOPS)",TecnoTablet:"TECNO P9|TECNO DP8D",JXDTablet:"Android.* \\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\b",iJoyTablet:"Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)",FX2Tablet:"FX2 PAD7|FX2 PAD10",XoroTablet:"KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151",ViewsonicTablet:"ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a",VerizonTablet:"QTAQZ3|QTAIR7|QTAQTZ3|QTASUN1|QTASUN2|QTAXIA1",OdysTablet:"LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\bXELIO\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10",CaptivaTablet:"CAPTIVA PAD",IconbitTablet:"NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S",TeclastTablet:"T98 4G|\\bP80\\b|\\bX90HD\\b|X98 Air|X98 Air 3G|\\bX89\\b|P80 3G|\\bX80h\\b|P98 Air|\\bX89HD\\b|P98 3G|\\bP90HD\\b|P89 3G|X98 3G|\\bP70h\\b|P79HD 3G|G18d 3G|\\bP79HD\\b|\\bP89s\\b|\\bA88\\b|\\bP10HD\\b|\\bP19HD\\b|G18 3G|\\bP78HD\\b|\\bA78\\b|\\bP75\\b|G17s 3G|G17h 3G|\\bP85t\\b|\\bP90\\b|\\bP11\\b|\\bP98t\\b|\\bP98HD\\b|\\bG18d\\b|\\bP85s\\b|\\bP11HD\\b|\\bP88s\\b|\\bA80HD\\b|\\bA80se\\b|\\bA10h\\b|\\bP89\\b|\\bP78s\\b|\\bG18\\b|\\bP85\\b|\\bA70h\\b|\\bA70\\b|\\bG17\\b|\\bP18\\b|\\bA80s\\b|\\bA11s\\b|\\bP88HD\\b|\\bA80h\\b|\\bP76s\\b|\\bP76h\\b|\\bP98\\b|\\bA10HD\\b|\\bP78\\b|\\bP88\\b|\\bA11\\b|\\bA10t\\b|\\bP76a\\b|\\bP76t\\b|\\bP76e\\b|\\bP85HD\\b|\\bP85a\\b|\\bP86\\b|\\bP75HD\\b|\\bP76v\\b|\\bA12\\b|\\bP75a\\b|\\bA15\\b|\\bP76Ti\\b|\\bP81HD\\b|\\bA10\\b|\\bT760VE\\b|\\bT720HD\\b|\\bP76\\b|\\bP73\\b|\\bP71\\b|\\bP72\\b|\\bT720SE\\b|\\bC520Ti\\b|\\bT760\\b|\\bT720VE\\b|T720-3GE|T720-WiFi",OndaTablet:"\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\b[\\s]+|V10 \\b4G\\b",JaytechTablet:"TPC-PA762",BlaupunktTablet:"Endeavour 800NG|Endeavour 1010",DigmaTablet:"\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\b",EvolioTablet:"ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\bEvotab\\b|\\bNeura\\b",LavaTablet:"QPAD E704|\\bIvoryS\\b|E-TAB IVORY|\\bE-TAB\\b",AocTablet:"MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712",MpmanTablet:"MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\bMPG7\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010",CelkonTablet:"CT695|CT888|CT[\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\bCT-1\\b",WolderTablet:"miTab \\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\b",MediacomTablet:"M-MPI10C3G|M-SP10EG|M-SP10EGP|M-SP10HXAH|M-SP7HXAH|M-SP10HXBH|M-SP8HXAH|M-SP8MXA",MiTablet:"\\bMI PAD\\b|\\bHM NOTE 1W\\b",NibiruTablet:"Nibiru M1|Nibiru Jupiter One",NexoTablet:"NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI",LeaderTablet:"TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100",UbislateTablet:"UbiSlate[\\s]?7C",PocketBookTablet:"Pocketbook",KocasoTablet:"\\b(TB-1207)\\b",HisenseTablet:"\\b(F5281|E2371)\\b",Hudl:"Hudl HT7S3|Hudl 2",TelstraTablet:"T-Hub2",GenericTablet:"Android.*\\b97D\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\bA7EB\\b|CatNova8|A1_07|CT704|CT1002|\\bM721\\b|rk30sdk|\\bEVOTAB\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\bM6pro\\b|CT1020W|arc 10HD|\\bTP750\\b|\\bQTAQZ3\\b|WVT101|TM1088|KT107"},oss:{AndroidOS:"Android",BlackBerryOS:"blackberry|\\bBB10\\b|rim tablet os",PalmOS:"PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino",SymbianOS:"Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\\bS60\\b",WindowsMobileOS:"Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Windows Mobile|Windows Phone [0-9.]+|WCE;",WindowsPhoneOS:"Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;",iOS:"\\biPhone.*Mobile|\\biPod|\\biPad|AppleCoreMedia",iPadOS:"CPU OS 13",SailfishOS:"Sailfish",MeeGoOS:"MeeGo",MaemoOS:"Maemo",JavaOS:"J2ME/|\\bMIDP\\b|\\bCLDC\\b",webOS:"webOS|hpwOS",badaOS:"\\bBada\\b",BREWOS:"BREW"},uas:{Chrome:"\\bCrMo\\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?",Dolfin:"\\bDolfin\\b",Opera:"Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+$|Coast/[0-9.]+",Skyfire:"Skyfire",Edge:"\\bEdgiOS\\b|Mobile Safari/[.0-9]* Edge",IE:"IEMobile|MSIEMobile",Firefox:"fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS",Bolt:"bolt",TeaShark:"teashark",Blazer:"Blazer",Safari:"Version((?!\\bEdgiOS\\b).)*Mobile.*Safari|Safari.*Mobile|MobileSafari",WeChat:"\\bMicroMessenger\\b",UCBrowser:"UC.*Browser|UCWEB",baiduboxapp:"baiduboxapp",baidubrowser:"baidubrowser",DiigoBrowser:"DiigoBrowser",Mercury:"\\bMercury\\b",ObigoBrowser:"Obigo",NetFront:"NF-Browser",GenericBrowser:"NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger",PaleMoon:"Android.*PaleMoon|Mobile.*PaleMoon"},props:{Mobile:"Mobile/[VER]",Build:"Build/[VER]",Version:"Version/[VER]",VendorID:"VendorID/[VER]",iPad:"iPad.*CPU[a-z ]+[VER]",iPhone:"iPhone.*CPU[a-z ]+[VER]",iPod:"iPod.*CPU[a-z ]+[VER]",Kindle:"Kindle/[VER]",Chrome:["Chrome/[VER]","CriOS/[VER]","CrMo/[VER]"],Coast:["Coast/[VER]"],Dolfin:"Dolfin/[VER]",Firefox:["Firefox/[VER]","FxiOS/[VER]"],Fennec:"Fennec/[VER]",Edge:"Edge/[VER]",IE:["IEMobile/[VER];","IEMobile [VER]","MSIE [VER];","Trident/[0-9.]+;.*rv:[VER]"],NetFront:"NetFront/[VER]",NokiaBrowser:"NokiaBrowser/[VER]",Opera:[" OPR/[VER]","Opera Mini/[VER]","Version/[VER]"],"Opera Mini":"Opera Mini/[VER]","Opera Mobi":"Version/[VER]",UCBrowser:["UCWEB[VER]","UC.*Browser/[VER]"],MQQBrowser:"MQQBrowser/[VER]",MicroMessenger:"MicroMessenger/[VER]",baiduboxapp:"baiduboxapp/[VER]",baidubrowser:"baidubrowser/[VER]",SamsungBrowser:"SamsungBrowser/[VER]",Iron:"Iron/[VER]",Safari:["Version/[VER]","Safari/[VER]"],Skyfire:"Skyfire/[VER]",Tizen:"Tizen/[VER]",Webkit:"webkit[ /][VER]",PaleMoon:"PaleMoon/[VER]",SailfishBrowser:"SailfishBrowser/[VER]",Gecko:"Gecko/[VER]",Trident:"Trident/[VER]",Presto:"Presto/[VER]",Goanna:"Goanna/[VER]",iOS:" \\bi?OS\\b [VER][ ;]{1}",Android:"Android [VER]",Sailfish:"Sailfish [VER]",BlackBerry:["BlackBerry[\\w]+/[VER]","BlackBerry.*Version/[VER]","Version/[VER]"],BREW:"BREW [VER]",Java:"Java/[VER]","Windows Phone OS":["Windows Phone OS [VER]","Windows Phone [VER]"],"Windows Phone":"Windows Phone [VER]","Windows CE":"Windows CE/[VER]","Windows NT":"Windows NT [VER]",Symbian:["SymbianOS/[VER]","Symbian/[VER]"],webOS:["webOS/[VER]","hpwOS/[VER];"]},utils:{Bot:"Googlebot|facebookexternalhit|Google-AMPHTML|s~amp-validator|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom|contentkingapp|AspiegelBot",MobileBot:"Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/M1A1-R2D2",DesktopMode:"WPDesktop",TV:"SonyDTV|HbbTV",WebKit:"(webkit)[ /]([\\w.]+)",Console:"\\b(Nintendo|Nintendo WiiU|Nintendo 3DS|Nintendo Switch|PLAYSTATION|Xbox)\\b",Watch:"SM-V700"}},i.detectMobileBrowsers={fullPattern:/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,shortPattern:/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,tabletPattern:/android|ipad|playbook|silk/i};var o=Object.prototype.hasOwnProperty,s;i.FALLBACK_PHONE="UnknownPhone",i.FALLBACK_TABLET="UnknownTablet",i.FALLBACK_MOBILE="UnknownMobile",s="isArray"in Array?Array.isArray:function(m){return Object.prototype.toString.call(m)==="[object Array]"};function r(m,f){return m!=null&&f!=null&&m.toLowerCase()===f.toLowerCase()}function a(m,f){var h,g,b=m.length;if(!b||!f)return!1;for(h=f.toLowerCase(),g=0;g<b;++g)if(h===m[g].toLowerCase())return!0;return!1}function c(m){for(var f in m)o.call(m,f)&&(m[f]=new RegExp(m[f],"i"))}function u(m){return(m||"").substr(0,500)}(function(){var f,h,g,b,x,y,N=i.mobileDetectRules;for(f in N.props)if(o.call(N.props,f)){for(h=N.props[f],s(h)||(h=[h]),x=h.length,b=0;b<x;++b)g=h[b],y=g.indexOf("[VER]"),y>=0&&(g=g.substring(0,y)+"([\\w._\\+]+)"+g.substring(y+5)),h[b]=new RegExp(g,"i");N.props[f]=h}c(N.oss),c(N.phones),c(N.tablets),c(N.uas),c(N.utils),N.oss0={WindowsPhoneOS:N.oss.WindowsPhoneOS,WindowsMobileOS:N.oss.WindowsMobileOS}})(),i.findMatch=function(m,f){for(var h in m)if(o.call(m,h)&&m[h].test(f))return h;return null},i.findMatches=function(m,f){var h=[];for(var g in m)o.call(m,g)&&m[g].test(f)&&h.push(g);return h},i.getVersionStr=function(m,f){var h=i.mobileDetectRules.props,g,b,x,y;if(o.call(h,m)){for(g=h[m],x=g.length,b=0;b<x;++b)if(y=g[b].exec(f),y!==null)return y[1]}return null},i.getVersion=function(m,f){var h=i.getVersionStr(m,f);return h?i.prepareVersionNo(h):NaN},i.prepareVersionNo=function(m){var f;return f=m.split(/[a-z._ \/\-]/i),f.length===1&&(m=f[0]),f.length>1&&(m=f[0]+".",f.shift(),m+=f.join("")),Number(m)},i.isMobileFallback=function(m){return i.detectMobileBrowsers.fullPattern.test(m)||i.detectMobileBrowsers.shortPattern.test(m.substr(0,4))},i.isTabletFallback=function(m){return i.detectMobileBrowsers.tabletPattern.test(m)},i.prepareDetectionCache=function(m,f,h){if(m.mobile===n){var g,b,x;if(b=i.findMatch(i.mobileDetectRules.tablets,f),b){m.mobile=m.tablet=b,m.phone=null;return}if(g=i.findMatch(i.mobileDetectRules.phones,f),g){m.mobile=m.phone=g,m.tablet=null;return}i.isMobileFallback(f)?(x=d.isPhoneSized(h),x===n?(m.mobile=i.FALLBACK_MOBILE,m.tablet=m.phone=null):x?(m.mobile=m.phone=i.FALLBACK_PHONE,m.tablet=null):(m.mobile=m.tablet=i.FALLBACK_TABLET,m.phone=null)):i.isTabletFallback(f)?(m.mobile=m.tablet=i.FALLBACK_TABLET,m.phone=null):m.mobile=m.tablet=m.phone=null}},i.mobileGrade=function(m){var f=m.mobile()!==null;return m.os("iOS")&&m.version("iPad")>=4.3||m.os("iOS")&&m.version("iPhone")>=3.1||m.os("iOS")&&m.version("iPod")>=3.1||m.version("Android")>2.1&&m.is("Webkit")||m.version("Windows Phone OS")>=7||m.is("BlackBerry")&&m.version("BlackBerry")>=6||m.match("Playbook.*Tablet")||m.version("webOS")>=1.4&&m.match("Palm|Pre|Pixi")||m.match("hp.*TouchPad")||m.is("Firefox")&&m.version("Firefox")>=12||m.is("Chrome")&&m.is("AndroidOS")&&m.version("Android")>=4||m.is("Skyfire")&&m.version("Skyfire")>=4.1&&m.is("AndroidOS")&&m.version("Android")>=2.3||m.is("Opera")&&m.version("Opera Mobi")>11&&m.is("AndroidOS")||m.is("MeeGoOS")||m.is("Tizen")||m.is("Dolfin")&&m.version("Bada")>=2||(m.is("UC Browser")||m.is("Dolfin"))&&m.version("Android")>=2.3||m.match("Kindle Fire")||m.is("Kindle")&&m.version("Kindle")>=3||m.is("AndroidOS")&&m.is("NookTablet")||m.version("Chrome")>=11&&!f||m.version("Safari")>=5&&!f||m.version("Firefox")>=4&&!f||m.version("MSIE")>=7&&!f||m.version("Opera")>=10&&!f?"A":m.os("iOS")&&m.version("iPad")<4.3||m.os("iOS")&&m.version("iPhone")<3.1||m.os("iOS")&&m.version("iPod")<3.1||m.is("Blackberry")&&m.version("BlackBerry")>=5&&m.version("BlackBerry")<6||m.version("Opera Mini")>=5&&m.version("Opera Mini")<=6.5&&(m.version("Android")>=2.3||m.is("iOS"))||m.match("NokiaN8|NokiaC7|N97.*Series60|Symbian/3")||m.version("Opera Mobi")>=11&&m.is("SymbianOS")?"B":(m.version("BlackBerry")<5||m.match("MSIEMobile|Windows CE.*Mobile")||m.version("Windows Mobile")<=5.2,"C")},i.detectOS=function(m){return i.findMatch(i.mobileDetectRules.oss0,m)||i.findMatch(i.mobileDetectRules.oss,m)},i.getDeviceSmallerSide=function(){return window.screen.width<window.screen.height?window.screen.width:window.screen.height};function d(m,f){this.ua=u(m),this._cache={},this.maxPhoneWidth=f||600}return d.prototype={constructor:d,mobile:function(){return i.prepareDetectionCache(this._cache,this.ua,this.maxPhoneWidth),this._cache.mobile},phone:function(){return i.prepareDetectionCache(this._cache,this.ua,this.maxPhoneWidth),this._cache.phone},tablet:function(){return i.prepareDetectionCache(this._cache,this.ua,this.maxPhoneWidth),this._cache.tablet},userAgent:function(){return this._cache.userAgent===n&&(this._cache.userAgent=i.findMatch(i.mobileDetectRules.uas,this.ua)),this._cache.userAgent},userAgents:function(){return this._cache.userAgents===n&&(this._cache.userAgents=i.findMatches(i.mobileDetectRules.uas,this.ua)),this._cache.userAgents},os:function(){return this._cache.os===n&&(this._cache.os=i.detectOS(this.ua)),this._cache.os},version:function(m){return i.getVersion(m,this.ua)},versionStr:function(m){return i.getVersionStr(m,this.ua)},is:function(m){return a(this.userAgents(),m)||r(m,this.os())||r(m,this.phone())||r(m,this.tablet())||a(i.findMatches(i.mobileDetectRules.utils,this.ua),m)},match:function(m){return m instanceof RegExp||(m=new RegExp(m,"i")),m.test(this.ua)},isPhoneSized:function(m){return d.isPhoneSized(m||this.maxPhoneWidth)},mobileGrade:function(){return this._cache.grade===n&&(this._cache.grade=i.mobileGrade(this)),this._cache.grade}},typeof window<"u"&&window.screen?d.isPhoneSized=function(m){return m<0?n:i.getDeviceSmallerSide()<=m}:d.isPhoneSized=function(){},d._impl=i,d.version="1.4.5 2021-03-13",d})})((function(t){if(e.exports)return function(n){e.exports=n()};if(typeof window<"u")return function(n){window.MobileDetect=n()};throw new Error("unknown environment")})())})(ja)),ja.exports}var fS=pS();const hS=Qb(fS),qd=e=>l.jsxDEV("span",{className:"mind-node-emoji",style:{fontSize:`${e.fontSize}px`},children:e.emojiItem.name},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/emoji.tsx",lineNumber:5,columnNumber:5},void 0),gS=e=>{const t=e;return e.setPluginOptions(Jb,{emojiPadding:0,spaceBetweenEmojis:4}),t.renderEmoji=(n,i)=>{const o=document.createElement("span");n.appendChild(o);const s=jr.createRoot(o);s.render(l.jsxDEV(qd,{...i},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/with-mind-extend.tsx",lineNumber:31,columnNumber:17},void 0));let r={...i};return{destroy:()=>{setTimeout(()=>{s.unmount()},0)},update:c=>{r={...r,...c},s.render(l.jsxDEV(qd,{...r},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/with-mind-extend.tsx",lineNumber:41,columnNumber:21},void 0))}}},t},bS=e=>{const t=p.useRef(null),[n,i]=p.useState(!1),[o,s]=p.useState(!0),{videoItem:r,isFocus:a=!1,isSelected:c=!1,readonly:u=!1}=e,{url:d,poster:m,videoType:f}=r,h=(d==null?void 0:d.replace("#video",""))||"";p.useEffect(()=>{const x=t.current;if(x){const y=()=>{s(!1),i(!1)},N=()=>{s(!1),i(!0)};return x.addEventListener("loadeddata",y),x.addEventListener("error",N),()=>{x.removeEventListener("loadeddata",y),x.removeEventListener("error",N)}}},[h]);const g=x=>{u&&(x.preventDefault(),x.stopPropagation(),window.open(h,"_blank"))},b={position:"relative",width:"100%",height:"100%",backgroundColor:"#000",borderRadius:"4px",overflow:"hidden"};return n?l.jsxDEV("div",{style:b,onClick:g,children:l.jsxDEV("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"#666",backgroundColor:"#f5f5f5",cursor:u?"pointer":"default"},children:[l.jsxDEV("div",{style:{fontSize:"48px",marginBottom:"8px"},children:"🎬"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:85,columnNumber:11},void 0),l.jsxDEV("div",{style:{fontSize:"14px",textAlign:"center",padding:"0 16px"},children:"Video failed to load"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:86,columnNumber:11},void 0),u&&l.jsxDEV("div",{style:{fontSize:"12px",color:"#999",marginTop:"4px"},children:"Click to open in new window"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:90,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:75,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:74,columnNumber:7},void 0):l.jsxDEV("div",{style:b,onClick:g,children:[o&&l.jsxDEV("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",zIndex:1},children:l.jsxDEV("div",{style:{textAlign:"center"},children:[l.jsxDEV("div",{style:{fontSize:"24px",marginBottom:"8px"},children:"⏳"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:116,columnNumber:13},void 0),l.jsxDEV("div",{style:{fontSize:"14px"},children:"Loading video..."},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:117,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:115,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:102,columnNumber:9},void 0),l.jsxDEV("video",{ref:t,src:h,poster:m,width:"100%",height:"100%",controls:!u,muted:!0,playsInline:!0,draggable:!1,className:Y("video-origin",{"video-origin--focus":a,"video-origin--selected":c}),style:{width:"100%",height:"100%",objectFit:"contain"},onError:()=>i(!0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:121,columnNumber:7},void 0),u&&l.jsxDEV("div",{style:{position:"absolute",top:"8px",right:"8px",backgroundColor:"rgba(0, 0, 0, 0.6)",color:"white",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",pointerEvents:"none"},children:"🎬 Video"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:143,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/video.tsx",lineNumber:100,columnNumber:5},void 0)},xS=e=>{if(e.isVideo===!0||e.videoType)return!0;const t=e.url||"";return t.includes("#video")||t.includes("#merged-video-")?!0:[".mp4",".avi",".mov",".wmv",".flv",".webm",".mkv"].some(i=>t.toLowerCase().includes(i))},Bd=e=>{const t=p.useCallback(()=>{e0(e.board,e.element,e.imageItem.url)},[e.board,e.element,e.imageItem.url]),n=e.element,i=n==null?void 0:n.pptImageStatus,o=n==null?void 0:n.pptImagePrompt,s=n==null?void 0:n.frameId,r=p.useCallback(async()=>{var c;if(!(!e.board||!s||!o||i==="loading")){ha(e.board,s,"loading"),vs(e.board,s,"loading");try{const u=await t0({prompt:o,size:"16x9"});if(u.success&&((c=u.data)!=null&&c.url)){n0(e.board,s);const d=e.board.children.find(m=>m.id===s);if(d){const m=ge.getRectangleByPoints(d.points),f=i0({x:m.x,y:m.y,width:m.width,height:m.height});await o0(e.board,u.data.url,"image",s,{width:m.width,height:m.height},{width:800,height:450},f)}vs(e.board,s,"generated")}else ha(e.board,s,"placeholder"),vs(e.board,s,"placeholder"),re.error(u.error||"图片生成失败")}catch(u){ha(e.board,s,"placeholder"),vs(e.board,s,"placeholder"),re.error((u==null?void 0:u.message)||"图片生成失败")}}},[e.board,s,o,i]);if(n!=null&&n.pptImagePlaceholder){const c=i==="loading";return l.jsxDEV("div",{className:"ppt-image-placeholder",onClick:c?void 0:r,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px",borderRadius:"8px",border:"1px dashed #d9d9d9",backgroundColor:"rgba(245,245,245,0.85)",color:"#999",fontSize:"13px",cursor:c?"default":"pointer",userSelect:"none"},children:[c?l.jsxDEV(s0,{size:"small"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/image.tsx",lineNumber:123,columnNumber:22},void 0):null,l.jsxDEV("span",{children:c?"生成配图中…":"点击生成配图"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/image.tsx",lineNumber:124,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/image.tsx",lineNumber:103,columnNumber:7},void 0)}if(xS(e.imageItem))return l.jsxDEV(bS,{videoItem:{url:e.imageItem.url,width:e.imageItem.width,height:e.imageItem.height,videoType:e.imageItem.videoType,poster:e.imageItem.poster},isFocus:e.isFocus,isSelected:e.isSelected,readonly:e.readonly},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/image.tsx",lineNumber:132,columnNumber:7},void 0);const a={src:e.imageItem.url,draggable:!1,width:"100%"};return l.jsxDEV("div",{children:l.jsxDEV("img",{...a,className:Y("image-origin",{"image-origin--focus":e.isFocus}),onError:t},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/image.tsx",lineNumber:155,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/components/image.tsx",lineNumber:154,columnNumber:5},void 0)};/*!
|
|
17
|
-
* Viewer.js v1.11.7
|
|
18
|
-
* https://fengyuanchen.github.io/viewerjs
|
|
19
|
-
*
|
|
20
|
-
* Copyright 2015-present Chen Fengyuan
|
|
21
|
-
* Released under the MIT license
|
|
22
|
-
*
|
|
23
|
-
* Date: 2024-11-24T04:32:19.116Z
|
|
24
|
-
*/function NS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ld(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Hh(i.key),i)}}function yS(e,t,n){return t&&Ld(e.prototype,t),n&&Ld(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function wS(e,t,n){return(t=Hh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Od(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,i)}return n}function jc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Od(Object(n),!0).forEach(function(i){wS(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Od(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function vS(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Hh(e){var t=vS(e,"string");return typeof t=="symbol"?t:t+""}function wl(e){"@babel/helpers - typeof";return wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wl(e)}var Fd={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},ES='<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list" role="navigation"></ul></div></div><div class="viewer-tooltip" role="alert" aria-hidden="true"></div><div class="viewer-button" data-viewer-action="mix" role="button"></div><div class="viewer-player"></div></div>',oa=typeof window<"u"&&typeof window.document<"u",Fn=oa?window:{},to=oa&&Fn.document.documentElement?"ontouchstart"in Fn.document.documentElement:!1,Pc=oa?"PointerEvent"in Fn:!1,Te="viewer",Qs="move",zh="switch",Bo="zoom",Ms="".concat(Te,"-active"),kS="".concat(Te,"-close"),Js="".concat(Te,"-fade"),vl="".concat(Te,"-fixed"),SS="".concat(Te,"-fullscreen"),Hd="".concat(Te,"-fullscreen-exit"),xi="".concat(Te,"-hide"),TS="".concat(Te,"-hide-md-down"),DS="".concat(Te,"-hide-sm-down"),_S="".concat(Te,"-hide-xs-down"),sn="".concat(Te,"-in"),Go="".concat(Te,"-invisible"),no="".concat(Te,"-loading"),jS="".concat(Te,"-move"),zd="".concat(Te,"-open"),Hi="".concat(Te,"-show"),Nt="".concat(Te,"-transition"),uo="click",El="dblclick",Gd="dragstart",Wd="focusin",$d="keydown",an="load",Ei="error",PS=to?"touchend touchcancel":"mouseup",CS=to?"touchmove":"mousemove",AS=to?"touchstart":"mousedown",Xd=Pc?"pointerdown":AS,Kd=Pc?"pointermove":CS,Yd=Pc?"pointerup pointercancel":PS,Zd="resize",pn="transitionend",Qd="wheel",Jd="ready",em="show",tm="shown",nm="hide",im="hidden",om="view",ls="viewed",sm="move",rm="moved",am="rotate",lm="rotated",cm="scale",um="scaled",dm="zoom",mm="zoomed",pm="play",fm="stop",br="".concat(Te,"Action"),Cc=/\s\s*/,Is=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function cs(e){return typeof e=="string"}var MS=Number.isNaN||Fn.isNaN;function gt(e){return typeof e=="number"&&!MS(e)}function Wi(e){return typeof e>"u"}function mo(e){return wl(e)==="object"&&e!==null}var IS=Object.prototype.hasOwnProperty;function $i(e){if(!mo(e))return!1;try{var t=e.constructor,n=t.prototype;return t&&n&&IS.call(n,"isPrototypeOf")}catch{return!1}}function Ze(e){return typeof e=="function"}function nt(e,t){if(e&&Ze(t))if(Array.isArray(e)||gt(e.length)){var n=e.length,i;for(i=0;i<n&&t.call(e,e[i],i,e)!==!1;i+=1);}else mo(e)&&Object.keys(e).forEach(function(o){t.call(e,e[o],o,e)});return e}var Jt=Object.assign||function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return mo(t)&&i.length>0&&i.forEach(function(s){mo(s)&&Object.keys(s).forEach(function(r){t[r]=s[r]})}),t},VS=/^(?:width|height|left|top|marginLeft|marginTop)$/;function gn(e,t){var n=e.style;nt(t,function(i,o){VS.test(o)&>(i)&&(i+="px"),n[o]=i})}function US(e){return cs(e)?e.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"):e}function Gi(e,t){return!e||!t?!1:e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function ye(e,t){if(!(!e||!t)){if(gt(e.length)){nt(e,function(i){ye(i,t)});return}if(e.classList){e.classList.add(t);return}var n=e.className.trim();n?n.indexOf(t)<0&&(e.className="".concat(n," ").concat(t)):e.className=t}}function Ge(e,t){if(!(!e||!t)){if(gt(e.length)){nt(e,function(n){Ge(n,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,""))}}function us(e,t,n){if(t){if(gt(e.length)){nt(e,function(i){us(i,t,n)});return}n?ye(e,t):Ge(e,t)}}var RS=/([a-z\d])([A-Z])/g;function Ac(e){return e.replace(RS,"$1-$2").toLowerCase()}function Xi(e,t){return mo(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(Ac(t)))}function kl(e,t,n){mo(n)?e[t]=n:e.dataset?e.dataset[t]=n:e.setAttribute("data-".concat(Ac(t)),n)}var Gh=(function(){var e=!1;if(oa){var t=!1,n=function(){},i=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(s){t=s}});Fn.addEventListener("test",n,i),Fn.removeEventListener("test",n,i)}return e})();function Qe(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=n;t.trim().split(Cc).forEach(function(s){if(!Gh){var r=e.listeners;r&&r[s]&&r[s][n]&&(o=r[s][n],delete r[s][n],Object.keys(r[s]).length===0&&delete r[s],Object.keys(r).length===0&&delete e.listeners)}e.removeEventListener(s,o,i)})}function ve(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=n;t.trim().split(Cc).forEach(function(s){if(i.once&&!Gh){var r=e.listeners,a=r===void 0?{}:r;o=function(){delete a[s][n],e.removeEventListener(s,o,i);for(var u=arguments.length,d=new Array(u),m=0;m<u;m++)d[m]=arguments[m];n.apply(e,d)},a[s]||(a[s]={}),a[s][n]&&e.removeEventListener(s,a[s][n],i),a[s][n]=o,e.listeners=a}e.addEventListener(s,o,i)})}function vt(e,t,n,i){var o;return Ze(Event)&&Ze(CustomEvent)?o=new CustomEvent(t,jc({bubbles:!0,cancelable:!0,detail:n},i)):(o=document.createEvent("CustomEvent"),o.initCustomEvent(t,!0,!0,n)),e.dispatchEvent(o)}function qS(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}function er(e){var t=e.rotate,n=e.scaleX,i=e.scaleY,o=e.translateX,s=e.translateY,r=[];gt(o)&&o!==0&&r.push("translateX(".concat(o,"px)")),gt(s)&&s!==0&&r.push("translateY(".concat(s,"px)")),gt(t)&&t!==0&&r.push("rotate(".concat(t,"deg)")),gt(n)&&n!==1&&r.push("scaleX(".concat(n,")")),gt(i)&&i!==1&&r.push("scaleY(".concat(i,")"));var a=r.length?r.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function BS(e){return cs(e)?decodeURIComponent(e.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var Pa=Fn.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(Fn.navigator.userAgent);function Wh(e,t,n){var i=document.createElement("img");if(e.naturalWidth&&!Pa)return n(e.naturalWidth,e.naturalHeight),i;var o=document.body||document.documentElement;return i.onload=function(){n(i.width,i.height),Pa||o.removeChild(i)},nt(t.inheritedAttributes,function(s){var r=e.getAttribute(s);r!==null&&i.setAttribute(s,r)}),i.src=e.src,Pa||(i.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",o.appendChild(i)),i}function Vs(e){switch(e){case 2:return _S;case 3:return DS;case 4:return TS;default:return""}}function LS(e){var t=jc({},e),n=[];return nt(e,function(i,o){delete t[o],nt(t,function(s){var r=Math.abs(i.startX-s.startX),a=Math.abs(i.startY-s.startY),c=Math.abs(i.endX-s.endX),u=Math.abs(i.endY-s.endY),d=Math.sqrt(r*r+a*a),m=Math.sqrt(c*c+u*u),f=(m-d)/d;n.push(f)})}),n.sort(function(i,o){return Math.abs(i)<Math.abs(o)}),n[0]}function Us(e,t){var n=e.pageX,i=e.pageY,o={endX:n,endY:i};return t?o:jc({timeStamp:Date.now(),startX:n,startY:i},o)}function OS(e){var t=0,n=0,i=0;return nt(e,function(o){var s=o.startX,r=o.startY;t+=s,n+=r,i+=1}),t/=i,n/=i,{pageX:t,pageY:n}}var FS={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var t=this.element.ownerDocument,n=t.body||t.documentElement;this.body=n,this.scrollbarWidth=window.innerWidth-t.documentElement.clientWidth,this.initialBodyPaddingRight=n.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(n).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t=this.options,n=this.parent,i;t.inline&&(i={width:Math.max(n.offsetWidth,t.minWidth),height:Math.max(n.offsetHeight,t.minHeight)},this.parentData=i),(this.fulled||!i)&&(i=this.containerData),this.viewerData=Jt({},i)},renderViewer:function(){this.options.inline&&!this.fulled&&gn(this.viewer,this.viewerData)},initList:function(){var t=this,n=this.element,i=this.options,o=this.list,s=[];o.innerHTML="",nt(this.images,function(r,a){var c=r.src,u=r.alt||BS(c),d=t.getImageURL(r);if(c||d){var m=document.createElement("li"),f=document.createElement("img");nt(i.inheritedAttributes,function(h){var g=r.getAttribute(h);g!==null&&f.setAttribute(h,g)}),i.navbar&&(f.src=c||d),f.alt=u,f.setAttribute("data-original-url",d||c),m.setAttribute("data-index",a),m.setAttribute("data-viewer-action","view"),m.setAttribute("role","button"),i.keyboard&&m.setAttribute("tabindex",0),m.appendChild(f),o.appendChild(m),s.push(m)}}),this.items=s,nt(s,function(r){var a=r.firstElementChild,c,u;kl(a,"filled",!0),i.loading&&ye(r,no),ve(a,an,c=function(m){Qe(a,Ei,u),i.loading&&Ge(r,no),t.loadImage(m)},{once:!0}),ve(a,Ei,u=function(){Qe(a,an,c),i.loading&&Ge(r,no)},{once:!0})}),i.transition&&ve(n,ls,function(){ye(o,Nt)},{once:!0})},renderList:function(){var t=this.index,n=this.items[t];if(n){var i=n.nextElementSibling,o=parseInt(window.getComputedStyle(i||n).marginLeft,10),s=n.offsetWidth,r=s+o;gn(this.list,Jt({width:r*this.length-o},er({translateX:(this.viewerData.width-s)/2-r*t})))}},resetList:function(){var t=this.list;t.innerHTML="",Ge(t,Nt),gn(t,er({translateX:0}))},initImage:function(t){var n=this,i=this.options,o=this.image,s=this.viewerData,r=this.footer.offsetHeight,a=s.width,c=Math.max(s.height-r,r),u=this.imageData||{},d;this.imageInitializing={abort:function(){d.onload=null}},d=Wh(o,i,function(m,f){var h=m/f,g=Math.max(0,Math.min(1,i.initialCoverage)),b=a,x=c;n.imageInitializing=!1,c*h>a?x=a/h:b=c*h,g=gt(g)?g:.9,b=Math.min(b*g,m),x=Math.min(x*g,f);var y=(a-b)/2,N=(c-x)/2,w={left:y,top:N,x:y,y:N,width:b,height:x,oldRatio:1,ratio:b/m,aspectRatio:h,naturalWidth:m,naturalHeight:f},T=Jt({},w);i.rotatable&&(w.rotate=u.rotate||0,T.rotate=0),i.scalable&&(w.scaleX=u.scaleX||1,w.scaleY=u.scaleY||1,T.scaleX=1,T.scaleY=1),n.imageData=w,n.initialImageData=T,t&&t()})},renderImage:function(t){var n=this,i=this.image,o=this.imageData;if(gn(i,Jt({width:o.width,height:o.height,marginLeft:o.x,marginTop:o.y},er(o))),t)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&Gi(i,Nt)){var s=function(){n.imageRendering=!1,t()};this.imageRendering={abort:function(){Qe(i,pn,s)}},ve(i,pn,s,{once:!0})}else t()},resetImage:function(){var t=this.image;t&&(this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null,this.title.innerHTML="")}},HS={bind:function(){var t=this.options,n=this.viewer,i=this.canvas,o=this.element.ownerDocument;ve(n,uo,this.onClick=this.click.bind(this)),ve(n,Gd,this.onDragStart=this.dragstart.bind(this)),ve(i,Xd,this.onPointerDown=this.pointerdown.bind(this)),ve(o,Kd,this.onPointerMove=this.pointermove.bind(this)),ve(o,Yd,this.onPointerUp=this.pointerup.bind(this)),ve(o,$d,this.onKeyDown=this.keydown.bind(this)),ve(window,Zd,this.onResize=this.resize.bind(this)),t.zoomable&&t.zoomOnWheel&&ve(n,Qd,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleOnDblclick&&ve(i,El,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var t=this.options,n=this.viewer,i=this.canvas,o=this.element.ownerDocument;Qe(n,uo,this.onClick),Qe(n,Gd,this.onDragStart),Qe(i,Xd,this.onPointerDown),Qe(o,Kd,this.onPointerMove),Qe(o,Yd,this.onPointerUp),Qe(o,$d,this.onKeyDown),Qe(window,Zd,this.onResize),t.zoomable&&t.zoomOnWheel&&Qe(n,Qd,this.onWheel,{passive:!1,capture:!0}),t.toggleOnDblclick&&Qe(i,El,this.onDblclick)}},zS={click:function(t){var n=this.options,i=this.imageData,o=t.target,s=Xi(o,br);switch(!s&&o.localName==="img"&&o.parentElement.localName==="li"&&(o=o.parentElement,s=Xi(o,br)),to&&t.isTrusted&&o===this.canvas&&clearTimeout(this.clickCanvasTimeout),s){case"mix":this.played?this.stop():n.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(Xi(o,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(n.loop);break;case"play":this.play(n.fullscreen);break;case"next":this.next(n.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-i.scaleX||-1);break;case"flip-vertical":this.scaleY(-i.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(t){t.preventDefault(),this.viewed&&t.target===this.image&&(to&&t.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(t.isTrusted?t:t.detail&&t.detail.originalEvent))},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var n=this.element,i=this.options,o=this.image,s=this.index,r=this.viewerData;Ge(o,Go),i.loading&&Ge(this.canvas,no),o.style.cssText="height:0;"+"margin-left:".concat(r.width/2,"px;")+"margin-top:".concat(r.height/2,"px;")+"max-width:none!important;position:relative;width:0;",this.initImage(function(){us(o,jS,i.movable),us(o,Nt,i.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,Ze(i.viewed)&&ve(n,ls,i.viewed,{once:!0}),vt(n,ls,{originalImage:t.images[s],index:s,image:o},{cancelable:!1})})})},loadImage:function(t){var n=t.target,i=n.parentNode,o=i.offsetWidth||30,s=i.offsetHeight||50,r=!!Xi(n,"filled");Wh(n,this.options,function(a,c){var u=a/c,d=o,m=s;s*u>o?r?d=s*u:m=o/u:r?m=o/u:d=s*u,gn(n,Jt({width:d,height:m},er({translateX:(o-d)/2,translateY:(s-m)/2})))})},keydown:function(t){var n=this.options;if(n.keyboard){var i=t.keyCode||t.which||t.charCode;switch(i){case 13:this.viewer.contains(t.target)&&this.click(t);break}if(this.fulled)switch(i){case 27:this.played?this.stop():n.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.played&&this.playing?this.playing.prev():this.prev(n.loop);break;case 38:t.preventDefault(),this.zoom(n.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(n.loop);break;case 40:t.preventDefault(),this.zoom(-n.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle());break}}},dragstart:function(t){t.target.localName==="img"&&t.preventDefault()},pointerdown:function(t){var n=this.options,i=this.pointers,o=t.buttons,s=t.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(gt(o)&&o!==1||gt(s)&&s!==0||t.ctrlKey))){t.preventDefault(),t.changedTouches?nt(t.changedTouches,function(a){i[a.identifier]=Us(a)}):i[t.pointerId||0]=Us(t);var r=n.movable?Qs:!1;n.zoomOnTouch&&n.zoomable&&Object.keys(i).length>1?r=Bo:n.slideOnTouch&&(t.pointerType==="touch"||t.type==="touchstart")&&this.isSwitchable()&&(r=zh),n.transition&&(r===Qs||r===Bo)&&Ge(this.image,Nt),this.action=r}},pointermove:function(t){var n=this.pointers,i=this.action;!this.viewed||!i||(t.preventDefault(),t.changedTouches?nt(t.changedTouches,function(o){Jt(n[o.identifier]||{},Us(o,!0))}):Jt(n[t.pointerId||0]||{},Us(t,!0)),this.change(t))},pointerup:function(t){var n=this,i=this.options,o=this.action,s=this.pointers,r;t.changedTouches?nt(t.changedTouches,function(a){r=s[a.identifier],delete s[a.identifier]}):(r=s[t.pointerId||0],delete s[t.pointerId||0]),o&&(t.preventDefault(),i.transition&&(o===Qs||o===Bo)&&ye(this.image,Nt),this.action=!1,to&&o!==Bo&&r&&Date.now()-r.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),i.toggleOnDblclick&&this.viewed&&t.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){vt(n.image,El,{originalEvent:t})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){n.imageClicked=!1},500)):(this.imageClicked=!1,i.backdrop&&i.backdrop!=="static"&&t.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){vt(n.canvas,uo,{originalEvent:t})},50)))))},resize:function(){var t=this;if(!(!this.isShown||this.hiding)&&(this.fulled&&(this.close(),this.initBody(),this.open()),this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}nt(this.player.getElementsByTagName("img"),function(n){ve(n,an,t.loadImage.bind(t),{once:!0}),vt(n,an)})}},wheel:function(t){var n=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){n.wheeling=!1},50);var i=Number(this.options.zoomRatio)||.1,o=1;t.deltaY?o=t.deltaY>0?1:-1:t.wheelDelta?o=-t.wheelDelta/120:t.detail&&(o=t.detail>0?1:-1),this.zoom(-o*i,!0,null,t)}}},GS={show:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=this.element,i=this.options;if(i.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if(Ze(i.show)&&ve(n,em,i.show,{once:!0}),vt(n,em)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var o=this.viewer;if(Ge(o,xi),o.setAttribute("role","dialog"),o.setAttribute("aria-labelledby",this.title.id),o.setAttribute("aria-modal",!0),o.removeAttribute("aria-hidden"),i.transition&&!t){var s=this.shown.bind(this);this.transitioning={abort:function(){Qe(o,pn,s),Ge(o,sn)}},ye(o,Nt),o.initialOffsetWidth=o.offsetWidth,ve(o,pn,s,{once:!0}),ye(o,sn)}else ye(o,sn),this.shown();return this},hide:function(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.element,o=this.options;if(o.inline||this.hiding||!(this.isShown||this.showing))return this;if(Ze(o.hide)&&ve(i,nm,o.hide,{once:!0}),vt(i,nm)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var s=this.viewer,r=this.image,a=function(){Ge(s,sn),t.hidden()};if(o.transition&&!n){var c=function(m){m&&m.target===s&&(Qe(s,pn,c),t.hidden())},u=function(){Gi(s,Nt)?(ve(s,pn,c),Ge(s,sn)):a()};this.transitioning={abort:function(){t.viewed&&Gi(r,Nt)?Qe(r,pn,u):Gi(s,Nt)&&Qe(s,pn,c)}},this.viewed&&Gi(r,Nt)?(ve(r,pn,u,{once:!0}),this.zoomTo(0,!1,null,null,!0)):u()}else a();return this},view:function(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(n=Number(n)||0,this.hiding||this.played||n<0||n>=this.length||this.viewed&&n===this.index)return this;if(!this.isShown)return this.index=n,this.show();this.viewing&&this.viewing.abort();var i=this.element,o=this.options,s=this.title,r=this.canvas,a=this.items[n],c=a.querySelector("img"),u=Xi(c,"originalUrl"),d=c.getAttribute("alt"),m=document.createElement("img");if(nt(o.inheritedAttributes,function(x){var y=c.getAttribute(x);y!==null&&m.setAttribute(x,y)}),m.src=u,m.alt=d,Ze(o.view)&&ve(i,om,o.view,{once:!0}),vt(i,om,{originalImage:this.images[n],index:n,image:m})===!1||!this.isShown||this.hiding||this.played)return this;var f=this.items[this.index];f&&(Ge(f,Ms),f.removeAttribute("aria-selected")),ye(a,Ms),a.setAttribute("aria-selected",!0),o.focus&&a.focus(),this.image=m,this.viewed=!1,this.index=n,this.imageData={},ye(m,Go),o.loading&&ye(r,no),r.innerHTML="",r.appendChild(m),this.renderList(),s.innerHTML="";var h=function(){var y=t.imageData,N=Array.isArray(o.title)?o.title[1]:o.title;s.innerHTML=US(Ze(N)?N.call(t,m,y):"".concat(d," (").concat(y.naturalWidth," × ").concat(y.naturalHeight,")"))},g,b;return ve(i,ls,h,{once:!0}),this.viewing={abort:function(){Qe(i,ls,h),m.complete?t.imageRendering?t.imageRendering.abort():t.imageInitializing&&t.imageInitializing.abort():(m.src="",Qe(m,an,g),t.timeout&&clearTimeout(t.timeout))}},m.complete?this.load():(ve(m,an,g=function(){Qe(m,Ei,b),t.load()},{once:!0}),ve(m,Ei,b=function(){Qe(m,an,g),t.timeout&&(clearTimeout(t.timeout),t.timeout=!1),Ge(m,Go),o.loading&&Ge(t.canvas,no)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){Ge(m,Go),t.timeout=!1},1e3)),this},prev:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=this.index-1;return n<0&&(n=t?this.length-1:0),this.view(n),this},next:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=this.length-1,i=this.index+1;return i>n&&(i=t?0:n),this.view(i),this},move:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.imageData;return this.moveTo(Wi(t)?t:i.x+Number(t),Wi(n)?n:i.y+Number(n)),this},moveTo:function(t){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=this.element,r=this.options,a=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&r.movable){var c=a.x,u=a.y,d=!1;if(gt(t)?d=!0:t=c,gt(i)?d=!0:i=u,d){if(Ze(r.move)&&ve(s,sm,r.move,{once:!0}),vt(s,sm,{x:t,y:i,oldX:c,oldY:u,originalEvent:o})===!1)return this;a.x=t,a.y=i,a.left=t,a.top=i,this.moving=!0,this.renderImage(function(){n.moving=!1,Ze(r.moved)&&ve(s,rm,r.moved,{once:!0}),vt(s,rm,{x:t,y:i,oldX:c,oldY:u,originalEvent:o},{cancelable:!1})})}}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var n=this,i=this.element,o=this.options,s=this.imageData;if(t=Number(t),gt(t)&&this.viewed&&!this.played&&o.rotatable){var r=s.rotate;if(Ze(o.rotate)&&ve(i,am,o.rotate,{once:!0}),vt(i,am,{degree:t,oldDegree:r})===!1)return this;s.rotate=t,this.rotating=!0,this.renderImage(function(){n.rotating=!1,Ze(o.rotated)&&ve(i,lm,o.rotated,{once:!0}),vt(i,lm,{degree:t,oldDegree:r},{cancelable:!1})})}return this},scaleX:function(t){return this.scale(t,this.imageData.scaleY),this},scaleY:function(t){return this.scale(this.imageData.scaleX,t),this},scale:function(t){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,o=this.element,s=this.options,r=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&s.scalable){var a=r.scaleX,c=r.scaleY,u=!1;if(gt(t)?u=!0:t=a,gt(i)?u=!0:i=c,u){if(Ze(s.scale)&&ve(o,cm,s.scale,{once:!0}),vt(o,cm,{scaleX:t,scaleY:i,oldScaleX:a,oldScaleY:c})===!1)return this;r.scaleX=t,r.scaleY=i,this.scaling=!0,this.renderImage(function(){n.scaling=!1,Ze(s.scaled)&&ve(o,um,s.scaled,{once:!0}),vt(o,um,{scaleX:t,scaleY:i,oldScaleX:a,oldScaleY:c},{cancelable:!1})})}}return this},zoom:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=this.imageData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(s.width*t/s.naturalWidth,n,i,o),this},zoomTo:function(t){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,a=this.element,c=this.options,u=this.pointers,d=this.imageData,m=d.x,f=d.y,h=d.width,g=d.height,b=d.naturalWidth,x=d.naturalHeight;if(t=Math.max(0,t),gt(t)&&this.viewed&&!this.played&&(r||c.zoomable)){if(!r){var y=Math.max(.01,c.minZoomRatio),N=Math.min(100,c.maxZoomRatio);t=Math.min(Math.max(t,y),N)}if(s)switch(s.type){case"wheel":c.zoomRatio>=.055&&t>.95&&t<1.05&&(t=1);break;case"pointermove":case"touchmove":case"mousemove":t>.99&&t<1.01&&(t=1);break}var w=b*t,T=x*t,S=w-h,v=T-g,E=d.ratio;if(Ze(c.zoom)&&ve(a,dm,c.zoom,{once:!0}),vt(a,dm,{ratio:t,oldRatio:E,originalEvent:s})===!1)return this;if(this.zooming=!0,s){var U=qS(this.viewer),q=u&&Object.keys(u).length>0?OS(u):{pageX:s.pageX,pageY:s.pageY};d.x-=S*((q.pageX-U.left-m)/h),d.y-=v*((q.pageY-U.top-f)/g)}else $i(o)&>(o.x)&>(o.y)?(d.x-=S*((o.x-m)/h),d.y-=v*((o.y-f)/g)):(d.x-=S/2,d.y-=v/2);d.left=d.x,d.top=d.y,d.width=w,d.height=T,d.oldRatio=E,d.ratio=t,this.renderImage(function(){n.zooming=!1,Ze(c.zoomed)&&ve(a,mm,c.zoomed,{once:!0}),vt(a,mm,{ratio:t,oldRatio:E,originalEvent:s},{cancelable:!1})}),i&&this.tooltip()}return this},play:function(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var i=this.element,o=this.options;if(Ze(o.play)&&ve(i,pm,o.play,{once:!0}),vt(i,pm)===!1)return this;var s=this.player,r=this.loadImage.bind(this),a=[],c=0,u=0;if(this.played=!0,this.onLoadWhenPlay=r,n&&this.requestFullscreen(n),ye(s,Hi),nt(this.items,function(f,h){var g=f.querySelector("img"),b=document.createElement("img");b.src=Xi(g,"originalUrl"),b.alt=g.getAttribute("alt"),b.referrerPolicy=g.referrerPolicy,c+=1,ye(b,Js),us(b,Nt,o.transition),Gi(f,Ms)&&(ye(b,sn),u=h),a.push(b),ve(b,an,r,{once:!0}),s.appendChild(b)}),gt(o.interval)&&o.interval>0){var d=function(){clearTimeout(t.playing.timeout),Ge(a[u],sn),u-=1,u=u>=0?u:c-1,ye(a[u],sn),t.playing.timeout=setTimeout(d,o.interval)},m=function(){clearTimeout(t.playing.timeout),Ge(a[u],sn),u+=1,u=u<c?u:0,ye(a[u],sn),t.playing.timeout=setTimeout(m,o.interval)};c>1&&(this.playing={prev:d,next:m,timeout:setTimeout(m,o.interval)})}return this},stop:function(){var t=this;if(!this.played)return this;var n=this.element,i=this.options;if(Ze(i.stop)&&ve(n,fm,i.stop,{once:!0}),vt(n,fm)===!1)return this;var o=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,nt(o.getElementsByTagName("img"),function(s){Qe(s,an,t.onLoadWhenPlay)}),Ge(o,Hi),o.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,n=this.options,i=this.viewer,o=this.image,s=this.list;return!this.isShown||this.played||this.fulled||!n.inline?this:(this.fulled=!0,this.open(),ye(this.button,Hd),n.transition&&(Ge(s,Nt),this.viewed&&Ge(o,Nt)),ye(i,vl),i.setAttribute("role","dialog"),i.setAttribute("aria-labelledby",this.title.id),i.setAttribute("aria-modal",!0),i.removeAttribute("style"),gn(i,{zIndex:n.zIndex}),n.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=Jt({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){n.transition&&setTimeout(function(){ye(o,Nt),ye(s,Nt)},0)})}),this)},exit:function(){var t=this,n=this.options,i=this.viewer,o=this.image,s=this.list;return!this.isShown||this.played||!this.fulled||!n.inline?this:(this.fulled=!1,this.close(),Ge(this.button,Hd),n.transition&&(Ge(s,Nt),this.viewed&&Ge(o,Nt)),n.focus&&this.clearEnforceFocus(),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),Ge(i,vl),gn(i,{zIndex:n.zIndexInline}),this.viewerData=Jt({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){n.transition&&setTimeout(function(){ye(o,Nt),ye(s,Nt)},0)})}),this)},tooltip:function(){var t=this,n=this.options,i=this.tooltipBox,o=this.imageData;return!this.viewed||this.played||!n.tooltip?this:(i.textContent="".concat(Math.round(o.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):n.transition?(this.fading&&vt(i,pn),ye(i,Hi),ye(i,Js),ye(i,Nt),i.removeAttribute("aria-hidden"),i.initialOffsetWidth=i.offsetWidth,ye(i,sn)):(ye(i,Hi),i.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){n.transition?(ve(i,pn,function(){Ge(i,Hi),Ge(i,Js),Ge(i,Nt),i.setAttribute("aria-hidden",!0),t.fading=!1},{once:!0}),Ge(i,sn),t.fading=!0):(Ge(i,Hi),i.setAttribute("aria-hidden",!0)),t.tooltipping=!1},1e3),this)},toggle:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,t):this.zoomTo(1,!0,null,t),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=Jt({},this.initialImageData),this.renderImage()),this},update:function(){var t=this,n=this.element,i=this.options,o=this.isImg;if(o&&!n.parentNode)return this.destroy();var s=[];if(nt(o?[n]:n.querySelectorAll("img"),function(u){Ze(i.filter)?i.filter.call(t,u)&&s.push(u):t.getImageURL(u)&&s.push(u)}),!s.length)return this;if(this.images=s,this.length=s.length,this.ready){var r=[];if(nt(this.items,function(u,d){var m=u.querySelector("img"),f=s[d];f&&m?(f.src!==m.src||f.alt!==m.alt)&&r.push(d):r.push(d)}),gn(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var a=r.indexOf(this.index);if(a>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-a,this.length-1),0));else{var c=this.items[this.index];ye(c,Ms),c.setAttribute("aria-selected",!0)}}}else this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var t=this.element,n=this.options;return t[Te]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),n.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):n.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),n.inline||Qe(t,uo,this.onStart),t[Te]=void 0,this):this}},WS={getImageURL:function(t){var n=this.options.url;return cs(n)?n=t.getAttribute(n):Ze(n)?n=n.call(this,t):n="",n},enforceFocus:function(){var t=this;this.clearEnforceFocus(),ve(document,Wd,this.onFocusin=function(n){var i=t.viewer,o=n.target;if(!(o===document||o===i||i.contains(o))){for(;o;){if(o.getAttribute("tabindex")!==null||o.getAttribute("aria-modal")==="true")return;o=o.parentElement}i.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Qe(document,Wd,this.onFocusin),this.onFocusin=null)},open:function(){var t=this.body;ye(t,zd),this.scrollbarWidth>0&&(t.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var t=this.body;Ge(t,zd),this.scrollbarWidth>0&&(t.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var t=this.element,n=this.options,i=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,n.focus&&(i.focus(),this.enforceFocus()),Ze(n.shown)&&ve(t,tm,n.shown,{once:!0}),vt(t,tm)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,n=this.options,i=this.viewer;n.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),ye(i,xi),i.removeAttribute("role"),i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-modal"),i.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(Ze(n.hidden)&&ve(t,im,n.hidden,{once:!0}),vt(t,im,null,{cancelable:!1}))},requestFullscreen:function(t){var n=this.element.ownerDocument;if(this.fulled&&!(n.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement)){var i=n.documentElement;i.requestFullscreen?$i(t)?i.requestFullscreen(t):i.requestFullscreen():i.webkitRequestFullscreen?i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.mozRequestFullScreen?i.mozRequestFullScreen():i.msRequestFullscreen&&i.msRequestFullscreen()}},exitFullscreen:function(){var t=this.element.ownerDocument;this.fulled&&(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement)&&(t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen())},change:function(t){var n=this.options,i=this.pointers,o=i[Object.keys(i)[0]];if(o){var s=o.endX-o.startX,r=o.endY-o.startY;switch(this.action){case Qs:(s!==0||r!==0)&&(this.pointerMoved=!0,this.move(s,r,t));break;case Bo:this.zoom(LS(i),!1,null,t);break;case zh:{this.action="switched";var a=Math.abs(s);a>1&&a>Math.abs(r)&&(this.pointers={},s>1?this.prev(n.loop):s<-1&&this.next(n.loop));break}}nt(i,function(c){c.startX=c.endX,c.startY=c.endY})}},isSwitchable:function(){var t=this.imageData,n=this.viewerData;return this.length>1&&t.x>=0&&t.y>=0&&t.width<=n.width&&t.height<=n.height}},$S=Fn.Viewer,XS=(function(e){return function(){return e+=1,e}})(-1),$h=(function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(NS(this,e),!t||t.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=Jt({},Fd,$i(n)&&n),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.imageClicked=!1,this.imageData={},this.index=this.options.initialViewIndex,this.isImg=!1,this.isShown=!1,this.length=0,this.moving=!1,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.rotating=!1,this.scaling=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.wheeling=!1,this.zooming=!1,this.pointerMoved=!1,this.id=XS(),this.init()}return yS(e,[{key:"init",value:function(){var n=this,i=this.element,o=this.options;if(!i[Te]){i[Te]=this,o.focus&&!o.keyboard&&(o.focus=!1);var s=i.localName==="img",r=[];if(nt(s?[i]:i.querySelectorAll("img"),function(u){Ze(o.filter)?o.filter.call(n,u)&&r.push(u):n.getImageURL(u)&&r.push(u)}),this.isImg=s,this.length=r.length,this.images=r,this.initBody(),Wi(document.createElement(Te).style.transition)&&(o.transition=!1),o.inline){var a=0,c=function(){if(a+=1,a===n.length){var d;n.initializing=!1,n.delaying={abort:function(){clearTimeout(d)}},d=setTimeout(function(){n.delaying=!1,n.build()},0)}};this.initializing={abort:function(){nt(r,function(d){d.complete||(Qe(d,an,c),Qe(d,Ei,c))})}},nt(r,function(u){if(u.complete)c();else{var d,m;ve(u,an,d=function(){Qe(u,Ei,m),c()},{once:!0}),ve(u,Ei,m=function(){Qe(u,an,d),c()},{once:!0})}})}else ve(i,uo,this.onStart=function(u){var d=u.target;d.localName==="img"&&(!Ze(o.filter)||o.filter.call(n,d))&&n.view(n.images.indexOf(d))})}}},{key:"build",value:function(){if(!this.ready){var n=this.element,i=this.options,o=n.parentNode,s=document.createElement("div");s.innerHTML=ES;var r=s.querySelector(".".concat(Te,"-container")),a=r.querySelector(".".concat(Te,"-title")),c=r.querySelector(".".concat(Te,"-toolbar")),u=r.querySelector(".".concat(Te,"-navbar")),d=r.querySelector(".".concat(Te,"-button")),m=r.querySelector(".".concat(Te,"-canvas"));if(this.parent=o,this.viewer=r,this.title=a,this.toolbar=c,this.navbar=u,this.button=d,this.canvas=m,this.footer=r.querySelector(".".concat(Te,"-footer")),this.tooltipBox=r.querySelector(".".concat(Te,"-tooltip")),this.player=r.querySelector(".".concat(Te,"-player")),this.list=r.querySelector(".".concat(Te,"-list")),r.id="".concat(Te).concat(this.id),a.id="".concat(Te,"Title").concat(this.id),ye(a,i.title?Vs(Array.isArray(i.title)?i.title[0]:i.title):xi),ye(u,i.navbar?Vs(i.navbar):xi),us(d,xi,!i.button),i.keyboard&&d.setAttribute("tabindex",0),i.backdrop&&(ye(r,"".concat(Te,"-backdrop")),!i.inline&&i.backdrop!=="static"&&kl(m,br,"hide")),cs(i.className)&&i.className&&i.className.split(Cc).forEach(function(w){ye(r,w)}),i.toolbar){var f=document.createElement("ul"),h=$i(i.toolbar),g=Is.slice(0,3),b=Is.slice(7,9),x=Is.slice(9);h||ye(c,Vs(i.toolbar)),nt(h?i.toolbar:Is,function(w,T){var S=h&&$i(w),v=h?Ac(T):w,E=S&&!Wi(w.show)?w.show:w;if(!(!E||!i.zoomable&&g.indexOf(v)!==-1||!i.rotatable&&b.indexOf(v)!==-1||!i.scalable&&x.indexOf(v)!==-1)){var U=S&&!Wi(w.size)?w.size:w,q=S&&!Wi(w.click)?w.click:w,$=document.createElement("li");i.keyboard&&$.setAttribute("tabindex",0),$.setAttribute("role","button"),ye($,"".concat(Te,"-").concat(v)),Ze(q)||kl($,br,v),gt(E)&&ye($,Vs(E)),["small","large"].indexOf(U)!==-1?ye($,"".concat(Te,"-").concat(U)):v==="play"&&ye($,"".concat(Te,"-large")),Ze(q)&&ve($,uo,q),f.appendChild($)}}),c.appendChild(f)}else ye(c,xi);if(!i.rotatable){var y=c.querySelectorAll('li[class*="rotate"]');ye(y,Go),nt(y,function(w){c.appendChild(w)})}if(i.inline)ye(d,SS),gn(r,{zIndex:i.zIndexInline}),window.getComputedStyle(o).position==="static"&&gn(o,{position:"relative"}),o.insertBefore(r,n.nextSibling);else{ye(d,kS),ye(r,vl),ye(r,Js),ye(r,xi),gn(r,{zIndex:i.zIndex});var N=i.container;cs(N)&&(N=n.ownerDocument.querySelector(N)),N||(N=this.body),N.appendChild(r)}if(i.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Ze(i.ready)&&ve(n,Jd,i.ready,{once:!0}),vt(n,Jd)===!1){this.ready=!1;return}this.ready&&i.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=$S,e}},{key:"setDefaults",value:function(n){Jt(Fd,$i(n)&&n)}}])})();Jt($h.prototype,FS,HS,zS,GS,WS);const KS=()=>window.innerWidth<=768||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);class YS{constructor(t={}){this.viewer=null,this.container=null,this.options={zoomStep:t.zoomStep||.2,minZoom:t.minZoom||.1,maxZoom:t.maxZoom||5,enableKeyboard:t.enableKeyboard!==!1}}open(t,n=""){this.close(),this.container=document.createElement("div"),this.container.style.display="none";const i=document.createElement("img");i.src=t,i.alt=n,this.container.appendChild(i),document.body.appendChild(this.container);const o=KS(),s=o?{zoomIn:1,zoomOut:1,oneToOne:0,reset:1,prev:0,play:0,next:0,rotateLeft:1,rotateRight:1,flipHorizontal:0,flipVertical:0}:{zoomIn:1,zoomOut:1,oneToOne:1,reset:1,prev:0,play:0,next:0,rotateLeft:1,rotateRight:1,flipHorizontal:1,flipVertical:1};this.viewer=new $h(this.container,{inline:!1,button:!0,navbar:!1,title:!!n,toolbar:s,fullscreen:!o,keyboard:this.options.enableKeyboard,backdrop:!0,loading:!0,loop:!1,minZoomRatio:this.options.minZoom,maxZoomRatio:this.options.maxZoom,zoomRatio:this.options.zoomStep,hidden:()=>{this.cleanup()}}),this.viewer.show()}close(){this.viewer&&this.viewer.hide()}cleanup(){this.viewer&&(this.viewer.destroy(),this.viewer=null),this.container&&this.container.parentNode&&(this.container.parentNode.removeChild(this.container),this.container=null)}destroy(){this.close(),this.cleanup()}}function ZS(e){const t=e.getData("text/uri-list");if(t){const o=t.split(`
|
|
25
|
-
`).filter(s=>s&&!s.startsWith("#"));if(o.length>0&&hm(o[0]))return o[0].trim()}const n=e.getData("text/plain");if(n&&hm(n.trim()))return n.trim();const i=e.getData("text/html");if(i){const o=i.match(/<img[^>]+src=["']([^"']+)["']/i);if(o&&o[1])return o[1]}return null}function hm(e){if(!e)return!1;try{new URL(e)}catch{return!1}const t=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"],n=e.toLowerCase();return t.some(o=>n.includes(o))?!0:[/\.(jpg|jpeg|png|gif|webp|svg|bmp)(\?|$)/i,/\/image\//i,/\/images\//i,/\/img\//i,/\/photo\//i,/data:image\//i,/blob:/i].some(o=>o.test(e))}const QS=e=>{const t=e,{insertFragment:n,drop:i,pointerUp:o}=t,s=new YS({zoomStep:.3,minZoom:.1,maxZoom:5,enableKeyboard:!0});return t.insertFragment=(r,a,c)=>{var u;if((u=r==null?void 0:r.files)!=null&&u.length&&uu(r.files[0].type)){const d=r.files[0];du(e,d,a,!1);return}n(r,a,c)},t.drop=r=>{var a,c;if((c=(a=r.dataTransfer)==null?void 0:a.files)!=null&&c.length){const u=r.dataTransfer.files[0];if(uu(u.type)){const d=Ft(e,Ht(e,r.x,r.y));return du(e,u,d,!0),!0}if(r0(u.type)){const d=Ft(e,Ht(e,r.x,r.y));return(async()=>{try{const m=u.name.replace(/\.[^.]+$/,"");await mu.initialize();const f=await mu.addAsset({type:Vn.AUDIO,source:a0.LOCAL,name:u.name,blob:u,mimeType:u.type});await pu.updateCachedMedia(f.url,{metadata:{name:m}});const[h,g]=await Promise.all([l0(u),c0(u)]);let b;if(g){const x=`/__aitu_cache__/image/${f.id}-cover.png`;await pu.cacheMediaFromBlob(x,g,"image",{taskId:`${f.id}-cover`,name:`${m}-cover`}),b=x}await Ll(e,f.url,{title:m,duration:h,previewImageUrl:b},d,!0)}catch(m){console.error("[withImagePlugin] Failed to insert audio from drop:",m)}})(),!0}}if(r.dataTransfer){const u=ZS(r.dataTransfer);if(u){const d=Ft(e,Ht(e,r.x,r.y));return u0(e,u,d).catch(m=>{console.error("[withImagePlugin] Failed to insert image from URL:",m)}),!0}}return i(r)},t.pointerUp=r=>{const a=d0(e);if(a&&!Sp(e)&&!Zo(e)&&!Qo(e)){const c=Ft(e,Ht(e,r.x,r.y)),u=Ka(e,c);u&&nn.isMindElement(e,u)&&nn.hasImage(u)&&m0(e,u,c)&&a===u&&s.open(u.data.image.url)}o(r)},t},Do={MAX_CHARS_PER_LINE:50};function JS(e){const t=e.split(`
|
|
26
|
-
`),n=[];for(const i of t)if(i.length<=Do.MAX_CHARS_PER_LINE)n.push(i);else{let o=i;for(;o.length>0;){let s=Do.MAX_CHARS_PER_LINE;if(o.length>Do.MAX_CHARS_PER_LINE){const r=o.lastIndexOf(" ",Do.MAX_CHARS_PER_LINE);r>Do.MAX_CHARS_PER_LINE*.7&&(s=r)}n.push(o.substring(0,s).trim()),o=o.substring(s).trim()}}return n.join(`
|
|
27
|
-
`)}function eT(e){var i,o;if(!e)return!1;const t=!!e.text||!!((i=e.data)!=null&&i.text),n=!!e.elements||!!((o=e.data)!=null&&o.elements);return t&&!n}function tT(e){var n;const t=e;if(t.text)return t.text;if((n=t.data)!=null&&n.text)return t.data.text;if(typeof t.getData=="function"){const i=t.getData("text/plain");if(i)return i}return null}const nT=e=>{const{insertFragment:t}=e;return e.insertFragment=(n,i,o)=>{if(eT(n)){const s=tT(n);if(s&&s.trim()){const r=s.trim(),a=p0(r);if(a&&a.length>0){const u=Math.round(window.innerWidth*.5);f0(e,a,i,u);return}const c=JS(r);Cr.insertText(e,i,c);return}}t(n,i,o)},e},iT=e=>{const t=e;return t.renderImage=(n,i)=>{const o=jr.createRoot(n);o.render(l.jsxDEV(Bd,{...i},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/with-common.tsx",lineNumber:20,columnNumber:17},void 0));let s={...i};return{destroy:()=>{setTimeout(()=>{o.unmount()},0)},update:a=>{s={...s,...a},o.render(l.jsxDEV(Bd,{...s},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/plugins/with-common.tsx",lineNumber:30,columnNumber:21},void 0))}}},nT(QS(t))},oT=p.forwardRef(({children:e,gap:t,align:n,justifyContent:i,className:o,style:s},r)=>l.jsxDEV("div",{className:Y("stack stack_horizontal",o),style:{"--gap":t,alignItems:n,justifyContent:i,...s},ref:r,children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/stack.tsx",lineNumber:23,columnNumber:7},void 0)),sT=p.forwardRef(({children:e,gap:t,align:n,justifyContent:i,className:o,style:s},r)=>l.jsxDEV("div",{className:Y("stack stack_vertical",o),style:{"--gap":t,justifyItems:n,justifyContent:i,...s},ref:r,children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/stack.tsx",lineNumber:45,columnNumber:7},void 0)),ft={Row:oT,Col:sT},Ye=_n.forwardRef(({children:e,padding:t,className:n,style:i,...o},s)=>l.jsxDEV("div",{className:Y("island",n),style:{"--padding":t,...i},ref:s,...o,children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/island.tsx",lineNumber:16,columnNumber:5},void 0)),Xh=e=>e?typeof e=="string"?e:Un(e)&&e.type==="solid"&&e.solid?e.solid.color:null:null,rT=(e,t)=>{Hn.setFillColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{if(!cn(e,n))return;const o=n.fill,s=Xh(o)||Tp(e,n);if(!h0(s))return;const r=ki(s),a=ho(t)?r:go(r,t);ue.setNode(e,{fill:a},i)}})},aT=(e,t)=>{Hn.setFillColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{if(!cn(e,n))return;const o=n.fill,s=Xh(o)||Tp(e,n),r=typeof s=="string"?so(s):void 0;Ol(t)?ue.setNode(e,{fill:"none"},i):Fl(r)||ho(r)?ue.setNode(e,{fill:t},i):ue.setNode(e,{fill:go(t,r)},i)}})},lT=(e,t)=>{Hn.setStrokeColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{const o=_p(e,n),s=ki(o),r=ho(t)?s:go(s,t);ue.setNode(e,{strokeColor:r},i)}})},cT=(e,t)=>{Hn.setStrokeColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{const o=_p(e,n),s=so(o);Ol(t)?ue.setNode(e,{strokeColor:"none"},i):Fl(s)||ho(s)?ue.setNode(e,{strokeColor:t},i):ue.setNode(e,{strokeColor:go(t,s)},i)}})},uT=(e,t)=>{Hn.setStrokeStyle(e,t,{getMemorizeKey:zn,callback:(n,i)=>{ue.setNode(e,{strokeStyle:t},i)}})},gm=(e,t)=>{Hn.setStrokeWidth(e,t,{getMemorizeKey:zn,callback:(n,i)=>{ue.setNode(e,{strokeWidth:t},i)}})},dT=(e,t,n)=>{const i=so(t);Ol(n)?Jn.setTextColor(e,null):Fl(i)||ho(i)?Jn.setTextColor(e,n):Jn.setTextColor(e,go(n,i))},mT=(e,t,n)=>{const i=ki(t),o=ho(n)?i:go(i,n);Jn.setTextColor(e,o)},Kh=(e,t)=>{try{Jn.setFontSize(e,t,16)}catch{const i=Tt(e);i&&i.length>0&&i.forEach(o=>{try{o.addMark("font-size",t)}catch(s){console.error("Failed to set font size mark:",s)}})}},pT=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),Ee.addMark(i,"font-family",t)}catch(o){console.error("Failed to set font family:",o)}})},Ca=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),t?Ee.addMark(i,"text-shadow",t):Ee.removeMark(i,"text-shadow")}catch(o){console.error("Failed to set text shadow:",o)}})},bm=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),t?Ee.addMark(i,"text-gradient",t):Ee.removeMark(i,"text-gradient")}catch(o){console.error("Failed to set text gradient:",o)}})},Yh=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),Ee.addMark(i,"font-weight",String(t))}catch(o){console.error("Failed to set font weight:",o)}})},fT=(e,t)=>{try{let n;t==="left"?n=Qi.left:t==="center"?n=Qi.center:n=Qi.right,Jn.setTextAlign(e,n)}catch(n){console.error("Failed to set text align:",n)}},hT=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),Ee.addMark(i,"line-height",String(t))}catch(o){console.error("Failed to set line height:",o)}})},gT=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i);const o=typeof t=="number"?`${t}px`:t;Ee.addMark(i,"letter-spacing",o)}catch(o){console.error("Failed to set letter spacing:",o)}})},bT=e=>{const t=Tt(e);t&&t.length>0&&t.forEach(n=>{try{At(n);const i=Ee.marks(n);(i?!!i.bold:!1)?Ee.removeMark(n,"bold"):Ee.addMark(n,"bold",!0)}catch(i){console.error("Failed to toggle bold:",i)}})},xT=e=>{const t=Tt(e);t&&t.length>0&&t.forEach(n=>{try{At(n);const i=Ee.marks(n);(i?!!i.italic:!1)?Ee.removeMark(n,"italic"):Ee.addMark(n,"italic",!0)}catch(i){console.error("Failed to toggle italic:",i)}})},NT=e=>{const t=Tt(e);t&&t.length>0&&t.forEach(n=>{try{At(n);const i=Ee.marks(n);(i?!!i.underlined:!1)?Ee.removeMark(n,"underlined"):Ee.addMark(n,"underlined",!0)}catch(i){console.error("Failed to toggle underline:",i)}})},yT=e=>{const t=Tt(e);t&&t.length>0&&t.forEach(n=>{try{At(n);const i=Ee.marks(n);(i?!!i.strikethrough:!1)?Ee.removeMark(n,"strikethrough"):Ee.addMark(n,"strikethrough",!0)}catch(i){console.error("Failed to toggle strikethrough:",i)}})},wT=e=>{const t=Tt(e);t&&t.length>0&&t.forEach(n=>{try{At(n);const i=Ee.marks(n);(i?!!i.superscript:!1)?Ee.removeMark(n,"superscript"):(Ee.removeMark(n,"subscript"),Ee.addMark(n,"superscript",!0))}catch(i){console.error("Failed to toggle superscript:",i)}})},vT=e=>{const t=Tt(e);t&&t.length>0&&t.forEach(n=>{try{At(n);const i=Ee.marks(n);(i?!!i.subscript:!1)?Ee.removeMark(n,"subscript"):(Ee.removeMark(n,"superscript"),Ee.addMark(n,"subscript",!0))}catch(i){console.error("Failed to toggle subscript:",i)}})},ET=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),t?Ee.addMark(i,"background-color",t):Ee.removeMark(i,"background-color")}catch(o){console.error("Failed to set background color:",o)}})},kT=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),t&&t!=="none"?Ee.addMark(i,"text-transform",t):Ee.removeMark(i,"text-transform")}catch(o){console.error("Failed to set text transform:",o)}})},ST=(e,t,n)=>{const i=Tt(e);i&&i.length>0&&i.forEach(o=>{try{At(o),t&&t>0?(Ee.addMark(o,"text-stroke",t),n&&Ee.addMark(o,"text-stroke-color",n)):(Ee.removeMark(o,"text-stroke"),Ee.removeMark(o,"text-stroke-color"))}catch(s){console.error("Failed to set text stroke:",s)}})},TT=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),t?Ee.addMark(i,"text-decoration-style",t):Ee.removeMark(i,"text-decoration-style")}catch(o){console.error("Failed to set text decoration style:",o)}})},DT=(e,t)=>{const n=Tt(e);n&&n.length>0&&n.forEach(i=>{try{At(i),t?Ee.addMark(i,"text-decoration-color",t):Ee.removeMark(i,"text-decoration-color")}catch(o){console.error("Failed to set text decoration color:",o)}})},_T=e=>{const t=Tt(e);if(t&&t.length>0){const n=t[0];try{return At(n),Ee.marks(n)||{}}catch(i){return console.error("Failed to get text marks:",i),{}}}return{}},jT=e=>{const t=Tt(e);if(t&&t.length>0){const n=t[0];try{const{selection:i}=n;if(i){const o=Array.from(Ee.nodes(n,{at:i,match:s=>{const r=s.type==="paragraph",a="align"in s;return Ee.isBlock(n,s)&&(r||a)}}));if(o.length>0){const[s]=o[0],r=s.align;if(r===Qi.right||r==="right")return"right";if(r===Qi.center||r==="center")return"center";if(r===Qi.left||r==="left")return"left"}}}catch(i){console.error("Failed to get text align:",i)}}return"left"},PT=(e,t)=>{Hn.setFillColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{if(!cn(e,n))return;const o=Dp(t),s={type:"gradient",gradient:t,fallbackColor:o};ue.setNode(e,{fill:o,fillConfig:s},i)}})},xm=(e,t)=>{Hn.setFillColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{if(!cn(e,n))return;const o="#FFFFFF",s={type:"image",image:t,fallbackColor:o};ue.setNode(e,{fill:o,fillConfig:s},i)}})},CT=(e,t)=>{Hn.setFillColor(e,null,{getMemorizeKey:zn,callback:(n,i)=>{if(!cn(e,n))return;const o=n.fillConfig,s=n.fill;if((o==null?void 0:o.type)!==t)switch(t){case"solid":{let r="#FFFFFF";typeof s=="string"&&s!=="none"?r=s:o!=null&&o.solid&&(r=o.solid.color),ue.setNode(e,{fill:r,fillConfig:void 0},i);break}case"gradient":{const r={type:"linear",angle:90,stops:[{offset:0,color:"#FFFFFF"},{offset:1,color:"#000000"}]},a=(o==null?void 0:o.gradient)||r,c=Dp(a),u={type:"gradient",gradient:a,fallbackColor:c};ue.setNode(e,{fill:c,fillConfig:u},i);break}case"image":{const r={imageUrl:"",mode:"stretch",scale:1,offsetX:0,offsetY:0,rotation:0},a="#FFFFFF",c={type:"image",image:(o==null?void 0:o.image)||r,fallbackColor:a};ue.setNode(e,{fill:a,fillConfig:c},i);break}default:return}}})},AT=(e,t)=>{const n=Be(e);for(const i of n)if(Ct(i)){const o=e.children.findIndex(s=>s.id===i.id);o!==-1&&ue.setNode(e,{fillColor:t},[o])}},MT=({board:e,currentColor:t,fontColorIcon:n,title:i})=>{const[o,s]=p.useState(!1),r=F.getBoardContainer(e),a=p.useCallback(u=>{dT(e,t||u,u)},[e,t]),c=p.useCallback(u=>{t&&mT(e,t,u)},[e,t]);return l.jsxDEV(at,{sideOffset:12,open:o,onOpenChange:u=>{s(u)},placement:"top",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button"),selected:o,visible:!0,icon:n,type:"button",tooltip:i,"aria-label":i,onPointerUp:()=>{s(!o)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-color-button.tsx",lineNumber:54,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-color-button.tsx",lineNumber:53,columnNumber:7},void 0),l.jsxDEV(ct,{container:r,children:l.jsxDEV(Ye,{padding:4,className:Y(`${Mt}`),children:l.jsxDEV(Si,{value:t,onChange:a,onOpacityChange:c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-color-button.tsx",lineNumber:72,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-color-button.tsx",lineNumber:68,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-color-button.tsx",lineNumber:67,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-color-button.tsx",lineNumber:45,columnNumber:5},void 0)},Sl=[{key:"title",labelZh:"标题",labelEn:"Title",previewSize:26,...jn.title},{key:"subtitle",labelZh:"副标题",labelEn:"Subtitle",previewSize:22,...jn.subtitle},{key:"h1",labelZh:"标题 1",labelEn:"Heading 1",previewSize:20,...jn.h1,divider:!0},{key:"h2",labelZh:"标题 2",labelEn:"Heading 2",previewSize:18,...jn.h2},{key:"h3",labelZh:"标题 3",labelEn:"Heading 3",previewSize:16,...jn.h3},{key:"h4",labelZh:"标题 4",labelEn:"Heading 4",previewSize:15,...jn.h4},{key:"body",labelZh:"正文",labelEn:"Body",previewSize:14,...jn.body,divider:!0},{key:"caption",labelZh:"注释",labelEn:"Caption",previewSize:13,...jn.caption},{key:"footnote",labelZh:"脚注",labelEn:"Footnote",previewSize:12,...jn.footnote}],IT=e=>{if(!e)return null;const t=parseInt(e,10);if(isNaN(t))return null;for(const n of Sl)if(n.fontSize===t)return n.key;return null},VT=({board:e,currentFontSize:t,title:n})=>{const[i,o]=p.useState(!1),{language:s}=ke(),r=F.getBoardContainer(e),a=IT(t),c=p.useCallback(d=>{Kh(e,String(d.fontSize)),Yh(e,d.fontWeight),Jn.setTextColor(e,d.color),o(!1)},[e]),u=(()=>{if(a){const d=Sl.find(m=>m.key===a);if(d)return s==="zh"?d.labelZh:d.labelEn}return t||"16"})();return l.jsxDEV(at,{sideOffset:12,open:i,onOpenChange:o,placement:"bottom",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button"),selected:i,visible:!0,type:"button",tooltip:n,"aria-label":n,onPointerUp:()=>o(!i),children:l.jsxDEV("div",{style:{fontSize:"12px",fontWeight:"bold",minWidth:"20px"},children:u},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:97,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:88,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:87,columnNumber:7},void 0),l.jsxDEV(ct,{container:r,children:l.jsxDEV(Ye,{padding:4,className:Y(`${Mt}`),children:l.jsxDEV(ft.Col,{gap:0,style:{minWidth:"200px"},children:[l.jsxDEV("div",{style:{fontSize:"12px",color:"#666",marginBottom:"2px",padding:"4px 10px 0"},children:s==="zh"?"字体样式":"Font Style"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:108,columnNumber:13},void 0),l.jsxDEV("div",{style:{maxHeight:"320px",overflowY:"auto"},children:Sl.map(d=>{const m=a===d.key;return l.jsxDEV(_n.Fragment,{children:[d.divider&&l.jsxDEV("div",{style:{height:"1px",backgroundColor:"#e8e8e8",margin:"4px 10px"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:118,columnNumber:23},void 0),l.jsxDEV("div",{onClick:()=>c(d),style:{padding:"6px 10px",cursor:"pointer",backgroundColor:m?"#f0f7ff":"transparent",borderLeft:m?"3px solid #0052d9":"3px solid transparent",borderRadius:"2px",transition:"background-color 0.15s",display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"8px"},onMouseEnter:f=>{m||(f.currentTarget.style.backgroundColor="#f5f5f5")},onMouseLeave:f=>{m||(f.currentTarget.style.backgroundColor="transparent")},children:[l.jsxDEV("span",{style:{fontSize:`${d.previewSize}px`,fontWeight:d.fontWeight,color:d.color,lineHeight:1.4},children:s==="zh"?d.labelZh:d.labelEn},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:145,columnNumber:23},void 0),l.jsxDEV("span",{style:{fontSize:"11px",color:"#bbb",flexShrink:0},children:[d.fontSize,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:155,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:120,columnNumber:21},void 0)]},d.key,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:116,columnNumber:19},void 0)})},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:112,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:107,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:103,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:102,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/font-size-button.tsx",lineNumber:81,columnNumber:5},void 0)},UT=({board:e,currentColor:t,title:n,hasStrokeStyle:i,hasStrokeWidth:o,currentStrokeWidth:s,children:r})=>{const[a,c]=p.useState(!1),[u,d]=p.useState(String(s||2)),m=t&&ki(t),f=t?so(t):100,h=F.getBoardContainer(e);_n.useEffect(()=>{d(String(s||2))},[s]);const g=Ap(f)?g0:Mp(m)?b0:void 0,b=g?l.jsxDEV(g,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:67,columnNumber:32},void 0):void 0,x=E=>{uT(e,E)},y=p.useCallback(E=>{cT(e,E)},[e]),N=p.useCallback(E=>{lT(e,E)},[e]),w=p.useCallback(E=>{gm(e,E),d(String(E))},[e]),T=p.useCallback(E=>{d(E.target.value)},[]),S=p.useCallback(()=>{const E=parseInt(u,10);!isNaN(E)&&E>=1&&E<=100?gm(e,E):d(String(s||2))},[e,u,s]),v=p.useCallback(E=>{E.key==="Enter"?(S(),E.target.blur()):E.key==="Escape"&&(d(String(s||2)),E.target.blur())},[S,s]);return l.jsxDEV(at,{sideOffset:12,crossAxisOffset:40,open:a,onOpenChange:E=>{c(E)},placement:"left",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button"),visible:!0,icon:b,type:"button",tooltip:n,"aria-label":n,onPointerUp:()=>{c(!a)},children:!b&&r},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:124,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:123,columnNumber:7},void 0),l.jsxDEV(ct,{container:h,children:l.jsxDEV(Ye,{padding:4,className:Y(`${Mt}`,"stroke-setting",{"has-stroke-style":i}),children:l.jsxDEV(ft.Col,{children:[o&&l.jsxDEV("div",{className:"stroke-width-section",style:{marginBottom:"8px"},children:l.jsxDEV(ft.Row,{gap:2,align:"center",children:[l.jsxDEV("span",{style:{fontSize:"12px",color:"var(--color-on-surface)",whiteSpace:"nowrap"},children:"线宽:"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:151,columnNumber:19},void 0),l.jsxDEV("div",{style:{flex:1,minWidth:"100px"},children:l.jsxDEV(Ar,{value:s||2,min:1,max:100,step:1,onChange:E=>w(E),label:!1},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:153,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:152,columnNumber:19},void 0),l.jsxDEV("div",{className:"stroke-width-input-wrapper",children:[l.jsxDEV("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:u,onChange:T,onBlur:S,onKeyDown:v,className:"stroke-width-input"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:163,columnNumber:21},void 0),l.jsxDEV("span",{className:"stroke-width-input-unit",children:"px"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:173,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:162,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:150,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:149,columnNumber:15},void 0),i&&l.jsxDEV("div",{className:"stroke-style-section",children:[l.jsxDEV("span",{className:"stroke-style-label",children:"样式:"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:180,columnNumber:17},void 0),l.jsxDEV(ft.Row,{className:Y("stroke-style-picker"),children:[l.jsxDEV(ne,{visible:!0,icon:l.jsxDEV(jp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:184,columnNumber:27},void 0),type:"button",tooltip:"实线","aria-label":"实线",onPointerUp:()=>x(ei.solid)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:182,columnNumber:19},void 0),l.jsxDEV(ne,{visible:!0,icon:l.jsxDEV(Pp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:192,columnNumber:27},void 0),type:"button",tooltip:"虚线","aria-label":"虚线",onPointerUp:()=>x(ei.dashed)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:190,columnNumber:19},void 0),l.jsxDEV(ne,{visible:!0,icon:l.jsxDEV(Cp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:200,columnNumber:27},void 0),type:"button",tooltip:"点线","aria-label":"点线",onPointerUp:()=>x(ei.dotted)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:198,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:181,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:179,columnNumber:15},void 0),l.jsxDEV(Si,{value:t,onChange:y,onOpacityChange:N},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:209,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:147,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:139,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:138,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/stroke-button.tsx",lineNumber:114,columnNumber:5},void 0)},RT="drawnix-color-history",Nm=24,ym=12,wm=Hs.createInstance({name:"drawnix",storeName:RT});let Pe=null;function Tl(e){const t=e.stops.map(n=>`${n.color}@${n.offset}`).join("|");return e.type==="linear"?`linear-${e.angle}-${t}`:`radial-${e.centerX}-${e.centerY}-${t}`}function qT(e,t){return Tl(e)===Tl(t)}class BT{constructor(){this.initialized=!1}async initialize(){if(!this.initialized)try{Pe=await wm.getItem("history")||{colors:[],gradients:[]},this.initialized=!0}catch(t){console.error("[ColorHistoryService] Failed to initialize:",t),Pe={colors:[],gradients:[]},this.initialized=!0}}async saveData(){if(Pe)try{await wm.setItem("history",Pe)}catch(t){console.error("[ColorHistoryService] Failed to save data:",t)}}async addColor(t){if(await this.initialize(),!Pe)return;const n=t.toUpperCase(),i=Pe.colors.findIndex(o=>o.color.toUpperCase()===n);if(i>=0){Pe.colors[i].lastUsedAt=Date.now(),Pe.colors[i].useCount+=1;const[o]=Pe.colors.splice(i,1);Pe.colors.unshift(o)}else Pe.colors.unshift({color:n,lastUsedAt:Date.now(),useCount:1}),Pe.colors.length>Nm&&(Pe.colors=Pe.colors.slice(0,Nm));await this.saveData()}async addGradient(t){if(await this.initialize(),!Pe)return;const n=Tl(t),i=Pe.gradients.findIndex(o=>qT(o.config,t));if(i>=0){Pe.gradients[i].lastUsedAt=Date.now(),Pe.gradients[i].useCount+=1;const[o]=Pe.gradients.splice(i,1);Pe.gradients.unshift(o)}else Pe.gradients.unshift({id:n,config:{...t},lastUsedAt:Date.now(),useCount:1}),Pe.gradients.length>ym&&(Pe.gradients=Pe.gradients.slice(0,ym));await this.saveData()}async getColors(){return await this.initialize(),(Pe==null?void 0:Pe.colors)||[]}async getGradients(){return await this.initialize(),(Pe==null?void 0:Pe.gradients)||[]}async removeColor(t){if(await this.initialize(),!Pe)return;const n=t.toUpperCase();Pe.colors=Pe.colors.filter(i=>i.color.toUpperCase()!==n),await this.saveData()}async removeGradient(t){await this.initialize(),Pe&&(Pe.gradients=Pe.gradients.filter(n=>n.id!==t),await this.saveData())}async clearAll(){Pe={colors:[],gradients:[]},await this.saveData()}resetCache(){Pe=null,this.initialized=!1}}const xn=new BT;function LT(){const[e,t]=p.useState([]),[n,i]=p.useState([]),[o,s]=p.useState(!0),r=p.useCallback(async()=>{try{const[m,f]=await Promise.all([xn.getColors(),xn.getGradients()]);t(m),i(f)}catch(m){console.error("[useColorHistory] Failed to load data:",m)}finally{s(!1)}},[]);p.useEffect(()=>{r()},[r]);const a=p.useCallback(async m=>{await xn.addColor(m);const f=await xn.getColors();t(f)},[]),c=p.useCallback(async m=>{await xn.addGradient(m);const f=await xn.getGradients();i(f)},[]),u=p.useCallback(async m=>{await xn.removeColor(m);const f=await xn.getColors();t(f)},[]),d=p.useCallback(async m=>{await xn.removeGradient(m);const f=await xn.getGradients();i(f)},[]);return{colors:e,gradients:n,isLoading:o,addColor:a,addGradient:c,removeColor:u,removeGradient:d,refresh:r}}function Ni(e){const t=e.stops.map(n=>`${n.color} ${Math.round(n.offset*100)}%`).join(", ");if(e.type==="linear")return`linear-gradient(${e.angle}deg, ${t})`;{const n=Math.round(e.centerX*100),i=Math.round(e.centerY*100);return`radial-gradient(circle at ${n}% ${i}%, ${t})`}}function OT(e){const t=e.match(/linear-gradient\((\d+)deg,\s*(.+)\)/);if(t){const i=parseInt(t[1],10),o=t[2],s=vm(o);return{type:"linear",angle:i,stops:s.length>=2?s:[{color:"#FF6B6B",offset:0},{color:"#4ECDC4",offset:1}]}}const n=e.match(/radial-gradient\(circle(?:\s+at\s+(\d+)%\s+(\d+)%)?,\s*(.+)\)/);if(n){const i=n[1]?parseInt(n[1],10)/100:.5,o=n[2]?parseInt(n[2],10)/100:.5,s=n[3],r=vm(s);return{type:"radial",centerX:i,centerY:o,stops:r.length>=2?r:[{color:"#FF6B6B",offset:0},{color:"#4ECDC4",offset:1}]}}return Mr}function vm(e){const t=[],n=/(#[0-9a-fA-F]{3,8}|rgba?\([^)]+\))\s+(\d+)%/g;let i;for(;(i=n.exec(e))!==null;)t.push({color:i[1],offset:parseInt(i[2],10)/100});return t}const Em=[{key:"left",labelZh:"左",labelEn:"Left",x:0,y:.5},{key:"center",labelZh:"中心",labelEn:"Center",x:.5,y:.5},{key:"top-left",labelZh:"左上",labelEn:"Top left",x:0,y:0},{key:"top",labelZh:"上",labelEn:"Top",x:.5,y:0},{key:"right",labelZh:"右",labelEn:"Right",x:1,y:.5},{key:"bottom",labelZh:"下",labelEn:"Bottom",x:.5,y:1}],Zh=({value:e,onChange:t,showPresets:n=!0,showHistory:i=!0,presetCategories:o,customPresets:s,compact:r=!1,inline:a=!1,onSavePreset:c,onDeletePreset:u})=>{const{language:d}=ke(),{addGradient:m}=LT(),[f,h]=p.useState(e||Mr),[g,b]=p.useState(0),[x,y]=p.useState(null),[N,w]=p.useState(!1),T=p.useRef(null);p.useEffect(()=>{e&&h(e)},[e]);const S=p.useCallback(X=>{h(X),t==null||t(X),m(X)},[t,m]),v=p.useCallback(X=>{S(X.config)},[S]),E=p.useCallback(X=>{const ae={...f,...X};S(ae)},[f,S]),U=p.useCallback(X=>{if(f.type!==X)if(X==="linear"){const ae={type:"linear",angle:90,stops:f.stops};S(ae)}else{const ae={type:"radial",centerX:.5,centerY:.5,stops:f.stops};S(ae)}},[f,S]),q=p.useCallback((X,ae)=>{const le=[...f.stops];le[X]={...le[X],...ae},le.sort((we,Fe)=>we.offset-Fe.offset);const be=le.findIndex(we=>we.color===(ae.color??f.stops[X].color));be!==-1&&be!==g&&b(be),E({stops:le})},[f.stops,g,E]),$=p.useCallback(()=>{if(f.stops.length>=8)return;const X=.5,le=[...f.stops,{color:"#888888",offset:X}].sort((be,we)=>be.offset-we.offset);E({stops:le}),b(le.findIndex(be=>be.offset===X))},[f.stops,E]),V=p.useCallback(X=>{if(f.stops.length<=2)return;const ae=f.stops.filter((le,be)=>be!==X);E({stops:ae}),b(Math.min(g,ae.length-1))},[f.stops,g,E]),R=p.useCallback((X,ae)=>{if(!T.current)return;const le=T.current.getBoundingClientRect(),we=Math.max(0,Math.min(X.clientX-le.left,le.width))/le.width;q(ae,{offset:we})},[q]),M=p.useCallback((X,ae)=>{X.preventDefault(),X.stopPropagation(),b(ae);const le=X.clientX,be=X.clientY;let we=!1;const Fe=3,K=We=>{const it=Math.abs(We.clientX-le),Ke=Math.abs(We.clientY-be);(it>Fe||Ke>Fe)&&(we=!0,w(!0),R(We,ae))},Ce=()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Ce),we||y(ae),setTimeout(()=>{w(!1)},0)};document.addEventListener("mousemove",K),document.addEventListener("mouseup",Ce)},[R]),_=p.useCallback(X=>{if(N||f.stops.length>=8||X.target!==T.current||!T.current)return;const le=T.current.getBoundingClientRect(),be=X.clientX-le.left,we=Math.max(0,Math.min(be/le.width,1)),Fe=[...f.stops].sort((Ke,D)=>Ke.offset-D.offset);let K=Fe[0];for(let Ke=0;Ke<Fe.length-1;Ke++)if(Fe[Ke].offset<=we&&Fe[Ke+1].offset>=we){K=Fe[Ke];break}const Ce=K.color,We=[...f.stops,{color:Ce,offset:we}].sort((Ke,D)=>Ke.offset-D.offset);E({stops:We});const it=We.findIndex(Ke=>Ke.offset===we);b(it)},[N,f.stops,E]);p.useMemo(()=>Ni(f),[f]),p.useMemo(()=>{const X=[{key:"basic",label:d==="zh"?"基础":"Basic"},{key:"colorful",label:d==="zh"?"多彩":"Colorful"},{key:"sunset",label:d==="zh"?"日落":"Sunset"},{key:"nature",label:d==="zh"?"自然":"Nature"},{key:"metal",label:d==="zh"?"金属":"Metal"}];return o?X.filter(ae=>o.includes(ae.key)):X},[d,o]);const I=p.useMemo(()=>s?s.length>0&&typeof s[0]=="string"?s.map((X,ae)=>({id:`custom-${ae}`,name:`Custom ${ae+1}`,nameZh:`自定义 ${ae+1}`,category:"custom",config:OT(X),css:X})):s:fu,[s]),P=p.useCallback(()=>{var le;if(f.type!=="radial")return null;const{centerX:X,centerY:ae}=f;return(le=Em.find(be=>Math.abs(be.x-X)<.01&&Math.abs(be.y-ae)<.01))==null?void 0:le.key},[f]),Z=p.useMemo(()=>s&&s.length>0&&typeof s[0]=="string",[s]),pe=p.useMemo(()=>Ni(f),[f]),A=p.useCallback(X=>pe===X,[pe]),G=()=>{const X=fu.slice(0,10),ae=Z?I:[];return l.jsxDEV("div",{className:"ge-quick-presets",children:[l.jsxDEV("div",{className:"ge-quick-presets-header",children:l.jsxDEV("span",{className:"ge-quick-presets-title",children:d==="zh"?"预设":"Presets"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:436,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:435,columnNumber:9},void 0),l.jsxDEV("div",{className:"ge-quick-presets-grid",children:[ae.map((le,be)=>{const we=le.css||Ni(le.config);return l.jsxDEV("button",{className:Y("ge-quick-preset-item ge-quick-preset-item--custom",{"ge-quick-preset-item--selected":A(we)}),onClick:()=>v(le),title:d==="zh"?le.nameZh:le.name,children:[l.jsxDEV("div",{className:"ge-quick-preset-preview",style:{background:we}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:453,columnNumber:17},void 0),u&&l.jsxDEV("button",{className:"ge-quick-preset-delete",onClick:Fe=>{Fe.stopPropagation(),u(be)},children:"×"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:458,columnNumber:19},void 0)]},le.id,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:445,columnNumber:15},void 0)}),X.map(le=>{const be=Ni(le.config);return l.jsxDEV("button",{className:Y("ge-quick-preset-item",{"ge-quick-preset-item--selected":A(be)}),onClick:()=>v(le),title:d==="zh"?le.nameZh:le.name,children:l.jsxDEV("div",{className:"ge-quick-preset-preview",style:{background:be}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:483,columnNumber:17},void 0)},le.id,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:475,columnNumber:15},void 0)})]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:440,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:434,columnNumber:7},void 0)},ce=()=>l.jsxDEV("div",{className:Y("ge-custom-editor",{"ge-custom-editor--inline":a}),children:[l.jsxDEV("div",{className:"ge-type-section",children:l.jsxDEV("div",{className:"ge-type-buttons",children:[l.jsxDEV("button",{className:Y("ge-type-btn",{active:f.type==="linear"}),onClick:()=>U("linear"),children:d==="zh"?"线性":"Linear"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:501,columnNumber:11},void 0),l.jsxDEV("button",{className:Y("ge-type-btn",{active:f.type==="radial"}),onClick:()=>U("radial"),children:d==="zh"?"径向":"Radial"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:507,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:500,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:499,columnNumber:7},void 0),l.jsxDEV("div",{className:"ge-color-section",children:[l.jsxDEV("div",{className:"ge-section-header",children:[l.jsxDEV("span",{className:"ge-section-title",children:d==="zh"?"颜色":"Colors"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:519,columnNumber:11},void 0),l.jsxDEV("div",{className:"ge-stop-actions",children:[l.jsxDEV("button",{className:"ge-action-btn",onClick:$,disabled:f.stops.length>=8,title:d==="zh"?"添加色标":"Add stop",children:"+"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:523,columnNumber:13},void 0),l.jsxDEV("button",{className:"ge-action-btn",onClick:()=>V(g),disabled:f.stops.length<=2,title:d==="zh"?"删除色标":"Remove stop",children:"−"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:531,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:522,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:518,columnNumber:9},void 0),l.jsxDEV("div",{className:"ge-gradient-bar-wrapper",children:l.jsxDEV("div",{ref:T,className:"ge-gradient-bar",style:{background:`linear-gradient(90deg, ${f.stops.map(X=>`${X.color} ${Math.round(X.offset*100)}%`).join(", ")})`},onClick:_,children:f.stops.map((X,ae)=>l.jsxDEV(at,{open:x===ae,onOpenChange:le=>y(le?ae:null),children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("button",{className:Y("ge-stop-handle",{selected:g===ae}),style:{left:`${X.offset*100}%`,backgroundColor:X.color},onMouseDown:le=>{M(le,ae)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:559,columnNumber:19},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:558,columnNumber:17},void 0),l.jsxDEV(ct,{children:l.jsxDEV(Ye,{padding:4,className:"ge-color-picker-popover "+Mt,children:l.jsxDEV(Si,{value:X.color,onChange:le=>q(ae,{color:le}),showAlpha:!1,showEyeDropper:!0,showPresets:!0,showRecentColors:!0,showHexInput:!0},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:577,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:573,columnNumber:19},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:572,columnNumber:17},void 0)]},ae,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:553,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:545,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:543,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:517,columnNumber:7},void 0),f.type==="radial"&&l.jsxDEV("div",{className:"ge-origin-section",children:[l.jsxDEV("span",{className:"ge-section-title",children:d==="zh"?"原点":"Origin"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:597,columnNumber:11},void 0),l.jsxDEV("div",{className:"ge-origin-buttons",children:Em.map(X=>l.jsxDEV("button",{className:Y("ge-origin-btn",{active:P()===X.key}),onClick:()=>E({centerX:X.x,centerY:X.y}),children:d==="zh"?X.labelZh:X.labelEn},X.key,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:602,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:600,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:596,columnNumber:9},void 0),f.type==="linear"&&l.jsxDEV("div",{className:"ge-angle-section",children:[l.jsxDEV("div",{className:"ge-section-header",children:[l.jsxDEV("span",{className:"ge-section-title",children:d==="zh"?"角度":"Angle"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:622,columnNumber:13},void 0),l.jsxDEV("span",{className:"ge-angle-value",children:[f.angle,"°"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:625,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:621,columnNumber:11},void 0),l.jsxDEV("input",{type:"range",min:0,max:360,value:f.angle,onChange:X=>E({angle:Number(X.target.value)}),className:"ge-angle-slider"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:629,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:620,columnNumber:9},void 0),c&&l.jsxDEV("div",{className:"ge-save-section",children:l.jsxDEV("button",{className:"ge-save-btn",onClick:c,children:d==="zh"?"保存":"Save"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:643,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:642,columnNumber:9},void 0),G()]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:497,columnNumber:5},void 0);return r||a?l.jsxDEV("div",{className:Y("gradient-editor",{"gradient-editor--compact":r,"gradient-editor--inline":a}),children:ce()},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:657,columnNumber:7},void 0):l.jsxDEV("div",{className:"gradient-editor",children:ce()},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/gradient-editor/GradientEditor.tsx",lineNumber:669,columnNumber:5},void 0)},Aa=Pt.CUSTOM_GRADIENTS,FT=({value:e,onChange:t,inline:n=!1})=>{const{language:i}=ke(),{confirm:o,confirmDialog:s}=Ir(),[r,a]=p.useState([]),[c,u]=p.useState(e||Mr);p.useEffect(()=>{let h=!0;return kn.get(Aa).then(g=>{h&&g&&a(g)}).catch(g=>{console.warn("Failed to load gradient data:",g)}),()=>{h=!1}},[]),p.useEffect(()=>{e&&u(e)},[e]);const d=p.useCallback(h=>{u(h),t==null||t(h)},[t]),m=p.useCallback(()=>{const h=Ni(c),b=[{id:`custom-${Date.now()}`,css:h},...r].slice(0,8);a(b),kn.set(Aa,b).catch(x=>{console.warn("Failed to save custom gradients:",x)})},[c,r]),f=p.useCallback(async h=>{const g=r[h];if(!g||!await o({title:i==="zh"?"确认删除渐变预设":"Delete Gradient Preset",description:i==="zh"?"确定要删除这个自定义渐变预设吗?":"Are you sure you want to delete this custom gradient preset?",confirmText:i==="zh"?"删除":"Delete",cancelText:i==="zh"?"取消":"Cancel",danger:!0}))return;const x=r.filter(y=>y.id!==g.id);a(x),kn.set(Aa,x).catch(y=>{console.warn("Failed to save custom gradients:",y)})},[o,r,i]);return l.jsxDEV(l.Fragment,{children:[l.jsxDEV(Zh,{value:c,onChange:d,showPresets:!0,showHistory:!0,inline:n,customPresets:r.map(h=>h.css),onSavePreset:m,onDeletePreset:f},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/GradientFillPanel.tsx",lineNumber:110,columnNumber:7},void 0),s]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/GradientFillPanel.tsx",lineNumber:109,columnNumber:5},void 0)},HT=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p5),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.MediaLibraryModal}))),zT=[{value:"stretch",labelZh:"拉伸",labelEn:"Stretch",icon:"⬌"},{value:"tile",labelZh:"平铺",labelEn:"Tile",icon:"⊞"},{value:"fit",labelZh:"适应",labelEn:"Fit",icon:"⊡"}],GT=({value:e,onChange:t,onOpenMediaLibrary:n,externalMediaLibraryControl:i=!1})=>{const{language:o}=ke(),[s,r]=p.useState(e||Ip),[a,c]=p.useState(!1),[u,d]=p.useState(!1),m=p.useRef(null);p.useEffect(()=>{e&&r(e)},[e]);const f=p.useCallback(S=>{const v={...s,...S};r(v),t==null||t(v)},[s,t]),h=p.useMemo(()=>x0(S=>{t==null||t(S)},300),[t]),g=p.useCallback(S=>{const v={...s,...S};r(v),h(v)},[s,h]),b=p.useCallback((S,v,E,U,q=1)=>{const $=parseFloat(v);if(isNaN($))return;const V=Math.max(E,Math.min(U,$)),R=q===1?V:V/q;f({[S]:R})},[f]),x=p.useCallback(S=>{f({imageUrl:S.url}),c(!1)},[f]),y=p.useCallback(async S=>{var q;const v=(q=S.target.files)==null?void 0:q[0];if(!v)return;if(!v.type.startsWith("image/")){re.warning(o==="zh"?"请选择图片文件":"Please select an image file");return}if(v.size>25*1024*1024){re.warning(o==="zh"?"图片大小不能超过 25MB":"Image size cannot exceed 25MB");return}let E=v;if(v.size>10*1024*1024){const $=N0(v.size/1048576),V=re.loading({content:o==="zh"?`正在压缩图片 (${(v.size/1024/1024).toFixed(1)}MB)...`:`Compressing image (${(v.size/1024/1024).toFixed(1)}MB)...`,duration:0,placement:"top"});try{E=await y0(v,$.targetSizeMB),re.close(V),re.success({content:o==="zh"?`压缩完成: ${(v.size/1024/1024).toFixed(1)}MB → ${(E.size/1024/1024).toFixed(1)}MB`:`Compressed: ${(v.size/1024/1024).toFixed(1)}MB → ${(E.size/1024/1024).toFixed(1)}MB`,duration:2})}catch(R){re.close(V),console.error("[ImageFillPanel] Compression failed:",R),re.warning(o==="zh"?"图片压缩失败":"Image compression failed");return}}const U=new FileReader;U.onload=$=>{var R;const V=(R=$.target)==null?void 0:R.result;f({imageUrl:V})},U.readAsDataURL(E),S.target.value=""},[o,f]),N=p.useCallback(()=>{var S;(S=m.current)==null||S.click()},[]),w=p.useCallback(()=>{i&&n?n():c(!0)},[i,n]),T=()=>s.imageUrl?l.jsxDEV("div",{className:"ifp-image-preview",children:[l.jsxDEV("img",{src:s.imageUrl,alt:"Fill preview"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:215,columnNumber:11},void 0),l.jsxDEV("button",{className:"ifp-image-remove",onClick:()=>f({imageUrl:""}),title:o==="zh"?"移除图片":"Remove image",children:"×"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:216,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:214,columnNumber:9},void 0):l.jsxDEV("div",{className:"ifp-image-placeholder",children:[l.jsxDEV(Up,{size:32,className:"ifp-placeholder-icon"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:229,columnNumber:9},void 0),l.jsxDEV("span",{className:"ifp-placeholder-text",children:o==="zh"?"选择图片":"Select Image"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:230,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:228,columnNumber:7},void 0);return l.jsxDEV("div",{className:"image-fill-panel",children:[l.jsxDEV("input",{ref:m,type:"file",accept:"image/*",style:{display:"none"},onChange:y},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:240,columnNumber:7},void 0),l.jsxDEV("div",{className:"ifp-image-section",children:[l.jsxDEV("div",{className:"ifp-image-container",onClick:()=>!s.imageUrl&&w(),children:T()},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:250,columnNumber:9},void 0),l.jsxDEV("div",{className:"ifp-image-actions",children:[l.jsxDEV("button",{className:"ifp-action-btn ifp-action-btn--primary",onClick:w,children:[l.jsxDEV(Vr,{size:14},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:256,columnNumber:13},void 0),l.jsxDEV("span",{children:o==="zh"?"素材库":"Library"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:257,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:255,columnNumber:11},void 0),l.jsxDEV("button",{className:"ifp-action-btn",onClick:N,children:[l.jsxDEV(Ur,{size:14},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:260,columnNumber:13},void 0),l.jsxDEV("span",{children:o==="zh"?"上传":"Upload"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:261,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:259,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:254,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:249,columnNumber:7},void 0),s.imageUrl&&l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{className:"ifp-control-section",children:[l.jsxDEV("div",{className:"ifp-section-title",children:o==="zh"?"平铺模式":"Fill Mode"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:271,columnNumber:13},void 0),l.jsxDEV("div",{className:"ifp-mode-buttons",children:zT.map(S=>l.jsxDEV("button",{className:Y("ifp-mode-btn",{active:s.mode===S.value}),onClick:()=>f({mode:S.value}),title:o==="zh"?S.labelZh:S.labelEn,children:[l.jsxDEV("span",{className:"ifp-mode-icon",children:S.icon},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:282,columnNumber:19},void 0),l.jsxDEV("span",{className:"ifp-mode-label",children:o==="zh"?S.labelZh:S.labelEn},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:283,columnNumber:19},void 0)]},S.value,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:276,columnNumber:17},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:274,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:270,columnNumber:11},void 0),l.jsxDEV("div",{className:"ifp-advanced-section",children:[l.jsxDEV("button",{className:"ifp-advanced-toggle",onClick:()=>d(!u),children:[l.jsxDEV("span",{children:o==="zh"?"高级设置":"Advanced"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:297,columnNumber:15},void 0),u?l.jsxDEV(Vp,{size:14},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:298,columnNumber:31},void 0):l.jsxDEV(Hl,{size:14},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:298,columnNumber:57},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:293,columnNumber:13},void 0),u&&l.jsxDEV("div",{className:"ifp-advanced-content",children:[l.jsxDEV("div",{className:"ifp-control-row",children:[l.jsxDEV("label",{className:"ifp-control-label",children:o==="zh"?"缩放":"Scale"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:305,columnNumber:19},void 0),l.jsxDEV("div",{className:"ifp-control-input",children:[l.jsxDEV("input",{type:"range",min:50,max:200,value:(s.scale??1)*100,onChange:S=>g({scale:Number(S.target.value)/100}),className:"ifp-slider"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:309,columnNumber:21},void 0),l.jsxDEV("div",{className:"ifp-control-value-wrapper",children:[l.jsxDEV("input",{type:"number",className:"ifp-control-value-input",value:Math.round((s.scale??1)*100),min:50,max:200,onChange:S=>b("scale",S.target.value,50,200,100)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:318,columnNumber:23},void 0),l.jsxDEV("span",{className:"ifp-control-unit",children:"%"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:326,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:317,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:308,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:304,columnNumber:17},void 0),l.jsxDEV("div",{className:"ifp-control-row",children:[l.jsxDEV("label",{className:"ifp-control-label",children:o==="zh"?"X 偏移":"Offset X"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:333,columnNumber:19},void 0),l.jsxDEV("div",{className:"ifp-control-input",children:[l.jsxDEV("input",{type:"range",min:-100,max:100,value:(s.offsetX??0)*100,onChange:S=>g({offsetX:Number(S.target.value)/100}),className:"ifp-slider"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:337,columnNumber:21},void 0),l.jsxDEV("div",{className:"ifp-control-value-wrapper",children:[l.jsxDEV("input",{type:"number",className:"ifp-control-value-input",value:Math.round((s.offsetX??0)*100),min:-100,max:100,onChange:S=>b("offsetX",S.target.value,-100,100,100)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:346,columnNumber:23},void 0),l.jsxDEV("span",{className:"ifp-control-unit",children:"%"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:354,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:345,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:336,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:332,columnNumber:17},void 0),l.jsxDEV("div",{className:"ifp-control-row",children:[l.jsxDEV("label",{className:"ifp-control-label",children:o==="zh"?"Y 偏移":"Offset Y"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:361,columnNumber:19},void 0),l.jsxDEV("div",{className:"ifp-control-input",children:[l.jsxDEV("input",{type:"range",min:-100,max:100,value:(s.offsetY??0)*100,onChange:S=>g({offsetY:Number(S.target.value)/100}),className:"ifp-slider"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:365,columnNumber:21},void 0),l.jsxDEV("div",{className:"ifp-control-value-wrapper",children:[l.jsxDEV("input",{type:"number",className:"ifp-control-value-input",value:Math.round((s.offsetY??0)*100),min:-100,max:100,onChange:S=>b("offsetY",S.target.value,-100,100,100)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:374,columnNumber:23},void 0),l.jsxDEV("span",{className:"ifp-control-unit",children:"%"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:382,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:373,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:364,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:360,columnNumber:17},void 0),l.jsxDEV("div",{className:"ifp-control-row",children:[l.jsxDEV("label",{className:"ifp-control-label",children:o==="zh"?"旋转":"Rotation"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:389,columnNumber:19},void 0),l.jsxDEV("div",{className:"ifp-control-input",children:[l.jsxDEV("input",{type:"range",min:0,max:360,value:s.rotation??0,onChange:S=>g({rotation:Number(S.target.value)}),className:"ifp-slider"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:393,columnNumber:21},void 0),l.jsxDEV("div",{className:"ifp-control-value-wrapper",children:[l.jsxDEV("input",{type:"number",className:"ifp-control-value-input",value:s.rotation??0,min:0,max:360,onChange:S=>b("rotation",S.target.value,0,360,1)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:402,columnNumber:23},void 0),l.jsxDEV("span",{className:"ifp-control-unit",children:"°"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:410,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:401,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:392,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:388,columnNumber:17},void 0),l.jsxDEV("button",{className:"ifp-reset-btn",onClick:()=>f({scale:1,offsetX:0,offsetY:0,rotation:0}),children:o==="zh"?"重置":"Reset"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:416,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:302,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:292,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:268,columnNumber:9},void 0),!i&&a&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(HT,{isOpen:a,onClose:()=>c(!1),mode:ii.SELECT,filterType:Vn.IMAGE,onSelect:x,selectButtonText:o==="zh"?"使用此图片":"Use this image"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:438,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:437,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/ImageFillPanel.tsx",lineNumber:238,columnNumber:5},void 0)},WT=[{value:"solid",labelZh:"纯色",labelEn:"Solid"},{value:"gradient",labelZh:"渐变",labelEn:"Gradient"},{value:"image",labelZh:"图片",labelEn:"Image"}],$T=({value:e,onSolidChange:t,onOpacityChange:n,onGradientChange:i,onImageChange:o,onFillTypeChange:s,showClose:r=!1,onClose:a,onOpenMediaLibrary:c})=>{const{language:u}=ke(),d=p.useMemo(()=>e?Jo(e)?w0(e):Un(e)?e:{type:"solid",solid:{color:"#FFFFFF"}}:{type:"solid",solid:{color:"#FFFFFF"}},[e]),[m,f]=p.useState(d.type);p.useEffect(()=>{f(d.type)},[d.type]);const[h,g]=p.useState(d.gradient||Mr),[b,x]=p.useState(d.image||Ip);p.useEffect(()=>{d.gradient&&g(d.gradient)},[d.gradient]),p.useEffect(()=>{d.image&&x(d.image)},[d.image]);const y=p.useCallback(v=>{f(v)},[]),N=p.useCallback(v=>{s==null||s("solid"),t==null||t(v)},[t,s]),w=p.useCallback(v=>{g(v),s==null||s("gradient"),i==null||i(v)},[i,s]),T=p.useCallback(v=>{x(v),s==null||s("image"),o==null||o(v)},[o,s]),S=p.useMemo(()=>Jo(e)?e:Un(e)&&e.solid?e.solid.color:"#FFFFFF",[e]);return l.jsxDEV("div",{className:"fill-panel",children:[l.jsxDEV("div",{className:"fill-panel__header",children:[l.jsxDEV("span",{className:"fill-panel__title",children:u==="zh"?"填充":"Fill"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:160,columnNumber:9},void 0),r&&l.jsxDEV("button",{className:"fill-panel__close",onClick:a,children:"×"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:164,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:159,columnNumber:7},void 0),l.jsxDEV("div",{className:"fill-panel__tabs",children:WT.map(v=>l.jsxDEV("button",{className:Y("fill-panel__tab",{active:m===v.value}),onClick:()=>y(v.value),children:u==="zh"?v.labelZh:v.labelEn},v.value,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:173,columnNumber:11},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:171,columnNumber:7},void 0),l.jsxDEV("div",{className:"fill-panel__content",children:[m==="solid"&&l.jsxDEV("div",{className:"fill-panel__solid",children:l.jsxDEV(Si,{value:S,onChange:N,onOpacityChange:n},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:187,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:186,columnNumber:11},void 0),m==="gradient"&&l.jsxDEV(FT,{value:h,onChange:w},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:196,columnNumber:11},void 0),m==="image"&&l.jsxDEV(GT,{value:b,onChange:T,onOpenMediaLibrary:c,externalMediaLibraryControl:!!c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:200,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:184,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/fill-panel/FillPanel.tsx",lineNumber:157,columnNumber:5},void 0)},XT=p.lazy(()=>Me(()=>import("./index-B4lLv-Sz.js"),__vite__mapDeps([0,1]),import.meta.url).then(e=>({default:e.MediaLibraryModal}))),KT=({board:e,currentColor:t,title:n,children:i})=>{const{language:o}=ke(),[s,r]=p.useState(!1),[a,c]=p.useState(!1),{hexColor:u,opacity:d}=p.useMemo(()=>{var T;if(!t)return{hexColor:void 0,opacity:100};if(Jo(t)){const S=ki(t),v=so(t);return{hexColor:S,opacity:v}}if(Un(t))switch(t.type){case"solid":if(t.solid){const S=ki(t.solid.color),v=so(t.solid.color);return{hexColor:S,opacity:v}}break;case"gradient":if((T=t.gradient)!=null&&T.stops[0])return{hexColor:t.gradient.stops[0].color,opacity:100};break;case"image":return{hexColor:"#888888",opacity:100}}return{hexColor:void 0,opacity:100}},[t]),m=!u||Ap(d)?l.jsxDEV(v0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:96,columnNumber:48},void 0):void 0,f=p.useCallback(T=>{aT(e,T),AT(e,T)},[e]),h=p.useCallback(T=>{rT(e,T)},[e]),g=p.useCallback(T=>{PT(e,T)},[e]),b=p.useCallback(T=>{xm(e,T)},[e]),x=p.useCallback(T=>{CT(e,T)},[e]),y=p.useCallback(()=>{r(!1)},[]),N=p.useCallback(()=>{c(!0)},[]),w=p.useCallback(T=>{xm(e,{imageUrl:T.url,mode:"stretch",scale:1,offsetX:0,offsetY:0,rotation:0}),c(!1)},[e]);return l.jsxDEV(at,{sideOffset:12,crossAxisOffset:40,open:s,onOpenChange:T=>{!T&&a||r(T)},placement:"left",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button"),visible:!0,icon:m,type:"button",tooltip:n,"aria-label":n,onPointerUp:()=>{r(!s)},children:!m&&i},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:182,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:181,columnNumber:7},void 0),l.jsxDEV(ct,{children:l.jsxDEV(Ye,{padding:0,className:Y(`${Mt}`,"fill-setting"),children:l.jsxDEV($T,{value:t,onSolidChange:f,onOpacityChange:h,onGradientChange:g,onImageChange:b,onFillTypeChange:x,showClose:!0,onClose:y,onOpenMediaLibrary:N},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:202,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:198,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:197,columnNumber:7},void 0),a&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(XT,{isOpen:a,onClose:()=>c(!1),mode:ii.SELECT,filterType:Vn.IMAGE,onSelect:w,selectButtonText:o==="zh"?"使用此图片":"Use this image"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:219,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:218,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/fill-button.tsx",lineNumber:168,columnNumber:5},void 0)},YT=({board:e,currentRadius:t,title:n,selectionRect:i})=>{const[o,s]=p.useState(!1),[r,a]=p.useState({top:0,left:0}),[c,u]=p.useState(""),d=p.useRef(null),m=p.useRef(null),f=F.getBoardContainer(e),{t:h}=ke(),g=n||h("toolbar.cornerRadius")||"圆角",b=t??0;p.useEffect(()=>{u(String(b))},[b]),p.useEffect(()=>{if(o&&d.current){const v=d.current.getBoundingClientRect(),E=220,U=8;let q=v.left+v.width/2-E/2,$=v.bottom+U;const V=window.innerWidth,R=window.innerHeight;q+E>V-16&&(q=V-E-16),q<16&&(q=16),$+40>R-16&&($=v.top-40-U),a({left:q,top:$})}},[o]),p.useEffect(()=>{if(!o)return;const v=U=>{const q=U.target;m.current&&m.current.contains(q)||d.current&&d.current.contains(q)||q.closest(".popup-toolbar")!==null||s(!1)},E=setTimeout(()=>{document.addEventListener("mousedown",v)},100);return()=>{clearTimeout(E),document.removeEventListener("mousedown",v)}},[o]);const x=p.useCallback(v=>{const E=Math.max(0,Math.min(100,v));Be(e).filter(q=>Je.isPenPath(q)).forEach(q=>{const $=e.children.findIndex(V=>V.id===q.id);$>=0&&ue.setNode(e,{cornerRadius:E},[$])})},[e]),y=p.useCallback(v=>{u(String(v)),x(v)},[x]),N=p.useCallback(v=>{u(v.target.value)},[]),w=p.useCallback(()=>{const v=parseInt(c,10);if(isNaN(v))u(String(b));else{const E=Math.max(0,Math.min(100,v));u(String(E)),x(E)}},[c,b,x]),T=p.useCallback(v=>{v.key==="Enter"&&v.target.blur()},[]),S=p.useCallback(()=>{s(!o)},[o]);return l.jsxDEV(l.Fragment,{children:[l.jsxDEV(ne,{ref:d,className:Y("property-button","corner-radius-button",{"is-active":o}),visible:!0,type:"button",tooltip:g,"aria-label":g,onPointerUp:S,children:l.jsxDEV("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:l.jsxDEV("path",{d:"M4 4 L4 14 Q4 20 10 20 L20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:178,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:177,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:168,columnNumber:7},void 0),o&&f&&Rr.createPortal(l.jsxDEV("div",{ref:m,className:Y(Mt,"corner-radius-panel"),style:{position:"fixed",top:r.top,left:r.left,zIndex:5e3},onPointerDown:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),children:l.jsxDEV(Ye,{padding:2,className:"corner-radius-setting-compact",children:l.jsxDEV("div",{className:"corner-radius-row",children:[l.jsxDEV("span",{className:"corner-radius-label",children:g},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:204,columnNumber:15},void 0),l.jsxDEV("div",{className:"corner-radius-slider",children:l.jsxDEV(Ar,{value:b,min:0,max:100,step:1,onChange:v=>y(v),label:!1},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:206,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:205,columnNumber:15},void 0),l.jsxDEV("input",{type:"text",className:"corner-radius-input",value:c,onChange:N,onBlur:w,onKeyDown:T},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:215,columnNumber:15},void 0),l.jsxDEV("span",{className:"corner-radius-unit",children:"%"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:223,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:203,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:202,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:190,columnNumber:9},void 0),f)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/corner-radius-button.tsx",lineNumber:167,columnNumber:5},void 0)},ZT=(e,t)=>{try{return Ot(e,[t],!1)}catch{return null}},km=(e,t,n,i,o,s)=>{const r=e.children.findIndex(g=>g.id===t.id);if(r<0)return;const a=ZT(e,t);if(!a)return;const c=(a.x-n.x)/n.width,u=(a.y-n.y)/n.height,d=i.x+c*i.width,m=i.y+u*i.height,f=a.width*o,h=a.height*s;if(wi(t)){const g=[[d,m],[d+f,m+h]];ue.setNode(e,{points:g},[r])}else if(H.isDrawElement(t)){const g=[[d,m],[d+f,m+h]];ue.setNode(e,{points:g},[r])}else if(nn.isMindElement(e,t)){const g=[[d,m],[d+f,m+h]];ue.setNode(e,{points:g},[r])}else if($e.isFreehand(t)){const b=t.points.map(x=>{const y=(x[0]-n.x)/n.width,N=(x[1]-n.y)/n.height;return[i.x+y*i.width,i.y+N*i.height]});ue.setNode(e,{points:b},[r])}else if(Je.isPenPath(t)){const b=t.anchors.map(y=>{const N=[y.point[0]*o,y.point[1]*s],w=y.handleIn?[y.handleIn[0]*o,y.handleIn[1]*s]:void 0,T=y.handleOut?[y.handleOut[0]*o,y.handleOut[1]*s]:void 0;return{...y,point:N,handleIn:w,handleOut:T}}),x=[d,m];ue.setNode(e,{points:[x,x],anchors:b},[r])}},QT=({board:e})=>{const{language:t}=ke(),n=t==="zh",i=Be(e),[o,s]=p.useState(!0),[r,a]=p.useState(""),[c,u]=p.useState(""),[d,m]=p.useState(1),[f,h]=p.useState(!1),g=p.useRef(null),b=F.getBoardContainer(e),x=i.length>0?Ot(e,i,!1):null;p.useEffect(()=>{x&&(g.current?(a(Math.round(g.current.width).toString()),u(Math.round(g.current.height).toString()),g.current=null):(a(Math.round(x.width).toString()),u(Math.round(x.height).toString())),m(x.width/x.height))},[x==null?void 0:x.width,x==null?void 0:x.height]);const y=p.useCallback(v=>{const E=v.target.value;if(a(E),o&&x){const U=parseFloat(E);if(!isNaN(U)&&U>0){const q=Math.round(U/d);u(q.toString())}}},[o,d,x]),N=p.useCallback(v=>{const E=v.target.value;if(u(E),o&&x){const U=parseFloat(E);if(!isNaN(U)&&U>0){const q=Math.round(U*d);a(q.toString())}}},[o,d,x]),w=p.useCallback(()=>{if(!x||i.length===0)return;const v=parseFloat(r),E=parseFloat(c);if(isNaN(v)||isNaN(E)||v<=0||E<=0){a(Math.round(x.width).toString()),u(Math.round(x.height).toString());return}if(Math.abs(v-x.width)<.5&&Math.abs(E-x.height)<.5)return;g.current={width:v,height:E};const U=v/x.width,q=E/x.height,$={x:x.x,y:x.y,width:v,height:E};i.forEach(V=>{km(e,V,x,$,U,q)})},[e,i,x,r,c]),T=p.useCallback(v=>{if(!x||i.length===0)return;const E=v.width,U=v.height;a(E.toString()),u(U.toString()),g.current={width:E,height:U};const q=E/x.width,$=U/x.height,V={x:x.x,y:x.y,width:E,height:U};i.forEach(R=>{km(e,R,x,V,q,$)}),m(E/U),h(!1)},[e,i,x]),S=p.useCallback(v=>{v.key==="Enter"?(w(),v.target.blur()):v.key==="Escape"&&(x&&(a(Math.round(x.width).toString()),u(Math.round(x.height).toString())),v.target.blur())},[w,x]);return x?l.jsxDEV("div",{className:"size-input-container",children:[l.jsxDEV("div",{className:"size-input-group",children:[l.jsxDEV("span",{className:"size-input-label",children:"W"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:303,columnNumber:9},void 0),l.jsxDEV("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"size-input",value:r,onChange:y,onBlur:w,onKeyDown:S},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:304,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:302,columnNumber:7},void 0),l.jsxDEV("button",{className:`size-lock-button ${o?"locked":""}`,onClick:()=>s(!o),title:o?"解锁比例":"锁定比例",children:o?l.jsxDEV(E0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:320,columnNumber:19},void 0):l.jsxDEV(k0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:320,columnNumber:34},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:315,columnNumber:7},void 0),l.jsxDEV("div",{className:"size-input-group",children:[l.jsxDEV("span",{className:"size-input-label",children:"H"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:323,columnNumber:9},void 0),l.jsxDEV("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"size-input",value:c,onChange:N,onBlur:w,onKeyDown:S},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:324,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:322,columnNumber:7},void 0),l.jsxDEV(at,{open:f,onOpenChange:h,placement:"bottom-end",sideOffset:8,children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("button",{className:`size-preset-button ${f?"active":""}`,title:n?"常用尺寸":"Preset Sizes",onClick:()=>h(!f),children:l.jsxDEV(Hl,{size:12},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:347,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:342,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:341,columnNumber:9},void 0),l.jsxDEV(ct,{container:b,children:l.jsxDEV("div",{className:"size-preset-panel",children:S0.map(v=>l.jsxDEV("div",{className:"size-preset-category",children:[l.jsxDEV("div",{className:"size-preset-category-label",children:n?v.category:v.categoryEn},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:354,columnNumber:17},void 0),v.items.map(E=>l.jsxDEV("button",{className:"size-preset-item",onClick:()=>T(E),children:[l.jsxDEV("span",{className:"size-preset-item-label",children:n?E.label:E.labelEn},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:363,columnNumber:21},void 0),l.jsxDEV("span",{className:"size-preset-item-size",children:[E.width," x ",E.height]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:366,columnNumber:21},void 0)]},`${E.width}x${E.height}-${E.label}`,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:358,columnNumber:19},void 0))]},v.category,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:353,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:351,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:350,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:335,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/size-input.tsx",lineNumber:301,columnNumber:5},void 0):null},JT=({board:e,title:t})=>{const{appState:n,setAppState:i}=Wt();return l.jsxDEV(ne,{className:Y("property-button"),visible:!0,icon:l.jsxDEV(D0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/link-button.tsx",lineNumber:25,columnNumber:13},void 0),type:"button",tooltip:t,"aria-label":t,onPointerUp:()=>{const o=Be(e)[0],s=T0(o);Ji.getLinkElement(s)||Ji.wrapLink(s,"链接",""),setTimeout(()=>{const c=Ji.getLinkElement(s)[0],u=En.toDOMNode(s,c);i({...n,linkState:{editor:s,targetDom:u,targetElement:c,isEditing:!0,isHovering:!1,isHoveringOrigin:!1}})},0)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/link-button.tsx",lineNumber:22,columnNumber:5},void 0)},Qh={zh:[`一张写实的半身人像,一位身穿水蓝色连身裙的年轻韩国亚洲女人走进旅馆大厅,女人脸上带着温暖的微笑,左手拿着白色棒球帽,右手拉着黄色行李箱。
|
|
28
|
-
场景在济州岛度假感的旅馆大厅里,柔和的光线从窗外洒入室内柔和的打在女人的身上,凸显了女人的脸部表情。
|
|
29
|
-
使用 50mm 人像镜头拍摄,女人在画面中央,背景呈现柔和的模糊(散景)。
|
|
30
|
-
氛围是日系杂志的色调并充满放松度假感。直式人像构图,比例1:1。`,"一只可爱的小猫坐在窗台上,阳光透过窗户洒在它的毛发上","美丽的山水风景,青山绿水,云雾缭绕","现代简约风格的室内设计,明亮宽敞","夜晚的城市天际线,霓虹灯闪烁","春天的樱花盛开,粉色花瓣飘落","科幻风格的太空站,星空背景","温馨的咖啡厅,暖色调灯光","抽象艺术风格,色彩丰富的几何图形"],en:[`young Korean woman in a light blue dress holding a white baseball cap and pulling a yellow suitcase, photography,
|
|
31
|
-
stylish modern hotel lobby, soft sunlight streaming through the window, pastel tones, relaxed vacation mood,
|
|
32
|
-
centered vertical portrait with bokeh background, medium shot.`,"A cute kitten sitting on a windowsill with sunlight streaming through","Beautiful mountain landscape with green hills and misty clouds","Modern minimalist interior design, bright and spacious","City skyline at night with neon lights glowing","Cherry blossoms in spring with pink petals falling","Sci-fi space station with starry background","Cozy coffee shop with warm ambient lighting","Abstract art with colorful geometric shapes"]},eD={zh:[`场景:日落时分,一座宏伟的城堡庭院,金色的光线透过彩色玻璃窗,营造出温暖而充满希望的氛围。
|
|
33
|
-
相机:对两位公主进行中特写跟踪拍摄,然后进行广角拉出,露出整个庭院,最后缓慢向上倾斜到天空。
|
|
34
|
-
动作:公主们互相微笑,然后开始和谐地唱歌,然后在灯光亮起时向天空举手。
|
|
35
|
-
音频:柔和的管弦乐,伴随着令人振奋的弦乐和合唱,沙沙作响的树叶和远处鸟儿的环绕声,对话:"我们相信明天会更加光明。"
|
|
36
|
-
风格:迪士尼风格的动画,鲜艳的色彩,梦幻般的灯光。`,"一个美丽的日出场景,阳光从山峰后缓缓升起,云朵轻柔地飘动","一个森林中的场景,树叶在微风中轻轻摇摆,阳光斑驳","一个海边场景,海浪轻拍岸边,海鸟在空中盘旋","一个花园场景,花朵在微风中轻摆,蝴蝶翩翩起舞","一个雨后场景,水滴从树叶上缓缓滴落,彩虹出现在天空","一个雪花飘落的冬日场景,雪花轻柔地降落","一个星空场景,星星闪烁,云朵缓缓飘过月亮","一个溪流场景,清水在石头间潺潺流淌,鱼儿游过"],en:[`Scene: A grand castle courtyard at sunset, golden light filtering through stained glass windows, creating a warm and hopeful atmosphere.
|
|
37
|
-
Camera: Medium close-up tracking shot of the two princesses, then a wide-angle pull-out to reveal the entire courtyard, ending with a slow upward tilt to the sky.
|
|
38
|
-
Action: The princesses smile at each other, then begin singing in harmony, then raise their hands toward the sky as the light brightens.
|
|
39
|
-
Audio: Soft orchestral music with uplifting strings and choir, ambient sounds of rustling leaves and distant birds, dialogue: "Together, we believe tomorrow will be brighter."
|
|
40
|
-
Style: Disney-style animation, vibrant colors, dreamy lighting.`,"a beautiful sunrise scene where the sun slowly rises from behind mountains with clouds gently floating","a forest scene with leaves gently swaying in the breeze and dappled sunlight","a seaside scene with waves gently lapping the shore and seagulls circling overhead","a garden scene with flowers swaying in the breeze and butterflies dancing","a post-rain scene with water drops slowly dripping from leaves and a rainbow appearing in the sky","a winter scene with snowflakes gently falling","a starry night scene with twinkling stars and clouds slowly drifting across the moon","a stream scene with clear water flowing gently between stones and fish swimming by"]},tD={zh:[{content:"灵感图:咖啡文化,16图",scene:"灵感图",tips:"调用1次文本模型 + 1次生图模型,一张图排布n张子图(最多16张)",modelType:"agent"},{content:"宫格图:可爱猫咪表情包,16宫格",scene:"宫格图",tips:"调用1次文本模型 + 1次生图模型,一张图排布n张正方形子图(最多16张)",modelType:"agent"},{content:"创作一个视频:樱花树下的少女,微风吹过,花瓣飘落",scene:"视频创作",tips:"调用1次文本模型 + 1次生视频模型",modelType:"video"},{content:"画一个AI工作流的流程图",scene:"mermaid图",tips:"调用1次文本模型,支持流程图、泳道图、",modelType:"agent"},{content:"大模型发展趋势的思维导图",scene:"知识梳理",tips:"调用1次文本模型",modelType:"agent"},{content:"矢量图:一个简约风格的火箭作为公司logo",scene:"SVG矢量图",tips:"调用1次文本模型生成SVG图标,可无损缩放",modelType:"agent"},{content:"生成一份关于人工智能发展的PPT",scene:"PPT演示",tips:"调用1次文本模型生成大纲 + 自动布局为多页PPT幻灯片",modelType:"agent"}],en:[{content:"inspiration board: Coffee culture mood board, beans, latte art, cafe scenes",scene:"Inspiration board",tips:"1 text model + 1 image model",modelType:"agent"},{content:"grid image: Cute cat emoji pack, 4x4 scattered layout",scene:"Grid image",tips:"1 text model + 1 image model",modelType:"agent"},{content:"a video: A girl under cherry blossom tree, petals falling in the breeze",scene:"Video creation",tips:"1 text model + 1 video model",modelType:"video"},{content:"Draw a flowchart of AI workflow",scene:"Tech docs",tips:"1 text model",modelType:"agent"},{content:"Draw a mind map of LLM development trends",scene:"Knowledge organization",tips:"1 text model",modelType:"agent"},{content:"SVG: A minimalist rocket icon",scene:"SVG vector",tips:"1 text model to generate SVG code, scalable and lossless",modelType:"agent"},{content:"Generate a PPT about artificial intelligence development",scene:"PPT slides",tips:"1 text model for outline + auto layout into multi-page PPT slides",modelType:"agent"}]},b2=e=>Qh[e],x2=e=>eD[e];function nD(e={}){const{language:t="zh",deduplicateWithPresets:n=!0,customPresetContents:i}=e,[o,s]=p.useState([]),r=p.useMemo(()=>{if(!n)return new Set;if(i&&i.length>0)return new Set(i.map(g=>g.trim().toLowerCase()));const h=tD[t]||[];return new Set(h.map(g=>g.content.trim().toLowerCase()))},[t,n,i]),a=p.useMemo(()=>!n||r.size===0?o:o.filter(h=>!r.has(h.content.trim().toLowerCase())),[o,r,n]),c=p.useCallback(()=>{const h=qi.getHistory();s(h)},[]);p.useEffect(()=>{let h=!0;return(async()=>{await qi.waitForInit(),h&&c()})(),()=>{h=!1}},[c]);const u=p.useCallback((h,g,b)=>{qi.addHistory(h,g,b),c()},[c]),d=p.useCallback(h=>{qi.removeHistory(h),c()},[c]),m=p.useCallback(()=>{qi.clearHistory(),c()},[c]),f=p.useCallback(h=>{qi.togglePin(h),c()},[c]);return{history:a,addHistory:u,removeHistory:d,clearHistory:m,refreshHistory:c,togglePinHistory:f}}const _o=8,iD=60,oD=600,Sm=24,sD='16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';let Ma=null,Rs=null;function rD(){if(Ma||(Ma=document.createElement("canvas"),Rs=Ma.getContext("2d")),!Rs)throw new Error("Failed to get canvas context");return Rs.font=sD,Rs}function Ia(e){return rD().measureText(e).width}function aD(e){const t=e.split(`
|
|
41
|
-
`);let n=0;for(const a of t){const c=Ia(a);n=Math.max(n,c)}const i=Math.min(oD-_o*2,Math.max(iD-_o*2,n)),o=i+_o*2;let s=0;for(const a of t){if(a.length===0){s+=1;continue}if(Ia(a)<=i)s+=1;else{let u=0,d=1;for(const m of a){const f=Ia(m);u+f>i?(d++,u=f):u+=f}s+=d}}const r=Math.max(Sm+_o*2,s*Sm+_o*2);return{width:o,height:r}}function lD(e){switch(e){case"ai-input":return l.jsxDEV(M0,{size:12},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:156,columnNumber:14},this);case"image":return l.jsxDEV(Up,{size:12},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:158,columnNumber:14},this);case"video":return l.jsxDEV(A0,{size:12},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:160,columnNumber:14},this);default:return null}}function cD(e,t){return{"ai-input":{zh:"AI输入",en:"AI Input"},image:{zh:"图片",en:"Image"},video:{zh:"视频",en:"Video"},preset:{zh:"预设",en:"Preset"}}[e][t]}const uD=({board:e,language:t,title:n})=>{const[i,o]=p.useState(!1),[s,r]=p.useState(0),{history:a,addHistory:c,removeHistory:u}=nD({deduplicateWithPresets:!1}),{confirm:d,confirmDialog:m}=Ir({container:e?F.getBoardContainer(e):null}),f=p.useRef(null),[h,g]=p.useState([]),[b,x]=p.useState([]);p.useEffect(()=>{i&&(g(_0()),x(j0()))},[i]);const y=p.useMemo(()=>{const E=Qh[t].map((I,P)=>({id:`preset_${P}`,content:I,source:"preset"})),U=a.map(I=>({id:I.id,content:I.content,source:"ai-input",timestamp:I.timestamp})),q=h.map(I=>({id:I.id,content:I.content,source:"image",timestamp:I.timestamp})),$=b.map(I=>({id:I.id,content:I.content,source:"video",timestamp:I.timestamp})),V=[...U,...q,...$];V.sort((I,P)=>(P.timestamp||0)-(I.timestamp||0));const R=new Set,M=[];for(const I of V){const P=I.content.trim();R.has(P)||(R.add(P),M.push(I))}const _=E.filter(I=>!R.has(I.content.trim()));return[...M,..._]},[t,a,h,b]),{historyPrompts:N,presetPrompts:w}=p.useMemo(()=>{const E=y.filter(q=>q.source!=="preset"),U=y.filter(q=>q.source==="preset");return{historyPrompts:E,presetPrompts:U}},[y]),T=p.useCallback((E,U)=>E==="history"?U:N.length+U,[N.length]);p.useEffect(()=>{i&&r(0)},[i]);const S=p.useCallback(E=>{c(E.content),o(!1);const U=Be(e);if(U.length===0)return;const q=R=>({type:"paragraph",children:[{text:R}]}),{width:$,height:V}=aD(E.content);for(const R of U){const M=e.children.findIndex(I=>I.id===R.id);if(M<0)continue;const _={};if(nn.isMindElement(e,R)){const I=[q(E.content)];ue.setNode(e,{data:I},[M]);continue}if(H.isText&&H.isText(R)){if(_.text=q(E.content),"points"in R&&Array.isArray(R.points)&&R.points.length>=2){const I=R.points,[P]=I,Z=[P,[P[0]+$,P[1]+V]];_.points=Z}ue.setNode(e,_,[M]);continue}if(H.isDrawElement(R)&&zl([R])){if("text"in R&&R.text){if(_.text=q(E.content),"points"in R&&Array.isArray(R.points)&&R.points.length>=2){const I=R.points,[P]=I,Z=[P,[P[0]+$,P[1]+V]];_.points=Z}ue.setNode(e,_,[M]);continue}if("data"in R&&Array.isArray(R.data)){if(_.data=[q(E.content)],"points"in R&&Array.isArray(R.points)&&R.points.length>=2){const I=R.points,[P]=I,Z=[P,[P[0]+$,P[1]+V]];_.points=Z}ue.setNode(e,_,[M]);continue}}if("text"in R&&R.text){if(_.text=q(E.content),"points"in R&&Array.isArray(R.points)&&R.points.length>=2){const I=R.points,[P]=I,Z=[P,[P[0]+$,P[1]+V]];_.points=Z}ue.setNode(e,_,[M]);continue}"textContent"in R&&ue.setNode(e,{textContent:E.content},[M])}},[e,c]),v=p.useCallback(async(E,U)=>{E.stopPropagation(),await d({title:t==="zh"?"确认删除提示词":"Delete Prompt",description:t==="zh"?"确定要删除这条历史提示词吗?此操作不可撤销。":"Are you sure you want to delete this prompt history item? This action cannot be undone.",confirmText:t==="zh"?"删除":"Delete",cancelText:t==="zh"?"取消":"Cancel",danger:!0})&&u(U)},[d,t,u]);return p.useEffect(()=>{if(!i)return;const E=U=>{if(y.length===0){U.key==="Escape"&&(U.preventDefault(),o(!1));return}switch(U.key){case"ArrowUp":U.preventDefault(),r(q=>q<=0?y.length-1:q-1);break;case"ArrowDown":U.preventDefault(),r(q=>q>=y.length-1?0:q+1);break;case"Enter":U.preventDefault(),y[s]&&S(y[s]);break;case"Escape":U.preventDefault(),o(!1);break}};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[i,y,s,S]),p.useEffect(()=>{var U;if(!i||y.length===0)return;const E=(U=f.current)==null?void 0:U.querySelector(".popup-prompt-panel__item--highlighted");E&&E.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,i,y.length]),l.jsxDEV(at,{open:i,onOpenChange:o,placement:"top",sideOffset:8,children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:"prompt-button",type:"icon",icon:l.jsxDEV(hu,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:489,columnNumber:17},void 0),visible:!0,tooltip:n||(t==="zh"?"提示词":"Prompts"),"aria-label":n||(t==="zh"?"提示词":"Prompts"),onPointerUp:()=>o(!i)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:486,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:485,columnNumber:7},void 0),l.jsxDEV(ct,{className:`popup-prompt-panel ${Mt}`,onMouseDown:E=>E.preventDefault(),children:l.jsxDEV("div",{ref:f,className:"popup-prompt-panel__content",children:[N.length>0&&l.jsxDEV("div",{className:"popup-prompt-panel__section",children:[l.jsxDEV("div",{className:"popup-prompt-panel__section-header",children:[l.jsxDEV(P0,{size:14},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:505,columnNumber:17},void 0),l.jsxDEV("span",{children:t==="zh"?"历史记录":"History"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:506,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:504,columnNumber:15},void 0),l.jsxDEV("div",{className:"popup-prompt-panel__list",children:N.map((E,U)=>l.jsxDEV("div",{className:`popup-prompt-panel__item popup-prompt-panel__item--history ${T("history",U)===s?"popup-prompt-panel__item--highlighted":""}`,onClick:()=>S(E),onMouseEnter:()=>r(T("history",U)),children:[l.jsxDEV("div",{className:"popup-prompt-panel__item-content",children:[l.jsxDEV("span",{className:"popup-prompt-panel__item-text",children:E.content},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:521,columnNumber:23},void 0),l.jsxDEV("span",{className:`popup-prompt-panel__item-source popup-prompt-panel__item-source--${E.source}`,children:[lD(E.source),l.jsxDEV("span",{children:cD(E.source,t)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:527,columnNumber:25},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:525,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:520,columnNumber:21},void 0),E.source==="ai-input"&&l.jsxDEV(Dt,{content:t==="zh"?"删除":"Delete",showArrow:!1,children:l.jsxDEV("button",{className:"popup-prompt-panel__item-delete",onClick:q=>v(q,E.id),children:l.jsxDEV(C0,{size:12},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:540,columnNumber:27},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:536,columnNumber:25},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:532,columnNumber:23},void 0)]},E.id,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:510,columnNumber:19},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:508,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:503,columnNumber:13},void 0),w.length>0&&l.jsxDEV("div",{className:"popup-prompt-panel__section",children:[l.jsxDEV("div",{className:"popup-prompt-panel__section-header",children:[l.jsxDEV(hu,{size:14},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:554,columnNumber:17},void 0),l.jsxDEV("span",{children:t==="zh"?"推荐提示词":"Suggestions"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:555,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:553,columnNumber:15},void 0),l.jsxDEV("div",{className:"popup-prompt-panel__list",children:w.map((E,U)=>l.jsxDEV("div",{className:`popup-prompt-panel__item ${T("preset",U)===s?"popup-prompt-panel__item--highlighted":""}`,onClick:()=>S(E),onMouseEnter:()=>r(T("preset",U)),children:l.jsxDEV("span",{className:"popup-prompt-panel__item-text",children:E.content},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:569,columnNumber:21},void 0)},E.id,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:559,columnNumber:19},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:557,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:552,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:500,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:496,columnNumber:7},void 0),m]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/prompt-button.tsx",lineNumber:484,columnNumber:5},void 0)},jo={bringToFront(e){const t=Be(e);if(t.length===0)return;const n=e.children.length-1,i=t.map(o=>({element:o,index:e.children.findIndex(s=>s.id===o.id)})).sort((o,s)=>s.index-o.index);for(const{element:o,index:s}of i)s>=0&&s<n&&ue.moveNode(e,[s],[n])},bringForward(e){const t=Be(e);if(t.length===0)return;const n=e.children.length-1,i=t.map(o=>({element:o,index:e.children.findIndex(s=>s.id===o.id)})).sort((o,s)=>s.index-o.index);for(const{element:o,index:s}of i)s>=0&&s<n&&ue.moveNode(e,[s],[s+2])},sendBackward(e){const t=Be(e);if(t.length===0)return;const n=t.map(i=>({element:i,index:e.children.findIndex(o=>o.id===i.id)})).sort((i,o)=>i.index-o.index);for(const{element:i,index:o}of n)o>0&&ue.moveNode(e,[o],[o-1])},sendToBack(e){const t=Be(e);if(t.length===0)return;const n=t.map(i=>({element:i,index:e.children.findIndex(o=>o.id===i.id)})).sort((i,o)=>i.index-o.index);for(const{element:i,index:o}of n)o>0&&ue.moveNode(e,[o],[0])},getLayerInfo(e,t){const n=e.children.findIndex(o=>o.id===t);if(n<0)return null;const i=e.children.length;return{index:n,total:i,canMoveUp:n<i-1,canMoveDown:n>0}}},dD=({board:e,title:t})=>{const{language:n}=ke(),[i,o]=p.useState(!1),[s,r]=p.useState(0),a=F.getBoardContainer(e),c=p.useMemo(()=>{const b=Be(e);if(b.length===0)return null;const x=b[0];return jo.getLayerInfo(e,x.id)},[e,s]),u=p.useCallback(()=>{jo.bringToFront(e),r(b=>b+1)},[e]),d=p.useCallback(()=>{jo.bringForward(e),r(b=>b+1)},[e]),m=p.useCallback(()=>{jo.sendBackward(e),r(b=>b+1)},[e]),f=p.useCallback(()=>{jo.sendToBack(e),r(b=>b+1)},[e]),h=(c==null?void 0:c.canMoveUp)??!1,g=(c==null?void 0:c.canMoveDown)??!1;return l.jsxDEV(at,{sideOffset:12,crossAxisOffset:-100,open:i,onOpenChange:o,placement:"top-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button","layer-control-button"),selected:i,visible:!0,icon:l.jsxDEV(I0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:80,columnNumber:17},void 0),type:"button",tooltip:t,"aria-label":t,onPointerUp:()=>o(!i)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:76,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:75,columnNumber:7},void 0),l.jsxDEV(ct,{container:a,children:l.jsxDEV(Ye,{padding:1,className:Y(Mt,"layer-control-panel"),children:l.jsxDEV("div",{className:"layer-actions",children:[l.jsxDEV(Dt,{content:n==="zh"?"置顶":"Bring to Front",showArrow:!1,children:l.jsxDEV("button",{className:Y("layer-action-btn",{disabled:!h}),onClick:u,disabled:!h,children:[l.jsxDEV(V0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:101,columnNumber:17},void 0),l.jsxDEV("span",{children:n==="zh"?"置顶":"Front"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:102,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:94,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:90,columnNumber:13},void 0),l.jsxDEV(Dt,{content:n==="zh"?"上移一层":"Bring Forward",showArrow:!1,children:l.jsxDEV("button",{className:Y("layer-action-btn",{disabled:!h}),onClick:d,disabled:!h,children:[l.jsxDEV(U0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:117,columnNumber:17},void 0),l.jsxDEV("span",{children:n==="zh"?"上移":"Forward"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:118,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:110,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:106,columnNumber:13},void 0),l.jsxDEV(Dt,{content:n==="zh"?"下移一层":"Send Backward",showArrow:!1,children:l.jsxDEV("button",{className:Y("layer-action-btn",{disabled:!g}),onClick:m,disabled:!g,children:[l.jsxDEV(R0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:133,columnNumber:17},void 0),l.jsxDEV("span",{children:n==="zh"?"下移":"Backward"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:134,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:126,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:122,columnNumber:13},void 0),l.jsxDEV(Dt,{content:n==="zh"?"置底":"Send to Back",showArrow:!1,children:l.jsxDEV("button",{className:Y("layer-action-btn",{disabled:!g}),onClick:f,disabled:!g,children:[l.jsxDEV(q0,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:149,columnNumber:17},void 0),l.jsxDEV("span",{children:n==="zh"?"置底":"Back"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:150,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:142,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:138,columnNumber:13},void 0),c&&l.jsxDEV("span",{className:"layer-info",children:[c.index+1,"/",c.total]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:155,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:89,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:88,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:87,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/layer-control-button.tsx",lineNumber:68,columnNumber:5},void 0)},mD=({board:e,title:t})=>{const{language:n}=ke(),[i,o]=p.useState(!1),s=F.getBoardContainer(e),r=p.useCallback(()=>{rn.alignLeft(e)},[e]),a=p.useCallback(()=>{rn.alignCenter(e)},[e]),c=p.useCallback(()=>{rn.alignRight(e)},[e]),u=p.useCallback(()=>{rn.alignTop(e)},[e]),d=p.useCallback(()=>{rn.alignMiddle(e)},[e]),m=p.useCallback(()=>{rn.alignBottom(e)},[e]),f=[{key:"left",icon:l.jsxDEV(L0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:67,columnNumber:13},void 0),label:n==="zh"?"左对齐":"Align Left",shortcut:"⌥ A",handler:r},{key:"center",icon:l.jsxDEV(O0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:74,columnNumber:13},void 0),label:n==="zh"?"水平居中":"Align Center",shortcut:"⌥ H",handler:a},{key:"right",icon:l.jsxDEV(F0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:81,columnNumber:13},void 0),label:n==="zh"?"右对齐":"Align Right",shortcut:"⌥ D",handler:c},{key:"top",icon:l.jsxDEV(H0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:88,columnNumber:13},void 0),label:n==="zh"?"顶部对齐":"Align Top",shortcut:"⌥ W",handler:u},{key:"middle",icon:l.jsxDEV(z0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:95,columnNumber:13},void 0),label:n==="zh"?"垂直居中":"Align Middle",shortcut:"⌥ V",handler:d},{key:"bottom",icon:l.jsxDEV(G0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:102,columnNumber:13},void 0),label:n==="zh"?"底部对齐":"Align Bottom",shortcut:"⌥ S",handler:m}];return l.jsxDEV(at,{sideOffset:12,crossAxisOffset:-100,open:i,onOpenChange:o,placement:"top-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button","alignment-button"),selected:i,visible:!0,icon:l.jsxDEV(B0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:122,columnNumber:17},void 0),type:"button",tooltip:t,"aria-label":t,onPointerUp:()=>o(!i)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:118,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:117,columnNumber:7},void 0),l.jsxDEV(ct,{container:s,children:l.jsxDEV(Ye,{padding:1,className:Y(Mt,"alignment-panel"),children:l.jsxDEV("div",{className:"alignment-actions",children:f.map(h=>l.jsxDEV(Dt,{content:h.label,showArrow:!1,children:l.jsxDEV("button",{className:"alignment-action-btn",onClick:h.handler,children:[h.icon,l.jsxDEV("span",{className:"alignment-label",children:h.label},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:149,columnNumber:19},void 0),l.jsxDEV("span",{className:"alignment-shortcut",children:h.shortcut},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:150,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:144,columnNumber:17},void 0)},h.key,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:139,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:137,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:130,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:129,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/alignment-button.tsx",lineNumber:110,columnNumber:5},void 0)},pD=({board:e,title:t})=>{const{language:n}=ke(),[i,o]=p.useState(!1),s=F.getBoardContainer(e),r=p.useCallback(()=>{eo.distributeHorizontal(e)},[e]),a=p.useCallback(()=>{eo.distributeVertical(e)},[e]),c=p.useCallback(()=>{eo.autoArrange(e)},[e]),u=[{key:"horizontal",icon:l.jsxDEV($0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:52,columnNumber:13},void 0),label:n==="zh"?"水平间距":"Horizontal Spacing",shortcut:"⇧ H",handler:r},{key:"vertical",icon:l.jsxDEV(X0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:59,columnNumber:13},void 0),label:n==="zh"?"垂直间距":"Vertical Spacing",shortcut:"⇧ V",handler:a},{key:"auto",icon:l.jsxDEV(K0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:66,columnNumber:13},void 0),label:n==="zh"?"自动排列":"Auto Arrange",shortcut:"⇧ A",handler:c}];return l.jsxDEV(at,{sideOffset:12,crossAxisOffset:-100,open:i,onOpenChange:o,placement:"top-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button","distribute-button"),selected:i,visible:!0,icon:l.jsxDEV(W0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:86,columnNumber:17},void 0),type:"button",tooltip:t,"aria-label":t,onPointerUp:()=>o(!i)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:82,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:81,columnNumber:7},void 0),l.jsxDEV(ct,{container:s,children:l.jsxDEV(Ye,{padding:1,className:Y(Mt,"distribute-panel"),children:l.jsxDEV("div",{className:"distribute-actions",children:u.map(d=>l.jsxDEV(Dt,{content:d.label,showArrow:!1,children:l.jsxDEV("button",{className:"distribute-action-btn",onClick:d.handler,children:[d.icon,l.jsxDEV("span",{className:"distribute-label",children:d.label},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:113,columnNumber:19},void 0),l.jsxDEV("span",{className:"distribute-shortcut",children:d.shortcut},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:114,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:108,columnNumber:17},void 0)},d.key,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:103,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:101,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:94,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:93,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/distribute-button.tsx",lineNumber:74,columnNumber:5},void 0)},fD=({board:e,title:t})=>{const{language:n}=ke(),[i,o]=p.useState(!1),s=F.getBoardContainer(e),r=p.useCallback(()=>{vn.union(e,n),o(!1)},[e,n]),a=p.useCallback(()=>{vn.subtract(e,n)},[e,n]),c=p.useCallback(()=>{vn.intersect(e,n)},[e,n]),u=p.useCallback(()=>{vn.exclude(e,n)},[e,n]),d=p.useCallback(()=>{vn.flatten(e,n)},[e,n]),m=[{key:"union",icon:l.jsxDEV(Z0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:63,columnNumber:13},void 0),label:n==="zh"?"合并":"Union",shortcut:"⌥⇧U",handler:r},{key:"subtract",icon:l.jsxDEV(Q0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:70,columnNumber:13},void 0),label:n==="zh"?"减去":"Subtract",shortcut:"⌥⇧S",handler:a},{key:"intersect",icon:l.jsxDEV(J0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:77,columnNumber:13},void 0),label:n==="zh"?"相交":"Intersect",shortcut:"⌥⇧I",handler:c},{key:"exclude",icon:l.jsxDEV(ex,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:84,columnNumber:13},void 0),label:n==="zh"?"排除":"Exclude",shortcut:"⌥⇧E",handler:u},{key:"flatten",icon:l.jsxDEV(tx,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:91,columnNumber:13},void 0),label:n==="zh"?"扁平化":"Flatten",shortcut:"⇧⌥F",handler:d}];return l.jsxDEV(at,{sideOffset:12,crossAxisOffset:-100,open:i,onOpenChange:o,placement:"top-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:Y("property-button","boolean-button"),selected:i,visible:!0,icon:l.jsxDEV(Y0,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:111,columnNumber:17},void 0),type:"button",tooltip:t,"aria-label":t,onPointerUp:()=>o(!i)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:107,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:106,columnNumber:7},void 0),l.jsxDEV(ct,{container:s,children:l.jsxDEV(Ye,{padding:1,className:Y(Mt,"boolean-panel"),children:l.jsxDEV("div",{className:"boolean-actions",children:m.map(f=>l.jsxDEV(Dt,{content:f.label,showArrow:!1,children:l.jsxDEV("button",{className:"boolean-action-btn",onClick:f.handler,children:[f.icon,l.jsxDEV("span",{className:"boolean-label",children:f.label},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:138,columnNumber:19},void 0),l.jsxDEV("span",{className:"boolean-shortcut",children:f.shortcut},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:139,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:133,columnNumber:17},void 0)},f.key,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:128,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:126,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:119,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:118,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/boolean-button.tsx",lineNumber:99,columnNumber:5},void 0)};function hD(e){return e.sort((t,n)=>t.position-n.position).map(t=>`${t.color} ${t.position}%`).join(", ")}function gD(e){const t=hD(e.stops);return e.type==="linear"?`linear-gradient(${e.angle}deg, ${t})`:`radial-gradient(circle, ${t})`}function Va(e){return e.enabled?`${e.offsetX}px ${e.offsetY}px ${e.blur}px ${e.color}`:""}const Ua=Pt.CUSTOM_GRADIENTS,bD=({board:e,isOpen:t,onClose:n,currentFontSize:i,currentFontFamily:o,currentColor:s,toolbarRect:r,selectionRect:a})=>{var Zc,Qc;const{t:c,language:u}=ke(),{confirm:d,confirmDialog:m}=Ir({container:F.getBoardContainer(e)}),f=p.useRef(null),[h,g]=p.useState({top:0,left:0}),[b,x]=p.useState(i||"16"),[y,N]=p.useState(!1),[w,T]=p.useState(o||"PingFang SC"),[S,v]=p.useState(new Set),[E,U]=p.useState(400),[q,$]=p.useState("left"),[V,R]=p.useState(1.5),[M,_]=p.useState(0),[I,P]=p.useState(!1),[Z,pe]=p.useState(!1),[A,G]=p.useState(!1),[ce,X]=p.useState(!1),[ae,le]=p.useState(!1),[be,we]=p.useState(!1),[Fe,K]=p.useState(null),[Ce,We]=p.useState(null),[it,Ke]=p.useState(0),[D,j]=p.useState("#000000"),[W,Q]=p.useState(null),[C,B]=p.useState(null),[L,z]=p.useState(!1),[te,ee]=p.useState(null),[O,J]=p.useState({color:"rgba(0, 0, 0, 0.5)",offsetX:2,offsetY:2,blur:4}),[oe,Ie]=p.useState(!1),[ut,Re]=p.useState(null),[ie,Ae]=p.useState({type:"linear",angle:135,stops:[{color:"#FF6B6B",offset:0},{color:"#4ECDC4",offset:1}]}),[Ue,_e]=p.useState([]),[Le,It]=p.useState(s||"#000000"),[_t,Vt]=p.useState(!1);p.useEffect(()=>{let k=!0;return kn.get(Ua).then(de=>{k&&de&&_e(de)}).catch(de=>{console.warn("Failed to load gradient data:",de)}),()=>{k=!1}},[]),p.useEffect(()=>{if(t){const k=_T(e);if(k["text-gradient"]){Ie(!0);const je=nx.find(et=>gD(et.config)===k["text-gradient"]);Re(je?je.id:null)}else Ie(!1),Re(null);if(k["text-shadow"]){z(!0);const je=k["text-shadow"];let et=null;for(const[on,Wn]of Object.entries(gu.textShadow))if(Va(Wn)===je){et=on;break}ee(et||null)}else z(!1),ee(null);if(k["font-family"]&&T(k["font-family"]),k["font-weight"]&&U(Number(k["font-weight"])),k["line-height"]&&R(Number(k["line-height"])),k["letter-spacing"]){const je=String(k["letter-spacing"]).replace("px","");_(Number(je))}const de=jT(e);$(de),P(!!k.bold),pe(!!k.italic),G(!!k.underlined),X(!!k.strikethrough),le(!!k.superscript),we(!!k.subscript),K(k["background-color"]||null),We(k["text-transform"]||null),Ke(k["text-stroke"]||0),j(k["text-stroke-color"]||"#000000"),Q(k["text-decoration-style"]||null),B(k["text-decoration-color"]||null)}},[t,e]),p.useEffect(()=>{if(t&&!y){const k=setTimeout(()=>{bu.forEach(de=>{Es.isFontLoaded(de.family)||Es.loadGoogleFont(de.family).catch(je=>{console.warn(`Failed to preload font ${de.family}:`,je)})})},500);return()=>clearTimeout(k)}},[t,y]),p.useEffect(()=>{if(t&&r&&a){let et=a.right+12,on=r.top+r.height+8;const Wn=window.innerWidth,pa=window.innerHeight;et+320>Wn-16&&(et=a.left-320-12,et<16&&(et=Wn-320-16)),on+520>pa-16&&(on=Math.max(16,pa-520-16)),g({left:Math.max(16,et),top:Math.max(16,on)})}},[t,r,a]);const Lt=p.useCallback(k=>{const de=parseInt(k,10);!isNaN(de)&&de>=8&&de<=100&&(x(k),Kh(e,k))},[e]),zt=p.useCallback(async k=>{if(T(k.family),N(!1),k.source==="google"&&!Es.isFontLoaded(k.family)){v(de=>new Set(de).add(k.family));try{await Es.loadGoogleFont(k.family)}catch(de){console.error("Failed to load Google font:",de)}finally{v(de=>{const je=new Set(de);return je.delete(k.family),je})}}pT(e,k.family)},[e]);p.useEffect(()=>{s&&It(s)},[s]);const mi=p.useCallback(k=>{It(k),Jn.setTextColor(e,k)},[e]),Gn=p.useCallback((k,de)=>{ee(k),z(!0),J({color:de.color,offsetX:de.offsetX,offsetY:de.offsetY,blur:de.blur});const je=Va(de);Ca(e,je)},[e]),xe=p.useCallback((k,de)=>{const je={...O,[k]:de};J(je),ee(null);const et=`${je.offsetX}px ${je.offsetY}px ${je.blur}px ${je.color}`;Ca(e,et)},[e,O]),He=p.useCallback(k=>{Ae(k),Re(null);const de=Ni(k);bm(e,de)},[e]),Ne=p.useCallback(()=>{const k=Ni(ie),je=[{id:`custom-${Date.now()}`,css:k},...Ue].slice(0,8);_e(je),kn.set(Ua,je).catch(et=>{console.warn("Failed to save custom gradients:",et)})},[ie,Ue]),Ve=p.useCallback(async k=>{if(!await d({title:u==="zh"?"确认删除渐变预设":"Delete Gradient Preset",description:u==="zh"?"确定要删除这个自定义渐变预设吗?":"Are you sure you want to delete this custom gradient preset?",confirmText:u==="zh"?"删除":"Delete",cancelText:u==="zh"?"取消":"Cancel",danger:!0}))return;const je=Ue.filter(et=>et.id!==k);_e(je),kn.set(Ua,je).catch(et=>{console.warn("Failed to save custom gradients:",et)})},[d,Ue,u]),ot=p.useCallback(()=>{const k=!L;z(k),k||(Ca(e,null),ee(null))},[e,L]),ze=p.useCallback(()=>{const k=!oe;Ie(k),k||(bm(e,null),Re(null))},[e,oe]),Oe=p.useCallback(k=>{U(k),Yh(e,k)},[e]),st=p.useCallback(k=>{$(k),fT(e,k)},[e]),ht=p.useCallback(k=>{R(k),hT(e,k)},[e]),jt=p.useCallback(k=>{_(k),gT(e,k)},[e]),Ut=p.useCallback(()=>{P(!I),bT(e)},[e,I]),dt=p.useCallback(()=>{pe(!Z),xT(e)},[e,Z]),dn=p.useCallback(()=>{G(!A),NT(e)},[e,A]),aa=p.useCallback(()=>{X(!ce),yT(e)},[e,ce]),la=p.useCallback(()=>{const k=!ae;le(k),k&&we(!1),wT(e)},[e,ae]),ca=p.useCallback(()=>{const k=!be;we(k),k&&le(!1),vT(e)},[e,be]),se=p.useCallback(k=>{K(k),ET(e,k)},[e]),Eo=p.useCallback(k=>{const de=k===Ce?null:k;We(de),kT(e,de)},[e,Ce]),Ui=p.useCallback((k,de)=>{Ke(k),de&&j(de),ST(e,k>0?k:null,de||D)},[e,D]),xb=p.useCallback(k=>{Q(k),TT(e,k)},[e]),Kc=p.useCallback(k=>{B(k),DT(e,k)},[e]);p.useEffect(()=>{if(!t)return;const k=je=>{const et=je.target;f.current&&f.current.contains(et)||et.closest(".popup-toolbar")!==null||n()},de=setTimeout(()=>{document.addEventListener("mousedown",k)},100);return()=>{clearTimeout(de),document.removeEventListener("mousedown",k)}},[t,n]);const Nb=p.useCallback(k=>{k.target===k.currentTarget&&n()},[n]),[ua,da]=p.useState(!1),Yc=[{value:100,label:"Thin",labelZh:"极细"},{value:200,label:"Extra Light",labelZh:"特细"},{value:300,label:"Light",labelZh:"细体"},{value:400,label:"Regular",labelZh:"常规"},{value:500,label:"Medium",labelZh:"中等"},{value:600,label:"Semi Bold",labelZh:"半粗"},{value:700,label:"Bold",labelZh:"粗体"},{value:800,label:"Extra Bold",labelZh:"特粗"},{value:900,label:"Black",labelZh:"黑体"}],yb=p.useCallback(k=>{const de=Yc.find(je=>je.value===k);return de?u==="zh"?de.labelZh:de.label:String(k)},[u]),ma=[...ix,...bu],wb=p.useCallback(k=>{const de=ma.find(je=>je.family===k);return(de==null?void 0:de.displayName)||k},[ma]);return t?l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{className:"text-property-panel-overlay",onClick:Nb,onPointerDown:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation()},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:612,columnNumber:7},void 0),l.jsxDEV("div",{ref:f,className:Y("text-property-panel",{"is-open":t}),style:{top:h.top,left:h.left},onPointerDown:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),onClick:k=>k.stopPropagation(),onPointerUp:k=>k.stopPropagation(),children:[l.jsxDEV("div",{className:"text-property-panel__header",children:[l.jsxDEV("span",{className:"text-property-panel__header-title",children:c("propertyPanel.title")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:631,columnNumber:11},void 0),l.jsxDEV("button",{className:"text-property-panel__header-close",onClick:n,children:l.jsxDEV("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:l.jsxDEV("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:636,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:635,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:634,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:630,columnNumber:9},void 0),l.jsxDEV("div",{className:"text-property-panel__content",children:[l.jsxDEV("div",{className:"text-property-panel__section",children:l.jsxDEV("div",{className:"text-property-panel__section-content",children:[l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"字号":"Size"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:648,columnNumber:17},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:b,min:8,max:100,step:1,onChange:k=>{x(k.target.value),Lt(k.target.value)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:650,columnNumber:19},void 0),l.jsxDEV("span",{className:"inline-control__value",children:b},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:662,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:649,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:647,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control inline-control--dropdown",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"字体":"Font"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:668,columnNumber:17},void 0),l.jsxDEV("div",{className:"custom-dropdown",children:[l.jsxDEV("div",{className:Y("custom-dropdown__trigger",{"is-expanded":y}),onClick:()=>{N(!y),da(!1)},children:[l.jsxDEV("span",{className:"custom-dropdown__value",style:{fontFamily:`'${w}', sans-serif`},children:wb(w)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:677,columnNumber:21},void 0),l.jsxDEV("svg",{className:"custom-dropdown__arrow",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:l.jsxDEV("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:684,columnNumber:23},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:683,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:670,columnNumber:19},void 0),l.jsxDEV("div",{className:Y("custom-dropdown__menu custom-dropdown__menu--font",{"is-open":y}),children:ma.map(k=>l.jsxDEV("div",{className:Y("custom-dropdown__item custom-dropdown__item--font",{"is-active":w===k.family}),onClick:()=>{zt(k),N(!1)},children:[l.jsxDEV("span",{className:"custom-dropdown__item-label",children:k.displayName},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:699,columnNumber:25},void 0),l.jsxDEV("span",{className:"custom-dropdown__item-preview",style:{fontFamily:`'${k.family}', sans-serif`},children:k.previewText},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:700,columnNumber:25},void 0)]},k.family,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:689,columnNumber:23},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:687,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:669,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:667,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control inline-control--dropdown",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"字重":"Weight"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:714,columnNumber:17},void 0),l.jsxDEV("div",{className:"custom-dropdown",children:[l.jsxDEV("div",{className:Y("custom-dropdown__trigger",{"is-expanded":ua}),onClick:()=>{da(!ua),N(!1)},children:[l.jsxDEV("span",{className:"custom-dropdown__value",style:{fontWeight:E},children:yb(E)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:723,columnNumber:21},void 0),l.jsxDEV("svg",{className:"custom-dropdown__arrow",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:l.jsxDEV("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:727,columnNumber:23},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:726,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:716,columnNumber:19},void 0),l.jsxDEV("div",{className:Y("custom-dropdown__menu",{"is-open":ua}),children:Yc.map(k=>l.jsxDEV("div",{className:Y("custom-dropdown__item",{"is-active":E===k.value}),onClick:()=>{Oe(k.value),da(!1)},children:l.jsxDEV("span",{className:"custom-dropdown__item-label",style:{fontWeight:k.value},children:u==="zh"?k.labelZh:k.label},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:742,columnNumber:25},void 0)},k.value,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:732,columnNumber:23},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:730,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:715,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:713,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"对齐":"Align"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:756,columnNumber:17},void 0),l.jsxDEV("div",{className:"align-buttons align-buttons--compact",children:[l.jsxDEV("button",{className:Y("align-buttons__btn",{"is-active":q==="left"}),onClick:()=>st("left"),title:u==="zh"?"左对齐":"Align Left",children:l.jsxDEV("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:l.jsxDEV("path",{d:"M2 3h12v2H2V3zm0 4h8v2H2V7zm0 4h12v2H2v-2z"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:764,columnNumber:23},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:763,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:758,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("align-buttons__btn",{"is-active":q==="center"}),onClick:()=>st("center"),title:u==="zh"?"居中对齐":"Align Center",children:l.jsxDEV("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:l.jsxDEV("path",{d:"M2 3h12v2H2V3zm2 4h8v2H4V7zm-2 4h12v2H2v-2z"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:773,columnNumber:23},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:772,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:767,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("align-buttons__btn",{"is-active":q==="right"}),onClick:()=>st("right"),title:u==="zh"?"右对齐":"Align Right",children:l.jsxDEV("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:l.jsxDEV("path",{d:"M2 3h12v2H2V3zm4 4h8v2H6V7zm-4 4h12v2H2v-2z"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:782,columnNumber:23},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:781,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:776,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:757,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:755,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"样式":"Style"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:790,columnNumber:17},void 0),l.jsxDEV("div",{className:"style-buttons",children:[l.jsxDEV("button",{className:Y("style-buttons__btn",{"is-active":I}),onClick:Ut,title:u==="zh"?"加粗":"Bold",children:l.jsxDEV("span",{className:"style-buttons__icon style-buttons__icon--bold",children:"B"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:797,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:792,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("style-buttons__btn",{"is-active":Z}),onClick:dt,title:u==="zh"?"斜体":"Italic",children:l.jsxDEV("span",{className:"style-buttons__icon style-buttons__icon--italic",children:"I"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:804,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:799,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("style-buttons__btn",{"is-active":A}),onClick:dn,title:u==="zh"?"下划线":"Underline",children:l.jsxDEV("span",{className:"style-buttons__icon style-buttons__icon--underline",children:"U"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:811,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:806,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("style-buttons__btn",{"is-active":ce}),onClick:aa,title:u==="zh"?"删除线":"Strikethrough",children:l.jsxDEV("span",{className:"style-buttons__icon style-buttons__icon--strikethrough",children:"S"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:818,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:813,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("style-buttons__btn",{"is-active":ae}),onClick:la,title:u==="zh"?"上标":"Superscript",children:l.jsxDEV("span",{className:"style-buttons__icon style-buttons__icon--superscript",children:["X",l.jsxDEV("sup",{children:"2"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:825,columnNumber:93},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:825,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:820,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("style-buttons__btn",{"is-active":be}),onClick:ca,title:u==="zh"?"下标":"Subscript",children:l.jsxDEV("span",{className:"style-buttons__icon style-buttons__icon--subscript",children:["X",l.jsxDEV("sub",{children:"2"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:832,columnNumber:91},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:832,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:827,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:791,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:789,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"大小写":"Case"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:839,columnNumber:17},void 0),l.jsxDEV("div",{className:"case-buttons",children:[l.jsxDEV("button",{className:Y("case-buttons__btn",{"is-active":Ce==="uppercase"}),onClick:()=>Eo("uppercase"),title:u==="zh"?"全大写":"Uppercase",children:"AA"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:841,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("case-buttons__btn",{"is-active":Ce==="lowercase"}),onClick:()=>Eo("lowercase"),title:u==="zh"?"全小写":"Lowercase",children:"aa"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:848,columnNumber:19},void 0),l.jsxDEV("button",{className:Y("case-buttons__btn",{"is-active":Ce==="capitalize"}),onClick:()=>Eo("capitalize"),title:u==="zh"?"首字母大写":"Capitalize",children:"Aa"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:855,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:840,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:838,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"行高":"Line"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:867,columnNumber:17},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:V,min:.8,max:3,step:.1,onChange:k=>ht(Number(k.target.value))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:869,columnNumber:19},void 0),l.jsxDEV("span",{className:"inline-control__value",children:V.toFixed(1)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:878,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:868,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:866,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"字距":"Spacing"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:884,columnNumber:17},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:M,min:-2,max:10,step:.5,onChange:k=>jt(Number(k.target.value))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:886,columnNumber:19},void 0),l.jsxDEV("span",{className:"inline-control__value",children:[M,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:895,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:885,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:883,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:645,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:644,columnNumber:11},void 0),l.jsxDEV("div",{className:"text-property-panel__section",children:[l.jsxDEV("div",{className:"text-property-panel__section-title",children:c("propertyPanel.textColor")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:903,columnNumber:13},void 0),l.jsxDEV("div",{className:"text-property-panel__section-content text-color-picker",children:l.jsxDEV(Si,{value:Le,onChange:mi,showAlpha:!0,showEyeDropper:!0,showPresets:!0,showRecentColors:!0,showHexInput:!0},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:907,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:906,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:902,columnNumber:11},void 0),l.jsxDEV("div",{className:"text-property-panel__section",children:l.jsxDEV("div",{className:"text-property-panel__section-content",children:[l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"高亮":"Highlight"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:924,columnNumber:17},void 0),l.jsxDEV("div",{className:"highlight-colors",children:[l.jsxDEV("button",{className:Y("highlight-colors__btn highlight-colors__btn--none",{"is-active":!Fe}),onClick:()=>se(null),title:u==="zh"?"无":"None",children:l.jsxDEV("svg",{width:"12",height:"12",viewBox:"0 0 16 16",children:l.jsxDEV("line",{x1:"2",y1:"2",x2:"14",y2:"14",stroke:"currentColor",strokeWidth:"2"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:932,columnNumber:23},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:931,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:926,columnNumber:19},void 0),["#FFEB3B","#4CAF50","#2196F3","#E91E63","#FF9800","#9C27B0"].map(k=>l.jsxDEV("button",{className:Y("highlight-colors__btn",{"is-active":Fe===k}),style:{backgroundColor:k},onClick:()=>se(k),title:k},k,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:936,columnNumber:21},void 0))]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:925,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:923,columnNumber:15},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"描边":"Stroke"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:949,columnNumber:17},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:it,min:0,max:3,step:.5,onChange:k=>Ui(Number(k.target.value))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:951,columnNumber:19},void 0),l.jsxDEV("span",{className:"inline-control__value",children:[it,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:960,columnNumber:19},void 0),it>0&&l.jsxDEV("input",{type:"color",className:"inline-control__color-input",value:D,onChange:k=>Ui(it,k.target.value)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:962,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:950,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:948,columnNumber:15},void 0),(A||ce)&&l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"线型":"Line Style"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:976,columnNumber:21},void 0),l.jsxDEV("div",{className:"decoration-style-buttons",children:["solid","double","dotted","dashed","wavy"].map(k=>l.jsxDEV("button",{className:Y("decoration-style-buttons__btn",{"is-active":W===k}),onClick:()=>xb(W===k?null:k),title:k,children:l.jsxDEV("span",{className:`decoration-preview decoration-preview--${k}`,children:"Ab"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:985,columnNumber:27},void 0)},k,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:979,columnNumber:25},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:977,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:975,columnNumber:19},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"线色":"Line Color"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:991,columnNumber:21},void 0),l.jsxDEV("div",{className:"highlight-colors",children:[l.jsxDEV("button",{className:Y("highlight-colors__btn highlight-colors__btn--none",{"is-active":!C}),onClick:()=>Kc(null),title:u==="zh"?"默认":"Default",children:l.jsxDEV("svg",{width:"12",height:"12",viewBox:"0 0 16 16",children:l.jsxDEV("line",{x1:"2",y1:"2",x2:"14",y2:"14",stroke:"currentColor",strokeWidth:"2"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:999,columnNumber:27},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:998,columnNumber:25},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:993,columnNumber:23},void 0),["#E91E63","#FF5722","#4CAF50","#2196F3","#9C27B0","#000000"].map(k=>l.jsxDEV("button",{className:Y("highlight-colors__btn",{"is-active":C===k}),style:{backgroundColor:k},onClick:()=>Kc(k),title:k},k,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1003,columnNumber:25},void 0))]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:992,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:990,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:974,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:921,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:920,columnNumber:11},void 0),l.jsxDEV("div",{className:"text-property-panel__section",children:l.jsxDEV("div",{className:"text-property-panel__section-content",children:[l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"阴影":"Shadow"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1023,columnNumber:17},void 0),l.jsxDEV("div",{className:Y("toggle-switch__control toggle-switch__control--inline",{"is-active":L}),onClick:ot},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1024,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1022,columnNumber:15},void 0),L&&l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{className:"effect-presets",children:Object.entries(gu.textShadow).map(([k,de])=>l.jsxDEV("div",{className:Y("effect-presets__item",{"is-active":te===k}),onClick:()=>Gn(k,de),title:k,children:l.jsxDEV("span",{style:{textShadow:Va(de)},children:"Aa"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1043,columnNumber:25},void 0)},k,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1035,columnNumber:23},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1033,columnNumber:19},void 0),l.jsxDEV("div",{className:"effect-config",children:[l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"颜色":"Color"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1052,columnNumber:23},void 0),l.jsxDEV("div",{className:"inline-control__color-group",children:[l.jsxDEV(at,{open:_t,onOpenChange:Vt,placement:"bottom",sideOffset:8,children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("button",{className:"inline-control__color-trigger",style:{backgroundColor:O.color.startsWith("rgba")?`#${((Zc=O.color.match(/\d+/g))==null?void 0:Zc.slice(0,3).map(k=>parseInt(k).toString(16).padStart(2,"0")).join(""))||"000000"}`:O.color},onClick:()=>Vt(!_t)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1061,columnNumber:29},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1060,columnNumber:27},void 0),l.jsxDEV(ct,{children:l.jsxDEV(Ye,{padding:4,className:"color-picker-popover",children:l.jsxDEV(Si,{value:O.color.startsWith("rgba")?`#${((Qc=O.color.match(/\d+/g))==null?void 0:Qc.slice(0,3).map(k=>parseInt(k).toString(16).padStart(2,"0")).join(""))||"000000"}`:O.color,onChange:k=>{const de=parseInt(k.slice(1,3),16),je=parseInt(k.slice(3,5),16),et=parseInt(k.slice(5,7),16),on=O.color.match(/[\d.]+\)$/),Wn=on?parseFloat(on[0]):.5;xe("color",`rgba(${de}, ${je}, ${et}, ${Wn})`)},showAlpha:!1,showEyeDropper:!0,showPresets:!0,showRecentColors:!0,showHexInput:!0},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1073,columnNumber:31},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1072,columnNumber:29},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1071,columnNumber:27},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1054,columnNumber:25},void 0),l.jsxDEV("input",{type:"range",className:"inline-control__slider inline-control__slider--short",value:(()=>{const k=O.color.match(/[\d.]+\)$/);return k?parseFloat(k[0])*100:50})(),min:0,max:100,step:5,title:u==="zh"?"透明度":"Opacity",onChange:k=>{const de=Number(k.target.value)/100,je=O.color.match(/\d+/g);if(je&&je.length>=3){const[et,on,Wn]=je.slice(0,3);xe("color",`rgba(${et}, ${on}, ${Wn}, ${de})`)}}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1094,columnNumber:25},void 0),l.jsxDEV("span",{className:"inline-control__value inline-control__value--narrow",children:[(()=>{const k=O.color.match(/[\d.]+\)$/);return k?Math.round(parseFloat(k[0])*100):50})(),"%"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1114,columnNumber:25},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1053,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1051,columnNumber:21},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"X偏移":"X"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1123,columnNumber:23},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:O.offsetX,min:-20,max:20,step:1,onChange:k=>xe("offsetX",Number(k.target.value))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1125,columnNumber:25},void 0),l.jsxDEV("span",{className:"inline-control__value",children:[O.offsetX,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1134,columnNumber:25},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1124,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1122,columnNumber:21},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"Y偏移":"Y"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1138,columnNumber:23},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:O.offsetY,min:-20,max:20,step:1,onChange:k=>xe("offsetY",Number(k.target.value))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1140,columnNumber:25},void 0),l.jsxDEV("span",{className:"inline-control__value",children:[O.offsetY,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1149,columnNumber:25},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1139,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1137,columnNumber:21},void 0),l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"模糊":"Blur"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1153,columnNumber:23},void 0),l.jsxDEV("div",{className:"inline-control__slider-group",children:[l.jsxDEV("input",{type:"range",className:"inline-control__slider",value:O.blur,min:0,max:30,step:1,onChange:k=>xe("blur",Number(k.target.value))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1155,columnNumber:25},void 0),l.jsxDEV("span",{className:"inline-control__value",children:[O.blur,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1164,columnNumber:25},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1154,columnNumber:23},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1152,columnNumber:21},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1049,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1031,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1020,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1019,columnNumber:11},void 0),l.jsxDEV("div",{className:"text-property-panel__section",children:l.jsxDEV("div",{className:"text-property-panel__section-content",children:[l.jsxDEV("div",{className:"inline-control",children:[l.jsxDEV("label",{className:"inline-control__label",children:u==="zh"?"渐变":"Gradient"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1178,columnNumber:17},void 0),l.jsxDEV("div",{className:Y("toggle-switch__control toggle-switch__control--inline",{"is-active":oe}),onClick:ze},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1179,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1177,columnNumber:15},void 0),oe&&l.jsxDEV("div",{className:"gradient-editor-wrapper",children:l.jsxDEV(Zh,{value:ie,onChange:He,showPresets:!0,showHistory:!1,inline:!0,customPresets:Ue.map(k=>k.css),onSavePreset:Ne,onDeletePreset:k=>{const de=Ue[k];de&&Ve(de.id)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1187,columnNumber:19},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1186,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1175,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:1174,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:642,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:620,columnNumber:7},void 0),m]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/text-property-panel.tsx",lineNumber:610,columnNumber:5},void 0):null};let ci={x:0,y:0},po=new Set,xr=!1;const Jh=e=>{ci={x:e.clientX,y:e.clientY},po.forEach(t=>t(ci))},eg=e=>{ci={x:e.clientX,y:e.clientY},po.forEach(t=>t(ci))},tg=e=>{ci={x:e.clientX,y:e.clientY},po.forEach(t=>t(ci))},xD=()=>{xr||(document.addEventListener("mousemove",Jh,!0),document.addEventListener("mousedown",eg,!0),document.addEventListener("mouseup",tg,!0),xr=!0)},ND=()=>{xr&&po.size===0&&(document.removeEventListener("mousemove",Jh,!0),document.removeEventListener("mousedown",eg,!0),document.removeEventListener("mouseup",tg,!0),xr=!1)},yD=()=>{const[e,t]=p.useState(()=>ci),n=p.useRef();return p.useEffect(()=>(n.current=i=>{t(i)},po.add(n.current),xD(),t(ci),()=>{n.current&&po.delete(n.current),ND()}),[]),e},wD=({visible:e,videoUrl:t,onClose:n,onConfirm:i})=>{const{language:o}=ke(),s=p.useRef(null),r=p.useRef(null),a=p.useRef(null),[c,u]=p.useState(!0),[d,m]=p.useState(0),[f,h]=p.useState(0),[g,b]=p.useState(""),[x,y]=p.useState(!1),[N,w]=p.useState(!1);p.useEffect(()=>(e&&t&&(u(!0),b(""),y(!1),w(!1)),()=>{a.current!==null&&window.clearTimeout(a.current)}),[e,t]);const T=()=>{const _=s.current;_&&(m(_.duration),y(!0))},S=p.useCallback((_,I=!1)=>{const P=s.current;if(!P)return;a.current!==null&&(window.clearTimeout(a.current),a.current=null);const Z=()=>{if(P.readyState<2){console.warn("Video not ready for seeking, readyState:",P.readyState);const pe=()=>{P.currentTime=_,P.removeEventListener("canplay",pe)};P.addEventListener("canplay",pe);return}P.currentTime=_};I?Z():a.current=window.setTimeout(Z,150)},[]);p.useEffect(()=>{const _=s.current;if(x&&_&&d>0){const I=Math.max(0,d-.1);h(I),S(I,!0)}},[x,d,S]);const v=p.useCallback(()=>{const _=s.current,I=r.current;if(!_||!I)return;const P=I.getContext("2d");if(P)try{I.width=_.videoWidth,I.height=_.videoHeight,P.drawImage(_,0,0,I.width,I.height);const Z=I.toDataURL("image/png");b(Z)}catch(Z){console.warn("Failed to generate frame image (likely due to CORS):",Z);try{P.fillStyle="#000",P.fillRect(0,0,I.width,I.height),P.fillStyle="#fff",P.font="16px Arial",P.textAlign="center",P.fillText("视频帧预览不可用",I.width/2,I.height/2);const pe=I.toDataURL("image/png");b(pe)}catch(pe){console.error("Failed to create placeholder image:",pe),b("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==")}}},[]),E=p.useCallback(()=>{N||(v(),u(!1))},[N,v]),U=()=>{w(!0)},q=_=>{if(s.current&&d>0&&x){const P=_/100*d;h(P),S(P,!1)}},$=()=>{w(!1),u(!0),s.current&&x&&S(f,!0)},V=_=>{if(!s.current||d===0||!x)return;const P=parseFloat(_.target.value);if(isNaN(P))return;const Z=Math.max(0,Math.min(d,P));h(Z),S(Z,!0),u(!0)},R=()=>{g&&(i(g,f),n())},M=_=>{const I=Math.floor(_/60),P=(_%60).toFixed(1);return`${I}:${P.padStart(4,"0")}`};return l.jsxDEV(ox,{visible:e,onClose:n,header:o==="zh"?"选择视频帧":"Select Video Frame",width:600,destroyOnClose:!0,footer:!1,children:l.jsxDEV("div",{className:"video-frame-selector",children:[l.jsxDEV("video",{ref:s,src:t,style:{display:"none"},muted:!0,playsInline:!0,preload:"auto",crossOrigin:"anonymous",onLoadedMetadata:T,onSeeked:E},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:223,columnNumber:9},void 0),l.jsxDEV("canvas",{ref:r,style:{display:"none"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:236,columnNumber:9},void 0),l.jsxDEV("div",{className:"frame-preview",children:c?l.jsxDEV("div",{className:"loading-placeholder",children:[l.jsxDEV("div",{className:"loading-spinner"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:245,columnNumber:15},void 0),l.jsxDEV("div",{className:"loading-text",children:o==="zh"?"加载视频中...":"Loading video..."},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:246,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:244,columnNumber:13},void 0):l.jsxDEV("div",{className:"frame-image-container",children:l.jsxDEV("img",{src:g,alt:"Video frame",className:"frame-image"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:252,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:251,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:242,columnNumber:9},void 0),l.jsxDEV("div",{className:"time-controls",children:[l.jsxDEV("div",{className:"time-display",children:[l.jsxDEV("span",{className:"current-time",children:M(f)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:264,columnNumber:13},void 0),l.jsxDEV("span",{className:"separator",children:"/"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:265,columnNumber:13},void 0),l.jsxDEV("span",{className:"total-time",children:M(d)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:266,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:263,columnNumber:11},void 0),l.jsxDEV("div",{className:"progress-container",children:l.jsxDEV("input",{type:"range",min:0,max:100,value:d>0?f/d*100:0,onChange:_=>q(Number(_.target.value)),onMouseDown:U,onMouseUp:$,onTouchStart:U,onTouchEnd:$,className:"progress-slider",disabled:c&&!N},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:271,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:270,columnNumber:11},void 0),l.jsxDEV("div",{className:"time-input-container",children:[l.jsxDEV("label",{className:"time-input-label",children:o==="zh"?"精确时间 (秒):":"Precise time (seconds):"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:288,columnNumber:13},void 0),l.jsxDEV("input",{type:"number",min:0,max:d,step:.1,value:f.toFixed(1),onChange:V,className:"time-input",disabled:c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:291,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:287,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:262,columnNumber:9},void 0),l.jsxDEV("div",{className:"actions",children:[l.jsxDEV("button",{className:"action-button secondary",onClick:n,children:o==="zh"?"取消":"Cancel"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:306,columnNumber:11},void 0),l.jsxDEV("button",{className:"action-button primary",onClick:R,disabled:c||!g,children:o==="zh"?"确认插入":"Confirm Insert"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:312,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:305,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:221,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/video-frame-selector/video-frame-selector.tsx",lineNumber:213,columnNumber:5},void 0)},vD=async(e,t,n,i)=>{if(!e||!t)throw new Error("Board and video element are required");try{const o=Ot(e,[t],!1),s=[o.x,o.y+o.height+20],r=new Image,a=await new Promise(u=>{r.onload=()=>{u({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=()=>{u({width:o.width,height:o.height})},r.src=n}),c={url:n,width:a.width,height:a.height,isVideoFrame:!0,videoTimestamp:i,sourceVideoId:t.id||"unknown"};Cr.insertImage(e,c,s)}catch(o){throw console.error("Failed to insert video frame:",o),new Error(`Video frame insertion failed: ${o instanceof Error?o.message:"Unknown error"}`)}};function ED(){if(typeof VideoDecoder>"u"||typeof VideoEncoder>"u")throw new Error(`当前浏览器不支持 WebCodecs API。
|
|
42
|
-
请使用 Chrome 94+ 或 Edge 94+ 浏览器。`)}function kD(){const e=[{mimeType:"video/mp4;codecs=avc1",extension:"mp4"},{mimeType:"video/webm;codecs=vp9",extension:"webm"},{mimeType:"video/webm;codecs=vp8",extension:"webm"}];for(const t of e)if(MediaRecorder.isTypeSupported(t.mimeType))return t;return console.warn("[WebCodecs] No preferred format supported, using default"),{mimeType:"video/webm",extension:"webm"}}async function SD(e,t,n){const i=document.createElement("canvas"),o=i.getContext("2d",{willReadFrequently:!1});if(!o)throw new Error("无法创建 Canvas 2D 上下文");const s=document.createElement("video");s.crossOrigin="anonymous",s.src=e[0],await new Promise((N,w)=>{s.onloadedmetadata=()=>N(),s.onerror=()=>w(new Error("无法加载第一个视频"))}),i.width=s.videoWidth,i.height=s.videoHeight;const r=kD(),a=new AudioContext,c=a.createMediaStreamDestination(),u=i.captureStream(30),d=new MediaStream([...u.getVideoTracks(),...c.stream.getAudioTracks()]),m=new MediaRecorder(d,{mimeType:r.mimeType,videoBitsPerSecond:8e6,audioBitsPerSecond:128e3}),f=[];m.ondataavailable=N=>{N.data.size>0&&f.push(N.data)},m.start(),t==null||t(0,"encoding","开始录制视频...");const h=(n==null?void 0:n.transitions)||[],g=(n==null?void 0:n.transitionDuration)??.5;for(let N=0;N<e.length;N++){t==null||t(N/e.length*100,"encoding",`正在处理视频 ${N+1}/${e.length}...`);const w=document.createElement("video");w.crossOrigin="anonymous",w.src=e[N],w.volume=1,await new Promise((E,U)=>{w.onloadedmetadata=()=>E(),w.onerror=()=>U(new Error(`无法加载视频 ${N+1}`))});let T=null;try{T=a.createMediaElementSource(w),T.connect(c)}catch(E){console.warn(`[WebCodecs] Failed to connect audio from video ${N+1}:`,E)}const S=N<h.length?h[N]:"cut",v=S==="dissolve"||S==="fade_to_black";await new Promise(E=>{w.play().catch(q=>{console.warn(`[WebCodecs] Failed to play video ${N+1}:`,q)});const U=()=>{if(w.ended){E();return}let q=1;if(v&&w.duration>0){const $=w.duration-w.currentTime;$<g&&(q=Math.max(0,$/g))}S==="fade_to_black"&&q<1&&(o.fillStyle="#000",o.fillRect(0,0,i.width,i.height)),o.globalAlpha=q,o.drawImage(w,0,0,i.width,i.height),o.globalAlpha=1,requestAnimationFrame(U)};w.onended=()=>E(),U()}),T&&T.disconnect(),w.pause(),w.src="",w.load()}t==null||t(100,"finalizing","正在生成最终视频..."),await new Promise(N=>{m.onstop=()=>N(),m.stop()}),await a.close();const b=r.mimeType.split(";")[0],x=new Blob(f,{type:b}),y=e.length*8;try{const{unifiedCacheService:N}=await Me(async()=>{const{unifiedCacheService:v}=await import("./tool-windows-CtLXQDGF.js").then(E=>E.oL);return{unifiedCacheService:v}},__vite__mapDeps([0]),import.meta.url),w=`merged-video-${Date.now()}`,T=`/__aitu_cache__/video/${w}.mp4`,S=T;return await N.cacheMediaFromBlob(S,x,"video",{taskId:w}),{blob:x,url:T,duration:y,taskId:w}}catch(N){console.warn("[WebCodecs] Failed to cache video, using blob URL:",N);const w=URL.createObjectURL(x);return{blob:x,url:w,duration:y}}}class Ki{constructor(){ED()}static getInstance(){return Ki.instance||(Ki.instance=new Ki),Ki.instance}async mergeVideos(t,n,i){if(t.length===0)throw new Error("没有视频可合并");if(t.length===1){n==null||n(0,"downloading","下载视频...");const s=await(await fetch(t[0])).blob();return{blob:s,url:URL.createObjectURL(s),duration:0}}try{n==null||n(0,"downloading",`下载 ${t.length} 个视频...`);const o=[];for(let s=0;s<t.length;s++){n==null||n(s/t.length*100,"downloading",`下载视频 ${s+1}/${t.length}...`);const a=await(await fetch(t[s])).blob();o.push(a)}return await SD(t,n,i)}catch(o){throw console.error("[WebCodecs] Merge failed:",o),new Error(`视频合并失败: ${o instanceof Error?o.message:String(o)}`)}}static isSupported(){return typeof VideoDecoder<"u"&&typeof VideoEncoder<"u"}}const TD=Ki.getInstance();async function DD(e,t,n){return TD.mergeVideos(e,t,n)}const Tm="笔记",_D="新笔记",jD=24;function PD(e){var t;return((t=e.title)==null?void 0:t.trim())||_D}function CD(e){return(e.body||"").trim()}async function AD(){const{knowledgeBaseService:e}=await Me(async()=>{const{knowledgeBaseService:o}=await import("./tool-windows-CtLXQDGF.js").then(s=>s.p4);return{knowledgeBaseService:o}},__vite__mapDeps([0]),import.meta.url);await e.initialize();const n=(await e.getAllDirectories()).find(o=>o.name===Tm);if(n)return{knowledgeBaseService:e,directory:n};const i=await e.createDirectory(Tm);return{knowledgeBaseService:e,directory:i}}function MD(e,t,n){const i=e.children.findIndex(o=>o.id===t);i<0||ue.setNode(e,{noteId:n},[i])}function ID(e){var n,i;if(Ct(e)){const o=(n=e.title)!=null&&n.trim()?`# ${e.title.trim()}`:"",s=((i=e.body)==null?void 0:i.trim())||"";return[o,s].filter(Boolean).join(`
|
|
43
|
-
|
|
44
|
-
`).trim()}const t=[];if("data"in e&&Array.isArray(e.data)){for(const o of e.data)if(ks.isNode(o)){const s=ks.string(o).trim();s&&t.push(s)}}if("text"in e){if(typeof e.text=="string"){const o=e.text.trim();o&&t.push(o)}else if(e.text&&typeof e.text=="object"&&ks.isNode(e.text)){const o=ks.string(e.text).trim();o&&t.push(o)}}if("textContent"in e&&typeof e.textContent=="string"){const o=e.textContent.trim();o&&t.push(o)}return t.join(`
|
|
45
|
-
`).trim()}function VD(e){return H.isDrawElement(e)&&H.isText(e)}function UD(e,t){return[...t].sort((n,i)=>{const o=Ot(e,[n],!1),s=Ot(e,[i],!1);return Math.abs(o.x-s.x)<=jD&&Math.abs(o.y-s.y)>.5?o.y-s.y:o.x-s.x})}async function ng(e,t,n="zh"){if(!t)return null;if(t.noteId)return t.noteId;try{const{knowledgeBaseService:i,directory:o}=await AD(),s=await i.createNote(PD(t),o.id),r=CD(t);return r&&await i.updateNote(s.id,{content:r}),MD(e,t.id,s.id),s.id}catch(i){return console.error("Failed to create note for card:",i),re.error(n==="zh"?"保存到知识库失败":"Failed to save to knowledge base"),null}}async function RD(e,t){const n=[...new Set(e.filter(Boolean))];if(n.length===0)return;const{knowledgeBaseService:i}=await Me(async()=>{const{knowledgeBaseService:s}=await import("./tool-windows-CtLXQDGF.js").then(r=>r.p4);return{knowledgeBaseService:s}},__vite__mapDeps([0]),import.meta.url);await i.initialize();const o=n[0];await i.updateNote(o,{content:t});for(const s of n.slice(1))await i.deleteNote(s);return o}const ig=async(e,t,n="zh")=>{if(t){if(t.noteId){window.dispatchEvent(new CustomEvent("kb:open",{detail:{noteId:t.noteId}}));return}try{const i=await ng(e,t,n);if(!i)return;window.dispatchEvent(new CustomEvent("kb:open",{detail:{noteId:i}}))}catch(i){console.error("Failed to create note for card:",i),re.error(n==="zh"?"无法打开知识库笔记":"Failed to open knowledge base note")}}};function Dm(e){return ax(e).replace(/\u00a0/g," ").replace(/[ \t]+\n/g,`
|
|
46
|
-
`).replace(/\n{3,}/g,`
|
|
47
|
-
|
|
48
|
-
`).trim()}function Yn(e){if(!e)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(i=>Yn(i)).filter(Boolean).join(`
|
|
49
|
-
`);if(typeof e!="object")return"";const t=e,n=[];return typeof t.text=="string"&&n.push(t.text),Array.isArray(t.children)&&n.push(Yn(t.children)),Array.isArray(t.data)&&n.push(Yn(t.data)),n.filter(Boolean).join(`
|
|
50
|
-
`)}function qD(e){if(!e||typeof window>"u")return"";const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return"";const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?t.toString().trim():""}function BD(e,t){if(Ct(t))return[t.title,t.body].filter(Boolean).join(`
|
|
51
|
-
|
|
52
|
-
`);if(nn.isMindElement(e,t))return Yn(t.data);if(H.isDrawElement(t)){const i=t,o=Yn(i.text);if(o)return o;const s=Yn(i.data);if(s)return s;if(typeof i.textContent=="string")return i.textContent}const n=t;return Yn(n.text)||Yn(n.data)}function LD(e,t){if(t.length===0)return{text:"",source:null,title:""};if(t.length===1&&Ct(t[0])){const s=t[0],r=Dm(qD(rx(s.id)));if(r)return{text:r,source:"selection",title:s.title||"卡片朗读",sourceId:`card:${s.id}:selection`,origin:{kind:"card",id:s.id}}}const n=t[0],i=t.length===1&&Ct(n)?n:null,o=Dm(t.map(s=>BD(e,s)).filter(Boolean).join(`
|
|
53
|
-
|
|
54
|
-
`));return{text:o,source:o?"element":null,title:(i==null?void 0:i.title)||(t.length===1?"画布朗读":`已选 ${t.length} 个元素`),sourceId:t.length===1?`${t[0].type}:${t[0].id}`:`selection:${t.map(s=>s.id).sort().join("|")}`,origin:i?{kind:"card",id:i.id}:void 0}}function og(e){return!e.text||!e.sourceId?null:Rp({elementId:e.sourceId,title:e.title,content:e.text,origin:e.origin||{kind:"card",id:e.sourceId}})}function OD(e,t){const n=og(t);if(!n)return[];if(!e.children||!t.origin||t.origin.kind!=="card")return[n];const i=sx(e,e.children.filter(Ct));return i.length<=1?[n]:i.map(o=>{var s;return o.id===((s=t.origin)==null?void 0:s.id)?n:Rp({elementId:`card:${o.id}`,title:o.title||"卡片朗读",content:[o.title,o.body].filter(Boolean).join(`
|
|
55
|
-
|
|
56
|
-
`),origin:{kind:"card",id:o.id}})}).filter(o=>!!o)}const FD=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p3),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.ImageEditor}))),HD=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p6),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.FrameSlideshow}))),zD=()=>{var it,Ke,D,j,W,Q;const e=xt(),n=Be(e).filter(C=>!lx(C)),{openDialog:i}=Wt(),{language:o,t:s}=ke(),[r,a]=p.useState(!1),c=p.useRef(r),[u,d]=p.useState(!1),[m,f]=p.useState(null),[h,g]=p.useState(!1),[b,x]=p.useState(""),[y,N]=p.useState(null),[w,T]=p.useState(!1),S=p.useRef(!1),[v,E]=p.useState(!1),[U,q]=p.useState(),[$,V]=p.useState({text:"",title:"",source:null}),[R,M]=p.useState(),[_,I]=p.useState(),P=p.useRef(null);yD();const Z=cx(),pe=Z.mediaType==="reading"?Z.activeReadingSourceId:void 0,A=!!$.sourceId&&!!pe&&pe.startsWith($.sourceId),G=p.useMemo(()=>n.map(C=>C.id).sort().join("|"),[n]),ce=A?Z.playing?o==="zh"?"暂停朗读":"Pause reading":o==="zh"?"继续朗读":"Resume reading":o==="zh"?"语音朗读":"Read aloud";p.useEffect(()=>{if(n.length===0||r){V(B=>B.text||B.source?{text:"",title:"",source:null}:B);return}const C=()=>{const B=LD(e,n);V(L=>L.text===B.text&&L.source===B.source&&L.title===B.title&&L.sourceId===B.sourceId?L:B)};return C(),document.addEventListener("selectionchange",C),()=>{document.removeEventListener("selectionchange",C)}},[e,G,r]);const X=n.length>0&&!Zo(e),{viewport:ae,selection:le,children:be}=e,{refs:we,floatingStyles:Fe}=Gl({placement:"top",middleware:[Wl(12),qp({padding:16}),$l({fallbackPlacements:["bottom","right","left"]})]});let K={fill:"red"};if(X&&!r){const C=n.some(se=>$D(e,se))&&!F.hasBeenTextEditing(e),B=n.some(se=>KD(e,se)),L=n.length>0&&n.every(se=>H.isDrawElement(se)&&H.isText(se)),z=n.some(se=>cg(e,se))&&!F.hasBeenTextEditing(e),te=n.some(se=>XD(e,se))&&!F.hasBeenTextEditing(e),ee=n.some(se=>wn(se)),O=n.some(se=>Xl(se)),J=n.some(se=>Ct(se)),oe=n.length>1&&n.every(se=>Ct(se)||VD(se)),Ie=n.length>0&&!ee&&!O&&!J&&n.some(se=>H.isDrawElement(se)&&H.isImage(se))&&!F.hasBeenTextEditing(e),ut=n.length===1&&wn(n[0])&&!F.hasBeenTextEditing(e),Re=!ee&&!O&&!J&&!F.hasBeenTextEditing(e),ie=n[0],Ae=H.isDrawElement(ie)&&H.isImage(ie)&&((it=ie.url)==null?void 0:it.startsWith("data:image/svg+xml")),Ue=n.length===1&&!ee&&!O&&H.isDrawElement(n[0])&&H.isImage(n[0])&&!Ae&&!F.hasBeenTextEditing(e),_e=Ue,Le=Ue,It=n.length>0&&!O&&n.some(se=>H.isDrawElement(se)&&H.isImage(se)||wn(se)||Kn(se))&&!F.hasBeenTextEditing(e),_t=n.length>1&&!oe&&!ee&&!O&&n.every(se=>H.isDrawElement(se)&&H.isImage(se)||H.isDrawElement(se)&&zl([se])||H.isDrawElement(se)&&H.isShapeElement(se)&&!H.isImage(se)||H.isDrawElement(se)&&H.isArrowLine(se)||H.isDrawElement(se)&&H.isVectorLine(se)||H.isDrawElement(se)&&H.isTable(se)||$e.isFreehand(se)||Je.isPenPath(se)||nn.isMindElement(e,se))&&!F.hasBeenTextEditing(e),Lt=n.filter(se=>wn(se)).length>1&&!F.hasBeenTextEditing(e),zt=n.filter(se=>Je.isPenPath(se)),mi=zt.length>0&&!F.hasBeenTextEditing(e);let Gn;if(zt.length>0){const se=zt[0].cornerRadius??0;Gn=zt.every(Ui=>(Ui.cornerRadius??0)===se)?se:void 0}const xe=n.filter(se=>$e.isFreehand(se)),He=(zt.length>0||xe.length>0)&&!F.hasBeenTextEditing(e);let Ne;const Ve=[...zt.map(se=>se.strokeWidth??2),...xe.map(se=>se.strokeWidth??2)];if(Ve.length>0){const se=Ve[0];Ne=Ve.every(Ui=>Ui===se)?se:void 0}const ot=n.length>0&&!O&&!F.hasBeenTextEditing(e),ze=n.length>0&&n.every(se=>nn.isMindElement(e,se)),Oe=n.length>1&&!ze&&!F.hasBeenTextEditing(e),st=n.length>1&&!ze&&!F.hasBeenTextEditing(e),ht=n.length>1&&!F.hasBeenTextEditing(e)&&n.every(se=>YD(e,se)),jt=n.length>0&&!F.hasBeenTextEditing(e)&&!!xu(e,n),Ut=n.length===1&&Ct(n[0])&&!!n[0].noteId&&!F.hasBeenTextEditing(e),dt=n.length===1&&Ct(n[0])&&!n[0].noteId&&!F.hasBeenTextEditing(e),dn=oe&&!F.hasBeenTextEditing(e),aa=n.length===1&&wi(n[0])&&!F.hasBeenTextEditing(e),la=n.length===1&&Kn(n[0])&&!F.hasBeenTextEditing(e),ca=typeof window<"u"&&"speechSynthesis"in window&&!F.hasBeenTextEditing(e)&&$.text.length>0;K={...GD(e),hasFill:C,hasFontColor:B,hasFontSize:B,hasStroke:z,hasStrokeStyle:te,hasStrokeWidth:He,strokeWidth:Ne,hasText:B,isTextOnly:L,hasAIImage:Re,hasAIVideo:Ie,hasVideoFrame:ut,hasSplitImage:_e,hasImageEdit:Le,hasDownloadable:It,hasMergeable:_t,hasVideoMergeable:Lt,hasCornerRadius:mi,cornerRadius:Gn,hasSizeInput:ot,hasAlignment:Oe,hasDistribute:st,hasBoolean:ht,hasMindmapToPPT:jt,hasCardEdit:Ut,hasCardSave:dt,hasContentMerge:dn,hasFramePlay:aa,hasAudioPlayer:la,hasTextToSpeech:ca}}const Ce=async(C,B)=>{if(!C)return;const L=C.title?`# ${C.title}
|
|
57
|
-
|
|
58
|
-
`:"",z=C.body||"",te=`${L}${z}`.trim();try{console.info("[CardCopy] Copy text from card",{source:B,id:C.id}),await Vx(te),re.success(o==="zh"?"已复制到剪贴板":"Copied to clipboard",2e3)}catch{re.error(o==="zh"?"复制失败":"Copy failed",2e3)}},We=async()=>{const C=UD(e,n);if(C.length<2)return;const B=C[0],L=C.map((te,ee)=>ee===0&&Ct(B)&&Ct(te)?(te.body||"").trim():ID(te)).filter(Boolean).join(`
|
|
59
|
-
|
|
60
|
-
`).trim();if(!L){re.warning(o==="zh"?"没有可合并的内容":"No content to merge");return}const z=C.flatMap(te=>Ct(te)&&te.noteId?[te.noteId]:[]);try{const te=await RD(z,L),ee=C.slice(1).map(J=>e.children.findIndex(oe=>oe.id===J.id)).filter(J=>J>=0).sort((J,oe)=>oe-J);for(const J of ee)ue.removeNode(e,[J]);let O;if(Ct(B)){const J=e.children.findIndex(Ie=>Ie.id===B.id);if(J<0)throw new Error(o==="zh"?"合并目标不存在":"Merge target missing");const oe={body:L};te&&(oe.noteId=te),ue.setNode(e,oe,[J]),O=e.children[J]}else{const J=Ot(e,[B],!1),oe=e.children.findIndex(ie=>ie.id===B.id);if(oe<0)throw new Error(o==="zh"?"合并目标不存在":"Merge target missing");const Ie=Math.max(J.width,320),ut=Math.max(J.height,180),Re={type:"card",id:`card-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`,body:L,fillColor:"#FA8C16",points:[[J.x,J.y],[J.x+Ie,J.y+ut]],children:[],...te?{noteId:te}:{}};ue.insertNode(e,Re,[oe]),ue.removeNode(e,[oe+1]),O=e.children[oe]}oi(e),O&&Ti(e,O),re.success(o==="zh"?`已合并 ${C.length} 个元素`:`Merged ${C.length} elements`)}catch(te){console.error("[PopupToolbar] Failed to merge content:",te),re.error((te==null?void 0:te.message)||(o==="zh"?"合并内容失败":"Failed to merge content"))}};return p.useEffect(()=>{if(X){const C=n.length>0;if(!r&&C){let B,L;const z=Be(e),te=Ot(e,z,!1),[ee,O]=ge.getPoints(te),J=Ss(e,Ro(e,ee)),oe=Ss(e,Ro(e,O));B=J[0]+(oe[0]-J[0])/2,L=J[1],we.setPositionReference({getBoundingClientRect(){return{width:1,height:1,x:B,y:L,top:L,left:B,right:B+1,bottom:L+1}}})}}},[ae,le,be,r]),p.useEffect(()=>{if(X&&!r&&P.current){const C=P.current.getBoundingClientRect();M({top:C.top,left:C.left,width:C.width,height:C.height});const B=Be(e);if(B.length>0){const L=Ot(e,B,!1),[z,te]=ge.getPoints(L),ee=Ss(e,Ro(e,z)),O=Ss(e,Ro(e,te));I({top:ee[1],left:ee[0],right:O[0],bottom:O[1],width:O[0]-ee[0],height:O[1]-ee[1]})}}},[X,r,Fe,e]),p.useEffect(()=>{S.current=w},[w]),p.useEffect(()=>{if(n.length===0&&!r){const C=setTimeout(()=>{T(!1)},50);return()=>clearTimeout(C)}},[n.length,r]),p.useEffect(()=>{c.current=r},[r]),p.useEffect(()=>{const{pointerUp:C,pointerMove:B}=e;return e.pointerMove=L=>{(es(e)||Qo(e))&&!c.current&&a(!0),B(L)},e.pointerUp=L=>{c.current&&(es(e)||Qo(e))&&a(!1),C(L)},()=>{e.pointerUp=C,e.pointerMove=B}},[e]),l.jsxDEV(l.Fragment,{children:[X&&!r&&l.jsxDEV(Ye,{padding:1,className:Y("popup-toolbar",Mt),ref:C=>{we.setFloating(C),P.current=C},style:Fe,"data-testid":"popup-toolbar",children:l.jsxDEV(ft.Row,{gap:1,children:[K.hasFill&&l.jsxDEV(KT,{board:e,currentColor:K.fill,title:s("toolbar.fillColor"),children:l.jsxDEV("label",{className:Y("fill-label","color-label",{"color-white":K.fill&&Jo(K.fill)&&Mp(ki(K.fill)),"color-mixed":K.fill===void 0,"color-gradient":K.fill&&Un(K.fill)&&K.fill.type==="gradient","color-image":K.fill&&Un(K.fill)&&K.fill.type==="image"}),style:K.fill===void 0?void 0:{background:Jo(K.fill)?K.fill:Un(K.fill)?K.fill.type==="gradient"&&K.fill.gradient?ux(K.fill.gradient):K.fill.type==="solid"&&K.fill.solid?K.fill.solid.color:K.fill.type==="image"&&((Ke=K.fill.image)!=null&&Ke.imageUrl)?`url(${K.fill.image.imageUrl}) center/cover no-repeat`:void 0:void 0}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:782,columnNumber:17},void 0)},3,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:776,columnNumber:15},void 0),K.hasStroke&&l.jsxDEV(UT,{board:e,currentColor:K.strokeColor,title:s("toolbar.stroke"),hasStrokeStyle:K.hasStrokeStyle||!1,hasStrokeWidth:K.hasStrokeWidth||!1,currentStrokeWidth:K.strokeWidth,children:l.jsxDEV("label",{className:Y("stroke-label","color-label",{"color-mixed":K.strokeColor===void 0}),style:{borderColor:K.strokeColor}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:822,columnNumber:17},void 0)},2,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:813,columnNumber:15},void 0),K.hasFontColor&&l.jsxDEV(MT,{board:e,currentColor:(D=K.marks)==null?void 0:D.color,title:s("toolbar.fontColor"),fontColorIcon:l.jsxDEV(dx,{currentColor:(j=K.marks)==null?void 0:j.color},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:837,columnNumber:19},void 0)},0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:831,columnNumber:15},void 0),K.hasFontSize&&l.jsxDEV(VT,{board:e,currentFontSize:K.fontSize,title:s("toolbar.fontSize")},1,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:842,columnNumber:15},void 0),K.hasCornerRadius&&l.jsxDEV(YT,{board:e,currentRadius:K.cornerRadius,title:s("toolbar.cornerRadius"),selectionRect:_},"corner-radius",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:852,columnNumber:15},void 0),K.hasText&&l.jsxDEV(JT,{board:e,title:"Link"},4,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:861,columnNumber:15},void 0),K.isTextOnly&&l.jsxDEV(uD,{board:e,language:o,title:o==="zh"?"提示词":"Prompts"},"prompt",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:868,columnNumber:15},void 0),K.hasTextToSpeech&&l.jsxDEV(ne,{className:"text-to-speech",type:"icon",icon:A&&Z.playing?l.jsxDEV(fx,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:882,columnNumber:21},void 0):l.jsxDEV(hx,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:884,columnNumber:21},void 0),visible:!0,selected:A&&Z.playing,title:ce,"aria-label":ce,"data-track":"toolbar_click_text_to_speech",onPointerUp:()=>{if(!$.text)return;const C=og($);if(!C)return;const B=OD(e,$);if(A){Z.playing?Z.pausePlayback():Z.resumePlayback();return}Nu({source:C,queue:B.length>0?B:[C],queueTab:{queueId:px,queueName:mx}})}},"text-to-speech",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:876,columnNumber:15},void 0),K.hasText&&l.jsxDEV(ne,{className:"property-settings",type:"icon",icon:l.jsxDEV(gx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:924,columnNumber:23},void 0),visible:!0,selected:w,title:s("propertyPanel.title"),"aria-label":s("propertyPanel.title"),"data-track":"toolbar_click_property_settings",onPointerUp:()=>{T(!w)}},"property-settings",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:920,columnNumber:15},void 0),K.hasAlignment&&l.jsxDEV(mD,{board:e,title:s("toolbar.alignment")},"alignment",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:937,columnNumber:15},void 0),K.hasDistribute&&l.jsxDEV(pD,{board:e,title:s("toolbar.distribute")},"distribute",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:945,columnNumber:15},void 0),K.hasBoolean&&l.jsxDEV(fD,{board:e,title:s("toolbar.boolean")},"boolean",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:953,columnNumber:15},void 0),K.hasMindmapToPPT&&l.jsxDEV(ne,{className:"mindmap-to-ppt",type:"icon",icon:l.jsxDEV(bx,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:965,columnNumber:23},void 0),visible:!0,title:o==="zh"?"转换为PPT":"Convert to PPT","aria-label":o==="zh"?"转换为PPT":"Convert to PPT","data-track":"toolbar_click_mindmap_to_ppt",onPointerUp:async()=>{const C=xu(e,n);if(!C)return;const B=re.loading(o==="zh"?"正在转换为PPT...":"Converting to PPT...",0);try{const{generatePPTFromMindmap:L}=await Me(async()=>{const{generatePPTFromMindmap:te}=await import("./tool-windows-CtLXQDGF.js").then(ee=>ee.oN);return{generatePPTFromMindmap:te}},__vite__mapDeps([0]),import.meta.url),z=await L(e,C);re.close(B),z.success?re.success(o==="zh"?`已生成 ${z.pageCount} 页PPT`:`Generated ${z.pageCount} PPT slides`):re.error(z.error||(o==="zh"?"转换失败":"Conversion failed"))}catch(L){re.close(B),re.error(L.message||(o==="zh"?"转换失败":"Conversion failed"))}}},"mindmap-to-ppt",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:961,columnNumber:15},void 0),K.hasCardEdit&&l.jsxDEV(ne,{className:"card-edit",type:"icon",icon:l.jsxDEV(yu,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1007,columnNumber:23},void 0),visible:!0,title:o==="zh"?"在知识库中编辑":"Edit in Knowledge Base","aria-label":o==="zh"?"在知识库中编辑":"Edit in Knowledge Base","data-track":"toolbar_click_card_edit",onPointerUp:async()=>{const C=n[0];C&&await ig(e,C,o)}},"card-edit",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1003,columnNumber:15},void 0),K.hasCardSave&&l.jsxDEV(ne,{className:"card-save",type:"icon",icon:l.jsxDEV(Bp,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1024,columnNumber:23},void 0),visible:!0,title:o==="zh"?"保存到知识库":"Save to Knowledge Base","aria-label":o==="zh"?"保存到知识库":"Save to Knowledge Base","data-track":"toolbar_click_card_save",onPointerUp:async()=>{const C=n[0];if(!C)return;await ng(e,C,o)&&re.success(o==="zh"?"已保存到知识库":"Saved to knowledge base")}},"card-save",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1020,columnNumber:15},void 0),(K.hasCardEdit||K.hasCardSave)&&l.jsxDEV(ne,{className:"card-copy",type:"icon",icon:l.jsxDEV(xx,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1045,columnNumber:23},void 0),visible:!0,title:o==="zh"?"复制文本内容":"Copy text content","aria-label":o==="zh"?"复制文本内容":"Copy text content","data-track":"toolbar_click_card_copy",onPointerDown:({event:C})=>{C.stopPropagation()},onPointerUp:async()=>{await Ce(n[0],"card-copy")}},"card-copy",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1041,columnNumber:15},void 0),K.hasContentMerge&&l.jsxDEV(ne,{className:"content-merge",type:"icon",icon:l.jsxDEV(wu,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1063,columnNumber:23},void 0),visible:!0,title:o==="zh"?"合并内容":"Merge Content","aria-label":o==="zh"?"合并内容":"Merge Content","data-track":"toolbar_click_content_merge",onPointerUp:()=>{We()}},"content-merge",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1059,columnNumber:15},void 0),K.hasAIImage&&l.jsxDEV(ne,{className:"ai-image",type:"icon",icon:l.jsxDEV(qr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1078,columnNumber:23},void 0),visible:!0,title:o==="zh"?"AI图片生成":"AI Image Generation","aria-label":o==="zh"?"AI图片生成":"AI Image Generation","data-track":"toolbar_click_ai_image",onPointerUp:()=>{i(ln.aiImageGeneration)}},5,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1074,columnNumber:15},void 0),K.hasAIVideo&&l.jsxDEV(ne,{className:"ai-video",type:"icon",icon:l.jsxDEV(Br,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1093,columnNumber:23},void 0),visible:!0,title:o==="zh"?"AI视频生成":"AI Video Generation","aria-label":o==="zh"?"AI视频生成":"AI Video Generation","data-track":"toolbar_click_ai_video",onPointerUp:()=>{i(ln.aiVideoGeneration)}},6,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1089,columnNumber:15},void 0),K.hasVideoFrame&&l.jsxDEV(ne,{className:"video-frame",type:"icon",icon:l.jsxDEV(Nx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1108,columnNumber:23},void 0),visible:!0,title:o==="zh"?"视频帧选择":"Video Frame Selection","aria-label":o==="zh"?"视频帧选择":"Video Frame Selection","data-track":"toolbar_click_video_frame",onPointerUp:()=>{const C=n.find(B=>wn(B));C&&(f(C),d(!0))}},7,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1104,columnNumber:15},void 0),K.hasSplitImage&&l.jsxDEV(ne,{className:"split-image",type:"icon",icon:l.jsxDEV(wx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1128,columnNumber:23},void 0),visible:!0,title:o==="zh"?"智能拆图":"Smart Split","aria-label":o==="zh"?"智能拆图":"Smart Split","data-track":"toolbar_click_split_image",onPointerUp:async()=>{const C=n[0];if(H.isImage(C)&&C.url){const B=re.loading(o==="zh"?"正在分析图片...":"Analyzing image...",0);try{const L=Ot(e,[C],!1),z=await yx(e,C.url,{sourceRect:{x:L.x,y:L.y,width:L.width,height:L.height},scrollToResult:!0});re.close(B),z.success?re.success(o==="zh"?`成功拆分为 ${z.count} 张图片`:`Split into ${z.count} images`):re.warning(z.error||(o==="zh"?"拆图失败":"Split failed"))}catch(L){re.close(B),re.error(L.message||(o==="zh"?"拆图失败":"Split failed"))}}}},"split-image",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1124,columnNumber:15},void 0),K.hasImageEdit&&l.jsxDEV(ne,{className:"image-edit",type:"icon",icon:l.jsxDEV(yu,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1173,columnNumber:23},void 0),visible:!0,title:o==="zh"?"编辑图片":"Edit Image","aria-label":o==="zh"?"编辑图片":"Edit Image","data-track":"toolbar_click_image_edit",onPointerUp:()=>{const C=n[0];H.isImage(C)&&C.url&&(x(C.url),N(C),g(!0))}},"image-edit",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1169,columnNumber:15},void 0),K.hasDownloadable&&l.jsxDEV(ne,{className:"download",type:"icon",icon:l.jsxDEV(kx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1193,columnNumber:23},void 0),visible:!0,title:o==="zh"?"下载":"Download","aria-label":o==="zh"?"下载":"Download","data-track":"toolbar_click_download",onPointerUp:async()=>{const C=[];for(const z of n)H.isDrawElement(z)&&H.isImage(z)&&z.url?C.push({url:z.url,type:"image"}):wn(z)&&z.url?C.push({url:z.url,type:"video"}):Kn(z)&&z.audioUrl&&C.push({url:z.audioUrl,type:"audio",filename:vx(z.title,"audio","mp3"),audioMetadata:{title:z.title,prompt:z.prompt,tags:z.tags,coverUrl:z.previewImageUrl,artist:z.modelVersion||"Aitu",album:"Aitu Generated"}});if(C.length===0){re.warning(o==="zh"?"没有可下载的内容":"No downloadable content");return}const B=C.length>1?o==="zh"?"正在打包下载...":"Packaging download...":o==="zh"?"正在下载...":"Downloading...",L=re.loading(B,0);try{const{unifiedCacheService:z}=await Me(async()=>{const{unifiedCacheService:J}=await import("./tool-windows-CtLXQDGF.js").then(oe=>oe.oL);return{unifiedCacheService:J}},__vite__mapDeps([0]),import.meta.url),{downloadFromBlob:te}=await Me(async()=>{const{downloadFromBlob:J}=await import("./tool-windows-CtLXQDGF.js").then(oe=>oe.oK);return{downloadFromBlob:J}},__vite__mapDeps([0]),import.meta.url),ee=[];for(const J of C)if(J.url.startsWith("blob:")){const oe=J.url.indexOf("#"),Ie=oe>0?J.url.substring(oe+1):null;if(Ie&&Ie.startsWith("merged-video-")){const ut=await z.getCachedBlob(Ie);if(ut){const Re=ut.type||"video/webm",ie=Re.startsWith("video/mp4")?"mp4":Re.startsWith("video/webm")?"webm":"bin",Ae=`merged-video-${Date.now()}.${ie}`;te(ut,Ae);continue}else console.warn("[Download] Cache not found for taskId:",Ie)}try{const Re=await(await fetch(J.url)).blob(),ie=Re.type.startsWith("video/mp4")?"mp4":Re.type.startsWith("video/webm")?"webm":Re.type.startsWith("image/")?"png":"bin",Ae=`${J.type}_${Date.now()}.${ie}`;te(Re,Ae)}catch(ut){throw console.error("[Download] Failed to fetch blob URL:",ut),new Error(`Failed to download ${J.type}: Blob URL inaccessible`)}}else ee.push(J);let O;ee.length>0&&(O=await Ex(ee)),re.close(L),O!=null&&O.openedCount&&O.downloadedCount===0?re.success(o==="zh"?O.openedCount>1?`已打开 ${O.openedCount} 个链接,请在新标签页下载`:"资源不支持直接下载,已打开链接":O.openedCount>1?`Opened ${O.openedCount} links for download`:"Opened link for download"):re.success(C.length>1?o==="zh"?`已下载 ${C.length} 个文件`:`Downloaded ${C.length} files`:o==="zh"?"下载成功":"Download complete")}catch(z){re.close(L),re.error(z.message||(o==="zh"?"下载失败":"Download failed"))}}},"download",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1189,columnNumber:15},void 0),K.hasMergeable&&l.jsxDEV(ne,{className:"merge",type:"icon",icon:l.jsxDEV(wu,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1324,columnNumber:23},void 0),visible:!0,title:o==="zh"?"合并为图片":"Merge to Image","aria-label":o==="zh"?"合并为图片":"Merge to Image","data-track":"toolbar_click_merge",onPointerUp:async()=>{const C=Sx("图片合并"),B=re.loading(o==="zh"?"正在合并...":"Merging...",0);try{const L=n.filter(ot=>{const ze=ot.url||ot.imageUrl;if(!ze||ze.startsWith("/")||ze.startsWith("data:")||ze.startsWith("blob:"))return!1;try{return new URL(ze).origin!==location.origin}catch{return!1}});if(L.length>0){const ot=L.map(async st=>{const ht=st.url||st.imageUrl;try{const jt=new AbortController,Ut=setTimeout(()=>jt.abort(),3e3),dt=await fetch(ht,{method:"HEAD",mode:"cors",signal:jt.signal});return clearTimeout(Ut),dt.ok}catch{return!1}});if((await Promise.all(ot)).some(st=>!st)){re.close(B),re.warning(o==="zh"?"部分外部图片无法访问,请先下载到本地后再合并":"Some external images are inaccessible. Please download them locally first."),C();return}}const z=Ot(e,n,!1),te=[...n].sort((ot,ze)=>{const Oe=e.children.findIndex(ht=>ht.id===ot.id),st=e.children.findIndex(ht=>ht.id===ze.id);return Oe-st}),ee=await Tx(e,{elements:te,fillStyle:"transparent",inlineStyleClassNames:".extend,.emojis,.text",ratio:2});if(!ee)throw new Error(o==="zh"?"合并失败:无法生成图片":"Merge failed: Unable to generate image");const O=new Image;await new Promise((ot,ze)=>{O.onload=()=>ot(),O.onerror=()=>ze(new Error("Failed to load merged image")),O.src=ee});const J=document.createElement("canvas");J.width=O.width,J.height=O.height;const oe=J.getContext("2d");if(!oe)throw new Error("Failed to get canvas context");oe.drawImage(O,0,0);const Ie=Dx(J),{canvas:ut,left:Re,top:ie,trimmedWidth:Ae,trimmedHeight:Ue}=Ie,_e=await new Promise((ot,ze)=>{ut.toBlob(Oe=>{Oe?ot(Oe):ze(new Error("Failed to convert canvas to blob"))},"image/png")}),{unifiedCacheService:Le}=await Me(async()=>{const{unifiedCacheService:ot}=await import("./tool-windows-CtLXQDGF.js").then(ze=>ze.oL);return{unifiedCacheService:ot}},__vite__mapDeps([0]),import.meta.url),It=`merged-image-${Date.now()}`,_t=`/__aitu_cache__/image/${It}.png`,Vt=_t;await Le.cacheMediaFromBlob(Vt,_e,"image",{taskId:It});const Lt=2,zt=z.x+Re/Lt,mi=z.y+ie/Lt,Gn=Ae/Lt,xe=Ue/Lt;Wa(e);const He=e.children.length,Ne={url:_t,width:Gn,height:xe};Cr.insertImage(e,Ne,[zt,mi]);const Ve=e.children[He];Ve&&(oi(e),Ti(e,Ve)),re.close(B),C(),re.success(o==="zh"?`已将 ${n.length} 个元素合并为图片`:`Merged ${n.length} elements into image`)}catch(L){re.close(B),C(),re.error(L.message||(o==="zh"?"合并失败":"Merge failed"))}}},"merge",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1320,columnNumber:15},void 0),K.hasVideoMergeable&&l.jsxDEV(ne,{className:"video-merge",type:"icon",icon:l.jsxDEV(_x,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1497,columnNumber:23},void 0),visible:!0,title:o==="zh"?"合成视频":"Merge Videos","aria-label":o==="zh"?"合成视频":"Merge Videos","data-track":"toolbar_click_video_merge",onPointerUp:async()=>{const C=[];for(const L of n)wn(L)&&L.url&&C.push(L.url);if(C.length<2){re.warning(o==="zh"?"请选择至少2个视频":"Please select at least 2 videos");return}const B=re.loading(o==="zh"?"正在合成视频...":"Merging videos...",0);try{const L=await DD(C,(z,te)=>{const ee={downloading:o==="zh"?"下载视频...":"Downloading videos...",decoding:o==="zh"?"解码视频...":"Decoding videos...",encoding:o==="zh"?"编码视频...":"Encoding videos...",finalizing:o==="zh"?"生成文件中...":"Finalizing..."}});re.close(B);try{const{quickInsert:z}=await Me(async()=>{const{quickInsert:te}=await import("./canvas-insertion-Dq3gR9Nw.js");return{quickInsert:te}},__vite__mapDeps([0]),import.meta.url);await z("video",L.url),re.success(o==="zh"?`已合成并插入 ${C.length} 个视频`:`Merged and inserted ${C.length} videos`)}catch(z){console.error("[VideoMerge] Failed to insert video:",z);const te=L.blob.type||"video/webm",ee=te.startsWith("video/mp4")?"mp4":"webm",O=new Blob([L.blob],{type:te}),J=URL.createObjectURL(O),oe=document.createElement("a");oe.href=J,oe.download=`merged-video-${Date.now()}.${ee}`,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),setTimeout(()=>URL.revokeObjectURL(J),1e3),re.warning(o==="zh"?`视频已合成,但插入失败,已自动下载 (${ee.toUpperCase()})`:`Video merged but failed to insert, downloaded as ${ee.toUpperCase()}`)}}catch(L){re.close(B),re.error(L.message||(o==="zh"?"视频合成失败":"Video merge failed"))}}},"video-merge",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1493,columnNumber:15},void 0),l.jsxDEV(dD,{board:e,title:s("textEffect.layer")},"layer-control",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1597,columnNumber:13},void 0),K.hasSizeInput&&l.jsxDEV(QT,{board:e},"size-input",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1603,columnNumber:15},void 0),K.hasFramePlay&&l.jsxDEV(ne,{className:"frame-play",type:"icon",icon:l.jsxDEV(vu,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1614,columnNumber:23},void 0),visible:!0,title:o==="zh"?"播放幻灯片":"Play Slideshow","aria-label":o==="zh"?"播放幻灯片":"Play Slideshow","data-track":"toolbar_click_frame_play",onPointerUp:()=>{const C=n.find(B=>wi(B));C&&(q(C.id),E(!0))}},"frame-play",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1610,columnNumber:15},void 0),K.hasAudioPlayer&&l.jsxDEV(ne,{className:"audio-player-play",type:"icon",icon:l.jsxDEV(vu,{size:15},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1633,columnNumber:23},void 0),visible:!0,title:o==="zh"?"在音乐播放器中播放":"Play in Music Player","aria-label":o==="zh"?"在音乐播放器中播放":"Play in Music Player","data-track":"toolbar_click_audio_player_play",onPointerUp:()=>{const C=n.find(B=>Kn(B));!C||!Kn(C)||Nu({source:{elementId:C.id,audioUrl:C.audioUrl,title:C.title,duration:C.duration,previewImageUrl:C.previewImageUrl,providerTaskId:C.providerTaskId,clipId:C.clipId,clipIds:C.clipIds},queue:Ya(e.children),queueTab:{queueId:Op,queueName:Lp}})}},"audio-player-play",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1629,columnNumber:15},void 0),l.jsxDEV(ne,{className:"duplicate",type:"icon",icon:l.jsxDEV(Ax,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1668,columnNumber:21},void 0),visible:!0,title:s("general.duplicate"),"aria-label":s("general.duplicate"),"data-track":"toolbar_click_duplicate",onPointerUp:()=>{if(n.length===1&&wi(n[0])){const B=jx(e,n[0],o);B&&Px(e,B)}else Cx(e)}},8,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1664,columnNumber:13},void 0),l.jsxDEV(ne,{className:"trash",type:"icon",icon:l.jsxDEV(rr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1697,columnNumber:21},void 0),visible:!0,title:s("general.delete"),"aria-label":s("general.delete"),"data-track":"toolbar_click_delete",onPointerUp:()=>{Wa(e)}},9,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1693,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:773,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:763,columnNumber:9},void 0),u&&m&&l.jsxDEV(wD,{visible:u,videoUrl:m.url||"",onClose:()=>{d(!1),f(null)},onConfirm:async(C,B)=>{try{m&&await vD(e,m,C,B)}catch(L){console.error("Failed to insert video frame:",L)}}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1712,columnNumber:9},void 0),h&&b&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(FD,{visible:h,imageUrl:b,showOverwrite:!!y,onClose:()=>{g(!1),x(""),N(null)},onOverwrite:async C=>{if(y)try{const{unifiedCacheService:B}=await Me(async()=>{const{unifiedCacheService:oe}=await import("./tool-windows-CtLXQDGF.js").then(Ie=>Ie.oL);return{unifiedCacheService:oe}},__vite__mapDeps([0]),import.meta.url),L=`edited-image-${Date.now()}`,z=`/__aitu_cache__/image/${L}.png`,ee=await(await fetch(C)).blob();await B.cacheMediaFromBlob(z,ee,"image",{taskId:L});const O=new Image;await new Promise((oe,Ie)=>{O.onload=()=>oe(),O.onerror=()=>Ie(new Error("Failed to load edited image")),O.src=C});const J=e.children.findIndex(oe=>oe.id===y.id);if(J>=0){const oe=e.children[J],{newPoints:Ie}=await Fp({url:oe.url,width:oe.width,height:oe.height,points:oe.points||[[0,0],[0,0]]},O.naturalWidth,O.naturalHeight);ue.setNode(e,{url:z,width:O.naturalWidth,height:O.naturalHeight,points:Ie},[J])}}catch(B){console.error("Failed to update image:",B),re.error(o==="zh"?"更新失败":"Update failed")}},onInsert:async C=>{try{const{unifiedCacheService:B}=await Me(async()=>{const{unifiedCacheService:ie}=await import("./tool-windows-CtLXQDGF.js").then(Ae=>Ae.oL);return{unifiedCacheService:ie}},__vite__mapDeps([0]),import.meta.url),L=`edited-image-${Date.now()}`,z=`/__aitu_cache__/image/${L}.png`,ee=await(await fetch(C)).blob();await B.cacheMediaFromBlob(z,ee,"image",{taskId:L});const O=new Image;await new Promise((ie,Ae)=>{O.onload=()=>ie(),O.onerror=()=>Ae(new Error("Failed to load edited image")),O.src=C});const J=Pr(e),oe=y?y.points[1][0]-y.points[0][0]+20:0,Ie=y?y.points[0][0]:J?J[0]+100:100,ut=y?y.points[0][1]:J?J[1]+100:100,Re=[Ie+oe,ut];await Kl(e,z,Re,!1,{width:O.naturalWidth,height:O.naturalHeight},!1,!0)}catch(B){console.error("Failed to insert image:",B),re.error(o==="zh"?"插入失败":"Insert failed")}}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1735,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1734,columnNumber:9},void 0),K.hasText&&l.jsxDEV(bD,{board:e,isOpen:w,onClose:()=>T(!1),currentFontSize:K.fontSize,currentFontFamily:(W=K.marks)==null?void 0:W["font-family"],currentColor:(Q=K.marks)==null?void 0:Q.color,toolbarRect:R,selectionRect:_},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1845,columnNumber:9},void 0),v&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(HD,{visible:v,board:e,onClose:()=>{E(!1),q(void 0)},initialFrameId:U},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1860,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:1859,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/popup-toolbar/popup-toolbar.tsx",lineNumber:761,columnNumber:5},void 0)},sg=(e,t)=>{const n=zp(t);return{fill:Lr(t),strokeColor:Ux(e,t),fontSize:n["font-size"],marks:n}},rg=(e,t)=>{const n=zp(t);return{fill:Lr(t),strokeColor:Rx(e,t),fontSize:n["font-size"],marks:n}},GD=e=>{const t=Be(e);if(t.length===0)return{fill:void 0,strokeColor:void 0};if(t.length===1){const n=t[0];return Ct(n)?{fill:n.fillColor,strokeColor:void 0}:nn.isMindElement(e,n)?sg(e,n):$e.isFreehand(n)?ag(e,n):Je.isPenPath(n)?lg(e,n):rg(e,n)}return WD(e,t)},WD=(e,t)=>{const n=t.map(a=>Ct(a)?{fill:a.fillColor,strokeColor:void 0}:nn.isMindElement(e,a)?sg(e,a):$e.isFreehand(a)?ag(e,a):Je.isPenPath(a)?lg(e,a):H.isDrawElement(a)?rg(e,a):{fill:void 0,strokeColor:void 0}),i=n.map(a=>a.fill),o=n.map(a=>a.strokeColor),s=i.every(a=>a===i[0]),r=o.every(a=>a===o[0]);return{fill:s?i[0]:void 0,strokeColor:r?o[0]:void 0}},ag=(e,t)=>({fill:Lr(t),strokeColor:Gp(e,t)}),lg=(e,t)=>({fill:Lr(t),strokeColor:t.strokeColor,cornerRadius:t.cornerRadius}),$D=(e,t)=>Ct(t)||nn.isMindElement(e,t)||Mx(e,t)?!0:$e.isFreehand(t)?Ix(t.points):Je.isPenPath(t)?t.closed:H.isDrawElement(t)?H.isShapeElement(t)&&!H.isImage(t)&&!H.isText(t)&&Hp(t):!1,cg=(e,t)=>nn.isMindElement(e,t)||$e.isFreehand(t)||Je.isPenPath(t)?!0:H.isDrawElement(t)?H.isShapeElement(t)&&!H.isImage(t)&&!H.isText(t)||H.isArrowLine(t)||H.isVectorLine(t)||H.isTable(t):!1,XD=(e,t)=>cg(e,t),KD=(e,t)=>nn.isMindElement(e,t)?!0:H.isDrawElement(t)?zl([t]):!1,YD=(e,t)=>{if(Je.isPenPath(t))return t.closed;if($e.isFreehand(t)){const n=t.points;if(!n||n.length<3)return!1;const i=n[0],o=n[n.length-1];return Math.hypot(o[0]-i[0],o[1]-i[1])<=10}return H.isDrawElement(t)?H.isImage(t)||H.isText(t)||H.isArrowLine(t)||H.isVectorLine(t)?!1:H.isShapeElement(t)&&Hp(t):(nn.isMindElement(e,t),!1)},sa=_n.createContext({}),_m=(e="",t=!1)=>`menu-item menu-item-base ${e} ${t?"menu-item--active":""}`.trim(),ZD=(e,t)=>{const n=p.useContext(sa);return qx(e,i=>{var s;const o=new CustomEvent(Yl.MENU_ITEM_SELECT,{bubbles:!0,cancelable:!0});t==null||t(o),o.defaultPrevented||(s=n.onSelect)==null||s.call(n,o)})},QD=({icon:e,shortcut:t,children:n})=>l.jsxDEV(l.Fragment,{children:[e&&l.jsxDEV("div",{className:"menu-item__icon",children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item-content.tsx",lineNumber:14,columnNumber:16},void 0),l.jsxDEV("div",{className:"menu-item__text",children:n},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item-content.tsx",lineNumber:15,columnNumber:7},void 0),t&&l.jsxDEV("div",{className:"menu-item__shortcut",children:t},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item-content.tsx",lineNumber:17,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item-content.tsx",lineNumber:13,columnNumber:5},void 0),qe=({icon:e,onSelect:t,children:n,shortcut:i,className:o,selected:s,submenu:r,...a})=>{const[c,u]=p.useState(!1),d=p.useRef(),m=ZD(a.onClick,t),f=l.jsxDEV(QD,{icon:e,shortcut:i,children:n},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:32,columnNumber:5},void 0),h=()=>{d.current&&window.clearTimeout(d.current),u(!0)},g=()=>{d.current=window.setTimeout(()=>{u(!1)},100)};return r?l.jsxDEV(at,{open:c,onOpenChange:u,placement:"right-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("button",{...a,type:"button",className:_m(o,s||c),title:a.title??a["aria-label"],onClick:m,onMouseEnter:h,onMouseLeave:g,role:"menuitem","aria-haspopup":"true","aria-expanded":c,children:f},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:58,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:57,columnNumber:9},void 0),l.jsxDEV(ct,{onMouseEnter:h,onMouseLeave:g,children:r},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:73,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:52,columnNumber:7},void 0):l.jsxDEV("button",{...a,onClick:m,type:"button",className:_m(o,s),title:a.title??a["aria-label"],role:"menuitem",children:f},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:81,columnNumber:5},void 0)};qe.displayName="MenuItem";const ug=({children:e})=>l.jsxDEV("div",{style:{display:"inline-flex",marginLeft:"auto",padding:"2px 4px",background:"var(--color-promo)",color:"var(--color-surface-lowest)",borderRadius:6,fontSize:9,fontFamily:"Cascadia, monospace"},children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-item.tsx",lineNumber:101,columnNumber:5},void 0);ug.displayName="MenuItemBadge";qe.Badge=ug;const Tn=({children:e,className:t="",onSelect:n,style:i,onClose:o})=>{const s=Y(`menu ${t}`).trim(),r=p.useRef(null),a=p.useCallback(()=>r.current?Array.from(r.current.querySelectorAll("button.menu-item:not([disabled])")):[],[]),c=p.useCallback(u=>{var f,h,g,b;const d=a();if(d.length===0)return;const m=d.findIndex(x=>x===document.activeElement);switch(u.key){case"ArrowDown":{u.preventDefault();const x=m<d.length-1?m+1:0;(f=d[x])==null||f.focus();break}case"ArrowUp":{u.preventDefault();const x=m>0?m-1:d.length-1;(h=d[x])==null||h.focus();break}case"Home":{u.preventDefault(),(g=d[0])==null||g.focus();break}case"End":{u.preventDefault(),(b=d[d.length-1])==null||b.focus();break}case"Escape":{u.preventDefault(),o==null||o();break}case"Enter":case" ":{m>=0&&d[m]&&(u.preventDefault(),d[m].click());break}}},[a,o]);return p.useEffect(()=>{const u=a();u.length>0&&requestAnimationFrame(()=>{var d;(d=u[0])==null||d.focus()})},[a]),l.jsxDEV(sa.Provider,{value:{onSelect:n},children:l.jsxDEV("div",{className:s,style:i,"data-testid":"menu",onKeyDown:c,ref:r,role:"menu",children:l.jsxDEV(Ye,{className:"menu-container",padding:2,children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu.tsx",lineNumber:113,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu.tsx",lineNumber:104,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu.tsx",lineNumber:103,columnNumber:5},void 0)};Tn.displayName="Menu";const dg=()=>{const e=xt(),{t}=ke();return l.jsxDEV(qe,{"data-testid":"save-button","data-track":"toolbar_click_menu_save",onSelect:()=>{Wp(e)},icon:l.jsxDEV(Bp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:48,columnNumber:13},void 0),"aria-label":t("menu.saveFile"),shortcut:"Cmd+S",children:t("menu.saveFile")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:42,columnNumber:5},void 0)};dg.displayName="SaveToFile";const mg=()=>{const e=xt(),t=Fh(),{t:n}=ke(),i=(o,s,r)=>{e.children=o,e.viewport=s||{zoom:1},e.theme={themeColorMode:hi.default},t.update(e.children,{board:e,parent:e,parentG:F.getElementHost(e)}),fe.fitViewport(e)};return l.jsxDEV(qe,{"data-testid":"open-button","data-track":"toolbar_click_menu_open",onSelect:()=>{Lx(e).then(o=>{o&&i(o.elements,o.viewport)})},icon:l.jsxDEV(Bx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:87,columnNumber:13},void 0),"aria-label":n("menu.open"),children:n("menu.open")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:76,columnNumber:5},void 0)};mg.displayName="OpenFile";const pg=()=>{const e=xt(),t=p.useContext(sa),{t:n}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(Ox,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:100,columnNumber:13},void 0),"data-testid":"image-export-button","data-track":"toolbar_click_menu_export",onSelect:()=>{zs(e,!0)},submenu:l.jsxDEV(Tn,{onSelect:()=>{var o;const i=new CustomEvent(Yl.MENU_ITEM_SELECT,{bubbles:!0,cancelable:!0});(o=t.onSelect)==null||o.call(t,i)},children:[l.jsxDEV(qe,{"data-track":"toolbar_click_menu_export_png",onSelect:()=>{zs(e,!0)},"aria-label":n("menu.exportImage.png"),children:n("menu.exportImage.png")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:114,columnNumber:11},void 0),l.jsxDEV(qe,{"data-track":"toolbar_click_menu_export_jpg",onSelect:()=>{zs(e,!1)},"aria-label":n("menu.exportImage.jpg"),children:n("menu.exportImage.jpg")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:123,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:107,columnNumber:9},void 0),shortcut:"Cmd+Shift+E","aria-label":n("menu.exportImage"),children:n("menu.exportImage")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:99,columnNumber:5},void 0)};pg.displayName="SaveAsImage";const fg=()=>{const{appState:e,setAppState:t}=Wt(),{t:n}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(rr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:148,columnNumber:13},void 0),"data-testid":"reset-button","data-track":"toolbar_click_menu_clean",onSelect:()=>{t({...e,openCleanConfirm:!0})},shortcut:"Cmd+Backspace","aria-label":n("menu.cleanBoard"),children:n("menu.cleanBoard")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:147,columnNumber:5},void 0)};fg.displayName="CleanBoard";const hg=({onOpenBackupRestore:e})=>{const{t}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(Hx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:174,columnNumber:13},void 0),"data-track":"toolbar_click_menu_backup",onSelect:e,"aria-label":t("menu.backupRestore"),children:t("menu.backupRestore")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:173,columnNumber:5},void 0)};hg.displayName="BackupRestore";const gg=({onOpenCloudSync:e})=>{const{t}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(Gx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:193,columnNumber:13},void 0),"data-track":"toolbar_click_menu_cloud_sync",onSelect:e,"aria-label":t("menu.cloudSync"),children:t("menu.cloudSync")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:192,columnNumber:5},void 0)};gg.displayName="CloudSync";const bg=()=>{const{t:e}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(zx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:208,columnNumber:13},void 0),"data-track":"toolbar_click_menu_debug",onSelect:()=>{window.location.href="./sw-debug.html"},"aria-label":e("menu.debugPanel"),children:e("menu.debugPanel")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:207,columnNumber:5},void 0)};bg.displayName="DebugPanel";const xg=()=>{const{appState:e,setAppState:t}=Wt(),{t:n}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(Wx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:226,columnNumber:13},void 0),"data-track":"toolbar_click_menu_settings",onSelect:()=>{t({...e,openSettings:!0})},"aria-label":n("menu.settings"),children:n("menu.settings")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:225,columnNumber:5},void 0)};xg.displayName="Settings";const Ng=()=>{const{appState:e,setAppState:t}=Wt(),{t:n}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV($x,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:264,columnNumber:13},void 0),"data-track":"toolbar_click_menu_commands",onSelect:()=>{t({...e,openCommandPalette:!0})},shortcut:"Cmd+K","aria-label":n("menu.commandPalette"),children:n("menu.commandPalette")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:263,columnNumber:5},void 0)};Ng.displayName="QuickCommands";const yg=()=>{const{t:e}=ke();return l.jsxDEV(qe,{icon:l.jsxDEV(Xx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:285,columnNumber:13},void 0),"data-track":"toolbar_click_menu_manual",onSelect:()=>{window.open("./user-manual/index.html","_blank")},"aria-label":e("menu.userManual"),children:e("menu.userManual")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:284,columnNumber:5},void 0)};yg.displayName="UserManual";const wg=()=>{var n;const{t:e}=ke(),t=((n=document.querySelector('meta[name="app-version"]'))==null?void 0:n.getAttribute("content"))||"0.0.0";return l.jsxDEV(qe,{"data-track":"toolbar_click_menu_version",onSelect:()=>{},"aria-label":e("menu.version"),children:l.jsxDEV("span",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[l.jsxDEV("span",{style:{color:"#666"},children:[e("menu.version"),":",t]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:310,columnNumber:9},void 0),l.jsxDEV("span",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[l.jsxDEV("span",{style:{color:"#1890ff",cursor:"pointer"},"data-track":"toolbar_click_menu_changelog",onClick:i=>{i.stopPropagation(),window.open("./versions.html","_blank")},children:e("menu.changelog")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:312,columnNumber:11},void 0),l.jsxDEV("span",{style:{color:"#1890ff",cursor:"pointer"},"data-track":"toolbar_click_menu_more_versions",onClick:i=>{i.stopPropagation(),window.open("https://release.opentu.ai/","_blank")},children:e("menu.more")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:322,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:311,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:309,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:304,columnNumber:5},void 0)};wg.displayName="VersionInfo";async function JD(e){if(!e||typeof e!="string")return!1;if(e.startsWith("blob:")||e.startsWith("data:"))return!0;try{return(await fetch(e,{method:"HEAD",mode:"cors",cache:"no-cache"})).ok}catch{try{const t=await fetch(e,{method:"GET",mode:"no-cors",cache:"no-cache"});return t.type==="opaque"||t.ok}catch{return!1}}}const vg=()=>{const e=xt(),{t}=ke(),[n,i]=p.useState(!1),o=p.useCallback(async()=>{if(n)return;i(!0);const s=re.loading(t("menu.cleanInvalidLinks.scanning"),0);try{const r=[];for(let u=0;u<e.children.length;u++){const d=e.children[u],m=d.url;if(!m||typeof m!="string")continue;const f=H.isDrawElement(d)&&H.isImage(d),h=wn(d);(f||h)&&r.push({element:d,index:u,url:m})}const a=[];if(await Promise.all(r.map(async({element:u,index:d,url:m})=>{await JD(m)||a.push({element:u,index:d})})),s.then(u=>{var d;return(d=u==null?void 0:u.close)==null?void 0:d.call(u)}),a.length===0){re.success(t("menu.cleanInvalidLinks.noInvalid")),i(!1);return}a.sort((u,d)=>d.index-u.index);for(const{index:u}of a)ue.removeNode(e,[u]);const c=t("menu.cleanInvalidLinks.success").replace("{count}",String(a.length));re.success(c)}catch(r){s.then(a=>{var c;return(c=a==null?void 0:a.close)==null?void 0:c.call(a)}),re.error(t("menu.cleanInvalidLinks.error")),console.error("[CleanInvalidLinks] Error:",r)}finally{i(!1)}},[e,t,n]);return l.jsxDEV(qe,{icon:l.jsxDEV(Fx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:461,columnNumber:13},void 0),"data-track":"toolbar_click_menu_clean_invalid_links",onSelect:o,"aria-label":t("menu.cleanInvalidLinks"),disabled:n,children:t("menu.cleanInvalidLinks")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-menu-items.tsx",lineNumber:460,columnNumber:5},void 0)};vg.displayName="CleanInvalidLinks";const Eg=()=>{const{language:e,setLanguage:t,t:n}=ke(),i=p.useContext(sa);return l.jsxDEV(qe,{icon:l.jsxDEV($p,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/language-switcher-menu.tsx",lineNumber:15,columnNumber:13},void 0),"data-testid":"language-switcher-button",onSelect:()=>{},submenu:l.jsxDEV(Tn,{onSelect:()=>{var s;const o=new CustomEvent(Yl.MENU_ITEM_SELECT,{bubbles:!0,cancelable:!0});(s=i.onSelect)==null||s.call(i,o)},children:[l.jsxDEV(qe,{onSelect:()=>{t("zh")},"aria-label":n("language.chinese"),selected:e==="zh",children:n("language.chinese")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/language-switcher-menu.tsx",lineNumber:28,columnNumber:11},void 0),l.jsxDEV(qe,{onSelect:()=>{t("en")},"aria-label":n("language.english"),selected:e==="en",children:n("language.english")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/language-switcher-menu.tsx",lineNumber:37,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/language-switcher-menu.tsx",lineNumber:21,columnNumber:9},void 0),"aria-label":n("language.switcher"),children:n("language.switcher")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/language-switcher-menu.tsx",lineNumber:14,columnNumber:5},void 0)};Eg.displayName="LanguageSwitcherMenu";const ds=()=>l.jsxDEV("div",{style:{height:"1px",backgroundColor:"var(--color-gray-10)",margin:".5rem 0"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/menu/menu-separator.tsx",lineNumber:2,columnNumber:3},void 0);ds.displayName="MenuSeparator";const Dl=({children:e,buttonId:t,isVisible:n,visibleIndex:i=-1,disabled:o=!1})=>{const{t:s}=ke(),{hideButton:r,showButton:a,resetToDefault:c,visibleButtons:u,reorderButton:d}=Or(),[m,f]=p.useState(!1),[h,g]=p.useState({x:0,y:0}),b=p.useRef(null),x=p.useRef(null);p.useEffect(()=>{const V=x.current;if(!V)return;const R=M=>{M.button===2&&M.stopPropagation()};return V.addEventListener("pointerdown",R,!0),()=>{V.removeEventListener("pointerdown",R,!0)}},[]);const y=p.useCallback(V=>{o||(V.preventDefault(),V.stopPropagation(),g({x:V.clientX,y:V.clientY}),f(!0))},[o]),N=p.useCallback(()=>{f(!1)},[]),w=p.useCallback(()=>{n?r(t):a(t),N()},[n,t,r,a,N]),T=p.useCallback(()=>{i>0&&d(i,i-1,!0),N()},[i,d,N]),S=p.useCallback(()=>{i>=0&&i<u.length-1&&d(i,i+1,!0),N()},[i,u.length,d,N]),v=p.useCallback(()=>{i>0&&d(i,0,!0),N()},[i,d,N]),E=p.useCallback(()=>{i>=0&&i<u.length-1&&d(i,u.length-1,!0),N()},[i,u.length,d,N]),U=p.useCallback(()=>{c(),N()},[c,N]);p.useEffect(()=>{if(!m)return;const V=M=>{b.current&&!b.current.contains(M.target)&&N()},R=M=>{M.key==="Escape"&&N()};return document.addEventListener("mousedown",V),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",R)}},[m,N]),p.useEffect(()=>{if(!m||!b.current)return;const R=b.current.getBoundingClientRect(),M=window.innerWidth,_=window.innerHeight;let I=h.x,P=h.y;h.x+R.width>M&&(I=M-R.width-8),h.y+R.height>_&&(P=_-R.height-8),(I!==h.x||P!==h.y)&&g({x:I,y:P})},[m,h]);const q=n&&i>0,$=n&&i>=0&&i<u.length-1;return l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{ref:x,onContextMenu:y,children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:192,columnNumber:7},void 0),m&&Rr.createPortal(l.jsxDEV("div",{ref:b,className:"toolbar-context-menu",style:{position:"fixed",left:h.x,top:h.y,zIndex:en.DROPDOWN_PORTAL},children:l.jsxDEV(Tn,{children:[n&&l.jsxDEV(l.Fragment,{children:[l.jsxDEV(qe,{onSelect:T,disabled:!q,children:s("toolbar.moveUp")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:208,columnNumber:19},void 0),l.jsxDEV(qe,{onSelect:S,disabled:!$,children:s("toolbar.moveDown")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:211,columnNumber:19},void 0),l.jsxDEV(qe,{onSelect:v,disabled:!q,children:s("toolbar.moveToTop")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:214,columnNumber:19},void 0),l.jsxDEV(qe,{onSelect:E,disabled:!$,children:s("toolbar.moveToBottom")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:217,columnNumber:19},void 0),l.jsxDEV(ds,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:220,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:207,columnNumber:17},void 0),l.jsxDEV(qe,{onSelect:w,children:s(n?"toolbar.rightClickToHide":"toolbar.doubleClickToShow")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:223,columnNumber:15},void 0),l.jsxDEV(ds,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:226,columnNumber:15},void 0),l.jsxDEV(qe,{onSelect:U,children:s("toolbar.resetToDefault")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:227,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:205,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:195,columnNumber:11},void 0),document.body)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-context-menu.tsx",lineNumber:191,columnNumber:5},void 0)},e_=({embedded:e=!1,iconMode:t=!1,onOpenBackupRestore:n,onOpenCloudSync:i})=>{const o=xt(),{t:s}=ke(),{isButtonVisible:r,visibleButtons:a}=Or(),c=F.getBoardContainer(o),[u,d]=p.useState(!1),m=o.history.undos.length<=0,f=o.history.redos.length<=0,h=r("undo"),g=r("redo"),b=a.findIndex(N=>N.id==="undo"),x=a.findIndex(N=>N.id==="redo"),y=l.jsxDEV(ft.Row,{gap:1,children:[l.jsxDEV(at,{sideOffset:12,open:u,onOpenChange:N=>{d(N)},placement:e?"right-start":"bottom-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{type:"icon",visible:!0,selected:u,icon:l.jsxDEV($p,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:71,columnNumber:21},void 0),tooltip:u?void 0:s("general.menu"),tooltipPlacement:e?"right":"bottom","aria-label":s("general.menu"),"data-track":"toolbar_click_menu",onPointerDown:()=>{d(!u)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:67,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:66,columnNumber:11},void 0),l.jsxDEV(ct,{container:c,style:{zIndex:en.POPOVER_APP},children:l.jsxDEV(Tn,{onSelect:()=>{d(!1)},onClose:()=>{d(!1)},children:[l.jsxDEV(mg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:90,columnNumber:15},void 0),l.jsxDEV(dg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:91,columnNumber:15},void 0),l.jsxDEV(pg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:92,columnNumber:15},void 0),l.jsxDEV(fg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:93,columnNumber:15},void 0),l.jsxDEV(vg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:94,columnNumber:15},void 0),l.jsxDEV(ds,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:95,columnNumber:15},void 0),l.jsxDEV(Eg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:96,columnNumber:15},void 0),l.jsxDEV(hg,{onOpenBackupRestore:()=>{d(!1),n==null||n()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:97,columnNumber:15},void 0),l.jsxDEV(bg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:101,columnNumber:15},void 0),l.jsxDEV(gg,{onOpenCloudSync:()=>{d(!1),i==null||i()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:102,columnNumber:15},void 0),l.jsxDEV(xg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:106,columnNumber:15},void 0),l.jsxDEV(ds,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:107,columnNumber:15},void 0),l.jsxDEV(Ng,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:108,columnNumber:15},void 0),l.jsxDEV(yg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:109,columnNumber:15},void 0),l.jsxDEV(wg,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:110,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:82,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:81,columnNumber:11},void 0)]},0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:57,columnNumber:9},void 0),h&&l.jsxDEV(Dl,{buttonId:"undo",isVisible:!0,visibleIndex:b,children:l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(Xp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:123,columnNumber:21},void 0),visible:!0,tooltip:s("general.undo"),tooltipPlacement:e?"right":"bottom","aria-label":s("general.undo"),"data-track":"toolbar_click_undo",onPointerUp:()=>{o.undo()},disabled:m},1,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:120,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:115,columnNumber:11},void 0),g&&l.jsxDEV(Dl,{buttonId:"redo",isVisible:!0,visibleIndex:x,children:l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(Kp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:145,columnNumber:21},void 0),visible:!0,tooltip:s("general.redo"),tooltipPlacement:e?"right":"bottom","aria-label":s("general.redo"),"data-track":"toolbar_click_redo",onPointerUp:()=>{o.redo()},disabled:f},2,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:142,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:137,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:56,columnNumber:7},void 0);return e?l.jsxDEV("div",{className:Y("app-toolbar",{"app-toolbar--embedded":e,"app-toolbar--icon-only":t}),children:[y,l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(Kx,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:169,columnNumber:17},void 0),visible:!0,tooltip:s("menu.github"),tooltipPlacement:"right","aria-label":s("menu.github"),"data-track":"toolbar_click_github",onPointerUp:()=>{window.open("https://github.com/ljquan/aitu","_blank")}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:167,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:162,columnNumber:7},void 0):l.jsxDEV(Ye,{padding:1,className:Y("app-toolbar",Mt,{"app-toolbar--embedded":e,"app-toolbar--icon-only":t}),children:y},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/app-toolbar/app-toolbar.tsx",lineNumber:184,columnNumber:5},void 0)};function t_(e,t){return!e||e===ei.solid?null:e===ei.dashed?`${t*3},${t*2}`:e===ei.dotted?`${t},${t*2}`:null}function pi(e){return e!==void 0&&!isNaN(e[0])&&!isNaN(e[1])&&isFinite(e[0])&&isFinite(e[1])}class n_ extends Yp{constructor(t){super(t)}canDraw(t){return t.anchors&&t.anchors.length>0}draw(t){const n=Zl();n.classList.add("pen-path");const i=Zp(t),o=t.cornerRadius||0,s=Qp(i,t.closed,o),r=t.strokeWidth||2,a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",s),a.setAttribute("fill",Yx(t.fill)),a.setAttribute("stroke",t.strokeColor||"#000000"),a.setAttribute("stroke-width",String(r)),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round");const c=t_(t.strokeStyle,r);return c&&a.setAttribute("stroke-dasharray",c),n.appendChild(a),n}}function i_(e,t){const n=e.point,i=Qx;if(e.type==="corner"){const o=document.createElementNS("http://www.w3.org/2000/svg","rect");return o.setAttribute("x",String(n[0]-i/2)),o.setAttribute("y",String(n[1]-i/2)),o.setAttribute("width",String(i)),o.setAttribute("height",String(i)),o.setAttribute("fill",t?"#1890ff":"#ffffff"),o.setAttribute("stroke","#1890ff"),o.setAttribute("stroke-width","1.5"),o.classList.add("pen-anchor"),o}else{const o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",String(n[0])),o.setAttribute("cy",String(n[1])),o.setAttribute("r",String(i/2)),o.setAttribute("fill",t?"#1890ff":"#ffffff"),o.setAttribute("stroke","#1890ff"),o.setAttribute("stroke-width","1.5"),o.classList.add("pen-anchor"),o}}function jm(e){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");return t.setAttribute("cx",String(e[0])),t.setAttribute("cy",String(e[1])),t.setAttribute("r",String(Zx/2)),t.setAttribute("fill","#ffffff"),t.setAttribute("stroke","#1890ff"),t.setAttribute("stroke-width","1"),t.classList.add("pen-handle"),t}function Pm(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","line");return n.setAttribute("x1",String(e[0])),n.setAttribute("y1",String(e[1])),n.setAttribute("x2",String(t[0])),n.setAttribute("y2",String(t[1])),n.setAttribute("stroke","#1890ff"),n.setAttribute("stroke-width","1"),n.setAttribute("stroke-dasharray","3,3"),n.classList.add("pen-handle-line"),n}function o_(e,t,n){const i="#ff4d4f";if(n.vertical&&n.verticalRefPoint){const s=n.verticalRefPoint,r=document.createElementNS("http://www.w3.org/2000/svg","line");r.setAttribute("x1",String(t[0])),r.setAttribute("y1",String(Math.min(t[1],s[1])-50)),r.setAttribute("x2",String(t[0])),r.setAttribute("y2",String(Math.max(t[1],s[1])+50)),r.setAttribute("stroke",i),r.setAttribute("stroke-width",String(1)),r.setAttribute("stroke-dasharray","4,4"),r.classList.add("pen-alignment-guide"),e.appendChild(r);const a=document.createElementNS("http://www.w3.org/2000/svg","circle");a.setAttribute("cx",String(s[0])),a.setAttribute("cy",String(s[1])),a.setAttribute("r","3"),a.setAttribute("fill",i),a.setAttribute("opacity","0.6"),a.classList.add("pen-alignment-marker"),e.appendChild(a)}if(n.horizontal&&n.horizontalRefPoint){const s=n.horizontalRefPoint,r=document.createElementNS("http://www.w3.org/2000/svg","line");if(r.setAttribute("x1",String(Math.min(t[0],s[0])-50)),r.setAttribute("y1",String(t[1])),r.setAttribute("x2",String(Math.max(t[0],s[0])+50)),r.setAttribute("y2",String(t[1])),r.setAttribute("stroke",i),r.setAttribute("stroke-width",String(1)),r.setAttribute("stroke-dasharray","4,4"),r.classList.add("pen-alignment-guide"),e.appendChild(r),!n.verticalRefPoint||n.horizontalRefPoint[0]!==n.verticalRefPoint[0]||n.horizontalRefPoint[1]!==n.verticalRefPoint[1]){const a=document.createElementNS("http://www.w3.org/2000/svg","circle");a.setAttribute("cx",String(s[0])),a.setAttribute("cy",String(s[1])),a.setAttribute("r","3"),a.setAttribute("fill",i),a.setAttribute("opacity","0.6"),a.classList.add("pen-alignment-marker"),e.appendChild(a)}}}function s_(e,t,n="#1890ff",i=2,o){const s=Zl();if(s.classList.add("pen-preview"),e.length===0)return s;if(t&&pi(t)&&o&&(o.horizontal||o.vertical)&&o_(s,t,o),e.length>0){const r=Qp(e,!1),a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",r),a.setAttribute("fill","none"),a.setAttribute("stroke",n),a.setAttribute("stroke-width",String(i)),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),s.appendChild(a)}if(t&&pi(t)&&e.length>0){const r=e[e.length-1];if(pi(r.point)){const a=document.createElementNS("http://www.w3.org/2000/svg","line"),c=r.handleOut&&pi(r.handleOut)?r.handleOut:r.point;a.setAttribute("x1",String(c[0])),a.setAttribute("y1",String(c[1])),a.setAttribute("x2",String(t[0])),a.setAttribute("y2",String(t[1])),a.setAttribute("stroke",n),a.setAttribute("stroke-width","1"),a.setAttribute("stroke-dasharray","5,5"),a.setAttribute("opacity","0.6"),s.appendChild(a)}}for(let r=0;r<e.length;r++){const a=e[r];if(!pi(a.point))continue;if(a.handleIn&&pi(a.handleIn)){const u=Pm(a.point,a.handleIn);s.appendChild(u);const d=jm(a.handleIn);s.appendChild(d)}if(a.handleOut&&pi(a.handleOut)){const u=Pm(a.point,a.handleOut);s.appendChild(u);const d=jm(a.handleOut);s.appendChild(d)}const c=i_(a,r===e.length-1);s.appendChild(c)}return s}const r_=3,a_=3,Cm=8,_l=new WeakMap;function Zn(e){let t=_l.get(e);return t||(t={isCreating:!1,anchors:[],isDraggingHandle:!1,dragStartPoint:null,currentPoint:null,previewG:null,alignment:{horizontal:!1,vertical:!1,horizontalRefPoint:null,verticalRefPoint:null,referencePoint:null}},_l.set(e,t)),t}function Am(e,t,n=!1){const i={horizontal:!1,vertical:!1,horizontalRefPoint:null,verticalRefPoint:null,referencePoint:null},o=[...e],s=n&&t.length>1?t.slice(0,-1):t;if(s.length===0)return{snappedPoint:e,alignment:i};let r=Cm,a=null,c=null,u=Cm,d=null,m=null;for(const f of s){const h=Math.abs(e[0]-f.point[0]),g=Math.abs(e[1]-f.point[1]);h<r&&(r=h,a=f.point[0],c=f.point),g<u&&(u=g,d=f.point[1],m=f.point)}return a!==null&&(o[0]=a,i.vertical=!0,i.verticalRefPoint=c),d!==null&&(o[1]=d,i.horizontal=!0,i.horizontalRefPoint=m),i.referencePoint=i.verticalRefPoint||i.horizontalRefPoint,{snappedPoint:o,alignment:i}}function io(e){const t=Zn(e);t.previewG&&t.previewG.remove(),kg(e),t.isCreating=!1,t.anchors=[],t.isDraggingHandle=!1,t.dragStartPoint=null,t.currentPoint=null,t.previewG=null,t.alignment={horizontal:!1,vertical:!1,horizontalRefPoint:null,verticalRefPoint:null,referencePoint:null}}function kg(e){F.getElementHost(e).querySelectorAll(".pen-preview").forEach(i=>i.remove())}function Po(e){const t=Zn(e),n=F.getElementHost(e);t.previewG&&t.previewG.remove(),t.previewG=s_(t.anchors,t.currentPoint,"#1890ff",2,t.alignment),n.appendChild(t.previewG)}function Nr(e,t=!1){const n=Zn(e),i=[...n.anchors];if(n.previewG&&(n.previewG.remove(),n.previewG=null),kg(e),i.length>=2){const o=Jx(e,i,t);n.isCreating=!1,n.anchors=[],n.isDraggingHandle=!1,n.dragStartPoint=null,n.currentPoint=null,ue.insertNode(e,o,[e.children.length]),t?(oi(e),Ti(e,o)):oi(e)}else io(e)}function Lo(e){return F.getPointer(e)===Ln.pen}function l_(e){const t=Zn(e);t.isCreating&&(Lo(e)||(t.anchors.length>=2?Nr(e,!1):io(e)))}const c_=e=>{const{pointerDown:t,pointerMove:n,pointerUp:i,globalPointerUp:o,keyDown:s,globalKeyDown:r}=e,a=u=>u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLElement&&u.isContentEditable,c=u=>{if(u.defaultPrevented||!Lo(e)||a(u.target))return!1;const d=Zn(e);return d.isCreating?u.key==="Enter"?(Nr(e,!1),u.preventDefault(),!0):u.key==="Escape"?(io(e),u.preventDefault(),!0):tt.isHotkey(["mod+z"],{byKey:!0})(u)||u.key==="Backspace"||u.key==="Delete"?(d.anchors.length>0&&(d.anchors.pop(),Po(e)),d.anchors.length===0&&io(e),u.preventDefault(),!0):!1:!1};return e.pointerDown=u=>{if(l_(e),!Lo(e)){t(u);return}const d=Zn(e);let m=Ft(e,Ht(e,u.x,u.y));if(d.isCreating&&d.anchors.length>=a_){const b={anchors:d.anchors};if(eN(b,m)){Nr(e,!0);return}}if(d.anchors.length>0){const{snappedPoint:b}=Am(m,d.anchors,!1);m=b}d.isCreating=!0,d.isDraggingHandle=!0,d.dragStartPoint=m;const h=Za(e).defaultAnchorType,g={point:m,type:h};d.anchors.push(g),d.alignment={horizontal:!1,vertical:!1,horizontalRefPoint:null,verticalRefPoint:null,referencePoint:null},Po(e)},e.pointerMove=u=>{if(!Lo(e)){n(u);return}const d=Zn(e);let m=Ft(e,Ht(e,u.x,u.y));const f=d.isDraggingHandle,{snappedPoint:h,alignment:g}=Am(m,d.anchors,f);if(d.currentPoint=h,d.alignment=g,d.isDraggingHandle&&d.dragStartPoint&&d.anchors.length>0&&tN(d.dragStartPoint,m)>r_){const x=d.anchors.length-1,y=d.anchors[x];if(y.type!=="corner"){if(y.type==="smooth"||y.type==="symmetric"){const N=nN(y.point,m);d.anchors[x]={...y,handleIn:N.handleIn,handleOut:N.handleOut}}}}d.isCreating&&Ql(e,"pen-preview",()=>{Po(e)}),n(u)},e.pointerUp=u=>{if(!Lo(e)){i(u);return}const d=Zn(e);d.isDraggingHandle=!1,d.dragStartPoint=null,Po(e),i(u)},e.globalPointerUp=u=>{o(u)},e.globalKeyDown=u=>{c(u)||r(u)},e.keyDown=u=>{c(u)||s(u)},e};function Dn(e){const t=_l.get(e);t!=null&&t.isCreating&&(t.anchors.length>=2?Nr(e,!1):io(e))}const Mc=[{icon:l.jsxDEV(bo,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:32,columnNumber:13},void 0),pointer:rt.feltTipPen,titleKey:"toolbar.pen"},{icon:l.jsxDEV(iN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:37,columnNumber:13},void 0),pointer:Ln.pen,titleKey:"toolbar.vectorPen"},{icon:l.jsxDEV(oN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:42,columnNumber:13},void 0),pointer:rt.eraser,titleKey:"toolbar.eraser"},{icon:l.jsxDEV(sN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:47,columnNumber:13},void 0),pointer:rt.laserPointer,titleKey:"toolbar.laserPointer"}],u_=Jp(Mc,5),Ic=({onPointerUp:e})=>{const{t}=ke(),n=xt();return l.jsxDEV(Ye,{padding:1,children:l.jsxDEV(ft.Row,{gap:1,align:"center",children:l.jsxDEV(ft.Row,{gap:1,children:u_.map((i,o)=>i.map((s,r)=>l.jsxDEV(ne,{className:Y({fillable:!1}),selected:n.pointer===s.pointer,type:"icon",size:"small",visible:!0,icon:s.icon,tooltip:t(s.titleKey),"aria-label":t(s.titleKey),onPointerDown:()=>{s.pointer!==Ln.pen&&Dn(n),mt(n,St.dnd),fe.updatePointerType(n,s.pointer)},onPointerUp:()=>{mt(n,St.drawing),e(s.pointer)}},`${o}-${r}`,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:73,columnNumber:17},void 0)))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:69,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:67,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/freehand-panel/freehand-panel.tsx",lineNumber:66,columnNumber:5},void 0)},d_=[{icon:l.jsxDEV(ef,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:30,columnNumber:11},void 0),title:"Rectangle — R",pointer:De.rectangle},{icon:l.jsxDEV(tf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:35,columnNumber:11},void 0),title:"Ellipse — O",pointer:De.ellipse},{icon:l.jsxDEV(nf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:40,columnNumber:11},void 0),title:"Triangle",pointer:De.triangle},{icon:l.jsxDEV(of,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:45,columnNumber:11},void 0),title:"Terminal",pointer:Jl.terminal},{icon:l.jsxDEV(sf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:50,columnNumber:11},void 0),title:"Diamond",pointer:De.diamond},{icon:l.jsxDEV(rf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:55,columnNumber:11},void 0),title:"Parallelogram",pointer:De.parallelogram},{icon:l.jsxDEV(af,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:60,columnNumber:11},void 0),title:"RoundRectangle",pointer:De.roundRectangle}],m_=Jp(d_,5),Vc=({onPointerUp:e})=>{const t=xt();return l.jsxDEV(Ye,{padding:1,children:l.jsxDEV(ft.Col,{gap:1,children:m_.map((n,i)=>l.jsxDEV(ft.Row,{gap:1,children:n.map((o,s)=>l.jsxDEV(ne,{className:Y({fillable:!1}),type:"icon",size:"small",visible:!0,icon:o.icon,tooltip:o.title,"aria-label":o.title,onPointerDown:()=>{Dn(t),mt(t,St.dnd),fe.updatePointerType(t,o.pointer)},onPointerUp:()=>{mt(t,St.drawing),e(o.pointer)}},s,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:84,columnNumber:19},void 0))},i,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:81,columnNumber:13},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:78,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/shape-picker.tsx",lineNumber:77,columnNumber:5},void 0)},p_=[{icon:l.jsxDEV(rN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/arrow-picker.tsx",lineNumber:21,columnNumber:11},void 0),title:"Straight Arrow Line",pointer:Sn.straight},{icon:l.jsxDEV(aN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/arrow-picker.tsx",lineNumber:26,columnNumber:11},void 0),title:"Elbow Arrow Line",pointer:Sn.elbow},{icon:l.jsxDEV(lN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/arrow-picker.tsx",lineNumber:31,columnNumber:11},void 0),title:"Curve Arrow Line",pointer:Sn.curve}],Uc=({onPointerUp:e})=>{const t=xt();return l.jsxDEV(Ye,{padding:1,children:l.jsxDEV(ft.Row,{gap:1,children:p_.map((n,i)=>l.jsxDEV(ne,{className:Y({fillable:!1}),type:"icon",size:"small",visible:!0,icon:n.icon,tooltip:n.title,"aria-label":n.title,onPointerDown:()=>{Dn(t),mt(t,St.drawing),fe.updatePointerType(t,n.pointer)},onPointerUp:()=>{e(n.pointer)}},i,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/arrow-picker.tsx",lineNumber:48,columnNumber:13},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/arrow-picker.tsx",lineNumber:45,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/arrow-picker.tsx",lineNumber:44,columnNumber:5},void 0)},Sg=[{value:hi.default,labelKey:"theme.default"},{value:hi.colorful,labelKey:"theme.colorful"},{value:hi.soft,labelKey:"theme.soft"},{value:hi.retro,labelKey:"theme.retro"},{value:hi.dark,labelKey:"theme.dark"},{value:hi.starry,labelKey:"theme.starry"}],Tg=l.jsxDEV("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{width:"1rem",height:"1rem"},children:l.jsxDEV("polyline",{points:"20 6 9 17 4 12"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-shared.tsx",lineNumber:37,columnNumber:5},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-shared.tsx",lineNumber:27,columnNumber:3},void 0),tr=e=>e===Et.hand||e===Et.selection||e===ts,Dg=l.jsxDEV("span",{style:{width:"1rem",display:"inline-block"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/toolbar-shared.tsx",lineNumber:55,columnNumber:26},void 0),Mm={hand:{icon:l.jsxDEV(hf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:84,columnNumber:19},void 0),titleKey:"toolbar.hand",pointer:Et.hand},selection:{icon:l.jsxDEV(ff,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:85,columnNumber:24},void 0),titleKey:"toolbar.selection",pointer:Et.selection},lasso:{icon:l.jsxDEV(pf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:86,columnNumber:20},void 0),titleKey:"toolbar.lasso",pointer:ts},mind:{icon:l.jsxDEV(ar,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:87,columnNumber:19},void 0),titleKey:"toolbar.mind",pointer:Di.mind},text:{icon:l.jsxDEV(oc,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:88,columnNumber:19},void 0),titleKey:"toolbar.text",pointer:De.text},freehand:{icon:l.jsxDEV(bo,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:89,columnNumber:23},void 0),titleKey:"toolbar.pen",pointer:rt.feltTipPen,hasPopup:!0,popupKey:"freehand"},arrow:{icon:l.jsxDEV(ic,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:90,columnNumber:20},void 0),titleKey:"toolbar.arrow",pointer:Sn.straight,hasPopup:!0,popupKey:"arrow"},shape:{icon:l.jsxDEV(nc,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:91,columnNumber:20},void 0),titleKey:"toolbar.shape",pointer:De.rectangle,hasPopup:!0,popupKey:"shape"},image:{icon:l.jsxDEV(Ur,{size:24},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:92,columnNumber:20},void 0),titleKey:"toolbar.image"},"media-library":{icon:l.jsxDEV(Vr,{size:24},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:93,columnNumber:28},void 0),titleKey:"toolbar.mediaLibrary"},"ai-image":{icon:l.jsxDEV(qr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:94,columnNumber:23},void 0),titleKey:"toolbar.aiImage"},"ai-video":{icon:l.jsxDEV(Br,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:95,columnNumber:23},void 0),titleKey:"toolbar.aiVideo"},theme:{icon:l.jsxDEV(mf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:96,columnNumber:20},void 0),titleKey:"toolbar.theme",hasPopup:!0,popupKey:"theme"},"mermaid-to-drawnix":{icon:l.jsxDEV(df,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:97,columnNumber:33},void 0),titleKey:"extraTools.mermaidToDrawnix"},"markdown-to-drawnix":{icon:l.jsxDEV(uf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:98,columnNumber:34},void 0),titleKey:"extraTools.markdownToDrawnix"},undo:{icon:l.jsxDEV(Xp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:100,columnNumber:19},void 0),titleKey:"general.undo"},redo:{icon:l.jsxDEV(Kp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:101,columnNumber:19},void 0),titleKey:"general.redo"}},f_=({embedded:e=!1})=>{const{t}=ke(),n=xt(),i=F.getBoardContainer(n),{hiddenButtons:o,showButton:s}=Or(),[r,a]=p.useState(!1),[c,u]=p.useState(!1),d=p.useRef(null),m=p.useRef(null),f=p.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),m.current&&(clearTimeout(m.current),m.current=null)},[]),h=p.useCallback(()=>"ontouchstart"in window||navigator.maxTouchPoints>0,[]),g=p.useCallback(()=>{h()||(f(),u(!0),d.current=setTimeout(()=>{a(!0)},200))},[f,h]),b=p.useCallback(()=>{h()||(d.current&&(clearTimeout(d.current),d.current=null),m.current=setTimeout(()=>{u(!1),a(!1)},150))},[h]),x=p.useCallback(()=>{h()&&(a(w=>!w),u(!1))},[h]),y=p.useCallback(()=>{f(),u(!0)},[f]),N=p.useCallback(()=>{m.current=setTimeout(()=>{u(!1),a(!1)},150)},[]);return l.jsxDEV(at,{open:r,onOpenChange:w=>{!w&&(h()||!c)&&a(!1)},placement:e?"right-start":"bottom",sideOffset:12,children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("div",{onMouseEnter:g,onMouseLeave:b,onClick:x,children:l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(cN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:213,columnNumber:19},void 0),tooltip:r?void 0:t("toolbar.more"),tooltipPlacement:e?"right":"bottom","aria-label":t("toolbar.more"),selected:r,visible:!0,"data-testid":"toolbar-more","data-track":"toolbar_click_more"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:211,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:206,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:205,columnNumber:7},void 0),l.jsxDEV(ct,{container:i,style:{zIndex:en.POPOVER},onMouseEnter:y,onMouseLeave:N,children:l.jsxDEV(h_,{hiddenButtons:o,showButton:s},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:230,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:224,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:193,columnNumber:5},void 0)},h_=({hiddenButtons:e,showButton:t})=>{const{t:n}=ke(),i=xt(),o=F.getBoardContainer(i),{openDialog:s}=Wt(),r=ec(),[a,c]=p.useState(null),[u,d]=p.useState(null),m=p.useRef({}),[f,h]=p.useState(null),g=p.useRef(null),[b,x]=p.useState(rt.feltTipPen),y=p.useCallback(()=>{c(null),d(null),Object.values(m.current).forEach(A=>{A&&clearTimeout(A)})},[]),N=p.useCallback(A=>{if(Object.values(m.current).forEach(G=>{G&&clearTimeout(G)}),u===A){d(null);return}a===A&&!u?c(null):(d(null),c(A))},[a,u]),w=p.useCallback(A=>{a&&!u||(m.current[A]&&clearTimeout(m.current[A]),Object.entries(m.current).forEach(([G,ce])=>{G!==A&&ce&&(clearTimeout(ce),m.current[G]=null)}),u&&u!==A?(c(A),d(A)):a||(m.current[A]=setTimeout(()=>{c(A),d(A)},300)))},[u,a]),T=p.useCallback(A=>{m.current[A]&&(clearTimeout(m.current[A]),m.current[A]=null),u===A&&(m.current[A]=setTimeout(()=>{c(null),d(null)},400))},[u]),S=p.useCallback(A=>{m.current[A]&&(clearTimeout(m.current[A]),m.current[A]=null)},[]),v=p.useCallback(A=>{u===A&&(c(null),d(null))},[u]),E=p.useCallback(A=>{Dn(i),A===De.text?mt(i,null):mt(i,St.dnd),fe.updatePointerType(i,A),r(A)},[i,r]),U=p.useCallback(A=>{A!==De.text&&mt(i,St.drawing)},[i]),q=p.useCallback(A=>{const G=Mm[A];if(G){if(G.hasPopup&&G.popupKey){N(G.popupKey);return}switch(y(),Dn(i),G.pointer&&(tr(G.pointer)?(fe.updatePointerType(i,G.pointer),r(G.pointer)):(E(G.pointer),U(G.pointer))),A){case"image":Fr(i);break;case"ai-image":s(ln.aiImageGeneration);break;case"ai-video":s(ln.aiVideoGeneration);break;case"mermaid-to-drawnix":s(ln.mermaidToDrawnix);break;case"markdown-to-drawnix":s(ln.markdownToDrawnix);break;case"undo":i.undo();break;case"redo":i.redo();break}}},[i,s,E,U,y,r,N]),$=p.useCallback((A,G)=>{A.preventDefault(),A.stopPropagation(),h({buttonId:G,x:A.clientX,y:A.clientY})},[]),V=p.useCallback(()=>{h(null)},[]),R=p.useCallback(()=>{f&&(t(f.buttonId),V())},[f,t,V]);_n.useEffect(()=>{if(!f)return;const A=ce=>{g.current&&!g.current.contains(ce.target)&&V()},G=ce=>{ce.key==="Escape"&&V()};return document.addEventListener("mousedown",A),document.addEventListener("keydown",G),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",G)}},[f,V]);const M=p.useCallback(A=>{switch(A){case"freehand":return l.jsxDEV(Ic,{onPointerUp:G=>{y(),r(G),x(G)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:489,columnNumber:11},void 0);case"shape":return l.jsxDEV(Vc,{onPointerUp:G=>{y(),r(G)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:499,columnNumber:11},void 0);case"arrow":return l.jsxDEV(Uc,{onPointerUp:G=>{y(),r(G)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:508,columnNumber:11},void 0);case"theme":return l.jsxDEV(Tn,{children:Sg.map(G=>{const ce=i.theme.themeColorMode===G.value;return l.jsxDEV(qe,{icon:ce?Tg:Dg,"data-track":`toolbar_click_theme_${G.value}`,onSelect:()=>{fe.updateThemeColor(i,G.value),y()},"aria-label":n(G.labelKey),selected:ce,children:n(G.labelKey)},G.value,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:521,columnNumber:17},void 0)})},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:517,columnNumber:11},void 0);default:return null}},[i,y,r,n]),_=p.useMemo(()=>{const A=Mc.find(G=>G.pointer===b);return(A==null?void 0:A.icon)||l.jsxDEV(bo,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:547,columnNumber:30},void 0)},[b]),[I,P]=p.useState(!1),Z=p.useCallback(()=>{var A;return l.jsxDEV("div",{className:"more-tools-panel__zoom-row",onContextMenu:G=>$(G,"zoom"),children:l.jsxDEV(ft.Row,{gap:1,children:[l.jsxDEV(ne,{type:"button",icon:l.jsxDEV(lf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:564,columnNumber:19},void 0),visible:!0,tooltip:n("zoom.out"),tooltipPlacement:"top","aria-label":n("zoom.out"),"data-track":"toolbar_click_zoom_out",onPointerUp:()=>{fe.updateZoom(i,i.viewport.zoom-.1)},className:"zoom-out-button"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:562,columnNumber:11},void 0),l.jsxDEV(at,{sideOffset:12,open:I,onOpenChange:G=>{P(G)},placement:"right-start",children:[l.jsxDEV(Dt,{content:n("zoom.fit"),showArrow:!1,children:l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("div",{"aria-label":n("zoom.fit"),"data-track":"toolbar_click_zoom_menu",className:`zoom-menu-trigger ${I?"active":""}`,onPointerUp:()=>{P(!I)},children:[Number(((((A=i==null?void 0:i.viewport)==null?void 0:A.zoom)||1)*100).toFixed(0)),"%"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:585,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:584,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:583,columnNumber:13},void 0),l.jsxDEV(ct,{container:o,style:{zIndex:en.POPOVER+1},children:l.jsxDEV(Tn,{onSelect:()=>{P(!1)},children:[l.jsxDEV(qe,{"data-track":"toolbar_click_zoom_fit",onSelect:()=>{fe.fitViewport(i)},"aria-label":n("zoom.fit"),shortcut:"Cmd+Shift+=",children:n("zoom.fit")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:603,columnNumber:17},void 0),l.jsxDEV(qe,{"data-track":"toolbar_click_zoom_fit_frame",onSelect:()=>{tc(i)},"aria-label":n("zoom.fitFrame"),children:n("zoom.fitFrame")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:611,columnNumber:17},void 0),l.jsxDEV(qe,{"data-track":"toolbar_click_zoom_100",onSelect:()=>{fe.updateZoom(i,1)},"aria-label":n("zoom.100"),shortcut:"Cmd+0",children:n("zoom.100")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:618,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:598,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:597,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:575,columnNumber:11},void 0),l.jsxDEV(ne,{type:"button",icon:l.jsxDEV(cf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:631,columnNumber:19},void 0),visible:!0,tooltip:n("zoom.in"),tooltipPlacement:"top","aria-label":n("zoom.in"),"data-track":"toolbar_click_zoom_in",onPointerUp:()=>{fe.updateZoom(i,i.viewport.zoom+.1)},className:"zoom-in-button"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:629,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:561,columnNumber:9},void 0)},"zoom",!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:556,columnNumber:7},void 0)},[i,o,$,n,I]),pe=p.useCallback(A=>{var we,Fe,K,Ce;if(A==="zoom")return Z();const G=Mm[A];if(!G)return null;const ce=n(G.titleKey),X=A==="freehand"?_:G.icon,ae=A==="undo"&&(((Fe=(we=i.history)==null?void 0:we.undos)==null?void 0:Fe.length)??0)<=0,le=A==="redo"&&(((Ce=(K=i.history)==null?void 0:K.redos)==null?void 0:Ce.length)??0)<=0,be=ae||le;if(G.hasPopup&&G.popupKey){const We=G.popupKey;return l.jsxDEV("div",{className:"more-tools-panel__item",onContextMenu:it=>$(it,A),children:l.jsxDEV(at,{open:a===We,sideOffset:2,onOpenChange:it=>{it||y()},placement:"right-start",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("div",{onMouseEnter:()=>w(We),onMouseLeave:()=>T(We),children:l.jsxDEV(ne,{type:"icon",icon:X,tooltip:ce,tooltipPlacement:"left","aria-label":ce,visible:!0,selected:a===We,"data-track":`toolbar_click_${A}`,onPointerUp:()=>q(A)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:687,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:683,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:682,columnNumber:13},void 0),l.jsxDEV(ct,{container:o,style:{zIndex:en.POPOVER+1},onMouseEnter:()=>S(We),onMouseLeave:()=>v(We),children:M(We)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:700,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:672,columnNumber:11},void 0)},A,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:667,columnNumber:9},void 0)}return l.jsxDEV("div",{className:"more-tools-panel__item",onContextMenu:We=>$(We,A),children:l.jsxDEV(ne,{type:"icon",icon:X,tooltip:ce,tooltipPlacement:"right","aria-label":ce,visible:!0,selected:!1,disabled:be,"data-track":`toolbar_click_${A}`,onPointerUp:()=>q(A)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:720,columnNumber:9},void 0)},A,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:715,columnNumber:7},void 0)},[n,i,o,a,_,q,$,w,T,S,v,M,y,Z]);return e.length===0?l.jsxDEV("div",{className:"more-tools-panel",children:[l.jsxDEV("div",{className:"more-tools-panel__header",children:l.jsxDEV("span",{className:"more-tools-panel__title",children:n("toolbar.moreTools")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:755,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:754,columnNumber:9},void 0),l.jsxDEV("div",{className:"more-tools-panel__empty",children:l.jsxDEV("span",{className:"more-tools-panel__empty-text",children:n("toolbar.allToolsVisible")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:758,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:757,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:753,columnNumber:7},void 0):l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{className:"more-tools-panel",children:[l.jsxDEV("div",{className:"more-tools-panel__header",children:l.jsxDEV("span",{className:"more-tools-panel__title",children:n("toolbar.moreTools")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:768,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:767,columnNumber:9},void 0),l.jsxDEV("div",{className:"more-tools-panel__content",children:e.map(A=>pe(A.id))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:770,columnNumber:9},void 0),l.jsxDEV("div",{className:"more-tools-panel__footer",children:l.jsxDEV("span",{className:"more-tools-panel__hint",children:n("toolbar.rightClickToAdd")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:774,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:773,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:766,columnNumber:7},void 0),f&&Rr.createPortal(l.jsxDEV("div",{ref:g,className:"toolbar-context-menu",style:{position:"fixed",left:f.x,top:f.y,zIndex:en.DROPDOWN_PORTAL},children:l.jsxDEV(Tn,{children:l.jsxDEV(qe,{onSelect:R,children:n("toolbar.addToToolbar")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:790,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:789,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:779,columnNumber:9},void 0),document.body)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/more-tools-button.tsx",lineNumber:765,columnNumber:5},void 0)},g_=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p5),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.MediaLibraryModal}))),b_=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p7),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.MinimizedToolsBar})));var _g=(e=>(e.shape="shape",e.arrow="arrow",e.freehand="freehand",e.theme="theme",e))(_g||{});const Im=[{icon:l.jsxDEV(hf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:123,columnNumber:11},void 0),pointer:Et.hand,titleKey:"toolbar.hand",visibilityKey:"hand"},{icon:l.jsxDEV(ff,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:129,columnNumber:11},void 0),pointer:Et.selection,titleKey:"toolbar.selection",visibilityKey:"selection"},{icon:l.jsxDEV(pf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:135,columnNumber:11},void 0),pointer:ts,titleKey:"toolbar.lasso",visibilityKey:"lasso"},{icon:l.jsxDEV(ar,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:141,columnNumber:11},void 0),pointer:Di.mind,titleKey:"toolbar.mind",visibilityKey:"mind"},{icon:l.jsxDEV(oc,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:147,columnNumber:11},void 0),pointer:De.text,titleKey:"toolbar.text",visibilityKey:"text"},{icon:l.jsxDEV(Ur,{size:24},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:153,columnNumber:11},void 0),titleKey:"toolbar.image",key:"image",visibilityKey:"image"},{icon:l.jsxDEV(Vr,{size:24},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:159,columnNumber:11},void 0),titleKey:"toolbar.mediaLibrary",key:"media-library",visibilityKey:"media-library"},{icon:l.jsxDEV(qr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:165,columnNumber:11},void 0),titleKey:"toolbar.aiImage",key:"ai-image",visibilityKey:"ai-image"},{icon:l.jsxDEV(Br,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:171,columnNumber:11},void 0),titleKey:"toolbar.aiVideo",key:"ai-video",visibilityKey:"ai-video"},{icon:l.jsxDEV(ar,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:177,columnNumber:11},void 0),pointer:Di.mind,titleKey:"toolbar.mind",visibilityKey:"mind"},{icon:l.jsxDEV(bo,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:183,columnNumber:11},void 0),pointer:rt.feltTipPen,titleKey:"toolbar.pen",key:"freehand",visibilityKey:"freehand"},{icon:l.jsxDEV(ic,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:190,columnNumber:11},void 0),titleKey:"toolbar.arrow",key:"arrow",pointer:Sn.straight,visibilityKey:"arrow"},{icon:l.jsxDEV(nc,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:197,columnNumber:11},void 0),titleKey:"toolbar.shape",key:"shape",pointer:De.rectangle,visibilityKey:"shape"},{icon:l.jsxDEV(mf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:204,columnNumber:11},void 0),titleKey:"toolbar.theme",key:"theme",visibilityKey:"theme"},{icon:l.jsxDEV(df,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:210,columnNumber:11},void 0),titleKey:"extraTools.mermaidToDrawnix",key:"mermaid-to-drawnix",visibilityKey:"mermaid-to-drawnix"},{icon:l.jsxDEV(uf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:216,columnNumber:11},void 0),titleKey:"extraTools.markdownToDrawnix",key:"markdown-to-drawnix",visibilityKey:"markdown-to-drawnix"}],x_=e=>Object.keys(Sn).includes(e.pointer),N_=e=>Object.keys(De).includes(e.pointer)||Object.keys(Jl).includes(e.pointer),y_=({embedded:e=!1,iconMode:t=!1,onOpenMediaLibrary:n,minimizedToolsBarEnabled:i=!1,onEnableToolWindows:o})=>{const s=xt(),{appState:r,openDialog:a}=Wt(),{t:c}=ke(),u=ec(),d=F.getBoardContainer(s),{visibleButtons:m,loading:f,reorderButton:h}=Or(),{getDragProps:g}=uN({items:m,getId:D=>D.id,onReorder:(D,j)=>{h(D,j,!0)},enabled:e}),[b,x]=p.useState({freehand:!1,arrow:!1,shape:!1,theme:!1}),[y,N]=p.useState(null),w=p.useRef({freehand:null,arrow:null,shape:null,theme:null}),[T,S]=p.useState(Im.find(D=>D.key==="freehand")),[v,E]=p.useState(!1),U=p.useCallback(async D=>{try{D.type===Vn.IMAGE?await Kl(s,D.url):D.type===Vn.VIDEO?await gf(s,D.url):D.type===Vn.AUDIO&&await Ll(s,D.url,{title:D.name,duration:D.duration,previewImageUrl:D.thumbnail,prompt:D.prompt,mv:D.modelName,clipId:D.clipId,providerTaskId:D.providerTaskId}),re.success("素材已插入到画板")}catch(j){console.error("Failed to insert asset:",j),re.error("插入素材失败")}},[s]),q=p.useCallback(()=>{if(n){n({mode:ii.SELECT,onSelect:U,selectButtonText:"插入"});return}E(!0)},[U,n]),$=p.useCallback(()=>{E(!1)},[]),V=()=>{x({freehand:!1,arrow:!1,shape:!1,theme:!1}),N(null),Object.values(w.current).forEach(D=>{D&&clearTimeout(D)})},R=D=>{N(null),Object.values(w.current).forEach(j=>{j&&clearTimeout(j)}),x({freehand:!1,arrow:!1,shape:!1,theme:!1,[D]:!0})},M=D=>{w.current[D]&&clearTimeout(w.current[D]),Object.entries(w.current).forEach(([j,W])=>{j!==D&&W&&(clearTimeout(W),w.current[j]=null)}),y&&y!==D?(x(j=>({...j,[y]:!1,[D]:!0})),N(D)):b[D]||(w.current[D]=setTimeout(()=>{x(j=>({...j,[D]:!0})),N(D)},300))},_=D=>{w.current[D]&&(clearTimeout(w.current[D]),w.current[D]=null),y===D&&(w.current[D]=setTimeout(()=>{x(j=>({...j,[D]:!1})),N(null)},200))},I=D=>{w.current[D]&&(clearTimeout(w.current[D]),w.current[D]=null)},P=D=>{y===D&&(x(j=>({...j,[D]:!1})),N(null))},Z=D=>{Dn(s),D===De.text?(mt(s,null),fe.updatePointerType(s,D),u(D)):(mt(s,St.dnd),fe.updatePointerType(s,D),u(D))},pe=D=>{D!==De.text&&mt(s,St.drawing)},A=()=>Object.values(b).some(D=>D),G=D=>F.isPointer(s,D.pointer)&&!A(),ce=D=>F.isInPointer(D,[rt.feltTipPen,rt.eraser,rt.laserPointer,Ln.pen]),X=D=>{V(),Dn(s),D.pointer&&!tr(D.pointer)?pe(D.pointer):D.pointer&&tr(D.pointer)&&(fe.updatePointerType(s,D.pointer),u(D.pointer)),D.key==="image"?Fr(s):D.key==="media-library"?q():D.key==="ai-image"?a(ln.aiImageGeneration):D.key==="ai-video"?a(ln.aiVideoGeneration):D.key==="mermaid-to-drawnix"?a(ln.mermaidToDrawnix):D.key==="markdown-to-drawnix"&&a(ln.markdownToDrawnix)},ae=(D,j,W)=>{const Q=()=>{switch(W){case"freehand":return l.jsxDEV(Ic,{onPointerUp:z=>{V(),u(z),S(Mc.find(te=>te.pointer===z))}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:520,columnNumber:13},void 0);case"shape":return l.jsxDEV(Vc,{onPointerUp:z=>{V(),u(z)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:532,columnNumber:13},void 0);case"arrow":return l.jsxDEV(Uc,{onPointerUp:z=>{V(),u(z)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:541,columnNumber:13},void 0);case"theme":return l.jsxDEV(Tn,{children:Sg.map(z=>{const te=s.theme.themeColorMode===z.value;return l.jsxDEV(qe,{icon:te?Tg:Dg,"data-track":`toolbar_click_theme_${z.value}`,onSelect:()=>{fe.updateThemeColor(s,z.value),V()},"aria-label":c(z.labelKey),selected:te,children:c(z.labelKey)},z.value,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:554,columnNumber:19},void 0)})},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:550,columnNumber:13},void 0)}},C=()=>{const z=b[W],te=Object.entries(b).some(([ee,O])=>ee!==W&&O);switch(W){case"freehand":return z||ce(s)&&!te;case"shape":return z||N_(s)&&!F.isPointer(s,De.text);case"arrow":return z||x_(s);default:return z}},B=W==="freehand"?T.icon:D.icon,L=W==="freehand"?T.titleKey?c(T.titleKey):"Freehand":D.titleKey?c(D.titleKey):"";return l.jsxDEV(at,{open:b[W],sideOffset:12,onOpenChange:z=>{z||V()},placement:e?"right-start":"bottom",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("div",{onMouseEnter:()=>M(W),onMouseLeave:()=>_(W),children:l.jsxDEV(ne,{type:"icon",visible:!0,selected:C(),icon:B,tooltip:L,"aria-label":L,"data-track":`toolbar_click_${W}`,onPointerDown:()=>{R(W),W==="freehand"&&T.pointer&&Z(T.pointer)},onPointerUp:()=>{W==="freehand"&&pe()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:627,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:623,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:622,columnNumber:9},void 0),l.jsxDEV(ct,{container:d,style:{zIndex:en.POPOVER},onMouseEnter:()=>I(W),onMouseLeave:()=>P(W),children:Q()},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:652,columnNumber:9},void 0)]},j,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:611,columnNumber:7},void 0)},le=(D,j)=>l.jsxDEV(ne,{type:"radio",icon:D.icon,checked:G(D),tooltip:D.titleKey?c(D.titleKey):"",tooltipPlacement:e?"right":"bottom","aria-label":D.titleKey?c(D.titleKey):"","data-track":`toolbar_click_${D.pointer||D.key}`,onPointerDown:()=>{D.pointer&&!tr(D.pointer)&&Z(D.pointer)},onPointerUp:()=>{X(D)}},j,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:667,columnNumber:7},void 0),be=p.useMemo(()=>{const D=new Map;return Im.forEach(j=>{j.visibilityKey&&D.set(j.visibilityKey,j)}),D},[]),[we,Fe]=p.useState(!1),K=p.useCallback(D=>{var W;const j=e?ft.Col:ft.Row;return l.jsxDEV("div",{className:Y("creation-toolbar__zoom-inline",{"creation-toolbar__zoom-inline--vertical":e}),children:l.jsxDEV(j,{gap:0,children:[l.jsxDEV(ne,{type:"button",icon:l.jsxDEV(lf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:721,columnNumber:21},void 0),visible:!0,tooltip:c("zoom.out"),tooltipPlacement:e?"right":"bottom","aria-label":c("zoom.out"),"data-track":"toolbar_click_zoom_out",onPointerUp:()=>{fe.updateZoom(s,s.viewport.zoom-.1)},className:"zoom-out-button"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:719,columnNumber:13},void 0),l.jsxDEV(at,{sideOffset:12,open:we,onOpenChange:Q=>{Fe(Q)},placement:e?"right-start":"bottom",children:[l.jsxDEV(Dt,{content:c("zoom.fit"),showArrow:!1,children:l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("div",{"aria-label":c("zoom.fit"),"data-track":"toolbar_click_zoom_menu",className:Y("zoom-menu-trigger",{active:we}),onPointerUp:()=>{Fe(!we)},children:[Number(((((W=s==null?void 0:s.viewport)==null?void 0:W.zoom)||1)*100).toFixed(0)),"%"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:742,columnNumber:19},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:741,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:740,columnNumber:15},void 0),l.jsxDEV(ct,{container:d,style:{zIndex:en.POPOVER},children:l.jsxDEV(Tn,{onSelect:()=>{Fe(!1)},children:[l.jsxDEV(qe,{"data-track":"toolbar_click_zoom_fit",onSelect:()=>{fe.fitViewport(s)},"aria-label":c("zoom.fit"),shortcut:"Cmd+Shift+=",children:c("zoom.fit")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:765,columnNumber:19},void 0),l.jsxDEV(qe,{"data-track":"toolbar_click_zoom_fit_frame",onSelect:()=>{tc(s)},"aria-label":c("zoom.fitFrame"),children:c("zoom.fitFrame")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:775,columnNumber:19},void 0),l.jsxDEV(qe,{"data-track":"toolbar_click_zoom_100",onSelect:()=>{fe.updateZoom(s,1)},"aria-label":c("zoom.100"),shortcut:"Cmd+0",children:c("zoom.100")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:784,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:760,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:756,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:732,columnNumber:13},void 0),l.jsxDEV(ne,{type:"button",icon:l.jsxDEV(cf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:799,columnNumber:21},void 0),visible:!0,tooltip:c("zoom.in"),tooltipPlacement:e?"right":"bottom","aria-label":c("zoom.in"),"data-track":"toolbar_click_zoom_in",onPointerUp:()=>{fe.updateZoom(s,s.viewport.zoom+.1)},className:"zoom-in-button"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:797,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:718,columnNumber:11},void 0)},`zoom-${D}`,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:712,columnNumber:9},void 0)},[s,d,e,c,we]),Ce=p.useCallback((D,j)=>{if(D==="zoom")return K(j);const W=be.get(D);return!W||r.isMobile&&W.pointer===Et.hand?null:W.key&&Object.values(_g).includes(W.key)?ae(W,j,W.key):le(W,j)},[be,r.isMobile,ae,le,K]),We=p.useCallback((D,j,W=!0,Q=-1)=>{const C=Ce(D,j);if(!C)return null;const B=g(D,j);return l.jsxDEV(Dl,{buttonId:D,isVisible:W,visibleIndex:Q,children:l.jsxDEV("div",{className:Y("toolbar-button-wrapper",{"toolbar-button-wrapper--dragging":B["data-dragging"],"toolbar-button-wrapper--drag-over":B["data-drag-over"],"toolbar-button-wrapper--drag-before":B["data-drag-position"]==="before","toolbar-button-wrapper--drag-after":B["data-drag-position"]==="after"}),"data-button-id":D,...B,children:C},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:873,columnNumber:11},void 0)},`ctx-${D}-${j}`,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:867,columnNumber:9},void 0)},[Ce,g]),it=l.jsxDEV(ft.Row,{gap:1,children:[!f&&m.map((D,j)=>e?We(D.id,j,!0,j):Ce(D.id,j)),l.jsxDEV(f_,{embedded:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:902,columnNumber:7},void 0),e&&i&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(b_,{ensureToolWindowsEnabled:o},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:906,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:905,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:894,columnNumber:5},void 0),Ke=v?l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(g_,{isOpen:v,onClose:$,mode:ii.SELECT,onSelect:U,selectButtonText:"插入"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:915,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:914,columnNumber:5},void 0):null;return e?l.jsxDEV(l.Fragment,{children:[l.jsxDEV("div",{className:Y("draw-toolbar",{"draw-toolbar--embedded":e,"draw-toolbar--icon-only":t}),children:it},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:928,columnNumber:9},void 0),Ke]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:927,columnNumber:7},void 0):l.jsxDEV(l.Fragment,{children:[l.jsxDEV(Ye,{padding:1,className:Y("draw-toolbar",Mt,{"draw-toolbar--embedded":e,"draw-toolbar--icon-only":t}),children:it},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:943,columnNumber:7},void 0),Ke]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/creation-toolbar.tsx",lineNumber:942,columnNumber:5},void 0)},Vm="https://tuziai.oss-cn-shenzhen.aliyuncs.com/aitu/AiTu.png",w_="https://tuziai.oss-cn-shenzhen.aliyuncs.com/linkme.png",v_=()=>{const e=xt(),t=F.getBoardContainer(e),[n,i]=p.useState(!1);return p.useEffect(()=>{const o=new Image;o.src=Vm;const s=new Image;s.src=w_},[]),l.jsxDEV(at,{placement:"right-end",sideOffset:12,open:n,onOpenChange:i,children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(dN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:38,columnNumber:17},void 0),"aria-label":"用户反馈群",title:"用户反馈群",tooltipPlacement:"right",selected:n,visible:!0,"data-track":"toolbar_click_feedback",onPointerDown:o=>{o.event.stopPropagation()},onClick:()=>i(!n)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:36,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:35,columnNumber:7},void 0),l.jsxDEV(ct,{container:t,style:{zIndex:en.POPOVER_FEEDBACK},children:l.jsxDEV("div",{className:"feedback-qrcode-content",children:l.jsxDEV("div",{className:"feedback-qrcode-grid",children:l.jsxDEV("div",{className:"feedback-qrcode-item",children:[l.jsxDEV("img",{src:Vm,alt:"用户反馈群二维码",className:"feedback-qrcode-image"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:55,columnNumber:15},void 0),l.jsxDEV("div",{className:"feedback-qrcode-text",children:"用户反馈群"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:60,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:54,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:53,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:52,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:51,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/feedback-button/feedback-button.tsx",lineNumber:34,columnNumber:5},void 0)},E_=({projectDrawerOpen:e,onProjectDrawerToggle:t,toolboxDrawerOpen:n=!1,onToolboxDrawerToggle:i,taskPanelExpanded:o,onTaskPanelToggle:s})=>{const{activeTasks:r,completedTasks:a,failedTasks:c}=mN(),d=r.length+a.length+c.length>0?`任务队列 (生成中: ${r.length}, 已完成: ${a.length}, 失败: ${c.length})`:"任务队列 (暂无任务)";return l.jsxDEV("div",{className:"bottom-actions-section",children:[l.jsxDEV(v_,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:50,columnNumber:7},void 0),l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(pN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:55,columnNumber:15},void 0),"aria-label":e?"关闭项目":"打开项目",tooltip:e?"关闭项目":"打开项目",tooltipPlacement:"right",selected:e,visible:!0,"data-track":"toolbar_click_project_drawer","data-testid":"toolbar-project",onPointerDown:m=>{m.event.stopPropagation()},onClick:t},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:53,columnNumber:7},void 0),i&&l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(fN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:73,columnNumber:17},void 0),"aria-label":n?"关闭工具箱":"打开工具箱",tooltip:n?"关闭工具箱":"打开工具箱",tooltipPlacement:"right",selected:n,visible:!0,"data-track":"toolbar_click_toolbox","data-testid":"toolbar-toolbox",onPointerDown:m=>{m.event.stopPropagation()},onClick:i},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:71,columnNumber:9},void 0),l.jsxDEV("div",{className:"bottom-actions-section__task-wrapper",children:[l.jsxDEV(hN,{count:r.length>0?r.length:0,showZero:!1,offset:[6,-6],children:l.jsxDEV(ne,{type:"icon",icon:l.jsxDEV(gN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:98,columnNumber:19},void 0),"aria-label":"任务队列",tooltip:d,tooltipPlacement:"right",selected:o,visible:!0,"data-track":"toolbar_click_tasks","data-testid":"toolbar-tasks",onPointerDown:m=>{m.event.stopPropagation()},onClick:s},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:96,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:91,columnNumber:9},void 0),r.length>0&&l.jsxDEV("div",{className:"bottom-actions-section__status bottom-actions-section__status--active"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:115,columnNumber:11},void 0),c.length>0&&r.length===0&&l.jsxDEV("div",{className:"bottom-actions-section__status bottom-actions-section__status--failed"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:118,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:90,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/bottom-actions-section.tsx",lineNumber:48,columnNumber:5},void 0)},k_=p.lazy(()=>Me(()=>import("./TaskQueuePanel-CTDuSScf.js"),__vite__mapDeps([0,2,3]),import.meta.url).then(e=>({default:e.TaskQueuePanel}))),S_=460,T_=["ai-image","ai-video"],D_=_n.memo(({className:e,projectDrawerOpen:t=!1,onProjectDrawerToggle:n,toolboxDrawerOpen:i=!1,onToolboxDrawerToggle:o,taskPanelExpanded:s=!1,onTaskPanelToggle:r,onOpenBackupRestore:a,onOpenCloudSync:c,onOpenMediaLibrary:u,deferredFeaturesEnabled:d=!1,minimizedToolsBarEnabled:m=!1,onEnableToolWindows:f})=>{const[h,g]=p.useState(!1),[b,x]=p.useState(!0),y=p.useRef(!1),N=p.useRef(null),w=p.useRef(null),T=p.useRef(!1),{isMobile:S,isTablet:v}=bN(),E=S||v;Hr(N,{enablePositionTracking:!0,enableScaleCompensation:!0});const U=p.useCallback(I=>{if(I[0]){const P=I[0].contentRect.height;g(P<S_)}},[]);p.useEffect(()=>{const I=N.current;if(!I)return;const P=new ResizeObserver(U);return P.observe(I),()=>{P.disconnect()}},[U]),p.useEffect(()=>{if(T.current)return;const I=w.current;if(!I)return;const P=()=>{T.current=!0;let pe=null;for(const X of T_){const ae=I.querySelector(`[data-button-id="${X}"]`);if(ae){pe=ae;break}}if(!pe)return;const A=I.getBoundingClientRect(),G=pe.getBoundingClientRect();if(!(G.bottom<=A.bottom&&G.top>=A.top)&&A.height>0){const X=G.top-A.top;I.scrollTop+=X}},Z=setTimeout(()=>{requestAnimationFrame(P)},100);return()=>{clearTimeout(Z)}},[]);const q=p.useCallback(()=>{!s&&!y.current&&(y.current=!0),r==null||r()},[s,r]),$=p.useCallback(()=>{s&&(r==null||r())},[s,r]),V=p.useCallback(()=>{x(I=>!I)},[]),{openDialog:R}=Wt(),M=p.useCallback(()=>{R(ln.aiImageGeneration)},[R]),_=p.useCallback(()=>{R(ln.aiVideoGeneration)},[R]);return l.jsxDEV(l.Fragment,{children:[y.current&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(k_,{expanded:s,onClose:$},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:191,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:190,columnNumber:11},void 0),l.jsxDEV(Ye,{ref:N,className:Y("unified-toolbar",Mt,{"unified-toolbar--icon-only":h||E,"unified-toolbar--mobile-collapsed":E&&b},e),padding:0,"data-testid":"unified-toolbar",children:[E&&b&&l.jsxDEV("div",{className:"unified-toolbar__collapsed-shortcuts",children:[l.jsxDEV("button",{className:"unified-toolbar__collapsed-btn unified-toolbar__collapsed-btn--toggle",onClick:V,"aria-label":"展开工具栏",children:l.jsxDEV(Vp,{size:18},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:222,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:217,columnNumber:15},void 0),l.jsxDEV("button",{className:"unified-toolbar__collapsed-btn",onClick:M,"aria-label":"AI 图片生成",children:l.jsxDEV(qr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:230,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:225,columnNumber:15},void 0),l.jsxDEV("button",{className:"unified-toolbar__collapsed-btn",onClick:_,"aria-label":"AI 视频生成",children:l.jsxDEV(Br,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:238,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:233,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:215,columnNumber:13},void 0),E&&!b&&l.jsxDEV("button",{className:"unified-toolbar__mobile-toggle unified-toolbar__mobile-toggle--expanded",onClick:V,"aria-label":"收起工具栏",children:l.jsxDEV(Hl,{size:18},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:250,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:245,columnNumber:13},void 0),l.jsxDEV("div",{className:"unified-toolbar__section unified-toolbar__section--fixed-top",children:l.jsxDEV(e_,{embedded:!0,iconMode:h||E,onOpenBackupRestore:a,onOpenCloudSync:c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:256,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:255,columnNumber:11},void 0),l.jsxDEV("div",{ref:w,className:"unified-toolbar__scrollable",children:l.jsxDEV("div",{className:"unified-toolbar__section",children:l.jsxDEV(y_,{embedded:!0,iconMode:h||E,onOpenMediaLibrary:u,deferredFeaturesEnabled:d,minimizedToolsBarEnabled:m,onEnableToolWindows:f},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:268,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:267,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:265,columnNumber:11},void 0),l.jsxDEV("div",{className:"unified-toolbar__section unified-toolbar__section--fixed-bottom",children:l.jsxDEV(E_,{projectDrawerOpen:t,onProjectDrawerToggle:n||(()=>{}),toolboxDrawerOpen:i,onToolboxDrawerToggle:o,taskPanelExpanded:s,onTaskPanelToggle:q},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:281,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:280,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:198,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/unified-toolbar.tsx",lineNumber:187,columnNumber:7},void 0)}),__=e=>n=>{const{globalKeyDown:i,keyDown:o}=n;return n.globalKeyDown=s=>{const r=s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||s.target instanceof HTMLElement&&s.target.isContentEditable;if(!r){if(tt.isHotkey(["mod+k"])(s)){e({openCommandPalette:!0}),s.preventDefault();return}if(tt.isHotkey(["mod+f"])(s)){e({openCanvasSearch:!0}),s.preventDefault();return}}if(!r&&(F.getMovingPointInBoard(n)||F.isMovingPointInBoard(n))&&!F.hasBeenTextEditing(n)){if(tt.isHotkey(["mod+shift+e"],{byKey:!0})(s)){zs(n,!0),s.preventDefault();return}if(tt.isHotkey(["mod+s"],{byKey:!0})(s)){Wp(n),s.preventDefault();return}if(tt.isHotkey(["mod+backspace"])(s)||tt.isHotkey(["mod+delete"])(s)){e({openCleanConfirm:!0}),s.preventDefault();return}if(tt.isHotkey(["mod+u"])(s)&&Fr(n),Be(n).length>1){if(tt.isHotkey(["alt+a"])(s)){rn.alignLeft(n),s.preventDefault();return}if(tt.isHotkey(["alt+h"])(s)){rn.alignCenter(n),s.preventDefault();return}if(tt.isHotkey(["alt+d"])(s)){rn.alignRight(n),s.preventDefault();return}if(tt.isHotkey(["alt+w"])(s)){rn.alignTop(n),s.preventDefault();return}if(tt.isHotkey(["alt+v"])(s)){rn.alignMiddle(n),s.preventDefault();return}if(tt.isHotkey(["alt+s"])(s)){rn.alignBottom(n),s.preventDefault();return}if(tt.isHotkey(["shift+h"])(s)){eo.distributeHorizontal(n),s.preventDefault();return}if(tt.isHotkey(["shift+v"])(s)){eo.distributeVertical(n),s.preventDefault();return}if(tt.isHotkey(["shift+a"])(s)){eo.autoArrange(n),s.preventDefault();return}if(tt.isHotkey(["alt+shift+u"])(s)){vn.union(n,"zh"),s.preventDefault();return}if(tt.isHotkey(["alt+shift+s"])(s)){vn.subtract(n,"zh"),s.preventDefault();return}if(tt.isHotkey(["alt+shift+i"])(s)){vn.intersect(n,"zh"),s.preventDefault();return}if(tt.isHotkey(["alt+shift+e"])(s)){vn.exclude(n,"zh"),s.preventDefault();return}if(tt.isHotkey(["alt+shift+f"])(s)){vn.flatten(n,"zh"),s.preventDefault();return}}if(!s.altKey&&!s.metaKey&&!s.ctrlKey&&tt.isHotkey(["shift+p"],{byKey:!0})(s)){mt(n,St.drawing),fe.updatePointerType(n,Ln.pen),e({pointer:Ln.pen}),s.preventDefault();return}if(!s.altKey&&!s.metaKey&&!s.ctrlKey&&!s.shiftKey){if(s.key==="l"){mt(n,St.drawing),fe.updatePointerType(n,rt.laserPointer),e({pointer:rt.laserPointer}),s.preventDefault();return}if(s.key==="Escape"&&F.isPointer(n,rt.laserPointer)){fe.updatePointerType(n,Et.selection),e({pointer:Et.selection}),s.preventDefault();return}if(s.key==="h"&&(fe.updatePointerType(n,Et.hand),e({pointer:Et.hand})),s.key==="v"&&(fe.updatePointerType(n,Et.selection),e({pointer:Et.selection})),s.key==="q"&&(fe.updatePointerType(n,ts),e({pointer:ts})),s.key==="m"&&(mt(n,St.dnd),fe.updatePointerType(n,Di.mind),e({pointer:Di.mind})),s.key==="e"&&(mt(n,St.drawing),fe.updatePointerType(n,rt.eraser),e({pointer:rt.eraser})),s.key==="p"&&(mt(n,St.drawing),fe.updatePointerType(n,rt.feltTipPen),e({pointer:rt.feltTipPen})),s.key==="a"&&!tt.isHotkey(["mod+a"])(s)&&Be(n).length===0&&(mt(n,St.drawing),fe.updatePointerType(n,Sn.straight),e({pointer:Sn.straight})),s.key==="f"&&(mt(n,St.drawing),fe.updatePointerType(n,Eu),e({pointer:Eu})),s.key==="r"||s.key==="o"||s.key==="t"){const c={r:De.rectangle,o:De.ellipse,t:De.text};c[s.key]===De.text?mt(n,null):mt(n,St.drawing),fe.updatePointerType(n,c[s.key]),e({pointer:c[s.key]})}s.preventDefault();return}}i(s)},n.keyDown=s=>{if(tt.isHotkey(["mod+z"],{byKey:!0})(s)){n.undo(),s.preventDefault();return}if(tt.isHotkey(["mod+shift+z"],{byKey:!0})(s)){n.redo(),s.preventDefault();return}o(s)},n};function Rc(e){return e===qt.square?"square":"round"}function qc(e,t){const n=Math.min(t/50,1),i=.2+n*.1,o=6-n*4,s=i+e*(o-i);return Math.max(.5,t*s)}function j_(e,t,n,i,o,s){const r=document.createElementNS("http://www.w3.org/2000/svg","g"),a=Rc(s);if(e.length<2){if(e.length===1){const f=qc(t[0]??.5,n);if(s===qt.square){const h=document.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("x",String(e[0][0]-f/2)),h.setAttribute("y",String(e[0][1]-f/2)),h.setAttribute("width",String(f)),h.setAttribute("height",String(f)),h.setAttribute("fill",i),r.appendChild(h)}else{const h=document.createElementNS("http://www.w3.org/2000/svg","circle");h.setAttribute("cx",String(e[0][0])),h.setAttribute("cy",String(e[0][1])),h.setAttribute("r",String(f/2)),h.setAttribute("fill",i),r.appendChild(h)}}return r}const c=sc(e,1,3);if(o===yn.double){const f=n*.8,h=n*.4,[g,b]=C_(c,t,h,f);if(g){const x=document.createElementNS("http://www.w3.org/2000/svg","path");x.setAttribute("d",g),x.setAttribute("fill",i),x.setAttribute("stroke","none"),r.appendChild(x)}if(b){const x=document.createElementNS("http://www.w3.org/2000/svg","path");x.setAttribute("d",b),x.setAttribute("fill",i),x.setAttribute("stroke","none"),r.appendChild(x)}return r}const u=bf(o,n),d=o!==ei.solid&&u?u.join(" "):"",m=A_(c,t,n);if(m.length>0){const f=document.createElementNS("http://www.w3.org/2000/svg","path");f.setAttribute("d",m),f.setAttribute("fill",i),f.setAttribute("stroke","none"),d&&(f.setAttribute("fill","none"),f.setAttribute("stroke",i),f.setAttribute("stroke-width",String(n)),f.setAttribute("stroke-dasharray",d),f.setAttribute("stroke-linecap",a),f.setAttribute("stroke-linejoin",a==="square"?"miter":"round")),r.appendChild(f)}return r}function P_(e,t,n,i){const o=document.createElementNS("http://www.w3.org/2000/svg","g"),s=Rc(i);if(e.length<2){if(e.length===1){const b=t*.8,x=t*.4;if(i===qt.square){const y=document.createElementNS("http://www.w3.org/2000/svg","rect");y.setAttribute("x",String(e[0][0]-x/2)),y.setAttribute("y",String(e[0][1]-b/2-x/2)),y.setAttribute("width",String(x)),y.setAttribute("height",String(x)),y.setAttribute("fill",n),o.appendChild(y);const N=document.createElementNS("http://www.w3.org/2000/svg","rect");N.setAttribute("x",String(e[0][0]-x/2)),N.setAttribute("y",String(e[0][1]+b/2-x/2)),N.setAttribute("width",String(x)),N.setAttribute("height",String(x)),N.setAttribute("fill",n),o.appendChild(N)}else{const y=document.createElementNS("http://www.w3.org/2000/svg","circle");y.setAttribute("cx",String(e[0][0])),y.setAttribute("cy",String(e[0][1]-b/2)),y.setAttribute("r",String(x/2)),y.setAttribute("fill",n),o.appendChild(y);const N=document.createElementNS("http://www.w3.org/2000/svg","circle");N.setAttribute("cx",String(e[0][0])),N.setAttribute("cy",String(e[0][1]+b/2)),N.setAttribute("r",String(x/2)),N.setAttribute("fill",n),o.appendChild(N)}}return o}const r=sc(e,1,3),a=t*.8,c=t*.4,u=[],d=[];for(let b=0;b<r.length;b++){let x,y;b===0?(x=r[1][0]-r[0][0],y=r[1][1]-r[0][1]):b===r.length-1?(x=r[b][0]-r[b-1][0],y=r[b][1]-r[b-1][1]):(x=r[b+1][0]-r[b-1][0],y=r[b+1][1]-r[b-1][1]);const N=Math.sqrt(x*x+y*y);if(N>0){const w=-y/N,T=x/N,S=a/2;u.push([r[b][0]+w*S,r[b][1]+T*S]),d.push([r[b][0]-w*S,r[b][1]-T*S])}else u.push(r[b]),d.push(r[b])}const m=document.createElementNS("http://www.w3.org/2000/svg","path");let f=`M ${u[0][0]} ${u[0][1]}`;for(let b=1;b<u.length;b++){const x=u[b-1],y=u[b],N=(x[0]+y[0])/2,w=(x[1]+y[1])/2;f+=` Q ${x[0]} ${x[1]} ${N} ${w}`}f+=` L ${u[u.length-1][0]} ${u[u.length-1][1]}`,m.setAttribute("d",f),m.setAttribute("fill","none"),m.setAttribute("stroke",n),m.setAttribute("stroke-width",String(c)),m.setAttribute("stroke-linecap",s),m.setAttribute("stroke-linejoin",s==="square"?"miter":"round"),o.appendChild(m);const h=document.createElementNS("http://www.w3.org/2000/svg","path");let g=`M ${d[0][0]} ${d[0][1]}`;for(let b=1;b<d.length;b++){const x=d[b-1],y=d[b],N=(x[0]+y[0])/2,w=(x[1]+y[1])/2;g+=` Q ${x[0]} ${x[1]} ${N} ${w}`}return g+=` L ${d[d.length-1][0]} ${d[d.length-1][1]}`,h.setAttribute("d",g),h.setAttribute("fill","none"),h.setAttribute("stroke",n),h.setAttribute("stroke-width",String(c)),h.setAttribute("stroke-linecap",s),h.setAttribute("stroke-linejoin",s==="square"?"miter":"round"),o.appendChild(h),o}function C_(e,t,n,i){if(e.length<2)return["",""];const o=[],s=[];for(let c=0;c<e.length;c++){let u,d;c===0?(u=e[1][0]-e[0][0],d=e[1][1]-e[0][1]):c===e.length-1?(u=e[c][0]-e[c-1][0],d=e[c][1]-e[c-1][1]):(u=e[c+1][0]-e[c-1][0],d=e[c+1][1]-e[c-1][1]);const m=Math.sqrt(u*u+d*d);if(m>0){const f=-d/m,h=u/m,g=i/2;o.push([e[c][0]+f*g,e[c][1]+h*g]),s.push([e[c][0]-f*g,e[c][1]-h*g])}else o.push(e[c]),s.push(e[c])}const r=Um(o,t,n),a=Um(s,t,n);return[r,a]}function Um(e,t,n){if(e.length<2)return"";const i=[],o=[];for(let r=0;r<e.length;r++){const a=t[r]??.5,u=qc(a,n)/2;let d,m;r===0?(d=e[1][0]-e[0][0],m=e[1][1]-e[0][1]):r===e.length-1?(d=e[r][0]-e[r-1][0],m=e[r][1]-e[r-1][1]):(d=e[r+1][0]-e[r-1][0],m=e[r+1][1]-e[r-1][1]);const f=Math.sqrt(d*d+m*m);if(f>0){const h=-m/f,g=d/f;i.push([e[r][0]+h*u,e[r][1]+g*u]),o.push([e[r][0]-h*u,e[r][1]-g*u])}else i.push(e[r]),o.push(e[r])}let s=`M ${i[0][0]} ${i[0][1]}`;for(let r=1;r<i.length;r++){const a=i[r-1],c=i[r],u=(a[0]+c[0])/2,d=(a[1]+c[1])/2;s+=` Q ${a[0]} ${a[1]} ${u} ${d}`}s+=` L ${i[i.length-1][0]} ${i[i.length-1][1]}`,s+=` L ${o[o.length-1][0]} ${o[o.length-1][1]}`;for(let r=o.length-2;r>=0;r--){const a=o[r+1],c=o[r],u=(a[0]+c[0])/2,d=(a[1]+c[1])/2;s+=` Q ${a[0]} ${a[1]} ${u} ${d}`}return s+=` L ${o[0][0]} ${o[0][1]}`,s+=" Z",s}function A_(e,t,n){if(e.length<2)return"";const i=[],o=[];for(let r=0;r<e.length;r++){const a=t[r]??.5,u=qc(a,n)/2;let d,m;r===0?(d=e[1][0]-e[0][0],m=e[1][1]-e[0][1]):r===e.length-1?(d=e[r][0]-e[r-1][0],m=e[r][1]-e[r-1][1]):(d=e[r+1][0]-e[r-1][0],m=e[r+1][1]-e[r-1][1]);const f=Math.sqrt(d*d+m*m);if(f>0){const h=-m/f,g=d/f;i.push([e[r][0]+h*u,e[r][1]+g*u]),o.push([e[r][0]-h*u,e[r][1]-g*u])}else i.push(e[r]),o.push(e[r])}let s=`M ${i[0][0]} ${i[0][1]}`;for(let r=1;r<i.length;r++){const a=i[r-1],c=i[r],u=(a[0]+c[0])/2,d=(a[1]+c[1])/2;s+=` Q ${a[0]} ${a[1]} ${u} ${d}`}s+=` L ${i[i.length-1][0]} ${i[i.length-1][1]}`,s+=` L ${o[o.length-1][0]} ${o[o.length-1][1]}`;for(let r=o.length-2;r>=0;r--){const a=o[r+1],c=o[r],u=(a[0]+c[0])/2,d=(a[1]+c[1])/2;s+=` Q ${a[0]} ${a[1]} ${u} ${d}`}return s+=` L ${o[0][0]} ${o[0][1]}`,s+=" Z",s}class Bc extends Yp{draw(t){const n=xN(t),i=Gp(this.board,t),o=NN(this.board,t),s=yN(this.board,t),r=bf(s,n),a=t.brushShape,c=Rc(a);if(t.pressures&&t.pressures.length>0)return j_(t.points,t.pressures,n,i,s,a);if(s===yn.double)return P_(t.points,n,i,a);const u={strokeWidth:n,stroke:i,fill:o,fillStyle:"solid",strokeLineDash:s!==ei.solid?r:void 0},d=F.getRoughSVG(this.board).curve(sc(t.points,1,3),u);return wN(d,c),d}canDraw(t){return!0}}class M_ extends rc{constructor(){super()}initializeGenerator(){this.activeGenerator=xf(this.board,{getRectangle:t=>zr(t),getStrokeWidth:()=>Nf,getStrokeOpacity:()=>1,hasResizeHandle:()=>yf(this.board,this.element)}),this.generator=new Bc(this.board)}initialize(){super.initialize(),this.initializeGenerator(),this.generator.processDrawing(this.element,this.getElementG())}onContextChanged(t,n){const i=t.board.viewport.zoom!==n.board.viewport.zoom||t.board.viewport.offsetX!==n.board.viewport.offsetX||t.board.viewport.offsetY!==n.board.viewport.offsetY;t.element!==n.element||t.hasThemeChanged?(this.generator.processDrawing(this.element,this.getElementG()),this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected})):i&&t.selected?this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected}):(t.selected!==n.selected||t.selected)&&this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected})}destroy(){var t;super.destroy(),(t=this.activeGenerator)==null||t.destroy()}}class jg{constructor(t={}){this.defaultOptions={smoothing:.65,velocityWeight:.2,curvatureWeight:.3,minDistance:.2,maxPoints:8,pressureSensitivity:.5,tiltSensitivity:.3,velocityThreshold:800,samplingRate:5},this.points=[],this.lastProcessedTime=0,this.movingAverageVelocity=[],this.velocityWindowSize=3,this.options={...this.defaultOptions,...t}}process(t,n={}){const i=n.timestamp??Date.now();if(this.points.length===0){const c={point:t,timestamp:i,...n};return this.points.push(c),this.lastProcessedTime=i,t}if(i-this.lastProcessedTime<this.options.samplingRate&&i-this.lastProcessedTime<2)return null;const o={point:t,timestamp:i,...n};if(!this.checkDistance(t)&&this.points.length>1&&i-this.lastProcessedTime<32)return null;this.updatePoints(o);const r=this.calculateDynamicParameters(o),a=this.smooth(t,r);return this.lastProcessedTime=i,a}reset(){this.points=[],this.lastProcessedTime=0,this.movingAverageVelocity=[]}updatePoints(t){this.points.push(t),this.points.length>this.options.maxPoints&&this.points.shift()}checkDistance(t){if(this.points.length===0)return!0;const n=this.points[this.points.length-1].point,i=this.getDistance(n,t);let o=this.options.minDistance;if(this.movingAverageVelocity.length>0){const s=this.getAverageVelocity();o*=Math.max(.5,Math.min(1.5,s/200))}return i>=o}calculateDynamicParameters(t){const n=this.calculateVelocity(t);this.updateMovingAverage(n);const i=this.getAverageVelocity(),o={...this.options};if(t.pressure!==void 0){const r=Math.pow(t.pressure,1.2);o.smoothing*=1-r*o.pressureSensitivity*.8}const s=Math.min(i/o.velocityThreshold,1);if(o.velocityWeight=.2+s*.3,o.smoothing*=1+s*.2,t.tiltX!==void 0&&t.tiltY!==void 0){const r=Math.sqrt(t.tiltX**2+t.tiltY**2)/90;o.smoothing*=1+r*o.tiltSensitivity*.7}return o}smooth(t,n){if(this.points.length<2)return t;const i=this.calculateWeights(n),o=i.reduce((r,a)=>r+a,0);if(o===0)return t;const s=[0,0];for(let r=0;r<this.points.length;r++){const a=i[r]/o;s[0]+=this.points[r].point[0]*a,s[1]+=this.points[r].point[1]*a}return s}calculateWeights(t){const n=[],i=this.points.length-1;for(let o=0;o<this.points.length;o++){let s=Math.pow(t.smoothing,(i-o)*.8);if(o<i){const r=this.getPointVelocity(o);s*=1+r*t.velocityWeight*.8}if(o>0&&o<i){const r=this.getPointCurvature(o);s*=1+r*t.curvatureWeight*.7}n.push(s)}return n}getDistance(t,n){return sr(t[0],t[1],n[0],n[1])}calculateVelocity(t){if(this.points.length<2)return 0;const n=this.points[this.points.length-1],i=this.getDistance(n.point,t.point),o=t.timestamp-n.timestamp;return o>0?i/o:0}updateMovingAverage(t){this.movingAverageVelocity.push(t),this.movingAverageVelocity.length>this.velocityWindowSize&&this.movingAverageVelocity.shift()}getAverageVelocity(){return this.movingAverageVelocity.length===0?0:this.movingAverageVelocity.reduce((t,n)=>t+n)/this.movingAverageVelocity.length}getPointVelocity(t){if(t>=this.points.length-1)return 0;const n=this.points[t],i=this.points[t+1],o=this.getDistance(n.point,i.point),s=i.timestamp-n.timestamp;return s>0?o/s:0}getPointCurvature(t){if(t<=0||t>=this.points.length-1)return 0;const n=this.points[t-1].point,i=this.points[t].point,o=this.points[t+1].point,s=this.getDistance(n,i),r=this.getDistance(i,o),a=this.getDistance(n,o),c=(s+r+a)/2;return 4*Math.sqrt(Math.max(0,c*(c-s)*(c-r)*(c-a)))/(s*r*a+1e-4)}}const I_=e=>{const{pointerDown:t,pointerMove:n,pointerUp:i,globalPointerUp:o}=e;let s=!1,r=!1,a=[],c=[],u=null;const d=new Bc(e),m=new jg({smoothing:.7,pressureSensitivity:.6});let f=null,h=null,g=null,b=0;const x=(w=!1)=>{if(!h||w){const T=si(e);h={strokeWidth:T.strokeWidth,strokeColor:T.strokeColor,strokeStyle:T.strokeStyle,pencilShape:T.pencilShape,pressureEnabled:T.pressureEnabled}}return h},y=(w,T)=>{if(!T)return 1;if(w.pointerType==="pen"&&w.pressure>0&&w.pressure!==.5)return w.pressure;const v=[w.x,w.y],E=performance.now();if(g&&b>0){const U=v[0]-g[0],q=v[1]-g[1],$=Math.sqrt(U*U+q*q),V=E-b;if(V>0){const R=$/V,M=.2,_=1,P=Math.min(R/1.5,1),Z=_-P*(_-M);return g=v,b=E,Z}}return g=v,b=E,.6},N=w=>{if(s){const T=F.getPointer(e);r&&(a.push(a[0]),c.length>0&&c.push(c[0]));const S=x();f=Qa(T,a,{strokeWidth:S.strokeWidth,strokeColor:S.strokeColor,strokeStyle:S.strokeStyle,brushShape:S.pencilShape,pressures:S.pressureEnabled?c:void 0})}f&&!w&&ue.insertNode(e,f,[e.children.length]),d==null||d.destroy(),f=null,s=!1,a=[],c=[],g=null,b=0,h=null,m.reset()};return e.pointerDown=w=>{const T=ac();if(F.isInPointer(e,T)&&lc(e)){s=!0;const v=x(!0);u=[w.x,w.y];const E=m.process(u);if(E){const U=Ft(e,Ht(e,E[0],E[1]));a.push(U),c.push(y(w,v.pressureEnabled))}}t(w)},e.pointerMove=w=>{if(s){const T=[w.x,w.y];u&&sr(u[0],u[1],T[0],T[1])<8?r=!0:r=!1;const S=m.process(T);if(S){d==null||d.destroy();const v=Ft(e,Ht(e,S[0],S[1]));a.push(v);const E=x();c.push(y(w,E.pressureEnabled));const U=F.getPointer(e);f=Qa(U,a,{strokeWidth:E.strokeWidth,strokeColor:E.strokeColor,strokeStyle:E.strokeStyle,brushShape:E.pencilShape,pressures:E.pressureEnabled?c:void 0}),d.processDrawing(f,F.getElementTopHost(e))}return}n(w)},e.pointerUp=w=>{N(),i(w)},e.globalPointerUp=w=>{N(!0),o(w)},e},V_=e=>{const t=e,{getDeletedFragment:n,buildFragment:i,insertFragment:o}=t;return t.getDeletedFragment=s=>{const r=ku(t);return r.length&&s.push(...r),n(s)},t.buildFragment=(s,r,a,c)=>{const u=ku(t);if(u.length){const d=wf(t,u,r?[r.x,r.y]:[0,0]);s=vf(s,{text:"",type:Ef.elements,elements:d})}return i(s,r,a,c)},t.insertFragment=(s,r,a)=>{var u;const c=(u=s==null?void 0:s.elements)==null?void 0:u.filter(d=>$e.isFreehand(d));c&&c.length>0&&kf(t,c,r),o(s,r,a)},t};function U_(e,t,n,i=0){const o=ge.getCenterPoint(t),s=Ai(t,ui);if(i){const r=R_(n,o,-i);let a=s.find(c=>ge.isHit(ge.getRectangleByPoints([r,r]),c.rectangle));return a&&(a.cursorClass=Gr(a.cursorClass,i)),a}else return s.find(r=>ge.isHit(ge.getRectangleByPoints([n,n]),r.rectangle))}function R_(e,t,n){const i=n*Math.PI/180,o=Math.cos(i),s=Math.sin(i),r=e[0]-t[0],a=e[1]-t[1];return[t[0]+r*o-a*s,t[1]+r*s+a*o]}function Pg(e){const t=Be(e);return t.length===1&&$e.isFreehand(t[0])?t[0]:null}function q_(e){return Pg(e)!==null}function B_(e,t){const n=Pg(e);if(!n)return null;const i=zr(n),o=n.angle||0,s=U_(e,i,t,o);return s?{element:n,rectangle:i,handle:s.handle,cursorClass:s.cursorClass}:null}function L_(e,t,n){const i=n.width/t.width,o=n.height/t.height;return e.map(s=>{const r=s[0]-t.x,a=s[1]-t.y;return[n.x+r*i,n.y+a*o]})}function O_(e,t,n){const{element:i,rectangle:o,handle:s}=t,{startPoint:r,endPoint:a}=n;if(!o)return;const c=a[0]-r[0],u=a[1]-r[1],d=xo(o,s,c,u,hs(),10),m=L_(i.points,o,d),f=e.children.findIndex(h=>h.id===i.id);f>=0&&ue.setNode(e,{points:m},[f])}const F_=e=>Ci(e,{key:"freehand",canResize:()=>q_(e),hitTest:(t=>B_(e,t)),onResize:(t,n)=>O_(e,t,n)});function H_(e){return e.type==="video"}const ms=1e3;async function Lc(){const e=await Me(()=>import("./clipper-B4i11tN1.js").then(t=>t.c),__vite__mapDeps([0]),import.meta.url);return e.default||e}function ps(e){return e.map(t=>({X:Math.round(t[0]*ms),Y:Math.round(t[1]*ms)}))}function Cg(e){return e.map(t=>[t.X/ms,t.Y/ms])}async function z_(e,t,n=Su.circle){if(e.length<2)return[];const i=await Lc(),o=ps(e),s=new i.ClipperOffset;n===Su.square?s.AddPath(o,i.JoinType.jtMiter,i.EndType.etOpenSquare):s.AddPath(o,i.JoinType.jtRound,i.EndType.etOpenRound);const r=[];return s.Execute(r,t/2*ms),r.length===0?[]:Cg(r[0])}function Oc(e){const t=e.points;if(!t||t.length<3)return!1;const n=t[0],i=t[t.length-1];return Math.hypot(i[0]-n[0],i[1]-n[1])<=10}function G_(e,t=20){if(Je.isPenPath(e)){if(!e.closed)return null;const n=Zp(e);return vN(n,!0,t)}if($e.isFreehand(e)){const n=e.points;return!n||n.length<3||!Oc(e)?null:n}return H.isDrawElement(e)&&H.isShapeElement(e)?H.isImage(e)||H.isText(e)?null:W_(e,t):null}function W_(e,t=20){const n=e.points;if(!n||n.length<2)return[];const[i,o]=n,s=Math.min(i[0],o[0]),r=Math.min(i[1],o[1]),a=Math.abs(o[0]-i[0]),c=Math.abs(o[1]-i[1]),u=e.shape;if(u==="ellipse"||u==="circle"){const d=s+a/2,m=r+c/2,f=a/2,h=c/2,g=[],b=Math.PI*(3*(f+h)-Math.sqrt((3*f+h)*(f+3*h))),x=Math.max(180,Math.ceil(b/2));for(let y=0;y<x;y++){const N=2*Math.PI*y/x;g.push([d+f*Math.cos(N),m+h*Math.sin(N)])}return g}return[[s,r],[s+a,r],[s+a,r+c],[s,r+c]]}function $_(e,t,n,i){if(e.length<3)throw new Error("Polygon must have at least 3 points");let o=1/0,s=1/0,r=-1/0,a=-1/0;for(const m of e)o=Math.min(o,m[0]),s=Math.min(s,m[1]),r=Math.max(r,m[0]),a=Math.max(a,m[1]);const c=[o,s],u=e.map(m=>({point:[m[0]-c[0],m[1]-c[1]],type:"corner"}));return{id:EN(),type:Sf,shape:Ln.pen,points:[c,[r,a]],anchors:u,closed:!0,strokeColor:t,fill:n,strokeWidth:i}}function X_(e){let t="#333333",n="#FFFFFF",i=2;return Je.isPenPath(e)?(t=e.strokeColor||t,n=e.fill||n,i=e.strokeWidth||i):$e.isFreehand(e)?(t=e.strokeColor||t,i=e.strokeWidth||i):H.isDrawElement(e)&&(t=e.strokeColor||t,n=e.fill||n,i=e.strokeWidth||i),{strokeColor:t,fill:n,strokeWidth:i}}async function K_(e,t){const n=await Lc(),i=new n.Clipper,o=[];return i.AddPath(ps(e),n.PolyType.ptSubject,!0),i.AddPath(ps(t),n.PolyType.ptClip,!0),i.Execute(n.ClipType.ctIntersection,o,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),o.length>0}async function Y_(e,t,n){const i=G_(t);if(!i||i.length<3||!await K_(i,n))return null;const s=await Lc(),r=new s.Clipper,a=[];if(r.AddPath(ps(i),s.PolyType.ptSubject,!0),r.AddPath(ps(n),s.PolyType.ptClip,!0),!r.Execute(s.ClipType.ctDifference,a,s.PolyFillType.pftNonZero,s.PolyFillType.pftNonZero))return null;const{strokeColor:u,fill:d,strokeWidth:m}=X_(t),f=[];for(const N of a)if(N.length>=3){let w=0;for(let T=0;T<N.length;T++){const S=(T+1)%N.length;w+=N[T].X*N[S].Y,w-=N[S].X*N[T].Y}w=w/2,f.push({path:N,signedArea:w,absArea:Math.abs(w)})}if(f.length===0)return[];const h=[...f].sort((N,w)=>w.absArea-N.absArea),g=h[0],b=h.slice(1);let x;b.length>0?x=Z_(g.path,b.map(N=>N.path)):x=g.path;const y=Cg(x);try{return[$_(y,u,d,m)]}catch{return[]}}function Z_(e,t){let n=[...e];for(const i of t){let o=1/0,s=0,r=0;for(let c=0;c<n.length;c++)for(let u=0;u<i.length;u++){const d=n[c].X-i[u].X,m=n[c].Y-i[u].Y,f=d*d+m*m;f<o&&(o=f,s=c,r=u)}const a=[];for(let c=0;c<=s;c++)a.push(n[c]);for(let c=0;c<i.length;c++){const u=(r+c)%i.length;a.push(i[u])}a.push(i[r]);for(let c=s;c<n.length;c++)a.push(n[c]);n=a}return n}function Ag(e){if($e.isFreehand(e)){const o=e.points;if(!o||o.length<2)return null;const s=ge.getRectangleByPoints(o),r=e.strokeWidth??2,a=r/2;return{x:s.x-a,y:s.y-a,width:s.width+r,height:s.height+r}}if(Je.isPenPath(e)){const o=e.points;if(!o||o.length<2)return null;const[s,r]=o;return{x:Math.min(s[0],r[0]),y:Math.min(s[1],r[1]),width:Math.abs(r[0]-s[0]),height:Math.abs(r[1]-s[1])}}const t=e.points;if(!t||t.length<2)return null;const[n,i]=t;return{x:Math.min(n[0],i[0]),y:Math.min(n[1],i[1]),width:Math.abs(i[0]-n[0]),height:Math.abs(i[1]-n[1])}}function Q_(e,t,n){if(t.length<2)return[];let i=1/0,o=1/0,s=-1/0,r=-1/0;for(const c of t)i=Math.min(i,c[0]-n),o=Math.min(o,c[1]-n),s=Math.max(s,c[0]+n),r=Math.max(r,c[1]+n);const a=[];for(const c of e.children){if(!J_(c))continue;const u=Ag(c);if(!u)continue;const{x:d,y:m,width:f,height:h}=u;d+f>=i&&d<=s&&m+h>=o&&m<=r&&a.push(c)}return a}function J_(e){return Je.isPenPath(e)?e.closed:$e.isFreehand(e)?Oc(e):H.isDrawElement(e)?H.isImage(e)||H.isText(e)||H.isArrowLine(e)||H.isVectorLine(e)?!1:H.isShapeElement(e):!1}function ej(e){if(Je.isPenPath(e))return e.closed?null:"openPath";if($e.isFreehand(e))return Oc(e)?null:"openPath";if(H.isDrawElement(e)){if(H.isImage(e))return"image";if(H.isText(e))return"text";if(H.isArrowLine(e))return"arrowLine";if(H.isVectorLine(e))return"vectorLine";if(H.isShapeElement(e))return null}return"unsupported"}function tj(e,t,n){if(t.length<2)return[];let i=1/0,o=1/0,s=-1/0,r=-1/0;for(const c of t)i=Math.min(i,c[0]-n),o=Math.min(o,c[1]-n),s=Math.max(s,c[0]+n),r=Math.max(r,c[1]+n);const a=[];for(const c of e.children){const u=Ag(c);if(!u)continue;const{x:d,y:m,width:f,height:h}=u;d+f>=i&&d<=s&&m+h>=o&&m<=r&&ej(c)&&a.push(c)}return a}async function nj(e,t,n,i,o){if(o.length===0)return;const s=await z_(t,n,i);if(s.length<3)return;const r=[],a=[];for(const c of o){const u=await Y_(e,c,s);u!==null&&(r.push(c),a.push(...u))}r.length>0&&Ja.removeElements(e,r);for(const c of a)ue.insertNode(e,c,[e.children.length])}const ij=e=>{const{pointerDown:t,pointerMove:n,pointerUp:i,globalPointerUp:o}=e;let s=!1;const r=new Set;let a=[];const c=m=>{const f=Ft(e,Ht(e,m[0],m[1])),g=si(e).eraserWidth/2;e.children.filter(x=>$e.isFreehand(x)).forEach(x=>{!r.has(x.id)&&kN(e,x,f,g)&&(Zi.getElementG(x).style.opacity="0.2",r.add(x.id))})},u=()=>{if(r.size>0){const m=e.children.filter(f=>r.has(f.id));m.length>0&&Ja.removeElements(e,m)}},d=async()=>{if(s){if(u(),a.length>=2){const m=si(e),f=Q_(e,a,m.eraserWidth).filter(g=>!$e.isFreehand(g));if(f.length>0)try{await nj(e,a,m.eraserWidth,m.eraserShape,f)}catch(g){console.error("Precise erase error:",g)}const h=tj(e,a,m.eraserWidth).filter(g=>!$e.isFreehand(g)&&!wi(g)&&!H_(g)&&!(H.isDrawElement(g)&&H.isImage(g)));h.length>0&&Ja.removeElements(e,h)}s=!1,r.clear(),a=[]}};return e.pointerDown=m=>{if(F.isInPointer(e,[rt.eraser])&&lc(e)){s=!0,r.clear(),a=[];const h=[m.x,m.y],g=Ft(e,Ht(e,h[0],h[1]));a.push(g),c(h);return}t(m)},e.pointerMove=m=>{if(s){Ql(e,"with-freehand-erase",()=>{const f=[m.x,m.y],h=Ft(e,Ht(e,f[0],f[1]));a.push(h),c(f)});return}n(m)},e.pointerUp=m=>{if(s){d();return}i(m)},e.globalPointerUp=m=>{if(s){d();return}o(m)},e},oj="#e91e63",sj=3,Rm=2e3,rj=e=>{const{pointerDown:t,pointerMove:n,pointerUp:i,globalPointerUp:o}=e;let s=!1,r=[];const a=new Bc(e),c=new jg({smoothing:.7,pressureSensitivity:0});let u=null;const d=[],m=()=>F.isPointer(e,rt.laserPointer),f=()=>{if(!s)return;s=!1;const g=a.g;g?(a.g=void 0,h(g)):a.destroy(),u=null,r=[],c.reset()},h=g=>{g.style.transition=`opacity ${Rm}ms ease-out`,g.style.opacity="1",g.getBoundingClientRect(),g.style.opacity="0";const b=window.setTimeout(()=>{g.remove();const x=d.findIndex(y=>y.g===g);x>=0&&d.splice(x,1)},Rm);d.push({g,timer:b})};return e.pointerDown=g=>{if(m()&&lc(e)){s=!0;const b=[g.x,g.y],x=c.process(b);if(x){const y=Ft(e,Ht(e,x[0],x[1]));r.push(y)}return}t(g)},e.pointerMove=g=>{if(s){const b=[g.x,g.y],x=c.process(b);if(x){a.destroy();const y=Ft(e,Ht(e,x[0],x[1]));r.push(y),u=Qa(rt.laserPointer,r,{strokeWidth:sj,strokeColor:oj}),a.processDrawing(u,F.getElementTopHost(e))}return}n(g)},e.pointerUp=g=>{s&&f(),i(g)},e.globalPointerUp=g=>{s&&f(),o(g)},e},aj=e=>{const{getRectangle:t,drawElement:n,isHit:i,isRectangleHit:o,getOneHitElement:s,isMovable:r,isAlign:a}=e;return e.drawElement=c=>$e.isFreehand(c.element)?M_:n(c),e.getRectangle=c=>$e.isFreehand(c)?zr(c):t(c),e.isRectangleHit=(c,u)=>$e.isFreehand(c)?SN(e,c,u):o(c,u),e.isHit=(c,u,d)=>$e.isFreehand(c)?TN(e,c,u):i(c,u,d),e.getOneHitElement=c=>c.every(d=>$e.isFreehand(d))?Tf(e,c):s(c),e.isMovable=c=>$e.isFreehand(c)?!0:r(c),e.isAlign=c=>$e.isFreehand(c)?!0:a(c),e.setPluginOptions(Df,{customGeometryTypes:[DN]}),rj(F_(ij(V_(I_(e)))))};class lj extends rc{constructor(){super()}initializeGenerator(){this.activeGenerator=xf(this.board,{getRectangle:t=>Wr(t),getStrokeWidth:()=>Nf,getStrokeOpacity:()=>1,hasResizeHandle:()=>yf(this.board,this.element)}),this.generator=new n_(this.board)}initialize(){super.initialize(),this.initializeGenerator(),this.generator.processDrawing(this.element,this.getElementG()),this.selected&&this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected})}onContextChanged(t,n){const i=t.board.viewport.zoom!==n.board.viewport.zoom||t.board.viewport.offsetX!==n.board.viewport.offsetX||t.board.viewport.offsetY!==n.board.viewport.offsetY;t.element!==n.element||t.hasThemeChanged?(this.generator.processDrawing(this.element,this.getElementG()),this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected})):i&&t.selected?this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected}):(t.selected!==n.selected||t.selected)&&this.activeGenerator.processDrawing(this.element,F.getActiveHost(this.board),{selected:this.selected})}destroy(){var t;super.destroy(),(t=this.activeGenerator)==null||t.destroy()}}const cj=e=>e,uj=e=>{const t=e,{getDeletedFragment:n,buildFragment:i,insertFragment:o}=t;return t.getDeletedFragment=s=>{const r=Tu(t);return r.length&&s.push(...r),n(s)},t.buildFragment=(s,r,a,c)=>{const u=Tu(t);if(u.length){const d=wf(t,u,r?[r.x,r.y]:[0,0]);s=vf(s,{text:"",type:Ef.elements,elements:d})}return i(s,r,a,c)},t.insertFragment=(s,r,a)=>{var u;const c=(u=s==null?void 0:s.elements)==null?void 0:u.filter(d=>Je.isPenPath(d));c&&c.length>0&&kf(t,c,r),o(s,r,a)},t};function dj(e,t,n,i=0){const o=ge.getCenterPoint(t),s=Ai(t,ui);if(i){const r=mj(n,o,-i);let a=s.find(c=>ge.isHit(ge.getRectangleByPoints([r,r]),c.rectangle));return a&&(a.cursorClass=Gr(a.cursorClass,i)),a}else return s.find(r=>ge.isHit(ge.getRectangleByPoints([n,n]),r.rectangle))}function mj(e,t,n){const i=n*Math.PI/180,o=Math.cos(i),s=Math.sin(i),r=e[0]-t[0],a=e[1]-t[1];return[t[0]+r*o-a*s,t[1]+r*s+a*o]}function Mg(e){const t=Be(e);return t.length===1&&Je.isPenPath(t[0])?t[0]:null}function pj(e){return Mg(e)!==null}function fj(e,t){const n=Mg(e);if(!n)return null;const i=Wr(n),o=n.angle||0,s=dj(e,i,t,o);return s?{element:n,rectangle:i,handle:s.handle,cursorClass:s.cursorClass}:null}function hj(e,t,n){return e.map(i=>({...i,point:[i.point[0]*t,i.point[1]*n],handleIn:i.handleIn?[i.handleIn[0]*t,i.handleIn[1]*n]:void 0,handleOut:i.handleOut?[i.handleOut[0]*t,i.handleOut[1]*n]:void 0}))}function gj(e,t,n){const{element:i,rectangle:o,handle:s}=t,{startPoint:r,endPoint:a}=n;if(!o)return;const c=a[0]-r[0],u=a[1]-r[1],d=xo(o,s,c,u,hs(),10),m=d.width/o.width,f=d.height/o.height,h=hj(i.anchors,m,f),b=[[d.x,d.y],[d.x+d.width,d.y+d.height]],x=e.children.findIndex(y=>y.id===i.id);x>=0&&ue.setNode(e,{points:b,anchors:h},[x])}const bj=e=>Ci(e,{key:"pen-path",canResize:()=>pj(e),hitTest:(t=>fj(e,t)),onResize:(t,n)=>gj(e,t,n)}),xj=e=>{const{getRectangle:t,drawElement:n,isHit:i,isRectangleHit:o,getOneHitElement:s,isMovable:r,isAlign:a}=e;return e.drawElement=c=>Je.isPenPath(c.element)?lj:n(c),e.getRectangle=c=>Je.isPenPath(c)?Wr(c):t(c),e.isRectangleHit=(c,u)=>Je.isPenPath(c)?_N(e,c,u):o(c,u),e.isHit=(c,u,d)=>Je.isPenPath(c)?jN(e,c,u):i(c,u,d),e.getOneHitElement=c=>c.every(d=>Je.isPenPath(d))?Tf(e,c):s(c),e.isMovable=c=>Je.isPenPath(c)?!0:r(c),e.isAlign=c=>Je.isPenPath(c)?!0:a(c),e.setPluginOptions(Df,{customGeometryTypes:[Sf]}),bj(uj(cj(c_(e))))},Ig=new WeakMap,qm=e=>!!Ig.get(e),Vg=(e,t)=>{Ig.set(e,t)},Nj=e=>n=>{const{pointerDown:i}=n;return n.pointerDown=o=>{Du(o)&&!qm(n)&&(Vg(n,!0),e({isPencilMode:!0})),!(qm(n)&&!Du(o))&&i(o)},n},yj=()=>{const e=xt(),{appState:t,setAppState:n}=Wt();return l.jsxDEV(l.Fragment,{children:t.isPencilMode&&l.jsxDEV("div",{className:"pencil-mode-toolbar",children:l.jsxDEV(ne,{type:"button",visible:!0,tooltip:"X Pencil","aria-label":"Arrow",label:"Pencil X",onPointerDown:()=>{n({...t,isPencilMode:!1}),Vg(e,!1)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-mode-toolbar.tsx",lineNumber:13,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-mode-toolbar.tsx",lineNumber:12,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-mode-toolbar.tsx",lineNumber:10,columnNumber:5},void 0)},wj="#f5f5f5";function vj(e,t){const n=Math.max(4,Math.min(256,t)),i=n+4,o=i/2,s=n/2,r=`<svg width="${i}" height="${i}" viewBox="0 0 ${i} ${i}" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
61
|
-
<circle cx="${o}" cy="${o}" r="${s}" fill="${e}" stroke="#fff" stroke-width="1"/>
|
|
62
|
-
<circle cx="${o}" cy="${o}" r="${s}" fill="none" stroke="#333" stroke-width="0.5" stroke-opacity="0.5"/>
|
|
63
|
-
</svg>`;return`url('data:image/svg+xml;base64,${btoa(r)}') ${o} ${o}, crosshair`}function Ej(e,t){const n=Math.max(4,Math.min(256,t)),i=n+4,o=i/2,s=n/2,r=`<svg width="${i}" height="${i}" viewBox="0 0 ${i} ${i}" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
64
|
-
<rect x="${o-s}" y="${o-s}" width="${n}" height="${n}" fill="${e}" stroke="#fff" stroke-width="1"/>
|
|
65
|
-
<rect x="${o-s}" y="${o-s}" width="${n}" height="${n}" fill="none" stroke="#333" stroke-width="0.5" stroke-opacity="0.5"/>
|
|
66
|
-
</svg>`;return`url('data:image/svg+xml;base64,${btoa(r)}') ${o} ${o}, crosshair`}function Bm(e,t,n=qt.circle){return n===qt.square?Ej(e,t):vj(e,t)}function Ug(e){return ac().includes(e)&&e!==rt.eraser}function Rg(e){return e===rt.eraser}function Wo(e,t){var r;const n=document.querySelector(".plait-board-container"),i=n==null?void 0:n.querySelector(".board-host-svg");if(!i)return;const o=si(e),s=((r=e.viewport)==null?void 0:r.zoom)||1;if(Ug(t)){const a=o.strokeWidth*s,c=Bm(o.strokeColor,a,o.pencilShape);i.style.cursor=c}else if(Rg(t)){const a=o.eraserWidth*s,c=Bm(wj,a,o.eraserShape);i.style.cursor=c}else t===De.text?i.style.cursor="crosshair":i.style.cursor=""}function kj({board:e,pointer:t}){const n=p.useRef(1),i=p.useRef(null);return p.useEffect(()=>{var r;if(!e)return;Wo(e,t),n.current=((r=e.viewport)==null?void 0:r.zoom)||1;let s=null;return(Ug(t)||Rg(t))&&(s=setInterval(()=>{var c;const a=((c=e.viewport)==null?void 0:c.zoom)||1;Math.abs(a-n.current)>.01&&(n.current=a,Wo(e,t))},100)),()=>{s&&clearInterval(s),i.current&&cancelAnimationFrame(i.current);const a=document.querySelector(".plait-board-container"),c=a==null?void 0:a.querySelector(".board-host-svg");c&&(c.style.cursor="")}},[e,t]),{updateCursor:p.useCallback(()=>{e&&Wo(e,t)},[e,t])}}function qs(e,t){Wo(e,t)}function Lm(e){Wo(e,rt.eraser)}const Sj=({color:e,size:t,zoom:n,shape:i=qt.circle})=>{const o=t*n,s=Math.max(4,Math.min(256,o)),r=i===qt.circle?"50%":"0";return l.jsxDEV("div",{className:"cursor-preview-dot",style:{width:s,height:s,backgroundColor:e,borderRadius:r}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:56,columnNumber:5},void 0)},Tj=()=>{var pe;const e=xt(),{appState:t}=Wt(),{t:n}=ke(),i=p.useRef(null);Hr(i,{enablePositionTracking:!0,enableScaleCompensation:!0});const o=si(e),[s,r]=p.useState(o.strokeWidth),[a,c]=p.useState(o.strokeColor),[u,d]=p.useState(o.strokeStyle),[m,f]=p.useState(o.pencilShape),[h,g]=p.useState(o.pressureEnabled),[b,x]=p.useState(!1),[y,N]=p.useState(!1),[w,T]=p.useState(String(o.strokeWidth)),[S,v]=p.useState(!1),U=ac().includes(t.pointer)&&t.pointer!==rt.eraser;p.useEffect(()=>{const A=si(e);r(A.strokeWidth),c(A.strokeColor),d(A.strokeStyle),f(A.pencilShape),g(A.pressureEnabled),T(String(A.strokeWidth))},[e,t.pointer]);const q=p.useCallback(A=>{T(A.target.value)},[]),$=p.useCallback(()=>{const A=parseInt(w,10);!isNaN(A)&&A>=1&&A<=100?(A!==s&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"pencil_stroke_width_changed",control:"stroke_width_input",value:A,source:"pencil_settings_toolbar",metadata:{previousValue:s}}),r(A),_u(e,A),qs(e,t.pointer)):T(String(s))},[e,w,s,t.pointer]),V=p.useCallback(A=>{A.key==="Enter"?($(),A.target.blur()):A.key==="Escape"&&(T(String(s)),A.target.blur())},[$,s]),R=p.useCallback(A=>{A!==a&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"pencil_color_changed",control:"stroke_color_picker",value:"custom",source:"pencil_settings_toolbar",metadata:{hasColor:!!A}}),c(A),PN(e,A),qs(e,t.pointer)},[e,t.pointer,a]),M=p.useCallback(A=>{A!==u&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"pencil_stroke_style_changed",control:"stroke_style_button",value:A,source:"pencil_settings_toolbar"}),d(A),CN(e,A)},[e,u]),_=p.useCallback(A=>{A!==m&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"pencil_shape_changed",control:"brush_shape_button",value:A,source:"pencil_settings_toolbar"}),f(A),AN(e,A),qs(e,t.pointer)},[e,t.pointer,m]),I=p.useCallback(A=>{A!==h&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"pencil_pressure_changed",control:"pressure_switch",value:A,source:"pencil_settings_toolbar"}),g(A),MN(e,A)},[e,h]);if(!U)return null;const P=F.getBoardContainer(e),Z=((pe=e.viewport)==null?void 0:pe.zoom)??1;return l.jsxDEV("div",{className:"pencil-settings-toolbar",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[S&&l.jsxDEV(Sj,{color:a||ju,size:s,zoom:Z,shape:m},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:255,columnNumber:9},void 0),l.jsxDEV(Ye,{ref:i,padding:1,children:l.jsxDEV(ft.Row,{gap:0,align:"center",children:[l.jsxDEV(at,{sideOffset:12,open:b,onOpenChange:x,placement:"bottom",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:"pencil-color-button",type:"button",visible:!0,tooltip:n("toolbar.strokeColor"),"aria-label":n("toolbar.strokeColor"),onPointerUp:()=>x(!b),children:l.jsxDEV("div",{className:"pencil-color-preview",style:{backgroundColor:a||ju}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:280,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:272,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:271,columnNumber:13},void 0),l.jsxDEV(ct,{container:P,children:l.jsxDEV(Ye,{padding:4,className:Y("stroke-setting"),children:l.jsxDEV(Si,{value:a,onChange:R},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:288,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:287,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:286,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:265,columnNumber:11},void 0),l.jsxDEV("div",{className:"pencil-stroke-style-picker",children:[l.jsxDEV(ne,{className:Y("pencil-stroke-style-button",{active:u===yn.solid}),type:"button",visible:!0,icon:l.jsxDEV(jp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:304,columnNumber:21},void 0),tooltip:"实线","aria-label":"实线",onPointerUp:()=>M(yn.solid)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:298,columnNumber:13},void 0),l.jsxDEV(ne,{className:Y("pencil-stroke-style-button",{active:u===yn.dashed}),type:"button",visible:!0,icon:l.jsxDEV(Pp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:317,columnNumber:21},void 0),tooltip:"虚线","aria-label":"虚线",onPointerUp:()=>M(yn.dashed)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:311,columnNumber:13},void 0),l.jsxDEV(ne,{className:Y("pencil-stroke-style-button",{active:u===yn.dotted}),type:"button",visible:!0,icon:l.jsxDEV(Cp,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:330,columnNumber:21},void 0),tooltip:"点线","aria-label":"点线",onPointerUp:()=>M(yn.dotted)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:324,columnNumber:13},void 0),l.jsxDEV(ne,{className:Y("pencil-stroke-style-button",{active:u===yn.double}),type:"button",visible:!0,icon:l.jsxDEV(IN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:343,columnNumber:21},void 0),tooltip:"双层线","aria-label":"双层线",onPointerUp:()=>M(yn.double)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:337,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:297,columnNumber:11},void 0),l.jsxDEV("div",{className:"pencil-shape-picker",children:[l.jsxDEV(Dt,{content:n("toolbar.pencilShape.circle"),children:l.jsxDEV(lr,{variant:"text",size:"small",className:`pencil-shape-button ${m===qt.circle?"active":""}`,onClick:()=>_(qt.circle),children:l.jsxDEV(_f,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:363,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:355,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:354,columnNumber:13},void 0),l.jsxDEV(Dt,{content:n("toolbar.pencilShape.square"),children:l.jsxDEV(lr,{variant:"text",size:"small",className:`pencil-shape-button ${m===qt.square?"active":""}`,onClick:()=>_(qt.square),children:l.jsxDEV(jf,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:375,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:367,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:366,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:353,columnNumber:11},void 0),l.jsxDEV(at,{sideOffset:12,open:y,onOpenChange:N,placement:"bottom",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:"pencil-width-button",type:"button",visible:!0,tooltip:n("toolbar.strokeWidth"),"aria-label":n("toolbar.strokeWidth"),onPointerUp:()=>N(!y),children:l.jsxDEV("svg",{className:"pencil-width-icon",viewBox:"0 0 24 24",children:[l.jsxDEV("line",{x1:"4",y1:"8",x2:"20",y2:"8",strokeWidth:"1",stroke:"currentColor"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:397,columnNumber:19},void 0),l.jsxDEV("line",{x1:"4",y1:"12",x2:"20",y2:"12",strokeWidth:"2",stroke:"currentColor"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:405,columnNumber:19},void 0),l.jsxDEV("line",{x1:"4",y1:"16",x2:"20",y2:"16",strokeWidth:"3",stroke:"currentColor"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:413,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:396,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:388,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:387,columnNumber:13},void 0),l.jsxDEV(ct,{container:P,children:l.jsxDEV(Ye,{padding:4,className:Y("stroke-width-picker"),children:l.jsxDEV(ft.Row,{gap:3,align:"center",style:{padding:"4px 8px"},children:[l.jsxDEV("div",{className:"stroke-width-value",style:{minWidth:"40px",fontSize:"13px",fontWeight:500,color:"var(--color-on-surface)"},children:[s,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:431,columnNumber:19},void 0),l.jsxDEV("div",{className:"stroke-width-slider-wrapper",style:{flex:1,minWidth:"160px"},children:l.jsxDEV(Ar,{value:s,min:1,max:100,step:1,onChange:A=>{const G=A;r(G),T(String(G)),_u(e,G),qs(e,t.pointer)},label:!1},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:446,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:442,columnNumber:19},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:426,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:425,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:424,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:381,columnNumber:11},void 0),l.jsxDEV("div",{className:"pencil-width-input-wrapper",children:[l.jsxDEV("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:w,onChange:q,onBlur:$,onKeyDown:V,className:"pencil-width-input"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:468,columnNumber:13},void 0),l.jsxDEV("span",{className:"pencil-width-input-unit",children:"px"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:478,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:467,columnNumber:11},void 0),l.jsxDEV(Dt,{content:"压力感应:支持压感笔;鼠标/触控板使用速度模拟(慢=粗,快=细)",children:l.jsxDEV("div",{className:"pencil-pressure-switch",children:l.jsxDEV(VN,{size:"small",value:h,onChange:I},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:484,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:483,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:482,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:263,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:262,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/pencil-settings-toolbar.tsx",lineNumber:248,columnNumber:5},void 0)},Dj=({color:e,size:t,zoom:n,shape:i=qt.circle})=>{const o=t*n,s=Math.max(4,Math.min(256,o)),r=i===qt.circle?"50%":"0";return l.jsxDEV("div",{className:"cursor-preview-dot",style:{width:s,height:s,backgroundColor:e,borderRadius:r}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/cursor-preview.tsx",lineNumber:34,columnNumber:5},void 0)},_j=()=>l.jsxDEV("svg",{className:"size-picker-icon",viewBox:"0 0 24 24",children:[l.jsxDEV("line",{x1:"4",y1:"8",x2:"20",y2:"8",strokeWidth:"1",stroke:"currentColor"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:38,columnNumber:5},void 0),l.jsxDEV("line",{x1:"4",y1:"12",x2:"20",y2:"12",strokeWidth:"2",stroke:"currentColor"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:39,columnNumber:5},void 0),l.jsxDEV("line",{x1:"4",y1:"16",x2:"20",y2:"16",strokeWidth:"3",stroke:"currentColor"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:40,columnNumber:5},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:37,columnNumber:3},void 0),jj=({size:e,onSizeChange:t,onSizeCommit:n,presets:i,previewColor:o,title:s,container:r,icon:a})=>{const{t:c}=ke(),[u,d]=p.useState(!1),[m,f]=p.useState(String(e)),[h,g]=p.useState(e);_n.useEffect(()=>{f(String(e))},[e]),_n.useEffect(()=>{u||g(e)},[u,e]);const b=p.useCallback(w=>{w!==h&&(n==null||n(w),g(w))},[h,n]),x=p.useCallback(w=>{f(w.target.value)},[]),y=p.useCallback(()=>{const w=parseInt(m,10);!isNaN(w)&&w>=1?(t(w),b(w)):f(String(e))},[b,m,e,t]),N=p.useCallback(w=>{w.key==="Enter"?(y(),w.target.blur()):w.key==="Escape"&&(f(String(e)),w.target.blur())},[y,e]);return l.jsxDEV(l.Fragment,{children:[l.jsxDEV(at,{sideOffset:12,open:u,onOpenChange:w=>{w||b(e),d(w)},placement:"bottom",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV(ne,{className:"size-picker-button",type:"button",visible:!0,tooltip:s,"aria-label":s,onPointerUp:()=>d(!u),children:a||l.jsxDEV(_j,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:127,columnNumber:22},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:119,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:118,columnNumber:9},void 0),l.jsxDEV(ct,{container:r,children:l.jsxDEV(Ye,{padding:4,className:Y("size-picker-popover"),children:l.jsxDEV(ft.Row,{gap:3,align:"center",style:{padding:"4px 8px"},children:[l.jsxDEV("div",{className:"size-picker-value",style:{minWidth:"40px",fontSize:"13px",fontWeight:500,color:"var(--color-on-surface)"},children:[e,"px"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:136,columnNumber:15},void 0),l.jsxDEV("div",{className:"size-picker-slider-wrapper",style:{flex:1,minWidth:"160px"},children:l.jsxDEV(Ar,{value:e,min:1,max:Math.max(256,...i),step:1,onChange:w=>{const T=w;f(String(T)),t(T)},label:!1},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:140,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:139,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:135,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:131,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:130,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:107,columnNumber:7},void 0),l.jsxDEV("div",{className:"size-picker-input-wrapper",children:[l.jsxDEV("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:m,onChange:x,onBlur:y,onKeyDown:N,className:"size-picker-input"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:160,columnNumber:9},void 0),l.jsxDEV("span",{className:"size-picker-input-unit",children:"px"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:170,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:159,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/size-picker.tsx",lineNumber:105,columnNumber:5},void 0)},Pj=[16,32,48,64,96,128,192,256],Cj="#f5f5f5",Aj=()=>{var y;const e=xt(),{appState:t}=Wt(),{t:n}=ke(),i=p.useRef(null);Hr(i,{enablePositionTracking:!0,enableScaleCompensation:!0});const o=si(e),[s,r]=p.useState(o.eraserWidth),[a,c]=p.useState(o.eraserShape),[u,d]=p.useState(!1),m=t.pointer===rt.eraser;p.useEffect(()=>{const N=si(e);r(N.eraserWidth),c(N.eraserShape)},[e,t.pointer]);const f=p.useCallback(N=>{r(N),UN(e,N),Lm(e)},[e]),h=p.useCallback(N=>{yt.trackUIInteraction({area:"canvas_tool_settings",action:"eraser_size_changed",control:"eraser_size_picker",value:N,source:"eraser_settings_toolbar"})},[]),g=p.useCallback(N=>{N!==a&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"eraser_shape_changed",control:"eraser_shape_button",value:N,source:"eraser_settings_toolbar"}),c(N),RN(e,N),Lm(e)},[e,a]);if(!m)return null;const b=F.getBoardContainer(e),x=((y=e.viewport)==null?void 0:y.zoom)??1;return l.jsxDEV("div",{className:"pencil-settings-toolbar eraser-settings-toolbar",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[u&&l.jsxDEV(Dj,{color:Cj,size:s,zoom:x,shape:a},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:129,columnNumber:9},void 0),l.jsxDEV(Ye,{ref:i,padding:1,children:l.jsxDEV(ft.Row,{gap:1,align:"center",children:[l.jsxDEV(jj,{size:s,onSizeChange:f,onSizeCommit:h,presets:Pj,previewColor:"#999",title:n("toolbar.eraserSize"),container:b},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:138,columnNumber:11},void 0),l.jsxDEV("div",{className:"toolbar-divider"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:148,columnNumber:11},void 0),l.jsxDEV("div",{className:"eraser-shape-picker",children:[l.jsxDEV(Dt,{content:n("toolbar.eraserShape.circle"),children:l.jsxDEV(lr,{variant:"text",size:"small",className:`eraser-shape-button ${a===qt.circle?"active":""}`,onClick:()=>g(qt.circle),children:l.jsxDEV(_f,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:160,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:152,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:151,columnNumber:13},void 0),l.jsxDEV(Dt,{content:n("toolbar.eraserShape.square"),children:l.jsxDEV(lr,{variant:"text",size:"small",className:`eraser-shape-button ${a===qt.square?"active":""}`,onClick:()=>g(qt.square),children:l.jsxDEV(jf,{size:16},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:172,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:164,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:163,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:150,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:137,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:136,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pencil-settings-toolbar/eraser-settings-toolbar.tsx",lineNumber:122,columnNumber:5},void 0)},Mj=[{icon:l.jsxDEV(BN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:38,columnNumber:11},void 0),type:"corner",titleKey:"toolbar.anchorCorner"},{icon:l.jsxDEV(LN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:43,columnNumber:11},void 0),type:"smooth",titleKey:"toolbar.anchorSmooth"},{icon:l.jsxDEV(ON,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:48,columnNumber:11},void 0),type:"symmetric",titleKey:"toolbar.anchorSymmetric"}],Ij=()=>{const e=xt(),{appState:t}=Wt(),{t:n}=ke(),i=p.useRef(null);Hr(i,{enablePositionTracking:!0,enableScaleCompensation:!0});const o=Za(e),[s,r]=p.useState(o.defaultAnchorType),a=t.pointer===Ln.pen&&e.pointer===Ln.pen;p.useEffect(()=>{const u=Za(e);r(u.defaultAnchorType)},[e,t.pointer,e.pointer]);const c=p.useCallback(u=>{u!==s&&yt.trackUIInteraction({area:"canvas_tool_settings",action:"pen_anchor_type_changed",control:"anchor_type_button",value:u,source:"pen_settings_toolbar"}),r(u),qN(e,u)},[s,e]);return a?l.jsxDEV("div",{className:"pen-settings-toolbar",children:l.jsxDEV(Ye,{ref:i,padding:1,children:l.jsxDEV(ft.Row,{gap:0,align:"center",children:l.jsxDEV("div",{className:"pen-anchor-type-picker",children:Mj.map(u=>l.jsxDEV(ne,{className:Y("pen-anchor-type-button",{active:s===u.type}),type:"button",visible:!0,icon:u.icon,tooltip:n(u.titleKey),"aria-label":n(u.titleKey),onPointerUp:()=>c(u.type)},u.type,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:111,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:109,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:107,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:103,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/pen-settings-toolbar/pen-settings-toolbar.tsx",lineNumber:102,columnNumber:5},void 0):null},Vj=({container:e})=>{const{appState:t,setAppState:n}=Wt(),{t:i}=ke(),o=xt();return l.jsxDEV(FN,{open:t.openCleanConfirm,container:e,title:i("cleanConfirm.title"),description:i("cleanConfirm.description"),confirmText:i("cleanConfirm.ok"),cancelText:i("cleanConfirm.cancel"),danger:!0,onOpenChange:s=>{n({...t,openCleanConfirm:s})},onConfirm:()=>{o.deleteFragment(o.children)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/clean-confirm/clean-confirm.tsx",lineNumber:15,columnNumber:5},void 0)},Om=e=>{const{appState:t}=e;return t&&t.linkState&&t.linkState.isHovering},Fm=e=>{const{appState:t}=e;return t&&t.linkState&&t.linkState.isEditing},Uj=e=>n=>{const{pointerMove:i}=n;let o=null,s=null;return n.pointerMove=r=>{(F.isPointer(n,Et.selection)||F.isPointer(n,Et.hand))&&!es(n)&&!Sp(n)&&!Om(n)&&!Fm(n)&&Ql(n,"with-text-link",()=>{const a=r.target.closest(".plait-board-link");if(a&&a!==o){const c=a.closest(".plait-text-container"),u=En.toSlateNode(void 0,c),d=En.toSlateNode(void 0,a);o=a,e({linkState:{targetDom:a,targetElement:d,editor:u,isEditing:!1,isHovering:!1,isHoveringOrigin:!0}}),clearTimeout(s)}else!a&&o&&(s=setTimeout(()=>{!Om(n)&&!Fm(n)&&e({linkState:null})},300),o=null)}),i(r)},n},Rj=()=>{var x,y,N,w;const[e,t]=p.useState(""),{appState:n,setAppState:i}=Wt(),o=xt(),{refs:s,floatingStyles:r}=Gl({placement:"top",middleware:[Wl(20),$l()]}),a=n.linkState,c=((x=n.linkState)==null?void 0:x.targetDom)||null,u=((y=n.linkState)==null?void 0:y.isEditing)||!1,d=((N=n.linkState)==null?void 0:N.isHoveringOrigin)||!1,m=((w=n.linkState)==null?void 0:w.isHovering)||!1,f=u||d||m,h=p.useRef(n.linkState);p.useEffect(()=>{h.current=n.linkState,n.linkState?t(n.linkState.targetElement.url):t("")},[n.linkState]),p.useEffect(()=>{if(c){const T=c.getBoundingClientRect();s.setPositionReference({getBoundingClientRect(){return{x:T.x,y:T.y,width:T.width,height:T.height,top:T.y,left:T.x,right:T.x+T.width,bottom:T.y+T.height}}})}},[o.viewport,c,s]);const g=p.useRef();g.current=T=>{if(s.floating.current&&!s.floating.current.contains(T.target)){if(h.current){const S=Ji.getLinkElement(h.current.editor);S&&!S[0].url.trim()&&Ji.unwrapLink(h.current.editor)}i({...n,linkState:null})}},p.useEffect(()=>{const T=S=>{var v;(v=g.current)==null||v.call(g,S)};return document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[]);const b=()=>{if(!a)return;if(e!==a.targetElement.url){const S=a.editor,v=a.targetElement,E=En.findPath(S,v);ga.setNodes(S,{url:e},{at:E})}const T=Ji.getLinkElement(a.editor);T&&i({...n,linkState:{...n.linkState,targetElement:T[0],isEditing:!1,isHoveringOrigin:!0}})};return f&&l.jsxDEV(Ye,{ref:s.setFloating,style:r,padding:1,className:Y("link-popup"),onPointerEnter:()=>{!m&&n.linkState&&i({...n,linkState:{...n.linkState,isHovering:!0}})},onPointerLeave:()=>{!u&&n.linkState&&i({...n,linkState:{...n.linkState,isHovering:!1}})},children:l.jsxDEV(ft.Row,{gap:1,align:"center",children:u?l.jsxDEV(l.Fragment,{children:[l.jsxDEV("input",{type:"text",value:e,onChange:T=>{t(T.target.value)},onKeyDown:T=>{T.key==="Enter"&&b()},className:"link-popup__input",autoFocus:!0},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:151,columnNumber:15},void 0),l.jsxDEV(ne,{type:"icon",visible:!0,icon:l.jsxDEV(rr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:168,columnNumber:23},void 0),tooltip:"Delete link","aria-label":"Delete link",onPointerDown:()=>{if(!a)return;const T=a.editor,S=a.targetElement,v=En.findPath(T,S);ga.unwrapNodes(T,{at:v}),i({...n,linkState:null})}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:165,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:150,columnNumber:13},void 0):l.jsxDEV(l.Fragment,{children:[l.jsxDEV("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"link-popup__link",children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:188,columnNumber:15},void 0),l.jsxDEV(ne,{className:"link-popup__edit",type:"icon",visible:!0,icon:l.jsxDEV(bo,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:200,columnNumber:23},void 0),tooltip:"Edit link","aria-label":"Edit link",onPointerDown:({event:T})=>{T.preventDefault(),n.linkState&&i({...n,linkState:{...n.linkState,isEditing:!0}})}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:196,columnNumber:15},void 0),l.jsxDEV(ne,{type:"icon",visible:!0,icon:l.jsxDEV(rr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:218,columnNumber:23},void 0),tooltip:"Delete link","aria-label":"Delete link",onPointerDown:()=>{if(!a)return;const T=a.editor,S=a.targetElement,v=En.findPath(T,S);ga.unwrapNodes(T,{at:v}),i({...n,linkState:null})}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:215,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:187,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:148,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/popup/link-popup/link-popup.tsx",lineNumber:120,columnNumber:7},void 0)},Oo={autoTrack:!1,debounceTime:500,retryPolicy:{maxRetries:3,retryInterval:2e3,exponentialBackoff:!0},cacheConfig:{maxCacheSize:100,cacheTTL:3600*1e3,storageKey:"tracking_cache"},logLevel:"error",batchConfig:{batchSize:10,batchTimeout:5e3,enabled:!0},excludedSelectors:["nav","header","footer","[data-track-ignore]"],devMode:!1};function qj(){return"0.6.76"}function Hm(e){return{...Oo,...e,retryPolicy:{...Oo.retryPolicy,...e.retryPolicy||{}},cacheConfig:{...Oo.cacheConfig,...e.cacheConfig||{}},batchConfig:{...Oo.batchConfig,...e.batchConfig||{}}}}class Bj{isAvailable(){return yt.isAnalyticsEnabled()}async track(t){if(!this.isAvailable())return;const n={...t.params,version:t.metadata.version,url:t.metadata.url,timestamp:t.metadata.timestamp,sessionId:t.metadata.sessionId,eventType:t.metadata.eventType};t.metadata.viewport&&(n.viewport=`${t.metadata.viewport.width}x${t.metadata.viewport.height}`);try{yt.track(t.eventName,n)}catch(i){throw console.error("[Tracking] PostHog track failed:",i),i}}async trackBatch(t){const n=[];for(const i of t)try{await this.track(i),n.push({success:!0})}catch(o){n.push({success:!1,error:o})}return n}getSDKInfo(){return{available:this.isAvailable(),version:this.isAvailable()?"PostHog JS":void 0}}}const zm=new Bj;class Lj{constructor(t){this.queue=[],this.timer=null,this.uploading=!1,this.config=t}enqueue(t){if(!this.config.enabled){this.uploadImmediate(t);return}this.queue.push(t),this.timer||(this.timer=setTimeout(()=>{this.flush()},this.config.batchTimeout)),this.queue.length>=this.config.batchSize&&this.flush()}async flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.queue.length===0||this.uploading)return;this.uploading=!0;const t=[...this.queue];this.queue=[];try{const n=await zm.trackBatch(t),i=n.filter(o=>!o.success);if(i.length>0){console.error(`Batch upload: ${i.length}/${t.length} events failed`);const o=t.filter((s,r)=>!n[r].success);this.requeueFailedEvents(o)}}catch(n){console.error("Batch upload failed:",n),this.requeueFailedEvents(t)}finally{this.uploading=!1}}async uploadImmediate(t){try{await zm.track(t)}catch(n){console.error("Immediate upload failed:",n)}}requeueFailedEvents(t){this.queue=[...t,...this.queue]}getQueueSize(){return this.queue.length}isUploading(){return this.uploading}updateConfig(t){this.config={...this.config,...t},!this.config.enabled&&this.queue.length>0&&this.flush()}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.queue=[],this.uploading=!1}flushOnUnload(){this.queue.length!==0&&this.flush()}}class Oj{constructor(t=500){this.debounceMap=new WeakMap,this.globalDebounceMap=new Map,this.globalDebounceTime=200,this.debounceTime=t}shouldTrack(t,n,i=!1){const o=Date.now(),s=this.globalDebounceMap.get(n);if(s&&o-s<this.globalDebounceTime)return i&&console.warn(`[Tracking] 🚫 Global debounce: ${n} (${o-s}ms ago)`),!1;const r=this.debounceMap.get(t);if(!r){const c=new Map;return c.set(n,o),this.debounceMap.set(t,c),this.globalDebounceMap.set(n,o),!0}const a=r.get(n);return!a||o-a>this.debounceTime?(r.set(n,o),this.globalDebounceMap.set(n,o),!0):(i&&console.warn(`[Tracking] 🚫 Element debounce: ${n} (${o-a}ms ago)`),!1)}clear(t){this.debounceMap.delete(t)}setDebounceTime(t){this.debounceTime=t}}const Fj=["button:not([data-track-ignore])","a:not([data-track-ignore])",'input[type="button"]:not([data-track-ignore])','input[type="submit"]:not([data-track-ignore])','[role="button"]:not([data-track-ignore])','[role="link"]:not([data-track-ignore])'].join(", ");function Hj(e,t){if(!e.matches(Fj))return!1;for(const i of t)if(e.matches(i)||e.closest(i))return!1;return e.hasAttribute("data-track-ignore")?!1:(e.onclick!==null,!0)}function zj(e,t="click"){var a;const n=`auto_${t}_`;if(e.id)return`${n}${e.id}`;const i=e.getAttribute("aria-label");if(i)return`${n}${Gm(i)}`;const o=(a=e.textContent)==null?void 0:a.trim();if(o&&o.length>0){const c=Gm(o.substring(0,20));return`${n}${c}`}const s=e.tagName.toLowerCase(),r=e.className?`.${e.className.split(" ")[0]}`:"";return`${n}${s}${r}`}function Gm(e){return e.toLowerCase().trim().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"").substring(0,50)}function Gj(e){if(e.id)return`#${e.id}`;const t=[];let n=e;for(;n&&n!==document.body;){let i=n.tagName.toLowerCase();if(n.className){const o=n.className.split(" ").filter(Boolean);o.length>0&&(i+=`.${o[0]}`)}t.unshift(i),n=n.parentElement}return t.join(" > ")}function Ra(e){const t=e.getAttribute("data-track-params")||e.getAttribute("track-params");if(!t)return null;try{return JSON.parse(t)}catch(n){return console.warn("Invalid track params JSON on element:",e,n),null}}function qg(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function Wj(){if(typeof window>"u")return"server-side";const e="tracking_session_id";let t=sessionStorage.getItem(e);return t||(t=qg(),sessionStorage.setItem(e,t)),t}function $j(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth||0,height:window.innerHeight||0}}class Xj{constructor(t={}){this.state$=new HN({initialized:!1,config:Oo,pendingEvents:[],uploading:!1,cachedEventCount:0,stats:{totalEvents:0,successfulUploads:0,failedUploads:0,batchUploadCount:0,debouncedEvents:0}}),this.clickListener=null,this.mutationObserver=null,this.attachedListeners=new WeakMap,this.config=Hm(t),this.batchService=new Lj(this.config.batchConfig),this.debouncer=new Oj(this.config.debounceTime),this.updateState({config:this.config,initialized:!1})}initialize(){if(this.state$.value.initialized){this.log("debug","Tracking service already initialized");return}this.setupClickDelegation(),this.setupMultiEventListeners(),this.setupMutationObserver(),this.setupBeforeUnload(),this.updateState({initialized:!0}),this.log("debug","Tracking service initialized")}setupClickDelegation(){typeof window>"u"||typeof document>"u"||(this.clickListener=t=>{const n=t.target;if(!n)return;const i=n.closest("[data-track]");if(i){const o=i.getAttribute("data-track");if(o){if(this.isElementExcluded(i))return;this.trackClick(i,o);return}}if(this.config.autoTrack&&Hj(n,this.config.excludedSelectors)){if(this.isElementExcluded(n))return;const o=zj(n,"click");this.trackClick(n,o)}},document.body.addEventListener("click",this.clickListener,!0))}setupMultiEventListeners(){if(typeof document>"u")return;document.querySelectorAll("[track-hover]").forEach(i=>{this.attachHoverListener(i)}),document.querySelectorAll("[track-focus]").forEach(i=>{this.attachFocusListener(i)})}attachHoverListener(t){const n=t.getAttribute("track-hover");if(!n||this.hasAttachedListener(t,"hover"))return;const i=()=>{if(!this.debouncer.shouldTrack(t,n,this.config.devMode)){this.incrementStat("debouncedEvents");return}const o=Ra(t),s=this.createTrackEvent(n,o,"hover",t);this.track(s)};t.addEventListener("mouseenter",i),this.markListenerAttached(t,"hover")}attachFocusListener(t){const n=t.getAttribute("track-focus");if(!n||this.hasAttachedListener(t,"focus"))return;const i=()=>{if(!this.debouncer.shouldTrack(t,n,this.config.devMode)){this.incrementStat("debouncedEvents");return}const o=Ra(t),s=this.createTrackEvent(n,o,"focus",t);this.track(s)};t.addEventListener("focus",i,!0),this.markListenerAttached(t,"focus")}hasAttachedListener(t,n){const i=this.attachedListeners.get(t);return i?i.has(n):!1}markListenerAttached(t,n){let i=this.attachedListeners.get(t);i||(i=new Set,this.attachedListeners.set(t,i)),i.add(n)}setupMutationObserver(){typeof window>"u"||typeof MutationObserver>"u"||(this.mutationObserver=new MutationObserver(t=>{t.forEach(n=>{n.addedNodes.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const o=i;o.hasAttribute("track-hover")&&this.attachHoverListener(o),o.hasAttribute("track-focus")&&this.attachFocusListener(o),o.querySelectorAll("[track-hover]").forEach(a=>this.attachHoverListener(a)),o.querySelectorAll("[track-focus]").forEach(a=>this.attachFocusListener(a))}})})}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}))}trackClick(t,n){if(!this.debouncer.shouldTrack(t,n,this.config.devMode)){this.incrementStat("debouncedEvents"),this.log("debug",`Event debounced: ${n}`);return}const i=Ra(t),o=this.createTrackEvent(n,i,"click",t);this.track(o)}createTrackEvent(t,n,i,o){const s={timestamp:Date.now(),url:typeof window<"u"?window.location.href:"",version:qj(),sessionId:Wj(),userAgent:typeof navigator<"u"?navigator.userAgent:void 0,viewport:$j(),eventType:i},r={eventName:t,params:n||void 0,metadata:s,id:qg(),createdAt:Date.now()};return this.config.devMode&&this.log("debug",`Event created: ${t}`,{params:n,element:o?Gj(o):void 0}),r}track(t){this.incrementStat("totalEvents"),this.batchService.enqueue(t),this.log("debug",`Event tracked: ${t.eventName}`)}isElementExcluded(t){if(t.hasAttribute("data-track-ignore"))return!0;for(const n of this.config.excludedSelectors)if(t.matches(n)||t.closest(n))return!0;return!1}setupBeforeUnload(){typeof window>"u"||window.addEventListener("beforeunload",()=>{this.batchService.flushOnUnload()})}getState(){return this.state$.asObservable()}getStats(){return this.state$.value.stats}updateConfig(t){this.config=Hm({...this.config,...t}),t.batchConfig&&this.batchService.updateConfig(t.batchConfig),t.debounceTime&&this.debouncer.setDebounceTime(t.debounceTime),this.updateState({config:this.config}),this.log("debug","Configuration updated",t)}destroy(){this.clickListener&&typeof document<"u"&&(document.body.removeEventListener("click",this.clickListener,!0),this.clickListener=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.attachedListeners=new WeakMap,this.batchService.flush(),this.updateState({initialized:!1}),this.log("debug","Tracking service destroyed")}updateState(t){this.state$.next({...this.state$.value,...t})}incrementStat(t){const n={...this.state$.value.stats};n[t]++,this.updateState({stats:n})}log(t,n,i){this.config.logLevel!=="silent"&&(t==="error"||t==="debug"&&this.config.devMode)}}let Mn=null;function Kj(){Mn&&(Mn.destroy(),Mn=null)}function Yj(e,t){return Mn||(Mn=new Xj(t),typeof window<"u"&&setTimeout(()=>{Mn==null||Mn.initialize()},0),typeof module<"u"&&module.hot&&module.hot.dispose(()=>{Kj()})),e.trackingService=Mn,e}class Zj extends rc{initialize(){super.initialize()}}const Qj=e=>{const{drawElement:t}=e;return e.drawElement=n=>{try{return t(n)}catch{return console.warn(`[Drawnix] Unknown element type "${n.element.type}" — may be from a newer version, hidden but preserved.`),Zj}},e};function Jj(e,t,n,i=0){const o=ge.getCenterPoint(t),s=Ai(t,ui);if(i){const r=eP(n,o,-i);let a=s.find(c=>ge.isHit(ge.getRectangleByPoints([r,r]),c.rectangle));return a&&(a.cursorClass=Gr(a.cursorClass,i)),a}else return s.find(r=>ge.isHit(ge.getRectangleByPoints([n,n]),r.rectangle))}function eP(e,t,n){const i=n*Math.PI/180,o=Math.cos(i),s=Math.sin(i),r=e[0]-t[0],a=e[1]-t[1];return[t[0]+r*o-a*s,t[1]+r*s+a*o]}function tP(e){const t=Be(e);return t.length!==1?!1:Xl(t[0])}function nP(e,t){const n=Be(e);if(n.length!==1||!Xl(n[0]))return null;const i=n[0],o=ge.getRectangleByPoints(i.points),s=i.angle||0,r=Jj(e,o,t,s);return r?{element:i,rectangle:o,handle:r.handle,cursorClass:r.cursorClass}:null}function iP(e,t,n){const{element:i,rectangle:o,handle:s}=t,{startPoint:r,endPoint:a}=n;if(!o){console.warn("startRectangle is undefined");return}const c=a[0]-r[0],u=a[1]-r[1],d=xo(o,s,c,u,hs(),100),m=[[d.x,d.y],[d.x+d.width,d.y+d.height]],f=e.children.findIndex(h=>h.id===i.id);f>=0&&ue.setNode(e,{points:m},[f])}const oP=e=>Ci(e,{key:"tool-elements",canResize:()=>tP(e),hitTest:(t=>nP(e,t)),onResize:(t,n)=>iP(e,t,n)});let yr=null;function sP(e,t){return $e.isFreehand(t)?zr(t):Je.isPenPath(t)?Wr(t):e.getRectangle(t)}function rP(e,t){return Ai(e,ui).find(i=>ge.isHit(ge.getRectangleByPoints([t,t]),i.rectangle))}function Fc(e){return e.some(t=>$e.isFreehand(t)||Je.isPenPath(t)||H.isText(t))}function aP(e){return e.some(t=>H.isText(t))}function Bg(e){const t=Be(e);if(t.length<2||!Fc(t))return null;try{const n=Ot(e,t,!1);return{elements:t,rectangle:n}}catch{return null}}function lP(e){return Bg(e)!==null}function cP(e,t){const n=Bg(e);if(!n)return null;const i=rP(n.rectangle,t);if(i){yr=new Map;for(const o of n.elements){const s=sP(e,o);s&&yr.set(o.id,{element:JSON.parse(JSON.stringify(o)),rectangle:{...s}})}return{element:n.elements,rectangle:n.rectangle,handle:i.handle,cursorClass:i.cursorClass}}return null}function uP(e,t,n,i,o,s){const r=s.width/o.width,a=s.height/o.height,c=i.x-o.x,u=i.y-o.y,d=s.x+c*r,m=s.y+u*a,f=n.points.map(g=>{const b=g[0]-i.x,x=g[1]-i.y,y=b*r,N=x*a;return[d+y,m+N]}),h=e.children.findIndex(g=>g.id===t);h>=0&&ue.setNode(e,{points:f},[h])}function dP(e,t,n,i,o,s){const r=s.width/o.width,a=s.height/o.height,c=i.x-o.x,u=i.y-o.y,d=s.x+c*r,m=s.y+u*a,f=n.anchors.map(N=>({...N,point:[N.point[0]*r,N.point[1]*a],handleIn:N.handleIn?[N.handleIn[0]*r,N.handleIn[1]*a]:void 0,handleOut:N.handleOut?[N.handleOut[0]*r,N.handleOut[1]*a]:void 0})),h=i.width*r,g=i.height*a,x=[[d,m],[d+h,m+g]],y=e.children.findIndex(N=>N.id===t);y>=0&&ue.setNode(e,{points:x,anchors:f},[y])}const Lg=14;function Og(e,t){const n={...e};if("text"in e&&typeof e.text=="string"){const i=e["font-size"]?parseFloat(e["font-size"]):Lg,o=Math.max(1,Math.round(i*t*10)/10);n["font-size"]=`${o}`}return Array.isArray(e.children)&&(n.children=e.children.map(i=>Og(i,t))),n}function mP(e,t,n,i,o,s){const r=s.width/o.width,a=s.height/o.height,c=i.x-o.x,u=i.y-o.y,d=s.x+c*r,m=s.y+u*a,f=i.width*r,h=i.height*a,g=[[d,m],[d+f,m+h]],b=e.children.findIndex(x=>x.id===t);if(b>=0)if(H.isDrawElement(n)&&H.isImage(n))ue.setNode(e,{points:g,width:f,height:h},[b]);else if(H.isText(n)){const x=n,y=Og(x.text,r),N=x.textHeight||Lg*1.4;ue.setNode(e,{points:g,text:y,textHeight:N*r,autoSize:!1},[b])}else ue.setNode(e,{points:g},[b])}function pP(e,t,n){const{element:i,rectangle:o,handle:s}=t,{startPoint:r,endPoint:a}=n;if(!o||!Array.isArray(i)||!yr)return;const c=a[0]-r[0],u=a[1]-r[1],d=hs()||aP(i),m=xo(o,s,c,u,d);for(const f of i){const h=yr.get(f.id);if(!h)continue;const{element:g,rectangle:b}=h;$e.isFreehand(g)?uP(e,f.id,g,b,o,m):Je.isPenPath(g)?dP(e,f.id,g,b,o,m):mP(e,f.id,g,b,o,m)}}function fP(e){const t=Be(e);if(t.length<2||!Fc(t))return null;try{const n=Zl(),i=Ot(e,t,!1),o=zN(e,i);return ge.getCornerPoints(o).forEach(r=>{const a=GN(e,r);n.append(a)}),n}catch{return null}}const hP=e=>{const{afterChange:t}=e;let n=null;return e.afterChange=()=>{t(),n&&(n.remove(),n=null);const i=Be(e);i.length>1&&Fc(i)&&!Zo(e)&&(n=fP(e),n&&F.getActiveHost(e).append(n))},Ci(e,{key:"multi-resize",canResize:()=>lP(e),hitTest:(i=>cP(e,i)),onResize:(i,o)=>pP(e,i,o)})},Fg=14;let nr=null,jl=null;function gP(e,t){return Ai(e,ui).find(i=>ge.isHit(ge.getRectangleByPoints([t,t]),i.rectangle))}function Hg(e,t){const n={...e};if("text"in e&&typeof e.text=="string"){const i=e["font-size"]?parseFloat(e["font-size"]):Fg,o=Math.max(1,Math.round(i*t*10)/10);n["font-size"]=`${o}`}return Array.isArray(e.children)&&(n.children=e.children.map(i=>Hg(i,t))),n}function bP(e){const t=Be(e);return t.length!==1?!1:H.isText(t[0])}function xP(e,t){const n=Be(e);if(n.length!==1||!H.isText(n[0]))return null;const i=n[0],o=ge.getRectangleByPoints(i.points),s=gP(o,t);return s?(nr=JSON.parse(JSON.stringify(i)),jl={...o},{element:i,rectangle:o,handle:s.handle,cursorClass:s.cursorClass}):null}function NP(e,t,n){const{element:i,rectangle:o,handle:s}=t,{startPoint:r,endPoint:a}=n;if(!o||!nr||!jl)return;const c=a[0]-r[0],u=a[1]-r[1],d=xo(o,s,c,u,!0,20),m=d.width/jl.width;if(m<=0)return;const f=Hg(nr.text,m),g=(nr.textHeight||Fg*1.4)*m,b=[[d.x,d.y],[d.x+d.width,d.y+d.height]],x=e.children.findIndex(y=>y.id===i.id);x>=0&&ue.setNode(e,{points:b,text:f,textHeight:g,autoSize:!1},[x])}const yP=e=>Ci(e,{key:"text-resize",canResize:()=>bP(e),hitTest:t=>xP(e,t),onResize:(t,n)=>NP(e,t,n)});function wP(e){return e.some(n=>$e.isFreehand(n)||Je.isPenPath(n))}function vP(e){const t=Be(e);if(t.length<2||!wP(t))return null;try{return Ot(e,t,!1)}catch{return null}}const EP=()=>{const e=xt(),[t,n]=p.useState([]),[i,o]=p.useState(!1),[s,r]=p.useState(!1),a=p.useRef(!1),c=p.useCallback(()=>{const m=Qo(e)||es(e)||Zo(e);if(r(m),m)return;Be(e);const f=vP(e);if(!f){o(!1);return}const g=[{x:f.x,y:f.y,cursor:"nwse-resize"},{x:f.x+f.width,y:f.y,cursor:"nesw-resize"},{x:f.x+f.width,y:f.y+f.height,cursor:"nwse-resize"},{x:f.x,y:f.y+f.height,cursor:"nesw-resize"}].map(b=>{const x=Ro(e,[b.x,b.y]);return{x:x[0],y:x[1],cursor:b.cursor}});n(g),o(!0)},[e]);if(p.useEffect(()=>{a.current=s},[s]),p.useEffect(()=>{c();let m,f=JSON.stringify(e.viewport),h=JSON.stringify(e.selection),g=e.children.length;const b=()=>{const x=JSON.stringify(e.viewport),y=JSON.stringify(e.selection),N=e.children.length,w=Qo(e)||es(e)||Zo(e);(x!==f||y!==h||N!==g||w!==a.current)&&(f=x,h=y,g=N,c()),m=requestAnimationFrame(b)};return m=requestAnimationFrame(b),()=>{cancelAnimationFrame(m)}},[e,c]),!i||t.length===0||s)return null;const u=ui,d=u/2;return l.jsxDEV("div",{className:Y("multi-selection-handles",Mt),children:t.map((m,f)=>l.jsxDEV("div",{className:"multi-selection-handle",style:{left:m.x-d,top:m.y-d,width:u,height:u,cursor:m.cursor}},f,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/multi-selection-handles/multi-selection-handles.tsx",lineNumber:169,columnNumber:9},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/multi-selection-handles/multi-selection-handles.tsx",lineNumber:167,columnNumber:5},void 0)},zg=p.createContext(null),kP=typeof window<"u"?Math.max(375,window.innerWidth*.5):600,SP=({children:e})=>{const t=p.useRef(null),n=p.useRef(null),[i,o]=p.useState([]),[s,r]=p.useState(!1),[a,c]=p.useState(kP),u=p.useCallback(m=>{n.current=m},[]),d=p.useCallback(async(m,f)=>{n.current?await n.current(m,f):console.warn("[ChatDrawerContext] No retry handler registered")},[]);return l.jsxDEV(zg.Provider,{value:{chatDrawerRef:t,registerRetryHandler:u,executeRetry:d,selectedContent:i,setSelectedContent:o,isDrawerOpen:s,setIsDrawerOpen:r,drawerWidth:a,setDrawerWidth:c},children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/contexts/ChatDrawerContext.tsx",lineNumber:79,columnNumber:5},void 0)};function Gg(){const e=p.useContext(zg);if(!e)throw new Error("useChatDrawer must be used within a ChatDrawerProvider");return e}function TP(){const{chatDrawerRef:e,registerRetryHandler:t,executeRetry:n,selectedContent:i,setSelectedContent:o,isDrawerOpen:s,setIsDrawerOpen:r,drawerWidth:a,setDrawerWidth:c}=Gg();return{openChatDrawer:()=>{var u;(u=e.current)==null||u.open()},closeChatDrawer:()=>{var u;(u=e.current)==null||u.close()},toggleChatDrawer:()=>{var u;(u=e.current)==null||u.toggle()},sendMessageToChatDrawer:async u=>{var d;await((d=e.current)==null?void 0:d.sendMessage(u))},sendWorkflowMessage:async u=>{var d;await((d=e.current)==null?void 0:d.sendWorkflowMessage(u))},updateWorkflowMessage:u=>{var d;(d=e.current)==null||d.updateWorkflowMessage(u)},appendAgentLog:u=>{var d;(d=e.current)==null||d.appendAgentLog(u)},updateThinkingContent:u=>{var d;(d=e.current)==null||d.updateThinkingContent(u)},isChatDrawerOpen:()=>{var u;return((u=e.current)==null?void 0:u.isOpen())??!1},isDrawerOpen:s,setIsDrawerOpen:r,drawerWidth:a,setDrawerWidth:c,registerRetryHandler:t,retryWorkflowFromStep:async(u,d)=>{await n(u,d)},selectedContent:i,setSelectedContent:o}}class DP{constructor(){this.board=null}setBoard(t){this.board=t}getBoard(){return this.board||console.error("❌ Board instance not set. Call testToolbox.setBoard(board) first"),this.board}insertBananaPrompt(){const t=this.getBoard();if(!t)return;const n=Ts.getToolById("banana-prompt");if(!n){console.error('❌ Tool "banana-prompt" not found');return}Bi.insertTool(t,n.id,n.url,[100,100],{width:n.defaultWidth||Li.defaultWidth,height:n.defaultHeight||Li.defaultHeight},{name:n.name,category:n.category,permissions:n.permissions})}insertXiaohongshuTool(){const t=this.getBoard();if(!t)return;const n=Ts.getToolById("xiaohongshu-tool");if(!n){console.error('❌ Tool "xiaohongshu-tool" not found');return}Bi.insertTool(t,n.id,n.url,[300,300],{width:n.defaultWidth||Li.defaultWidth,height:n.defaultHeight||Li.defaultHeight},{name:n.name,category:n.category,permissions:n.permissions})}insertToolById(t,n=200,i=200){const o=this.getBoard();if(!o)return;const s=Ts.getToolById(t);if(!s){console.error(`❌ Tool "${t}" not found`);return}Bi.insertTool(o,s.id,s.url,[n,i],{width:s.defaultWidth||Li.defaultWidth,height:s.defaultHeight||Li.defaultHeight},{name:s.name,category:s.category,permissions:s.permissions})}listAllTools(){Ts.getAvailableTools().forEach((n,i)=>{})}getAllToolElements(){const t=this.getBoard();if(!t)return;Bi.getAllTools(t).forEach((i,o)=>{})}removeAllTools(){const t=this.getBoard();if(!t)return;Bi.getAllTools(t).forEach(i=>{Bi.removeTool(t,i.id)})}help(){}}const Wg=new DP;typeof window<"u"&&(window.testToolbox=Wg);const _P={width:200,height:150,position:"bottom-right",margin:16,collapsible:!0,defaultExpanded:!1,backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"rgba(0, 0, 0, 0.1)",viewportColor:"rgba(90, 79, 207, 0.3)",elementColor:"rgba(0, 0, 0, 0.5)"},jP={autoHideDelay:3e3},PP=({board:e,config:t,className:n,displayMode:i="auto",autoTriggerConfig:o})=>{const s=p.useRef(null),r=p.useRef(null);p.useRef(null);const a={..._P,...t},c={...jP,...o},[u,d]=p.useState(()=>({expanded:i==="always"?!0:a.defaultExpanded,dragging:!1,autoMode:i==="auto",manuallyExpanded:!1})),m=p.useRef({isDragging:!1,startPoint:null}),f=p.useRef(null),[h,g]=p.useState(null),b=p.useRef(null),[x,y]=p.useState(!1),N=120,w=p.useRef(0),T=p.useRef({zoom:e.viewport.zoom,offsetX:e.viewport.offsetX,offsetY:e.viewport.offsetY}),S=p.useRef(!1),v=p.useCallback(()=>{if(!e||!e.children)return[];const D=[];return e.children.forEach(j=>{try{let W=null;j.points&&Array.isArray(j.points)?W=ge.getRectangleByPoints(j.points):j.x!==void 0&&j.y!==void 0&&(W={x:j.x,y:j.y,width:j.width||100,height:j.height||100}),W&&W.width>0&&W.height>0&&D.push({id:j.id,bounds:W,type:j.type})}catch(W){console.warn("Failed to get bounds for element:",j.id,W)}}),D},[e]),E=p.useCallback(()=>{const j=F.getBoardContainer(e).getBoundingClientRect(),W=e.viewport.zoom,Q=Pr(e),C=Q[0],B=Q[1],L=j.width/W,z=j.height/W;return{x:C,y:B,width:L,height:z}},[e]),U=p.useRef(u.expanded);U.current=u.expanded;const q=p.useRef(null),$=p.useRef(1);p.useEffect(()=>{if(i==="always"){U.current||d(j=>({...j,expanded:!0}));return}if(i!=="auto")return;const D=setInterval(()=>{const j=e.viewport,W=T.current,Q=Math.abs(j.zoom-W.zoom)>.001,C=Math.abs(j.offsetX-W.offsetX)>.5||Math.abs(j.offsetY-W.offsetY)>.5;if(Q||C){if(T.current={zoom:j.zoom,offsetX:j.offsetX,offsetY:j.offsetY},!S.current){S.current=!0;return}w.current=Date.now(),U.current||d(L=>({...L,expanded:!0,manuallyExpanded:!1}))}},100);return()=>{clearInterval(D)}},[i,e]),p.useEffect(()=>{if(i!=="auto"||!u.expanded||u.manuallyExpanded||u.dragging)return;const D=setTimeout(()=>{d(j=>!j.autoMode||j.manuallyExpanded||j.dragging?j:{...j,expanded:!1})},c.autoHideDelay);return()=>{clearTimeout(D)}},[i,u.expanded,u.manuallyExpanded,u.dragging,c.autoHideDelay]);const V=p.useCallback((D,j)=>{if(D.length===0)return{x:j.x-200,y:j.y-200,width:j.width+400,height:j.height+400};let W=j.x,Q=j.y,C=j.x+j.width,B=j.y+j.height;D.forEach(z=>{const{x:te,y:ee,width:O,height:J}=z.bounds;W=Math.min(W,te),Q=Math.min(Q,ee),C=Math.max(C,te+O),B=Math.max(B,ee+J)});const L=100;return{x:W-L,y:Q-L,width:C-W+L*2,height:B-Q+L*2}},[]),R=p.useCallback(D=>{const W=(a.width-20)/D.width,Q=(a.height-20)/D.height;return Math.min(W,Q)},[a.width,a.height]),M=p.useCallback((D,j,W,Q)=>{const B=(D-W.x)*Q+10,L=(j-W.y)*Q+10;return[B,L]},[]),_=p.useCallback((D,j,W,Q)=>{const B=(D-10)/Q+W.x,L=(j-10)/Q+W.y;return[B,L]},[]),I=p.useCallback((D,j,W)=>{if(100*W<5)return;D.strokeStyle="rgba(0, 0, 0, 0.05)",D.lineWidth=.5;const B=Math.floor(j.x/100)*100,L=Math.floor(j.y/100)*100,z=j.x+j.width,te=j.y+j.height;for(let ee=B;ee<=z;ee+=100){const[O]=M(ee,0,j,W);D.beginPath(),D.moveTo(O,0),D.lineTo(O,a.height),D.stroke()}for(let ee=L;ee<=te;ee+=100){const[,O]=M(0,ee,j,W);D.beginPath(),D.moveTo(0,O),D.lineTo(a.width,O),D.stroke()}},[M,a.width,a.height]),P=p.useCallback(()=>{const D=s.current;if(!D)return;const j=D.getContext("2d");if(!j)return;j.clearRect(0,0,a.width,a.height);const W=v(),Q=E();if(W.length===0&&!Q){j.fillStyle="#999",j.font="12px sans-serif",j.textAlign="center",j.textBaseline="middle",j.fillText("空画布",a.width/2,a.height/2);return}const C=V(W,Q),B=R(C);q.current=C,$.current=B,I(j,C,B),j.fillStyle=a.elementColor,j.strokeStyle="rgba(0, 0, 0, 0.1)",j.lineWidth=.5,W.forEach(oe=>{const{x:Ie,y:ut,width:Re,height:ie}=oe.bounds,[Ae,Ue]=M(Ie,ut,C,B),_e=Re*B,Le=ie*B;j.fillRect(Ae,Ue,_e,Le),j.strokeRect(Ae,Ue,_e,Le)});const[L,z]=M(Q.x,Q.y,C,B),te=Q.width*B,ee=Q.height*B;j.fillStyle=a.viewportColor,j.fillRect(L,z,te,ee),j.strokeStyle=a.viewportColor.replace("0.3","1"),j.lineWidth=2,j.strokeRect(L,z,te,ee);const O=8;j.fillStyle=a.viewportColor.replace("0.3","0.8"),j.fillRect(L,z,O,2),j.fillRect(L,z,2,O),j.fillRect(L+te-O,z,O,2),j.fillRect(L+te-2,z,2,O),j.fillRect(L,z+ee-2,O,2),j.fillRect(L,z+ee-O,2,O),j.fillRect(L+te-O,z+ee-2,O,2),j.fillRect(L+te-2,z+ee-O,2,O);const J=b.current;if(J){const oe=J.x-te/2,Ie=J.y-ee/2;j.fillStyle="rgba(243, 156, 18, 0.15)",j.fillRect(oe,Ie,te,ee),j.strokeStyle="rgba(243, 156, 18, 0.8)",j.lineWidth=2,j.strokeRect(oe,Ie,te,ee)}},[e,a,v,E,V,R,M,I]),Z=p.useCallback(D=>{D.preventDefault(),D.stopPropagation();const j=s.current;if(!j||!q.current)return;const W=j.getBoundingClientRect(),Q=D.clientX-W.left,C=D.clientY-W.top;yt.track("minimap_navigate",{action:"click",displayMode:i});const[B,L]=_(Q,C,q.current,$.current);m.current={isDragging:!0,startPoint:[Q,C]},d(z=>({...z,dragging:!0})),pe(B,L)},[_,e]),pe=p.useCallback((D,j)=>{const Q=F.getBoardContainer(e).getBoundingClientRect(),C=e.viewport.zoom,B=D-Q.width/(2*C),L=j-Q.height/(2*C);fe.updateViewport(e,[B,L],C),requestAnimationFrame(()=>P())},[e,P]),A=p.useCallback(D=>{if(!m.current.isDragging||!q.current)return;D.preventDefault(),D.stopPropagation();const j=s.current;if(!j)return;const W=j.getBoundingClientRect(),Q=D.clientX-W.left,C=D.clientY-W.top,[B,L]=_(Q,C,q.current,$.current);pe(B,L)},[_,pe]),G=p.useCallback(()=>{m.current.isDragging&&yt.track("minimap_navigate",{action:"drag",displayMode:i}),m.current={isDragging:!1,startPoint:null},d(D=>({...D,dragging:!1}))},[i]),ce=p.useCallback((D,j)=>{const W=f.current;if(!W||!q.current)return;const Q=W.getContext("2d");if(!Q)return;const[C,B]=_(D,j,q.current,$.current),L=E(),z=L.width,te=L.height,ee=z,O=te;Q.clearRect(0,0,N,N),Q.fillStyle="#fff",Q.fillRect(0,0,N,N);const J=C-ee/2,oe=B-O/2,Ie=N/ee,ut=N/O,Re=Math.min(Ie,ut),ie=(N-ee*Re)/2,Ae=(N-O*Re)/2;v().forEach(_e=>{const{bounds:Le}=_e;if(Le.x+Le.width>=J&&Le.x<=J+ee&&Le.y+Le.height>=oe&&Le.y<=oe+O){const It=(Le.x-J)*Re+ie,_t=(Le.y-oe)*Re+Ae,Vt=Le.width*Re,Lt=Le.height*Re;Q.fillStyle="rgba(0, 0, 0, 0.6)",Q.fillRect(It,_t,Vt,Lt)}}),Q.strokeStyle="rgba(90, 79, 207, 0.6)",Q.lineWidth=1,Q.setLineDash([4,4]),Q.beginPath(),Q.moveTo(0,N/2),Q.lineTo(N,N/2),Q.stroke(),Q.beginPath(),Q.moveTo(N/2,0),Q.lineTo(N/2,N),Q.stroke(),Q.setLineDash([]),Q.strokeStyle="rgba(90, 79, 207, 0.3)",Q.lineWidth=2,Q.strokeRect(0,0,N,N)},[v,E,_]),X=p.useCallback(()=>{u.dragging||y(!0)},[u.dragging]),ae=p.useCallback(()=>{y(!1),g(null),b.current=null},[]),le=p.useCallback(D=>{if(u.dragging){y(!1),b.current=null;return}const j=s.current;if(!j)return;const W=j.getBoundingClientRect(),Q=D.clientX-W.left,C=D.clientY-W.top,B={x:Q,y:C};g(B),b.current=B,y(!0),ce(Q,C),P()},[u.dragging,ce,P]),be=p.useRef(!1),we=p.useCallback(D=>{be.current=!0;const j=s.current;if(!j)return;const W=D.touches[0],Q=j.getBoundingClientRect(),C=W.clientX-Q.left,B=W.clientY-Q.top,L={x:C,y:B};g(L),b.current=L,y(!0),ce(C,B),P()},[ce,P]),Fe=p.useCallback(D=>{const j=s.current;if(!j)return;const W=D.touches[0],Q=j.getBoundingClientRect(),C=W.clientX-Q.left,B=W.clientY-Q.top,L={x:C,y:B};g(L),b.current=L,y(!0),ce(C,B),P()},[ce,P]),K=p.useCallback(()=>{be.current=!1,setTimeout(()=>{be.current||(y(!1),g(null),b.current=null,P())},500)},[P]);p.useEffect(()=>{if(!u.expanded)return;P();const D=setInterval(()=>{P()},100);return()=>{clearInterval(D)}},[e,u.expanded,P]);const Ce=p.useCallback(()=>{d(D=>{const j=!D.expanded;return{...D,expanded:j,manuallyExpanded:j}})},[]),We={bottom:a.position.includes("bottom")?a.margin:void 0,top:a.position.includes("top")?a.margin:void 0,right:a.position.includes("right")?a.margin:void 0,left:a.position.includes("left")?a.margin:void 0},it=x&&(be.current||!u.dragging),Ke=h?{position:"absolute",right:a.width+8,top:Math.max(0,Math.min(h.y-N/2,a.height-N)),width:N,height:N,opacity:it?1:0,pointerEvents:"none",transition:"opacity 0.15s ease-out, top 0.1s ease-out"}:{display:"none"};return l.jsxDEV("div",{ref:r,className:`minimap ${u.expanded?"minimap--expanded":"minimap--collapsed"} ${i==="auto"?"minimap--auto":""} ${n||""}`,style:{...We,zIndex:en.MINIMAP},"data-track":"minimap_container",children:[u.expanded&&l.jsxDEV("div",{className:"minimap__content",children:[l.jsxDEV("canvas",{ref:s,width:a.width,height:a.height,className:"minimap__canvas",onPointerDown:Z,onPointerMove:A,onPointerUp:G,onPointerLeave:G,onMouseEnter:X,onMouseLeave:ae,onMouseMove:le,onTouchStart:we,onTouchMove:Fe,onTouchEnd:K,style:{cursor:u.dragging?"grabbing":"pointer"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:822,columnNumber:11},void 0),l.jsxDEV("div",{className:"minimap__preview",style:Ke,children:l.jsxDEV("canvas",{ref:f,width:N,height:N,className:"minimap__preview-canvas"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:844,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:843,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:821,columnNumber:9},void 0),a.collapsible&&l.jsxDEV("button",{className:`minimap__toggle ${u.expanded?"minimap__toggle--expanded":""}`,onClick:Ce,title:u.expanded?"折叠小地图":"展开小地图","data-track":"minimap_click_toggle",children:l.jsxDEV(WN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:861,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:855,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/minimap/Minimap.tsx",lineNumber:812,columnNumber:5},void 0)},Wm=10,CP=3e3,AP=({showMinimap:e=!0,container:t})=>{var q,$,V,R;const n=xt(),{t:i}=ke(),{isDrawerOpen:o,drawerWidth:s}=TP(),[r,a]=p.useState(!1),[c,u]=p.useState(!0),[d,m]=p.useState(!1),f=p.useRef(null),h=p.useRef({zoom:((q=n==null?void 0:n.viewport)==null?void 0:q.zoom)||1,offsetX:(($=n==null?void 0:n.viewport)==null?void 0:$.offsetX)||0,offsetY:((V=n==null?void 0:n.viewport)==null?void 0:V.offsetY)||0}),g=p.useRef(!1),b=p.useRef(null),x=p.useMemo(()=>o?s+Wm:Wm,[o,s]),y=p.useCallback(()=>{fe.updateZoom(n,n.viewport.zoom-.1)},[n]),N=p.useCallback(()=>{fe.updateZoom(n,n.viewport.zoom+.1)},[n]),w=p.useCallback(()=>{fe.fitViewport(n),a(!1)},[n]),T=p.useCallback(()=>{fe.updateZoom(n,1),a(!1)},[n]),S=p.useCallback(()=>{tc(n),a(!1)},[n]),v=p.useCallback(()=>{u(M=>{const _=!M;return m(_),_})},[]);p.useEffect(()=>{if(!c||!n)return;const M=F.getBoardContainer(n);if(!M)return;const _=I=>{var Z;const P=I.target;(Z=f.current)!=null&&Z.contains(P)||(u(!1),m(!1))};return M.addEventListener("mousedown",_),()=>{M.removeEventListener("mousedown",_)}},[c,n]),p.useEffect(()=>{if(!e||!n)return;const M=setInterval(()=>{const _=n.viewport,I=h.current,P=Math.abs(_.zoom-I.zoom)>.001,Z=Math.abs(_.offsetX-I.offsetX)>.5||Math.abs(_.offsetY-I.offsetY)>.5;if(P||Z){if(h.current={zoom:_.zoom,offsetX:_.offsetX,offsetY:_.offsetY},!g.current){g.current=!0;return}c||(u(!0),m(!1)),b.current&&clearTimeout(b.current)}},100);return()=>{clearInterval(M)}},[e,n,c]),p.useEffect(()=>{if(!(!c||d))return b.current=setTimeout(()=>{u(!1)},CP),()=>{b.current&&clearTimeout(b.current)}},[c,d]);const E=p.useCallback(()=>{a(M=>!M)},[]),U=Math.round((((R=n==null?void 0:n.viewport)==null?void 0:R.zoom)||1)*100);return l.jsxDEV("div",{className:"view-navigation",style:{right:x,zIndex:en.VIEW_NAVIGATION},ref:f,"data-testid":"view-navigation",children:[l.jsxDEV("div",{className:"view-navigation__zoom",children:[l.jsxDEV(Dt,{content:i("zoom.out"),showArrow:!1,children:l.jsxDEV("button",{className:"view-navigation__zoom-btn",onClick:y,"aria-label":i("zoom.out"),"data-track":"view_nav_zoom_out","data-testid":"zoom-out",children:l.jsxDEV($N,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:214,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:207,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:206,columnNumber:9},void 0),l.jsxDEV(at,{sideOffset:8,open:r,onOpenChange:a,placement:"bottom",children:[l.jsxDEV(Dt,{content:i("zoom.fit"),showArrow:!1,children:l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("button",{className:"view-navigation__zoom-percent",onClick:E,"aria-label":i("zoom.fit"),"data-track":"view_nav_zoom_menu","data-testid":"zoom-display",children:[U,"%"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:226,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:225,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:224,columnNumber:11},void 0),l.jsxDEV(ct,{container:t,style:{zIndex:en.POPOVER},children:l.jsxDEV("div",{className:"view-navigation-zoom-menu",children:[l.jsxDEV("button",{className:"zoom-menu-item",onClick:w,"data-track":"view_nav_zoom_fit",children:[l.jsxDEV("span",{className:"zoom-menu-item__label",children:i("zoom.fit")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:244,columnNumber:17},void 0),l.jsxDEV("span",{className:"zoom-menu-item__shortcut",children:"⌘⇧="},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:245,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:239,columnNumber:15},void 0),l.jsxDEV("button",{className:"zoom-menu-item",onClick:S,"data-track":"view_nav_zoom_fit_frame",children:l.jsxDEV("span",{className:"zoom-menu-item__label",children:i("zoom.fitFrame")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:252,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:247,columnNumber:15},void 0),l.jsxDEV("button",{className:"zoom-menu-item",onClick:T,"data-track":"view_nav_zoom_100",children:[l.jsxDEV("span",{className:"zoom-menu-item__label",children:i("zoom.100")},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:259,columnNumber:17},void 0),l.jsxDEV("span",{className:"zoom-menu-item__shortcut",children:"⌘0"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:260,columnNumber:17},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:254,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:238,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:237,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:218,columnNumber:9},void 0),l.jsxDEV(Dt,{content:i("zoom.in"),showArrow:!1,children:l.jsxDEV("button",{className:"view-navigation__zoom-btn",onClick:N,"aria-label":i("zoom.in"),"data-track":"view_nav_zoom_in","data-testid":"zoom-in",children:l.jsxDEV(XN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:274,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:267,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:266,columnNumber:9},void 0),e&&l.jsxDEV(Dt,{content:c?"折叠小地图":"展开小地图",showArrow:!1,children:l.jsxDEV("button",{className:`view-navigation__minimap-toggle ${c?"view-navigation__minimap-toggle--expanded":""}`,onClick:v,"aria-label":c?"折叠小地图":"展开小地图","data-track":"view_nav_minimap_toggle",children:l.jsxDEV(KN,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:290,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:284,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:280,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:205,columnNumber:7},void 0),e&&c&&l.jsxDEV("div",{className:"view-navigation__minimap",children:l.jsxDEV(PP,{board:n,displayMode:"always",config:{width:180,height:120,position:"top-right",margin:0,collapsible:!1,defaultExpanded:!0}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:299,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:298,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/view-navigation/ViewNavigation.tsx",lineNumber:195,columnNumber:5},void 0)},MP=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p5),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.MediaLibraryModal}))),IP=({position:e,visible:t,onClose:n,onOpenMediaLibrary:i})=>{const o=xt(),{t:s}=ke(),r=ec(),a=F.getBoardContainer(o),[c,u]=p.useState({freehand:!1,arrow:!1,shape:!1}),[d,m]=p.useState(!1),{refs:f,floatingStyles:h}=Gl({placement:"bottom",middleware:[Wl(12),qp({padding:16}),$l({fallbackPlacements:["top","right","left"]})]});p.useEffect(()=>{if(e&&t){const[V,R]=e;f.setPositionReference({getBoundingClientRect(){return{width:1,height:1,x:V,y:R,top:R,left:V,right:V+1,bottom:R+1}}})}},[e,t,f]),p.useEffect(()=>{if(!t)return;const V=M=>{const _=M.target,I=_.closest(".quick-creation-toolbar"),P=_.closest(".quick-toolbar-popover")||_.closest("[data-radix-popper-content-wrapper]")||_.closest(".plait-popover")||_.closest(".shape-picker")||_.closest(".arrow-picker")||_.closest(".freehand-panel"),Z=_.closest(".media-library-modal");!I&&!P&&!Z&&n()},R=setTimeout(()=>{document.addEventListener("mousedown",V)},100);return()=>{clearTimeout(R),document.removeEventListener("mousedown",V)}},[t,n]);const g=()=>{u({freehand:!1,arrow:!1,shape:!1})},b=V=>{u({freehand:!1,arrow:!1,shape:!1,[V]:!0})},x=()=>{g(),Dn(o),mt(o,null),fe.updatePointerType(o,De.text),r(De.text),n()},y=()=>{g(),Dn(o),mt(o,St.dnd),fe.updatePointerType(o,Di.mind),r(Di.mind),n()},N=()=>{g(),Fr(o),n()},w=async V=>{try{V.type===Vn.IMAGE?await Kl(o,V.url):V.type===Vn.VIDEO?await gf(o,V.url):V.type===Vn.AUDIO&&await Ll(o,V.url,{title:V.name,duration:V.duration,previewImageUrl:V.thumbnail,prompt:V.prompt,mv:V.modelName,clipId:V.clipId,providerTaskId:V.providerTaskId}),re.success(s("toolbar.assetInserted")||"素材已插入到画板"),m(!1),n()}catch(R){console.error("Failed to insert asset:",R),re.error(s("toolbar.assetInsertFailed")||"插入素材失败")}},T=()=>{if(g(),i){i({mode:ii.SELECT,onSelect:w,selectButtonText:s("toolbar.insert")||"插入"}),n();return}m(!0)},[S,v]=p.useState(rt.feltTipPen),E=300,U=p.useRef(null),q=p.useCallback(()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]);p.useEffect(()=>()=>{q()},[q]);const $=(V,R,M,_)=>l.jsxDEV(at,{open:c[R],sideOffset:12,onOpenChange:I=>{I||g()},placement:"bottom",children:[l.jsxDEV(lt,{asChild:!0,children:l.jsxDEV("div",{onPointerEnter:()=>{q(),U.current=setTimeout(()=>{b(R)},E)},onPointerLeave:()=>{q()},children:l.jsxDEV(ne,{type:"icon",visible:!0,selected:c[R],icon:V,"aria-label":M,"data-track":`quick_toolbar_click_${R}`,onPointerDown:()=>{q(),b(R),Dn(o),R==="freehand"&&(mt(o,St.dnd),fe.updatePointerType(o,S),r(S))},onPointerUp:()=>{R==="freehand"&&mt(o,St.drawing)}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:304,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:290,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:289,columnNumber:9},void 0),l.jsxDEV(ct,{container:a,style:{zIndex:en.POPOVER},className:"quick-toolbar-popover",children:_},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:333,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:279,columnNumber:7},void 0);return t?l.jsxDEV(l.Fragment,{children:[l.jsxDEV(Ye,{padding:1,className:`quick-creation-toolbar ${Mt}`,ref:f.setFloating,style:h,children:l.jsxDEV(ft.Row,{gap:1,children:[l.jsxDEV(ne,{type:"icon",visible:!0,icon:l.jsxDEV(oc,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:359,columnNumber:19},void 0),"aria-label":s("toolbar.text"),"data-track":"quick_toolbar_click_text",onPointerUp:x},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:356,columnNumber:11},void 0),l.jsxDEV(ne,{type:"icon",visible:!0,icon:l.jsxDEV(Ur,{size:24},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:369,columnNumber:19},void 0),"aria-label":s("toolbar.image"),"data-track":"quick_toolbar_click_image",onPointerUp:N},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:366,columnNumber:11},void 0),l.jsxDEV(ne,{type:"icon",visible:!0,icon:l.jsxDEV(Vr,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:379,columnNumber:19},void 0),"aria-label":s("toolbar.mediaLibrary"),"data-track":"quick_toolbar_click_media_library",onPointerUp:T},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:376,columnNumber:11},void 0),$(l.jsxDEV(bo,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:387,columnNumber:13},void 0),"freehand",s("toolbar.pen"),l.jsxDEV(Ic,{onPointerUp:V=>{g(),v(V),fe.updatePointerType(o,V),r(V),n()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:390,columnNumber:13},void 0)),$(l.jsxDEV(ic,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:405,columnNumber:13},void 0),"arrow",s("toolbar.arrow"),l.jsxDEV(Uc,{onPointerUp:V=>{g(),fe.updatePointerType(o,V),r(V),n()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:408,columnNumber:13},void 0)),$(l.jsxDEV(nc,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:420,columnNumber:13},void 0),"shape",s("toolbar.shape"),l.jsxDEV(Vc,{onPointerUp:V=>{g(),fe.updatePointerType(o,V),r(V),n()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:423,columnNumber:13},void 0)),l.jsxDEV(ne,{type:"icon",visible:!0,icon:l.jsxDEV(ar,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:437,columnNumber:19},void 0),"aria-label":s("toolbar.mind"),"data-track":"quick_toolbar_click_mind",onPointerUp:y},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:434,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:354,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:348,columnNumber:7},void 0),d&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(MP,{isOpen:d,onClose:()=>{m(!1)},mode:ii.SELECT,onSelect:w,selectButtonText:s("toolbar.insert")||"插入"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:448,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:447,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/toolbar/quick-creation-toolbar/quick-creation-toolbar.tsx",lineNumber:347,columnNumber:5},void 0):null},VP=({children:e,onOpenMediaLibrary:t})=>{const[n,i]=p.useState(!1),{confirm:o,confirmDialog:s}=Ir(),r=p.useCallback(()=>{n||(i(!0),o({title:"缓存空间已满",description:"图片缓存空间已满,无法继续缓存新图片。是否打开素材库清理缓存?",confirmText:"打开素材库",cancelText:"稍后处理",confirmTheme:"warning"}).then(a=>{i(!1),a&&(t==null||t())}))},[o,n,t]);return YN(r),l.jsxDEV(l.Fragment,{children:[e,s]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/cache-quota-provider/CacheQuotaProvider.tsx",lineNumber:52,columnNumber:5},void 0)},wr={visible:!1,position:{x:0,y:0},sourceElement:null,currentShape:null,hitIndex:-1,hitPoint:null,mode:"hover",arrowLineElement:null,arrowLineEndPoint:null},$g=new WeakMap,Pl=new WeakMap;function vr(e){return $g.get(e)||wr}function Fo(e,t){$g.set(e,t);const n=Pl.get(e);n&&n(t)}function UP(e,t){return Pl.set(e,t),()=>{Pl.delete(e)}}function Hc(e){Fo(e,wr)}const Co=100;function RP(e,t,n,i,o){const s=ny(n),r=ge.getRectangleByPoints(t.points),a=r.width,c=r.height,u=r.x+a/2,d=r.y+c/2,f=ge.getEdgeCenterPoints(r)[n];let h,g;switch(s){case pt.right:h=u+a/2+Co+a/2,g=d;break;case pt.bottom:h=u,g=d+c/2+Co+c/2;break;case pt.left:h=u-a/2-Co-a/2,g=d;break;case pt.top:h=u,g=d-c/2-Co-c/2;break;default:h=u+a/2+Co+a/2,g=d}const b=[[h-a/2,g-c/2],[h+a/2,g+c/2]],x=cc(e,b,o);if(x.fill="#ffffff",H.isShapeElement(t)&&!H.isText(t)){const V=t;V.angle!==void 0&&(x.angle=V.angle),V.fill&&V.fill!=="none"&&(x.fill=V.fill),V.strokeColor!==void 0&&(x.strokeColor=V.strokeColor),V.strokeStyle!==void 0&&(x.strokeStyle=V.strokeStyle),V.strokeWidth!==void 0&&(x.strokeWidth=V.strokeWidth)}const y=cr(f,t)||f,N=H.isShapeElement(t)?ns(e,y,t):void 0;let w;switch(s){case pt.right:w=3;break;case pt.bottom:w=0;break;case pt.left:w=1;break;case pt.top:w=2;break;default:w=3}const T=ge.getRectangleByPoints(x.points),v=ge.getEdgeCenterPoints(T)[w],E=cr(v,x)||v,U=ns(e,E,x),q=Af(Sn.straight,[y,E],{marker:is.none,connection:N,boundId:t.id},{marker:is.arrow,connection:U,boundId:x.id},[],{});ue.insertNode(e,q,[e.children.length]),Cf(e,x),Hc(e);const $=x.id;setTimeout(()=>{const V=e.children.findIndex(M=>M.id===$),R=V>=0?e.children[V]:null;R&&(oi(e),Ti(e,R),fe.updatePointerType(e,Et.selection),ue.setNode(e,{_forceRender:Date.now()},[V]),ue.setNode(e,{_forceRender:void 0},[V]))},50)}function qP(e,t,n,i){var g;let o=100,s=100;const r=t,a=(g=r.source)==null?void 0:g.boundId;if(a){const b=e.children.find(x=>x.id===a);if(b&&H.isShapeElement(b)){const x=ge.getRectangleByPoints(b.points);o=x.width,s=x.height}}const c=[[n[0]-o/2,n[1]-s/2],[n[0]+o/2,n[1]+s/2]],u=cc(e,c,i);u.fill="#ffffff";const d=ge.getRectangleByPoints(u.points),m=ge.getEdgeCenterPoints(d),f=r.points||[];if(f.length>=2){const b=f[0],x=f[f.length-1],y=x[0]-b[0],N=x[1]-b[1];let w;Math.abs(y)>Math.abs(N)?w=y>0?3:1:w=N>0?0:2;const T=m[w],S=ns(e,T,u),v=e.children.findIndex(E=>E.id===t.id);v!==-1&&ue.setNode(e,{target:{marker:is.arrow,connection:S,boundId:u.id},points:[b,T]},[v])}Cf(e,u),Hc(e);const h=u.id;setTimeout(()=>{const b=e.children.findIndex(y=>y.id===h),x=b>=0?e.children[b]:null;x&&(oi(e),Ti(e,x),fe.updatePointerType(e,Et.selection),ue.setNode(e,{_forceRender:Date.now()},[b]),ue.setNode(e,{_forceRender:void 0},[b]))},50)}const BP=e=>{const{pointerMove:t,pointerLeave:n,globalPointerUp:i}=e;let o=null,s=-1,r=e.children.length,a={x:0,y:0};return e.pointerMove=c=>{var T;a={x:c.clientX,y:c.clientY},o&&(clearTimeout(o),o=null);const u=Pf(e),d=u.length===1&&u[0],m=vr(e);if(!d||!H.isShapeElement(d)||H.isText(d)){if(m.visible&&m.mode==="hover"&&Fo(e,{...wr}),s=-1,d&&H.isShapeElement(d)&&!Zi.getElementRef(d))return;t(c);return}if(!Zi.getElementRef(d)){s=-1;return}const h=ZN(e,c.x,c.y),g=QN(e,d,!0),b=JN(e,h,d,!0)||h,x=ey(b,g),y=g[x];if(y){if(x!==s||!m.visible){s=x;const S=c.clientX,v=c.clientY;o=setTimeout(()=>{const E=H.isImage(d)?De.rectangle:d.shape||De.rectangle;Fo(e,{visible:!0,position:{x:S-140,y:v+20},sourceElement:d,currentShape:E,hitIndex:x,hitPoint:y,mode:"hover"})},50)}}else s=-1,m.visible&&m.mode==="hover"&&(o=setTimeout(()=>{const S=vr(e);S.visible&&S.mode==="hover"&&Fo(e,{...wr})},300));const N=Zi.getElementRef(d);(T=N==null?void 0:N.getGenerator)!=null&&T.call(N,ty.key)&&t(c)},e.pointerLeave=c=>{o&&(clearTimeout(o),o=null),n(c)},e.globalPointerUp=c=>{var d;i(c);const u=e.children.length;if(u>r){const m=e.children[u-1];if(H.isArrowLine(m)){const f=m;if(!((d=f.target)==null?void 0:d.boundId)){const g=f.points||[];if(g.length>=2){const b=g[g.length-1];setTimeout(()=>{Fo(e,{visible:!0,position:{x:a.x-140,y:a.y+20},sourceElement:null,currentShape:De.rectangle,hitIndex:-1,hitPoint:null,mode:"arrowLine",arrowLineElement:m,arrowLineEndPoint:b})},50)}}}}r=e.children.length},e},Ao=100;function LP(e){switch(e){case"ArrowRight":return pt.right;case"ArrowDown":return pt.bottom;case"ArrowLeft":return pt.left;case"ArrowUp":return pt.top;default:return null}}function OP(e){switch(e){case pt.top:return 0;case pt.right:return 1;case pt.bottom:return 2;case pt.left:return 3;default:return 1}}function FP(e){return(e+2)%4}function HP(e,t,n,i,o,s){const r={x:t-i/2,y:n-o/2,width:i,height:o};for(const a of e.children)if(a.id!==s&&H.isDrawElement(a)&&!H.isArrowLine(a))try{const c=ge.getRectangleByPoints(a.points);if(r.x<c.x+c.width&&r.x+r.width>c.x&&r.y<c.y+c.height&&r.y+r.height>c.y)return!0}catch{}return!1}function zP(e,t,n){const i=ge.getRectangleByPoints(t.points),o=i.width,s=i.height,r=i.x+o/2,a=i.y+s/2;let c,u;switch(n){case pt.right:c=r+o/2+Ao+o/2,u=a;break;case pt.bottom:c=r,u=a+s/2+Ao+s/2;break;case pt.left:c=r-o/2-Ao-o/2,u=a;break;case pt.top:c=r,u=a-s/2-Ao-s/2;break;default:c=r+o/2+Ao+o/2,u=a}let d=0;const m=n===pt.right||n===pt.left?s+20:o+20;for(;HP(e,c,u,o,s,t.id)&&(d+=m,n===pt.right||n===pt.left?u=a+d:c=r+d,!(d>1e3)););const f=[[c-o/2,u-s/2],[c+o/2,u+s/2]],g=t.shape||"rectangle",b=cc(e,f,g);if(b.fill="#ffffff",H.isShapeElement(t)&&!H.isText(t)){const M=t;M.fill&&M.fill!=="none"&&(b.fill=M.fill),M.strokeColor!==void 0&&(b.strokeColor=M.strokeColor),M.strokeWidth!==void 0&&(b.strokeWidth=M.strokeWidth)}const x=OP(n),y=FP(x),w=ge.getEdgeCenterPoints(i)[x],T=cr(w,t)||w,S=H.isShapeElement(t)?ns(e,T,t):void 0,v=ge.getRectangleByPoints(b.points),U=ge.getEdgeCenterPoints(v)[y],q=cr(U,b)||U,$=ns(e,q,b),V=Af(Sn.elbow,[T,q],{marker:is.none,connection:S,boundId:t.id},{marker:is.arrow,connection:$,boundId:b.id},[],{});ue.insertNode(e,V,[e.children.length]),ue.insertNode(e,b,[e.children.length]);const R=b.id;setTimeout(()=>{const M=e.children.find(_=>_.id===R);M&&(oi(e),Ti(e,M),fe.updatePointerType(e,Et.selection),Mf(e,[c,u]))},50)}function GP(e,t){var o,s,r,a;const n=[],i=[];for(const c of e.children){if(!H.isArrowLine(c))continue;const u=c;if(((o=u.source)==null?void 0:o.boundId)===t.id&&((s=u.target)!=null&&s.boundId)){const d=e.children.find(m=>m.id===u.target.boundId);d&&i.push(d)}if(((r=u.target)==null?void 0:r.boundId)===t.id&&((a=u.source)!=null&&a.boundId)){const d=e.children.find(m=>m.id===u.source.boundId);d&&n.push(d)}}return{incoming:n,outgoing:i}}function WP(e,t,n){const{incoming:i,outgoing:o}=GP(e,t),s=n?[...o,...i]:[...i,...o];if(s.length===0)return!1;const r=s[0];oi(e),Ti(e,r);try{const a=Ot(e,[r],!1),c=a.x+a.width/2,u=a.y+a.height/2;Mf(e,[c,u])}catch{}return!0}const $P=e=>{const{keyDown:t}=e;return e.keyDown=n=>{if(!n.altKey&&!n.metaKey&&!n.ctrlKey){if(!n.shiftKey){const i=LP(n.key);if(i!==null){const o=Pf(e);if(o.length===1){const s=o[0];if(H.isShapeElement(s)&&!H.isText(s)&&!H.isImage(s)){zP(e,s,i),n.preventDefault();return}}}}if(n.key==="Tab"){const i=Be(e);if(i.length===1){const o=i[0];if(H.isDrawElement(o)&&H.isShapeElement(o)&&WP(e,o,!n.shiftKey)){n.preventDefault();return}}}}t(n)},e},XP=240,KP=new Set(["5","7"]);function YP(e,t,n){const i=n*Math.PI/180,o=Math.cos(i),s=Math.sin(i),r=e[0]-t[0],a=e[1]-t[1];return[t[0]+r*o-a*s,t[1]+r*s+a*o]}function ZP(e,t,n=0){const i=ge.getCenterPoint(e),s=Ai(e,ui).filter(r=>KP.has(String(r.handle)));if(n){const r=YP(t,i,-n),a=s.find(c=>ge.isHit(ge.getRectangleByPoints([r,r]),c.rectangle));return a&&(a.cursorClass=Gr(a.cursorClass,n)),a}return s.find(r=>ge.isHit(ge.getRectangleByPoints([t,t]),r.rectangle))}function QP(e){const t=Be(e);return t.length===1&&Kn(t[0])}function JP(e,t){const n=Be(e);if(n.length!==1||!Kn(n[0]))return null;const i=n[0],o=ge.getRectangleByPoints(i.points),s=ZP(o,t,0);return s?{element:i,rectangle:o,handle:s.handle,cursorClass:s.cursorClass}:null}function eC(e,t,n,i){const o=e.width/e.height,s=t==="7",r=s?-n:n,a=Math.max(XP,e.width+r),c=a/o,u=(e.height-c)/2;return{x:s?e.x+(e.width-a):e.x,y:e.y+u,width:a,height:c}}function tC(e,t,n){const{element:i,rectangle:o,handle:s}=t,{startPoint:r,endPoint:a}=n;if(!o)return;const c=a[0]-r[0];a[1]-r[1];const u=eC(o,s,c),d=[[u.x,u.y],[u.x+u.width,u.y+u.height]],m=e.children.findIndex(f=>f.id===i.id);m>=0&&ue.setNode(e,{points:d},[m])}const nC=e=>Ci(e,{key:"audio-nodes",canResize:()=>QP(e),hitTest:(t=>JP(e,t)),onResize:(t,n)=>tC(e,t,n)}),iC=[{icon:l.jsxDEV(ef,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:27,columnNumber:11},void 0),title:"Rectangle",pointer:De.rectangle},{icon:l.jsxDEV(tf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:28,columnNumber:11},void 0),title:"Ellipse",pointer:De.ellipse},{icon:l.jsxDEV(nf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:29,columnNumber:11},void 0),title:"Triangle",pointer:De.triangle},{icon:l.jsxDEV(of,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:30,columnNumber:11},void 0),title:"Terminal",pointer:Jl.terminal},{icon:l.jsxDEV(sf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:31,columnNumber:11},void 0),title:"Diamond",pointer:De.diamond},{icon:l.jsxDEV(rf,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:32,columnNumber:11},void 0),title:"Parallelogram",pointer:De.parallelogram},{icon:l.jsxDEV(af,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:33,columnNumber:11},void 0),title:"RoundRectangle",pointer:De.roundRectangle}],oC=({visible:e,position:t,currentShape:n,onSelectShape:i,onClose:o,container:s})=>{const r=p.useRef(null);p.useEffect(()=>{if(!e)return;const f=b=>{r.current&&!r.current.contains(b.target)&&o()},h=b=>{b.key==="Escape"&&o()},g=setTimeout(()=>{document.addEventListener("mousedown",f),document.addEventListener("keydown",h)},50);return()=>{clearTimeout(g),document.removeEventListener("mousedown",f),document.removeEventListener("keydown",h)}},[e,o]);const a=p.useCallback(f=>{i(f)},[i]);if(!e)return null;const c={x:isNaN(t.x)?0:t.x,y:isNaN(t.y)?0:t.y},u=200,d=80;typeof window<"u"&&(c.x+u>window.innerWidth&&(c.x=window.innerWidth-u-10),c.y+d>window.innerHeight&&(c.y=t.y-d-20));const m=l.jsxDEV("div",{ref:r,className:Y("auto-complete-shape-picker",Mt),style:{left:c.x,top:c.y},children:l.jsxDEV(Ye,{padding:1,children:l.jsxDEV(ft.Col,{gap:1,children:l.jsxDEV(ft.Row,{gap:1,children:iC.map((f,h)=>l.jsxDEV(ne,{className:Y("shape-button",{"is-current":n===f.pointer}),type:"icon",size:"small",visible:!0,icon:f.icon,tooltip:f.title,"aria-label":f.title,onPointerDown:({event:g})=>{g.stopPropagation(),a(f.pointer)}},h,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:127,columnNumber:15},void 0))},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:125,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:124,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:123,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/auto-complete-shape-picker/auto-complete-shape-picker.tsx",lineNumber:115,columnNumber:5},void 0);return s?Rr.createPortal(m,s):m},sC={visible:!1,position:{x:0,y:0},sourceElement:null,currentShape:null,hitIndex:-1,hitPoint:null,mode:"hover"};function rC(e){const[t,n]=p.useState(sC);p.useEffect(()=>{if(!e)return;n(vr(e));const s=UP(e,r=>{n(r)});return()=>{s()}},[e]);const i=p.useCallback(s=>{if(!e)return;const r=vr(e);r.mode==="arrowLine"?r.arrowLineElement&&r.arrowLineEndPoint&&qP(e,r.arrowLineElement,r.arrowLineEndPoint,s):r.sourceElement&&r.hitPoint&&r.hitIndex>=0&&RP(e,r.sourceElement,r.hitIndex,r.hitPoint,s)},[e]),o=p.useCallback(()=>{e&&Hc(e)},[e]);return{state:t,selectShape:i,closePicker:o}}const aC="#ffffff",lC=[De.rectangle,De.ellipse,De.triangle,De.diamond,De.parallelogram,De.roundRectangle];function $m(e){if(!H.isGeometry(e)||H.isText(e)||H.isImage(e))return!1;const t=e;return!(!t.shape||!lC.includes(t.shape)||t.fill&&t.fill!=="none")}const cC=e=>{const{afterChange:t}=e,n=new Set;return e.afterChange=()=>{t();const i=[];e.children.forEach((o,s)=>{$m(o)&&!n.has(o.id)&&(i.push({path:[s],element:o}),n.add(o.id))}),i.length>0&&setTimeout(()=>{i.forEach(({path:o})=>{const s=e.children[o[0]];s&&$m(s)&&ue.setNode(e,{fill:aC},o)})},0)},e},Er=new WeakMap;let qa=null,Cn=null;function Xg(e,t){try{const n=Zi.getElementG(t);if(n)return n}catch{}if(t!=null&&t.id){const n=F.getElementHost(e);if(n){const i=n.querySelector(`g[id="${t.id}"]`);if(i)return i}}return null}function Kg(e){return e.querySelector("path, rect, ellipse, polygon, circle")}function Yg(e){let t=e.querySelector("defs");return t||(t=iy(),e.insertBefore(t,e.firstChild)),t}function uC(e,t){const n=Er.get(t);if(n){const i=e.querySelector(`#${n}`);i&&i.remove()}}function kr(e,t,n){const i=Xg(e,t);if(!i)return;const o=Kg(i);if(!o)return;const s=i.closest("svg");if(!s)return;const r=Ot(e,[t],!1),a=(r==null?void 0:r.width)||100,c=(r==null?void 0:r.height)||100,u=If(n,t.id,a,c),d=Yg(s);if(u.defElement){const m=u.defElement.id,f=d.querySelector(`#${m}`);f?f.replaceWith(u.defElement):d.appendChild(u.defElement),o.setAttribute("fill",u.fillValue),Er.set(t,m);const h=Er.get(t);if(h&&h!==m){const g=d.querySelector(`#${h}`);g&&g.remove()}}else o.setAttribute("fill",u.fillValue),uC(s,t)}function ir(e,t){return e.children.find(n=>n.id===t)||null}function In(e){const t=e.fillConfig;return t&&Un(t)?t:e.fill&&Un(e.fill)?e.fill:null}function Zg(e,t){if(!e)return!1;if(e==="[object Object]")return!0;if(e.startsWith("url(#")){const n=e.match(/url\(#([^)]+)\)/);if(n){const i=n[1];if(!document.getElementById(i))return!0}return!1}if(t){const n=In(t);if(n&&(n.type==="gradient"||n.type==="image"))return!0}return!1}function dC(e){if(!Cn)return;const t=new Set;e.forEach(n=>{if(n.type==="attributes"&&n.attributeName==="fill"){const i=n.target,o=i.getAttribute("fill"),s=i.closest("g[id]");if(s){const r=s.getAttribute("id");if(r){const a=ir(Cn,r),c=a?In(a):null;a&&c&&cn(Cn,a)&&Zg(o,a)&&t.add(a)}}}n.type==="childList"&&n.addedNodes.forEach(i=>{if(i instanceof SVGGElement&&i.hasAttribute("id")){const o=i.getAttribute("id");if(o){const s=ir(Cn,o),r=s?In(s):null;s&&r&&cn(Cn,s)&&t.add(s)}}if(i instanceof Element){const o=i.closest("g[id]");if(o){const s=o.getAttribute("id");if(s){const r=ir(Cn,s),a=r?In(r):null;r&&a&&cn(Cn,r)&&t.add(r)}}}})}),t.size>0&&t.forEach(n=>{const i=In(n);i&&kr(Cn,n,i)})}function mC(e){if(qa)return;const t=F.getElementHost(e);t&&(Cn=e,qa=new MutationObserver(dC),qa.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["fill"]}))}function pC(e){const t=F.getElementHost(e);if(!t)return;t.querySelectorAll("path[fill], rect[fill], ellipse[fill], polygon[fill], circle[fill]").forEach(i=>{const o=i.getAttribute("fill"),s=i.closest("g[id]");if(s){const r=s.getAttribute("id");if(r){const a=ir(e,r),c=a?In(a):null;a&&c&&cn(e,a)&&Zg(o,a)&&kr(e,a,c)}}})}function Cl(e,t=!1){e.children.forEach(n=>{const i=In(n);i&&cn(e,n)&&(t?kr(e,n,i):requestAnimationFrame(()=>{kr(e,n,i)}))}),t&&pC(e)}let Xm=!0;const Km=new WeakSet;function Qg(e){const t=F.getElementHost(e);if(!t)return;const n=t.closest("svg")||t.querySelector("svg");n&&e.children.forEach(i=>{const o=In(i);if(o&&(o.type==="gradient"||o.type==="image")&&cn(e,i)){const s=Ot(e,[i],!1),r=(s==null?void 0:s.width)||100,a=(s==null?void 0:s.height)||100,c=If(o,i.id,r,a);if(c.defElement){const u=Yg(n);u.querySelector(`#${c.defElement.id}`)||(u.appendChild(c.defElement),Er.set(i,c.defElement.id))}}})}function fC(e){let t=0;return e.children.forEach(n=>{const i=In(n);if(i&&(i.type==="gradient"||i.type==="image")&&cn(e,n)){const o=Xg(e,n);(o?Kg(o):null)||t++}}),t}function hC(e){if(Km.has(e))return;Km.add(e);const t=15,n=16;let i=0;const o=()=>{i++;try{if(!F.getElementHost(e))return;if(Qg(e),Cl(e,!0),fC(e)>0&&i<t){const a=Math.min(n*Math.pow(1.5,i),500);setTimeout(o,a)}}catch{}};requestAnimationFrame(()=>{o(),setTimeout(o,0)})}const gC=e=>{const{afterChange:t}=e;return e.afterChange=()=>{t(),mC(e),Qg(e),Xm?(Xm=!1,Cl(e,!0),hC(e)):Cl(e,!0)},e};function bC(e,t){return Ai(e,ui).find(i=>ge.isHit(ge.getRectangleByPoints([t,t]),i.rectangle))}function xC(e){const t=Be(e);return t.length!==1?!1:wi(t[0])}function NC(e,t){const n=Be(e);if(n.length!==1||!wi(n[0]))return null;const i=n[0],o=ge.getRectangleByPoints(i.points),s=bC(o,t);return s?{element:i,rectangle:o,handle:s.handle,cursorClass:s.cursorClass}:null}function yC(e,t,n){const{element:i,rectangle:o,handle:s}=t;if(!o)return;const{startPoint:r,endPoint:a}=n,c=a[0]-r[0],u=a[1]-r[1],d=xo(o,s,c,u,hs(),60),m=[[d.x,d.y],[d.x+d.width,d.y+d.height]],f=e.children.findIndex(h=>h.id===i.id);f>=0&&ue.setNode(e,{points:m},[f])}function wC(e,t){const{element:n}=t,i=e.children.find(o=>o.id===n.id);i&&oy.updateFrameMembers(e,i)}const vC=e=>Ci(e,{key:"frame-elements",canResize:()=>xC(e),hitTest:t=>NC(e,t),onResize:(t,n)=>yC(e,t,n),afterResize:t=>wC(e,t)});function Ba(e){return!!e.locked}const EC=e=>{const{isHit:t,isRectangleHit:n,isMovable:i}=e;return e.isHit=(o,s,r)=>Ba(o)?!1:t(o,s,r),e.isRectangleHit=(o,s)=>Ba(o)?!1:n(o,s),e.isMovable=o=>Ba(o)?!1:i(o),e},Al="aitu-tab-sync-version",kC=500,Ml=`tab-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;function Jg({onSyncNeeded:e,enabled:t=!0,currentBoardId:n}){const i=p.useRef(-1),o=p.useRef();p.useEffect(()=>{if(!t)return;const s=localStorage.getItem(Al);if(s)try{const r=JSON.parse(s);i.current=r.version}catch{i.current=parseInt(s,10)||Date.now()}else i.current=Date.now()},[t]),p.useEffect(()=>{if(!t)return;const s=()=>{const a=localStorage.getItem(Al);if(a)try{const c=JSON.parse(a);if(c.version>i.current&&c.tabId!==Ml){const u=n&&c.boardId&&c.boardId===n;i.current=c.version,u&&e()}else c.version>i.current&&c.tabId===Ml&&(i.current=c.version)}catch{const c=parseInt(a,10);c>i.current&&(i.current=c)}};o.current=setInterval(()=>{document.hidden||s()},kC);const r=()=>{document.hidden||s()};return document.addEventListener("visibilitychange",r),()=>{o.current&&clearInterval(o.current),document.removeEventListener("visibilitychange",r)}},[t,e,n])}function eb(e){try{const n={version:Date.now(),tabId:Ml,boardId:e};localStorage.setItem(Al,JSON.stringify(n))}catch{}}const N2=Object.freeze(Object.defineProperty({__proto__:null,markTabSyncVersion:eb,useTabSync:Jg},Symbol.toStringTag,{value:"Module"})),Il=new Set,Ym=4,Bs=1e3;function Xn(e,t){if(t===void 0){console.info(`[StartupPrefetch] ${e}`);return}console.info(`[StartupPrefetch] ${e}`,t)}function Zm(e){e.forEach(t=>Il.delete(t))}function Qm(){const e=typeof navigator<"u"?navigator.connection:void 0;return e?e.saveData?!1:e.effectiveType!=="slow-2g"&&e.effectiveType!=="2g":!0}function tb(e){if(typeof window>"u"||!("serviceWorker"in navigator)||e.length===0||!Qm()){Xn("skip idle prefetch request",{hasWindow:typeof window<"u",hasServiceWorker:typeof navigator<"u"&&"serviceWorker"in navigator,groupCount:e.length,canUseConnection:Qm()});return}const t=e.filter(s=>Il.has(s)?!1:(Il.add(s),!0));if(t.length===0){Xn("skip idle prefetch request: all groups already requested",{groups:e});return}const n={type:"SW_PREFETCH_GROUPS",groups:t},i=(s=1)=>{const r=navigator.serviceWorker.controller;if(r){r.postMessage(n),Xn("posted idle prefetch request via controller",{groups:t,attempt:s});return}navigator.serviceWorker.ready.then(a=>{if(a.active){a.active.postMessage(n),Xn("posted idle prefetch request via registration.active",{groups:t,attempt:s});return}if(s>=Ym){Zm(t),console.warn("[StartupPrefetch] idle prefetch request dropped: no active service worker",{groups:t,attempt:s});return}Xn("retry idle prefetch request: no active service worker yet",{groups:t,attempt:s,retryDelayMs:Bs}),window.setTimeout(()=>i(s+1),Bs)}).catch(a=>{if(s>=Ym){Zm(t),console.warn("[StartupPrefetch] idle prefetch request failed after retries",{groups:t,attempt:s,error:a});return}Xn("retry idle prefetch request after navigator.serviceWorker.ready failure",{groups:t,attempt:s,retryDelayMs:Bs}),window.setTimeout(()=>i(s+1),Bs)})},o=window.requestIdleCallback;typeof o=="function"?(Xn("queue idle prefetch request with requestIdleCallback",{groups:t}),o(()=>i(),{timeout:1500})):(Xn("queue idle prefetch request with setTimeout fallback",{groups:t}),window.setTimeout(i,400))}const SC=p.lazy(()=>Me(()=>import("./DeferredAIInputBar-ObyfJQ0O.js"),__vite__mapDeps([0,4,5,6,7,8,9]),import.meta.url).then(e=>({default:e.DeferredAIInputBar}))),TC=p.lazy(()=>Me(()=>import("./index-oT8mbA3U.js"),__vite__mapDeps([0,4,5,10]),import.meta.url).then(e=>({default:e.ChatDrawer}))),mn=["tool-windows","runtime-static-assets"],DC=p.lazy(()=>Me(()=>import("./DrawnixDeferredFeatures-CFHVLxc5.js"),__vite__mapDeps([0,11]),import.meta.url).then(e=>({default:e.DrawnixDeferredFeatures}))),_C=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p8),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.DrawnixDeferredRuntime}))),jC=p.lazy(()=>Me(()=>import("./ttd-dialog-BRg3XE5k.js"),__vite__mapDeps([0,4,6,7,8,2,3,12,13]),import.meta.url).then(e=>({default:e.TTDDialog}))),PC=p.lazy(()=>Me(()=>import("./settings-dialog-CAhU3cfG.js"),__vite__mapDeps([0,4,6,14]),import.meta.url).then(e=>({default:e.SettingsDialog}))),CC=p.lazy(()=>Me(()=>import("./tool-windows-CtLXQDGF.js").then(e=>e.p2),__vite__mapDeps([0]),import.meta.url).then(e=>({default:e.UnifiedMediaViewer}))),AC=p.lazy(()=>Me(()=>import("./CanvasAudioPlayer-DwM6PU4W.js"),__vite__mapDeps([0,15]),import.meta.url).then(e=>({default:e.CanvasAudioPlayer}))),MC=[],IC=({value:e,viewport:t,theme:n,onChange:i,onSelectionChange:o,onViewportChange:s,onThemeChange:r,onValueChange:a,afterInit:c,onBoardSwitch:u,onTabSyncNeeded:d,isDataReady:m=!1,currentBoardId:f})=>{const h={readonly:!1,hideScrollbar:!1,disabledScrollOnNonFocus:!1,themeColors:Sy},[g,b]=p.useState(()=>{const ie=new hS(window.navigator.userAgent);return{pointer:Et.hand,isMobile:ie.mobile()!==null,isPencilMode:!1,openDialogTypes:new Set,dialogInitialData:null,dialogInitialDataByType:{},openCleanConfirm:!1,openSettings:!1}}),[x,y]=p.useState(null),[N,w]=p.useState(!1),[T,S]=p.useState(!1),[v,E]=p.useState(!1),[U,q]=p.useState(!1),[$,V]=p.useState({mode:ii.BROWSE}),[R,M]=p.useState(!1),[_,I]=p.useState(!1),[P,Z]=p.useState(!1),[pe,A]=p.useState(!1),[G,ce]=p.useState(!1),[X,ae]=p.useState(!1),[le,be]=p.useState(!1),we=p.useRef(null),Fe=p.useCallback(()=>{w(!1),S(!1),E(!1),q(!1)},[]),K=p.useCallback((ie=MC)=>{tb(ie),Z(!0)},[]),Ce=p.useCallback((ie=mn)=>{K(ie),be(!0),ae(!0)},[K]),We=p.useCallback(()=>{Ce(mn),Promise.all([Me(()=>import("./tool-windows-CtLXQDGF.js").then(ie=>ie.oU),__vite__mapDeps([0]),import.meta.url),Me(()=>import("./tool-windows-CtLXQDGF.js").then(ie=>ie.oT),__vite__mapDeps([0]),import.meta.url)]).then(([{toolWindowService:ie},{BUILT_IN_TOOLS:Ae}])=>{const Ue=Ae.find(Le=>Le.id==="knowledge-base");if(!Ue)return;const _e=ie.getToolState(Ue.id);_e&&_e.status==="open"?ie.closeTool(Ue.id):ie.openTool(Ue)})},[Ce]);p.useEffect(()=>{const ie=Ae=>{const{noteId:Ue}=Ae.detail;Ce(mn),Promise.all([Me(()=>import("./tool-windows-CtLXQDGF.js").then(_e=>_e.oU),__vite__mapDeps([0]),import.meta.url),Me(()=>import("./tool-windows-CtLXQDGF.js").then(_e=>_e.oT),__vite__mapDeps([0]),import.meta.url)]).then(([{toolWindowService:_e},{BUILT_IN_TOOLS:Le}])=>{const It=Le.find(Vt=>Vt.id==="knowledge-base");if(!It)return;const _t=_e.isToolOpen(It.id);_e.openTool(It,{componentProps:Ue?{initialNoteId:Ue}:{}}),_t&&Ue&&window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("kb:open-note",{detail:{noteId:Ue}}))},50)})};return window.addEventListener("kb:open",ie),()=>window.removeEventListener("kb:open",ie)},[Ce]);const it=p.useCallback(()=>{if(Ce(mn),N){w(!1);return}S(!1),E(!1),q(!1),w(!0)},[Ce,N]),Ke=p.useCallback(()=>{if(Ce(mn),T){S(!1);return}w(!1),E(!1),q(!1),S(!0)},[Ce,T]),D=p.useCallback(()=>{if(K(mn),v){E(!1);return}w(!1),S(!1),q(!1),E(!0)},[K,v]),j=p.useCallback(ie=>{Ce(mn),Fe(),V({mode:ii.BROWSE,...ie}),q(!0)},[Fe,Ce]),W=p.useCallback(()=>{K(mn),M(!0)},[K]),Q=p.useCallback(()=>{K(mn),I(!0)},[K]),C=p.useCallback(ie=>{b(ie)},[]),B=p.useCallback(ie=>{b(Ae=>({...Ae,...ie}))},[]);p.useEffect(()=>{x&&(x.appState=g,x.__setAppState=C,we.current=x)},[x,g,C]),p.useEffect(()=>{if(new URLSearchParams(window.location.search).has("tool")){Ce(mn);return}},[Ce]),p.useEffect(()=>{if(typeof window>"u"||!("serviceWorker"in navigator))return;let ie=!1;const Ae=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",Ue=_t=>{var Vt;((Vt=_t.data)==null?void 0:Vt.type)==="SW_IDLE_PREFETCH_STATUS"&&mn.every(Lt=>{var zt;return(zt=_t.data.completedGroups)==null?void 0:zt.includes(Lt)})&&(ie=!0,be(!0))};navigator.serviceWorker.addEventListener("message",Ue);const _e={type:"SW_IDLE_PREFETCH_STATUS_GET"},Le=navigator.serviceWorker.controller;Le?Le.postMessage(_e):navigator.serviceWorker.ready.then(_t=>{var Vt;(Vt=_t.active)==null||Vt.postMessage(_e)}).catch(()=>{});const It=window.setTimeout(()=>{ie||le||(Ae?console.info("[Drawnix] SW idle prefetch status unresolved in dev, enabling minimized tools bar fallback"):console.warn("[Drawnix] SW idle prefetch status unresolved, enabling minimized tools bar fallback"),be(!0))},2200);return()=>{window.clearTimeout(It),navigator.serviceWorker.removeEventListener("message",Ue)}},[le]),p.useEffect(()=>{const ie=window.requestIdleCallback;let Ae;const Ue=window.setTimeout(()=>{const _e=()=>{A(!0),ce(!0)};if(typeof ie=="function"){Ae=ie(_e,{timeout:2500});return}_e()},5e3);return()=>{var _e;window.clearTimeout(Ue),typeof Ae=="number"&&((_e=window.cancelIdleCallback)==null||_e.call(window,Ae))}},[]),p.useEffect(()=>{const ie=Ae=>{const Ue=Ae,{message:_e}=Ue.detail;re.error({content:"API Key 无效或已过期,请重新配置",duration:5e3}),console.error("[Drawnix] API auth error:",_e),b(Le=>({...Le,openSettings:!0}))};return window.addEventListener(Pu,ie),()=>{window.removeEventListener(Pu,ie)}},[]);const L=[my,py,fy,gS,iT,__(B),aj,xj,yP,hP,Nj(B),Uj(B),hy,gy,oP,by,xy,Ny,BP,$P,yy,vC,wy,vy,Ey,nC,cC,gC,ky,EC,Yj,Qj],z=p.useRef(null),{saveBoard:te,createBoard:ee,switchBoard:O}=sy(),J=p.useCallback(async()=>{if(i&&we.current){const ie={children:we.current.children||[],viewport:we.current.viewport,theme:we.current.theme};await te(ie)}},[i,te]),oe=p.useCallback(async()=>{await J();const ie=await ee({name:"新画布"});ie&&(await O(ie.id),setTimeout(()=>{os()},500))},[J,ee,O]),Ie=p.useCallback(ie=>{const Ae=we.current;if(Ae&&ie){const _e=Be(Ae).map(Le=>Le.id).filter(Boolean);B({lastSelectedElementIds:_e})}o&&o(ie)},[o,B]),ut=p.useMemo(()=>({appState:g,setAppState:C,board:x}),[g,C,x]),Re=pe||G||X||g.openCommandPalette||g.openCanvasSearch||N||T||U||R||_;return l.jsxDEV(ry,{children:l.jsxDEV(ay,{children:l.jsxDEV(ly,{children:l.jsxDEV(cy,{children:l.jsxDEV(uy,{children:l.jsxDEV(VP,{onOpenMediaLibrary:j,children:l.jsxDEV(SP,{children:l.jsxDEV(dy.Provider,{value:ut,children:l.jsxDEV(VC,{value:e,viewport:t,theme:n,options:h,plugins:L,containerRef:z,appState:g,board:x,setBoard:y,projectDrawerOpen:N,toolboxDrawerOpen:T,taskPanelExpanded:v,mediaLibraryOpen:U,mediaLibraryConfig:$,backupRestoreOpen:R,onChange:i,onSelectionChange:Ie,onViewportChange:s,onThemeChange:r,onValueChange:a,afterInit:c,onBoardSwitch:u,onTabSyncNeeded:d,handleProjectDrawerToggle:it,handleToolboxDrawerToggle:Ke,handleKnowledgeBaseToggle:We,handleTaskPanelToggle:D,handleOpenMediaLibrary:j,handleOpenBackupRestore:W,handleOpenCloudSync:Q,setProjectDrawerOpen:w,setToolboxDrawerOpen:S,setMediaLibraryOpen:q,setBackupRestoreOpen:M,cloudSyncOpen:_,setCloudSyncOpen:I,handleBeforeSwitch:J,isDataReady:m,onCreateProjectForMemory:oe,currentBoardId:f,deferredRuntimeEnabled:P,shouldRenderDeferredFeatures:Re,versionUpdateEnabled:pe,performancePanelEnabled:G,toolWindowManagerEnabled:X,minimizedToolsBarEnabled:le,enableToolWindows:Ce},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:727,columnNumber:21},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:726,columnNumber:19},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:725,columnNumber:17},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:724,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:723,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:722,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:721,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:720,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:719,columnNumber:5},void 0)},VC=({value:e,viewport:t,theme:n,options:i,plugins:o,containerRef:s,appState:r,board:a,setBoard:c,projectDrawerOpen:u,toolboxDrawerOpen:d,taskPanelExpanded:m,mediaLibraryOpen:f,mediaLibraryConfig:h,backupRestoreOpen:g,deferredRuntimeEnabled:b,shouldRenderDeferredFeatures:x,versionUpdateEnabled:y,performancePanelEnabled:N,toolWindowManagerEnabled:w,minimizedToolsBarEnabled:T,enableToolWindows:S,cloudSyncOpen:v,onChange:E,onSelectionChange:U,onViewportChange:q,onThemeChange:$,onValueChange:V,afterInit:R,onBoardSwitch:M,onTabSyncNeeded:_,handleProjectDrawerToggle:I,handleToolboxDrawerToggle:P,handleKnowledgeBaseToggle:Z,handleTaskPanelToggle:pe,handleOpenMediaLibrary:A,handleOpenBackupRestore:G,handleOpenCloudSync:ce,setProjectDrawerOpen:X,setToolboxDrawerOpen:ae,setMediaLibraryOpen:le,setBackupRestoreOpen:be,setCloudSyncOpen:we,handleBeforeSwitch:Fe,isDataReady:K,onCreateProjectForMemory:Ce,currentBoardId:We})=>{const{setAppState:it}=Wt(),{chatDrawerRef:Ke}=Gg(),{language:D}=ke(),j=Cu(xe=>xe.error),W=Cu(xe=>xe.playing||!!xe.activeAudioUrl||!!xe.activeReadingSourceId),Q=p.useRef(void 0),[C,B]=p.useState(W);kj({board:a,pointer:r.pointer}),Jg({onSyncNeeded:p.useCallback(()=>{_?_():os()},[_]),enabled:!0,currentBoardId:We});const[L,z]=p.useState(!1),[te,ee]=p.useState(null),[O,J]=p.useState(null),oe=p.useRef(null),[Ie,ut]=p.useState(!1),[Re,ie]=p.useState([]),[Ae,Ue]=p.useState(0);p.useEffect(()=>{if(!j){Q.current=void 0;return}j!==Q.current&&(Q.current=j,re.error(j))},[j]),p.useEffect(()=>{W&&B(!0)},[W]),p.useEffect(()=>{ba.setCanvasQueue(Ya(e))},[e]),p.useEffect(()=>()=>{ba.stopAndClear()},[]);const _e=p.useCallback(()=>{if(!a||!a.children)return{items:[],elementIds:[]};const xe=[],He=[];for(const Ne of a.children){const Ve=Ne.url;if(!Ve||typeof Ve!="string"||xa(Ne))continue;const ot=H.isDrawElement(Ne)&&H.isImage(Ne),ze=wn(Ne);(ot||ze)&&(xe.push({id:Ne.id,url:Ve,type:ze?"video":"image",title:Ne.name||void 0}),He.push(Ne.id))}return{items:xe,elementIds:He}},[a]),Le=p.useCallback(xe=>{const{items:He,elementIds:Ne}=_e();if(He.length===0)return;const Ve=Ne.indexOf(xe);Ve!==-1&&(ie(He),Ue(Ve),ut(!0))},[_e]),It=p.useCallback(()=>{ut(!1)},[]),_t=p.useCallback(async(xe,He)=>{const Ne=He.id;if(!(!Ne||!a))try{const{unifiedCacheService:Ve}=await Me(async()=>{const{unifiedCacheService:dt}=await import("./tool-windows-CtLXQDGF.js").then(dn=>dn.oL);return{unifiedCacheService:dt}},__vite__mapDeps([0]),import.meta.url),{Transforms:ot}=await Me(async()=>{const{Transforms:dt}=await import("./tool-windows-CtLXQDGF.js").then(dn=>dn.oJ);return{Transforms:dt}},__vite__mapDeps([0]),import.meta.url),ze=`edited-image-${Date.now()}`,Oe=`/__aitu_cache__/image/${ze}.png`,ht=await(await fetch(xe)).blob();await Ve.cacheMediaFromBlob(Oe,ht,"image",{taskId:ze});const jt=new Image;await new Promise((dt,dn)=>{jt.onload=()=>dt(),jt.onerror=()=>dn(new Error("Failed to load edited image")),jt.src=xe});const Ut=a.children.findIndex(dt=>dt.id===Ne);if(Ut>=0){const dt=a.children[Ut],{newPoints:dn}=await Fp({url:dt.url,width:dt.width,height:dt.height,points:dt.points||[[0,0],[0,0]]},jt.naturalWidth,jt.naturalHeight);ot.setNode(a,{url:Oe,width:jt.naturalWidth,height:jt.naturalHeight,points:dn},[Ut])}}catch(Ve){console.error("Failed to update image:",Ve),re.error("更新失败")}},[a]),Vt=p.useCallback(async xe=>{if(a)try{const{unifiedCacheService:He}=await Me(async()=>{const{unifiedCacheService:Ut}=await import("./tool-windows-CtLXQDGF.js").then(dt=>dt.oL);return{unifiedCacheService:Ut}},__vite__mapDeps([0]),import.meta.url),{insertImageFromUrl:Ne}=await Me(async()=>{const{insertImageFromUrl:Ut}=await import("./tool-windows-CtLXQDGF.js").then(dt=>dt.oP);return{insertImageFromUrl:Ut}},__vite__mapDeps([0]),import.meta.url),Ve=`edited-image-${Date.now()}`,ot=`/__aitu_cache__/image/${Ve}.png`,Oe=await(await fetch(xe)).blob();await He.cacheMediaFromBlob(ot,Oe,"image",{taskId:Ve});const st=new Image;await new Promise((Ut,dt)=>{st.onload=()=>Ut(),st.onerror=()=>dt(new Error("Failed to load edited image")),st.src=xe});const ht=Pr(a),jt=[((ht==null?void 0:ht[0])??0)+100,((ht==null?void 0:ht[1])??0)+100];await Ne(a,ot,jt,!1,{width:st.naturalWidth,height:st.naturalHeight},!1,!0)}catch(He){console.error("Failed to insert image:",He),re.error("插入失败")}},[a]),{state:Lt,selectShape:zt,closePicker:mi}=rC(a);p.useEffect(()=>{O&&oe.current&&oe.current.focus()},[O]);const Gn=p.useCallback(()=>{if(!a||!O||!oe.current){J(null);return}const xe=oe.current.innerText||"";xe.trim()&&(Cr.insertText(a,O.worldPoint,xe),requestAnimationFrame(()=>{const He=a.children[a.children.length-1];if(H.isText(He)){const Ne=He;if(!isFinite(Ne.textHeight)){const Ve=ge.getRectangleByPoints(Ne.points);ue.setNode(a,{textHeight:Ve.height},[a.children.length-1])}}})),J(null),fe.updatePointerType(a,Et.selection),it(He=>({...He,pointer:Et.selection}))},[a,O,it]);return p.useEffect(()=>{if(!a)return;const xe=Ne=>{const Ve=Ne.target;if(!(Ve.closest(".board-host-svg")||Ve.closest(".plait-board-container")))return;const ze=Ft(a,Ht(a,Ne.clientX,Ne.clientY)),Oe=Ka(a,ze);if(Oe&&Ct(Oe)){ig(a,Oe,D),Ne.preventDefault(),Ne.stopPropagation();return}if(Oe){if(xa(Oe)){Ne.preventDefault(),Ne.stopPropagation();return}const ht=Oe.url;if(ht&&typeof ht=="string"){const jt=H.isDrawElement(Oe)&&H.isImage(Oe),Ut=wn(Oe);if(jt||Ut){Le(Oe.id),Ne.preventDefault(),Ne.stopPropagation();return}}}const st=Ve.closest(".plait-tool-container")||Ve.closest(".plait-workzone-container")||Ve.closest("foreignObject");if(!Oe&&!st){const ht=[Ne.clientX,Ne.clientY];ee(ht),z(!0)}},He=s.current;return He&&He.addEventListener("dblclick",xe),()=>{He&&He.removeEventListener("dblclick",xe)}},[a,s,Le,D]),p.useEffect(()=>{if(!a)return;const xe=Ne=>{const Ve=Ne.target;if(!(Ve.closest(".board-host-svg")||Ve.closest(".plait-board-container")))return;const ze=Ft(a,Ht(a,Ne.clientX,Ne.clientY)),Oe=Ka(a,ze);if(Oe&&xa(Oe)&&!Kn(Oe)){B(!0);const st=Ty(Oe);if(st){Ne.preventDefault(),Ne.stopPropagation(),ba.togglePlaybackInQueue(st,Ya(a.children),{queueSource:"canvas",queueId:Op,queueName:Lp}).catch(()=>{});return}}if(F.isPointer(a,De.text)&&!(Ve.closest(".plait-tool-container")||Ve.closest(".plait-workzone-container")||Ve.closest("foreignObject"))&&!Oe){J({screenX:Ne.clientX,screenY:Ne.clientY,worldPoint:ze,zoom:a.viewport.zoom}),Ne.preventDefault(),Ne.stopPropagation();return}u&&X(!1),d&&ae(!1)},He=s.current;return He&&He.addEventListener("click",xe),()=>{He&&He.removeEventListener("click",xe)}},[a,s,u,d,X,ae]),l.jsxDEV("div",{className:Y("drawnix",{"drawnix--mobile":r.isMobile}),ref:s,children:l.jsxDEV("div",{className:"drawnix__main",children:[l.jsxDEV(uS,{value:e,viewport:t,theme:n,options:i,plugins:o,onChange:xe=>{E&&E(xe)},onSelectionChange:U,onViewportChange:q,onThemeChange:$,onValueChange:V,children:[l.jsxDEV(rS,{afterInit:xe=>{c(xe),window.__drawnixBoard=xe,Wg.setBoard(xe),R&&R(xe),xe.afterChange&&xe.afterChange()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1413,columnNumber:11},void 0),l.jsxDEV(EP,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1434,columnNumber:11},void 0),l.jsxDEV(D_,{projectDrawerOpen:u,onProjectDrawerToggle:I,toolboxDrawerOpen:d,onToolboxDrawerToggle:P,taskPanelExpanded:m,onTaskPanelToggle:pe,onOpenBackupRestore:G,onOpenCloudSync:ce,onKnowledgeBaseToggle:Z,onOpenMediaLibrary:A,deferredFeaturesEnabled:w,minimizedToolsBarEnabled:T,onEnableToolWindows:S},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1436,columnNumber:11},void 0),C&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(AC,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1453,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1452,columnNumber:13},void 0),l.jsxDEV(zD,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1457,columnNumber:11},void 0),l.jsxDEV(Rj,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1458,columnNumber:11},void 0),l.jsxDEV(yj,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1459,columnNumber:11},void 0),l.jsxDEV(Tj,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1460,columnNumber:11},void 0),l.jsxDEV(Ij,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1461,columnNumber:11},void 0),l.jsxDEV(Aj,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1462,columnNumber:11},void 0),r.openDialogTypes.size>0&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(jC,{container:s.current},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1465,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1464,columnNumber:13},void 0),r.openSettings&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(PC,{container:s.current},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1470,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1469,columnNumber:13},void 0),l.jsxDEV(Vj,{container:s.current},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1473,columnNumber:11},void 0),l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(SC,{isDataReady:K,activationKey:0},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1475,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1474,columnNumber:11},void 0),l.jsxDEV(IP,{position:te,visible:L,onClose:()=>z(!1),onOpenMediaLibrary:A},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1478,columnNumber:11},void 0),O&&l.jsxDEV("div",{ref:oe,contentEditable:!0,suppressContentEditableWarning:!0,style:{position:"fixed",left:O.screenX,top:O.screenY-14*O.zoom/2,minWidth:"2px",minHeight:"1.5em",outline:"none",border:"none",background:"transparent",fontSize:`${14*O.zoom}px`,lineHeight:"1.5",color:"#333",caretColor:"#333",zIndex:1e4,whiteSpace:"pre-wrap",fontFamily:"inherit"},onBlur:Gn,onKeyDown:xe=>{xe.key==="Escape"&&J(null),xe.stopPropagation()}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1486,columnNumber:13},void 0),Ie&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(CC,{visible:Ie,items:Re,initialIndex:Ae,onClose:It,showThumbnails:!0,useBuiltInEditor:!0,showEditOverwrite:!0,onEditOverwrite:_t,onEditInsert:Vt},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1519,columnNumber:15},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1518,columnNumber:13},void 0),l.jsxDEV(oC,{visible:Lt.visible,position:Lt.position,currentShape:Lt.currentShape||void 0,onSelectShape:zt,onClose:mi,container:s.current},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1533,columnNumber:11},void 0),l.jsxDEV(AP,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1542,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1399,columnNumber:9},void 0),l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(TC,{ref:Ke},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1545,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1544,columnNumber:9},void 0),b&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(_C,{board:a,value:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1549,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1548,columnNumber:11},void 0),x&&l.jsxDEV(p.Suspense,{fallback:null,children:l.jsxDEV(DC,{board:a,value:e,containerRef:s,versionUpdateEnabled:y,performancePanelEnabled:N,toolWindowManagerEnabled:w,projectDrawerOpen:u,toolboxDrawerOpen:d,mediaLibraryOpen:f,mediaLibraryConfig:h,backupRestoreOpen:g,cloudSyncOpen:v,onBoardSwitch:M,setProjectDrawerOpen:X,setToolboxDrawerOpen:ae,setMediaLibraryOpen:le,setBackupRestoreOpen:be,setCloudSyncOpen:we,handleBeforeSwitch:Fe,onCreateProjectForMemory:Ce},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1554,columnNumber:13},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1553,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1398,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/drawnix.tsx",lineNumber:1392,columnNumber:5},void 0)},UC="Opentu",RC="Opentu - AI应用平台";function Sr(e){e&&e.trim()?document.title=`${UC} - ${e.trim()}`:document.title=RC}function qC(e){if(!e){Sr();return}const t=Vf.getBoard(e);Sr(t==null?void 0:t.name)}function BC(e,t){return p.useEffect(()=>{qC(e)},[e,t]),p.useEffect(()=>{const i=Vf.observeEvents().subscribe(o=>{if(o.type==="boardUpdated"){const s=o.payload;s&&s.id===e&&Sr(s.name)}});return()=>{i.unsubscribe()}},[e]),{updateTitle:p.useCallback(i=>{Sr(i)},[])}}const nb="main_board_content",ib=Hs.createInstance({name:"Drawnix",storeName:Dy,driver:[Hs.INDEXEDDB,Hs.LOCALSTORAGE]});async function ob(){try{const e=await el.loadState();return(e==null?void 0:e.migrationCompleted)===!0}catch(e){return console.error("[WorkspaceMigration] Failed to check migration status:",e),!1}}async function Jm(){try{const e=await el.loadState();e.migrationCompleted=!0,await el.saveState(e)}catch(e){console.error("[WorkspaceMigration] Failed to mark migration completed:",e)}}async function LC(){try{const e=await ib.getItem(nb);if(e&&e.children&&e.children.length>0)return e;const t=localStorage.getItem(Uf);if(t){const n=JSON.parse(t);if(Array.isArray(n)&&n.length>0)return{children:n}}return null}catch(e){return console.error("[WorkspaceMigration] Failed to get legacy data:",e),null}}async function OC(){try{if(await ob())return null;const t=await LC();if(!t||!t.children||t.children.length===0)return await Jm(),null;const n=Nn.getInstance();await n.initialize();const i=await n.createBoard({name:"迁移的画板",elements:t.children,viewport:t.viewport,theme:t.theme});return i?(await n.switchBoard(i.id),await Jm(),await FC(),i.id):(console.error("[WorkspaceMigration] Failed to create board"),null)}catch(e){return console.error("[WorkspaceMigration] Migration failed:",e),null}}async function FC(){try{await ib.removeItem(nb),localStorage.removeItem(Uf)}catch(e){console.error("[WorkspaceMigration] Failed to clear legacy data:",e)}}function Mo(e){if(!yt.isAnalyticsEnabled())return;const t=HC(e.name,e.value),n=document.referrer,i={[`$web_vitals_${e.name}_value`]:e.value,[`$web_vitals_${e.name}_event`]:{id:e.id,delta:e.delta,rating:t,navigationType:e.navigationType},page_path:window.location.pathname,referrer:n.length>200?n.slice(0,200):n,timestamp:Date.now()};setTimeout(()=>{yt.track("$web_vitals",i)},0)}function HC(e,t){const i={LCP:{good:2500,poor:4e3},FID:{good:100,poor:300},CLS:{good:.1,poor:.25},FCP:{good:1800,poor:3e3},TTFB:{good:800,poor:1800},INP:{good:200,poor:500}}[e];return i?t<=i.good?"good":t<=i.poor?"needs-improvement":"poor":"needs-improvement"}async function zC(){try{const e=await Me(()=>import("./web-vitals-DcvjKPr-.js"),[],import.meta.url),{onCLS:t,onFCP:n,onLCP:i,onTTFB:o,onINP:s}=e;t(Mo),n(Mo),i(Mo),o(Mo),s(Mo)}catch(e){console.error("[Web Vitals] Failed to initialize monitoring:",e)}}const fs="page_report",GC="app_page_view";let ep=!1,tp="";function WC(){const e=window.innerWidth;return e<768?"mobile":e<1024?"tablet":"desktop"}const np=200;function $C(){const e=navigator.userAgent;return{page_url:window.location.href,page_path:window.location.pathname,page_title:document.title,referrer:document.referrer,viewport_width:window.innerWidth,viewport_height:window.innerHeight,screen_width:window.screen.width,screen_height:window.screen.height,device_type:WC(),user_agent:e.length>np?e.slice(0,np):e,language:navigator.language,timestamp:Date.now()}}function XC(){if(!window.performance)return null;const e={page_url:window.location.pathname,page_path:window.location.pathname,timestamp:Date.now()};if(window.performance.getEntriesByType){const t=window.performance.getEntriesByType("navigation");if(t&&t.length>0){const n=t[0];n.domainLookupEnd&&n.domainLookupStart&&(e.dns_time=n.domainLookupEnd-n.domainLookupStart),n.connectEnd&&n.connectStart&&(e.tcp_time=n.connectEnd-n.connectStart),n.responseStart&&n.requestStart&&(e.request_time=n.responseStart-n.requestStart),n.responseEnd&&n.responseStart&&(e.response_time=n.responseEnd-n.responseStart),n.domComplete&&n.domInteractive&&(e.dom_processing_time=n.domComplete-n.domInteractive),n.domInteractive&&n.fetchStart&&(e.dom_interactive_time=n.domInteractive-n.fetchStart),n.domComplete&&n.fetchStart&&(e.dom_complete_time=n.domComplete-n.fetchStart),n.loadEventEnd&&n.fetchStart&&(e.load_time=n.loadEventEnd-n.fetchStart)}}if(window.performance.getEntriesByType){const t=window.performance.getEntriesByType("resource");e.total_resources=t.length,e.total_size=t.reduce((n,i)=>n+(i.transferSize||0),0)}return e}function La(){if(!yt.isAnalyticsEnabled())return;const e=$C();e.page_url!==tp&&(tp=e.page_url,yt.track(GC,{category:fs,...e}))}function ip(){if(!yt.isAnalyticsEnabled())return;const e=XC();if(!e){console.warn("[Page Report] Performance data not available");return}yt.track("page_performance",{category:fs,...e})}function KC(){if(!yt.isAnalyticsEnabled())return;const e=Math.round(performance.now());yt.track("page_unload",{category:fs,page_url:window.location.href,page_path:window.location.pathname,time_on_page:e,timestamp:Date.now()})}function YC(){try{if(ep)return;ep=!0,La(),document.readyState==="complete"?ip():window.addEventListener("load",()=>{setTimeout(()=>{ip()},0)}),window.addEventListener("beforeunload",()=>{KC()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?yt.track("page_hidden",{category:fs,page_url:window.location.href,page_path:window.location.pathname,timestamp:Date.now()}):document.visibilityState==="visible"&&yt.track("page_visible",{category:fs,page_url:window.location.href,page_path:window.location.pathname,timestamp:Date.now()})}),window.addEventListener("popstate",()=>{setTimeout(()=>{La()},100)});const e=history.pushState;history.pushState=function(...t){e.apply(this,t),setTimeout(()=>{La()},100)}}catch(e){console.error("[Page Report] Failed to initialize monitoring:",e)}}function op(e){if(!e||!(e instanceof Element))return!1;const t=e,n=["input","textarea","select","button",".unified-toolbar",".chat-drawer",".side-drawer",".toolbox-drawer",".project-drawer",".popup-toolbar",".t-dialog",".t-drawer",".t-popup",".t-popover",".Dialog",".winbox",".ai-input-bar",".view-navigation",".minimap",".task-queue-panel",".t-slider",".unified-color-picker",".color-picker",".media-library",".viewer-container",".viewer-canvas",".viewer-footer",".viewer-toolbar",".unified-viewer",".media-viewport",".thumbnail-queue",'[role="button"]','[role="slider"]','[role="menu"]','[role="menuitem"]','[role="dialog"]',"[data-allow-touch]"];for(const i of n)if(t.matches(i)||t.closest(i))return!0;if(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth){const i=window.getComputedStyle(t);if(i.overflowY==="auto"||i.overflowY==="scroll"||i.overflowX==="auto"||i.overflowX==="scroll")return!0}return!1}function sp(e){if(!e||!(e instanceof Element))return!1;const t=e,n=[".plait-board-container",".plait-board","[plait-board]","svg.rough-svg"];for(const i of n)if(t.matches(i)||t.closest(i))return!0;return!1}function ZC(){if(typeof window>"u")return()=>{};const e=i=>{if(i.touches.length>1){const o=i.target;if(op(o))return;sp(o)&&(i.preventDefault(),i.stopPropagation())}},t=i=>{const o=i.target;op(o)||sp(o)&&(i.preventDefault(),i.stopPropagation())},n=i=>{(i.ctrlKey||i.metaKey)&&i.preventDefault()};return document.addEventListener("touchstart",e,{passive:!1,capture:!0}),document.addEventListener("touchmove",e,{passive:!1,capture:!0}),document.addEventListener("touchend",e,{passive:!1,capture:!0}),document.addEventListener("gesturestart",t,{passive:!1,capture:!0}),document.addEventListener("gesturechange",t,{passive:!1,capture:!0}),document.addEventListener("gestureend",t,{passive:!1,capture:!0}),window.addEventListener("wheel",n,{passive:!1}),()=>{document.removeEventListener("touchstart",e,!0),document.removeEventListener("touchmove",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("gesturestart",t,!0),document.removeEventListener("gesturechange",t,!0),document.removeEventListener("gestureend",t,!0),window.removeEventListener("wheel",n)}}const Vl=$r.DB_CLEANUP_DONE;function sb(){let e=0;for(const t of Rf)try{localStorage.getItem(t)!==null&&(localStorage.removeItem(t),e++)}catch(n){console.warn(`[DBCleanup] Failed to remove LocalStorage key ${t}:`,n)}return e}async function rb(){localStorage.getItem(Vl)||(sb(),localStorage.setItem(Vl,Date.now().toString()))}function QC(){localStorage.removeItem(Vl)}typeof window<"u"&&(window.__dbCleanup={run:rb,reset:QC,cleanupLS:sb,LS_KEYS_DEPRECATED:Rf});const zc=[{lsKey:Pt.PROMPT_HISTORY,idbKey:Pt.PROMPT_HISTORY,deleteAfterMigration:!0},{lsKey:Pt.VIDEO_PROMPT_HISTORY,idbKey:Pt.VIDEO_PROMPT_HISTORY,deleteAfterMigration:!0},{lsKey:Pt.PRESET_SETTINGS,idbKey:Pt.PRESET_SETTINGS,deleteAfterMigration:!0},{lsKey:Pt.BATCH_IMAGE_CACHE,idbKey:Pt.BATCH_IMAGE_CACHE,deleteAfterMigration:!0},{lsKey:Pt.RECENT_TEXT_COLORS,idbKey:Pt.RECENT_TEXT_COLORS,deleteAfterMigration:!0},{lsKey:Pt.CUSTOM_GRADIENTS,idbKey:Pt.CUSTOM_GRADIENTS,deleteAfterMigration:!0},{lsKey:Pt.CUSTOM_FONTS,idbKey:Pt.CUSTOM_FONTS,deleteAfterMigration:!0},{lsKey:Pt.TOOLBAR_CONFIG,idbKey:Pt.TOOLBAR_CONFIG,deleteAfterMigration:!0}];function Gc(){try{return localStorage.getItem($r.LS_TO_IDB_MIGRATION_DONE)!==null}catch{return!1}}function JC(){try{localStorage.setItem($r.LS_TO_IDB_MIGRATION_DONE,Date.now().toString())}catch(e){console.error("[StorageMigration] Failed to mark migration done:",e)}}function eA(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch(t){return console.warn(`[StorageMigration] Failed to read ${e} from LocalStorage:`,t),null}}function rp(e){try{localStorage.removeItem(e)}catch(t){console.warn(`[StorageMigration] Failed to delete ${e} from LocalStorage:`,t)}}async function tA(e){const{lsKey:t,idbKey:n,deleteAfterMigration:i}=e;try{const o=eA(t);return o===null?{key:t,success:!0}:await kn.get(n)!==null?(i&&rp(t),{key:t,success:!0}):(await kn.set(n,o),await kn.get(n)===null?{key:t,success:!1,error:"Verification failed: data not found after write"}:(i&&rp(t),{key:t,success:!0}))}catch(o){const s=o instanceof Error?o.message:String(o);return console.error(`[StorageMigration] Failed to migrate ${t}:`,o),{key:t,success:!1,error:s}}}async function ab(){if(!kn.isAvailable())return console.warn("[StorageMigration] IndexedDB not available, skipping migration"),[];if(Gc())return[];const e=[];for(const n of zc){const i=await tA(n);e.push(i),i.success||console.warn(`[StorageMigration] Failed: ${i.key} - ${i.error}`)}return e.filter(n=>n.success).length,e.filter(n=>!n.success).length===0&&JC(),e}function lb(){try{localStorage.removeItem($r.LS_TO_IDB_MIGRATION_DONE)}catch(e){console.error("[StorageMigration] Failed to reset migration status:",e)}}const nA={isMigrationDone:Gc,runMigration:ab,resetMigration:lb,MIGRATION_CONFIGS:zc};typeof window<"u"&&(window.__storageMigration={run:ab,reset:lb,isDone:Gc,configs:zc});const Kt={LOADING_STATE:"aitu_page_loading_state",CRASH_COUNT:"aitu_crash_count",LAST_SUCCESS_LOAD:"aitu_last_success_load",SAFE_MODE:"aitu_safe_mode",CRASH_HISTORY:"aitu_crash_history"};class iA{constructor(){this.state={crashDetected:!1,crashCount:0,isSafeMode:!1,crashHistory:[]}}markLoadingStart(){try{localStorage.getItem(Kt.LOADING_STATE)==="loading"&&(this.state.crashDetected=!0,this.incrementCrashCount(),this.recordCrash()),localStorage.setItem(Kt.LOADING_STATE,"loading"),this.state.isSafeMode=localStorage.getItem(Kt.SAFE_MODE)==="true",this.loadCrashHistory()}catch(t){console.warn("[CrashRecovery] Failed to mark loading start:",t)}}markLoadingComplete(){try{localStorage.setItem(Kt.LOADING_STATE,"complete"),localStorage.setItem(Kt.LAST_SUCCESS_LOAD,Date.now().toString()),this.state.isSafeMode||(localStorage.setItem(Kt.CRASH_COUNT,"0"),this.state.crashCount=0)}catch(t){console.warn("[CrashRecovery] Failed to mark loading complete:",t)}}incrementCrashCount(){try{const t=parseInt(localStorage.getItem(Kt.CRASH_COUNT)||"0",10);this.state.crashCount=t+1,localStorage.setItem(Kt.CRASH_COUNT,this.state.crashCount.toString())}catch{}}recordCrash(){try{const t=performance,n={timestamp:Date.now(),url:window.location.href,memoryStats:t.memory?{usedJSHeapSize:t.memory.usedJSHeapSize,totalJSHeapSize:t.memory.totalJSHeapSize,jsHeapSizeLimit:t.memory.jsHeapSizeLimit}:null};this.state.crashHistory.unshift(n),this.state.crashHistory=this.state.crashHistory.slice(0,10),this.saveCrashHistory()}catch{}}loadCrashHistory(){try{const t=localStorage.getItem(Kt.CRASH_HISTORY);t&&(this.state.crashHistory=JSON.parse(t))}catch{this.state.crashHistory=[]}}saveCrashHistory(){try{localStorage.setItem(Kt.CRASH_HISTORY,JSON.stringify(this.state.crashHistory))}catch{}}getState(){return{...this.state}}isCrashDetected(){return this.state.crashDetected}getCrashCount(){return this.state.crashCount}isSafeMode(){return this.state.isSafeMode}shouldShowSafeModePrompt(){return this.state.crashDetected&&this.state.crashCount>=2}enableSafeMode(){try{localStorage.setItem(Kt.SAFE_MODE,"true"),this.state.isSafeMode=!0}catch{}}disableSafeMode(){try{localStorage.removeItem(Kt.SAFE_MODE),this.state.isSafeMode=!1,localStorage.setItem(Kt.CRASH_COUNT,"0"),this.state.crashCount=0}catch{}}clearCrashState(){try{localStorage.setItem(Kt.CRASH_COUNT,"0"),this.state.crashCount=0,this.state.crashDetected=!1}catch{}}checkUrlSafeMode(){try{const t=new URLSearchParams(window.location.search);if(t.get("safe")==="1"||t.get("safe_mode")==="1")return this.enableSafeMode(),!0}catch{}return!1}getMemoryInfo(){try{const t=performance;if(!t.memory)return null;const n=i=>i<1024*1024?`${(i/1024).toFixed(1)} KB`:i<1024*1024*1024?`${(i/1024/1024).toFixed(1)} MB`:`${(i/1024/1024/1024).toFixed(2)} GB`;return{used:n(t.memory.usedJSHeapSize),limit:n(t.memory.jsHeapSizeLimit),percent:t.memory.usedJSHeapSize/t.memory.jsHeapSizeLimit*100}}catch{return null}}}const Yt=new iA,oA=3e4,sA=800,rA=.6,aA=3,Wc="aitu_last_snapshot",lA=50,$o=[],cA=20,uA=2e3;let Xo=null;const ap=3e3,dA=1e4,mA=200,pA=5e3,fA=10,hA=5e3,gA=30,bA=20,lp=20,xA=100,NA=30,yA=240;let cp=null,up=!1,dp=null,mp=null,Oa=null,Fa=0,yi=60,Ho=!1,Ha=!1;const ti=[],ni=[],fn=[];function wA(e){const t=Bt(),n=Date.now();return()=>{const i=Bt();if(!t||!i)return;const o=(i.usedJSHeapSize-t.usedJSHeapSize)/(1024*1024),s=Date.now()-n;if(Math.abs(o)>=lA){const r=o>=0?"+":"";console.warn(`[MemoryLog] ${e}: ${r}${o.toFixed(0)} MB (${s}ms)`)}}}function hn(e){if(e)return e.slice(0,yA)}function vA(){return"0.6.76"}function EA(){if(typeof navigator>"u"||typeof window>"u"||!("serviceWorker"in navigator))return{supported:!1,readyState:document.readyState,visibilityState:document.visibilityState};const e=navigator.serviceWorker.controller;return{supported:!0,controller:e?{scriptURL:hn(e.scriptURL),state:e.state}:null,readyState:document.readyState,visibilityState:document.visibilityState}}function kA(){const e=Array.from(document.scripts).map(i=>hn(Rn(i.src))).filter(Boolean).slice(-8),t=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).map(i=>hn(Rn(i.href))).filter(Boolean).slice(-8),n=Array.from(document.querySelectorAll('link[rel="modulepreload"]')).map(i=>hn(Rn(i.href))).filter(Boolean).slice(-8);return{scripts:e,stylesheets:t,modulePreloads:n}}function cb(e){if(!(e instanceof HTMLElement))return;const t=e;return{tagName:e.tagName.toLowerCase(),id:hn(e.id||void 0),className:typeof e.className=="string"?hn(e.className):void 0,src:hn(t.currentSrc||t.src?Rn(t.currentSrc||t.src||""):void 0),href:hn(t.href?Rn(t.href):void 0),rel:hn(t.rel),crossOrigin:hn(t.crossOrigin||void 0)}}function Ul(e){return{appVersion:vA(),recentActions:ti.slice(-10),recentErrors:ni.slice(-5),recentNetworkErrors:fn.slice(-5),serviceWorker:EA(),loadedResources:kA(),...e}}function Bt(){if(typeof performance<"u"&&"memory"in performance){const e=performance.memory;return{usedJSHeapSize:e.usedJSHeapSize,totalJSHeapSize:e.totalJSHeapSize,jsHeapSizeLimit:e.jsHeapSizeLimit}}}function fo(){try{const e={domNodeCount:document.getElementsByTagName("*").length,canvasCount:document.getElementsByTagName("canvas").length,imageCount:document.getElementsByTagName("img").length,videoCount:document.getElementsByTagName("video").length,iframeCount:document.getElementsByTagName("iframe").length,plaitBoardExists:!!document.querySelector(".plait-board-container")},t=document.querySelector(".plait-board-container");if(t){const n=t.querySelectorAll("svg > g > g");e.plaitElementCount=n.length}return window.getEventListeners,e}catch{return{domNodeCount:0,canvasCount:0,imageCount:0,videoCount:0,iframeCount:0,plaitBoardExists:!1}}}function ub(){if(!bt.isInitialized()||$o.length===0)return;const e=$o.splice(0,$o.length);for(const t of e)bt.reportCrashSnapshot(t).catch(()=>{});Xo&&(clearInterval(Xo),Xo=null)}function SA(){Xo||(Xo=setInterval(()=>{bt.isInitialized()&&ub()},uA))}function tn(e){try{bt.isInitialized()?(ub(),bt.reportCrashSnapshot(e).catch(()=>{})):$o.length<cA&&($o.push(e),SA())}catch(t){console.warn("[MemoryLog] Failed to send snapshot to SW:",t)}}function TA(e){try{localStorage.setItem(Wc,JSON.stringify(e))}catch{}}function DA(){try{const e=localStorage.getItem(Wc);if(e)return JSON.parse(e)}catch{}return null}function _A(){try{localStorage.removeItem(Wc)}catch{}}function jA(){const e={id:`startup-${Date.now()}`,timestamp:Date.now(),type:"startup",userAgent:navigator.userAgent,url:location.href,memory:Bt()};tn(e)}function PA(){if(cp!==null)return;let e=0;cp=window.setInterval(()=>{const t=Bt();if(!t)return;const n=t.usedJSHeapSize/(1024*1024),i=t.jsHeapSizeLimit/(1024*1024),o=n/i;if(n>sA||o>rA){e++;const a=e>=aA?fo():void 0,c={id:`periodic-${Date.now()}`,timestamp:Date.now(),type:"periodic",memory:t,pageStats:a,userAgent:navigator.userAgent,url:location.href};tn(c)}else e=0},oA)}function CA(){window.addEventListener("error",e=>{var n;if(e.error instanceof DOMException&&(e.error.name==="AbortError"||e.error.name==="NotAllowedError"))return;const t={id:`error-${Date.now()}`,timestamp:Date.now(),type:"error",error:{message:e.message||"Unknown error",stack:(n=e.error)==null?void 0:n.stack,type:"uncaughtError"},memory:Bt(),userAgent:navigator.userAgent,url:location.href,customData:Ul({filename:e.filename,lineno:e.lineno,colno:e.colno,eventTarget:cb(e.target)})};tn(t),console.error("[MemoryLog] Uncaught error captured:",e.message)}),window.addEventListener("unhandledrejection",e=>{const t=e.reason,n=(t==null?void 0:t.message)||String(t)||"",i=(t==null?void 0:t.stack)||"";if(t instanceof DOMException&&(t.name==="AbortError"||t.name==="NotAllowedError"||t.name==="DataError"&&n.includes("No key or key range specified"))||n.includes("posthog.com")||n.includes("sentry.io")||i.includes("posthog")||i.includes("sentry"))return;const o={id:`rejection-${Date.now()}`,timestamp:Date.now(),type:"error",error:{message:n||"Unhandled Promise rejection",stack:i,type:"unhandledRejection"},memory:Bt(),userAgent:navigator.userAgent,url:location.href,customData:Ul()};tn(o),console.error("[MemoryLog] Unhandled rejection captured:",t)}),window.addEventListener("beforeunload",()=>{const e=Bt();if(e){const t={id:`beforeunload-${Date.now()}`,timestamp:Date.now(),type:"beforeunload",memory:e,userAgent:navigator.userAgent,url:location.href};TA(t),tn(t)}})}function AA(){if(dp!==null)return;let e=Date.now();document.addEventListener("visibilitychange",()=>{document.hidden?Ha=!0:(e=Date.now(),setTimeout(()=>{Ha=!1},ap+100))}),dp=window.setInterval(()=>{const t=Date.now(),n=t-e;if(n>dA&&!Ha&&!document.hidden){const i={id:`freeze-${Date.now()}`,timestamp:Date.now(),type:"freeze",memory:Bt(),pageStats:fo(),performance:{freezeDuration:n,lastHeartbeat:e,fps:yi},userAgent:navigator.userAgent,url:location.href,customData:{recentActions:ti.slice(-10),recentErrors:ni.slice(-5),recentNetworkErrors:fn.slice(-5)}};tn(i)}e=t,bt.isInitialized()&&bt.sendHeartbeat(t).catch(()=>{})},ap)}function MA(){if(Oa===null&&!(typeof PerformanceObserver>"u"))try{Oa=new PerformanceObserver(e=>{for(const t of e.getEntries())if(t.duration>mA){const i=t.attribution;let o;if(i&&i.length>0){const r=i[0];o={name:r.name,containerType:r.containerType,containerSrc:r.containerSrc,containerId:r.containerId,containerName:r.containerName}}const s={id:`longtask-${Date.now()}`,timestamp:Date.now(),type:"longtask",memory:Bt(),performance:{longTaskDuration:t.duration,fps:yi},userAgent:navigator.userAgent,url:location.href,customData:{taskName:t.name,startTime:t.startTime,attribution:o,debugTip:"Use Chrome DevTools Performance panel to record and analyze the call stack"}};tn(s)}}),Oa.observe({entryTypes:["longtask"]})}catch{}}function IA(){if(mp!==null)return;let e=0;const t=()=>{if(e++,e>=NA){const n=performance.now(),i=n-Fa;i>0&&(yi=Math.round(e*1e3/i)),e=0,Fa=n}requestAnimationFrame(t)};Fa=performance.now(),requestAnimationFrame(t),mp=window.setInterval(()=>{if(yi<fA&&yi>0){const n={id:`lowfps-${Date.now()}`,timestamp:Date.now(),type:"freeze",memory:Bt(),performance:{fps:yi},userAgent:navigator.userAgent,url:location.href};tn(n)}},pA)}function VA(){setTimeout(()=>{pp()},hA),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&!Ho&&setTimeout(pp,1e3)})}function pp(){if(Ho)return;const e=document.getElementById("root"),t=e&&e.children.length>0,i=!!document.querySelector(".plait-board-container");if(document.body.children.length>1,e&&!t){Ho=!0;const o={id:`whitescreen-${Date.now()}`,timestamp:Date.now(),type:"whitescreen",memory:Bt(),pageStats:{domNodeCount:document.getElementsByTagName("*").length,canvasCount:0,imageCount:0,videoCount:0,iframeCount:0,plaitBoardExists:i},userAgent:navigator.userAgent,url:location.href,customData:{rootExists:!!e,rootChildCount:(e==null?void 0:e.children.length)||0,bodyChildCount:document.body.children.length,hasPlaitBoard:i}};tn(o),console.error("[MemoryLog] 白屏检测: React 未渲染内容")}t&&!i&&location.pathname==="/"&&setTimeout(()=>{if(!document.querySelector(".plait-board-container")&&!Ho){Ho=!0;const o={id:`whitescreen-noboard-${Date.now()}`,timestamp:Date.now(),type:"whitescreen",memory:Bt(),pageStats:fo(),userAgent:navigator.userAgent,url:location.href,customData:{reason:"画板未加载",rootChildCount:(e==null?void 0:e.children.length)||0}};tn(o),console.error("[MemoryLog] 白屏检测: 画板组件未加载")}},5e3)}function zo(e,t,n){ti.push({time:Date.now(),action:e,target:t,detail:n}),ti.length>gA&&ti.shift()}function UA(){let e=0;document.addEventListener("click",t=>{const n=Date.now();if(n-e<xA)return;e=n;const i=t.target;if(!i)return;const o=()=>{var a,c,u,d,m,f,h,g,b,x,y,N,w,T,S;let s="";const r=(c=(a=i.closest)==null?void 0:a.call(i,"[data-track]"))==null?void 0:c.getAttribute("data-track");if(r)s=r;else if(i.tagName==="BUTTON"||(u=i.closest)!=null&&u.call(i,"button")){const v=((d=i.closest)==null?void 0:d.call(i,"button"))||i,E=(m=v.textContent)==null?void 0:m.trim().slice(0,20),U=(b=(g=(h=(f=v.className)==null?void 0:f.split)==null?void 0:h.call(f," "))==null?void 0:g[0])==null?void 0:b.slice(0,20);s=`btn:${E||U||"unknown"}`}else if(i.tagName==="A")s=`link:${((x=i.pathname)==null?void 0:x.slice(0,30))||""}`;else if(i.tagName==="INPUT"||i.tagName==="TEXTAREA"){const v=i;s=`input:${v.name||v.type||((y=v.placeholder)==null?void 0:y.slice(0,15))||""}`}else if(i.id)s=`#${i.id}`;else{const v=(T=(w=(N=i.className)==null?void 0:N.split)==null?void 0:w.call(N," "))==null?void 0:T[0];s=v?`.${v.slice(0,20)}`:((S=i.tagName)==null?void 0:S.toLowerCase())||"unknown"}zo("click",s)};"requestIdleCallback"in window?window.requestIdleCallback(o,{timeout:100}):setTimeout(o,0)},{capture:!0,passive:!0}),document.addEventListener("keydown",t=>{if(t.ctrlKey||t.metaKey||t.altKey){const n=[];(t.ctrlKey||t.metaKey)&&n.push("Cmd"),t.altKey&&n.push("Alt"),t.shiftKey&&n.push("Shift"),n.push(t.key),zo("shortcut",n.join("+"))}},{capture:!0,passive:!0}),window.addEventListener("popstate",()=>{zo("navigate",location.pathname)}),window.addEventListener("hashchange",()=>{zo("navigate",location.hash)})}function RA(){const e=window.fetch;window.fetch=async function(t,n){const i=Date.now();try{const o=await e.call(this,t,n);if(!o.ok){const s=typeof t=="string"?t:t.url,r=Date.now()-i,a=Rn(s).slice(0,300);fn.push({time:Date.now(),url:a,method:(n==null?void 0:n.method)||"GET",status:o.status,statusText:o.statusText,duration:r}),fn.length>lp&&fn.shift()}return o}catch(o){const s=typeof t=="string"?t:t.url,r=Date.now()-i,a=Rn(s).slice(0,300);throw fn.push({time:Date.now(),url:a,method:(n==null?void 0:n.method)||"GET",error:o.message,duration:r}),fn.length>lp&&fn.shift(),o}}}function qA(){window.addEventListener("error",e=>{var n;const t=e.target;if(t&&t!==window&&t instanceof HTMLElement&&("src"in t||"href"in t)){const i=t.src||t.href,o=(n=t.tagName)==null?void 0:n.toLowerCase();zo("resource_error",o,i==null?void 0:i.slice(0,100));const s={id:`resource-error-${Date.now()}`,timestamp:Date.now(),type:"error",error:{message:`Resource load failed: ${o||"unknown"}`,type:"resourceError"},memory:Bt(),userAgent:navigator.userAgent,url:location.href,customData:Ul({resourceUrl:hn(i?Rn(i):void 0),eventTarget:cb(t)})};tn(s)}},{capture:!0})}function BA(){const e=console.error;console.error=function(...t){e.apply(this,t);const n=t[0];if(typeof n=="string"&&n.includes("[MemoryLog]"))return;const i=[...t];setTimeout(()=>{var r;let o="",s;for(let a=0;a<Math.min(i.length,5);a++){const c=i[a];if(typeof c=="string")o+=c+" ";else if(typeof c=="number"||typeof c=="boolean")o+=String(c)+" ";else if(c instanceof Error)o+=`Error: ${c.message} `,s=c.stack;else if(c&&typeof c=="object")try{const d=Object.keys(c).slice(0,5).map(m=>{const f=c[m];return`${m}:${typeof f=="string"?f.slice(0,20):typeof f}`}).join(",");o+=`{${d}} `}catch{o+=`[${((r=c.constructor)==null?void 0:r.name)||"Object"}] `}}ni.push({time:Date.now(),message:o.trim().slice(0,500),stack:s}),ni.length>bA&&ni.shift()},0)}}function db(){return{userActions:[...ti],consoleErrors:[...ni],networkErrors:[...fn],memory:Bt(),pageStats:fo(),fps:yi}}function LA(){typeof window>"u"||(window.__memoryLog={getMemory:()=>{const e=Bt();return e?{usedMB:(e.usedJSHeapSize/1024/1024).toFixed(1),limitMB:(e.jsHeapSizeLimit/1024/1024).toFixed(0),percent:(e.usedJSHeapSize/e.jsHeapSizeLimit*100).toFixed(1)}:null},track:wA,diagnose:()=>{const e=Bt(),t=fo();if(console.group("[MemoryLog] 内存诊断"),e){const n=e.usedJSHeapSize/1048576,i=e.jsHeapSizeLimit/(1024*1024),o=n/i*100;console.log(`内存: ${n.toFixed(0)} MB / ${i.toFixed(0)} MB (${o.toFixed(1)}%)`)}return console.log(`页面: DOM ${t.domNodeCount} | Canvas ${t.canvasCount} | Img ${t.imageCount} | Video ${t.videoCount}`),t.plaitElementCount!==void 0&&console.log(`Plait 元素: ${t.plaitElementCount}`),t.imageCount>50&&console.warn("图片较多,考虑懒加载"),t.domNodeCount>5e3&&console.warn("DOM 节点较多"),console.groupEnd(),{memory:e,pageStats:t}},snapshot:()=>{const e={id:`manual-${Date.now()}`,timestamp:Date.now(),type:"periodic",memory:Bt(),pageStats:fo(),userAgent:navigator.userAgent,url:location.href};tn(e)},getDiagnostics:db,getActions:()=>(console.table(ti.map(e=>({time:new Date(e.time).toLocaleTimeString("zh-CN"),action:e.action,target:e.target,detail:e.detail}))),ti),getNetworkErrors:()=>(console.table(fn.map(e=>({time:new Date(e.time).toLocaleTimeString("zh-CN"),url:e.url,status:e.status,error:e.error}))),fn),getConsoleErrors:()=>(console.table(ni.map(e=>({time:new Date(e.time).toLocaleTimeString("zh-CN"),message:e.message.slice(0,100)}))),ni)})}function OA(){if(up)return;up=!0,jA(),CA(),PA(),AA(),MA(),IA(),VA(),UA(),RA(),qA(),BA(),LA();const e=DA();e&&(e.customData={...e.customData,recovered:!0,recoveredAt:Date.now()},tn(e),_A())}function Rl(e,t){try{const n=FA(e,t),i=JSON.stringify(n,null,2),o=new Blob([i],{type:"application/json"}),s=URL.createObjectURL(o),r=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),a=document.createElement("a");a.href=s,a.download=`opentu-error-log-${r}.json`,a.style.display="none",document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(s)},100)}catch(n){console.error("[ErrorLogExporter] Failed to export:",n)}}function FA(e,t){const n={exportTime:new Date().toISOString(),version:"1.0",environment:{userAgent:navigator.userAgent,url:window.location.href,timestamp:Date.now(),language:navigator.language,platform:navigator.platform,screenSize:`${window.screen.width}x${window.screen.height}`},crashRecovery:Yt.getState(),diagnostics:db(),unifiedLogs:_y.getMemoryLogs()};return e&&(n.currentError={message:e.message,stack:e.stack,componentStack:(t==null?void 0:t.componentStack)??void 0}),n}const HA="aitu:lazy-chunk-retry",zA="_lazy_chunk_retry",GA="_t",WA=[/Failed to fetch dynamically imported module/i,/Importing a module script failed/i,/Loading chunk [\w-]+ failed/i,/ChunkLoadError/i];function $A(){var e;return typeof document>"u"?"unknown":((e=document.querySelector('meta[name="app-version"]'))==null?void 0:e.getAttribute("content"))||"unknown"}function mb(e){if(e instanceof Error){const t=[e.name,e.message,e.stack];return e.cause&&t.push(String(e.cause)),t.filter(Boolean).join(`
|
|
67
|
-
`)}return String(e??"")}function XA(e){const t=e.match(/https?:\/\/[^\s)'"]+\.js(?:\?[^\s)'"]*)?/i);if(!t)return"unknown-module";try{return new URL(t[0]).pathname}catch{return t[0]}}function KA(e){const t=mb(e);return WA.some(n=>n.test(t))}function YA(e){if(typeof window>"u"||typeof sessionStorage>"u"||!KA(e))return!1;const t=mb(e),n=`${HA}:${$A()}:${XA(t)}`;try{if(sessionStorage.getItem(n)==="1")return!1;sessionStorage.setItem(n,"1")}catch{return!1}const i=new URL(window.location.href);return i.searchParams.set(zA,"1"),i.searchParams.set(GA,String(Date.now())),console.warn("[ErrorBoundary] Detected stale lazy chunk. Reloading once to recover.",e),window.setTimeout(()=>{window.location.replace(i.toString())},0),!0}class ZA extends p.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null,errorInfo:null,recoveringFromChunkError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){const i=YA(t);this.setState({errorInfo:n,recoveringFromChunkError:i}),!i&&console.error("[ErrorBoundary] React render error:",t,n)}render(){var t,n,i,o,s,r;return this.state.hasError?this.state.recoveringFromChunkError?l.jsxDEV(Dr,{variant:"error",title:"检测到静态资源已更新",description:"当前页面引用的懒加载资源已失效,正在自动刷新一次以恢复工作台。若长时间未恢复,可手动点击安全模式。",errorMessage:((t=this.state.error)==null?void 0:t.message)||"动态资源加载失败",errorStack:(n=this.state.error)==null?void 0:n.stack,componentStack:((i=this.state.errorInfo)==null?void 0:i.componentStack)??void 0,onExportLog:()=>Rl(this.state.error,this.state.errorInfo),onSafeModeReload:ql,onGoToDebug:Tr},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:153,columnNumber:9},this):l.jsxDEV(Dr,{variant:"error",errorMessage:((o=this.state.error)==null?void 0:o.message)||"未知错误",errorStack:(s=this.state.error)==null?void 0:s.stack,componentStack:((r=this.state.errorInfo)==null?void 0:r.componentStack)??void 0,onExportLog:()=>Rl(this.state.error,this.state.errorInfo),onSafeModeReload:ql,onGoToDebug:Tr},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:170,columnNumber:7},this):this.props.children}}function ql(){try{localStorage.setItem("aitu_safe_mode","true")}catch{}window.location.reload()}function Tr(){const e="/sw-debug.html";window.location.href=e}const QA={crash:{iconBg:"#FFF3E0",iconStroke:"#F57C00",iconPath:l.jsxDEV(l.Fragment,{children:[l.jsxDEV("circle",{cx:"12",cy:"12",r:"10"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:235,columnNumber:9},void 0),l.jsxDEV("line",{x1:"12",y1:"8",x2:"12",y2:"12"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:236,columnNumber:9},void 0),l.jsxDEV("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:237,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:234,columnNumber:7},void 0),defaultTitle:"检测到页面异常退出",defaultDesc:""},error:{iconBg:"#FFEBEE",iconStroke:"#E53935",iconPath:l.jsxDEV(l.Fragment,{children:[l.jsxDEV("circle",{cx:"12",cy:"12",r:"10"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:248,columnNumber:9},void 0),l.jsxDEV("line",{x1:"15",y1:"9",x2:"9",y2:"15"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:249,columnNumber:9},void 0),l.jsxDEV("line",{x1:"9",y1:"9",x2:"15",y2:"15"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:250,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:247,columnNumber:7},void 0),defaultTitle:"应用渲染出错",defaultDesc:"页面遇到了意外错误,可能是画布数据异常或浏览器内存不足。"}},Dr=e=>{const{variant:t,crashCount:n,memoryInfo:i,onIgnore:o,title:s,description:r,errorMessage:a,errorStack:c,componentStack:u,onExportLog:d,onSafeModeReload:m,onGoToDebug:f}=e,[h,g]=_n.useState(!1),b=QA[t],x=s||b.defaultTitle,y=r||b.defaultDesc;return l.jsxDEV("div",{style:wt.overlay,children:l.jsxDEV("div",{style:wt.card,children:[l.jsxDEV("div",{style:{...wt.iconWrap,backgroundColor:b.iconBg},children:l.jsxDEV("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:b.iconStroke,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.iconPath},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:277,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:276,columnNumber:9},void 0),l.jsxDEV("h2",{style:wt.title,children:x},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:284,columnNumber:9},void 0),t==="crash"&&n!=null&&l.jsxDEV("p",{style:wt.desc,children:["页面已连续 ",n," 次未能正常加载,可能是因为:",l.jsxDEV("br",{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:290,columnNumber:13},void 0),"• 画布元素过多导致内存不足",l.jsxDEV("br",{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:291,columnNumber:13},void 0),"• 浏览器内存限制",l.jsxDEV("br",{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:292,columnNumber:13},void 0),l.jsxDEV("br",{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:292,columnNumber:19},void 0),"建议使用「安全模式」创建空白画布,稍后可从侧边栏切换到其他画布。"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:288,columnNumber:11},void 0),t==="error"&&y&&l.jsxDEV("p",{style:wt.desc,children:y},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:299,columnNumber:11},void 0),i&&l.jsxDEV(JA,{info:i},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:303,columnNumber:24},void 0),t==="error"&&a&&l.jsxDEV("div",{style:wt.errorBox,children:[l.jsxDEV("div",{style:wt.errorMsg,children:a},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:308,columnNumber:13},void 0),(c||u)&&l.jsxDEV("button",{onClick:()=>g(N=>!N),style:wt.detailToggle,children:h?"收起详情":"展开详情"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:310,columnNumber:15},void 0),h&&l.jsxDEV("pre",{style:wt.errorDetail,children:[c,u&&`
|
|
68
|
-
|
|
69
|
-
Component Stack:${u}`]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:316,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:307,columnNumber:11},void 0),l.jsxDEV("div",{style:wt.btnRow,children:[t==="crash"&&o&&l.jsxDEV(Ls,{label:"继续加载",onClick:o,bg:"#f5f5f5",bgHover:"#e8e8e8",color:"#666"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:327,columnNumber:13},void 0),t==="error"&&d&&l.jsxDEV(Ls,{label:"导出错误日志",onClick:d,bg:"#f5f5f5",bgHover:"#e8e8e8",color:"#333"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:331,columnNumber:13},void 0),l.jsxDEV(Ls,{label:"安全模式",onClick:m,bg:"#F39C12",bgHover:"#E67E22",color:"#fff"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:334,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:325,columnNumber:9},void 0),l.jsxDEV("div",{style:wt.divider},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:339,columnNumber:9},void 0),l.jsxDEV("div",{style:wt.helpSection,children:l.jsxDEV("div",{style:wt.helpRow,children:[l.jsxDEV("img",{src:"https://nav.ourzhishi.top/api/dynamic-image/qr-code",alt:"企业微信二维码",style:wt.qrcode,referrerPolicy:"no-referrer"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:345,columnNumber:13},void 0),l.jsxDEV("div",{style:wt.helpText,children:[l.jsxDEV("p",{style:wt.helpTitle,children:"需要帮助?"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:350,columnNumber:15},void 0),l.jsxDEV("p",{style:wt.helpDesc,children:"扫码联系客服,或前往调试页面导出完整日志与备份数据"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:351,columnNumber:15},void 0),l.jsxDEV(Ls,{label:"打开调试页面",onClick:f,bg:"#f0eefa",bgHover:"#e2ddf7",color:"#5A4FCF",small:!0},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:352,columnNumber:15},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:349,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:343,columnNumber:11},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:342,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:274,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:273,columnNumber:5},void 0)},JA=({info:e})=>{const t=e.percent>75?"#E53935":e.percent>50?"#FB8C00":"#43A047";return l.jsxDEV("div",{style:wt.memoryBox,children:[l.jsxDEV("div",{style:{fontSize:12,color:"#888",marginBottom:8},children:"当前内存使用情况"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:370,columnNumber:7},void 0),l.jsxDEV("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsxDEV("span",{style:{fontSize:14,color:"#333"},children:[e.used," / ",e.limit]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:372,columnNumber:9},void 0),l.jsxDEV("span",{style:{fontSize:14,fontWeight:500,color:t},children:[e.percent.toFixed(0),"%"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:373,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:371,columnNumber:7},void 0),l.jsxDEV("div",{style:{height:4,backgroundColor:"#e0e0e0",borderRadius:2,marginTop:8,overflow:"hidden"},children:l.jsxDEV("div",{style:{height:"100%",width:`${Math.min(e.percent,100)}%`,backgroundColor:t,transition:"width 0.3s ease"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:376,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:375,columnNumber:7},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:369,columnNumber:5},void 0)},Ls=({label:e,onClick:t,bg:n,bgHover:i,color:o,small:s})=>{const[r,a]=_n.useState(!1),c=s?{...wt.btnSmall,backgroundColor:r?i:n,color:o}:{...wt.btn,backgroundColor:r?i:n,color:o};return l.jsxDEV("button",{onClick:t,onMouseOver:()=>a(!0),onMouseOut:()=>a(!1),style:c,children:e},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/ErrorBoundary.tsx",lineNumber:392,columnNumber:5},void 0)},wt={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99999},card:{backgroundColor:"#fff",borderRadius:12,padding:32,maxWidth:520,width:"90%",maxHeight:"90vh",overflowY:"auto",boxShadow:"0 20px 60px rgba(0,0,0,0.3)"},iconWrap:{width:64,height:64,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px"},title:{margin:"0 0 12px",fontSize:20,fontWeight:600,textAlign:"center",color:"#1a1a1a"},desc:{margin:"0 0 20px",fontSize:14,color:"#666",textAlign:"center",lineHeight:1.6},memoryBox:{backgroundColor:"#f5f5f5",borderRadius:8,padding:"12px 16px",marginBottom:24},errorBox:{backgroundColor:"#f5f5f5",borderRadius:8,padding:"12px 16px",marginBottom:24},errorMsg:{fontSize:13,color:"#E53935",wordBreak:"break-word"},detailToggle:{marginTop:8,padding:0,border:"none",background:"none",color:"#888",fontSize:12,cursor:"pointer",textDecoration:"underline"},errorDetail:{marginTop:8,padding:8,backgroundColor:"#eee",borderRadius:4,fontSize:11,color:"#555",maxHeight:150,overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},btnRow:{display:"flex",gap:12},btn:{flex:1,padding:"12px 24px",fontSize:14,fontWeight:500,border:"none",borderRadius:8,cursor:"pointer",transition:"background-color 0.2s ease"},btnSmall:{padding:"8px 16px",fontSize:13,fontWeight:500,border:"none",borderRadius:6,cursor:"pointer",transition:"background-color 0.2s ease"},divider:{height:1,backgroundColor:"#eee",margin:"24px 0"},helpSection:{padding:0},helpRow:{display:"flex",gap:16,alignItems:"center"},qrcode:{width:96,height:96,borderRadius:8,flexShrink:0},helpText:{flex:1,minWidth:0},helpTitle:{margin:"0 0 4px",fontSize:14,fontWeight:500,color:"#333"},helpDesc:{margin:"0 0 12px",fontSize:12,color:"#999",lineHeight:1.5}},e2=500,Bl="board",$c="aitu_board_close_snapshot_v1";let za=!1;function t2(){if(!(typeof window>"u"))return window.__OPENTU_BOOT__}function fp(){return new URLSearchParams(window.location.search).get(Bl)}function hp(e,t=!1){const n=new URL(window.location.href);e?n.searchParams.set(Bl,e):n.searchParams.delete(Bl),t?window.history.replaceState({boardId:e},"",n.toString()):window.history.pushState({boardId:e},"",n.toString())}function n2(e){try{localStorage.setItem($c,JSON.stringify(e))}catch(t){console.warn("[App] Failed to save board close snapshot:",t)}}function pb(){try{const e=localStorage.getItem($c);if(!e)return null;const t=JSON.parse(e);return!t||typeof t.boardId!="string"||typeof t.updatedAt!="number"||!Array.isArray(t.children)?null:t}catch(e){return console.warn("[App] Failed to load board close snapshot:",e),null}}function Os(e){try{const t=pb();if(!t)return;(!e||t.boardId===e)&&localStorage.removeItem($c)}catch(t){console.warn("[App] Failed to clear board close snapshot:",t)}}function i2(){const[e,t]=p.useState(!0),[n,i]=p.useState(!1),o=p.useRef(!1),[s,r]=p.useState(!1),[a,c]=p.useState(null),[u,d]=p.useState({children:[]}),[m,f]=p.useState(null),h=p.useRef(null),g=p.useRef(),b=p.useRef(null),x=p.useRef(null),y=p.useRef(!1),N=p.useRef(null),w=p.useRef(!1),T=p.useRef(!1),S=p.useRef(!1);BC(m),p.useEffect(()=>{h.current=m},[m]);const v=p.useCallback((M,_,I=Date.now())=>{g.current=_.viewport,b.current={boardId:M,children:_.children,viewport:_.viewport,theme:_.theme,updatedAt:I}},[]),E=p.useCallback(M=>{const _=b.current,I=h.current;if(!_||!I||_.boardId!==I||!S.current)return;n2({..._,updatedAt:Date.now()}),Nn.getInstance().saveCurrentBoard({children:_.children,viewport:_.viewport,theme:_.theme}).catch(Z=>{console.warn(`[App] Failed to flush board on ${M}:`,Z)})},[]);p.useEffect(()=>{const M=t2();M&&(s||a||!e)&&M.markReady()},[a,e,s]),p.useEffect(()=>{s||a||e||tb(["offline-static-assets"])},[a,e,s]),p.useEffect(()=>{(async()=>{if(Yt.shouldShowSafeModePrompt()&&!Yt.isSafeMode()){r(!0),t(!1);return}if(za){const _=Nn.getInstance();t(!1),await _.waitForInitialization();const I=_.getState().currentBoardId;if(I&&_.getBoardMetadata(I)){const P=await _.switchBoard(I),Z={children:P.elements||[],viewport:P.viewport,theme:P.theme};v(P.id,Z,P.updatedAt),S.current=!1,d(Z)}t(!1),Yt.markLoadingComplete();return}za=!0;try{const _=Nn.getInstance();if(t(!1),await _.initialize(),await ob()||await OC(),Yt.isSafeMode()){console.log("[App] Safe mode: looking for existing safe mode board");const ce=_.getAllBoards().find(le=>le.name.startsWith("安全模式")&&(!le.elements||le.elements.length===0));if(ce)console.log("[App] Safe mode: reusing existing board:",ce.name),await _.switchBoard(ce.id),f(ce.id);else{console.log("[App] Safe mode: creating new blank board");const le=new Date().toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),be=await _.createBoard({name:`安全模式 ${le}`,elements:[]});be&&(await _.switchBoard(be.id),f(be.id))}const X={children:[]},ae=(ce==null?void 0:ce.id)||h.current||"safe-mode";v(ae,X,Date.now()),d(X),o.current=!0,i(!0),t(!1),Yt.markLoadingComplete(),Yt.disableSafeMode(),setTimeout(()=>{re.warning({content:"当前处于安全模式,已创建空白画布。可从侧边栏切换到其他画布。",duration:8e3,closeBtn:!0})},500);return}let P=null;const Z=fp(),pe=_.getState().currentBoardId;let A=null;if(Z&&_.getBoardMetadata(Z)?A=Z:pe&&_.getBoardMetadata(pe)&&(A=pe),A)P=await _.switchBoard(A);else if(_.hasBoards()){const G=_.getTree(),ce=fb(G);ce&&(P=await _.switchBoard(ce.id))}else{const G=await _.createBoard({name:"我的画板1",elements:[]});G&&(P=await _.switchBoard(G.id))}if(P&&(hp(P.id,!0),f(P.id),_.persistCurrentBoardId(P.id),S.current=!1),P){const G=pb();let ce={children:P.elements||[],viewport:P.viewport,theme:P.theme};if(G&&G.boardId===P.id&&G.updatedAt>P.updatedAt){ce={children:G.children,viewport:G.viewport,theme:G.theme},P={...P,...ce,updatedAt:G.updatedAt};const X=P.id;_.saveBoard(X,ce).then(()=>{S.current=!1,Os(X)}).catch(ae=>{console.warn("[App] Failed to rehydrate board from close snapshot:",ae)}),re.warning({content:"检测到上次关闭前的未落盘画布,已自动恢复",duration:5e3,closeBtn:!0})}else G&&G.boardId&&!_.getBoardMetadata(G.boardId)&&Os(G.boardId);v(P.id,ce,P.updatedAt),S.current=!1,d(ce),Ga(ce.children).then(X=>{if(X!==ce.children){const ae={...ce,children:X};v(P.id,ae,Date.now()),d(ae)}}).catch(X=>{console.error("[App] Video URL recovery failed:",X)})}}catch(_){console.error("[App] Initialization failed:",_),c(_ instanceof Error?_:new Error(String(_)))}finally{o.current=!0,i(!0),t(!1),Yt.markLoadingComplete()}})()},[v]);const U=p.useCallback(async(M,_=!1)=>{try{_||(hp(M.id),Nn.getInstance().persistCurrentBoardId(M.id)),f(M.id),T.current=!1,S.current=!1;const P={children:await Ga(M.elements||[]),viewport:M.viewport,theme:M.theme};v(M.id,P,M.updatedAt),d(P),setTimeout(()=>{N.current&&(Yo(N.current),kp(N.current),or(N.current))},0)}catch(I){console.error("[App] Board switch failed:",I),re.error({content:`切换画板失败: ${I instanceof Error?I.message:"未知错误"}`,duration:5e3,closeBtn:!0})}},[v]);p.useEffect(()=>{const M=async()=>{if(!y.current){y.current=!0;try{const _=fp();if(_&&_!==m){const I=Nn.getInstance(),P=await I.switchBoard(_);P&&(await U(P,!0),I.persistCurrentBoardId(P.id))}}catch(_){console.error("[App] Failed to handle browser navigation:",_)}finally{y.current=!1}}};return window.addEventListener("popstate",M),()=>{window.removeEventListener("popstate",M)}},[m,U]);const q=p.useCallback(async()=>{w.current=!0;try{const M=Nn.getInstance();let _=M.getCurrentBoard();if(!_){const P=M.getState().currentBoardId;if(!P){console.warn("[App] handleTabSyncNeeded: no current board ID");return}if(!M.getBoardMetadata(P)){console.warn("[App] handleTabSyncNeeded: board not found",P);return}try{_=await M.switchBoard(P)}catch(Z){console.error("[App] handleTabSyncNeeded: failed to load board",Z);return}}const I=await M.reloadBoard(_.id);if(I){const Z={children:await Ga(I.elements||[]),viewport:I.viewport,theme:I.theme};v(I.id,Z,I.updatedAt),S.current=!1,d(Z)}}catch(M){console.error("[App] Failed to sync board data:",M),os()}finally{setTimeout(()=>{w.current=!1},100)}},[v]),$=p.useCallback(M=>{if(d(M),g.current=M.viewport,!o.current||w.current)return;T.current=!0,S.current=!0;const _=Nn.getInstance(),I=_.getCurrentBoard();if(!I){console.warn("[App] handleBoardChange: board not fully loaded, skipping save");return}v(I.id,M),_.saveCurrentBoard(M).then(()=>{S.current=!1,Os(I.id),eb(I.id)}).catch(P=>{console.error("[App] Failed to save board:",P)})},[v]),V=p.useCallback(M=>{g.current=M;const _=b.current;_&&(b.current={..._,viewport:M,updatedAt:Date.now()}),!w.current&&(S.current=!0,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{if(w.current)return;const I=Nn.getInstance(),P=I.getCurrentBoard();P&&I.saveCurrentBoard({children:P.elements,viewport:M,theme:P.theme}).then(()=>{S.current=!1,Os(P.id)}).catch(Z=>{console.error("[App] Failed to save viewport:",Z)})},e2))},[v]);p.useEffect(()=>{const M=Z=>{if(x.current&&(clearTimeout(x.current),x.current=null),w.current)return;const A=Nn.getInstance().getCurrentBoard(),G=b.current,ce=g.current,X=h.current;A&&X&&(!G||G.boardId!==X)&&v(A.id,{children:A.elements,viewport:ce??A.viewport,theme:A.theme},Date.now()),!(Z==="visibilitychange"&&!T.current)&&E(Z)},_=()=>{M("beforeunload")},I=()=>{document.visibilityState==="hidden"&&M("visibilitychange")},P=()=>{M("pagehide")};return window.addEventListener("beforeunload",_),window.addEventListener("pagehide",P),document.addEventListener("visibilitychange",I),()=>{window.removeEventListener("beforeunload",_),window.removeEventListener("pagehide",P),document.removeEventListener("visibilitychange",I),x.current&&clearTimeout(x.current)}},[E,v]);const R=p.useCallback(M=>{r(!1),M?Yt.enableSafeMode():Yt.clearCrashState(),t(!0),za=!1,setTimeout(()=>{os()},100)},[]);return s?l.jsxDEV(Dr,{variant:"crash",crashCount:Yt.getCrashCount(),memoryInfo:Yt.getMemoryInfo(),onIgnore:()=>R(!1),onSafeModeReload:()=>R(!0),onGoToDebug:Tr},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/app.tsx",lineNumber:874,columnNumber:7},this):a?l.jsxDEV(Dr,{variant:"error",title:"应用初始化失败",description:"无法加载画板数据,可能是存储损坏或浏览器限制。",errorMessage:a.message,errorStack:a.stack,onExportLog:()=>Rl(a),onSafeModeReload:ql,onGoToDebug:Tr},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/app.tsx",lineNumber:888,columnNumber:7},this):e?l.jsxDEV("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh"},children:"加载中..."},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/app.tsx",lineNumber:903,columnNumber:7},this):l.jsxDEV("div",{style:{height:"100vh"},children:l.jsxDEV(IC,{value:u.children,viewport:u.viewport,theme:u.theme,onChange:$,onViewportChange:V,onBoardSwitch:U,onTabSyncNeeded:q,isDataReady:n,currentBoardId:m,afterInit:M=>{N.current=M,window.__drawnix__web__console=_=>{o2(M,_)}}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/app.tsx",lineNumber:918,columnNumber:7},this)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/app/app.tsx",lineNumber:917,columnNumber:5},this)}const o2=(e,t)=>{const n=F.getBoardContainer(e).closest(".drawnix");let i=n.querySelector(".drawnix-console");i||(i=document.createElement("div"),i.classList.add("drawnix-console"),n.append(i));const o=document.createElement("div");o.innerHTML=t,i.append(o)};async function Ga(e){return e.map(t=>{const n=t.url;if(n!=null&&n.startsWith("/__aitu_cache__/video/"))return t;if(n!=null&&n.startsWith("blob:")&&n.includes("#merged-video-")){const i=n.indexOf("#merged-video-");if(i!==-1){const o=n.substring(i+1),s=o.indexOf("#",1),a=`/__aitu_cache__/video/${s>0?o.substring(0,s):o}.mp4`;return{...t,url:a}}}return t})}function fb(e){for(const t of e){if(t.type==="board")return t.data;if(t.type==="folder"&&t.children){const n=fb(t.children);if(n)return n}}return null}const gp=window.addEventListener.bind(window),s2=window.removeEventListener.bind(window);let Xc=null;window.addEventListener=function(e,t,n){if(e==="unload"){console.warn("[Permissions Policy] Blocked unload event listener");return}return e==="beforeunload"&&(Xc=t),gp.call(window,e,t,n)};window.removeEventListener=function(e,t,n){return e==="beforeunload"&&(Xc=null),s2.call(window,e,t,n)};window.__checkBeforeUnload=()=>!!Xc;let bp=!1;const hb="sw-debug-enabled";function r2(){try{return sessionStorage.getItem(hb)==="true"}catch{return!1}}function xp(e){try{sessionStorage.setItem(hb,e===!0?"true":"false")}catch{}}let Io=r2();const Ko=[];let oo=null,Qn=0;const _r=15e3,Vo={error:console.error,warn:console.warn,info:console.info,log:console.log,debug:console.debug};function fi(e,t,n){if(t.includes("[SW]")||t.includes("[SWTaskQueue]")||t.includes("[SWChannelManager]")||t.includes("Invalid message structure")||t.includes("posthog.com")||t.includes("sentry.io")||n&&(n.includes("posthog")||n.includes("sentry")))return;const i=()=>{bt.isInitialized()&&bt.reportConsoleLog(e,[{message:t,stack:n||"",source:window.location.href}],Date.now()).catch(()=>{})},o=()=>{for(;Ko.length>0&&bt.isInitialized();){const r=Ko.shift();bt.reportConsoleLog(r.level,[{message:r.message,stack:r.stack||"",source:window.location.href}],Date.now()).catch(()=>{})}},s=()=>{const r=Date.now();oo||r<Qn||(oo=bt.initialize().then(a=>{if(!a){Qn=Date.now()+_r;return}Qn=0,o()}).catch(()=>{Qn=Date.now()+_r}).finally(()=>{oo=null}))};bt.isInitialized()?i():(Ko.push({level:e,message:t,stack:n}),s())}function Uo(e){return e.map(t=>{if(t instanceof Error)return t.message;if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)}).join(" ")}function Np(e){for(const t of e)if(t instanceof Error&&t.stack)return t.stack;return""}function a2(){if(bp||!("serviceWorker"in navigator))return;bp=!0;const e=()=>{if(bt.isInitialized())bt.subscribeToEvent("debug:statusChanged",t=>{const n=t,i=n.enabled??n.debugModeEnabled??!1;Io=i,xp(i)}),bt.getDebugStatus().then(t=>{const n=t.enabled??t.debugModeEnabled??!1;Io=n,xp(n)});else{const t=Date.now();!oo&&t>=Qn&&(oo=bt.initialize().then(n=>{if(!n){Qn=Date.now()+_r;return}for(Qn=0;Ko.length>0&&bt.isInitialized();){const i=Ko.shift();bt.reportConsoleLog(i.level,[{message:i.message,stack:i.stack||"",source:window.location.href}],Date.now()).catch(()=>{})}}).catch(()=>{Qn=Date.now()+_r}).finally(()=>{oo=null})),setTimeout(e,500)}};e(),console.error=function(...t){Vo.error.apply(console,t),fi("error",Uo(t),Np(t))},console.warn=function(...t){Vo.warn.apply(console,t),fi("warn",Uo(t),Np(t))},console.log=function(...t){Vo.log.apply(console,t),Io&&fi("log",Uo(t),"")},console.info=function(...t){Vo.info.apply(console,t),Io&&fi("info",Uo(t),"")},console.debug=function(...t){Vo.debug.apply(console,t),Io&&fi("debug",Uo(t),"")},window.addEventListener("error",t=>{var i;const n=`${t.message} at ${t.filename}:${t.lineno}:${t.colno}`;fi("error",n,((i=t.error)==null?void 0:i.stack)||"")}),window.addEventListener("unhandledrejection",t=>{const n=t.reason,i=n instanceof Error?n.message:`Unhandled Promise: ${String(n)}`,o=n instanceof Error&&n.stack||"";fi("error",i,o)})}"serviceWorker"in navigator&&a2();Yt.markLoadingStart();Yt.checkUrlSafeMode();OA();const l2=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),c2=typeof window<"u"&&new URLSearchParams(window.location.search).get("report")==="1",u2=c2||!l2&&!1,gb="0.6.76",ra=jy(),yp="_lazy_chunk_retry",d2="_t";function m2(){if(typeof window>"u")return;const e=new URL(window.location.href);if(e.searchParams.has(yp)){e.searchParams.delete(yp),e.searchParams.delete(d2);try{window.history.replaceState(window.history.state,"",e.toString())}catch{}}}m2();function bb(e){return e==="jsdelivr"||e==="unpkg"||e==="local"}function p2(){return window.__OPENTU_BOOT__||null}function Yi(e){var t,n;(n=(t=p2())==null?void 0:t.setProgress)==null||n.call(t,e==null?void 0:e.progress,e)}function f2(){const e=window.__OPENTU_CDN__||window.__AITU_CDN__;return!e||!bb(e.cdn)?null:{cdn:e.cdn,latency:Number.isFinite(e.latency)&&e.latency>=0?e.latency:0,timestamp:Number.isFinite(e.timestamp)&&e.timestamp>0?e.timestamp:Date.now()}}function wp(e){const t=f2();if(!t)return;const n={type:"SW_CDN_SET_PREFERENCE",...t,version:gb},i=new Set,o=[navigator.serviceWorker.controller,e==null?void 0:e.active,e==null?void 0:e.waiting,e==null?void 0:e.installing];for(const s of o)s&&i.add(s);i.forEach(s=>{s.postMessage(n)})}function vp(e){wp(e);const t=window.__OPENTU_CDN_API__||window.__AITU_CDN_API__;t!=null&&t.selectBestCDN&&t.selectBestCDN().then(n=>{n&&bb(n.cdn)&&(window.__OPENTU_CDN__=n),wp(e)}).catch(n=>{console.warn("[Main] Failed to sync CDN preference to Service Worker:",n)})}function Fs(e,t={}){if(typeof window>"u")return;const{delay:n=0,timeout:i=2e3}=t,o=()=>{const r=window.requestIdleCallback;if(typeof r=="function"){r(e,{timeout:i});return}window.setTimeout(e,Math.min(i,500))},s=()=>{if(n>0){window.setTimeout(o,n);return}o()};window.requestAnimationFrame(()=>{window.requestAnimationFrame(s)})}wk({dsn:"https://a18e755345995baaa0e1972c4cf24497@o4510700882296832.ingest.us.sentry.io/4510700883869696",enabled:u2,sendDefaultPii:!1,tracesSampleRate:.1,beforeSend(e){return e.extra&&(e.extra=Oi(e.extra)),e.contexts&&(e.contexts=Oi(e.contexts)),e.breadcrumbs&&(e.breadcrumbs=e.breadcrumbs.map(t=>({...t,data:t.data?Oi(t.data):void 0,message:t.message?String(Oi(t.message)):void 0}))),e.request&&(e.request.headers&&(e.request.headers=Oi(e.request.headers)),e.request.data&&(e.request.data=Oi(e.request.data)),e.request.url&&(e.request.url=Rn(e.request.url))),e}});na("app_version",gb);na("deployment_env",ra.deployment_env);na("release_channel",ra.release_channel);na("host",ra.host||"unknown");Yi({tip:"正在初始化启动服务...",source:"phase",progress:12});if(typeof window<"u"){ZC();const e=()=>{if(window.posthog){Ay(ra),YC();return}setTimeout(e,300)};Fs(e,{delay:0,timeout:1e3}),Fs(()=>{rb().catch(n=>{console.warn("[Main] Database cleanup failed:",n)}),nA.runMigration().then(()=>Promise.all([Py(),Cy.initializeAsync()])).catch(n=>{console.warn("[Main] Storage migration/init failed:",n)})},{delay:400,timeout:2500}),Fs(()=>{Au.start(),Au.logMemoryStatus()},{delay:5e3,timeout:2500});const t=()=>{window.posthog?zC():setTimeout(t,500)};Fs(t,{delay:1500,timeout:3e3})}if("serviceWorker"in navigator){const e=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1";let t=null,n=!1,i=!1,o=null,s=null;const r=g=>{o!==g&&(o=g,window.dispatchEvent(new CustomEvent("sw-update-available",{detail:{version:g}})))},a=g=>{if(g.pendingVersion&&g.pendingVersion!==g.committedVersion&&(g.upgradeState==="ready"||g.upgradeState==="committing")){r(g.pendingVersion);return}g.pendingVersion||(o=null)},c=g=>{const b=g||t||(s==null?void 0:s.waiting)||navigator.serviceWorker.controller||(s==null?void 0:s.active)||null;b&&b.postMessage({type:"GET_VERSION_STATE"})},u=g=>{!n||i||(i=!0,console.info("[Main] Scheduling reload after service worker takeover:",{reason:g}),setTimeout(()=>{os()},1e3))},d=async()=>{const g=[t,s==null?void 0:s.waiting];try{const b=await navigator.serviceWorker.getRegistration()||null;b&&(s=b,g.push(b.waiting))}catch(b){console.warn("[Main] Failed to get live service worker registration:",b)}try{const b=await navigator.serviceWorker.ready;g.push(b.waiting)}catch(b){console.warn("[Main] Failed to inspect ready service worker registration:",b)}for(const b of g)if(!(!b||b.state==="redundant")&&b!==navigator.serviceWorker.controller)return t=b,b;return null},m=window.__OPENTU_SW_REGISTRATION_PROMISE__||navigator.serviceWorker.register("/sw.js").catch(g=>(console.warn("[Main] Service worker registration failed:",g),null));window.__OPENTU_SW_REGISTRATION_PROMISE__=m,m.then(g=>{if(!g){Yi({tip:"离线加速未启用,正在直接启动工作台...",source:"phase",progress:70});return}s=g,Yi({tip:"启动缓存服务已连接,正在准备资源清单...",source:"phase",progress:72}),vp(g),e?(g.update().catch(b=>console.warn("Forced update check failed:",b)),g.waiting&&g.waiting.postMessage({type:"FORCE_UPGRADE"})):g.waiting&&navigator.serviceWorker.controller&&(t=g.waiting,c(g.waiting)),g.addEventListener("updatefound",()=>{const b=g.installing;b&&b.addEventListener("statechange",()=>{b.state==="installed"&&navigator.serviceWorker.controller&&(t=b,e?b.postMessage({type:"FORCE_UPGRADE"}):(c(b),setTimeout(()=>c(b),5e3)))})}),g.active&&!g.installing&&!g.waiting&&Yi({tip:"启动缓存服务已就绪,正在恢复工作台状态...",source:"phase",progress:78}),c(),setInterval(()=>{g.update().catch(b=>{console.warn("Update check failed:",b)})},300*1e3),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&c()})}).catch(g=>{Yi({tip:"离线加速未启用,正在直接启动工作台...",source:"phase",progress:70})});const f=()=>{if(!bt.isInitialized()){setTimeout(f,500);return}bt.setEventHandlers({onSWUpdated:g=>{c()},onSWNewVersionReady:g=>{r(g.version),c()},onSWActivated:g=>{if(n){u("sw:activated");return}t=null,c()}}),s!=null&&s.waiting&&navigator.serviceWorker.controller&&(t=s.waiting,c(s.waiting))};setTimeout(f,1e3);const h=async()=>{if(!bt.isInitialized()){setTimeout(h,500);return}bt.registerVideoThumbnailHandler(async(g,b)=>{try{const{generateVideoThumbnailFromBlob:x}=await Me(async()=>{const{generateVideoThumbnailFromBlob:v}=await import("./tool-windows-CtLXQDGF.js").then(E=>E.oK);return{generateVideoThumbnailFromBlob:v}},__vite__mapDeps([0]),import.meta.url);let y=null;const w=await(await caches.open("drawnix-images")).match(g);if(w&&(y=await w.blob()),!y&&(g.startsWith("http://")||g.startsWith("https://")))try{const v=await fetch(g);v.ok&&(y=await v.blob())}catch{y=null}if(!y)return{error:"Video not found in cache or network"};const T=await x(y,b||400);return{thumbnailUrl:await new Promise((v,E)=>{const U=new FileReader;U.onloadend=()=>v(U.result),U.onerror=E,U.readAsDataURL(T)})}}catch(x){return{error:x instanceof Error?x.message:String(x)}}})};h(),navigator.serviceWorker.addEventListener("message",g=>{var b;((b=g.data)==null?void 0:b.type)==="SW_VERSION_STATE"&&a(g.data)}),navigator.serviceWorker.addEventListener("controllerchange",()=>{vp(s),c(),u("controllerchange")}),window.addEventListener("user-confirmed-upgrade",()=>{(async()=>{const g=await d();if(!g){console.warn("[Main] No waiting service worker available for COMMIT_UPGRADE"),c(),s==null||s.update().catch(b=>{console.warn("[Main] Update check after missing waiting worker failed:",b)});return}n=!0,g.postMessage({type:"COMMIT_UPGRADE"})})()})}Yi({tip:"正在挂载工作台界面...",source:"phase",progress:88});const h2=jr.createRoot(document.getElementById("root"));h2.render(l.jsxDEV(p.StrictMode,{children:l.jsxDEV(ZA,{children:l.jsxDEV(i2,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/main.tsx",lineNumber:784,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/main.tsx",lineNumber:783,columnNumber:5},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/apps/web/src/main.tsx",lineNumber:782,columnNumber:3},void 0));const y2=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{tD as A,rS as B,uS as W,TP as a,xt as b,x2 as c,Gg as d,N2 as e,y2 as f,b2 as g,H_ as i,DD as m,nD as u,iT as w};
|