agentworkshop 0.7.23 → 0.7.27
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/0jKrzLuM.js +19 -0
- package/.output/public/_nuxt/2jaJHWIJ.js +1 -0
- package/.output/public/_nuxt/{Cor9siSf.js → 6PZPfFcO.js} +1 -1
- package/.output/public/_nuxt/B7gZokg82.js +209 -0
- package/.output/public/_nuxt/B8kt898d.js +1 -0
- package/.output/public/_nuxt/{B-xskWta.js → BCJFMBQ6.js} +1 -1
- package/.output/public/_nuxt/BFGpEo8S.js +1 -0
- package/.output/public/_nuxt/BG4zduPf.js +14 -0
- package/.output/public/_nuxt/{DNxVTfhe.js → BGhOrgle.js} +1 -1
- package/.output/public/_nuxt/{n3vMFfrv.js → BHcpzI2n.js} +3 -3
- package/.output/public/_nuxt/{CEHmSufQ.js → BTLEvDxM.js} +1 -1
- package/.output/public/_nuxt/{CYBq3kS7.js → BWyR3awA.js} +1 -1
- package/.output/public/_nuxt/Bc89zKq2.js +1 -0
- package/.output/public/_nuxt/BetmGSO4.js +1 -0
- package/.output/public/_nuxt/{DAR70Lf5.js → BgCrZKv_2.js} +1 -1
- package/.output/public/_nuxt/BowTbasd.js +1 -0
- package/.output/public/_nuxt/BvtknqSC2.js +1 -0
- package/.output/public/_nuxt/CJviSvm-.js +1 -0
- package/.output/public/_nuxt/CTfqWGdy.js +1 -0
- package/.output/public/_nuxt/Cb3SnTM8.js +1 -0
- package/.output/public/_nuxt/Chc5pfAA.js +1 -0
- package/.output/public/_nuxt/CmHzfVc5.js +3 -0
- package/.output/public/_nuxt/Cn3J3NXR.js +23 -0
- package/.output/public/_nuxt/CobSUzQv.js +2 -0
- package/.output/public/_nuxt/{kZV5TQvh2.js → CucID8qg2.js} +1 -1
- package/.output/public/_nuxt/{CfVAr2nf.js → Cz9gD2Yo.js} +1 -1
- package/.output/public/_nuxt/{E88a-JCG.js → DGAOugLt.js} +1 -1
- package/.output/public/_nuxt/DHbTyoAV.js +1 -0
- package/.output/public/_nuxt/{BxtpDtzC.js → DNQF_TXX.js} +1 -1
- package/.output/public/_nuxt/DfLUN8kY.js +1 -0
- package/.output/public/_nuxt/DjU9Dx5Y.js +1 -0
- package/.output/public/_nuxt/DnziMlcX.js +1 -0
- package/.output/public/_nuxt/{BBwMH_hG.js → DoAlYsiF.js} +1 -1
- package/.output/public/_nuxt/{DA4lxCWC2.js → DosOJEmZ2.js} +2 -2
- package/.output/public/_nuxt/{DWcEk1ur2.js → DvgKXPgu2.js} +1 -1
- package/.output/public/_nuxt/{ed5qX-x5.js → Q_SJDSgx.js} +1 -1
- package/.output/public/_nuxt/{TownView.zu2rU5nS.css → TownView.CtskuMXS.css} +1 -1
- package/.output/public/_nuxt/XY2z78rj.js +1 -0
- package/.output/public/_nuxt/_id_.DdbYeLqn.css +1 -0
- package/.output/public/_nuxt/bFnZa2yd.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/f7a8e33d-5422-45ac-895d-27168f97e3ad.json +1 -0
- package/.output/public/_nuxt/daq.DGV9QS8d.css +1 -0
- package/.output/public/_nuxt/entry.BN02X8iR.css +1 -0
- package/.output/public/_nuxt/monitor.B--1dPzs.css +1 -0
- package/.output/public/_nuxt/permissions.B1pjGChZ.css +1 -0
- package/.output/public/_nuxt/plugins.DpCuwaJt.css +1 -0
- package/.output/public/_nuxt/rkVgzg62.js +1 -0
- package/.output/public/_nuxt/settings.W6qrYAui.css +1 -0
- package/.output/public/_nuxt/teams.BBXVkyKq.css +1 -0
- package/.output/public/_nuxt/tokens.xRb1fSPU.css +1 -0
- package/.output/public/_nuxt/users.DuAt_Zwf.css +1 -0
- package/.output/public/_nuxt/workshop.BJg84pOK.css +1 -0
- package/.output/public/assets/game/character/yangyang-walk.glb +0 -0
- package/.output/server/chunks/_/host-bindings.mjs +1 -1
- package/.output/server/chunks/_/nitro.mjs +1073 -925
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/build/{OmpTerminalPanel-Ban3yJZ4.mjs → OmpTerminalPanel-Cw_Vw9oO.mjs} +3 -3
- package/.output/server/chunks/build/{OmpTerminalPanel-Ban3yJZ4.mjs.map → OmpTerminalPanel-Cw_Vw9oO.mjs.map} +1 -1
- package/.output/server/chunks/build/{TownView-DxeQe1Bl.mjs → TownView-ftIylqiD.mjs} +178 -151
- package/.output/server/chunks/build/{TownView-DxeQe1Bl.mjs.map → TownView-ftIylqiD.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-DQDqj-cZ.mjs → _id_-3Axz2-gV.mjs} +35 -35
- package/.output/server/chunks/build/{_id_-DQDqj-cZ.mjs.map → _id_-3Axz2-gV.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-DY6v6sqB.mjs → _id_-CahfkmEt.mjs} +5 -5
- package/.output/server/chunks/build/{_id_-DY6v6sqB.mjs.map → _id_-CahfkmEt.mjs.map} +1 -1
- package/.output/server/chunks/build/{_wsId_-C2O5zZsI.mjs → _wsId_-BymlQhzS.mjs} +13 -15
- package/.output/server/chunks/build/{_wsId_-C2O5zZsI.mjs.map → _wsId_-BymlQhzS.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents--6bzGtES.mjs → agents-DuMiSWKp.mjs} +7 -9
- package/.output/server/chunks/build/agents-DuMiSWKp.mjs.map +1 -0
- package/.output/server/chunks/build/button-DEcZFcqN.mjs +1 -1
- package/.output/server/chunks/build/{card-CCPQoKlh.mjs → card-Dipvaykh.mjs} +4 -4
- package/.output/server/chunks/build/{card-CCPQoKlh.mjs.map → card-Dipvaykh.mjs.map} +1 -1
- package/.output/server/chunks/build/{channel-templates-C1Bb-U75.mjs → channel-templates-BStqJ-of.mjs} +5 -7
- package/.output/server/chunks/build/channel-templates-BStqJ-of.mjs.map +1 -0
- package/.output/server/chunks/build/{checkbox-Dv1kjaUZ.mjs → checkbox-C1gABOca.mjs} +5 -5
- package/.output/server/chunks/build/{checkbox-Dv1kjaUZ.mjs.map → checkbox-C1gABOca.mjs.map} +1 -1
- package/.output/server/chunks/build/{daq-B-3xCp_2.mjs → daq-ChYCABz1.mjs} +312 -426
- package/.output/server/chunks/build/daq-ChYCABz1.mjs.map +1 -0
- package/.output/server/chunks/build/{dcw-BL2dhuz7.mjs → dcw-CcQNGggh.mjs} +3 -3
- package/.output/server/chunks/build/{dcw-BL2dhuz7.mjs.map → dcw-CcQNGggh.mjs.map} +1 -1
- package/.output/server/chunks/build/{default-DdV642BY.mjs → default-95-zOTPt.mjs} +3 -4
- package/.output/server/chunks/build/{default-DdV642BY.mjs.map → default-95-zOTPt.mjs.map} +1 -1
- package/.output/server/chunks/build/dropdown-vhn1NPFs.mjs +1 -1
- package/.output/server/chunks/build/{input-number-CZ3ZrCsy.mjs → input-number-Bd55elNN.mjs} +3 -3
- package/.output/server/chunks/build/{input-number-CZ3ZrCsy.mjs.map → input-number-Bd55elNN.mjs.map} +1 -1
- package/.output/server/chunks/build/{input-DxDqeyQW.mjs → input-sf_BT6o6.mjs} +553 -5
- package/.output/server/chunks/build/input-sf_BT6o6.mjs.map +1 -0
- package/.output/server/chunks/build/{logs-Dto_umFY.mjs → logs-D-2UyGtE.mjs} +3 -3
- package/.output/server/chunks/build/{logs-Dto_umFY.mjs.map → logs-D-2UyGtE.mjs.map} +1 -1
- package/.output/server/chunks/build/menu-WCrlpYVh.mjs +2 -2
- package/.output/server/chunks/build/modal-yvUquPj5.mjs +2 -2
- package/.output/server/chunks/build/{monitor-miqq9xHB.mjs → monitor-mfG5jBtz.mjs} +70 -192
- package/.output/server/chunks/build/monitor-mfG5jBtz.mjs.map +1 -0
- package/.output/server/chunks/build/{pages-D9tOoJsf.mjs → pages-Dfosfchr.mjs} +5 -6
- package/.output/server/chunks/build/pages-Dfosfchr.mjs.map +1 -0
- package/.output/server/chunks/build/{permissions-CxEgXic0.mjs → permissions-B-hhZuzm.mjs} +288 -194
- package/.output/server/chunks/build/permissions-B-hhZuzm.mjs.map +1 -0
- package/.output/server/chunks/build/{plugins-wLIKHcIE.mjs → plugins-DZR0T4Mh.mjs} +17 -17
- package/.output/server/chunks/build/{plugins-wLIKHcIE.mjs.map → plugins-DZR0T4Mh.mjs.map} +1 -1
- package/.output/server/chunks/build/popconfirm-CRaHcz5O.mjs +1 -1
- package/.output/server/chunks/build/{segmented-ChmQZwz6.mjs → segmented-LPPREMtZ.mjs} +336 -5
- package/.output/server/chunks/build/{segmented-ChmQZwz6.mjs.map → segmented-LPPREMtZ.mjs.map} +1 -1
- package/.output/server/chunks/build/{settings-BPBll_7K.mjs → settings-BajN9TQW.mjs} +254 -27
- package/.output/server/chunks/build/settings-BajN9TQW.mjs.map +1 -0
- package/.output/server/chunks/build/space-CCBYAkXt.mjs +1 -1
- package/.output/server/chunks/build/switch-CelRXpcy.mjs +1 -1
- package/.output/server/chunks/build/{table-BtksyDlQ.mjs → table-Bf1r2JjE.mjs} +5 -5
- package/.output/server/chunks/build/{table-BtksyDlQ.mjs.map → table-Bf1r2JjE.mjs.map} +1 -1
- package/.output/server/chunks/build/{tabs-DQv-_-R6.mjs → tabs-BM3tAh_J.mjs} +2 -2
- package/.output/server/chunks/build/{tabs-DQv-_-R6.mjs.map → tabs-BM3tAh_J.mjs.map} +1 -1
- package/.output/server/chunks/build/{tag-A0tZ2Ouq.mjs → tag-NO9jEqKy.mjs} +3 -3
- package/.output/server/chunks/build/{tag-A0tZ2Ouq.mjs.map → tag-NO9jEqKy.mjs.map} +1 -1
- package/.output/server/chunks/build/{teams-DD8ZXTKL.mjs → teams-t2SkRlJP.mjs} +349 -51
- package/.output/server/chunks/build/teams-t2SkRlJP.mjs.map +1 -0
- package/.output/server/chunks/build/{tokens-Dxnuw96_.mjs → tokens-DiCojbN8.mjs} +296 -200
- package/.output/server/chunks/build/tokens-DiCojbN8.mjs.map +1 -0
- package/.output/server/chunks/build/{town-Dsh0jlwZ.mjs → town-C7QM8DYK.mjs} +5 -5
- package/.output/server/chunks/build/{town-Dsh0jlwZ.mjs.map → town-C7QM8DYK.mjs.map} +1 -1
- package/.output/server/chunks/build/{useDaqStream-DkRL3tEW.mjs → useDaqStream-BeA2X8KR.mjs} +26 -11
- package/.output/server/chunks/build/useDaqStream-BeA2X8KR.mjs.map +1 -0
- package/.output/server/chunks/build/{useDcwStream-DyB2ufQI.mjs → useDcwStream-BJW_MitY.mjs} +14 -6
- package/.output/server/chunks/build/useDcwStream-BJW_MitY.mjs.map +1 -0
- package/.output/server/chunks/build/{useDeviceTwins-ZbT86L9O.mjs → useDeviceTwins-Dwz_EY_i.mjs} +2 -2
- package/.output/server/chunks/build/{useDeviceTwins-ZbT86L9O.mjs.map → useDeviceTwins-Dwz_EY_i.mjs.map} +1 -1
- package/.output/server/chunks/build/{useOpsLog-8HCYFb6n.mjs → useOpsLog-Dm8QEb1I.mjs} +2 -2
- package/.output/server/chunks/build/{useOpsLog-8HCYFb6n.mjs.map → useOpsLog-Dm8QEb1I.mjs.map} +1 -1
- package/.output/server/chunks/build/{useWorkshopApi-D2gq06N2.mjs → useWorkshopApi-B-L3MmIX.mjs} +9 -2
- package/.output/server/chunks/build/{useWorkshopApi-D2gq06N2.mjs.map → useWorkshopApi-B-L3MmIX.mjs.map} +1 -1
- package/.output/server/chunks/build/{users-D6RNylrW.mjs → users-B9SAdEtH.mjs} +12 -13
- package/.output/server/chunks/build/users-B9SAdEtH.mjs.map +1 -0
- package/.output/server/chunks/build/{workshop-CTcYDq2i.mjs → workshop-81xhz368.mjs} +21 -22
- package/.output/server/chunks/build/workshop-81xhz368.mjs.map +1 -0
- package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs +14 -2
- package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +40 -0
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs +21 -9
- package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index5.get.mjs +33 -0
- package/.output/server/chunks/routes/api/workshop/channels/_id/index5.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +15 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index5.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index6.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +1 -1
- package/.output/server/chunks/routes/renderer.mjs +3 -3
- package/.output/server/chunks/virtual/entry.mjs +381 -438
- package/.output/server/chunks/virtual/entry.mjs.map +1 -1
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/app/app.vue +7 -0
- package/app/assets/css/main.css +12 -1
- package/app/components/workshop/DaqNodeRow.vue +398 -0
- package/app/components/workshop/town/ModelPreview3D.vue +26 -4
- package/app/components/workshop/town/TownScene3D.ts +60 -12
- package/app/components/workshop/town/TownView.vue +4 -3
- package/app/composables/workshop/useCharacterAssets.ts +1 -0
- package/app/composables/workshop/useDaqStream.ts +24 -5
- package/app/composables/workshop/useDcwStream.ts +13 -4
- package/app/composables/workshop/useWorkshopApi.ts +294 -259
- package/app/pages/daq/[id].vue +27 -3
- package/app/pages/daq/index.vue +8 -355
- package/app/pages/monitor.vue +56 -68
- package/app/pages/permissions/index.vue +86 -82
- package/app/pages/plugins/index.vue +12 -7
- package/app/pages/settings.vue +253 -2
- package/app/pages/tokens.vue +94 -96
- package/app/pages/users.vue +10 -18
- package/app/pages/workshop/index.vue +34 -5
- package/app/pages/workshop/teams.vue +212 -2
- package/i18n/dicts/_en.json +361 -1
- package/i18n/dicts/plugins.json +10 -0
- package/i18n/dicts/settings.json +1 -0
- package/i18n/dicts/teamPlugins.json +10 -0
- package/i18n/locales/en.ts +1861 -1901
- package/i18n/locales/zh-CN.ts +1789 -1830
- package/package.json +149 -148
- package/public/assets/game/character/yangyang-walk.glb +0 -0
- package/scripts/_dbg-cpu-profile.mjs +53 -0
- package/scripts/_dbg-logs-ui-e2e.py +3 -2
- package/scripts/_dbg-render-perf.mjs +142 -0
- package/scripts/_dbg-render-regression.mjs +130 -0
- package/scripts/_dbg-ui-survey.py +52 -0
- package/scripts/i18n-merge.mjs +152 -30
- package/scripts/production-closed-loop-e2e.mjs +254 -0
- package/scripts/team-plugins-api-smoke.mjs +149 -0
- package/scripts/three-system-e2e.mjs +448 -0
- package/server/api/plugins/[name]/[...path].ts +46 -31
- package/server/api/workshop/channels/[id]/plugins/index.get.ts +35 -0
- package/server/api/workshop/channels/[id]/plugins/index.put.ts +39 -0
- package/server/api/workshop/channels.post.ts +17 -0
- package/server/data/dcw-lines.json +14 -0
- package/server/data/dcw-products.json +14 -0
- package/server/data/dcw-recipes.json +23 -1
- package/server/data/dcw-rollback.json +585 -10
- package/server/data/dcw-runs.json +27 -27
- package/server/data/dcw-writes.json +96 -0
- package/server/data/dcws.json +394 -366
- package/server/data/scene-layouts.json +66 -0
- package/server/plugins/aw-plugins.ts +35 -27
- package/server/plugins-builtin/diag-bridge/index.mjs +556 -0
- package/server/plugins-builtin/rag-bridge/index.mjs +364 -0
- package/server/services/workshop/agents/host-tool-bridge.ts +659 -642
- package/server/services/workshop/agents/omp-agent.ts +1178 -1178
- package/server/services/workshop/agents/plugin-tools.ts +10 -1
- package/server/services/workshop/db/channel-plugins.repo.ts +65 -0
- package/server/services/workshop/plugins/host.mjs +52 -4
- package/server/services/workshop/runtime/manager.ts +2976 -2968
- package/shared/config/schema.json +4 -0
- package/.output/public/_nuxt/BJbhwS5o.js +0 -1
- package/.output/public/_nuxt/BUcmySDa2.js +0 -209
- package/.output/public/_nuxt/BWC4HQHQ.js +0 -1
- package/.output/public/_nuxt/BbZAzXjZ2.js +0 -1
- package/.output/public/_nuxt/BgOhoDTI.js +0 -1
- package/.output/public/_nuxt/Bo8t5fkJ.js +0 -1
- package/.output/public/_nuxt/BuiGDfMB.js +0 -1
- package/.output/public/_nuxt/BxPPAkGA.js +0 -3
- package/.output/public/_nuxt/C53drffV.js +0 -1
- package/.output/public/_nuxt/CcwJ2mrD2.js +0 -1
- package/.output/public/_nuxt/Cr9DkD1d.js +0 -1
- package/.output/public/_nuxt/DTYBfjRY.js +0 -1
- package/.output/public/_nuxt/DVoWWlUW.js +0 -1
- package/.output/public/_nuxt/Dc32T41C.js +0 -1
- package/.output/public/_nuxt/Dhqra7NB.js +0 -1
- package/.output/public/_nuxt/DlRO_q5L.js +0 -1
- package/.output/public/_nuxt/DsUUYP292.js +0 -1
- package/.output/public/_nuxt/Dsdy4Ua-.js +0 -1
- package/.output/public/_nuxt/DtzZqC0z.js +0 -1
- package/.output/public/_nuxt/Ko9mMsJj.js +0 -14
- package/.output/public/_nuxt/RzXYI9FM.js +0 -23
- package/.output/public/_nuxt/UtviM1bg.js +0 -1
- package/.output/public/_nuxt/_id_.C-YXjn8Q.css +0 -1
- package/.output/public/_nuxt/bAFueD6a.js +0 -1
- package/.output/public/_nuxt/builds/meta/1adc96e0-8bbd-4a79-ac7e-b6952556fef8.json +0 -1
- package/.output/public/_nuxt/daq.3OKj58HH.css +0 -1
- package/.output/public/_nuxt/dbi5bHkY.js +0 -2
- package/.output/public/_nuxt/eHYnGew0.js +0 -19
- package/.output/public/_nuxt/entry.OR_psZHp.css +0 -1
- package/.output/public/_nuxt/jyQyulh-.js +0 -1
- package/.output/public/_nuxt/monitor.CmwpEUCI.css +0 -1
- package/.output/public/_nuxt/permissions.DTRtZeTw.css +0 -1
- package/.output/public/_nuxt/plugins.BcSEwwGb.css +0 -1
- package/.output/public/_nuxt/settings.BqMF2nfj.css +0 -1
- package/.output/public/_nuxt/teams.DN0pAGGu.css +0 -1
- package/.output/public/_nuxt/tokens.BVXU1jOK.css +0 -1
- package/.output/public/_nuxt/users.D8lcLE62.css +0 -1
- package/.output/public/_nuxt/workshop.CbymC2LY.css +0 -1
- package/.output/public/_nuxt/zVkqCZ78.js +0 -1
- package/.output/server/chunks/build/Col-biaNnEPf.mjs +0 -338
- package/.output/server/chunks/build/Col-biaNnEPf.mjs.map +0 -1
- package/.output/server/chunks/build/agents--6bzGtES.mjs.map +0 -1
- package/.output/server/chunks/build/channel-templates-C1Bb-U75.mjs.map +0 -1
- package/.output/server/chunks/build/daq-B-3xCp_2.mjs.map +0 -1
- package/.output/server/chunks/build/hasIn-vQ9LWt-J.mjs +0 -554
- package/.output/server/chunks/build/hasIn-vQ9LWt-J.mjs.map +0 -1
- package/.output/server/chunks/build/input-DxDqeyQW.mjs.map +0 -1
- package/.output/server/chunks/build/monitor-miqq9xHB.mjs.map +0 -1
- package/.output/server/chunks/build/pages-D9tOoJsf.mjs.map +0 -1
- package/.output/server/chunks/build/permissions-CxEgXic0.mjs.map +0 -1
- package/.output/server/chunks/build/settings-BPBll_7K.mjs.map +0 -1
- package/.output/server/chunks/build/teams-DD8ZXTKL.mjs.map +0 -1
- package/.output/server/chunks/build/tokens-Dxnuw96_.mjs.map +0 -1
- package/.output/server/chunks/build/useDaqStream-DkRL3tEW.mjs.map +0 -1
- package/.output/server/chunks/build/useDcwStream-DyB2ufQI.mjs.map +0 -1
- package/.output/server/chunks/build/useSiteConfig-DJe_KMVr.mjs +0 -27
- package/.output/server/chunks/build/useSiteConfig-DJe_KMVr.mjs.map +0 -1
- package/.output/server/chunks/build/users-D6RNylrW.mjs.map +0 -1
- package/.output/server/chunks/build/workshop-CTcYDq2i.mjs.map +0 -1
- /package/.output/public/_nuxt/{CNs_Ozdc.js → CNs_Ozdc2.js} +0 -0
- /package/.output/public/_nuxt/{Cno6kYiO.js → Cno6kYiO2.js} +0 -0
- /package/.output/public/_nuxt/{ORt9oDIy2.js → ORt9oDIy.js} +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import{t as e}from"./BBrRELH32.js";import{n as t,t as n}from"./CWKEp1wx2.js";import{$ as r,A as i,B as a,C as o,Ct as s,D as c,E as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,P as b,Q as x,R as S,S as ee,St as C,T as w,U as te,V as ne,W as T,X as re,Y as E,Z as ie,_ as ae,_t as oe,a as D,at as se,b as ce,bt as O,ct as k,d as A,dt as le,et as ue,f as de,ft as j,g as fe,gt as pe,h as me,ht as M,i as N,it as P,j as he,k as F,l as ge,lt as I,m as L,mt as _e,n as R,nt as ve,o as ye,ot as be,p as xe,pt as Se,q as z,r as B,rt as Ce,s as we,st as Te,t as Ee,tt as De,u as V,v as Oe,vt as ke,w as H,x as Ae,xt as U,y as je,yt as W,z as Me}from"./BFjGV-RV2.js";var G=new be,K=new C,q=new C,J=new P,Ne={X:new C(1,0,0),Y:new C(0,1,0),Z:new C(0,0,1)},Pe={type:`change`},Fe={type:`mouseDown`,mode:null},Ie={type:`mouseUp`,mode:null},Le={type:`objectChange`},Re=class extends he{constructor(e,t=null){super(void 0,t);let n=new nt(this);this._root=n;let r=new rt;this._gizmo=r,n.add(r);let i=new it;this._plane=i,n.add(i);let a=this;function o(e,t){let n=t;Object.defineProperty(a,e,{get:function(){return n===void 0?t:n},set:function(t){n!==t&&(n=t,i[e]=t,r[e]=t,a.dispatchEvent({type:e+`-changed`,value:t}),a.dispatchEvent(Pe))}}),a[e]=t,i[e]=t,r[e]=t}o(`camera`,e),o(`object`,void 0),o(`enabled`,!0),o(`axis`,null),o(`mode`,`translate`),o(`translationSnap`,null),o(`rotationSnap`,null),o(`scaleSnap`,null),o(`space`,`world`),o(`size`,1),this.viewport=null,o(`dragging`,!1),o(`showX`,!0),o(`showY`,!0),o(`showZ`,!0),o(`showXY`,!0),o(`showYZ`,!0),o(`showXZ`,!0),o(`showXYZE`,!0),o(`showE`,!0),o(`minX`,-1/0),o(`maxX`,1/0),o(`minY`,-1/0),o(`maxY`,1/0),o(`minZ`,-1/0),o(`maxZ`,1/0);let s=new C,c=new C,l=new P,u=new P,d=new C,f=new P,p=new C,m=new C,h=new C,g=new C;o(`worldPosition`,s),o(`worldPositionStart`,c),o(`worldQuaternion`,l),o(`worldQuaternionStart`,u),o(`cameraPosition`,d),o(`cameraQuaternion`,f),o(`pointStart`,p),o(`pointEnd`,m),o(`rotationAxis`,h),o(`rotationAngle`,0),o(`eye`,g),this._offset=new C,this._startNorm=new C,this._endNorm=new C,this._cameraScale=new C,this._parentPosition=new C,this._parentQuaternion=new P,this._parentQuaternionInv=new P,this._parentScale=new C,this._worldScaleStart=new C,this._worldQuaternionInv=new P,this._worldScale=new C,this._positionStart=new C,this._quaternionStart=new P,this._scaleStart=new C,this._getPointer=ze.bind(this),this._onPointerDown=Ve.bind(this),this._onPointerHover=Be.bind(this),this._onPointerMove=He.bind(this),this._onPointerUp=Ue.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointermove`,this._onPointerHover),this.domElement.addEventListener(`pointerup`,this._onPointerUp),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointermove`,this._onPointerHover),this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerup`,this._onPointerUp),this.domElement.style.touchAction=``}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&G.setFromCamera(e,this.camera);let t=We(this._gizmo.picker[this.mode],G);this.axis=t?t.object.name:null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&G.setFromCamera(e,this.camera);let t=We(this._plane,G,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Fe.mode=this.mode,this.dispatchEvent(Fe)}}pointerMove(e){let t=this.axis,n=this.mode,r=this.object,i=this.space;if(n===`scale`?i=`local`:(t===`E`||t===`XYZE`||t===`XYZ`)&&(i=`world`),r===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&G.setFromCamera(e,this.camera);let a=We(this._plane,G,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),n===`translate`)this._offset.copy(this.pointEnd).sub(this.pointStart),i===`local`&&t!==`XYZ`&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf(`X`)===-1&&(this._offset.x=0),t.indexOf(`Y`)===-1&&(this._offset.y=0),t.indexOf(`Z`)===-1&&(this._offset.z=0),i===`local`&&t!==`XYZ`?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(i===`local`&&(r.position.applyQuaternion(J.copy(this._quaternionStart).invert()),t.search(`X`)!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search(`Y`)!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search(`Z`)!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),i===`world`&&(r.getWorldPosition(K),t.search(`X`)!==-1&&(K.x=Math.round(K.x/this.translationSnap)*this.translationSnap),t.search(`Y`)!==-1&&(K.y=Math.round(K.y/this.translationSnap)*this.translationSnap),t.search(`Z`)!==-1&&(K.z=Math.round(K.z/this.translationSnap)*this.translationSnap),r.position.copy(r.parent.worldToLocal(K)))),r.position.x=Math.max(this.minX,Math.min(this.maxX,r.position.x)),r.position.y=Math.max(this.minY,Math.min(this.maxY,r.position.y)),r.position.z=Math.max(this.minZ,Math.min(this.maxZ,r.position.z));else if(n===`scale`){if(t.search(`XYZ`)!==-1){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),q.set(e,e,e)}else K.copy(this.pointStart),q.copy(this.pointEnd),K.applyQuaternion(this._worldQuaternionInv),q.applyQuaternion(this._worldQuaternionInv),q.divide(K),t.search(`X`)===-1&&(q.x=1),t.search(`Y`)===-1&&(q.y=1),t.search(`Z`)===-1&&(q.z=1);r.scale.copy(this._scaleStart).multiply(q),this.scaleSnap&&(t.search(`X`)!==-1&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search(`Y`)!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search(`Z`)!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n===`rotate`){this._offset.copy(this.pointEnd).sub(this.pointStart);let e=20/this.worldPosition.distanceTo(K.setFromMatrixPosition(this.camera.matrixWorld)),n=!1;t===`XYZE`?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(K.copy(this.rotationAxis).cross(this.eye))*e):(t===`X`||t===`Y`||t===`Z`)&&(this.rotationAxis.copy(Ne[t]),K.copy(Ne[t]),i===`local`&&K.applyQuaternion(this.worldQuaternion),K.cross(this.eye),K.length()===0?n=!0:this.rotationAngle=this._offset.dot(K.normalize())*e),(t===`E`||n)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i===`local`&&t!==`E`&&t!==`XYZE`?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(J.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(J.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Pe),this.dispatchEvent(Le)}}pointerUp(e){(e===null||e.button===0)&&(this.dragging&&this.axis!==null&&(Ie.mode=this.mode,this.dispatchEvent(Ie)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Pe),this.dispatchEvent(Le),this.pointStart.copy(this.pointEnd))}getRaycaster(){return G}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}setColors(e,t,n,r){let i=this._gizmo.materialLib;i.xAxis.color.set(e),i.yAxis.color.set(t),i.zAxis.color.set(n),i.active.color.set(r),i.xAxisTransparent.color.set(e),i.yAxisTransparent.color.set(t),i.zAxisTransparent.color.set(n),i.activeTransparent.color.set(r),i.xAxis._color&&i.xAxis._color.set(e),i.yAxis._color&&i.yAxis._color.set(t),i.zAxis._color&&i.zAxis._color.set(n),i.active._color&&i.active._color.set(r),i.xAxisTransparent._color&&i.xAxisTransparent._color.set(e),i.yAxisTransparent._color&&i.yAxisTransparent._color.set(t),i.zAxisTransparent._color&&i.zAxisTransparent._color.set(n),i.activeTransparent._color&&i.activeTransparent._color.set(r)}};function ze(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{let t=this.domElement.getBoundingClientRect(),n=this.viewport,r,i,a,o;return n===null?(r=0,i=0,a=t.width,o=t.height):(r=n.x,i=t.height-n.y-n.w,a=n.z,o=n.w),{x:(e.clientX-t.left-r)/a*2-1,y:-(e.clientY-t.top-i)/o*2+1,button:e.button}}}function Be(e){if(this.enabled)switch(e.pointerType){case`mouse`:case`pen`:this.pointerHover(this._getPointer(e))}}function Ve(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function He(e){this.enabled&&this.pointerMove(this._getPointer(e))}function Ue(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.pointerUp(this._getPointer(e)))}function We(e,t,n){let r=t.intersectObject(e,!0);for(let e=0;e<r.length;e++)if(r[e].object.visible||n)return r[e];return!1}var Ge=new b,Y=new C(0,1,0),Ke=new C(0,0,0),qe=new d,Je=new P,Ye=new P,X=new C,Xe=new d,Ze=new C(1,0,0),Z=new C(0,1,0),Qe=new C(0,0,1),$e=new C,et=new C,tt=new C,nt=class extends re{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){let t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error(`TransformControls: The attached 3D object must be a part of the scene graph.`):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),this.parent&&(Xe.copy(this.parent.matrixWorld).invert(),Xe.decompose(this.position,this.quaternion,this.scale)),super.updateMatrixWorld(e)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}},rt=class extends re{constructor(){super(),this.isTransformControlsGizmo=!0,this.type=`TransformControlsGizmo`;let e=new z({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new ne({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=e.clone();n.opacity=.15;let r=t.clone();r.opacity=.5;let i=e.clone();i.color.setHex(16711680);let o=e.clone();o.color.setHex(65280);let s=e.clone();s.color.setHex(255);let c=e.clone();c.color.setHex(16711680),c.opacity=.5;let l=e.clone();l.color.setHex(65280),l.opacity=.5;let d=e.clone();d.color.setHex(255),d.opacity=.5;let f=e.clone();f.opacity=.25;let p=e.clone();p.color.setHex(16776960),p.opacity=.25;let m=e.clone();m.color.setHex(16776960);let g=e.clone();g.color.setHex(7895160),this.materialLib={xAxis:i,yAxis:o,zAxis:s,active:m,xAxisTransparent:c,yAxisTransparent:l,zAxisTransparent:d,activeTransparent:p};let v=new _(0,.04,.1,12);v.translate(0,.05,0);let y=new H(.08,.08,.08);y.translate(0,.04,0);let b=new w;b.setAttribute(`position`,new u([0,0,0,1,0,0],3));let x=new _(.0075,.0075,.5,3);x.translate(0,.25,0);function S(e,t){let n=new W(e,.0075,3,64,t*Math.PI*2);return n.rotateY(Math.PI/2),n.rotateX(Math.PI/2),n}function ee(){let e=new w;return e.setAttribute(`position`,new u([0,0,0,1,1,1],3)),e}let C={X:[[new h(v,i),[.5,0,0],[0,0,-Math.PI/2]],[new h(v,i),[-.5,0,0],[0,0,Math.PI/2]],[new h(x,i),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new h(v,o),[0,.5,0]],[new h(v,o),[0,-.5,0],[Math.PI,0,0]],[new h(x,o)]],Z:[[new h(v,s),[0,0,.5],[Math.PI/2,0,0]],[new h(v,s),[0,0,-.5],[-Math.PI/2,0,0]],[new h(x,s),null,[Math.PI/2,0,0]]],XYZ:[[new h(new ie(.1,0),f),[0,0,0]]],XY:[[new h(new H(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new h(new H(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h(new H(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]]},te={X:[[new h(new _(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new h(new _(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new h(new _(.2,0,.6,4),n),[0,.3,0]],[new h(new _(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new h(new _(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new h(new _(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new h(new ie(.2,0),n)]],XY:[[new h(new H(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new h(new H(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h(new H(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]]},T={START:[[new h(new ie(.01,2),r),null,null,null,`helper`]],END:[[new h(new ie(.01,2),r),null,null,null,`helper`]],DELTA:[[new a(ee(),r),null,null,null,`helper`]],X:[[new a(b,r),[-1e3,0,0],null,[1e6,1,1],`helper`]],Y:[[new a(b,r),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],`helper`]],Z:[[new a(b,r),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],`helper`]]},E={XYZE:[[new h(S(.5,1),g),null,[0,Math.PI/2,0]]],X:[[new h(S(.5,.5),i)]],Y:[[new h(S(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new h(S(.5,.5),s),null,[0,Math.PI/2,0]]],E:[[new h(S(.75,1),p),null,[0,Math.PI/2,0]]]},ae={AXIS:[[new a(b,r),[-1e3,0,0],null,[1e6,1,1],`helper`]]},oe={XYZE:[[new h(new M(.25,10,8),n)]],X:[[new h(new W(.5,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new h(new W(.5,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new h(new W(.5,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new h(new W(.75,.1,2,24),n)]]},D={X:[[new h(y,i),[.5,0,0],[0,0,-Math.PI/2]],[new h(x,i),[0,0,0],[0,0,-Math.PI/2]],[new h(y,i),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new h(y,o),[0,.5,0]],[new h(x,o)],[new h(y,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new h(y,s),[0,0,.5],[Math.PI/2,0,0]],[new h(x,s),[0,0,0],[Math.PI/2,0,0]],[new h(y,s),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new h(new H(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new h(new H(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h(new H(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new h(new H(.1,.1,.1),f)]]},se={X:[[new h(new _(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new h(new _(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new h(new _(.2,0,.6,4),n),[0,.3,0]],[new h(new _(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new h(new _(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new h(new _(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new h(new H(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new h(new H(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h(new H(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new h(new H(.2,.2,.2),n),[0,0,0]]]},ce={X:[[new a(b,r),[-1e3,0,0],null,[1e6,1,1],`helper`]],Y:[[new a(b,r),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],`helper`]],Z:[[new a(b,r),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],`helper`]]};function O(e){let t=new re;for(let n in e)for(let r=e[n].length;r--;){let i=e[n][r][0].clone(),a=e[n][r][1],o=e[n][r][2],s=e[n][r][3],c=e[n][r][4];i.name=n,i.tag=c,a&&i.position.set(a[0],a[1],a[2]),o&&i.rotation.set(o[0],o[1],o[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix();let l=i.geometry.clone();l.applyMatrix4(i.matrix),i.geometry=l,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),t.add(i)}return t}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=O(C)),this.add(this.gizmo.rotate=O(E)),this.add(this.gizmo.scale=O(D)),this.add(this.picker.translate=O(te)),this.add(this.picker.rotate=O(oe)),this.add(this.picker.scale=O(se)),this.add(this.helper.translate=O(T)),this.add(this.helper.rotate=O(ae)),this.add(this.helper.scale=O(ce)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){let t=(this.mode===`scale`?`local`:this.space)===`local`?this.worldQuaternion:Ye;this.gizmo.translate.visible=this.mode===`translate`,this.gizmo.rotate.visible=this.mode===`rotate`,this.gizmo.scale.visible=this.mode===`scale`,this.helper.translate.visible=this.mode===`translate`,this.helper.rotate.visible=this.mode===`rotate`,this.helper.scale.visible=this.mode===`scale`;let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let e=0;e<n.length;e++){let r=n[e];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let i;if(i=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(i*this.size/4),r.tag===`helper`){r.visible=!1,r.name===`AXIS`?(r.visible=!!this.axis,this.axis===`X`&&(J.setFromEuler(Ge.set(0,0,0)),r.quaternion.copy(t).multiply(J),Math.abs(Y.copy(Ze).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`Y`&&(J.setFromEuler(Ge.set(0,0,Math.PI/2)),r.quaternion.copy(t).multiply(J),Math.abs(Y.copy(Z).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`Z`&&(J.setFromEuler(Ge.set(0,Math.PI/2,0)),r.quaternion.copy(t).multiply(J),Math.abs(Y.copy(Qe).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`XYZE`&&(J.setFromEuler(Ge.set(0,Math.PI/2,0)),Y.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(qe.lookAt(Ke,Y,Z)),r.quaternion.multiply(J),r.visible=this.dragging),this.axis===`E`&&(r.visible=!1)):r.name===`START`?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name===`END`?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name===`DELTA`?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),K.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),K.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(K),r.visible=this.dragging):(r.quaternion.copy(t),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}if(r.quaternion.copy(t),this.mode===`translate`||this.mode===`scale`){let e=.99,n=.2;r.name===`X`&&Math.abs(Y.copy(Ze).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`Y`&&Math.abs(Y.copy(Z).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`Z`&&Math.abs(Y.copy(Qe).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`XY`&&Math.abs(Y.copy(Qe).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`YZ`&&Math.abs(Y.copy(Ze).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`XZ`&&Math.abs(Y.copy(Z).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)}else this.mode===`rotate`&&(Je.copy(t),Y.copy(this.eye).applyQuaternion(J.copy(t).invert()),r.name.search(`E`)!==-1&&r.quaternion.setFromRotationMatrix(qe.lookAt(this.eye,Ke,Z)),r.name===`X`&&(J.setFromAxisAngle(Ze,Math.atan2(-Y.y,Y.z)),J.multiplyQuaternions(Je,J),r.quaternion.copy(J)),r.name===`Y`&&(J.setFromAxisAngle(Z,Math.atan2(Y.x,Y.z)),J.multiplyQuaternions(Je,J),r.quaternion.copy(J)),r.name===`Z`&&(J.setFromAxisAngle(Qe,Math.atan2(Y.y,Y.x)),J.multiplyQuaternions(Je,J),r.quaternion.copy(J)));r.visible=r.visible&&(r.name.indexOf(`X`)===-1||this.showX),r.visible=r.visible&&(r.name.indexOf(`Y`)===-1||this.showY),r.visible=r.visible&&(r.name.indexOf(`Z`)===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf(`E`)===-1||this.showX&&this.showY&&this.showZ),r.visible=r.visible&&(r.name.indexOf(`XY`)===-1||this.showXY),r.visible=r.visible&&(r.name.indexOf(`YZ`)===-1||this.showYZ),r.visible=r.visible&&(r.name.indexOf(`XZ`)===-1||this.showXZ),r.visible=r.visible&&(r.name!==`E`||this.showE),r.visible=r.visible&&(r.name!==`XYZE`||this.showXYZE),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split(``).some(function(e){return r.name===e}))&&(r.material.color.copy(this.materialLib.active.color),r.material.opacity=1)}super.updateMatrixWorld(e)}},it=class extends h{constructor(){super(new ve(1e5,1e5,2,2),new z({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type=`TransformControlsPlane`}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode===`scale`&&(t=`local`),$e.copy(Ze).applyQuaternion(t===`local`?this.worldQuaternion:Ye),et.copy(Z).applyQuaternion(t===`local`?this.worldQuaternion:Ye),tt.copy(Qe).applyQuaternion(t===`local`?this.worldQuaternion:Ye),Y.copy(et),this.mode){case`translate`:case`scale`:switch(this.axis){case`X`:Y.copy(this.eye).cross($e),X.copy($e).cross(Y);break;case`Y`:Y.copy(this.eye).cross(et),X.copy(et).cross(Y);break;case`Z`:Y.copy(this.eye).cross(tt),X.copy(tt).cross(Y);break;case`XY`:X.copy(tt);break;case`YZ`:X.copy($e);break;case`XZ`:Y.copy(tt),X.copy(et);break;case`XYZ`:case`E`:X.set(0,0,0)}break;default:X.set(0,0,0)}X.length()===0?this.quaternion.copy(this.cameraQuaternion):(Xe.lookAt(K.set(0,0,0),X,Y),this.quaternion.setFromRotationMatrix(Xe)),super.updateMatrixWorld(e)}},at={name:`CopyShader`,uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
2
|
+
|
|
3
|
+
varying vec2 vUv;
|
|
4
|
+
|
|
5
|
+
void main() {
|
|
6
|
+
|
|
7
|
+
vUv = uv;
|
|
8
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
9
|
+
|
|
10
|
+
}`,fragmentShader:`
|
|
11
|
+
|
|
12
|
+
uniform float opacity;
|
|
13
|
+
|
|
14
|
+
uniform sampler2D tDiffuse;
|
|
15
|
+
|
|
16
|
+
varying vec2 vUv;
|
|
17
|
+
|
|
18
|
+
void main() {
|
|
19
|
+
|
|
20
|
+
vec4 texel = texture2D( tDiffuse, vUv );
|
|
21
|
+
gl_FragColor = opacity * texel;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
}`},Q=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error(`THREE.Pass: .render() must be implemented in derived pass.`)}dispose(){}},ot=new x(-1,1,1,-1,0,1),st=new class extends w{constructor(){super(),this.setAttribute(`position`,new u([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(`uv`,new u([0,2,0,0,2,0],2))}},ct=class{constructor(e){this._mesh=new h(st,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,ot)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},lt=class extends Q{constructor(e,t=`tDiffuse`){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof j?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=O.clone(e.uniforms),this.material=new j({name:e.name===void 0?`unspecified`:e.name,defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new ct(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}},ut=class extends Q{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),i=e.state;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),i.buffers.stencil.setClear(o),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.color.setMask(!0),i.buffers.depth.setMask(!0),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}},dt=class extends Q{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}},ft=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new U);this._width=n.width,this._height=n.height,t=new s(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:S}),t.texture.name=`EffectComposer.rt1`}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new lt(at),this.copyPass.material.blending=0,this.timer=new ke}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let t=0,r=this.passes.length;t<r;t++){let r=this.passes[t];if(r.enabled!==!1){if(r.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),r.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),r.needsSwap){if(n){let t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}ut!==void 0&&(r instanceof ut?n=!0:r instanceof dt&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new U);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}},pt=class extends Q{constructor(e,t,n=null,r=null,i=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=i,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new F}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let i,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(i=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==1&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(i),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}},mt={name:`LuminosityHighPassShader`,uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new F(0)},defaultOpacity:{value:0}},vertexShader:`
|
|
25
|
+
|
|
26
|
+
varying vec2 vUv;
|
|
27
|
+
|
|
28
|
+
void main() {
|
|
29
|
+
|
|
30
|
+
vUv = uv;
|
|
31
|
+
|
|
32
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
33
|
+
|
|
34
|
+
}`,fragmentShader:`
|
|
35
|
+
|
|
36
|
+
uniform sampler2D tDiffuse;
|
|
37
|
+
uniform vec3 defaultColor;
|
|
38
|
+
uniform float defaultOpacity;
|
|
39
|
+
uniform float luminosityThreshold;
|
|
40
|
+
uniform float smoothWidth;
|
|
41
|
+
|
|
42
|
+
varying vec2 vUv;
|
|
43
|
+
|
|
44
|
+
void main() {
|
|
45
|
+
|
|
46
|
+
vec4 texel = texture2D( tDiffuse, vUv );
|
|
47
|
+
|
|
48
|
+
float v = luminance( texel.xyz );
|
|
49
|
+
|
|
50
|
+
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
|
51
|
+
|
|
52
|
+
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
|
53
|
+
|
|
54
|
+
gl_FragColor = mix( outputColor, texel, alpha );
|
|
55
|
+
|
|
56
|
+
}`},ht=class e extends Q{constructor(e,t=1,n,r){super(),this.strength=t,this.radius=n,this.threshold=r,this.resolution=e===void 0?new U(256,256):new U(e.x,e.y),this.clearColor=new F(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new s(i,a,{type:S}),this.renderTargetBright.texture.name=`UnrealBloomPass.bright`,this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){let t=new s(i,a,{type:S});t.texture.name=`UnrealBloomPass.h`+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);let n=new s(i,a,{type:S});n.texture.name=`UnrealBloomPass.v`+e,n.texture.generateMipmaps=!1,this.renderTargetsVertical.push(n),i=Math.round(i/2),a=Math.round(a/2)}let o=mt;this.highPassUniforms=O.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new j({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];let c=[6,10,14,18,22];i=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(c[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new U(1/i,1/a),i=Math.round(i/2),a=Math.round(a/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;let l=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=l,this.bloomTintColors=[new C(1,1,1),new C(1,1,1),new C(1,1,1),new C(1,1,1),new C(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=O.clone(at.uniforms),this.blendMaterial=new j({uniforms:this.copyUniforms,vertexShader:at.vertexShader,fragmentShader:at.fragmentShader,premultipliedAlpha:!0,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new F,this._oldClearAlpha=1,this._basic=new z,this._fsQuad=new ct(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(n,r),this.renderTargetsVertical[e].setSize(n,r),this.separableBlurMaterials[e].uniforms.invSize.value=new U(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}render(t,n,r,i,a){t.getClearColor(this._oldClearColor),this._oldClearAlpha=t.getClearAlpha();let o=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),a&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this._fsQuad.material=this._basic,this._basic.map=r.texture,t.setRenderTarget(null),t.clear(),this._fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this._fsQuad.render(t);let s=this.renderTargetBright;for(let n=0;n<this.nMips;n++)this._fsQuad.material=this.separableBlurMaterials[n],this.separableBlurMaterials[n].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[n].uniforms.direction.value=e.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[n]),t.clear(),this._fsQuad.render(t),this.separableBlurMaterials[n].uniforms.colorTexture.value=this.renderTargetsHorizontal[n].texture,this.separableBlurMaterials[n].uniforms.direction.value=e.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[n]),t.clear(),this._fsQuad.render(t),s=this.renderTargetsVertical[n];this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this._fsQuad.render(t),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this._fsQuad.render(t)):(t.setRenderTarget(r),this._fsQuad.render(t)),t.setClearColor(this._oldClearColor,this._oldClearAlpha),t.autoClear=o}_getSeparableBlurMaterial(e){let t=[],n=e/3;for(let r=0;r<e;r++)t.push(.39894*Math.exp(-.5*r*r/(n*n))/n);return new j({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new U(.5,.5)},direction:{value:new U(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`
|
|
57
|
+
|
|
58
|
+
varying vec2 vUv;
|
|
59
|
+
|
|
60
|
+
void main() {
|
|
61
|
+
|
|
62
|
+
vUv = uv;
|
|
63
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
64
|
+
|
|
65
|
+
}`,fragmentShader:`
|
|
66
|
+
|
|
67
|
+
#include <common>
|
|
68
|
+
|
|
69
|
+
varying vec2 vUv;
|
|
70
|
+
|
|
71
|
+
uniform sampler2D colorTexture;
|
|
72
|
+
uniform vec2 invSize;
|
|
73
|
+
uniform vec2 direction;
|
|
74
|
+
uniform float gaussianCoefficients[KERNEL_RADIUS];
|
|
75
|
+
|
|
76
|
+
void main() {
|
|
77
|
+
|
|
78
|
+
float weightSum = gaussianCoefficients[0];
|
|
79
|
+
vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
|
|
80
|
+
|
|
81
|
+
for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
|
82
|
+
|
|
83
|
+
float x = float( i );
|
|
84
|
+
float w = gaussianCoefficients[i];
|
|
85
|
+
vec2 uvOffset = direction * invSize * x;
|
|
86
|
+
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
|
|
87
|
+
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
|
|
88
|
+
diffuseSum += ( sample1 + sample2 ) * w;
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
gl_FragColor = vec4( diffuseSum, 1.0 );
|
|
93
|
+
|
|
94
|
+
}`})}_getCompositeMaterial(e){return new j({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
|
|
95
|
+
|
|
96
|
+
varying vec2 vUv;
|
|
97
|
+
|
|
98
|
+
void main() {
|
|
99
|
+
|
|
100
|
+
vUv = uv;
|
|
101
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
102
|
+
|
|
103
|
+
}`,fragmentShader:`
|
|
104
|
+
|
|
105
|
+
varying vec2 vUv;
|
|
106
|
+
|
|
107
|
+
uniform sampler2D blurTexture1;
|
|
108
|
+
uniform sampler2D blurTexture2;
|
|
109
|
+
uniform sampler2D blurTexture3;
|
|
110
|
+
uniform sampler2D blurTexture4;
|
|
111
|
+
uniform sampler2D blurTexture5;
|
|
112
|
+
uniform float bloomStrength;
|
|
113
|
+
uniform float bloomRadius;
|
|
114
|
+
uniform float bloomFactors[NUM_MIPS];
|
|
115
|
+
uniform vec3 bloomTintColors[NUM_MIPS];
|
|
116
|
+
|
|
117
|
+
float lerpBloomFactor( const in float factor ) {
|
|
118
|
+
|
|
119
|
+
float mirrorFactor = 1.2 - factor;
|
|
120
|
+
return mix( factor, mirrorFactor, bloomRadius );
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
void main() {
|
|
125
|
+
|
|
126
|
+
// 3.0 for backwards compatibility with previous alpha-based intensity
|
|
127
|
+
vec3 bloom = 3.0 * bloomStrength * (
|
|
128
|
+
lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +
|
|
129
|
+
lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +
|
|
130
|
+
lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +
|
|
131
|
+
lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +
|
|
132
|
+
lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
|
|
136
|
+
gl_FragColor = vec4( bloom, bloomAlpha );
|
|
137
|
+
|
|
138
|
+
}`})}};ht.BlurDirectionX=new U(1,0),ht.BlurDirectionY=new U(0,1);var gt={name:`OutputShader`,uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
|
|
139
|
+
precision highp float;
|
|
140
|
+
|
|
141
|
+
uniform mat4 modelViewMatrix;
|
|
142
|
+
uniform mat4 projectionMatrix;
|
|
143
|
+
|
|
144
|
+
attribute vec3 position;
|
|
145
|
+
attribute vec2 uv;
|
|
146
|
+
|
|
147
|
+
varying vec2 vUv;
|
|
148
|
+
|
|
149
|
+
void main() {
|
|
150
|
+
|
|
151
|
+
vUv = uv;
|
|
152
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
153
|
+
|
|
154
|
+
}`,fragmentShader:`
|
|
155
|
+
|
|
156
|
+
precision highp float;
|
|
157
|
+
|
|
158
|
+
uniform sampler2D tDiffuse;
|
|
159
|
+
|
|
160
|
+
#include <tonemapping_pars_fragment>
|
|
161
|
+
#include <colorspace_pars_fragment>
|
|
162
|
+
|
|
163
|
+
varying vec2 vUv;
|
|
164
|
+
|
|
165
|
+
void main() {
|
|
166
|
+
|
|
167
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
168
|
+
|
|
169
|
+
// tone mapping
|
|
170
|
+
|
|
171
|
+
#ifdef LINEAR_TONE_MAPPING
|
|
172
|
+
|
|
173
|
+
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
174
|
+
|
|
175
|
+
#elif defined( REINHARD_TONE_MAPPING )
|
|
176
|
+
|
|
177
|
+
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
178
|
+
|
|
179
|
+
#elif defined( CINEON_TONE_MAPPING )
|
|
180
|
+
|
|
181
|
+
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
|
182
|
+
|
|
183
|
+
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
184
|
+
|
|
185
|
+
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
186
|
+
|
|
187
|
+
#elif defined( AGX_TONE_MAPPING )
|
|
188
|
+
|
|
189
|
+
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
190
|
+
|
|
191
|
+
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
192
|
+
|
|
193
|
+
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
194
|
+
|
|
195
|
+
#elif defined( CUSTOM_TONE_MAPPING )
|
|
196
|
+
|
|
197
|
+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
198
|
+
|
|
199
|
+
#endif
|
|
200
|
+
|
|
201
|
+
// color space
|
|
202
|
+
|
|
203
|
+
#ifdef SRGB_TRANSFER
|
|
204
|
+
|
|
205
|
+
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
206
|
+
|
|
207
|
+
#endif
|
|
208
|
+
|
|
209
|
+
}`},_t=class extends Q{constructor(){super(),this.isOutputPass=!0,this.uniforms=O.clone(gt.uniforms),this.material=new se({name:gt.name,uniforms:this.uniforms,vertexShader:gt.vertexShader,fragmentShader:gt.fragmentShader}),this._fsQuad=new ct(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},i.getTransfer(this._outputColorSpace)===`srgb`&&(this.material.defines.SRGB_TRANSFER=``),this._toneMapping===1?this.material.defines.LINEAR_TONE_MAPPING=``:this._toneMapping===2?this.material.defines.REINHARD_TONE_MAPPING=``:this._toneMapping===3?this.material.defines.CINEON_TONE_MAPPING=``:this._toneMapping===4?this.material.defines.ACES_FILMIC_TONE_MAPPING=``:this._toneMapping===6?this.material.defines.AGX_TONE_MAPPING=``:this._toneMapping===7?this.material.defines.NEUTRAL_TONE_MAPPING=``:this._toneMapping===5&&(this.material.defines.CUSTOM_TONE_MAPPING=``),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}},vt=class{channelId;name;x;z;radiusX;radiusZ;shape;rotationY;color;platform;padRing;beacon;boundary;label;members=[];host;constructor(e){Object.assign(this,e)}layout(){return{channelId:this.channelId,x:this.x,z:this.z,radiusX:this.radiusX,radiusZ:this.radiusZ,shape:this.shape,rotationY:this.rotationY}}normLayout(){return L(this.layout())}handlePoints(){return this.shape===`rect`?[[this.radiusX,this.radiusZ],[-this.radiusX,this.radiusZ],[-this.radiusX,-this.radiusZ],[this.radiusX,-this.radiusZ]]:[[this.radiusX,0],[-this.radiusX,0],[0,this.radiusZ],[0,-this.radiusZ]]}pointIn(e,t){return me(this.layout(),e,t)}moveBy(e,t){this.x+=e,this.z+=t,this.platform.position.set(this.x,.16,this.z),this.padRing.position.set(this.x,.32,this.z),this.beacon.position.set(this.x,0,this.z),this.boundary.position.set(this.x,.3,this.z),this.boundary.rotation.y=this.rotationY*Math.PI/180,this.label.position.set(this.x,30,this.z);for(let n of this.members)n.root.position.x+=e,n.root.position.z+=t,n.homeX+=e,n.homeZ+=t,n.range&&(n.range.x+=e,n.range.z+=t,n.renderRangeLine());this.host.trackLayout(this)}applyPatch(e){e.x!==void 0&&(this.x=e.x),e.z!==void 0&&(this.z=e.z),e.radiusX!==void 0&&(this.radiusX=e.radiusX),e.radiusZ!==void 0&&(this.radiusZ=e.radiusZ),e.shape!==void 0&&(this.shape=e.shape),e.rotationY!==void 0&&(this.rotationY=e.rotationY)}clampMembersAndRanges(){let e=this.layout();for(let t of this.members){let n=A(e,t.root.position.x,t.root.position.z,16);if(t.root.position.x=n.x,t.root.position.z=n.z,t.homeX=n.x,t.homeZ=n.z,t.range){t.renderRangeLine();let e=V(t.range,t.homeX,t.homeZ,0);(e.x!==t.homeX||e.z!==t.homeZ)&&(t.homeX=e.x,t.homeZ=e.z,t.root.position.x=e.x,t.root.position.z=e.z)}}this.host.markDirty()}};function $(e,t,n,r){let i=ye(e,t,n,48).map(([e,t])=>new C(e,0,t)),a=new w().setFromPoints(i);return new te(a,new ne({color:r,transparent:!0,opacity:.75,depthTest:!1}))}var yt=class{channelId;agentId;name;role;root;model;mixer;clips;colorNum;nameSprite;bubble;bubbleText;bubbleTimer;state;progress;behavior;dragging;homeX;homeZ;range;rangeLine;textureKey;modelRef;animState=`idle`;activeAction=null;host;moving=!1;aura=null;auraMats=[];auraPhase=0;attachAura(e,t){let n=new g,r=[],i=(t,i,a,o)=>{let s=new z({color:e,transparent:!0,opacity:o,side:2,depthWrite:!1,blending:2});s.userData.baseOp=o,r.push(s);let c=new h(new k(t,i,44),s);c.rotation.x=-Math.PI/2,c.position.y=a,n.add(c)};i(34,40,.36,.26),t===`lead`&&i(46,50,.42,.2),this.root.add(n),this.aura=n,this.auraMats=r,this.auraPhase=Math.random()*Math.PI*2}constructor(e){Object.assign(this,e)}reached(e){return Math.hypot(this.root.position.x-e.x,this.root.position.z-e.z)<=48}driveToward(e,n,r){this.moving=!0;let i={x:this.root.position.x,z:this.root.position.z},a=t({x:i.x,y:i.z},{x:e.x,y:e.z},n,r),o=a.x,s=a.y;if(this.range){let e=V(this.range,o,s,6);o=e.x,s=e.z}else{let e=this.host.blockLayoutOf(this.channelId);if(e){let t=A(e,o,s,6);o=t.x,s=t.z}}this.root.position.x=o,this.root.position.z=s;let c=a.dir===`left`?Math.PI:0,l=this.root.rotation.y,u=c-l;u>Math.PI?u-=Math.PI*2:u<-Math.PI&&(u+=Math.PI*2);let d=r*3.2;this.root.rotation.y=l+Math.max(-d,Math.min(d,u))}update(e){this.moving=!1;try{this.updateBehavior(e)}finally{this.playWalkAnim(this.moving)}}updateBehavior(e){let t=this.behavior;if(t.mode===`idle`||t.mode===`roam`){if(t.engaged||this.dragging)return;if(t.mode=`roam`,!t.roamTarget){if(performance.now()<t.pauseUntil)return;let e=this.host.blockLayoutOf(this.channelId),n,r;if(this.range){n=this.homeX+(Math.random()*2-1)*this.range.radiusX*.9,r=this.homeZ+(Math.random()*2-1)*this.range.radiusZ*.9;let e=V(this.range,n,r,8);n=e.x,r=e.z}else{let t=e?Math.min(e.radiusX,e.radiusZ)*.45:80;if(n=this.homeX+(Math.random()*2-1)*t,r=this.homeZ+(Math.random()*2-1)*t*.6,e){let t=A(e,n,r,16);n=t.x,r=t.z}}t.roamTarget={x:n,z:r}}this.driveToward(t.roamTarget,48,e),this.reached(t.roamTarget)&&(t.roamTarget=null,t.pauseUntil=performance.now()+350+Math.random()*900);return}if(t.mode===`approach`){let n=t.targetId?this.host.getAgent(t.targetId):void 0;if(!n){t.mode=`idle`;return}let r={x:n.root.position.x,z:n.root.position.z};if(this.range){let e=V(this.range,r.x,r.z,8);r={x:e.x,z:e.z}}this.driveToward(r,96,e),this.reached(r)&&(this.host.deliverBehavior(this,n),t.action?.requireReply?(t.mode=`wait`,t.waitUntil=performance.now()+Ee):(t.mode=`returnHome`,this.host.releaseEngaged(this),t.targetId=null));return}if(t.mode===`wait`){if(this.dragging)return;let n=t.targetId?this.host.getAgent(t.targetId):void 0;if(n&&!n.dragging){let t={x:n.root.position.x+28,z:n.root.position.z+8};this.driveToward(t,96*.6,e)}performance.now()>=t.waitUntil&&(t.mode=`returnHome`,this.host.releaseEngaged(this));return}if(t.mode===`returnHome`){if(this.dragging)return;let n={x:this.homeX,z:this.homeZ};this.driveToward(n,96*.7,e),this.reached(n)&&(this.root.position.set(this.homeX,0,this.homeZ),t.mode=`idle`,t.targetId=null,t.action=void 0)}}playWalkAnim(e){let t=e?`walk`:`idle`;this.animState!==t&&(this.animState=t,this.host.notifyMotion(this));let n=()=>{let t=performance.now(),n=1.2+Math.sin(t*.0016)*1.6,r=Math.abs(Math.sin(t*.005))*6;this.model.position.y=e?r:n;let i=e?Math.sin(t*.006)*.07:0;this.model.rotation.z+=(i-this.model.rotation.z)*.12};if(this.clips.length===0){n();return}if(!this.mixer)return;let r=e=>e.name.toLowerCase(),i=e?this.clips.find(e=>/walk|run|move/.test(r(e)))??this.clips[Math.min(1,this.clips.length-1)]:this.clips.find(e=>/idle|stand|breath/.test(r(e)))??(this.clips.length>1?this.clips[0]:null);if(!i){this.activeAction&&=(this.activeAction.fadeOut(.15),null),n();return}let a=this.mixer.clipAction(i);if(this.activeAction===a){a.timeScale=e?1.3:.9;return}a.reset().setEffectiveTimeScale(e?1.3:.9).fadeIn(.15).play(),this.activeAction&&this.activeAction.fadeOut(.15),this.activeAction=a}setHome(e,t){this.homeX=e,this.homeZ=t}renderRangeLine(){if(this.rangeLine&&=(this.host.threeScene.remove(this.rangeLine),null),!this.range)return;let e=4311284,t=$(this.range.shape,this.range.radiusX,this.range.radiusZ,e);t.material=new f({color:e,transparent:!0,opacity:.75,depthTest:!1,dashSize:14,gapSize:9}),t.computeLineDistances(),t.position.set(this.range.x,.5,this.range.z),t.rotation.y=this.range.rotationY*Math.PI/180,t.visible=this.host.rangeLineVisibleFor(this),this.host.threeScene.add(t),this.rangeLine=t,this.host.markDirty()}attachBubble(e,t){this.bubble&&(this.host.threeScene.remove(this.bubble),this.bubbleText=null),this.bubble=e,this.bubbleText=t}clearBubble(){this.bubble&&(this.host.threeScene.remove(this.bubble),this.bubble=null,this.bubbleText=null)}},bt=class{twinId;name;modelRef;root;holder;ring;arc=null;label;state;telemetry;host;constructor(e){Object.assign(this,e)}topYCache=null;lineColor=``;applyLine=null;updateRing(){let e=this.ring.material;this.lineColor?e.color.set(this.lineColor):e.color.setHex(this.state===`alarm`?16739179:this.state===`offline`?8689317:this.state===`running`?3530912:16172115),this.arc&&(this.arc.visible=this.state===`running`)}applyTwin(e){e.state&&(this.state=e.state),e.telemetry&&(this.telemetry={...this.telemetry,...e.telemetry}),e.name&&e.name!==this.name&&this.host.renameDeviceSprite(this,e.name),e.modelRef&&e.modelRef!==this.modelRef&&this.host.swapDeviceModelSprite(this,e.modelRef),(e.lineColor??``)!==this.lineColor&&(this.lineColor=e.lineColor??``,this.applyLine?.(this.lineColor)),this.updateRing(),this.host.markDirty()}rememberTransform(){return{posX:Math.round(this.root.position.x*10)/10,posZ:Math.round(this.root.position.z*10)/10,rotationY:Math.round(T.radToDeg(this.root.rotation.y)*10)/10}}},xt=class t{renderer;composer;camera;camTarget=new C(R,20,B);keyLight;scene;ground;skyDome=null;blocks=new Map;agents=new Map;deviceNodes=new Map;daqLedRings=new Map;daqLinkGroup=new g;daqLinks=[];static _wDir=new C;static _wRel=new C;static _wVec=new C;static _wVec2=new U;static _groundPlane=new De(new C(0,1,0),0);static _raycaster=new be;daqLinkSig=``;daqLinksWanted=[];filmWebGroup=new g;filmWebSig=``;filmWebMat=null;pendingDeviceTwins=new Map;pendingDeviceCreates=new Map;cancelledDeviceCreates=new Set;scalables=new Map;selected=null;modelsById=new Map;gltfCache=new Map;gltfLoader=new Oe;el;raf=0;clock=new y;frameCount=0;fpsAccum=0;fpsWinT0=0;rafCount=0;frameBudgetMs=25;setFpsCap(e){this.frameBudgetMs=e>0?1e3/e:0,this.frameAcc=0}frameAcc=0;baseDpr=Math.min(window.devicePixelRatio,2);dirty=!0;flagBy=new Map;disposed=!1;dolly=1;autoOrbit=!1;viewCur={yaw:0,pitch:.7,radius:1178};viewTarget={yaw:0,pitch:.7,radius:1178};tControls=null;resizeOb=null;mode=`browse`;pointerDrag=null;snapEnabled=!0;selRing=null;resizeHandles=[];agentRangeHandles=[];rangeDrawLine=null;rangeDrawAgent=null;rangeDrawPreviewState=null;rangeHomeMoved=null;lastActivity=null;recentActivity=[];dbgBubbles=[];receivers=new Map;container;resolveTaskAssignee=null;devices=null;agentApi=null;channelApi=null;busHandlers=new Map;constructor(e,t){this.el=t,this.container=t,this.initRenderer(),this.buildBlocks(e)}initRenderer(){this.renderer=new ce({antialias:!0,alpha:!0,powerPreference:`high-performance`}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.renderer.setSize(this.el.clientWidth||1100,this.el.clientHeight||700),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=2,this.renderer.shadowMap.autoUpdate=!1,this.renderer.outputColorSpace=I,this.renderer.toneMapping=4,this.renderer.toneMappingExposure=1.12,this.renderer.info.autoReset=!1,this.el.appendChild(this.renderer.domElement),this.resizeOb=new ResizeObserver(()=>{let e=this.el.clientWidth,t=this.el.clientHeight;e<2||t<2||(this.renderer.setSize(e,t),this.composer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.dirty=!0)}),this.resizeOb.observe(this.el);let e=null;this.renderer.domElement.addEventListener(`pointerdown`,t=>{e=t.button===0?{x:t.clientX,y:t.clientY}:null}),this.renderer.domElement.addEventListener(`pointerup`,t=>{if(t.button!==0||this.pointerDrag||this.tControls?.dragging)return;if(e&&Math.hypot(t.clientX-e.x,t.clientY-e.y)>8){e=null;return}e=null;let n=this.screenToWorld(t.clientX,t.clientY),r=this.pickBeacon(n.x,n.z);if(r){this.setSelected(null),this.selectChannel(r.cid),this.focusTo(r.x,r.z);return}let i=this.pickAt(n.x,n.z);if(i){this.setSelected(i),this.selectedChannel&&this.selectChannel(null);return}let a=this.pickChannel(n.x,n.z);this.setSelected(null),a&&this.mode===`edit`&&this.selectChannel(a)}),this.renderer.domElement.addEventListener(`dblclick`,e=>{if(this.pointerDrag)return;let t=this.screenToWorld(e.clientX,e.clientY),n=this.pickAt(t.x,t.z);if(n?.kind===`agent`){let e=this.agents.get(n.id);e&&this.focusTo(e.root.position.x,e.root.position.z)}else if(n?.kind===`device`){let e=this.deviceNodes.get(n.id);e&&this.focusTo(e.root.position.x,e.root.position.z)}else{let e=this.pickChannel(t.x,t.z),n=e?this.blocks.get(e):void 0;n&&(this.selectChannel(e),this.focusTo(n.x,n.z))}}),this.scene=new le,this.scene.background=new F(659224),this.scene.fog=new p(1779766,1400,8800);try{let e=new je(this.renderer);this.scene.environment=e.fromScene(new ae,.04).texture,this.scene.environmentIntensity=.42,e.dispose()}catch{}this.skyDome=this.makeSkyDome(),this.scene.add(this.skyDome);for(let e=0;e<4;e++){let t=new h(new W(16,6,8,20),new z({color:16172115,transparent:!0,opacity:.95,depthTest:!1}));t.rotation.x=Math.PI/2,t.position.y=1.4,t.visible=!1,this.scene.add(t),this.resizeHandles.push({mesh:t,cid:``,handle:e})}for(let e=0;e<4;e++){let t=new h(new W(10,4,8,16),new z({color:4311284,transparent:!0,opacity:.95,depthTest:!1}));t.rotation.x=Math.PI/2,t.position.y=1.2,t.visible=!1,this.scene.add(t),this.agentRangeHandles.push({mesh:t,agentId:``,handle:e})}let t=new h(new k(.92,1,56),new z({color:16172115,transparent:!0,opacity:.85,side:2,depthWrite:!1,blending:2}));t.rotation.x=-Math.PI/2,t.position.y=.5,t.visible=!1,t.renderOrder=5,this.scene.add(t),this.selRing=t,this.camera=new ue(55,(this.el.clientWidth||1100)/(this.el.clientHeight||700),1,12e3),this.camera.position.set(R,760,B+900),this.camera.lookAt(R,20,B);let n=new Re(this.camera,this.renderer.domElement);n.size=.85,n.setMode(`translate`),n.showY=!1,n.addEventListener(`dragging-changed`,e=>{if(!e.value){let e=this.selected;e?.kind===`device`&&this.deviceNodes.has(e.id)&&this.persistDeviceTransform(e.id)}}),n.addEventListener(`objectChange`,()=>{let e=this.selected;if(!e||e.kind!==`device`)return;let t=this.deviceNodes.get(e.id);if(t){if(n.mode===`scale`&&Math.abs(t.root.scale.x-1)>1e-4){let n=this.scalables.get(`device:${e.id}`)?.userScale??1;this.setModelScale(e.id,Math.min(50,Math.max(.02,n*t.root.scale.x)),`device`),t.root.scale.set(1,1,1)}this.dirty=!0}}),this.tControls=n,this.scene.add(n.getHelper()),this.scene.add(new Ae(13690094,1.6));let r=new Me(10471400,3813157,.7);this.scene.add(r);let i=new v(16774368,3.2);i.position.set(R+500,900,B+300),i.castShadow=!0,this.keyLight=i,i.shadow.mapSize.set(2048,2048),i.shadow.camera.left=-1400,i.shadow.camera.right=1400,i.shadow.camera.top=2e3,i.shadow.camera.bottom=-2e3,i.shadow.normalBias=2,i.shadow.bias=-2e-4,i.shadow.radius=6,this.scene.add(i);let a=new v(8961023,.75);a.position.set(R-1200,900,B-800),this.scene.add(a);let o=new v(4311284,1.4);o.position.set(R-1400,620,B-1e3),this.scene.add(o);let c=new v(3530912,.4);c.position.set(R+700,380,B+900),this.scene.add(c);let l=new E({color:16777215,roughness:.62,metalness:.3,envMapIntensity:.42});this.ground=new h(new ve(D*16,N*16),l),this.ground.rotation.x=-Math.PI/2,this.ground.receiveShadow=!0,this.scene.add(this.ground),this.scene.add(this.daqLinkGroup,this.filmWebGroup);let u=new s(1,1,{type:S,samples:4});this.composer=new ft(this.renderer,u),this.composer.setPixelRatio(this.renderer.getPixelRatio()),this.composer.setSize(this.el.clientWidth||1100,this.el.clientHeight||700),this.composer.addPass(new pt(this.scene,this.camera)),this.composer.addPass(new ht(new U(this.el.clientWidth||1100,this.el.clientHeight||700),.32,.35,3)),this.composer.addPass(new _t),this.applyGroundTexture(),globalThis.__townScene3d=this,this.loop()}makeIndustrialGroundTexture(){let e=1024,t=document.createElement(`canvas`);t.width=e,t.height=e;let n=t.getContext(`2d`),r=n.createLinearGradient(0,0,e,e);r.addColorStop(0,`#151f36`),r.addColorStop(.5,`#101a2d`),r.addColorStop(1,`#131c31`),n.fillStyle=r,n.fillRect(0,0,e,e),n.strokeStyle=`rgba(42,63,102,0.32)`,n.lineWidth=2;for(let t=0;t<=8;t++){let r=t/8*e;n.beginPath(),n.moveTo(r,0),n.lineTo(r,e),n.stroke(),n.beginPath(),n.moveTo(0,r),n.lineTo(e,r),n.stroke()}n.strokeStyle=`rgba(42,63,102,0.2)`,n.lineWidth=1;for(let t=0;t<=32;t++){let r=t/32*e;n.beginPath(),n.moveTo(r,0),n.lineTo(r,e),n.stroke(),n.beginPath(),n.moveTo(0,r),n.lineTo(e,r),n.stroke()}n.fillStyle=`rgba(255,255,255,0.02)`;for(let t=0;t<900;t++){let r=t*733%e,i=t*151%e;n.fillRect(r,i,2,2)}let i=new l(t);return i.colorSpace=I,i.wrapS=Te,i.wrapT=Te,i.repeat.set(23,17),i.anisotropy=Math.min(8,this.renderer.capabilities.getMaxAnisotropy()),i}makeSkyDome(){let e=document.createElement(`canvas`);e.width=1024,e.height=256;let t=e.getContext(`2d`),n=t.createLinearGradient(0,0,0,256);n.addColorStop(0,`#080d16`),n.addColorStop(.4,`#121b27`),n.addColorStop(.64,`#22303e`),n.addColorStop(.84,`#3b4b5b`),n.addColorStop(1,`#2a3644`),t.fillStyle=n,t.fillRect(0,0,e.width,e.height);let r=20260831,i=()=>(r=(r*1103515245+12345)%2147483648,r/2147483648);for(let n=0;n<220;n++){let n=i()*e.width,r=i()*i()*118,a=i()<.88?1:2,o=.12+i()*.5;t.fillStyle=i()<.24?`rgba(160,220,255,${o.toFixed(2)})`:`rgba(232,240,250,${o.toFixed(2)})`,t.beginPath(),t.arc(n,r,a,0,Math.PI*2),t.fill()}let a=new l(e);a.colorSpace=I;let o=new M(5600,24,16),s=new z({map:a,side:1,fog:!1,depthWrite:!1}),c=new h(o,s);return c.position.set(R,0,B),c.renderOrder=-10,c}applyGroundTexture(){try{let e=this.ground.material;e.map=this.makeIndustrialGroundTexture(),e.color.set(16777215),e.roughness=.94,e.metalness=.06,e.envMapIntensity=.28,e.needsUpdate=!0,this.dirty=!0}catch{}}on(e,t){return this.busHandlers.set(e,t),()=>this.busHandlers.delete(e)}emit(e,t){let n=this.busHandlers.get(e);n&&n(t)}buildBlocks(e){this.entityIndex.clear();for(let t of e){this.entityIndex.set(t.channelId,t);let e=this.layouts.get(t.channelId);e&&this.placeChannel(t,e)}this.emit(`blockCount`,this.blocks.size),this.emit(`agentCount`,this.agents.size)}placeChannel(e,t){let n=L(t),r=ge(e.channelId),i=this.makeBlock(e.channelName,r,n),a=new vt({channelId:e.channelId,name:e.channelName,x:n.x,z:n.z,radiusX:n.radiusX,radiusZ:n.radiusZ,shape:n.shape,rotationY:n.rotationY,color:r,platform:i.platform,padRing:i.padRing,beacon:i.beacon,boundary:$(n.shape,n.radiusX,n.radiusZ,r),label:this.makeLabel(e.channelName,n.x,30,n.z)});a.host=this,a.boundary.position.set(n.x,.3,n.z),a.boundary.rotation.y=n.rotationY*Math.PI/180,this.scene.add(a.boundary),this.blocks.set(e.channelId,a),this.layoutAgentsInBlock(e,a);for(let t of this.agents.values())t.channelId===e.channelId&&!a.members.includes(t)&&a.members.push(t)}layoutAgentsInBlock(e,t){let{x:n,z:r,radiusX:i,radiusZ:a}=t,o=.6,s=Math.max(1,e.agents.length);e.agents.forEach((c,l)=>{let u,d;if(typeof c.homeX==`number`&&typeof c.homeZ==`number`)u=c.homeX,d=c.homeZ;else{let e=s<=1?0:l/(s-1)*2-1;u=n+e*i*o*.8,d=r+(c.role===`lead`?0:(l%2==0?-1:1)*a*o*.4)}this.ensureAgent({...c,channelId:e.channelId},u,d,t.color)})}makeBlock(e,t,n){let r=n.rotationY*Math.PI/180,i=new h(this.makePadShapeGeometry(n.shape,n.radiusX,n.radiusZ),new E({color:t,transparent:!0,opacity:.24,roughness:.85,metalness:.12,emissive:t,emissiveIntensity:.12,side:2}));i.rotation.set(0,r,0),i.position.set(n.x,.16,n.z),i.receiveShadow=!1,this.scene.add(i);let a=new h(this.makePadRingGeometry(n.shape,n.radiusX,n.radiusZ),new z({color:t,transparent:!0,opacity:.52,side:2,depthWrite:!1}));a.rotation.set(0,r,0),a.position.set(n.x,.34,n.z),this.scene.add(a);let o=this.makeBeacon(t);return o.position.set(n.x,0,n.z),this.scene.add(o),{platform:i,padRing:a,beacon:o}}makeBeacon(e){let t=new g,n=new E({color:2766146,roughness:.45,metalness:.65}),r=new h(new _(7,9,5,12),n);r.position.y=2.5;let i=new h(new _(1.6,1.6,30,8),n);i.position.y=18;let a=new h(new ie(6.5),new z({color:e}));return a.material.color.multiplyScalar(4.5),a.position.y=37,t.add(r,i,a),t}pickBeacon(e,t){for(let n of this.blocks.values())if(Math.hypot(n.x-e,n.z-t)<34)return{cid:n.channelId,x:n.x,z:n.z};return null}makePadShapeGeometry(e,t,n){let r=new Se;e===`rect`?(r.moveTo(-t,-n),r.lineTo(t,-n),r.lineTo(t,n),r.lineTo(-t,n),r.closePath()):r.absellipse(0,0,t,n,0,Math.PI*2);let i=new _e(r,e===`rect`?1:56);return i.rotateX(Math.PI/2),i}makePadRingGeometry(e,t,n,i=13){let a=Math.max(4,t-i),o=Math.max(4,n-i),s=new Se,c=new r;e===`rect`?(s.moveTo(-t,-n),s.lineTo(t,-n),s.lineTo(t,n),s.lineTo(-t,n),s.closePath(),c.moveTo(-a,-o),c.lineTo(a,-o),c.lineTo(a,o),c.lineTo(-a,o),c.closePath()):(s.absellipse(0,0,t,n,0,Math.PI*2),c.absellipse(0,0,a,o,0,Math.PI*2)),s.holes.push(c);let l=new _e(s,e===`rect`?1:56);return l.rotateX(Math.PI/2),l}applyPadToBlock(e){let t=e.rotationY*Math.PI/180;e.platform.rotation.set(0,t,0),e.padRing.rotation.set(0,t,0);let n=e.platform.geometry;e.platform.geometry=this.makePadShapeGeometry(e.shape,e.radiusX,e.radiusZ),n.dispose();let r=e.padRing.geometry;e.padRing.geometry=this.makePadRingGeometry(e.shape,e.radiusX,e.radiusZ),r.dispose()}makeLabel(e,t,n,r,i=`#41c8f4`){let a=document.createElement(`canvas`),o=a.getContext(`2d`),s=`600 21px "Geist Mono", Geist, "PingFang SC", monospace`;o.font=s;let c=Math.max(104,Math.ceil(o.measureText(e).width)+26+14);a.width=c,a.height=48,o.font=s,o.fillStyle=`rgba(10,14,20,0.8)`,o.fillRect(0,0,c,48),o.strokeStyle=`${i}66`,o.lineWidth=1,o.strokeRect(.5,.5,c-1,47),o.fillStyle=i,o.fillRect(0,0,3,48),o.fillStyle=`#dce7f0`,o.textAlign=`left`,o.textBaseline=`middle`,o.fillText(e,26,25);let u=new l(a);u.colorSpace=I;let d=new pe(new oe({map:u,transparent:!0,depthTest:!1}));return d.scale.set(c/6,8,1),d.position.set(t,n,r),this.scene.add(d),d}hexOf(e){return`#${e.toString(16).padStart(6,`0`)}`}ensureAgent(e,t,n,r){let i=e.agentId;if(this.agents.has(i))return;let a=this.blockLayout(e.channelId),o=e.homeX??t,s=e.homeZ??n;if(a){let e=A(a,o,s,20);o=e.x,s=e.z}let c=e.range??null,l=new g;l.position.set(o,0,s);let u=this.makeLabel(e.name,o,48,s,this.hexOf(r)),d=e.modelRef||`hero-anime-1`,f=new g;l.add(f),this.scene.add(l);let p=new yt({channelId:e.channelId,agentId:i,name:e.name,role:e.role,root:l,model:f,mixer:null,clips:[],colorNum:r,nameSprite:u,bubble:null,bubbleText:null,bubbleTimer:null,state:e.state,progress:e.currentTaskProgress??null,dragging:!1,homeX:o,homeZ:s,range:c,rangeLine:null,textureKey:d,modelRef:e.modelRef??``,behavior:{mode:`idle`,roamTarget:null,targetId:null,waitUntil:0,pauseUntil:0,engaged:!1}});p.host=this,p.attachAura(r,e.role),this.agents.set(i,p);let m=this.modelsById.get(d)??(d.startsWith(`hero-anime-`)?{id:d,file:`/assets/game/character/${d}.glb`,name:`二次元角色`}:this.modelsById.get(`hero-3d`)??{id:`hero-3d`,file:`/assets/game/character/hero-3d.glb`,name:`标准员工模型`});this.mountModel(p,m.file,m.name),p.renderRangeLine(),this.emit(`agentCount`,this.agents.size)}async mountModel(e,t,n){let r=this.gltfCache.get(t),i,a;if(r)i=r.scene.clone(!0),a=r.height;else try{let e=await this.loadGltf(t);i=e.scene;let n=new o().setFromObject(i);a=Math.max(.5,n.max.y-n.min.y),this.gltfCache.set(t,{file:t,scene:i,height:a}),this.agentAnimClips.set(t,e.animations)}catch{i=this.makeFallbackBot(),a=1.4}i.position.y=0,i.scale.setScalar(120/a),i.traverse(e=>{e.isMesh&&(e.castShadow=!0)}),this.enhancePbrMaterials(i,`character`),e.model.clear(),e.model.add(i),this.registerScalable(`agent`,e.agentId,e.model),e.mixer=null,e.activeAction=null;let s=this.agentAnimClips.get(t)??[],c=s[0];if(c){e.mixer=new ee(i),e.clips=s;let t=e.mixer.clipAction(c);t.play(),e.activeAction=t}this.dirty=!0}agentAnimClips=new Map;loadGltf(e){return new Promise((t,n)=>{this.gltfLoader.load(e,e=>t({scene:e.scene,animations:e.animations??[]}),void 0,n)})}makeFallbackBot(){let e=new g,t=new E({color:2766146,roughness:.42,metalness:.62}),n=new E({color:1317668,roughness:.6,metalness:.4}),r=new z({color:4311284}),i=new h(new c(.42,.62,8,16),t);i.position.y=.86;let a=new h(new M(.32,16,12),t);a.position.y=1.62;let o=new h(new H(.4,.1,.12),r);o.position.set(0,1.66,.27);let s=new h(new M(.14,12,8),r);s.position.set(0,1.1,.36);let l=new h(new _(.5,.62,.26,16),n);l.position.y=.16;let u=new h(new _(.03,.03,.5,6),n);u.position.set(0,2.04,0);let d=new h(new M(.08,10,8),r);return d.position.set(0,2.34,0),e.add(i,a,o,s,l,u,d),e}registerModelsFromList(e){if(this.disposed)return;let t=new Set;for(let n of e){let e=this.modelsById.get(n.id);(!e||e.file!==n.file||e.name!==n.name||e.kind!==n.kind||e.hFactor!==(n.hFactor??1))&&(this.modelsById.set(n.id,{...n,hFactor:n.hFactor??1}),t.add(n.id))}if(t.size>0){for(let e of this.agents.values()){if(!e.modelRef||!t.has(e.modelRef))continue;let n=this.modelsById.get(e.modelRef);n&&this.mountModel(e,n.file,n.name)}for(let e of this.deviceNodes.values())t.has(e.modelRef)&&this.swapDeviceModelSprite(e,e.modelRef)}for(let e of[...this.pendingDeviceTwins.values()])!(e.kind===`daq`||(e.modelRef??``).startsWith(`daq-`))&&!this.modelsById.get(e.modelRef)?.file||(this.pendingDeviceTwins.delete(e.id),this.recreateDeviceNode(e))}applySceneLayouts(e){this.layouts.clear();for(let t of e){let e=L(t);this.layouts.set(e.channelId,e)}}hasChannel(e){return this.blocks.has(e)}blockLayout(e){let t=this.blocks.get(e);return t?t.layout():null}placedChannels(){return[...this.blocks.keys()]}getChannelLayout(e){let t=this.blocks.get(e);return t?t.layout():null}get threeScene(){return this.scene}markDirty(){this.dirty=!0}trackLayout(e){this.layouts.set(e.channelId,e.normLayout())}renameDeviceSprite(e,t){e.name=t.trim(),this.scene.remove(e.label),e.label=this.makeLabel(`⚙ ${e.name}`,e.root.position.x,60,e.root.position.z),this.dirty=!0}swapDeviceModelSprite(e,t){let n=this.modelsById.get(t);n?.file&&(e.modelRef!==t||e.holder.userData.modelFile!==n.file)&&(e.modelRef=t,e.holder.clear(),e.holder.userData.modelFile=n.file,this.loadGltfToGroup(n.file,e.holder,192),this.dirty=!0)}hydrate(e,t,n){this.applySceneLayouts(t),this.rebuild(e),this.syncDevices(n),this.emit(`blockCount`,this.blocks.size),this.emit(`agentCount`,this.agents.size)}rebuild(e){this.resetAll(),this.buildBlocks(e),this.emit(`blockCount`,this.blocks.size),this.emit(`agentCount`,this.agents.size)}focusChannel(e){let t=this.blocks.get(e);t&&this.focusTo(t.x,t.z)}dropChannelOnWorld(e,t,n,r,i){let a=this.blocks.get(n);if(a)return this.focusTo(a.x,a.z),{x:Math.round(a.x),z:Math.round(a.z),channelId:n,name:a.name};let o={channelId:n,x:e,z:t,radiusX:Math.max(120,110+i*18),radiusZ:Math.max(80,70+i*14),shape:`ellipse`,rotationY:0};this.layouts.set(n,L(o));let s=this.entityIndex.get(n);if(s)this.placeChannel(s,o);else{let i=ge(n),a=this.makeBlock(r,i,o),s=new vt({channelId:n,name:r,x:e,z:t,radiusX:o.radiusX,radiusZ:o.radiusZ,shape:o.shape,rotationY:o.rotationY,color:i,platform:a.platform,padRing:a.padRing,beacon:a.beacon,boundary:$(o.shape,o.radiusX,o.radiusZ,i),label:this.makeLabel(r,e,30,t)});s.host=this,s.boundary.position.set(e,.3,t),this.scene.add(s.boundary),this.blocks.set(n,s)}return this.emit(`blockCount`,this.blocks.size),this.emit(`agentCount`,this.agents.size),{x:Math.round(e),z:Math.round(t),channelId:n,name:r}}updateChannelLayout(e,t){let n=this.blocks.get(e);if(!n)return;t.x!==void 0&&(n.x=t.x),t.z!==void 0&&(n.z=t.z),t.radiusX!==void 0&&(n.radiusX=Math.max(60,t.radiusX)),t.radiusZ!==void 0&&(n.radiusZ=Math.max(40,t.radiusZ)),t.shape!==void 0&&(n.shape=t.shape),t.rotationY!==void 0&&(n.rotationY=t.rotationY);let r=L({channelId:e,x:n.x,z:n.z,radiusX:n.radiusX,radiusZ:n.radiusZ,shape:n.shape,rotationY:n.rotationY});this.layouts.set(e,r),this.scene.remove(n.boundary),this.applyPadToBlock(n),n.boundary=$(r.shape,r.radiusX,r.radiusZ,n.color),n.boundary.position.set(r.x,.3,r.z),n.boundary.rotation.y=r.rotationY*Math.PI/180,this.scene.add(n.boundary),this.clampAgentsToBoundary(e),this.dirty=!0}removeChannel(e){let t=this.blocks.get(e);if(t){this.scene.remove(t.platform),this.scene.remove(t.padRing),this.scene.remove(t.beacon),t.boundary&&this.scene.remove(t.boundary),this.scene.remove(t.label);for(let[t,n]of[...this.agents.entries()])n.channelId===e&&(this.scene.remove(n.root),n.nameSprite&&this.scene.remove(n.nameSprite),n.bubble&&this.scene.remove(n.bubble),n.rangeLine&&this.scene.remove(n.rangeLine),this.disposeAgentAssets(n),this.agents.delete(t));t.label&&this.disposeCanvasTextures(t.label),this.rangeDrawAgent&&this.agents.get(this.rangeDrawAgent)===void 0&&this.cancelRangeDraw(),this.blocks.delete(e),this.layouts.delete(e),this.receivers.delete(e);for(let e of this.resizeHandles)e.mesh.visible=!1;for(let e of this.agentRangeHandles)e.mesh.visible=!1;this.selectedChannel===e&&(this.selectedChannel=null,this.emit(`selectChannel`,null)),this.emit(`blockCount`,this.blocks.size),this.emit(`agentCount`,this.agents.size),this.dirty=!0}}applyBlockMove(e,t,n){e.moveBy(t-e.x,n-e.z),this.refreshAgentRangeHandles(),this.dirty=!0}applyLayoutToBlock(e){let t={channelId:e.channelId,x:e.x,z:e.z,radiusX:e.radiusX,radiusZ:e.radiusZ,shape:e.shape,rotationY:e.rotationY};this.layouts.set(e.channelId,L(t)),e.platform.position.set(e.x,.16,e.z),e.padRing.position.set(e.x,.34,e.z),this.applyPadToBlock(e),e.boundary&&this.scene.remove(e.boundary),e.boundary=$(e.shape,e.radiusX,e.radiusZ,e.color),e.boundary.position.set(e.x,.3,e.z),e.boundary.rotation.y=e.rotationY*Math.PI/180,this.scene.add(e.boundary),this.dirty=!0}boundaryHandlePoints(e){return e.shape===`rect`?[[e.radiusX,e.radiusZ],[-e.radiusX,e.radiusZ],[-e.radiusX,-e.radiusZ],[e.radiusX,-e.radiusZ]]:[[e.radiusX,0],[-e.radiusX,0],[0,e.radiusZ],[0,-e.radiusZ]]}refreshChannelHandles(){for(let e of this.resizeHandles)e.mesh.visible=!1;if(this.mode!==`edit`||!this.selectedChannel)return;let e=this.blocks.get(this.selectedChannel);if(!e)return;let t=e.rotationY*Math.PI/180,n=this.boundaryHandlePoints(e);for(let r=0;r<this.resizeHandles.length&&r<n.length;r++){let[i,a]=n[r],o=e.x+i*Math.cos(t)-a*Math.sin(t),s=e.z+i*Math.sin(t)+a*Math.cos(t);this.resizeHandles[r].cid=e.channelId,this.resizeHandles[r].mesh.position.set(o,1.4,s),this.resizeHandles[r].mesh.visible=!0}}pickResizeHandle(e,t){if(this.mode!==`edit`)return null;for(let n of this.resizeHandles)if(n.mesh.visible&&Math.hypot(n.mesh.position.x-e,n.mesh.position.z-t)<90)return{cid:n.cid,handle:n.handle};return null}applyResize(e,t,n,r){let i=-e.rotationY*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=n-e.x,c=r-e.z,l=s*a-c*o,u=s*o+c*a;e.shape===`rect`?(e.radiusX=Math.max(60,Math.abs(l)),e.radiusZ=Math.max(40,Math.abs(u))):t===0||t===1?e.radiusX=Math.max(60,Math.abs(l)):e.radiusZ=Math.max(40,Math.abs(u)),this.applyLayoutToBlock(e),this.refreshChannelHandles(),this.autoFrameTo(e.radiusX,e.radiusZ),this.dirty=!0}clampAgentsToBoundary(e){let t=this.blocks.get(e);t&&(t.clampMembersAndRanges(),this.dirty=!0)}getSelectedChannel(){return this.selectedChannel}selectChannel(e){this.selectedChannel=e,this.emit(`selectChannel`,e),this.refreshChannelHandles(),this.cancelRangeDraw(),this.refreshAgentRangeHandles();for(let t of this.blocks.values()){let n=t.boundary.material;n.color.setHex(t.channelId===e?16172115:t.color),n.opacity=t.channelId===e?1:.75}e&&!this.pointerDrag&&this.focusTo(this.blocks.get(e)?.x??1600,this.blocks.get(e)?.z??1200)}getAllChannelLayouts(){return[...this.blocks.values()].map(e=>({channelId:e.channelId,x:e.x,z:e.z,radiusX:e.radiusX,radiusZ:e.radiusZ,shape:e.shape,rotationY:e.rotationY}))}handleTownEvent(t){if(t.type===`channel.snapshot`)return;if(t.type===`scene.layout.saved`){let e=t.payload;this.blocks.has(e.channelId)&&(this.applySceneLayouts([...this.layouts.values(),e]),this.getChannelLayout(e.channelId)&&this.updateChannelLayout(e.channelId,e));return}if(t.type===`scene.layout.removed`){let{channelId:e}=t.payload;this.removeChannel(e);return}let r=e(t);if(!r)return;if(r.agentId){let e=this.agents.get(r.agentId);e&&(t.type===`agent.status`&&(e.state=t.payload.state,e.state!==`busy`&&(e.progress=null)),t.type===`task.progress`&&(e.progress=t.payload.progress),this.dirty=!0)}r.bubble&&this.enqueueBubble(r.bubble.channelId,r.bubble.agentId,r.bubble.kind,r.bubble.text,r.bubble.ttlMs),this.emitResonance(t);let i=n(t,{resolveTaskAssignee:this.resolveTaskAssignee??void 0});i&&this.startBehavior(i)}startBehavior(e){let t=this.agents.get(e.fromId),n=this.agents.get(e.toId);!t||!n||t.dragging||(t.behavior.mode=`approach`,t.behavior.targetId=n.agentId,t.behavior.action=e,n.dragging||(n.behavior.engaged=!0,n.behavior.roamTarget=null),this.emit(`behavior`,{agentName:t.name,action:this.behaviorActionLabel(e.kind),targetName:n.name}))}behaviorActionLabel(e){return e===`task`?`下发任务`:`回复`}notifyMotion(e){this.emit(`motion`,{agentName:e.name,anim:e.animState,at:Date.now()})}deliverBehavior(e,t){let n=e.behavior.action?.text??``;n&&this.enqueueBubble(e.channelId,e.agentId,`info`,n,2600),this.emit(`behavior`,{agentName:e.name,action:this.behaviorActionLabel(e.behavior.action?.kind??`message`),targetName:t.name})}releaseEngaged(e){let t=e.behavior.targetId?this.agents.get(e.behavior.targetId):void 0;t&&(t.behavior.engaged=!1)}getAgent(e){return this.agents.get(e)}blockLayoutOf(e){return this.blockLayout(e)}resolveFile(e){return this.modelsById.get(e)?.file??``}getCameraTarget(){return{x:Math.round(this.camTarget.x),z:Math.round(this.camTarget.z)}}swapAgentModel(e,t){let n=this.agents.get(e);if(!n)return;let r=this.modelsById.get(t),i=r?.file??`/assets/game/character/hero-3d.glb`;n.modelRef=t,n.textureKey=t,this.mountModel(n,i,r?.name??t)}emitResonance(e){let t=this.blocks.get(e.channelId),n=e.agentId?this.agents.get(e.agentId):void 0,r=n?.root.position.x??t?.x,i=n?.root.position.z??t?.z;r!==void 0&&i!==void 0&&(e.type===`agent.message`||e.type===`agent.status.message`||e.type===`a2a.message`?this.pulseRing(r,i,n?4311284:t?.color??4311284):e.type===`error`||e.type===`task.status`&&(e.payload.state===`failed`||e.payload.state===`canceled`)?this.pulseRing(r,i,16739179):e.type===`task.status`&&e.payload.state===`completed`&&this.lightColumn(r,i,3530912))}pulseRing(e,t,n){let r=new h(new k(10,22,24),new z({color:n,transparent:!0,opacity:.8,side:2,depthWrite:!1}));r.rotation.x=-Math.PI/2,r.position.set(e,.4,t),this.scene.add(r);let i=performance.now(),a=()=>{let e=Math.min(1,(performance.now()-i)/800),t=1-(1-e)**3;if(r.scale.setScalar(1+t*1.6),r.material.opacity=.8*(1-t),e>=1){this.scene.remove(r),r.geometry.dispose(),r.material.dispose();return}this.rafAnims.push(a)};this.rafAnims.push(a)}lightColumn(e,t,n){let r=new _(6,12,120,16);r.translate(0,60,0);let i=new h(r,new z({color:n,transparent:!0,opacity:.8,depthWrite:!1}));i.position.set(e,0,t),i.scale.y=.01,this.scene.add(i);let a=performance.now(),o=()=>{let e=Math.min(1,(performance.now()-a)/900),t=1-(1-e)**2;if(i.scale.y=.01+t*.99,i.material.opacity=.8*(1-e),e>=1){this.scene.remove(i),i.geometry.dispose(),i.material.dispose();return}this.rafAnims.push(o)};this.rafAnims.push(o)}rafAnims=[];layouts=new Map;entityIndex=new Map;selectedChannel=null;enqueueBubble(e,t,n,r,i){this.dbgBubbles.push({text:r,at:Date.now()}),this.dbgBubbles.length>30&&this.dbgBubbles.splice(0,this.dbgBubbles.length-30);let a=t?this.agents.get(t)?.name:void 0;this.lastActivity={channelId:e,agentName:a??this.blocks.get(e)?.name??`系统`,text:r,at:Date.now()},this.recentActivity.push(this.lastActivity),this.recentActivity.length>30&&this.recentActivity.splice(0,this.recentActivity.length-30),this.emit(`lastActivity`,this.lastActivity);let o=this.receivers.get(e);o||(o={channelId:e,queue:[],current:null,currentUntil:0},this.receivers.set(e,o)),o.queue.length>=24&&o.queue.splice(0,o.queue.length-24),o.queue.push({agentId:t??null,kind:n,text:r,ttlMs:i}),this.dirty=!0}drainReceivers(e){for(let t of this.receivers.values()){if(t.current){if(e<t.currentUntil)continue;this.clearReceiverBubble(t.channelId,t.current),t.current=null}let n=t.queue.shift();n&&(t.current=n,t.currentUntil=e+xe(n.text,t.queue.length),this.renderReceiverBubble(t.channelId,n))}}clearReceiverBubble(e,t){if(!t.agentId)return;let n=this.agents.get(t.agentId);n?.bubble&&(this.scene.remove(n.bubble),n.bubble=null,n.bubbleText=null,n.bubbleTimer&&=(clearTimeout(n.bubbleTimer),null))}renderReceiverBubble(e,t){let n=t.agentId?this.agents.get(t.agentId):void 0,r=this.blocks.get(e);if(!n&&!r)return;let i=n?.name??r?.name??`系统`,a=n?n.colorNum:r?.color??4311284,o=(t.kind===`artifact`&&!t.text.startsWith(`📦`)?`📦 ${t.text}`:t.text)||`…`,s=this.makeChatBubble(o,i,a,t.kind),c=n?.root.position.x??r.x,l=n?.root.position.z??r.z;if(s.position.set(c,n?108+Math.max(0,n.model.scale.y-1)*22:64,l),this.scene.add(s),!n){window.setTimeout(()=>{this.scene.remove(s)},we(t.text)+500);return}n.bubble&&(this.scene.remove(n.bubble),this.disposeCanvasTextures(n.bubble),n.bubbleText=null),n.bubble=s,n.bubbleText=o,this.popInSprite(s),this.dirty=!0}makeChatBubble(e,t,n,r){let i=`#${n.toString(16).padStart(6,`0`)}`,a=document.createElement(`canvas`),o=a.getContext(`2d`),s=`18px Geist, "PingFang SC", sans-serif`;o.font=s;let c=this.wrapBubbleLines(o,e.replace(/\s+/g,` `).trim()||`…`,470,6),u=Math.max(...c.map(e=>o.measureText(e).width)),d=Math.min(680,Math.max(140,Math.ceil(u)+36)),f=26+c.length*24+24,p=f+13;a.width=d,a.height=p,o.clearRect(0,0,d,p);let m=d/2,h=Math.min(24,d*.32),g=()=>{o.beginPath(),o.moveTo(4,0),o.lineTo(d-4,0),o.quadraticCurveTo(d,0,d,4),o.lineTo(d,f-4),o.quadraticCurveTo(d,f,d-4,f),o.lineTo(m+h/2,f),o.lineTo(m,f+13),o.lineTo(m-h/2,f),o.lineTo(4,f),o.quadraticCurveTo(0,f,0,f-4),o.lineTo(0,4),o.quadraticCurveTo(0,0,4,0),o.closePath()};o.save(),o.shadowColor=`rgba(0,0,0,0.55)`,o.shadowBlur=14,o.shadowOffsetY=4,g(),o.fillStyle=`rgba(14,18,27,0.94)`,o.fill(),o.restore(),o.save(),g(),o.clip(),o.fillStyle=`rgba(255,255,255,0.045)`,o.fillRect(0,0,d,38),o.restore(),o.globalAlpha=.28,o.fillStyle=`#fff`,o.fillRect(18,30,d-36,1),o.globalAlpha=1,g(),o.lineWidth=1.2,o.strokeStyle=`rgba(140,170,195,0.4)`,o.stroke(),o.save(),g(),o.clip(),o.fillStyle=i,o.fillRect(0,0,3,f),o.restore(),o.font=`600 13px "Geist Mono", Geist, "PingFang SC", monospace`,o.fillStyle=i,o.textBaseline=`middle`,o.textAlign=`left`,o.fillText(t,18,22);let _=r===`artifact`?`ARTIFACT`:r===`error`?`FAULT`:``;if(_){let e=o.measureText(_).width+12;o.font=`600 10px "Geist Mono", Geist, monospace`,o.fillStyle=r===`error`?`#ff8d80`:`#9fc3e8`,o.strokeStyle=r===`error`?`rgba(255,141,128,0.55)`:`rgba(159,195,232,0.45)`,o.lineWidth=1;let t=d-18-e;o.beginPath(),o.rect(t,14,e,16),o.fill(),o.stroke(),o.textAlign=`center`,o.fillText(_,t+e/2,22.5)}o.font=s,o.fillStyle=r===`error`?`#ff9d9d`:`#eef2fb`,o.textAlign=`left`,c.forEach((e,t)=>o.fillText(e,18,48+t*24));let v=new l(a);v.colorSpace=I;let y=new pe(new oe({map:v,transparent:!0,depthTest:!1,depthWrite:!1})),b=2.4;return y.scale.set(d/b,p/b,1),y}popInSprite(e){let t=e.scale.x,n=e.scale.y;e.scale.set(t*.62,n*.62,1);let r=performance.now(),i=()=>{if(this.disposed)return;let a=Math.min(1,(performance.now()-r)/180),o=.62+.38*(1-(1-a)**3);e.scale.set(t*o,n*o,1),a<1&&this.rafAnims.push(i)};this.rafAnims.push(i)}wrapBubbleLines(e,t,n,r){let i=[],a=``;for(let o of t)if(e.measureText(a+o).width>n&&a){if(i.push(a),a=o,i.length>=r)return i[r-1]=`${i[r-1]??``}…`,i}else a+=o;return a&&i.push(a),i.length===0&&i.push(`…`),i}get canvas(){return this.renderer.domElement}worldToScreen(e,n,r){let i=this.renderer.domElement.getBoundingClientRect(),a=t._wDir;if(this.camera.getWorldDirection(a),t._wRel.set(e-this.camera.position.x,n-this.camera.position.y,r-this.camera.position.z).dot(a)<=.1)return null;let o=t._wVec.set(e,n,r).project(this.camera);return o.z>1||Math.abs(o.x)>1.6||Math.abs(o.y)>1.6?null:{x:i.left+(o.x+1)/2*i.width,y:i.top+(1-o.y)/2*i.height}}screenToWorld(e,n){let r=this.renderer.domElement.getBoundingClientRect(),i=(e-r.left)/r.width*2-1,a=-((n-r.top)/r.height)*2+1,o=t._raycaster;o.setFromCamera(t._wVec2.set(i,a),this.camera);let s=t._wVec;return o.ray.intersectPlane(t._groundPlane,s),s?{x:s.x,z:s.z}:{x:this.camera.position.x,z:this.camera.position.z}}panBy(e,t){this.camTarget.x-=e,this.camTarget.z-=t}autoDolly=null;fitDollyFor(e,t){let n=this.camera.aspect||1.6;return Math.max(e/(.82*613*n),t/779)}autoFrameTo(e,t){let n=this.fitDollyFor(e,t);n>this.dolly&&(this.autoDolly=Math.min(40,n*1.18))}setTransformMode(e){this.tControls&&(this.tControls.setMode(e),this.tControls.showX=e!==`rotate`,this.tControls.showY=e!==`translate`,this.tControls.showZ=e!==`rotate`)}isGizmoBusy(){return!!this.tControls&&(this.tControls.dragging||!!this.tControls.axis)}setViewPreset(e){let t={std:{yaw:0,pitch:.7,radius:1178},top:{yaw:0,pitch:1.51,radius:2400},front:{yaw:0,pitch:.09,radius:1510},side:{yaw:Math.PI/2,pitch:.33,radius:1320}},n=t[e]??t.std;this.viewTarget={...n}}orbitBy(e,t){let n=this.viewCur.yaw-e*.0052,r=Math.min(1.52,Math.max(.06,this.viewCur.pitch+t*.0052));this.viewCur={yaw:n,pitch:r,radius:this.viewCur.radius},this.viewTarget={...this.viewCur},this.dirty=!0}setAutoOrbit(e){this.autoOrbit=e}getAutoOrbit(){return this.autoOrbit}panByScreen(e,t){let n=this.viewCur.radius*this.dolly*.0011,r=Math.sin(this.viewCur.yaw),i=Math.cos(this.viewCur.yaw),a=Math.sin(this.viewCur.pitch),o=(i*e+a*r*t)*n,s=(-r*e+a*i*t)*n;this.panBy(o,s)}flyToPreset(e,t=900){this.setViewPreset(e)}getCameraPose(){return{pos:{x:this.camera.position.x,y:this.camera.position.y,z:this.camera.position.z},target:{x:this.camTarget.x,z:this.camTarget.z},yaw:this.viewCur.yaw,dolly:this.dolly}}panWorldBy(e,t){this.camTarget.x-=e,this.camTarget.z-=t,this.camera.position.x-=e,this.camera.position.z-=t,this.dirty=!0}setExposure(e){this.renderer.toneMappingExposure=Math.min(2.2,Math.max(.2,e))}setTerritoryOpacity(e){let t=Math.min(1,Math.max(.05,e));for(let e of this.blocks.values())e.platform.material.opacity=.24*t;this.dirty=!0}resetView(){this.dolly=1,this.autoDolly=null,this.tweenCamTo(R,B),this.setViewPreset(`std`)}zoomBy(e){this.autoDolly=null,this.dolly=Math.min(1e3,Math.max(.001,this.dolly+e))}focusTo(e,t){this.tweenCamTo(e,t)}tweenCamTo(e,t){let n=performance.now(),r=this.camTarget.x,i=this.camTarget.z,a=()=>{let o=Math.min(1,(performance.now()-n)/600),s=1-(1-o)**3;this.camTarget.x=r+(e-r)*s,this.camTarget.z=i+(t-i)*s,o<1&&this.rafAnims.push(a)};this.rafAnims.push(a)}dropModelOnWorld(e,t,n){let r=this.nearestAgent(e,t,80),i=this.modelsById.get(n),a=i?.id??n;if(i?.kind===`dev`)return{mode:`spawn`,agentId:this.spawnDeviceNode(e,t,a,i.file,i.name),textureKey:a,x:Math.round(e),y:Math.round(t)};if(r)return this.swapTexture(r,a),this.enqueueBubble(r.channelId,r.agentId,`info`,`换装 → ${i?.name??n}`,2200),{mode:`rebind`,agentId:r.agentId,textureKey:a,x:Math.round(r.root.position.x),y:Math.round(r.root.position.z)};let o=i??{id:n,file:``,name:n};return this.spawnResident(e,t,a,o.name),{mode:`spawn`,textureKey:a,x:Math.round(e),y:Math.round(t)}}nearestAgent(e,t,n){let r,i=n;for(let n of this.agents.values()){let a=Math.hypot(n.root.position.x-e,n.root.position.z-t);a<i&&(r=n,i=a)}return r}swapTexture(e,t){let n=this.modelsById.get(t),r=n?.file??this.resolveFile(t)??`/assets/game/character/hero-3d.glb`;e.modelRef=t,e.textureKey=t,this.mountModel(e,r,n?.name??t)}spawnResident(e,t,n,r){let i=new g;i.position.set(e,0,t);let a=new g;i.add(a);let o=this.makeLabel(r,e,48,t,this.hexOf(16771524));this.scene.add(i);let s=new yt({channelId:``,agentId:`resident-${Date.now().toString(36)}`,name:r,role:`worker`,root:i,model:a,mixer:null,clips:[],colorNum:16771524,nameSprite:o,bubble:null,bubbleText:null,bubbleTimer:null,state:`idle`,progress:null,dragging:!1,homeX:e,homeZ:t,range:null,rangeLine:null,textureKey:n,modelRef:n,behavior:{mode:`idle`,roamTarget:null,targetId:null,waitUntil:0,pauseUntil:0,engaged:!1}});s.host=this,s.attachAura(16771524,`worker`),this.agents.set(s.agentId,s);let c=this.modelsById.get(n);this.mountModel(s,c?.file??`/assets/game/character/hero-3d.glb`,c?.name??r)}makeDeviceRing(){let e=new h(new k(20,26,32),new z({color:16172115,transparent:!0,opacity:.8,side:2}));e.rotation.x=-Math.PI/2,e.position.y=.3;let t=new h(new k(20,26,32,1,0,Math.PI*1.5),new z({color:3530912,transparent:!0,opacity:.55,side:2,depthWrite:!1,blending:2}));return t.rotation.x=-Math.PI/2,t.position.y=.34,t.visible=!1,{ring:e,arc:t}}spawnDeviceNode(e,t,n,r,i){let a=`dev-${Date.now().toString(36)}`,o=new g;o.position.set(e,0,t);let{ring:s,arc:c}=this.makeDeviceRing();o.add(s,c);let l=new g;o.add(l),l.userData.modelFile=r;let u=this.makeLabel(`⚙ ${i}`,e,60,t);this.scene.add(o);let d=new bt({twinId:a,name:i,modelRef:n,root:o,holder:l,ring:s,label:u,state:`idle`,telemetry:{}});d.host=this,d.arc=c,d.updateRing(),this.deviceNodes.set(a,d),this.registerScalable(`device`,a,l),this.loadGltfToGroup(r,l,192);let f=this.scalables.get(`device:${a}`),p=this.devices?.create({name:i,modelRef:n,kind:`device`,controls:[`power_on`,`power_off`,`set_speed`],posX:Math.round(e*10)/10,posZ:Math.round(t*10)/10,scale:f?Math.round(f.userScale*100)/100:1});return p?(this.pendingDeviceCreates.set(a,{name:i,modelRef:n,posX:e,posZ:t}),p.then(e=>{let t=this.cancelledDeviceCreates.delete(a);if(this.pendingDeviceCreates.delete(a),t){this.devices?.remove?.(e.id).catch(()=>{});return}this.disposed||this.adoptDeviceNode(a,e.id)}).catch(()=>{this.cancelledDeviceCreates.delete(a),this.pendingDeviceCreates.delete(a)}),a):a}adoptDeviceNode(e,t){this.pendingDeviceCreates.delete(e);let n=this.deviceNodes.get(e);if(!n)return;let r=this.deviceNodes.get(t);if(r&&r!==n){this.removeDeviceNode(e),this.selected?.kind===`device`&&this.selected.id===e&&this.setSelected({kind:`device`,id:t});return}this.deviceNodes.delete(e),n.twinId=t,this.deviceNodes.set(t,n);let i=this.scalables.get(`device:${e}`);this.scalables.delete(`device:${e}`),i&&(i.id=t,this.scalables.set(`device:${t}`,i));let a=this.pendingSaveTimers.get(e);this.pendingSaveTimers.delete(e),a&&this.pendingSaveTimers.set(t,a),this.pointerDrag?.kind===`device`&&this.pointerDrag.id===e&&(this.pointerDrag.id=t),this.selected?.kind===`device`&&this.selected.id===e&&this.setSelected({kind:`device`,id:t}),this.persistDeviceTransform(t)}async loadGltfToGroup(e,t,n){try{let r=await this.loadGltf(e),i=new o().setFromObject(r.scene),a=n/Math.max(.5,i.max.y-i.min.y);r.scene.scale.setScalar(a),r.scene.position.y=0,r.scene.traverse(e=>{e.isMesh&&(e.castShadow=!0)}),this.enhancePbrMaterials(r.scene,`device`),r.scene.traverse(e=>{e!==r.scene&&(e.matrixAutoUpdate=!1,e.updateMatrix())}),t.add(r.scene)}catch{}}enhancePbrMaterials(e,t){e.traverse(e=>{let n=e;if(!n.isMesh)return;n.receiveShadow=!0;let r=e=>{let n=e,r;if(n?.isMeshBasicMaterial){if(t===`device`&&/led|lamp|light/i.test(n.name??``)){let e=n.userData??={};return e.hdrBoost||=(n.color.multiplyScalar(4.5),!0),n}r=new E({map:n.map??null,color:n.color.clone().multiplyScalar(t===`character`?.38:.5),transparent:n.transparent,opacity:n.opacity,alphaTest:n.alphaTest,side:n.side,roughness:t===`character`?.92:.6,metalness:t===`character`?0:.25}),r.name=n.name??``,n.dispose()}else{let t=e;if(!t||!(`envMapIntensity`in t))return e;r=t}if(t===`character`)return r.envMapIntensity=.45,r.metalness>.3&&(r.metalness=0),r;if(r.transparent)return r.envMapIntensity=.42,r.emissive&&r.emissive.setScalar(Math.max(r.emissive.r,.06)),r;if(r.metalness>=.5)return r.envMapIntensity=.85,r;if(r.isMeshPhysicalMaterial){let e=r;return e.clearcoat=.35,e.clearcoatRoughness=.4,e.envMapIntensity=.7,e.needsUpdate=!0,e}let i=new m({color:r.color,map:r.map,normalMap:r.normalMap,roughnessMap:r.roughnessMap,aoMap:r.aoMap,emissive:r.emissive,emissiveMap:r.emissiveMap,emissiveIntensity:r.emissiveIntensity,roughness:Math.min(r.roughness,.55),metalness:r.metalness,clearcoat:.35,clearcoatRoughness:.4});return i.name=r.name,i.side=r.side,r.dispose(),i};n.material=Array.isArray(n.material)?n.material.map(r):r(n.material)}),this.dirty=!0}getDebugState(){return{blocks:this.blocks.size,agents:[...this.agents.values()].map(e=>({agentId:e.agentId,name:e.name,role:e.role,channelId:e.channelId,state:e.state,progress:e.progress,x:Math.round(e.root.position.x),y:Math.round(e.root.position.z),visible:!0,draggable:!0,auraColor:e.colorNum,behavior:e.behavior.mode,targetId:e.behavior.targetId,homeX:Math.round(e.homeX),homeY:Math.round(e.homeZ),textureKey:e.textureKey,modelRef:e.modelRef,decorated:!e.channelId,range:e.range?{x:Math.round(e.range.x),z:Math.round(e.range.z),radiusX:Math.round(e.range.radiusX),radiusZ:Math.round(e.range.radiusZ),shape:e.range.shape}:null,bubbleText:e.bubbleText,anim:e.animState})),bubbles:this.dbgBubbles.slice(-8),activity:this.lastActivity,player:{x:Math.round(this.camera.position.x),y:Math.round(this.camera.position.z)}}}getMinimapState(){let e=e=>e===`alarm`?16739179:e===`offline`?8689317:e===`running`?3530912:16172115;return{world:{w:D,h:N},blocks:[...this.blocks.values()].map(e=>({x:e.x/D,y:e.z/N,color:e.color,name:e.name,shape:e.shape,rx:e.radiusX/D,rz:e.radiusZ/N,rot:e.rotationY})),agents:[...this.agents.values()].map(e=>({x:e.root.position.x/D,y:e.root.position.z/N,color:e.colorNum,busy:e.state===`busy`})),devices:[...this.deviceNodes.values()].map(t=>({twinId:t.twinId,x:t.root.position.x/D,y:t.root.position.z/N,color:e(t.state),state:t.state,daq:t.modelRef.startsWith(`daq-`)||t.modelRef.includes(`daq`),bound:!1})),player:{x:this.camTarget.x/D,y:this.camTarget.z/N}}}getRecentActivity(){return[...this.recentActivity]}updateDeviceNode(e,t,n){let r=this.deviceNodes.get(e);r&&(t&&(r.state=t,r.updateRing()),n&&(r.telemetry={...r.telemetry,...n}),this.dirty=!0)}renameDevice(e,t){let n=this.deviceNodes.get(e);!n||!t.trim()||t.trim()===n.name||this.renameDeviceSprite(n,t)}swapDeviceModel(e,t){let n=this.deviceNodes.get(e);n&&this.swapDeviceModelSprite(n,t)}getDeviceName(e){return this.deviceNodes.get(e)?.name??``}getDeviceModelRef(e){return this.deviceNodes.get(e)?.modelRef??``}async removeDevice(e){if(this.deviceNodes.get(e)){if(this.pendingDeviceCreates.has(e)){this.cancelledDeviceCreates.add(e),this.removeDeviceNode(e);return}try{await this.devices?.remove?.(e)}catch{}this.removeDeviceNode(e)}}getDeviceNodes(){return[...this.deviceNodes.values()].map(e=>({twinId:e.twinId,name:e.name,x:Math.round(e.root.position.x),z:Math.round(e.root.position.z),topY:Math.round(this.deviceTopY(e)),state:e.state,telemetry:e.telemetry}))}setAnimPref(e,t){let n=this.agents.get(e);if(!n||n.clips.length===0||!n.mixer)return;let r=n.clips.findIndex(e=>e.name.toLowerCase().includes(t.toLowerCase()));r<0&&(r=t===`work`?n.clips.length-1:t===`walk`?Math.min(1,n.clips.length-1):0);let i=n.clips[r];i&&(n.mixer.stopAllAction(),n.mixer.clipAction(i).reset().play())}getAgentModel(e){return this.agents.get(e)?.modelRef??null}getAgentName(e){return this.agents.get(e)?.name??e.slice(0,8)}getAgentClips(e){let t=this.agents.get(e);return t?t.clips.map(e=>({name:e.name,duration:Math.round(e.duration*10)/10})):[]}pickAt(e,t){let n=null;for(let r of this.agents.values()){let i=Math.hypot(r.root.position.x-e,r.root.position.z-t);i<90&&(!n||i<n.d)&&(n={kind:`agent`,id:r.agentId,d:i})}for(let r of this.deviceNodes.values()){let i=Math.hypot(r.root.position.x-e,r.root.position.z-t);i<90&&(!n||i<n.d)&&(n={kind:`device`,id:r.twinId,d:i})}return n?{kind:n.kind,id:n.id}:null}pickChannel(e,t){for(let n of this.blocks.values()){let r={channelId:n.channelId,x:n.x,z:n.z,radiusX:n.radiusX,radiusZ:n.radiusZ,shape:n.shape,rotationY:n.rotationY};if(me(r,e,t))return n.channelId}return null}pickChannelEdge(e,t){for(let n of this.blocks.values()){let r=fe(n,e,t),i=Math.hypot(r.x/n.radiusX,r.z/n.radiusZ),a=42/Math.min(n.radiusX,n.radiusZ);if(Math.abs(i-1)<=a)return{cid:n.channelId,rx0:n.radiusX,rz0:n.radiusZ,rd0:i}}return null}setSelected(e){if((!e||e.kind!==`agent`||e.id!==this.rangeDrawAgent)&&this.cancelRangeDraw(),this.selected=e,this.tControls&&(e?.kind===`device`&&this.mode===`edit`&&this.deviceNodes.has(e.id)?this.tControls.attach(this.deviceNodes.get(e.id).root):this.tControls.detach()),this.refreshAgentRangeLines(),this.refreshAgentRangeHandles(),!e){this.emit(`select`,null);return}let t=this.scalables.get(`${e.kind}:${e.id}`);t&&this.emit(`select`,{kind:e.kind,id:e.id,scale:t.userScale,rotation:Math.round(this.getModelRotation(e.id,e.kind)*10)/10})}setModelScale(e,t,n){let r=n??(this.scalables.has(`device:${e}`)?`device`:`agent`),i=`${r}:${e}`,a=this.scalables.get(i);if(a){if(a.userScale=t,a.holder.scale.setScalar(a.userScale),r===`device`){let t=this.deviceNodes.get(e);t&&(t.topYCache=null)}this.dirty=!0}}getSelectedScale(){if(!this.selected)return null;let e=this.scalables.get(`${this.selected.kind}:${this.selected.id}`);return e?{kind:this.selected.kind,id:this.selected.id,scale:e.userScale,rotation:Math.round(this.getModelRotation(this.selected.id,this.selected.kind)*10)/10}:null}registerScalable(e,t,n,r){let i=r===void 0?typeof localStorage<`u`?Number(localStorage.getItem(`town.scale.${e}:${t}`)??1):1:r,a=Number.isFinite(i)&&i>0?i:1;if(this.scalables.set(`${e}:${t}`,{kind:e,id:t,userScale:a,holder:n}),n.scale.setScalar(a),e===`device`){let e=this.deviceNodes.get(t);e&&(e.topYCache=null)}}persistScale(e,t){let n=this.scalables.get(`${e}:${t}`);!n||typeof localStorage>`u`||(localStorage.setItem(`town.scale.${e}:${t}`,String(n.userScale)),e===`device`&&this.persistDeviceTransform(t))}setMode(e){if(this.mode!==e){this.mode=e,e===`browse`&&(this.pointerDrag&&this.endPointerDrag(),this.cancelRangeDraw(),this.setSelected(null),this.tControls?.detach()),this.refreshChannelHandles(),this.refreshAgentRangeHandles();for(let e of this.agents.values())e.renderRangeLine();this.dirty=!0}}getMode(){return this.mode}setSnap(e){this.snapEnabled=e}getSnap(){return this.snapEnabled}tryStartPointerDrag(e,t){if(this.mode!==`edit`||this.isGizmoBusy())return!1;let n=this.screenToWorld(e,t),r=this.pickAgentRangeHandle(n.x,n.z);if(r)return this.pointerDrag={kind:`agentRangeResize`,id:r.agentId,handle:r.handle},this.emitSaveState(`dirty`),!0;let i=this.pickResizeHandle(n.x,n.z);if(i)return this.pointerDrag={kind:`resize`,id:i.cid,handle:i.handle},this.setSelected(null),this.emitSaveState(`dirty`),!0;if(this.rangeDrawAgent)return this.pointerDrag={kind:`rangeDraw`,id:this.rangeDrawAgent,x0:n.x,z0:n.z},this.rangeDrawPreviewState=null,!0;let a=this.pickAt(n.x,n.z);if(a){if(a.kind===`device`)return this.deviceNodes.has(a.id)?(this.pointerDrag=a,this.setSelected(a),this.emitSaveState(`dirty`),!0):!1;let e=this.agents.get(a.id);return!e||!e.channelId?!1:(e.bubbleTimer&&=(clearTimeout(e.bubbleTimer),null),e.dragging=!0,e.behavior.mode=`idle`,e.behavior.targetId=null,this.pointerDrag=a,this.setSelected(a),this.emitSaveState(`dirty`),!0)}let o=this.hitAgentRangeBoundary(n.x,n.z);if(o&&o.range)return this.pointerDrag={kind:`agentRange`,id:o.agentId,dx:o.range.x-n.x,dz:o.range.z-n.z},this.setSelected({kind:`agent`,id:o.agentId}),this.emitSaveState(`dirty`),!0;let s=this.pickChannelEdge(n.x,n.z);if(s)return this.pointerDrag={kind:`channelEdge`,id:s.cid,rx0:s.rx0,rz0:s.rz0,rd0:s.rd0},this.setSelected(null),this.selectChannel(s.cid),this.emitSaveState(`dirty`),!0;if(this.pickBeacon(n.x,n.z))return!1;let c=this.pickChannel(n.x,n.z);if(c){let e=this.blocks.get(c);return e?(this.pointerDrag={kind:`channel`,id:c,dx:e.x-n.x,dz:e.z-n.z},this.setSelected(null),this.selectChannel(c),this.emitSaveState(`dirty`),!0):!1}return!1}isPointerDragging(){return this.pointerDrag!==null}snapWorld(e){return this.snapEnabled?Math.round(e/16)*16:Math.round(e*10)/10}movePointerDrag(e,t){if(!this.pointerDrag)return;let n=this.screenToWorld(e,t),r=this.snapWorld(n.x),i=this.snapWorld(n.z),a=this.pointerDrag;if(a.kind===`device`){let e=this.deviceNodes.get(a.id);e&&(e.root.position.x=r,e.root.position.z=i,this.dirty=!0)}else if(a.kind===`agent`){let e=this.agents.get(a.id);if(e){let t=r,n=i,a=this.blockLayout(e.channelId);if(a){let e=A(a,r,i,20);t=e.x,n=e.z}e.root.position.x=t,e.root.position.z=n,this.dirty=!0}}else if(a.kind===`rangeDraw`){let e=this.agents.get(a.id);if(!e)return;let t=this.blockLayout(e.channelId),r=n.x,i=n.z;if(t){let e=A(t,r,i,12);r=e.x,i=e.z}this.rangeDrawPreviewState={x0:a.x0,z0:a.z0,x1:r,z1:i},this.updateRangeDrawPreview(a.x0,a.z0,r,i),this.dirty=!0}else if(a.kind===`agentRange`){let e=this.agents.get(a.id);if(!e||!e.range)return;let t=r+a.dx,n=i+a.dz;e.range={...e.range,x:t,z:n},e.renderRangeLine(),this.refreshAgentRangeHandles(),this.dirty=!0}else if(a.kind===`agentRangeResize`){let e=this.agents.get(a.id);if(!e||!e.range)return;e.range=this.applyAgentRangeResize(e.range,a.handle,n.x,n.z),e.renderRangeLine(),this.refreshAgentRangeHandles(),this.autoFrameTo(e.range.radiusX,e.range.radiusZ),this.dirty=!0}else if(a.kind===`channel`){let e=this.blocks.get(a.id);e&&this.applyBlockMove(e,r+a.dx,i+a.dz)}else if(a.kind===`resize`){let e=this.blocks.get(a.id);e&&this.applyResize(e,a.handle,n.x,n.z)}else if(a.kind===`channelEdge`){let e=this.blocks.get(a.id);if(e){let t=fe(e,r,i),n=Math.hypot(t.x/a.rx0,t.z/a.rz0),o=a.rd0>.05?n/a.rd0:1;e.radiusX=Math.max(60,Math.round(a.rx0*o)),e.radiusZ=Math.max(40,Math.round(a.rz0*o)),this.applyLayoutToBlock(e),this.autoFrameTo(e.radiusX,e.radiusZ)}}}endPointerDrag(){if(!this.pointerDrag)return;let e=this.pointerDrag;if(this.pointerDrag=null,e.kind===`device`)this.deviceNodes.get(e.id)&&this.persistDeviceTransform(e.id);else if(e.kind===`agent`){let t=this.agents.get(e.id);t&&(t.homeX=t.root.position.x,t.homeZ=t.root.position.z,t.dragging=!1,this.emitSaveState(`saving`),this.agentApi?.updateHome(e.id,t.channelId,t.homeX,t.homeZ).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`)))}else if(e.kind===`rangeDraw`){let t=this.agents.get(e.id);if(t&&this.rangeDrawPreviewState){let n=this.rangeDrawPreviewState,r={x:(n.x0+n.x1)/2,z:(n.z0+n.z1)/2,radiusX:Math.abs(n.x1-n.x0)/2,radiusZ:Math.abs(n.z1-n.z0)/2,shape:`rect`,rotationY:0};if(r.radiusX>=40&&r.radiusZ>=40){t.range=r,t.renderRangeLine();let n=V(t.range,t.homeX,t.homeZ,0);(n.x!==t.homeX||n.z!==t.homeZ)&&(t.homeX=n.x,t.homeZ=n.z,t.root.position.x=n.x,t.root.position.z=n.z,this.agentApi?.updateHome(e.id,t.channelId,n.x,n.z).catch(()=>{})),this.emitSaveState(`saving`),this.agentApi?.updateRange(e.id,t.channelId,t.range).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`))}}this.cancelRangeDraw(),this.refreshAgentRangeHandles(),this.emitAgentRangeChanged(e.id)}else if(e.kind===`agentRange`||e.kind===`agentRangeResize`){let t=this.agents.get(e.id);t&&t.range&&(this.emitSaveState(`saving`),this.agentApi?.updateRange(e.id,t.channelId,t.range).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`))),this.refreshAgentRangeHandles(),this.emitAgentRangeChanged(e.id)}else if(this.blocks.get(e.id)){this.clampAgentsToBoundary(e.id),this.refreshChannelHandles();let t=this.getChannelLayout(e.id);t&&(this.emitSaveState(`saving`),this.channelApi?.save(e.id,t).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`)),this.emit(`channelResized`,{channelId:e.id,layout:t}))}}rangeLineVisible(e){return this.mode===`edit`||this.selected?.kind===`agent`&&this.selected.id===e.agentId}emitAgentRangeChanged(e){this.emit(`agentRangeChanged`,{agentId:e})}refreshAgentRangeLines(){for(let e of this.agents.values())e.rangeLine&&(e.rangeLine.visible=this.rangeLineVisibleFor(e))}rangeLineVisibleFor(e){return this.mode===`edit`||this.selected?.kind===`agent`&&this.selected.id===e.agentId}refreshAgentRangeHandles(){for(let e of this.agentRangeHandles)e.mesh.visible=!1;if(this.mode!==`edit`||!this.selected||this.selected.kind!==`agent`)return;let e=this.agents.get(this.selected.id);if(!e||!e.range)return;let t=e.range.rotationY*Math.PI/180,n=this.boundaryHandlePoints(e.range);for(let r=0;r<this.agentRangeHandles.length&&r<n.length;r++){let[i,a]=n[r],o=e.range.x+i*Math.cos(t)-a*Math.sin(t),s=e.range.z+i*Math.sin(t)+a*Math.cos(t);this.agentRangeHandles[r].agentId=e.agentId,this.agentRangeHandles[r].mesh.position.set(o,1.2,s),this.agentRangeHandles[r].mesh.visible=!0}}pickAgentRangeHandle(e,t){if(this.mode!==`edit`)return null;for(let n of this.agentRangeHandles)if(n.mesh.visible&&Math.hypot(n.mesh.position.x-e,n.mesh.position.z-t)<40)return{agentId:n.agentId,handle:n.handle};return null}hitAgentRangeBoundary(e,t){if(this.mode===`edit`){for(let n of this.agents.values())if(!(!n.range||!n.channelId)&&de(n.range,e,t)<26)return n}}applyAgentRangeResize(e,t,n,r){let i=-e.rotationY*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=n-e.x,c=r-e.z,l=s*a-c*o,u=s*o+c*a,d;return d=e.shape===`rect`?{...e,radiusX:Math.max(30,Math.abs(l)),radiusZ:Math.max(30,Math.abs(u))}:t===0||t===1?{...e,radiusX:Math.max(30,Math.abs(l))}:{...e,radiusZ:Math.max(30,Math.abs(u))},d}updateRangeDrawPreview(e,t,n,r){let i=Math.min(e,n),a=Math.max(e,n),o=Math.min(t,r),s=Math.max(t,r),c=(i+a)/2,l=(o+s)/2,u=Math.max(8,(a-i)/2),d=Math.max(8,(s-o)/2);if(!this.rangeDrawLine){let e=$(`rect`,1,1,4311284);e.material.opacity=.95,e.position.y=.5,this.scene.add(e),this.rangeDrawLine=e}this.rangeDrawLine.position.set(c,.5,l),this.rangeDrawLine.rotation.y=0;let f=new w().setFromPoints([new C(-u,0,-d),new C(u,0,-d),new C(u,0,d),new C(-u,0,d)]);this.rangeDrawLine.geometry.dispose(),this.rangeDrawLine.geometry=f}cancelRangeDraw(){this.rangeDrawAgent===null&&!this.rangeDrawLine||(this.rangeDrawAgent=null,this.rangeDrawPreviewState=null,this.rangeDrawLine&&=(this.scene.remove(this.rangeDrawLine),null),this.dirty=!0)}startRangeDraw(e){let t=this.agents.get(e);!t||!t.channelId||this.mode!==`edit`||(this.setSelected({kind:`agent`,id:e}),this.cancelRangeDraw(),this.rangeDrawAgent=e,this.rangeDrawPreviewState=null,this.refreshAgentRangeHandles(),this.dirty=!0)}isRangeDrawing(e){return this.rangeDrawAgent?e===void 0||this.rangeDrawAgent===e:!1}debugAdvanceReceiver(e){let t=this.receivers.get(e);t&&(t.currentUntil=0)}getAgentRange(e){return this.agents.get(e)?.range??null}setAgentRangeScene(e,t){let n=this.agents.get(e);if(!n)return;n.range||={x:n.homeX,z:n.homeZ,radiusX:120,radiusZ:90,shape:`ellipse`,rotationY:0},n.range={...n.range,...t};let r=V(n.range,n.homeX,n.homeZ,0);(r.x!==n.homeX||r.z!==n.homeZ)&&(n.homeX=r.x,n.homeZ=r.z,n.root.position.x=r.x,n.root.position.z=r.z,this.rangeHomeMoved={agentId:e,x:r.x,z:r.z}),n.renderRangeLine(),this.refreshAgentRangeHandles(),this.dirty=!0}commitAgentRange(e){let t=this.agents.get(e);if(t){if(this.rangeHomeMoved?.agentId===e){let{x:n,z:r}=this.rangeHomeMoved;this.rangeHomeMoved=null,this.agentApi?.updateHome(e,t.channelId,n,r).catch(()=>{})}this.emitSaveState(`saving`),this.agentApi?.updateRange(e,t.channelId,t.range).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`)),this.emitAgentRangeChanged(e)}}clearAgentRange(e){let t=this.agents.get(e);t&&(t.rangeLine&&=(this.scene.remove(t.rangeLine),null),t.range=null,this.rangeHomeMoved=null,this.refreshAgentRangeHandles(),this.emitSaveState(`saving`),this.agentApi?.updateRange(e,t.channelId,null).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`)),this.emitAgentRangeChanged(e),this.dirty=!0)}setModelRotation(e,t,n){if((n??(this.deviceNodes.has(e)?`device`:`agent`))===`device`){let n=this.deviceNodes.get(e);if(!n)return;n.root.rotation.y=t*Math.PI/180}else{let n=this.agents.get(e);if(!n)return;n.root.rotation.y=t*Math.PI/180}this.dirty=!0}getModelRotation(e,t){if((t??(this.deviceNodes.has(e)?`device`:`agent`))===`device`){let t=this.deviceNodes.get(e);return t?T.radToDeg(t.root.rotation.y):0}let n=this.agents.get(e);return n?T.radToDeg(n.root.rotation.y):0}emitSaveState(e,t=Date.now()){this.emit(`saveState`,{state:e,at:t})}persistDeviceTransform(e){let t=this.deviceNodes.get(e);if(!t||!this.devices?.update||this.pendingDeviceCreates.has(e))return;let n=this.scalables.get(`device:${e}`),r=this.pendingSaveTimers.get(e);r&&clearTimeout(r),this.pendingSaveTimers.set(e,setTimeout(()=>{this.pendingSaveTimers.delete(e),!(this.disposed||this.pendingDeviceCreates.has(e))&&(this.emitSaveState(`saving`),this.devices.update(e,{posX:Math.round(t.root.position.x*10)/10,posZ:Math.round(t.root.position.z*10)/10,rotationY:Math.round(T.radToDeg(t.root.rotation.y)*10)/10,scale:n?Math.round(n.userScale*100)/100:void 0}).then(()=>this.emitSaveState(`saved`,Date.now())).catch(()=>this.emitSaveState(`error`)))},350)),this.emitSaveState(`dirty`)}persistAllDevices(){for(let e of[...this.deviceNodes.keys()])this.persistDeviceTransform(e)}pendingSaveTimers=new Map;syncDevices(e){let t=new Set(e.map(e=>e.id));for(let e of[...this.deviceNodes.keys()])!t.has(e)&&!this.pendingDeviceCreates.has(e)&&this.removeDeviceNode(e);for(let t of e){let e=this.deviceNodes.get(t.id);if(!e){let n=[...this.pendingDeviceCreates.entries()].find(([,e])=>e.name===t.name&&e.modelRef===t.modelRef);n&&(this.adoptDeviceNode(n[0],t.id),e=this.deviceNodes.get(t.id))}if(!e){(t.kind===`daq`||(t.modelRef??``).startsWith(`daq-`)||(t.modelRef??``).startsWith(`dcw-`)||this.resolveDeviceModel(t.modelRef)?.file)&&typeof t.posX==`number`&&typeof t.posZ==`number`?this.recreateDeviceNode(t):this.pendingDeviceTwins.set(t.id,t);continue}if(this.pendingDeviceTwins.delete(t.id),e.applyTwin(t),this.pointerDrag?.id!==t.id){let n=typeof t.posX==`number`&&t.posX!==e.root.position.x||typeof t.posZ==`number`&&t.posZ!==e.root.position.z;typeof t.posX==`number`&&(e.root.position.x=t.posX),typeof t.posZ==`number`&&(e.root.position.z=t.posZ),typeof t.rotationY==`number`&&(e.root.rotation.y=t.rotationY*Math.PI/180);let r=this.scalables.get(`device:${t.id}`);typeof t.scale==`number`&&r&&(r.userScale=t.scale,r.holder.scale.setScalar(t.scale)),n&&(this.dirty=!0)}this.dirty=!0}this.daqLinksWanted.length&&this.syncDaqLinks(this.daqLinksWanted);for(let e of[...this.pendingDeviceTwins.keys()])t.has(e)||this.pendingDeviceTwins.delete(e)}resolveDeviceModel(e){let t=this.modelsById.get(e);if(t?.file)return{id:t.id,file:t.file,hFactor:t.hFactor??1};for(let[t,n]of this.modelsById)if(!(n.kind!==`dev`||!n.file)&&(t===`dev-folder-${e}`||t.endsWith(`-${e}`)))return{id:t,file:n.file,hFactor:n.hFactor??1};return null}recreateDeviceNode(e){if(e.kind===`daq`||(e.modelRef??``).startsWith(`daq-`)||(e.modelRef??``).startsWith(`dcw-`)){this.recreateDaqNode(e);return}let t=this.resolveDeviceModel(e.modelRef),n=t?.file??``;if(!n)return;let r=typeof e.posX==`number`?e.posX:R,i=typeof e.posZ==`number`?e.posZ:B,a=new g;a.position.set(r,0,i),a.rotation.y=typeof e.rotationY==`number`?e.rotationY*Math.PI/180:0;let{ring:o,arc:s}=this.makeDeviceRing();a.add(o,s);let c=new g;a.add(c);let l=this.makeLabel(`⚙ ${e.name}`,r,60,i);c.userData.modelFile=n,this.scene.add(a);let u=new bt({twinId:e.id,name:e.name,modelRef:e.modelRef,root:a,holder:c,ring:o,label:l,state:e.state??`idle`,telemetry:e.telemetry??{}});u.host=this,u.arc=s,u.updateRing(),this.deviceNodes.set(e.id,u),this.registerScalable(`device`,e.id,c,typeof e.scale==`number`?e.scale:void 0),this.loadGltfToGroup(n,c,192*(t?.hFactor??1)),this.dirty=!0}makeDaqMesh(e){let t=new g,n=new E({color:10465992,metalness:.85,roughness:.32}),r=new E({color:7636636,metalness:.35,roughness:.5}),i=new E({color:5596282,metalness:.4,roughness:.55}),a=new E({color:2831426,metalness:.7,roughness:.45}),o=new E({color:14674162,metalness:1,roughness:.14}),s=new E({color:12941893,metalness:.9,roughness:.35}),c=new z({color:4311284});c.color.multiplyScalar(5);let l=(e,t,n,r)=>{let i=new h(new H(e*34,t*34,n*34),r);return i.castShadow=!0,i},u=(e,t,n,r,i=20)=>{let a=new h(new _(e*34,t*34,n*34,i),r);return a.castShadow=!0,a},d=(e,n,r,i)=>(e.position.set(n*34,r*34,i*34),t.add(e),e);d(u(.17,.22,.09,a),0,.045,0),d(u(.028,.028,.95,n,10),0,.55,0);let f=new h(new W(3.06,.68,10,28),new z({color:3530912}));if(f.material.color.multiplyScalar(6),f.rotation.x=Math.PI/2,t.add(f),f.position.y=34.68,e.endsWith(`temp-tc`)){d(l(.24,.32,.24,r),0,1.2,0);let e=d(u(.014,.014,.4,n,8),.14,.85,0);e.rotation.z=-.5}else if(e.endsWith(`pressure-tx`))d(u(.13,.16,.3,n),0,1.22,0),d(u(.12,.12,.05,a),0,1.4,0),d(l(.05,.05,.2,s),0,1.1,.2);else if(e.endsWith(`tension-cell`)){d(l(.34,.2,.2,r),0,1.25,0);for(let e of[-.11,.11]){let t=d(u(.06,.06,.26,o),e,1.25,0);t.rotation.x=Math.PI/2}}else if(e.endsWith(`line-encoder`)){d(l(.34,.05,.05,n),.14,1.28,0);let e=d(u(.16,.16,.05,a),.32,1.28,0);e.rotation.z=Math.PI/2,d(new h(new W(.1*34,.51,10,26),f.material),.35,1.28,0)}else if(e.endsWith(`vision-cam`)){d(l(.28,.2,.36,i),0,1.3,0);let e=d(u(.07,.09,.14,a),0,1.3,.24);e.rotation.x=Math.PI/2,d(new h(new W(2.55,.012*34,10,24),f.material),0,1.3,.3)}else e.endsWith(`power-meter`)&&(d(l(.32,.42,.18,r),0,1.3,0),d(u(.012,.012,.42,n,8),.1,1.7,0),d(new h(new M(.028*34,10,8),f.material),.1,1.92,0),d(l(.2,.06,.02,c),0,1.42,.1));return{group:t,ledRing:f}}recreateDaqNode(e){let t=typeof e.posX==`number`?e.posX:R,n=typeof e.posZ==`number`?e.posZ:B,r=new g;r.position.set(t,0,n),r.rotation.y=typeof e.rotationY==`number`?e.rotationY*Math.PI/180:0;let{group:i,ledRing:a}=this.makeDaqMesh(e.modelRef);r.add(i);let o=new h(new k(16,21,36),new z({color:3530912,transparent:!0,opacity:.5,side:2,depthWrite:!1}));o.rotation.x=-Math.PI/2,o.position.y=.35,r.add(o);let s=new h(new k(24,34,48),new z({color:3530912,transparent:!0,opacity:.16,side:2,depthWrite:!1,blending:2}));s.rotation.x=-Math.PI/2,s.position.y=.28,r.add(s);let c=e.lineColor||`#35e0a0`,l=this.makeLabel(e.name,t,62,n,c);this.scene.add(r);let u=new bt({twinId:e.id,name:e.name,modelRef:e.modelRef,root:r,holder:r,ring:o,label:l,state:e.state??`running`,telemetry:e.telemetry??{}});u.host=this,u.lineColor=e.lineColor??``,u.applyLine=e=>{let t=new F(e||`#35e0a0`);o.material.color.copy(t),s.material.color.copy(t),a.material.color.copy(t).multiplyScalar(6),this.scene.remove(l),l.material.dispose();let n=this.makeLabel(u.name,r.position.x,62,r.position.z,e||`#35e0a0`);u.label=n,this.scene.add(n),this.dirty=!0},e.lineColor&&u.applyLine(e.lineColor),u.updateRing(),this.deviceNodes.set(e.id,u),this.daqLedRings.set(e.id,a),this.registerScalable(`device`,e.id,r,typeof e.scale==`number`?e.scale:void 0),this.dirty=!0}removeDeviceNode(e){let t=this.deviceNodes.get(e);t&&(this.scene.remove(t.root),this.scene.remove(t.label),this.disposeDeviceAssets(t),this.selected?.kind===`device`&&this.selected.id===e&&this.setSelected(null),this.scalables.delete(`device:${e}`),this.deviceNodes.delete(e),this.daqLedRings.delete(e),this.daqLinkSig=``,this.filmWebSig=``,this.dirty=!0)}deviceTopY(e){if(e.topYCache!=null)return e.topYCache;let t=new o().setFromObject(e.holder),n=Number.isFinite(t.max.y)?Math.max(40,t.max.y):64;return e.topYCache=n,n}syncDaqLinks(e){this.daqLinksWanted=e;let t=e.filter(e=>this.deviceNodes.has(e.daqId)&&this.deviceNodes.has(e.deviceId)),n=t.map(e=>`${e.daqId}>${e.deviceId}`).sort().join(`|`);if(n!==this.daqLinkSig){this.daqLinkSig=n;for(let e of this.daqLinks)this.daqLinkGroup.remove(e.line),this.daqLinkGroup.remove(e.pulse),e.line.geometry.dispose();this.daqLinks=[];for(let e of t){let t=this.deviceNodes.get(e.daqId),n=this.deviceNodes.get(e.deviceId),r=new C(t.root.position.x,42,t.root.position.z),i=new C(n.root.position.x,this.deviceTopY(n)+6,n.root.position.z),o=r.clone().add(i).multiplyScalar(.5);o.y=Math.max(r.y,i.y)+42;let s=new Ce(r,o,i),c=new w().setFromPoints(s.getPoints(28)),l=new a(c,new f({color:3530912,transparent:!0,opacity:.55,dashSize:8,gapSize:5}));l.computeLineDistances();let u=new h(new M(2.6,10,8),new z({color:4311284}));u.material.color.multiplyScalar(5),this.daqLinkGroup.add(l,u),this.daqLinks.push({...e,line:l,pulse:u,curve:s,pt:Math.random(),ptSig:``})}this.dirty=!0}}static _lkA=new C;static _lkB=new C;static _lkM=new C;refreshDaqLinks(){for(let e of this.daqLinks){let n=this.deviceNodes.get(e.daqId),r=this.deviceNodes.get(e.deviceId);if(!n||!r)continue;let i=this.deviceTopY(r)+6,a=`${Math.round(n.root.position.x)},${Math.round(n.root.position.z)},${Math.round(r.root.position.x)},${Math.round(r.root.position.z)},${Math.round(i)}`;if(a===e.ptSig)continue;e.ptSig=a;let o=t._lkA.set(n.root.position.x,42,n.root.position.z),s=t._lkB.set(r.root.position.x,i,r.root.position.z),c=t._lkM.copy(o).add(s).multiplyScalar(.5);c.y=Math.max(o.y,s.y)+42,e.curve.v0.copy(o),e.curve.v1.copy(c),e.curve.v2.copy(s);let l=e.curve.getPoints(28);e.line.geometry.setFromPoints(l),e.line.computeLineDistances()}}isLineDevice(e){let t=e.toLowerCase();return/extruder|caster|mdo|tdo|winder/.test(t)}rebuildFilmWeb(){let e=[...this.deviceNodes.values()].filter(e=>this.isLineDevice(e.modelRef)&&!e.modelRef.startsWith(`daq-`)).sort((e,t)=>e.root.position.x-t.root.position.x),t=e.map(e=>`${e.twinId}:${Math.round(e.root.position.x)},${Math.round(e.root.position.z)}`).join(`|`);if(t!==this.filmWebSig){for(this.filmWebSig=t;this.filmWebGroup.children.length;){let e=this.filmWebGroup.children[0];this.filmWebGroup.remove(e),e.geometry.dispose()}this.filmWebMat||=new E({color:11196671,metalness:.1,roughness:.35,transparent:!0,opacity:.28,emissive:2845583,emissiveIntensity:.25,side:2,depthWrite:!1});for(let t=0;t<e.length-1;t++){let n=e[t].root.position,r=e[t+1].root.position,i=Math.abs(r.x-n.x)-110;if(i<30)continue;let a=new h(new H(i,1.2,46),this.filmWebMat);a.position.set((n.x+r.x)/2,48,(n.z+r.z)/2),this.filmWebGroup.add(a)}this.dirty=!0}}loop(){let e=()=>{if(this.disposed)return;this.raf=requestAnimationFrame(e),this.rafCount+=1;let t=this.clock.getDelta();if(this.frameBudgetMs>0){if(this.frameAcc+=t*1e3,this.frameAcc<this.frameBudgetMs-.5)return;this.frameAcc=0}let n=Math.min(t,.1),r=this.clock.elapsedTime;this.drainReceivers(performance.now());for(let e of this.agents.values())e.state!==`stopped`&&!e.dragging&&e.update(n);for(let e of this.agents.values())e.mixer&&e.mixer.update(n);for(let e of this.blocks.values())e.beacon.rotation.y+=n*.4;for(let e of this.agents.values())if(e.nameSprite.position.set(e.root.position.x,48,e.root.position.z),e.bubble&&e.bubble.position.set(e.root.position.x,108+Math.max(0,e.model.scale.y-1)*22,e.root.position.z),e.auraMats.length){let t=.8+.2*Math.sin(r*2.2+e.auraPhase);for(let n of e.auraMats)n.opacity=n.userData.baseOp*t}for(let e of this.deviceNodes.values())e.label.position.set(e.root.position.x,60,e.root.position.z),e.arc?.visible&&(e.arc.rotation.z+=n*1.6);for(let e of this.daqLedRings.values()){e.rotation.z+=n*1.2;let t=1+Math.sin(r*3.2)*.08;e.scale.setScalar(t)}if(this.daqLinks.length){this.dirty&&this.refreshDaqLinks();for(let e of this.daqLinks)e.pt=(e.pt+n*.3)%1,e.pulse.position.copy(e.curve.getPoint(e.pt))}if(this.dirty&&this.rebuildFilmWeb(),this.selRing){let e=this.selected,t=0,r=0,i=0;if(e?.kind===`agent`){let n=this.agents.get(e.id);n&&(t=n.root.position.x,r=n.root.position.z,i=46*Math.max(.6,n.model.scale.y))}else if(e?.kind===`device`){let n=this.deviceNodes.get(e.id);n&&(t=n.root.position.x,r=n.root.position.z,i=Math.max(34,this.deviceTopY(n)*.42))}this.selRing.visible=i>0,i>0&&(this.selRing.position.set(t,.5,r),this.selRing.scale.setScalar(i),this.selRing.rotation.z+=n*.9)}let i=this.rafAnims;this.rafAnims=[];for(let e of i)e();let a=1-Math.exp(-n*7.2);this.autoDolly!==null&&(this.dolly+=(this.autoDolly-this.dolly)*a,Math.abs(this.autoDolly-this.dolly)<.01&&(this.autoDolly=null));let o=1-Math.exp(-n*4.8);for(let e of[`yaw`,`pitch`,`radius`])this.viewCur[e]+=(this.viewTarget[e]-this.viewCur[e])*o;this.autoOrbit&&!this.pointerDrag&&(this.viewCur.yaw-=n*.156,this.viewTarget.yaw=this.viewCur.yaw);let s=this.viewCur.radius*this.dolly,c=Math.cos(this.viewCur.pitch);this.camera.position.set(this.camTarget.x+s*c*Math.sin(this.viewCur.yaw),20+s*Math.sin(this.viewCur.pitch),this.camTarget.z+s*c*Math.cos(this.viewCur.yaw)),this.camera.lookAt(this.camTarget.x,20,this.camTarget.z);let l=Math.max(.05,1.2*this.dolly),u=16e3*this.dolly;(Math.abs(this.camera.near-l)>.005||Math.abs(this.camera.far-u)>1)&&(this.camera.near=l,this.camera.far=u,this.camera.updateProjectionMatrix()),this.skyDome&&(this.skyDome.position.set(this.camTarget.x,0,this.camTarget.z),this.skyDome.scale.setScalar(Math.max(1,this.dolly*1.3))),this.ground.position.set(this.camTarget.x,0,this.camTarget.z);let d=this.ground.material.map;d&&d.offset.set(this.camTarget.x/(D*16/d.repeat.x),-this.camTarget.z/(N*16/d.repeat.y));let f=this.scene.fog;f instanceof p&&(f.near=1400*this.dolly,f.far=8800*this.dolly);let m=this.keyLight.shadow.camera,h=1600*Math.max(1,this.dolly);Math.abs(m.right-h)>1&&(m.left=-h,m.right=h,m.top=2300*Math.max(1,this.dolly),m.bottom=-2300*Math.max(1,this.dolly),m.updateProjectionMatrix(),this.renderer.shadowMap.needsUpdate=!0);let g=!1;for(let e of this.agents.values())if(e.mixer){g=!0;break}this.renderer.shadowMap.needsUpdate=this.dirty||g,this.renderer.info.reset(),this.composer.render(n),this.dirty=!1,this.frameCount+=1;let _=performance.now();if(this.fpsWinT0===0&&(this.fpsWinT0=_),_-this.fpsWinT0>=1e3){let e=Math.round(this.frameCount*1e3/(_-this.fpsWinT0));this.emit(`fps`,e),this.adaptQuality(e);let t=this.renderer.info;globalThis.__townStats={fps:e,rafHz:this.rafCount,drawCalls:t.render.calls,triangles:t.render.triangles,geometries:t.memory.geometries,textures:t.memory.textures,tier:this.qTier,dpr:+this.renderer.getPixelRatio().toFixed(2),frameBudgetMs:+this.frameBudgetMs.toFixed(2),agents:this.agents.size,devices:this.deviceNodes.size},this.frameCount=0,this.rafCount=0,this.fpsWinT0=_}};e()}static Q_TIERS=[{scale:1,shadow:2048,bloom:!0},{scale:.8,shadow:2048,bloom:!0},{scale:.65,shadow:1024,bloom:!0},{scale:.55,shadow:1024,bloom:!1}];qTier=0;qLowStreak=0;qHighStreak=0;qualityMode=`auto`;static USER_QUALITY={ultra:{scale:1,shadow:2048,bloom:!0},hd:{scale:.8,shadow:2048,bloom:!0},normal:{scale:.6,shadow:1024,bloom:!0}};setQualityMode(e){if(this.qualityMode=e,e===`auto`){this.applyQuality();return}let n=t.USER_QUALITY[e];this.applyPixelRatio(Math.max(.5,this.baseDpr*n.scale));let r=this.keyLight;(r.shadow.mapSize.x??0)!==n.shadow&&(r.shadow.mapSize.set(n.shadow,n.shadow),r.shadow.map?.dispose(),r.shadow.map=null,this.renderer.shadowMap.needsUpdate=!0);let i=this.composer.passes.find(e=>e instanceof ht);i&&(i.enabled=n.bloom)}adaptQuality(e){if(this.qualityMode!==`auto`)return;let n=t.Q_TIERS.length-1;e<17&&this.qTier<n?++this.qLowStreak>=2&&(this.qTier++,this.applyQuality(),this.qLowStreak=0,this.qHighStreak=0):e>=27&&this.qTier>0?++this.qHighStreak>=4&&(this.qTier--,this.applyQuality(),this.qHighStreak=0,this.qLowStreak=0):(this.qLowStreak=0,this.qHighStreak=0)}applyQuality(){let e=t.Q_TIERS[this.qTier];this.applyPixelRatio(Math.max(.5,this.baseDpr*e.scale));let n=this.keyLight;(n.shadow.mapSize.x??0)!==e.shadow&&(n.shadow.mapSize.set(e.shadow,e.shadow),n.shadow.map?.dispose(),n.shadow.map=null,this.renderer.shadowMap.needsUpdate=!0);let r=this.composer.passes.find(e=>e instanceof ht);r&&(r.enabled=e.bloom)}applyPixelRatio(e){this.renderer.setPixelRatio(e),this.composer.setPixelRatio(e);let t=this.el.clientWidth||1100,n=this.el.clientHeight||700;this.renderer.setSize(t,n),this.composer.setSize(t,n)}disposeCanvasTextures(e){e&&e.traverse(e=>{let t=e.material,n=Array.isArray(t)?t:t?[t]:[];for(let e of n){let t=e;t.map&&t.map.image instanceof HTMLCanvasElement&&t.map.dispose(),e.dispose()}})}disposeDeviceAssets(e){e.ring.geometry.dispose(),e.ring.material.dispose(),e.arc&&(e.arc.geometry.dispose(),e.arc.material.dispose()),this.disposeCanvasTextures(e.label)}disposeAgentAssets(e){this.disposeCanvasTextures(e.nameSprite??null),this.disposeCanvasTextures(e.bubble??null),e.rangeLine?.geometry.dispose(),e.aura&&=(e.aura.traverse(e=>{let t=e;t.isMesh&&(t.geometry.dispose(),t.material.dispose())}),null)}resetAll(){for(let e of this.agents.values())this.scene.remove(e.root),e.nameSprite&&this.scene.remove(e.nameSprite),e.bubble&&this.scene.remove(e.bubble),e.rangeLine&&this.scene.remove(e.rangeLine),this.disposeAgentAssets(e);for(let e of this.blocks.values())this.scene.remove(e.platform),this.scene.remove(e.padRing),this.scene.remove(e.beacon),this.scene.remove(e.boundary),this.scene.remove(e.label),this.disposeCanvasTextures(e.label);for(let e of this.deviceNodes.values())this.scene.remove(e.root),this.scene.remove(e.label),this.disposeDeviceAssets(e);this.deviceNodes.clear(),this.scalables.clear(),this.receivers.clear(),this.pointerDrag=null,this.cancelRangeDraw(),this.selected=null,this.selectedChannel=null;for(let e of this.resizeHandles)e.mesh.visible=!1;for(let e of this.agentRangeHandles)e.mesh.visible=!1;this.agents.clear(),this.blocks.clear()}dispose(){this.disposed=!0,cancelAnimationFrame(this.raf),delete globalThis.__townScene3d;for(let e of this.pendingSaveTimers.values())clearTimeout(e);this.pendingSaveTimers.clear(),this.receivers.clear(),this.resizeOb?.disconnect(),this.resizeOb=null,this.tControls?.dispose(),this.tControls=null,this.composer?.dispose(),this.renderer.dispose(),this.renderer.domElement.parentElement===this.el&&this.renderer.domElement.remove()}};export{xt as TownScene3D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ft as e}from"./BSCpFtzG.js";import{t}from"./G0qIw7Gq2.js";import{t as n}from"./36oeS8_R2.js";import{i as r}from"./BgCrZKv_2.js";var i=40,a=(e,t)=>r({base:`/api/workshop/ops-logs`,path:e,init:t});function o(e){return{id:0,actor:e.actor,actorName:e.actorName||e.actor,actorKind:e.actorKind,action:e.action,targetKind:e.targetKind,targetId:e.targetId,detailJson:``,at:e.at,lineId:e.lineId,productId:e.productId,recipeId:e.recipeId,kind:e.kind,summary:e.summary}}var s=()=>{let r=e([]),s=e([]),c=e({list:!1,posting:!1}),l=e({list:``,post:``}),u=0,d=null;function f(){u++,u===1&&(m(),d=n().subscribe(p));let e=!1;return()=>{e||(e=!0,--u===0&&(d?.(),d=null))}}function p(e){if(e.type===`ops.log`){let t=o(e.payload);r.some(e=>e.at===t.at&&e.actor===t.actor&&e.action===t.action)||(r.unshift(t),r.length>i&&r.splice(i))}}async function m(){try{let e=await a(`?limit=15`);for(let t of(e.logs??[]).reverse())r.some(e=>e.at===t.at&&e.actor===t.actor&&e.action===t.action)||r.unshift(t)}catch{}}async function h(e={}){c.list=!0,l.list=``;try{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=await a(`?${t.toString()}`);s.splice(0,s.length,...n.logs??[])}catch(e){l.list=t(e)}finally{c.list=!1}}async function g(e){c.posting=!0,l.post=``;try{await a(``,{method:`POST`,body:JSON.stringify(e)})}catch(e){throw l.post=t(e),e}finally{c.posting=!1}}return e({recent:r,results:s,loading:c,error:l,ensureLive:f,fetchLogs:h,postManual:g})},c=`__opsLogStream`;function l(){let e=globalThis;return e[c]||(e[c]=s()),e[c]}export{l as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,M as t,O as n,U as r,a as i,et as a,f as o,gt as s,mt as c,tt as l,x as u}from"./BSCpFtzG.js";import{At as d,B as f,Ct as p,O as m,Q as h,Tt as g,X as _,Y as v,Z as y,d as b,h as x,kt as S,n as C,p as w,t as T,tt as E,u as D}from"./BDUjyaF4.js";import{$ as O,c as k,l as A}from"./DtBu71ev.js";import{t as ee}from"./BfGc7TJp.js";import{I as j,K as te,d as M,i as N,p as P,z as ne}from"./VLI2Zy4t.js";import{p as re}from"./D-Ca4BGY.js";import{
|
|
1
|
+
import{C as e,M as t,O as n,U as r,a as i,et as a,f as o,gt as s,mt as c,tt as l,x as u}from"./BSCpFtzG.js";import{At as d,B as f,Ct as p,O as m,Q as h,Tt as g,X as _,Y as v,Z as y,d as b,h as x,kt as S,n as C,p as w,t as T,tt as E,u as D}from"./BDUjyaF4.js";import{$ as O,c as k,l as A}from"./DtBu71ev.js";import{t as ee}from"./BfGc7TJp.js";import{I as j,K as te,d as M,i as N,p as P,z as ne}from"./VLI2Zy4t.js";import{p as re}from"./D-Ca4BGY.js";import{k as ie}from"./Cn3J3NXR.js";var ae=/\s/;function oe(e){for(var t=e.length;t--&&ae.test(e.charAt(t)););return t}var se=/^\s+/;function ce(e){return e&&e.slice(0,oe(e)+1).replace(se,``)}var F=NaN,le=/^[-+]0x[0-9a-f]+$/i,ue=/^0b[01]+$/i,de=/^0o[0-7]+$/i,fe=parseInt;function I(e){if(typeof e==`number`)return e;if(ie(e))return F;if(j(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=j(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=ce(e);var n=ue.test(e);return n||de.test(e)?fe(e.slice(2),n?2:8):le.test(e)?F:+e}var L=function(){return ne.Date.now()},R=`Expected a function`,z=Math.max,B=Math.min;function pe(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(R);t=I(t)||0,j(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?z(I(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?B(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=L();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(L())}function x(){var e=L(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}var me=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},he={prefixCls:String,name:String,id:String,type:String,defaultChecked:{type:[Boolean,Number],default:void 0},checked:{type:[Boolean,Number],default:void 0},disabled:Boolean,tabindex:{type:[Number,String]},readonly:Boolean,autofocus:Boolean,value:T.any,required:Boolean},V=e({compatConfig:{MODE:3},name:`Checkbox`,inheritAttrs:!1,props:ee(he,{prefixCls:`rc-checkbox`,type:`checkbox`,defaultChecked:!1}),emits:[`click`,`change`],setup(e,t){let{attrs:n,emit:r,expose:i}=t,o=c(e.checked===void 0?e.defaultChecked:e.checked),s=c();a(()=>e.checked,()=>{o.value=e.checked}),i({focus(){var e;(e=s.value)==null||e.focus()},blur(){var e;(e=s.value)==null||e.blur()}});let l=c(),f=t=>{if(e.disabled)return;e.checked===void 0&&(o.value=t.target.checked),t.shiftKey=l.value;let n={target:S(S({},e),{checked:t.target.checked}),stopPropagation(){t.stopPropagation()},preventDefault(){t.preventDefault()},nativeEvent:t};e.checked!==void 0&&(s.value.checked=!!e.checked),r(`change`,n),l.value=!1},m=e=>{r(`click`,e),l.value=e.shiftKey};return()=>{let{prefixCls:t,name:r,id:i,type:a,disabled:c,readonly:l,tabindex:h,autofocus:g,value:_,required:v}=e,y=me(e,[`prefixCls`,`name`,`id`,`type`,`disabled`,`readonly`,`tabindex`,`autofocus`,`value`,`required`]),{class:b,onFocus:x,onBlur:C,onKeydown:w,onKeypress:T,onKeyup:E}=n,D=S(S({},y),n),O=Object.keys(D).reduce((e,t)=>((t.startsWith(`data-`)||t.startsWith(`aria-`)||t===`role`)&&(e[t]=D[t]),e),{}),k=p(t,b,{[`${t}-checked`]:o.value,[`${t}-disabled`]:c}),A=S(S({name:r,id:i,type:a,readonly:l,disabled:c,tabindex:h,class:`${t}-input`,checked:!!o.value,autofocus:g,value:_},O),{onChange:f,onClick:m,onFocus:x,onBlur:C,onKeydown:w,onKeypress:T,onKeyup:E,required:v});return u(`span`,{class:k},[u(`input`,d({ref:s},A),null),u(`span`,{class:`${t}-inner`},null)])}}}),H=Symbol(`radioGroupContextKey`),ge=e=>{r(H,e)},_e=()=>n(H,void 0),U=Symbol(`radioOptionTypeContextKey`),ve=e=>{r(U,e)},ye=()=>n(U,void 0),be=new m(`antRadioEffect`,{"0%":{transform:`scale(1)`,opacity:.5},"100%":{transform:`scale(1.6)`,opacity:0}}),xe=e=>{let{componentCls:t,antCls:n}=e,r=`${t}-group`;return{[r]:S(S({},x(e)),{display:`inline-block`,fontSize:0,[`&${r}-rtl`]:{direction:`rtl`},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:`none`}})}},Se=e=>{let{componentCls:t,radioWrapperMarginRight:n,radioCheckedColor:r,radioSize:i,motionDurationSlow:a,motionDurationMid:o,motionEaseInOut:s,motionEaseInOutCirc:c,radioButtonBg:l,colorBorder:u,lineWidth:d,radioDotSize:f,colorBgContainerDisabled:p,colorTextDisabled:m,paddingXS:h,radioDotDisabledColor:g,lineType:_,radioDotDisabledSize:v,wireframe:y,colorWhite:b}=e,C=`${t}-inner`;return{[`${t}-wrapper`]:S(S({},x(e)),{position:`relative`,display:`inline-flex`,alignItems:`baseline`,marginInlineStart:0,marginInlineEnd:n,cursor:`pointer`,[`&${t}-wrapper-rtl`]:{direction:`rtl`},"&-disabled":{cursor:`not-allowed`,color:e.colorTextDisabled},"&::after":{display:`inline-block`,width:0,overflow:`hidden`,content:`"\\a0"`},[`${t}-checked::after`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,width:`100%`,height:`100%`,border:`${d}px ${_} ${r}`,borderRadius:`50%`,visibility:`hidden`,animationName:be,animationDuration:a,animationTimingFunction:s,animationFillMode:`both`,content:`""`},[t]:S(S({},x(e)),{position:`relative`,display:`inline-block`,outline:`none`,cursor:`pointer`,alignSelf:`center`}),[`${t}-wrapper:hover &,
|
|
2
2
|
&:hover ${C}`]:{borderColor:r},[`${t}-input:focus-visible + ${C}`]:S({},w(e)),[`${t}:hover::after, ${t}-wrapper:hover &::after`]:{visibility:`visible`},[`${t}-inner`]:{"&::after":{boxSizing:`border-box`,position:`absolute`,insetBlockStart:`50%`,insetInlineStart:`50%`,display:`block`,width:i,height:i,marginBlockStart:i/-2,marginInlineStart:i/-2,backgroundColor:y?r:b,borderBlockStart:0,borderInlineStart:0,borderRadius:i,transform:`scale(0)`,opacity:0,transition:`all ${a} ${c}`,content:`""`},boxSizing:`border-box`,position:`relative`,insetBlockStart:0,insetInlineStart:0,display:`block`,width:i,height:i,backgroundColor:l,borderColor:u,borderStyle:`solid`,borderWidth:d,borderRadius:`50%`,transition:`all ${o}`},[`${t}-input`]:{position:`absolute`,insetBlockStart:0,insetInlineEnd:0,insetBlockEnd:0,insetInlineStart:0,zIndex:1,cursor:`pointer`,opacity:0},[`${t}-checked`]:{[C]:{borderColor:r,backgroundColor:y?l:r,"&::after":{transform:`scale(${f/i})`,opacity:1,transition:`all ${a} ${c}`}}},[`${t}-disabled`]:{cursor:`not-allowed`,[C]:{backgroundColor:p,borderColor:u,cursor:`not-allowed`,"&::after":{backgroundColor:g}},[`${t}-input`]:{cursor:`not-allowed`},[`${t}-disabled + span`]:{color:m,cursor:`not-allowed`},[`&${t}-checked`]:{[C]:{"&::after":{transform:`scale(${v/i})`}}}},[`span${t} + *`]:{paddingInlineStart:h,paddingInlineEnd:h}})}},Ce=e=>{let{radioButtonColor:t,controlHeight:n,componentCls:r,lineWidth:i,lineType:a,colorBorder:o,motionDurationSlow:s,motionDurationMid:c,radioButtonPaddingHorizontal:l,fontSize:u,radioButtonBg:d,fontSizeLG:f,controlHeightLG:p,controlHeightSM:m,paddingXS:h,borderRadius:g,borderRadiusSM:_,borderRadiusLG:v,radioCheckedColor:y,radioButtonCheckedBg:b,radioButtonHoverColor:x,radioButtonActiveColor:C,radioSolidCheckedColor:T,colorTextDisabled:E,colorBgContainerDisabled:D,radioDisabledButtonCheckedColor:O,radioDisabledButtonCheckedBg:k}=e;return{[`${r}-button-wrapper`]:{position:`relative`,display:`inline-block`,height:n,margin:0,paddingInline:l,paddingBlock:0,color:t,fontSize:u,lineHeight:`${n-i*2}px`,background:d,border:`${i}px ${a} ${o}`,borderBlockStartWidth:i+.02,borderInlineStartWidth:0,borderInlineEndWidth:i,cursor:`pointer`,transition:[`color ${c}`,`background ${c}`,`border-color ${c}`,`box-shadow ${c}`].join(`,`),a:{color:t},[`> ${r}-button`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:`100%`,height:`100%`},"&:not(:first-child)":{"&::before":{position:`absolute`,insetBlockStart:-i,insetInlineStart:-i,display:`block`,boxSizing:`content-box`,width:1,height:`100%`,paddingBlock:i,paddingInline:0,backgroundColor:o,transition:`background-color ${s}`,content:`""`}},"&:first-child":{borderInlineStart:`${i}px ${a} ${o}`,borderStartStartRadius:g,borderEndStartRadius:g},"&:last-child":{borderStartEndRadius:g,borderEndEndRadius:g},"&:first-child:last-child":{borderRadius:g},[`${r}-group-large &`]:{height:p,fontSize:f,lineHeight:`${p-i*2}px`,"&:first-child":{borderStartStartRadius:v,borderEndStartRadius:v},"&:last-child":{borderStartEndRadius:v,borderEndEndRadius:v}},[`${r}-group-small &`]:{height:m,paddingInline:h-i,paddingBlock:0,lineHeight:`${m-i*2}px`,"&:first-child":{borderStartStartRadius:_,borderEndStartRadius:_},"&:last-child":{borderStartEndRadius:_,borderEndEndRadius:_}},"&:hover":{position:`relative`,color:y},"&:has(:focus-visible)":S({},w(e)),[`${r}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:`none`},[`&-checked:not(${r}-button-wrapper-disabled)`]:{zIndex:1,color:y,background:b,borderColor:y,"&::before":{backgroundColor:y},"&:first-child":{borderColor:y},"&:hover":{color:x,borderColor:x,"&::before":{backgroundColor:x}},"&:active":{color:C,borderColor:C,"&::before":{backgroundColor:C}}},[`${r}-group-solid &-checked:not(${r}-button-wrapper-disabled)`]:{color:T,background:y,borderColor:y,"&:hover":{color:T,background:x,borderColor:x},"&:active":{color:T,background:C,borderColor:C}},"&-disabled":{color:E,backgroundColor:D,borderColor:o,cursor:`not-allowed`,"&:first-child, &:hover":{color:E,backgroundColor:D,borderColor:o}},[`&-disabled${r}-button-wrapper-checked`]:{color:O,backgroundColor:k,borderColor:o,boxShadow:`none`}}}},W=b(`Radio`,e=>{let{padding:t,lineWidth:n,controlItemBgActiveDisabled:r,colorTextDisabled:i,colorBgContainer:a,fontSizeLG:o,controlOutline:s,colorPrimaryHover:c,colorPrimaryActive:l,colorText:u,colorPrimary:d,marginXS:f,controlOutlineWidth:p,colorTextLightSolid:m,wireframe:h}=e,g=`0 0 0 ${p}px ${s}`,_=g,v=o,y=v-8,b=h?y:v-(4+n)*2,x=d,S=u,C=c,w=l,T=t-n,E=D(e,{radioFocusShadow:g,radioButtonFocusShadow:_,radioSize:v,radioDotSize:b,radioDotDisabledSize:y,radioCheckedColor:x,radioDotDisabledColor:i,radioSolidCheckedColor:m,radioButtonBg:a,radioButtonCheckedBg:a,radioButtonColor:S,radioButtonHoverColor:C,radioButtonActiveColor:w,radioButtonPaddingHorizontal:T,radioDisabledButtonCheckedBg:r,radioDisabledButtonCheckedColor:i,radioWrapperMarginRight:f});return[xe(E),Se(E),Ce(E)]}),we=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},G=()=>({prefixCls:String,checked:_(),disabled:_(),isGroup:_(),value:T.any,name:String,id:String,autofocus:_(),onChange:h(),onFocus:h(),onBlur:h(),onClick:h(),"onUpdate:checked":h(),"onUpdate:value":h()}),K=e({compatConfig:{MODE:3},name:`ARadio`,inheritAttrs:!1,props:G(),setup(e,t){let{emit:n,expose:r,slots:i,attrs:a}=t,s=P(),l=M.useInject(),m=ye(),h=_e(),g=f(),_=o(()=>x.value??g.value),v=c(),{prefixCls:y,direction:b,disabled:x}=C(`radio`,e),w=o(()=>h?.optionType.value===`button`||m===`button`?`${y.value}-button`:y.value),T=f(),[E,D]=W(y);r({focus:()=>{v.value.focus()},blur:()=>{v.value.blur()}});let O=e=>{let t=e.target.checked;n(`update:checked`,t),n(`update:value`,t),n(`change`,e),s.onFieldChange()},k=e=>{n(`change`,e),h&&h.onChange&&h.onChange(e)};return()=>{let t=h,{prefixCls:n,id:r=s.id.value}=e,o=we(e,[`prefixCls`,`id`]),c=S(S({prefixCls:w.value,id:r},te(o,[`onUpdate:checked`,`onUpdate:value`])),{disabled:x.value??T.value});t?(c.name=t.name.value,c.onChange=k,c.checked=e.value===t.value.value,c.disabled=_.value||t.disabled.value):c.onChange=O;let f=p({[`${w.value}-wrapper`]:!0,[`${w.value}-wrapper-checked`]:c.checked,[`${w.value}-wrapper-disabled`]:c.disabled,[`${w.value}-wrapper-rtl`]:b.value===`rtl`,[`${w.value}-wrapper-in-form-item`]:l.isFormItemInput},a.class,D.value);return E(u(`label`,d(d({},a),{},{class:f}),[u(V,d(d({},c),{},{type:`radio`,ref:v}),null),i.default&&u(`span`,null,[i.default()])]))}}}),q=e({compatConfig:{MODE:3},name:`ARadioGroup`,inheritAttrs:!1,props:{prefixCls:String,value:T.any,size:E(),options:v(),disabled:_(),name:String,buttonStyle:E(`outline`),id:String,optionType:E(`default`),onChange:h(),"onUpdate:value":h()},setup(e,n){let{slots:r,emit:i,attrs:s}=n,l=P(),{prefixCls:f,direction:m,size:h}=C(`radio`,e),[g,_]=W(f),v=c(e.value),y=c(!1);return a(()=>e.value,e=>{v.value=e,y.value=!1}),ge({onChange:n=>{let r=v.value,{value:a}=n.target;`value`in e||(v.value=a),!y.value&&a!==r&&(y.value=!0,i(`update:value`,a),i(`change`,n),l.onFieldChange()),t(()=>{y.value=!1})},value:v,disabled:o(()=>e.disabled),name:o(()=>e.name),optionType:o(()=>e.optionType)}),()=>{let{options:t,buttonStyle:n,id:i=l.id.value}=e,a=`${f.value}-group`,o=p(a,`${a}-${n}`,{[`${a}-${h.value}`]:h.value,[`${a}-rtl`]:m.value===`rtl`},s.class,_.value),c=null;return c=t&&t.length>0?t.map(t=>{if(typeof t==`string`||typeof t==`number`)return u(K,{key:t,prefixCls:f.value,disabled:e.disabled,value:t,checked:v.value===t},{default:()=>[t]});let{value:n,disabled:r,label:i}=t;return u(K,{key:`radio-group-value-options-${n}`,prefixCls:f.value,disabled:r||e.disabled,value:n,checked:v.value===n},{default:()=>[i]})}):r.default?.call(r),g(u(`div`,d(d({},s),{},{class:o,id:i}),[c]))}}}),J=e({compatConfig:{MODE:3},name:`ARadioButton`,inheritAttrs:!1,props:G(),setup(e,t){let{slots:n,attrs:r}=t,{prefixCls:i}=C(`radio`,e);return ve(`button`),()=>u(K,d(d(d({},r),e),{},{prefixCls:i.value}),{default:()=>[n.default?.call(n)]})}});K.Group=q,K.Button=J,K.install=function(e){return e.component(K.name,K),e.component(K.Group.name,K.Group),e.component(K.Button.name,K.Button),e};var Te=K,Y=(e,t,n)=>{let r=g(n);return{[`${e.componentCls}-${t}`]:{color:e[`color${n}`],background:e[`color${r}Bg`],borderColor:e[`color${r}Border`],[`&${e.componentCls}-borderless`]:{borderColor:`transparent`}}}},Ee=e=>O(e,(t,n)=>{let{textColor:r,lightBorderColor:i,lightColor:a,darkColor:o}=n;return{[`${e.componentCls}-${t}`]:{color:r,background:a,borderColor:i,"&-inverse":{color:e.colorTextLightSolid,background:o,borderColor:o},[`&${e.componentCls}-borderless`]:{borderColor:`transparent`}}}}),X=e=>{let{paddingXXS:t,lineWidth:n,tagPaddingHorizontal:r,componentCls:i}=e,a=r-n,o=t-n;return{[i]:S(S({},x(e)),{display:`inline-block`,height:`auto`,marginInlineEnd:e.marginXS,paddingInline:a,fontSize:e.tagFontSize,lineHeight:`${e.tagLineHeight}px`,whiteSpace:`nowrap`,background:e.tagDefaultBg,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:`start`,[`&${i}-rtl`]:{direction:`rtl`},"&, a, a:hover":{color:e.tagDefaultColor},[`${i}-close-icon`]:{marginInlineStart:o,color:e.colorTextDescription,fontSize:e.tagIconSize,cursor:`pointer`,transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${i}-has-color`]:{borderColor:`transparent`,[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:`transparent`,borderColor:`transparent`,cursor:`pointer`,[`&:not(${i}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:`none`},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:a}}),[`${i}-borderless`]:{borderColor:`transparent`,background:e.tagBorderlessBg}}},Z=b(`Tag`,e=>{let{fontSize:t,lineHeight:n,lineWidth:r,fontSizeIcon:i}=e,a=Math.round(t*n),o=e.fontSizeSM,s=a-r*2,c=e.colorFillAlter,l=e.colorText,u=D(e,{tagFontSize:o,tagLineHeight:s,tagDefaultBg:c,tagDefaultColor:l,tagIconSize:i-2*r,tagPaddingHorizontal:8,tagBorderlessBg:e.colorFillTertiary});return[X(u),Ee(u),Y(u,`success`,`Success`),Y(u,`processing`,`Info`),Y(u,`error`,`Error`),Y(u,`warning`,`Warning`)]}),Q=e({compatConfig:{MODE:3},name:`ACheckableTag`,inheritAttrs:!1,props:{prefixCls:String,checked:{type:Boolean,default:void 0},onChange:{type:Function},onClick:{type:Function},"onUpdate:checked":Function},setup(e,t){let{slots:n,emit:r,attrs:i}=t,{prefixCls:a}=C(`tag`,e),[s,c]=Z(a),l=t=>{let{checked:n}=e;r(`update:checked`,!n),r(`change`,!n),r(`click`,t)},f=o(()=>p(a.value,c.value,{[`${a.value}-checkable`]:!0,[`${a.value}-checkable-checked`]:e.checked}));return()=>s(u(`span`,d(d({},i),{},{class:[f.value,i.class],onClick:l}),[n.default?.call(n)]))}}),$=e({compatConfig:{MODE:3},name:`ATag`,inheritAttrs:!1,props:{prefixCls:String,color:{type:String},closable:{type:Boolean,default:!1},closeIcon:T.any,visible:{type:Boolean,default:void 0},onClose:{type:Function},onClick:y(),"onUpdate:visible":Function,icon:T.any,bordered:{type:Boolean,default:!0}},slots:Object,setup(e,t){let{slots:n,emit:r,attrs:a}=t,{prefixCls:c,direction:f}=C(`tag`,e),[m,h]=Z(c),g=s(!0);l(()=>{e.visible!==void 0&&(g.value=e.visible)});let _=t=>{t.stopPropagation(),r(`update:visible`,!1),r(`close`,t),!t.defaultPrevented&&e.visible===void 0&&(g.value=!1)},v=o(()=>k(e.color)||A(e.color)),y=o(()=>p(c.value,h.value,{[`${c.value}-${e.color}`]:v.value,[`${c.value}-has-color`]:e.color&&!v.value,[`${c.value}-hidden`]:!g.value,[`${c.value}-rtl`]:f.value===`rtl`,[`${c.value}-borderless`]:!e.bordered})),b=e=>{r(`click`,e)};return()=>{let{icon:t=n.icon?.call(n),color:r,closeIcon:o=n.closeIcon?.call(n),closable:s=!1}=e,l=()=>s?o?u(`span`,{class:`${c.value}-close-icon`,onClick:_},[o]):u(re,{class:`${c.value}-close-icon`,onClick:_},null):null,f={backgroundColor:r&&!v.value?r:void 0},p=t||null,h=n.default?.call(n),g=p?u(i,null,[p,u(`span`,null,[h])]):h,x=e.onClick!==void 0,S=u(`span`,d(d({},a),{},{onClick:b,class:[y.value,a.class],style:[f,a.style]}),[g,l()]);return m(x?u(N,null,{default:()=>[S]}):S)}}});$.CheckableTag=Q,$.install=function(e){return e.component($.name,$),e.component(Q.name,Q),e};export{V as a,q as i,Te as n,pe as o,J as r,I as s,$ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e,U as t,V as n,W as r,q as i}from"./rqZ-1SoP.js";import{C as a,G as o,H as s,Ht as c,St as l,Ut as u,Wt as d,a as f,b as p,f as m,ft as h,g,h as _,mt as v,nt as y,p as b,rt as x,t as S,x as C}from"./BSCpFtzG.js";import{t as ee}from"./D8CqF0yy.js";import{n as te}from"./BeIfu4N3.js";import{t as w}from"./G0qIw7Gq2.js";import{r as T,t as ne}from"./BgCrZKv_2.js";var re={class:`page`},ie={class:`aw-page-head`},ae={class:`sub`},oe={class:`badges mono`},se=[`title`],ce={class:`badge`},le={key:0,class:`banner bad`},ue={class:`fleet-filter`},de={class:`aw-seg`},fe=[`placeholder`],pe={class:`line-grid aw-stagger`},me={class:`lc-head`},he={class:`lc-name`},ge=[`title`,`onClick`],_e=[`title`,`onClick`],ve={key:0,class:`lc-run mono`},ye={class:`lc-stats mono`},be={class:`lc-ctl`},xe=[`onUpdate:modelValue`,`disabled`,`title`],Se={value:``},Ce=[`value`,`disabled`],we=[`disabled`,`onClick`],Te=[`disabled`,`onClick`],Ee={key:1,class:`banner`},De={key:2,class:`banner`},Oe={class:`modal`},ke={class:`m-title`},Ae={class:`f`},je=[`placeholder`],Me={class:`f`},Ne=[`placeholder`],Pe={class:`f`},Fe={class:`color-row`},Ie=[`onClick`],Le={class:`dim`},Re={key:0,class:`m-err`},ze={class:`m-actions`},Be=[`disabled`],Ve={class:`modal`},He={class:`m-title`},Ue={class:`f`},We=[`placeholder`],Ge={class:`f`},Ke=[`placeholder`],qe={class:`f`},Je={class:`color-row`},Ye=[`onClick`],Xe={class:`dim`},Ze={key:0,class:`m-err`},Qe={class:`m-actions`},$e=[`disabled`],et={class:`modal`},tt={class:`m-title danger-title`},nt={class:`del-summary`},rt={class:`del-purge`},it={key:0,class:`m-err`},at={class:`m-actions`},ot=[`disabled`],st={class:`modal wide`},ct={class:`m-title`},lt={class:`dim mono`},ut={class:`dim tpl-hint`},dt={class:`tpl-list`},ft=[`title`],pt={class:`mono dim`},mt={key:0,class:`tpl-sem`},ht=[`onClick`],gt={class:`sec-label`},_t={class:`tpl-form`},vt={class:`f`},yt=[`placeholder`],bt={class:`f`},xt=[`placeholder`],St={class:`f`},Ct={class:`f`},wt={class:`f`},Tt={class:`f`},Et={class:`f`},Dt={class:`f`},Ot=[`value`],kt={class:`f`},At=[`placeholder`],jt={key:0,class:`m-err`},Mt={class:`m-actions`},Nt=[`disabled`],Pt={key:3,class:`banner bad`},E=S(a({__name:`index`,setup(a){let{t:S}=te(),E=ne();E.load();let D=m(()=>E.lines.map(e=>({line:e,nodes:E.nodes.filter(t=>t.lineId===e.id).length,products:E.products.filter(t=>t.lineId===e.id).length,recipes:E.recipes.filter(t=>t.lineId===e.id).length}))),O=m(()=>E.nodes.filter(e=>!e.lineId).length+E.products.filter(e=>!e.lineId).length),k=v(`all`),A=v(``),j=m(()=>D.value.filter(e=>E.lineStateOf(e.line.id).active).length),M=m(()=>D.value.filter(e=>{let t=E.lineStateOf(e.line.id).active;if(k.value===`running`&&!t||k.value===`idle`&&t)return!1;let n=A.value.trim().toLowerCase();return!(n&&!e.line.name.toLowerCase().includes(n)&&!(e.line.description??``).toLowerCase().includes(n))})),N=v(!1),P=v(!1),F=v(``),I=h({name:``,description:``,color:``}),L=m(()=>T[E.lines.length%T.length]??`#3aa0ff`);function Ft(){I.name=``,I.description=``,I.color=``,F.value=``,N.value=!0}async function It(){P.value=!0,F.value=``;try{await E.createLine({name:I.name.trim(),description:I.description.trim(),color:I.color||void 0}),N.value=!1}catch(e){F.value=w(e)}finally{P.value=!1}}let R=v(``),z=v(``),B=h({});async function Lt(e){R.value=e.line.id,z.value=``;try{let t=B[e.line.id]??``;if(!t)throw Error(S(`dcw.k188cswn039`));await E.startLine(e.line.id,t)}catch(e){z.value=w(e)}finally{R.value=``}}async function Rt(e){R.value=e.line.id,z.value=``;try{await E.stopLine(e.line.id)}catch(e){z.value=w(e)}finally{R.value=``}}function V(e){return E.recipes.filter(t=>t.lineId===e)}let H=v(!1),U=v(!1),W=v(``),G=v(!0),K=v(null);function zt(e){K.value=e,G.value=!0,W.value=``,H.value=!0}async function Bt(){if(K.value){U.value=!0,W.value=``;try{await E.removeLine(K.value.line.id,G.value),H.value=!1}catch(e){W.value=w(e)}finally{U.value=!1}}}let q=v(!1),J=v(!1),Y=v(``),X=h({id:``,name:``,description:``,color:``});function Vt(e){X.id=e.line.id,X.name=e.line.name,X.description=e.line.description,X.color=e.line.color,Y.value=``,q.value=!0}async function Ht(){J.value=!0,Y.value=``;try{await E.updateLine(X.id,{name:X.name.trim(),description:X.description.trim(),color:X.color||void 0}),q.value=!1}catch(e){Y.value=w(e)}finally{J.value=!1}}let Z=v(!1),Q=v(``),$=h({name:``,ch:``,code:``,unit:``,min:``,max:``,decimals:1,icon:`gateway`,semantics:``}),Ut=[{key:`thermo`,label:S(`dcw.k422b8040`)},{key:`pressure`,label:S(`dcw.k3x6ff041`)},{key:`tension`,label:S(`dcw.k3z9xc042`)},{key:`encoder`,label:S(`dcw.kjb3vhs043`)},{key:`camera`,label:S(`dcw.k47atw044`)},{key:`gateway`,label:S(`dcw.k48c07045`)}];async function Wt(){Q.value=``;try{if(!$.name.trim())throw Error(S(`dcw.k6ugbw2046`));if($.min===``||$.max===``)throw Error(S(`dcw.k13awowo047`));await E.createTemplate({name:$.name.trim(),ch:$.ch.trim()||$.name.trim(),code:$.code.trim()||`CUSTOM`,unit:$.unit.trim()||`-`,min:Number($.min),max:Number($.max),decimals:Number($.decimals)||0,icon:$.icon,semantics:$.semantics.trim()||void 0}),$.name=``,$.ch=``,$.code=``,$.unit=``,$.min=``,$.max=``}catch(e){Q.value=w(e)}}async function Gt(e){Q.value=``;try{await fetch(`/api/workshop/dcw/templates/${e}`,{method:`DELETE`,headers:{authorization:`Bearer ${document.cookie.match(/(?:^|;\s*)token=([^;]+)/)?.[1]??``}`}}).then(async e=>{let t=await e.json().catch(()=>({}));if(t?.code!==0)throw Error(t?.message??S(`dcw.k1bphrb3048`))});let t=E.templates.findIndex(t=>t.key===e);t>=0&&E.templates.splice(t,1)}catch(e){Q.value=w(e)}}let Kt=m(()=>E.templates.filter(e=>e.builtin).length);return(a,m)=>{let h=ee;return s(),g(`div`,re,[b(`div`,ie,[b(`div`,null,[m[27]||=b(`p`,{class:`aw-kicker`},` AGENTWORKSHOP / LINE OPERATIONS `,-1),b(`h1`,null,d(a.$t(`dcw.k1b2tk5c009`)),1),b(`p`,ae,d(a.$t(`dcw.k5q0aqi010`)),1)]),b(`div`,oe,[O.value?(s(),g(`span`,{key:0,class:`badge warn-badge`,title:a.$t(`dcw.k1i5a9vw001`)},d(a.$t(`dcw.k3ootr6049`))+` `+d(O.value),9,se)):_(``,!0),b(`span`,ce,d(a.$t(`dcw.k3wj9n050`))+` `+d(l(E).lines.length),1),b(`button`,{class:`badge tpl-btn`,onClick:m[0]||=e=>Z.value=!0},d(a.$t(`dcw.k11nndsp051`))+` `+d(l(E).templates.length),1)])]),z.value?(s(),g(`p`,le,d(z.value),1)):_(``,!0),b(`div`,ue,[b(`div`,de,[b(`button`,{class:c({on:k.value===`all`}),onClick:m[1]||=e=>k.value=`all`},d(a.$t(`common.all`))+` `+d(D.value.length),3),b(`button`,{class:c({on:k.value===`running`}),onClick:m[2]||=e=>k.value=`running`},d(a.$t(`dcw.k1eox1el055`))+` `+d(j.value),3),b(`button`,{class:c({on:k.value===`idle`}),onClick:m[3]||=e=>k.value=`idle`},d(a.$t(`dcw.k149r6y7059`))+` `+d(D.value.length-j.value),3)]),x(b(`input`,{"onUpdate:modelValue":m[4]||=e=>A.value=e,class:`inp fleet-search`,type:`search`,placeholder:a.$t(`dcw.filterSearchPh`)},null,8,fe),[[r,A.value]])]),b(`div`,pe,[(s(!0),g(f,null,o(M.value,e=>(s(),g(`div`,{key:e.line.id,class:c([`line-card aw-liftable`,{idle:!l(E).lineStateOf(e.line.id).active}]),style:u({"--lc":e.line.color})},[b(`div`,me,[m[30]||=b(`span`,{class:`lc-dot`},null,-1),b(`b`,he,d(e.line.name),1),b(`span`,{class:c([`lc-state`,{on:l(E).lineStateOf(e.line.id).active}])},d(l(E).lineStateOf(e.line.id).active?a.$t(`dcw.k1eox1el055`):a.$t(`dcw.k149r6y7059`)),3),b(`button`,{class:`lc-act`,title:a.$t(`common.edit`),onClick:t=>Vt(e)},[...m[28]||=[b(`span`,{class:`i-tabler-pencil`},null,-1)]],8,ge),b(`button`,{class:`lc-act danger`,title:a.$t(`dcw.k3xakp026`),onClick:t=>zt(e)},[...m[29]||=[b(`span`,{class:`i-tabler-trash`},null,-1)]],8,_e)]),l(E).lineStateOf(e.line.id).active?(s(),g(`small`,ve,d(l(E).lineStateOf(e.line.id).productName)+` · `+d(l(E).lineStateOf(e.line.id).recipeName)+` · `+d(a.$t(`dcw.k3zz0f052`))+` `+d(l(E).lineStateOf(e.line.id).taggedSamples),1)):(s(),g(`small`,{key:1,class:c([`lc-run dim`,{ph:!e.line.description}])},d(e.line.description||a.$t(`dcw.k18moyq1056`)),3)),b(`div`,ye,[b(`span`,null,[p(d(a.$t(`dcw.k45uio011`))+` `,1),b(`b`,null,d(e.nodes),1)]),b(`span`,null,[p(d(a.$t(`dcw.k3waz1012`))+` `,1),b(`b`,null,d(e.products),1)]),b(`span`,null,[p(d(a.$t(`dcw.k48grv013`))+` `,1),b(`b`,null,d(e.recipes),1)])]),b(`div`,be,[l(E).lineStateOf(e.line.id).active?(s(),g(`button`,{key:1,class:`pill-btn stop`,disabled:R.value===e.line.id,onClick:t=>Rt(e)},d(a.$t(`dcw.k148rclf015`)),9,Te)):(s(),g(f,{key:0},[x(b(`select`,{"onUpdate:modelValue":t=>B[e.line.id]=t,class:`inp`,disabled:V(e.line.id).length===0,title:a.$t(`dcw.k1dhaby4003`)},[b(`option`,Se,d(V(e.line.id).length?a.$t(`dcw.kutxzsz057`):a.$t(`dcw.k1elczt9060`)),1),(s(!0),g(f,null,o(V(e.line.id),e=>(s(),g(`option`,{key:e.id,value:e.id,disabled:e.params.length===0},d(e.name)+`(`+d(e.params.length)+`) `,9,Ce))),128))],8,xe),[[t,B[e.line.id]]]),b(`button`,{class:`pill-btn`,disabled:R.value===e.line.id||!B[e.line.id],onClick:t=>Lt(e)},d(a.$t(`dcw.k149b4vg014`)),9,we)],64))]),C(h,{class:`lc-manage`,to:`/dcw/${e.line.id}`},{default:y(()=>[p(d(a.$t(`dcw.k1fwqw5g016`)),1)]),_:1},8,[`to`])],6))),128)),b(`button`,{class:`line-card new-card`,onClick:Ft},[m[31]||=b(`span`,{class:`i-tabler-plus`},null,-1),p(` `+d(a.$t(`dcw.k1efe391017`))+` `,1),b(`small`,null,d(a.$t(`dcw.k19dlbli053`)),1)])]),l(E).loaded&&l(E).lines.length===0?(s(),g(`p`,Ee,d(a.$t(`dcw.k1sk85vs018`)),1)):l(E).loaded&&M.value.length===0?(s(),g(`p`,De,d(a.$t(`dcw.filterEmpty`)),1)):_(``,!0),C(e,{name:`modal`},{default:y(()=>[N.value?(s(),g(`div`,{key:0,class:`modal-mask`,onClick:m[8]||=i(e=>N.value=!1,[`self`])},[b(`div`,Oe,[b(`h3`,ke,d(a.$t(`dcw.k1efe391017`)),1),b(`label`,Ae,[b(`span`,null,[p(d(a.$t(`dcw.k1b2ioko019`)),1),m[32]||=b(`em`,null,`*`,-1)]),x(b(`input`,{"onUpdate:modelValue":m[5]||=e=>I.name=e,class:`inp`,placeholder:a.$t(`dcw.kru37i3004`)},null,8,je),[[r,I.name]])]),b(`label`,Me,[b(`span`,null,d(a.$t(`dcw.k24dxcd020`)),1),x(b(`input`,{"onUpdate:modelValue":m[6]||=e=>I.description=e,class:`inp`,placeholder:a.$t(`dcw.k1f2nwsp005`)},null,8,Ne),[[r,I.description]])]),b(`div`,Pe,[b(`span`,null,d(a.$t(`dcw.k1x7nubr021`)),1),b(`div`,Fe,[(s(!0),g(f,null,o(l(T),e=>(s(),g(`button`,{key:e,class:c([`color-dot`,{on:I.color===e}]),style:u({background:e}),onClick:t=>I.color=I.color===e?``:e},null,14,Ie))),128)),b(`small`,Le,d(I.color||a.$t(`dcw.k1qidbpy061`,{p0:L.value})),1)])]),F.value?(s(),g(`p`,Re,d(F.value),1)):_(``,!0),b(`div`,ze,[b(`button`,{class:`mini-btn`,onClick:m[7]||=e=>N.value=!1},d(a.$t(`dcw.k3xdnn022`)),1),b(`button`,{class:`pill-btn`,disabled:P.value||!I.name.trim(),onClick:It},d(a.$t(`dcw.k3wzi2023`)),9,Be)])])])):_(``,!0)]),_:1}),C(e,{name:`modal`},{default:y(()=>[q.value?(s(),g(`div`,{key:0,class:`modal-mask`,onClick:m[12]||=i(e=>q.value=!1,[`self`])},[b(`div`,Ve,[b(`h3`,He,d(a.$t(`dcw.k5tq8wc071`)),1),b(`label`,Ue,[b(`span`,null,[p(d(a.$t(`dcw.k1b2ioko019`)),1),m[33]||=b(`em`,null,`*`,-1)]),x(b(`input`,{"onUpdate:modelValue":m[9]||=e=>X.name=e,class:`inp`,placeholder:a.$t(`dcw.kru37i3004`)},null,8,We),[[r,X.name]])]),b(`label`,Ge,[b(`span`,null,d(a.$t(`dcw.k24dxcd020`)),1),x(b(`input`,{"onUpdate:modelValue":m[10]||=e=>X.description=e,class:`inp`,placeholder:a.$t(`dcw.k1f2nwsp005`)},null,8,Ke),[[r,X.description]])]),b(`div`,qe,[b(`span`,null,d(a.$t(`dcw.k1x7nubr021`)),1),b(`div`,Je,[(s(!0),g(f,null,o(l(T),e=>(s(),g(`button`,{key:e,class:c([`color-dot`,{on:X.color===e}]),style:u({background:e}),onClick:t=>X.color=X.color===e?``:e},null,14,Ye))),128)),b(`small`,Xe,d(X.color||a.$t(`dcw.k1qidbpy061`,{p0:L.value})),1)])]),Y.value?(s(),g(`p`,Ze,d(Y.value),1)):_(``,!0),b(`div`,Qe,[b(`button`,{class:`mini-btn`,onClick:m[11]||=e=>q.value=!1},d(a.$t(`dcw.k3xdnn022`)),1),b(`button`,{class:`pill-btn`,disabled:J.value||!X.name.trim(),onClick:Ht},d(a.$t(`common.save`)),9,$e)])])])):_(``,!0)]),_:1}),C(e,{name:`modal`},{default:y(()=>[H.value&&K.value?(s(),g(`div`,{key:0,class:`modal-mask`,onClick:m[15]||=i(e=>H.value=!1,[`self`])},[b(`div`,et,[b(`h3`,tt,[m[34]||=b(`span`,{class:`i-tabler-alert-triangle`},null,-1),p(` `+d(a.$t(`dcw.k7xq2mfd063`,{p0:K.value.line.name})),1)]),b(`p`,nt,d(G.value?a.$t(`dcw.k4r7nbd073`,{p0:K.value.line.name,p1:K.value.nodes,p2:K.value.products,p3:K.value.recipes}):a.$t(`dcw.k1gp649b062`,{p0:K.value.line.name,p1:K.value.nodes,p2:K.value.products,p3:K.value.recipes})),1),b(`label`,rt,[x(b(`input`,{"onUpdate:modelValue":m[13]||=e=>G.value=e,type:`checkbox`},null,512),[[n,G.value]]),b(`span`,null,d(a.$t(`dcw.k9m2vxa072`)),1)]),W.value?(s(),g(`p`,it,d(W.value),1)):_(``,!0),b(`div`,at,[b(`button`,{class:`mini-btn`,onClick:m[14]||=e=>H.value=!1},d(a.$t(`dcw.k3xdnn022`)),1),b(`button`,{class:`pill-btn danger`,disabled:U.value,onClick:Bt},d(a.$t(`dcw.k3xakp026`)),9,ot)])])])):_(``,!0)]),_:1}),C(e,{name:`modal`},{default:y(()=>[Z.value?(s(),g(`div`,{key:0,class:`modal-mask`,onClick:m[26]||=i(e=>Z.value=!1,[`self`])},[b(`div`,st,[b(`h3`,ct,[p(d(a.$t(`dcw.k11oadmx024`))+` `,1),b(`small`,lt,d(a.$t(`dcw.k3x23c054`))+` `+d(Kt.value)+` · `+d(a.$t(`dcw.k3t616a058`))+` `+d(l(E).templates.length-Kt.value),1)]),b(`p`,ut,d(a.$t(`dcw.k2hlav5025`)),1),b(`div`,dt,[(s(!0),g(f,null,o(l(E).templates,e=>(s(),g(`div`,{key:e.key,class:`tpl-row`,title:e.semantics??``},[b(`b`,null,d(e.name),1),b(`small`,pt,d(e.code)+` · `+d(e.min)+`~`+d(e.max)+` `+d(e.unit),1),e.semantics?(s(),g(`small`,mt,d(e.semantics.slice(0,40))+d(e.semantics.length>40?`…`:``),1)):_(``,!0),b(`span`,{class:c([`tpl-tag`,{builtin:e.builtin}])},d(e.builtin?a.$t(`dcw.k3x23c054`):a.$t(`dcw.k3t616a058`)),3),e.builtin?_(``,!0):(s(),g(`button`,{key:1,class:`mini-btn danger`,onClick:t=>Gt(e.key)},d(a.$t(`dcw.k3xakp026`)),9,ht))],8,ft))),128))]),b(`p`,gt,d(a.$t(`dcw.k169eb4s027`)),1),b(`div`,_t,[b(`label`,vt,[b(`span`,null,[p(d(a.$t(`dcw.k3xhia028`)),1),m[35]||=b(`em`,null,`*`,-1)]),x(b(`input`,{"onUpdate:modelValue":m[16]||=e=>$.name=e,class:`inp`,placeholder:a.$t(`dcw.k1tooi3o006`)},null,8,yt),[[r,$.name]])]),b(`label`,bt,[b(`span`,null,d(a.$t(`dcw.k1bqk219029`)),1),x(b(`input`,{"onUpdate:modelValue":m[17]||=e=>$.ch=e,class:`inp`,placeholder:a.$t(`dcw.k698qz0007`)},null,8,xt),[[r,$.ch]])]),b(`label`,St,[b(`span`,null,d(a.$t(`dcw.k1ayxrqb030`)),1),x(b(`input`,{"onUpdate:modelValue":m[18]||=e=>$.code=e,class:`inp`,placeholder:`如 MOTOR · I`},null,512),[[r,$.code]])]),b(`label`,Ct,[b(`span`,null,d(a.$t(`dcw.k3x4ef031`)),1),x(b(`input`,{"onUpdate:modelValue":m[19]||=e=>$.unit=e,class:`inp`,placeholder:`如 A`},null,512),[[r,$.unit]])]),b(`label`,wt,[b(`span`,null,[p(d(a.$t(`dcw.k1l9jv5m032`)),1),m[36]||=b(`em`,null,`*`,-1)]),x(b(`input`,{"onUpdate:modelValue":m[20]||=e=>$.min=e,type:`number`,class:`inp`},null,512),[[r,$.min,void 0,{number:!0}]])]),b(`label`,Tt,[b(`span`,null,[p(d(a.$t(`dcw.k1l9jv4p033`)),1),m[37]||=b(`em`,null,`*`,-1)]),x(b(`input`,{"onUpdate:modelValue":m[21]||=e=>$.max=e,type:`number`,class:`inp`},null,512),[[r,$.max,void 0,{number:!0}]])]),b(`label`,Et,[b(`span`,null,d(a.$t(`dcw.k3mxmcx034`)),1),x(b(`input`,{"onUpdate:modelValue":m[22]||=e=>$.decimals=e,type:`number`,class:`inp`},null,512),[[r,$.decimals,void 0,{number:!0}]])]),b(`label`,Dt,[b(`span`,null,d(a.$t(`dcw.k3xx56035`)),1),x(b(`select`,{"onUpdate:modelValue":m[23]||=e=>$.icon=e,class:`inp`},[(s(),g(f,null,o(Ut,e=>b(`option`,{key:e.key,value:e.key},d(e.label),9,Ot)),64))],512),[[t,$.icon]])])]),b(`label`,kt,[b(`span`,null,d(a.$t(`dcw.k1b6qorg036`)),1),x(b(`textarea`,{"onUpdate:modelValue":m[24]||=e=>$.semantics=e,class:`inp`,rows:`3`,placeholder:a.$t(`dcw.k1qdnfzc008`)},null,8,At),[[r,$.semantics]])]),Q.value?(s(),g(`p`,jt,d(Q.value),1)):_(``,!0),b(`div`,Mt,[b(`button`,{class:`mini-btn`,onClick:m[25]||=e=>Z.value=!1},d(a.$t(`dcw.k3x62t037`)),1),b(`button`,{class:`pill-btn`,disabled:!$.name.trim()||$.min===``||$.max===``,onClick:Wt},d(a.$t(`dcw.k1bg9nga038`)),9,Nt)])])])):_(``,!0)]),_:1}),l(E).error?(s(),g(`p`,Pt,d(l(E).error),1)):_(``,!0)])}}}),[[`__scopeId`,`data-v-a200e0d3`]]);export{E as default};
|