@datatechsolutions/tympan 0.3.0
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/LICENSE +105 -0
- package/README.md +361 -0
- package/THIRD_PARTY_NOTICES.md +180 -0
- package/dist/Avatar-BwVXK1gt.d.ts +37 -0
- package/dist/Avatar-P14MVkK1.js +2815 -0
- package/dist/Avatar-P14MVkK1.js.map +1 -0
- package/dist/avatars.d.ts +130 -0
- package/dist/avatars.js +531 -0
- package/dist/avatars.js.map +1 -0
- package/dist/cx-Bn-0YiVq.js +10 -0
- package/dist/cx-Bn-0YiVq.js.map +1 -0
- package/dist/flags/1x1/ad-BLe4yr61.js +6 -0
- package/dist/flags/1x1/ae-DWj10f_-.js +6 -0
- package/dist/flags/1x1/af-DavbPdY_.js +6 -0
- package/dist/flags/1x1/ag-CQgo5awT.js +6 -0
- package/dist/flags/1x1/ai-i1e-tRb-.js +6 -0
- package/dist/flags/1x1/al-BUFgcw5S.js +6 -0
- package/dist/flags/1x1/am-NU473ju2.js +6 -0
- package/dist/flags/1x1/ao-B-pKKU_Z.js +6 -0
- package/dist/flags/1x1/aq-BheU24WX.js +6 -0
- package/dist/flags/1x1/ar-DNwRSqYh.js +6 -0
- package/dist/flags/1x1/arab-88qGIYv0.js +6 -0
- package/dist/flags/1x1/as-CGCC07cj.js +6 -0
- package/dist/flags/1x1/asean-DdlmT25h.js +6 -0
- package/dist/flags/1x1/at-BEu8eDs7.js +6 -0
- package/dist/flags/1x1/au-C5Xq8bGD.js +6 -0
- package/dist/flags/1x1/aw-CB9G0R84.js +6 -0
- package/dist/flags/1x1/ax-Buob1nIg.js +6 -0
- package/dist/flags/1x1/az-CcVicXqN.js +6 -0
- package/dist/flags/1x1/ba-Cxm2rPWt.js +6 -0
- package/dist/flags/1x1/bb-CelcvA2P.js +6 -0
- package/dist/flags/1x1/bd-CZOnB2bt.js +6 -0
- package/dist/flags/1x1/be-BeSuVKmy.js +6 -0
- package/dist/flags/1x1/bf-DCR3ADbo.js +6 -0
- package/dist/flags/1x1/bg-DT2du0bc.js +6 -0
- package/dist/flags/1x1/bh-C20nQ3k2.js +6 -0
- package/dist/flags/1x1/bi-DV69kx68.js +6 -0
- package/dist/flags/1x1/bj-Cd_6yaxw.js +6 -0
- package/dist/flags/1x1/bl-TaG2WuKM.js +6 -0
- package/dist/flags/1x1/bm-Blnd9QyE.js +6 -0
- package/dist/flags/1x1/bn-rjF94qbn.js +6 -0
- package/dist/flags/1x1/bo-DDdGwBdI.js +6 -0
- package/dist/flags/1x1/bq-B5WRxpfU.js +6 -0
- package/dist/flags/1x1/br-bpueSDua.js +6 -0
- package/dist/flags/1x1/bs-CEEd020S.js +6 -0
- package/dist/flags/1x1/bt-JCokd5Ri.js +6 -0
- package/dist/flags/1x1/bv-VkQe2kr4.js +6 -0
- package/dist/flags/1x1/bw-FyQwptO9.js +6 -0
- package/dist/flags/1x1/by-D-0OPUI_.js +6 -0
- package/dist/flags/1x1/bz-R83MH-fy.js +6 -0
- package/dist/flags/1x1/ca-CmGq-ESK.js +6 -0
- package/dist/flags/1x1/cc-BqKVdIBU.js +6 -0
- package/dist/flags/1x1/cd-OeN90lUp.js +6 -0
- package/dist/flags/1x1/cefta-DoN3C1FP.js +6 -0
- package/dist/flags/1x1/cf-c_IWvoMt.js +6 -0
- package/dist/flags/1x1/cg-DB6A28kr.js +6 -0
- package/dist/flags/1x1/ch-BoUeVhR3.js +6 -0
- package/dist/flags/1x1/ci-DO7X3pCD.js +6 -0
- package/dist/flags/1x1/ck-DbhiimVc.js +6 -0
- package/dist/flags/1x1/cl-D18TvDyU.js +6 -0
- package/dist/flags/1x1/cm-BkkRG54s.js +6 -0
- package/dist/flags/1x1/cn-DXW0Zc-C.js +6 -0
- package/dist/flags/1x1/co-Cy9H7OxQ.js +6 -0
- package/dist/flags/1x1/cp-OJP4OSI_.js +6 -0
- package/dist/flags/1x1/cr-DjqO_sqT.js +6 -0
- package/dist/flags/1x1/cu-DHMTbgXc.js +6 -0
- package/dist/flags/1x1/cv-DTvqMV9p.js +6 -0
- package/dist/flags/1x1/cw-0DPof2UJ.js +6 -0
- package/dist/flags/1x1/cx-PKvWuYvr.js +6 -0
- package/dist/flags/1x1/cy-DNqBiZyI.js +6 -0
- package/dist/flags/1x1/cz-yXbpq9dW.js +6 -0
- package/dist/flags/1x1/de-C8riQ_D-.js +6 -0
- package/dist/flags/1x1/dg-Bq-Ud7da.js +6 -0
- package/dist/flags/1x1/dj-ND_VVEYo.js +6 -0
- package/dist/flags/1x1/dk-Bomd7YHA.js +6 -0
- package/dist/flags/1x1/dm-qszJkHRv.js +6 -0
- package/dist/flags/1x1/do-Bv0isgHk.js +6 -0
- package/dist/flags/1x1/dz-CUA3AvZL.js +6 -0
- package/dist/flags/1x1/eac-Ba3w7XxY.js +6 -0
- package/dist/flags/1x1/ec-CcdQ1fLf.js +6 -0
- package/dist/flags/1x1/ee-B-9UyJkI.js +6 -0
- package/dist/flags/1x1/eg-CZg9XtnS.js +6 -0
- package/dist/flags/1x1/eh-COr5bQZC.js +6 -0
- package/dist/flags/1x1/er-CYCgUEjl.js +6 -0
- package/dist/flags/1x1/es-CZgLUvTm.js +6 -0
- package/dist/flags/1x1/es-ct-Bx84VtrH.js +6 -0
- package/dist/flags/1x1/es-ga-CYZIqZNg.js +6 -0
- package/dist/flags/1x1/es-pv-D_xA9FJj.js +6 -0
- package/dist/flags/1x1/et-7yKufKNW.js +6 -0
- package/dist/flags/1x1/eu-CkGTFKZG.js +6 -0
- package/dist/flags/1x1/fi-PhiA7TSZ.js +6 -0
- package/dist/flags/1x1/fj-D5HT3L1Q.js +6 -0
- package/dist/flags/1x1/fk-D1r8PWRL.js +6 -0
- package/dist/flags/1x1/fm-DzWMFpux.js +6 -0
- package/dist/flags/1x1/fo-Bu22hwIJ.js +6 -0
- package/dist/flags/1x1/fr-DSs3a2MO.js +6 -0
- package/dist/flags/1x1/ga-DYufGjqh.js +6 -0
- package/dist/flags/1x1/gb-DQrKw26J.js +6 -0
- package/dist/flags/1x1/gb-eng-CLG2z7wM.js +6 -0
- package/dist/flags/1x1/gb-nir-BBzZa87S.js +6 -0
- package/dist/flags/1x1/gb-sct-C0keZmXy.js +6 -0
- package/dist/flags/1x1/gb-wls-D2caXmYS.js +6 -0
- package/dist/flags/1x1/gd-B-wv-GsF.js +6 -0
- package/dist/flags/1x1/ge-CIgkNaAi.js +6 -0
- package/dist/flags/1x1/gf-CcFRsGEB.js +6 -0
- package/dist/flags/1x1/gg-CRVhi7RS.js +6 -0
- package/dist/flags/1x1/gh-ZIIas1gx.js +6 -0
- package/dist/flags/1x1/gi-aNP9A0DW.js +6 -0
- package/dist/flags/1x1/gl-BzgDzfSn.js +6 -0
- package/dist/flags/1x1/gm-D8gqU6yg.js +6 -0
- package/dist/flags/1x1/gn-CUq13_pA.js +6 -0
- package/dist/flags/1x1/gp-CccqVUWo.js +6 -0
- package/dist/flags/1x1/gq-NOK-yjB9.js +6 -0
- package/dist/flags/1x1/gr-BuFzOeZR.js +6 -0
- package/dist/flags/1x1/gs-BTz9XWE1.js +6 -0
- package/dist/flags/1x1/gt-9_0vebb7.js +6 -0
- package/dist/flags/1x1/gu-BYwEbw67.js +6 -0
- package/dist/flags/1x1/gw-C6MASvA4.js +6 -0
- package/dist/flags/1x1/gy-CVJynGMI.js +6 -0
- package/dist/flags/1x1/hk-BK85zxRX.js +6 -0
- package/dist/flags/1x1/hm-C2DNwCnS.js +6 -0
- package/dist/flags/1x1/hn-CovnHmxi.js +6 -0
- package/dist/flags/1x1/hr-Xiutii4P.js +6 -0
- package/dist/flags/1x1/ht-BW7wprT-.js +6 -0
- package/dist/flags/1x1/hu-CYCcM7tq.js +6 -0
- package/dist/flags/1x1/ic-D4t41hrd.js +6 -0
- package/dist/flags/1x1/id-Ch177K4Q.js +6 -0
- package/dist/flags/1x1/ie-jdf-in47.js +6 -0
- package/dist/flags/1x1/il-CWEqhQTm.js +6 -0
- package/dist/flags/1x1/im-DpubIP14.js +6 -0
- package/dist/flags/1x1/in-G0wDC92n.js +6 -0
- package/dist/flags/1x1/io-DBkbcbKG.js +6 -0
- package/dist/flags/1x1/iq-B0897GsN.js +6 -0
- package/dist/flags/1x1/ir-Decsonvj.js +6 -0
- package/dist/flags/1x1/is-yn_GGMix.js +6 -0
- package/dist/flags/1x1/it-CzpFdgc2.js +6 -0
- package/dist/flags/1x1/je-DXwHIhBp.js +6 -0
- package/dist/flags/1x1/jm-ByvGfY6R.js +6 -0
- package/dist/flags/1x1/jo-Bikg0_s4.js +6 -0
- package/dist/flags/1x1/jp-BJaExao-.js +6 -0
- package/dist/flags/1x1/ke-KCANUoB9.js +6 -0
- package/dist/flags/1x1/kg-DpLGJA_E.js +6 -0
- package/dist/flags/1x1/kh-B1cMsgzP.js +6 -0
- package/dist/flags/1x1/ki-CyD2gdcT.js +6 -0
- package/dist/flags/1x1/km-53bL6Y8i.js +6 -0
- package/dist/flags/1x1/kn-BEyi33Ey.js +6 -0
- package/dist/flags/1x1/kp-YyqYNIfr.js +6 -0
- package/dist/flags/1x1/kr-C6fy0Xrq.js +6 -0
- package/dist/flags/1x1/kw-CTe0WExz.js +6 -0
- package/dist/flags/1x1/ky-FVDALRC1.js +6 -0
- package/dist/flags/1x1/kz-ByrgvZkC.js +6 -0
- package/dist/flags/1x1/la-xaxFHwKj.js +6 -0
- package/dist/flags/1x1/lb-CVRf8x3C.js +6 -0
- package/dist/flags/1x1/lc-DggZ-MAM.js +6 -0
- package/dist/flags/1x1/li-BjKARW5X.js +6 -0
- package/dist/flags/1x1/lk-DKp1FG25.js +6 -0
- package/dist/flags/1x1/lr-CRdeQLZp.js +6 -0
- package/dist/flags/1x1/ls-DsmPxnLE.js +6 -0
- package/dist/flags/1x1/lt-ppTAzYgZ.js +6 -0
- package/dist/flags/1x1/lu-Uh-VRqcJ.js +6 -0
- package/dist/flags/1x1/lv-QLDxm2XB.js +6 -0
- package/dist/flags/1x1/ly-CALXfGtF.js +6 -0
- package/dist/flags/1x1/ma-BUv6slh8.js +6 -0
- package/dist/flags/1x1/mc-DbRaSw7Z.js +6 -0
- package/dist/flags/1x1/md-BAbGk1u-.js +6 -0
- package/dist/flags/1x1/me-Cn9otM5-.js +6 -0
- package/dist/flags/1x1/mf-VN2Hxfy5.js +6 -0
- package/dist/flags/1x1/mg-DMFg3gWK.js +6 -0
- package/dist/flags/1x1/mh-mLFhHPfv.js +6 -0
- package/dist/flags/1x1/mk-BYU_KcQn.js +6 -0
- package/dist/flags/1x1/ml-CxUloBPA.js +6 -0
- package/dist/flags/1x1/mm-B1GvkWeA.js +6 -0
- package/dist/flags/1x1/mn-CGxIncf0.js +6 -0
- package/dist/flags/1x1/mo-mVFWphva.js +6 -0
- package/dist/flags/1x1/mp-n86_oaVp.js +6 -0
- package/dist/flags/1x1/mq-BKYfdZ6x.js +6 -0
- package/dist/flags/1x1/mr-fpb5SDjH.js +6 -0
- package/dist/flags/1x1/ms-DJ2RoBuC.js +6 -0
- package/dist/flags/1x1/mt-DRCD8PbR.js +6 -0
- package/dist/flags/1x1/mu-DIwBWq5I.js +6 -0
- package/dist/flags/1x1/mv-BMA6eE3m.js +6 -0
- package/dist/flags/1x1/mw-Ebs1mO8O.js +6 -0
- package/dist/flags/1x1/mx-BH8Za6dt.js +6 -0
- package/dist/flags/1x1/my-fd4tKRXC.js +6 -0
- package/dist/flags/1x1/mz-44mCvMzP.js +6 -0
- package/dist/flags/1x1/na-Bc17qIOR.js +6 -0
- package/dist/flags/1x1/nc-BEiZyZM6.js +6 -0
- package/dist/flags/1x1/ne-3wSQFOSk.js +6 -0
- package/dist/flags/1x1/nf-BBG5Bp7Y.js +6 -0
- package/dist/flags/1x1/ng-BQyiUScm.js +6 -0
- package/dist/flags/1x1/ni-CZP_RJzQ.js +6 -0
- package/dist/flags/1x1/nl-Dod3207s.js +6 -0
- package/dist/flags/1x1/no-DDekGkfu.js +6 -0
- package/dist/flags/1x1/np-DMopwWij.js +6 -0
- package/dist/flags/1x1/nr-nDPYj76A.js +6 -0
- package/dist/flags/1x1/nu-DEw3csOK.js +6 -0
- package/dist/flags/1x1/nz-CxrPsIb1.js +6 -0
- package/dist/flags/1x1/om-CyVvqtLi.js +6 -0
- package/dist/flags/1x1/pa-BO-gt67V.js +6 -0
- package/dist/flags/1x1/pc-CBmqnctk.js +6 -0
- package/dist/flags/1x1/pe-B9LhqS9S.js +6 -0
- package/dist/flags/1x1/pf-hjhdLHA3.js +6 -0
- package/dist/flags/1x1/pg-C-wKaAj0.js +6 -0
- package/dist/flags/1x1/ph-C9JTsx92.js +6 -0
- package/dist/flags/1x1/pk-DrN39bQT.js +6 -0
- package/dist/flags/1x1/pl-CrEpBNNE.js +6 -0
- package/dist/flags/1x1/pm-Btdxx1lW.js +6 -0
- package/dist/flags/1x1/pn-DzqRGCQA.js +6 -0
- package/dist/flags/1x1/pr-U6tnqx1t.js +6 -0
- package/dist/flags/1x1/ps-DHIlPg16.js +6 -0
- package/dist/flags/1x1/pt-Cj6X3TbL.js +6 -0
- package/dist/flags/1x1/pw-UpjwxQ0z.js +6 -0
- package/dist/flags/1x1/py-Cn2qwuG7.js +6 -0
- package/dist/flags/1x1/qa-Biuy4UWu.js +6 -0
- package/dist/flags/1x1/re-B25_JOkL.js +6 -0
- package/dist/flags/1x1/ro-B9VO8uV5.js +6 -0
- package/dist/flags/1x1/rs-CS2zrjg3.js +6 -0
- package/dist/flags/1x1/ru-7-OkapKW.js +6 -0
- package/dist/flags/1x1/rw-COm3RNUj.js +6 -0
- package/dist/flags/1x1/sa-DhosoqBh.js +6 -0
- package/dist/flags/1x1/sb-dEOdp0-U.js +6 -0
- package/dist/flags/1x1/sc-DH5lZ-X1.js +6 -0
- package/dist/flags/1x1/sd-CjLepWrS.js +6 -0
- package/dist/flags/1x1/se-fjKCg3uq.js +6 -0
- package/dist/flags/1x1/sg-CvvPJuek.js +6 -0
- package/dist/flags/1x1/sh-BACbCuQV.js +6 -0
- package/dist/flags/1x1/sh-ac-B8mGy82J.js +6 -0
- package/dist/flags/1x1/sh-hl-CdNllvu3.js +6 -0
- package/dist/flags/1x1/sh-ta-BpzAidVW.js +6 -0
- package/dist/flags/1x1/si-C9wDaOie.js +6 -0
- package/dist/flags/1x1/sj-DmQ-l-GG.js +6 -0
- package/dist/flags/1x1/sk-csj-UEpd.js +6 -0
- package/dist/flags/1x1/sl-66khImvm.js +6 -0
- package/dist/flags/1x1/sm-Dw-fwny-.js +6 -0
- package/dist/flags/1x1/sn-DFOPTJuS.js +6 -0
- package/dist/flags/1x1/so-NmeQT-wa.js +6 -0
- package/dist/flags/1x1/sr-DY7R8R1H.js +6 -0
- package/dist/flags/1x1/ss-BRaIhTBI.js +6 -0
- package/dist/flags/1x1/st-DbWpIgL_.js +6 -0
- package/dist/flags/1x1/sv-CCR1P023.js +6 -0
- package/dist/flags/1x1/sx-Dqve8sOF.js +6 -0
- package/dist/flags/1x1/sy-uUGakD8a.js +6 -0
- package/dist/flags/1x1/sz-DnPvNXRi.js +6 -0
- package/dist/flags/1x1/tc-sWa0Hka-.js +6 -0
- package/dist/flags/1x1/td-BH8NEKMZ.js +6 -0
- package/dist/flags/1x1/tf-DGr1cSmp.js +6 -0
- package/dist/flags/1x1/tg-CzXZhjV5.js +6 -0
- package/dist/flags/1x1/th-Bd7yXeo8.js +6 -0
- package/dist/flags/1x1/tj-BXE2hU6d.js +6 -0
- package/dist/flags/1x1/tk-BvAJwB5n.js +6 -0
- package/dist/flags/1x1/tl-Cf7eXtjJ.js +6 -0
- package/dist/flags/1x1/tm-C8XHem7_.js +6 -0
- package/dist/flags/1x1/tn-A574RUnc.js +6 -0
- package/dist/flags/1x1/to-rZfgCO86.js +6 -0
- package/dist/flags/1x1/tr-DRqxGnLc.js +6 -0
- package/dist/flags/1x1/tt-BciLQvVK.js +6 -0
- package/dist/flags/1x1/tv-DLgi8rdd.js +6 -0
- package/dist/flags/1x1/tw-BcCRKYqW.js +6 -0
- package/dist/flags/1x1/tz-BjDpP6SA.js +6 -0
- package/dist/flags/1x1/ua-DPOXiMzw.js +6 -0
- package/dist/flags/1x1/ug-C0vrxL4F.js +6 -0
- package/dist/flags/1x1/um-DqpOJgNl.js +6 -0
- package/dist/flags/1x1/un-Bk0wLUvy.js +6 -0
- package/dist/flags/1x1/us-f-Xdfkne.js +6 -0
- package/dist/flags/1x1/uy-BrUGNLWK.js +6 -0
- package/dist/flags/1x1/uz-BKDQBNxr.js +6 -0
- package/dist/flags/1x1/va-BderRROs.js +6 -0
- package/dist/flags/1x1/vc-DPo9h-3V.js +6 -0
- package/dist/flags/1x1/ve-DrDTrDyq.js +6 -0
- package/dist/flags/1x1/vg-DxocsseP.js +6 -0
- package/dist/flags/1x1/vi-DsQ40wwi.js +6 -0
- package/dist/flags/1x1/vn-YEvgXi4o.js +6 -0
- package/dist/flags/1x1/vu-Dy0sZ3Ly.js +6 -0
- package/dist/flags/1x1/wf-BZfYe7wF.js +6 -0
- package/dist/flags/1x1/ws-C4FYzmn6.js +6 -0
- package/dist/flags/1x1/xk-DZFilPCh.js +6 -0
- package/dist/flags/1x1/xx-0UytpHfL.js +6 -0
- package/dist/flags/1x1/ye-CZMZu1ZB.js +6 -0
- package/dist/flags/1x1/yt-DBYDbgIm.js +6 -0
- package/dist/flags/1x1/za-ClvA8Dny.js +6 -0
- package/dist/flags/1x1/zm-D7L0dPCl.js +6 -0
- package/dist/flags/1x1/zw-DpCNoBk-.js +6 -0
- package/dist/flags/4x3/ad-BwDf_AgT.js +6 -0
- package/dist/flags/4x3/ae-KPB0rRvk.js +6 -0
- package/dist/flags/4x3/af-CPngQm7Z.js +6 -0
- package/dist/flags/4x3/ag-Cvrhc-BK.js +6 -0
- package/dist/flags/4x3/ai-Dex-oYnB.js +6 -0
- package/dist/flags/4x3/al-C2rnSjJ-.js +6 -0
- package/dist/flags/4x3/am-u91DPBsf.js +6 -0
- package/dist/flags/4x3/ao-B0AdkYiM.js +6 -0
- package/dist/flags/4x3/aq-5iFhwg5i.js +6 -0
- package/dist/flags/4x3/ar-BLK5U8Sr.js +6 -0
- package/dist/flags/4x3/arab-zVkSqGyE.js +6 -0
- package/dist/flags/4x3/as-CgVHGYml.js +6 -0
- package/dist/flags/4x3/asean-D0zehsSg.js +6 -0
- package/dist/flags/4x3/at-Cge2pfYH.js +6 -0
- package/dist/flags/4x3/au-BUHitxZ7.js +6 -0
- package/dist/flags/4x3/aw-9FVkX8eg.js +6 -0
- package/dist/flags/4x3/ax-BhOsTuXD.js +6 -0
- package/dist/flags/4x3/az-_xXDkPBy.js +6 -0
- package/dist/flags/4x3/ba-czeMkj9F.js +6 -0
- package/dist/flags/4x3/bb-CLWVnfR9.js +6 -0
- package/dist/flags/4x3/bd-B-3DhjKL.js +6 -0
- package/dist/flags/4x3/be-Bpxb3n8W.js +6 -0
- package/dist/flags/4x3/bf-DJ8HJgOv.js +6 -0
- package/dist/flags/4x3/bg-CcHaZEiP.js +6 -0
- package/dist/flags/4x3/bh-CgYuyQai.js +6 -0
- package/dist/flags/4x3/bi-DFDeFqbN.js +6 -0
- package/dist/flags/4x3/bj-BJ2Mv3Qn.js +6 -0
- package/dist/flags/4x3/bl-49c6xkK_.js +6 -0
- package/dist/flags/4x3/bm-DUnGX933.js +6 -0
- package/dist/flags/4x3/bn-D5OzuSfC.js +6 -0
- package/dist/flags/4x3/bo-h7n1xblU.js +6 -0
- package/dist/flags/4x3/bq-kCIKVZCB.js +6 -0
- package/dist/flags/4x3/br-CeKOfZ4p.js +6 -0
- package/dist/flags/4x3/bs-D-dpb2Wt.js +6 -0
- package/dist/flags/4x3/bt-DYguJJqP.js +6 -0
- package/dist/flags/4x3/bv-CxfcHUGg.js +6 -0
- package/dist/flags/4x3/bw-Dmlo2Xrl.js +6 -0
- package/dist/flags/4x3/by-DpJ2tbSJ.js +6 -0
- package/dist/flags/4x3/bz-C8KkVEct.js +6 -0
- package/dist/flags/4x3/ca-B0vqIN4C.js +6 -0
- package/dist/flags/4x3/cc-1AhJzny1.js +6 -0
- package/dist/flags/4x3/cd-C15eWPm0.js +6 -0
- package/dist/flags/4x3/cefta-T0n99-tg.js +6 -0
- package/dist/flags/4x3/cf-B-N0dXk3.js +6 -0
- package/dist/flags/4x3/cg-RBObVHlS.js +6 -0
- package/dist/flags/4x3/ch-BAwraSMD.js +6 -0
- package/dist/flags/4x3/ci-LZ8Apa_f.js +6 -0
- package/dist/flags/4x3/ck-DxgfUgaV.js +6 -0
- package/dist/flags/4x3/cl-Dn5PmBH_.js +6 -0
- package/dist/flags/4x3/cm-DT7ZRDLD.js +6 -0
- package/dist/flags/4x3/cn-Uxu_n0TL.js +6 -0
- package/dist/flags/4x3/co-DUXgiBfK.js +6 -0
- package/dist/flags/4x3/cp-DBFQpzcn.js +6 -0
- package/dist/flags/4x3/cr-B3r-jfDb.js +6 -0
- package/dist/flags/4x3/cu-C2AkPSKm.js +6 -0
- package/dist/flags/4x3/cv-BSCHMcjA.js +6 -0
- package/dist/flags/4x3/cw-CTl-jMEj.js +6 -0
- package/dist/flags/4x3/cx-Blx2-PJu.js +6 -0
- package/dist/flags/4x3/cy-CmfldoYM.js +6 -0
- package/dist/flags/4x3/cz-Bc4FVt_z.js +6 -0
- package/dist/flags/4x3/de-CwT-mfsC.js +6 -0
- package/dist/flags/4x3/dg-CMYWTwG_.js +6 -0
- package/dist/flags/4x3/dj-Bog9QII6.js +6 -0
- package/dist/flags/4x3/dk-CEB1aRPZ.js +6 -0
- package/dist/flags/4x3/dm-idTEOH5b.js +6 -0
- package/dist/flags/4x3/do-C-xUzrhA.js +6 -0
- package/dist/flags/4x3/dz-B0XT3h3L.js +6 -0
- package/dist/flags/4x3/eac-BYyC7gTx.js +6 -0
- package/dist/flags/4x3/ec-DHPDQJB4.js +6 -0
- package/dist/flags/4x3/ee-YEP7-YiI.js +6 -0
- package/dist/flags/4x3/eg-DphZyJ3R.js +6 -0
- package/dist/flags/4x3/eh-BMMUn6kT.js +6 -0
- package/dist/flags/4x3/er-02p7NzRX.js +6 -0
- package/dist/flags/4x3/es-CxCY_HyC.js +6 -0
- package/dist/flags/4x3/es-ct-COxgK6gN.js +6 -0
- package/dist/flags/4x3/es-ga-YtOQPf2W.js +6 -0
- package/dist/flags/4x3/es-pv-BJWGTixJ.js +6 -0
- package/dist/flags/4x3/et-C9te-XyE.js +6 -0
- package/dist/flags/4x3/eu-D3pBiamG.js +6 -0
- package/dist/flags/4x3/fi-p8gKOqu5.js +6 -0
- package/dist/flags/4x3/fj-WA6Sj14C.js +6 -0
- package/dist/flags/4x3/fk-C3YQpfie.js +6 -0
- package/dist/flags/4x3/fm-WlAfSSOy.js +6 -0
- package/dist/flags/4x3/fo-CnipJFZB.js +6 -0
- package/dist/flags/4x3/fr-wcxjBEM6.js +6 -0
- package/dist/flags/4x3/ga-D4QkmEbT.js +6 -0
- package/dist/flags/4x3/gb-Iu59IqG4.js +6 -0
- package/dist/flags/4x3/gb-eng-J2KeRbF6.js +6 -0
- package/dist/flags/4x3/gb-nir-D8v4gixn.js +6 -0
- package/dist/flags/4x3/gb-sct-eUMUOmec.js +6 -0
- package/dist/flags/4x3/gb-wls-DNa6cGuk.js +6 -0
- package/dist/flags/4x3/gd-CcutC5Jv.js +6 -0
- package/dist/flags/4x3/ge-BT79hKsn.js +6 -0
- package/dist/flags/4x3/gf-C6HTKVwe.js +6 -0
- package/dist/flags/4x3/gg-CBz1K2KV.js +6 -0
- package/dist/flags/4x3/gh-C_hnux9x.js +6 -0
- package/dist/flags/4x3/gi-DwDUY2CR.js +6 -0
- package/dist/flags/4x3/gl-ul6S0drK.js +6 -0
- package/dist/flags/4x3/gm-C8-_GrOJ.js +6 -0
- package/dist/flags/4x3/gn-DpAS4Emu.js +6 -0
- package/dist/flags/4x3/gp-v6jMGkOl.js +6 -0
- package/dist/flags/4x3/gq-BHcHFt2R.js +6 -0
- package/dist/flags/4x3/gr-oAWzdDL5.js +6 -0
- package/dist/flags/4x3/gs-Bv3j5ihx.js +6 -0
- package/dist/flags/4x3/gt-D58m-PIf.js +6 -0
- package/dist/flags/4x3/gu-DA1wyGyA.js +6 -0
- package/dist/flags/4x3/gw-C4R5CLxA.js +6 -0
- package/dist/flags/4x3/gy-B03XmJhj.js +6 -0
- package/dist/flags/4x3/hk-DR5PFCoc.js +6 -0
- package/dist/flags/4x3/hm-a3gZlVMF.js +6 -0
- package/dist/flags/4x3/hn-DxaVMgH9.js +6 -0
- package/dist/flags/4x3/hr-BDsdEZ9G.js +6 -0
- package/dist/flags/4x3/ht-DgQNMO2Q.js +6 -0
- package/dist/flags/4x3/hu-C2qm-xRb.js +6 -0
- package/dist/flags/4x3/ic-D9RMzjWn.js +6 -0
- package/dist/flags/4x3/id-DEj8jtC8.js +6 -0
- package/dist/flags/4x3/ie-6bydCA7G.js +6 -0
- package/dist/flags/4x3/il-D0CMPynd.js +6 -0
- package/dist/flags/4x3/im-Bk7Igczt.js +6 -0
- package/dist/flags/4x3/in-CSwUkXPH.js +6 -0
- package/dist/flags/4x3/io-Dr_xhh5f.js +6 -0
- package/dist/flags/4x3/iq-C0Met1sv.js +6 -0
- package/dist/flags/4x3/ir-CLPSHIql.js +6 -0
- package/dist/flags/4x3/is-D5nGt-6k.js +6 -0
- package/dist/flags/4x3/it-B2NNW4yZ.js +6 -0
- package/dist/flags/4x3/je-BPuVMtBX.js +6 -0
- package/dist/flags/4x3/jm-DFjIgq_Z.js +6 -0
- package/dist/flags/4x3/jo-DnWyEAoq.js +6 -0
- package/dist/flags/4x3/jp-DaC3ftqV.js +6 -0
- package/dist/flags/4x3/ke-DQltk3Nm.js +6 -0
- package/dist/flags/4x3/kg-B9wByXjn.js +6 -0
- package/dist/flags/4x3/kh-DsD475kI.js +6 -0
- package/dist/flags/4x3/ki-BYmKP6AJ.js +6 -0
- package/dist/flags/4x3/km-Dj1BRPW5.js +6 -0
- package/dist/flags/4x3/kn-DFhgS6Sx.js +6 -0
- package/dist/flags/4x3/kp-CeyDf8wh.js +6 -0
- package/dist/flags/4x3/kr-DruUFoV6.js +6 -0
- package/dist/flags/4x3/kw-xFITUXkK.js +6 -0
- package/dist/flags/4x3/ky-CDzTcYQP.js +6 -0
- package/dist/flags/4x3/kz-CA-J-BrJ.js +6 -0
- package/dist/flags/4x3/la-DFsAJIHb.js +6 -0
- package/dist/flags/4x3/lb-Bmhu7qDU.js +6 -0
- package/dist/flags/4x3/lc-c1kA4IQi.js +6 -0
- package/dist/flags/4x3/li-D7EkWWIr.js +6 -0
- package/dist/flags/4x3/lk-DjV8GlBc.js +6 -0
- package/dist/flags/4x3/lr-D_nRBy7g.js +6 -0
- package/dist/flags/4x3/ls-BQtizfhz.js +6 -0
- package/dist/flags/4x3/lt-BtwRhwiF.js +6 -0
- package/dist/flags/4x3/lu-BuGEmjGI.js +6 -0
- package/dist/flags/4x3/lv-BzSskWH0.js +6 -0
- package/dist/flags/4x3/ly-BQOllMQt.js +6 -0
- package/dist/flags/4x3/ma-Sdg_SxjA.js +6 -0
- package/dist/flags/4x3/mc-EjXwAk3n.js +6 -0
- package/dist/flags/4x3/md-Dq3fri60.js +6 -0
- package/dist/flags/4x3/me-Czx-10De.js +6 -0
- package/dist/flags/4x3/mf-Do15dk7j.js +6 -0
- package/dist/flags/4x3/mg-CXajwe-a.js +6 -0
- package/dist/flags/4x3/mh-DnobhgT4.js +6 -0
- package/dist/flags/4x3/mk-BRiJw8Tt.js +6 -0
- package/dist/flags/4x3/ml-aAwTONwn.js +6 -0
- package/dist/flags/4x3/mm-C1m5tOBJ.js +6 -0
- package/dist/flags/4x3/mn-C9ULzcTg.js +6 -0
- package/dist/flags/4x3/mo-DeMiFKJD.js +6 -0
- package/dist/flags/4x3/mp-BWLTjTll.js +6 -0
- package/dist/flags/4x3/mq-DVS4CJ07.js +6 -0
- package/dist/flags/4x3/mr-DGqyf4qY.js +6 -0
- package/dist/flags/4x3/ms-rAHNRTea.js +6 -0
- package/dist/flags/4x3/mt-Bm7FiwOE.js +6 -0
- package/dist/flags/4x3/mu-JFEJCkzB.js +6 -0
- package/dist/flags/4x3/mv-BTeEwa1J.js +6 -0
- package/dist/flags/4x3/mw-D0tRc77D.js +6 -0
- package/dist/flags/4x3/mx-CUaww8P5.js +6 -0
- package/dist/flags/4x3/my-DAanXl_d.js +6 -0
- package/dist/flags/4x3/mz-BIGM9L2m.js +6 -0
- package/dist/flags/4x3/na-B0qW9JE2.js +6 -0
- package/dist/flags/4x3/nc-WNgLHyf6.js +6 -0
- package/dist/flags/4x3/ne-DidYQTz7.js +6 -0
- package/dist/flags/4x3/nf-B72F6aJy.js +6 -0
- package/dist/flags/4x3/ng-DvIbB1xq.js +6 -0
- package/dist/flags/4x3/ni-BH4HRye2.js +6 -0
- package/dist/flags/4x3/nl-B43Plb7G.js +6 -0
- package/dist/flags/4x3/no-DcP-jaEB.js +6 -0
- package/dist/flags/4x3/np-zDFTSsAD.js +6 -0
- package/dist/flags/4x3/nr-Dne6n-U4.js +6 -0
- package/dist/flags/4x3/nu-BcXVN0pM.js +6 -0
- package/dist/flags/4x3/nz-BXB8x6bx.js +6 -0
- package/dist/flags/4x3/om-Dv3qsB7p.js +6 -0
- package/dist/flags/4x3/pa-CHIJ1Gj2.js +6 -0
- package/dist/flags/4x3/pc-VmqK_LID.js +6 -0
- package/dist/flags/4x3/pe-RvGqR0R-.js +6 -0
- package/dist/flags/4x3/pf-DRmCnqA_.js +6 -0
- package/dist/flags/4x3/pg-Df7s4vFf.js +6 -0
- package/dist/flags/4x3/ph-B3B1UTrp.js +6 -0
- package/dist/flags/4x3/pk-Dk1ksVx0.js +6 -0
- package/dist/flags/4x3/pl-D3tYaKmt.js +6 -0
- package/dist/flags/4x3/pm-SV9tklTs.js +6 -0
- package/dist/flags/4x3/pn-DQGkKgDr.js +6 -0
- package/dist/flags/4x3/pr-BPSfxHTy.js +6 -0
- package/dist/flags/4x3/ps-mnWMreGY.js +6 -0
- package/dist/flags/4x3/pt-VcneVeGg.js +6 -0
- package/dist/flags/4x3/pw-KY-EGmiX.js +6 -0
- package/dist/flags/4x3/py-CUyHPIqw.js +6 -0
- package/dist/flags/4x3/qa-BoCDaZ5y.js +6 -0
- package/dist/flags/4x3/re-DZBesO0V.js +6 -0
- package/dist/flags/4x3/ro-B7sesSSL.js +6 -0
- package/dist/flags/4x3/rs-B7-UORMV.js +6 -0
- package/dist/flags/4x3/ru-CdydeEda.js +6 -0
- package/dist/flags/4x3/rw-BITmNEbj.js +6 -0
- package/dist/flags/4x3/sa-CEgkBKZZ.js +6 -0
- package/dist/flags/4x3/sb-23uLUQKM.js +6 -0
- package/dist/flags/4x3/sc-DErwXRuR.js +6 -0
- package/dist/flags/4x3/sd-CjpBOzMD.js +6 -0
- package/dist/flags/4x3/se-XCNX4vGY.js +6 -0
- package/dist/flags/4x3/sg-BtnYiuwt.js +6 -0
- package/dist/flags/4x3/sh-6GY_cF-o.js +6 -0
- package/dist/flags/4x3/sh-ac-CTk21Nif.js +6 -0
- package/dist/flags/4x3/sh-hl-8dH1yqR1.js +6 -0
- package/dist/flags/4x3/sh-ta-Cdv7EnHK.js +6 -0
- package/dist/flags/4x3/si-Cw1Vyq_K.js +6 -0
- package/dist/flags/4x3/sj-CL2an3Th.js +6 -0
- package/dist/flags/4x3/sk-C4liHPFg.js +6 -0
- package/dist/flags/4x3/sl-BEPk-LAG.js +6 -0
- package/dist/flags/4x3/sm-C1vEPLxP.js +6 -0
- package/dist/flags/4x3/sn-Covr6Xmh.js +6 -0
- package/dist/flags/4x3/so-DDPk0fUE.js +6 -0
- package/dist/flags/4x3/sr-MDcgyROR.js +6 -0
- package/dist/flags/4x3/ss-Dy5O7Lgr.js +6 -0
- package/dist/flags/4x3/st-EMIr_lQj.js +6 -0
- package/dist/flags/4x3/sv-uTqJibDY.js +6 -0
- package/dist/flags/4x3/sx-CgbBHNON.js +6 -0
- package/dist/flags/4x3/sy-C4aYR08W.js +6 -0
- package/dist/flags/4x3/sz-BAgMx7HS.js +6 -0
- package/dist/flags/4x3/tc-DMg2Jb3V.js +6 -0
- package/dist/flags/4x3/td-BrA1SxCq.js +6 -0
- package/dist/flags/4x3/tf-DoYbh5AE.js +6 -0
- package/dist/flags/4x3/tg-CMdw-T1t.js +6 -0
- package/dist/flags/4x3/th-B8VvXk2o.js +6 -0
- package/dist/flags/4x3/tj-9RifD4z9.js +6 -0
- package/dist/flags/4x3/tk-D332FDkf.js +6 -0
- package/dist/flags/4x3/tl-DepW4rFc.js +6 -0
- package/dist/flags/4x3/tm-DlPsOPJl.js +6 -0
- package/dist/flags/4x3/tn-_n6aSOVC.js +6 -0
- package/dist/flags/4x3/to-BjHOduFR.js +6 -0
- package/dist/flags/4x3/tr-D8FSsqzD.js +6 -0
- package/dist/flags/4x3/tt-DF_MyPwW.js +6 -0
- package/dist/flags/4x3/tv-CaZzLQ4T.js +6 -0
- package/dist/flags/4x3/tw-DwoJdato.js +6 -0
- package/dist/flags/4x3/tz-Cwgfqcan.js +6 -0
- package/dist/flags/4x3/ua-DczPl-DK.js +6 -0
- package/dist/flags/4x3/ug-Bhd5tzWZ.js +6 -0
- package/dist/flags/4x3/um-xZ3EHJTJ.js +6 -0
- package/dist/flags/4x3/un-DW3M9Rfg.js +6 -0
- package/dist/flags/4x3/us-BZHTCCSU.js +6 -0
- package/dist/flags/4x3/uy-DkzWeMZ_.js +6 -0
- package/dist/flags/4x3/uz-CO7BpRjt.js +6 -0
- package/dist/flags/4x3/va-CuzPfqQ5.js +6 -0
- package/dist/flags/4x3/vc-Dvt-xnVp.js +6 -0
- package/dist/flags/4x3/ve-DUN0cG2f.js +6 -0
- package/dist/flags/4x3/vg-BnMCm3Lp.js +6 -0
- package/dist/flags/4x3/vi-a5qpfbwf.js +6 -0
- package/dist/flags/4x3/vn-Mfo0Etd-.js +6 -0
- package/dist/flags/4x3/vu-CMXE67-m.js +6 -0
- package/dist/flags/4x3/wf-C2pOdB7O.js +6 -0
- package/dist/flags/4x3/ws-UNuo3E3p.js +6 -0
- package/dist/flags/4x3/xk-CyeCbLw7.js +6 -0
- package/dist/flags/4x3/xx-X7wcWWS4.js +6 -0
- package/dist/flags/4x3/ye-BGZWYDat.js +6 -0
- package/dist/flags/4x3/yt-zZ_nlbyQ.js +6 -0
- package/dist/flags/4x3/za-T6vuGNwj.js +6 -0
- package/dist/flags/4x3/zm-BbWQxaas.js +6 -0
- package/dist/flags/4x3/zw-CJUOj-vi.js +6 -0
- package/dist/flags.d.ts +50 -0
- package/dist/flags.js +999 -0
- package/dist/flags.js.map +1 -0
- package/dist/flow.css +8648 -0
- package/dist/flow.d.ts +6452 -0
- package/dist/flow.js +29982 -0
- package/dist/flow.js.map +1 -0
- package/dist/index-C3WAwKdm.d.ts +6363 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/src-Ds9ArSaP.js +20940 -0
- package/dist/src-Ds9ArSaP.js.map +1 -0
- package/dist/styles.css +23945 -0
- package/package.json +191 -0
package/dist/flow.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.js","names":["Group","Button","Tabs","TabPanel","Button","Icon","AriaTextField","AriaButton","Button","portAnchorFor","Button","AriaButton","Button","listeners","version","Tag","AriaButton","Button","Group","Switch","str","anchorOf","AriaButton","AriaButton","CheckboxGroup","Checkbox","TextField","Switch","Button","Popover","AriaButton","AriaPopover","AriaButton","Button","AriaButton","Button","STATUS_ICON","AriaButton","Button","Button","AriaSwitch","AriaButton","AriaPopover","Button","Ctx","DRAWN","Button","Switch","TextArea","TextField","Button","AriaButton","Button","isTyping","AriaButton","Button","Tag","TextField","TextArea","kindOf","TextArea","Button","TextField","AriaButton","AriaButton","Tag","Button","TextArea","TextArea","TextArea","NumberInput","Switch","TextField","Button","TextArea","Tag","AriaButton","TagList","Button","Switch","TextField","Switch","TextArea","TextField","Button","Button","TextField","TextField","Link","TextArea","TextField","TextArea","Button","TextField","Checkbox","Button","TextField","CheckboxGroup","Checkbox","TextField","TextArea","AriaButton","TextField","Button","TextArea","Button","Button","Tabs","TabPanel","Button","Group","AriaButton","Button","TextField","isTextEntry","NUDGE","Button","MapIcon","Keyboard","Button","Button","Button","num","TextField","Button","TextArea","TextField","Tag","Button","TextField","Button","Button","Tag","AriaButton","Button","Button","TextField","TextArea","Switch","Button","Button","AgentMark","AriaButton","TextField","en","Button","AgentMark","AriaTextField","Switch","TextField","TextArea","AriaButton","Link","TextField","TextArea","AgentMark","Row","Button","Button","Button","Button","Button","Button"],"sources":["../src/flow/model/types.ts","../src/flow/model/graph.ts","../src/flow/geometry/rect.ts","../src/flow/geometry/viewport.ts","../src/flow/geometry/curve.ts","../src/flow/geometry/guides.ts","../src/flow/geometry/arrange.ts","../src/flow/layout/chainLayout.ts","../src/flow/layout/autoLayout.ts","../src/flow/internal/ids.ts","../src/flow/catalog/palette.ts","../src/flow/catalog/kindCatalog.ts","../src/flow/catalog/icons.ts","../src/flow/catalog/nodeState.ts","../src/flow/catalog/RenderCatalog.tsx","../src/flow/state/store.ts","../src/flow/state/graphEdits.ts","../src/flow/state/editorState.tsx","../src/flow/state/dialogStack.tsx","../src/flow/internal/Announcer.tsx","../src/flow/internal/confirm.tsx","../src/flow/internal/SectionedModal.tsx","../src/flow/internal/DockedPanel.tsx","../src/flow/internal/format.ts","../src/flow/internal/messageFormat.ts","../src/flow/internal/labels.ts","../src/flow/connectors/ConnectionPreviewLine.tsx","../src/flow/internal/useControllable.ts","../src/flow/surface/OverviewMap.tsx","../src/flow/surface/SurfaceContext.tsx","../src/flow/surface/useElementSize.ts","../src/flow/surface/useNodeMeasurement.ts","../src/flow/surface/CanvasSurface.tsx","../src/flow/nodes/GraphNodeCard.tsx","../src/flow/nodes/ports.ts","../src/flow/nodes/ConnectionPorts.tsx","../src/flow/nodes/nodeChrome.tsx","../src/flow/nodes/NodeRunIndicator.tsx","../src/flow/decision/types.ts","../src/flow/decision/DecisionNode.tsx","../src/flow/nodes/AgentIdentity.tsx","../src/flow/nodes/AgentNode.tsx","../src/flow/nodes/sourceMarks.tsx","../src/flow/nodes/DataSourceNode.tsx","../src/flow/nodes/GenericNode.tsx","../src/flow/nodes/groupLayout.ts","../src/flow/nodes/GroupNode.tsx","../src/flow/nodes/NoteNode.tsx","../src/flow/nodes/RuleNode.tsx","../src/flow/nodes/registry.tsx","../src/flow/nodes/AlignmentGuides.tsx","../src/flow/connectors/ConnectorInsertMenu.tsx","../src/flow/connectors/ConditionalConnector.tsx","../src/flow/provenance/model.ts","../src/flow/provenance/labels.ts","../src/flow/provenance/ProvenanceNode.tsx","../src/flow/provenance/ProvenanceLegend.tsx","../src/flow/provenance/ProvenanceFilters.tsx","../src/flow/provenance/ProvenanceTree.tsx","../src/flow/provenance/ProvenanceInspector.tsx","../src/flow/toolbar/CanvasNodeSearch.tsx","../src/flow/toolbar/CanvasToolbar.tsx","../src/flow/toolbar/canvasTools.ts","../src/flow/provenance/EditionCompare.tsx","../src/flow/provenance/ProvenanceCertificate.tsx","../src/flow/provenance/ProvenanceTimeline.tsx","../src/flow/provenance/ProvenanceGraph.tsx","../src/flow/provenance/NumberTrace.tsx","../src/flow/steps/ShapeChip.tsx","../src/flow/steps/researchSteps.ts","../src/flow/steps/shapes.ts","../src/flow/steps/stepLabels.ts","../src/flow/steps/StepsContext.tsx","../src/flow/steps/AddStepPicker.tsx","../src/flow/steps/FlowSidePanel.tsx","../src/flow/steps/IssueBar.tsx","../src/flow/steps/wiring.ts","../src/flow/steps/StepCard.tsx","../src/flow/steps/StepListView.tsx","../src/flow/steps/StepPalette.tsx","../src/flow/steps/stepTools.ts","../src/flow/expressions/model.ts","../src/flow/expressions/labels.ts","../src/flow/expressions/catalogContext.tsx","../src/flow/expressions/exampleCatalog.ts","../src/flow/expressions/builder/shared.tsx","../src/flow/expressions/builder/ItemList.tsx","../src/flow/expressions/builder/leaves.tsx","../src/flow/expressions/builder/tree.tsx","../src/flow/expressions/ExpressionBuilder.tsx","../src/flow/expressions/ExpressionField.tsx","../src/flow/forms/NodeFormFooter.tsx","../src/flow/expressions/ComputeInsertPanel.tsx","../src/flow/expressions/computeDraft.ts","../src/flow/expressions/TraceTree.tsx","../src/flow/expressions/ComputeTrial.tsx","../src/flow/expressions/ComputeNodeForm.tsx","../src/flow/expressions/SimulationNodeForm.tsx","../src/flow/expressions/ruleActions.ts","../src/flow/expressions/ruleCondition.ts","../src/flow/expressions/RuleEditor.tsx","../src/flow/expressions/RuleNodeForm.tsx","../src/flow/expressions/trace.ts","../src/flow/forms/SchemaConfigForm.tsx","../src/flow/forms/nameListModel.ts","../src/flow/forms/VariableListEditor.tsx","../src/flow/forms/ToolServerListField.tsx","../src/flow/forms/StartNodeForm.tsx","../src/flow/forms/AgentNodeForm.tsx","../src/flow/forms/GroupNodeForm.tsx","../src/flow/forms/OutputSchemaBuilder.tsx","../src/flow/forms/DataSourceNodeForm.tsx","../src/flow/assistant/MarkdownView.tsx","../src/flow/report/ReportView.tsx","../src/flow/forms/ReportOutputNodeForm.tsx","../src/flow/forms/DecisionNodeForm.tsx","../src/flow/dialogs/NodeConfigDialog.tsx","../src/flow/run/lineage.ts","../src/flow/run/RunStatusMark.tsx","../src/flow/run/RunPanel.tsx","../src/flow/run/runData.ts","../src/flow/run/RunDrawer.tsx","../src/flow/run/RunPreviewPanel.tsx","../src/flow/run/RunViews.tsx","../src/flow/editor/CanvasContextMenus.tsx","../src/flow/editor/focusOut.ts","../src/flow/editor/nodeBridge.tsx","../src/flow/editor/NodePalette.tsx","../src/flow/editor/FlowPreview.tsx","../src/flow/editor/keyMap.ts","../src/flow/editor/useEditorShortcuts.ts","../src/flow/editor/useSelectionArrange.ts","../src/flow/editor/FlowEditor.tsx","../src/flow/editor/AutosaveController.tsx","../src/flow/editor/editorTools.ts","../src/flow/editor/CanvasCommandBar.tsx","../src/flow/editor/FlowOutline.tsx","../src/flow/editor/FlowSwitcherBar.tsx","../src/flow/editor/SaveStatus.tsx","../src/flow/editor/RunControls.tsx","../src/flow/toolbar/dockItems.tsx","../src/flow/run/execution.ts","../src/flow/run/ShortId.tsx","../src/flow/run/NumberInput.tsx","../src/flow/run/RunInputDialog.tsx","../src/flow/run/RunReplayDialog.tsx","../src/flow/run/rewindPlan.ts","../src/flow/run/RunRewindDialog.tsx","../src/flow/run/ExecutionTimeline.tsx","../src/flow/run/VariableInspector.tsx","../src/flow/run/VersionHistoryPanel.tsx","../src/flow/dialogs/FlowSettingsDialog.tsx","../src/flow/dialogs/DefinitionExportDialog.tsx","../src/flow/dialogs/DefinitionImportDialog.tsx","../src/flow/agents/parts.tsx","../src/flow/agents/AgentEditorDialog.tsx","../src/flow/agents/AgentCreationWizard.tsx","../src/flow/assistant/visual.ts","../src/flow/assistant/useAssistantSession.ts","../src/flow/assistant/AssistantVisualBlock.tsx","../src/flow/assistant/AssistantConversation.tsx","../src/flow/assistant/threadDays.ts","../src/flow/assistant/ThreadHistory.tsx","../src/flow/assistant/LiveCanvasPanel.tsx","../src/flow/assistant/ConversationShell.tsx"],"sourcesContent":["// Graph vocabulary shared by every canvas in this package. Positions and sizes\n// are in canvas units (1 unit = 1 CSS px at zoom 1). The screen position of a\n// canvas point p is `p * zoom + (viewport.x, viewport.y)`.\n\nexport interface Point {\n x: number\n y: number\n}\n\nexport interface Size {\n width: number\n height: number\n}\n\nexport interface Rect extends Point, Size {}\n\n/** Pan offset (screen px) and zoom factor of a canvas. */\nexport interface Viewport {\n x: number\n y: number\n zoom: number\n}\n\n/** Side of a node box. `start`/`end` are the inline sides (left/right in LTR). */\nexport type Side = 'start' | 'end' | 'top' | 'bottom'\n\n/** Direction used by the editor state and the command bar. */\nexport type LayoutDirection = 'down' | 'right'\n\n/** Direction used by AutoLayout ('right-left' is the RTL reading of 'left-right'). */\nexport type RankDirection = 'top-down' | 'left-right' | 'right-left'\n\n/** A step on a canvas. `data` belongs to the node kind. */\nexport interface FlowNode<D extends Record<string, unknown> = Record<string, unknown>> {\n id: string\n kind: string\n position: Point\n data: D\n /** Size the node declares (card width variant, note size, group frame). */\n size?: Size\n /** Size measured in the browser, when available. */\n measured?: Size\n /** Enclosing group frame; the position is then relative to that frame. */\n parentId?: string\n selected?: boolean\n hidden?: boolean\n}\n\n/** A directed connection between two nodes (the fork called these edges). */\nexport interface FlowConnector {\n id: string\n source: string\n target: string\n sourcePort?: string\n targetPort?: string\n /** Explicit branch label; otherwise derived from well-known output ports. */\n label?: string\n /** Branch condition carried with the connector (opaque to the canvas). */\n condition?: unknown\n selected?: boolean\n hidden?: boolean\n}\n\nexport interface FlowGraph {\n nodes: FlowNode[]\n connectors: FlowConnector[]\n viewport: Viewport\n}\n\n/** Per-node state of the live or inspected run held by the editor state. */\nexport type NodeResultStatus = 'pending' | 'running' | 'success' | 'error'\n\nexport interface NodeRunResult {\n status: NodeResultStatus\n data?: unknown\n error?: string\n durationMs?: number\n}\n\n/** Status vocabulary of read-only previews and run inspection. */\nexport type RunStatus = 'running' | 'completed' | 'failed' | 'skipped' | 'restored' | 'served-from-history' | 'unknown'\n\nexport const ORIGIN_VIEWPORT: Viewport = Object.freeze({ x: 0, y: 0, zoom: 1 })\n","// Pure graph queries over node ids and directed pairs. Nothing here knows about\n// React, the DOM or a particular node kind.\n\nexport interface DirectedPair {\n source: string\n target: string\n}\n\ninterface Adjacency {\n out: Map<string, string[]>\n into: Map<string, string[]>\n}\n\nfunction adjacency(ids: Iterable<string>, pairs: readonly DirectedPair[]): Adjacency {\n const out = new Map<string, string[]>()\n const into = new Map<string, string[]>()\n for (const id of ids) {\n out.set(id, [])\n into.set(id, [])\n }\n for (const { source, target } of pairs) {\n if (!out.has(source) || !into.has(target)) continue\n out.get(source)!.push(target)\n into.get(target)!.push(source)\n }\n return { out, into }\n}\n\n/**\n * Kahn ordering that keeps the given id order as the tie-break, so the result\n * is stable. Ids left over by a cycle are appended in their original order.\n */\nexport function topologicalOrder(ids: readonly string[], pairs: readonly DirectedPair[]): string[] {\n const { out, into } = adjacency(ids, pairs)\n const remaining = new Map(ids.map((id) => [id, into.get(id)!.length]))\n const rankOf = new Map(ids.map((id, i) => [id, i]))\n const ready = ids.filter((id) => remaining.get(id) === 0)\n const ordered: string[] = []\n const placed = new Set<string>()\n while (ready.length) {\n ready.sort((a, b) => rankOf.get(a)! - rankOf.get(b)!)\n const id = ready.shift()!\n ordered.push(id)\n placed.add(id)\n for (const next of out.get(id)!) {\n const left = remaining.get(next)! - 1\n remaining.set(next, left)\n if (left === 0) ready.push(next)\n }\n }\n for (const id of ids) if (!placed.has(id)) ordered.push(id)\n return ordered\n}\n\n/** Longest-path layer of each id (sources are layer 0); cycles fall back to 0. */\nexport function layerIndex(ids: readonly string[], pairs: readonly DirectedPair[]): Map<string, number> {\n const order = topologicalOrder(ids, pairs)\n const { into } = adjacency(ids, pairs)\n const layer = new Map<string, number>()\n for (const id of order) {\n let best = 0\n for (const parent of into.get(id)!) {\n const l = layer.get(parent)\n if (l !== undefined) best = Math.max(best, l + 1)\n }\n layer.set(id, best)\n }\n return layer\n}\n\nexport type HopDirection = 'backward' | 'forward' | 'both'\n\n/**\n * Ids reachable from `focus` within `hops` steps. `backward` follows pairs\n * against their direction (towards what the focus was derived from),\n * `forward` along them. Returns a map id → distance (focus is 0).\n */\nexport function withinHops(focus: string, pairs: readonly DirectedPair[], hops: number, direction: HopDirection): Map<string, number> {\n const forward = new Map<string, string[]>()\n const backward = new Map<string, string[]>()\n for (const { source, target } of pairs) {\n if (!forward.has(source)) forward.set(source, [])\n if (!backward.has(target)) backward.set(target, [])\n forward.get(source)!.push(target)\n backward.get(target)!.push(source)\n }\n const found = new Map<string, number>([[focus, 0]])\n const walk = (links: Map<string, string[]>) => {\n let frontier = [focus]\n for (let step = 1; step <= hops && frontier.length; step++) {\n const next: string[] = []\n for (const id of frontier) {\n for (const n of links.get(id) ?? []) {\n if (found.has(n) && found.get(n)! <= step) continue\n found.set(n, step)\n next.push(n)\n }\n }\n frontier = next\n }\n }\n if (direction !== 'forward') walk(backward)\n if (direction !== 'backward') walk(forward)\n return found\n}\n\n/** Every id that can reach `id` (its ancestors), nearest first. */\nexport function ancestorsOf(id: string, pairs: readonly DirectedPair[]): string[] {\n const within = withinHops(id, pairs, Number.POSITIVE_INFINITY, 'backward')\n within.delete(id)\n return [...within.entries()].sort((a, b) => a[1] - b[1]).map(([k]) => k)\n}\n\n/** Direct predecessors and successors of `id`. */\nexport function neighboursOf(id: string, pairs: readonly DirectedPair[]): { incoming: string[]; outgoing: string[] } {\n const incoming: string[] = []\n const outgoing: string[] = []\n for (const p of pairs) {\n if (p.target === id) incoming.push(p.source)\n if (p.source === id) outgoing.push(p.target)\n }\n return { incoming, outgoing }\n}\n","import type { FlowNode, Point, Rect, Side, Size } from '../model/types'\n\n/** Size assumed for a node that neither declares nor has a measured size. */\nexport const FALLBACK_NODE_SIZE: Readonly<Size> = Object.freeze({ width: 256, height: 96 })\n\n/** Measured size, else declared size, else the fallback. */\nexport function sizeOf(node: Pick<FlowNode, 'size' | 'measured'>, fallback: Size = FALLBACK_NODE_SIZE): Size {\n const m = node.measured\n if (m && m.width > 0 && m.height > 0) return { width: m.width, height: m.height }\n const d = node.size\n if (d && d.width > 0 && d.height > 0) return { width: d.width, height: d.height }\n return { width: fallback.width, height: fallback.height }\n}\n\n/**\n * Absolute box of a node on the canvas. Positions of grouped nodes are\n * relative to their frame, so the frame chain is followed.\n */\nexport function absoluteRect(node: FlowNode, byId: ReadonlyMap<string, FlowNode>, fallback?: Size): Rect {\n let x = node.position.x\n let y = node.position.y\n let parent = node.parentId ? byId.get(node.parentId) : undefined\n const seen = new Set<string>([node.id])\n while (parent && !seen.has(parent.id)) {\n seen.add(parent.id)\n x += parent.position.x\n y += parent.position.y\n parent = parent.parentId ? byId.get(parent.parentId) : undefined\n }\n return { x, y, ...sizeOf(node, fallback) }\n}\n\nexport function centreOf(r: Rect): Point {\n return { x: r.x + r.width / 2, y: r.y + r.height / 2 }\n}\n\n/** Smallest box holding every rect, or null for none. */\nexport function enclosingRect(rects: readonly Rect[]): Rect | null {\n if (!rects.length) return null\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n for (const r of rects) {\n minX = Math.min(minX, r.x)\n minY = Math.min(minY, r.y)\n maxX = Math.max(maxX, r.x + r.width)\n maxY = Math.max(maxY, r.y + r.height)\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n}\n\nexport function growRect(r: Rect, by: number): Rect {\n return { x: r.x - by, y: r.y - by, width: r.width + by * 2, height: r.height + by * 2 }\n}\n\nexport function containsPoint(r: Rect, p: Point): boolean {\n return p.x >= r.x && p.x <= r.x + r.width && p.y >= r.y && p.y <= r.y + r.height\n}\n\nexport function rectsOverlap(a: Rect, b: Rect): boolean {\n return a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height\n}\n\n/**\n * Point on a side of a box. `along` is 0..1 from the top (inline sides) or\n * from the start (block sides); 0.5 is the middle.\n */\nexport function pointOnSide(r: Rect, side: Side, along = 0.5): Point {\n const t = Math.min(1, Math.max(0, along))\n switch (side) {\n case 'start':\n return { x: r.x, y: r.y + r.height * t }\n case 'end':\n return { x: r.x + r.width, y: r.y + r.height * t }\n case 'top':\n return { x: r.x + r.width * t, y: r.y }\n case 'bottom':\n return { x: r.x + r.width * t, y: r.y + r.height }\n }\n}\n\n/**\n * Where the ray from the centre of `r` towards `towards` leaves the box, and\n * which side it crosses. Used by border-attached (\"floating\") connectors.\n */\nexport function exitPoint(r: Rect, towards: Point): { point: Point; side: Side } {\n const c = centreOf(r)\n const dx = towards.x - c.x\n const dy = towards.y - c.y\n if (dx === 0 && dy === 0) return { point: { x: r.x + r.width, y: c.y }, side: 'end' }\n const halfW = r.width / 2\n const halfH = r.height / 2\n // Scale factor at which the ray meets each pair of sides; the smaller wins.\n const tx = dx === 0 ? Infinity : halfW / Math.abs(dx)\n const ty = dy === 0 ? Infinity : halfH / Math.abs(dy)\n if (tx <= ty) {\n return { point: { x: c.x + dx * tx, y: c.y + dy * tx }, side: dx > 0 ? 'end' : 'start' }\n }\n return { point: { x: c.x + dx * ty, y: c.y + dy * ty }, side: dy > 0 ? 'bottom' : 'top' }\n}\n","import type { Point, Rect, Size, Viewport } from '../model/types'\n\nexport interface ZoomLimits {\n min: number\n max: number\n}\n\nexport const DEFAULT_ZOOM_LIMITS: Readonly<ZoomLimits> = Object.freeze({ min: 0.2, max: 2.5 })\n\n/** Zoom steps used by the zoom in / zoom out tools (a readable ladder, not a factor). */\nexport const ZOOM_LADDER = [0.2, 0.25, 0.33, 0.5, 0.67, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5] as const\n\nexport function clampZoom(z: number, limits: ZoomLimits = DEFAULT_ZOOM_LIMITS): number {\n return Math.min(limits.max, Math.max(limits.min, z))\n}\n\nexport function screenToCanvas(v: Viewport, p: Point): Point {\n return { x: (p.x - v.x) / v.zoom, y: (p.y - v.y) / v.zoom }\n}\n\nexport function canvasToScreen(v: Viewport, p: Point): Point {\n return { x: p.x * v.zoom + v.x, y: p.y * v.zoom + v.y }\n}\n\n/** New viewport with zoom `z` that keeps the canvas point under `pivot` (screen) still. */\nexport function zoomAt(v: Viewport, z: number, pivot: Point, limits?: ZoomLimits): Viewport {\n const zoom = clampZoom(z, limits)\n const anchor = screenToCanvas(v, pivot)\n return { zoom, x: pivot.x - anchor.x * zoom, y: pivot.y - anchor.y * zoom }\n}\n\n/** Next step of the zoom ladder above (`+1`) or below (`-1`) the current zoom. */\nexport function ladderStep(current: number, direction: 1 | -1, limits?: ZoomLimits): number {\n const eps = 0.001\n const steps = direction > 0 ? ZOOM_LADDER.filter((s) => s > current + eps) : [...ZOOM_LADDER].reverse().filter((s) => s < current - eps)\n return clampZoom(steps[0] ?? current, limits)\n}\n\n/** Viewport that shows `bounds` centred in a container, with `padding` screen px around it. */\nexport function fitBounds(bounds: Rect | null, container: Size, padding = 48, limits: ZoomLimits = DEFAULT_ZOOM_LIMITS, maxFitZoom = 1): Viewport {\n if (!bounds || container.width <= 0 || container.height <= 0) return { x: 0, y: 0, zoom: 1 }\n const availW = Math.max(1, container.width - padding * 2)\n const availH = Math.max(1, container.height - padding * 2)\n const raw = Math.min(availW / Math.max(1, bounds.width), availH / Math.max(1, bounds.height))\n const zoom = clampZoom(Math.min(raw, maxFitZoom), limits)\n const x = (container.width - bounds.width * zoom) / 2 - bounds.x * zoom\n const y = (container.height - bounds.height * zoom) / 2 - bounds.y * zoom\n return { x, y, zoom }\n}\n\n/** Viewport shifted just enough to bring `target` (canvas rect) inside the container, with a margin. */\nexport function revealRect(v: Viewport, target: Rect, container: Size, margin = 32): Viewport {\n const left = target.x * v.zoom + v.x\n const top = target.y * v.zoom + v.y\n const right = left + target.width * v.zoom\n const bottom = top + target.height * v.zoom\n let dx = 0\n let dy = 0\n if (left < margin) dx = margin - left\n else if (right > container.width - margin) dx = container.width - margin - right\n if (top < margin) dy = margin - top\n else if (bottom > container.height - margin) dy = container.height - margin - bottom\n if (!dx && !dy) return v\n return { ...v, x: v.x + dx, y: v.y + dy }\n}\n\n/** The part of the canvas currently on screen. */\nexport function visibleArea(v: Viewport, container: Size): Rect {\n return { x: -v.x / v.zoom, y: -v.y / v.zoom, width: container.width / v.zoom, height: container.height / v.zoom }\n}\n","import type { Point, Side } from '../model/types'\n\n/** An end of a connector: where it touches the node and which way that side faces. */\nexport interface CurveEnd {\n point: Point\n side: Side\n}\n\nexport interface CurveGeometry {\n /** SVG path data (one cubic segment). */\n d: string\n /** Point halfway along the curve parameter, for labels and controls. */\n mid: Point\n /** Unit direction of travel where the curve meets the target. */\n arrival: Point\n}\n\nconst OUTWARD: Record<Side, Point> = {\n start: { x: -1, y: 0 },\n end: { x: 1, y: 0 },\n top: { x: 0, y: -1 },\n bottom: { x: 0, y: 1 },\n}\n\nconst round = (n: number) => Math.round(n * 100) / 100\n\n/**\n * A single cubic segment that leaves `from` perpendicular to its side and\n * arrives at `to` perpendicular to its side. The handle length grows with the\n * distance between the ends, within bounds, so short hops stay tight and long\n * ones stay smooth.\n */\nexport function connectorCurve(from: CurveEnd, to: CurveEnd): CurveGeometry {\n const span = Math.hypot(to.point.x - from.point.x, to.point.y - from.point.y)\n const reach = Math.min(160, Math.max(24, span * 0.45))\n const a = OUTWARD[from.side]\n const b = OUTWARD[to.side]\n const c1 = { x: from.point.x + a.x * reach, y: from.point.y + a.y * reach }\n const c2 = { x: to.point.x + b.x * reach, y: to.point.y + b.y * reach }\n // Bernstein weights at t = 1/2 are 1/8, 3/8, 3/8, 1/8.\n const mid = {\n x: (from.point.x + 3 * c1.x + 3 * c2.x + to.point.x) / 8,\n y: (from.point.y + 3 * c1.y + 3 * c2.y + to.point.y) / 8,\n }\n const ax = to.point.x - c2.x\n const ay = to.point.y - c2.y\n const len = Math.hypot(ax, ay) || 1\n const d = `M${round(from.point.x)},${round(from.point.y)} C${round(c1.x)},${round(c1.y)} ${round(c2.x)},${round(c2.y)} ${round(to.point.x)},${round(to.point.y)}`\n return { d, mid, arrival: { x: ax / len, y: ay / len } }\n}\n\n/** Side a free pointer end should be treated as facing, given where the line comes from. */\nexport function facingSide(from: Point, to: Point): Side {\n const dx = to.x - from.x\n const dy = to.y - from.y\n if (Math.abs(dx) >= Math.abs(dy)) return dx >= 0 ? 'start' : 'end'\n return dy >= 0 ? 'top' : 'bottom'\n}\n","import type { Rect } from '../model/types'\n\n/** Guide lines found while a node is dragged, in canvas units. */\nexport interface GuidePositions {\n /** y of a horizontal guide, or null. */\n horizontal: number | null\n /** x of a vertical guide, or null. */\n vertical: number | null\n}\n\nexport interface GuideMatch extends GuidePositions {\n /** Ids of the nodes each guide aligns with (for announcements). */\n horizontalWith: string | null\n verticalWith: string | null\n}\n\nexport const NO_GUIDES: Readonly<GuidePositions> = Object.freeze({ horizontal: null, vertical: null })\n\n/** Snap distance in canvas units within which two lines count as aligned. */\nexport const GUIDE_THRESHOLD = 6\n\nconst xLines = (r: Rect) => [r.x, r.x + r.width / 2, r.x + r.width]\nconst yLines = (r: Rect) => [r.y, r.y + r.height / 2, r.y + r.height]\n\n/**\n * Compares the start, centre and end lines of `moving` with those of every\n * other box on each axis and keeps the closest match within the threshold.\n */\nexport function findGuides(moving: Rect, others: ReadonlyArray<{ id: string; rect: Rect }>, threshold = GUIDE_THRESHOLD): GuideMatch {\n let bestX = { gap: threshold + 1, at: null as number | null, id: null as string | null }\n let bestY = { gap: threshold + 1, at: null as number | null, id: null as string | null }\n const mx = xLines(moving)\n const my = yLines(moving)\n for (const { id, rect } of others) {\n for (const line of xLines(rect)) {\n for (const own of mx) {\n const gap = Math.abs(line - own)\n if (gap <= threshold && gap < bestX.gap) bestX = { gap, at: line, id }\n }\n }\n for (const line of yLines(rect)) {\n for (const own of my) {\n const gap = Math.abs(line - own)\n if (gap <= threshold && gap < bestY.gap) bestY = { gap, at: line, id }\n }\n }\n }\n return { vertical: bestX.at, horizontal: bestY.at, verticalWith: bestX.id, horizontalWith: bestY.id }\n}\n","// Arithmetic behind \"align\", \"distribute\" and \"group\" of SelectionArrange.\n// Works on plain boxes keyed by id; callers map results back onto nodes.\n\nimport type { Point, Rect } from '../model/types'\nimport { enclosingRect } from './rect'\n\nexport type AlignEdge = 'left' | 'right' | 'top' | 'bottom' | 'centerHorizontal' | 'centerVertical'\nexport type DistributeAxis = 'horizontal' | 'vertical'\n\nexport interface Placed {\n id: string\n rect: Rect\n}\n\n/** New top-left corners after aligning the boxes along one edge or centre line. */\nexport function alignBoxes(boxes: readonly Placed[], edge: AlignEdge): Map<string, Point> {\n const moved = new Map<string, Point>()\n if (boxes.length < 2) return moved\n const lefts = boxes.map((b) => b.rect.x)\n const tops = boxes.map((b) => b.rect.y)\n const rights = boxes.map((b) => b.rect.x + b.rect.width)\n const bottoms = boxes.map((b) => b.rect.y + b.rect.height)\n const cxs = boxes.map((b) => b.rect.x + b.rect.width / 2)\n const cys = boxes.map((b) => b.rect.y + b.rect.height / 2)\n const midX = (Math.min(...cxs) + Math.max(...cxs)) / 2\n const midY = (Math.min(...cys) + Math.max(...cys)) / 2\n for (const { id, rect } of boxes) {\n let { x, y } = rect\n if (edge === 'left') x = Math.min(...lefts)\n if (edge === 'right') x = Math.max(...rights) - rect.width\n if (edge === 'top') y = Math.min(...tops)\n if (edge === 'bottom') y = Math.max(...bottoms) - rect.height\n // \"Centre horizontally\" lines centres up on a vertical line (shared x).\n if (edge === 'centerHorizontal') x = midX - rect.width / 2\n if (edge === 'centerVertical') y = midY - rect.height / 2\n moved.set(id, { x, y })\n }\n return moved\n}\n\n/**\n * Keeps the first and last box (by position on the axis) in place and gives\n * every neighbouring pair the same gap.\n */\nexport function distributeBoxes(boxes: readonly Placed[], axis: DistributeAxis): Map<string, Point> {\n const moved = new Map<string, Point>()\n if (boxes.length < 3) return moved\n const key = axis === 'horizontal' ? 'x' : 'y'\n const extent = axis === 'horizontal' ? 'width' : 'height'\n const sorted = [...boxes].sort((a, b) => a.rect[key] - b.rect[key])\n const first = sorted[0]!\n const last = sorted[sorted.length - 1]!\n const occupied = sorted.reduce((sum, b) => sum + b.rect[extent], 0)\n const span = last.rect[key] + last.rect[extent] - first.rect[key]\n const gap = (span - occupied) / (sorted.length - 1)\n let cursor = first.rect[key]\n for (const b of sorted) {\n moved.set(b.id, axis === 'horizontal' ? { x: cursor, y: b.rect.y } : { x: b.rect.x, y: cursor })\n cursor += b.rect[extent] + gap\n }\n return moved\n}\n\n/** Frame box for a group around `boxes`: padding on every side plus a header band on top. */\nexport function frameAround(boxes: readonly Placed[], padding: number, header: number): Rect | null {\n const bounds = enclosingRect(boxes.map((b) => b.rect))\n if (!bounds) return null\n return {\n x: bounds.x - padding,\n y: bounds.y - padding - header,\n width: bounds.width + padding * 2,\n height: bounds.height + padding * 2 + header,\n }\n}\n","// Chain placement for flows that read downwards: each step sits in its first\n// parent's column, a parent's later children step toward the inline end, and\n// a step that would overlap one already placed in its row moves along until\n// it fits. The main chain therefore stays on one straight line. Pure.\n\nimport type { Point, Size } from '../model/types'\n\nexport interface ChainOptions {\n rankGap: number\n siblingGap: number\n margin: number\n rtl?: boolean\n}\n\n/** Top-left corners by id for `sizes` (insertion order breaks ties). */\nexport function placeChain(sizes: ReadonlyMap<string, Size>, links: ReadonlyArray<{ source: string; target: string }>, o: ChainOptions): Map<string, Point> {\n const ids = [...sizes.keys()]\n const kids = new Map<string, string[]>(ids.map((id) => [id, []]))\n const parents = new Map<string, string[]>(ids.map((id) => [id, []]))\n for (const { source, target } of links) {\n if (source === target || !sizes.has(source) || !sizes.has(target)) continue\n kids.get(source)!.push(target)\n parents.get(target)!.push(source)\n }\n // Row = longest path from a start (cycles are cut by the visit guard).\n const row = new Map<string, number>()\n const depth = (id: string, seen: Set<string>): number => {\n if (row.has(id)) return row.get(id)!\n if (seen.has(id)) return 0\n seen.add(id)\n const d = Math.max(-1, ...parents.get(id)!.map((p) => depth(p, seen))) + 1\n row.set(id, d)\n return d\n }\n ids.forEach((id) => depth(id, new Set()))\n const rows = Math.max(0, ...row.values()) + 1\n const rowHeight = Math.max(0, ...[...sizes.values()].map((s) => s.height)) + o.rankGap\n const used: Array<Array<[number, number]>> = Array.from({ length: rows }, () => [])\n const x = new Map<string, number>()\n const fits = (r: number, from: number, w: number) => used[r]!.every(([a, b]) => from + w + o.siblingGap <= a || from >= b + o.siblingGap)\n let rootEnd = 0\n for (let r = 0; r < rows; r++) {\n for (const id of ids.filter((i) => row.get(i) === r)) {\n const w = sizes.get(id)!.width\n const first = parents.get(id)!.find((p) => x.has(p))\n let want: number\n if (first === undefined) {\n want = rootEnd\n } else {\n const order = kids.get(first)!.indexOf(id)\n want = x.get(first)! + order * (w + o.siblingGap)\n }\n while (!fits(r, want, w)) want += 8\n x.set(id, want)\n used[r]!.push([want, want + w])\n if (first === undefined) rootEnd = want + w + o.siblingGap\n }\n }\n const right = Math.max(0, ...ids.map((id) => x.get(id)! + sizes.get(id)!.width))\n const out = new Map<string, Point>()\n for (const id of ids) {\n const left = o.rtl ? right - x.get(id)! - sizes.get(id)!.width : x.get(id)!\n out.set(id, { x: left + o.margin, y: row.get(id)! * rowHeight + o.margin })\n }\n return out\n}\n","// Ranked placement of a directed graph so connectors read one way. The\n// crossing reduction and coordinates come from @dagrejs/dagre (MIT); this\n// module only chooses who takes part, feeds sizes in and reads corners out.\n// Pure: the input list is never changed.\n\nimport { placeChain } from './chainLayout'\nimport { Graph, layout } from '@dagrejs/dagre'\nimport { sizeOf } from '../geometry/rect'\nimport type { Point, RankDirection, Size } from '../model/types'\n\nexport interface LayoutNode {\n id: string\n kind: string\n position: Point\n size?: Size\n measured?: Size\n parentId?: string\n}\n\nexport interface LayoutEdge {\n source: string\n target: string\n}\n\nexport interface AutoLayoutOptions {\n /** Gap between ranks (design direction §2.1: --ty-space-8 = 64). */\n rankGap?: number\n /** Gap between nodes of one rank (--ty-space-6 = 32). */\n siblingGap?: number\n /** Margin around the whole layout (--ty-space-5 = 24). */\n margin?: number\n /** Kinds whose nodes are never moved (annotations). Default: note. */\n fixedKinds?: readonly string[]\n /** Size to assume when a node has neither measured nor declared size. */\n fallbackSize?: Size\n /**\n * `start` (top-down only) keeps a chain on one line and puts branches after\n * it toward the inline end, which `rtl` flips (see chainLayout.ts);\n * `centre` (default) centres parents over their children.\n */\n alignment?: 'centre' | 'start'\n rtl?: boolean\n}\n\nconst RANKDIR: Record<RankDirection, 'TB' | 'LR' | 'RL'> = { 'top-down': 'TB', 'left-right': 'LR', 'right-left': 'RL' }\n\n/** Top-left corner for every node that takes part, keyed by id. */\nfunction placeRanked(members: readonly LayoutNode[], links: readonly LayoutEdge[], direction: RankDirection, o: AutoLayoutOptions): Map<string, Point> {\n const g = new Graph()\n const edgeGap = o.margin ?? 24\n g.setGraph({\n rankdir: RANKDIR[direction],\n ranksep: o.rankGap ?? 64,\n nodesep: o.siblingGap ?? 32,\n marginx: edgeGap,\n marginy: edgeGap,\n })\n g.setDefaultEdgeLabel(() => ({}))\n const sizes = new Map(members.map((m) => [m.id, sizeOf(m, o.fallbackSize)]))\n sizes.forEach((s, id) => g.setNode(id, { width: s.width, height: s.height }))\n for (const { source, target } of links) if (source !== target && sizes.has(source) && sizes.has(target)) g.setEdge(source, target)\n layout(g)\n const corners = new Map<string, Point>()\n sizes.forEach((s, id) => {\n const centre = g.node(id) as { x: number; y: number } | undefined\n if (centre) corners.set(id, { x: centre.x - s.width / 2, y: centre.y - s.height / 2 })\n })\n return corners\n}\n\n/** Arranges nodes in ranks. Grouped children and fixed kinds (notes) keep their positions. */\nexport function autoLayout<N extends LayoutNode>(nodes: readonly N[], connectors: readonly LayoutEdge[], direction: RankDirection, options: AutoLayoutOptions = {}): N[] {\n const staysPut = new Set(options.fixedKinds ?? ['note'])\n const members = nodes.filter((n) => n.parentId === undefined && !staysPut.has(n.kind))\n const corners = !members.length\n ? new Map<string, Point>()\n : options.alignment === 'start' && direction === 'top-down'\n ? placeChain(new Map(members.map((m) => [m.id, sizeOf(m, options.fallbackSize)])), connectors, { rankGap: options.rankGap ?? 64, siblingGap: options.siblingGap ?? 32, margin: options.margin ?? 24, rtl: !!options.rtl })\n : placeRanked(members, connectors, direction, options)\n return nodes.map((n) => {\n const corner = corners.get(n.id)\n return corner ? { ...n, position: corner } : n\n })\n}\n\n/**\n * Maps the editor's direction names onto AutoLayout's. A horizontal flow reads\n * in the text direction: right-to-left in RTL locales unless `keepLtr`.\n */\nexport function rankDirectionOf(direction: 'down' | 'right', rtl = false, keepLtr = false): RankDirection {\n if (direction === 'down') return 'top-down'\n return rtl && !keepLtr ? 'right-left' : 'left-right'\n}\n","let counter = 0\n\n/** A new unique id with a readable prefix (`node-3f9c…`). */\nexport function createId(prefix = 'id'): string {\n const c = globalThis.crypto\n const random = c && typeof c.randomUUID === 'function' ? c.randomUUID().slice(0, 8) : Math.random().toString(36).slice(2, 10)\n counter = (counter + 1) % 1_000_000\n return `${prefix}-${random}${counter.toString(36)}`\n}\n","// FlowPaletteTokens (wave-4 spec): every colour decision of the canvas as a\n// token reference. Components receive `var(--ty-flow-…)` strings or a tone\n// name for a data attribute; never a literal colour.\n\nexport const TONE_NAMES = [\n 'categorical-1',\n 'categorical-2',\n 'categorical-3',\n 'categorical-4',\n 'categorical-5',\n 'categorical-6',\n 'categorical-7',\n 'categorical-8',\n 'neutral',\n] as const\n\nexport type ToneName = (typeof TONE_NAMES)[number]\n\nexport function isToneName(value: unknown): value is ToneName {\n return typeof value === 'string' && (TONE_NAMES as readonly string[]).includes(value)\n}\n\n/**\n * Default tone per kind family, used when the backend catalog sends none.\n * Start and end share a tone (icon and label tell them apart).\n */\nconst FAMILY_TONES: ReadonlyArray<[ToneName, readonly string[]]> = [\n ['categorical-1', ['start', 'end', 'trigger', 'input', 'output']],\n ['categorical-2', ['if-else', 'branch', 'switch', 'rule', 'condition', 'decision']],\n ['categorical-3', ['code', 'compute', 'iteration', 'iteration-start', 'loop', 'simulation', 'transform']],\n ['categorical-4', ['agent', 'answer', 'llm']],\n ['categorical-5', ['report-output', 'report', 'dashboard']],\n ['categorical-6', ['datasource', 'data-source']],\n // Provenance kinds (W3C PROV, design direction §3.13).\n ['categorical-7', ['query', 'retrieval', 'source']],\n ['categorical-8', ['assertion', 'record', 'verification', 'analysis', 'edition', 'manuscript']],\n ['neutral', ['note', 'group']],\n]\n\nconst defaultTones = new Map<string, ToneName>()\nfor (const [tone, kinds] of FAMILY_TONES) for (const k of kinds) defaultTones.set(k, tone)\n\nlet catalogTones = new Map<string, ToneName>()\nlet hostTones = new Map<string, ToneName>()\n\n/** Installs tones read from the backend node catalog (invalid names are ignored). */\nexport function setCatalogTones(map: Record<string, string | undefined>): void {\n const next = new Map<string, ToneName>()\n for (const [kind, tone] of Object.entries(map)) if (isToneName(tone)) next.set(kind, tone)\n catalogTones = next\n}\n\n/** Host override of kind tones. Throws on a tone that is not a categorical token name. */\nexport function overrideKindTones(map: Record<string, string>): void {\n const next = new Map(hostTones)\n for (const [kind, tone] of Object.entries(map)) {\n if (!isToneName(tone)) {\n throw new Error(`overrideKindTones: \"${tone}\" (kind \"${kind}\") is not a tone name; expected one of ${TONE_NAMES.join(', ')}.`)\n }\n next.set(kind, tone)\n }\n hostTones = next\n}\n\n/** Clears host overrides and catalog tones (tests, host teardown). */\nexport function resetKindTones(): void {\n catalogTones = new Map()\n hostTones = new Map()\n}\n\n/** Tone for a kind: host override, then catalog, then default family, then neutral. */\nexport function kindTone(kind: string): ToneName {\n return hostTones.get(kind) ?? catalogTones.get(kind) ?? defaultTones.get(kind) ?? 'neutral'\n}\n\nexport interface KindTokenRefs {\n bubble: string\n bubbleInk: string\n badge: string\n badgeInk: string\n minimap: string\n port: string\n}\n\n/** Token references for the parts drawn in a kind's tone. */\nexport function toneTokens(tone: ToneName): KindTokenRefs {\n return {\n bubble: `var(--ty-flow-tone-${tone})`,\n bubbleInk: `var(--ty-flow-tone-${tone}-ink)`,\n badge: `var(--ty-flow-tone-${tone}-soft)`,\n badgeInk: `var(--ty-flow-tone-${tone}-text)`,\n minimap: `var(--ty-flow-tone-${tone})`,\n port: `var(--ty-flow-tone-${tone})`,\n }\n}\n\nexport function kindTokens(kind: string): KindTokenRefs {\n return toneTokens(kindTone(kind))\n}\n\n/** Connector colours. Every conditional connector also carries a word and a line style. */\nexport const connectorTokens = Object.freeze({\n rest: 'var(--ty-flow-connector)',\n active: 'var(--ty-flow-connector-active)',\n true: 'var(--ty-flow-connector-true)',\n false: 'var(--ty-flow-connector-false)',\n rule: 'var(--ty-flow-connector-rule)',\n})\n\n/** Run accent of a running node: always the semantic pending colour, never the kind tone. */\nexport const RUN_ACCENT = 'var(--ty-flow-ring-running)'\n","// NodeKindCatalog store: the backend's list of node kinds, installed once and\n// queried by every canvas part. Everything answers \"empty\" until installed.\n\nimport type { Side } from '../model/types'\nimport { createId } from '../internal/ids'\nimport { setCatalogTones } from './palette'\n\nexport type BranchTone = 'success' | 'error' | 'info' | 'warning' | 'neutral'\n\nexport interface PortSpec {\n id: string\n side: Side\n /** Position along the side in percent (0–100); centred when absent. */\n offset?: number\n label?: string\n tone?: BranchTone\n}\n\nexport interface PortTopology {\n inputs: PortSpec[]\n outputs: PortSpec[]\n}\n\nexport interface FieldSchema {\n type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'\n enum?: Array<string | number>\n description?: string\n title?: string\n format?: string\n default?: unknown\n}\n\nexport interface ConfigSchema {\n properties?: Record<string, FieldSchema>\n required?: string[]\n}\n\n/** Which form NodeConfigDialog shows for a kind. */\nexport type FormKind = 'compute' | 'simulation' | 'start' | 'agent' | 'rule' | 'report-output' | 'group' | 'datasource' | 'decision' | 'schema'\n\nexport interface NodeKindEntry {\n kind: string\n label: string\n category: string\n description?: string\n /** Icon registry key (lucide name in kebab case, e.g. \"git-branch\"). */\n icon?: string\n /** Tone name (categorical-1…8 or neutral). Never a colour. */\n tone?: string\n ports?: PortTopology\n defaultConfig?: Record<string, unknown>\n configSchema?: ConfigSchema\n formKind?: FormKind\n experimental?: boolean\n deprecated?: boolean\n}\n\n/** Kinds configured by choosing an existing thing (a saved agent, rule or source). */\nexport const PICKER_KINDS: readonly string[] = ['agent', 'rule', 'datasource']\n\nconst IDENTIFIER_KEY = /^(id|[a-z][A-Za-z0-9]*Id)$/\n\nfunction cloneFillingIds(value: unknown, key: string | null): unknown {\n if (Array.isArray(value)) return value.map((v) => cloneFillingIds(v, null))\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) out[k] = cloneFillingIds(v, k)\n return out\n }\n if (key !== null && IDENTIFIER_KEY.test(key) && value === '') return createId(key === 'id' ? 'item' : key.replace(/Id$/, ''))\n return value\n}\n\ntype Listener = () => void\n\nexport class NodeKindCatalogStore {\n private entries: NodeKindEntry[] = []\n private index = new Map<string, NodeKindEntry>()\n private loaded = false\n private listeners = new Set<Listener>()\n private version = 0\n\n /** Replaces the catalog. Order is kept for palettes and grouping. */\n install(entries: readonly NodeKindEntry[]): void {\n this.entries = entries.map((e) => ({ ...e }))\n this.index = new Map(this.entries.map((e) => [e.kind, e]))\n this.loaded = true\n const tones: Record<string, string | undefined> = {}\n for (const e of this.entries) tones[e.kind] = e.tone\n setCatalogTones(tones)\n this.bump()\n }\n\n /** Back to \"not loaded\". */\n reset(): void {\n this.entries = []\n this.index = new Map()\n this.loaded = false\n setCatalogTones({})\n this.bump()\n }\n\n isLoaded(): boolean {\n return this.loaded\n }\n\n entry(kind: string): NodeKindEntry | undefined {\n return this.loaded ? this.index.get(kind) : undefined\n }\n\n exists(kind: string): boolean {\n return this.loaded && this.index.has(kind)\n }\n\n kinds(): string[] {\n return this.loaded ? this.entries.map((e) => e.kind) : []\n }\n\n /** Kinds grouped by category, both in catalog order. */\n byCategory(): Array<{ category: string; entries: NodeKindEntry[] }> {\n if (!this.loaded) return []\n const groups = new Map<string, NodeKindEntry[]>()\n for (const e of this.entries) {\n if (!groups.has(e.category)) groups.set(e.category, [])\n groups.get(e.category)!.push(e)\n }\n return [...groups.entries()].map(([category, entries]) => ({ category, entries }))\n }\n\n fieldOptions(kind: string, field: string): Array<string | number> {\n return this.entry(kind)?.configSchema?.properties?.[field]?.enum?.slice() ?? []\n }\n\n defaultConfig(kind: string): Record<string, unknown> | undefined {\n const d = this.entry(kind)?.defaultConfig\n return d ? (structuredClone(d) as Record<string, unknown>) : undefined\n }\n\n /**\n * Fresh default configuration: a deep copy whose empty identifiers are\n * filled with new unique ids. Nothing for picker kinds or when not loaded.\n */\n createDefaultConfig(kind: string): Record<string, unknown> | undefined {\n if (PICKER_KINDS.includes(kind)) return undefined\n const d = this.entry(kind)?.defaultConfig\n if (!d) return undefined\n return cloneFillingIds(d, null) as Record<string, unknown>\n }\n\n isExperimental(kind: string): boolean {\n return !!this.entry(kind)?.experimental\n }\n\n isDeprecated(kind: string): boolean {\n return !!this.entry(kind)?.deprecated\n }\n\n subscribe = (listener: Listener): (() => void) => {\n this.listeners.add(listener)\n return () => this.listeners.delete(listener)\n }\n\n getVersion = (): number => this.version\n\n private bump() {\n this.version++\n for (const l of this.listeners) l()\n }\n}\n\n/** The process-wide catalog installed from the backend. */\nexport const nodeKindCatalog = new NodeKindCatalogStore()\n\nexport const installNodeCatalog = (entries: readonly NodeKindEntry[]) => nodeKindCatalog.install(entries)\nexport const resetNodeCatalog = () => nodeKindCatalog.reset()\n","// Icon registry: catalog icon keys (kebab-case lucide names) → components.\n// Unknown keys resolve to a neutral generic glyph (design direction §4.4).\n\nimport {\n BookOpen,\n Bot,\n Box,\n Braces,\n ChartColumn,\n ClipboardCheck,\n Code,\n Database,\n Dices,\n FileChartColumn,\n FileSearch,\n FileText,\n Fingerprint,\n Flag,\n GitBranch,\n Group,\n Landmark,\n Library,\n MessageSquare,\n Newspaper,\n Play,\n Quote,\n Repeat,\n Scale,\n ScrollText,\n Search,\n Split,\n SquareFunction,\n StickyNote,\n Target,\n Workflow,\n} from 'lucide-react'\nimport type { IconComponent } from '../../index'\n\nexport const GENERIC_ICON: IconComponent = Box\n\nconst builtIn: Record<string, IconComponent> = {\n play: Play,\n flag: Flag,\n 'git-branch': GitBranch,\n split: Split,\n code: Code,\n braces: Braces,\n 'square-function': SquareFunction,\n repeat: Repeat,\n bot: Bot,\n 'message-square': MessageSquare,\n 'file-chart-column': FileChartColumn,\n 'chart-column': ChartColumn,\n database: Database,\n 'sticky-note': StickyNote,\n group: Group,\n dices: Dices,\n scale: Scale,\n target: Target,\n workflow: Workflow,\n // Provenance kinds.\n search: Search,\n fingerprint: Fingerprint,\n 'file-search': FileSearch,\n 'file-text': FileText,\n quote: Quote,\n 'clipboard-check': ClipboardCheck,\n 'book-open': BookOpen,\n library: Library,\n newspaper: Newspaper,\n 'scroll-text': ScrollText,\n landmark: Landmark,\n box: Box,\n}\n\nlet registry = new Map<string, IconComponent>(Object.entries(builtIn))\n\n/** Adds or replaces icons (host icons for its own kinds). */\nexport function registerIcons(map: Record<string, IconComponent>): void {\n registry = new Map([...registry, ...Object.entries(map)])\n}\n\nexport function resolveIcon(key: string | undefined | null): IconComponent {\n return (key && registry.get(key)) || GENERIC_ICON\n}\n\n/** Default icon key per kind when the catalog is not loaded. */\nexport const FALLBACK_KIND_ICONS: Readonly<Record<string, string>> = Object.freeze({\n start: 'play',\n end: 'flag',\n 'if-else': 'git-branch',\n branch: 'git-branch',\n switch: 'split',\n code: 'code',\n compute: 'square-function',\n iteration: 'repeat',\n loop: 'repeat',\n simulation: 'dices',\n agent: 'bot',\n answer: 'message-square',\n rule: 'scale',\n decision: 'target',\n 'report-output': 'file-chart-column',\n datasource: 'database',\n note: 'sticky-note',\n group: 'group',\n query: 'search',\n retrieval: 'fingerprint',\n source: 'file-text',\n assertion: 'quote',\n record: 'clipboard-check',\n analysis: 'chart-column',\n edition: 'library',\n manuscript: 'scroll-text',\n verification: 'scale',\n})\n","// NodeStateStyles (wave-4 spec): a node exposes its interaction and run state\n// as data attributes; the stylesheet (nodes/node-frame.css) maps them to\n// tokens. This helper is the only way components build that attribute map.\n\nimport type { NodeResultStatus } from '../model/types'\n\nexport type NodeRunState = 'idle' | 'running' | 'succeeded' | 'failed' | 'skipped'\nexport type NodeProofState = 'proved' | 'pending' | 'refuted' | 'not_disclosed' | 'none'\n\nexport interface NodeStateInput {\n selected?: boolean\n runState?: NodeRunState\n locked?: boolean\n dimmed?: boolean\n /** Border line style of provenance nodes (§2.11). Omit for workflow nodes. */\n proofState?: NodeProofState | null\n}\n\nexport type NodeStateAttributes = Record<`data-${string}`, string>\n\nexport function nodeStateAttributes(state: NodeStateInput = {}): NodeStateAttributes {\n const attrs: NodeStateAttributes = {\n 'data-selected': state.selected ? 'true' : 'false',\n 'data-run-state': state.runState ?? 'idle',\n 'data-locked': state.locked ? 'true' : 'false',\n 'data-dimmed': state.dimmed ? 'true' : 'false',\n }\n if (state.proofState !== undefined && state.proofState !== null) {\n attrs['data-proof-state'] = state.proofState.replace('_', '-')\n }\n return attrs\n}\n\n/** Editor result status → normalised run state. */\nexport function runStateOf(status: NodeResultStatus | undefined): NodeRunState {\n switch (status) {\n case 'running':\n return 'running'\n case 'success':\n return 'succeeded'\n case 'error':\n return 'failed'\n default:\n return 'idle'\n }\n}\n","// How a node kind is presented (label, icon, tone, ports, per-node identity).\n// By default the installed NodeKindCatalog answers; a host can swap any single\n// answer for a subtree with <NodeKindCatalogProvider>.\n\nimport { createContext, useContext, useMemo, useSyncExternalStore, type ReactNode } from 'react'\nimport type { IconComponent } from '../../index'\nimport { FALLBACK_KIND_ICONS, resolveIcon } from './icons'\nimport { nodeKindCatalog, type NodeKindCatalogStore, type PortTopology } from './kindCatalog'\nimport { kindTone, type ToneName } from './palette'\n\n/** Per-instance presentation that wins over the per-kind catalog data. */\nexport interface NodeIdentity {\n icon?: IconComponent\n title?: string\n description?: string\n}\n\nexport interface RenderCatalog {\n /** Label and category for a kind (label falls back to a humanised kind key only when nothing else exists). */\n entry(kind: string): { label: string; category: string; description?: string } | undefined\n icon(kind: string): IconComponent\n tone(kind: string): ToneName\n ports(kind: string): PortTopology | undefined\n identity(kind: string, data: Record<string, unknown>): NodeIdentity | null\n badgeTone(kind: string): ToneName\n /** Connectors attach to node borders; ports become invisible (ids kept). */\n floatingConnections: boolean\n}\n\nexport interface RenderCatalogOverrides extends Partial<Omit<RenderCatalog, 'floatingConnections'>> {\n floatingConnections?: boolean\n}\n\n/** Answers read straight from a catalog store. */\nexport function catalogFromStore(store: NodeKindCatalogStore, floatingConnections = false): RenderCatalog {\n return {\n entry: (kind) => {\n const found = store.entry(kind)\n if (!found) return undefined\n const { label, category, description } = found\n return description ? { label, category, description } : { label, category }\n },\n icon: (kind) => resolveIcon(store.entry(kind)?.icon ?? FALLBACK_KIND_ICONS[kind]),\n tone: kindTone,\n badgeTone: kindTone,\n ports: (kind) => store.entry(kind)?.ports,\n identity: () => null,\n floatingConnections,\n }\n}\n\nconst ANSWER_KEYS = ['entry', 'icon', 'tone', 'ports', 'identity', 'badgeTone'] as const\n\n/** Base answers with every defined override laid on top. */\nfunction layered(base: RenderCatalog, patch: RenderCatalogOverrides): RenderCatalog {\n const out = { ...base, floatingConnections: patch.floatingConnections ?? false }\n for (const key of ANSWER_KEYS) {\n const replacement = patch[key]\n if (replacement) (out as Record<string, unknown>)[key] = replacement\n }\n return out\n}\n\n/** Re-renders when a new catalog is installed into the store. */\nconst useStoreVersion = (store: NodeKindCatalogStore) => useSyncExternalStore(store.subscribe, store.getVersion, store.getVersion)\n\nconst CatalogContext = createContext<RenderCatalog | null>(null)\n\nexport interface NodeKindCatalogProviderProps extends RenderCatalogOverrides {\n store?: NodeKindCatalogStore\n children: ReactNode\n}\n\n/** Lets a host replace any resolver (icon, tone, identity …) for the subtree. */\nexport function NodeKindCatalogProvider({ store = nodeKindCatalog, children, ...patch }: NodeKindCatalogProviderProps) {\n const version = useStoreVersion(store)\n const deps = [store, version, patch.floatingConnections, ...ANSWER_KEYS.map((k) => patch[k])]\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const catalog = useMemo(() => layered(catalogFromStore(store, patch.floatingConnections ?? false), patch), deps)\n return <CatalogContext.Provider value={catalog}>{children}</CatalogContext.Provider>\n}\n\n/** The catalog in effect: a provider's, else the installed store's. */\nexport function useRenderCatalog(): RenderCatalog {\n const provided = useContext(CatalogContext)\n const version = useStoreVersion(nodeKindCatalog)\n return useMemo(() => provided ?? catalogFromStore(nodeKindCatalog), [provided, version])\n}\n\n/** Readable fallback for a kind key when no catalog label exists (\"if-else\" → \"If else\"). */\nexport function humaniseKey(key: string): string {\n const spaced = key\n .split(/(?<=[a-z0-9])(?=[A-Z])|[_-]+/)\n .filter(Boolean)\n .join(' ')\n .toLowerCase()\n return spaced ? spaced.charAt(0).toUpperCase() + spaced.slice(1) : key\n}\n","// A minimal external store (subscribe / getState / setState) and a selector\n// hook with memoised selection, so components re-render only for their slice.\n\nimport { useCallback, useRef, useSyncExternalStore } from 'react'\n\nexport interface Store<S> {\n getState(): S\n setState(next: Partial<S> | ((prev: S) => Partial<S>)): void\n subscribe(listener: () => void): () => void\n}\n\nexport function createStore<S extends object>(initial: S): Store<S> {\n let state = initial\n const listeners = new Set<() => void>()\n return {\n getState: () => state,\n setState(next) {\n const patch = typeof next === 'function' ? next(state) : next\n let changed = false\n for (const k of Object.keys(patch) as Array<keyof S>) {\n if (!Object.is(state[k], patch[k])) {\n changed = true\n break\n }\n }\n if (!changed) return\n state = { ...state, ...patch }\n for (const l of [...listeners]) l()\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n }\n}\n\n/** Shallow equality for arrays and plain records (selector results). */\nexport function shallowEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true\n if (typeof a !== 'object' || typeof b !== 'object' || !a || !b) return false\n if (Array.isArray(a) !== Array.isArray(b)) return false\n const ka = Object.keys(a)\n const kb = Object.keys(b)\n if (ka.length !== kb.length) return false\n for (const k of ka) if (!Object.is((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k])) return false\n return true\n}\n\n/** Subscribes to `selector(state)`; re-renders only when the selection changes under `isEqual`. */\nexport function useStoreSelector<S, T>(store: Store<S>, selector: (s: S) => T, isEqual: (a: T, b: T) => boolean = Object.is): T {\n const memo = useRef<{ state: S; selector: (s: S) => T; value: T } | null>(null)\n const select = useCallback(() => {\n const state = store.getState()\n const prev = memo.current\n if (prev && prev.state === state && prev.selector === selector) return prev.value\n const value = selector(state)\n if (prev && isEqual(prev.value, value)) {\n memo.current = { state, selector, value: prev.value }\n return prev.value\n }\n memo.current = { state, selector, value }\n return value\n // selector identity is allowed to change each render; the state check keeps it cheap\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, selector])\n return useSyncExternalStore(store.subscribe, select, select)\n}\n","// Pure edits on a graph snapshot: history stacks, copy, paste, duplicate and\n// removal. Shared by the editor state and the stand-alone EditorShortcuts hooks.\n\nimport { createId } from '../internal/ids'\nimport type { FlowConnector, FlowNode } from '../model/types'\n\nexport interface GraphSnapshot {\n nodes: FlowNode[]\n connectors: FlowConnector[]\n}\n\n/** Deep copy of node data so later edits never leak into history entries. */\nexport function freezeSnapshot(nodes: readonly FlowNode[], connectors: readonly FlowConnector[]): GraphSnapshot {\n return {\n nodes: nodes.map((n) => ({ ...n, position: { ...n.position }, data: structuredClone(n.data) })),\n connectors: connectors.map((c) => ({ ...c })),\n }\n}\n\nexport interface HistoryStacks {\n past: GraphSnapshot[]\n future: GraphSnapshot[]\n}\n\n/** Pushes `current` onto past (bounded), clears future. */\nexport function recordHistory(stacks: HistoryStacks, current: GraphSnapshot, limit: number): HistoryStacks {\n const past = [...stacks.past, current]\n while (past.length > Math.max(1, limit)) past.shift()\n return { past, future: [] }\n}\n\nexport function stepBack(stacks: HistoryStacks, current: GraphSnapshot): { stacks: HistoryStacks; graph: GraphSnapshot } | null {\n if (!stacks.past.length) return null\n const past = stacks.past.slice(0, -1)\n const graph = stacks.past[stacks.past.length - 1]!\n return { stacks: { past, future: [current, ...stacks.future] }, graph }\n}\n\nexport function stepForward(stacks: HistoryStacks, current: GraphSnapshot): { stacks: HistoryStacks; graph: GraphSnapshot } | null {\n if (!stacks.future.length) return null\n const [graph, ...future] = stacks.future\n return { stacks: { past: [...stacks.past, current], future }, graph: graph! }\n}\n\n/** Selected nodes plus only the connectors whose both ends are selected; null when nothing is selected. */\nexport function copySelection(nodes: readonly FlowNode[], connectors: readonly FlowConnector[]): GraphSnapshot | null {\n const picked = nodes.filter((n) => n.selected)\n if (!picked.length) return null\n const ids = new Set(picked.map((n) => n.id))\n return freezeSnapshot(\n picked,\n connectors.filter((c) => ids.has(c.source) && ids.has(c.target)),\n )\n}\n\nexport const PASTE_OFFSET = 32\n\n/**\n * New nodes and connectors for a paste: fresh ids, remapped connectors,\n * positions shifted diagonally, only the new nodes selected.\n */\nexport function clonePiece(piece: GraphSnapshot, offset = PASTE_OFFSET): GraphSnapshot {\n const remap = new Map<string, string>()\n for (const n of piece.nodes) remap.set(n.id, createId(n.kind || 'node'))\n const nodes = piece.nodes.map((n) => ({\n ...n,\n id: remap.get(n.id)!,\n position: n.parentId && remap.has(n.parentId) ? { ...n.position } : { x: n.position.x + offset, y: n.position.y + offset },\n ...(n.parentId ? { parentId: remap.get(n.parentId) ?? n.parentId } : {}),\n data: structuredClone(n.data),\n selected: true,\n }))\n const connectors = piece.connectors.map((c) => ({\n ...c,\n id: createId('connector'),\n source: remap.get(c.source)!,\n target: remap.get(c.target)!,\n selected: false,\n }))\n return { nodes, connectors }\n}\n\n/** Graph with `piece` merged in and everything else deselected. */\nexport function mergePiece(graph: GraphSnapshot, piece: GraphSnapshot): GraphSnapshot {\n return {\n nodes: [...graph.nodes.map((n) => (n.selected ? { ...n, selected: false } : n)), ...piece.nodes],\n connectors: [...graph.connectors.map((c) => (c.selected ? { ...c, selected: false } : c)), ...piece.connectors],\n }\n}\n\n/** Removes the given nodes, their members and every connector touching them. */\nexport function withoutNodes(graph: GraphSnapshot, ids: ReadonlySet<string>): GraphSnapshot {\n const gone = new Set(ids)\n // Members of removed frames go too.\n let grew = true\n while (grew) {\n grew = false\n for (const n of graph.nodes) if (n.parentId && gone.has(n.parentId) && !gone.has(n.id)) {\n gone.add(n.id)\n grew = true\n }\n }\n return {\n nodes: graph.nodes.filter((n) => !gone.has(n.id)),\n connectors: graph.connectors.filter((c) => !gone.has(c.source) && !gone.has(c.target)),\n }\n}\n","// FlowEditorState: one store per editor (never a module singleton), with\n// actions and fine-grained read hooks.\n\nimport { createContext, useContext, useState, type ReactNode } from 'react'\nimport type { FlowConnector, FlowNode, LayoutDirection, NodeRunResult, Point } from '../model/types'\nimport {\n clonePiece,\n copySelection,\n freezeSnapshot,\n mergePiece,\n PASTE_OFFSET,\n recordHistory,\n stepBack,\n stepForward,\n withoutNodes,\n type GraphSnapshot,\n} from './graphEdits'\nimport { createStore, shallowEqual, useStoreSelector, type Store } from './store'\n\nexport type PanelName = 'variables' | 'versions' | 'run' | 'minimap' | 'grid' | 'shortcuts' | 'preview' | 'outline'\n\nexport interface CanvasMenuState {\n kind: 'node' | 'connector' | 'canvas' | 'selection'\n /** Screen position the menu opens at. */\n position: Point\n targetId?: string\n}\n\nexport interface FlowEditorData {\n nodes: FlowNode[]\n connectors: FlowConnector[]\n past: GraphSnapshot[]\n future: GraphSnapshot[]\n clipboard: GraphSnapshot | null\n editingNodeId: string | null\n contextMenu: CanvasMenuState | null\n controlMode: 'select' | 'pan'\n layoutDirection: LayoutDirection\n panels: Record<PanelName, boolean>\n cardDensity: 'detailed' | 'compact'\n isRunning: boolean\n nodeResults: Record<string, NodeRunResult>\n selectedRunId: string | null\n locked: boolean\n}\n\ntype Updater<T> = T | ((prev: T) => T)\n\nexport interface FlowEditorActions {\n setNodes(next: Updater<FlowNode[]>): void\n setConnectors(next: Updater<FlowConnector[]>): void\n /** Takes a history snapshot of the current graph (call before an edit). */\n snapshot(): void\n undo(): void\n redo(): void\n copy(): void\n paste(offset?: number): void\n /** Copies the selection in place (offset), selecting only the copies. One undo step. */\n duplicate(ids?: readonly string[]): void\n /** Removes selected nodes (and connectors touching them) and selected connectors. One undo step. Refused when locked. */\n removeSelection(): void\n removeNodes(ids: readonly string[]): void\n removeConnector(id: string): void\n selectAll(): void\n deselectAll(): void\n select(ids: readonly string[], additive?: boolean): void\n selectConnector(id: string | null): void\n setEditingNode(id: string | null): void\n openContextMenu(menu: CanvasMenuState): void\n closeContextMenu(): void\n setControlMode(mode: 'select' | 'pan'): void\n setLayoutDirection(direction: LayoutDirection): void\n togglePanel(name: PanelName): void\n setPanel(name: PanelName, open: boolean): void\n closeShortcuts(): void\n toggleDensity(): void\n setRunning(running: boolean): void\n setNodeResult(id: string, result: NodeRunResult): void\n clearNodeResults(): void\n setSelectedRun(id: string | null): void\n setLocked(locked: boolean): void\n reset(): void\n}\n\nexport interface FlowEditorStore extends Store<FlowEditorData> {\n actions: FlowEditorActions\n historyLimit: number\n}\n\nexport interface FlowEditorStoreOptions {\n /** Maximum undo depth (default 50). */\n historyLimit?: number\n initial?: Partial<Pick<FlowEditorData, 'nodes' | 'connectors' | 'controlMode' | 'layoutDirection' | 'cardDensity' | 'locked'>> & {\n panels?: Partial<Record<PanelName, boolean>>\n }\n}\n\nconst CLOSED_PANELS: Record<PanelName, boolean> = {\n variables: false,\n versions: false,\n run: false,\n minimap: false,\n grid: true,\n shortcuts: false,\n preview: false,\n outline: false,\n}\n\nfunction blank(options: FlowEditorStoreOptions): FlowEditorData {\n const i = options.initial ?? {}\n return {\n nodes: i.nodes ?? [],\n connectors: i.connectors ?? [],\n past: [],\n future: [],\n clipboard: null,\n editingNodeId: null,\n contextMenu: null,\n controlMode: i.controlMode ?? 'select',\n layoutDirection: i.layoutDirection ?? 'down',\n panels: { ...CLOSED_PANELS, ...(i.panels ?? {}) },\n cardDensity: i.cardDensity ?? 'detailed',\n isRunning: false,\n nodeResults: {},\n selectedRunId: null,\n locked: i.locked ?? false,\n }\n}\n\nconst apply = <T,>(next: Updater<T>, prev: T): T => (typeof next === 'function' ? (next as (p: T) => T)(prev) : next)\n\nexport function createFlowEditorStore(options: FlowEditorStoreOptions = {}): FlowEditorStore {\n const limit = options.historyLimit ?? 50\n const base = createStore<FlowEditorData>(blank(options))\n const get = base.getState\n const set = base.setState\n const current = () => freezeSnapshot(get().nodes, get().connectors)\n\n const actions: FlowEditorActions = {\n setNodes: (next) => set((s) => ({ nodes: apply(next, s.nodes) })),\n setConnectors: (next) => set((s) => ({ connectors: apply(next, s.connectors) })),\n snapshot() {\n const s = get()\n set(recordHistory({ past: s.past, future: s.future }, current(), limit))\n },\n undo() {\n const s = get()\n const r = stepBack({ past: s.past, future: s.future }, current())\n if (r) set({ ...r.stacks, nodes: r.graph.nodes, connectors: r.graph.connectors })\n },\n redo() {\n const s = get()\n const r = stepForward({ past: s.past, future: s.future }, current())\n if (r) set({ ...r.stacks, nodes: r.graph.nodes, connectors: r.graph.connectors })\n },\n copy() {\n const piece = copySelection(get().nodes, get().connectors)\n if (piece) set({ clipboard: piece })\n },\n paste(offset = PASTE_OFFSET) {\n const s = get()\n if (!s.clipboard || s.locked) return\n actions.snapshot()\n const piece = clonePiece(s.clipboard, offset)\n const merged = mergePiece({ nodes: get().nodes, connectors: get().connectors }, piece)\n // The clipboard follows the pasted copy so the next paste cascades.\n set({ ...merged, clipboard: freezeSnapshot(piece.nodes, piece.connectors) })\n },\n duplicate(ids) {\n const s = get()\n if (s.locked) return\n const chosen = ids ? new Set(ids) : null\n const nodes = chosen ? s.nodes.map((n) => ({ ...n, selected: chosen.has(n.id) })) : s.nodes\n const piece = copySelection(nodes, s.connectors)\n if (!piece) return\n actions.snapshot()\n set(mergePiece({ nodes: get().nodes, connectors: get().connectors }, clonePiece(piece)))\n },\n removeSelection() {\n const s = get()\n if (s.locked) return\n const ids = new Set(s.nodes.filter((n) => n.selected).map((n) => n.id))\n const connectorIds = new Set(s.connectors.filter((c) => c.selected).map((c) => c.id))\n if (!ids.size && !connectorIds.size) return\n actions.snapshot()\n const g = withoutNodes({ nodes: s.nodes, connectors: s.connectors.filter((c) => !connectorIds.has(c.id)) }, ids)\n set(g)\n },\n removeNodes(idList) {\n const s = get()\n if (s.locked || !idList.length) return\n actions.snapshot()\n set(withoutNodes({ nodes: s.nodes, connectors: s.connectors }, new Set(idList)))\n },\n removeConnector(id) {\n const s = get()\n if (s.locked || !s.connectors.some((c) => c.id === id)) return\n actions.snapshot()\n set({ connectors: get().connectors.filter((c) => c.id !== id) })\n },\n selectAll: () => set((s) => ({ nodes: s.nodes.map((n) => (n.selected || n.hidden ? n : { ...n, selected: true })) })),\n deselectAll: () =>\n set((s) => ({\n nodes: s.nodes.some((n) => n.selected) ? s.nodes.map((n) => (n.selected ? { ...n, selected: false } : n)) : s.nodes,\n connectors: s.connectors.some((c) => c.selected) ? s.connectors.map((c) => (c.selected ? { ...c, selected: false } : c)) : s.connectors,\n })),\n select(idList, additive = false) {\n const chosen = new Set(idList)\n set((s) => ({\n nodes: s.nodes.map((n) => {\n const on = chosen.has(n.id) || (additive && !!n.selected)\n return !!n.selected === on ? n : { ...n, selected: on }\n }),\n connectors: additive ? s.connectors : s.connectors.map((c) => (c.selected ? { ...c, selected: false } : c)),\n }))\n },\n selectConnector(id) {\n set((s) => ({\n connectors: s.connectors.map((c) => (!!c.selected === (c.id === id) ? c : { ...c, selected: c.id === id })),\n nodes: id ? s.nodes.map((n) => (n.selected ? { ...n, selected: false } : n)) : s.nodes,\n }))\n },\n setEditingNode: (id) => set({ editingNodeId: id }),\n openContextMenu: (menu) => set({ contextMenu: menu }),\n closeContextMenu: () => set({ contextMenu: null }),\n setControlMode: (mode) => set({ controlMode: mode }),\n setLayoutDirection: (direction) => set({ layoutDirection: direction }),\n togglePanel: (name) => set((s) => ({ panels: { ...s.panels, [name]: !s.panels[name] } })),\n setPanel: (name, open) => set((s) => (s.panels[name] === open ? {} : { panels: { ...s.panels, [name]: open } })),\n closeShortcuts: () => actions.setPanel('shortcuts', false),\n toggleDensity: () => set((s) => ({ cardDensity: s.cardDensity === 'detailed' ? 'compact' : 'detailed' })),\n setRunning: (running) => set({ isRunning: running }),\n setNodeResult: (id, result) => set((s) => ({ nodeResults: { ...s.nodeResults, [id]: result } })),\n clearNodeResults: () => set((s) => (Object.keys(s.nodeResults).length ? { nodeResults: {} } : {})),\n setSelectedRun: (id) => set({ selectedRunId: id }),\n setLocked: (locked) => set({ locked }),\n reset: () => set(blank(options)),\n }\n\n return { ...base, actions, historyLimit: limit }\n}\n\nconst EditorStoreContext = createContext<FlowEditorStore | null>(null)\n\n/** Provides an editor store; creates one per provider when none is passed. */\nexport function FlowEditorStateProvider({ store, options, children }: { store?: FlowEditorStore; options?: FlowEditorStoreOptions; children: ReactNode }) {\n const [own] = useState(() => store ?? createFlowEditorStore(options))\n return <EditorStoreContext.Provider value={store ?? own}>{children}</EditorStoreContext.Provider>\n}\n\nexport function useFlowEditorStore(): FlowEditorStore {\n const store = useContext(EditorStoreContext)\n if (!store) throw new Error('Flow editor components must be inside <FlowEditorStateProvider> (FlowEditor provides one).')\n return store\n}\n\n/** The store when inside an editor, else null (for components usable in both). */\nexport function useOptionalFlowEditorStore(): FlowEditorStore | null {\n return useContext(EditorStoreContext)\n}\n\nexport function useFlowEditorState<T>(selector: (s: FlowEditorData) => T, isEqual: (a: T, b: T) => boolean = shallowEqual as (a: T, b: T) => boolean): T {\n return useStoreSelector(useFlowEditorStore(), selector, isEqual)\n}\n\nexport const useFlowEditorActions = (): FlowEditorActions => useFlowEditorStore().actions\n\n// Read hooks named by the spec.\nexport const useCanUndo = () => useFlowEditorState((s) => s.past.length > 0)\nexport const useCanRedo = () => useFlowEditorState((s) => s.future.length > 0)\nexport const useHasClipboard = () => useFlowEditorState((s) => !!s.clipboard && s.clipboard.nodes.length > 0)\nexport const useCanvasMenu = () => useFlowEditorState((s) => s.contextMenu)\nexport const useEditingNodeId = () => useFlowEditorState((s) => s.editingNodeId)\nexport const useSelectedNodeCount = () => useFlowEditorState((s) => s.nodes.reduce((n, node) => n + (node.selected ? 1 : 0), 0))\nexport const useIsRunning = () => useFlowEditorState((s) => s.isRunning)\nexport const useNodeResults = () => useFlowEditorState((s) => s.nodeResults)\n\n/** Result of one node from the editor state, or undefined outside an editor. */\nexport function useNodeResult(nodeId: string): NodeRunResult | undefined {\n const store = useOptionalFlowEditorStore()\n const fallback = useFallbackStore()\n return useStoreSelector(store ?? fallback, (s) => s.nodeResults[nodeId])\n}\n\n/** Locked flag, false outside an editor. */\nexport function useEditorLocked(): boolean {\n const store = useOptionalFlowEditorStore()\n const fallback = useFallbackStore()\n return useStoreSelector(store ?? fallback, (s) => s.locked)\n}\n\nlet sharedFallback: FlowEditorStore | null = null\nfunction useFallbackStore(): FlowEditorStore {\n sharedFallback ??= createFlowEditorStore()\n return sharedFallback\n}\n","// Editor dialog stack: opening a dialog while another is open pushes the\n// current one; closing pops and restores it with its payload.\n\nimport { createContext, useContext, useState, type ReactNode } from 'react'\nimport { createStore, useStoreSelector, type Store } from './store'\n\nexport type EditorDialogKind = 'agent-editor' | 'node-config' | 'flow-settings'\n\n/** Payload of the node configuration dialog. */\nexport interface NodeConfigPayload {\n nodeId: string\n kind: string\n label: string\n config: Record<string, unknown>\n /** Upstream values the forms may reference (ancestor node ids and flow inputs). */\n references: string[]\n}\n\n/** Payload of the agent editor. */\nexport interface AgentEditorPayload {\n mode: 'create' | 'edit'\n agent?: Record<string, unknown> & { id?: string; name?: string }\n}\n\n/** Payload of the flow settings dialog (lifecycle values only when known). */\nexport interface FlowSettingsPayload {\n name: string\n description: string\n slug?: string | null\n isDraft?: boolean\n isActive?: boolean\n}\n\nexport interface EditorDialogEntry<P = unknown> {\n kind: EditorDialogKind\n payload: P\n}\n\nexport interface DialogStackData {\n active: EditorDialogEntry | null\n stack: EditorDialogEntry[]\n}\n\nexport interface DialogStack extends Store<DialogStackData> {\n open<P>(kind: EditorDialogKind, payload: P): void\n close(): void\n closeAll(): void\n}\n\nexport function createDialogStack(): DialogStack {\n const base = createStore<DialogStackData>({ active: null, stack: [] })\n return {\n ...base,\n open(kind, payload) {\n const s = base.getState()\n base.setState({ active: { kind, payload }, stack: s.active ? [...s.stack, s.active] : s.stack })\n },\n close() {\n const s = base.getState()\n const stack = s.stack.slice(0, -1)\n base.setState({ active: s.stack[s.stack.length - 1] ?? null, stack })\n },\n closeAll() {\n base.setState({ active: null, stack: [] })\n },\n }\n}\n\nconst DialogStackContext = createContext<DialogStack | null>(null)\n\nexport function DialogStackProvider({ stack, children }: { stack?: DialogStack; children: ReactNode }) {\n const [own] = useState(() => stack ?? createDialogStack())\n return <DialogStackContext.Provider value={stack ?? own}>{children}</DialogStackContext.Provider>\n}\n\nexport function useDialogStack(): DialogStack {\n const s = useContext(DialogStackContext)\n if (!s) throw new Error('Editor dialogs must be inside <DialogStackProvider> (FlowEditor provides one).')\n return s\n}\n\nexport function useOptionalDialogStack(): DialogStack | null {\n return useContext(DialogStackContext)\n}\n\n/** The active dialog when it is of `kind`, else null. */\nexport function useActiveDialog<P = unknown>(kind: EditorDialogKind): EditorDialogEntry<P> | null {\n const stack = useDialogStack()\n return useStoreSelector(stack, (s) => (s.active?.kind === kind ? (s.active as EditorDialogEntry<P>) : null))\n}\n","// A canvas speaks through two shared live regions (polite and assertive)\n// instead of one region per node. `useAnnounce()` returns the speaker; with\n// no AnnouncerProvider above it, speaking does nothing.\n\nimport { createContext, useContext, useReducer, type ReactNode } from 'react'\n\ntype Urgency = 'polite' | 'assertive'\ntype Speaker = (message: string, urgency?: Urgency) => void\n\ninterface Lines {\n polite: string\n assertive: string\n /** Odd/even counter: an invisible suffix changes so repeating a sentence still reads. */\n beat: number\n}\n\ntype Utterance = { text: string; urgency: Urgency }\n\nfunction speak(prev: Lines, next: Utterance): Lines {\n const beat = prev.beat + 1\n const text = beat % 2 ? next.text : `${next.text} `\n return { ...prev, beat, [next.urgency]: text }\n}\n\nconst SpeakerContext = createContext<Speaker | null>(null)\n\nconst REGIONS: ReadonlyArray<{ urgency: Urgency; role: 'status' | 'alert' }> = [\n { urgency: 'polite', role: 'status' },\n { urgency: 'assertive', role: 'alert' },\n]\n\nexport function AnnouncerProvider({ children }: { children: ReactNode }) {\n const [lines, dispatch] = useReducer(speak, { polite: '', assertive: '', beat: 0 })\n // `dispatch` is stable, so the speaker needs no memoisation.\n const speaker: Speaker = (text, urgency = 'polite') => dispatch({ text, urgency })\n return (\n <SpeakerContext.Provider value={useStableSpeaker(speaker)}>\n {children}\n {REGIONS.map((r) => (\n <div key={r.urgency} className=\"ty-visually-hidden\" role={r.role} aria-live={r.urgency} data-ty-announcer={r.urgency}>\n {lines[r.urgency]}\n </div>\n ))}\n </SpeakerContext.Provider>\n )\n}\n\n/** Keeps the first speaker function (it only closes over the stable dispatch). */\nfunction useStableSpeaker(candidate: Speaker): Speaker {\n const [kept] = useReducer((s: Speaker) => s, candidate)\n return kept\n}\n\nconst silent: Speaker = () => undefined\n\nexport function useAnnounce(): Speaker {\n return useContext(SpeakerContext) ?? silent\n}\n\n/** Whether a provider is above (components then skip a region of their own). */\nexport function useHasAnnouncer(): boolean {\n return useContext(SpeakerContext) !== null\n}\n","// Asking a person to confirm, until the design system's wave-2 confirm\n// service exists. `useConfirm()` gives an async question function; hosts can\n// plug in their own through <ConfirmProvider confirm={...}>.\n\nimport { createContext, useContext, useState, type ReactNode } from 'react'\nimport { Button, ModalDialog } from '../../index'\n\nexport interface ConfirmOptions {\n title: string\n message?: string\n confirmLabel: string\n cancelLabel: string\n tone?: 'neutral' | 'danger'\n}\n\nexport type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>\n\n/** An open question: what is asked and how to answer it. */\ninterface Question {\n ask: ConfirmOptions\n answer: (yes: boolean) => void\n}\n\nconst AskContext = createContext<ConfirmFn | null>(null)\n\nfunction QuestionDialog({ question, done }: { question: Question; done: () => void }) {\n const reply = (yes: boolean) => {\n question.answer(yes)\n done()\n }\n const { ask } = question\n return (\n <ModalDialog\n isOpen\n role=\"alertdialog\"\n width=\"narrow\"\n onOpenChange={(open) => (open ? undefined : reply(false))}\n title={ask.title}\n description={ask.message}\n actions={\n <>\n <Button variant=\"secondary\" autoFocus onPress={() => reply(false)}>\n {ask.cancelLabel}\n </Button>\n <Button variant={ask.tone === 'danger' ? 'danger' : 'primary'} onPress={() => reply(true)}>\n {ask.confirmLabel}\n </Button>\n </>\n }\n />\n )\n}\n\nexport function ConfirmProvider({ confirm, children }: { confirm?: ConfirmFn; children: ReactNode }) {\n const [open, setOpen] = useState<Question | null>(null)\n const [builtIn] = useState<ConfirmFn>(() => (ask: ConfirmOptions) => new Promise<boolean>((answer) => setOpen({ ask, answer })))\n return (\n <AskContext.Provider value={confirm ?? builtIn}>\n {children}\n {open ? <QuestionDialog question={open} done={() => setOpen(null)} /> : null}\n </AskContext.Provider>\n )\n}\n\n/** Without a provider the browser's own confirm box answers (true where there is none). */\nconst browserAsk: ConfirmFn = async ({ title, message }) => {\n if (typeof window === 'undefined' || typeof window.confirm !== 'function') return true\n return window.confirm(message ? `${title}\\n${message}` : title)\n}\n\nexport function useConfirm(): ConfirmFn {\n return useContext(AskContext) ?? browserAsk\n}\n","// Stand-in for the wave-2 SectionedModal (not yet in @datatechsolutions/tympan):\n// ModalDialog with an eyebrow, a kind icon, an optional section rail and\n// Ctrl/Cmd+Enter to submit. Replace with the @datatechsolutions/tympan component when it\n// lands; the props mirror its spec.\n\nimport { useMemo, type KeyboardEvent, type ReactNode } from 'react'\nimport { ModalDialog, Tabs, TabPanel, useMediaQuery, type ModalDialogWidth } from '../../index'\n\nexport interface ModalSection {\n id: string\n label: string\n content: ReactNode\n}\n\nexport interface SectionedModalProps {\n isOpen: boolean\n onOpenChange: (open: boolean) => void\n title: ReactNode\n /** Accessible description (for example the node label). */\n subtitle?: ReactNode\n eyebrow?: string\n icon?: ReactNode\n /** Kind tone for the icon tile (a tone name, never a colour). */\n tone?: string\n width?: ModalDialogWidth\n footer?: ReactNode\n /** Ctrl/Cmd+Enter anywhere inside the body. */\n onSubmitShortcut?: () => void\n /** Section rail (vertical tabs from the medium breakpoint, a top strip below). */\n sections?: ModalSection[]\n railLabel?: string\n activeSection?: string\n onActiveSectionChange?: (id: string) => void\n /** Pane shown above the section content (identity card, status). */\n railHeader?: ReactNode\n railFooter?: ReactNode\n busy?: boolean\n role?: 'dialog' | 'alertdialog'\n className?: string\n children?: ReactNode\n}\n\nexport function SectionedModal(props: SectionedModalProps) {\n const { isOpen, onOpenChange, title, subtitle, eyebrow, icon, tone, width = 'wide', footer, onSubmitShortcut, sections, railLabel, activeSection, onActiveSectionChange, railHeader, railFooter, busy, role, className, children } = props\n const wide = useMediaQuery('(min-width: 768px)', true)\n const phone = !useMediaQuery('(min-width: 640px)', true)\n\n const heading = useMemo(\n () => (\n <span className=\"ty-flow-sectioned-modal__heading\">\n {icon ? (\n <span className=\"ty-flow-sectioned-modal__icon\" data-tone={tone ?? 'neutral'} aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"ty-flow-sectioned-modal__titles\">\n {eyebrow ? (\n <span className=\"ty-flow-sectioned-modal__eyebrow\" aria-hidden=\"true\">\n {eyebrow}\n </span>\n ) : null}\n <span className=\"ty-flow-sectioned-modal__title\">{title}</span>\n </span>\n </span>\n ),\n [eyebrow, icon, title, tone],\n )\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (onSubmitShortcut && e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {\n e.preventDefault()\n onSubmitShortcut()\n }\n }\n\n const body = sections?.length ? (\n <div className=\"ty-flow-sectioned-modal__rail-layout\" data-rail={wide ? 'side' : 'top'}>\n {railHeader ? <div className=\"ty-flow-sectioned-modal__rail-header\">{railHeader}</div> : null}\n <Tabs\n label={railLabel ?? 'Sections'}\n tabs={sections.map((s) => ({ id: s.id, label: s.label }))}\n orientation={wide ? 'vertical' : 'horizontal'}\n activation=\"manual\"\n {...(activeSection !== undefined ? { selectedKey: activeSection } : {})}\n {...(onActiveSectionChange ? { onSelectionChange: onActiveSectionChange } : {})}\n >\n {sections.map((s) => (\n <TabPanel key={s.id} id={s.id}>\n {s.content}\n </TabPanel>\n ))}\n </Tabs>\n {railFooter ? <div className=\"ty-flow-sectioned-modal__rail-footer\">{railFooter}</div> : null}\n {children}\n </div>\n ) : (\n children\n )\n\n return (\n <ModalDialog\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n width={phone ? 'xwide' : width}\n title={heading}\n description={subtitle}\n actions={footer}\n {...(busy !== undefined ? { busy } : {})}\n {...(role ? { role } : {})}\n className={['ty-flow-sectioned-modal', className].filter(Boolean).join(' ')}\n >\n <div className=\"ty-flow-sectioned-modal__body\" data-phone={phone || undefined} onKeyDown={onKeyDown}>\n {body}\n </div>\n </ModalDialog>\n )\n}\n","// Non-modal panel docked beside or over a canvas: a labelled `region` or\n// `complementary` landmark with a heading, a close control and Escape to close.\n// The canvas stays usable (no focus trap). Placement follows design direction\n// §2.8: pushes at ≥1280, overlays 1024–1279, full-width sheet below 1024; the\n// host layout decides pushing vs overlaying through `data-placement`.\n\nimport { useEffect, useId, useRef, type KeyboardEvent, type ReactNode } from 'react'\nimport { X } from 'lucide-react'\nimport { Button, useMediaQuery, useMessages } from '../../index'\n\nexport interface DockedPanelProps {\n title: ReactNode\n /** Accessible name when the title is not plain text. */\n label?: string\n landmark?: 'region' | 'complementary'\n /** Where it docks on wide screens. */\n edge?: 'end' | 'bottom' | 'float'\n onClose?: () => void\n closeLabel?: string\n /** Controls placed before the close button (switch view, run, stop …). */\n actions?: ReactNode\n /** Leading icon of the header. */\n icon?: ReactNode\n /** Element to return focus to when the panel closes. */\n returnFocusTo?: HTMLElement | null\n /** Moves focus to the heading on mount. */\n focusOnOpen?: boolean\n busy?: boolean\n className?: string\n children?: ReactNode\n /** Extra attributes on the root (data-* only). */\n data?: Record<`data-${string}`, string | undefined>\n}\n\nexport function DockedPanel(props: DockedPanelProps) {\n const { title, label, landmark = 'region', edge = 'end', onClose, closeLabel, actions, icon, returnFocusTo, focusOnOpen = false, busy, className, children, data } = props\n const messages = useMessages()\n const headingId = useId()\n const headingRef = useRef<HTMLHeadingElement>(null)\n const phone = !useMediaQuery('(min-width: 1024px)', true)\n const opener = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n opener.current = returnFocusTo ?? (document.activeElement as HTMLElement | null)\n if (focusOnOpen) headingRef.current?.focus()\n return () => {\n const back = opener.current\n if (back && back.isConnected && typeof back.focus === 'function') {\n // After unmount, return focus only if it was inside the panel (now gone).\n if (!document.activeElement || document.activeElement === document.body) back.focus()\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const onKeyDown = (e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Escape' && onClose && !e.defaultPrevented) {\n e.preventDefault()\n e.stopPropagation()\n onClose()\n }\n }\n\n const Tag = landmark === 'complementary' ? 'aside' : 'section'\n return (\n <Tag\n className={['ty-docked-panel', className].filter(Boolean).join(' ')}\n aria-labelledby={label ? undefined : headingId}\n aria-label={label}\n aria-busy={busy || undefined}\n data-edge={phone ? 'sheet' : edge}\n onKeyDown={onKeyDown}\n {...(landmark === 'region' ? { role: 'region' } : {})}\n {...data}\n >\n <header className=\"ty-docked-panel__header\">\n {icon ? (\n <span className=\"ty-docked-panel__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <h2 id={headingId} ref={headingRef} tabIndex={-1} className=\"ty-docked-panel__title\">\n {title}\n </h2>\n <div className=\"ty-docked-panel__actions\">\n {actions}\n {onClose ? (\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={closeLabel ?? messages.close} leadingIcon={<X />} onPress={onClose} />\n ) : null}\n </div>\n </header>\n <div className=\"ty-docked-panel__body\">{children}</div>\n </Tag>\n )\n}\n","// Locale-aware formatting helpers (Intl only; no hand-built English strings).\n\n/** Under one second: whole milliseconds (\"340 ms\"); otherwise seconds with one decimal (\"2.5 s\"). */\nexport function formatDuration(ms: number, locale?: string): string {\n if (!Number.isFinite(ms) || ms < 0) return ''\n if (ms < 1000) {\n return new Intl.NumberFormat(locale, { style: 'unit', unit: 'millisecond', unitDisplay: 'short', maximumFractionDigits: 0 }).format(Math.round(ms))\n }\n return new Intl.NumberFormat(locale, { style: 'unit', unit: 'second', unitDisplay: 'short', minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(ms / 1000)\n}\n\nconst RELATIVE_STEPS: Array<[Intl.RelativeTimeFormatUnit, number]> = [\n ['second', 60],\n ['minute', 60],\n ['hour', 24],\n ['day', 7],\n ['week', 4.35],\n ['month', 12],\n ['year', Infinity],\n]\n\n/** \"10 minutes ago\" / \"há 10 minutos\", through Intl.RelativeTimeFormat. */\nexport function formatRelative(date: Date | string | number, locale?: string, now: Date = new Date()): string {\n const then = new Date(date)\n if (Number.isNaN(then.getTime())) return ''\n let value = (then.getTime() - now.getTime()) / 1000\n const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' })\n for (const [unit, size] of RELATIVE_STEPS) {\n if (Math.abs(value) < size) return rtf.format(Math.round(value), unit)\n value /= size\n }\n return rtf.format(Math.round(value), 'year')\n}\n\nexport function formatDateTime(date: Date | string | number, locale?: string, options: Intl.DateTimeFormatOptions = { dateStyle: 'medium', timeStyle: 'short' }): string {\n const d = new Date(date)\n return Number.isNaN(d.getTime()) ? '' : new Intl.DateTimeFormat(locale, options).format(d)\n}\n\nexport function formatNumber(n: number, locale?: string, options?: Intl.NumberFormatOptions): string {\n return new Intl.NumberFormat(locale, options).format(n)\n}\n\n/** Current document language, used as the default locale. */\nexport function documentLocale(): string | undefined {\n return typeof document !== 'undefined' ? document.documentElement.lang || undefined : undefined\n}\n","// A small ICU MessageFormat subset for label templates, so hosts can pass the\n// same strings they keep in ICU catalogues:\n// {name} argument\n// {count, number} Intl.NumberFormat\n// {count, plural, =0 {none} one {# item} other {# items}}\n// {kind, select, agent {agent} other {step}}\n// `#` inside a plural branch is the formatted number. Apostrophe quoting is not\n// supported (not needed by the library's own strings).\n\nexport type MessageValues = Record<string, string | number | boolean | null | undefined>\n\ninterface Cursor {\n s: string\n i: number\n}\n\nfunction readUntilBalanced(c: Cursor): string {\n // c.i is just after an opening brace; returns the content up to its match.\n let depth = 1\n const start = c.i\n while (c.i < c.s.length) {\n const ch = c.s[c.i]\n if (ch === '{') depth++\n else if (ch === '}') {\n depth--\n if (depth === 0) {\n const body = c.s.slice(start, c.i)\n c.i++\n return body\n }\n }\n c.i++\n }\n return c.s.slice(start)\n}\n\nfunction parseBranches(text: string): Map<string, string> {\n const branches = new Map<string, string>()\n const c: Cursor = { s: text, i: 0 }\n while (c.i < text.length) {\n while (c.i < text.length && /\\s/.test(text[c.i]!)) c.i++\n let key = ''\n while (c.i < text.length && text[c.i] !== '{' && !/\\s/.test(text[c.i]!)) key += text[c.i++]\n while (c.i < text.length && /\\s/.test(text[c.i]!)) c.i++\n if (text[c.i] !== '{') break\n c.i++\n branches.set(key, readUntilBalanced(c))\n }\n return branches\n}\n\nfunction render(template: string, values: MessageValues, locale: string | undefined, hash: string | null): string {\n let out = ''\n const c: Cursor = { s: template, i: 0 }\n while (c.i < template.length) {\n const ch = template[c.i]!\n if (ch === '#' && hash !== null) {\n out += hash\n c.i++\n continue\n }\n if (ch !== '{') {\n out += ch\n c.i++\n continue\n }\n c.i++\n const body = readUntilBalanced(c)\n const firstComma = body.indexOf(',')\n const name = (firstComma < 0 ? body : body.slice(0, firstComma)).trim()\n const value = values[name]\n if (firstComma < 0) {\n out += value === undefined || value === null ? `{${name}}` : String(value)\n continue\n }\n const rest = body.slice(firstComma + 1)\n const secondComma = rest.indexOf(',')\n const type = (secondComma < 0 ? rest : rest.slice(0, secondComma)).trim()\n const arg = secondComma < 0 ? '' : rest.slice(secondComma + 1)\n if (type === 'number') {\n out += typeof value === 'number' ? new Intl.NumberFormat(locale).format(value) : String(value ?? '')\n } else if (type === 'plural') {\n const n = typeof value === 'number' ? value : Number(value)\n const branches = parseBranches(arg)\n const exact = branches.get(`=${n}`)\n const category = new Intl.PluralRules(locale).select(n)\n const chosen = exact ?? branches.get(category) ?? branches.get('other') ?? ''\n out += render(chosen, values, locale, new Intl.NumberFormat(locale).format(n))\n } else if (type === 'select') {\n const branches = parseBranches(arg)\n out += render(branches.get(String(value)) ?? branches.get('other') ?? '', values, locale, hash)\n } else {\n out += String(value ?? '')\n }\n }\n return out\n}\n\n/** Formats an ICU-subset template with values in `locale`. */\nexport function formatMessage(template: string, values: MessageValues = {}, locale?: string): string {\n return render(template, values, locale, null)\n}\n","// Labels (every user-visible string) and locale.\n//\n// Each component declares its strings once with `defineLabels(key, { en,\n// 'pt-BR', es })`. At render, `useLabels(definition, props.labels)` resolves:\n// 1. the component's `labels` prop (partial),\n// 2. the host catalogue given to <FlowMessagesProvider messages={{ [key]: … }}>,\n// 3. the built-in bundle for the provider locale (exact tag, then language),\n// 4. English.\n// Templates use an ICU MessageFormat subset (see messageFormat.ts); `fill`\n// formats them with the provider locale. Locale and direction come from React\n// Aria's I18nProvider, which @datatechsolutions/tympan's TympanProvider sets.\n\nimport { createContext, createElement, useContext, useMemo, type ReactNode } from 'react'\nimport { useLocale } from 'react-aria-components'\nimport { formatMessage, type MessageValues } from './messageFormat'\n\nexport interface LabelDefinition<L extends object> {\n readonly key: string\n readonly bundles: Readonly<Record<string, Partial<L>>> & { readonly en: L }\n}\n\n/** Declares a component's strings: English is complete; other locales may be partial. */\nexport function defineLabels<L extends object>(key: string, bundles: { en: L } & Record<string, Partial<L>>): LabelDefinition<L> {\n return Object.freeze({ key, bundles: Object.freeze({ ...bundles }) as LabelDefinition<L>['bundles'] })\n}\n\n/** Locales the library ships strings for. Hosts add any other through FlowMessagesProvider. */\nexport const BUILT_IN_LOCALES = ['en', 'pt-BR', 'es'] as const\n\ntype HostCatalogue = Record<string, Record<string, unknown>>\n\nconst MessagesContext = createContext<HostCatalogue | null>(null)\n\n/** Host i18n adapter: `messages[componentKey]` overrides that component's labels. */\nexport function FlowMessagesProvider({ messages, children }: { messages: HostCatalogue; children: ReactNode }) {\n return createElement(MessagesContext.Provider, { value: messages }, children)\n}\n\nfunction isDefinition<L extends object>(x: L | LabelDefinition<L>): x is LabelDefinition<L> {\n return typeof x === 'object' && x !== null && 'bundles' in x && 'key' in x\n}\n\nfunction stripUndefined<L extends object>(o: Partial<L> | undefined): Partial<L> {\n const out: Partial<L> = {}\n if (!o) return out\n for (const [k, v] of Object.entries(o)) if (v !== undefined) (out as Record<string, unknown>)[k] = v\n return out\n}\n\n/** Picks the bundle for a BCP 47 tag: exact, then same language, else nothing. */\nexport function bundleFor<L extends object>(def: LabelDefinition<L>, locale: string): Partial<L> {\n const exact = def.bundles[locale]\n if (exact) return exact\n const lang = locale.split('-')[0]!.toLowerCase()\n const byLanguage = Object.entries(def.bundles).find(([tag]) => tag.split('-')[0]!.toLowerCase() === lang)\n return byLanguage ? byLanguage[1] : {}\n}\n\n/** Resolves labels (see the header). Accepts a definition or a plain English object. */\nexport function useLabels<L extends object>(defaults: L | LabelDefinition<L>, overrides: Partial<L> | undefined): L {\n const { locale } = useLocale()\n const host = useContext(MessagesContext)\n return useMemo(() => {\n if (!isDefinition(defaults)) return { ...defaults, ...stripUndefined(overrides) }\n return {\n ...defaults.bundles.en,\n ...stripUndefined(bundleFor(defaults, locale)),\n ...stripUndefined(host?.[defaults.key] as Partial<L> | undefined),\n ...stripUndefined(overrides),\n }\n }, [defaults, overrides, locale, host])\n}\n\n/** Formats a label template (ICU subset). Pass the locale for plurals and numbers. */\nexport function fill(template: string, values: MessageValues, locale?: string): string {\n return formatMessage(template, values, locale)\n}\n\nexport interface FlowLocale {\n locale: string\n direction: 'ltr' | 'rtl'\n rtl: boolean\n}\n\n/** Provider locale and reading direction (React Aria I18nProvider, else the browser). */\nexport function useFlowLocale(): FlowLocale {\n const { locale, direction } = useLocale()\n return useMemo(() => ({ locale, direction, rtl: direction === 'rtl' }), [locale, direction])\n}\n","// ConnectionPreviewLine: the temporary line from a port to the pointer while a\n// connection is dragged. Decorative (aria-hidden); the surface announces the\n// hovered target in its live region.\n\nimport { connectorCurve, facingSide } from '../geometry/curve'\nimport type { Point, Side } from '../model/types'\nimport type { ConnectValidity } from '../surface/types'\n\nexport interface ConnectionPreviewLineProps {\n from: Point & { side: Side }\n to: Point & { side?: Side }\n validity?: ConnectValidity\n}\n\nexport function ConnectionPreviewLine({ from, to, validity = 'unknown' }: ConnectionPreviewLineProps) {\n const toSide = to.side ?? facingSide(from, to)\n const { d } = connectorCurve({ point: from, side: from.side }, { point: to, side: toSide })\n return (\n <g className=\"ty-connection-preview\" data-validity={validity} aria-hidden=\"true\">\n <path className=\"ty-connection-preview__path\" d={d} />\n <circle className=\"ty-connection-preview__dot\" cx={to.x} cy={to.y} r={4} />\n {validity === 'invalid' ? (\n // Not-allowed glyph: a ring with a bar, drawn beside the pointer so a finger does not hide it.\n <g className=\"ty-connection-preview__refusal\" transform={`translate(${to.x + 14} ${to.y - 14})`}>\n <circle r={7} />\n <line x1={-5} y1={5} x2={5} y2={-5} />\n </g>\n ) : null}\n </g>\n )\n}\n","import { useCallback, useRef, useState } from 'react'\n\n/** Controlled when `value` is defined, uncontrolled otherwise; `onChange` fires in both. */\nexport function useControllable<T>(value: T | undefined, initial: T | (() => T), onChange?: (next: T) => void): [T, (next: T) => void] {\n const [own, setOwn] = useState<T>(initial)\n const controlled = value !== undefined\n const latest = useRef(onChange)\n latest.current = onChange\n const set = useCallback(\n (next: T) => {\n if (!controlled) setOwn(next)\n latest.current?.(next)\n },\n [controlled],\n )\n return [controlled ? (value as T) : own, set]\n}\n","// Overview map in the bottom end corner: every node as a small box in its\n// kind tone plus the visible area. Pointer convenience only (aria-hidden);\n// the keyboard reaches everything through the canvas and the list view.\n\nimport type { PointerEvent as ReactPointerEvent } from 'react'\nimport { enclosingRect, growRect } from '../geometry/rect'\nimport { visibleArea } from '../geometry/viewport'\nimport type { Point, Rect, Size, Viewport } from '../model/types'\nimport type { SurfaceNode } from './types'\n\nconst MAP_W = 184\nconst MAP_H = 128\n\nexport function OverviewMap({ nodes, rects, viewport, container, onCentre }: { nodes: readonly SurfaceNode[]; rects: ReadonlyMap<string, Rect>; viewport: Viewport; container: Size; onCentre: (canvasPoint: Point) => void }) {\n const seen = visibleArea(viewport, container)\n const world = growRect(enclosingRect([...rects.values(), seen]) ?? seen, 40)\n const scale = Math.min(MAP_W / world.width, MAP_H / world.height)\n const toMap = (r: Rect) => ({ x: (r.x - world.x) * scale, y: (r.y - world.y) * scale, width: Math.max(2, r.width * scale), height: Math.max(2, r.height * scale) })\n const pick = (e: ReactPointerEvent<SVGSVGElement>) => {\n const box = e.currentTarget.getBoundingClientRect()\n onCentre({ x: world.x + (e.clientX - box.left) / scale, y: world.y + (e.clientY - box.top) / scale })\n }\n const v = toMap(seen)\n return (\n <svg\n className=\"ty-flow-surface__overview\"\n data-ty-surface-chrome=\"\"\n aria-hidden=\"true\"\n focusable=\"false\"\n width={MAP_W}\n height={MAP_H}\n viewBox={`0 0 ${MAP_W} ${MAP_H}`}\n onPointerDown={(e) => {\n e.stopPropagation()\n pick(e)\n }}\n onPointerMove={(e) => {\n if (e.buttons === 1) pick(e)\n }}\n >\n {nodes.map((n) => {\n const r = rects.get(n.id)\n if (!r) return null\n const m = toMap(r)\n return <rect key={n.id} className=\"ty-flow-surface__overview-node\" data-tone={n.tone ?? 'neutral'} x={m.x} y={m.y} width={m.width} height={m.height} rx={2} />\n })}\n <rect className=\"ty-flow-surface__overview-view\" x={v.x} y={v.y} width={v.width} height={v.height} rx={3} />\n </svg>\n )\n}\n","import { createContext, useContext } from 'react'\nimport type { PortRef } from './types'\n\nexport interface SurfaceContextValue {\n zoom: number\n /** True for a short moment after a node drag ended: presses then are not activations. */\n justDragged(): boolean\n /** Connection being drawn, if any. */\n connecting: PortRef | null\n /** Node currently hovered by a connection drag and whether it accepts it. */\n connectTarget: { nodeId: string; valid: boolean } | null\n /** Connectors attach to node borders (ports hidden, ids kept). */\n floating: boolean\n}\n\nconst fallback: SurfaceContextValue = {\n zoom: 1,\n justDragged: () => false,\n connecting: null,\n connectTarget: null,\n floating: false,\n}\n\nexport const SurfaceContext = createContext<SurfaceContextValue>(fallback)\n\nexport function useSurface(): SurfaceContextValue {\n return useContext(SurfaceContext)\n}\n","import { useEffect, useState, type RefObject } from 'react'\nimport type { Size } from '../model/types'\n\n/** Size used when layout is unavailable (tests, first paint on the server). */\nexport const UNMEASURED_CONTAINER: Readonly<Size> = Object.freeze({ width: 960, height: 640 })\n\nfunction read(el: HTMLElement | null): Size {\n if (!el) return UNMEASURED_CONTAINER\n const width = el.clientWidth\n const height = el.clientHeight\n return width > 0 && height > 0 ? { width, height } : UNMEASURED_CONTAINER\n}\n\n/** Content-box size of an element, updated by ResizeObserver when present. */\nexport function useElementSize(ref: RefObject<HTMLElement | null>): Size {\n const [size, setSize] = useState<Size>(UNMEASURED_CONTAINER)\n useEffect(() => {\n const el = ref.current\n setSize(read(el))\n if (!el || typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver(() => {\n const next = read(el)\n setSize((prev) => (prev.width === next.width && prev.height === next.height ? prev : next))\n })\n ro.observe(el)\n return () => ro.disconnect()\n }, [ref])\n return size\n}\n","import { useCallback, useEffect, useRef, useState } from 'react'\nimport type { Size } from '../model/types'\n\n/**\n * Measures node wrappers with one shared ResizeObserver. Returns the sizes and\n * a stable ref callback per node id. The node box is untransformed (the zoom\n * is applied to the plane), so border-box sizes are canvas units.\n */\nexport function useNodeMeasurement(onMeasured?: (id: string, size: Size) => void) {\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(() => new Map())\n const callbacks = useRef(new Map<string, (el: HTMLElement | null) => void>())\n const elements = useRef(new Map<Element, string>())\n const observer = useRef<ResizeObserver | null>(null)\n const report = useRef(onMeasured)\n report.current = onMeasured\n\n useEffect(() => {\n if (typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver((entries) => {\n const changes: Array<[string, Size]> = []\n for (const entry of entries) {\n const id = elements.current.get(entry.target)\n if (!id) continue\n const box = entry.borderBoxSize?.[0]\n const el = entry.target as HTMLElement\n const size = box ? { width: box.inlineSize, height: box.blockSize } : { width: el.offsetWidth, height: el.offsetHeight }\n if (size.width > 0 && size.height > 0) changes.push([id, size])\n }\n if (!changes.length) return\n setMeasured((prev) => {\n let next: Map<string, Size> | null = null\n for (const [id, size] of changes) {\n const old = prev.get(id)\n if (old && Math.abs(old.width - size.width) < 0.5 && Math.abs(old.height - size.height) < 0.5) continue\n next ??= new Map(prev)\n next.set(id, size)\n report.current?.(id, size)\n }\n return next ?? prev\n })\n })\n observer.current = ro\n for (const el of elements.current.keys()) ro.observe(el)\n return () => {\n ro.disconnect()\n observer.current = null\n }\n }, [])\n\n const refFor = useCallback((id: string) => {\n let cb = callbacks.current.get(id)\n if (!cb) {\n let current: HTMLElement | null = null\n cb = (el) => {\n if (current && current !== el) {\n observer.current?.unobserve(current)\n elements.current.delete(current)\n }\n current = el\n if (el) {\n elements.current.set(el, id)\n observer.current?.observe(el)\n }\n }\n callbacks.current.set(id, cb)\n }\n return cb\n }, [])\n\n return { measured, refFor }\n}\n","// CanvasSurface: the pannable, zoomable plane every canvas of this package is\n// built on (provenance graph, flow editor, flow preview). Nodes are ordinary\n// HTML placed in canvas coordinates, in reading order, so the DOM (and the Tab\n// order) follows the picture. Connectors are one SVG cubic each.\n//\n// Pointer gestures (mouse, pen and touch through Pointer Events):\n// - background: pan (hand mode, touch, middle button, Space held) or\n// marquee selection (select mode, primary mouse button);\n// - node: drag (select mode, after a small threshold), never a press;\n// - port ([data-ty-port]): draw a connection;\n// - two touch points: pinch zoom around their midpoint;\n// - wheel: pan, or zoom with Ctrl/⌘ (and trackpad pinch), or always zoom.\n\nimport {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { ConnectionPreviewLine } from '../connectors/ConnectionPreviewLine'\nimport { connectorCurve, type CurveEnd } from '../geometry/curve'\nimport { centreOf, enclosingRect, exitPoint, pointOnSide, rectsOverlap } from '../geometry/rect'\nimport { DEFAULT_ZOOM_LIMITS, clampZoom, fitBounds, ladderStep, revealRect, screenToCanvas, visibleArea, zoomAt, type ZoomLimits } from '../geometry/viewport'\nimport { useFlowLocale } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport type { Point, Rect, Side, Size, Viewport } from '../model/types'\nimport { OverviewMap } from './OverviewMap'\nimport { SurfaceContext, type SurfaceContextValue } from './SurfaceContext'\nimport type { CanvasApi, ConnectOptions, ConnectValidity, ConnectorParts, ConnectorShape, NodeDragEvent, PortAnchor, PortRef, SurfaceConnector, SurfaceNode } from './types'\nimport { useElementSize } from './useElementSize'\nimport { useNodeMeasurement } from './useNodeMeasurement'\n\nexport interface CanvasSurfaceProps {\n /** Accessible name of the canvas. */\n label: string\n /** Spoken role, for example \"canvas\" or \"graph\". */\n roleDescription?: string\n nodes: readonly SurfaceNode[]\n connectors?: readonly SurfaceConnector[]\n renderNode: (node: SurfaceNode) => ReactNode\n renderConnector?: (connector: SurfaceConnector, shape: ConnectorShape) => ConnectorParts\n /**\n * Where a connector touches its nodes. Sides are logical: in a right-to-left\n * canvas 'start' is the right side. 'border' attaches to the nearest border point.\n */\n portAnchor?: (nodeId: string, portId: string | undefined, role: 'source' | 'target') => PortAnchor | 'border'\n floating?: boolean\n /** Reading direction; defaults to the provider locale's. */\n direction?: 'ltr' | 'rtl'\n\n viewport?: Viewport\n defaultViewport?: Viewport\n onViewportChange?: (v: Viewport) => void\n zoomLimits?: ZoomLimits\n /** When to fit the graph into view. */\n fit?: 'mount' | 'resize' | 'none'\n /** Changing this value refits (for example a graph revision). */\n fitKey?: unknown\n fitPadding?: number\n /** Highest zoom a fit may choose (1 keeps text at its natural size). */\n maxFitZoom?: number\n /**\n * Lowest zoom a fit may choose, so text stays readable; a larger graph is\n * then centred and reached by panning (the overview map and the list help).\n */\n minFitZoom?: number\n /**\n * Where a fitted graph sits: centred, or against the reading-start and top\n * edges (no empty margin before the content; right edge in RTL).\n */\n fitAlign?: 'center' | 'start' | 'top'\n /** Extra canvas area a fit must include besides the nodes (band labels, frames). */\n fitInclude?: Rect\n\n mode?: 'select' | 'pan'\n dragNodes?: boolean\n marquee?: boolean\n wheel?: 'pan' | 'zoom' | 'none'\n pinch?: boolean\n\n onNodeDrag?: (e: NodeDragEvent) => void\n onMarquee?: (ids: string[], additive: boolean) => void\n onBackgroundPress?: (canvasPoint: Point) => void\n onBackgroundContextMenu?: (screen: Point, canvas: Point) => void\n onNodeContextMenu?: (id: string, screen: Point) => void\n onNodeKeyDown?: (id: string, e: KeyboardEvent<HTMLElement>) => void\n onNodeMeasured?: (id: string, size: Size) => void\n /** Escape inside the canvas. Return true when handled (e.g. selection cleared). */\n onEscape?: () => boolean\n /** Escape with nothing to clear: move focus out of the canvas (never trapped). */\n onLeave?: () => void\n connect?: ConnectOptions\n\n grid?: boolean\n minimap?: boolean\n /** Canvas-space content drawn above connectors (alignment guides …). */\n overlay?: ReactNode\n /** Screen-space content over the canvas (toolbars, legends). */\n children?: ReactNode\n apiRef?: Ref<CanvasApi>\n className?: string\n /** Extra data attributes on the root (e.g. data-locked). */\n data?: Record<`data-${string}`, string | undefined>\n}\n\nconst DRAG_THRESHOLD = 4\n\n/** Logical side → physical side of the (always left-to-right) canvas geometry. */\nexport function physicalSide(side: Side, rtl: boolean): Side {\n if (!rtl) return side\n return side === 'start' ? 'end' : side === 'end' ? 'start' : side\n}\nconst GRID_STEP = 24\nconst NO_DRAG = 'input, textarea, select, [contenteditable=\"true\"], [data-ty-no-drag], [data-ty-port]'\n\ntype Gesture =\n | { kind: 'pan'; pointerId: number; start: Point; origin: Viewport }\n | { kind: 'marquee'; pointerId: number; start: Point; now: Point; additive: boolean }\n | { kind: 'node'; pointerId: number; start: Point; nodeId: string; ids: string[] | null; zoom: number }\n | { kind: 'connect'; pointerId: number; from: PortRef; pointer: Point }\n | { kind: 'pinch'; ids: [number, number]; startDistance: number; startMid: Point; origin: Viewport }\n\nexport function CanvasSurface(props: CanvasSurfaceProps) {\n const {\n label,\n roleDescription,\n nodes,\n connectors = [],\n renderNode,\n renderConnector,\n portAnchor,\n floating = false,\n direction,\n zoomLimits = DEFAULT_ZOOM_LIMITS,\n fit = 'mount',\n fitKey,\n fitPadding = 48,\n maxFitZoom = 1,\n minFitZoom,\n fitAlign = 'center',\n fitInclude,\n mode = 'select',\n dragNodes = false,\n marquee = false,\n wheel = 'pan',\n pinch = true,\n onNodeDrag,\n onMarquee,\n onBackgroundPress,\n onBackgroundContextMenu,\n onNodeContextMenu,\n onNodeKeyDown,\n onNodeMeasured,\n onEscape,\n onLeave,\n connect,\n grid = false,\n minimap = false,\n overlay,\n children,\n apiRef,\n className,\n data,\n } = props\n\n const paneRef = useRef<HTMLDivElement>(null)\n const localeDirection = useFlowLocale().direction\n const rtl = (direction ?? localeDirection) === 'rtl'\n const container = useElementSize(paneRef)\n const [viewport, setViewport] = useControllable<Viewport>(props.viewport, props.defaultViewport ?? { x: 0, y: 0, zoom: 1 }, props.onViewportChange)\n const viewportRef = useRef(viewport)\n viewportRef.current = viewport\n\n // Measured node sizes refine the declared ones.\n const { measured, refFor } = useNodeMeasurement(onNodeMeasured)\n const placed = useMemo(() => {\n const map = new Map<string, Rect>()\n for (const n of nodes) {\n if (n.hidden) continue\n const m = measured.get(n.id)\n map.set(n.id, m ? { ...n.rect, width: m.width, height: n.fixedHeight ? n.rect.height : Math.max(m.height, 1) } : n.rect)\n }\n return map\n }, [nodes, measured])\n\n const ordered = useMemo(() => nodes.filter((n) => !n.hidden).map((n, i) => ({ n, i })).sort((a, b) => (a.n.layer ?? 1) - (b.n.layer ?? 1) || a.i - b.i).map((x) => x.n), [nodes])\n\n // ---- viewport helpers -------------------------------------------------\n const bounds = useCallback(() => enclosingRect([...placed.values(), ...(fitInclude ? [fitInclude] : [])]), [placed, fitInclude])\n const fitNow = useCallback(() => {\n const b = bounds()\n let v = fitBounds(b, container, fitPadding, zoomLimits, maxFitZoom)\n if (b && minFitZoom !== undefined && v.zoom < minFitZoom) {\n const zoom = clampZoom(minFitZoom, zoomLimits)\n v = { zoom, x: container.width / 2 - (b.x + b.width / 2) * zoom, y: container.height / 2 - (b.y + b.height / 2) * zoom }\n }\n if (b && fitAlign === 'top') {\n // Centred across, from the top edge down (flows that read downwards).\n v = { zoom: v.zoom, y: fitPadding + 16 - b.y * v.zoom, x: v.x }\n }\n if (b && fitAlign === 'start') {\n const pad = Math.min(fitPadding, 16)\n v = { zoom: v.zoom, y: pad - b.y * v.zoom, x: rtl ? container.width - pad - (b.x + b.width) * v.zoom : pad - b.x * v.zoom }\n }\n setViewport(v)\n }, [bounds, container, fitPadding, zoomLimits, maxFitZoom, minFitZoom, fitAlign, rtl, setViewport])\n const centrePivot = useCallback((): Point => ({ x: container.width / 2, y: container.height / 2 }), [container])\n\n const didFit = useRef(false)\n useEffect(() => {\n if (fit === 'none') return\n if (!didFit.current || fit === 'resize') {\n didFit.current = true\n fitNow()\n }\n // Refit on container size (resize mode) and on mount only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [container.width, container.height])\n const lastFitKey = useRef(fitKey)\n useEffect(() => {\n if (fit === 'none' || Object.is(lastFitKey.current, fitKey)) return\n lastFitKey.current = fitKey\n fitNow()\n }, [fitKey, fit, fitNow])\n\n const clientToLocal = useCallback((p: Point): Point => {\n const r = paneRef.current?.getBoundingClientRect()\n return r ? { x: p.x - r.left, y: p.y - r.top } : p\n }, [])\n\n const focusNode = useCallback((id: string) => {\n const wrapper = paneRef.current?.querySelector<HTMLElement>(`[data-ty-node-id=\"${CSS.escape(id)}\"]`)\n if (!wrapper) return\n const target = wrapper.querySelector<HTMLElement>('[data-ty-node-focus], button, [tabindex]:not([tabindex=\"-1\"])') ?? wrapper\n target.focus()\n }, [])\n\n useImperativeHandle(\n apiRef,\n (): CanvasApi => ({\n zoomIn: () => setViewport(zoomAt(viewportRef.current, ladderStep(viewportRef.current.zoom, 1, zoomLimits), centrePivot(), zoomLimits)),\n zoomOut: () => setViewport(zoomAt(viewportRef.current, ladderStep(viewportRef.current.zoom, -1, zoomLimits), centrePivot(), zoomLimits)),\n zoomTo: (z) => setViewport(zoomAt(viewportRef.current, z, centrePivot(), zoomLimits)),\n fit: fitNow,\n getViewport: () => viewportRef.current,\n setViewport,\n visibleCentre: () => centreOf(visibleArea(viewportRef.current, container)),\n clientToCanvas: (p) => screenToCanvas(viewportRef.current, clientToLocal(p)),\n reveal: (id) => {\n const r = placed.get(id)\n if (r) setViewport(revealRect(viewportRef.current, r, container))\n },\n focusNode,\n containerSize: () => container,\n }),\n [setViewport, zoomLimits, centrePivot, fitNow, container, clientToLocal, placed, focusNode],\n )\n\n // ---- connectors -------------------------------------------------------\n const endOf = useCallback(\n (nodeId: string, portId: string | undefined, role: 'source' | 'target', other: Rect): CurveEnd | null => {\n const r = placed.get(nodeId)\n if (!r) return null\n const anchor = floating ? 'border' : (portAnchor?.(nodeId, portId, role) ?? { side: role === 'source' ? 'end' : 'start', along: 0.5 })\n if (anchor === 'border') return exitPoint(r, centreOf(other))\n // Geometry is physical (start = left); logical sides mirror in RTL.\n const side = physicalSide(anchor.side, rtl)\n return { point: pointOnSide(r, side, anchor.along), side }\n },\n [placed, portAnchor, floating, rtl],\n )\n\n const shapes = useMemo(() => {\n const out: Array<{ c: SurfaceConnector; shape: ConnectorShape }> = []\n for (const c of connectors) {\n if (c.hidden) continue\n const s = placed.get(c.source)\n const t = placed.get(c.target)\n if (!s || !t) continue\n const from = endOf(c.source, c.sourcePort, 'source', t)\n const to = endOf(c.target, c.targetPort, 'target', s)\n if (!from || !to) continue\n const g = connectorCurve(from, to)\n out.push({ c, shape: { ...g, from, to, sourceRect: s, targetRect: t } })\n }\n return out\n }, [connectors, placed, endOf])\n\n // ---- gestures ---------------------------------------------------------\n const gesture = useRef<Gesture | null>(null)\n const touches = useRef(new Map<number, Point>())\n const dragEndedAt = useRef(0)\n const spaceHeld = useRef(false)\n const [marqueeBox, setMarqueeBox] = useState<Rect | null>(null)\n const [connecting, setConnecting] = useState<{ from: PortRef; pointer: Point } | null>(null)\n const [connectTarget, setConnectTarget] = useState<{ nodeId: string; portId?: string; role?: 'source' | 'target'; valid: boolean } | null>(null)\n const [dragging, setDragging] = useState(false)\n const [liveText, setLiveText] = useState('')\n\n const hitTarget = (clientX: number, clientY: number, fallbackTarget: EventTarget | null): HTMLElement | null => {\n const fromPoint = typeof document.elementFromPoint === 'function' ? document.elementFromPoint(clientX, clientY) : null\n return (fromPoint as HTMLElement | null) ?? (fallbackTarget instanceof HTMLElement || fallbackTarget instanceof SVGElement ? (fallbackTarget as HTMLElement) : null)\n }\n\n const resolveDrop = useCallback(\n (el: HTMLElement | null, from: PortRef): { ref: PortRef; valid: boolean } | null => {\n if (!el || !connect) return null\n const port = el.closest<HTMLElement>('[data-ty-port]')\n const nodeEl = el.closest<HTMLElement>('[data-ty-node-id]')\n const nodeId = port?.dataset.tyPortNode ?? nodeEl?.dataset.tyNodeId\n if (!nodeId) return null\n const wanted: 'source' | 'target' = from.role === 'source' ? 'target' : 'source'\n const portRole = port?.dataset.tyPortRole as 'source' | 'target' | undefined\n const ref: PortRef = { nodeId, role: wanted, ...(port && portRole === wanted && port.dataset.tyPortId ? { portId: port.dataset.tyPortId } : {}) }\n const src = from.role === 'source' ? from : ref\n const tgt = from.role === 'source' ? ref : from\n return { ref, valid: nodeId !== from.nodeId && connect.canConnect(src, tgt) }\n },\n [connect],\n )\n\n const onWindowMove = useCallback(\n (e: PointerEvent) => {\n const g = gesture.current\n if (!g) return\n if (g.kind === 'pinch') {\n if (!touches.current.has(e.pointerId)) return\n touches.current.set(e.pointerId, { x: e.clientX, y: e.clientY })\n const a = touches.current.get(g.ids[0])\n const b = touches.current.get(g.ids[1])\n if (!a || !b) return\n const dist = Math.hypot(a.x - b.x, a.y - b.y)\n const mid = clientToLocal({ x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 })\n const zoomed = zoomAt(g.origin, clampZoom(g.origin.zoom * (dist / Math.max(1, g.startDistance)), zoomLimits), g.startMid, zoomLimits)\n setViewport({ ...zoomed, x: zoomed.x + (mid.x - g.startMid.x), y: zoomed.y + (mid.y - g.startMid.y) })\n return\n }\n if (e.pointerId !== g.pointerId) return\n const here = { x: e.clientX, y: e.clientY }\n if (g.kind === 'pan') {\n setViewport({ ...g.origin, x: g.origin.x + here.x - g.start.x, y: g.origin.y + here.y - g.start.y })\n } else if (g.kind === 'marquee') {\n g.now = here\n const a = clientToLocal(g.start)\n const b = clientToLocal(here)\n setMarqueeBox({ x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), width: Math.abs(a.x - b.x), height: Math.abs(a.y - b.y) })\n } else if (g.kind === 'node') {\n const dx = here.x - g.start.x\n const dy = here.y - g.start.y\n if (!g.ids) {\n if (Math.hypot(dx, dy) < DRAG_THRESHOLD) return\n const self = nodes.find((n) => n.id === g.nodeId)\n g.ids = self?.selected ? nodes.filter((n) => n.selected && !n.hidden && n.draggable !== false).map((n) => n.id) : [g.nodeId]\n setDragging(true)\n onNodeDrag?.({ ids: g.ids, delta: { x: 0, y: 0 }, phase: 'start' })\n }\n onNodeDrag?.({ ids: g.ids, delta: { x: dx / g.zoom, y: dy / g.zoom }, phase: 'move' })\n } else if (g.kind === 'connect') {\n const local = clientToLocal(here)\n g.pointer = screenToCanvas(viewportRef.current, local)\n setConnecting({ from: g.from, pointer: g.pointer })\n const drop = resolveDrop(hitTarget(e.clientX, e.clientY, e.target), g.from)\n setConnectTarget((prev) => {\n const next = drop ? { nodeId: drop.ref.nodeId, ...(drop.ref.portId ? { portId: drop.ref.portId } : {}), role: drop.ref.role, valid: drop.valid } : null\n if (next && (!prev || prev.nodeId !== next.nodeId || prev.valid !== next.valid)) {\n const name = connect?.nameOf?.(next.nodeId) ?? next.nodeId\n setLiveText(next.valid ? (connect?.labels?.canConnect?.(name) ?? `${name}: can connect`) : (connect?.labels?.cannotConnect?.(name) ?? `${name}: cannot connect`))\n }\n return next\n })\n }\n },\n // nodes/connect change between renders; the handler is re-bound per gesture\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [clientToLocal, setViewport, zoomLimits, nodes, onNodeDrag, resolveDrop, connect],\n )\n\n const endGesture = useCallback(\n (e: PointerEvent) => {\n touches.current.delete(e.pointerId)\n const g = gesture.current\n if (!g) return\n if (g.kind === 'pinch') {\n if (touches.current.size < 2) gesture.current = null\n return\n }\n if (e.pointerId !== g.pointerId) return\n gesture.current = null\n if (g.kind === 'marquee') {\n setMarqueeBox(null)\n const a = clientToLocal(g.start)\n const b = clientToLocal(g.now)\n if (Math.hypot(a.x - b.x, a.y - b.y) < DRAG_THRESHOLD) {\n onBackgroundPress?.(screenToCanvas(viewportRef.current, a))\n return\n }\n const p1 = screenToCanvas(viewportRef.current, a)\n const p2 = screenToCanvas(viewportRef.current, b)\n const box = { x: Math.min(p1.x, p2.x), y: Math.min(p1.y, p2.y), width: Math.abs(p1.x - p2.x), height: Math.abs(p1.y - p2.y) }\n onMarquee?.(\n [...placed.entries()].filter(([, r]) => rectsOverlap(r, box)).map(([id]) => id),\n g.additive,\n )\n } else if (g.kind === 'pan') {\n const moved = Math.hypot(e.clientX - g.start.x, e.clientY - g.start.y)\n if (moved < DRAG_THRESHOLD && e.type !== 'pointercancel') onBackgroundPress?.(screenToCanvas(viewportRef.current, clientToLocal(g.start)))\n } else if (g.kind === 'node') {\n if (g.ids) {\n dragEndedAt.current = performance.now()\n setDragging(false)\n const dx = (e.clientX - g.start.x) / g.zoom\n const dy = (e.clientY - g.start.y) / g.zoom\n onNodeDrag?.({ ids: g.ids, delta: { x: dx, y: dy }, phase: 'end' })\n }\n } else if (g.kind === 'connect') {\n setConnecting(null)\n setConnectTarget(null)\n if (e.type === 'pointercancel' || !connect) return\n const drop = resolveDrop(hitTarget(e.clientX, e.clientY, e.target), g.from)\n if (drop?.valid) {\n const src = g.from.role === 'source' ? g.from : drop.ref\n const tgt = g.from.role === 'source' ? drop.ref : g.from\n connect.onConnect(src, tgt)\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [clientToLocal, onBackgroundPress, onMarquee, placed, onNodeDrag, connect, resolveDrop],\n )\n\n useEffect(() => {\n window.addEventListener('pointermove', onWindowMove)\n window.addEventListener('pointerup', endGesture)\n window.addEventListener('pointercancel', endGesture)\n return () => {\n window.removeEventListener('pointermove', onWindowMove)\n window.removeEventListener('pointerup', endGesture)\n window.removeEventListener('pointercancel', endGesture)\n }\n }, [onWindowMove, endGesture])\n\n const onPointerDownCapture = (e: ReactPointerEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement\n const here = { x: e.clientX, y: e.clientY }\n if (e.pointerType === 'touch') {\n touches.current.set(e.pointerId, here)\n if (pinch && touches.current.size === 2) {\n const [a, b] = [...touches.current.entries()]\n gesture.current = {\n kind: 'pinch',\n ids: [a![0], b![0]],\n startDistance: Math.hypot(a![1].x - b![1].x, a![1].y - b![1].y),\n startMid: clientToLocal({ x: (a![1].x + b![1].x) / 2, y: (a![1].y + b![1].y) / 2 }),\n origin: viewportRef.current,\n }\n return\n }\n }\n if (target.closest('[data-ty-surface-chrome]')) return\n const port = target.closest<HTMLElement>('[data-ty-port]')\n if (port && connect && e.button === 0 && mode === 'select') {\n const nodeId = port.dataset.tyPortNode\n const role = port.dataset.tyPortRole as 'source' | 'target' | undefined\n if (nodeId && role) {\n e.preventDefault()\n e.stopPropagation()\n const from: PortRef = { nodeId, role, ...(port.dataset.tyPortId ? { portId: port.dataset.tyPortId } : {}) }\n const pointer = screenToCanvas(viewportRef.current, clientToLocal(here))\n gesture.current = { kind: 'connect', pointerId: e.pointerId, from, pointer }\n setConnecting({ from, pointer })\n return\n }\n }\n const nodeEl = target.closest<HTMLElement>('[data-ty-node-id]')\n const wantsPan = mode === 'pan' || e.button === 1 || spaceHeld.current || (e.pointerType === 'touch' && !nodeEl)\n if (wantsPan && (e.button === 0 || e.button === 1)) {\n gesture.current = { kind: 'pan', pointerId: e.pointerId, start: here, origin: viewportRef.current }\n return\n }\n if (nodeEl && e.button === 0) {\n const id = nodeEl.dataset.tyNodeId!\n const self = nodes.find((n) => n.id === id)\n if (dragNodes && self?.draggable !== false && !target.closest(NO_DRAG)) {\n gesture.current = { kind: 'node', pointerId: e.pointerId, start: here, nodeId: id, ids: null, zoom: viewportRef.current.zoom }\n }\n return\n }\n if (!nodeEl && e.button === 0) {\n gesture.current = marquee\n ? { kind: 'marquee', pointerId: e.pointerId, start: here, now: here, additive: e.shiftKey || e.metaKey || e.ctrlKey }\n : { kind: 'pan', pointerId: e.pointerId, start: here, origin: viewportRef.current }\n }\n }\n\n // Wheel needs a non-passive listener to keep the page from scrolling.\n useEffect(() => {\n const el = paneRef.current\n if (!el || wheel === 'none') return\n const onWheel = (e: WheelEvent) => {\n const local = clientToLocal({ x: e.clientX, y: e.clientY })\n const v = viewportRef.current\n if (wheel === 'zoom' || e.ctrlKey || e.metaKey) {\n e.preventDefault()\n setViewport(zoomAt(v, v.zoom * Math.exp(-e.deltaY * 0.0015), local, zoomLimits))\n } else {\n e.preventDefault()\n setViewport({ ...v, x: v.x - e.deltaX, y: v.y - e.deltaY })\n }\n }\n el.addEventListener('wheel', onWheel, { passive: false })\n return () => el.removeEventListener('wheel', onWheel)\n }, [wheel, clientToLocal, setViewport, zoomLimits])\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === ' ' && e.target === paneRef.current) spaceHeld.current = true\n if (e.key === 'Escape' && !e.defaultPrevented) {\n if (gesture.current?.kind === 'connect') {\n gesture.current = null\n setConnecting(null)\n setConnectTarget(null)\n e.preventDefault()\n return\n }\n const handled = onEscape?.() ?? false\n e.preventDefault()\n if (!handled) onLeave?.()\n return\n }\n // Keyboard view control when the canvas itself (not a node) has focus.\n if (e.target !== paneRef.current || e.metaKey || e.ctrlKey || e.altKey) return\n const v = viewportRef.current\n const step = e.shiftKey ? 160 : 40\n const pans: Record<string, Point> = { ArrowLeft: { x: step, y: 0 }, ArrowRight: { x: -step, y: 0 }, ArrowUp: { x: 0, y: step }, ArrowDown: { x: 0, y: -step } }\n const pan = pans[e.key]\n if (pan) {\n e.preventDefault()\n setViewport({ ...v, x: v.x + pan.x, y: v.y + pan.y })\n } else if (e.key === '+' || e.key === '=') {\n e.preventDefault()\n setViewport(zoomAt(v, ladderStep(v.zoom, 1, zoomLimits), centrePivot(), zoomLimits))\n } else if (e.key === '-' || e.key === '_') {\n e.preventDefault()\n setViewport(zoomAt(v, ladderStep(v.zoom, -1, zoomLimits), centrePivot(), zoomLimits))\n }\n }\n const onKeyUp = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === ' ') spaceHeld.current = false\n }\n\n const ctx = useMemo<SurfaceContextValue>(\n () => ({\n zoom: viewport.zoom,\n justDragged: () => performance.now() - dragEndedAt.current < 250,\n connecting: connecting?.from ?? null,\n connectTarget: connectTarget ? { nodeId: connectTarget.nodeId, valid: connectTarget.valid } : null,\n floating,\n }),\n [viewport.zoom, connecting, connectTarget, floating],\n )\n\n const preview = useMemo(() => {\n if (!connecting) return null\n const r = placed.get(connecting.from.nodeId)\n if (!r) return null\n const pointerRect = { ...connecting.pointer, width: 0, height: 0 }\n const start = endOf(connecting.from.nodeId, connecting.from.portId, connecting.from.role, pointerRect)\n if (!start) return null\n let to: Point & { side?: CurveEnd['side'] } = connecting.pointer\n if (connectTarget?.valid) {\n const tr = placed.get(connectTarget.nodeId)\n const end = tr ? endOf(connectTarget.nodeId, connectTarget.portId, connectTarget.role ?? 'target', r) : null\n if (end) to = { ...end.point, side: end.side }\n }\n const validity: ConnectValidity = connectTarget ? (connectTarget.valid ? 'valid' : 'invalid') : 'unknown'\n return <ConnectionPreviewLine from={{ ...start.point, side: start.side }} to={to} validity={validity} />\n }, [connecting, connectTarget, placed, endOf])\n\n const svgParts: ReactNode[] = []\n const htmlParts: ReactNode[] = []\n for (const { c, shape } of shapes) {\n const parts: ConnectorParts = renderConnector ? renderConnector(c, shape) : { svg: <path className=\"ty-flow-surface__connector\" d={shape.d} markerEnd=\"url(#ty-surface-arrow)\" /> }\n if (parts.svg) svgParts.push(<g key={c.id}>{parts.svg}</g>)\n if (parts.html) htmlParts.push(<div key={c.id} className=\"ty-flow-surface__connector-html\">{parts.html}</div>)\n }\n\n const transform = `translate(${viewport.x}px, ${viewport.y}px) scale(${viewport.zoom})`\n const gridSize = GRID_STEP * viewport.zoom\n\n return (\n <SurfaceContext.Provider value={ctx}>\n <div\n ref={paneRef}\n className={['ty-flow-surface', className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={label}\n aria-roledescription={roleDescription}\n tabIndex={0}\n data-mode={mode}\n data-direction={rtl ? 'rtl' : 'ltr'}\n data-dragging={dragging || undefined}\n data-connecting={connecting ? 'true' : undefined}\n onPointerDownCapture={onPointerDownCapture}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onContextMenu={(e) => {\n const target = e.target as HTMLElement\n const nodeEl = target.closest<HTMLElement>('[data-ty-node-id]')\n const local = clientToLocal({ x: e.clientX, y: e.clientY })\n if (nodeEl && onNodeContextMenu) {\n e.preventDefault()\n onNodeContextMenu(nodeEl.dataset.tyNodeId!, { x: e.clientX, y: e.clientY })\n } else if (!nodeEl && !target.closest('[data-ty-surface-chrome]') && onBackgroundContextMenu) {\n e.preventDefault()\n onBackgroundContextMenu({ x: e.clientX, y: e.clientY }, screenToCanvas(viewportRef.current, local))\n }\n }}\n {...data}\n >\n {grid ? (\n <svg className=\"ty-flow-surface__grid\" aria-hidden=\"true\" focusable=\"false\">\n <defs>\n <pattern id=\"ty-surface-grid\" patternUnits=\"userSpaceOnUse\" x={viewport.x % gridSize} y={viewport.y % gridSize} width={gridSize} height={gridSize}>\n <circle cx={gridSize / 2} cy={gridSize / 2} r={Math.max(0.6, 1 * viewport.zoom)} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#ty-surface-grid)\" />\n </svg>\n ) : null}\n <div className=\"ty-flow-surface__plane\" style={{ transform }}>\n <svg className=\"ty-flow-surface__links\" aria-hidden=\"true\" focusable=\"false\">\n <defs>\n <marker id=\"ty-surface-arrow\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerWidth=\"8\" markerHeight=\"8\" orient=\"auto-start-reverse\">\n <path d=\"M0,0 L10,5 L0,10 z\" className=\"ty-flow-surface__arrowhead\" />\n </marker>\n </defs>\n {svgParts}\n {preview}\n </svg>\n {ordered.map((n) => {\n const r = n.rect\n return (\n <div\n key={n.id}\n className=\"ty-flow-surface__node\"\n data-ty-node-id={n.id}\n data-layer={n.layer ?? 1}\n style={{ transform: `translate(${r.x}px, ${r.y}px)`, width: r.width, ...(n.fixedHeight ? { height: r.height } : { minHeight: r.height }) }}\n onKeyDown={onNodeKeyDown ? (e) => onNodeKeyDown(n.id, e) : undefined}\n ref={refFor(n.id)}\n >\n {renderNode(n)}\n </div>\n )\n })}\n {overlay}\n {htmlParts}\n </div>\n {marqueeBox ? <div className=\"ty-flow-surface__marquee\" aria-hidden=\"true\" style={{ left: marqueeBox.x, top: marqueeBox.y, width: marqueeBox.width, height: marqueeBox.height }} /> : null}\n {minimap ? <OverviewMap nodes={ordered} rects={placed} viewport={viewport} container={container} onCentre={(p) => setViewport({ ...viewportRef.current, x: container.width / 2 - p.x * viewportRef.current.zoom, y: container.height / 2 - p.y * viewportRef.current.zoom })} /> : null}\n {children}\n <div className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {connecting ? liveText : ''}\n </div>\n </div>\n </SurfaceContext.Provider>\n )\n\n}\n","// GraphNodeCard: the shell every node is drawn with (workflow kinds and the\n// provenance graph). One primary control (the title button, stretched over the\n// card) opens or selects the node; delete and other actions are sibling\n// buttons, never nested inside it.\n\nimport { isValidElement, useId, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { Button as AriaButton, Input, TextField as AriaTextField, Label } from 'react-aria-components'\nimport { TriangleAlert, Trash2 } from 'lucide-react'\nimport { Button, type IconComponent } from '../../index'\nimport { nodeStateAttributes, type NodeProofState, type NodeRunState } from '../catalog/nodeState'\nimport type { ToneName } from '../catalog/palette'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useSurface } from '../surface/SurfaceContext'\n\nexport type CardWidth = 'narrow' | 'standard' | 'wide'\nexport type CardDensity = 'detailed' | 'compact'\n\n/** Card widths in canvas units (multiples of the 4 px scale of §2.1). */\nexport const CARD_WIDTHS: Readonly<Record<CardWidth, number>> = Object.freeze({ narrow: 208, standard: 256, wide: 304 })\n\n/** Height a card is laid out with before it is measured. */\nexport function estimatedCardHeight(density: CardDensity, hasMeta = true): number {\n return density === 'compact' ? 60 : hasMeta ? 104 : 76\n}\n\nexport interface GraphNodeCardLabels {\n /** Accessible name pattern of the card's main control. */\n name: string\n rename: string\n renameField: string\n remove: string\n problem: string\n selected: string\n locked: string\n dimmed: string\n running: string\n succeeded: string\n failed: string\n skipped: string\n}\n\nexport const graphNodeCardLabels = defineLabels<GraphNodeCardLabels>('GraphNodeCard', {\n en: {\n name: '{kind}: {title}',\n rename: 'Rename {title}',\n renameField: 'Name of {title}',\n remove: 'Remove {title}',\n problem: 'Needs attention',\n selected: 'selected',\n locked: 'read only',\n dimmed: 'not run',\n running: 'running',\n succeeded: 'succeeded',\n failed: 'failed',\n skipped: 'skipped',\n },\n 'pt-BR': {\n name: '{kind}: {title}',\n rename: 'Renomear {title}',\n renameField: 'Nome de {title}',\n remove: 'Remover {title}',\n problem: 'Precisa de atenção',\n selected: 'selecionado',\n locked: 'somente leitura',\n dimmed: 'não executado',\n running: 'em execução',\n succeeded: 'concluído',\n failed: 'falhou',\n skipped: 'ignorado',\n },\n es: {\n name: '{kind}: {title}',\n rename: 'Cambiar el nombre de {title}',\n renameField: 'Nombre de {title}',\n remove: 'Quitar {title}',\n problem: 'Requiere atención',\n selected: 'seleccionado',\n locked: 'solo lectura',\n dimmed: 'no ejecutado',\n running: 'en ejecución',\n succeeded: 'completado',\n failed: 'falló',\n skipped: 'omitido',\n },\n})\n\nexport const defaultGraphNodeCardLabels: GraphNodeCardLabels = graphNodeCardLabels.bundles.en\n\nexport interface GraphNodeCardProps {\n /** Kind key (tone, test hooks). */\n kind: string\n /** Spoken kind name (catalog label or category); defaults to the kind key. */\n kindLabel?: string\n title: string\n description?: string\n icon?: IconComponent | ReactNode\n tone?: ToneName\n width?: CardWidth\n density?: CardDensity\n selected?: boolean\n /** Missing or not configured: dashed border, warning icon and this text (or the default word). */\n problem?: boolean | string\n runState?: NodeRunState\n locked?: boolean\n dimmed?: boolean\n /** Provenance proof state: border line style per §2.11. */\n proofState?: NodeProofState | null\n /** When set, the card is a button (opens configuration or selects). */\n onActivate?: () => void\n /** Enables in-place rename (double-click or F2). */\n onRename?: (title: string) => void\n /** Shows the delete action. */\n onDelete?: () => void\n /** Content under the header (badges, counts); hidden in compact density. */\n meta?: ReactNode\n /** Small items next to the title (kind badge, dialect). */\n badges?: ReactNode\n /** Extra header actions (sibling buttons). */\n headerActions?: ReactNode\n /** Words added to the accessible description (run state detail, proof word …). */\n stateWords?: string[]\n /** Overrides the composed accessible name. */\n accessibleName?: string\n /** Ports, run indicator, hover toolbar: drawn inside the card, outside the main control. */\n children?: ReactNode\n labels?: Partial<GraphNodeCardLabels>\n className?: string\n /** Keys pressed on the main control (the host adds node shortcuts). */\n onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void\n}\n\nfunction renderIcon(icon: GraphNodeCardProps['icon']) {\n if (!icon) return null\n if (isValidElement(icon)) return icon\n if (typeof icon === 'function' || (typeof icon === 'object' && icon !== null && '$$typeof' in icon)) {\n const Icon = icon as IconComponent\n return <Icon aria-hidden=\"true\" focusable=\"false\" />\n }\n return icon as ReactNode\n}\n\nexport function GraphNodeCard(props: GraphNodeCardProps) {\n const {\n kind,\n kindLabel,\n title,\n description,\n icon,\n tone = 'neutral',\n width = 'standard',\n density = 'detailed',\n selected = false,\n problem = false,\n runState = 'idle',\n locked = false,\n dimmed = false,\n proofState,\n onActivate,\n onRename,\n onDelete,\n meta,\n badges,\n headerActions,\n stateWords = [],\n accessibleName,\n children,\n className,\n onKeyDown,\n } = props\n const l = useLabels(graphNodeCardLabels, props.labels)\n const { locale } = useFlowLocale()\n const surface = useSurface()\n const stateId = useId()\n const problemId = useId()\n const activatorRef = useRef<HTMLButtonElement>(null)\n const [renaming, setRenaming] = useState(false)\n const [draft, setDraft] = useState(title)\n const canRename = !!onRename && !locked\n\n const name = accessibleName ?? fill(l.name, { kind: kindLabel ?? kind, title }, locale)\n const words = [\n ...(selected ? [l.selected] : []),\n ...(runState !== 'idle' ? [l[runState]] : []),\n ...(locked ? [l.locked] : []),\n ...(dimmed ? [l.dimmed] : []),\n ...stateWords,\n ]\n\n const startRename = () => {\n if (!canRename) return\n setDraft(title)\n setRenaming(true)\n }\n const finishRename = (commit: boolean) => {\n const value = draft.trim()\n setRenaming(false)\n if (commit && value && value !== title) onRename?.(value)\n requestAnimationFrame(() => activatorRef.current?.focus())\n }\n\n const onActivatorKeyDown = (e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'F2' && canRename) {\n e.preventDefault()\n startRename()\n return\n }\n onKeyDown?.(e)\n }\n\n const titleNode = renaming ? (\n <AriaTextField className=\"ty-node-card__rename\" value={draft} onChange={setDraft} autoFocus aria-label={fill(l.renameField, { title }, locale)}>\n <Label className=\"ty-visually-hidden\">{fill(l.renameField, { title }, locale)}</Label>\n <Input\n className=\"ty-node-card__rename-input\"\n data-ty-no-drag=\"\"\n onBlur={() => finishRename(true)}\n onKeyDown={(e) => {\n // Keys typed while renaming never reach canvas shortcuts.\n e.stopPropagation()\n if (e.key === 'Enter') {\n e.preventDefault()\n finishRename(true)\n } else if (e.key === 'Escape') {\n e.preventDefault()\n finishRename(false)\n }\n }}\n />\n </AriaTextField>\n ) : onActivate ? (\n <AriaButton\n ref={activatorRef}\n className=\"ty-node-card__activator\"\n aria-label={name}\n aria-describedby={[words.length ? stateId : null, problem ? problemId : null].filter(Boolean).join(' ') || undefined}\n data-ty-node-focus=\"\"\n onPress={() => {\n if (surface.justDragged()) return\n onActivate()\n }}\n onKeyDown={onActivatorKeyDown}\n >\n <span className=\"ty-node-card__title\" title={title}>\n {title}\n </span>\n </AriaButton>\n ) : (\n <span className=\"ty-node-card__title\" title={title}>\n {title}\n </span>\n )\n\n const root = {\n className: ['ty-node-card', className].filter(Boolean).join(' '),\n 'data-kind': kind,\n 'data-tone': tone,\n 'data-width': width,\n 'data-density': density,\n 'data-problem': problem ? 'true' : 'false',\n 'data-interactive': onActivate ? 'true' : 'false',\n ...nodeStateAttributes({ selected, runState, locked, dimmed, ...(proofState !== undefined ? { proofState } : {}) }),\n ...(surface.connectTarget && surface.connecting ? { 'data-connect-target': surface.connectTarget.valid ? 'valid' : 'invalid' } : {}),\n }\n\n const groupProps = onActivate\n ? {}\n : {\n role: 'group' as const,\n 'aria-label': name,\n tabIndex: 0,\n 'data-ty-node-focus': '',\n ...(words.length ? { 'aria-describedby': stateId } : {}),\n onKeyDown: onActivatorKeyDown,\n }\n\n return (\n <div {...root} {...groupProps}>\n <div className=\"ty-node-card__header\">\n <span className=\"ty-node-card__bubble\" data-tone={tone} aria-hidden=\"true\">\n {renderIcon(icon)}\n </span>\n <div className=\"ty-node-card__titles\" onDoubleClick={canRename && !renaming ? startRename : undefined}>\n {titleNode}\n {description && density === 'detailed' ? <span className=\"ty-node-card__description\">{description}</span> : null}\n </div>\n {badges ? <div className=\"ty-node-card__badges\">{badges}</div> : null}\n {headerActions || onDelete ? (\n <div className=\"ty-node-card__actions\">\n {headerActions}\n {onDelete && !locked ? (\n <Button className=\"ty-node-card__delete\" variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={fill(l.remove, { title }, locale)} leadingIcon={<Trash2 />} onPress={onDelete} />\n ) : null}\n </div>\n ) : null}\n </div>\n {problem ? (\n <p className=\"ty-node-card__problem\" id={problemId}>\n <TriangleAlert aria-hidden=\"true\" focusable=\"false\" />\n <span>{typeof problem === 'string' ? problem : l.problem}</span>\n </p>\n ) : null}\n {meta && density === 'detailed' ? <div className=\"ty-node-card__meta\">{meta}</div> : null}\n {words.length ? (\n <span id={stateId} className=\"ty-visually-hidden\">\n {words.join(', ')}\n </span>\n ) : null}\n {children}\n </div>\n )\n}\n\n/** Small label in the header or meta row: neutral, or in the kind's tone. */\nexport function NodeBadge({ tone = 'neutral', icon, children }: { tone?: ToneName | 'neutral'; icon?: ReactNode; children: ReactNode }) {\n return (\n <span className=\"ty-node-badge\" data-tone={tone}>\n {icon ? (\n <span className=\"ty-node-badge__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n {children}\n </span>\n )\n}\n","// Port placement: which ports a node has and where each sits. Pure; used by\n// ConnectionPorts (drawing) and by portAnchorFor (connector geometry), so the\n// dot and the line end always agree.\n\nimport type { BranchTone, PortSpec, PortTopology } from '../catalog/kindCatalog'\nimport type { RenderCatalog } from '../catalog/RenderCatalog'\nimport type { FlowNode, LayoutDirection, Side } from '../model/types'\nimport type { PortAnchor } from '../surface/types'\n\nexport type PortRole = 'source' | 'target'\n\n/** A port ready to draw: logical side after the layout mapping, position 0..1 along it. */\nexport interface PlacedPort {\n id: string\n role: PortRole\n side: Side\n along: number\n label?: string\n tone?: BranchTone\n}\n\n/** Per-instance outputs (one per configured case), stored in node data. */\nexport interface DynamicOutput {\n id: string\n label: string\n tone?: BranchTone\n}\n\n/**\n * Top-down layouts turn the inline sides into block sides: start → top,\n * end → bottom. Ids never change, so saved connectors keep resolving.\n */\nexport function sideForLayout(side: Side, direction: LayoutDirection): Side {\n if (direction !== 'down') return side\n if (side === 'start') return 'top'\n if (side === 'end') return 'bottom'\n return side\n}\n\n/** Position of item `index` of `count` spread evenly along a side (1/(n+1) steps). */\nexport function evenSpread(index: number, count: number): number {\n return (index + 1) / (count + 1)\n}\n\n/** Ids of a port set: prefix plus index, or the stable keys when given. */\nexport function portSetIds(count: number, idPrefix: string, keys?: readonly string[]): string[] {\n return Array.from({ length: count }, (_, i) => keys?.[i] ?? `${idPrefix}-${i}`)\n}\n\nconst IN: PortSpec = { id: 'in', side: 'start' }\nconst OUT: PortSpec = { id: 'out', side: 'end' }\n\n/** Topology used when the catalog has none for a kind. */\nexport function fallbackTopology(kind: string): PortTopology {\n switch (kind) {\n case 'start':\n case 'trigger':\n return { inputs: [], outputs: [OUT] }\n case 'end':\n case 'answer':\n return { inputs: [IN], outputs: [] }\n case 'note':\n return { inputs: [], outputs: [] }\n case 'if-else':\n case 'branch':\n return {\n inputs: [IN],\n outputs: [\n { id: 'true', side: 'end', label: 'true', tone: 'success' },\n { id: 'false', side: 'end', label: 'false', tone: 'error' },\n ],\n }\n case 'iteration':\n case 'loop':\n return { inputs: [IN], outputs: [OUT, { id: 'loop', side: 'bottom', label: 'loop', tone: 'info' }] }\n case 'agent':\n return {\n inputs: [IN, { id: 'in-top', side: 'top' }],\n outputs: [OUT, { id: 'out-bottom', side: 'bottom' }, { id: 'rule', side: 'bottom', offset: 80, label: 'rule', tone: 'neutral' }],\n }\n case 'rule':\n return { inputs: [IN], outputs: [{ id: 'rule', side: 'end', label: 'rule', tone: 'neutral' }] }\n default:\n return { inputs: [IN], outputs: [OUT] }\n }\n}\n\nfunction place(specs: readonly PortSpec[], role: PortRole, direction: LayoutDirection): PlacedPort[] {\n // Ports without an explicit offset share their side evenly.\n const bySide = new Map<Side, PortSpec[]>()\n for (const s of specs) if (s.offset === undefined) bySide.set(s.side, [...(bySide.get(s.side) ?? []), s])\n return specs.map((s) => {\n const peers = bySide.get(s.side)\n const along = s.offset !== undefined ? s.offset / 100 : evenSpread(peers!.indexOf(s), peers!.length)\n return {\n id: s.id,\n role,\n side: sideForLayout(s.side, direction),\n along,\n ...(s.label ? { label: s.label } : {}),\n ...(s.tone ? { tone: s.tone } : {}),\n }\n })\n}\n\nfunction dynamicOutputsOf(node: FlowNode): DynamicOutput[] | null {\n const d = node.data.dynamicOutputs\n if (!Array.isArray(d) || !d.length) return null\n return d.filter((o): o is DynamicOutput => !!o && typeof o === 'object' && typeof (o as DynamicOutput).id === 'string')\n}\n\n/** Every port of a node, placed for the current layout direction. */\nexport function portsOf(node: FlowNode, catalog: Pick<RenderCatalog, 'ports'>, direction: LayoutDirection): { inputs: PlacedPort[]; outputs: PlacedPort[] } {\n const topology = catalog.ports(node.kind) ?? fallbackTopology(node.kind)\n const dynamic = dynamicOutputsOf(node)\n const outputs: PortSpec[] = dynamic ? dynamic.map((o) => ({ id: o.id, side: 'end', label: o.label, ...(o.tone ? { tone: o.tone } : {}) })) : topology.outputs\n return { inputs: place(topology.inputs, 'target', direction), outputs: place(outputs, 'source', direction) }\n}\n\n/** Where a connector touches `node` for `portId`; the first port of the role when the id is unknown. */\nexport function portAnchorFor(node: FlowNode, portId: string | undefined, role: PortRole, direction: LayoutDirection, catalog: Pick<RenderCatalog, 'ports'>): PortAnchor {\n const { inputs, outputs } = portsOf(node, catalog, direction)\n const list = role === 'source' ? outputs : inputs\n const port = (portId !== undefined && list.find((p) => p.id === portId)) || list[0]\n if (port) return { side: port.side, along: port.along }\n return { side: sideForLayout(role === 'source' ? 'end' : 'start', direction), along: 0.5 }\n}\n","// ConnectionPorts: the points on a node where connectors start and end. Ports\n// are not tab stops; the canvas surface reads their data attributes to draw a\n// connection, and the keyboard path is the \"Connect to…\" command below.\n\nimport { useMemo, useState, type CSSProperties } from 'react'\nimport { Button as AriaButton, ComboBox, Input, Label, ListBox, ListBoxItem, Popover } from 'react-aria-components'\nimport { Check, ChevronDown, Info, Minus, TriangleAlert, X } from 'lucide-react'\nimport { Button, ModalDialog, NativeSelect } from '../../index'\nimport type { BranchTone } from '../catalog/kindCatalog'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\nimport type { LayoutDirection, Side } from '../model/types'\nimport { useSurface } from '../surface/SurfaceContext'\nimport type { PortRef } from '../surface/types'\nimport { evenSpread, portSetIds, sideForLayout, type PlacedPort } from './ports'\n\nexport interface ConnectionPortsLabels {\n input: string\n output: string\n /** \"{direction} {label} of {node}\"; label may be empty. */\n name: string\n}\n\nexport const connectionPortsLabels = defineLabels<ConnectionPortsLabels>('connectionPorts', {\n en: { input: 'input', output: 'output', name: '{direction}{label} of {node}' },\n 'pt-BR': { input: 'entrada', output: 'saída', name: '{direction}{label} de {node}' },\n es: { input: 'entrada', output: 'salida', name: '{direction}{label} de {node}' },\n})\nexport const defaultConnectionPortsLabels = connectionPortsLabels.bundles.en\n\nconst TONE_ICON: Record<BranchTone, typeof Check> = { success: Check, error: X, info: Info, warning: TriangleAlert, neutral: Minus }\n\n/** Small label beside an output: icon and word by tone, never colour alone. */\nexport function BranchLabel({ label, tone = 'neutral' }: { label: string; tone?: BranchTone }) {\n const Icon = TONE_ICON[tone]\n return (\n <span className=\"ty-branch-label\" data-branch-tone={tone} aria-hidden=\"true\">\n <Icon focusable=\"false\" />\n {label}\n </span>\n )\n}\n\nexport interface ConnectionPortProps {\n /** Receives (input) or emits (output) connectors. */\n direction: 'input' | 'output'\n /** Preferred side before the layout mapping. */\n side: Side\n id: string\n nodeId: string\n /** Node name used in the port's accessible name. */\n nodeLabel: string\n /** Kind tone (categorical token name) of the point. */\n tone?: string\n branchTone?: BranchTone\n /** Position along the side, in percent; centred when absent. */\n offset?: number\n label?: string\n layout?: LayoutDirection\n /** Read-only picture: decorative, not a connection point. */\n preview?: boolean\n labels?: Partial<ConnectionPortsLabels>\n}\n\n/** One port. */\nexport function ConnectionPort(props: ConnectionPortProps) {\n const { direction, side, id, nodeId, nodeLabel, tone = 'neutral', branchTone, offset, label, layout = 'right', preview = false } = props\n const placed: PlacedPort = {\n id,\n role: direction === 'output' ? 'source' : 'target',\n side: sideForLayout(side, layout),\n along: offset !== undefined ? offset / 100 : 0.5,\n ...(label ? { label } : {}),\n ...(branchTone ? { tone: branchTone } : {}),\n }\n return <PortDot port={placed} nodeId={nodeId} nodeLabel={nodeLabel} tone={tone} preview={preview} labels={props.labels} />\n}\n\nexport interface PortSetProps extends Omit<ConnectionPortProps, 'id' | 'offset'> {\n count: number\n idPrefix: string\n /** Stable keys for items that can be reordered; replaces prefix-index ids. */\n keys?: readonly string[]\n}\n\n/** Several ports spread evenly along one side (ids prefix-0, prefix-1 …). */\nexport function PortSet({ count, idPrefix, keys, ...rest }: PortSetProps) {\n return (\n <>\n {portSetIds(count, idPrefix, keys).map((id, i) => (\n <ConnectionPort key={id} {...rest} id={id} offset={evenSpread(i, count) * 100} />\n ))}\n </>\n )\n}\n\nexport interface ConnectionPortsProps {\n nodeId: string\n nodeLabel: string\n inputs: readonly PlacedPort[]\n outputs: readonly PlacedPort[]\n tone?: string\n preview?: boolean\n labels?: Partial<ConnectionPortsLabels>\n}\n\n/** All ports of a node (see portsOf). */\nexport function ConnectionPorts({ nodeId, nodeLabel, inputs, outputs, tone = 'neutral', preview = false, labels }: ConnectionPortsProps) {\n return (\n <>\n {[...inputs, ...outputs].map((p) => (\n <PortDot key={`${p.role}-${p.id}`} port={p} nodeId={nodeId} nodeLabel={nodeLabel} tone={tone} preview={preview} labels={labels} />\n ))}\n </>\n )\n}\n\nfunction PortDot({ port, nodeId, nodeLabel, tone, preview, labels }: { port: PlacedPort; nodeId: string; nodeLabel: string; tone: string; preview: boolean; labels: Partial<ConnectionPortsLabels> | undefined }) {\n const l = useLabels(connectionPortsLabels, labels)\n const surface = useSurface()\n const name = fill(l.name, { direction: port.role === 'source' ? l.output : l.input, label: port.label ? ` ${port.label}` : '', node: nodeLabel })\n const target = surface.connectTarget?.nodeId === nodeId && surface.connecting && surface.connecting.role !== port.role ? (surface.connectTarget.valid ? 'valid' : 'invalid') : undefined\n const connectingFromHere = surface.connecting?.nodeId === nodeId && surface.connecting.portId === port.id && surface.connecting.role === port.role\n const style = { '--ty-port-along': `${port.along * 100}%` } as CSSProperties\n const common = {\n className: 'ty-port',\n 'data-side': port.side,\n 'data-role': port.role,\n 'data-tone': tone,\n ...(port.tone ? { 'data-branch-tone': port.tone } : {}),\n 'data-hidden': surface.floating ? 'true' : undefined,\n 'data-target': target,\n 'data-origin': connectingFromHere ? 'true' : undefined,\n style,\n }\n if (preview) {\n return (\n <span {...common} data-preview=\"true\" aria-hidden=\"true\">\n <span className=\"ty-port__dot\" />\n </span>\n )\n }\n return (\n <span {...common} data-ty-port=\"\" data-ty-port-node={nodeId} data-ty-port-id={port.id} data-ty-port-role={port.role} data-port-id={port.id}>\n <span className=\"ty-port__dot\" aria-hidden=\"true\" />\n <span className=\"ty-visually-hidden\">{name}</span>\n {port.label ? <BranchLabel label={port.label} {...(port.tone ? { tone: port.tone } : {})} /> : null}\n </span>\n )\n}\n\n// ---- keyboard alternative -----------------------------------------------\n\nexport interface ConnectToLabels {\n title: string\n description: string\n output: string\n target: string\n targetPlaceholder: string\n noTargets: string\n connect: string\n cancel: string\n}\n\nexport const connectToLabels = defineLabels<ConnectToLabels>('connectTo', {\n en: {\n title: 'Connect {node} to…',\n description: 'Choose the step that receives this connection.',\n output: 'Output',\n target: 'Target step',\n targetPlaceholder: 'Type a step name',\n noTargets: 'No step can receive this connection.',\n connect: 'Connect',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n title: 'Conectar {node} a…',\n description: 'Escolha a etapa que recebe esta conexão.',\n output: 'Saída',\n target: 'Etapa de destino',\n targetPlaceholder: 'Digite o nome de uma etapa',\n noTargets: 'Nenhuma etapa pode receber esta conexão.',\n connect: 'Conectar',\n cancel: 'Cancelar',\n },\n es: {\n title: 'Conectar {node} con…',\n description: 'Elige el paso que recibe esta conexión.',\n output: 'Salida',\n target: 'Paso de destino',\n targetPlaceholder: 'Escribe el nombre de un paso',\n noTargets: 'Ningún paso puede recibir esta conexión.',\n connect: 'Conectar',\n cancel: 'Cancelar',\n },\n})\nexport const defaultConnectToLabels = connectToLabels.bundles.en\n\nexport interface ConnectTarget {\n nodeId: string\n label: string\n kindLabel?: string\n}\n\nexport interface ConnectToDialogProps {\n isOpen: boolean\n onOpenChange: (open: boolean) => void\n sourceId: string\n sourceLabel: string\n /** Outputs of the source; a list to choose from when there is more than one. */\n outputs: readonly PlacedPort[]\n /** Valid targets only (the host filters with canConnect). */\n targets: readonly ConnectTarget[]\n /** Same call a pointer drop makes. */\n onConnect: (from: PortRef, to: PortRef) => void\n labels?: Partial<ConnectToLabels>\n}\n\n/** \"Connect to…\": the keyboard way to create a connector from the focused node. */\nexport function ConnectToDialog({ isOpen, onOpenChange, sourceId, sourceLabel, outputs, targets, onConnect, labels }: ConnectToDialogProps) {\n const l = useLabels(connectToLabels, labels)\n const [output, setOutput] = useState<string | undefined>(outputs[0]?.id)\n const [target, setTarget] = useState<string | null>(null)\n const items = useMemo(() => targets.map((t) => ({ id: t.nodeId, ...t })), [targets])\n const submit = () => {\n if (!target) return\n onConnect({ nodeId: sourceId, role: 'source', ...(output ? { portId: output } : {}) }, { nodeId: target, role: 'target' })\n onOpenChange(false)\n }\n return (\n <ModalDialog\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n width=\"narrow\"\n title={fill(l.title, { node: sourceLabel })}\n description={l.description}\n actions={\n <>\n <Button variant=\"secondary\" onPress={() => onOpenChange(false)}>\n {l.cancel}\n </Button>\n <Button variant=\"primary\" disabled={!target} onPress={submit}>\n {l.connect}\n </Button>\n </>\n }\n >\n <div className=\"ty-connect-to\">\n {outputs.length > 1 ? (\n <NativeSelect label={l.output} options={outputs.map((o) => ({ value: o.id, label: o.label ?? o.id }))} value={output ?? ''} onChange={setOutput} />\n ) : null}\n {items.length ? (\n <ComboBox className=\"ty-connect-to__combo\" items={items} selectedKey={target} onSelectionChange={(k) => setTarget(k === null ? null : String(k))} menuTrigger=\"focus\">\n <Label className=\"ty-connect-to__label\">{l.target}</Label>\n <div className=\"ty-connect-to__field\">\n <Input className=\"ty-connect-to__input\" placeholder={l.targetPlaceholder} />\n <AriaButton className=\"ty-connect-to__toggle\">\n <ChevronDown aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n </div>\n <Popover className=\"ty-connect-to__popover\">\n <ListBox className=\"ty-connect-to__list\">\n {(item: (typeof items)[number]) => (\n <ListBoxItem id={item.id} textValue={item.label} className=\"ty-connect-to__option\">\n {item.label}\n {item.kindLabel ? <span className=\"ty-connect-to__kind\">{item.kindLabel}</span> : null}\n </ListBoxItem>\n )}\n </ListBox>\n </Popover>\n </ComboBox>\n ) : (\n <p className=\"ty-connect-to__empty\">{l.noTargets}</p>\n )}\n </div>\n </ModalDialog>\n )\n}\n","// Pieces every node kind composes around GraphNodeCard: kind presentation\n// from the render catalog, the floating per-node tool strip, and the status\n// mark of read-only previews.\n\nimport type { ReactNode } from 'react'\nimport { Toolbar } from 'react-aria-components'\nimport { CircleCheck, CircleDashed, CircleX, History, LoaderCircle, SkipForward, Undo2 } from 'lucide-react'\nimport { Button, type IconComponent } from '../../index'\nimport { humaniseKey, useRenderCatalog, type RenderCatalog } from '../catalog/RenderCatalog'\nimport type { ToneName } from '../catalog/palette'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection, RunStatus } from '../model/types'\nimport { portsOf, type PlacedPort } from './ports'\n\nexport interface KindPresentation {\n catalog: RenderCatalog\n kindLabel: string\n category: string | undefined\n icon: IconComponent\n tone: ToneName\n title: string\n description: string | undefined\n inputs: PlacedPort[]\n outputs: PlacedPort[]\n}\n\n/** Label, icon, tone and ports of a node: per-instance identity > node label > catalog > kind key. */\nexport function useKindPresentation(node: FlowNode, direction: LayoutDirection, fallbackTitle?: string): KindPresentation {\n const catalog = useRenderCatalog()\n const entry = catalog.entry(node.kind)\n const identity = catalog.identity(node.kind, node.data)\n const label = typeof node.data.label === 'string' && node.data.label.trim() ? node.data.label : undefined\n const { inputs, outputs } = portsOf(node, catalog, direction)\n return {\n catalog,\n kindLabel: entry?.label ?? humaniseKey(node.kind),\n category: entry?.category,\n icon: identity?.icon ?? catalog.icon(node.kind),\n tone: catalog.tone(node.kind),\n title: identity?.title ?? label ?? fallbackTitle ?? entry?.label ?? humaniseKey(node.kind),\n description: identity?.description ?? (typeof node.data.description === 'string' ? node.data.description : undefined),\n inputs,\n outputs,\n }\n}\n\nexport interface NodeToolAction {\n id: string\n label: string\n icon: IconComponent\n onPress: () => void\n tone?: 'default' | 'danger'\n}\n\n/**\n * Tool strip above a node (APG Toolbar): visible on hover, selection and\n * keyboard focus inside the node, always in the DOM so Tab reaches it.\n */\nexport function NodeTools({ label, actions }: { label: string; actions: NodeToolAction[] }) {\n if (!actions.length) return null\n return (\n <Toolbar aria-label={label} className=\"ty-node-tools\" data-ty-no-drag=\"\" data-ty-above=\"\">\n {actions.map((a) => (\n <Button key={a.id} variant={a.tone === 'danger' ? 'danger' : 'quiet'} size=\"compact\" iconOnly accessibleLabel={a.label} leadingIcon={<a.icon />} onPress={a.onPress} />\n ))}\n </Toolbar>\n )\n}\n\nexport interface PreviewStatusLabels {\n running: string\n completed: string\n failed: string\n skipped: string\n restored: string\n 'served-from-history': string\n unknown: string\n}\n\nexport const previewStatusLabels = defineLabels<PreviewStatusLabels>('previewStatus', {\n en: { running: 'running', completed: 'completed', failed: 'failed', skipped: 'skipped', restored: 'restored', 'served-from-history': 'from history', unknown: 'not run' },\n 'pt-BR': { running: 'em execução', completed: 'concluída', failed: 'falhou', skipped: 'ignorada', restored: 'restaurada', 'served-from-history': 'do histórico', unknown: 'não executada' },\n es: { running: 'en ejecución', completed: 'completado', failed: 'falló', skipped: 'omitido', restored: 'restaurado', 'served-from-history': 'del historial', unknown: 'no ejecutado' },\n})\nexport const defaultPreviewStatusLabels = previewStatusLabels.bundles.en\n\nconst STATUS_GLYPHS: Record<RunStatus, IconComponent> = {\n running: LoaderCircle,\n completed: CircleCheck,\n failed: CircleX,\n skipped: SkipForward,\n restored: Undo2,\n 'served-from-history': History,\n unknown: CircleDashed,\n}\n\n/** Word for a preview status (goes into the node's accessible name). */\nexport function usePreviewStatusWord(status: RunStatus | undefined, labels?: Partial<PreviewStatusLabels>): string | null {\n const l = useLabels(previewStatusLabels, labels)\n return status ? l[status] : null\n}\n\n/** Glyph plus word, never colour alone. */\nexport function PreviewStatusMark({ status, labels }: { status: RunStatus; labels?: Partial<PreviewStatusLabels> }): ReactNode {\n const l = useLabels(previewStatusLabels, labels)\n const Glyph = STATUS_GLYPHS[status]\n return (\n <span className=\"ty-preview-status\" data-status={status} aria-hidden=\"true\">\n <Glyph focusable=\"false\" />\n {l[status]}\n </span>\n )\n}\n","// NodeRunIndicator: a node's state in the current or inspected run (pending,\n// running, succeeded, failed) with the duration once finished. The mark is not\n// focusable; its words join the node's accessible name through useRunWords.\n\nimport { useEffect, useRef } from 'react'\nimport { CircleCheck, CircleX, Clock, LoaderCircle } from 'lucide-react'\nimport { runStateOf, type NodeRunState } from '../catalog/nodeState'\nimport { useAnnounce } from '../internal/Announcer'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { NodeResultStatus, NodeRunResult } from '../model/types'\nimport { useNodeResult } from '../state/editorState'\n\nexport interface NodeRunLabels {\n pending: string\n running: string\n succeeded: string\n succeededIn: string\n failed: string\n failedWith: string\n /** Live announcement for the focused node: \"{node}: {state}\". */\n announce: string\n milliseconds: string\n seconds: string\n}\n\nexport const nodeRunLabels = defineLabels<NodeRunLabels>('nodeRun', {\n en: {\n pending: 'waiting',\n running: 'running',\n succeeded: 'succeeded',\n succeededIn: 'succeeded in {duration}',\n failed: 'failed',\n failedWith: 'failed: {message}',\n announce: '{node}: {state}',\n milliseconds: '{value, number} ms',\n seconds: '{value} s',\n },\n 'pt-BR': {\n pending: 'aguardando',\n running: 'em execução',\n succeeded: 'concluída',\n succeededIn: 'concluída em {duration}',\n failed: 'falhou',\n failedWith: 'falhou: {message}',\n announce: '{node}: {state}',\n milliseconds: '{value, number} ms',\n seconds: '{value} s',\n },\n es: {\n pending: 'en espera',\n running: 'en ejecución',\n succeeded: 'completado',\n succeededIn: 'completado en {duration}',\n failed: 'falló',\n failedWith: 'falló: {message}',\n announce: '{node}: {state}',\n milliseconds: '{value, number} ms',\n seconds: '{value} s',\n },\n})\nexport const defaultNodeRunLabels = nodeRunLabels.bundles.en\n\n/**\n * Under one second: whole milliseconds (\"340 ms\"); otherwise seconds with one\n * decimal (\"2.5 s\", \"2,5 s\"). SI symbols, locale digits and separators.\n */\nexport function formatRunDuration(ms: number, locale: string, l: Pick<NodeRunLabels, 'milliseconds' | 'seconds'> = defaultNodeRunLabels): string {\n if (!Number.isFinite(ms) || ms < 0) return ''\n if (ms < 1000) return fill(l.milliseconds, { value: Math.round(ms) }, locale)\n const value = new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(ms / 1000)\n return fill(l.seconds, { value }, locale)\n}\n\n/** Words for a result, used in the node's accessible name. */\nexport function runWords(result: NodeRunResult | undefined, locale: string, l: NodeRunLabels): string | null {\n if (!result) return null\n const duration = result.durationMs !== undefined ? formatRunDuration(result.durationMs, locale, l) : ''\n switch (result.status) {\n case 'pending':\n return l.pending\n case 'running':\n return l.running\n case 'success':\n return duration ? fill(l.succeededIn, { duration }, locale) : l.succeeded\n case 'error': {\n const base = result.error ? fill(l.failedWith, { message: result.error }, locale) : l.failed\n return duration ? `${base}, ${duration}` : base\n }\n }\n}\n\n/** Run state and words of a node from the editor state (nothing outside an editor). */\nexport function useRunWords(nodeId: string, labels?: Partial<NodeRunLabels>): { result: NodeRunResult | undefined; runState: NodeRunState; words: string | null } {\n const result = useNodeResult(nodeId)\n const l = useLabels(nodeRunLabels, labels)\n const { locale } = useFlowLocale()\n return { result, runState: runStateOf(result?.status), words: runWords(result, locale, l) }\n}\n\nconst MARKS: Record<NodeResultStatus, typeof Clock> = { pending: Clock, running: LoaderCircle, success: CircleCheck, error: CircleX }\n\nexport interface NodeRunIndicatorProps {\n nodeId: string\n /** Node kind (kept for hosts that tint per kind; the ring uses the pending semantic colour). */\n kind?: string\n /** Name used in the focused-node announcement. */\n nodeLabel?: string\n labels?: Partial<NodeRunLabels>\n}\n\nexport function NodeRunIndicator({ nodeId, kind, nodeLabel, labels }: NodeRunIndicatorProps) {\n const result = useNodeResult(nodeId)\n const l = useLabels(nodeRunLabels, labels)\n const { locale } = useFlowLocale()\n const announce = useAnnounce()\n const ref = useRef<HTMLSpanElement>(null)\n const previous = useRef<NodeResultStatus | undefined>(result?.status)\n\n useEffect(() => {\n const before = previous.current\n previous.current = result?.status\n if (!result || before === undefined || before === result.status) return\n // One region per editor: announce only for the node that has focus.\n const card = ref.current?.closest('.ty-node-card, [data-ty-node-id]')\n if (card && card.contains(document.activeElement)) {\n announce(fill(l.announce, { node: nodeLabel ?? nodeId, state: runWords(result, locale, l) ?? '' }, locale))\n }\n }, [result, announce, l, locale, nodeId, nodeLabel])\n\n if (!result) return null\n const Mark = MARKS[result.status]\n const done = result.status === 'success' || result.status === 'error'\n return (\n <span ref={ref} className=\"ty-node-run-indicator\" data-status={result.status} data-kind={kind} aria-hidden=\"true\" title={result.error}>\n <Mark className=\"ty-node-run-indicator__mark\" focusable=\"false\" />\n {done && result.durationMs !== undefined ? <span className=\"ty-node-run-indicator__duration\">{formatRunDuration(result.durationMs, locale, l)}</span> : null}\n </span>\n )\n}\n","// Generic decision step (backlog B-002): a model reads an input state and\n// chooses one value from a declared set of options. The run records the\n// chosen value, the probability of each option, and which provider and model\n// version decided, so an analysis can be audited and replayed.\n\n/** One allowed outcome of the decision. */\nexport interface DecisionOption {\n /** Stable value written to the output (for example \"above_limit\"). */\n value: string\n /** Human label (from the host's i18n). */\n label: string\n description?: string\n}\n\n/** Where the input state comes from: an upstream reference, plus an optional shape. */\nexport interface DecisionInputState {\n /** Reference to an upstream value (for example \"assertion.value\"). */\n ref: string\n /** Optional JSON-Schema-like description of the expected input. */\n schema?: Record<string, unknown>\n}\n\nexport interface DecisionConfig {\n kind: 'decision'\n input: DecisionInputState\n options: DecisionOption[]\n /** Instruction given to the model (may reference upstream values). */\n instruction?: string\n provider?: string\n model?: string\n /** Pinned model version; recorded with every result. */\n modelVersion?: string\n /** Name of the output variable (default \"decision\"). */\n outputVariable?: string\n /** Minimum probability for the result to count as decided; below it the step asks for review. */\n threshold?: number\n}\n\n/** What one run of the decision produced. */\nexport interface DecisionResult {\n value: string\n /** Probability per option value (0..1); they need not sum to exactly 1. */\n probabilities: Record<string, number>\n provider: string\n model: string\n modelVersion: string\n /** True when the top probability is under the configured threshold. */\n needsReview?: boolean\n}\n\nexport function defaultDecisionConfig(): DecisionConfig {\n return { kind: 'decision', input: { ref: '' }, options: [], outputVariable: 'decision' }\n}\n\n/** Options sorted by probability, highest first; unknown options last. */\nexport function rankedOptions(result: DecisionResult, options: readonly DecisionOption[]): Array<DecisionOption & { probability: number | null }> {\n return options\n .map((o) => ({ ...o, probability: result.probabilities[o.value] ?? null }))\n .sort((a, b) => (b.probability ?? -1) - (a.probability ?? -1))\n}\n","// DecisionNode (backlog B-002): a model reads an input state and chooses one\n// of the declared options. Before a run the card shows what is read, how many\n// options exist and who decides (provider · model · version); after a run it\n// shows the chosen value and each option's probability as text, with a bar\n// that only repeats the number.\n\nimport { useId } from 'react'\nimport { Target, TriangleAlert } from 'lucide-react'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection } from '../model/types'\nimport { useNodeResult } from '../state/editorState'\nimport { ConnectionPorts } from '../nodes/ConnectionPorts'\nimport { GraphNodeCard, type CardDensity } from '../nodes/GraphNodeCard'\nimport { useKindPresentation } from '../nodes/nodeChrome'\nimport { NodeRunIndicator, useRunWords } from '../nodes/NodeRunIndicator'\nimport { rankedOptions, type DecisionConfig, type DecisionResult } from './types'\n\nexport interface DecisionNodeLabels {\n kind: string\n title: string\n input: string\n options: string\n decidedBy: string\n version: string\n chosen: string\n probabilities: string\n probability: string\n needsReview: string\n notConfigured: string\n remove: string\n}\n\nexport const decisionNodeLabels = defineLabels<DecisionNodeLabels>('decisionNode', {\n en: {\n kind: 'decision',\n title: 'Decision',\n input: 'reads {ref}',\n options: '{count, plural, =0 {no options} one {# option} other {# options}}',\n decidedBy: 'decided by',\n version: 'version {version}',\n chosen: 'chosen: {value}',\n probabilities: 'Probability of each option',\n probability: '{label}: {percent}',\n needsReview: 'Needs review: no option is clear enough',\n notConfigured: 'Choose the input and at least two options.',\n remove: 'Remove {title}',\n },\n 'pt-BR': {\n kind: 'decisão',\n title: 'Decisão',\n input: 'lê {ref}',\n options: '{count, plural, =0 {nenhuma opção} one {# opção} other {# opções}}',\n decidedBy: 'decidido por',\n version: 'versão {version}',\n chosen: 'escolha: {value}',\n probabilities: 'Probabilidade de cada opção',\n probability: '{label}: {percent}',\n needsReview: 'Precisa de revisão: nenhuma opção é clara o bastante',\n notConfigured: 'Escolha a entrada e pelo menos duas opções.',\n remove: 'Remover {title}',\n },\n es: {\n kind: 'decisión',\n title: 'Decisión',\n input: 'lee {ref}',\n options: '{count, plural, =0 {ninguna opción} one {# opción} other {# opciones}}',\n decidedBy: 'decidido por',\n version: 'versión {version}',\n chosen: 'elegido: {value}',\n probabilities: 'Probabilidad de cada opción',\n probability: '{label}: {percent}',\n needsReview: 'Requiere revisión: ninguna opción es lo bastante clara',\n notConfigured: 'Elige la entrada y al menos dos opciones.',\n remove: 'Quitar {title}',\n },\n})\nexport const defaultDecisionNodeLabels = decisionNodeLabels.bundles.en\n\n/** A run result that has the decision shape. */\nexport function isDecisionResult(x: unknown): x is DecisionResult {\n return !!x && typeof x === 'object' && typeof (x as DecisionResult).value === 'string' && typeof (x as DecisionResult).probabilities === 'object'\n}\n\nexport interface DecisionNodeProps {\n id: string\n config: DecisionConfig | null\n /** Outcome to show; defaults to the node's run result when it has the decision shape. */\n result?: DecisionResult\n label?: string\n density?: CardDensity\n onConfigure?: (id: string) => void\n onRemove?: (id: string) => void\n selected?: boolean\n locked?: boolean\n preview?: boolean\n direction?: LayoutDirection\n labels?: Partial<DecisionNodeLabels>\n}\n\nexport function DecisionNode(props: DecisionNodeProps) {\n const { id, config, label, density = 'detailed', onConfigure, onRemove, selected = false, locked = false, preview = false, direction = 'right' } = props\n const l = useLabels(decisionNodeLabels, props.labels)\n const { locale } = useFlowLocale()\n const listId = useId()\n const node: FlowNode = { id, kind: 'decision', position: { x: 0, y: 0 }, data: {} }\n const k = useKindPresentation(node, direction)\n const run = useRunWords(id)\n const live = useNodeResult(id)\n const result = props.result ?? (isDecisionResult(live?.data) ? live.data : undefined)\n const title = label ?? l.title\n const configured = !!config && !!config.input.ref && config.options.length >= 2\n const canEdit = !preview && !locked\n const pct = (p: number) => new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 0 }).format(p)\n const optionLabel = (value: string) => config?.options.find((o) => o.value === value)?.label ?? value\n const who = result ? [result.provider, result.model].filter(Boolean).join(' · ') : [config?.provider, config?.model].filter(Boolean).join(' · ')\n const version = result?.modelVersion ?? config?.modelVersion\n const words = [\n result ? fill(l.chosen, { value: optionLabel(result.value) }, locale) : null,\n result?.needsReview ? l.needsReview : null,\n run.words,\n ].filter((w): w is string => !!w)\n\n const meta = configured ? (\n <div className=\"ty-decision-node__meta\">\n <span className=\"ty-decision-node__input\">{fill(l.input, { ref: config!.input.ref }, locale)}</span>\n <span>{fill(l.options, { count: config!.options.length }, locale)}</span>\n {who || version ? (\n <span className=\"ty-decision-node__model\">\n <span className=\"ty-visually-hidden\">{l.decidedBy} </span>\n {who ? <code>{who}</code> : null}\n {version ? <code>{fill(l.version, { version }, locale)}</code> : null}\n </span>\n ) : null}\n {result ? (\n <div className=\"ty-decision-node__result\">\n <p className=\"ty-decision-node__chosen\">{fill(l.chosen, { value: optionLabel(result.value) }, locale)}</p>\n {result.needsReview ? (\n <p className=\"ty-decision-node__review\">\n <TriangleAlert aria-hidden=\"true\" focusable=\"false\" />\n {l.needsReview}\n </p>\n ) : null}\n <ul className=\"ty-decision-node__probabilities\" aria-label={l.probabilities} id={listId}>\n {rankedOptions(result, config!.options).map((o) => (\n <li key={o.value} className=\"ty-decision-node__option\" data-chosen={o.value === result.value ? 'true' : undefined}>\n <span className=\"ty-decision-node__option-text\">{fill(l.probability, { label: o.label, percent: o.probability === null ? '?' : pct(o.probability) }, locale)}</span>\n <span className=\"ty-decision-node__bar\" aria-hidden=\"true\">\n <span className=\"ty-decision-node__bar-fill\" style={{ inlineSize: `${Math.round((o.probability ?? 0) * 100)}%` }} />\n </span>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n </div>\n ) : undefined\n\n return (\n <GraphNodeCard\n kind=\"decision\"\n kindLabel={l.kind}\n title={title}\n icon={<Target />}\n tone={k.tone}\n width=\"wide\"\n density={density}\n selected={selected}\n locked={locked}\n runState={run.runState}\n problem={configured ? false : l.notConfigured}\n stateWords={words}\n {...(onConfigure && (canEdit || preview) ? { onActivate: () => onConfigure(id) } : {})}\n {...(onRemove && canEdit ? { onDelete: () => onRemove(id) } : {})}\n labels={{ remove: l.remove }}\n meta={meta}\n className=\"ty-flow-node ty-decision-node\"\n >\n <ConnectionPorts nodeId={id} nodeLabel={title} inputs={k.inputs} outputs={k.outputs} tone={k.tone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind=\"decision\" nodeLabel={title} />\n </GraphNodeCard>\n )\n}\n","// AgentIdentity: who an automated agent is, the same way everywhere. Design\n// direction §2.11: an agent is a rounded square with a dashed boundary, never\n// a round face or initials, and the word \"agent\" is always visible. No\n// external avatar service: the optional generated mark is drawn here from a\n// hash of the name.\n\nimport { useState } from 'react'\nimport { Bot } from 'lucide-react'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\n\nexport type AgentTier = 'beginner' | 'intermediate' | 'advanced' | 'expert'\n\n/** Default rating thresholds (a, b, c): below a beginner … at or above c expert. Hosts pass their own. */\nexport const DEFAULT_TIER_THRESHOLDS: readonly [number, number, number] = [25, 50, 75]\n\n/** Maps a rating to one of four ordered tiers; a missing rating counts as the lowest. */\nexport function agentTier(rating?: number | null, thresholds: readonly [number, number, number] = DEFAULT_TIER_THRESHOLDS): AgentTier {\n if (rating === undefined || rating === null || Number.isNaN(rating)) return 'beginner'\n const [a, b, c] = thresholds\n if (rating < a) return 'beginner'\n if (rating < b) return 'intermediate'\n if (rating < c) return 'advanced'\n return 'expert'\n}\n\n/** FNV-1a over UTF-16 code units: small, stable, no dependency. */\nexport function nameHash(name: string): number {\n let h = 0x811c9dc5\n for (let i = 0; i < name.length; i++) {\n h ^= name.charCodeAt(i)\n h = Math.imul(h, 0x01000193) >>> 0\n }\n return h >>> 0\n}\n\n/**\n * Deterministic geometric mark: a 5 × 5 grid mirrored left to right, cells\n * switched on by bits of the name hash. Same name, same picture; no faces.\n */\nexport function GeneratedAgentMark({ name }: { name: string }) {\n const h = nameHash(name)\n const cells: Array<[number, number]> = []\n for (let row = 0; row < 5; row++) {\n for (let col = 0; col < 3; col++) {\n if ((h >>> (row * 3 + col)) & 1) {\n cells.push([col, row])\n if (col < 2) cells.push([4 - col, row])\n }\n }\n }\n const tone = (h % 8) + 1\n return (\n <svg className=\"ty-agent-mark__generated\" viewBox=\"0 0 5 5\" data-tone={`categorical-${tone}`} data-hash={h.toString(16)} aria-hidden=\"true\" focusable=\"false\">\n {cells.map(([x, y]) => (\n <rect key={`${x}-${y}`} x={x} y={y} width={1} height={1} />\n ))}\n </svg>\n )\n}\n\nexport interface AgentMarkProps {\n name: string\n image?: string | null\n size?: 'sm' | 'md'\n /** 'bot': the bot glyph without an image; 'generated': the name's geometric mark. */\n fallback?: 'bot' | 'generated'\n}\n\n/** The square, dashed mark of an agent. Decorative: the name is text elsewhere. */\nexport function AgentMark({ name, image, size = 'md', fallback = 'bot' }: AgentMarkProps) {\n const [failedSrc, setFailedSrc] = useState<string | null>(null)\n const showImage = !!image && failedSrc !== image\n return (\n <span className=\"ty-agent-mark\" data-size={size} data-content={showImage ? 'image' : fallback} aria-hidden=\"true\">\n {showImage ? (\n <img className=\"ty-agent-mark__image\" src={image!} alt=\"\" onError={() => setFailedSrc(image!)} />\n ) : fallback === 'generated' ? (\n <GeneratedAgentMark name={name} />\n ) : (\n <Bot className=\"ty-agent-mark__bot\" focusable=\"false\" />\n )}\n <span className=\"ty-agent-mark__badge\">\n <Bot focusable=\"false\" />\n </span>\n </span>\n )\n}\n\nexport interface AgentIdentityLabels {\n agent: string\n /** Name when the identity sits inside a link or button. */\n name: string\n modelLine: string\n}\n\nexport const agentIdentityLabels = defineLabels<AgentIdentityLabels>('agentIdentity', {\n en: { agent: 'agent', name: '{name}, agent', modelLine: '{provider} · {model}' },\n 'pt-BR': { agent: 'agente', name: '{name}, agente', modelLine: '{provider} · {model}' },\n es: { agent: 'agente', name: '{name}, agente', modelLine: '{provider} · {model}' },\n})\nexport const defaultAgentIdentityLabels = agentIdentityLabels.bundles.en\n\nexport interface AgentIdentityProps {\n agent: { name: string; image?: string; role?: string; provider?: string; model?: string }\n size?: 'sm' | 'md'\n fallbackRole?: string\n /** Show the word \"agent\"; hide only where a column header already says it. */\n showKindWord?: boolean\n /** Mark without an image: the bot glyph (default) or the generated mark. */\n markFallback?: 'bot' | 'generated'\n labels?: Partial<AgentIdentityLabels>\n className?: string\n}\n\n/** \"provider · model\" or whichever is present. */\nexport function modelLineOf(provider: string | undefined, model: string | undefined, template = defaultAgentIdentityLabels.modelLine): string | null {\n if (provider && model) return fill(template, { provider, model })\n return provider || model || null\n}\n\nexport function AgentIdentity({ agent, size = 'md', fallbackRole, showKindWord = true, markFallback = 'bot', labels, className }: AgentIdentityProps) {\n const l = useLabels(agentIdentityLabels, labels)\n const modelLine = modelLineOf(agent.provider, agent.model, l.modelLine)\n const role = agent.role || fallbackRole\n const secondary = role ?? modelLine\n return (\n <span className={['ty-agent-identity', className].filter(Boolean).join(' ')} data-size={size}>\n <AgentMark name={agent.name} image={agent.image ?? null} size={size} fallback={markFallback} />\n <span className=\"ty-agent-identity__text\">\n <span className=\"ty-agent-identity__line\">\n <span className=\"ty-agent-identity__name\" title={agent.name}>\n {agent.name}\n </span>\n {showKindWord ? <span className=\"ty-agent-identity__kind\">{l.agent}</span> : null}\n </span>\n {secondary ? (\n <span className=\"ty-agent-identity__secondary\" title={secondary}>\n {secondary}\n </span>\n ) : null}\n {role && modelLine ? <span className=\"ty-agent-identity__model\">{modelLine}</span> : null}\n </span>\n </span>\n )\n}\n","// AgentNode: a configured AI agent placed in a flow: name, role and model\n// family (full model id on focus or hover). The body is shared with agent\n// galleries outside the canvas (AgentCardBody).\n\nimport type { ReactNode } from 'react'\nimport { Focusable, Tooltip, TooltipTrigger } from 'react-aria-components'\nimport { Bot } from 'lucide-react'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection } from '../model/types'\nimport { AgentMark } from './AgentIdentity'\nimport { ConnectionPorts } from './ConnectionPorts'\nimport { GraphNodeCard, type CardDensity } from './GraphNodeCard'\nimport { useKindPresentation } from './nodeChrome'\nimport { NodeRunIndicator, useRunWords } from './NodeRunIndicator'\nimport type { AgentSummary } from './types'\n\nexport interface AgentNodeLabels {\n kind: string\n name: string\n nameWithRole: string\n remove: string\n notFound: string\n model: string\n agentWord: string\n}\n\nexport const agentNodeLabels = defineLabels<AgentNodeLabels>('agentNode', {\n en: {\n kind: 'agent',\n name: 'agent: {name}',\n nameWithRole: 'agent: {name}, {role}',\n remove: 'Remove {title} from canvas',\n notFound: 'Agent not found. It may have been deleted.',\n model: 'model {model}',\n agentWord: 'agent',\n },\n 'pt-BR': {\n kind: 'agente',\n name: 'agente: {name}',\n nameWithRole: 'agente: {name}, {role}',\n remove: 'Remover {title} do canvas',\n notFound: 'Agente não encontrado. Ele pode ter sido excluído.',\n model: 'modelo {model}',\n agentWord: 'agente',\n },\n es: {\n kind: 'agente',\n name: 'agente: {name}',\n nameWithRole: 'agente: {name}, {role}',\n remove: 'Quitar {title} del lienzo',\n notFound: 'Agente no encontrado. Puede haber sido eliminado.',\n model: 'modelo {model}',\n agentWord: 'agente',\n },\n})\nexport const defaultAgentNodeLabels = agentNodeLabels.bundles.en\n\n/** Family shown on the mark: the explicit provider, else the id's first segment. */\nexport function modelFamily(modelId: string, provider?: string): string {\n if (provider) return provider\n const head = modelId.split(/[/:]/)[0] ?? modelId\n return head.split(/[-_.]/)[0] || head\n}\n\n/** Model family as text; the full id on focus or hover (no brand logos). */\nexport function ModelMark({ modelId, provider, labels }: { modelId: string; provider?: string; labels?: Partial<AgentNodeLabels> }) {\n const l = useLabels(agentNodeLabels, labels)\n return (\n <TooltipTrigger delay={300}>\n <Focusable>\n <span className=\"ty-model-mark\" role=\"img\" aria-label={fill(l.model, { model: modelId })} tabIndex={0} data-ty-above=\"\" data-ty-no-drag=\"\">\n {modelFamily(modelId, provider)}\n </span>\n </Focusable>\n <Tooltip className=\"ty-model-mark__tooltip\" offset={6}>\n {modelId}\n </Tooltip>\n </TooltipTrigger>\n )\n}\n\n/** Agent card body shared with galleries: mark, name, role, the word \"agent\", model. */\nexport function AgentCardBody({ agent, density = 'detailed', actions, labels }: { agent: AgentSummary; density?: CardDensity; actions?: ReactNode; labels?: Partial<AgentNodeLabels> }) {\n const l = useLabels(agentNodeLabels, labels)\n return (\n <div className=\"ty-agent-body\" data-density={density}>\n <AgentMark name={agent.name} image={agent.avatar ?? null} fallback=\"generated\" />\n <div className=\"ty-agent-body__text\">\n <span className=\"ty-agent-body__line\">\n <span className=\"ty-agent-body__kind\">{l.agentWord}</span>\n {agent.modelId ? <ModelMark modelId={agent.modelId} {...(agent.provider ? { provider: agent.provider } : {})} labels={labels} /> : null}\n </span>\n {density === 'detailed' && agent.role ? <span className=\"ty-agent-body__role\">{agent.role}</span> : null}\n </div>\n {actions ? <div className=\"ty-agent-body__actions\">{actions}</div> : null}\n </div>\n )\n}\n\nexport interface AgentNodeProps {\n id: string\n agent: AgentSummary | null\n /** Title when the agent is missing. */\n label?: string\n density?: CardDensity\n onOpen?: () => void\n onRemove?: (id: string) => void\n /** Extra header actions (gallery use). */\n actions?: ReactNode\n selected?: boolean\n locked?: boolean\n preview?: boolean\n direction?: LayoutDirection\n labels?: Partial<AgentNodeLabels>\n}\n\nexport function AgentNode(props: AgentNodeProps) {\n const { id, agent, label, density = 'detailed', onOpen, onRemove, actions, selected = false, locked = false, preview = false, direction = 'right' } = props\n const l = useLabels(agentNodeLabels, props.labels)\n const node: FlowNode = { id, kind: 'agent', position: { x: 0, y: 0 }, data: {} }\n const k = useKindPresentation(node, direction)\n const run = useRunWords(id)\n const title = agent?.name ?? label ?? l.kind\n const name = agent ? (agent.role ? fill(l.nameWithRole, { name: agent.name, role: agent.role }) : fill(l.name, { name: agent.name })) : undefined\n const canEdit = !preview && !locked\n return (\n <GraphNodeCard\n kind=\"agent\"\n kindLabel={l.kind}\n title={title}\n icon={<Bot />}\n tone={k.tone}\n width=\"wide\"\n density={density}\n selected={selected}\n locked={locked}\n runState={run.runState}\n problem={agent ? false : l.notFound}\n {...(name ? { accessibleName: run.words ? `${name}, ${run.words}` : name } : {})}\n {...(run.words && !name ? { stateWords: [run.words] } : {})}\n {...(onOpen && (canEdit || preview) ? { onActivate: onOpen } : {})}\n {...(onRemove && canEdit ? { onDelete: () => onRemove(id) } : {})}\n labels={{ remove: l.remove }}\n headerActions={actions}\n meta={agent ? <AgentCardBody agent={agent} density={density} labels={props.labels} /> : undefined}\n className=\"ty-flow-node\"\n >\n <ConnectionPorts nodeId={id} nodeLabel={title} inputs={k.inputs} outputs={k.outputs} tone={k.tone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind=\"agent\" nodeLabel={title} />\n </GraphNodeCard>\n )\n}\n","// Source marks: optional product marks a host registers per dialect (from an\n// openly licensed set or assets it holds a licence for). The library ships\n// none; without a mark the neutral database glyph is shown. Marks are always\n// decorative: the dialect name is written as text next to them.\n// Stand-in for the wave-4 ThirdPartyMarkSlot until the design system has it.\n\nimport { useState, useSyncExternalStore } from 'react'\nimport { Database } from 'lucide-react'\n\nexport interface SourceMark {\n /** Image address (SVG or raster). */\n src: string\n /** Licence note for the host's notices (not shown). */\n licence?: string\n}\n\nlet marks = new Map<string, SourceMark>()\nconst listeners = new Set<() => void>()\nlet version = 0\n\n/** Registers marks by dialect key (lower case). Later calls replace earlier ones. */\nexport function registerSourceMarks(map: Record<string, SourceMark>): void {\n marks = new Map([...marks, ...Object.entries(map).map(([k, v]) => [k.toLowerCase(), v] as const)])\n version++\n for (const l of listeners) l()\n}\n\nexport function clearSourceMarks(): void {\n marks = new Map()\n version++\n for (const l of listeners) l()\n}\n\nexport function sourceMarkFor(dialect: string | undefined): SourceMark | undefined {\n return dialect ? marks.get(dialect.toLowerCase()) : undefined\n}\n\nconst subscribe = (l: () => void) => {\n listeners.add(l)\n return () => listeners.delete(l)\n}\n\n/** The mark for a dialect, or the neutral glyph; aria-hidden in both cases. */\nexport function SourceMarkSlot({ dialect }: { dialect?: string }) {\n useSyncExternalStore(subscribe, () => version, () => version)\n const mark = sourceMarkFor(dialect)\n const [failed, setFailed] = useState<string | null>(null)\n if (mark && failed !== mark.src) {\n return <img className=\"ty-source-mark\" src={mark.src} alt=\"\" aria-hidden=\"true\" data-mark=\"registered\" onError={() => setFailed(mark.src)} />\n }\n return <Database className=\"ty-source-mark\" aria-hidden=\"true\" focusable=\"false\" data-mark=\"fallback\" />\n}\n","// DataSourceNode (wave-4 spec): reads rows from a connected source and\n// summarises what it will read. The dialect is always written as text; a\n// host-registered mark is optional decoration.\n\nimport { useId } from 'react'\nimport { CircleCheck, CircleSlash } from 'lucide-react'\nimport { Tag } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection } from '../model/types'\nimport { ConnectionPorts } from './ConnectionPorts'\nimport { GraphNodeCard, NodeBadge, type CardDensity } from './GraphNodeCard'\nimport { useKindPresentation } from './nodeChrome'\nimport { NodeRunIndicator, useRunWords } from './NodeRunIndicator'\nimport { SourceMarkSlot } from './sourceMarks'\n\nexport interface DataSourceConfig {\n sourceId: string\n dialect?: string\n table: string\n selectedColumns?: string[]\n filters?: unknown[]\n limit?: number\n}\n\nexport interface DataSourceNodeLabels {\n kind: string\n title: string\n name: string\n detail: string\n connected: string\n notConnected: string\n sample: string\n columns: string\n filters: string\n limit: string\n notConfigured: string\n remove: string\n}\n\nexport const dataSourceNodeLabels = defineLabels<DataSourceNodeLabels>('dataSourceNode', {\n en: {\n kind: 'data source',\n title: 'Data source',\n name: 'data source: {title}, {dialect}, {table}',\n detail: '{source} · {table}',\n connected: 'connected',\n notConnected: 'not connected',\n sample: 'sample',\n columns: '{count, plural, one {# column} other {# columns}}',\n filters: '{count, plural, one {# filter} other {# filters}}',\n limit: '{count, plural, one {up to # row} other {up to # rows}}',\n notConfigured: 'Choose a connection and a table to read from.',\n remove: 'remove {title}',\n },\n 'pt-BR': {\n kind: 'fonte de dados',\n title: 'Fonte de dados',\n name: 'fonte de dados: {title}, {dialect}, {table}',\n detail: '{source} · {table}',\n connected: 'conectada',\n notConnected: 'não conectada',\n sample: 'amostra',\n columns: '{count, plural, one {# coluna} other {# colunas}}',\n filters: '{count, plural, one {# filtro} other {# filtros}}',\n limit: '{count, plural, one {até # linha} other {até # linhas}}',\n notConfigured: 'Escolha uma conexão e uma tabela para ler.',\n remove: 'remover {title}',\n },\n es: {\n kind: 'fuente de datos',\n title: 'Fuente de datos',\n name: 'fuente de datos: {title}, {dialect}, {table}',\n detail: '{source} · {table}',\n connected: 'conectada',\n notConnected: 'no conectada',\n sample: 'muestra',\n columns: '{count, plural, one {# columna} other {# columnas}}',\n filters: '{count, plural, one {# filtro} other {# filtros}}',\n limit: '{count, plural, one {hasta # fila} other {hasta # filas}}',\n notConfigured: 'Elige una conexión y una tabla para leer.',\n remove: 'quitar {title}',\n },\n})\nexport const defaultDataSourceNodeLabels = dataSourceNodeLabels.bundles.en\n\n/** Display name of a dialect: host list, else the key with its first letter capitalised. */\nexport function dialectDisplayName(key: string | undefined, dialects: readonly { key: string; displayName: string }[] = []): string {\n if (!key) return ''\n const known = dialects.find((d) => d.key.toLowerCase() === key.toLowerCase())\n return known?.displayName ?? key.charAt(0).toUpperCase() + key.slice(1)\n}\n\n/** Counts greater than zero, in the order columns, filters, limit. */\nexport function dataSourceCounts(config: DataSourceConfig, l: DataSourceNodeLabels, locale: string): string[] {\n const out: string[] = []\n const cols = config.selectedColumns?.length ?? 0\n const filters = config.filters?.length ?? 0\n if (cols > 0) out.push(fill(l.columns, { count: cols }, locale))\n if (filters > 0) out.push(fill(l.filters, { count: filters }, locale))\n if (config.limit && config.limit > 0) out.push(fill(l.limit, { count: config.limit }, locale))\n return out\n}\n\nexport interface DataSourceNodeProps {\n id: string\n config: DataSourceConfig | null\n source?: { name: string; connected?: boolean }\n dialects?: { key: string; displayName: string }[]\n label?: string\n readOnly?: boolean\n density?: CardDensity\n onConfigure?: (id: string) => void\n onRemove?: (id: string) => void\n selected?: boolean\n locked?: boolean\n preview?: boolean\n direction?: LayoutDirection\n labels?: Partial<DataSourceNodeLabels>\n}\n\nexport function DataSourceNode(props: DataSourceNodeProps) {\n const { id, config, source, dialects = [], readOnly = false, density = 'detailed', onConfigure, onRemove, selected = false, locked = false, preview = false, direction = 'right' } = props\n const l = useLabels(dataSourceNodeLabels, props.labels)\n const { locale } = useFlowLocale()\n const detailId = useId()\n const node: FlowNode = { id, kind: 'datasource', position: { x: 0, y: 0 }, data: {} }\n const k = useKindPresentation(node, direction)\n const run = useRunWords(id)\n const title = props.label ?? l.title\n const configured = !!config && !!config.sourceId && !!config.table\n const dialect = dialectDisplayName(config?.dialect, dialects)\n const counts = config ? dataSourceCounts(config, l, locale) : []\n const showConnection = !readOnly && source?.connected !== undefined\n const connectionWord = source?.connected ? l.connected : l.notConnected\n const canEdit = !preview && !locked\n const name = configured ? fill(l.name, { title, dialect: dialect || '', table: config!.table }, locale) : undefined\n const description = [showConnection ? connectionWord : null, readOnly ? l.sample : null, ...counts, run.words].filter(Boolean).join(', ')\n\n return (\n <GraphNodeCard\n kind=\"datasource\"\n kindLabel={l.kind}\n title={title}\n {...(configured && density === 'detailed' ? { description: fill(l.detail, { source: source?.name ?? config!.sourceId, table: config!.table }, locale) } : {})}\n icon={<SourceMarkSlot {...(config?.dialect ? { dialect: config.dialect } : {})} />}\n tone={k.tone}\n width=\"standard\"\n density={density}\n selected={selected}\n locked={locked}\n runState={run.runState}\n problem={configured ? false : l.notConfigured}\n {...(name ? { accessibleName: name } : {})}\n {...(description ? { stateWords: [description] } : {})}\n {...(onConfigure && (canEdit || preview) ? { onActivate: () => onConfigure(id) } : {})}\n {...(onRemove && canEdit ? { onDelete: () => onRemove(id) } : {})}\n labels={{ remove: l.remove }}\n badges={dialect && density === 'detailed' ? <NodeBadge>{dialect}</NodeBadge> : undefined}\n meta={\n configured ? (\n <span className=\"ty-datasource-node__meta\" id={detailId}>\n {showConnection ? (\n <span className=\"ty-datasource-node__connection\" data-connected={source?.connected ? 'true' : 'false'}>\n {source?.connected ? <CircleCheck aria-hidden=\"true\" focusable=\"false\" /> : <CircleSlash aria-hidden=\"true\" focusable=\"false\" />}\n {connectionWord}\n </span>\n ) : null}\n {readOnly ? <Tag size=\"small\">{l.sample}</Tag> : null}\n {counts.length ? <span className=\"ty-datasource-node__counts\">{counts.join(' · ')}</span> : null}\n </span>\n ) : undefined\n }\n className=\"ty-flow-node ty-datasource-node\"\n >\n <ConnectionPorts nodeId={id} nodeLabel={title} inputs={k.inputs} outputs={k.outputs} tone={k.tone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind=\"datasource\" nodeLabel={title} />\n </GraphNodeCard>\n )\n}\n","// GenericNode: any node kind drawn from NodeKindCatalog data alone, so a kind\n// added on the backend appears without new front-end code. Duplicate, delete\n// and rename act on the shared editor state (one undo step each).\n\nimport { Copy, Settings2, Trash2 } from 'lucide-react'\nimport type { BranchTone } from '../catalog/kindCatalog'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection, RunStatus } from '../model/types'\nimport { useEditorLocked, useOptionalFlowEditorStore } from '../state/editorState'\nimport { ConnectionPorts } from './ConnectionPorts'\nimport { GraphNodeCard, type CardDensity } from './GraphNodeCard'\nimport { NodeTools, PreviewStatusMark, useKindPresentation, usePreviewStatusWord, type NodeToolAction } from './nodeChrome'\nimport { NodeRunIndicator, useRunWords } from './NodeRunIndicator'\n\nexport interface GenericNodeLabels {\n tools: string\n configure: string\n duplicate: string\n remove: string\n}\n\nexport const genericNodeLabels = defineLabels<GenericNodeLabels>('genericNode', {\n en: { tools: 'Tools for {label}', configure: 'Configure {label}', duplicate: 'Duplicate {label}', remove: 'Delete {label}' },\n 'pt-BR': { tools: 'Ferramentas de {label}', configure: 'Configurar {label}', duplicate: 'Duplicar {label}', remove: 'Excluir {label}' },\n es: { tools: 'Herramientas de {label}', configure: 'Configurar {label}', duplicate: 'Duplicar {label}', remove: 'Eliminar {label}' },\n})\nexport const defaultGenericNodeLabels = genericNodeLabels.bundles.en\n\nexport interface GenericNodeProps {\n id: string\n kind: string\n /** Per-instance label; always wins over the catalog label. */\n label?: string\n density?: CardDensity\n /** Replaces the kind's static outputs for this instance (one per configured case). */\n dynamicOutputs?: { id: string; label: string; tone?: BranchTone }[]\n onConfigure?: (id: string) => void\n selected?: boolean\n direction?: LayoutDirection\n /** Extra node data (identity resolvers read it). */\n data?: Record<string, unknown>\n preview?: boolean\n runStatus?: RunStatus\n /** Used when no editor state is present. */\n onDuplicate?: (id: string) => void\n onRemove?: (id: string) => void\n onRename?: (id: string, label: string) => void\n locked?: boolean\n labels?: Partial<GenericNodeLabels>\n}\n\nexport function GenericNode(props: GenericNodeProps) {\n const { id, kind, label, density = 'detailed', dynamicOutputs, onConfigure, selected = false, direction = 'right', data, preview = false, runStatus } = props\n const l = useLabels(genericNodeLabels, props.labels)\n const store = useOptionalFlowEditorStore()\n const editorLocked = useEditorLocked()\n const locked = !!props.locked || editorLocked\n const node: FlowNode = { id, kind, position: { x: 0, y: 0 }, data: { ...(data ?? {}), ...(label !== undefined ? { label } : {}), ...(dynamicOutputs ? { dynamicOutputs } : {}) } }\n const k = useKindPresentation(node, direction)\n const run = useRunWords(id)\n const previewWord = usePreviewStatusWord(runStatus)\n\n const duplicate = () => {\n if (store) store.actions.duplicate([id])\n else props.onDuplicate?.(id)\n }\n const remove = () => {\n if (store) store.actions.removeNodes([id])\n else props.onRemove?.(id)\n }\n const rename = (next: string) => {\n if (locked) return\n if (store) {\n store.actions.snapshot()\n store.actions.setNodes((nodes) => nodes.map((n) => (n.id === id ? { ...n, data: { ...n.data, label: next } } : n)))\n } else props.onRename?.(id, next)\n }\n\n const editable = !preview && !locked\n const tools: NodeToolAction[] = editable\n ? [\n ...(onConfigure ? [{ id: 'configure', label: fill(l.configure, { label: k.title }), icon: Settings2, onPress: () => onConfigure(id) }] : []),\n ...(store || props.onDuplicate ? [{ id: 'duplicate', label: fill(l.duplicate, { label: k.title }), icon: Copy, onPress: duplicate }] : []),\n ...(store || props.onRemove ? [{ id: 'delete', label: fill(l.remove, { label: k.title }), icon: Trash2, onPress: remove, tone: 'danger' as const }] : []),\n ]\n : []\n\n const extra = [run.words, previewWord].filter((w): w is string => !!w)\n return (\n <GraphNodeCard\n kind={kind}\n kindLabel={k.category ?? k.kindLabel}\n title={k.title}\n description={k.description ?? (density === 'detailed' ? k.kindLabel : undefined)}\n icon={k.icon}\n tone={k.tone}\n width=\"standard\"\n density={density}\n selected={selected}\n locked={locked}\n runState={run.runState}\n dimmed={runStatus === 'unknown'}\n stateWords={extra}\n {...((editable || preview) && onConfigure ? { onActivate: () => onConfigure(id) } : {})}\n {...(editable && (store || props.onRename) ? { onRename: rename } : {})}\n meta={runStatus ? <PreviewStatusMark status={runStatus} /> : undefined}\n className=\"ty-flow-node\"\n >\n <NodeTools label={fill(l.tools, { label: k.title })} actions={tools} />\n <ConnectionPorts nodeId={id} nodeLabel={k.title} inputs={k.inputs} outputs={k.outputs} tone={k.tone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind={kind} nodeLabel={k.title} />\n </GraphNodeCard>\n )\n}\n","// Pure arithmetic of group frames: members' bounds, auto-fit, the smallest\n// allowed manual size, and collapse/expand (which hides members and their\n// connectors without moving anything).\n\nimport { enclosingRect, sizeOf } from '../geometry/rect'\nimport type { FlowConnector, FlowNode, Rect, Size } from '../model/types'\n\n/** Inner padding around members (§2.1 --ty-space-5). */\nexport const GROUP_PADDING = 24\n/** Height of the frame's header band. */\nexport const GROUP_HEADER = 48\nexport const GROUP_MIN_SIZE: Readonly<Size> = Object.freeze({ width: 240, height: 160 })\n/** Keyboard resize step (grid step of the canvas). */\nexport const GROUP_RESIZE_STEP = 24\n\nexport function membersOf(nodes: readonly FlowNode[], groupId: string): FlowNode[] {\n return nodes.filter((n) => n.parentId === groupId)\n}\n\n/** Members' box in the frame's own coordinates, or null without members. */\nexport function memberBounds(nodes: readonly FlowNode[], groupId: string): Rect | null {\n return enclosingRect(membersOf(nodes, groupId).map((m) => ({ ...m.position, ...sizeOf(m) })))\n}\n\n/** Smallest manual size: members' far edges plus padding, never under the minimum. */\nexport function minimumGroupSize(nodes: readonly FlowNode[], groupId: string): Size {\n const b = memberBounds(nodes, groupId)\n if (!b) return { ...GROUP_MIN_SIZE }\n return {\n width: Math.max(GROUP_MIN_SIZE.width, b.x + b.width + GROUP_PADDING),\n height: Math.max(GROUP_MIN_SIZE.height, b.y + b.height + GROUP_PADDING),\n }\n}\n\n/**\n * Moves and resizes the frame so every side keeps the same padding around its\n * members, shifting member positions so none moves on screen.\n */\nexport function fitGroupToMembers(nodes: readonly FlowNode[], groupId: string): FlowNode[] {\n const group = nodes.find((n) => n.id === groupId)\n const b = memberBounds(nodes, groupId)\n if (!group || !b) return nodes.slice()\n const shift = { x: b.x - GROUP_PADDING, y: b.y - GROUP_PADDING - GROUP_HEADER }\n const size = {\n width: Math.max(GROUP_MIN_SIZE.width, b.width + GROUP_PADDING * 2),\n height: Math.max(GROUP_MIN_SIZE.height, b.height + GROUP_PADDING * 2 + GROUP_HEADER),\n }\n return nodes.map((n) => {\n if (n.id === groupId) return { ...n, position: { x: n.position.x + shift.x, y: n.position.y + shift.y }, size }\n if (n.parentId === groupId) return { ...n, position: { x: n.position.x - shift.x, y: n.position.y - shift.y } }\n return n\n })\n}\n\n/** Collapses or expands a frame: members and every connector touching them are hidden or shown. */\nexport function setGroupExpanded(graph: { nodes: readonly FlowNode[]; connectors: readonly FlowConnector[] }, groupId: string, expanded: boolean): { nodes: FlowNode[]; connectors: FlowConnector[] } {\n const members = new Set(membersOf(graph.nodes, groupId).map((m) => m.id))\n return {\n nodes: graph.nodes.map((n) => {\n if (n.id === groupId) return { ...n, data: { ...n.data, expanded } }\n if (members.has(n.id)) return { ...n, hidden: !expanded }\n return n\n }),\n connectors: graph.connectors.map((c) => (members.has(c.source) || members.has(c.target) ? { ...c, hidden: !expanded } : c)),\n }\n}\n","// GroupNode: a frame around several nodes. Expanded, it is a labelled group\n// with a header and a child area (resizable when selected); collapsed, it is a\n// card. Either way it has one input and one output so it wires as a unit.\n\nimport { useId, useRef, type KeyboardEvent, type PointerEvent as ReactPointerEvent } from 'react'\nimport { ChevronDown, ChevronRight, Focus, Group, Trash2 } from 'lucide-react'\nimport { Button as AriaButton } from 'react-aria-components'\nimport { Button } from '../../index'\nimport { isToneName } from '../catalog/palette'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection, Size } from '../model/types'\nimport { useSurface } from '../surface/SurfaceContext'\nimport { ConnectionPorts } from './ConnectionPorts'\nimport { GraphNodeCard, NodeBadge, type CardDensity } from './GraphNodeCard'\nimport { GROUP_MIN_SIZE, GROUP_RESIZE_STEP } from './groupLayout'\nimport { useKindPresentation } from './nodeChrome'\nimport { NodeRunIndicator, useRunWords } from './NodeRunIndicator'\n\nexport interface GroupNodeLabels {\n defaultName: string\n defaultDescription: string\n group: string\n members: string\n collapse: string\n expand: string\n focus: string\n remove: string\n resize: string\n}\n\nexport const groupNodeLabels = defineLabels<GroupNodeLabels>('groupNode', {\n en: {\n defaultName: 'Group',\n defaultDescription: 'Several steps kept together',\n group: 'group',\n members: '{count, plural, =0 {no steps} one {# step} other {# steps}}',\n collapse: 'Collapse {name}',\n expand: 'Expand {name}',\n focus: 'Open {name} in focused view',\n remove: 'Delete group {name}',\n resize: 'Resize {name}',\n },\n 'pt-BR': {\n defaultName: 'Grupo',\n defaultDescription: 'Várias etapas mantidas juntas',\n group: 'grupo',\n members: '{count, plural, =0 {nenhuma etapa} one {# etapa} other {# etapas}}',\n collapse: 'Recolher {name}',\n expand: 'Expandir {name}',\n focus: 'Abrir {name} em vista focada',\n remove: 'Excluir o grupo {name}',\n resize: 'Redimensionar {name}',\n },\n es: {\n defaultName: 'Grupo',\n defaultDescription: 'Varios pasos agrupados',\n group: 'grupo',\n members: '{count, plural, =0 {ningún paso} one {# paso} other {# pasos}}',\n collapse: 'Contraer {name}',\n expand: 'Expandir {name}',\n focus: 'Abrir {name} en vista enfocada',\n remove: 'Eliminar el grupo {name}',\n resize: 'Cambiar el tamaño de {name}',\n },\n})\nexport const defaultGroupNodeLabels = groupNodeLabels.bundles.en\n\nexport interface GroupNodeProps {\n id: string\n name?: string\n description?: string\n tone?: string\n expanded?: boolean\n autoFit?: boolean\n size?: Size\n memberCount?: number\n /** Smallest manual size (the members' bounds plus padding). */\n minSize?: Size\n onToggleExpanded: (id: string) => void\n onConfigure?: (id: string) => void\n onEnterFocus?: (id: string) => void\n onRemove?: (id: string) => void\n /** Manual resize finished (the host turns auto-fit off and stores the size). */\n onResize?: (id: string, size: Size) => void\n selected?: boolean\n locked?: boolean\n preview?: boolean\n density?: CardDensity\n direction?: LayoutDirection\n labels?: Partial<GroupNodeLabels>\n}\n\nexport function GroupNode(props: GroupNodeProps) {\n const { id, tone, expanded = true, size = { width: 400, height: 280 }, memberCount = 0, minSize = GROUP_MIN_SIZE, onToggleExpanded, onConfigure, onEnterFocus, onRemove, onResize, selected = false, locked = false, preview = false, density = 'detailed', direction = 'right' } = props\n const l = useLabels(groupNodeLabels, props.labels)\n const { locale } = useFlowLocale()\n const surface = useSurface()\n const name = props.name?.trim() || l.defaultName\n const description = props.description?.trim() || undefined\n const safeTone = isToneName(tone) ? tone : 'neutral'\n const node: FlowNode = { id, kind: 'group', position: { x: 0, y: 0 }, data: {} }\n const k = useKindPresentation(node, direction)\n const run = useRunWords(id)\n const countId = useId()\n const drag = useRef<{ x: number; y: number; size: Size } | null>(null)\n const frameRef = useRef<HTMLDivElement>(null)\n const canEdit = !preview && !locked\n const members = fill(l.members, { count: memberCount }, locale)\n\n const toggle = (\n <AriaButton className=\"ty-group-node__toggle\" aria-label={fill(expanded ? l.collapse : l.expand, { name })} aria-expanded={expanded} onPress={() => onToggleExpanded(id)} data-ty-no-drag=\"\">\n {expanded ? <ChevronDown aria-hidden=\"true\" focusable=\"false\" /> : <ChevronRight className=\"ty-group-node__chevron\" aria-hidden=\"true\" focusable=\"false\" />}\n </AriaButton>\n )\n const controls = (\n <>\n {onEnterFocus && !preview ? <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.focus, { name })} leadingIcon={<Focus />} onPress={() => onEnterFocus(id)} /> : null}\n {onRemove && canEdit ? <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.remove, { name })} leadingIcon={<Trash2 />} onPress={() => onRemove(id)} /> : null}\n </>\n )\n\n if (!expanded) {\n return (\n <GraphNodeCard\n kind=\"group\"\n kindLabel={l.group}\n title={name}\n description={description ?? l.defaultDescription}\n icon={<Group />}\n tone={safeTone}\n density={density}\n selected={selected}\n locked={locked}\n runState={run.runState}\n stateWords={[members, ...(run.words ? [run.words] : [])]}\n {...(onConfigure && (canEdit || preview) ? { onActivate: () => onConfigure(id) } : {})}\n badges={<NodeBadge>{l.group}</NodeBadge>}\n headerActions={\n <span className=\"ty-group-node__controls\" data-ty-above=\"\">\n {toggle}\n {controls}\n </span>\n }\n className=\"ty-flow-node ty-group-node__card\"\n >\n <ConnectionPorts nodeId={id} nodeLabel={name} inputs={k.inputs} outputs={k.outputs} tone={safeTone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind=\"group\" nodeLabel={name} />\n </GraphNodeCard>\n )\n }\n\n const scale = surface.zoom || 1\n const onHandleDown = (e: ReactPointerEvent<HTMLSpanElement>) => {\n e.stopPropagation()\n e.preventDefault()\n drag.current = { x: e.clientX, y: e.clientY, size }\n const move = (ev: PointerEvent) => {\n if (!drag.current || !frameRef.current) return\n const w = Math.max(minSize.width, drag.current.size.width + (ev.clientX - drag.current.x) / scale)\n const h = Math.max(minSize.height, drag.current.size.height + (ev.clientY - drag.current.y) / scale)\n frameRef.current.style.inlineSize = `${w}px`\n frameRef.current.style.blockSize = `${h}px`\n }\n const up = (ev: PointerEvent) => {\n window.removeEventListener('pointermove', move)\n window.removeEventListener('pointerup', up)\n if (!drag.current) return\n const w = Math.max(minSize.width, drag.current.size.width + (ev.clientX - drag.current.x) / scale)\n const h = Math.max(minSize.height, drag.current.size.height + (ev.clientY - drag.current.y) / scale)\n drag.current = null\n onResize?.(id, { width: Math.round(w), height: Math.round(h) })\n }\n window.addEventListener('pointermove', move)\n window.addEventListener('pointerup', up)\n }\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.target !== frameRef.current || !e.shiftKey || !canEdit || !onResize) return\n const steps: Record<string, [number, number]> = { ArrowRight: [1, 0], ArrowLeft: [-1, 0], ArrowDown: [0, 1], ArrowUp: [0, -1] }\n const step = steps[e.key]\n if (!step) return\n e.preventDefault()\n e.stopPropagation()\n // Inline sides mirror in right-to-left canvases.\n const inline = getComputedStyle(frameRef.current).direction === 'rtl' ? -step[0] : step[0]\n onResize(id, {\n width: Math.max(minSize.width, size.width + inline * GROUP_RESIZE_STEP),\n height: Math.max(minSize.height, size.height + step[1] * GROUP_RESIZE_STEP),\n })\n }\n\n return (\n <div\n ref={frameRef}\n className=\"ty-group-node\"\n role=\"group\"\n aria-label={name}\n aria-describedby={countId}\n tabIndex={0}\n data-ty-node-focus=\"\"\n data-tone={safeTone}\n data-selected={selected ? 'true' : 'false'}\n data-locked={locked ? 'true' : 'false'}\n data-run-state={run.runState}\n style={{ inlineSize: size.width, blockSize: size.height }}\n onKeyDown={onKeyDown}\n >\n <span id={countId} className=\"ty-visually-hidden\">\n {[members, run.words].filter(Boolean).join(', ')}\n </span>\n <header className=\"ty-group-node__header\" onDoubleClick={onConfigure && canEdit ? () => onConfigure(id) : undefined}>\n <span className=\"ty-group-node__icon\" aria-hidden=\"true\">\n <Group focusable=\"false\" />\n </span>\n <span className=\"ty-group-node__titles\">\n <span className=\"ty-group-node__name\" title={name}>\n {name}\n </span>\n {description ? <span className=\"ty-group-node__description\">{description}</span> : null}\n </span>\n <span className=\"ty-group-node__controls\">\n {toggle}\n {controls}\n </span>\n </header>\n <div className=\"ty-group-node__members\" aria-hidden=\"true\" />\n <ConnectionPorts nodeId={id} nodeLabel={name} inputs={k.inputs} outputs={k.outputs} tone={safeTone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind=\"group\" nodeLabel={name} />\n {selected && canEdit && onResize ? <span className=\"ty-group-node__resize\" data-ty-no-drag=\"\" aria-hidden=\"true\" title={fill(l.resize, { name })} onPointerDown={onHandleDown} /> : null}\n </div>\n )\n}\n","// NoteNode: a free-text annotation on the canvas. It never takes part in\n// execution or connections (no ports). Edits are written back through\n// onTextChange, one call per editing session.\n\nimport { useId, useRef, useState, type KeyboardEvent } from 'react'\nimport { TextArea, TextField } from 'react-aria-components'\nimport { StickyNote } from 'lucide-react'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\n\n/** Note tones: five categorical tones of design direction §2.3 (decorative). */\nexport const NOTE_TONES = ['categorical-1', 'categorical-2', 'categorical-3', 'categorical-5', 'categorical-7'] as const\nexport type NoteTone = (typeof NOTE_TONES)[number]\n\nexport const NOTE_SIZE = { width: 240, height: 160 } as const\n\nexport interface NoteNodeLabels {\n note: string\n placeholder: string\n annotation: string\n editor: string\n}\n\nexport const noteNodeLabels = defineLabels<NoteNodeLabels>('noteNode', {\n en: { note: 'note', placeholder: 'Double-click to write a note', annotation: 'annotation, not a step', editor: 'Note text' },\n 'pt-BR': { note: 'nota', placeholder: 'Clique duas vezes para escrever uma nota', annotation: 'anotação, não é uma etapa', editor: 'Texto da nota' },\n es: { note: 'nota', placeholder: 'Haz doble clic para escribir una nota', annotation: 'anotación, no es un paso', editor: 'Texto de la nota' },\n})\nexport const defaultNoteNodeLabels = noteNodeLabels.bundles.en\n\nexport interface NoteNodeProps {\n id: string\n text?: string\n tone?: string\n width?: number\n height?: number\n onTextChange: (text: string) => void\n placeholder?: string\n selected?: boolean\n locked?: boolean\n labels?: Partial<NoteNodeLabels>\n}\n\n/** First words of the text for the group name (by words, never by characters). */\nfunction firstWords(text: string, count = 6): string {\n const words = text.trim().split(/\\s+/).filter(Boolean)\n return words.slice(0, count).join(' ') + (words.length > count ? '…' : '')\n}\n\nexport function NoteNode(props: NoteNodeProps) {\n const { text = '', tone, width = NOTE_SIZE.width, height = NOTE_SIZE.height, onTextChange, selected = false, locked = false } = props\n const l = useLabels(noteNodeLabels, props.labels)\n const placeholder = props.placeholder ?? l.placeholder\n const safeTone = (NOTE_TONES as readonly string[]).includes(tone ?? '') ? (tone as NoteTone) : NOTE_TONES[0]\n const [editing, setEditing] = useState(false)\n const [draft, setDraft] = useState(text)\n const rootRef = useRef<HTMLDivElement>(null)\n const descId = useId()\n\n const start = () => {\n if (locked) return\n setDraft(text)\n setEditing(true)\n }\n const finish = () => {\n setEditing(false)\n if (draft !== text) onTextChange(draft)\n requestAnimationFrame(() => rootRef.current?.focus())\n }\n const onRootKey = (e: KeyboardEvent<HTMLDivElement>) => {\n if (editing || e.target !== rootRef.current) return\n if (e.key === 'Enter' || e.key === 'F2') {\n e.preventDefault()\n e.stopPropagation()\n start()\n }\n }\n const name = text.trim() ? `${l.note}: ${firstWords(text)}` : l.note\n\n return (\n <div\n ref={rootRef}\n className=\"ty-note-node\"\n role=\"group\"\n aria-label={name}\n aria-describedby={descId}\n tabIndex={0}\n data-ty-node-focus=\"\"\n data-tone={safeTone}\n data-selected={selected ? 'true' : 'false'}\n data-locked={locked ? 'true' : 'false'}\n data-editing={editing ? 'true' : undefined}\n style={{ inlineSize: width, blockSize: height }}\n onDoubleClick={start}\n onKeyDown={onRootKey}\n onPointerUp={(e) => {\n // Touch: a tap on an already selected note starts editing.\n if (e.pointerType === 'touch' && selected && !editing) start()\n }}\n >\n <span id={descId} className=\"ty-visually-hidden\">\n {l.annotation}\n </span>\n <StickyNote className=\"ty-note-node__icon\" aria-hidden=\"true\" focusable=\"false\" />\n {editing ? (\n <TextField className=\"ty-note-node__field\" value={draft} onChange={setDraft} aria-label={l.editor} autoFocus>\n <TextArea\n className=\"ty-note-node__editor\"\n data-ty-no-drag=\"\"\n onBlur={finish}\n onKeyDown={(e) => {\n // Typing in a note never reaches canvas shortcuts.\n e.stopPropagation()\n if (e.key === 'Escape') {\n e.preventDefault()\n finish()\n }\n }}\n />\n </TextField>\n ) : text.trim() ? (\n <p className=\"ty-note-node__text\">{text}</p>\n ) : (\n <p className=\"ty-note-node__text\" data-empty=\"true\">\n {placeholder}\n </p>\n )}\n </div>\n )\n}\n\n/** Accessible name used by lists and outlines. */\nexport function noteName(text: string, labels = defaultNoteNodeLabels): string {\n return text.trim() ? fill('{note}: {words}', { note: labels.note, words: firstWords(text) }) : labels.note\n}\n","// RuleNode: a stored rule (adjustment, priority, categories, on/off) or an\n// inline rule-engine step. The enabled switch and remove are siblings of the\n// card's main control, so toggling never opens the editor.\n\nimport { Scale } from 'lucide-react'\nimport { Switch } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowNode, LayoutDirection } from '../model/types'\nimport { ConnectionPorts } from './ConnectionPorts'\nimport { GraphNodeCard, NodeBadge, type CardDensity } from './GraphNodeCard'\nimport { useKindPresentation } from './nodeChrome'\nimport { NodeRunIndicator, useRunWords } from './NodeRunIndicator'\nimport type { RuleAdjustment, RuleEngineConfig, StoredRule } from './types'\n\nexport interface RuleNodeLabels {\n kind: string\n engine: string\n formula: string\n priority: string\n variables: string\n output: string\n enabled: string\n off: string\n missing: string\n remove: string\n}\n\nexport const ruleNodeLabels = defineLabels<RuleNodeLabels>('ruleNode', {\n en: {\n kind: 'rule',\n engine: 'Rule engine',\n formula: 'formula',\n priority: 'priority {value, number}',\n variables: '{count, plural, one {# variable} other {# variables}}',\n output: 'output {name}',\n enabled: '{name} enabled',\n off: 'off',\n missing: 'No rule is attached to this step.',\n remove: 'Remove {title}',\n },\n 'pt-BR': {\n kind: 'regra',\n engine: 'Motor de regras',\n formula: 'fórmula',\n priority: 'prioridade {value, number}',\n variables: '{count, plural, one {# variável} other {# variáveis}}',\n output: 'saída {name}',\n enabled: '{name} ativa',\n off: 'desligada',\n missing: 'Nenhuma regra está ligada a esta etapa.',\n remove: 'Remover {title}',\n },\n es: {\n kind: 'regla',\n engine: 'Motor de reglas',\n formula: 'fórmula',\n priority: 'prioridad {value, number}',\n variables: '{count, plural, one {# variable} other {# variables}}',\n output: 'salida {name}',\n enabled: '{name} activada',\n off: 'desactivada',\n missing: 'Ninguna regla está vinculada a este paso.',\n remove: 'Quitar {title}',\n },\n})\nexport const defaultRuleNodeLabels = ruleNodeLabels.bundles.en\n\n/**\n * Signed adjustment text: \"+10%\", \"−5\" (true minus sign), \"0\", or the formula\n * word. Digits follow the locale.\n */\nexport function formatAdjustment(adj: RuleAdjustment | undefined, locale: string, formulaWord: string): string | null {\n if (!adj) return null\n if (adj.type === 'formula' || adj.value === undefined) return formulaWord\n const magnitude = new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(Math.abs(adj.value))\n const sign = adj.value > 0 ? '+' : adj.value < 0 ? '−' : ''\n return `${sign}${magnitude}${adj.type === 'percent' ? '%' : ''}`\n}\n\nexport interface RuleNodeProps {\n id: string\n rule?: StoredRule | null\n config?: RuleEngineConfig | null\n label?: string\n density?: CardDensity\n onOpen?: (ruleOrId: StoredRule | string) => void\n onToggleEnabled?: (rule: StoredRule) => void\n onRemove?: (id: string) => void\n selected?: boolean\n locked?: boolean\n preview?: boolean\n direction?: LayoutDirection\n labels?: Partial<RuleNodeLabels>\n}\n\nexport function RuleNode(props: RuleNodeProps) {\n const { id, rule, config, label, density = 'detailed', onOpen, onToggleEnabled, onRemove, selected = false, locked = false, preview = false, direction = 'right' } = props\n const l = useLabels(ruleNodeLabels, props.labels)\n const { locale } = useFlowLocale()\n const node: FlowNode = { id, kind: 'rule', position: { x: 0, y: 0 }, data: {} }\n const k = useKindPresentation(node, direction)\n const run = useRunWords(id)\n const canEdit = !preview && !locked\n const title = rule?.name ?? config?.label ?? label ?? (config ? l.engine : l.kind)\n\n let meta = null\n if (rule) {\n const adj = formatAdjustment(rule.adjustment, locale, l.formula)\n meta = (\n <>\n {adj ? <span className=\"ty-rule-node__adjustment\">{adj}</span> : null}\n {rule.priority !== undefined ? <span className=\"ty-rule-node__priority\">{fill(l.priority, { value: rule.priority }, locale)}</span> : null}\n {(rule.categories ?? []).map((c) => (\n <NodeBadge key={c}>{c}</NodeBadge>\n ))}\n </>\n )\n } else if (config) {\n meta = (\n <>\n <span>{fill(l.variables, { count: config.contextVariables?.length ?? 0 }, locale)}</span>\n {config.outputVariable ? <span className=\"ty-rule-node__output\">{fill(l.output, { name: config.outputVariable }, locale)}</span> : null}\n </>\n )\n }\n\n const toggle =\n rule && onToggleEnabled && !preview ? (\n <span className=\"ty-rule-node__switch\" data-ty-above=\"\" data-ty-no-drag=\"\">\n <Switch size=\"small\" isSelected={rule.enabled} accessibleLabel={fill(l.enabled, { name: rule.name })} disabled={locked} onChange={() => onToggleEnabled(rule)} />\n {!rule.enabled ? <span className=\"ty-rule-node__off\">{l.off}</span> : null}\n </span>\n ) : rule && !rule.enabled ? (\n <span className=\"ty-rule-node__off\">{l.off}</span>\n ) : null\n\n return (\n <GraphNodeCard\n kind=\"rule\"\n kindLabel={l.kind}\n title={title}\n icon={<Scale />}\n tone={k.tone}\n width=\"standard\"\n density={density}\n selected={selected}\n locked={locked}\n runState={run.runState}\n problem={!rule && !config ? l.missing : false}\n {...(run.words ? { stateWords: [run.words] } : {})}\n {...(onOpen && (canEdit || preview) && (rule || config) ? { onActivate: () => onOpen(rule ?? id) } : {})}\n {...(onRemove && canEdit ? { onDelete: () => onRemove(id) } : {})}\n labels={{ remove: l.remove }}\n headerActions={toggle}\n meta={meta}\n className=\"ty-flow-node ty-rule-node\"\n >\n <ConnectionPorts nodeId={id} nodeLabel={title} inputs={k.inputs} outputs={k.outputs} tone={k.tone} preview={preview} />\n <NodeRunIndicator nodeId={id} kind=\"rule\" nodeLabel={title} />\n </GraphNodeCard>\n )\n}\n","// Registry of built-in node kinds and the rules canvases need about nodes:\n// which component draws a kind, its size before measurement, where its ports\n// sit, whether two nodes may be connected, and its spoken name.\n//\n// Node data keys read by the built-in kinds:\n// every kind label?, description?\n// generic dynamicOutputs?: { id, label, tone? }[]\n// agent agentRef? (id in reference.agents)\n// rule ruleId? (id in reference.rules) | engine?: RuleEngineConfig\n// note text?, tone? (size: node.size)\n// group name?, description?, tone?, expanded?, autoFit? (size: node.size)\n// datasource sourceId, dialect?, table, selectedColumns?, filters?, limit?, readOnly?\n// decision DecisionConfig fields (input, options, provider, model, modelVersion …)\n\nimport { humaniseKey, type RenderCatalog } from '../catalog/RenderCatalog'\nimport { DecisionNode } from '../decision/DecisionNode'\nimport type { DecisionConfig } from '../decision/types'\nimport type { FlowNode, LayoutDirection, Size } from '../model/types'\nimport { useOptionalFlowEditorStore } from '../state/editorState'\nimport type { PortAnchor } from '../surface/types'\nimport { AgentNode } from './AgentNode'\nimport { DataSourceNode, type DataSourceConfig } from './DataSourceNode'\nimport { GenericNode } from './GenericNode'\nimport { CARD_WIDTHS, estimatedCardHeight, type CardDensity } from './GraphNodeCard'\nimport { fitGroupToMembers, membersOf, minimumGroupSize, setGroupExpanded } from './groupLayout'\nimport { GroupNode } from './GroupNode'\nimport { NOTE_SIZE, NoteNode } from './NoteNode'\nimport { portAnchorFor as anchorOf } from './ports'\nimport { RuleNode } from './RuleNode'\nimport type { FlowNodeComponent, FlowNodeProps, RuleEngineConfig } from './types'\n\nconst str = (v: unknown): string | undefined => (typeof v === 'string' ? v : undefined)\n\nfunction AgentAdapter({ node, reference, density, locked, preview, selected, direction, onConfigure, onRemove }: FlowNodeProps) {\n const ref = str(node.data.agentRef) ?? str(node.data.agentId)\n const agent = reference?.agents?.find((a) => a.id === ref) ?? null\n return (\n <AgentNode\n id={node.id}\n agent={agent}\n label={str(node.data.label) ?? 'Agent'}\n density={density}\n locked={locked}\n preview={!!preview}\n selected={!!selected}\n direction={direction}\n {...(onConfigure ? { onOpen: () => onConfigure(node.id) } : {})}\n {...(onRemove ? { onRemove } : {})}\n />\n )\n}\n\nfunction RuleAdapter({ node, reference, density, locked, preview, selected, direction, onConfigure, onRemove, onToggleRule }: FlowNodeProps) {\n const rule = reference?.rules?.find((r) => r.id === str(node.data.ruleId)) ?? null\n const engine = (node.data.engine as RuleEngineConfig | undefined) ?? null\n const label = str(node.data.label)\n return (\n <RuleNode\n id={node.id}\n rule={rule}\n config={engine}\n {...(label ? { label } : {})}\n density={density}\n locked={locked}\n preview={!!preview}\n selected={!!selected}\n direction={direction}\n {...(onConfigure ? { onOpen: () => onConfigure(node.id) } : {})}\n {...(onToggleRule ? { onToggleEnabled: onToggleRule } : {})}\n {...(onRemove ? { onRemove } : {})}\n />\n )\n}\n\nfunction NoteAdapter({ node, locked, preview, selected, onTextChange }: FlowNodeProps) {\n const store = useOptionalFlowEditorStore()\n const size = node.size ?? NOTE_SIZE\n return (\n <NoteNode\n id={node.id}\n text={str(node.data.text) ?? ''}\n {...(str(node.data.tone) ? { tone: str(node.data.tone)! } : {})}\n width={size.width}\n height={size.height}\n selected={!!selected}\n locked={locked || !!preview}\n onTextChange={(text) => {\n if (onTextChange) return onTextChange(node.id, text)\n if (!store) return\n // One undo step per editing session.\n store.actions.snapshot()\n store.actions.setNodes((nodes) => nodes.map((n) => (n.id === node.id ? { ...n, data: { ...n.data, text } } : n)))\n }}\n />\n )\n}\n\nfunction GroupAdapter({ node, locked, preview, selected, density, direction, onConfigure, onRemove, onToggleExpanded, onEnterFocus }: FlowNodeProps) {\n const store = useOptionalFlowEditorStore()\n const nodes = store?.getState().nodes ?? []\n const toggle = (id: string) => {\n if (onToggleExpanded) return onToggleExpanded(id)\n if (!store || locked) return\n const s = store.getState()\n store.actions.snapshot()\n const next = setGroupExpanded({ nodes: s.nodes, connectors: s.connectors }, id, node.data.expanded === false)\n store.actions.setNodes(next.nodes)\n store.actions.setConnectors(next.connectors)\n }\n const resize = (id: string, size: Size) => {\n if (!store || locked) return\n store.actions.snapshot()\n store.actions.setNodes((all) => all.map((n) => (n.id === id ? { ...n, size, data: { ...n.data, autoFit: false } } : n)))\n }\n return (\n <GroupNode\n id={node.id}\n {...(str(node.data.name) ?? str(node.data.label) ? { name: (str(node.data.name) ?? str(node.data.label))! } : {})}\n {...(str(node.data.description) ? { description: str(node.data.description)! } : {})}\n {...(str(node.data.tone) ? { tone: str(node.data.tone)! } : {})}\n expanded={node.data.expanded !== false}\n autoFit={node.data.autoFit !== false}\n size={node.size ?? { width: 400, height: 280 }}\n memberCount={membersOf(nodes, node.id).length}\n minSize={minimumGroupSize(nodes, node.id)}\n onToggleExpanded={toggle}\n onResize={resize}\n selected={!!selected}\n locked={locked}\n preview={!!preview}\n density={density}\n direction={direction}\n {...(onConfigure ? { onConfigure } : {})}\n {...(onRemove ? { onRemove } : {})}\n {...(onEnterFocus ? { onEnterFocus } : {})}\n />\n )\n}\n\nfunction DataSourceAdapter({ node, reference, density, locked, preview, selected, direction, onConfigure, onRemove }: FlowNodeProps) {\n const d = node.data\n const config: DataSourceConfig | null = str(d.sourceId) && str(d.table) ? (d as unknown as DataSourceConfig) : null\n const src = reference?.dataSources?.find((s) => s.id === str(d.sourceId))\n const label = str(d.label)\n return (\n <DataSourceNode\n id={node.id}\n config={config}\n {...(src ? { source: { name: src.name, ...(src.connected !== undefined ? { connected: src.connected } : {}) } } : {})}\n dialects={reference?.dialects ?? []}\n {...(label ? { label } : {})}\n readOnly={d.readOnly === true || !!src?.sample}\n density={density}\n locked={locked}\n preview={!!preview}\n selected={!!selected}\n direction={direction}\n {...(onConfigure ? { onConfigure } : {})}\n {...(onRemove ? { onRemove } : {})}\n />\n )\n}\n\nfunction DecisionAdapter({ node, reference, density, locked, preview, selected, direction, onConfigure, onRemove }: FlowNodeProps) {\n const d = node.data as Partial<DecisionConfig>\n const config: DecisionConfig | null = d.input && Array.isArray(d.options) ? ({ kind: 'decision', ...d } as DecisionConfig) : null\n const result = reference?.decisionResults?.[node.id]\n const label = str(node.data.label)\n return (\n <DecisionNode\n id={node.id}\n config={config}\n {...(result ? { result } : {})}\n {...(label ? { label } : {})}\n density={density}\n locked={locked}\n preview={!!preview}\n selected={!!selected}\n direction={direction}\n {...(onConfigure ? { onConfigure } : {})}\n {...(onRemove ? { onRemove } : {})}\n />\n )\n}\n\nfunction GenericAdapter({ node, density, locked, preview, selected, direction, runStatus, onConfigure, onRemove, onDuplicate, onRename }: FlowNodeProps) {\n return (\n <GenericNode\n id={node.id}\n kind={node.kind}\n {...(str(node.data.label) ? { label: str(node.data.label)! } : {})}\n data={node.data}\n density={density}\n locked={locked}\n preview={!!preview}\n selected={!!selected}\n direction={direction}\n {...(runStatus ? { runStatus } : {})}\n {...(onConfigure ? { onConfigure } : {})}\n {...(onRemove ? { onRemove } : {})}\n {...(onDuplicate ? { onDuplicate } : {})}\n {...(onRename ? { onRename } : {})}\n />\n )\n}\n\nexport const builtInNodeComponents: Record<string, FlowNodeComponent> = {\n agent: AgentAdapter,\n rule: RuleAdapter,\n note: NoteAdapter,\n group: GroupAdapter,\n datasource: DataSourceAdapter,\n decision: DecisionAdapter,\n}\n\n/** Component for a kind: host extras, then built-ins, then the catalog-driven generic node. */\nexport function nodeComponentFor(kind: string, extra?: Record<string, FlowNodeComponent>): FlowNodeComponent {\n return extra?.[kind] ?? builtInNodeComponents[kind] ?? GenericAdapter\n}\n\n/** Size to lay a node out with before it is measured. */\nexport function declaredNodeSize(node: FlowNode, density: CardDensity): Size {\n if (node.kind === 'note') return node.size ?? { ...NOTE_SIZE }\n if (node.kind === 'group') {\n if (node.data.expanded === false) return { width: CARD_WIDTHS.standard, height: estimatedCardHeight(density, false) }\n return node.size ?? { width: 400, height: 280 }\n }\n const wide = node.kind === 'agent' || node.kind === 'decision'\n return node.size ?? { width: wide ? CARD_WIDTHS.wide : CARD_WIDTHS.standard, height: estimatedCardHeight(density, density === 'detailed') }\n}\n\n/** Where a connector touches a node (logical side, 0..1 along it). */\nexport function portAnchorFor(node: FlowNode, portId: string | undefined, role: 'source' | 'target', direction: LayoutDirection, catalog: Pick<RenderCatalog, 'ports'>): PortAnchor {\n return anchorOf(node, portId, role, direction, catalog)\n}\n\nconst NEVER_SOURCE = new Set(['end', 'answer', 'rule', 'note'])\nconst NEVER_TARGET = new Set(['start', 'trigger', 'note'])\n\n/**\n * Connection rules: no self-connection; notes never connect; a start node is\n * never a target; end and answer nodes are never sources; a rule node is never\n * a source; an iteration-start node accepts input only from its iteration.\n */\nexport function canConnect(source: FlowNode, target: FlowNode, _sourcePort?: string, _targetPort?: string): boolean {\n if (source.id === target.id) return false\n if (NEVER_SOURCE.has(source.kind) || NEVER_TARGET.has(target.kind)) return false\n if (target.kind === 'iteration-start') {\n const owner = str(target.data.iterationId) ?? target.parentId\n return source.kind === 'iteration' && (!owner || owner === source.id)\n }\n return true\n}\n\n/** \"Kind: label\" for lists, announcements and search. */\nexport function nodeAccessibleName(node: FlowNode, catalog: Pick<RenderCatalog, 'entry'>): string {\n const kind = catalog.entry(node.kind)?.label ?? humaniseKey(node.kind)\n const title = str(node.data.label) ?? str(node.data.name) ?? (node.kind === 'note' ? str(node.data.text)?.split(/\\s+/).slice(0, 6).join(' ') : undefined)\n return title ? `${kind}: ${title}` : kind\n}\n\nexport { fitGroupToMembers }\n","// AlignmentGuides: while nodes move (pointer drag or arrow keys), show a\n// horizontal and/or vertical line where an edge or centre lines up with\n// another node. Detection is geometry/guides (findGuides); this file holds the\n// hook, the decorative overlay and the keyboard announcement.\n\nimport { useCallback, useRef, useState } from 'react'\nimport { findGuides, GUIDE_THRESHOLD, NO_GUIDES, type GuidePositions } from '../geometry/guides'\nimport { useAnnounce } from '../internal/Announcer'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { Rect } from '../model/types'\n\nexport interface AlignmentGuidesLabels {\n aligned: string\n}\n\nexport const alignmentGuidesLabels = defineLabels<AlignmentGuidesLabels>('alignmentGuides', {\n en: { aligned: 'aligned with {name}' },\n 'pt-BR': { aligned: 'alinhado com {name}' },\n es: { aligned: 'alineado con {name}' },\n})\nexport const defaultAlignmentGuidesLabels = alignmentGuidesLabels.bundles.en\n\nexport interface GuideCandidate {\n id: string\n rect: Rect\n}\n\nexport interface UseAlignmentGuidesOptions {\n threshold?: number\n /** Node name for the keyboard announcement. */\n nameOf?: (id: string) => string\n labels?: Partial<AlignmentGuidesLabels>\n}\n\nexport interface AlignmentGuidesApi {\n guides: GuidePositions\n /**\n * Returns the drag handler for the current graph: call it with the moving\n * reference box (the node under the pointer), its id and every dragged id.\n * Dragged nodes are never compared with each other.\n */\n createDragHandler: (all: readonly GuideCandidate[]) => (moving: Rect, referenceId: string, draggedIds: readonly string[]) => void\n onDragStop: () => void\n /** Same detection after an arrow-key move; announces \"aligned with …\" when a guide appears. */\n onKeyboardMove: (all: readonly GuideCandidate[], moving: Rect, movedId: string) => void\n}\n\nexport function useAlignmentGuides(options: UseAlignmentGuidesOptions = {}): AlignmentGuidesApi {\n const { threshold = GUIDE_THRESHOLD, nameOf } = options\n const l = useLabels(alignmentGuidesLabels, options.labels)\n const { locale } = useFlowLocale()\n const announce = useAnnounce()\n const [guides, setGuides] = useState<GuidePositions>(NO_GUIDES)\n const lastAnnounced = useRef<string | null>(null)\n\n const detect = useCallback(\n (all: readonly GuideCandidate[], moving: Rect, excluded: ReadonlySet<string>) => {\n const m = findGuides(\n moving,\n all.filter((c) => !excluded.has(c.id)),\n threshold,\n )\n setGuides((prev) => (prev.horizontal === m.horizontal && prev.vertical === m.vertical ? prev : { horizontal: m.horizontal, vertical: m.vertical }))\n return m\n },\n [threshold],\n )\n\n const createDragHandler = useCallback(\n (all: readonly GuideCandidate[]) => (moving: Rect, referenceId: string, draggedIds: readonly string[]) => {\n detect(all, moving, new Set([referenceId, ...draggedIds]))\n },\n [detect],\n )\n\n const onDragStop = useCallback(() => {\n setGuides(NO_GUIDES)\n lastAnnounced.current = null\n }, [])\n\n const onKeyboardMove = useCallback(\n (all: readonly GuideCandidate[], moving: Rect, movedId: string) => {\n const m = detect(all, moving, new Set([movedId]))\n const partner = m.verticalWith ?? m.horizontalWith\n if (partner && partner !== lastAnnounced.current) {\n announce(fill(l.aligned, { name: nameOf?.(partner) ?? partner }, locale))\n }\n lastAnnounced.current = partner\n },\n [detect, announce, l, nameOf, locale],\n )\n\n return { guides, createDragHandler, onDragStop, onKeyboardMove }\n}\n\n/** Reach of a guide line in canvas units (it spans the whole canvas). */\nconst REACH = 100_000\n\n/** Decorative overlay in canvas coordinates; renders nothing without guides. */\nexport function AlignmentGuidesOverlay({ guides }: { guides: GuidePositions }) {\n if (guides.horizontal === null && guides.vertical === null) return null\n return (\n <svg className=\"ty-alignment-guides\" aria-hidden=\"true\" focusable=\"false\">\n {guides.vertical !== null ? <line className=\"ty-alignment-guides__line\" data-axis=\"vertical\" x1={guides.vertical} x2={guides.vertical} y1={-REACH} y2={REACH} /> : null}\n {guides.horizontal !== null ? <line className=\"ty-alignment-guides__line\" data-axis=\"horizontal\" x1={-REACH} x2={REACH} y1={guides.horizontal} y2={guides.horizontal} /> : null}\n </svg>\n )\n}\n","// ConnectorInsertMenu: a small searchable list of step kinds, opened at the\n// middle of a connector. Wide screens: popover anchored to the control that\n// opened it; below 640 px: a bottom drawer.\n\nimport { useMemo, useState, type RefObject } from 'react'\nimport { Autocomplete, Dialog, Input, Label, ListBox, ListBoxItem, Popover, SearchField, Text, useFilter } from 'react-aria-components'\nimport { Drawer, useMediaQuery } from '../../index'\nimport { useRenderCatalog } from '../catalog/RenderCatalog'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\n\nexport interface InsertOption {\n kind: string\n label: string\n}\n\nexport interface ConnectorInsertMenuLabels {\n title: string\n search: string\n placeholder: string\n empty: string\n results: string\n}\n\nexport const connectorInsertMenuLabels = defineLabels<ConnectorInsertMenuLabels>('ConnectorInsertMenu', {\n en: { title: 'Insert a step', search: 'Step kind', placeholder: 'Search step kinds', empty: 'No step kind matches', results: '{count, plural, =0 {No results} one {# result} other {# results}}' },\n 'pt-BR': { title: 'Inserir uma etapa', search: 'Tipo de etapa', placeholder: 'Buscar tipos de etapa', empty: 'Nenhum tipo de etapa corresponde', results: '{count, plural, =0 {Nenhum resultado} one {# resultado} other {# resultados}}' },\n es: { title: 'Insertar un paso', search: 'Tipo de paso', placeholder: 'Buscar tipos de paso', empty: 'Ningún tipo de paso coincide', results: '{count, plural, =0 {Sin resultados} one {# resultado} other {# resultados}}' },\n})\nexport const defaultConnectorInsertMenuLabels = connectorInsertMenuLabels.bundles.en\n\nexport interface ConnectorInsertMenuProps {\n /** Canvas point the menu belongs to (the connector midpoint). */\n anchor: { x: number; y: number }\n /** Control the popover attaches to (and focus returns to). */\n triggerRef: RefObject<HTMLElement | null>\n options: readonly InsertOption[]\n onSelect: (kind: string) => void\n onClose: () => void\n labels?: Partial<ConnectorInsertMenuLabels>\n}\n\nfunction KindList({ options, onSelect, onClose, l }: { options: readonly InsertOption[]; onSelect: (k: string) => void; onClose: () => void; l: ConnectorInsertMenuLabels }) {\n const catalog = useRenderCatalog()\n const { locale } = useFlowLocale()\n const { contains } = useFilter({ sensitivity: 'base' })\n const [query, setQuery] = useState('')\n const all = useMemo(() => options.map((o) => ({ ...o, id: o.kind, text: catalog.entry(o.kind)?.label ?? o.label })), [options, catalog])\n const shown = useMemo(() => (query ? all.filter((o) => contains(o.text, query)) : all), [all, query, contains])\n return (\n <div className=\"ty-insert-menu__body\">\n <Autocomplete inputValue={query} onInputChange={setQuery}>\n <SearchField className=\"ty-insert-menu__field\" autoFocus aria-label={l.search}>\n <Label className=\"ty-insert-menu__label\">{l.search}</Label>\n <Input className=\"ty-insert-menu__input\" placeholder={l.placeholder} />\n </SearchField>\n <ListBox\n className=\"ty-insert-menu__list\"\n aria-label={l.title}\n items={shown}\n renderEmptyState={() => <p className=\"ty-insert-menu__empty\">{l.empty}</p>}\n onAction={(key) => {\n onSelect(String(key))\n onClose()\n }}\n >\n {(item) => {\n const Icon = catalog.icon(item.kind)\n return (\n <ListBoxItem id={item.id} textValue={item.text} className=\"ty-insert-menu__option\">\n <span className=\"ty-insert-menu__bubble\" data-tone={catalog.tone(item.kind)} aria-hidden=\"true\">\n <Icon focusable=\"false\" />\n </span>\n <Text slot=\"label\">{item.text}</Text>\n </ListBoxItem>\n )\n }}\n </ListBox>\n </Autocomplete>\n <p className=\"ty-visually-hidden\" role=\"status\">\n {fill(l.results, { count: shown.length }, locale)}\n </p>\n </div>\n )\n}\n\nexport function ConnectorInsertMenu({ triggerRef, options, onSelect, onClose, labels }: ConnectorInsertMenuProps) {\n const l = useLabels(connectorInsertMenuLabels, labels)\n const narrow = !useMediaQuery('(min-width: 640px)', true)\n if (narrow) {\n return (\n <Drawer open onOpenChange={(open) => !open && onClose()} title={l.title} placement=\"bottom\">\n <KindList options={options} onSelect={onSelect} onClose={onClose} l={l} />\n </Drawer>\n )\n }\n return (\n <Popover isOpen onOpenChange={(open) => !open && onClose()} triggerRef={triggerRef} placement=\"bottom\" offset={8} className=\"ty-insert-menu\">\n <Dialog aria-label={l.title} className=\"ty-insert-menu__dialog\">\n <KindList options={options} onSelect={onSelect} onClose={onClose} l={l} />\n </Dialog>\n </Popover>\n )\n}\n","// ConditionalConnector: the line between two nodes, with its branch word, a\n// wide invisible hit path, and a control pill (insert a step, delete). The\n// surface calls `renderConditionalConnector` once per connector; it returns the\n// SVG part (drawn under nodes) and the HTML part (drawn above, in canvas\n// coordinates). Line and pill share one hover state per connector so the pill\n// stays while the pointer travels between them.\n\nimport { useRef, useState, useSyncExternalStore, type KeyboardEvent } from 'react'\nimport { Button as AriaButton } from 'react-aria-components'\nimport { Check, Info, Minus, Plus, Repeat, Trash2, X } from 'lucide-react'\nimport type { BranchTone } from '../catalog/kindCatalog'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { createId } from '../internal/ids'\nimport type { FlowConnector, Point } from '../model/types'\nimport type { ConnectorParts, ConnectorShape } from '../surface/types'\nimport { ConnectorInsertMenu, type InsertOption } from './ConnectorInsertMenu'\n\nexport interface ConditionalConnectorLabels {\n name: string\n nameBranch: string\n insert: string\n remove: string\n true: string\n false: string\n loop: string\n controls: string\n}\n\nexport const conditionalConnectorLabels = defineLabels<ConditionalConnectorLabels>('ConditionalConnector', {\n en: {\n name: 'from {source} to {target}',\n nameBranch: 'from {source} to {target}, branch {branch}',\n insert: 'Insert step between {source} and {target}',\n remove: 'Delete connection from {source} to {target}',\n true: 'true',\n false: 'false',\n loop: 'loop',\n controls: 'Connection tools',\n },\n 'pt-BR': {\n name: 'de {source} para {target}',\n nameBranch: 'de {source} para {target}, ramo {branch}',\n insert: 'Inserir etapa entre {source} e {target}',\n remove: 'Excluir conexão de {source} para {target}',\n true: 'verdadeiro',\n false: 'falso',\n loop: 'repetição',\n controls: 'Ferramentas da conexão',\n },\n es: {\n name: 'de {source} a {target}',\n nameBranch: 'de {source} a {target}, rama {branch}',\n insert: 'Insertar paso entre {source} y {target}',\n remove: 'Eliminar conexión de {source} a {target}',\n true: 'verdadero',\n false: 'falso',\n loop: 'bucle',\n controls: 'Herramientas de la conexión',\n },\n})\nexport const defaultConditionalConnectorLabels = conditionalConnectorLabels.bundles.en\n\n/** Logic kinds offered by the built-in insert menu when the host gives none. */\nexport const DEFAULT_INSERTABLE_KINDS: readonly InsertOption[] = [\n { kind: 'code', label: 'Compute' },\n { kind: 'if-else', label: 'Branch' },\n { kind: 'decision', label: 'Decision' },\n { kind: 'iteration', label: 'Loop' },\n]\n\ntype WellKnownBranch = 'true' | 'false' | 'loop'\nconst BRANCH_TONE: Record<WellKnownBranch, BranchTone> = { true: 'success', false: 'error', loop: 'info' }\n\n/** Branch key of a connector: explicit label wins; well-known outputs name themselves. */\nexport function branchOf(c: Pick<FlowConnector, 'label' | 'sourcePort'>): { key: string; wellKnown: WellKnownBranch | null } | null {\n const port = c.sourcePort as WellKnownBranch | undefined\n const wellKnown = port && port in BRANCH_TONE ? port : null\n if (c.label) return { key: c.label, wellKnown: (c.label as WellKnownBranch) in BRANCH_TONE ? (c.label as WellKnownBranch) : wellKnown }\n return wellKnown ? { key: wellKnown, wellKnown } : null\n}\n\n/**\n * Splits connector `id` through `newNodeId`: the first half keeps the label\n * and condition, the second half is unconditional. Other connectors untouched.\n */\nexport function splitConnector(connectors: readonly FlowConnector[], id: string, newNodeId: string): FlowConnector[] {\n const out: FlowConnector[] = []\n for (const c of connectors) {\n if (c.id !== id) {\n out.push(c)\n continue\n }\n const { target, targetPort, selected: _s, ...first } = c\n out.push({ ...first, target: newNodeId })\n out.push({ id: createId('connector'), source: newNodeId, target, ...(targetPort ? { targetPort } : {}) })\n }\n return out\n}\n\n// ---- shared hover per connector ------------------------------------------\n\nlet hovered: string | null = null\nlet leaveTimer: ReturnType<typeof setTimeout> | null = null\nconst listeners = new Set<() => void>()\nconst emit = () => listeners.forEach((l) => l())\nfunction enter(id: string) {\n if (leaveTimer) clearTimeout(leaveTimer)\n leaveTimer = null\n if (hovered !== id) {\n hovered = id\n emit()\n }\n}\nfunction leave(id: string) {\n if (leaveTimer) clearTimeout(leaveTimer)\n // A short grace lets the pointer cross the gap between line and pill.\n leaveTimer = setTimeout(() => {\n if (hovered === id) {\n hovered = null\n emit()\n }\n }, 160)\n}\nfunction useHovered(id: string) {\n return useSyncExternalStore(\n (l) => {\n listeners.add(l)\n return () => listeners.delete(l)\n },\n () => hovered === id,\n () => false,\n )\n}\n\n// ---- rendering -------------------------------------------------------------\n\nexport interface ConditionalConnectorOptions {\n sourceName: string\n targetName: string\n selected?: boolean\n locked?: boolean\n /** The path currently executing (active token). */\n active?: boolean\n insertableKinds?: readonly InsertOption[]\n onInsertStep?: (connectorId: string, kind: string, point: Point) => void\n /** When set, replaces the built-in insert menu with the host's picker. */\n onOpenInsertPicker?: (connectorId: string, point: Point) => void\n onDelete?: (connectorId: string) => void\n onSelect?: (connectorId: string) => void\n labels?: Partial<ConditionalConnectorLabels>\n}\n\nfunction toneOf(c: FlowConnector): BranchTone {\n const b = branchOf(c)\n return b?.wellKnown ? BRANCH_TONE[b.wellKnown] : 'neutral'\n}\n\nexport function renderConditionalConnector(connector: FlowConnector, shape: ConnectorShape, options: ConditionalConnectorOptions): ConnectorParts {\n return {\n svg: <ConnectorPath connector={connector} shape={shape} options={options} />,\n html: <ConnectorControls connector={connector} shape={shape} options={options} />,\n }\n}\n\nfunction ConnectorPath({ connector, shape, options }: { connector: FlowConnector; shape: ConnectorShape; options: ConditionalConnectorOptions }) {\n const isHovered = useHovered(connector.id)\n const branch = branchOf(connector)\n return (\n <g\n className=\"ty-connector\"\n data-branch={branch?.wellKnown ?? (branch ? 'named' : 'none')}\n data-tone={toneOf(connector)}\n data-selected={options.selected ? 'true' : 'false'}\n data-hovered={isHovered ? 'true' : undefined}\n data-active={options.active ? 'true' : undefined}\n aria-hidden=\"true\"\n >\n <path className=\"ty-connector__path\" d={shape.d} markerEnd=\"url(#ty-surface-arrow)\" />\n <path\n className=\"ty-connector__hit\"\n d={shape.d}\n onPointerEnter={() => enter(connector.id)}\n onPointerLeave={() => leave(connector.id)}\n onClick={() => options.onSelect?.(connector.id)}\n />\n </g>\n )\n}\n\nconst WELL_KNOWN_ICON: Record<WellKnownBranch, typeof Check> = { true: Check, false: X, loop: Repeat }\n\nfunction ConnectorControls({ connector, shape, options }: { connector: FlowConnector; shape: ConnectorShape; options: ConditionalConnectorOptions }) {\n const l = useLabels(conditionalConnectorLabels, options.labels)\n const { locale } = useFlowLocale()\n const isHovered = useHovered(connector.id)\n const [menuOpen, setMenuOpen] = useState(false)\n const focusRef = useRef<HTMLButtonElement>(null)\n const insertRef = useRef<HTMLButtonElement>(null)\n const [focusWithin, setFocusWithin] = useState(false)\n const branch = branchOf(connector)\n const branchWord = branch ? (branch.wellKnown && !connector.label ? l[branch.wellKnown] : branch.key) : null\n const names = { source: options.sourceName, target: options.targetName }\n const name = branchWord ? fill(l.nameBranch, { ...names, branch: branchWord }, locale) : fill(l.name, names, locale)\n const canEdit = !options.locked\n const showControls = canEdit && (isHovered || !!options.selected || focusWithin || menuOpen)\n const Icon = branch?.wellKnown ? WELL_KNOWN_ICON[branch.wellKnown] : branch ? Info : Minus\n\n const openInsert = () => {\n if (!canEdit) return\n if (options.onOpenInsertPicker) options.onOpenInsertPicker(connector.id, shape.mid)\n else setMenuOpen(true)\n }\n const onKeyDown = (e: KeyboardEvent<HTMLElement>) => {\n if (!canEdit) return\n if (e.key === 'Delete' || e.key === 'Backspace') {\n e.preventDefault()\n e.stopPropagation()\n options.onDelete?.(connector.id)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n openInsert()\n }\n }\n\n return (\n <div\n className=\"ty-connector-controls\"\n data-labelled={branch ? 'true' : 'false'}\n data-tone={toneOf(connector)}\n data-visible={showControls ? 'true' : 'false'}\n style={{ transform: `translate(${shape.mid.x}px, ${shape.mid.y}px)` }}\n onPointerEnter={() => enter(connector.id)}\n onPointerLeave={() => leave(connector.id)}\n onFocus={() => setFocusWithin(true)}\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setFocusWithin(false)\n }}\n data-ty-surface-chrome=\"\"\n >\n <AriaButton ref={focusRef} className=\"ty-connector-controls__handle\" aria-label={name} onPress={() => options.onSelect?.(connector.id)} onKeyDown={onKeyDown}>\n {branchWord ? (\n <span className=\"ty-connector-controls__label\">\n <Icon aria-hidden=\"true\" focusable=\"false\" />\n {branchWord}\n </span>\n ) : (\n <span className=\"ty-connector-controls__dot\" aria-hidden=\"true\" />\n )}\n </AriaButton>\n {canEdit ? (\n <span className=\"ty-connector-controls__pill\" role=\"group\" aria-label={l.controls}>\n <AriaButton ref={insertRef} className=\"ty-connector-controls__tool\" aria-label={fill(l.insert, names, locale)} onPress={openInsert}>\n <Plus aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n <AriaButton className=\"ty-connector-controls__tool\" data-tone=\"danger\" aria-label={fill(l.remove, names, locale)} onPress={() => options.onDelete?.(connector.id)}>\n <Trash2 aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n </span>\n ) : null}\n {menuOpen ? (\n <ConnectorInsertMenu\n anchor={shape.mid}\n triggerRef={insertRef}\n options={options.insertableKinds ?? DEFAULT_INSERTABLE_KINDS}\n onSelect={(kind) => options.onInsertStep?.(connector.id, kind, shape.mid)}\n onClose={() => {\n setMenuOpen(false)\n requestAnimationFrame(() => insertRef.current?.focus())\n }}\n />\n ) : null}\n </div>\n )\n}\n\n/** Stand-alone component form, for hosts drawing their own SVG layer. */\nexport function ConditionalConnector(props: { connector: FlowConnector; shape: ConnectorShape } & ConditionalConnectorOptions) {\n const { connector, shape, ...options } = props\n const parts = renderConditionalConnector(connector, shape, options)\n return (\n <>\n <svg className=\"ty-connector-standalone\" aria-hidden=\"true\" focusable=\"false\">\n {parts.svg}\n </svg>\n {parts.html}\n </>\n )\n}\n","// Provenance model (W3C PROV-DM concepts, design direction §3.13).\n//\n// Items are PROV entities and activities of the research trail (query,\n// retrieval, source, assertion, record, analysis, edition, manuscript\n// sentence). Statements are PROV relations written the PROV way round:\n// `subject relation object`, e.g. \"assertion wasDerivedFrom source\",\n// \"analysis used edition\", \"retrieval wasGeneratedBy query\",\n// \"assertion wasAttributedTo coder\".\n//\n// Who acted is carried on each item (`actor`), because every card and row\n// shows it (§2.11). A `wasAttributedTo` statement may also point at an actor\n// id; those actors can be drawn as their own nodes on request, so attribution\n// stays a real PROV edge and is not only decoration.\n//\n// Drawing: time runs from origins (left) to results (right). A statement\n// becomes a directed pair `object → subject` for layout and hop counting, and\n// the arrowhead is drawn at the object end, as PROV diagrams do (the arrow\n// points back to what something came from). \"Backward\" therefore walks\n// towards origins, \"forward\" towards what was made from the item.\n\nimport { layerIndex, topologicalOrder, withinHops, type DirectedPair, type HopDirection } from '../model/graph'\nimport type { ProofObligation } from './proofTypes'\n\nexport const PROV_KINDS = ['query', 'retrieval', 'source', 'assertion', 'record', 'verification', 'analysis', 'edition', 'manuscript'] as const\nexport type ProvKind = (typeof PROV_KINDS)[number]\n\nexport const PROV_RELATIONS = ['wasDerivedFrom', 'used', 'wasGeneratedBy', 'wasAttributedTo'] as const\nexport type ProvRelation = (typeof PROV_RELATIONS)[number]\n\nexport type ProvProofState = 'proved' | 'pending' | 'refuted' | 'not_disclosed'\n/** Proof filter keys: the four states plus \"no proof\". */\nexport type ProofKey = ProvProofState | 'none'\nexport const PROOF_KEYS: readonly ProofKey[] = ['proved', 'pending', 'refuted', 'not_disclosed', 'none']\n\nexport type ProvActorKind = 'person' | 'agent' | 'system'\nexport const ACTOR_KINDS: readonly ProvActorKind[] = ['person', 'agent', 'system']\n\nexport interface ProvActor {\n /** Needed only when statements attribute items to this actor. */\n id?: string\n kind: ProvActorKind\n name: string\n email?: string\n /** Agent key (mono metadata). */\n agentKey?: string\n /** Model and version the agent ran on (mono metadata). */\n model?: string\n}\n\nexport interface ProvDetail {\n label: string\n value: string\n mono?: boolean\n}\n\nexport interface ProvItem {\n id: string\n kind: ProvKind\n title: string\n /** Identifiers shown in mono under the title: hash, key = value, edition date. */\n meta?: string[]\n actor?: ProvActor\n proofState?: ProvProofState | null\n /** When the act happened (ISO 8601). */\n at?: string\n /** Who verified the proof, and the verifier rule, for the evidence block. */\n verifiedBy?: string\n rule?: string\n summary?: string\n details?: ProvDetail[]\n /** Retrieval only: was the stored copy reread and does its hash still match? */\n hashCheck?: 'match' | 'not-reread' | 'mismatch'\n /** Why the proof state is what it is, in plain words. */\n proofReason?: string\n /** The passage of the source that supports the item, quoted. */\n evidence?: string\n /** What must hold for the item to count as proved. */\n obligations?: ProofObligation[]\n}\n\nexport interface ProvStatement {\n id?: string\n subject: string\n relation: ProvRelation\n object: string\n}\n\nexport interface ProvFilters {\n /** Kinds to keep; empty keeps all. */\n kinds: ProvKind[]\n actorKinds: ProvActorKind[]\n /** Case-insensitive part of the actor name; empty keeps all. */\n actorName: string\n proofStates: ProofKey[]\n /** Draw attributed actors as nodes with wasAttributedTo edges. */\n actorsAsNodes: boolean\n}\n\nexport const EMPTY_FILTERS: Readonly<ProvFilters> = Object.freeze({ kinds: [], actorKinds: [], actorName: '', proofStates: [], actorsAsNodes: false })\n\nexport function activeFilterCount(f: ProvFilters): number {\n return (f.kinds.length ? 1 : 0) + (f.actorKinds.length ? 1 : 0) + (f.actorName.trim() ? 1 : 0) + (f.proofStates.length ? 1 : 0) + (f.actorsAsNodes ? 1 : 0)\n}\n\nexport const proofKeyOf = (item: Pick<ProvItem, 'proofState'>): ProofKey => item.proofState ?? 'none'\n\n/** Does an item pass the filters (actor-node switch aside)? */\nexport function passesFilters(item: ProvItem, f: ProvFilters): boolean {\n if (f.kinds.length && !f.kinds.includes(item.kind)) return false\n if (f.proofStates.length && !f.proofStates.includes(proofKeyOf(item))) return false\n if (f.actorKinds.length && (!item.actor || !f.actorKinds.includes(item.actor.kind))) return false\n const needle = f.actorName.trim().toLocaleLowerCase()\n if (needle && !(item.actor?.name ?? '').toLocaleLowerCase().includes(needle)) return false\n return true\n}\n\n/** A drawable link: the pair runs from the older end (object) to the newer (subject). */\nexport interface ProvLink extends DirectedPair {\n id: string\n relation: ProvRelation\n}\n\nexport function linkOf(s: ProvStatement, index: number): ProvLink {\n return { id: s.id ?? `${s.subject}~${s.relation}~${s.object}~${index}`, source: s.object, target: s.subject, relation: s.relation }\n}\n\n/** A node on the canvas or in the tree: an item, or an actor drawn as a node. */\nexport type ProvVertex = { type: 'item'; id: string; item: ProvItem } | { type: 'actor'; id: string; actor: ProvActor & { id: string } }\n\nexport interface ProvView {\n vertices: ProvVertex[]\n links: ProvLink[]\n /** Hop distance from the focus (focus 0); absent when no focus. */\n distance: ReadonlyMap<string, number>\n /** Rank (layer) of each vertex, origins first. */\n layer: ReadonlyMap<string, number>\n /** The focus is hidden by the filters. */\n focusFiltered: boolean\n /** The focus has no links at all in the whole graph. */\n focusIsolated: boolean\n}\n\nexport interface ViewQuery {\n focusId: string | null\n /** Steps towards origins (\"where it came from\"). */\n back: number\n /** Steps towards uses (\"where it was used\"). */\n forward: number\n filters: ProvFilters\n}\n\n/**\n * The subgraph to show: filters first, then N hops from the focus in the\n * chosen direction (over the filtered graph), in reading order (rank, then\n * the order items were given).\n */\nexport function provenanceView(items: readonly ProvItem[], statements: readonly ProvStatement[], actors: readonly ProvActor[], q: ViewQuery): ProvView {\n const byId = new Map(items.map((i) => [i.id, i]))\n const allowed = new Set(items.filter((i) => passesFilters(i, q.filters)).map((i) => i.id))\n const itemLinks = statements.map(linkOf).filter((l) => l.relation !== 'wasAttributedTo' && byId.has(l.source) && byId.has(l.target))\n const focusIsolated = !!q.focusId && !itemLinks.some((l) => l.source === q.focusId || l.target === q.focusId)\n const focusFiltered = !!q.focusId && byId.has(q.focusId) && !allowed.has(q.focusId)\n const kept = itemLinks.filter((l) => allowed.has(l.source) && allowed.has(l.target))\n\n let visible: Set<string>\n let distance = new Map<string, number>()\n if (q.focusId && allowed.has(q.focusId)) {\n distance = new Map(withinHops(q.focusId, kept, q.back, 'backward'))\n for (const [id, d] of withinHops(q.focusId, kept, q.forward, 'forward')) if (!distance.has(id) || distance.get(id)! > d) distance.set(id, d)\n visible = new Set(distance.keys())\n } else if (q.focusId && byId.has(q.focusId)) {\n visible = new Set()\n } else {\n visible = allowed\n }\n\n const links = kept.filter((l) => visible.has(l.source) && visible.has(l.target))\n const vertices: ProvVertex[] = items.filter((i) => visible.has(i.id)).map((item) => ({ type: 'item', id: item.id, item }))\n\n if (q.filters.actorsAsNodes) {\n const actorById = new Map(actors.filter((a): a is ProvActor & { id: string } => !!a.id).map((a) => [a.id, a]))\n statements.forEach((s, i) => {\n if (s.relation !== 'wasAttributedTo' || !visible.has(s.subject)) return\n const actor = actorById.get(s.object)\n if (!actor) return\n if (!vertices.some((v) => v.id === actor.id)) vertices.push({ type: 'actor', id: actor.id, actor })\n links.push(linkOf(s, i))\n })\n }\n\n const ids = vertices.map((v) => v.id)\n const layer = layerIndex(ids, links)\n const order = topologicalOrder(ids, links)\n const rankOf = new Map(order.map((id, i) => [id, i]))\n vertices.sort((a, b) => (layer.get(a.id)! - layer.get(b.id)!) || rankOf.get(a.id)! - rankOf.get(b.id)!)\n return { vertices, links, distance, layer, focusFiltered, focusIsolated }\n}\n\n/** Direct neighbours of a vertex in a view: `back` = what it came from, `ahead` = what was made from it. */\nexport function relationsOf(id: string, links: readonly ProvLink[]): { back: ProvLink[]; ahead: ProvLink[] } {\n return { back: links.filter((l) => l.target === id), ahead: links.filter((l) => l.source === id) }\n}\n\n/** Every item in reading order (rank of the whole graph), for pickers. */\nexport function readingOrder(items: readonly ProvItem[], statements: readonly ProvStatement[]): ProvItem[] {\n const view = provenanceView(items, statements, [], { focusId: null, back: 0, forward: 0, filters: { ...EMPTY_FILTERS } })\n return view.vertices.flatMap((v) => (v.type === 'item' ? [v.item] : []))\n}\n\n/** Views larger than this, or deeper than DEEP_HOPS, show the \"reduce hops\" warning. */\nexport const DEEP_VIEW_SIZE = 40\nexport const DEEP_HOPS = 8\n\nexport function isDeep(view: ProvView, hops: number): boolean {\n return view.vertices.length > DEEP_VIEW_SIZE || (hops > DEEP_HOPS && view.distance.size > 0)\n}\n\n/**\n * The proof path of the focus: every item it was derived from, used or was\n * generated by, however far back, within the view. Returns the item ids and\n * the link ids on the path (the focus included).\n */\nexport function proofPath(view: ProvView, focusId: string | null): { nodes: Set<string>; links: Set<string>; ahead: Set<string> } {\n const nodes = new Set<string>()\n const links = new Set<string>()\n const ahead = new Set<string>()\n if (!focusId || !view.vertices.some((v) => v.id === focusId)) return { nodes, links, ahead }\n const itemLinks = view.links.filter((lk) => lk.relation !== 'wasAttributedTo')\n for (const id of withinHops(focusId, itemLinks, Number.POSITIVE_INFINITY, 'backward').keys()) nodes.add(id)\n for (const lk of itemLinks) if (nodes.has(lk.source) && nodes.has(lk.target)) links.add(lk.id)\n // What was made from the focus is read in full, not dimmed.\n for (const id of withinHops(focusId, itemLinks, Number.POSITIVE_INFINITY, 'forward').keys()) if (id !== focusId) ahead.add(id)\n return { nodes, links, ahead }\n}\n\n/** Swimlanes of the graph, in research order. */\nexport const LANES = ['search', 'read', 'source', 'assertion', 'base', 'analysis', 'edition', 'manuscript', 'actors'] as const\nexport type LaneKey = (typeof LANES)[number]\n\nconst LANE_OF_KIND: Record<ProvKind, LaneKey> = {\n query: 'search',\n retrieval: 'read',\n source: 'source',\n assertion: 'assertion',\n record: 'base',\n verification: 'base',\n analysis: 'analysis',\n edition: 'edition',\n manuscript: 'manuscript',\n}\n\nexport function laneOf(v: ProvVertex): LaneKey {\n return v.type === 'item' ? LANE_OF_KIND[v.item.kind] : 'actors'\n}\n\nexport interface BandGeometry {\n /** Width of the band label column at the reading start. */\n label: number\n /** Height of one band. */\n band: number\n /** Card size inside a band. */\n card: { width: number; height: number }\n /** Gap between columns inside a band. */\n column: number\n /** Top offset of a node inside its band (default: centred). */\n inset?: number\n}\n\nexport const DEFAULT_BANDS: Readonly<BandGeometry> = Object.freeze({ label: 130, band: 96, card: { width: 236, height: 72 }, column: 56, inset: 12 })\n\n/** Reads the band tokens (--ty-flow-band, --ty-flow-band-label, --ty-flow-node-h, --ty-flow-node-w, --ty-flow-col-gap) from an element, falling back to the defaults. */\nexport function bandGeometryFrom(el: Element | null): BandGeometry {\n if (!el || typeof getComputedStyle !== 'function') return DEFAULT_BANDS\n const cs = getComputedStyle(el)\n const px = (name: string, fallback: number) => {\n const v = parseFloat(cs.getPropertyValue(name))\n return Number.isFinite(v) && v > 0 ? v : fallback\n }\n const band = px('--ty-flow-band', DEFAULT_BANDS.band)\n const height = px('--ty-flow-node-h', DEFAULT_BANDS.card.height)\n return {\n band,\n label: px('--ty-flow-band-label', DEFAULT_BANDS.label),\n card: { width: px('--ty-flow-node-w', DEFAULT_BANDS.card.width), height },\n column: px('--ty-flow-col-gap', DEFAULT_BANDS.column),\n inset: Math.min(DEFAULT_BANDS.inset ?? 12, Math.max(0, (band - height) / 2)),\n }\n}\n\nexport interface BandPlacement {\n /** Bands that hold at least one vertex, in research order, top to bottom. */\n bands: Array<{ key: LaneKey; row: number; count: number }>\n /** Top-left of each vertex in canvas units. */\n positions: Map<string, { x: number; y: number }>\n /** Size of the whole picture, label column included. */\n width: number\n height: number\n /** Where the label column sits (x of its start). */\n labelX: number\n}\n\n/**\n * Horizontal bands stacked top to bottom in research order; only bands with\n * items take a row. Inside a band, items on the proof path come first\n * (column 0, then 1…), the others follow in reading order, so the path reads\n * straight down the first column. In right-to-left reading the label column\n * and column 0 sit on the right.\n */\nexport function bandLayout(view: ProvView, onPath: ReadonlySet<string>, g: BandGeometry = DEFAULT_BANDS, mirror = false): BandPlacement {\n const byBand = new Map<LaneKey, ProvVertex[]>()\n for (const v of view.vertices) {\n const k = laneOf(v)\n if (!byBand.has(k)) byBand.set(k, [])\n byBand.get(k)!.push(v)\n }\n const used = LANES.filter((k) => byBand.has(k))\n const columnsOf = (k: LaneKey) => {\n const list = byBand.get(k)!\n return [...list.filter((v) => onPath.has(v.id)), ...list.filter((v) => !onPath.has(v.id))]\n }\n const maxColumns = Math.max(1, ...used.map((k) => byBand.get(k)!.length))\n const contentWidth = maxColumns * g.card.width + (maxColumns - 1) * g.column\n const width = g.label + g.column + contentWidth\n const positions = new Map<string, { x: number; y: number }>()\n const inset = g.inset ?? (g.band - g.card.height) / 2\n used.forEach((key, row) => {\n columnsOf(key).forEach((v, col) => {\n // The label column already leaves the gap before column 0.\n const fromStart = g.label + col * (g.card.width + g.column)\n positions.set(v.id, { x: mirror ? width - fromStart - g.card.width : fromStart, y: row * g.band + inset })\n })\n })\n return {\n bands: used.map((key, row) => ({ key, row, count: byBand.get(key)!.length })),\n positions,\n width,\n height: used.length * g.band,\n labelX: mirror ? width - g.label : 0,\n }\n}\n\n/** Text the question bar matches: title, kind, ids, detail values, evidence. */\nexport function searchableText(item: ProvItem): string {\n return [item.title, item.id, ...(item.meta ?? []), ...(item.details ?? []).map((d) => d.value), item.evidence ?? ''].join(' ')\n}\n\n/** Tree rows for the list alternative: the focus as root (or the origins without focus), children follow links. */\nexport interface ProvTreeRow {\n /** Unique path key (a DAG item may appear under several parents). */\n key: string\n id: string\n /** Relation to the parent row, read from the parent: \"back\" (came from) or \"ahead\" (made from it). */\n via?: { relation: ProvRelation; way: 'back' | 'ahead' }\n children: ProvTreeRow[]\n}\n\nexport function provenanceTree(view: ProvView, focusId: string | null, direction: HopDirection): ProvTreeRow[] {\n const ids = new Set(view.vertices.map((v) => v.id))\n const build = (id: string, path: string, seen: Set<string>, via?: ProvTreeRow['via']): ProvTreeRow => {\n const next = new Set(seen).add(id)\n const children: ProvTreeRow[] = []\n const { back, ahead } = relationsOf(id, view.links)\n const wantBack = focusId !== null && direction !== 'forward'\n const wantAhead = focusId === null || direction !== 'backward'\n if (wantBack && (via?.way ?? 'back') === 'back') {\n for (const l of back) if (!next.has(l.source)) children.push(build(l.source, `${path}/${l.source}`, next, { relation: l.relation, way: 'back' }))\n }\n if (wantAhead && (via?.way ?? 'ahead') === 'ahead') {\n for (const l of ahead) if (!next.has(l.target)) children.push(build(l.target, `${path}/${l.target}`, next, { relation: l.relation, way: 'ahead' }))\n }\n return { key: path, id, ...(via ? { via } : {}), children }\n }\n if (focusId && ids.has(focusId)) return [build(focusId, focusId, new Set())]\n const roots = view.vertices.filter((v) => !view.links.some((l) => l.target === v.id))\n return roots.map((r) => build(r.id, r.id, new Set()))\n}\n\n/** Every row key of the tree (to expand all). */\nexport function treeKeys(rows: readonly ProvTreeRow[]): string[] {\n return rows.flatMap((r) => [r.key, ...treeKeys(r.children)])\n}\n","// Strings of the provenance viewer. English is complete; pt-BR is the\n// product's language. Hosts override through `labels` or FlowMessagesProvider.\n\nimport { defineLabels } from '../internal/labels'\nimport type { LaneKey, ProofKey, ProvActorKind, ProvKind, ProvRelation } from './model'\n\nexport interface ProvenanceLabels {\n graphName: string\n graphRole: string\n treeName: string\n queryBar: string\n focus: string\n focusAll: string\n direction: string\n backward: string\n forward: string\n both: string\n hops: string\n view: string\n viewGraph: string\n viewTree: string\n filters: string\n filtersActive: string\n filterKinds: string\n filterActors: string\n filterActorName: string\n filterProof: string\n actorsAsNodes: string\n clearFilters: string\n legend: string\n inspector: string\n closeInspector: string\n cameFrom: string\n madeFrom: string\n noRelations: string\n details: string\n when: string\n attributedTo: string\n /** Accessible name of a node: kind, title, proof word, actor. */\n nodeName: string\n actorNodeName: string\n /** Tree row relation prefix, e.g. \"was derived from\". */\n treeVia: string\n emptyTitle: string\n emptyText: string\n isolated: string\n focusFiltered: string\n noMatches: string\n deep: string\n loading: string\n errorTitle: string\n retry: string\n count: string\n question: string\n questionHint: string\n questionEmpty: string\n hopsBack: string\n hopsForward: string\n viewTimeline: string\n viewCertificate: string\n viewCompare: string\n onlyPath: string\n proofPath: string\n offPath: string\n focusWord: string\n lanes: Record<LaneKey, string>\n relationLegend: string\n hash: Record<'match' | 'not-reread' | 'mismatch', string>\n reason: string\n evidence: string\n obligations: string\n obligationStatus: Record<'ok' | 'pending' | 'failed', string>\n reread: string\n requestVerification: string\n treeBackward: string\n treeForward: string\n treeWay: string\n openInGraph: string\n noCertificate: string\n noComparison: string\n kinds: Record<ProvKind, string>\n relations: Record<ProvRelation, string>\n /** Relation read from the older end (\"used by\", \"source of\"). */\n relationsReversed: Record<ProvRelation, string>\n proof: Record<ProofKey, string>\n actorKinds: Record<ProvActorKind, string>\n /** Inspector eyebrow: \"{kind} in focus\". */\n inFocus: string\n /** Proof note when there is no certificate yet. */\n noCertificateYet: string\n filterKindChip: string\n filterActorChip: string\n filterProofChip: string\n filterAllKinds: string\n filterAllActors: string\n filterAllProof: string\n filterChosen: string\n hopsWord: string\n treeCount: string\n treeKeys: string\n toolTree: string\n toolExport: string\n questionField: string\n}\n\nexport const defaultProvenanceLabels: ProvenanceLabels = {\n graphName: 'Provenance graph',\n graphRole: 'graph',\n treeName: 'Provenance list',\n queryBar: 'Provenance query',\n focus: 'Item in focus',\n focusAll: 'Whole graph',\n direction: 'Direction',\n backward: 'Back to sources',\n forward: 'Forward to uses',\n both: 'Both',\n hops: 'Steps',\n view: 'View',\n viewGraph: 'Graph',\n viewTree: 'Tree',\n filters: 'Filters',\n filtersActive: 'Filters ({count, plural, one {# active} other {# active}})',\n filterKinds: 'Item types',\n filterActors: 'Who acted',\n filterActorName: 'Actor name',\n filterProof: 'Proof state',\n actorsAsNodes: 'Show actors as nodes',\n clearFilters: 'Clear filters',\n legend: 'Proof states',\n inspector: 'Evidence',\n closeInspector: 'Close evidence',\n cameFrom: 'Came from',\n madeFrom: 'Used by',\n noRelations: 'None',\n details: 'Details',\n when: 'When',\n attributedTo: 'Attributed to',\n nodeName: '{kind}: {title}, {proof}, {actor}',\n actorNodeName: '{kind}: {name}',\n treeVia: '{relation}',\n emptyTitle: 'No provenance yet',\n emptyText: 'Nothing has been recorded for this project. Items appear here as searches, sources and assertions are registered.',\n isolated: 'This item has no recorded links.',\n focusFiltered: 'The item in focus is hidden by the filters.',\n noMatches: 'No item matches these filters.',\n deep: 'This view is large ({count} items). Reduce the number of steps to read it more easily.',\n loading: 'Loading the provenance graph',\n errorTitle: 'The provenance could not be loaded',\n retry: 'Try again',\n count: '{count, plural, one {# item} other {# items}}',\n question: 'Where did this come from',\n questionHint: 'Any value, record, number or manuscript sentence',\n questionEmpty: 'Nothing matches',\n hopsBack: 'Steps back',\n hopsForward: 'Steps forward',\n viewTimeline: 'Timeline',\n viewCertificate: 'Certificate',\n viewCompare: 'Compare editions',\n onlyPath: 'Only the proof path',\n proofPath: 'on the proof path',\n offPath: 'off the proof path',\n focusWord: 'in focus',\n lanes: { search: 'Search', read: 'Reading', source: 'Source', assertion: 'Assertion', base: 'Base and verification', analysis: 'Analysis', edition: 'Edition', manuscript: 'Manuscript', actors: 'Actors' },\n relationLegend: 'Relations',\n hash: { match: 'hash matches', 'not-reread': 'not reread', mismatch: 'hash does not match' },\n reason: 'Why',\n evidence: 'Quoted evidence',\n obligations: 'Proof obligations',\n obligationStatus: { ok: 'met', pending: 'pending', failed: 'failed' },\n reread: 'Reread the source now',\n requestVerification: 'Ask for verification',\n treeBackward: 'Where it came from',\n treeForward: 'Where it was used',\n treeWay: 'Direction of the list',\n openInGraph: 'Enter shows it in the graph',\n noCertificate: 'This item has no certificate yet.',\n noComparison: 'No editions to compare.',\n kinds: {\n query: 'query',\n retrieval: 'retrieval',\n source: 'source',\n assertion: 'assertion',\n record: 'record',\n analysis: 'analysis',\n edition: 'edition',\n manuscript: 'manuscript sentence',\n verification: 'verification',\n },\n relations: { wasDerivedFrom: 'was derived from', used: 'used', wasGeneratedBy: 'was generated by', wasAttributedTo: 'was attributed to' },\n relationsReversed: { wasDerivedFrom: 'source of', used: 'used by', wasGeneratedBy: 'generated', wasAttributedTo: 'responsible for' },\n proof: { proved: 'proved', pending: 'pending', refuted: 'refuted', not_disclosed: 'not disclosed', none: 'no proof' },\n actorKinds: { person: 'person', agent: 'agent', system: 'system' },\n inFocus: '{kind} in focus',\n noCertificateYet: 'the verifier (G7a) has not issued a certificate yet',\n filterKindChip: 'Type: {value}',\n filterActorChip: 'Actor: {value}',\n filterProofChip: 'Proof: {value}',\n filterAllKinds: 'all',\n filterAllActors: 'all',\n filterAllProof: 'all',\n filterChosen: '{count, plural, one {# chosen} other {# chosen}}',\n hopsWord: 'steps',\n treeCount: '{nodes, plural, one {# node} other {# nodes}} · {actors, plural, one {# actor} other {# actors}} · {hashes, plural, one {# hash checked} other {# hashes checked}}',\n treeKeys: 'Arrows move · → opens · ← closes · Enter shows it in the graph',\n toolTree: 'Navigable tree',\n toolExport: 'Export PROV',\n questionField: 'value, record, number or sentence',\n}\n\nexport const provenanceLabelsPtBR: ProvenanceLabels = {\n graphName: 'Grafo de proveniência',\n graphRole: 'grafo',\n treeName: 'Lista de proveniência',\n queryBar: 'Consulta de proveniência',\n focus: 'Item em foco',\n focusAll: 'Grafo inteiro',\n direction: 'Direção',\n backward: 'Até as fontes',\n forward: 'Até os usos',\n both: 'As duas',\n hops: 'Saltos',\n view: 'Vista',\n viewGraph: 'Grafo',\n viewTree: 'Árvore',\n filters: 'Filtros',\n filtersActive: 'Filtros ({count, plural, one {# ativo} other {# ativos}})',\n filterKinds: 'Tipos de item',\n filterActors: 'Quem agiu',\n filterActorName: 'Nome do ator',\n filterProof: 'Estado de prova',\n actorsAsNodes: 'Mostrar atores como nós',\n clearFilters: 'Limpar filtros',\n legend: 'Estados de prova',\n inspector: 'Evidência',\n closeInspector: 'Fechar evidência',\n cameFrom: 'Veio de',\n madeFrom: 'Usado por',\n noRelations: 'Nenhum',\n details: 'Detalhes',\n when: 'Quando',\n attributedTo: 'Atribuído a',\n nodeName: '{kind}: {title}, {proof}, {actor}',\n actorNodeName: '{kind}: {name}',\n treeVia: '{relation}',\n emptyTitle: 'Nenhuma proveniência ainda',\n emptyText: 'Nada foi registrado neste projeto. Os itens aparecem aqui à medida que buscas, fontes e asserções são registradas.',\n isolated: 'Este item não tem ligações registradas.',\n focusFiltered: 'O item em foco está oculto pelos filtros.',\n noMatches: 'Nenhum item com esses filtros.',\n deep: 'Esta vista é grande ({count} itens). Reduza o número de saltos para ler melhor.',\n loading: 'Carregando o grafo de proveniência',\n errorTitle: 'Não foi possível carregar a proveniência',\n retry: 'Tentar de novo',\n count: '{count, plural, one {# item} other {# itens}}',\n question: 'De onde veio',\n questionHint: 'Qualquer valor, registro, número ou frase do manuscrito',\n questionEmpty: 'Nada corresponde',\n hopsBack: 'Para trás',\n hopsForward: 'Para a frente',\n viewTimeline: 'Linha do tempo',\n viewCertificate: 'Certificado',\n viewCompare: 'Comparar edições',\n onlyPath: 'Só o caminho da prova',\n proofPath: 'no caminho da prova',\n offPath: 'fora do caminho da prova',\n focusWord: 'em foco',\n lanes: { search: 'Busca', read: 'Leitura', source: 'Fonte', assertion: 'Afirmação', base: 'Base e verificação', analysis: 'Análise', edition: 'Edição', manuscript: 'Manuscrito', actors: 'Atores' },\n relationLegend: 'Relações',\n hash: { match: 'hash confere', 'not-reread': 'não relido', mismatch: 'hash não confere' },\n reason: 'Por quê',\n evidence: 'Evidência citada',\n obligations: 'Obrigações da prova',\n obligationStatus: { ok: 'cumprida', pending: 'pendente', failed: 'falhou' },\n reread: 'Reler a fonte agora',\n requestVerification: 'Pedir verificação',\n treeBackward: 'De onde veio',\n treeForward: 'Onde foi usado',\n treeWay: 'Sentido da lista',\n openInGraph: 'Enter mostra no grafo',\n noCertificate: 'Este item ainda não tem certificado.',\n noComparison: 'Nenhuma edição para comparar.',\n kinds: {\n query: 'consulta',\n retrieval: 'recuperação',\n source: 'fonte',\n assertion: 'asserção',\n record: 'registro',\n analysis: 'análise',\n edition: 'edição',\n manuscript: 'frase do manuscrito',\n verification: 'verificação',\n },\n relations: { wasDerivedFrom: 'derivou de', used: 'usou', wasGeneratedBy: 'gerado por', wasAttributedTo: 'atribuído a' },\n relationsReversed: { wasDerivedFrom: 'origem de', used: 'usado por', wasGeneratedBy: 'gerou', wasAttributedTo: 'responsável por' },\n proof: { proved: 'provada', pending: 'pendente', refuted: 'refutada', not_disclosed: 'não informada', none: 'sem prova' },\n actorKinds: { person: 'pessoa', agent: 'agente', system: 'sistema' },\n inFocus: '{kind} em foco',\n noCertificateYet: 'o verificador (G7a) ainda não emitiu certificado',\n filterKindChip: 'Tipo: {value}',\n filterActorChip: 'Ator: {value}',\n filterProofChip: 'Prova: {value}',\n filterAllKinds: 'todos',\n filterAllActors: 'todos',\n filterAllProof: 'todas',\n filterChosen: '{count, plural, one {# escolhido} other {# escolhidos}}',\n hopsWord: 'saltos',\n treeCount: '{nodes, plural, one {# nó} other {# nós}} · {actors, plural, one {# ator} other {# atores}} · {hashes, plural, one {# hash conferido} other {# hashes conferidos}}',\n treeKeys: 'Setas movem · → abre · ← fecha · Enter mostra no grafo',\n toolTree: 'Árvore navegável',\n toolExport: 'Exportar PROV',\n questionField: 'valor, registro, número ou frase',\n}\n\nexport const provenanceLabelsEs: ProvenanceLabels = {\n graphName: 'Grafo de procedencia',\n graphRole: 'grafo',\n treeName: 'Lista de procedencia',\n queryBar: 'Consulta de procedencia',\n focus: 'Elemento en foco',\n focusAll: 'Grafo completo',\n direction: 'Dirección',\n backward: 'Hacia las fuentes',\n forward: 'Hacia los usos',\n both: 'Ambas',\n hops: 'Pasos',\n view: 'Vista',\n viewGraph: 'Grafo',\n viewTree: 'Árbol',\n filters: 'Filtros',\n filtersActive: 'Filtros ({count, plural, one {# activo} other {# activos}})',\n filterKinds: 'Tipos de elemento',\n filterActors: 'Quién actuó',\n filterActorName: 'Nombre del actor',\n filterProof: 'Estado de prueba',\n actorsAsNodes: 'Mostrar actores como nodos',\n clearFilters: 'Borrar filtros',\n legend: 'Estados de prueba',\n inspector: 'Evidencia',\n closeInspector: 'Cerrar evidencia',\n cameFrom: 'Proviene de',\n madeFrom: 'Usado por',\n noRelations: 'Ninguno',\n details: 'Detalles',\n when: 'Cuándo',\n attributedTo: 'Atribuido a',\n nodeName: '{kind}: {title}, {proof}, {actor}',\n actorNodeName: '{kind}: {name}',\n treeVia: '{relation}',\n emptyTitle: 'Todavía no hay procedencia',\n emptyText: 'No se ha registrado nada en este proyecto. Los elementos aparecen aquí a medida que se registran búsquedas, fuentes y aserciones.',\n isolated: 'Este elemento no tiene vínculos registrados.',\n focusFiltered: 'El elemento en foco está oculto por los filtros.',\n noMatches: 'Ningún elemento coincide con estos filtros.',\n deep: 'Esta vista es grande ({count} elementos). Reduzca el número de pasos para leerla mejor.',\n loading: 'Cargando el grafo de procedencia',\n errorTitle: 'No se pudo cargar la procedencia',\n retry: 'Reintentar',\n count: '{count, plural, one {# elemento} other {# elementos}}',\n question: 'De dónde vino',\n questionHint: 'Cualquier valor, registro, número o frase del manuscrito',\n questionEmpty: 'Nada coincide',\n hopsBack: 'Hacia atrás',\n hopsForward: 'Hacia adelante',\n viewTimeline: 'Línea de tiempo',\n viewCertificate: 'Certificado',\n viewCompare: 'Comparar ediciones',\n onlyPath: 'Solo el camino de la prueba',\n proofPath: 'en el camino de la prueba',\n offPath: 'fuera del camino de la prueba',\n focusWord: 'en foco',\n lanes: { search: 'Búsqueda', read: 'Lectura', source: 'Fuente', assertion: 'Afirmación', base: 'Base y verificación', analysis: 'Análisis', edition: 'Edición', manuscript: 'Manuscrito', actors: 'Actores' },\n relationLegend: 'Relaciones',\n hash: { match: 'el hash coincide', 'not-reread': 'no releído', mismatch: 'el hash no coincide' },\n reason: 'Por qué',\n evidence: 'Evidencia citada',\n obligations: 'Obligaciones de la prueba',\n obligationStatus: { ok: 'cumplida', pending: 'pendiente', failed: 'falló' },\n reread: 'Releer la fuente ahora',\n requestVerification: 'Pedir verificación',\n treeBackward: 'De dónde vino',\n treeForward: 'Dónde se usó',\n treeWay: 'Sentido de la lista',\n openInGraph: 'Enter lo muestra en el grafo',\n noCertificate: 'Este elemento aún no tiene certificado.',\n noComparison: 'No hay ediciones para comparar.',\n kinds: {\n query: 'consulta',\n retrieval: 'recuperación',\n source: 'fuente',\n assertion: 'aserción',\n record: 'registro',\n analysis: 'análisis',\n edition: 'edición',\n manuscript: 'frase del manuscrito',\n verification: 'verificación',\n },\n relations: { wasDerivedFrom: 'derivó de', used: 'usó', wasGeneratedBy: 'generado por', wasAttributedTo: 'atribuido a' },\n relationsReversed: { wasDerivedFrom: 'origen de', used: 'usado por', wasGeneratedBy: 'generó', wasAttributedTo: 'responsable de' },\n proof: { proved: 'probada', pending: 'pendiente', refuted: 'refutada', not_disclosed: 'no informada', none: 'sin prueba' },\n actorKinds: { person: 'persona', agent: 'agente', system: 'sistema' },\n inFocus: '{kind} en foco',\n noCertificateYet: 'el verificador (G7a) aún no emitió certificado',\n filterKindChip: 'Tipo: {value}',\n filterActorChip: 'Actor: {value}',\n filterProofChip: 'Prueba: {value}',\n filterAllKinds: 'todos',\n filterAllActors: 'todos',\n filterAllProof: 'todas',\n filterChosen: '{count, plural, one {# elegido} other {# elegidos}}',\n hopsWord: 'saltos',\n treeCount: '{nodes, plural, one {# nodo} other {# nodos}} · {actors, plural, one {# actor} other {# actores}} · {hashes, plural, one {# hash verificado} other {# hashes verificados}}',\n treeKeys: 'Flechas mueven · → abre · ← cierra · Enter lo muestra en el grafo',\n toolTree: 'Árbol navegable',\n toolExport: 'Exportar PROV',\n questionField: 'valor, registro, número o frase',\n}\n\nexport const provenanceLabels = defineLabels<ProvenanceLabels>('provenance', { en: defaultProvenanceLabels, 'pt-BR': provenanceLabelsPtBR, es: provenanceLabelsEs })\n","// A provenance item (or an actor drawn as a node) on the canvas: one\n// 236×72 card with three lines, the kind glyph and title, the mono\n// identifier, then who acted and the check that matters for this item\n// (the hash state of a reading, or the proof word of a claim). Proof and\n// hash states always carry a word and an icon, never colour alone.\n\nimport { useId, type KeyboardEvent, type ReactNode } from 'react'\nimport { Bot, CircleCheck, CircleDashed, CircleMinus, CircleX, Hourglass, Server, ShieldCheck, ShieldQuestion, ShieldX, User } from 'lucide-react'\nimport { Button as AriaButton } from 'react-aria-components'\nimport { resolveIcon, FALLBACK_KIND_ICONS } from '../catalog/icons'\nimport { fill } from '../internal/labels'\nimport { useSurface } from '../surface/SurfaceContext'\nimport type { ProvenanceLabels } from './labels'\nimport { proofKeyOf, type ProofKey, type ProvActor, type ProvActorKind, type ProvItem } from './model'\n\n/** Canvas size a provenance card is laid out with before it is measured. */\nexport const PROV_CARD = Object.freeze({ width: 236, height: 72 })\nexport const ACTOR_CARD = Object.freeze({ width: 200, height: 60 })\n\nexport function itemAccessibleName(item: ProvItem, l: ProvenanceLabels, locale?: string): string {\n const actor = item.actor ? `${l.actorKinds[item.actor.kind]} ${item.actor.name}` : ''\n return fill(l.nodeName, { kind: l.kinds[item.kind], title: item.title, proof: l.proof[proofKeyOf(item)], actor }, locale).replace(/,\\s*$/, '')\n}\n\n/** Items whose proof word is worth a pill (claims, or any item with an explicit state). */\nexport function showsProof(item: ProvItem): boolean {\n return item.kind === 'assertion' || (item.proofState !== null && item.proofState !== undefined)\n}\n\nconst ACTOR_GLYPH: Record<ProvActorKind, typeof Bot> = { agent: Bot, person: User, system: Server }\n\n/** Who acted: a small glyph box (dashed for agents, round for people, square for systems) and the name. */\nexport function ActorMark({ actor, className }: { actor: Pick<ProvActor, 'kind' | 'name'>; className?: string }) {\n const Glyph = ACTOR_GLYPH[actor.kind]\n return (\n <span className={['ty-prov-actor', className].filter(Boolean).join(' ')} data-kind={actor.kind}>\n <span className=\"ty-prov-actor__glyph\" aria-hidden=\"true\">\n <Glyph focusable=\"false\" />\n </span>\n <span className=\"ty-prov-actor__name\" dir=\"auto\">\n {actor.name}\n </span>\n </span>\n )\n}\n\nconst PROOF_GLYPH: Record<ProofKey, typeof CircleCheck> = { proved: CircleCheck, pending: Hourglass, refuted: CircleX, not_disclosed: CircleDashed, none: CircleMinus }\n\n/** The proof state as a pill: word and glyph, with a border style per state. */\nexport function ProofPill({ state, word, size = 'regular' }: { state: ProofKey; word: string; size?: 'regular' | 'small' }) {\n const Glyph = PROOF_GLYPH[state]\n return (\n <span className=\"ty-prov-proof\" data-proof={state} data-size={size}>\n <Glyph aria-hidden=\"true\" focusable=\"false\" />\n {word}\n </span>\n )\n}\n\n/** \"hash matches\" / \"not reread\" / \"hash does not match\": icon and word, never colour alone. */\nexport function HashCheck({ state, labels: l }: { state: NonNullable<ProvItem['hashCheck']>; labels: ProvenanceLabels }) {\n const Icon = state === 'match' ? ShieldCheck : state === 'mismatch' ? ShieldX : ShieldQuestion\n return (\n <span className=\"ty-prov-hash\" data-state={state}>\n <Icon aria-hidden=\"true\" focusable=\"false\" />\n {l.hash[state]}\n </span>\n )\n}\n\nexport interface ProvenanceNodeProps {\n item: ProvItem\n labels: ProvenanceLabels\n locale?: string\n selected?: boolean\n dimmed?: boolean\n /** On the focus item's proof path (accent border). */\n onPath?: boolean\n /** The focus item itself (halo). */\n focused?: boolean\n onActivate: () => void\n onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void\n}\n\n/** Card chrome shared by items and actors: a full-size activator under three lines of text. */\nfunction CardShell({ name, words, onActivate, onKeyDown, attrs, children }: { name: string; words: string[]; onActivate: () => void; onKeyDown?: ((e: KeyboardEvent<HTMLElement>) => void) | undefined; attrs: Record<string, string | undefined>; children: ReactNode }) {\n const surface = useSurface()\n const describedBy = useId()\n return (\n <div className=\"ty-prov-card\" {...attrs}>\n <AriaButton\n className=\"ty-prov-card__hit\"\n data-ty-node-focus=\"\"\n aria-label={name}\n {...(words.length ? { 'aria-describedby': describedBy } : {})}\n onPress={() => {\n if (surface.justDragged()) return\n onActivate()\n }}\n onKeyDown={(e) => onKeyDown?.(e)}\n />\n {children}\n {words.length ? (\n <span id={describedBy} className=\"ty-visually-hidden\">\n {words.join(', ')}\n </span>\n ) : null}\n </div>\n )\n}\n\nexport function ProvenanceNode({ item, labels: l, locale, selected, dimmed, onPath, focused, onActivate, onKeyDown }: ProvenanceNodeProps) {\n const proof = proofKeyOf(item)\n const Icon = resolveIcon(FALLBACK_KIND_ICONS[item.kind])\n const words = [...(focused ? [l.focusWord] : []), ...(onPath && !focused ? [l.proofPath] : []), ...(dimmed ? [l.offPath] : []), ...(item.hashCheck ? [l.hash[item.hashCheck]] : [])]\n return (\n <CardShell\n name={itemAccessibleName(item, l, locale)}\n words={words}\n onActivate={onActivate}\n onKeyDown={onKeyDown}\n attrs={{ 'data-kind': item.kind, 'data-on-path': onPath ? 'true' : undefined, 'data-focus': focused ? 'true' : undefined, 'data-selected': selected ? 'true' : undefined, 'data-dimmed': dimmed ? 'true' : undefined }}\n >\n <span className=\"ty-prov-card__head\" aria-hidden=\"true\">\n <Icon className=\"ty-prov-card__icon\" focusable=\"false\" />\n <span className=\"ty-prov-card__title\" dir=\"auto\" title={item.title}>\n {item.title}\n </span>\n </span>\n <code className=\"ty-prov-card__id\" dir=\"ltr\" title={item.meta?.[0]} aria-hidden=\"true\">\n {item.meta?.[0] ?? ''}\n </code>\n <span className=\"ty-prov-card__foot\" aria-hidden=\"true\">\n {item.actor ? <ActorMark actor={item.actor} /> : <span />}\n {item.hashCheck ? <HashCheck state={item.hashCheck} labels={l} /> : showsProof(item) ? <ProofPill state={proof} word={l.proof[proof]} size=\"small\" /> : null}\n </span>\n </CardShell>\n )\n}\n\nexport interface ActorNodeProps {\n actor: ProvActor & { id: string }\n labels: ProvenanceLabels\n locale?: string\n selected?: boolean\n onActivate: () => void\n onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void\n}\n\n/** An actor as its own node (only when \"show actors as nodes\" is on). */\nexport function ActorNode({ actor, labels: l, locale, selected, onActivate, onKeyDown }: ActorNodeProps) {\n return (\n <CardShell\n name={fill(l.actorNodeName, { kind: l.actorKinds[actor.kind], name: actor.name }, locale)}\n words={[]}\n onActivate={onActivate}\n onKeyDown={onKeyDown}\n attrs={{ 'data-kind': 'actor', 'data-selected': selected ? 'true' : undefined }}\n >\n <span className=\"ty-prov-card__head\" aria-hidden=\"true\">\n <span className=\"ty-prov-card__title\">{l.actorKinds[actor.kind]}</span>\n </span>\n <code className=\"ty-prov-card__id\" dir=\"ltr\" aria-hidden=\"true\">\n {actor.model ?? ''}\n </code>\n <span className=\"ty-prov-card__foot\" aria-hidden=\"true\">\n <ActorMark actor={actor} />\n </span>\n </CardShell>\n )\n}\n","// Key to the graph's two visual codes, each spelled out in words: how a line\n// is drawn tells the PROV relation, how a card's border is drawn tells the\n// proof state (design direction §2.11, §3.13). It sits in the graph's tool\n// row ('inline') or in a canvas corner ('panel').\n\nimport type { ReactNode } from 'react'\nimport { ProofBadge } from '../../index'\nimport type { ProvenanceLabels } from './labels'\nimport { PROOF_KEYS, PROV_RELATIONS, type ProofKey, type ProvRelation } from './model'\n\nexport interface ProvenanceLegendProps {\n labels: ProvenanceLabels\n /** Proof states to explain (for example only those present in the view). */\n states?: readonly ProofKey[]\n /** Relations to explain; all four by default. */\n relations?: readonly ProvRelation[]\n variant?: 'inline' | 'panel'\n}\n\ninterface KeyGroup {\n heading: string\n entries: Array<{ id: string; sample: ReactNode; word: ReactNode }>\n}\n\nfunction relationSample(r: ProvRelation) {\n return (\n <svg className=\"ty-prov-legend__line\" data-relation={r} viewBox=\"0 0 32 8\" aria-hidden=\"true\" focusable=\"false\">\n <line x1=\"1\" y1=\"4\" x2=\"31\" y2=\"4\" />\n </svg>\n )\n}\n\nfunction proofSample(k: ProofKey) {\n return <span className=\"ty-prov-legend__swatch\" data-proof-state={k.replace('_', '-')} aria-hidden=\"true\" />\n}\n\nexport function ProvenanceLegend({ labels: l, states = PROOF_KEYS, relations = PROV_RELATIONS, variant = 'panel' }: ProvenanceLegendProps) {\n const groups: KeyGroup[] = [\n {\n heading: l.relationLegend,\n entries: relations.map((r) => ({ id: r, sample: relationSample(r), word: <span className=\"ty-prov-legend__word\">{l.relations[r]}</span> })),\n },\n {\n heading: l.legend,\n entries: states.map((k) => ({ id: k, sample: proofSample(k), word: <ProofBadge state={k === 'none' ? null : k} size=\"inline\" label={l.proof[k]} /> })),\n },\n ]\n const shown = groups.filter((g) => g.entries.length)\n return (\n <section className=\"ty-prov-legend\" data-variant={variant} aria-label={states.length ? l.legend : l.relationLegend} data-ty-surface-chrome=\"\">\n {shown.map((g) => (\n <div key={g.heading} className=\"ty-prov-legend__group\">\n <h3 className=\"ty-prov-legend__title\">{g.heading}</h3>\n <ul className=\"ty-prov-legend__list\">\n {g.entries.map((e) => (\n <li key={e.id} className=\"ty-prov-legend__row\">\n {e.sample}\n {e.word}\n </li>\n ))}\n </ul>\n </div>\n ))}\n </section>\n )\n}\n","// Filters of the provenance view. In the graph they are three chips (type,\n// actor, proof), each opening its own popover; ProvenanceFilters keeps the\n// single \"Filters\" popover and ProvenanceFilterFields the bare fields.\n\nimport { ChevronDown, SlidersHorizontal } from 'lucide-react'\nimport { Button as AriaButton, Dialog, DialogTrigger, Popover as AriaPopover } from 'react-aria-components'\nimport { Button, Checkbox, CheckboxGroup, Popover, Switch, TextField } from '../../index'\nimport type { ReactNode } from 'react'\nimport { fill } from '../internal/labels'\nimport type { ProvenanceLabels } from './labels'\nimport { ACTOR_KINDS, activeFilterCount, EMPTY_FILTERS, PROOF_KEYS, PROV_KINDS, type ProofKey, type ProvActorKind, type ProvFilters, type ProvKind } from './model'\n\nexport interface ProvenanceFiltersProps {\n value: ProvFilters\n onChange: (next: ProvFilters) => void\n labels: ProvenanceLabels\n locale?: string\n /** Kinds offered (defaults to every PROV kind). */\n kinds?: readonly ProvKind[]\n /** Offer the \"actors as nodes\" switch (only when actors with ids exist). */\n canShowActors?: boolean\n}\n\n/** The filter fields without the popover (embeddable in a drawer). */\nexport function ProvenanceFilterFields({ value, onChange, labels: l, kinds = PROV_KINDS, canShowActors = false }: ProvenanceFiltersProps) {\n return (\n <div className=\"ty-prov-filters\">\n <CheckboxGroup label={l.filterKinds} value={value.kinds} onChange={(v) => onChange({ ...value, kinds: v as ProvKind[] })} orientation=\"vertical\">\n {kinds.map((k) => (\n <Checkbox key={k} value={k} label={l.kinds[k]} />\n ))}\n </CheckboxGroup>\n <CheckboxGroup label={l.filterProof} value={value.proofStates} onChange={(v) => onChange({ ...value, proofStates: v as ProofKey[] })}>\n {PROOF_KEYS.map((k) => (\n <Checkbox key={k} value={k} label={l.proof[k]} />\n ))}\n </CheckboxGroup>\n <CheckboxGroup label={l.filterActors} value={value.actorKinds} onChange={(v) => onChange({ ...value, actorKinds: v as ProvActorKind[] })}>\n {ACTOR_KINDS.map((k) => (\n <Checkbox key={k} value={k} label={l.actorKinds[k]} />\n ))}\n </CheckboxGroup>\n <TextField label={l.filterActorName} value={value.actorName} onChange={(t) => onChange({ ...value, actorName: t })} />\n {canShowActors ? <Switch label={l.actorsAsNodes} isSelected={value.actorsAsNodes} onChange={(on) => onChange({ ...value, actorsAsNodes: on })} /> : null}\n <Button variant=\"quiet\" onPress={() => onChange({ ...EMPTY_FILTERS, kinds: [], actorKinds: [], proofStates: [] })} disabled={activeFilterCount(value) === 0} focusableWhenDisabled>\n {l.clearFilters}\n </Button>\n </div>\n )\n}\n\nexport function ProvenanceFilters(props: ProvenanceFiltersProps) {\n const { value, labels: l, locale } = props\n const count = activeFilterCount(value)\n const trigger = count ? fill(l.filtersActive, { count }, locale) : l.filters\n return (\n <Popover\n title={l.filters}\n placement=\"bottom\"\n align=\"end\"\n trigger={\n <Button variant=\"secondary\" leadingIcon={<SlidersHorizontal />} className=\"ty-prov-filters__trigger\">\n {trigger}\n </Button>\n }\n >\n <ProvenanceFilterFields {...props} />\n </Popover>\n )\n}\n\ntype ChipKey = 'kinds' | 'actors' | 'proof'\n\n/** Type, actor and proof filters as three chips with popovers (\"Type: all\"). */\nexport function FilterChips({ value, onChange, labels: l, locale, kinds = PROV_KINDS, canShowActors = false }: ProvenanceFiltersProps) {\n const chosen = (n: number, all: string) => (n ? fill(l.filterChosen, { count: n }, locale) : all)\n const actorCount = value.actorKinds.length + (value.actorName.trim() ? 1 : 0) + (value.actorsAsNodes ? 1 : 0)\n const chips: Array<{ key: ChipKey; text: string; active: boolean; body: ReactNode }> = [\n {\n key: 'kinds',\n text: fill(l.filterKindChip, { value: chosen(value.kinds.length, l.filterAllKinds) }, locale),\n active: value.kinds.length > 0,\n body: (\n <CheckboxGroup label={l.filterKinds} value={value.kinds} onChange={(v) => onChange({ ...value, kinds: v as ProvKind[] })}>\n {kinds.map((k) => (\n <Checkbox key={k} value={k} label={l.kinds[k]} />\n ))}\n </CheckboxGroup>\n ),\n },\n {\n key: 'actors',\n text: fill(l.filterActorChip, { value: chosen(actorCount, l.filterAllActors) }, locale),\n active: actorCount > 0,\n body: (\n <>\n <CheckboxGroup label={l.filterActors} value={value.actorKinds} onChange={(v) => onChange({ ...value, actorKinds: v as ProvActorKind[] })}>\n {ACTOR_KINDS.map((k) => (\n <Checkbox key={k} value={k} label={l.actorKinds[k]} />\n ))}\n </CheckboxGroup>\n <TextField label={l.filterActorName} value={value.actorName} onChange={(t) => onChange({ ...value, actorName: t })} />\n {canShowActors ? <Switch label={l.actorsAsNodes} isSelected={value.actorsAsNodes} onChange={(on) => onChange({ ...value, actorsAsNodes: on })} /> : null}\n </>\n ),\n },\n {\n key: 'proof',\n text: fill(l.filterProofChip, { value: chosen(value.proofStates.length, l.filterAllProof) }, locale),\n active: value.proofStates.length > 0,\n body: (\n <CheckboxGroup label={l.filterProof} value={value.proofStates} onChange={(v) => onChange({ ...value, proofStates: v as ProofKey[] })}>\n {PROOF_KEYS.map((k) => (\n <Checkbox key={k} value={k} label={l.proof[k]} />\n ))}\n </CheckboxGroup>\n ),\n },\n ]\n return (\n <>\n {chips.map((c) => (\n <DialogTrigger key={c.key}>\n <AriaButton className=\"ty-prov-chip\" data-active={c.active ? 'true' : undefined}>\n {c.text}\n <ChevronDown className=\"ty-prov-chip__chevron\" aria-hidden=\"true\" />\n </AriaButton>\n <AriaPopover className=\"ty-prov-chip-pop\" placement=\"bottom start\" offset={6}>\n <Dialog className=\"ty-prov-chip-pop__dialog\" aria-label={c.text}>\n <div className=\"ty-prov-filters\">{c.body}</div>\n </Dialog>\n </AriaPopover>\n </DialogTrigger>\n ))}\n </>\n )\n}\n","// ProvenanceTree: the keyboard and screen-reader alternative to the canvas\n// (APG Tree View through React Aria Tree). Same subgraph, same selection:\n// the focus item is the root; its children are what it came from (back) or\n// what was made from it (ahead), each row saying the relation in words.\n// Up/Down move, Right/Left expand/collapse (mirrored in RTL by React Aria),\n// Home/End jump, Enter/Space select.\n\nimport { useEffect, useMemo, useState, type CSSProperties, type ReactNode } from 'react'\nimport { Button as AriaButton, Radio, RadioGroup, Tree, TreeItem, TreeItemContent, type Key, type Selection } from 'react-aria-components'\nimport { ChevronRight } from 'lucide-react'\nimport { useControllable } from '../internal/useControllable'\nimport { fill } from '../internal/labels'\nimport { FALLBACK_KIND_ICONS, resolveIcon } from '../catalog/icons'\nimport type { HopDirection } from '../model/graph'\nimport type { ProvenanceLabels } from './labels'\nimport { proofKeyOf, provenanceTree, treeKeys, type ProvTreeRow, type ProvView } from './model'\nimport { ActorMark, HashCheck, itemAccessibleName, showsProof } from './ProvenanceNode'\n\nexport interface ProvenanceTreeProps {\n view: ProvView\n focusId: string | null\n /** 'backward' lists where the focus came from; 'forward' where it was used. */\n way?: 'backward' | 'forward'\n defaultWay?: 'backward' | 'forward'\n onWayChange?: (way: 'backward' | 'forward') => void\n selectedId: string | null\n onSelect: (id: string) => void\n /** Enter on a row: show that node in the graph. */\n onOpenInGraph?: (id: string) => void\n labels: ProvenanceLabels\n locale?: string\n className?: string\n}\n\nexport function ProvenanceTree({ view, focusId, selectedId, onSelect, onOpenInGraph, labels: l, locale, className, ...rest }: ProvenanceTreeProps) {\n const [way, setWay] = useControllable<'backward' | 'forward'>(rest.way, rest.defaultWay ?? 'backward', rest.onWayChange)\n const direction: HopDirection = focusId ? way : 'forward'\n const rows = useMemo(() => provenanceTree(view, focusId, direction), [view, focusId, direction])\n const allKeys = useMemo(() => treeKeys(rows), [rows])\n const [expanded, setExpanded] = useState<Set<Key>>(() => new Set(allKeys))\n // A new query opens every row again.\n useEffect(() => setExpanded(new Set(allKeys)), [allKeys])\n\n const byId = useMemo(() => new Map(view.vertices.map((v) => [v.id, v])), [view])\n const selectedKey = useMemo(() => (selectedId ? allKeys.find((k) => lastId(k) === selectedId) : undefined), [allKeys, selectedId])\n\n const renderRow = (row: ProvTreeRow): ReactNode => {\n const vertex = byId.get(row.id)\n if (!vertex) return null\n const via = row.via ? (row.via.way === 'back' ? l.relations[row.via.relation] : l.relationsReversed[row.via.relation]) : null\n const text = vertex.type === 'item' ? itemAccessibleName(vertex.item, l, locale) : `${l.actorKinds[vertex.actor.kind]}: ${vertex.actor.name}`\n const Icon = vertex.type === 'item' ? resolveIcon(FALLBACK_KIND_ICONS[vertex.item.kind]) : null\n const meta = vertex.type === 'item' ? vertex.item.meta?.[0] : undefined\n const proofWord = vertex.type === 'item' && showsProof(vertex.item) ? l.proof[proofKeyOf(vertex.item)] : undefined\n return (\n <TreeItem key={row.key} id={row.key} textValue={via ? `${via}: ${text}` : text} className=\"ty-prov-tree__item\" style={({ level }) => ({ '--ty-tree-level': level }) as CSSProperties}>\n <TreeItemContent>\n {({ hasChildItems }) => (\n <div className=\"ty-prov-tree__row\">\n {hasChildItems ? (\n <AriaButton slot=\"chevron\" className=\"ty-prov-tree__chevron\">\n <ChevronRight aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n ) : (\n <span className=\"ty-prov-tree__spacer\" aria-hidden=\"true\" />\n )}\n {Icon ? <Icon className=\"ty-prov-tree__icon\" aria-hidden=\"true\" focusable=\"false\" /> : <span className=\"ty-prov-tree__icon\" aria-hidden=\"true\" />}\n <span className=\"ty-prov-tree__text\">\n <span className=\"ty-prov-tree__line\">\n {via ? <span className=\"ty-visually-hidden\">{via} </span> : null}\n <span className=\"ty-prov-tree__kind\">{vertex.type === 'item' ? l.kinds[vertex.item.kind] : l.actorKinds[vertex.actor.kind]}</span>\n <span className=\"ty-prov-tree__title\" dir=\"auto\">\n {vertex.type === 'item' ? vertex.item.title : vertex.actor.name}\n </span>\n </span>\n {meta || proofWord ? (\n <span className=\"ty-prov-tree__meta\">\n {meta ? <code dir=\"ltr\">{meta}</code> : null}\n {meta && proofWord ? ' · ' : null}\n {proofWord ?? null}\n </span>\n ) : null}\n </span>\n {vertex.type === 'item' && vertex.item.actor ? <ActorMark actor={vertex.item.actor} className=\"ty-prov-tree__actor\" /> : null}\n {vertex.type === 'item' && vertex.item.hashCheck ? <HashCheck state={vertex.item.hashCheck} labels={l} /> : null}\n </div>\n )}\n </TreeItemContent>\n {row.children.map(renderRow)}\n </TreeItem>\n )\n }\n\n const counts = useMemo(() => {\n const items = view.vertices.flatMap((v) => (v.type === 'item' ? [v.item] : []))\n const actors = new Set(items.flatMap((i) => (i.actor ? [`${i.actor.kind}:${i.actor.name}`] : [])))\n return { nodes: view.vertices.length, actors: actors.size, hashes: items.filter((i) => i.hashCheck === 'match').length }\n }, [view])\n\n return (\n <div className=\"ty-prov-tree-wrap\">\n <div className=\"ty-prov-tree__bar\">\n {focusId ? (\n <RadioGroup className=\"ty-prov-tree__way\" aria-label={l.treeWay} orientation=\"horizontal\" value={way} onChange={(v) => setWay(v as 'backward' | 'forward')}>\n <Radio value=\"backward\" className=\"ty-prov-chip ty-prov-tree__way-option\">\n {l.treeBackward}\n </Radio>\n <Radio value=\"forward\" className=\"ty-prov-chip ty-prov-tree__way-option\">\n {l.treeForward}\n </Radio>\n </RadioGroup>\n ) : null}\n <span className=\"ty-prov__spacer\" />\n <p className=\"ty-prov-tree__count\">{fill(l.treeCount, counts, locale)}</p>\n </div>\n <Tree\n aria-label={l.treeName}\n className={['ty-prov-tree', className].filter(Boolean).join(' ')}\n selectionMode=\"single\"\n selectionBehavior={onOpenInGraph ? 'replace' : 'toggle'}\n selectedKeys={selectedKey ? [selectedKey] : []}\n onSelectionChange={(keys: Selection) => {\n if (keys === 'all') return\n const [first] = [...keys]\n if (first !== undefined) onSelect(lastId(String(first)))\n }}\n expandedKeys={expanded}\n onExpandedChange={setExpanded}\n renderEmptyState={() => <p className=\"ty-prov-tree__empty\">{l.noMatches}</p>}\n {...(onOpenInGraph ? { onAction: (key: Key) => onOpenInGraph(lastId(String(key))) } : {})}\n >\n {rows.map(renderRow)}\n </Tree>\n <p className=\"ty-prov-tree__hint\">{onOpenInGraph ? l.treeKeys : null}</p>\n </div>\n )\n}\n\n/** Row keys are paths (\"a/b/c\"); the item id is the last segment. */\nfunction lastId(key: string): string {\n const i = key.lastIndexOf('/')\n return i < 0 ? key : key.slice(i + 1)\n}\n","// Evidence panel for the selected provenance item. Reading order: what it is\n// and whether it is proved, the quoted evidence, the obligations the proof\n// needs, the facts (who, when, values), the actions, then the relations in\n// both directions as buttons that move the selection along the trail.\n\nimport { CircleCheck, CircleX, FileText, Hourglass, ShieldQuestion, X } from 'lucide-react'\nimport { Button } from '../../index'\nimport type { ObligationStatus, ProofObligation } from './proofTypes'\nimport { ActorMark, HashCheck, ProofPill } from './ProvenanceNode'\nimport { fill } from '../internal/labels'\nimport { formatDateTime } from '../internal/format'\nimport type { ProvenanceLabels } from './labels'\nimport { proofKeyOf, relationsOf, type ProvLink, type ProvView, type ProvVertex } from './model'\n\nexport interface ProvenanceInspectorProps {\n vertex: ProvVertex\n view: ProvView\n labels: ProvenanceLabels\n locale?: string\n onSelect: (id: string) => void\n /** Shows a close button (the panel is a sheet on narrow screens). */\n onClose?: () => void\n /** \"Reread the source now\" (retrievals and sources). */\n onReread?: (id: string) => void\n /** \"Ask for verification\". */\n onRequestVerification?: (id: string) => void\n /** Words for the item's time (for example a placeholder while dates are not known). */\n formatTime?: (time: number, use: 'tick' | 'detail') => string\n className?: string\n}\n\nconst OBLIGATION_ICON: Record<ObligationStatus, typeof CircleCheck> = { ok: CircleCheck, pending: Hourglass, failed: CircleX }\n\nfunction Obligations({ list, l }: { list: ProofObligation[]; l: ProvenanceLabels }) {\n return (\n <ul className=\"ty-prov-obligations\">\n {list.map((o) => {\n const Icon = OBLIGATION_ICON[o.status]\n return (\n <li key={o.id} className=\"ty-prov-obligation\" data-status={o.status}>\n <Icon className=\"ty-prov-obligation__icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-prov-obligation__text\">\n <span className=\"ty-prov-obligation__label\">{o.label}</span>\n <span className=\"ty-visually-hidden\">\n , <span>{l.obligationStatus[o.status]}</span>\n </span>\n {o.detail ? (\n <code className=\"ty-prov-obligation__detail\" dir=\"ltr\">\n {o.detail}\n </code>\n ) : null}\n </span>\n {o.children?.length ? <Obligations list={o.children} l={l} /> : null}\n </li>\n )\n })}\n </ul>\n )\n}\n\nconst capital = (s: string, locale?: string) => s.charAt(0).toLocaleUpperCase(locale) + s.slice(1)\n\nexport function ProvenanceInspector({ vertex, view, labels: l, locale, onSelect, onClose, onReread, onRequestVerification, formatTime, className }: ProvenanceInspectorProps) {\n const byId = new Map(view.vertices.map((v) => [v.id, v]))\n const { back, ahead } = relationsOf(vertex.id, view.links)\n const nameOf = (id: string) => {\n const v = byId.get(id)\n if (!v) return id\n return v.type === 'item' ? `${l.kinds[v.item.kind]}: ${v.item.title}` : `${l.actorKinds[v.actor.kind]}: ${v.actor.name}`\n }\n const relations = (links: ProvLink[], way: 'back' | 'ahead', heading: string) =>\n links.length ? (\n <section className=\"ty-prov-inspector__relations\" aria-labelledby={`ty-prov-rel-${way}-${vertex.id}`}>\n <h3 id={`ty-prov-rel-${way}-${vertex.id}`} className=\"ty-prov-inspector__eyebrow\">\n {heading}\n </h3>\n <ul className=\"ty-prov-inspector__links\">\n {links.map((link) => {\n const other = way === 'back' ? link.source : link.target\n const phrase = way === 'back' ? l.relations[link.relation] : l.relationsReversed[link.relation]\n return (\n <li key={link.id}>\n <button type=\"button\" className=\"ty-prov-inspector__link\" aria-label={`${phrase} ${nameOf(other)}`} onClick={() => onSelect(other)}>\n <span className=\"ty-prov-inspector__relation\">{phrase}</span>\n <span className=\"ty-prov-inspector__target\" dir=\"auto\">\n {nameOf(other)}\n </span>\n </button>\n </li>\n )\n })}\n </ul>\n </section>\n ) : null\n\n const title = vertex.type === 'item' ? vertex.item.title : vertex.actor.name\n const eyebrow = vertex.type === 'item' ? fill(l.inFocus, { kind: capital(l.kinds[vertex.item.kind], locale) }, locale) : capital(l.actorKinds[vertex.actor.kind], locale)\n const close = onClose ? (\n <Button className=\"ty-prov-inspector__close\" variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={l.closeInspector} leadingIcon={<X />} onPress={onClose} />\n ) : null\n\n if (vertex.type !== 'item') {\n return (\n <aside className={['ty-prov-inspector', className].filter(Boolean).join(' ')} aria-label={`${l.inspector}: ${title}`}>\n <div className=\"ty-prov-inspector__top\">\n <span className=\"ty-prov-inspector__eyebrow\">{eyebrow}</span>\n {close}\n </div>\n <h2 className=\"ty-prov-inspector__title\">{title}</h2>\n <ActorMark actor={vertex.actor} />\n {relations(ahead, 'ahead', l.relationsReversed.wasAttributedTo)}\n </aside>\n )\n }\n\n const item = vertex.item\n const proof = proofKeyOf(item)\n const note = item.proofReason ?? (item.proofState ? null : l.noCertificateYet)\n // A reading, a source, or a claim resting on quoted evidence can be reread.\n const canReread = !!onReread && (item.kind === 'retrieval' || item.kind === 'source' || (item.kind === 'assertion' && !!item.evidence))\n return (\n <aside className={['ty-prov-inspector', className].filter(Boolean).join(' ')} aria-label={`${l.inspector}: ${title}`}>\n <div className=\"ty-prov-inspector__top\">\n <span className=\"ty-prov-inspector__eyebrow\">{eyebrow}</span>\n {close}\n </div>\n <h2 className=\"ty-prov-inspector__title\" dir=\"auto\">\n {title}\n </h2>\n <div className=\"ty-prov-inspector__proof\">\n <ProofPill state={proof} word={l.proof[proof]} />\n {note ? (\n <span className=\"ty-prov-inspector__note\">\n {item.proofReason ? <span className=\"ty-visually-hidden\">{l.reason}: </span> : null}\n {note}\n </span>\n ) : null}\n {item.hashCheck ? <HashCheck state={item.hashCheck} labels={l} /> : null}\n </div>\n {item.evidence ? (\n <figure className=\"ty-prov-inspector__evidence\">\n <figcaption className=\"ty-visually-hidden\">{l.evidence}</figcaption>\n <blockquote className=\"ty-prov-inspector__quote\" dir=\"auto\">\n {item.evidence}\n </blockquote>\n </figure>\n ) : null}\n {item.obligations?.length ? (\n <section className=\"ty-prov-inspector__section\" aria-labelledby={`ty-prov-obl-${vertex.id}`}>\n <h3 id={`ty-prov-obl-${vertex.id}`} className=\"ty-prov-inspector__eyebrow\">\n {l.obligations}\n </h3>\n <Obligations list={item.obligations} l={l} />\n </section>\n ) : null}\n {item.summary ? <p className=\"ty-prov-inspector__summary\">{item.summary}</p> : null}\n <dl className=\"ty-prov-inspector__facts\">\n {(item.details ?? []).map((d) => (\n <div key={d.label} className=\"ty-prov-inspector__fact\">\n <dt>{d.label}</dt>\n <dd data-mono={d.mono ? 'true' : undefined} dir={d.mono ? 'ltr' : 'auto'}>\n {d.value}\n </dd>\n </div>\n ))}\n {item.actor && !item.details?.length ? (\n <div className=\"ty-prov-inspector__fact\">\n <dt>{l.attributedTo}</dt>\n <dd>\n <ActorMark actor={item.actor} />\n </dd>\n </div>\n ) : null}\n {item.at ? (\n <div className=\"ty-prov-inspector__fact\">\n <dt>{l.when}</dt>\n <dd data-mono=\"true\">\n <time dateTime={item.at}>{formatTime && Number.isFinite(Date.parse(item.at)) ? formatTime(Date.parse(item.at), 'detail') : formatDateTime(item.at, locale)}</time>\n </dd>\n </div>\n ) : null}\n </dl>\n {canReread || onRequestVerification ? (\n <div className=\"ty-prov-inspector__actions\">\n {canReread ? (\n <Button variant=\"secondary\" leadingIcon={<FileText />} onPress={() => onReread!(vertex.id)}>\n {l.reread}\n </Button>\n ) : null}\n {onRequestVerification ? (\n <Button variant=\"quiet\" leadingIcon={<ShieldQuestion />} onPress={() => onRequestVerification(vertex.id)}>\n {l.requestVerification}\n </Button>\n ) : null}\n </div>\n ) : null}\n {relations(back, 'back', l.cameFrom)}\n {relations(ahead, 'ahead', l.madeFrom)}\n </aside>\n )\n}\n","// CanvasNodeSearch: \"find a node\" as a popover with a search field and a\n// filtered list (RAC Autocomplete + SearchField + ListBox, APG combobox-like\n// virtual focus). Choosing a result calls onPick; the host reveals, selects\n// and focuses that node.\n\nimport { useMemo, useState, type RefObject } from 'react'\nimport { Autocomplete, Dialog, Input, Label, ListBox, ListBoxItem, Popover, SearchField, Text, useFilter } from 'react-aria-components'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\n\nexport interface SearchableNode {\n id: string\n label: string\n /** Spoken kind shown under the label (\"assertion\", \"Compute\"). */\n kindLabel?: string\n /** Extra text matched by the filter (ids, meta). */\n keywords?: string\n}\n\nexport interface CanvasNodeSearchLabels {\n title: string\n field: string\n placeholder: string\n empty: string\n results: string\n}\n\nexport const canvasNodeSearchLabels = defineLabels<CanvasNodeSearchLabels>('CanvasNodeSearch', {\n en: {\n title: 'Find a node',\n field: 'Node name',\n placeholder: 'Type a name or id',\n empty: 'No node matches',\n results: '{count, plural, =0 {No results} one {# result} other {# results}}',\n },\n 'pt-BR': {\n title: 'Encontrar um nó',\n field: 'Nome do nó',\n placeholder: 'Digite um nome ou id',\n empty: 'Nenhum nó corresponde',\n results: '{count, plural, =0 {Nenhum resultado} one {# resultado} other {# resultados}}',\n },\n es: {\n title: 'Buscar un nodo',\n field: 'Nombre del nodo',\n placeholder: 'Escriba un nombre o id',\n empty: 'Ningún nodo coincide',\n results: '{count, plural, =0 {Sin resultados} one {# resultado} other {# resultados}}',\n },\n})\n\nexport const defaultCanvasNodeSearchLabels: CanvasNodeSearchLabels = canvasNodeSearchLabels.bundles.en\n\nexport interface CanvasNodeSearchProps {\n isOpen: boolean\n onOpenChange: (open: boolean) => void\n /** Element the popover is anchored to (the search tool). */\n triggerRef: RefObject<HTMLElement | null>\n nodes: readonly SearchableNode[]\n onPick: (id: string) => void\n labels?: Partial<CanvasNodeSearchLabels>\n}\n\nexport function CanvasNodeSearch({ isOpen, onOpenChange, triggerRef, nodes, onPick, labels }: CanvasNodeSearchProps) {\n const l = useLabels(canvasNodeSearchLabels, labels)\n const { locale } = useFlowLocale()\n const { contains } = useFilter({ sensitivity: 'base' })\n const [query, setQuery] = useState('')\n const all = useMemo(() => nodes.map((n) => ({ ...n, text: [n.label, n.kindLabel, n.keywords, n.id].filter(Boolean).join(' ') })), [nodes])\n // Filtered here (not by Autocomplete) so the announced count is exact.\n const items = useMemo(() => (query ? all.filter((n) => contains(n.text, query)) : all), [all, query, contains])\n return (\n <Popover isOpen={isOpen} onOpenChange={onOpenChange} triggerRef={triggerRef} placement=\"top\" className=\"ty-node-search\" offset={8}>\n <Dialog aria-label={l.title} className=\"ty-node-search__dialog\">\n <Autocomplete inputValue={query} onInputChange={setQuery}>\n <SearchField className=\"ty-node-search__field\" aria-label={l.field} autoFocus>\n <Label className=\"ty-node-search__label\">{l.field}</Label>\n <Input className=\"ty-node-search__input\" placeholder={l.placeholder} />\n </SearchField>\n <ListBox\n className=\"ty-node-search__list\"\n aria-label={l.title}\n items={items}\n selectionMode=\"single\"\n renderEmptyState={() => <p className=\"ty-node-search__empty\">{l.empty}</p>}\n onAction={(key) => {\n onPick(String(key))\n onOpenChange(false)\n }}\n >\n {(item) => (\n <ListBoxItem id={item.id} textValue={item.text} className=\"ty-node-search__option\">\n <Text slot=\"label\" className=\"ty-node-search__option-label\">\n {item.label}\n </Text>\n {item.kindLabel ? (\n <Text slot=\"description\" className=\"ty-node-search__option-kind\">\n {item.kindLabel}\n </Text>\n ) : null}\n </ListBoxItem>\n )}\n </ListBox>\n </Autocomplete>\n <p className=\"ty-visually-hidden\" role=\"status\">\n {fill(l.results, { count: items.length }, locale)}\n </p>\n </Dialog>\n </Popover>\n )\n}\n","// CanvasToolbar: renders canvas tool items (see canvasTools.ts) as an APG\n// Toolbar (one tab stop, arrow keys between tools). Each tool reveals its\n// name beside the icon on hover and keyboard focus. The same items can be\n// handed to the design system's bottom dock instead.\n\nimport { Fragment, type ReactNode } from 'react'\nimport { Button as AriaButton, Separator, ToggleButton, Toolbar } from 'react-aria-components'\nimport type { CanvasToolItem } from './canvasTools'\n\nexport interface CanvasToolbarProps {\n items: readonly CanvasToolItem[]\n /** Accessible name of the toolbar. */\n label: string\n orientation?: 'horizontal' | 'vertical'\n /** Where the bar sits: docked at the bottom edge of the canvas, or inline in a host bar. */\n placement?: 'dock' | 'inline'\n /** Extra content after the tools (for example the node search popover). */\n after?: ReactNode\n className?: string\n /** Lets Escape from the canvas land here (EditorShortcuts / FlowEditor). */\n exitTarget?: boolean\n}\n\nexport function CanvasToolbar({ items, label, orientation = 'horizontal', placement = 'dock', after, className, exitTarget = true }: CanvasToolbarProps) {\n let lastGroup: string | null = null\n return (\n <Toolbar\n aria-label={label}\n orientation={orientation}\n className={['ty-canvas-toolbar', className].filter(Boolean).join(' ')}\n data-placement={placement}\n data-ty-surface-chrome=\"\"\n {...(exitTarget ? { 'data-ty-canvas-exit': '' } : {})}\n >\n {items.map((item) => {\n const divider = lastGroup !== null && lastGroup !== item.group\n lastGroup = item.group\n return (\n <Fragment key={item.id}>\n {divider ? <Separator orientation={orientation === 'horizontal' ? 'vertical' : 'horizontal'} className=\"ty-canvas-toolbar__divider\" /> : null}\n <Tool item={item} />\n </Fragment>\n )\n })}\n {after}\n </Toolbar>\n )\n}\n\nfunction ToolFace({ item }: { item: CanvasToolItem }) {\n const Icon = item.icon\n return (\n <>\n {item.text ? (\n <span className=\"ty-canvas-tool__text\" aria-hidden=\"true\">\n {item.text}\n </span>\n ) : Icon ? (\n <Icon className=\"ty-canvas-tool__icon\" aria-hidden=\"true\" focusable=\"false\" />\n ) : null}\n {item.text ? null : (\n <span className=\"ty-canvas-tool__label\" aria-hidden=\"true\">\n {item.label}\n {item.shortcut ? <kbd className=\"ty-canvas-tool__keys\">{item.shortcut.replace('Control+', '⌃')}</kbd> : null}\n </span>\n )}\n </>\n )\n}\n\nfunction Tool({ item }: { item: CanvasToolItem }) {\n const common = {\n className: 'ty-canvas-tool',\n 'aria-label': item.label,\n 'data-tool': item.id,\n // React Aria does not forward aria-keyshortcuts; set it on the element.\n ref: (el: HTMLButtonElement | null) => {\n if (!el) return\n if (item.shortcut) el.setAttribute('aria-keyshortcuts', item.shortcut)\n else el.removeAttribute('aria-keyshortcuts')\n },\n }\n if (item.kind === 'toggle' || item.kind === 'mode') {\n return (\n <ToggleButton\n {...common}\n isSelected={!!item.pressed}\n onChange={() => {\n // A mode already on stays on (single-select pair).\n if (item.kind === 'mode' && item.pressed) return\n item.onPress?.()\n }}\n isDisabled={item.disabled}\n data-kind={item.kind}\n >\n <ToolFace item={item} />\n </ToggleButton>\n )\n }\n return (\n <AriaButton\n {...common}\n // Disabled tools stay focusable and discoverable; activation is a no-op.\n aria-disabled={item.disabled || undefined}\n data-disabled={item.disabled || undefined}\n onPress={() => {\n if (!item.disabled) item.onPress?.()\n }}\n data-kind=\"action\"\n >\n <ToolFace item={item} />\n </AriaButton>\n )\n}\n","// Canvas tools as data: the same list feeds the design system's bottom dock\n// (each entry is a dock item) and the stand-alone CanvasToolbar.\n\nimport { Hand, ListTree, Maximize, MousePointer2, Network, Search, ZoomIn, ZoomOut } from 'lucide-react'\nimport type { IconComponent } from '../../index'\nimport { bundleFor, defineLabels, fill } from '../internal/labels'\n\nexport interface CanvasToolItem {\n id: 'select' | 'pan' | 'zoom-out' | 'zoom-level' | 'zoom-in' | 'fit' | 'auto-layout' | 'list-view' | 'search' | (string & {})\n /** Accessible name (also the revealed label). */\n label: string\n icon?: IconComponent\n /** Visible text instead of an icon (the zoom percentage). */\n text?: string\n /** `toggle` exposes aria-pressed; `mode` items form a single-select pair. */\n kind: 'action' | 'toggle' | 'mode'\n pressed?: boolean\n disabled?: boolean\n /** aria-keyshortcuts value, also shown in the revealed label. */\n shortcut?: string\n group: 'mode' | 'view' | 'layout' | 'find'\n onPress?: () => void\n}\n\nexport interface CanvasToolLabels {\n select: string\n pan: string\n zoomOut: string\n zoomIn: string\n zoomLevel: string\n fit: string\n autoLayout: string\n listView: string\n search: string\n toolbar: string\n}\n\nexport const canvasToolLabels = defineLabels<CanvasToolLabels>('CanvasTools', {\n en: {\n select: 'Select',\n pan: 'Pan',\n zoomOut: 'Zoom out',\n zoomIn: 'Zoom in',\n zoomLevel: 'Zoom {percent}, reset to 100%',\n fit: 'Fit to view',\n autoLayout: 'Arrange automatically',\n listView: 'List view',\n search: 'Find a node',\n toolbar: 'Canvas tools',\n },\n 'pt-BR': {\n select: 'Selecionar',\n pan: 'Mover a vista',\n zoomOut: 'Diminuir zoom',\n zoomIn: 'Aumentar zoom',\n zoomLevel: 'Zoom {percent}, voltar a 100%',\n fit: 'Ajustar à tela',\n autoLayout: 'Organizar automaticamente',\n listView: 'Ver como lista',\n search: 'Encontrar um nó',\n toolbar: 'Ferramentas do canvas',\n },\n es: {\n select: 'Seleccionar',\n pan: 'Desplazar la vista',\n zoomOut: 'Alejar',\n zoomIn: 'Acercar',\n zoomLevel: 'Zoom {percent}, volver a 100 %',\n fit: 'Ajustar a la vista',\n autoLayout: 'Organizar automáticamente',\n listView: 'Ver como lista',\n search: 'Buscar un nodo',\n toolbar: 'Herramientas del lienzo',\n },\n})\n\nexport const defaultCanvasToolLabels: CanvasToolLabels = canvasToolLabels.bundles.en\n\nexport interface CanvasToolOptions {\n zoom: number\n mode: 'select' | 'pan'\n onModeChange: (mode: 'select' | 'pan') => void\n onZoomIn: () => void\n onZoomOut: () => void\n onZoomReset: () => void\n onFit: () => void\n onAutoLayout?: () => void\n listView?: boolean\n onToggleListView?: () => void\n onSearch?: () => void\n locale?: string\n labels?: Partial<CanvasToolLabels>\n /** Tools to leave out (for example 'auto-layout' on a read-only canvas). */\n omit?: readonly string[]\n}\n\n/** The canvas tools as dock items, in dock order. */\nexport function canvasToolItems(o: CanvasToolOptions): CanvasToolItem[] {\n // Pure (usable outside React): built-in bundle for `locale`, then overrides.\n const l: CanvasToolLabels = { ...canvasToolLabels.bundles.en, ...(o.locale ? bundleFor(canvasToolLabels, o.locale) : {}), ...(o.labels ?? {}) }\n const percent = new Intl.NumberFormat(o.locale, { style: 'percent', maximumFractionDigits: 0 }).format(o.zoom)\n const items: CanvasToolItem[] = [\n { id: 'select', label: l.select, icon: MousePointer2, kind: 'mode', pressed: o.mode === 'select', shortcut: 'V', group: 'mode', onPress: () => o.onModeChange('select') },\n { id: 'pan', label: l.pan, icon: Hand, kind: 'mode', pressed: o.mode === 'pan', shortcut: 'H', group: 'mode', onPress: () => o.onModeChange('pan') },\n { id: 'zoom-out', label: l.zoomOut, icon: ZoomOut, kind: 'action', shortcut: 'Control+-', group: 'view', onPress: o.onZoomOut },\n { id: 'zoom-level', label: fill(l.zoomLevel, { percent }, o.locale), text: percent, kind: 'action', shortcut: 'Shift+1', group: 'view', onPress: o.onZoomReset },\n { id: 'zoom-in', label: l.zoomIn, icon: ZoomIn, kind: 'action', shortcut: 'Control+=', group: 'view', onPress: o.onZoomIn },\n { id: 'fit', label: l.fit, icon: Maximize, kind: 'action', shortcut: 'Control+1', group: 'view', onPress: o.onFit },\n ]\n if (o.onAutoLayout) items.push({ id: 'auto-layout', label: l.autoLayout, icon: Network, kind: 'action', group: 'layout', onPress: o.onAutoLayout })\n if (o.onToggleListView) items.push({ id: 'list-view', label: l.listView, icon: ListTree, kind: 'toggle', pressed: !!o.listView, group: 'layout', onPress: o.onToggleListView })\n if (o.onSearch) items.push({ id: 'search', label: l.search, icon: Search, kind: 'action', shortcut: 'Control+F', group: 'find', onPress: o.onSearch })\n return o.omit ? items.filter((i) => !o.omit!.includes(i.id)) : items\n}\n","// EditionCompare (\"Comparar edições\"): what changed between two frozen\n// editions, item by item. Each change carries an icon, a word and a line\n// style, so the kind of change never rests on colour.\n\nimport { useMemo, useState } from 'react'\nimport { Share2 } from 'lucide-react'\nimport { Button } from '../../index'\nimport { ActorMark } from './ProvenanceNode'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport type { EditionChange, EditionComparison } from './proofTypes'\n\nexport type EditionFilter = 'all' | EditionChange\n\nexport interface EditionCompareLabels {\n title: string\n summary: string\n filter: string\n all: string\n item: string\n valueIn: string\n change: string\n who: string\n notPresent: string\n unknownActor: string\n noRows: string\n selected: string\n before: string\n after: string\n pickRow: string\n changes: Record<EditionChange, string>\n counts: Record<EditionChange, string>\n /** Words under the big numbers (\"values altered\"). */\n stats: Record<EditionChange | 'hashes', string>\n valueHead: string\n openInGraph: string\n requestReview: string\n}\n\nexport const editionCompareLabels = defineLabels<EditionCompareLabels>('EditionCompare', {\n en: {\n title: 'Compare editions',\n summary: '{a} compared with {b}',\n filter: 'Show',\n all: 'All',\n item: 'Item',\n valueIn: 'Value in {edition}',\n change: 'Change',\n who: 'Who',\n notPresent: 'not present',\n unknownActor: 'not recorded',\n noRows: 'No change of this kind between the two editions.',\n selected: 'Selected change',\n before: 'Before · {edition}',\n after: 'After · {edition}',\n pickRow: 'Choose a row to compare its values side by side.',\n stats: { altered: 'values altered', new: 'new records', removed: 'removed', hashes: 'divergent hashes' },\n valueHead: '{edition}',\n openInGraph: 'See in the graph',\n requestReview: 'Ask for a review',\n changes: { altered: 'altered', new: 'new', removed: 'removed' },\n counts: {\n altered: '{n, plural, =0 {nothing altered} one {# altered} other {# altered}}',\n new: '{n, plural, =0 {nothing new} one {# new} other {# new}}',\n removed: '{n, plural, =0 {nothing removed} one {# removed} other {# removed}}',\n },\n },\n 'pt-BR': {\n title: 'Comparar edições',\n summary: '{a} comparada com {b}',\n filter: 'Mostrar',\n all: 'Todas',\n item: 'Item',\n valueIn: 'Valor em {edition}',\n change: 'Mudança',\n who: 'Quem',\n notPresent: 'não consta',\n unknownActor: 'não registrado',\n noRows: 'Nenhuma mudança deste tipo entre as duas edições.',\n selected: 'Mudança selecionada',\n before: 'Antes · {edition}',\n after: 'Depois · {edition}',\n pickRow: 'Escolha uma linha para comparar os valores lado a lado.',\n stats: { altered: 'valores alterados', new: 'registros novos', removed: 'removidos', hashes: 'hashes divergentes' },\n valueHead: '{edition}',\n openInGraph: 'Ver no grafo',\n requestReview: 'Pedir revisão',\n changes: { altered: 'alterado', new: 'novo', removed: 'removido' },\n counts: {\n altered: '{n, plural, =0 {nenhum alterado} one {# alterado} other {# alterados}}',\n new: '{n, plural, =0 {nenhum novo} one {# novo} other {# novos}}',\n removed: '{n, plural, =0 {nenhum removido} one {# removido} other {# removidos}}',\n },\n },\n es: {\n title: 'Comparar ediciones',\n summary: '{a} comparada con {b}',\n filter: 'Mostrar',\n all: 'Todos',\n item: 'Elemento',\n valueIn: 'Valor en {edition}',\n change: 'Cambio',\n who: 'Quién',\n notPresent: 'no consta',\n unknownActor: 'no registrado',\n noRows: 'No hay cambios de este tipo entre las dos ediciones.',\n selected: 'Cambio seleccionado',\n before: 'Antes · {edition}',\n after: 'Después · {edition}',\n pickRow: 'Elija una fila para comparar sus valores lado a lado.',\n stats: { altered: 'valores modificados', new: 'registros nuevos', removed: 'eliminados', hashes: 'hashes divergentes' },\n valueHead: '{edition}',\n openInGraph: 'Ver en el grafo',\n requestReview: 'Pedir revisión',\n changes: { altered: 'modificado', new: 'nuevo', removed: 'eliminado' },\n counts: {\n altered: '{n, plural, =0 {ninguno modificado} one {# modificado} other {# modificados}}',\n new: '{n, plural, =0 {ninguno nuevo} one {# nuevo} other {# nuevos}}',\n removed: '{n, plural, =0 {ninguno eliminado} one {# eliminado} other {# eliminados}}',\n },\n },\n})\n\nexport const defaultEditionCompareLabels = editionCompareLabels.bundles.en\n\nexport interface EditionCompareProps {\n comparison: EditionComparison\n /** Controlled change filter. */\n filter?: EditionFilter\n defaultFilter?: EditionFilter\n onFilterChange?: (f: EditionFilter) => void\n selectedItemId?: string | null\n /** Row selected at first when the selection is not controlled. */\n defaultSelectedItemId?: string | null\n onSelectItem?: (itemId: string) => void\n /** \"See in the graph\" on the selected change. */\n onOpenInGraph?: (itemId: string) => void\n /** \"Ask for a review\" on the selected change. */\n onRequestReview?: (itemId: string) => void\n labels?: Partial<EditionCompareLabels>\n className?: string\n}\n\nconst KINDS: EditionChange[] = ['altered', 'new', 'removed']\n\nexport function EditionCompare({ comparison, filter, defaultFilter = 'all', onFilterChange, selectedItemId, defaultSelectedItemId = null, onSelectItem, onOpenInGraph, onRequestReview, labels, className }: EditionCompareProps) {\n const [ownSelected, setOwnSelected] = useState<string | null>(defaultSelectedItemId)\n const selectedId = selectedItemId !== undefined ? selectedItemId : ownSelected\n const select = (id: string) => {\n setOwnSelected(id)\n onSelectItem?.(id)\n }\n const l = useLabels(editionCompareLabels, labels)\n const { locale } = useFlowLocale()\n const [shown, setShown] = useControllable<EditionFilter>(filter, defaultFilter, onFilterChange)\n const counts = useMemo(() => {\n const c: Record<EditionChange, number> = { altered: 0, new: 0, removed: 0 }\n for (const r of comparison.rows) c[r.change]++\n return c\n }, [comparison.rows])\n const rows = shown === 'all' ? comparison.rows : comparison.rows.filter((r) => r.change === shown)\n const { a, b } = comparison\n const current = selectedId ? (comparison.rows.find((r) => r.itemId === selectedId) ?? null) : null\n\n const value = (v: string | undefined) =>\n v === undefined ? (\n <span className=\"ty-diff__absent\">{l.notPresent}</span>\n ) : (\n <code className=\"ty-diff__value\" dir=\"ltr\">\n {v}\n </code>\n )\n\n const swatch = (k: EditionChange) => (\n <span className=\"ty-diff__change\" data-change={k}>\n <span className=\"ty-diff__swatch\" aria-hidden=\"true\" />\n <span>{l.changes[k]}</span>\n </span>\n )\n const num = (n: number) => new Intl.NumberFormat(locale).format(n)\n\n return (\n <section className={['ty-diff', className].filter(Boolean).join(' ')} aria-label={l.title}>\n <p className=\"ty-visually-hidden\">{fill(l.summary, { a: a.label, b: b.label }, locale)}</p>\n <div className=\"ty-diff__stats\" role=\"group\" aria-label={l.filter}>\n {KINDS.map((k) => (\n <button\n key={k}\n type=\"button\"\n className=\"ty-diff__stat\"\n data-change={k}\n aria-pressed={shown === k}\n aria-label={fill(l.counts[k], { n: counts[k] }, locale)}\n onClick={() => setShown(shown === k ? 'all' : k)}\n >\n <span className=\"ty-diff__stat-number\" aria-hidden=\"true\">\n {num(counts[k])}\n </span>\n <span className=\"ty-diff__stat-word\" aria-hidden=\"true\">\n {l.stats[k]}\n </span>\n </button>\n ))}\n {comparison.divergentHashes !== undefined ? (\n <div className=\"ty-diff__stat\" data-static=\"true\">\n <span className=\"ty-diff__stat-number\">{typeof comparison.divergentHashes === 'number' ? num(comparison.divergentHashes) : comparison.divergentHashes}</span>\n <span className=\"ty-diff__stat-word\">{l.stats.hashes}</span>\n </div>\n ) : null}\n </div>\n {rows.length ? (\n <div className=\"ty-diff__scroll\" role=\"region\" aria-label={fill(l.summary, { a: a.label, b: b.label }, locale)} tabIndex={0}>\n <table className=\"ty-diff__table\">\n <thead>\n <tr>\n <th scope=\"col\">{l.item}</th>\n <th scope=\"col\">\n <span className=\"ty-visually-hidden\">{fill(l.valueIn, { edition: a.label }, locale)}</span>\n <span aria-hidden=\"true\">{a.label}</span>\n </th>\n <th scope=\"col\">\n <span className=\"ty-visually-hidden\">{fill(l.valueIn, { edition: b.label }, locale)}</span>\n <span aria-hidden=\"true\">{b.label}</span>\n </th>\n <th scope=\"col\">{l.change}</th>\n <th scope=\"col\">{l.who}</th>\n </tr>\n </thead>\n <tbody>\n {rows.map((r) => (\n <tr key={r.itemId} data-change={r.change} data-selected={selectedId === r.itemId || undefined} onClick={() => select(r.itemId)}>\n <th scope=\"row\" className=\"ty-diff__item\">\n <button\n type=\"button\"\n className=\"ty-diff__pick\"\n aria-pressed={selectedId === r.itemId}\n onClick={(e) => {\n e.stopPropagation()\n select(r.itemId)\n }}\n >\n {r.label}\n </button>\n </th>\n <td>{value(r.a)}</td>\n <td>{value(r.b)}</td>\n <td>{swatch(r.change)}</td>\n <td>{r.who ? <ActorMark actor={r.who} /> : <span className=\"ty-diff__absent\">{l.unknownActor}</span>}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n ) : (\n <p className=\"ty-diff__empty\">{l.noRows}</p>\n )}\n <h3 className=\"ty-diff__eyebrow\">{l.selected}</h3>\n <div className=\"ty-diff__cards\" aria-label={l.selected} role=\"group\" aria-live=\"polite\">\n {current ? (\n (['a', 'b'] as const).map((side) => {\n const note = side === 'a' ? current.aNote : current.bNote\n return (\n <article key={side} className=\"ty-diff__card\" data-side={side} data-change={current.change}>\n <p className=\"ty-diff__card-edition\">{fill(side === 'a' ? l.before : l.after, { edition: side === 'a' ? a.label : b.label }, locale)}</p>\n <p className=\"ty-diff__card-value\">\n <span className=\"ty-diff__card-label\">{current.label}</span> = {value(current[side])}\n </p>\n {note ? <p className=\"ty-diff__card-note\">{note}</p> : null}\n {side === 'b' && (onOpenInGraph || onRequestReview) ? (\n <div className=\"ty-diff__card-actions\">\n {onOpenInGraph ? (\n <Button variant=\"secondary\" leadingIcon={<Share2 />} onPress={() => onOpenInGraph(current.itemId)}>\n {l.openInGraph}\n </Button>\n ) : null}\n {onRequestReview ? (\n <Button variant=\"quiet\" onPress={() => onRequestReview(current.itemId)}>\n {l.requestReview}\n </Button>\n ) : null}\n </div>\n ) : null}\n </article>\n )\n })\n ) : (\n <p className=\"ty-diff__empty\">{l.pickRow}</p>\n )}\n </div>\n </section>\n )\n}\n","// ProvenanceCertificate (\"Certificado\"): the obligation tree a deterministic\n// verifier checked for one claim, with the verdict and the facts needed to\n// reproduce it (verifier version, run time, input edition, certificate hash).\n\nimport { useMemo } from 'react'\nimport { Button as AriaButton, Tree, TreeItem, TreeItemContent, type Key } from 'react-aria-components'\nimport { Check, ChevronRight, CircleCheck, CircleX, FileDown, Hourglass, ShieldCheck } from 'lucide-react'\nimport { Button } from '../../index'\nimport { ProofPill } from './ProvenanceNode'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { ObligationStatus, ProofCertificate, ProofObligation } from './proofTypes'\n\nexport interface ProvenanceCertificateLabels {\n title: string\n tree: string\n facts: string\n verdict: string\n verifier: string\n ranAt: string\n inputEdition: string\n hash: string\n rerun: string\n rerunning: string\n download: string\n deterministic: string\n empty: string\n obligation: string\n status: Record<ObligationStatus, string>\n verdicts: Record<'proved' | 'pending' | 'refuted', string>\n obligationsTitle: string\n /** Verdict line beside the pill: how many obligations are still open. */\n openCount: string\n allHold: string\n}\n\nexport const provenanceCertificateLabels = defineLabels<ProvenanceCertificateLabels>('ProvenanceCertificate', {\n en: {\n title: 'Certificate',\n tree: 'Proof obligations of the claim',\n facts: 'Certificate details',\n verdict: 'Verdict',\n verifier: 'Verifier',\n ranAt: 'Run at',\n inputEdition: 'Input edition',\n hash: 'Certificate hash',\n rerun: 'Run again',\n rerunning: 'Running',\n download: 'Download certificate',\n deterministic: 'The verifier is deterministic: the same edition and rules always give the same certificate. It uses no language model.',\n empty: 'No certificate for this item yet.',\n obligation: '{label}, {status}',\n status: { ok: 'holds', pending: 'pending', failed: 'fails' },\n verdicts: { proved: 'proved', pending: 'pending', refuted: 'refuted' },\n obligationsTitle: 'Proof obligations',\n openCount: '{pending, plural, =0 {} one {# obligation pending} other {# obligations pending}}{failed, plural, =0 {} one { · # fails} other { · # fail}}',\n allHold: 'every obligation holds',\n },\n 'pt-BR': {\n title: 'Certificado',\n tree: 'Obrigações da prova da afirmação',\n facts: 'Dados do certificado',\n verdict: 'Veredito',\n verifier: 'Verificador',\n ranAt: 'Rodou em',\n inputEdition: 'Edição de entrada',\n hash: 'Hash do certificado',\n rerun: 'Rodar de novo',\n rerunning: 'Rodando',\n download: 'Baixar certificado',\n deterministic: 'O verificador é determinístico: a mesma edição e as mesmas regras dão sempre o mesmo certificado. Ele não usa modelo de linguagem.',\n empty: 'Ainda não há certificado para este item.',\n obligation: '{label}, {status}',\n status: { ok: 'cumprida', pending: 'pendente', failed: 'falhou' },\n verdicts: { proved: 'provada', pending: 'pendente', refuted: 'refutada' },\n obligationsTitle: 'Obrigações da prova',\n openCount: '{pending, plural, =0 {} one {# obrigação pendente} other {# obrigações pendentes}}{failed, plural, =0 {} one { · # falhou} other { · # falharam}}',\n allHold: 'todas as obrigações cumpridas',\n },\n es: {\n title: 'Certificado',\n tree: 'Obligaciones de prueba de la afirmación',\n facts: 'Datos del certificado',\n verdict: 'Veredicto',\n verifier: 'Verificador',\n ranAt: 'Ejecutado el',\n inputEdition: 'Edición de entrada',\n hash: 'Hash del certificado',\n rerun: 'Ejecutar de nuevo',\n rerunning: 'Ejecutando',\n download: 'Descargar certificado',\n deterministic: 'El verificador es determinista: la misma edición y las mismas reglas dan siempre el mismo certificado. No usa ningún modelo de lenguaje.',\n empty: 'Todavía no hay certificado para este elemento.',\n obligation: '{label}, {status}',\n status: { ok: 'cumplida', pending: 'pendiente', failed: 'falla' },\n verdicts: { proved: 'probada', pending: 'pendiente', refuted: 'refutada' },\n obligationsTitle: 'Obligaciones de prueba',\n openCount: '{pending, plural, =0 {} one {# obligación pendiente} other {# obligaciones pendientes}}{failed, plural, =0 {} one { · # falla} other { · # fallan}}',\n allHold: 'todas las obligaciones se cumplen',\n },\n})\n\nexport const defaultProvenanceCertificateLabels = provenanceCertificateLabels.bundles.en\n\nexport interface ProvenanceCertificateProps {\n certificate: ProofCertificate | null\n onRerun?: () => void\n onDownload?: () => void\n busy?: boolean\n labels?: Partial<ProvenanceCertificateLabels>\n className?: string\n}\n\nconst STATUS_ICON = { ok: CircleCheck, pending: Hourglass, failed: CircleX } as const\n\nfunction allKeys(list: readonly ProofObligation[], prefix: string): string[] {\n return list.flatMap((o) => [`${prefix}/${o.id}`, ...allKeys(o.children ?? [], `${prefix}/${o.id}`)])\n}\n\nexport function ProvenanceCertificate({ certificate, onRerun, onDownload, busy = false, labels, className }: ProvenanceCertificateProps) {\n const l = useLabels(provenanceCertificateLabels, labels)\n const { locale } = useFlowLocale()\n const expanded = useMemo<Key[]>(() => (certificate ? ['root', ...allKeys(certificate.obligations, 'root')] : []), [certificate])\n\n if (!certificate) {\n return (\n <section className={['ty-cert', className].filter(Boolean).join(' ')} aria-label={l.title}>\n <p className=\"ty-cert__empty\">\n <ShieldCheck aria-hidden=\"true\" focusable=\"false\" />\n <span>{l.empty}</span>\n </p>\n </section>\n )\n }\n\n const open = countOpen(certificate.obligations)\n const ranAt = Number.isFinite(Date.parse(certificate.ranAt)) ? new Intl.DateTimeFormat(locale, { dateStyle: 'medium', timeStyle: 'medium' }).format(Date.parse(certificate.ranAt)) : certificate.ranAt\n\n const obligationRow = (o: ProofObligation, key: string) => {\n const Icon = STATUS_ICON[o.status]\n return (\n <TreeItem key={key} id={key} textValue={fill(l.obligation, { label: o.label, status: l.status[o.status] }, locale)} className=\"ty-cert__item\">\n <TreeItemContent>\n {({ hasChildItems }) => (\n <div className=\"ty-cert__row\" data-status={o.status}>\n {hasChildItems ? (\n <AriaButton slot=\"chevron\" className=\"ty-cert__chevron\">\n <ChevronRight aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n ) : (\n <span className=\"ty-cert__spacer\" aria-hidden=\"true\" />\n )}\n <Icon className=\"ty-cert__icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-cert__text\">\n <span className=\"ty-cert__label\">{o.label}</span>\n {o.detail ? (\n <code className=\"ty-cert__detail\" dir=\"ltr\">\n {o.detail}\n </code>\n ) : null}\n </span>\n <span className=\"ty-cert__status\">{l.status[o.status]}</span>\n </div>\n )}\n </TreeItemContent>\n {(o.children ?? []).map((c) => obligationRow(c, `${key}/${c.id}`))}\n </TreeItem>\n )\n }\n\n return (\n <section className={['ty-cert', className].filter(Boolean).join(' ')} aria-label={l.title}>\n <div className=\"ty-cert__main\">\n <h3 className=\"ty-cert__heading\">{l.obligationsTitle}</h3>\n <Tree aria-label={l.tree} className=\"ty-cert__tree\" defaultExpandedKeys={expanded}>\n <TreeItem id=\"root\" textValue={`${certificate.claim}, ${l.verdicts[certificate.verdict]}`} className=\"ty-cert__item\" data-root=\"\">\n <TreeItemContent>\n {() => (\n <div className=\"ty-cert__row ty-cert__row--root\" data-status={certificate.verdict === 'proved' ? 'ok' : certificate.verdict === 'refuted' ? 'failed' : 'pending'}>\n <AriaButton slot=\"chevron\" className=\"ty-cert__chevron\">\n <ChevronRight aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n {(() => {\n const Icon = STATUS_ICON[certificate.verdict === 'proved' ? 'ok' : certificate.verdict === 'refuted' ? 'failed' : 'pending']\n return <Icon className=\"ty-cert__icon\" aria-hidden=\"true\" focusable=\"false\" />\n })()}\n <span className=\"ty-cert__text\">\n <span className=\"ty-cert__claim\" dir=\"auto\">\n {certificate.claim}\n </span>\n {certificate.note ? (\n <code className=\"ty-cert__detail\" dir=\"auto\">\n {certificate.note}\n </code>\n ) : null}\n </span>\n <span className=\"ty-cert__status\">{l.verdicts[certificate.verdict]}</span>\n </div>\n )}\n </TreeItemContent>\n {certificate.obligations.map((o) => obligationRow(o, `root/${o.id}`))}\n </TreeItem>\n </Tree>\n </div>\n <aside className=\"ty-cert__side\" aria-label={l.facts}>\n <span className=\"ty-cert__eyebrow\">{l.verdict}</span>\n <div className=\"ty-cert__verdict\">\n <ProofPill state={certificate.verdict} word={l.verdicts[certificate.verdict]} />\n <span className=\"ty-cert__open\">{open.pending || open.failed ? fill(l.openCount, open, locale) : l.allHold}</span>\n </div>\n <p className=\"ty-cert__note\">{l.deterministic}</p>\n <dl className=\"ty-cert__facts\">\n <div>\n <dt>{l.verifier}</dt>\n <dd className=\"ty-cert__mono\" dir=\"ltr\">\n {certificate.verifier}\n </dd>\n </div>\n <div>\n <dt>{l.ranAt}</dt>\n <dd className=\"ty-cert__mono\">\n <time dateTime={certificate.ranAt}>{ranAt}</time>\n </dd>\n </div>\n <div>\n <dt>{l.inputEdition}</dt>\n <dd className=\"ty-cert__mono\" dir=\"ltr\">\n {certificate.inputEdition}\n </dd>\n </div>\n <div>\n <dt>{l.hash}</dt>\n <dd className=\"ty-cert__mono ty-cert__hash\" dir=\"ltr\">\n {certificate.hash}\n </dd>\n </div>\n </dl>\n <div className=\"ty-cert__actions\">\n {onRerun ? (\n <Button variant=\"secondary\" leadingIcon={<Check />} busy={busy} busyLabel={l.rerunning} onPress={onRerun}>\n {l.rerun}\n </Button>\n ) : null}\n {onDownload ? (\n <Button variant=\"quiet\" leadingIcon={<FileDown />} onPress={onDownload}>\n {l.download}\n </Button>\n ) : null}\n </div>\n </aside>\n </section>\n )\n}\n\n/** Pending and failed obligations, at every level. */\nfunction countOpen(list: readonly ProofObligation[]): { pending: number; failed: number } {\n return list.reduce(\n (acc, o) => {\n const inner = countOpen(o.children ?? [])\n return { pending: acc.pending + inner.pending + (o.status === 'pending' ? 1 : 0), failed: acc.failed + inner.failed + (o.status === 'failed' ? 1 : 0) }\n },\n { pending: 0, failed: 0 },\n )\n}\n","// ProvenanceTimeline (\"Linha do tempo\"): the same provenance items laid out\n// by who acted and when. One lane per actor; events sit on one shared time\n// axis that runs in the reading direction. Each lane is a list of event\n// buttons in time order; arrow keys move along a lane (Left/Right, mirrored\n// in RTL) and between lanes (Up/Down).\n\nimport { useMemo, useRef, type KeyboardEvent, type ReactNode } from 'react'\nimport { ProofPill, ActorMark } from './ProvenanceNode'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport type { ProvActor, ProvItem } from './model'\n\nexport interface ProvenanceTimelineLabels {\n title: string\n axis: string\n undated: string\n noItems: string\n agentWord: string\n systemWord: string\n personWord: string\n laneName: string\n event: string\n detail: string\n noSelection: string\n when: string\n kindWord: string\n proofWord: string\n ids: string\n kinds: Record<string, string>\n proof: Record<'proved' | 'pending' | 'refuted' | 'not_disclosed' | 'none', string>\n}\n\nconst kindsEn = { query: 'query', retrieval: 'retrieval', source: 'source', assertion: 'assertion', record: 'record', verification: 'verification', analysis: 'analysis', edition: 'edition', manuscript: 'manuscript sentence' }\n\nexport const provenanceTimelineLabels = defineLabels<ProvenanceTimelineLabels>('ProvenanceTimeline', {\n en: {\n title: 'Timeline',\n axis: 'Time',\n undated: 'Without a date',\n noItems: 'Nothing to place on the timeline.',\n agentWord: 'agent',\n systemWord: 'system',\n personWord: 'person',\n laneName: '{name}, {kind}, {count, plural, one {# event} other {# events}}',\n event: '{kind}: {title}, {proof}, {time}',\n detail: 'Selected event',\n noSelection: 'Choose an event to see its details.',\n when: 'When',\n kindWord: 'Kind',\n proofWord: 'Proof',\n ids: 'Identifiers',\n kinds: kindsEn,\n proof: { proved: 'proved', pending: 'pending', refuted: 'refuted', not_disclosed: 'not disclosed', none: 'no proof' },\n },\n 'pt-BR': {\n title: 'Linha do tempo',\n axis: 'Tempo',\n undated: 'Sem data',\n noItems: 'Nada para pôr na linha do tempo.',\n agentWord: 'agente',\n systemWord: 'sistema',\n personWord: 'pessoa',\n laneName: '{name}, {kind}, {count, plural, one {# evento} other {# eventos}}',\n event: '{kind}: {title}, {proof}, {time}',\n detail: 'Evento selecionado',\n noSelection: 'Escolha um evento para ver os detalhes.',\n when: 'Quando',\n kindWord: 'Tipo',\n proofWord: 'Prova',\n ids: 'Identificadores',\n kinds: { query: 'busca', retrieval: 'leitura', source: 'fonte', assertion: 'afirmação', record: 'registro', verification: 'verificação', analysis: 'análise', edition: 'edição', manuscript: 'frase do manuscrito' },\n proof: { proved: 'provada', pending: 'pendente', refuted: 'refutada', not_disclosed: 'não informada', none: 'sem prova' },\n },\n es: {\n title: 'Línea de tiempo',\n axis: 'Tiempo',\n undated: 'Sin fecha',\n noItems: 'No hay nada que poner en la línea de tiempo.',\n agentWord: 'agente',\n systemWord: 'sistema',\n personWord: 'persona',\n laneName: '{name}, {kind}, {count, plural, one {# evento} other {# eventos}}',\n event: '{kind}: {title}, {proof}, {time}',\n detail: 'Evento seleccionado',\n noSelection: 'Elija un evento para ver sus detalles.',\n when: 'Cuándo',\n kindWord: 'Tipo',\n proofWord: 'Prueba',\n ids: 'Identificadores',\n kinds: { query: 'búsqueda', retrieval: 'lectura', source: 'fuente', assertion: 'afirmación', record: 'registro', verification: 'verificación', analysis: 'análisis', edition: 'edición', manuscript: 'frase del manuscrito' },\n proof: { proved: 'probada', pending: 'pendiente', refuted: 'refutada', not_disclosed: 'no informada', none: 'sin prueba' },\n },\n})\n\nexport const defaultProvenanceTimelineLabels = provenanceTimelineLabels.bundles.en\n\nexport interface ProvenanceTimelineProps {\n items: readonly ProvItem[]\n selectedId?: string | null\n defaultSelectedId?: string | null\n onSelect?: (id: string) => void\n labels?: Partial<ProvenanceTimelineLabels>\n /** Words for a time (axis ticks and the detail panel); Intl dates by default. */\n formatTime?: (time: number, use: 'tick' | 'detail') => string\n /** Actions under the selected event (for example \"See the answer\"). */\n renderDetailActions?: (item: ProvItem) => ReactNode\n className?: string\n}\n\ninterface Lane {\n key: string\n actor: ProvActor | null\n dated: Array<{ item: ProvItem; time: number }>\n undated: ProvItem[]\n}\n\nconst ROW_HEIGHT = 40\nconst MAX_TICKS = 8\n\nfunction laneKey(a: ProvActor | undefined): string {\n return a ? `${a.kind}:${a.id ?? a.name}` : 'unattributed'\n}\n\nexport function ProvenanceTimeline({ items, selectedId: selectedProp, defaultSelectedId = null, onSelect, labels, formatTime, renderDetailActions, className }: ProvenanceTimelineProps) {\n const l = useLabels(provenanceTimelineLabels, labels)\n const [selectedId, setSelected] = useControllable<string | null>(selectedProp, defaultSelectedId, (id) => {\n if (id) onSelect?.(id)\n })\n const { locale, rtl } = useFlowLocale()\n const rootRef = useRef<HTMLElement>(null)\n\n const { lanes, min, max } = useMemo(() => {\n const byKey = new Map<string, Lane>()\n let lo = Infinity\n let hi = -Infinity\n for (const item of items) {\n const key = laneKey(item.actor)\n if (!byKey.has(key)) byKey.set(key, { key, actor: item.actor ?? null, dated: [], undated: [] })\n const lane = byKey.get(key)!\n const t = item.at ? Date.parse(item.at) : NaN\n if (Number.isFinite(t)) {\n lane.dated.push({ item, time: t })\n lo = Math.min(lo, t)\n hi = Math.max(hi, t)\n } else lane.undated.push(item)\n }\n for (const lane of byKey.values()) lane.dated.sort((a, b) => a.time - b.time)\n // Lanes in order of their first act, undated-only lanes last.\n const ordered = [...byKey.values()].sort((a, b) => (a.dated[0]?.time ?? Infinity) - (b.dated[0]?.time ?? Infinity))\n return { lanes: ordered, min: lo, max: hi }\n }, [items])\n\n const span = Number.isFinite(min) && max > min ? max - min : 0\n // Events keep a margin at both ends of the axis so none hangs over the edge.\n const at = (t: number) => (span ? 6 + ((t - min) / span) * 76 : 40)\n /** Stack events that are close in time into rows so their labels never overlap. */\n const rowsOf = (dated: ReadonlyArray<{ item: ProvItem; time: number }>) => {\n const ends: number[] = []\n return dated.map(({ time }) => {\n const x = at(time)\n let row = ends.findIndex((end) => x - end >= 20)\n if (row < 0) row = ends.length\n ends[row] = x\n return row\n })\n }\n const dateFmt = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }), [locale])\n const timeFmt = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'medium', timeStyle: 'short' }), [locale])\n // Ticks where something happened (distinct dates), thinned to a few.\n const ticks = useMemo(() => {\n const all = [...new Set(lanes.flatMap((ln) => ln.dated.map((d) => d.time)))].sort((a, b) => a - b)\n // Keep ticks far enough apart that their words never touch.\n const kept: number[] = []\n for (const t of all) if (!kept.length || at(t) - at(kept[kept.length - 1]!) >= 11) kept.push(t)\n return kept.slice(0, MAX_TICKS)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [lanes, min, span])\n const tickWord = (t: number) => (formatTime ? formatTime(t, 'tick') : dateFmt.format(t))\n const detailWord = (t: number) => (formatTime ? formatTime(t, 'detail') : timeFmt.format(t))\n\n const selected = selectedId ? (items.find((i) => i.id === selectedId) ?? null) : null\n const kindWord = (k: string) => l.kinds[k] ?? k\n const actorWord = (a: ProvActor | null) => (!a ? l.systemWord : a.kind === 'agent' ? l.agentWord : a.kind === 'system' ? l.systemWord : l.personWord)\n\n const onKeyDown = (e: KeyboardEvent<HTMLElement>) => {\n const target = e.target as HTMLElement\n if (target.dataset.tyProvTimelineEvent === undefined) return\n const root = rootRef.current\n if (!root) return\n const lanesEls = [...root.querySelectorAll<HTMLElement>('[data-ty-prov-timeline-lane]')]\n const laneEl = target.closest<HTMLElement>('[data-ty-prov-timeline-lane]')\n const laneIdx = laneEl ? lanesEls.indexOf(laneEl) : -1\n const inLane = laneEl ? [...laneEl.querySelectorAll<HTMLElement>('[data-ty-prov-timeline-event]')] : []\n const idx = inLane.indexOf(target)\n const forwardKey = rtl ? 'ArrowLeft' : 'ArrowRight'\n const backKey = rtl ? 'ArrowRight' : 'ArrowLeft'\n let next: HTMLElement | undefined\n if (e.key === forwardKey) next = inLane[idx + 1]\n else if (e.key === backKey) next = inLane[idx - 1]\n else if (e.key === 'Home') next = inLane[0]\n else if (e.key === 'End') next = inLane[inLane.length - 1]\n else if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const other = lanesEls[laneIdx + (e.key === 'ArrowDown' ? 1 : -1)]\n if (other) {\n // Nearest event in time on the other lane.\n const t = Number(target.dataset.tyTime ?? NaN)\n const candidates = [...other.querySelectorAll<HTMLElement>('[data-ty-prov-timeline-event]')]\n next = candidates.reduce<HTMLElement | undefined>((best, c) => {\n if (!best) return c\n const d = Math.abs(Number(c.dataset.tyTime ?? NaN) - t)\n const bd = Math.abs(Number(best.dataset.tyTime ?? NaN) - t)\n return Number.isFinite(d) && (!Number.isFinite(bd) || d < bd) ? c : best\n }, undefined)\n }\n } else return\n e.preventDefault()\n next?.focus()\n }\n\n const eventButton = (item: ProvItem, time: number | null, row = 0) => {\n const proofKey = item.proofState ?? 'none'\n const name = fill(l.event, { kind: kindWord(item.kind), title: item.title, proof: l.proof[proofKey], time: time === null ? l.undated : detailWord(time) }, locale)\n return (\n <li key={item.id} className=\"ty-prov-timeline__slot\" data-row={row} style={time === null ? undefined : { insetInlineStart: `${at(time)}%`, insetBlockStart: `${8 + row * ROW_HEIGHT}px` }}>\n <button\n type=\"button\"\n className=\"ty-prov-timeline__event\"\n data-ty-prov-timeline-event=\"\"\n data-ty-time={time ?? ''}\n data-selected={selectedId === item.id || undefined}\n aria-pressed={selectedId === item.id}\n aria-label={name}\n title={item.title}\n onClick={() => setSelected(item.id)}\n >\n <span className=\"ty-prov-timeline__dot\" aria-hidden=\"true\" />\n <span className=\"ty-prov-timeline__title\" aria-hidden=\"true\" dir=\"auto\">\n {item.title}\n </span>\n </button>\n </li>\n )\n }\n\n if (!items.length) {\n return (\n <section className={['ty-prov-timeline', className].filter(Boolean).join(' ')} aria-label={l.title}>\n <p className=\"ty-prov-timeline__empty\">{l.noItems}</p>\n </section>\n )\n }\n\n return (\n <section ref={rootRef} className={['ty-prov-timeline', className].filter(Boolean).join(' ')} aria-label={l.title} onKeyDown={onKeyDown}>\n <div className=\"ty-prov-timeline__lanes\">\n {ticks.length ? (\n <div className=\"ty-prov-timeline__axis\" aria-label={l.axis} role=\"group\">\n <span className=\"ty-prov-timeline__axis-gutter\" aria-hidden=\"true\" />\n <ol className=\"ty-prov-timeline__ticks\">\n {ticks.map((t, i) => (\n <li key={i} className=\"ty-prov-timeline__tick\" style={{ insetInlineStart: `${at(t)}%` }}>\n <time dateTime={new Date(t).toISOString()}>{tickWord(t)}</time>\n </li>\n ))}\n </ol>\n </div>\n ) : null}\n {lanes.map((lane) => {\n const headingId = `ty-prov-timeline-${lane.key.replace(/[^\\w-]/g, '_')}`\n const rows = rowsOf(lane.dated)\n const rowCount = Math.max(1, ...rows.map((r) => r + 1))\n const count = lane.dated.length + lane.undated.length\n return (\n <div key={lane.key} className=\"ty-prov-timeline__lane\" data-ty-prov-timeline-lane=\"\" data-actor-kind={lane.actor?.kind ?? 'system'}>\n <h3 className=\"ty-prov-timeline__lane-head\" id={headingId}>\n <span className=\"ty-visually-hidden\">{fill(l.laneName, { name: lane.actor?.name ?? l.systemWord, kind: actorWord(lane.actor), count }, locale)}</span>\n <span aria-hidden=\"true\" className=\"ty-prov-timeline__actor\">\n <ActorMark actor={lane.actor ?? { kind: 'system', name: l.systemWord }} />\n </span>\n </h3>\n <ol className=\"ty-prov-timeline__track\" aria-labelledby={headingId} style={{ minBlockSize: `${Math.max(112, 28 + rowCount * ROW_HEIGHT)}px` }}>\n {lane.dated.map(({ item, time }, i) => eventButton(item, time, rows[i]))}\n </ol>\n {lane.undated.length ? (\n <div className=\"ty-prov-timeline__undated\">\n <p className=\"ty-prov-timeline__undated-title\">{l.undated}</p>\n <ul className=\"ty-prov-timeline__undated-list\">{lane.undated.map((item) => eventButton(item, null))}</ul>\n </div>\n ) : null}\n </div>\n )\n })}\n </div>\n <aside className=\"ty-prov-timeline__detail\" aria-label={l.detail} aria-live=\"polite\">\n <span className=\"ty-prov-timeline__eyebrow\">{l.detail}</span>\n {selected ? (\n <>\n <h3 className=\"ty-prov-timeline__detail-title\" dir=\"auto\">\n {selected.title}\n </h3>\n {selected.actor ? <ActorMark actor={selected.actor} /> : null}\n <dl className=\"ty-prov-timeline__facts\">\n <div>\n <dt>{l.when}</dt>\n <dd data-mono=\"true\">{selected.at && Number.isFinite(Date.parse(selected.at)) ? <time dateTime={selected.at}>{detailWord(Date.parse(selected.at))}</time> : l.undated}</dd>\n </div>\n <div>\n <dt>{l.kindWord}</dt>\n <dd>{kindWord(selected.kind)}</dd>\n </div>\n <div>\n <dt>{l.proofWord}</dt>\n <dd>\n <ProofPill state={selected.proofState ?? 'none'} word={l.proof[selected.proofState ?? 'none']} size=\"small\" />\n </dd>\n </div>\n {(selected.meta ?? []).map((m, i) => (\n <div key={m}>\n <dt>{i === 0 ? l.ids : ''}</dt>\n <dd data-mono=\"true\" dir=\"ltr\">\n <code>{m}</code>\n </dd>\n </div>\n ))}\n {(selected.details ?? []).map((d) => (\n <div key={d.label}>\n <dt>{d.label}</dt>\n <dd data-mono={d.mono ? 'true' : undefined} dir={d.mono ? 'ltr' : 'auto'}>\n {d.value}\n </dd>\n </div>\n ))}\n </dl>\n {renderDetailActions ? <div className=\"ty-prov-timeline__actions\">{renderDetailActions(selected)}</div> : null}\n </>\n ) : (\n <p className=\"ty-prov-timeline__detail-empty\">{l.noSelection}</p>\n )}\n </aside>\n </section>\n )\n}\n","// ProvenanceGraph: \"where did this come from\". One question bar picks the\n// item in focus (any value, record, number or manuscript sentence); five\n// views show the same data:\n//\n// Graph horizontal bands in research order (search, reading,\n// source, assertion, base and verification, analysis,\n// edition, manuscript), the focus item's proof path down the\n// first column, everything else dimmed or hidden.\n// Tree the keyboard and screen-reader alternative (APG tree).\n// Timeline one lane per actor on a time axis.\n// Certificate the obligation tree the verifier checked for a claim.\n// Compare what changed between two editions.\n//\n// The evidence panel (inspector) stays beside the graph and the tree. The\n// graph's filters (type, actor, proof), the steps back and forward and \"only\n// the proof path\" sit as chips in one row above the canvas with the line key;\n// the canvas tools (select, move, zoom, fit, rearrange, tree, export, find)\n// form a dock, drawn over the canvas or handed to the host (renderTools).\n// The question field and the view switch are exported on their own so a\n// host can place them in its page header (showQuestionBar={false}).\n//\n// Keys on a focused node: Up/Down move between bands along the relations\n// (towards the origin is Up), Left/Right move inside a band (mirrored in\n// RTL), Home/End go to the first/last node, Enter/Space select, Escape\n// returns to the question bar.\n\nimport { useCallback, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { ComboBox, Input, Label, ListBox, ListBoxItem, Popover as AriaPopover, Button as AriaButton, Radio, RadioGroup, Switch as AriaSwitch, Text } from 'react-aria-components'\nimport { ArrowDown, ArrowUp, Check, ChevronDown, FileDown, GitCompareArrows, Hourglass, ListTree } from 'lucide-react'\nimport { Button, EmptyState, InlineNotice, useMediaQuery } from '../../index'\nimport { kindTone } from '../catalog/palette'\nimport { fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport type { Point } from '../model/types'\nimport { CanvasSurface } from '../surface/CanvasSurface'\nimport type { CanvasApi, ConnectorShape, NodeDragEvent, SurfaceConnector, SurfaceNode } from '../surface/types'\nimport { CanvasNodeSearch } from '../toolbar/CanvasNodeSearch'\nimport { CanvasToolbar } from '../toolbar/CanvasToolbar'\nimport { canvasToolItems, type CanvasToolItem } from '../toolbar/canvasTools'\nimport { EditionCompare } from './EditionCompare'\nimport { provenanceLabels, type ProvenanceLabels } from './labels'\nimport {\n bandGeometryFrom,\n bandLayout,\n DEFAULT_BANDS,\n type BandGeometry,\n EMPTY_FILTERS,\n isDeep,\n proofKeyOf,\n proofPath,\n provenanceView,\n readingOrder,\n searchableText,\n type ProofKey,\n type ProvActor,\n type ProvFilters,\n type ProvItem,\n type ProvLink,\n type ProvStatement,\n type ProvVertex,\n} from './model'\nimport type { EditionComparison, ProofCertificate } from './proofTypes'\nimport { ProvenanceCertificate } from './ProvenanceCertificate'\nimport { FilterChips } from './ProvenanceFilters'\nimport { ProvenanceInspector } from './ProvenanceInspector'\nimport { ProvenanceLegend } from './ProvenanceLegend'\nimport { ActorNode, ProvenanceNode } from './ProvenanceNode'\nimport { ProvenanceTimeline } from './ProvenanceTimeline'\nimport { ProvenanceTree } from './ProvenanceTree'\n\nexport type ProvenanceViewMode = 'graph' | 'tree' | 'timeline' | 'certificate' | 'compare'\n\nexport interface ProvenanceGraphProps {\n items: readonly ProvItem[]\n statements: readonly ProvStatement[]\n /** Actors that statements attribute items to (needed only to draw actors as nodes). */\n actors?: readonly ProvActor[]\n focusId?: string | null\n defaultFocusId?: string | null\n onFocusChange?: (id: string | null) => void\n selectedId?: string | null\n defaultSelectedId?: string | null\n onSelect?: (id: string | null) => void\n /** Steps towards origins. */\n back?: number\n defaultBack?: number\n onBackChange?: (n: number) => void\n /** Steps towards uses. */\n forward?: number\n defaultForward?: number\n onForwardChange?: (n: number) => void\n /** Show only the focus item's proof path. */\n onlyProofPath?: boolean\n defaultOnlyProofPath?: boolean\n onOnlyProofPathChange?: (on: boolean) => void\n view?: ProvenanceViewMode\n defaultView?: ProvenanceViewMode\n onViewChange?: (v: ProvenanceViewMode) => void\n filters?: ProvFilters\n defaultFilters?: ProvFilters\n onFiltersChange?: (f: ProvFilters) => void\n /** Largest number of steps offered in each direction. */\n maxHops?: number\n /** Certificates by claim id (the focus or the selected item). */\n certificates?: Readonly<Record<string, ProofCertificate>>\n onRerunCertificate?: (claimId: string) => void\n onDownloadCertificate?: (claimId: string) => void\n certificateBusy?: boolean\n /** Two editions to compare. */\n comparison?: EditionComparison | null\n onReread?: (id: string) => void\n onRequestVerification?: (id: string) => void\n loading?: boolean\n /** Error message in plain words (the view then shows it with a retry). */\n error?: string | null\n onRetry?: () => void\n /** Keep the graph's reading start on the left even in RTL locales. */\n keepLtr?: boolean\n labels?: Partial<ProvenanceLabels>\n /** Page title shown at the start of the question row (for example \"Proveniência\"). */\n title?: string\n /** Mono breadcrumb above the title (organisation / project / id). */\n breadcrumb?: string\n /** `false` when the host shows ProvenanceQuestion and ProvenanceViewSwitch itself. */\n showQuestionBar?: boolean\n /** Host dock: receives the canvas tool items; a dock over the canvas otherwise. */\n renderTools?: (items: CanvasToolItem[]) => ReactNode\n /** \"Export PROV\" in the canvas tools. */\n onExport?: () => void\n /** Content at the end of the graph's chip row (for example a sample-data tag). */\n toolRowEnd?: ReactNode\n /** Words for times on the timeline (for example placeholders while dates are not known). */\n formatTime?: (time: number, use: 'tick' | 'detail') => string\n /** Actions under the selected timeline event. */\n timelineActions?: (item: ProvItem) => ReactNode\n /** \"Ask for a review\" on a compared change. */\n onRequestReview?: (itemId: string) => void\n /** Compared row selected at first. */\n defaultCompareItemId?: string | null\n className?: string\n}\n\nconst VIEWS: readonly ProvenanceViewMode[] = ['graph', 'tree', 'timeline', 'certificate', 'compare']\nconst PROV_RELATIONS_ORDER = ['wasDerivedFrom', 'wasAttributedTo', 'used', 'wasGeneratedBy'] as const\n\nfunction initialMatch(query: string, fallback: boolean): boolean {\n return typeof window !== 'undefined' && window.matchMedia ? window.matchMedia(query).matches : fallback\n}\n\nexport function ProvenanceGraph(props: ProvenanceGraphProps) {\n const { items, statements, actors = [], maxHops = 8, loading = false, error = null, onRetry, keepLtr = false, className } = props\n const l = useLabels(provenanceLabels, props.labels)\n const { locale, rtl } = useFlowLocale()\n const mirror = rtl && !keepLtr\n const wide = useMediaQuery('(min-width: 1024px)', true)\n\n const [focusId, setFocusId] = useControllable<string | null>(props.focusId, props.defaultFocusId ?? null, props.onFocusChange)\n const [selectedId, setSelectedIdRaw] = useControllable<string | null>(props.selectedId, props.defaultSelectedId ?? props.defaultFocusId ?? null, props.onSelect)\n const [back, setBack] = useControllable<number>(props.back, props.defaultBack ?? 3, props.onBackChange)\n const [forward, setForward] = useControllable<number>(props.forward, props.defaultForward ?? 1, props.onForwardChange)\n const [onlyPath, setOnlyPath] = useControllable<boolean>(props.onlyProofPath, props.defaultOnlyProofPath ?? false, props.onOnlyProofPathChange)\n const [view, setView] = useControllable<ProvenanceViewMode>(props.view, () => props.defaultView ?? (initialMatch('(min-width: 1024px)', true) ? 'graph' : 'tree'), props.onViewChange)\n const [filters, setFilters] = useControllable<ProvFilters>(props.filters, props.defaultFilters ?? EMPTY_FILTERS, props.onFiltersChange)\n // On phones the inspector is a sheet over the page: it opens on selection only.\n const [inspectorOpen, setInspectorOpen] = useState(() => initialMatch('(min-width: 1024px)', true))\n const [mode, setMode] = useState<'select' | 'pan'>('select')\n const [zoom, setZoom] = useState(1)\n const [searchOpen, setSearchOpen] = useState(false)\n const [moved, setMoved] = useState<ReadonlyMap<string, Point>>(new Map())\n const [layoutRun, setLayoutRun] = useState(0)\n const pendingFocus = useRef<string | null>(null)\n const rootRef = useRef<HTMLDivElement>(null)\n const [geometry, setGeometry] = useState<BandGeometry>(DEFAULT_BANDS)\n // Band sizes come from the --ty-flow-* tokens, so a theme or density can change them.\n useLayoutEffect(() => {\n const g = bandGeometryFrom(rootRef.current)\n setGeometry((prev) => (JSON.stringify(prev) === JSON.stringify(g) ? prev : g))\n }, [])\n\n const api = useRef<CanvasApi | null>(null)\n const barRef = useRef<HTMLDivElement>(null)\n const canvasRef = useRef<HTMLDivElement>(null)\n const searchAnchor = useRef<HTMLElement | null>(null)\n const dragBase = useRef<Map<string, Point>>(new Map())\n\n const fullView = useMemo(() => provenanceView(items, statements, actors, { focusId, back, forward, filters }), [items, statements, actors, focusId, back, forward, filters])\n const path = useMemo(() => proofPath(fullView, focusId), [fullView, focusId])\n const provView = useMemo(() => {\n if (!onlyPath || !path.nodes.size) return fullView\n return { ...fullView, vertices: fullView.vertices.filter((v) => path.nodes.has(v.id)), links: fullView.links.filter((lk) => path.links.has(lk.id)) }\n }, [fullView, onlyPath, path])\n const byId = useMemo(() => new Map(provView.vertices.map((v) => [v.id, v])), [provView])\n const linkById = useMemo(() => new Map(provView.links.map((lk) => [lk.id, lk])), [provView])\n const ordered = useMemo(() => readingOrder(items, statements), [items, statements])\n const hasPath = path.nodes.size > 1\n\n const setSelectedId = useCallback(\n (id: string | null) => {\n setSelectedIdRaw(id)\n if (id !== null) setInspectorOpen(true)\n },\n [setSelectedIdRaw],\n )\n\n // Band placement, then any node the person moved by hand.\n const bands = useMemo(() => bandLayout(provView, path.nodes, geometry, mirror), [provView, path, mirror, geometry])\n const layoutKey = `${focusId}|${back}|${forward}|${onlyPath}|${JSON.stringify(filters)}|${layoutRun}|${view}|${mirror}`\n\n const surfaceNodes = useMemo<SurfaceNode[]>(\n () =>\n provView.vertices.map((v) => {\n const p = moved.get(v.id) ?? bands.positions.get(v.id) ?? { x: 0, y: 0 }\n return { id: v.id, rect: { ...p, width: geometry.card.width, height: geometry.card.height }, selected: v.id === selectedId, tone: v.type === 'item' ? kindTone(v.item.kind) : 'neutral' }\n }),\n [provView, moved, bands, selectedId, geometry],\n )\n const surfaceConnectors = useMemo<SurfaceConnector[]>(() => provView.links.map((lk) => ({ id: lk.id, source: lk.source, target: lk.target })), [provView])\n\n const leaveCanvas = useCallback(() => {\n barRef.current?.querySelector<HTMLElement>('input, button, select, [tabindex=\"0\"]')?.focus()\n }, [])\n\n const moveFocusTo = useCallback((id: string | undefined) => {\n if (!id) return\n api.current?.reveal(id)\n api.current?.focusNode(id)\n }, [])\n\n const onNodeKey = useCallback(\n (id: string) => (e: KeyboardEvent<HTMLElement>) => {\n const here = bands.positions.get(id)\n const sameBand = provView.vertices\n .filter((v) => bands.positions.get(v.id)?.y === here?.y)\n .sort((a, b) => (bands.positions.get(a.id)!.x - bands.positions.get(b.id)!.x) * (mirror ? -1 : 1))\n const index = sameBand.findIndex((v) => v.id === id)\n const nextInBand = mirror ? 'ArrowLeft' : 'ArrowRight'\n const prevInBand = mirror ? 'ArrowRight' : 'ArrowLeft'\n const yOf = (other: string) => bands.positions.get(other)?.y ?? 0\n const neighbours = provView.links.flatMap((lk) => (lk.source === id ? [lk.target] : lk.target === id ? [lk.source] : []))\n let next: string | undefined\n if (e.key === 'ArrowUp') next = neighbours.filter((n) => yOf(n) < (here?.y ?? 0)).sort((a, b) => yOf(b) - yOf(a))[0]\n else if (e.key === 'ArrowDown') next = neighbours.filter((n) => yOf(n) > (here?.y ?? 0)).sort((a, b) => yOf(a) - yOf(b))[0]\n else if (e.key === nextInBand) next = sameBand[index + 1]?.id\n else if (e.key === prevInBand) next = sameBand[index - 1]?.id\n else if (e.key === 'Home') next = provView.vertices[0]?.id\n else if (e.key === 'End') next = provView.vertices[provView.vertices.length - 1]?.id\n else if (e.key === 'Escape') {\n e.preventDefault()\n leaveCanvas()\n return\n } else return\n e.preventDefault()\n moveFocusTo(next)\n },\n [bands, provView, mirror, leaveCanvas, moveFocusTo],\n )\n\n const onNodeDrag = useCallback(\n (e: NodeDragEvent) => {\n if (e.phase === 'start') {\n dragBase.current = new Map(e.ids.map((id) => [id, surfaceNodes.find((n) => n.id === id)?.rect ?? { x: 0, y: 0 }]))\n return\n }\n setMoved((prev) => {\n const next = new Map(prev)\n for (const [id, base] of dragBase.current) next.set(id, { x: base.x + e.delta.x, y: base.y + e.delta.y })\n return next\n })\n },\n [surfaceNodes],\n )\n\n const renderConnector = useCallback(\n (c: SurfaceConnector, shape: ConnectorShape) => {\n const link = linkById.get(c.id) as ProvLink\n const onPathLink = path.links.has(link.id)\n const dim = hasPath && !onPathLink && !(path.ahead.has(link.source) && (path.ahead.has(link.target) || path.nodes.has(link.target)))\n // The relation is carried by the line style (legend in the tool row) and\n // spelled out in the inspector and the tree; no word sits on the line,\n // so it never covers a card between two close bands.\n return {\n svg: (\n <path className=\"ty-prov-link\" data-relation={link.relation} data-on-path={onPathLink ? 'true' : undefined} data-dimmed={dim ? 'true' : undefined} d={shape.d} markerEnd=\"url(#ty-surface-arrow)\">\n <title>{l.relations[link.relation]}</title>\n </path>\n ),\n }\n },\n [linkById, l, path, hasPath],\n )\n\n const renderNode = useCallback(\n (n: SurfaceNode) => {\n const v = byId.get(n.id) as ProvVertex\n const activate = () => setSelectedId(n.id)\n const onPathNode = path.nodes.has(n.id)\n return v.type === 'item' ? (\n <ProvenanceNode\n item={v.item}\n labels={l}\n locale={locale}\n selected={n.id === selectedId}\n onPath={hasPath && onPathNode}\n focused={n.id === focusId}\n dimmed={hasPath && !onPathNode && !path.ahead.has(n.id)}\n onActivate={activate}\n onKeyDown={onNodeKey(n.id)}\n />\n ) : (\n <ActorNode actor={v.actor} labels={l} locale={locale} selected={n.id === selectedId} onActivate={activate} onKeyDown={onNodeKey(n.id)} />\n )\n },\n [byId, l, locale, selectedId, setSelectedId, onNodeKey, path, hasPath, focusId],\n )\n\n // Band backgrounds and labels, drawn under the nodes in canvas units.\n const bandOverlay = (\n <div className=\"ty-prov-bands\" aria-hidden=\"true\">\n {bands.bands.map((b) => (\n <div\n key={b.key}\n className=\"ty-prov-band\"\n data-parity={b.row % 2 ? 'odd' : 'even'}\n style={{ transform: `translate(${-4000}px, ${b.row * geometry.band}px)`, width: bands.width + 8000, height: geometry.band }}\n />\n ))}\n {bands.bands.map((b) => (\n <span\n key={`label-${b.key}`}\n className=\"ty-prov-band__label\"\n style={{ transform: `translate(${bands.labelX}px, ${b.row * geometry.band}px)`, width: geometry.label, height: geometry.band }}\n >\n <span className=\"ty-prov-band__number\">{new Intl.NumberFormat(locale).format(b.row + 1)}</span>\n <span className=\"ty-prov-band__name\">{l.lanes[b.key]}</span>\n </span>\n ))}\n </div>\n )\n\n const openInGraph = useCallback(\n (id: string) => {\n setSelectedId(id)\n pendingFocus.current = id\n setView('graph')\n },\n [setSelectedId, setView],\n )\n\n const bindApi = useCallback(\n (handle: CanvasApi | null) => {\n api.current = handle\n const id = pendingFocus.current\n if (handle && id) {\n pendingFocus.current = null\n requestAnimationFrame(() => moveFocusTo(id))\n }\n },\n [moveFocusTo],\n )\n\n const baseTools = canvasToolItems({\n zoom,\n mode,\n onModeChange: setMode,\n onZoomIn: () => api.current?.zoomIn(),\n onZoomOut: () => api.current?.zoomOut(),\n onZoomReset: () => api.current?.zoomTo(1),\n onFit: () => api.current?.fit(),\n onAutoLayout: () => {\n setMoved(new Map())\n setLayoutRun((r) => r + 1)\n },\n onToggleListView: () => setView('tree'),\n onSearch: () => {\n searchAnchor.current = (document.activeElement as HTMLElement | null) ?? null\n setSearchOpen(true)\n },\n labels: { listView: l.toolTree },\n locale,\n })\n // Export sits with \"find\", before the search.\n const tools: CanvasToolItem[] = props.onExport\n ? [...baseTools.slice(0, -1), { id: 'export', label: l.toolExport, icon: FileDown, kind: 'action', group: 'find', onPress: props.onExport }, ...baseTools.slice(-1)]\n : baseTools\n\n const presentProof = useMemo(() => {\n const seen = new Set<ProofKey>(provView.vertices.flatMap((v) => (v.type === 'item' ? [proofKeyOf(v.item)] : [])))\n return (['proved', 'pending', 'refuted', 'not_disclosed', 'none'] as const).filter((k) => seen.has(k))\n }, [provView])\n\n const selectedVertex = selectedId ? (byId.get(selectedId) ?? fullView.vertices.find((v) => v.id === selectedId)) : undefined\n const hopOptions = Array.from({ length: maxHops + 1 }, (_, i) => String(i))\n const viewNames: Record<ProvenanceViewMode, string> = { graph: l.viewGraph, tree: l.viewTree, timeline: l.viewTimeline, certificate: l.viewCertificate, compare: l.viewCompare }\n\n void viewNames\n const question =\n props.showQuestionBar === false ? null : (\n <div className=\"ty-prov__bar\" role=\"group\" aria-label={l.queryBar} ref={barRef}>\n {props.title ? (\n <div className=\"ty-prov__heading\">\n {props.breadcrumb ? <p className=\"ty-prov__crumb\">{props.breadcrumb}</p> : null}\n <h1 className=\"ty-prov__title\">{props.title}</h1>\n </div>\n ) : null}\n <ProvenanceQuestion\n items={ordered}\n value={focusId}\n labels={l}\n onChange={(id) => {\n setFocusId(id)\n setSelectedId(id)\n }}\n />\n <ProvenanceViewSwitch value={view} onChange={setView} labels={l} />\n </div>\n )\n\n const shell = (state: string, body: ReactNode) => (\n <div className={['ty-prov', className].filter(Boolean).join(' ')} data-state={state} {...(state === 'loading' ? { 'aria-busy': true } : {})}>\n {body}\n </div>\n )\n if (loading) {\n return shell(\n 'loading',\n <>\n <p className=\"ty-prov__status\" role=\"status\">\n {l.loading}\n </p>\n <div className=\"ty-prov__ghosts\" aria-hidden=\"true\">\n <span className=\"ty-prov__ghost\" />\n <span className=\"ty-prov__ghost\" />\n <span className=\"ty-prov__ghost\" />\n </div>\n </>,\n )\n }\n if (error) {\n return shell(\n 'error',\n <InlineNotice tone=\"danger\" title={l.errorTitle} titleAs=\"h2\" urgency=\"assertive\" actions={onRetry ? <Button onPress={onRetry}>{l.retry}</Button> : undefined}>\n {error}\n </InlineNotice>,\n )\n }\n if (!items.length) return shell('empty', <EmptyState title={l.emptyTitle} description={l.emptyText} framing=\"section\" />)\n\n const notices: Array<{ key: string; tone: 'info' | 'warning'; text: string }> = []\n if (fullView.focusFiltered) notices.push({ key: 'filtered', tone: 'info', text: l.focusFiltered })\n else if (fullView.focusIsolated) notices.push({ key: 'isolated', tone: 'info', text: l.isolated })\n else if (!provView.vertices.length) notices.push({ key: 'none', tone: 'info', text: l.noMatches })\n if (isDeep(provView, Math.max(back, forward))) notices.push({ key: 'deep', tone: 'warning', text: fill(l.deep, { count: provView.vertices.length }, locale) })\n\n const inspector =\n inspectorOpen && selectedVertex ? (\n <ProvenanceInspector\n vertex={selectedVertex}\n view={fullView}\n labels={l}\n locale={locale}\n onSelect={(id) => setSelectedId(id)}\n {...(!wide ? { onClose: () => setInspectorOpen(false) } : {})}\n {...(props.onReread ? { onReread: props.onReread } : {})}\n {...(props.onRequestVerification ? { onRequestVerification: props.onRequestVerification } : {})}\n {...(props.formatTime ? { formatTime: props.formatTime } : {})}\n />\n ) : null\n\n const presentRelations = PROV_RELATIONS_ORDER.filter((r) => provView.links.some((lk) => lk.relation === r))\n void presentProof\n const graphRow = (\n <div className=\"ty-prov__tools\" data-ty-canvas-exit=\"\">\n <FilterChips value={filters} onChange={setFilters} labels={l} locale={locale} canShowActors={actors.some((a) => !!a.id)} />\n <span className=\"ty-prov-chip ty-prov-hops\" role=\"group\" aria-label={l.hops} data-disabled={focusId ? undefined : 'true'}>\n <ArrowUp className=\"ty-prov-hops__arrow\" aria-hidden=\"true\" focusable=\"false\" />\n <select className=\"ty-prov-hops__select\" aria-label={l.hopsBack} value={String(back)} onChange={(e) => setBack(Number(e.target.value))} disabled={!focusId}>\n {hopOptions.map((o) => (\n <option key={o} value={o}>\n {o}\n </option>\n ))}\n </select>\n <span aria-hidden=\"true\">·</span>\n <ArrowDown className=\"ty-prov-hops__arrow\" aria-hidden=\"true\" focusable=\"false\" />\n <select className=\"ty-prov-hops__select\" aria-label={l.hopsForward} value={String(forward)} onChange={(e) => setForward(Number(e.target.value))} disabled={!focusId}>\n {hopOptions.map((o) => (\n <option key={o} value={o}>\n {o}\n </option>\n ))}\n </select>\n <span className=\"ty-prov-hops__word\">{l.hopsWord}</span>\n </span>\n <AriaSwitch className=\"ty-prov-chip ty-prov-only-path\" isSelected={onlyPath} onChange={setOnlyPath} isDisabled={!hasPath}>\n {l.onlyPath}\n </AriaSwitch>\n <span className=\"ty-prov__spacer\" />\n <p className=\"ty-visually-hidden\" role=\"status\">\n {fill(l.count, { count: provView.vertices.length }, locale)}\n </p>\n <ProvenanceLegend labels={l} states={[]} relations={presentRelations.length ? presentRelations : undefined} variant=\"inline\" />\n {props.toolRowEnd}\n </div>\n )\n const dock = props.renderTools ? props.renderTools(tools) : <CanvasToolbar className=\"ty-prov-dock\" items={tools} label={l.graphName} placement=\"dock\" exitTarget={false} />\n\n const certificateFor = (focusId && props.certificates?.[focusId]) || (selectedId && props.certificates?.[selectedId]) || null\n\n let main: ReactNode\n if (view === 'graph') {\n main = (\n <div className=\"ty-prov__main\" ref={canvasRef}>\n {graphRow}\n <CanvasSurface\n label={l.graphName}\n roleDescription={l.graphRole}\n nodes={surfaceNodes}\n connectors={surfaceConnectors}\n renderNode={renderNode}\n renderConnector={renderConnector}\n overlay={bandOverlay}\n floating\n fitKey={layoutKey}\n fit=\"resize\"\n fitAlign=\"start\"\n fitInclude={{ x: 0, y: 0, width: bands.width, height: bands.height }}\n fitPadding={16}\n minFitZoom={0.55}\n minimap={provView.vertices.length > 12}\n mode={mode}\n dragNodes={mode === 'select'}\n onNodeDrag={onNodeDrag}\n onViewportChange={(v) => setZoom(v.zoom)}\n onEscape={() => false}\n onLeave={leaveCanvas}\n direction={mirror ? 'rtl' : 'ltr'}\n apiRef={bindApi}\n className=\"ty-prov__canvas\"\n data={{ 'data-path': hasPath ? 'true' : undefined }}\n >\n <CanvasNodeSearch\n isOpen={searchOpen}\n onOpenChange={setSearchOpen}\n triggerRef={searchAnchor}\n nodes={provView.vertices.map((v) =>\n v.type === 'item' ? { id: v.id, label: v.item.title, kindLabel: l.kinds[v.item.kind], keywords: v.item.meta?.join(' ') ?? '' } : { id: v.id, label: v.actor.name, kindLabel: l.actorKinds[v.actor.kind] },\n )}\n onPick={(id) => {\n setSelectedId(id)\n requestAnimationFrame(() => moveFocusTo(id))\n }}\n />\n {props.renderTools ? null : dock}\n </CanvasSurface>\n {props.renderTools ? dock : null}\n </div>\n )\n } else if (view === 'tree') {\n main = (\n <div className=\"ty-prov__main\">\n <div className=\"ty-prov__tree-only\">\n <ProvenanceTree view={fullView} focusId={focusId} selectedId={selectedId} onSelect={(id) => setSelectedId(id)} onOpenInGraph={openInGraph} labels={l} locale={locale} />\n </div>\n </div>\n )\n } else if (view === 'timeline') {\n main = (\n <div className=\"ty-prov__main\">\n <ProvenanceTimeline\n items={provView.vertices.flatMap((v) => (v.type === 'item' ? [v.item] : []))}\n selectedId={selectedId}\n onSelect={(id: string) => setSelectedId(id)}\n {...(props.formatTime ? { formatTime: props.formatTime } : {})}\n {...(props.timelineActions ? { renderDetailActions: props.timelineActions } : {})}\n />\n </div>\n )\n } else if (view === 'certificate') {\n main = (\n <div className=\"ty-prov__main\">\n <ProvenanceCertificate\n certificate={certificateFor}\n {...(certificateFor && props.onRerunCertificate ? { onRerun: () => props.onRerunCertificate!(certificateFor.claimId) } : {})}\n {...(certificateFor && props.onDownloadCertificate ? { onDownload: () => props.onDownloadCertificate!(certificateFor.claimId) } : {})}\n {...(props.certificateBusy !== undefined ? { busy: props.certificateBusy } : {})}\n />\n </div>\n )\n } else {\n main = (\n <div className=\"ty-prov__main\">\n {props.comparison ? (\n <EditionCompare\n comparison={props.comparison}\n {...(props.defaultCompareItemId ? { defaultSelectedItemId: props.defaultCompareItemId } : {})}\n onOpenInGraph={(id) => (items.some((i) => i.id === id) ? openInGraph(id) : setView('graph'))}\n {...(props.onRequestReview ? { onRequestReview: props.onRequestReview } : {})}\n />\n ) : <EmptyState title={l.viewCompare} description={l.noComparison} framing=\"section\" />}\n </div>\n )\n }\n\n const showInspector = view === 'graph' || view === 'tree'\n return (\n <div ref={rootRef} className={['ty-prov', className].filter(Boolean).join(' ')} data-view={view} data-inspector-open={showInspector && inspector ? 'true' : 'false'} data-wide={wide ? 'true' : 'false'}>\n {question}\n {notices.map((n) => (\n <InlineNotice key={n.key} tone={n.tone} urgency=\"polite\" className=\"ty-prov__notice\">\n {n.text}\n </InlineNotice>\n ))}\n <div className=\"ty-prov__body\">\n {main}\n {showInspector ? inspector : null}\n </div>\n </div>\n )\n}\n\nconst VIEW_ICON: Record<ProvenanceViewMode, typeof ListTree> = { graph: ProvGlyph as unknown as typeof ListTree, tree: ListTree, timeline: Hourglass, certificate: Check, compare: GitCompareArrows }\n\n/** Three linked nodes, the provenance mark. */\nfunction ProvGlyph(props: { className?: string }) {\n return (\n <svg className={props.className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">\n <circle cx=\"5\" cy=\"6\" r=\"2\" />\n <circle cx=\"19\" cy=\"6\" r=\"2\" />\n <circle cx=\"12\" cy=\"18\" r=\"2\" />\n <path d=\"M7 6h10M6 8l5 8M18 8l-5 8\" />\n </svg>\n )\n}\n\nexport interface ProvenanceViewSwitchProps {\n value: ProvenanceViewMode\n onChange: (view: ProvenanceViewMode) => void\n labels?: Partial<ProvenanceLabels>\n /** Views offered, in order (all five by default). */\n views?: readonly ProvenanceViewMode[]\n className?: string\n}\n\n/** The five views as one radio group with icons (graph, tree, timeline, certificate, compare). */\nexport function ProvenanceViewSwitch({ value, onChange, labels, views = VIEWS, className }: ProvenanceViewSwitchProps) {\n const l = useLabels(provenanceLabels, labels)\n const names: Record<ProvenanceViewMode, string> = { graph: l.viewGraph, tree: l.viewTree, timeline: l.viewTimeline, certificate: l.viewCertificate, compare: l.viewCompare }\n return (\n <RadioGroup className={['ty-prov-views', className].filter(Boolean).join(' ')} aria-label={l.view} orientation=\"horizontal\" value={value} onChange={(v) => onChange(v as ProvenanceViewMode)}>\n {views.map((v) => {\n const Icon = VIEW_ICON[v]\n return (\n <Radio key={v} value={v} className=\"ty-prov-views__option\">\n <Icon className=\"ty-prov-views__icon\" aria-hidden=\"true\" />\n <span className=\"ty-prov-views__word\">{names[v]}</span>\n </Radio>\n )\n })}\n </RadioGroup>\n )\n}\n\nexport interface ProvenanceQuestionProps {\n items: readonly ProvItem[]\n value: string | null\n onChange: (id: string | null) => void\n labels?: Partial<ProvenanceLabels>\n /** Show the hint of what can be asked at the end of the field. */\n hint?: boolean\n className?: string\n}\n\n/** \"Where did this come from [item]\": a combobox over every item, matching titles, ids, values and quoted evidence. */\nexport function ProvenanceQuestion({ items, value, onChange, labels, hint = false, className }: ProvenanceQuestionProps) {\n const l = useLabels(provenanceLabels, labels)\n const [input, setInput] = useState<string | null>(null)\n const current = items.find((i) => i.id === value)\n const shown = input ?? (current ? current.title : '')\n const needle = (input ?? '').trim().toLocaleLowerCase()\n const options = needle ? items.filter((i) => searchableText(i).toLocaleLowerCase().includes(needle) || l.kinds[i.kind].toLocaleLowerCase().includes(needle)) : items\n return (\n <ComboBox\n className={['ty-prov-question', className].filter(Boolean).join(' ')}\n items={options}\n selectedKey={value}\n inputValue={shown}\n onInputChange={setInput}\n onSelectionChange={(key) => {\n setInput(null)\n if (key !== null) onChange(String(key))\n }}\n menuTrigger=\"focus\"\n allowsEmptyCollection\n >\n <div className=\"ty-prov-question__field\">\n <Label className=\"ty-prov-question__label\">{l.question}</Label>\n <Input className=\"ty-prov-question__input\" placeholder={l.questionHint} dir=\"auto\" onBlur={() => setInput(null)} />\n {hint ? (\n <span className=\"ty-prov-question__hint\" aria-hidden=\"true\">\n {l.questionField}\n </span>\n ) : null}\n <AriaButton className=\"ty-prov-question__button\">\n <ChevronDown aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n </div>\n <AriaPopover className=\"ty-prov-question__popover\" placement=\"bottom start\">\n <ListBox className=\"ty-prov-question__list\" renderEmptyState={() => <p className=\"ty-prov-question__empty\">{l.questionEmpty}</p>}>\n {(item: ProvItem) => (\n <ListBoxItem id={item.id} textValue={`${l.kinds[item.kind]}: ${item.title}`} className=\"ty-prov-question__option\">\n <Text slot=\"label\" className=\"ty-prov-question__option-title\">\n <span className=\"ty-prov-question__option-kind\">{l.kinds[item.kind]}</span> {item.title}\n </Text>\n {item.meta?.[0] ? (\n <Text slot=\"description\" className=\"ty-prov-question__option-meta\">\n <code dir=\"ltr\">{item.meta[0]}</code>\n </Text>\n ) : null}\n </ListBoxItem>\n )}\n </ListBox>\n </AriaPopover>\n </ComboBox>\n )\n}\n","// NumberTrace (\"where did this number come from?\"): a manuscript passage\n// whose numbers can be followed back to the records they came from. Each\n// traced number is a button; the selected one opens a panel beside the text\n// with the number, what it counts, and the numbered chain sentence → run →\n// edition → records → assertions, each link marked as holding or pending.\n\nimport { useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { Check, Hourglass, RotateCcw, Share2 } from 'lucide-react'\nimport { Button } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { NumberTraceStep, TracedNumber, TracedPassage } from './proofTypes'\n\nexport interface NumberTraceLabels {\n passage: string\n number: string\n panel: string\n chain: string\n close: string\n open: string\n status: Record<NumberTraceStep['status'], string>\n kinds: Record<string, string>\n selected: string\n openInGraph: string\n rerun: string\n}\n\nexport const numberTraceLabels = defineLabels<NumberTraceLabels>('NumberTrace', {\n en: {\n passage: 'Manuscript passage',\n number: 'number {value}, show its trace',\n panel: 'Where {value} comes from',\n chain: 'Chain from the sentence to the assertions',\n close: 'Close the trace',\n open: 'Open {title}',\n selected: 'Selected number',\n openInGraph: 'Open in the graph',\n rerun: 'Run again',\n status: { ok: 'holds', pending: 'pending' },\n kinds: { query: 'query', retrieval: 'retrieval', source: 'source', assertion: 'assertion', record: 'record', verification: 'verification', analysis: 'run', edition: 'edition', manuscript: 'sentence' },\n },\n 'pt-BR': {\n passage: 'Trecho do manuscrito',\n number: 'número {value}, mostrar a origem',\n panel: 'De onde vem {value}',\n chain: 'Cadeia da frase até as afirmações',\n close: 'Fechar a origem',\n open: 'Abrir {title}',\n selected: 'Número selecionado',\n openInGraph: 'Abrir no grafo',\n rerun: 'Reexecutar',\n status: { ok: 'confere', pending: 'pendente' },\n kinds: { query: 'busca', retrieval: 'leitura', source: 'fonte', assertion: 'afirmação', record: 'registro', verification: 'verificação', analysis: 'execução', edition: 'edição', manuscript: 'frase' },\n },\n es: {\n passage: 'Fragmento del manuscrito',\n number: 'número {value}, mostrar su origen',\n panel: 'De dónde viene {value}',\n chain: 'Cadena de la frase a las afirmaciones',\n close: 'Cerrar el origen',\n open: 'Abrir {title}',\n selected: 'Número seleccionado',\n openInGraph: 'Abrir en el grafo',\n rerun: 'Ejecutar de nuevo',\n status: { ok: 'coincide', pending: 'pendiente' },\n kinds: { query: 'búsqueda', retrieval: 'lectura', source: 'fuente', assertion: 'afirmación', record: 'registro', verification: 'verificación', analysis: 'ejecución', edition: 'edición', manuscript: 'frase' },\n },\n})\n\nexport const defaultNumberTraceLabels = numberTraceLabels.bundles.en\n\nexport interface NumberTraceProps {\n passage: TracedPassage\n /** Where the passage is (file, section), in mono above the text. */\n source?: string\n /** Text after the passage (the next paragraph, muted). */\n after?: ReactNode\n /** Number whose trace is open at first. */\n defaultOpenId?: string\n /** Makes each step of the chain a link-like button (for example to focus it in the graph). */\n onOpenStep?: (step: NumberTraceStep) => void\n /** \"Open in the graph\" for the selected number. */\n onOpenInGraph?: (n: TracedNumber) => void\n /** \"Run again\" for the selected number. */\n onRerun?: (n: TracedNumber) => void\n labels?: Partial<NumberTraceLabels>\n className?: string\n}\n\nconst STATUS_ICON = { ok: Check, pending: Hourglass } as const\n\nexport function NumberTrace({ passage, source, after, defaultOpenId, onOpenStep, onOpenInGraph, onRerun, labels, className }: NumberTraceProps) {\n const l = useLabels(numberTraceLabels, labels)\n const { locale } = useFlowLocale()\n const [open, setOpen] = useState<TracedNumber | null>(() => (defaultOpenId ? (passage.find((p): p is TracedNumber => typeof p !== 'string' && p.id === defaultOpenId) ?? null) : null))\n const opener = useRef<HTMLButtonElement | null>(null)\n const headingRef = useRef<HTMLHeadingElement>(null)\n const num = (n: number) => new Intl.NumberFormat(locale).format(n)\n\n const close = () => {\n setOpen(null)\n requestAnimationFrame(() => opener.current?.focus())\n }\n const onPanelKey = (e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault()\n e.stopPropagation()\n close()\n }\n }\n\n return (\n <div className={['ty-numtrace', className].filter(Boolean).join(' ')} data-open={open ? 'true' : undefined} role=\"group\" aria-label={l.passage}>\n <article className=\"ty-numtrace__article\">\n {source ? (\n <p className=\"ty-numtrace__source\" dir=\"ltr\">\n {source}\n </p>\n ) : null}\n <p className=\"ty-numtrace__text\" dir=\"auto\">\n {passage.map((part, i) =>\n typeof part === 'string' ? (\n <span key={i}>{part}</span>\n ) : (\n <button\n key={part.id}\n type=\"button\"\n className=\"ty-numtrace__number\"\n aria-label={fill(l.number, { value: part.text }, locale)}\n aria-expanded={open?.id === part.id}\n data-active={open?.id === part.id || undefined}\n onClick={(e) => {\n opener.current = e.currentTarget\n setOpen(part)\n requestAnimationFrame(() => headingRef.current?.focus())\n }}\n >\n {part.text}\n </button>\n ),\n )}\n </p>\n {after ? <div className=\"ty-numtrace__after\">{after}</div> : null}\n </article>\n {open ? (\n <section className=\"ty-numtrace__panel\" role=\"region\" aria-labelledby=\"ty-numtrace-heading\" onKeyDown={onPanelKey}>\n <h3 id=\"ty-numtrace-heading\" ref={headingRef} tabIndex={-1} className=\"ty-numtrace__eyebrow\">\n <span aria-hidden=\"true\">{l.selected}</span>\n <span className=\"ty-visually-hidden\">{fill(l.panel, { value: open.text }, locale)}</span>\n </h3>\n <p className=\"ty-numtrace__value\" aria-hidden=\"true\">\n {open.text}\n </p>\n {open.caption ? <p className=\"ty-numtrace__caption\">{open.caption}</p> : null}\n <ol className=\"ty-numtrace__chain\" aria-label={l.chain}>\n {open.chain.map((step, i) => {\n const Icon = STATUS_ICON[step.status]\n const body = (\n <>\n <span className=\"ty-visually-hidden\">{l.kinds[step.kind] ?? step.kind}: </span>\n <span className=\"ty-numtrace__step-title\" dir=\"auto\">\n {step.title}\n </span>\n {step.meta ? (\n <code className=\"ty-numtrace__meta\" dir=\"ltr\">\n {step.meta}\n </code>\n ) : null}\n </>\n )\n return (\n <li key={step.id} className=\"ty-numtrace__step\" data-status={step.status}>\n <span className=\"ty-numtrace__index\" aria-hidden=\"true\">\n {num(i + 1)}\n </span>\n {onOpenStep ? (\n <button type=\"button\" className=\"ty-numtrace__open\" aria-label={fill(l.open, { title: step.title }, locale)} onClick={() => onOpenStep(step)}>\n {body}\n </button>\n ) : (\n <span className=\"ty-numtrace__body\">{body}</span>\n )}\n <span className=\"ty-numtrace__status\">\n <Icon aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-visually-hidden\">{l.status[step.status]}</span>\n </span>\n </li>\n )\n })}\n </ol>\n {onOpenInGraph || onRerun ? (\n <div className=\"ty-numtrace__actions\">\n {onOpenInGraph ? (\n <Button variant=\"secondary\" leadingIcon={<Share2 />} onPress={() => onOpenInGraph(open)}>\n {l.openInGraph}\n </Button>\n ) : null}\n {onRerun ? (\n <Button variant=\"quiet\" leadingIcon={<RotateCcw />} onPress={() => onRerun(open)}>\n {l.rerun}\n </Button>\n ) : null}\n </div>\n ) : null}\n </section>\n ) : null}\n </div>\n )\n}\n","// Shape chips: a data shape as glyph + word on its tone (never colour alone),\n// and the \"takes → gives\" line of a step.\n\nimport { ArrowRight } from 'lucide-react'\nimport type { HTMLAttributes } from 'react'\nimport type { DataShape, ShapeWords } from './shapes'\nimport type { StepEditorWords } from './stepLabels'\n\nexport interface ShapeChipProps extends HTMLAttributes<HTMLSpanElement> {\n shapes: readonly DataShape[]\n words: ShapeWords\n}\n\n/** One outlined chip in the shape's colour; several accepted shapes share it (\"records / table\"). */\nexport function ShapeChip({ shapes, words, className, ...rest }: ShapeChipProps) {\n return (\n <span {...rest} className={['ty-shape-chip', className].filter(Boolean).join(' ')} data-shape={shapes.length === 1 ? shapes[0] : 'several'}>\n {shapes.map((s, i) => (\n <span key={s} className=\"ty-shape-chip__word\" data-shape={s}>\n {i > 0 ? '/' : ''}\n {words[s]}\n </span>\n ))}\n </span>\n )\n}\n\n/** \"records → table\" (or \"start → records\" for a source step). */\nexport function ShapeFlow({ inputs, output, words, labels, bare = false }: { inputs: ReadonlyArray<readonly DataShape[]>; output: DataShape | null; words: ShapeWords; labels: Pick<StepEditorWords, 'inputs' | 'output' | 'nothing' | 'origin'>; bare?: boolean }) {\n // Inputs taking the same shapes show once (\"table\" for a join of two tables).\n const distinct = inputs.filter((a, i) => inputs.findIndex((b) => b.join() === a.join()) === i)\n return (\n <span className=\"ty-shape-flow\">\n <span className=\"ty-visually-hidden\">{labels.inputs}: </span>\n {distinct.length ? distinct.map((accepts, i) => <ShapeChip key={i} shapes={accepts} words={words} />) : <span className={bare ? 'ty-visually-hidden' : 'ty-shape-flow__origin'}>{labels.origin}</span>}\n <ArrowRight className=\"ty-shape-flow__arrow\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-visually-hidden\">{labels.output}: </span>\n {output ? <ShapeChip shapes={[output]} words={words} /> : <span className=\"ty-shape-flow__none\">{labels.nothing}</span>}\n </span>\n )\n}\n","// Research steps: what a researcher adds to an analysis flow, shelved by\n// research verb (take in, prepare, analyse, decide, give out). A host may pass\n// its own shelves and steps; the built-in set below is the default. Engine\n// primitives (start, end, branch) stay reachable on a collapsed shelf.\n\nimport { Bot, ChartColumn, CornerDownRight, FileText, Filter, Flag, GitBranch, Hash, Lock, Play, Scale, Shapes, Sigma, Split, SunMedium, Table2, UserCheck } from 'lucide-react'\nimport type { IconComponent } from '../../index'\nimport { resolveIcon } from '../catalog/icons'\nimport { defineLabels, fill } from '../internal/labels'\nimport type { FlowNode } from '../model/types'\nimport type { DataShape } from './shapes'\n\n/** A value field of a step's configuration form. */\nexport interface StepField {\n key: string\n /**\n * `choice` picks one of `options` (the current value is always offered); `boolean` is a switch; `list` is a list of\n * short values typed with commas; `json` is structured text (objects, lists of objects, bindings).\n */\n type: 'text' | 'number' | 'choice' | 'boolean' | 'list' | 'json'\n /** Visible label; the built-in word for `key`, else the key. */\n label?: string\n /** Option values of a choice; each shows its built-in word `option.<value>` when there is one. */\n options?: readonly string[]\n /** The setting must be filled (marked on the field). */\n required?: boolean\n /** A number setting takes whole numbers only. */\n integer?: boolean\n}\n\nexport interface StepSpec {\n id: string\n /** Shelf id (research verb). */\n verb: string\n icon: IconComponent | string\n /** Node kind created on the canvas: 'step' unless an engine primitive. */\n kind?: string\n name?: string\n description?: string\n /** Accepted shapes per input, in port order (empty for a source step). */\n inputs: ReadonlyArray<readonly DataShape[]>\n output: DataShape | null\n usesAI?: boolean\n /** ICU template over the node data: the one-line summary on the card. */\n summary?: string\n fields?: readonly StepField[]\n /**\n * Where the fields live in the node data: at its top level (default), or inside one object of it (e.g. `config`,\n * as the host's graph stores a step's configuration). The card's summary reads the same place.\n */\n configIn?: string\n /** Problems of the step's settings, as the host words them, by field key ('' for the whole configuration). */\n check?: (values: Record<string, unknown>) => Record<string, string>\n defaults?: Record<string, unknown>\n /** Engine primitive: no typed ports. */\n primitive?: boolean\n}\n\nexport interface VerbShelf {\n id: string\n title?: string\n purpose?: string\n /** Starts folded (the engine primitives). */\n folded?: boolean\n}\n\nexport interface StepCatalog {\n shelves: readonly VerbShelf[]\n steps: readonly StepSpec[]\n}\n\n/** A spec with its words for the current locale. */\nexport interface ReadyStep extends Omit<StepSpec, 'icon'> {\n icon: IconComponent\n kind: string\n name: string\n description: string\n}\n\nexport interface ReadyShelf extends VerbShelf {\n title: string\n purpose: string\n steps: ReadyStep[]\n}\n\n// ---- built-in words ------------------------------------------------------\n\ntype Words = Record<string, string>\n\nexport const researchStepWords = defineLabels<Words>('researchSteps', {\n en: {\n 'shelf.input': 'Input', 'shelf.input.purpose': 'Where the data comes in',\n 'shelf.prepare': 'Prepare', 'shelf.prepare.purpose': 'Get the data ready',\n 'shelf.analyse': 'Analyse', 'shelf.analyse.purpose': 'Calculate',\n 'shelf.decide': 'Decide', 'shelf.decide.purpose': 'Recorded choices',\n 'shelf.output': 'Output', 'shelf.output.purpose': 'What becomes citable',\n 'shelf.advanced': 'Advanced', 'shelf.advanced.purpose': 'Engine pieces: start, end and branch',\n 'frozen-edition': 'Frozen edition', 'frozen-edition.about': 'records of a citable edition', 'frozen-edition.line': '{edition} · {count, plural, one {# record} other {# records}}',\n 'dataset': 'Dataset', 'dataset.about': 'imported table, with codebook', 'dataset.line': '{name}',\n 'instrument-answers': 'Instrument answers', 'instrument-answers.about': 'submitted answers, by assignment', 'instrument-answers.line': '{instrument}',\n 'filter': 'Filter', 'filter.about': 'keeps what meets a condition', 'filter.line': '{before} → {after} records',\n 'join': 'Join', 'join.about': 'joins two inputs on a key', 'join.line': 'on {key}',\n 'group': 'Group', 'group.about': 'groups by fields and summarises', 'group.line': 'by {keys}',\n 'recode': 'Recode', 'recode.about': 'maps values to categories', 'recode.line': '{column}: {scheme}',\n 'describe': 'Counts and descriptives', 'describe.about': 'frequencies, mean, median, CI', 'describe.line': '{counts}',\n 'reliability': 'Reliability', 'reliability.about': 'Krippendorff\\'s α, Gwet\\'s AC1', 'reliability.line': '{measure}',\n 'composite-index': 'Composite index', 'composite-index.about': 'declared × lived, gap per dimension', 'composite-index.line': '{formula}',\n 'person-decision': 'Decision by a person', 'person-decision.about': 'a person chooses between options', 'person-decision.line': '{question}',\n 'agent-decision': 'Decision by an agent', 'agent-decision.about': 'typed choice with probabilities', 'agent-decision.line': '{model}',\n 'rule': 'Rule', 'rule.about': 'deterministic condition, no model', 'rule.line': '{rule}',\n 'citable-table': 'Citable table', 'citable-table.about': 'with edition, version and hash', 'citable-table.line': '{caption}',\n 'citable-chart': 'Citable chart', 'citable-chart.about': 'Vega-Lite generated from the run', 'citable-chart.line': '{caption}',\n 'manuscript-number': 'Number for the manuscript', 'manuscript-number.about': 'links a value to a sentence', 'manuscript-number.line': '{name}',\n 'start': 'Start', 'start.about': 'Where the engine begins',\n 'end': 'End', 'end.about': 'Where the engine stops',\n 'branch': 'Branch', 'branch.about': 'Follows one of two paths',\n 'field.edition': 'Edition', 'field.count': 'Records', 'field.name': 'Name', 'field.instrument': 'Instrument', 'field.criterion': 'Condition', 'field.before': 'Records in', 'field.after': 'Records out', 'field.key': 'Key', 'field.keys': 'Group by', 'field.aggregate': 'Summary per group', 'field.column': 'Column', 'field.scheme': 'Scheme', 'field.counts': 'Counts', 'field.measure': 'Measure', 'field.formula': 'Formula', 'field.question': 'Question', 'field.model': 'Model', 'field.rule': 'Rule', 'field.caption': 'Caption',\n 'option.count': 'count of records', 'option.mean': 'mean', 'option.median': 'median',\n },\n 'pt-BR': {\n 'shelf.input': 'Entrada', 'shelf.input.purpose': 'Onde os dados entram',\n 'shelf.prepare': 'Preparar', 'shelf.prepare.purpose': 'Deixar os dados prontos',\n 'shelf.analyse': 'Analisar', 'shelf.analyse.purpose': 'Calcular',\n 'shelf.decide': 'Decidir', 'shelf.decide.purpose': 'Escolhas registradas',\n 'shelf.output': 'Saída', 'shelf.output.purpose': 'O que vira citável',\n 'shelf.advanced': 'Avançado', 'shelf.advanced.purpose': 'Peças do motor: início, fim e desvio',\n 'frozen-edition': 'Edição congelada', 'frozen-edition.about': 'registros de uma edição citável', 'frozen-edition.line': '{edition} · {count, plural, one {# registro} other {# registros}}',\n 'dataset': 'Conjunto de dados', 'dataset.about': 'tabela importada, com codebook', 'dataset.line': '{name}',\n 'instrument-answers': 'Respostas de instrumento', 'instrument-answers.about': 'respostas enviadas, por atribuição', 'instrument-answers.line': '{instrument}',\n 'filter': 'Filtrar', 'filter.about': 'mantém o que atende a uma condição', 'filter.line': '{before} → {after} registros',\n 'join': 'Juntar', 'join.about': 'une duas entradas por uma chave', 'join.line': 'por {key}',\n 'group': 'Agrupar', 'group.about': 'agrupa por campos e resume', 'group.line': 'por {keys}',\n 'recode': 'Recodificar', 'recode.about': 'mapeia valores para categorias', 'recode.line': '{column}: {scheme}',\n 'describe': 'Contagem e descritivas', 'describe.about': 'frequências, média, mediana, IC', 'describe.line': '{counts}',\n 'reliability': 'Confiabilidade', 'reliability.about': 'α de Krippendorff, AC1 de Gwet', 'reliability.line': '{measure}',\n 'composite-index': 'Índice composto', 'composite-index.about': 'declarado × vivido, lacuna por dimensão', 'composite-index.line': '{formula}',\n 'person-decision': 'Decisão por pessoa', 'person-decision.about': 'uma pessoa escolhe entre opções', 'person-decision.line': '{question}',\n 'agent-decision': 'Decisão por agente', 'agent-decision.about': 'escolha tipada com probabilidades', 'agent-decision.line': '{model}',\n 'rule': 'Regra', 'rule.about': 'condição determinística, sem modelo', 'rule.line': '{rule}',\n 'citable-table': 'Tabela citável', 'citable-table.about': 'com edição, versão e hash', 'citable-table.line': '{caption}',\n 'citable-chart': 'Gráfico citável', 'citable-chart.about': 'Vega-Lite gerado da execução', 'citable-chart.line': '{caption}',\n 'manuscript-number': 'Número para o manuscrito', 'manuscript-number.about': 'liga um valor a uma frase', 'manuscript-number.line': '{name}',\n 'start': 'Início', 'start.about': 'Onde o motor começa',\n 'end': 'Fim', 'end.about': 'Onde o motor para',\n 'branch': 'Desvio', 'branch.about': 'Segue por um de dois caminhos',\n 'field.edition': 'Edição', 'field.count': 'Registros', 'field.name': 'Nome', 'field.instrument': 'Instrumento', 'field.criterion': 'Condição', 'field.before': 'Registros de entrada', 'field.after': 'Registros de saída', 'field.key': 'Chave', 'field.keys': 'Agrupar por', 'field.aggregate': 'Resumo por grupo', 'field.column': 'Coluna', 'field.scheme': 'Esquema', 'field.counts': 'Contagens', 'field.measure': 'Medida', 'field.formula': 'Fórmula', 'field.question': 'Pergunta', 'field.model': 'Modelo', 'field.rule': 'Regra', 'field.caption': 'Legenda',\n 'option.count': 'contagem de registros', 'option.mean': 'média', 'option.median': 'mediana',\n },\n es: {\n 'shelf.input': 'Entrada', 'shelf.input.purpose': 'Dónde entran los datos',\n 'shelf.prepare': 'Preparar', 'shelf.prepare.purpose': 'Dejar los datos listos',\n 'shelf.analyse': 'Analizar', 'shelf.analyse.purpose': 'Calcular',\n 'shelf.decide': 'Decidir', 'shelf.decide.purpose': 'Elecciones registradas',\n 'shelf.output': 'Salida', 'shelf.output.purpose': 'Lo que se vuelve citable',\n 'shelf.advanced': 'Avanzado', 'shelf.advanced.purpose': 'Piezas del motor: inicio, fin y desvío',\n 'frozen-edition': 'Edición congelada', 'frozen-edition.about': 'registros de una edición citable', 'frozen-edition.line': '{edition} · {count, plural, one {# registro} other {# registros}}',\n 'dataset': 'Conjunto de datos', 'dataset.about': 'tabla importada, con libro de códigos', 'dataset.line': '{name}',\n 'instrument-answers': 'Respuestas de instrumento', 'instrument-answers.about': 'respuestas enviadas, por asignación', 'instrument-answers.line': '{instrument}',\n 'filter': 'Filtrar', 'filter.about': 'conserva lo que cumple una condición', 'filter.line': '{before} → {after} registros',\n 'join': 'Unir', 'join.about': 'une dos entradas por una clave', 'join.line': 'por {key}',\n 'group': 'Agrupar', 'group.about': 'agrupa por campos y resume', 'group.line': 'por {keys}',\n 'recode': 'Recodificar', 'recode.about': 'asigna valores a categorías', 'recode.line': '{column}: {scheme}',\n 'describe': 'Conteo y descriptivos', 'describe.about': 'frecuencias, media, mediana, IC', 'describe.line': '{counts}',\n 'reliability': 'Fiabilidad', 'reliability.about': 'α de Krippendorff, AC1 de Gwet', 'reliability.line': '{measure}',\n 'composite-index': 'Índice compuesto', 'composite-index.about': 'declarado × vivido, brecha por dimensión', 'composite-index.line': '{formula}',\n 'person-decision': 'Decisión de una persona', 'person-decision.about': 'una persona elige entre opciones', 'person-decision.line': '{question}',\n 'agent-decision': 'Decisión de un agente', 'agent-decision.about': 'elección tipada con probabilidades', 'agent-decision.line': '{model}',\n 'rule': 'Regla', 'rule.about': 'condición determinista, sin modelo', 'rule.line': '{rule}',\n 'citable-table': 'Tabla citable', 'citable-table.about': 'con edición, versión y hash', 'citable-table.line': '{caption}',\n 'citable-chart': 'Gráfico citable', 'citable-chart.about': 'Vega-Lite generado de la ejecución', 'citable-chart.line': '{caption}',\n 'manuscript-number': 'Número para el manuscrito', 'manuscript-number.about': 'vincula un valor a una frase', 'manuscript-number.line': '{name}',\n 'start': 'Inicio', 'start.about': 'Donde empieza el motor',\n 'end': 'Fin', 'end.about': 'Donde se detiene el motor',\n 'branch': 'Desvío', 'branch.about': 'Sigue uno de dos caminos',\n 'field.edition': 'Edición', 'field.count': 'Registros', 'field.name': 'Nombre', 'field.instrument': 'Instrumento', 'field.criterion': 'Condición', 'field.before': 'Registros de entrada', 'field.after': 'Registros de salida', 'field.key': 'Clave', 'field.keys': 'Agrupar por', 'field.aggregate': 'Resumen por grupo', 'field.column': 'Columna', 'field.scheme': 'Esquema', 'field.counts': 'Conteos', 'field.measure': 'Medida', 'field.formula': 'Fórmula', 'field.question': 'Pregunta', 'field.model': 'Modelo', 'field.rule': 'Regla', 'field.caption': 'Leyenda',\n 'option.count': 'conteo de registros', 'option.mean': 'media', 'option.median': 'mediana',\n },\n})\n\n// ---- built-in catalog ----------------------------------------------------\n\nconst f = (...keys: string[]): StepField[] => keys.map((key) => ({ key, type: key === 'count' || key === 'before' || key === 'coders' ? 'number' : 'text' }))\nconst R = ['records'] as const\nconst T = ['table'] as const\n\nconst BUILT_IN: StepCatalog = {\n shelves: [{ id: 'input' }, { id: 'prepare' }, { id: 'analyse' }, { id: 'decide' }, { id: 'output' }, { id: 'advanced', folded: true }],\n steps: [\n { id: 'frozen-edition', verb: 'input', icon: Lock, inputs: [], output: 'records', fields: f('edition', 'count') },\n { id: 'dataset', verb: 'input', icon: Table2, inputs: [], output: 'table', fields: f('name') },\n { id: 'instrument-answers', verb: 'input', icon: FileText, inputs: [], output: 'table', fields: f('instrument') },\n { id: 'filter', verb: 'prepare', icon: Filter, inputs: [R], output: 'records', fields: f('criterion', 'before', 'after') },\n { id: 'join', verb: 'prepare', icon: CornerDownRight, inputs: [T, T], output: 'table', fields: f('key') },\n { id: 'group', verb: 'prepare', icon: Split, inputs: [R], output: 'table', fields: [{ key: 'keys', type: 'choice' }, { key: 'aggregate', type: 'choice', options: ['count', 'mean', 'median'] }] },\n { id: 'recode', verb: 'prepare', icon: SunMedium, inputs: [R], output: 'records', fields: f('column', 'scheme') },\n { id: 'describe', verb: 'analyse', icon: Sigma, inputs: [T], output: 'table', fields: f('counts') },\n { id: 'reliability', verb: 'analyse', icon: ChartColumn, inputs: [T], output: 'number', fields: f('measure') },\n { id: 'composite-index', verb: 'analyse', icon: Shapes, inputs: [T], output: 'table', fields: f('formula') },\n { id: 'person-decision', verb: 'decide', icon: UserCheck, inputs: [R], output: 'decision', fields: f('question') },\n { id: 'agent-decision', verb: 'decide', icon: Bot, inputs: [R], output: 'decision', usesAI: true, fields: f('model') },\n { id: 'rule', verb: 'decide', icon: Scale, inputs: [R], output: 'decision', fields: f('rule') },\n { id: 'citable-table', verb: 'output', icon: Table2, inputs: [T], output: 'table', fields: f('caption') },\n { id: 'citable-chart', verb: 'output', icon: ChartColumn, inputs: [T], output: 'chart', fields: f('caption') },\n { id: 'manuscript-number', verb: 'output', icon: Hash, inputs: [['number']], output: 'number', fields: f('name') },\n { id: 'start', verb: 'advanced', icon: Play, kind: 'start', inputs: [], output: null, primitive: true },\n { id: 'end', verb: 'advanced', icon: Flag, kind: 'end', inputs: [], output: null, primitive: true },\n { id: 'branch', verb: 'advanced', icon: GitBranch, kind: 'if-else', inputs: [], output: null, primitive: true },\n ],\n}\nexport const researchStepCatalog: StepCatalog = Object.freeze(BUILT_IN)\n\n/** Node kind research steps are drawn with. */\nexport const STEP_KIND = 'step'\n\n/** Words for a catalog in one locale: host text wins, then the built-in words, then the id. */\nexport function readyCatalog(catalog: StepCatalog, words: Words): { shelves: ReadyShelf[]; steps: ReadyStep[]; byId: Map<string, ReadyStep> } {\n const steps: ReadyStep[] = catalog.steps.map((s) => ({\n ...s,\n icon: typeof s.icon === 'string' ? resolveIcon(s.icon) : s.icon,\n kind: s.kind ?? STEP_KIND,\n name: s.name ?? words[s.id] ?? s.id,\n description: s.description ?? words[`${s.id}.about`] ?? '',\n ...(s.summary ?? words[`${s.id}.line`] ? { summary: s.summary ?? words[`${s.id}.line`] } : {}),\n ...(s.fields ? { fields: s.fields.map((x) => ({ ...x, label: x.label ?? words[`field.${x.key}`] ?? x.key })) } : {}),\n }))\n const shelves = catalog.shelves.map((sh) => ({\n ...sh,\n title: sh.title ?? words[`shelf.${sh.id}`] ?? sh.id,\n purpose: sh.purpose ?? words[`shelf.${sh.id}.purpose`] ?? '',\n steps: steps.filter((s) => s.verb === sh.id),\n }))\n return { shelves, steps, byId: new Map(steps.map((s) => [s.id, s])) }\n}\n\n/** The spec a node was made from (research steps and the engine primitives). */\nexport function specOfNode(node: Pick<FlowNode, 'kind' | 'data'>, byId: ReadonlyMap<string, ReadyStep>): ReadyStep | undefined {\n if (node.kind === STEP_KIND) return typeof node.data.stepId === 'string' ? byId.get(node.data.stepId) : undefined\n for (const s of byId.values()) if (s.primitive && s.kind === node.kind) return s\n return undefined\n}\n\nconst SLOT = /\\{(\\w+)/g\n\n/** The values a step's fields edit: the node data, or the object of it named by `configIn`. */\nexport function settingsOf(step: Pick<ReadyStep, 'configIn'> | undefined, data: Record<string, unknown>): Record<string, unknown> {\n if (!step?.configIn) return data\n const inner = data[step.configIn]\n return inner && typeof inner === 'object' && !Array.isArray(inner) ? (inner as Record<string, unknown>) : {}\n}\n\n/** Problems of a node's settings by field key: the spec's own check, then what the host reports for this node. */\nexport function settingProblems(step: Pick<ReadyStep, 'configIn' | 'check'> | undefined, data: Record<string, unknown>, reported?: Record<string, string>): Record<string, string> {\n return { ...(step?.check ? step.check(settingsOf(step, data)) : {}), ...(reported ?? {}) }\n}\n\n/** The card's one-line summary (a host `line` wins), or null while a value it names is not set. */\nexport function summaryLine(step: Pick<ReadyStep, 'summary' | 'configIn'>, data: Record<string, unknown>, locale: string): string | null {\n if (typeof data.line === 'string' && data.line) return data.line\n if (!step.summary) return null\n const values: Record<string, string | number> = {}\n const settings = settingsOf(step, data)\n for (const [, key] of step.summary.matchAll(SLOT)) {\n const v = data[key!] ?? settings[key!]\n if (v === undefined || v === null || v === '') return null\n if (typeof v === 'string' || typeof v === 'number') values[key!] = v\n else return null\n }\n return fill(step.summary, values, locale)\n}\n","// Data shapes that travel between research steps. Every shape has a word, a\n// glyph and a tone, so a port chip never relies on colour alone.\n\nimport { ChartColumn, Hash, Rows3, Split, Table2 } from 'lucide-react'\nimport type { IconComponent } from '../../index'\nimport { defineLabels, fill } from '../internal/labels'\n\nexport type DataShape = 'records' | 'table' | 'number' | 'chart' | 'decision'\n\nexport const DATA_SHAPES: readonly DataShape[] = ['records', 'table', 'number', 'chart', 'decision']\n\nexport type ShapeWords = Record<DataShape, string>\n\nexport const shapeWords = defineLabels<ShapeWords>('dataShapes', {\n en: { records: 'records', table: 'table', number: 'number', chart: 'chart', decision: 'decision' },\n 'pt-BR': { records: 'registros', table: 'tabela', number: 'número', chart: 'gráfico', decision: 'decisão' },\n es: { records: 'registros', table: 'tabla', number: 'número', chart: 'gráfico', decision: 'decisión' },\n})\n\n/** Glyph of each shape (lists and menus; the chips carry the word only). */\nexport const SHAPE_LOOK: Readonly<Record<DataShape, { icon: IconComponent; tone: string }>> = Object.freeze({\n records: { icon: Rows3, tone: 'categorical-1' },\n table: { icon: Table2, tone: 'categorical-3' },\n number: { icon: Hash, tone: 'categorical-5' },\n chart: { icon: ChartColumn, tone: 'categorical-6' },\n decision: { icon: Split, tone: 'categorical-7' },\n})\n\n/** \"records / table\": the shapes one input accepts, in the reader's words. */\nexport function shapeList(shapes: readonly DataShape[], words: ShapeWords): string {\n return shapes.map((s) => words[s]).join(' / ')\n}\n\n/** Counted shapes (\"1 table · 2 charts\"), one ICU message per shape. */\nexport const shapeCountWords = defineLabels<ShapeWords>('dataShapeCounts', {\n en: { records: '{n, plural, one {# record set} other {# record sets}}', table: '{n, plural, one {# table} other {# tables}}', number: '{n, plural, one {# number} other {# numbers}}', chart: '{n, plural, one {# chart} other {# charts}}', decision: '{n, plural, one {# decision} other {# decisions}}' },\n 'pt-BR': { records: '{n, plural, one {# conjunto de registros} other {# conjuntos de registros}}', table: '{n, plural, one {# tabela} other {# tabelas}}', number: '{n, plural, one {# número} other {# números}}', chart: '{n, plural, one {# gráfico} other {# gráficos}}', decision: '{n, plural, one {# decisão} other {# decisões}}' },\n es: { records: '{n, plural, one {# conjunto de registros} other {# conjuntos de registros}}', table: '{n, plural, one {# tabla} other {# tablas}}', number: '{n, plural, one {# número} other {# números}}', chart: '{n, plural, one {# gráfico} other {# gráficos}}', decision: '{n, plural, one {# decisión} other {# decisiones}}' },\n})\n\n/** \"1 table · 1 chart\" for a list of output shapes, in shape order. */\nexport function shapeCounts(shapes: readonly DataShape[], words: ShapeWords, locale: string): string {\n return DATA_SHAPES.filter((s) => shapes.includes(s))\n .map((s) => fill(words[s], { n: shapes.filter((x) => x === s).length }, locale))\n .join(' · ')\n}\n","// Interface words of the research-step editor parts (palette, add picker,\n// card, issue bar, side panel, list view, dock items).\n\nimport { defineLabels } from '../internal/labels'\n\nexport interface StepEditorWords {\n paletteTitle: string\n search: string\n searchKey: string\n show: string\n all: string\n noAI: string\n recent: string\n ai: string\n aiOff: string\n noMatch: string\n noRecent: string\n dragHint: string\n dragItem: string\n addNamed: string\n pickerAfter: string\n pickerBetween: string\n pickerFree: string\n pickerSearch: string\n accepts: string\n nothingAccepts: string\n results: string\n addAfter: string\n notSet: string\n /** Card line when the step has configuration problems. */\n configIncomplete: string\n /** Error of a structured (JSON) setting that does not parse. */\n invalidJson: string\n /** Hint of a list setting. */\n valuesHint: string\n runOk: string\n runRunning: string\n runFailed: string\n mismatch: string\n nothing: string\n inputs: string\n origin: string\n pickerOnly: string\n pickerKeys: string\n eyebrowFlow: string\n eyebrowStep: string\n runsOn: string\n nothingSelected: string\n saved: string\n issueSentence: string\n andGets: string\n fixReplace: string\n stepName: string\n moreStep: string\n output: string\n dropHere: string\n issueCount: string\n fixInsert: string\n fixUnlink: string\n flowOk: string\n summaryTitle: string\n version: string\n runs: string\n stepCount: string\n usesAI: string\n yes: string\n no: string\n deterministic: string\n seed: string\n citable: string\n none: string\n runFlow: string\n validate: string\n validOk: string\n stepTitle: string\n preview: string\n noPreview: string\n testStep: string\n remove: string\n backToSummary: string\n listTitle: string\n listHint: string\n addHere: string\n more: string\n moveUp: string\n moveDown: string\n configure: string\n toolAdd: string\n toolArrange: string\n toolFit: string\n toolList: string\n toolSearch: string\n toolSelect: string\n toolPan: string\n added: string\n moved: string\n}\n\nexport const stepEditorWords = defineLabels<StepEditorWords>('stepEditor', {\n en: {\n origin: 'start', pickerOnly: 'Only steps that take', pickerKeys: '↑↓ choose · Enter adds and links · Esc closes', eyebrowFlow: 'Flow', eyebrowStep: 'Selected step', runsOn: 'Runs on', nothingSelected: 'Nothing selected. Click a step to configure it, or use + to add one.', saved: 'saved', issueSentence: '“{to}” expects', andGets: 'and gets', fixReplace: 'Replace with {step}', stepName: 'Step name', moreStep: 'More for this step', \n paletteTitle: 'Steps', search: 'Find a step', searchKey: 'Shortcut: /', show: 'Show', all: 'All', noAI: 'Without AI', recent: 'Recent',\n ai: 'AI', aiOff: 'AI is off in this project', noMatch: 'No step matches “{query}”', noRecent: 'Steps you add appear here', dragItem: 'Drag {name}',\n dragHint: 'Drag onto the canvas or press Enter', addNamed: 'Add {name}',\n pickerAfter: 'Add after “{name}”', pickerBetween: 'Insert between “{from}” and “{to}”', pickerFree: 'Add a step', pickerSearch: 'Find a step',\n accepts: 'Takes {shape}', nothingAccepts: 'No step takes {shape}', results: '{count, plural, =0 {No steps} one {# step} other {# steps}}',\n addAfter: 'Add a step after “{name}”', notSet: 'not configured', configIncomplete: 'configuration incomplete', invalidJson: 'Not valid JSON: {detail}', valuesHint: 'Separate the values with commas.', runOk: 'ok', runRunning: 'running', runFailed: 'failed',\n mismatch: 'expects {expects}; gets {gets}', nothing: 'nothing', inputs: 'Takes', output: 'Gives', dropHere: 'Drop to add “{name}”',\n issueCount: '{count, plural, one {# problem} other {# problems}}',\n fixInsert: 'Insert “{step}” between “{from}” and “{to}”', fixUnlink: 'Remove the link from “{from}” to “{to}”', flowOk: 'Every link fits',\n summaryTitle: 'Flow summary', version: 'Version', runs: 'Runs over the edition', stepCount: 'Steps', usesAI: 'Uses AI', yes: 'yes', no: 'no',\n deterministic: 'Deterministic', seed: 'seed {seed}', citable: 'Citable outputs', none: 'none', runFlow: 'Run over the edition', validate: 'Validate flow',\n validOk: 'No problems found', stepTitle: 'Title', preview: 'Output preview', noPreview: 'No preview yet. Test this step to see its output.',\n testStep: 'Test this step', remove: 'Remove', backToSummary: 'Back to the summary',\n listTitle: 'Flow steps', listHint: 'Arrows move, Alt+arrows reorder, A adds, Enter configures', addHere: 'Add a step here', more: 'More for “{name}”',\n moveUp: 'Move up', moveDown: 'Move down', configure: 'Configure',\n toolAdd: 'Add a step', toolArrange: 'Rearrange', toolFit: 'Fit to view', toolList: 'Show as list', toolSearch: 'Find a step', toolSelect: 'Select', toolPan: 'Move the view',\n added: '{name} added', moved: '{name} moved to position {position}',\n },\n 'pt-BR': {\n origin: 'início', pickerOnly: 'Só passos que aceitam', pickerKeys: '↑↓ escolhe · Enter adiciona e liga · Esc fecha', eyebrowFlow: 'Fluxo', eyebrowStep: 'Passo selecionado', runsOn: 'Roda sobre', nothingSelected: 'Nada selecionado. Clique num passo para configurá-lo, ou use + para adicionar.', saved: 'salvo', issueSentence: '“{to}” espera', andGets: 'e recebe', fixReplace: 'Trocar por {step}', stepName: 'Nome do passo', moreStep: 'Mais ações do passo', \n paletteTitle: 'Passos', search: 'Buscar passo', searchKey: 'Atalho: /', show: 'Mostrar', all: 'Todos', noAI: 'Sem IA', recent: 'Recentes',\n ai: 'IA', aiOff: 'IA desativada neste projeto', noMatch: 'Nenhum passo corresponde a “{query}”', noRecent: 'Os passos que você adicionar aparecem aqui', dragItem: 'Arrastar {name}',\n dragHint: 'Arraste para o canvas ou pressione Enter', addNamed: 'Adicionar {name}',\n pickerAfter: 'Adicionar depois de “{name}”', pickerBetween: 'Inserir entre “{from}” e “{to}”', pickerFree: 'Adicionar passo', pickerSearch: 'Buscar passo',\n accepts: 'Recebe {shape}', nothingAccepts: 'Nenhum passo recebe {shape}', results: '{count, plural, =0 {Nenhum passo} one {# passo} other {# passos}}',\n addAfter: 'Adicionar passo depois de “{name}”', notSet: 'não configurado', configIncomplete: 'configuração incompleta', invalidJson: 'JSON inválido: {detail}', valuesHint: 'Separe os valores por vírgula.', runOk: 'ok', runRunning: 'rodando', runFailed: 'falhou',\n mismatch: 'espera {expects}; recebe {gets}', nothing: 'nada', inputs: 'Recebe', output: 'Entrega', dropHere: 'Solte para adicionar “{name}”',\n issueCount: '{count, plural, one {# problema} other {# problemas}}',\n fixInsert: 'Inserir “{step}” entre “{from}” e “{to}”', fixUnlink: 'Remover a ligação de “{from}” para “{to}”', flowOk: 'Todas as ligações encaixam',\n summaryTitle: 'Resumo do fluxo', version: 'Versão', runs: 'Execuções sobre a edição', stepCount: 'Passos', usesAI: 'Usa IA', yes: 'sim', no: 'não',\n deterministic: 'Determinístico', seed: 'semente {seed}', citable: 'Saídas citáveis', none: 'nenhuma', runFlow: 'Executar sobre a edição', validate: 'Validar fluxo',\n validOk: 'Nenhum problema encontrado', stepTitle: 'Título', preview: 'Prévia da saída', noPreview: 'Ainda sem prévia. Teste este passo para ver a saída.',\n testStep: 'Testar este passo', remove: 'Remover', backToSummary: 'Voltar ao resumo',\n listTitle: 'Passos do fluxo', listHint: 'Setas movem, Alt+setas reordenam, A adiciona, Enter configura', addHere: 'Adicionar passo aqui', more: 'Mais ações para “{name}”',\n moveUp: 'Subir', moveDown: 'Descer', configure: 'Configurar',\n toolAdd: 'Adicionar passo', toolArrange: 'Reorganizar', toolFit: 'Ajustar à tela', toolList: 'Ver como lista', toolSearch: 'Buscar passo', toolSelect: 'Selecionar', toolPan: 'Mover',\n added: '{name} adicionado', moved: '{name} movido para a posição {position}',\n },\n es: {\n origin: 'inicio', pickerOnly: 'Solo pasos que aceptan', pickerKeys: '↑↓ elige · Enter añade y enlaza · Esc cierra', eyebrowFlow: 'Flujo', eyebrowStep: 'Paso seleccionado', runsOn: 'Se ejecuta sobre', nothingSelected: 'Nada seleccionado. Haz clic en un paso para configurarlo, o usa + para añadir.', saved: 'guardado', issueSentence: '“{to}” espera', andGets: 'y recibe', fixReplace: 'Cambiar por {step}', stepName: 'Nombre del paso', moreStep: 'Más acciones del paso', \n paletteTitle: 'Pasos', search: 'Buscar paso', searchKey: 'Atajo: /', show: 'Mostrar', all: 'Todos', noAI: 'Sin IA', recent: 'Recientes',\n ai: 'IA', aiOff: 'IA desactivada en este proyecto', noMatch: 'Ningún paso coincide con “{query}”', noRecent: 'Los pasos que añadas aparecen aquí', dragItem: 'Arrastrar {name}',\n dragHint: 'Arrastra al lienzo o pulsa Enter', addNamed: 'Añadir {name}',\n pickerAfter: 'Añadir después de “{name}”', pickerBetween: 'Insertar entre “{from}” y “{to}”', pickerFree: 'Añadir paso', pickerSearch: 'Buscar paso',\n accepts: 'Recibe {shape}', nothingAccepts: 'Ningún paso recibe {shape}', results: '{count, plural, =0 {Ningún paso} one {# paso} other {# pasos}}',\n addAfter: 'Añadir paso después de “{name}”', notSet: 'sin configurar', configIncomplete: 'configuración incompleta', invalidJson: 'JSON no válido: {detail}', valuesHint: 'Separa los valores con comas.', runOk: 'ok', runRunning: 'en curso', runFailed: 'falló',\n mismatch: 'espera {expects}; recibe {gets}', nothing: 'nada', inputs: 'Recibe', output: 'Entrega', dropHere: 'Suelta para añadir “{name}”',\n issueCount: '{count, plural, one {# problema} other {# problemas}}',\n fixInsert: 'Insertar “{step}” entre “{from}” y “{to}”', fixUnlink: 'Quitar el enlace de “{from}” a “{to}”', flowOk: 'Todos los enlaces encajan',\n summaryTitle: 'Resumen del flujo', version: 'Versión', runs: 'Ejecuciones sobre la edición', stepCount: 'Pasos', usesAI: 'Usa IA', yes: 'sí', no: 'no',\n deterministic: 'Determinista', seed: 'semilla {seed}', citable: 'Salidas citables', none: 'ninguna', runFlow: 'Ejecutar sobre la edición', validate: 'Validar flujo',\n validOk: 'No se encontraron problemas', stepTitle: 'Título', preview: 'Vista previa de la salida', noPreview: 'Aún sin vista previa. Prueba este paso para ver la salida.',\n testStep: 'Probar este paso', remove: 'Quitar', backToSummary: 'Volver al resumen',\n listTitle: 'Pasos del flujo', listHint: 'Flechas mueven, Alt+flechas reordenan, A añade, Enter configura', addHere: 'Añadir paso aquí', more: 'Más acciones para “{name}”',\n moveUp: 'Subir', moveDown: 'Bajar', configure: 'Configurar',\n toolAdd: 'Añadir paso', toolArrange: 'Reorganizar', toolFit: 'Ajustar a la vista', toolList: 'Ver como lista', toolSearch: 'Buscar paso', toolSelect: 'Seleccionar', toolPan: 'Mover',\n added: '{name} añadido', moved: '{name} movido a la posición {position}',\n },\n})\n","// What the step parts share inside one editor: the catalog with its words,\n// whether AI steps are allowed, the current wiring issues and the \"add after\"\n// action. The editor provides it; stand-alone parts fall back to defaults.\n\nimport { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport { useLabels } from '../internal/labels'\nimport { readyCatalog, researchStepCatalog, researchStepWords, type ReadyShelf, type ReadyStep, type StepCatalog } from './researchSteps'\nimport { shapeCountWords, shapeWords, type ShapeWords } from './shapes'\nimport { stepEditorWords, type StepEditorWords } from './stepLabels'\nimport type { WiringIssue } from './wiring'\n\nexport interface StepsRuntime {\n shelves: ReadyShelf[]\n steps: ReadyStep[]\n byId: ReadonlyMap<string, ReadyStep>\n aiAllowed: boolean\n words: StepEditorWords\n shapes: ShapeWords\n /** Counted shape messages (ICU, `n`). */\n counts: ShapeWords\n /** Wiring issues by receiving node id. */\n issues: ReadonlyMap<string, WiringIssue[]>\n /** Settings problems the host reported, by node id then field key. */\n problems: ReadonlyMap<string, Record<string, string>>\n /** Opens the add picker after a node, anchored to `trigger`. */\n addAfter?: (nodeId: string, trigger: HTMLElement) => void\n}\n\nconst Ctx = createContext<StepsRuntime | null>(null)\nconst EMPTY_ISSUES: ReadonlyMap<string, WiringIssue[]> = new Map()\nconst EMPTY_PROBLEMS: ReadonlyMap<string, Record<string, string>> = new Map()\n\nexport interface StepsProviderProps {\n catalog?: StepCatalog\n aiAllowed?: boolean\n issues?: ReadonlyMap<string, WiringIssue[]>\n problems?: ReadonlyMap<string, Record<string, string>>\n addAfter?: (nodeId: string, trigger: HTMLElement) => void\n words?: Partial<StepEditorWords>\n children: ReactNode\n}\n\n/** Catalog words resolved for the provider locale. */\nexport function useReadyCatalog(catalog: StepCatalog = researchStepCatalog) {\n const words = useLabels(researchStepWords, undefined)\n return useMemo(() => readyCatalog(catalog, words), [catalog, words])\n}\n\nexport function StepsProvider({ catalog, aiAllowed = true, issues, problems, addAfter, words, children }: StepsProviderProps) {\n const ready = useReadyCatalog(catalog)\n const w = useLabels(stepEditorWords, words)\n const shapes = useLabels(shapeWords, undefined)\n const counts = useLabels(shapeCountWords, undefined)\n const value = useMemo<StepsRuntime>(\n () => ({ ...ready, aiAllowed, words: w, shapes, counts, issues: issues ?? EMPTY_ISSUES, problems: problems ?? EMPTY_PROBLEMS, ...(addAfter ? { addAfter } : {}) }),\n [ready, aiAllowed, w, shapes, counts, issues, problems, addAfter],\n )\n return <Ctx.Provider value={value}>{children}</Ctx.Provider>\n}\n\n\n/** The runtime of the nearest StepsProvider, or the built-in catalog. */\nexport function useSteps(): StepsRuntime {\n const got = useContext(Ctx)\n const ready = useReadyCatalog()\n const words = useLabels(stepEditorWords, undefined)\n const shapes = useLabels(shapeWords, undefined)\n const counts = useLabels(shapeCountWords, undefined)\n return got ?? { ...ready, aiAllowed: true, words, shapes, counts, issues: EMPTY_ISSUES, problems: EMPTY_PROBLEMS }\n}\n","// AddStepPicker: \"Add after “…”\". Lists only the steps whose input takes what\n// the anchor step gives; type to narrow, ↑↓ to move, Enter to insert, Esc to\n// close. A popover on wide screens, a bottom drawer below 640 px.\n\nimport { useMemo, useState, type RefObject } from 'react'\nimport { Autocomplete, Dialog, Heading, Input, ListBox, ListBoxItem, Popover, SearchField, Text, useFilter } from 'react-aria-components'\nimport { Search } from 'lucide-react'\nimport { Drawer, useMediaQuery } from '../../index'\nimport { fill, useFlowLocale } from '../internal/labels'\nimport { ShapeChip } from './ShapeChip'\nimport type { DataShape } from './shapes'\nimport type { ReadyStep } from './researchSteps'\nimport { useSteps } from './StepsContext'\n\nexport interface AddStepPickerProps {\n /** Heading: after a step, between two steps, or free. */\n title: string\n /** Search placeholder (defaults to the title). */\n placeholder?: string\n /** Shape arriving at the new step (undefined: anything). */\n arriving?: DataShape | null\n options: readonly ReadyStep[]\n triggerRef: RefObject<HTMLElement | null>\n onPick: (stepId: string) => void\n onClose: () => void\n}\n\nfunction PickerBody({ title, placeholder, arriving, options, onPick, onClose, headed }: Omit<AddStepPickerProps, 'triggerRef'> & { headed: boolean }) {\n const rt = useSteps()\n const w = rt.words\n const { locale } = useFlowLocale()\n const { contains } = useFilter({ sensitivity: 'base' })\n const [query, setQuery] = useState('')\n const shown = useMemo(() => (query ? options.filter((o) => contains(`${o.name} ${o.description}`, query)) : [...options]), [options, query, contains])\n return (\n <div className=\"ty-add-picker__body\">\n {headed ? (\n <Heading slot=\"title\" className=\"ty-visually-hidden\">\n {title}\n </Heading>\n ) : null}\n <Autocomplete inputValue={query} onInputChange={setQuery} filter={() => true}>\n <SearchField className=\"ty-add-picker__field\" autoFocus aria-label={title}>\n <Search className=\"ty-add-picker__glass\" aria-hidden=\"true\" focusable=\"false\" />\n <Input className=\"ty-add-picker__input\" placeholder={placeholder ?? title} />\n </SearchField>\n {arriving ? (\n <p className=\"ty-add-picker__only\">\n <span>{w.pickerOnly}</span>\n <ShapeChip shapes={[arriving]} words={rt.shapes} />\n </p>\n ) : null}\n <ListBox\n className=\"ty-add-picker__list\"\n aria-label={title}\n items={shown}\n renderEmptyState={() => <p className=\"ty-add-picker__empty\">{arriving && !options.length ? fill(w.nothingAccepts, { shape: rt.shapes[arriving] }, locale) : fill(w.noMatch, { query }, locale)}</p>}\n onAction={(key) => {\n onPick(String(key))\n onClose()\n }}\n >\n {(item) => {\n const Icon = item.icon\n return (\n <ListBoxItem id={item.id} textValue={item.name} className=\"ty-add-picker__option\">\n <span className=\"ty-add-picker__tile\" aria-hidden=\"true\">\n <Icon focusable=\"false\" />\n </span>\n <Text slot=\"label\" className=\"ty-add-picker__name\">\n {item.name}\n </Text>\n <Text slot=\"description\" className=\"ty-add-picker__about\">\n {item.description}\n </Text>\n </ListBoxItem>\n )\n }}\n </ListBox>\n </Autocomplete>\n <p className=\"ty-add-picker__keys\" aria-hidden=\"true\">\n {w.pickerKeys}\n </p>\n <p className=\"ty-visually-hidden\" role=\"status\">\n {fill(w.results, { count: shown.length }, locale)}\n </p>\n </div>\n )\n}\n\nexport function AddStepPicker(props: AddStepPickerProps) {\n const narrow = !useMediaQuery('(min-width: 640px)', true)\n const { triggerRef, onClose, title } = props\n if (narrow) {\n return (\n <Drawer open onOpenChange={(open) => !open && onClose()} title={title} placement=\"bottom\">\n <PickerBody {...props} headed={false} />\n </Drawer>\n )\n }\n return (\n <Popover isOpen onOpenChange={(open) => !open && onClose()} triggerRef={triggerRef} placement=\"bottom start\" offset={10} className=\"ty-add-picker\">\n <Dialog className=\"ty-add-picker__dialog\">\n <PickerBody {...props} headed />\n </Dialog>\n </Popover>\n )\n}\n","// FlowSidePanel: the editor's inline-end panel. With nothing selected it\n// sums the flow up (version, the edition it runs on, steps, AI use,\n// determinism, citable outputs by shape) with \"run\" and \"validate\"; with a\n// step selected it shows the step's settings, a preview of its output and\n// \"test\" / \"remove\".\n\nimport { ArrowRight, Check, Ellipsis } from 'lucide-react'\nimport { useEffect, useMemo, useState } from 'react'\nimport { ActionMenu, Button, ListboxSelect, Switch, TextArea, TextField } from '../../index'\nimport { fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowNode } from '../model/types'\nimport { ShapeFlow } from './ShapeChip'\nimport { researchStepWords, settingProblems, settingsOf, specOfNode, type ReadyStep, type StepField } from './researchSteps'\nimport { shapeCounts, type DataShape } from './shapes'\nimport { useSteps } from './StepsContext'\n\n/** Facts about the flow the host knows (the editor counts the rest). */\nexport interface FlowFacts {\n /** The flow's name (panel title). */\n name?: string\n /** Version and state, as the host words it (\"v3 · draft\"). */\n version?: string\n /** What it runs on (\"edition 2026-09-20\"). */\n runsOn?: string\n runsOverEdition?: number\n deterministic?: boolean\n seed?: string | number\n}\n\n/** A few rows of a step's output. */\nexport interface OutputPreview {\n columns: readonly string[]\n rows: ReadonlyArray<ReadonlyArray<string | number>>\n}\n\nexport interface FlowSidePanelProps {\n nodes: readonly FlowNode[]\n selected: FlowNode | null\n facts?: FlowFacts\n preview?: OutputPreview | null\n locked?: boolean\n /** Result line of the last validation, when there was one. */\n validation?: string | null\n onRunFlow?: () => void\n onValidate: () => void\n onTestStep?: (nodeId: string) => void\n onRemove: (nodeId: string) => void\n onEdit: (nodeId: string, patch: Record<string, unknown>) => void\n onBack: () => void\n}\n\nconst DRAWN = (n: FlowNode) => n.kind !== 'note' && n.kind !== 'group'\n\nexport function FlowSidePanel(p: FlowSidePanelProps) {\n const rt = useSteps()\n const spec = p.selected ? specOfNode(p.selected, rt.byId) : undefined\n return p.selected ? <StepSettings {...p} node={p.selected} spec={spec} /> : <FlowOverview {...p} />\n}\n\nfunction Fact({ label, value }: { label: string; value: string }) {\n return (\n <div className=\"ty-flow-side__fact\">\n <dt>{label}</dt>\n <dd>{value}</dd>\n </div>\n )\n}\n\nfunction FlowOverview({ nodes, facts = {}, validation, onRunFlow, onValidate }: FlowSidePanelProps) {\n const rt = useSteps()\n const w = rt.words\n const { locale } = useFlowLocale()\n const specs = nodes.filter(DRAWN).map((n) => specOfNode(n, rt.byId))\n const ai = specs.some((s) => s?.usesAI)\n const outputs = specs.filter((s): s is ReadyStep => s?.verb === 'output' && !!s.output).map((s) => s.output as DataShape)\n const num = (v: number) => new Intl.NumberFormat(locale).format(v)\n return (\n <section className=\"ty-flow-side\" aria-labelledby=\"ty-flow-side-title\">\n <span className=\"ty-flow-side__eyebrow\">{w.eyebrowFlow}</span>\n <h2 id=\"ty-flow-side-title\" className=\"ty-flow-side__title\">\n {facts.name ?? w.summaryTitle}\n </h2>\n <dl className=\"ty-flow-side__facts\">\n {facts.version ? <Fact label={w.version} value={facts.version} /> : null}\n {facts.runsOn ? <Fact label={w.runsOn} value={facts.runsOn} /> : null}\n {facts.runsOverEdition !== undefined ? <Fact label={w.runs} value={num(facts.runsOverEdition)} /> : null}\n <Fact label={w.stepCount} value={num(specs.length)} />\n <Fact label={w.usesAI} value={ai ? w.yes : w.no} />\n {facts.deterministic !== undefined ? (\n <Fact label={w.deterministic} value={[facts.deterministic ? w.yes : w.no, facts.seed !== undefined ? fill(w.seed, { seed: String(facts.seed) }, locale) : null].filter(Boolean).join(' · ')} />\n ) : null}\n <Fact label={w.citable} value={outputs.length ? shapeCounts(outputs, rt.counts, locale) : w.none} />\n </dl>\n <div className=\"ty-flow-side__stack\">\n {onRunFlow ? (\n <Button variant=\"primary\" fullWidth leadingIcon={<ArrowRight className=\"ty-flow-side__arrow\" />} onPress={onRunFlow}>\n {w.runFlow}\n </Button>\n ) : null}\n <Button variant=\"secondary\" fullWidth leadingIcon={<Check />} onPress={onValidate}>\n {w.validate}\n </Button>\n </div>\n <p className=\"ty-flow-side__hint\">{w.nothingSelected}</p>\n <p className=\"ty-flow-side__status\" role=\"status\">\n {validation ?? ''}\n </p>\n </section>\n )\n}\n\nfunction StepSettings({ node, spec, preview, locked, onTestStep, onRemove, onEdit, onBack }: FlowSidePanelProps & { node: FlowNode; spec: ReadyStep | undefined }) {\n const rt = useSteps()\n const w = rt.words\n const title = (typeof node.data.label === 'string' && node.data.label) || spec?.name || node.kind\n const settings = settingsOf(spec, node.data)\n const problems = settingProblems(spec, node.data, rt.problems.get(node.id))\n /** A field's new value, at the top of the node data or inside the object `configIn` names (undefined removes it). */\n const commit = (key: string, v: unknown) => {\n if (!spec?.configIn) return onEdit(node.id, { [key]: v })\n const next = { ...settings }\n if (v === undefined) delete next[key]\n else next[key] = v\n onEdit(node.id, { [spec.configIn]: next })\n }\n return (\n <section className=\"ty-flow-side\" aria-labelledby=\"ty-flow-side-title\" data-step={node.id}>\n <div className=\"ty-flow-side__top\">\n <span className=\"ty-flow-side__eyebrow\">{w.eyebrowStep}</span>\n <ActionMenu\n label={w.moreStep}\n trigger={<Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={w.moreStep} leadingIcon={<Ellipsis />} />}\n items={[\n { id: 'back', label: w.backToSummary },\n ...(!locked ? [{ id: 'remove', label: w.remove, tone: 'danger' as const }] : []),\n ]}\n onAction={(id) => (id === 'back' ? onBack() : onRemove(node.id))}\n />\n </div>\n <h2 id=\"ty-flow-side-title\" className=\"ty-flow-side__title\" dir=\"auto\">\n {title}\n </h2>\n {spec && !spec.primitive ? <ShapeFlow inputs={spec.inputs} output={spec.output} words={rt.shapes} labels={w} /> : null}\n <form className=\"ty-flow-side__form\" onSubmit={(e) => e.preventDefault()} noValidate>\n {problems[''] ? (\n <p className=\"ty-flow-side__problem\" role=\"alert\">\n {problems['']}\n </p>\n ) : null}\n {(spec?.fields ?? []).map((f) => (\n <Field key={f.key} field={f} value={settings[f.key]} error={problems[f.key]} disabled={!!locked} onCommit={(v) => commit(f.key, v)} />\n ))}\n <Draft label={w.stepName} value={typeof node.data.label === 'string' ? node.data.label : ''} placeholder={spec?.name ?? ''} disabled={!!locked} onCommit={(v) => onEdit(node.id, { label: v || undefined })} />\n </form>\n <span className=\"ty-flow-side__eyebrow\">{w.preview}</span>\n {preview && preview.rows.length ? (\n <div className=\"ty-flow-side__preview\">\n <table>\n <thead>\n <tr>\n {preview.columns.map((c) => (\n <th key={c} scope=\"col\">\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {preview.rows.map((r, i) => (\n <tr key={i}>\n {r.map((v, j) => (\n <td key={j} data-kind={j === 0 ? 'key' : typeof v === 'number' || /^\\[?n\\]?$/.test(String(v)) ? 'number' : 'value'}>\n {v}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n ) : (\n <p className=\"ty-flow-side__hint\">{w.noPreview}</p>\n )}\n {!locked ? (\n <div className=\"ty-flow-side__row\">\n {onTestStep ? (\n <Button variant=\"secondary\" leadingIcon={<ArrowRight className=\"ty-flow-side__arrow\" />} onPress={() => onTestStep(node.id)}>\n {w.testStep}\n </Button>\n ) : null}\n <Button variant=\"quiet\" onPress={() => onRemove(node.id)}>\n {w.remove}\n </Button>\n </div>\n ) : null}\n </section>\n )\n}\n\n/** A settings field: a choice, a switch, or text / number / list / structured text committed on blur or Enter. */\nfunction Field({ field, value, error, disabled, onCommit }: { field: StepField; value: unknown; error?: string; disabled: boolean; onCommit: (v: unknown) => void }) {\n const words = useLabels(researchStepWords, undefined)\n const rt = useSteps()\n const { locale } = useFlowLocale()\n const current = value === undefined || value === null ? '' : typeof value === 'object' ? '' : String(value)\n const options = useMemo(() => {\n const values = [...(field.options ?? [])]\n if (current && !values.includes(current)) values.unshift(current)\n return values.map((v) => ({ value: v, label: words[`option.${v}`] ?? v }))\n }, [field.options, current, words])\n const label = field.label ?? field.key\n const req = field.required ? { required: true } : {}\n if (field.type === 'choice') {\n return (\n <div className=\"ty-flow-side__field\">\n <ListboxSelect label={label} options={options} value={current || null} disabled={disabled} {...req} {...(error ? { errorMessage: error } : {})} onChange={(v) => v !== current && onCommit(v)} />\n </div>\n )\n }\n if (field.type === 'boolean') {\n return (\n <div className=\"ty-flow-side__field\">\n <Switch label={label} isSelected={value === true} disabled={disabled} onChange={(on) => onCommit(on)} {...(error ? { description: <span className=\"ty-flow-side__problem\">{error}</span> } : {})} />\n </div>\n )\n }\n if (field.type === 'json') return <JsonDraft label={label} value={value} error={error} disabled={disabled} required={!!field.required} invalid={(detail) => fill(rt.words.invalidJson, { detail }, locale)} onCommit={onCommit} />\n if (field.type === 'list') {\n const text = Array.isArray(value) ? value.map(String).join(', ') : current\n return (\n <Draft\n label={label}\n value={text}\n hint={rt.words.valuesHint}\n error={error}\n required={!!field.required}\n disabled={disabled}\n onCommit={(v) => {\n const items = v.split(',').map((x) => x.trim()).filter(Boolean)\n onCommit(items.length ? items : undefined)\n }}\n />\n )\n }\n return (\n <Draft\n label={label}\n value={current}\n numeric={field.type === 'number'}\n error={error}\n required={!!field.required}\n disabled={disabled}\n onCommit={(v) => onCommit(v === '' ? undefined : field.type === 'number' && Number.isFinite(Number(v)) ? Number(v) : v)}\n />\n )\n}\n\n/** Structured text (JSON) committed when it leaves the field; text that does not parse stays with its error. */\nfunction JsonDraft({ label, value, error, disabled, required, invalid, onCommit }: { label: string; value: unknown; error?: string; disabled: boolean; required: boolean; invalid: (detail: string) => string; onCommit: (v: unknown) => void }) {\n const text = value === undefined ? '' : JSON.stringify(value, null, 2)\n const [draft, setDraft] = useState(text)\n const [parseError, setParseError] = useState<string | null>(null)\n useEffect(() => {\n setDraft(text)\n setParseError(null)\n }, [text])\n const commit = () => {\n const t = draft.trim()\n if (!t) {\n setParseError(null)\n if (value !== undefined) onCommit(undefined)\n return\n }\n try {\n const parsed: unknown = JSON.parse(t)\n setParseError(null)\n if (JSON.stringify(parsed) !== JSON.stringify(value)) onCommit(parsed)\n } catch (e) {\n setParseError(invalid(e instanceof Error ? e.message : String(e)))\n }\n }\n const shown = parseError ?? error\n return (\n <div className=\"ty-flow-side__field\" onBlur={commit}>\n <TextArea label={label} value={draft} onChange={setDraft} monospace autoGrow rows={3} maxRows={12} disabled={disabled} {...(required ? { required: true } : {})} {...(shown ? { errorMessage: shown } : {})} />\n </div>\n )\n}\n\n/** A text field that reports its value when it loses focus or on Enter (one undo step per edit). */\nfunction Draft({ label, value, placeholder, numeric, hint, error, required, disabled, onCommit }: { label: string; value: string; placeholder?: string; numeric?: boolean; hint?: string; error?: string; required?: boolean; disabled: boolean; onCommit: (v: string) => void }) {\n const [draft, setDraft] = useState(value)\n useEffect(() => setDraft(value), [value])\n const commit = () => {\n if (draft.trim() !== value) onCommit(draft.trim())\n }\n return (\n <div\n className=\"ty-flow-side__field\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') commit()\n }}\n >\n <TextField\n label={label}\n value={draft}\n onChange={setDraft}\n onBlur={commit}\n disabled={disabled}\n {...(placeholder ? { placeholder } : {})}\n {...(numeric ? { inputType: 'number' as const } : {})}\n {...(hint ? { hint } : {})}\n {...(error ? { errorMessage: error } : {})}\n {...(required ? { required: true } : {})}\n />\n </div>\n )\n}\n","// IssueBar: a strip at the top of the canvas while any link carries a shape\n// its receiving step does not take. It says which step expects what and\n// receives what, and offers the repair in one press: swap the step for one of\n// the same kind that takes what arrives, insert a bridging step, or unlink.\n\nimport { TriangleAlert } from 'lucide-react'\nimport { Button } from '../../index'\nimport { fill, useFlowLocale } from '../internal/labels'\nimport { ShapeChip } from './ShapeChip'\nimport { useSteps } from './StepsContext'\nimport type { WiringIssue } from './wiring'\n\nexport interface IssueBarProps {\n issues: readonly WiringIssue[]\n nameOf: (nodeId: string) => string\n locked?: boolean\n onRepair: (issue: WiringIssue) => void\n /** Moves to the step with the problem. */\n onShow?: (nodeId: string) => void\n}\n\nexport function IssueBar({ issues, nameOf, locked, onRepair, onShow }: IssueBarProps) {\n const rt = useSteps()\n const w = rt.words\n const { locale } = useFlowLocale()\n const first = issues[0]\n if (!first) return <p className=\"ty-visually-hidden\" role=\"status\" />\n const names = { from: nameOf(first.sourceId), to: nameOf(first.nodeId) }\n const stepName = (id: string) => rt.byId.get(id)?.name ?? id\n const fix =\n first.repair.kind === 'replace'\n ? fill(w.fixReplace, { step: stepName(first.repair.stepId) }, locale)\n : first.repair.kind === 'insert'\n ? fill(w.fixInsert, { step: stepName(first.repair.stepId), ...names }, locale)\n : fill(w.fixUnlink, names, locale)\n return (\n <div className=\"ty-issue-bar\" data-ty-surface-chrome=\"\">\n <TriangleAlert className=\"ty-issue-bar__icon\" aria-hidden=\"true\" focusable=\"false\" />\n <p className=\"ty-issue-bar__text\" role=\"status\">\n <strong>{fill(w.issueCount, { count: issues.length }, locale)}:</strong>{' '}\n {onShow ? (\n <button type=\"button\" className=\"ty-issue-bar__link\" onClick={() => onShow(first.nodeId)}>\n {fill(w.issueSentence, { to: names.to }, locale)}\n </button>\n ) : (\n fill(w.issueSentence, { to: names.to }, locale)\n )}{' '}\n <ShapeChip shapes={first.expects} words={rt.shapes} /> {w.andGets}{' '}\n {first.gets ? <ShapeChip shapes={[first.gets]} words={rt.shapes} /> : w.nothing}.\n </p>\n {!locked ? (\n <Button className=\"ty-issue-bar__fix\" variant=\"secondary\" size=\"compact\" onPress={() => onRepair(first)}>\n {fix}\n </Button>\n ) : null}\n </div>\n )\n}\n","// Typed wiring between research steps, as pure functions: what may follow a\n// step, which links carry the wrong shape (and a one-click repair), and how a\n// new step is placed after a step or inside a link.\n\nimport type { FlowConnector, FlowNode } from '../model/types'\nimport type { DataShape } from './shapes'\nimport { specOfNode, STEP_KIND, type ReadyStep } from './researchSteps'\n\nexport const OUT_PORT = 'out'\nexport const inPort = (index: number) => `in-${index}`\n\n/** Input position from a port id ('in-1' → 1); unknown ids read as the first input. */\nexport function inputIndex(portId: string | undefined): number {\n const m = portId ? /^in-(\\d+)$/.exec(portId) : null\n return m ? Number(m[1]) : 0\n}\n\ntype Specs = ReadonlyMap<string, ReadyStep>\n\n/** Shape a node gives: a shape, null (gives nothing) or undefined (untyped). */\nexport function givenShape(node: FlowNode, specs: Specs): DataShape | null | undefined {\n const s = specOfNode(node, specs)\n return !s || s.primitive ? undefined : s.output\n}\n\n/** Shapes one input of a node accepts; undefined when the node is untyped. */\nexport function acceptedShapes(node: FlowNode, specs: Specs, portId?: string): readonly DataShape[] | undefined {\n const s = specOfNode(node, specs)\n if (!s || s.primitive) return undefined\n return s.inputs[inputIndex(portId)] ?? s.inputs[0] ?? []\n}\n\n/** Steps that can follow something giving `shape` (every step with an input when untyped). */\nexport function stepsAccepting(shape: DataShape | null | undefined, steps: readonly ReadyStep[], aiAllowed = true): ReadyStep[] {\n return steps.filter((s) => {\n if (s.primitive || !s.inputs.length || (s.usesAI && !aiAllowed)) return false\n return shape === undefined || (shape !== null && s.inputs[0]!.includes(shape))\n })\n}\n\nexport type Repair =\n | { kind: 'replace'; nodeId: string; stepId: string }\n | { kind: 'insert'; connectorId: string; stepId: string }\n | { kind: 'unlink'; connectorId: string }\n\nexport interface WiringIssue {\n connectorId: string\n /** The step receiving the wrong shape. */\n nodeId: string\n sourceId: string\n expects: readonly DataShape[]\n gets: DataShape | null\n repair: Repair\n}\n\n/** Links whose shape the receiving input does not accept, each with a repair. */\nexport function wiringIssues(nodes: readonly FlowNode[], connectors: readonly FlowConnector[], steps: readonly ReadyStep[], aiAllowed = true): WiringIssue[] {\n const specs = new Map(steps.map((s) => [s.id, s]))\n const byId = new Map(nodes.map((n) => [n.id, n]))\n const found: WiringIssue[] = []\n for (const c of connectors) {\n const from = byId.get(c.source)\n const to = byId.get(c.target)\n if (!from || !to) continue\n const gets = givenShape(from, specs)\n const expects = acceptedShapes(to, specs, c.targetPort)\n if (gets === undefined || expects === undefined) continue\n if (gets !== null && expects.includes(gets)) continue\n // First choice: a step of the same kind of work that takes what arrives;\n // then a bridge that takes it and gives what the receiver wants.\n const receiver = specOfNode(to, specs)\n const takers = gets === null ? [] : stepsAccepting(gets, steps, aiAllowed)\n const twin = takers.find((s) => s.verb === receiver?.verb && s.id !== receiver?.id)\n const bridge = takers.find((s) => s.output !== null && expects.includes(s.output))\n found.push({\n connectorId: c.id,\n nodeId: to.id,\n sourceId: from.id,\n expects,\n gets,\n repair: twin ? { kind: 'replace', nodeId: to.id, stepId: twin.id } : bridge ? { kind: 'insert', connectorId: c.id, stepId: bridge.id } : { kind: 'unlink', connectorId: c.id },\n })\n }\n return found\n}\n\n/** A fresh step node (positions are settled by the layout afterwards). */\nexport function stepNode(step: ReadyStep, id: string, at: { x: number; y: number }): FlowNode {\n const data: Record<string, unknown> = step.kind === STEP_KIND ? { stepId: step.id, ...(step.defaults ?? {}) } : { label: step.name, ...(step.defaults ?? {}) }\n return { id, kind: step.kind, position: at, data }\n}\n\n/** Links a new step `newId` to follow `afterId`. */\nexport function linkAfter(connectors: readonly FlowConnector[], afterId: string, newId: string, makeId: () => string): FlowConnector[] {\n return [...connectors, { id: makeId(), source: afterId, target: newId, sourcePort: OUT_PORT, targetPort: inPort(0) }]\n}\n\n/** Replaces link `connectorId` with two links through `newId`. */\nexport function linkThrough(connectors: readonly FlowConnector[], connectorId: string, newId: string, makeId: () => string): FlowConnector[] {\n const old = connectors.find((c) => c.id === connectorId)\n if (!old) return [...connectors]\n const rest = connectors.filter((c) => c.id !== connectorId)\n return [\n ...rest,\n { id: makeId(), source: old.source, target: newId, ...(old.sourcePort ? { sourcePort: old.sourcePort } : {}), targetPort: inPort(0) },\n { id: makeId(), source: newId, target: old.target, sourcePort: OUT_PORT, ...(old.targetPort ? { targetPort: old.targetPort } : {}) },\n ]\n}\n\n/**\n * Reorders two neighbours of a chain: `first` → `second` becomes\n * `second` → `first`, with what came into `first` now entering `second` and\n * what left `second` now leaving `first`. Null when they are not linked.\n */\nexport function swapNeighbours(connectors: readonly FlowConnector[], first: string, second: string): FlowConnector[] | null {\n if (!connectors.some((c) => c.source === first && c.target === second)) return null\n return connectors.map((c) => {\n if (c.source === first && c.target === second) return { ...c, source: second, target: first }\n if (c.target === first) return { ...c, target: second }\n if (c.source === second) return { ...c, source: first }\n return c\n })\n}\n","// StepCard: a research step on the canvas (250×86). Typed input chips ride\n// the top edge and the output chip the bottom edge, both from the inline\n// start; they are the connection handles. The body names the kind and the\n// title beside an icon tile, with the run badge, then one mono line: the\n// configuration summary, or the wiring problem in amber. A selected, editable\n// step shows \"+\" on the middle of its bottom edge (add after).\n\nimport { Check, CircleAlert, LoaderCircle, Plus } from 'lucide-react'\nimport { useId, useRef } from 'react'\nimport { Button as AriaButton } from 'react-aria-components'\nimport { fill, useFlowLocale } from '../internal/labels'\nimport type { FlowNodeProps } from '../nodes/types'\nimport { useNodeResult } from '../state/editorState'\nimport { useSurface } from '../surface/SurfaceContext'\nimport { ShapeChip } from './ShapeChip'\nimport { shapeList, type DataShape } from './shapes'\nimport { settingProblems, specOfNode, summaryLine } from './researchSteps'\nimport { useSteps } from './StepsContext'\nimport { inPort, OUT_PORT } from './wiring'\n\nexport const STEP_CARD_SIZE = Object.freeze({ width: 250, height: 86 })\n\n/** Where input `index` of `count` meets the top edge (0..1): centred, spread when several. */\nexport const alongEdge = (index: number, count: number) => (count <= 1 ? 0.5 : 0.35 + (0.3 * index) / (count - 1))\n\nexport function StepCard({ node, locked, selected, preview, onConfigure }: FlowNodeProps) {\n const rt = useSteps()\n const { locale } = useFlowLocale()\n const surface = useSurface()\n const result = useNodeResult(node.id)\n const addRef = useRef<HTMLButtonElement>(null)\n const describedBy = useId()\n const spec = specOfNode(node, rt.byId)\n const w = rt.words\n const title = (typeof node.data.label === 'string' && node.data.label) || spec?.name || node.kind\n const kindWord = spec ? rt.shelves.find((s) => s.id === spec.verb)?.title ?? spec.verb : node.kind\n const line = spec ? summaryLine(spec, node.data, locale) : null\n const issues = rt.issues.get(node.id) ?? []\n const Icon = spec?.icon\n const run = result?.status === 'success' ? 'ok' : result?.status === 'running' ? 'running' : result?.status === 'error' ? 'failed' : null\n const runWord = run === 'ok' ? w.runOk : run === 'running' ? w.runRunning : run === 'failed' ? w.runFailed : null\n const settings = Object.entries(settingProblems(spec, node.data, rt.problems.get(node.id)))\n const problems = [\n ...issues.map((i) => fill(w.mismatch, { expects: shapeList(i.expects, rt.shapes), gets: i.gets ? rt.shapes[i.gets] : w.nothing }, locale)),\n ...(settings.length ? [w.configIncomplete] : []),\n ]\n const editable = !locked && !preview\n const inputs = spec?.inputs ?? []\n const output = spec?.output ?? null\n\n const port = (role: 'source' | 'target', id: string) => {\n const target = surface.connectTarget?.nodeId === node.id && surface.connecting && surface.connecting.role !== role ? (surface.connectTarget.valid ? 'valid' : 'invalid') : undefined\n return {\n 'data-role': role,\n ...(target ? { 'data-target': target } : {}),\n ...(preview || locked ? {} : { 'data-ty-port': '', 'data-ty-port-node': node.id, 'data-ty-port-id': id, 'data-ty-port-role': role }),\n }\n }\n\n return (\n <div className=\"ty-step\" data-selected={selected ? 'true' : undefined} data-issue={problems.length ? 'true' : undefined} data-run={run ?? undefined}>\n {inputs.length ? (\n <span className=\"ty-step__ports\" data-edge=\"in\">\n {inputs.map((accepts, i) => (\n <span key={i} className=\"ty-step__port\" {...port('target', inPort(i))}>\n <ShapeChip shapes={accepts as DataShape[]} words={rt.shapes} aria-hidden=\"true\" />\n </span>\n ))}\n </span>\n ) : null}\n <AriaButton\n className=\"ty-step__body\"\n data-ty-node-focus=\"\"\n aria-label={`${kindWord}: ${title}`}\n aria-describedby={describedBy}\n onPress={() => {\n if (surface.justDragged()) return\n onConfigure?.(node.id)\n }}\n >\n <span className=\"ty-step__head\">\n <span className=\"ty-step__tile\" aria-hidden=\"true\">\n {Icon ? <Icon focusable=\"false\" /> : null}\n </span>\n <span className=\"ty-step__names\">\n <span className=\"ty-step__kind\">{kindWord}</span>\n <span className=\"ty-step__title\" title={title} dir=\"auto\">\n {title}\n </span>\n </span>\n {runWord ? (\n <span className=\"ty-step__run\" data-run={run} aria-hidden=\"true\">\n {run === 'ok' ? <Check focusable=\"false\" /> : run === 'running' ? <LoaderCircle focusable=\"false\" /> : <CircleAlert focusable=\"false\" />}\n {runWord}\n </span>\n ) : null}\n </span>\n {problems.length ? (\n <span className=\"ty-step__line\" data-problem=\"true\" aria-hidden=\"true\">\n {problems[0]}\n </span>\n ) : (\n <span className=\"ty-step__line\" data-empty={line ? undefined : 'true'} dir=\"auto\">\n {line ?? w.notSet}\n </span>\n )}\n </AriaButton>\n <span id={describedBy} className=\"ty-visually-hidden\">\n {[\n inputs.length ? `${w.inputs}: ${inputs.map((a) => shapeList(a, rt.shapes)).join(', ')}` : null,\n output ? `${w.output}: ${rt.shapes[output]}` : null,\n runWord,\n ...problems,\n ]\n .filter(Boolean)\n .join('. ')}\n </span>\n {output ? (\n <span className=\"ty-step__ports\" data-edge=\"out\">\n <span className=\"ty-step__port\" {...port('source', OUT_PORT)}>\n <ShapeChip shapes={[output]} words={rt.shapes} aria-hidden=\"true\" />\n </span>\n </span>\n ) : null}\n {editable && selected && output && rt.addAfter ? (\n <AriaButton\n ref={addRef}\n className=\"ty-step__add\"\n data-ty-surface-chrome=\"\"\n data-ty-add-after={node.id}\n aria-label={fill(w.addAfter, { name: title }, locale)}\n onPress={() => addRef.current && rt.addAfter?.(node.id, addRef.current)}\n >\n <Plus aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n ) : null}\n </div>\n )\n}\n","// StepListView: the flow as a numbered list, the keyboard view of the canvas\n// (toggled from the dock). ↑↓ move between steps, Alt+↑↓ reorder, A adds\n// after the current step, Enter opens its settings. An \"add a step here\" row\n// follows the current step; each row has a \"…\" menu.\n\nimport { ArrowDown, ArrowUp, Ellipsis, Plus, Settings2, Trash2 } from 'lucide-react'\nimport { useEffect, useRef, useState, type KeyboardEvent } from 'react'\nimport { ActionMenu, Button } from '../../index'\nimport { fill, useFlowLocale } from '../internal/labels'\nimport type { FlowNode } from '../model/types'\nimport { ShapeFlow } from './ShapeChip'\nimport { specOfNode, summaryLine } from './researchSteps'\nimport { useSteps } from './StepsContext'\n\nexport interface StepListViewProps {\n /** Steps in reading order. */\n nodes: readonly FlowNode[]\n locked?: boolean\n /** Step that holds focus when the view opens. */\n activeId?: string | null\n onConfigure: (id: string) => void\n onMove: (id: string, towards: -1 | 1) => void\n onRemove: (id: string) => void\n onAddAfter: (id: string, trigger: HTMLElement) => void\n onActiveChange?: (id: string) => void\n}\n\nexport function StepListView({ nodes, locked, activeId, onConfigure, onMove, onRemove, onAddAfter, onActiveChange }: StepListViewProps) {\n const rt = useSteps()\n const w = rt.words\n const { locale } = useFlowLocale()\n const start = Math.max(0, nodes.findIndex((n) => n.id === activeId))\n const [at, setAt] = useState(start)\n const rows = useRef(new Map<string, HTMLButtonElement>())\n const pending = useRef<string | null>(null)\n const current = nodes[Math.min(at, nodes.length - 1)]\n\n // After a reorder the moved step keeps focus at its new place.\n useEffect(() => {\n if (!pending.current) return\n const i = nodes.findIndex((n) => n.id === pending.current)\n const el = rows.current.get(pending.current)\n pending.current = null\n if (i >= 0) setAt(i)\n el?.focus()\n }, [nodes])\n\n const focusAt = (i: number) => {\n const n = nodes[i]\n if (!n) return\n setAt(i)\n rows.current.get(n.id)?.focus()\n onActiveChange?.(n.id)\n }\n\n const onKey = (e: KeyboardEvent<HTMLButtonElement>, i: number, n: FlowNode) => {\n const step = e.key === 'ArrowDown' ? 1 : e.key === 'ArrowUp' ? -1 : 0\n if (step && e.altKey) {\n e.preventDefault()\n if (locked || !nodes[i + step]) return\n pending.current = n.id\n onMove(n.id, step)\n } else if (step) {\n e.preventDefault()\n focusAt(i + step)\n } else if (e.key === 'Home' || e.key === 'End') {\n e.preventDefault()\n focusAt(e.key === 'Home' ? 0 : nodes.length - 1)\n } else if ((e.key === 'a' || e.key === 'A') && !e.metaKey && !e.ctrlKey && !e.altKey && !locked) {\n e.preventDefault()\n onAddAfter(n.id, e.currentTarget)\n }\n }\n\n return (\n <section className=\"ty-flow-list\" aria-labelledby=\"ty-flow-list-title\">\n <h2 id=\"ty-flow-list-title\" className=\"ty-visually-hidden\">\n {w.listTitle}\n </h2>\n <p className=\"ty-visually-hidden\" id=\"ty-flow-list-hint\">\n {w.listHint}\n </p>\n <ol className=\"ty-flow-list__rows\">\n {nodes.map((n, i) => {\n const spec = specOfNode(n, rt.byId)\n const title = (typeof n.data.label === 'string' && n.data.label) || spec?.name || n.kind\n const line = spec ? summaryLine(spec, n.data, locale) : null\n const Icon = spec?.icon\n const here = n.id === current?.id\n return [\n <li key={n.id} className=\"ty-flow-list__row\" data-current={here ? 'true' : undefined}>\n <span className=\"ty-flow-list__number\" aria-hidden=\"true\">\n {new Intl.NumberFormat(locale).format(i + 1)}\n </span>\n <button\n ref={(el) => {\n if (el) rows.current.set(n.id, el)\n else rows.current.delete(n.id)\n }}\n type=\"button\"\n className=\"ty-flow-list__main\"\n tabIndex={here ? 0 : -1}\n aria-describedby=\"ty-flow-list-hint\"\n onFocus={() => {\n setAt(i)\n onActiveChange?.(n.id)\n }}\n onClick={() => onConfigure(n.id)}\n onKeyDown={(e) => onKey(e, i, n)}\n >\n <span className=\"ty-flow-list__tile\" aria-hidden=\"true\">\n {Icon ? <Icon focusable=\"false\" /> : null}\n </span>\n <span className=\"ty-flow-list__title-text\" dir=\"auto\">{title}</span>\n <span className=\"ty-flow-list__line\" dir=\"auto\">{line ?? w.notSet}</span>\n {spec && !spec.primitive ? <ShapeFlow inputs={spec.inputs} output={spec.output} words={rt.shapes} labels={w} bare /> : null}\n </button>\n {!locked ? (\n <ActionMenu\n label={fill(w.more, { name: title }, locale)}\n trigger={<Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={fill(w.more, { name: title }, locale)} leadingIcon={<Ellipsis />} />}\n items={[\n { id: 'configure', label: w.configure, icon: Settings2 },\n { id: 'up', label: w.moveUp, icon: ArrowUp, disabled: i === 0 },\n { id: 'down', label: w.moveDown, icon: ArrowDown, disabled: i === nodes.length - 1 },\n { type: 'separator' },\n { id: 'remove', label: w.remove, icon: Trash2, tone: 'danger' },\n ]}\n onAction={(id) => {\n if (id === 'configure') onConfigure(n.id)\n else if (id === 'up' || id === 'down') {\n pending.current = n.id\n onMove(n.id, id === 'up' ? -1 : 1)\n } else if (id === 'remove') onRemove(n.id)\n }}\n />\n ) : null}\n </li>,\n here && !locked ? (\n <li key={`${n.id}-add`} className=\"ty-flow-list__add\">\n <button type=\"button\" className=\"ty-flow-list__add-button\" onClick={(e) => onAddAfter(n.id, e.currentTarget)}>\n <Plus aria-hidden=\"true\" focusable=\"false\" />\n {w.addHere}\n </button>\n </li>\n ) : null,\n ]\n })}\n </ol>\n </section>\n )\n}\n","// StepPalette: research steps shelved by verb. A search field (\"/\" jumps to\n// it), a filter (all, without AI, recent), then one list per shelf with its\n// purpose. Each entry shows its typed \"takes → gives\" chips; AI steps carry a\n// dashed \"AI\" tag and are unavailable when the project allows no agents.\n// Shelves with nothing to show are left out; engine primitives sit on a\n// folded shelf. Enter or a tap places a step; a drag drops it on the canvas.\n\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { Button as AriaButton, Disclosure, DisclosurePanel, GridList, GridListItem, Heading, Input, Label, SearchField, ToggleButton, ToggleButtonGroup, useDragAndDrop, useFilter, type Key } from 'react-aria-components'\nimport { ChevronDown, GripVertical, Search } from 'lucide-react'\nimport { fill, useFlowLocale } from '../internal/labels'\nimport { ShapeFlow } from './ShapeChip'\nimport type { ReadyShelf, ReadyStep } from './researchSteps'\nimport { useSteps } from './StepsContext'\n\n/** Drag payload type of a palette step. */\nexport const STEP_MEDIA_TYPE = 'application/x-tympan-step'\n\n/** A second, empty drag type that names the step, readable while dragging over (payloads are not). */\nexport const stepDragType = (stepId: string) => `${STEP_MEDIA_TYPE}-${stepId.toLowerCase()}`\n\n/** The step id a drag names, if any. */\nexport function stepOfDrag(types: readonly string[]): string | null {\n const prefix = `${STEP_MEDIA_TYPE}-`\n const hit = types.find((t) => t.startsWith(prefix))\n return hit ? hit.slice(prefix.length) : null\n}\n\nexport type PaletteFilter = 'all' | 'no-ai' | 'recent'\n\nexport interface StepPaletteProps {\n onPlace: (stepId: string) => void\n /** Step ids placed lately, newest first. */\n recent?: readonly string[]\n /** Which step is being dragged (null when the drag ends). */\n onDragChange?: (stepId: string | null) => void\n className?: string\n}\n\nconst isTyping = (el: EventTarget | null) => el instanceof HTMLElement && !!el.closest('input, textarea, select, [contenteditable=\"true\"]')\n\nexport function StepPalette({ onPlace, recent = [], onDragChange, className }: StepPaletteProps) {\n const rt = useSteps()\n const w = rt.words\n const { locale } = useFlowLocale()\n const { contains } = useFilter({ sensitivity: 'base' })\n const [query, setQuery] = useState('')\n const [filter, setFilter] = useState<PaletteFilter>('all')\n const fieldRef = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== '/' || e.metaKey || e.ctrlKey || e.altKey || isTyping(e.target)) return\n e.preventDefault()\n fieldRef.current?.focus()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [])\n\n const keep = (s: ReadyStep) => {\n if (query && !contains(`${s.name} ${s.description}`, query)) return false\n if (filter === 'no-ai' && s.usesAI) return false\n if (filter === 'recent' && !recent.includes(s.id)) return false\n return true\n }\n const shelves = useMemo(() => {\n const out: ReadyShelf[] = []\n for (const sh of rt.shelves) {\n const steps = sh.steps.filter(keep)\n if (filter === 'recent') steps.sort((a, b) => recent.indexOf(a.id) - recent.indexOf(b.id))\n if (steps.length) out.push({ ...sh, steps })\n }\n return out\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [rt.shelves, query, filter, recent, contains])\n\n const emptyWord = filter === 'recent' && !query ? w.noRecent : fill(w.noMatch, { query }, locale)\n\n return (\n <section className={['ty-step-palette', className].filter(Boolean).join(' ')} aria-label={w.paletteTitle}>\n <div className=\"ty-step-palette__top\">\n <SearchField className=\"ty-step-palette__search\" value={query} onChange={setQuery}>\n <Label className=\"ty-visually-hidden\">{w.search}</Label>\n <Search className=\"ty-step-palette__search-icon\" aria-hidden=\"true\" focusable=\"false\" />\n <Input ref={fieldRef} className=\"ty-step-palette__input\" placeholder={w.search} aria-keyshortcuts=\"/\" />\n <kbd className=\"ty-step-palette__key\" title={w.searchKey}>\n /\n </kbd>\n </SearchField>\n <ToggleButtonGroup\n className=\"ty-step-palette__filters\"\n aria-label={w.show}\n selectionMode=\"single\"\n disallowEmptySelection\n selectedKeys={[filter]}\n onSelectionChange={(keys) => {\n const next = [...keys][0]\n if (next) setFilter(next as PaletteFilter)\n }}\n >\n <ToggleButton id=\"all\" className=\"ty-step-palette__filter\">\n {w.all}\n </ToggleButton>\n <ToggleButton id=\"no-ai\" className=\"ty-step-palette__filter\">\n {w.noAI}\n </ToggleButton>\n <ToggleButton id=\"recent\" className=\"ty-step-palette__filter\">\n {w.recent}\n </ToggleButton>\n </ToggleButtonGroup>\n </div>\n <div className=\"ty-step-palette__shelves\">\n {!rt.aiAllowed ? <p className=\"ty-step-palette__note\">{w.aiOff}</p> : null}\n {shelves.length ? (\n shelves.map((sh) =>\n sh.folded && !query ? (\n <Disclosure key={sh.id} className=\"ty-step-palette__shelf\" data-folded=\"true\">\n <div className=\"ty-step-palette__shelf-head\">\n <Heading level={3} className=\"ty-step-palette__shelf-title\">\n <AriaButton slot=\"trigger\" className=\"ty-step-palette__fold\">\n <ChevronDown className=\"ty-step-palette__chevron\" aria-hidden=\"true\" focusable=\"false\" />\n {sh.title}\n </AriaButton>\n </Heading>\n {sh.purpose ? <span className=\"ty-step-palette__purpose\">{sh.purpose}</span> : null}\n </div>\n <DisclosurePanel>\n <ShelfList shelf={sh} onPlace={onPlace} {...(onDragChange ? { onDragChange } : {})} />\n </DisclosurePanel>\n </Disclosure>\n ) : (\n <section key={sh.id} className=\"ty-step-palette__shelf\" aria-labelledby={`ty-shelf-${sh.id}`}>\n <div className=\"ty-step-palette__shelf-head\">\n <h3 id={`ty-shelf-${sh.id}`} className=\"ty-step-palette__shelf-title\">\n {sh.title}\n </h3>\n {sh.purpose ? <span className=\"ty-step-palette__purpose\">{sh.purpose}</span> : null}\n </div>\n <ShelfList shelf={sh} onPlace={onPlace} {...(onDragChange ? { onDragChange } : {})} />\n </section>\n ),\n )\n ) : (\n <p className=\"ty-step-palette__empty\">{emptyWord}</p>\n )}\n </div>\n </section>\n )\n}\n\nfunction ShelfList({ shelf, onPlace, onDragChange }: { shelf: ReadyShelf; onPlace: (id: string) => void; onDragChange?: (id: string | null) => void }) {\n const rt = useSteps()\n const w = rt.words\n const blocked = (s: ReadyStep) => !!s.usesAI && !rt.aiAllowed\n const { dragAndDropHooks } = useDragAndDrop({\n getItems: (keys) =>\n shelf.steps\n .filter((s) => keys.has(s.id))\n .map((s) => ({\n [STEP_MEDIA_TYPE]: JSON.stringify({ stepId: s.id }),\n [stepDragType(s.id)]: '',\n 'text/plain': s.name,\n })),\n onDragStart: (e) => onDragChange?.(String([...e.keys][0] ?? '')),\n onDragEnd: () => onDragChange?.(null),\n })\n const disabled: Key[] = shelf.steps.filter(blocked).map((s) => s.id)\n return (\n <GridList className=\"ty-step-palette__list\" aria-label={shelf.title} items={shelf.steps} disabledKeys={disabled} dragAndDropHooks={dragAndDropHooks} onAction={(key) => onPlace(String(key))}>\n {(s) => {\n const Icon = s.icon\n return (\n <GridListItem id={s.id} textValue={s.name} className=\"ty-step-palette__item\" data-ai={s.usesAI ? 'true' : undefined}>\n <AriaButton slot=\"drag\" className=\"ty-step-palette__grip\" aria-label={fill(w.dragItem, { name: s.name })}>\n <GripVertical aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n <span className=\"ty-step-palette__tile\" aria-hidden=\"true\">\n <Icon focusable=\"false\" />\n </span>\n <span className=\"ty-step-palette__name\">\n {s.name}\n {s.usesAI ? <span className=\"ty-step-palette__ai\">{w.ai}</span> : null}\n </span>\n <span className=\"ty-step-palette__about\" title={s.description} dir=\"auto\">\n {blocked(s) ? w.aiOff : s.description}\n </span>\n {s.primitive ? null : <ShapeFlow inputs={s.inputs} output={s.output} words={rt.shapes} labels={w} />}\n </GridListItem>\n )\n }}\n </GridList>\n )\n}\n","// Dock items of the research-step editor, in three groups:\n// select, move | add a step (A), rearrange, fit | list view, find a step.\n\nimport { Hand, ListOrdered, Maximize, MousePointer2, Network, Plus, Search } from 'lucide-react'\nimport type { CanvasToolItem } from '../toolbar/canvasTools'\nimport type { StepEditorWords } from './stepLabels'\n\nexport interface StepToolOptions {\n words: Pick<StepEditorWords, 'toolSelect' | 'toolPan' | 'toolAdd' | 'toolArrange' | 'toolFit' | 'toolList' | 'toolSearch'>\n mode: 'select' | 'pan'\n onModeChange: (mode: 'select' | 'pan') => void\n /** Absent while the flow is locked. */\n onAdd?: (() => void) | undefined\n onArrange?: (() => void) | undefined\n onFit: () => void\n listView: boolean\n onToggleList: () => void\n onSearch: () => void\n}\n\nexport function stepToolItems(o: StepToolOptions): CanvasToolItem[] {\n const w = o.words\n const pointer: CanvasToolItem[] = [\n { id: 'select', label: w.toolSelect, icon: MousePointer2, kind: 'mode', pressed: o.mode === 'select', shortcut: 'V', group: 'mode', onPress: () => o.onModeChange('select') },\n { id: 'pan', label: w.toolPan, icon: Hand, kind: 'mode', pressed: o.mode === 'pan', shortcut: 'H', group: 'mode', onPress: () => o.onModeChange('pan') },\n ]\n const shaping: CanvasToolItem[] = [\n ...(o.onAdd ? [{ id: 'add-step', label: w.toolAdd, icon: Plus, kind: 'action' as const, shortcut: 'A', group: 'layout' as const, onPress: o.onAdd }] : []),\n ...(o.onArrange ? [{ id: 'auto-layout', label: w.toolArrange, icon: Network, kind: 'action' as const, group: 'layout' as const, onPress: o.onArrange }] : []),\n { id: 'fit', label: w.toolFit, icon: Maximize, kind: 'action', shortcut: 'Control+1', group: 'layout', onPress: o.onFit },\n ]\n const finding: CanvasToolItem[] = [\n { id: 'list-view', label: w.toolList, icon: ListOrdered, kind: 'toggle', pressed: o.listView, group: 'find', onPress: o.onToggleList },\n { id: 'search', label: w.toolSearch, icon: Search, kind: 'action', shortcut: 'Control+F', group: 'find', onPress: o.onSearch },\n ]\n return [...pointer, ...shaping, ...finding]\n}\n","// Expression trees and the operation vocabulary. The vocabulary belongs to the\n// engine: hosts pass it as an ExpressionCatalog (from the backend node\n// catalog). This module only groups, describes and seeds it.\n\n/** A node of an expression tree: an operation, a reference or a literal. */\nexport type ExpressionNode = OperationNode | ReferenceNode | LiteralNode\n\nexport interface OperationNode {\n operation: string\n [operand: string]: unknown\n}\nexport interface ReferenceNode {\n ref: string\n}\nexport interface LiteralNode {\n value: unknown\n}\n\nexport type OperandKind = 'expression' | 'list' | 'param' | 'raw'\nexport type LoopBinding = 'item' | 'index' | 'accumulator'\n\nexport interface OperandSlotSpec {\n key: string\n kind: OperandKind\n /** Known sub-vocabulary of a parameter (shown with friendly names). */\n vocabulary?: 'comparison' | 'arithmetic' | 'sortOrder' | readonly string[]\n /** Loop variables this expression slot binds for its subtree. */\n binds?: readonly LoopBinding[]\n optional?: boolean\n}\n\nexport type YieldType = 'boolean' | 'number' | 'string' | 'list' | 'object' | 'any'\n\nexport interface OperationSpec {\n name: string\n /** One of EXPRESSION_FAMILIES; anything else falls into \"core\". */\n family?: string\n operands: readonly OperandSlotSpec[]\n yields?: YieldType\n /** Operands to seed when the operation is picked (defaults per slot kind otherwise). */\n starter?: Record<string, unknown>\n}\n\nexport interface ExpressionCatalog {\n operations: readonly OperationSpec[]\n}\n\n/** The twelve families, in display order. \"core\" also receives unknown families. */\nexport const EXPRESSION_FAMILIES = [\n 'aggregation',\n 'list',\n 'set',\n 'object',\n 'arithmetic',\n 'text',\n 'logic',\n 'conversion',\n 'datetime',\n 'pattern',\n 'utility',\n 'core',\n] as const\nexport type ExpressionFamily = (typeof EXPRESSION_FAMILIES)[number]\n\nexport const VOCABULARIES: Record<'comparison' | 'arithmetic' | 'sortOrder', readonly string[]> = {\n comparison: ['eq', 'ne', 'gt', 'gte', 'lt', 'lte'],\n arithmetic: ['add', 'subtract', 'multiply', 'divide', 'modulo', 'power'],\n sortOrder: ['asc', 'desc'],\n}\n\n/** Engine nesting limit mirrored by the builder. */\nexport const MAX_EXPRESSION_DEPTH = 8\n\n/** Reference used for \"the flow's inputs\" when nothing more specific exists. */\nexport const FLOW_INPUTS_REF = 'inputs'\n\nexport const isOperation = (n: unknown): n is OperationNode => !!n && typeof n === 'object' && !Array.isArray(n) && typeof (n as OperationNode).operation === 'string'\nexport const isReference = (n: unknown): n is ReferenceNode => !!n && typeof n === 'object' && !Array.isArray(n) && typeof (n as ReferenceNode).ref === 'string' && !('operation' in (n as object))\nexport const isLiteral = (n: unknown): n is LiteralNode => !!n && typeof n === 'object' && !Array.isArray(n) && 'value' in (n as object) && !('operation' in (n as object)) && !('ref' in (n as object))\n\nexport function familyOf(op: OperationSpec): ExpressionFamily {\n return (EXPRESSION_FAMILIES as readonly string[]).includes(op.family ?? '') ? (op.family as ExpressionFamily) : 'core'\n}\n\nexport function vocabularyOf(slot: OperandSlotSpec): readonly string[] | null {\n if (!slot.vocabulary) return null\n return typeof slot.vocabulary === 'string' ? VOCABULARIES[slot.vocabulary] : slot.vocabulary\n}\n\n/**\n * An entry of the operation picker. Operations with an arithmetic-kind\n * parameter are offered as one verb per arithmetic kind (\"add\", \"subtract\"),\n * which still emits the same tree.\n */\nexport interface PickerEntry {\n id: string\n family: ExpressionFamily\n op: OperationSpec\n /** Arithmetic verb fixed by this entry, if any. */\n verb?: { key: string; value: string }\n}\n\nexport function pickerEntries(catalog: ExpressionCatalog | undefined, mode: 'expression' | 'predicate'): PickerEntry[] {\n if (!catalog) return []\n const out: PickerEntry[] = []\n for (const op of catalog.operations) {\n if (mode === 'predicate' && op.yields !== 'boolean') continue\n const verbSlot = op.operands.find((s) => s.kind === 'param' && s.vocabulary === 'arithmetic')\n if (verbSlot) {\n for (const v of VOCABULARIES.arithmetic) out.push({ id: `${op.name}:${v}`, family: familyOf(op), op, verb: { key: verbSlot.key, value: v } })\n } else out.push({ id: op.name, family: familyOf(op), op })\n }\n return out\n}\n\n/** Picker entry that represents `node` (verb-aware). */\nexport function entryIdOf(node: OperationNode, entries: readonly PickerEntry[]): string | null {\n const match = entries.find((e) => e.op.name === node.operation && (!e.verb || node[e.verb.key] === e.verb.value))\n return match?.id ?? null\n}\n\nexport function starterFor(slot: OperandSlotSpec): unknown {\n switch (slot.kind) {\n case 'expression':\n return { value: null }\n case 'list':\n return []\n case 'param':\n return vocabularyOf(slot)?.[0] ?? ''\n case 'raw':\n return {}\n }\n}\n\n/** A fresh operation node with starter operands. */\nexport function seedOperation(entry: PickerEntry): OperationNode {\n const node: OperationNode = { operation: entry.op.name }\n for (const slot of entry.op.operands) {\n if (slot.optional) continue\n node[slot.key] = entry.op.starter && slot.key in entry.op.starter ? structuredClone(entry.op.starter[slot.key]) : starterFor(slot)\n }\n if (entry.verb) node[entry.verb.key] = entry.verb.value\n return node\n}\n\nexport function findOperation(catalog: ExpressionCatalog | undefined, name: string): OperationSpec | undefined {\n return catalog?.operations.find((o) => o.name === name)\n}\n\n/** Slots of an operation the catalog does not know, inferred from its operands. */\nexport function inferSlots(node: OperationNode): OperandSlotSpec[] {\n return Object.keys(node)\n .filter((k) => k !== 'operation')\n .map((key) => {\n const v = node[key]\n if (Array.isArray(v)) return { key, kind: 'list' as const }\n if (v && typeof v === 'object') return isOperation(v) || isReference(v) || isLiteral(v) ? { key, kind: 'expression' as const } : { key, kind: 'raw' as const }\n return { key, kind: 'param' as const }\n })\n}\n\n/** Reads a literal field: structured data when it parses, else plain text. */\nexport function readLiteral(text: string): unknown {\n const t = text.trim()\n if (t === '') return ''\n try {\n return JSON.parse(t)\n } catch {\n return text\n }\n}\n\nexport function writeLiteral(value: unknown): string {\n if (value === null || value === undefined) return ''\n return typeof value === 'string' ? value : JSON.stringify(value)\n}\n\nexport type ExpressionTextError = { kind: 'empty' } | { kind: 'unparseable'; detail: string } | { kind: 'missing-operation' } | { kind: 'unknown-operation'; operation: string }\n\n/** Validates a structured-text document holding one expression tree. */\nexport function parseExpressionText(text: string, catalog?: ExpressionCatalog): { ok: true; value: OperationNode } | { ok: false; error: ExpressionTextError } {\n if (!text.trim()) return { ok: false, error: { kind: 'empty' } }\n let parsed: unknown\n try {\n parsed = JSON.parse(text)\n } catch (e) {\n return { ok: false, error: { kind: 'unparseable', detail: e instanceof Error ? e.message : String(e) } }\n }\n if (!isOperation(parsed) || !parsed.operation.trim()) return { ok: false, error: { kind: 'missing-operation' } }\n if (catalog && !findOperation(catalog, parsed.operation)) return { ok: false, error: { kind: 'unknown-operation', operation: parsed.operation } }\n return { ok: true, value: parsed }\n}\n\nexport const prettyJson = (v: unknown) => JSON.stringify(v, null, 2)\n","import { defineLabels } from '../internal/labels'\nimport type { ExpressionFamily } from './model'\n\nexport interface ExpressionBuilderLabels {\n families: Record<ExpressionFamily, string>\n /** Friendly names of vocabulary values (comparison, arithmetic, sort order). */\n vocabulary: Record<string, string>\n /** Friendly operation names; missing ones fall back to the engine name. */\n operations: Record<string, string>\n family: string\n operation: string\n choose: string\n kindSwitch: string\n kindOperation: string\n kindReference: string\n kindLiteral: string\n references: string\n referencePath: string\n literal: string\n literalHint: string\n addItem: string\n removeItem: string\n itemCount: string\n item: string\n raw: string\n rawError: string\n unknownOperation: string\n depthLimit: string\n loadingOperations: string\n level: string\n loopHint: string\n bindings: Record<'item' | 'index' | 'accumulator', string>\n}\n\nexport const expressionBuilderLabels = defineLabels<ExpressionBuilderLabels>('expressionBuilder', {\n en: {\n families: {\n aggregation: 'Aggregation',\n list: 'List shaping',\n set: 'Set algebra',\n object: 'Object shaping',\n arithmetic: 'Arithmetic',\n text: 'Text',\n logic: 'Logic',\n conversion: 'Type conversion',\n datetime: 'Date and time',\n pattern: 'Pattern matching',\n utility: 'Utility',\n core: 'Core',\n },\n vocabulary: {\n eq: 'equals',\n ne: 'differs from',\n gt: 'greater than',\n gte: 'at least',\n lt: 'less than',\n lte: 'at most',\n add: 'add',\n subtract: 'subtract',\n multiply: 'multiply',\n divide: 'divide',\n modulo: 'remainder',\n power: 'power',\n asc: 'ascending',\n desc: 'descending',\n },\n operations: {},\n family: 'Family',\n operation: 'Operation',\n choose: 'Choose an operation',\n kindSwitch: 'Operand kind',\n kindOperation: 'Operation',\n kindReference: 'Reference',\n kindLiteral: 'Value',\n references: 'Available references',\n referencePath: 'Reference path',\n literal: 'Value',\n literalHint: 'Text, a number, true, false or structured data',\n addItem: 'Add item',\n removeItem: 'Remove item {n}',\n itemCount: '{count, plural, one {# item} other {# items}}',\n item: 'Item {n}',\n raw: 'Structured value',\n rawError: 'Not valid structured data: {detail}',\n unknownOperation: 'The engine does not list the operation {name}. Its operands stay editable.',\n depthLimit: 'Deepest nesting level reached. Edit this part as structured text.',\n loadingOperations: 'Loading operations',\n level: '{key}, level {level}',\n loopHint: 'Inside this part, {names} refer to the element being processed.',\n bindings: { item: 'item', index: 'index', accumulator: 'accumulator' },\n },\n 'pt-BR': {\n operations: {},\n families: {\n aggregation: 'Agregação',\n list: 'Listas',\n set: 'Conjuntos',\n object: 'Objetos',\n arithmetic: 'Aritmética',\n text: 'Texto',\n logic: 'Lógica',\n conversion: 'Conversão de tipo',\n datetime: 'Data e hora',\n pattern: 'Padrões',\n utility: 'Utilidades',\n core: 'Núcleo',\n },\n vocabulary: {\n eq: 'igual a',\n ne: 'diferente de',\n gt: 'maior que',\n gte: 'pelo menos',\n lt: 'menor que',\n lte: 'no máximo',\n add: 'somar',\n subtract: 'subtrair',\n multiply: 'multiplicar',\n divide: 'dividir',\n modulo: 'resto',\n power: 'potência',\n asc: 'crescente',\n desc: 'decrescente',\n },\n family: 'Família',\n operation: 'Operação',\n choose: 'Escolha uma operação',\n kindSwitch: 'Tipo de operando',\n kindOperation: 'Operação',\n kindReference: 'Referência',\n kindLiteral: 'Valor',\n references: 'Referências disponíveis',\n referencePath: 'Caminho da referência',\n literal: 'Valor',\n literalHint: 'Texto, número, true, false ou dado estruturado',\n addItem: 'Adicionar item',\n removeItem: 'Remover item {n}',\n itemCount: '{count, plural, one {# item} other {# itens}}',\n item: 'Item {n}',\n raw: 'Valor estruturado',\n rawError: 'Dado estruturado inválido: {detail}',\n unknownOperation: 'O motor não lista a operação {name}. Os operandos continuam editáveis.',\n depthLimit: 'Nível máximo de aninhamento. Edite esta parte como texto estruturado.',\n loadingOperations: 'Carregando operações',\n level: '{key}, nível {level}',\n loopHint: 'Dentro desta parte, {names} se referem ao elemento em processamento.',\n bindings: { item: 'item', index: 'índice', accumulator: 'acumulador' },\n },\n es: {\n families: {\n aggregation: 'Agregación',\n list: 'Listas',\n set: 'Conjuntos',\n object: 'Objetos',\n arithmetic: 'Aritmética',\n text: 'Texto',\n logic: 'Lógica',\n conversion: 'Conversión de tipo',\n datetime: 'Fecha y hora',\n pattern: 'Patrones',\n utility: 'Utilidades',\n core: 'Núcleo',\n },\n vocabulary: {\n eq: 'igual a',\n ne: 'distinto de',\n gt: 'mayor que',\n gte: 'al menos',\n lt: 'menor que',\n lte: 'como máximo',\n add: 'sumar',\n subtract: 'restar',\n multiply: 'multiplicar',\n divide: 'dividir',\n modulo: 'resto',\n power: 'potencia',\n asc: 'ascendente',\n desc: 'descendente',\n },\n operations: {},\n family: 'Familia',\n operation: 'Operación',\n choose: 'Elija una operación',\n kindSwitch: 'Tipo de operando',\n kindOperation: 'Operación',\n kindReference: 'Referencia',\n kindLiteral: 'Valor',\n references: 'Referencias disponibles',\n referencePath: 'Ruta de la referencia',\n literal: 'Valor',\n literalHint: 'Texto, número, true, false o dato estructurado',\n addItem: 'Añadir elemento',\n removeItem: 'Quitar elemento {n}',\n itemCount: '{count, plural, one {# elemento} other {# elementos}}',\n item: 'Elemento {n}',\n raw: 'Valor estructurado',\n rawError: 'Dato estructurado no válido: {detail}',\n unknownOperation: 'El motor no incluye la operación {name}. Sus operandos siguen siendo editables.',\n depthLimit: 'Nivel máximo de anidamiento. Edite esta parte como texto estructurado.',\n loadingOperations: 'Cargando operaciones',\n level: '{key}, nivel {level}',\n loopHint: 'Dentro de esta parte, {names} se refieren al elemento en proceso.',\n bindings: { item: 'elemento', index: 'índice', accumulator: 'acumulador' },\n },\n})\n","import { createContext, useContext, type ReactNode } from 'react'\nimport type { ExpressionCatalog } from './model'\n\nexport interface ExpressionCatalogState {\n /** Undefined while the host is still loading the engine's vocabulary. */\n catalog?: ExpressionCatalog\n loading?: boolean\n}\n\nconst Ctx = createContext<ExpressionCatalogState>({})\n\n/** Supplies the engine's operation vocabulary to every builder below it. */\nexport function ExpressionCatalogProvider({ catalog, loading, children }: ExpressionCatalogState & { children: ReactNode }) {\n return <Ctx.Provider value={{ ...(catalog ? { catalog } : {}), ...(loading !== undefined ? { loading } : {}) }}>{children}</Ctx.Provider>\n}\n\n/** A prop catalog wins over the provider's. */\nexport function useExpressionCatalog(own?: ExpressionCatalog): ExpressionCatalogState {\n const ctx = useContext(Ctx)\n return own ? { catalog: own, loading: false } : ctx\n}\n","// A small sample vocabulary for the gallery and tests. It is NOT the engine's\n// catalog: hosts pass the one their backend serves. The names below match the\n// shapes produced by normalizeRuleCondition (compare, and, or, not, matches,\n// coalesce) so rules render in the visual builder.\n\nimport type { ExpressionCatalog } from './model'\n\nexport const exampleExpressionCatalog: ExpressionCatalog = {\n operations: [\n { name: 'count', family: 'aggregation', yields: 'number', operands: [{ key: 'list', kind: 'expression' }] },\n { name: 'sum', family: 'aggregation', yields: 'number', operands: [{ key: 'list', kind: 'expression' }] },\n { name: 'map', family: 'list', yields: 'list', operands: [{ key: 'list', kind: 'expression' }, { key: 'body', kind: 'expression', binds: ['item', 'index'] }] },\n { name: 'filter', family: 'list', yields: 'list', operands: [{ key: 'list', kind: 'expression' }, { key: 'where', kind: 'expression', binds: ['item', 'index'] }] },\n { name: 'sort', family: 'list', yields: 'list', operands: [{ key: 'list', kind: 'expression' }, { key: 'order', kind: 'param', vocabulary: 'sortOrder' }] },\n {\n name: 'fold',\n family: 'list',\n yields: 'any',\n operands: [\n { key: 'list', kind: 'expression' },\n { key: 'initial', kind: 'expression' },\n { key: 'body', kind: 'expression', binds: ['accumulator', 'item', 'index'] },\n ],\n },\n { name: 'union', family: 'set', yields: 'list', operands: [{ key: 'lists', kind: 'list' }] },\n { name: 'pick', family: 'object', yields: 'object', operands: [{ key: 'object', kind: 'expression' }, { key: 'keys', kind: 'raw' }] },\n { name: 'arithmetic', family: 'arithmetic', yields: 'number', operands: [{ key: 'op', kind: 'param', vocabulary: 'arithmetic' }, { key: 'left', kind: 'expression' }, { key: 'right', kind: 'expression' }] },\n { name: 'concat', family: 'text', yields: 'string', operands: [{ key: 'parts', kind: 'list' }] },\n { name: 'compare', family: 'logic', yields: 'boolean', operands: [{ key: 'op', kind: 'param', vocabulary: 'comparison' }, { key: 'left', kind: 'expression' }, { key: 'right', kind: 'expression' }] },\n { name: 'and', family: 'logic', yields: 'boolean', operands: [{ key: 'conditions', kind: 'list' }] },\n { name: 'or', family: 'logic', yields: 'boolean', operands: [{ key: 'conditions', kind: 'list' }] },\n { name: 'not', family: 'logic', yields: 'boolean', operands: [{ key: 'condition', kind: 'expression' }] },\n { name: 'is_empty', family: 'logic', yields: 'boolean', operands: [{ key: 'value', kind: 'expression' }] },\n { name: 'in', family: 'logic', yields: 'boolean', operands: [{ key: 'value', kind: 'expression' }, { key: 'list', kind: 'expression' }] },\n { name: 'to_number', family: 'conversion', yields: 'number', operands: [{ key: 'value', kind: 'expression' }] },\n { name: 'days_between', family: 'datetime', yields: 'number', operands: [{ key: 'from', kind: 'expression' }, { key: 'to', kind: 'expression' }] },\n { name: 'matches', family: 'pattern', yields: 'boolean', operands: [{ key: 'text', kind: 'expression' }, { key: 'pattern', kind: 'expression' }] },\n { name: 'lookup', family: 'utility', yields: 'any', operands: [{ key: 'key', kind: 'expression' }, { key: 'table', kind: 'raw' }] },\n { name: 'coalesce', family: 'core', yields: 'any', operands: [{ key: 'values', kind: 'list' }] },\n { name: 'identity', family: 'core', yields: 'any', operands: [{ key: 'value', kind: 'expression' }] },\n ],\n}\n","// What every level of one expression builder shares (strings, catalog,\n// limits), plus the small helpers the levels use.\n\nimport { createContext, useContext, type ReactNode } from 'react'\nimport { fill } from '../../internal/labels'\nimport type { ExpressionBuilderLabels } from '../labels'\nimport type { ExpressionCatalog, LoopBinding, PickerEntry } from '../model'\n\nexport interface BuilderEnv {\n words: ExpressionBuilderLabels\n locale: string\n catalog: ExpressionCatalog | undefined\n catalogPending: boolean\n depthLimit: number\n /** Palette below the root (always the full expression palette). */\n innerPalette: PickerEntry[]\n}\n\nconst EnvContext = createContext<BuilderEnv | null>(null)\nexport const BuilderEnvProvider = EnvContext.Provider\n\nexport function useBuilderEnv(): BuilderEnv {\n const env = useContext(EnvContext)\n if (!env) throw new Error('Expression builder parts must be inside ExpressionBuilder.')\n return env\n}\n\n/** Name shown for a picker entry: its flattened verb when it has one, else the operation. */\nexport function entryLabel(words: ExpressionBuilderLabels, entry: PickerEntry): string {\n if (entry.verb) return words.vocabulary[entry.verb.value] ?? entry.verb.value\n return words.operations[entry.op.name] ?? entry.op.name\n}\n\n/** Loop variables (engine identifiers) come first among the chips of their subtree. */\nexport function chipsWithLoopNames(references: readonly string[], binds: readonly LoopBinding[] | undefined): string[] {\n const extra = (binds ?? []).filter((b) => !references.includes(b))\n return [...extra, ...references]\n}\n\n/** Accessible name of a group at `depth` (0-based) for operand `key`. */\nexport function groupName(words: ExpressionBuilderLabels, key: string, depth: number): string {\n return fill(words.level, { key, level: depth + 1 })\n}\n\n/** Header shared by operand groups: the key in mono and the level as text (depth never by colour). */\nexport function SlotHeading({ slotKey, trailing }: { slotKey: string; trailing: ReactNode }) {\n return (\n <div className=\"ty-expr__slot-head\">\n <code className=\"ty-expr__slot-key\" dir=\"ltr\">\n {slotKey}\n </code>\n {trailing}\n </div>\n )\n}\n","// A list operand: numbered items, each drawn by the caller, with remove and\n// add. After a removal focus lands on the item that took the removed one's\n// place (its kind switch), or on \"add item\" when none did.\n\nimport { useEffect, useRef, useState, type ReactNode } from 'react'\nimport { Plus, Trash2 } from 'lucide-react'\nimport { Button, Tag } from '../../../index'\nimport { fill } from '../../internal/labels'\nimport { groupName, SlotHeading, useBuilderEnv } from './shared'\n\n/** Where focus should go after items change; resolved once the DOM has updated. */\nfunction useFocusLanding(dependency: unknown) {\n const [target, setTarget] = useState<number | null>(null)\n const holders = useRef(new Map<number, HTMLElement>())\n const fallback = useRef<HTMLButtonElement>(null)\n useEffect(() => {\n if (target === null) return\n const holder = holders.current.get(target)\n const radio = holder?.querySelector<HTMLInputElement>('input[type=\"radio\"]:checked') ?? holder?.querySelector<HTMLInputElement>('input[type=\"radio\"]')\n ;(radio ?? fallback.current)?.focus()\n setTarget(null)\n }, [target, dependency])\n const holderRef = (index: number) => (el: HTMLElement | null) => {\n if (el) holders.current.set(index, el)\n else holders.current.delete(index)\n }\n return { land: setTarget, holderRef, fallback }\n}\n\nexport interface ItemListProps {\n slotKey: string\n items: unknown[]\n depth: number\n onItems: (items: unknown[]) => void\n /** Draws item `index`; `switchRef` must reach its kind switch. */\n drawItem: (args: { index: number; item: unknown; name: string; onItem: (v: unknown) => void; switchRef: (el: HTMLElement | null) => void }) => ReactNode\n}\n\nexport function ItemList({ slotKey, items, depth, onItems, drawItem }: ItemListProps) {\n const { words, locale } = useBuilderEnv()\n const focus = useFocusLanding(items.length)\n const remove = (index: number) => {\n onItems(items.filter((_, j) => j !== index))\n focus.land(index < items.length - 1 ? index : -1)\n }\n const rows = items.map((item, index) => (\n <li key={index} className=\"ty-expr__item\">\n <span className=\"ty-expr__item-number\" aria-hidden=\"true\">\n {index + 1}\n </span>\n <div className=\"ty-expr__item-body\">\n {drawItem({\n index,\n item,\n name: fill(words.item, { n: index + 1 }),\n onItem: (v) => onItems(items.map((x, j) => (j === index ? v : x))),\n switchRef: focus.holderRef(index),\n })}\n </div>\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={fill(words.removeItem, { n: index + 1 })} leadingIcon={<Trash2 />} onPress={() => remove(index)} />\n </li>\n ))\n return (\n <div className=\"ty-expr__list\" role=\"group\" aria-label={groupName(words, slotKey, depth)}>\n <SlotHeading slotKey={slotKey} trailing={<Tag size=\"small\">{fill(words.itemCount, { count: items.length }, locale)}</Tag>} />\n {rows.length ? <ol className=\"ty-expr__items\">{rows}</ol> : null}\n <Button ref={focus.fallback} variant=\"secondary\" size=\"compact\" leadingIcon={<Plus />} onPress={() => onItems([...items, { value: null }])}>\n {words.addItem}\n </Button>\n </div>\n )\n}\n","// Leaf editors of the expression builder: reference chips, literal text,\n// plain parameters and raw JSON. None of them nests further.\n\nimport { useEffect, useReducer, useRef, useState } from 'react'\nimport { ToggleButton } from 'react-aria-components'\nimport { ListboxSelect, TextArea, TextField } from '../../../index'\nimport { fill } from '../../internal/labels'\nimport { prettyJson, readLiteral, vocabularyOf, writeLiteral, type OperandSlotSpec } from '../model'\nimport { useBuilderEnv } from './shared'\n\nexport function ReferencePicker({ current, offered, onPick }: { current: string; offered: readonly string[]; onPick: (ref: string) => void }) {\n const { words } = useBuilderEnv()\n const chips = offered.map((ref) => (\n <ToggleButton key={ref} className=\"ty-expr__chip\" isSelected={ref === current} onChange={() => onPick(ref)}>\n <code dir=\"ltr\">{ref}</code>\n </ToggleButton>\n ))\n return (\n <div className=\"ty-expr__reference\">\n {chips.length ? (\n <div className=\"ty-expr__chips\" role=\"group\" aria-label={words.references}>\n {chips}\n </div>\n ) : null}\n <TextField label={words.referencePath} value={current} onChange={onPick} className=\"ty-expr__mono\" />\n </div>\n )\n}\n\n/**\n * Text that mirrors a value without fighting the person typing: an outside\n * change rewrites the text, the text's own echo does not.\n */\nfunction useMirroredText(value: unknown, print: (v: unknown) => string) {\n const [text, setText] = useState(() => print(value))\n const lastSent = useRef<unknown>(value)\n useEffect(() => {\n if (JSON.stringify(lastSent.current) !== JSON.stringify(value)) {\n lastSent.current = value\n setText(print(value))\n }\n // print is stable per caller\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value])\n return { text, setText, remember: (v: unknown) => (lastSent.current = v) }\n}\n\n/** Free text, read as structured data when it parses. */\nexport function LiteralText({ value, onValue }: { value: unknown; onValue: (v: unknown) => void }) {\n const { words } = useBuilderEnv()\n const mirror = useMirroredText(value, writeLiteral)\n return (\n <TextField\n label={words.literal}\n hint={words.literalHint}\n value={mirror.text}\n onChange={(typed) => {\n mirror.setText(typed)\n onValue(mirror.remember(readLiteral(typed)))\n }}\n />\n )\n}\n\n/** A plain parameter, or a friendly select when its vocabulary is known. */\nexport function ParameterField({ slot, value, onValue }: { slot: OperandSlotSpec; value: unknown; onValue: (v: unknown) => void }) {\n const { words } = useBuilderEnv()\n const vocabulary = vocabularyOf(slot)\n if (!vocabulary) {\n return <TextField label={slot.key} value={value == null ? '' : String(value)} onChange={(t) => onValue(readLiteral(t))} />\n }\n const options = vocabulary.map((w) => ({ value: w, label: words.vocabulary[w] ?? w }))\n return <ListboxSelect label={slot.key} value={typeof value === 'string' ? value : null} options={options} onChange={onValue} />\n}\n\ntype RawState = { text: string; problem?: string }\n\n/** JSON for operands the builder cannot shape; a broken text keeps the last good value. */\nexport function RawJson({ label, value, onValue }: { label: string; value: unknown; onValue: (v: unknown) => void }) {\n const { words } = useBuilderEnv()\n const [state, set] = useReducer((_: RawState, next: RawState) => next, value, (v): RawState => ({ text: prettyJson(v ?? {}) }))\n const change = (text: string) => {\n let parsed: unknown\n try {\n parsed = JSON.parse(text)\n } catch (err) {\n set({ text, problem: fill(words.rawError, { detail: err instanceof Error ? err.message : String(err) }) })\n return\n }\n set({ text })\n onValue(parsed)\n }\n return <TextArea label={label} monospace rows={4} value={state.text} errorMessage={state.problem} onChange={change} />\n}\n","// The recursive part of the expression builder: an operation (picker plus its\n// operand slots) and an operand (kind switch plus the editor of that kind).\n// Operand kinds and slot kinds are both driven by descriptor tables.\n\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { InlineNotice, ListboxSelect, SegmentedControl } from '../../../index'\nimport { fill } from '../../internal/labels'\nimport type { ExpressionBuilderLabels } from '../labels'\nimport { EXPRESSION_FAMILIES, entryIdOf, findOperation, inferSlots, isLiteral, isOperation, isReference, seedOperation, type ExpressionNode, type OperandSlotSpec, type OperationNode, type PickerEntry } from '../model'\nimport { ItemList } from './ItemList'\nimport { LiteralText, ParameterField, RawJson, ReferencePicker } from './leaves'\nimport { chipsWithLoopNames, entryLabel, groupName, SlotHeading, useBuilderEnv } from './shared'\n\ntype OperandKind = 'operation' | 'reference' | 'literal'\n\ninterface OperandEnv {\n value: unknown\n set: (v: ExpressionNode) => void\n depth: number\n refs: readonly string[]\n palette: PickerEntry[]\n}\n\n/** The three shapes an expression operand can take: its switch label, its starter and its editor. */\nconst OPERAND_KINDS: ReadonlyArray<{\n kind: OperandKind\n word: keyof ExpressionBuilderLabels\n matches: (v: unknown) => boolean\n starter: (e: OperandEnv) => ExpressionNode\n editor: (e: OperandEnv) => ReactNode\n}> = [\n {\n kind: 'operation',\n word: 'kindOperation',\n matches: isOperation,\n starter: (e) => (e.palette[0] ? seedOperation(e.palette[0]) : { operation: '' }),\n editor: (e) => (\n <div className=\"ty-expr__nested\" data-depth={e.depth}>\n <OperationEditor node={e.value as OperationNode} onNode={e.set} depth={e.depth} refs={e.refs} palette={e.palette} />\n </div>\n ),\n },\n {\n kind: 'reference',\n word: 'kindReference',\n matches: isReference,\n starter: (e) => ({ ref: e.refs[0] ?? '' }),\n editor: (e) => <ReferencePicker current={(e.value as { ref: string }).ref} offered={e.refs} onPick={(ref) => e.set({ ref })} />,\n },\n {\n kind: 'literal',\n word: 'kindLiteral',\n matches: () => true,\n starter: () => ({ value: '' }),\n editor: (e) => <LiteralText value={isLiteral(e.value) ? e.value.value : e.value} onValue={(v) => e.set({ value: v })} />,\n },\n]\n\nconst kindOf = (v: unknown) => OPERAND_KINDS.find((k) => k.matches(v))!\n\nexport interface OperandEditorProps {\n slotKey: string\n value: unknown\n onValue: (v: ExpressionNode) => void\n depth: number\n refs: readonly string[]\n hint?: string\n palette?: PickerEntry[]\n switchRef?: (el: HTMLElement | null) => void\n}\n\nexport function OperandEditor({ slotKey, value, onValue, depth, refs, hint, palette, switchRef }: OperandEditorProps) {\n const { words, innerPalette } = useBuilderEnv()\n const env: OperandEnv = { value, set: onValue, depth, refs, palette: palette ?? innerPalette }\n const current = kindOf(value)\n return (\n <div className=\"ty-expr__slot\" role=\"group\" aria-label={groupName(words, slotKey, depth)} data-depth={depth}>\n <SlotHeading\n slotKey={slotKey}\n trailing={\n <span className=\"ty-expr__level\" aria-hidden=\"true\">\n {depth + 1}\n </span>\n }\n />\n {hint ? <p className=\"ty-expr__hint\">{hint}</p> : null}\n <div ref={switchRef} className=\"ty-expr__kind\">\n <SegmentedControl\n label={words.kindSwitch}\n size=\"compact\"\n value={current.kind}\n onChange={(k) => onValue(OPERAND_KINDS.find((d) => d.kind === k)!.starter(env))}\n options={OPERAND_KINDS.map((d) => ({ value: d.kind, label: words[d.word] as string }))}\n />\n </div>\n {current.editor(env)}\n </div>\n )\n}\n\ninterface SlotEnv {\n slot: OperandSlotSpec\n value: unknown\n set: (v: unknown) => void\n depth: number\n refs: string[]\n words: ExpressionBuilderLabels\n}\n\n/** How each slot kind of an operation is edited. */\nconst SLOT_EDITORS: Record<OperandSlotSpec['kind'], (s: SlotEnv) => ReactNode> = {\n expression: (s) => (\n <OperandEditor\n slotKey={s.slot.key}\n value={s.value}\n onValue={s.set}\n depth={s.depth + 1}\n refs={s.refs}\n {...(s.slot.binds?.length ? { hint: fill(s.words.loopHint, { names: s.slot.binds.map((b) => s.words.bindings[b]).join(', ') }) } : {})}\n />\n ),\n list: (s) => (\n <ItemList\n slotKey={s.slot.key}\n items={Array.isArray(s.value) ? s.value : []}\n depth={s.depth}\n onItems={s.set}\n drawItem={({ item, name, onItem, switchRef }) => <OperandEditor slotKey={name} value={item} depth={s.depth + 1} refs={s.refs} onValue={onItem} switchRef={switchRef} />}\n />\n ),\n param: (s) => <ParameterField slot={s.slot} value={s.value} onValue={s.set} />,\n raw: (s) => <RawJson label={s.slot.key} value={s.value} onValue={s.set} />,\n}\n\nfunction SlotEditor({ slot, value, set, depth, refs }: { slot: OperandSlotSpec; value: unknown; set: (v: unknown) => void; depth: number; refs: readonly string[] }) {\n const { words } = useBuilderEnv()\n const scoped = useMemo(() => chipsWithLoopNames(refs, slot.binds), [refs, slot.binds])\n return <>{SLOT_EDITORS[slot.kind]({ slot, value, set, depth, refs: scoped, words })}</>\n}\n\nexport interface OperationEditorProps {\n node: OperationNode | undefined\n onNode: (n: ExpressionNode) => void\n depth: number\n refs: readonly string[]\n palette: PickerEntry[]\n}\n\n/** An operation: at the depth limit a raw JSON slot; otherwise the picker and one editor per operand slot. */\nexport function OperationEditor({ node, onNode, depth, refs, palette }: OperationEditorProps) {\n const { words, catalog, depthLimit } = useBuilderEnv()\n if (node && depth >= depthLimit) {\n return (\n <>\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {words.depthLimit}\n </InlineNotice>\n <RawJson label={words.raw} value={node} onValue={(v) => onNode(v as ExpressionNode)} />\n </>\n )\n }\n const definition = node ? findOperation(catalog, node.operation) : undefined\n const pickedId = node ? entryIdOf(node, palette) : null\n // A flattened verb (add, subtract …) is chosen in the picker, not edited as a slot.\n const hiddenSlot = palette.find((e) => e.id === pickedId)?.verb?.key\n const slots = node ? (definition ? definition.operands : inferSlots(node)).filter((s) => s.key !== hiddenSlot) : []\n const unknown = !!node && !!catalog && !definition && node.operation !== ''\n return (\n <div className=\"ty-expr__operation\">\n <OperationPicker palette={palette} pickedId={pickedId} onPick={(entry) => onNode(seedOperation(entry))} />\n {unknown ? (\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {fill(words.unknownOperation, { name: node!.operation })}\n </InlineNotice>\n ) : null}\n {slots.map((slot) => (\n <SlotEditor key={slot.key} slot={slot} value={node![slot.key]} depth={depth} refs={refs} set={(v) => onNode({ ...node!, [slot.key]: v })} />\n ))}\n </div>\n )\n}\n\n/** Family, then operation. Picking another family selects that family's first operation. */\nfunction OperationPicker({ palette, pickedId, onPick }: { palette: PickerEntry[]; pickedId: string | null; onPick: (e: PickerEntry) => void }) {\n const { words, catalogPending } = useBuilderEnv()\n const families = EXPRESSION_FAMILIES.filter((f) => palette.some((e) => e.family === f))\n const pickedFamily = palette.find((e) => e.id === pickedId)?.family\n const [browsed, setBrowsed] = useState(pickedFamily ?? families[0])\n if (catalogPending && palette.length === 0) {\n return (\n <p className=\"ty-expr__loading\" role=\"status\">\n {words.loadingOperations}\n </p>\n )\n }\n const family = pickedFamily ?? browsed ?? families[0]\n return (\n <div className=\"ty-expr__picker\">\n <ListboxSelect\n label={words.family}\n value={family ?? null}\n options={families.map((f) => ({ value: f, label: words.families[f] }))}\n onChange={(f) => {\n setBrowsed(f as typeof family)\n const lead = palette.find((e) => e.family === f)\n if (lead && f !== pickedFamily) onPick(lead)\n }}\n />\n <ListboxSelect\n label={words.operation}\n placeholder={words.choose}\n value={pickedId}\n options={palette.filter((e) => e.family === family).map((e) => ({ value: e.id, label: entryLabel(words, e) }))}\n onChange={(id) => {\n const entry = palette.find((e) => e.id === id)\n if (entry) onPick(entry)\n }}\n />\n </div>\n )\n}\n","// ExpressionBuilder: builds a computation (or, in predicate mode, a yes/no\n// test) as a tree of operations, without code. The root resolves strings,\n// catalog and limits once and hands them to every level through\n// BuilderEnvProvider; the levels themselves live in ./builder. Each operand is\n// a labelled group (\"‹key›, level n\") with its level also written as text, so\n// depth is never told by colour alone.\n\nimport { useMemo } from 'react'\nimport { useFlowLocale, useLabels } from '../internal/labels'\nimport { useExpressionCatalog } from './catalogContext'\nimport { expressionBuilderLabels, type ExpressionBuilderLabels } from './labels'\nimport { MAX_EXPRESSION_DEPTH, isOperation, pickerEntries, type ExpressionCatalog, type ExpressionNode } from './model'\nimport { BuilderEnvProvider, groupName, type BuilderEnv } from './builder/shared'\nimport { OperandEditor, OperationEditor } from './builder/tree'\n\nexport { expressionBuilderLabels, type ExpressionBuilderLabels }\nexport const defaultExpressionBuilderLabels: ExpressionBuilderLabels = expressionBuilderLabels.bundles.en\n\nexport interface ExpressionBuilderProps {\n value: ExpressionNode | undefined\n onChange: (next: ExpressionNode) => void\n /** Upstream references offered as chips. */\n references?: readonly string[]\n mode?: 'expression' | 'predicate'\n /** Internal recursion depth (0 at the root). */\n depth?: number\n maxDepth?: number\n /** Overrides the ExpressionCatalogProvider. */\n catalog?: ExpressionCatalog\n labels?: Partial<ExpressionBuilderLabels>\n /** Accessible name of the root group. */\n label?: string\n}\n\n/** Everything the levels share, resolved once per builder. */\nfunction useRootEnv(props: ExpressionBuilderProps): { env: BuilderEnv; rootPalette: BuilderEnv['innerPalette'] } {\n const words = useLabels(expressionBuilderLabels, props.labels)\n const { catalog, loading } = useExpressionCatalog(props.catalog)\n const { locale } = useFlowLocale()\n const mode = props.mode ?? 'expression'\n const depthLimit = props.maxDepth ?? MAX_EXPRESSION_DEPTH\n const innerPalette = useMemo(() => pickerEntries(catalog, 'expression'), [catalog])\n const rootPalette = useMemo(() => pickerEntries(catalog, mode), [catalog, mode])\n const env = useMemo<BuilderEnv>(\n () => ({ words, locale, catalog, catalogPending: !!loading || !catalog, depthLimit, innerPalette }),\n [words, locale, catalog, loading, depthLimit, innerPalette],\n )\n return { env, rootPalette }\n}\n\nexport function ExpressionBuilder(props: ExpressionBuilderProps) {\n const { value, onChange, label } = props\n const depth = props.depth ?? 0\n const refs = props.references ?? []\n const { env, rootPalette } = useRootEnv(props)\n const { words } = env\n // A root that already holds a reference or a literal is shown as an operand with its kind switch.\n const body =\n value === undefined || isOperation(value) ? (\n <OperationEditor node={value} onNode={onChange} depth={depth} refs={refs} palette={rootPalette} />\n ) : (\n <OperandEditor slotKey={label ?? words.kindLiteral} value={value} onValue={onChange} depth={depth} refs={refs} palette={rootPalette} />\n )\n return (\n <BuilderEnvProvider value={env}>\n <div className=\"ty-expr\" data-depth={depth} role=\"group\" aria-label={label ?? groupName(words, words.operation, depth)}>\n {body}\n </div>\n </BuilderEnvProvider>\n )\n}\n","// ExpressionField: one expression edited visually (ExpressionBuilder) or as\n// structured text, with the parse error or a \"valid\" note. Invalid text never\n// replaces the last valid tree. Shared by SimulationNodeForm and the rule\n// condition builder.\n\nimport { useId, useState } from 'react'\nimport { SegmentedControl, TextArea } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { ExpressionBuilder } from './ExpressionBuilder'\nimport type { ExpressionBuilderLabels } from './labels'\nimport { useExpressionCatalog } from './catalogContext'\nimport { findOperation, isOperation, prettyJson, type ExpressionCatalog, type ExpressionNode } from './model'\n\nexport interface ExpressionFieldLabels {\n mode: string\n visual: string\n text: string\n valid: string\n unparseable: string\n notObject: string\n missingOperation: string\n unknownOperation: string\n}\n\nexport const expressionFieldLabels = defineLabels<ExpressionFieldLabels>('ExpressionField', {\n en: {\n mode: 'Editor',\n visual: 'Visual',\n text: 'Structured text',\n valid: 'Valid expression.',\n unparseable: 'Cannot read this text: {detail}',\n notObject: 'The expression must be an object.',\n missingOperation: 'The expression needs an operation.',\n unknownOperation: 'Unknown operation: {operation}',\n },\n 'pt-BR': {\n mode: 'Editor',\n visual: 'Visual',\n text: 'Texto estruturado',\n valid: 'Expressão válida.',\n unparseable: 'Não foi possível ler este texto: {detail}',\n notObject: 'A expressão precisa ser um objeto.',\n missingOperation: 'A expressão precisa de uma operação.',\n unknownOperation: 'Operação desconhecida: {operation}',\n },\n es: {\n mode: 'Editor',\n visual: 'Visual',\n text: 'Texto estructurado',\n valid: 'Expresión válida.',\n unparseable: 'No se puede leer este texto: {detail}',\n notObject: 'La expresión debe ser un objeto.',\n missingOperation: 'La expresión necesita una operación.',\n unknownOperation: 'Operación desconocida: {operation}',\n },\n})\n\nexport interface ExpressionFieldProps {\n label: string\n hint?: string\n value: ExpressionNode\n onChange: (next: ExpressionNode) => void\n references?: readonly string[]\n mode?: 'expression' | 'predicate'\n /** Allow any object (reference, literal) in text mode, not only operations. */\n acceptLeaves?: boolean\n catalog?: ExpressionCatalog\n builderLabels?: Partial<ExpressionBuilderLabels>\n labels?: Partial<ExpressionFieldLabels>\n /** Reports whether the text currently fails to parse. */\n onValidityChange?: (valid: boolean) => void\n}\n\ntype TextError = { key: 'unparseable'; detail: string } | { key: 'notObject' } | { key: 'missingOperation' } | { key: 'unknownOperation'; operation: string }\n\nfunction readText(text: string, acceptLeaves: boolean, catalog?: ExpressionCatalog): { ok: true; value: ExpressionNode } | { ok: false; error: TextError } {\n let parsed: unknown\n try {\n parsed = JSON.parse(text)\n } catch (e) {\n return { ok: false, error: { key: 'unparseable', detail: e instanceof Error ? e.message : String(e) } }\n }\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return { ok: false, error: { key: 'notObject' } }\n if (!isOperation(parsed)) {\n if (acceptLeaves && ('ref' in parsed || 'value' in parsed)) return { ok: true, value: parsed as ExpressionNode }\n return { ok: false, error: { key: 'missingOperation' } }\n }\n if (catalog && !findOperation(catalog, parsed.operation)) return { ok: false, error: { key: 'unknownOperation', operation: parsed.operation } }\n return { ok: true, value: parsed }\n}\n\nexport function ExpressionField(props: ExpressionFieldProps) {\n const { label, hint, value, onChange, references = [], mode = 'expression', acceptLeaves = false, builderLabels, onValidityChange } = props\n const l = useLabels(expressionFieldLabels, props.labels)\n const { locale } = useFlowLocale()\n const { catalog } = useExpressionCatalog(props.catalog)\n const groupId = useId()\n const [view, setView] = useState<'visual' | 'text'>('visual')\n const [text, setText] = useState(() => prettyJson(value))\n const [error, setError] = useState<TextError | null>(null)\n\n const message = error ? fill(l[error.key], error.key === 'unparseable' ? { detail: error.detail } : error.key === 'unknownOperation' ? { operation: error.operation } : {}, locale) : null\n\n return (\n <div className=\"ty-expr-form__field-group\" role=\"group\" aria-labelledby={groupId}>\n <span id={groupId} className=\"ty-expr-form__legend\">\n {label}\n </span>\n {hint ? <p className=\"ty-expr__hint\">{hint}</p> : null}\n <SegmentedControl\n label={`${label}: ${l.mode}`}\n size=\"compact\"\n value={view}\n onChange={(v) => {\n if (v === 'text') {\n setText(prettyJson(value))\n setError(null)\n onValidityChange?.(true)\n }\n setView(v as 'visual' | 'text')\n }}\n options={[\n { value: 'visual', label: l.visual },\n { value: 'text', label: l.text },\n ]}\n />\n {view === 'visual' ? (\n <ExpressionBuilder label={label} value={value} onChange={onChange} references={references} mode={mode} {...(props.catalog ? { catalog: props.catalog } : {})} {...(builderLabels ? { labels: builderLabels } : {})} />\n ) : (\n <>\n <TextArea\n className=\"ty-expr-form__code\"\n label={label}\n monospace\n rows={6}\n value={text}\n onChange={(t) => {\n setText(t)\n const r = readText(t, acceptLeaves, catalog)\n if (r.ok) {\n setError(null)\n onChange(r.value)\n } else setError(r.error)\n onValidityChange?.(r.ok)\n }}\n {...(message ? { errorMessage: message } : {})}\n />\n {!error ? (\n <p className=\"ty-expr-form__valid\" role=\"status\">\n {l.valid}\n </p>\n ) : null}\n </>\n )}\n </div>\n )\n}\n","// Shared footer of every node configuration form: a divider, then Cancel\n// (secondary) and Save (primary) aligned to the end. Save is an explicit\n// button; Enter in a single-line field never submits by itself.\n\nimport { Button } from '../../index'\nimport { defineLabels, useLabels } from '../internal/labels'\n\nexport interface NodeFormFooterLabels {\n save: string\n cancel: string\n}\n\nexport const nodeFormFooterLabels = defineLabels<NodeFormFooterLabels>('NodeFormFooter', {\n en: { save: 'Save', cancel: 'Cancel' },\n 'pt-BR': { save: 'Salvar', cancel: 'Cancelar' },\n es: { save: 'Guardar', cancel: 'Cancelar' },\n})\n\nexport const defaultNodeFormFooterLabels: NodeFormFooterLabels = nodeFormFooterLabels.bundles.en\n\nexport interface NodeFormFooterProps {\n onSave: () => void\n onCancel: () => void\n saveDisabled?: boolean\n /** Id of the element explaining why Save is disabled. */\n disabledReasonId?: string\n labels?: Partial<NodeFormFooterLabels>\n}\n\nexport function NodeFormFooter({ onSave, onCancel, saveDisabled = false, disabledReasonId, labels }: NodeFormFooterProps) {\n const l = useLabels(nodeFormFooterLabels, labels)\n return (\n <div className=\"ty-node-form-footer\" data-ty-form-footer=\"\">\n <Button variant=\"secondary\" onPress={onCancel}>\n {l.cancel}\n </Button>\n <span className=\"ty-node-form-footer__save\" aria-describedby={saveDisabled ? disabledReasonId : undefined}>\n <Button variant=\"primary\" disabled={saveDisabled} onPress={onSave}>\n {l.save}\n </Button>\n </span>\n </div>\n )\n}\n","// Side panel of the compute form's text mode: three sources of fragments\n// (operations by family, references, named examples). Each source is a\n// descriptor that lists groups of pickable fragments; one renderer draws any\n// source, and picking inserts the fragment at the caret.\n\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { Button as AriaButton } from 'react-aria-components'\nimport { SegmentedControl, TextField } from '../../index'\nimport { fill } from '../internal/labels'\nimport { EXPRESSION_FAMILIES, pickerEntries, prettyJson, seedOperation, type ExpressionCatalog, type OperationNode } from './model'\n\nexport interface InsertExample {\n id: string\n expression: OperationNode\n}\n\nexport interface InsertPanelWords {\n referencePanel: string\n operations: string\n references: string\n examples: string\n searchOperations: string\n noOperations: string\n familyCount: string\n exampleNames: Record<string, string>\n familyNames?: Record<string, string>\n}\n\ntype SourceId = 'operations' | 'references' | 'examples'\n\ninterface Pick {\n key: string\n face: ReactNode\n fragment: string\n}\n\ninterface PickGroup {\n key: string\n title?: string\n picks: Pick[]\n}\n\nconst asCode = (text: string) => (\n <code className=\"ty-compute__ref\" dir=\"ltr\">\n {text}\n </code>\n)\n\ninterface SourceInput {\n catalog: ExpressionCatalog | undefined\n refs: readonly string[]\n examples: readonly InsertExample[]\n words: InsertPanelWords\n locale: string\n query: string\n}\n\n/** Each source turns the panel's inputs into titled groups of picks. */\nconst SOURCES: Record<SourceId, (i: SourceInput) => PickGroup[]> = {\n operations: ({ catalog, words, locale, query }) => {\n const needle = query.trim().toLocaleLowerCase(locale)\n const entries = pickerEntries(catalog, 'expression')\n const groups: PickGroup[] = []\n for (const family of EXPRESSION_FAMILIES) {\n const picks = entries\n .filter((e) => e.family === family && (needle === '' || e.id.toLocaleLowerCase(locale).includes(needle)))\n .map((e) => ({ key: e.id, face: asCode(e.id), fragment: JSON.stringify(seedOperation(e)) }))\n if (picks.length) groups.push({ key: family, title: fill(words.familyCount, { family: words.familyNames?.[family] ?? family, count: picks.length }, locale), picks })\n }\n return groups\n },\n references: ({ refs, words }) => [{ key: 'refs', title: words.references, picks: refs.map((r) => ({ key: r, face: asCode(r), fragment: JSON.stringify({ ref: r }) })) }],\n examples: ({ examples, words }) => [\n { key: 'examples', title: words.examples, picks: examples.map((x) => ({ key: x.id, face: words.exampleNames[x.id] ?? x.id, fragment: prettyJson(x.expression) })) },\n ],\n}\n\nexport function ComputeInsertPanel(props: { catalog: ExpressionCatalog | undefined; refs: readonly string[]; examples: readonly InsertExample[]; words: InsertPanelWords; locale: string; onPick: (fragment: string) => void }) {\n const { words, onPick } = props\n const [source, setSource] = useState<SourceId>('operations')\n const [query, setQuery] = useState('')\n const groups = useMemo(() => SOURCES[source]({ ...props, query }), [source, props, query])\n const titledAsSection = source === 'operations'\n\n return (\n <div className=\"ty-expr-form__panel\">\n <SegmentedControl\n label={words.referencePanel}\n size=\"compact\"\n value={source}\n onChange={(v) => setSource(v as SourceId)}\n options={(Object.keys(SOURCES) as SourceId[]).map((id) => ({ value: id, label: words[id] }))}\n />\n {source === 'operations' ? <TextField mode=\"search\" label={words.searchOperations} value={query} onChange={setQuery} /> : null}\n {source === 'operations' && groups.length === 0 ? (\n <p className=\"ty-expr__hint\" role=\"status\">\n {words.noOperations}\n </p>\n ) : null}\n {groups.map((group) => {\n const list = (\n <ul className=\"ty-expr-form__insert-list\" {...(titledAsSection ? {} : { 'aria-label': group.title })}>\n {group.picks.map((pick) => (\n <li key={pick.key}>\n <AriaButton className=\"ty-expr-form__insert\" onPress={() => onPick(pick.fragment)}>\n {pick.face}\n </AriaButton>\n </li>\n ))}\n </ul>\n )\n return titledAsSection ? (\n <section key={group.key} className=\"ty-expr-form__family\" aria-label={group.title}>\n <h4 className=\"ty-expr-form__family-title\">{group.title}</h4>\n {list}\n </section>\n ) : (\n <div key={group.key}>{list}</div>\n )\n })}\n </div>\n )\n}\n","// State of the compute form's expression, independent of its markup: the tree,\n// its JSON text and the text's problem move together through one reducer, so\n// a bad text never loses the last good tree.\n\nimport { useEffect, useReducer, useRef } from 'react'\nimport { fill } from '../internal/labels'\nimport { FLOW_INPUTS_REF, parseExpressionText, prettyJson, type ExpressionCatalog, type ExpressionTextError, type OperationNode } from './model'\n\n/** Seeded into a blank document: hands the flow's inputs through unchanged. */\nexport const PASS_THROUGH: OperationNode = { operation: 'identity', value: { ref: FLOW_INPUTS_REF } }\n\n/** Keys of the earlier script-based compute step, dropped on load. */\nexport const LEGACY_SCRIPT_KEYS = ['script', 'code', 'language', 'runtime'] as const\n\n/** The stored configuration minus the old script keys. */\nexport function withoutScriptKeys(config: Record<string, unknown>): Record<string, unknown> {\n const legacy = new Set<string>(LEGACY_SCRIPT_KEYS)\n const out: Record<string, unknown> = {}\n for (const key of Object.keys(config)) if (!legacy.has(key)) out[key] = config[key]\n return out\n}\n\n/** The tree to start from: the stored operation, or the pass-through. */\nexport function openingTree(config: Record<string, unknown>): OperationNode {\n const candidate = config.expression\n const usable = !!candidate && typeof candidate === 'object' && typeof (candidate as { operation?: unknown }).operation === 'string'\n return usable ? (candidate as OperationNode) : PASS_THROUGH\n}\n\ntype ProblemWords = { unparseable: string; missingOperation: string; unknownOperation: string }\n\n/** Sentence for a text problem; null for an empty document (no message). */\nexport function textErrorMessage(error: ExpressionTextError, words: ProblemWords, locale?: string): string | null {\n if (error.kind === 'empty') return null\n if (error.kind === 'missing-operation') return words.missingOperation\n if (error.kind === 'unparseable') return fill(words.unparseable, { detail: error.detail }, locale)\n return fill(words.unknownOperation, { name: error.operation }, locale)\n}\n\n/** Sample data text: blank means \"none\"; otherwise a JSON object is required. */\nexport function sampleFromText(text: string): { ok: true; value: Record<string, unknown> | undefined } | { ok: false; reason: string } {\n if (text.trim() === '') return { ok: true, value: undefined }\n try {\n const value: unknown = JSON.parse(text)\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) return { ok: true, value: value as Record<string, unknown> }\n return { ok: false, reason: 'object expected' }\n } catch (err) {\n return { ok: false, reason: err instanceof Error ? err.message : String(err) }\n }\n}\n\ninterface DraftState {\n tree: OperationNode\n text: string\n problem: ExpressionTextError | null\n}\n\ntype DraftMove = { to: 'text'; text: string; catalog: ExpressionCatalog | undefined } | { to: 'tree'; tree: OperationNode } | { to: 'reprint' }\n\nfunction draftReducer(state: DraftState, move: DraftMove): DraftState {\n if (move.to === 'tree') return { ...state, tree: move.tree }\n if (move.to === 'reprint') return { ...state, text: prettyJson(state.tree), problem: null }\n const read = parseExpressionText(move.text, move.catalog)\n return read.ok ? { tree: read.value, text: move.text, problem: null } : { ...state, text: move.text, problem: read.error }\n}\n\n/**\n * The expression as tree and text. `splice` inserts a fragment at the caret\n * (or replaces a blank document) and puts the caret after it.\n */\nexport function useComputeDraft(start: OperationNode, catalog: ExpressionCatalog | undefined) {\n const [state, move] = useReducer(draftReducer, start, (tree) => ({ tree, text: prettyJson(tree), problem: null }))\n const textArea = useRef<HTMLTextAreaElement>(null)\n const pendingCaret = useRef<number | null>(null)\n\n useEffect(() => {\n const at = pendingCaret.current\n if (at === null || !textArea.current) return\n pendingCaret.current = null\n textArea.current.focus()\n textArea.current.setSelectionRange(at, at)\n }, [state.text])\n\n const editText = (text: string) => move({ to: 'text', text, catalog })\n const splice = (fragment: string) => {\n if (state.text.trim() === '') {\n pendingCaret.current = fragment.length\n editText(fragment)\n return\n }\n const el = textArea.current\n const start = el?.selectionStart ?? state.text.length\n const end = el?.selectionEnd ?? start\n pendingCaret.current = start + fragment.length\n editText(state.text.slice(0, start) + fragment + state.text.slice(end))\n }\n return {\n ...state,\n textArea,\n editText,\n splice,\n setTree: (tree: OperationNode) => move({ to: 'tree', tree }),\n reprint: () => move({ to: 'reprint' }),\n }\n}\n","// TraceTree: how an expression evaluated, one row per evaluated sub-expression\n// (APG Tree View on React Aria Tree). Enter or the preview button toggles the\n// full result under a row; results are clamped by lines, never cut.\n\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { Button as AriaButton, Tree, TreeItem, TreeItemContent, type Key } from 'react-aria-components'\nimport { ChevronRight } from 'lucide-react'\nimport { InlineNotice, Tag } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { TraceReport, TraceSpan } from './trace'\n\nexport interface TraceTreeLabels {\n tree: string\n expand: string\n collapse: string\n viewResult: string\n resultOf: string\n rowName: string\n truncated: string\n reference: string\n value: string\n list: string\n object: string\n absent: string\n}\n\nexport const traceTreeLabels = defineLabels<TraceTreeLabels>('TraceTree', {\n en: {\n tree: 'Evaluation trace',\n expand: 'Expand {label}',\n collapse: 'Collapse {label}',\n viewResult: 'Result of {label}: {preview}',\n resultOf: 'Result of {label}',\n rowName: '{label}, result: {preview}',\n truncated: 'The engine stopped recording after {frames, number} of {limit, number} frames. The final result is still correct.',\n reference: 'reference',\n value: 'value',\n list: '{count, plural, one {list of # item} other {list of # items}}',\n object: '{count, plural, one {object with # key} other {object with # keys}}',\n absent: 'no result recorded',\n },\n 'pt-BR': {\n tree: 'Rastro da avaliação',\n expand: 'Expandir {label}',\n collapse: 'Recolher {label}',\n viewResult: 'Resultado de {label}: {preview}',\n resultOf: 'Resultado de {label}',\n rowName: '{label}, resultado: {preview}',\n truncated: 'O motor parou de registrar após {frames, number} de {limit, number} quadros. O resultado final continua correto.',\n reference: 'referência',\n value: 'valor',\n list: '{count, plural, one {lista de # item} other {lista de # itens}}',\n object: '{count, plural, one {objeto com # chave} other {objeto com # chaves}}',\n absent: 'sem resultado registrado',\n },\n es: {\n tree: 'Traza de la evaluación',\n expand: 'Expandir {label}',\n collapse: 'Contraer {label}',\n viewResult: 'Resultado de {label}: {preview}',\n resultOf: 'Resultado de {label}',\n rowName: '{label}, resultado: {preview}',\n truncated: 'El motor dejó de registrar tras {frames, number} de {limit, number} marcos. El resultado final sigue siendo correcto.',\n reference: 'referencia',\n value: 'valor',\n list: '{count, plural, one {lista de # elemento} other {lista de # elementos}}',\n object: '{count, plural, one {objeto con # clave} other {objeto con # claves}}',\n absent: 'sin resultado registrado',\n },\n})\nexport const defaultTraceTreeLabels: TraceTreeLabels = traceTreeLabels.bundles.en\n\nexport interface TraceTreeProps {\n report: TraceReport\n /** Rows shallower than this are visible when the tree opens (2: root and its children). */\n defaultExpandDepth?: number\n labels?: Partial<TraceTreeLabels>\n className?: string\n}\n\ninterface Row {\n id: string\n depth: number\n span: TraceSpan\n children: Row[]\n}\n\nfunction toRows(span: TraceSpan, id: string, depth: number): Row {\n return { id, depth, span, children: (span.children ?? []).map((c, i) => toRows(c, `${id}.${i}`, depth + 1)) }\n}\n\nfunction walk(row: Row, visit: (r: Row) => void) {\n visit(row)\n row.children.forEach((c) => walk(c, visit))\n}\n\n/** One-line summary of a result (the full value is shown on request). */\nexport function previewResult(value: unknown, l: TraceTreeLabels, locale: string, present = true): string {\n if (!present) return l.absent\n if (value === null) return 'null'\n if (Array.isArray(value)) return fill(l.list, { count: value.length }, locale)\n if (typeof value === 'object') return fill(l.object, { count: Object.keys(value as object).length }, locale)\n if (typeof value === 'number') return new Intl.NumberFormat(locale).format(value)\n if (typeof value === 'string') return JSON.stringify(value)\n return String(value)\n}\n\nfunction argSummary(args: Record<string, unknown> | undefined): string {\n if (!args) return ''\n return Object.entries(args)\n .filter(([, v]) => v === null || ['string', 'number', 'boolean'].includes(typeof v))\n .map(([k, v]) => `${k}: ${typeof v === 'string' ? v : JSON.stringify(v)}`)\n .join(', ')\n}\n\nexport function TraceTree({ report, defaultExpandDepth = 2, labels, className }: TraceTreeProps) {\n const l = useLabels(traceTreeLabels, labels)\n const { locale } = useFlowLocale()\n const root = useMemo(() => toRows(report.trace, '0', 0), [report.trace])\n const [expanded, setExpanded] = useState<Set<Key>>(() => {\n const open = new Set<Key>()\n // A row is open when its children are shallower than the expand depth.\n walk(root, (r) => {\n if (r.children.length && r.depth + 1 < defaultExpandDepth) open.add(r.id)\n })\n return open\n })\n const [details, setDetails] = useState<Set<string>>(new Set())\n const toggleDetail = (id: string) =>\n setDetails((prev) => {\n const next = new Set(prev)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n\n const render = (row: Row): ReactNode => {\n const { span } = row\n const present = 'result' in span\n const preview = previewResult(span.result, l, locale, present)\n const open = details.has(row.id)\n const detailId = `ty-trace-${row.id}`\n return (\n <TreeItem\n key={row.id}\n id={row.id}\n textValue={span.label}\n aria-label={fill(l.rowName, { label: span.label, preview }, locale)}\n className=\"ty-trace__row\"\n style={{ ['--ty-trace-level' as string]: row.depth + 1 }}\n onAction={() => toggleDetail(row.id)}\n >\n <TreeItemContent>\n {({ hasChildItems, isExpanded }) => (\n <>\n <div className=\"ty-trace__line\">\n {hasChildItems ? (\n <AriaButton slot=\"chevron\" className=\"ty-trace__chevron\" aria-label={fill(isExpanded ? l.collapse : l.expand, { label: span.label }, locale)}>\n <ChevronRight className=\"ty-trace__chevron-icon\" aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n ) : (\n <span className=\"ty-trace__spacer\" aria-hidden=\"true\" />\n )}\n {span.kind === 'operation' ? (\n <code className=\"ty-trace__op\" dir=\"ltr\">\n {span.label}\n </code>\n ) : (\n <>\n <Tag size=\"small\">{span.kind === 'ref' ? l.reference : l.value}</Tag>\n <code className=\"ty-trace__op\" dir=\"ltr\">\n {span.label}\n </code>\n </>\n )}\n {span.args ? (\n <span className=\"ty-trace__args\" dir=\"ltr\">\n {argSummary(span.args)}\n </span>\n ) : null}\n <AriaButton className=\"ty-trace__preview\" aria-expanded={open} aria-controls={open ? detailId : undefined} aria-label={fill(l.viewResult, { label: span.label, preview }, locale)} onPress={() => toggleDetail(row.id)}>\n {preview}\n </AriaButton>\n </div>\n {open ? (\n <pre id={detailId} className=\"ty-trace__detail\" role=\"region\" aria-label={fill(l.resultOf, { label: span.label }, locale)} dir=\"ltr\" tabIndex={0}>\n {present ? JSON.stringify(span.result, null, 2) : l.absent}\n </pre>\n ) : null}\n </>\n )}\n </TreeItemContent>\n {row.children.map(render)}\n </TreeItem>\n )\n }\n\n return (\n <div className={['ty-trace', className].filter(Boolean).join(' ')}>\n {report.truncated ? (\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {fill(l.truncated, { frames: report.frameCount, limit: report.frameLimit }, locale)}\n </InlineNotice>\n ) : null}\n <Tree aria-label={l.tree} className=\"ty-trace__tree\" expandedKeys={expanded} onExpandedChange={(keys) => setExpanded(new Set(keys))}>\n {render(root)}\n </Tree>\n </div>\n )\n}\n","// \"Test with sample data\" for the compute form: two sample texts, a run\n// button, and the evaluation trace. Its whole state is one reducer.\n\nimport { useReducer } from 'react'\nimport { FlaskConical } from 'lucide-react'\nimport { Button, InlineNotice, TextArea } from '../../index'\nimport { fill } from '../internal/labels'\nimport { sampleFromText } from './computeDraft'\nimport type { TraceReport } from './trace'\nimport { TraceTree, type TraceTreeLabels } from './TraceTree'\n\nexport interface TrialWords {\n testToggle: string\n sampleInputs: string\n sampleOutputs: string\n sampleHint: string\n invalidExpression: string\n invalidSamples: string\n run: string\n running: string\n results: string\n testFailed: string\n trace: Partial<TraceTreeLabels>\n}\n\nexport type TrialSamples = { inputs?: Record<string, unknown>; nodeOutputs?: Record<string, unknown> }\n\ninterface TrialState {\n expanded: boolean\n inputs: string\n outputs: string\n outcome: { state: 'idle' } | { state: 'running' } | { state: 'traced'; report: TraceReport } | { state: 'error'; text: string }\n}\n\ntype TrialEvent = { on: 'toggle' } | { on: 'inputs'; text: string } | { on: 'outputs'; text: string } | { on: 'outcome'; outcome: TrialState['outcome'] }\n\nfunction trialReducer(s: TrialState, e: TrialEvent): TrialState {\n if (e.on === 'toggle') return { ...s, expanded: !s.expanded }\n if (e.on === 'inputs') return { ...s, inputs: e.text }\n if (e.on === 'outputs') return { ...s, outputs: e.text }\n return { ...s, outcome: e.outcome }\n}\n\nexport function ComputeTrial({ words, locale, blocked, launch }: { words: TrialWords; locale: string; blocked: boolean; launch: (samples: TrialSamples) => Promise<TraceReport> }) {\n const [s, send] = useReducer(trialReducer, { expanded: false, inputs: '', outputs: '', outcome: { state: 'idle' } })\n const busy = s.outcome.state === 'running'\n\n const start = async () => {\n const readIn = sampleFromText(s.inputs)\n const readOut = sampleFromText(s.outputs)\n const firstBad = [readIn, readOut].find((r) => !r.ok)\n if (firstBad && !firstBad.ok) {\n send({ on: 'outcome', outcome: { state: 'error', text: fill(words.invalidSamples, { detail: firstBad.reason }, locale) } })\n return\n }\n const samples: TrialSamples = {}\n if (readIn.ok && readIn.value) samples.inputs = readIn.value\n if (readOut.ok && readOut.value) samples.nodeOutputs = readOut.value\n send({ on: 'outcome', outcome: { state: 'running' } })\n try {\n send({ on: 'outcome', outcome: { state: 'traced', report: await launch(samples) } })\n } catch (err) {\n send({ on: 'outcome', outcome: { state: 'error', text: fill(words.testFailed, { message: err instanceof Error ? err.message : String(err) }, locale) } })\n }\n }\n\n const fields = [\n { key: 'inputs' as const, label: words.sampleInputs },\n { key: 'outputs' as const, label: words.sampleOutputs },\n ]\n\n return (\n <div className=\"ty-expr-form__section\">\n <Button variant=\"secondary\" leadingIcon={<FlaskConical />} aria-expanded={s.expanded} onPress={() => send({ on: 'toggle' })}>\n {words.testToggle}\n </Button>\n {s.expanded ? (\n <div className=\"ty-expr-form__test\">\n {fields.map((f) => (\n <TextArea key={f.key} className=\"ty-expr-form__code\" label={f.label} hint={words.sampleHint} monospace rows={4} value={s[f.key]} onChange={(text) => send({ on: f.key, text })} />\n ))}\n {blocked ? (\n <InlineNotice tone=\"warning\" urgency=\"polite\">\n {words.invalidExpression}\n </InlineNotice>\n ) : null}\n <div>\n <Button variant=\"secondary\" busy={busy} busyLabel={words.running} disabled={blocked || busy} onPress={start}>\n {busy ? words.running : words.run}\n </Button>\n </div>\n <div className=\"ty-expr-form__section\" role=\"region\" aria-label={words.results} aria-live=\"polite\" aria-busy={busy || undefined}>\n {s.outcome.state === 'error' ? (\n <InlineNotice tone=\"danger\" urgency=\"none\">\n {s.outcome.text}\n </InlineNotice>\n ) : s.outcome.state === 'traced' ? (\n <TraceTree report={s.outcome.report} labels={words.trace} />\n ) : null}\n </div>\n </div>\n ) : null}\n </div>\n )\n}\n","// ComputeNodeForm: the settings of a compute step, whose logic is one\n// expression tree edited visually or as JSON text. The pieces live in their\n// own modules: computeDraft.ts (tree and text state), ComputeInsertPanel.tsx\n// (operations, references and examples to insert at the caret) and\n// ComputeTrial.tsx (dry run on sample data). This file wires them together.\n\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { SegmentedControl, TextArea } from '../../index'\nimport { NodeFormFooter } from '../forms/NodeFormFooter'\nimport { defineLabels, useFlowLocale, useLabels } from '../internal/labels'\nimport { useExpressionCatalog } from './catalogContext'\nimport { ComputeInsertPanel } from './ComputeInsertPanel'\nimport { ComputeTrial } from './ComputeTrial'\nimport { openingTree, textErrorMessage, useComputeDraft, withoutScriptKeys } from './computeDraft'\nimport { ExpressionBuilder, type ExpressionBuilderLabels } from './ExpressionBuilder'\nimport { FLOW_INPUTS_REF, type ExpressionCatalog, type ExpressionNode, type OperationNode } from './model'\nimport type { TraceReport } from './trace'\nimport type { TraceTreeLabels } from './TraceTree'\n\nexport { LEGACY_SCRIPT_KEYS, PASS_THROUGH, textErrorMessage } from './computeDraft'\n\nexport interface ComputeNodeConfig {\n kind: 'compute'\n expression?: ExpressionNode\n [key: string]: unknown\n}\n\nexport interface ComputeExample {\n /** Key into labels.examples for the visible name. */\n id: string\n expression: OperationNode\n}\n\n/** Examples authored for a research dataset of assertions; names come from labels. */\nexport const defaultComputeExamples: ComputeExample[] = [\n {\n id: 'countConfirmed',\n expression: {\n operation: 'count',\n list: {\n operation: 'filter',\n list: { ref: 'inputs.assertions' },\n where: { operation: 'compare', op: 'eq', left: { ref: 'item.value' }, right: { value: 'confirmed_primary' } },\n },\n },\n },\n {\n id: 'shareProved',\n expression: {\n operation: 'arithmetic',\n op: 'divide',\n left: { operation: 'count', list: { ref: 'inputs.proved' } },\n right: { operation: 'count', list: { ref: 'inputs.assertions' } },\n },\n },\n { id: 'daysSinceRetrieval', expression: { operation: 'days_between', from: { ref: 'retrieval.fetched_at' }, to: { ref: 'inputs.edition_date' } } },\n]\n\nexport interface ComputeNodeFormLabels {\n editorMode: string\n visual: string\n text: string\n expression: string\n expressionHint: string\n valid: string\n unparseable: string\n missingOperation: string\n unknownOperation: string\n referencePanel: string\n operations: string\n references: string\n examples: string\n searchOperations: string\n familyCount: string\n noOperations: string\n exampleNames: Record<string, string>\n testToggle: string\n sampleInputs: string\n sampleOutputs: string\n sampleHint: string\n run: string\n running: string\n results: string\n invalidExpression: string\n invalidSamples: string\n testFailed: string\n save: string\n cancel: string\n builder: Partial<ExpressionBuilderLabels>\n trace: Partial<TraceTreeLabels>\n}\n\nexport const computeNodeFormLabels = defineLabels<ComputeNodeFormLabels>('ComputeNodeForm', {\n en: {\n editorMode: 'Editor',\n visual: 'Visual',\n text: 'Structured text',\n expression: 'Expression',\n expressionHint: 'One expression tree with an operation at its root.',\n valid: 'The expression is valid.',\n unparseable: 'The text could not be read: {detail}',\n missingOperation: 'The root must name an operation.',\n unknownOperation: '{name} is not an operation of the engine.',\n referencePanel: 'Reference',\n operations: 'Operations',\n references: 'References',\n examples: 'Examples',\n searchOperations: 'Search operations',\n familyCount: '{family} ({count, number})',\n noOperations: 'No operation matches.',\n exampleNames: {\n countConfirmed: 'Count assertions coded as confirmed',\n shareProved: 'Share of proved assertions',\n daysSinceRetrieval: 'Days between retrieval and edition',\n },\n testToggle: 'Test with sample data',\n sampleInputs: 'Sample flow inputs',\n sampleOutputs: 'Sample upstream outputs',\n sampleHint: 'Structured data; leave blank for none.',\n run: 'Run test',\n running: 'Running',\n results: 'Test result',\n invalidExpression: 'Fix the expression before testing it.',\n invalidSamples: 'The sample data could not be read: {detail}',\n testFailed: 'The test failed: {message}',\n save: 'Save',\n cancel: 'Cancel',\n builder: {},\n trace: {},\n },\n 'pt-BR': {\n editorMode: 'Editor',\n visual: 'Visual',\n text: 'Texto estruturado',\n expression: 'Expressão',\n expressionHint: 'Uma árvore de expressão com uma operação na raiz.',\n valid: 'A expressão é válida.',\n unparseable: 'Não foi possível ler o texto: {detail}',\n missingOperation: 'A raiz precisa indicar uma operação.',\n unknownOperation: '{name} não é uma operação do motor.',\n referencePanel: 'Consulta',\n operations: 'Operações',\n references: 'Referências',\n examples: 'Exemplos',\n searchOperations: 'Buscar operações',\n familyCount: '{family} ({count, number})',\n noOperations: 'Nenhuma operação corresponde.',\n exampleNames: {\n countConfirmed: 'Contar asserções codificadas como confirmadas',\n shareProved: 'Proporção de asserções provadas',\n daysSinceRetrieval: 'Dias entre a coleta e a edição',\n },\n testToggle: 'Testar com dados de exemplo',\n sampleInputs: 'Entradas de exemplo do fluxo',\n sampleOutputs: 'Saídas de exemplo das etapas anteriores',\n sampleHint: 'Dado estruturado; deixe em branco para nenhum.',\n run: 'Executar teste',\n running: 'Executando',\n results: 'Resultado do teste',\n invalidExpression: 'Corrija a expressão antes de testá-la.',\n invalidSamples: 'Não foi possível ler os dados de exemplo: {detail}',\n testFailed: 'O teste falhou: {message}',\n save: 'Salvar',\n cancel: 'Cancelar',\n builder: {},\n trace: {},\n },\n es: {\n editorMode: 'Editor',\n visual: 'Visual',\n text: 'Texto estructurado',\n expression: 'Expresión',\n expressionHint: 'Un árbol de expresión con una operación en la raíz.',\n valid: 'La expresión es válida.',\n unparseable: 'No se pudo leer el texto: {detail}',\n missingOperation: 'La raíz debe indicar una operación.',\n unknownOperation: '{name} no es una operación del motor.',\n referencePanel: 'Consulta',\n operations: 'Operaciones',\n references: 'Referencias',\n examples: 'Ejemplos',\n searchOperations: 'Buscar operaciones',\n familyCount: '{family} ({count, number})',\n noOperations: 'Ninguna operación coincide.',\n exampleNames: {\n countConfirmed: 'Contar afirmaciones codificadas como confirmadas',\n shareProved: 'Proporción de afirmaciones probadas',\n daysSinceRetrieval: 'Días entre la recuperación y la edición',\n },\n testToggle: 'Probar con datos de ejemplo',\n sampleInputs: 'Entradas de ejemplo del flujo',\n sampleOutputs: 'Salidas de ejemplo de los pasos anteriores',\n sampleHint: 'Dato estructurado; déjelo en blanco si no hay.',\n run: 'Ejecutar prueba',\n running: 'Ejecutando',\n results: 'Resultado de la prueba',\n invalidExpression: 'Corrija la expresión antes de probarla.',\n invalidSamples: 'No se pudieron leer los datos de ejemplo: {detail}',\n testFailed: 'La prueba falló: {message}',\n save: 'Guardar',\n cancel: 'Cancelar',\n builder: {},\n trace: {},\n },\n})\nexport const defaultComputeNodeFormLabels: ComputeNodeFormLabels = computeNodeFormLabels.bundles.en\n\nexport interface ComputeDryRunRequest {\n config: ComputeNodeConfig\n inputs?: Record<string, unknown>\n nodeOutputs?: Record<string, unknown>\n}\n\nexport interface ComputeNodeFormProps {\n value: ComputeNodeConfig | Record<string, unknown>\n /** Ancestor node ids. */\n references?: string[]\n onDryRun?: (req: ComputeDryRunRequest) => Promise<{ result: unknown; trace: TraceReport }>\n onSave: (config: ComputeNodeConfig) => void\n onCancel: () => void\n catalog?: ExpressionCatalog\n examples?: ComputeExample[]\n labels?: Partial<ComputeNodeFormLabels>\n}\n\ntype EditorMode = 'visual' | 'text'\n\nexport function ComputeNodeForm(props: ComputeNodeFormProps) {\n const words = useLabels(computeNodeFormLabels, props.labels)\n const { locale } = useFlowLocale()\n const { catalog } = useExpressionCatalog(props.catalog)\n const base = useMemo(() => withoutScriptKeys(props.value as Record<string, unknown>), [props.value])\n const draft = useComputeDraft(openingTree(base), catalog)\n const [mode, setMode] = useState<EditorMode>('visual')\n const refs = useMemo(() => [FLOW_INPUTS_REF, ...(props.references ?? []).filter((r) => r !== FLOW_INPUTS_REF)], [props.references])\n\n const inText = mode === 'text'\n const textBroken = inText && draft.problem !== null\n const toConfig = (): ComputeNodeConfig => ({ ...base, kind: 'compute', expression: draft.tree })\n\n const editors: Record<EditorMode, () => ReactNode> = {\n visual: () => (\n <ExpressionBuilder label={words.expression} value={draft.tree} onChange={(n) => draft.setTree(n as OperationNode)} references={refs} {...(props.catalog ? { catalog: props.catalog } : {})} labels={words.builder} />\n ),\n text: () => {\n const error = draft.problem ? textErrorMessage(draft.problem, words, locale) : null\n return (\n <div className=\"ty-expr-form__section\">\n <TextArea ref={draft.textArea} className=\"ty-expr-form__code\" label={words.expression} hint={words.expressionHint} monospace rows={12} value={draft.text} onChange={draft.editText} errorMessage={error ?? undefined} />\n {draft.problem ? null : (\n <p className=\"ty-expr-form__valid\" role=\"status\">\n {words.valid}\n </p>\n )}\n </div>\n )\n },\n }\n\n const panel = inText ? (\n <ComputeInsertPanel\n catalog={catalog}\n refs={refs}\n examples={props.examples ?? defaultComputeExamples}\n words={{ ...words, familyNames: words.builder.families as Record<string, string> | undefined }}\n locale={locale}\n onPick={draft.splice}\n />\n ) : null\n\n const onDryRun = props.onDryRun\n return (\n <div className=\"ty-expr-form\" data-form=\"compute\">\n <SegmentedControl\n label={words.editorMode}\n value={mode}\n onChange={(next) => {\n if (next === 'text') draft.reprint()\n setMode(next as EditorMode)\n }}\n options={(['visual', 'text'] as const).map((m) => ({ value: m, label: words[m] }))}\n />\n <div className=\"ty-expr-form__layout\" data-with-panel={inText || undefined}>\n {editors[mode]()}\n {panel}\n </div>\n {onDryRun ? <ComputeTrial words={words} locale={locale} blocked={textBroken} launch={async (samples) => (await onDryRun({ config: toConfig(), ...samples })).trace} /> : null}\n <NodeFormFooter labels={{ save: words.save, cancel: words.cancel }} saveDisabled={textBroken} onCancel={props.onCancel} onSave={() => props.onSave(toConfig())} />\n </div>\n )\n}\n","// SimulationNodeForm: a repeated-sampling step (how many runs, how many steps\n// per run, the starting state, the transition) plus the values tracked per\n// step. Each expression field always has a root operation: bare values are\n// wrapped in a \"first non-empty value\" operation with that single candidate.\n\nimport { useState } from 'react'\nimport { TextArea } from '../../index'\nimport { NodeFormFooter } from '../forms/NodeFormFooter'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport { ExpressionField, type ExpressionFieldLabels } from './ExpressionField'\nimport { FLOW_INPUTS_REF, isOperation, prettyJson, type ExpressionCatalog, type ExpressionNode, type OperationNode } from './model'\n\nexport type SimulationField = 'runs' | 'steps' | 'initialState' | 'step'\nexport const SIMULATION_FIELDS: readonly SimulationField[] = ['runs', 'steps', 'initialState', 'step']\n\n/** Operation used to give a bare value a root operation (same meaning). */\nexport const FIRST_NON_EMPTY = 'coalesce'\n\n/** References the transition may use besides flow inputs and ancestors. */\nexport const SIMULATION_STEP_REFS = ['state', 'run_index', 'step_index'] as const\n\nexport interface SimulationNodeConfig {\n kind: 'simulation'\n runs: ExpressionNode\n steps: ExpressionNode\n initialState: ExpressionNode\n step: ExpressionNode\n tracking: string[]\n [key: string]: unknown\n}\n\nexport interface SimulationNodeFormLabels {\n runs: string\n runsHint: string\n steps: string\n stepsHint: string\n initialState: string\n initialStateHint: string\n step: string\n stepHint: string\n tracking: string\n trackingHint: string\n trackingInvalid: string\n field: Partial<ExpressionFieldLabels>\n save: string\n cancel: string\n}\n\nexport const simulationNodeFormLabels = defineLabels<SimulationNodeFormLabels>('SimulationNodeForm', {\n en: {\n runs: 'Number of runs',\n runsHint: 'How many independent runs to sample.',\n steps: 'Steps per run',\n stepsHint: 'How many steps each run takes.',\n initialState: 'Initial state',\n initialStateHint: 'The state every run starts from.',\n step: 'Step transition',\n stepHint: 'The next state; may use the current state, the run index and the step index.',\n tracking: 'Tracked values',\n trackingHint: 'A list (structured text) of the values recorded at each step.',\n trackingInvalid: 'Tracked values must be a list.',\n field: {},\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n runs: 'Número de execuções',\n runsHint: 'Quantas execuções independentes amostrar.',\n steps: 'Passos por execução',\n stepsHint: 'Quantos passos cada execução dá.',\n initialState: 'Estado inicial',\n initialStateHint: 'O estado de onde toda execução parte.',\n step: 'Transição do passo',\n stepHint: 'O próximo estado; pode usar o estado atual, o índice da execução e o índice do passo.',\n tracking: 'Valores acompanhados',\n trackingHint: 'Uma lista (texto estruturado) dos valores registrados a cada passo.',\n trackingInvalid: 'Os valores acompanhados precisam ser uma lista.',\n field: {},\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n runs: 'Número de ejecuciones',\n runsHint: 'Cuántas ejecuciones independientes muestrear.',\n steps: 'Pasos por ejecución',\n stepsHint: 'Cuántos pasos da cada ejecución.',\n initialState: 'Estado inicial',\n initialStateHint: 'El estado desde el que parte cada ejecución.',\n step: 'Transición del paso',\n stepHint: 'El siguiente estado; puede usar el estado actual, el índice de ejecución y el índice de paso.',\n tracking: 'Valores seguidos',\n trackingHint: 'Una lista (texto estructurado) de los valores registrados en cada paso.',\n trackingInvalid: 'Los valores seguidos deben ser una lista.',\n field: {},\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultSimulationNodeFormLabels: SimulationNodeFormLabels = simulationNodeFormLabels.bundles.en\n\n/** A tree for the visual builder: operations as they are, anything else wrapped. */\nexport function seedSimulationField(value: unknown): OperationNode {\n if (isOperation(value)) return value\n const candidate = value && typeof value === 'object' && !Array.isArray(value) && ('ref' in value || 'value' in value) ? value : { value: value ?? null }\n return { operation: FIRST_NON_EMPTY, values: [candidate] }\n}\n\nexport interface SimulationNodeFormProps {\n /** Each expression field is an expression tree or a bare literal. */\n value: Partial<Record<SimulationField, unknown>> & { tracking?: string[] } & Record<string, unknown>\n references?: string[]\n defaults?: Partial<Record<SimulationField, unknown>>\n catalog?: ExpressionCatalog\n onSave: (value: SimulationNodeConfig) => void\n onCancel: () => void\n labels?: Partial<SimulationNodeFormLabels>\n}\n\nexport function SimulationNodeForm({ value, references = [], defaults = {}, catalog, onSave, onCancel, labels }: SimulationNodeFormProps) {\n const l = useLabels(simulationNodeFormLabels, labels)\n const [fields, setFields] = useState<Record<SimulationField, ExpressionNode>>(() => {\n const out = {} as Record<SimulationField, ExpressionNode>\n for (const f of SIMULATION_FIELDS) out[f] = seedSimulationField(value[f] !== undefined ? value[f] : (defaults[f] ?? null))\n return out\n })\n const [trackingText, setTrackingText] = useState(() => prettyJson(Array.isArray(value.tracking) ? value.tracking : []))\n const [tracking, setTracking] = useState<string[]>(() => (Array.isArray(value.tracking) ? value.tracking : []))\n const [trackingError, setTrackingError] = useState(false)\n const baseRefs = [FLOW_INPUTS_REF, ...references.filter((r) => r !== FLOW_INPUTS_REF)]\n\n const save = () => onSave({ ...value, kind: 'simulation', ...fields, tracking })\n\n return (\n <div className=\"ty-node-form ty-expr-form\" data-form=\"simulation\">\n {SIMULATION_FIELDS.map((f) => (\n <ExpressionField\n key={f}\n label={l[f]}\n hint={l[`${f}Hint` as const]}\n value={fields[f]}\n onChange={(n) => setFields((prev) => ({ ...prev, [f]: n }))}\n references={f === 'step' ? [...baseRefs, ...SIMULATION_STEP_REFS] : baseRefs}\n acceptLeaves\n labels={l.field}\n {...(catalog ? { catalog } : {})}\n />\n ))}\n <TextArea\n className=\"ty-expr-form__code\"\n label={l.tracking}\n hint={l.trackingHint}\n monospace\n rows={3}\n value={trackingText}\n onChange={(t) => {\n setTrackingText(t)\n try {\n const v = JSON.parse(t) as unknown\n if (Array.isArray(v)) {\n setTracking(v.map(String))\n setTrackingError(false)\n return\n }\n } catch {\n /* fall through to the error */\n }\n setTrackingError(true)\n }}\n {...(trackingError ? { errorMessage: l.trackingInvalid } : {})}\n />\n <NodeFormFooter onSave={save} onCancel={onCancel} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// RuleActionCatalog (wave 4): what a rule may do. The host supplies the\n// catalog; the library ships a domain-neutral default set that fits a research\n// workflow. The catalog only describes the form: the engine executes actions.\n\nexport type ParamType = 'text' | 'number' | 'boolean' | 'choice' | 'reference' | 'duration'\nexport const PARAM_TYPES: readonly ParamType[] = ['text', 'number', 'boolean', 'choice', 'reference', 'duration']\n\nexport type DurationUnit = 'minutes' | 'hours' | 'days'\nexport const DURATION_UNITS: readonly DurationUnit[] = ['minutes', 'hours', 'days']\n\nexport interface ParamSpec {\n key: string\n labelKey: string\n type: ParamType\n required?: boolean\n default?: unknown\n hintKey?: string\n min?: number\n max?: number\n step?: number\n options?: Array<{ value: string; labelKey: string }>\n optionsFrom?: 'branches' | 'roles' | 'statuses'\n /** Read the text value as the declared type of the referenced parameter (Set value). */\n typedBy?: string\n}\n\nexport interface ParamError {\n key: string\n code: 'required' | 'noOptions' | 'invalid'\n}\n\nexport interface ActionKind {\n kind: string\n labelKey: string\n descriptionKey?: string\n icon?: string\n params: ParamSpec[]\n validate?: (params: Record<string, unknown>) => ParamError[]\n}\n\nexport interface ActionContext {\n branches?: Array<{ value: string; label: string }>\n roles?: Array<{ value: string; label: string }>\n statuses?: Array<{ value: string; label: string }>\n}\n\nexport const CUSTOM_ACTION = 'custom'\n\nexport const defaultRuleActions: readonly ActionKind[] = Object.freeze([\n {\n kind: 'set-value',\n labelKey: 'setValue',\n descriptionKey: 'setValueDescription',\n params: [\n { key: 'target', labelKey: 'target', type: 'reference', required: true },\n { key: 'value', labelKey: 'value', type: 'text', required: true, typedBy: 'target' },\n ],\n },\n { kind: 'add-tag', labelKey: 'addTag', descriptionKey: 'addTagDescription', params: [{ key: 'tag', labelKey: 'tag', type: 'text', required: true }] },\n {\n kind: 'request-review',\n labelKey: 'requestReview',\n descriptionKey: 'requestReviewDescription',\n params: [\n { key: 'role', labelKey: 'role', type: 'choice', optionsFrom: 'roles', required: true },\n { key: 'reason', labelKey: 'reason', type: 'text', required: true },\n { key: 'dueIn', labelKey: 'dueIn', type: 'duration' },\n ],\n },\n {\n kind: 'notify',\n labelKey: 'notify',\n descriptionKey: 'notifyDescription',\n params: [\n { key: 'recipient', labelKey: 'recipient', type: 'choice', optionsFrom: 'roles', required: true },\n { key: 'message', labelKey: 'message', type: 'text', required: true },\n ],\n },\n { kind: 'route', labelKey: 'route', descriptionKey: 'routeDescription', params: [{ key: 'branch', labelKey: 'branch', type: 'choice', optionsFrom: 'branches', required: true }] },\n {\n kind: 'stop',\n labelKey: 'stop',\n descriptionKey: 'stopDescription',\n params: [\n {\n key: 'outcome',\n labelKey: 'outcome',\n type: 'choice',\n required: true,\n default: 'completed',\n options: [\n { value: 'completed', labelKey: 'completed' },\n { value: 'failed', labelKey: 'failed' },\n ],\n },\n { key: 'reason', labelKey: 'reason', type: 'text' },\n ],\n },\n] satisfies ActionKind[])\n\n/** Validates a host action kind; throws on duplicate keys or unknown parameter types. */\nexport function defineRuleAction(kind: ActionKind, existing: readonly ActionKind[] = defaultRuleActions): ActionKind {\n if (!kind.kind || kind.kind === CUSTOM_ACTION) throw new Error(`defineRuleAction: \"${kind.kind}\" is reserved or empty.`)\n if (existing.some((k) => k.kind === kind.kind)) throw new Error(`defineRuleAction: an action kind \"${kind.kind}\" already exists.`)\n const seen = new Set<string>()\n for (const p of kind.params) {\n if (seen.has(p.key)) throw new Error(`defineRuleAction: parameter \"${p.key}\" appears twice in \"${kind.kind}\".`)\n seen.add(p.key)\n if (!PARAM_TYPES.includes(p.type)) throw new Error(`defineRuleAction: parameter \"${p.key}\" has unknown type \"${String(p.type)}\".`)\n if (!p.labelKey) throw new Error(`defineRuleAction: parameter \"${p.key}\" has no label key.`)\n }\n return Object.freeze({ ...kind })\n}\n\n/** Default parameters of a kind. */\nexport function defaultParams(kind: ActionKind | undefined): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const p of kind?.params ?? []) {\n if (p.default !== undefined) out[p.key] = p.default\n else if (p.type === 'boolean') out[p.key] = false\n else if (p.type === 'duration') continue\n else out[p.key] = p.type === 'number' ? null : ''\n }\n return out\n}\n\n/** Options of a choice parameter, from the spec or the host context. */\nexport function choiceOptions(p: ParamSpec, ctx: ActionContext): Array<{ value: string; label?: string; labelKey?: string }> {\n if (p.options) return p.options\n return (p.optionsFrom ? ctx[p.optionsFrom] : undefined) ?? []\n}\n\n/** Parameter errors: missing required values and choices with no options. */\nexport function validateParams(kind: ActionKind, params: Record<string, unknown>, ctx: ActionContext): ParamError[] {\n const errors: ParamError[] = []\n for (const p of kind.params) {\n if (p.type === 'choice' && !choiceOptions(p, ctx).length) {\n errors.push({ key: p.key, code: 'noOptions' })\n continue\n }\n const v = params[p.key]\n if (p.required && (v === undefined || v === null || v === '')) errors.push({ key: p.key, code: 'required' })\n }\n return [...errors, ...(kind.validate?.(params) ?? [])]\n}\n\n/** \"5\" → 5, \"true\" → true, other text stays text (custom parameters). */\nexport function readLooseValue(text: string): string | number | boolean {\n const t = text.trim()\n if (t === 'true') return true\n if (t === 'false') return false\n if (t !== '' && Number.isFinite(Number(t))) return Number(t)\n return text\n}\n\n/** Reads text as the declared type of a referenced value. */\nexport function readTyped(text: string, type: 'number' | 'boolean' | 'string' | undefined): unknown {\n if (type === 'number') {\n const n = Number(text)\n return text.trim() !== '' && Number.isFinite(n) ? n : text\n }\n if (type === 'boolean') return text === 'true' ? true : text === 'false' ? false : text\n return text\n}\n","// Rule conditions: a predicate expression tree. `normalizeRuleCondition`\n// rewrites older condition shapes into that tree, keeping their meaning. It\n// must stay identical to the engine's normaliser (shared fixtures).\n\nimport { FLOW_INPUTS_REF, isOperation, type ExpressionNode, type OperationNode } from './model'\n\nconst ref = (path: string): ExpressionNode => ({ ref: path })\nconst lit = (value: unknown): ExpressionNode => ({ value })\nconst compare = (op: string, left: ExpressionNode, right: ExpressionNode): OperationNode => ({ operation: 'compare', op, left, right })\nconst all = (conditions: ExpressionNode[]): OperationNode => ({ operation: 'and', conditions })\nconst any = (conditions: ExpressionNode[]): OperationNode => ({ operation: 'or', conditions })\n\n/** Default condition: flow input equals an empty literal. */\nexport function defaultRuleCondition(): OperationNode {\n return compare('eq', ref(FLOW_INPUTS_REF), lit(''))\n}\n\n/** A condition that never matches (used for unreadable input). */\nexport const NEVER_MATCHES: ExpressionNode = Object.freeze({ value: false })\n\nconst OPERATOR_WORDS: Record<string, string> = {\n equals: 'eq',\n eq: 'eq',\n '==': 'eq',\n '=': 'eq',\n not_equals: 'ne',\n notEquals: 'ne',\n ne: 'ne',\n '!=': 'ne',\n greater_than: 'gt',\n gt: 'gt',\n '>': 'gt',\n at_least: 'gte',\n gte: 'gte',\n '>=': 'gte',\n less_than: 'lt',\n lt: 'lt',\n '<': 'lt',\n at_most: 'lte',\n lte: 'lte',\n '<=': 'lte',\n}\n\ntype Legacy = Record<string, unknown>\n\nfunction convert(c: unknown): ExpressionNode {\n if (isOperation(c)) return c\n if (!c || typeof c !== 'object' || Array.isArray(c)) return NEVER_MATCHES\n const o = c as Legacy\n const group = (o.all ?? o.and) as unknown\n if (Array.isArray(group)) return all(group.map(convert))\n const either = (o.any ?? o.or) as unknown\n if (Array.isArray(either)) return any(either.map(convert))\n if ('not' in o) return { operation: 'not', condition: convert(o.not) }\n const field = typeof o.field === 'string' ? o.field : null\n if (!field) return NEVER_MATCHES\n const left = ref(field)\n if (o.truthy === true || o.type === 'truthy' || o.operator === 'truthy') {\n // Old \"truthy\": not null, not false, not empty text.\n return all([compare('ne', left, lit(null)), compare('ne', left, lit(false)), compare('ne', left, lit(''))])\n }\n if (typeof o.pattern === 'string') return { operation: 'matches', text: left, pattern: lit(o.pattern) }\n if ('min' in o || 'max' in o) {\n const parts: ExpressionNode[] = []\n if (o.min !== undefined) parts.push(compare('gte', left, lit(o.min)))\n if (o.max !== undefined) parts.push(compare('lte', left, lit(o.max)))\n return parts.length === 1 ? parts[0]! : all(parts)\n }\n if ('after' in o || 'before' in o) {\n const parts: ExpressionNode[] = []\n if (o.after !== undefined) parts.push(compare('gte', left, lit(o.after)))\n if (o.before !== undefined) parts.push(compare('lte', left, lit(o.before)))\n return parts.length === 1 ? parts[0]! : all(parts)\n }\n const op = OPERATOR_WORDS[String(o.operator ?? o.op ?? 'equals')]\n if (!op) return NEVER_MATCHES\n return compare(op, left, lit(o.value))\n}\n\n/** Normalises any stored condition into a predicate expression tree. */\nexport function normalizeRuleCondition(value: unknown): ExpressionNode {\n return convert(value)\n}\n\n/** Name of the root of a condition tree: its operation, \"reference\" or \"value\". */\nexport function conditionRootName(node: ExpressionNode | undefined): 'reference' | 'value' | string {\n if (isOperation(node)) return node.operation\n if (node && 'ref' in node) return 'reference'\n return 'value'\n}\n\n/** \"and of 3 clauses\" style summary data for rule pickers. */\nexport function conditionSummary(value: unknown): { root: string; clauses: number } {\n const n = normalizeRuleCondition(value)\n const root = conditionRootName(n)\n const list = isOperation(n) && Array.isArray(n.conditions) ? n.conditions.length : 1\n return { root, clauses: list }\n}\n","// RuleEditor: a saved rule end to end (identity, priority, activity, a yes/no\n// condition, one action, and optional validity, lifecycle and tags). The\n// condition builder and the action builder are exported on their own.\n\nimport { Fragment, useEffect, useId, useMemo, useState } from 'react'\nimport { ChevronRight, Plus, Trash2 } from 'lucide-react'\nimport { Button as AriaButton, Disclosure, DisclosurePanel, Group, Heading, Input, Label, NumberField } from 'react-aria-components'\nimport { Button, InlineNotice, NativeSelect, Switch, Tag, TagList, TextArea, TextField } from '../../index'\nimport { createId } from '../internal/ids'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport { ExpressionField, type ExpressionFieldLabels } from './ExpressionField'\nimport type { ExpressionBuilderLabels } from './labels'\nimport { FLOW_INPUTS_REF, type ExpressionCatalog, type ExpressionNode } from './model'\nimport {\n choiceOptions,\n CUSTOM_ACTION,\n defaultParams,\n defaultRuleActions,\n DURATION_UNITS,\n readLooseValue,\n readTyped,\n validateParams,\n type ActionContext,\n type ActionKind,\n type ParamError,\n type ParamSpec,\n} from './ruleActions'\nimport { conditionRootName, defaultRuleCondition, normalizeRuleCondition } from './ruleCondition'\n\nexport interface RuleAction {\n kind: string\n params?: Record<string, unknown>\n}\n\nexport interface RuleValue {\n id?: string\n name: string\n description?: string\n enabled: boolean\n priority: number\n status?: string\n validFrom?: string | null\n validUntil?: string | null\n tags?: string[]\n condition: ExpressionNode\n action: RuleAction\n recurrence?: unknown\n}\n\nexport const FALLBACK_RULE_STATUSES = ['draft', 'active', 'paused', 'archived'] as const\n\n/** A new rule: empty name, enabled, priority 0, active, an equality condition, the first action kind. */\nexport function defaultRule(actionCatalog: readonly ActionKind[] = defaultRuleActions): RuleValue {\n const first = actionCatalog[0]\n return {\n name: '',\n enabled: true,\n priority: 0,\n status: 'active',\n condition: defaultRuleCondition(),\n action: first ? { kind: first.kind, params: defaultParams(first) } : { kind: CUSTOM_ACTION, params: {} },\n }\n}\n\nexport interface RuleEditorLabels {\n name: string\n nameRequired: string\n priority: string\n active: string\n description: string\n conditionHeading: string\n actionHeading: string\n rootNames: { reference: string; value: string }\n condition: string\n actionKind: string\n unavailable: string\n noOptions: string\n required: string\n customLegend: string\n customKey: string\n customValue: string\n customRemove: string\n customAdd: string\n durationUnit: string\n units: Record<'minutes' | 'hours' | 'days', string>\n advanced: string\n validFrom: string\n validUntil: string\n invalidDate: string\n status: string\n statusNames: Record<string, string>\n tags: string\n addTag: string\n removeTag: string\n newTag: string\n /** Names and descriptions of action kinds and their parameters, by label key. */\n actions: Record<string, string>\n field: Partial<ExpressionFieldLabels>\n builder: Partial<ExpressionBuilderLabels>\n}\n\nconst enActions: Record<string, string> = {\n setValue: 'Set value',\n setValueDescription: 'Write a value into a flow variable.',\n addTag: 'Add tag',\n addTagDescription: 'Tag the item being evaluated.',\n requestReview: 'Request review',\n requestReviewDescription: 'Create a task for a person in the verification queue.',\n notify: 'Notify',\n notifyDescription: 'Send a message to a role.',\n route: 'Route',\n routeDescription: 'Continue on one branch of the rule step.',\n stop: 'Stop',\n stopDescription: 'End the run with an outcome.',\n custom: 'Custom',\n customDescription: 'Free parameters read by the engine.',\n target: 'Target variable',\n value: 'Value',\n tag: 'Tag',\n role: 'Role',\n reason: 'Reason',\n dueIn: 'Due in',\n recipient: 'Recipient',\n message: 'Message',\n branch: 'Branch',\n outcome: 'Outcome',\n completed: 'Completed',\n failed: 'Failed',\n}\n\nexport const ruleEditorLabels = defineLabels<RuleEditorLabels>('RuleEditor', {\n en: {\n name: 'Name',\n nameRequired: 'Give the rule a name.',\n priority: 'Priority',\n active: 'Active',\n description: 'Description',\n conditionHeading: 'Condition',\n actionHeading: 'Action',\n rootNames: { reference: 'reference', value: 'value' },\n condition: 'Condition',\n actionKind: 'Action',\n unavailable: 'This action is not available here. Its stored parameters are shown below; choose an available action to replace it.',\n noOptions: 'There is nothing to choose for {name} yet.',\n required: '{name} is required.',\n customLegend: 'Parameter {n, number}',\n customKey: 'Key',\n customValue: 'Value',\n customRemove: 'Remove parameter {key}',\n customAdd: 'Add parameter',\n durationUnit: 'Unit',\n units: { minutes: 'minutes', hours: 'hours', days: 'days' },\n advanced: 'Advanced',\n validFrom: 'Valid from',\n validUntil: 'Valid until',\n invalidDate: 'Enter a valid date and time.',\n status: 'Lifecycle status',\n statusNames: { draft: 'Draft', active: 'Active', paused: 'Paused', archived: 'Archived' },\n tags: 'Tags',\n addTag: 'Add tag',\n removeTag: 'Remove tag {tag}',\n newTag: 'New tag',\n actions: enActions,\n field: {},\n builder: {},\n },\n 'pt-BR': {\n name: 'Nome',\n nameRequired: 'Dê um nome à regra.',\n priority: 'Prioridade',\n active: 'Ativa',\n description: 'Descrição',\n conditionHeading: 'Condição',\n actionHeading: 'Ação',\n rootNames: { reference: 'referência', value: 'valor' },\n condition: 'Condição',\n actionKind: 'Ação',\n unavailable: 'Esta ação não está disponível aqui. Os parâmetros guardados aparecem abaixo; escolha uma ação disponível para substituí-la.',\n noOptions: 'Ainda não há o que escolher em {name}.',\n required: '{name} é obrigatório.',\n customLegend: 'Parâmetro {n, number}',\n customKey: 'Chave',\n customValue: 'Valor',\n customRemove: 'Remover parâmetro {key}',\n customAdd: 'Adicionar parâmetro',\n durationUnit: 'Unidade',\n units: { minutes: 'minutos', hours: 'horas', days: 'dias' },\n advanced: 'Avançado',\n validFrom: 'Válida a partir de',\n validUntil: 'Válida até',\n invalidDate: 'Informe data e hora válidas.',\n status: 'Situação',\n statusNames: { draft: 'Rascunho', active: 'Ativa', paused: 'Pausada', archived: 'Arquivada' },\n tags: 'Etiquetas',\n addTag: 'Adicionar etiqueta',\n removeTag: 'Remover etiqueta {tag}',\n newTag: 'Nova etiqueta',\n actions: {\n setValue: 'Definir valor',\n setValueDescription: 'Grava um valor numa variável do fluxo.',\n addTag: 'Adicionar etiqueta',\n addTagDescription: 'Etiqueta o item avaliado.',\n requestReview: 'Pedir revisão',\n requestReviewDescription: 'Cria uma tarefa para uma pessoa na fila de verificação.',\n notify: 'Notificar',\n notifyDescription: 'Envia uma mensagem a um papel.',\n route: 'Encaminhar',\n routeDescription: 'Segue por um ramo da etapa de regra.',\n stop: 'Parar',\n stopDescription: 'Encerra a execução com um desfecho.',\n custom: 'Personalizada',\n customDescription: 'Parâmetros livres lidos pelo motor.',\n target: 'Variável de destino',\n value: 'Valor',\n tag: 'Etiqueta',\n role: 'Papel',\n reason: 'Motivo',\n dueIn: 'Prazo',\n recipient: 'Destinatário',\n message: 'Mensagem',\n branch: 'Ramo',\n outcome: 'Desfecho',\n completed: 'Concluída',\n failed: 'Falhou',\n },\n field: {},\n builder: {},\n },\n es: {\n name: 'Nombre',\n nameRequired: 'Dé un nombre a la regla.',\n priority: 'Prioridad',\n active: 'Activa',\n description: 'Descripción',\n conditionHeading: 'Condición',\n actionHeading: 'Acción',\n rootNames: { reference: 'referencia', value: 'valor' },\n condition: 'Condición',\n actionKind: 'Acción',\n unavailable: 'Esta acción no está disponible aquí. Sus parámetros guardados se muestran abajo; elija una acción disponible para reemplazarla.',\n noOptions: 'Todavía no hay nada que elegir en {name}.',\n required: '{name} es obligatorio.',\n customLegend: 'Parámetro {n, number}',\n customKey: 'Clave',\n customValue: 'Valor',\n customRemove: 'Quitar parámetro {key}',\n customAdd: 'Añadir parámetro',\n durationUnit: 'Unidad',\n units: { minutes: 'minutos', hours: 'horas', days: 'días' },\n advanced: 'Avanzado',\n validFrom: 'Válida desde',\n validUntil: 'Válida hasta',\n invalidDate: 'Introduzca una fecha y hora válidas.',\n status: 'Estado',\n statusNames: { draft: 'Borrador', active: 'Activa', paused: 'En pausa', archived: 'Archivada' },\n tags: 'Etiquetas',\n addTag: 'Añadir etiqueta',\n removeTag: 'Quitar etiqueta {tag}',\n newTag: 'Nueva etiqueta',\n actions: {\n setValue: 'Asignar valor',\n setValueDescription: 'Escribe un valor en una variable del flujo.',\n addTag: 'Añadir etiqueta',\n addTagDescription: 'Etiqueta el elemento evaluado.',\n requestReview: 'Pedir revisión',\n requestReviewDescription: 'Crea una tarea para una persona en la cola de verificación.',\n notify: 'Notificar',\n notifyDescription: 'Envía un mensaje a un rol.',\n route: 'Encaminar',\n routeDescription: 'Sigue por una rama del paso de regla.',\n stop: 'Detener',\n stopDescription: 'Termina la ejecución con un resultado.',\n custom: 'Personalizada',\n customDescription: 'Parámetros libres leídos por el motor.',\n target: 'Variable de destino',\n value: 'Valor',\n tag: 'Etiqueta',\n role: 'Rol',\n reason: 'Motivo',\n dueIn: 'Plazo',\n recipient: 'Destinatario',\n message: 'Mensaje',\n branch: 'Rama',\n outcome: 'Resultado',\n completed: 'Completada',\n failed: 'Falló',\n },\n field: {},\n builder: {},\n },\n})\n\nexport const defaultRuleEditorLabels: RuleEditorLabels = ruleEditorLabels.bundles.en\n\n// ---- small fields ---------------------------------------------------------\n\nfunction NumberInput({ label, value, onChange, min, max, step, integer }: { label: string; value: number | null; onChange: (v: number | null) => void; min?: number; max?: number; step?: number; integer?: boolean }) {\n return (\n <NumberField\n className=\"ty-rule-editor__number\"\n value={value ?? NaN}\n onChange={(v) => onChange(Number.isNaN(v) ? null : v)}\n {...(min !== undefined ? { minValue: min } : {})}\n {...(max !== undefined ? { maxValue: max } : {})}\n {...(step !== undefined ? { step } : {})}\n formatOptions={integer ? { maximumFractionDigits: 0 } : {}}\n >\n <Label className=\"ty-rule-editor__label\">{label}</Label>\n <Group>\n <Input className=\"ty-rule-editor__number-input\" />\n </Group>\n </NumberField>\n )\n}\n\n/** Local date-time text ↔ UTC instant. */\nexport function localToInstant(local: string): string | null {\n if (!local) return null\n const d = new Date(local)\n return Number.isNaN(d.getTime()) ? null : d.toISOString()\n}\n\nexport function instantToLocal(iso: string | null | undefined): string {\n if (!iso) return ''\n const d = new Date(iso)\n if (Number.isNaN(d.getTime())) return ''\n const pad = (n: number) => String(n).padStart(2, '0')\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`\n}\n\nfunction DateTimeField({ label, value, onChange, errorText }: { label: string; value: string | null | undefined; onChange: (iso: string | null) => void; errorText: string }) {\n const id = useId()\n const [text, setText] = useState(() => instantToLocal(value))\n const [bad, setBad] = useState(false)\n return (\n <div className=\"ty-rule-editor__number\">\n <label className=\"ty-rule-editor__label\" htmlFor={id}>\n {label}\n </label>\n <input\n id={id}\n className=\"ty-rule-editor__number-input\"\n type=\"datetime-local\"\n value={text}\n aria-invalid={bad || undefined}\n aria-describedby={bad ? `${id}-error` : undefined}\n onChange={(e) => {\n const t = e.target.value\n setText(t)\n const iso = localToInstant(t)\n setBad(t !== '' && iso === null)\n onChange(iso)\n }}\n />\n {bad ? (\n <p id={`${id}-error`} className=\"ty-rule-editor__error\">\n {errorText}\n </p>\n ) : null}\n </div>\n )\n}\n\n// ---- condition --------------------------------------------------------------\n\nexport interface RuleConditionBuilderProps {\n value: ExpressionNode\n onChange: (next: ExpressionNode) => void\n references?: readonly string[]\n catalog?: ExpressionCatalog\n labels?: Partial<RuleEditorLabels>\n}\n\nexport function RuleConditionBuilder({ value, onChange, references = [FLOW_INPUTS_REF], catalog, labels }: RuleConditionBuilderProps) {\n const l = useLabels(ruleEditorLabels, labels)\n return (\n <ExpressionField\n label={l.condition}\n value={value}\n onChange={onChange}\n references={references}\n mode=\"predicate\"\n acceptLeaves\n labels={l.field}\n builderLabels={l.builder}\n {...(catalog ? { catalog } : {})}\n />\n )\n}\n\n// ---- action -----------------------------------------------------------------\n\nexport interface RuleActionBuilderProps {\n value: RuleAction\n onChange: (next: RuleAction) => void\n actionCatalog?: readonly ActionKind[]\n allowCustom?: boolean\n actionContext?: ActionContext\n references?: readonly string[]\n /** Declared type of each reference, to read Set value text as a number or boolean. */\n referenceTypes?: Record<string, 'number' | 'boolean' | 'string'>\n onValidate?: (errors: ParamError[]) => void\n labels?: Partial<RuleEditorLabels>\n}\n\nconst CUSTOM_KIND: ActionKind = { kind: CUSTOM_ACTION, labelKey: 'custom', descriptionKey: 'customDescription', params: [] }\n\nexport function RuleActionBuilder(props: RuleActionBuilderProps) {\n const { value, onChange, actionCatalog, allowCustom = true, actionContext = {}, references = [FLOW_INPUTS_REF], referenceTypes = {}, onValidate } = props\n const l = useLabels(ruleEditorLabels, props.labels)\n const { locale } = useFlowLocale()\n const kinds = useMemo(() => [...(actionCatalog ?? defaultRuleActions), ...(allowCustom ? [CUSTOM_KIND] : [])], [actionCatalog, allowCustom])\n const kind = kinds.find((k) => k.kind === value.kind)\n const params = value.params ?? {}\n const say = (key: string | undefined) => (key ? (l.actions[key] ?? key) : '')\n const [touched, setTouched] = useState<Record<string, boolean>>({})\n const errors = kind && kind.kind !== CUSTOM_ACTION ? validateParams(kind, params, actionContext) : []\n const errorKey = errors.map((e) => `${e.key}:${e.code}`).join('|')\n useEffect(() => {\n onValidate?.(errors)\n // errorKey summarises the errors array\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [errorKey])\n\n const setParam = (key: string, v: unknown) => onChange({ ...value, params: { ...params, [key]: v } })\n\n const picker = (\n <NativeSelect\n label={l.actionKind}\n options={[...(kind ? [] : [{ value: value.kind, label: value.kind, disabled: true }]), ...kinds.map((k) => ({ value: k.kind, label: say(k.labelKey) }))]}\n value={value.kind}\n hint={kind?.descriptionKey ? say(kind.descriptionKey) : undefined}\n onChange={(k) => {\n const next = kinds.find((x) => x.kind === k)\n setTouched({})\n onChange({ kind: k, params: next?.kind === CUSTOM_ACTION ? {} : defaultParams(next) })\n }}\n />\n )\n\n if (!kind) {\n return (\n <div className=\"ty-rule-editor__panel\">\n {picker}\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {l.unavailable}\n </InlineNotice>\n <dl className=\"ty-rule-editor__readonly\">\n {Object.entries(params).map(([k, v]) => (\n <Fragment key={k}>\n <dt dir=\"ltr\">{k}</dt>\n <dd>{typeof v === 'string' ? v : JSON.stringify(v)}</dd>\n </Fragment>\n ))}\n </dl>\n </div>\n )\n }\n\n if (kind.kind === CUSTOM_ACTION) return <div className=\"ty-rule-editor__panel\">{picker}<CustomParams params={params} onChange={(p) => onChange({ ...value, params: p })} l={l} /></div>\n\n const errorFor = (p: ParamSpec) => {\n const e = errors.find((x) => x.key === p.key)\n if (!e || e.code === 'noOptions') return undefined\n return touched[p.key] ? fill(l.required, { name: say(p.labelKey) }, locale) : undefined\n }\n\n return (\n <div className=\"ty-rule-editor__panel\">\n {picker}\n <div className=\"ty-rule-editor__params\">\n {kind.params.map((p) => {\n const name = say(p.labelKey)\n const current = params[p.key]\n const blur = () => setTouched((t) => ({ ...t, [p.key]: true }))\n if (p.type === 'number') return <NumberInput key={p.key} label={name} value={typeof current === 'number' ? current : null} onChange={(v) => setParam(p.key, v)} {...(p.min !== undefined ? { min: p.min } : {})} {...(p.max !== undefined ? { max: p.max } : {})} {...(p.step !== undefined ? { step: p.step } : {})} />\n if (p.type === 'boolean') return <Switch key={p.key} label={name} isSelected={current === true} onChange={(v) => setParam(p.key, v)} />\n if (p.type === 'choice' || p.type === 'reference') {\n const options = p.type === 'reference' ? references.map((r) => ({ value: r, label: r })) : choiceOptions(p, actionContext).map((o) => ({ value: o.value, label: o.label ?? say(o.labelKey) }))\n if (!options.length)\n return (\n <InlineNotice key={p.key} tone=\"warning\" urgency=\"none\">\n {fill(l.noOptions, { name }, locale)}\n </InlineNotice>\n )\n return <NativeSelect key={p.key} label={name} placeholder=\"\" options={[{ value: '', label: '' }, ...options]} value={typeof current === 'string' ? current : ''} onChange={(v) => setParam(p.key, v)} {...(errorFor(p) ? { errorMessage: errorFor(p)! } : {})} />\n }\n if (p.type === 'duration') {\n const d = (current && typeof current === 'object' ? current : {}) as { amount?: number; unit?: string }\n return (\n <fieldset key={p.key} className=\"ty-rule-editor__duration\">\n <legend className=\"ty-rule-editor__label\">{name}</legend>\n <NumberInput label={name} integer min={0} value={typeof d.amount === 'number' ? d.amount : null} onChange={(amount) => setParam(p.key, amount === null ? undefined : { amount, unit: d.unit ?? 'days' })} />\n <NativeSelect label={l.durationUnit} options={DURATION_UNITS.map((u) => ({ value: u, label: l.units[u] }))} value={d.unit ?? 'days'} onChange={(unit) => setParam(p.key, { amount: d.amount ?? 0, unit })} />\n </fieldset>\n )\n }\n const typed = p.typedBy ? referenceTypes[String(params[p.typedBy] ?? '')] : undefined\n return (\n <TextField\n key={p.key}\n label={name}\n value={current === undefined || current === null ? '' : String(current)}\n onChange={(t) => setParam(p.key, readTyped(t, typed))}\n onBlur={blur}\n {...(errorFor(p) ? { errorMessage: errorFor(p)! } : {})}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\nfunction CustomParams({ params, onChange, l }: { params: Record<string, unknown>; onChange: (p: Record<string, unknown>) => void; l: RuleEditorLabels }) {\n const { locale } = useFlowLocale()\n const [rows, setRows] = useState(() => Object.entries(params).map(([key, v]) => ({ id: createId('param'), key, text: typeof v === 'string' ? v : JSON.stringify(v) })))\n const emit = (next: typeof rows) => {\n setRows(next)\n const out: Record<string, unknown> = {}\n for (const r of next) if (r.key.trim()) out[r.key.trim()] = readLooseValue(r.text)\n onChange(out)\n }\n return (\n <div className=\"ty-rule-editor__params\">\n {rows.map((r, i) => (\n <fieldset key={r.id} className=\"ty-rule-editor__row\">\n <legend className=\"ty-visually-hidden\">{fill(l.customLegend, { n: i + 1 }, locale)}</legend>\n <TextField className=\"ty-ltr-text\" label={l.customKey} value={r.key} onChange={(key) => emit(rows.map((x) => (x.id === r.id ? { ...x, key } : x)))} />\n <TextField label={l.customValue} value={r.text} onChange={(text) => emit(rows.map((x) => (x.id === r.id ? { ...x, text } : x)))} />\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={fill(l.customRemove, { key: r.key || String(i + 1) }, locale)} leadingIcon={<Trash2 />} onPress={() => emit(rows.filter((x) => x.id !== r.id))} />\n </fieldset>\n ))}\n <Button variant=\"secondary\" size=\"compact\" leadingIcon={<Plus />} onPress={() => setRows((rs) => [...rs, { id: createId('param'), key: '', text: '' }])}>\n {l.customAdd}\n </Button>\n </div>\n )\n}\n\n// ---- full form ---------------------------------------------------------------\n\nexport interface RuleEditorProps {\n value?: RuleValue\n onChange: (next: RuleValue) => void\n actionCatalog?: readonly ActionKind[]\n allowCustom?: boolean\n actionContext?: ActionContext\n statuses?: readonly string[]\n references?: readonly string[]\n referenceTypes?: Record<string, 'number' | 'boolean' | 'string'>\n catalog?: ExpressionCatalog\n onValidate?: (errors: ParamError[]) => void\n labels?: Partial<RuleEditorLabels>\n}\n\nexport function RuleEditor(props: RuleEditorProps) {\n const { actionCatalog, allowCustom, actionContext, statuses = FALLBACK_RULE_STATUSES, references = [FLOW_INPUTS_REF], referenceTypes, catalog, onValidate } = props\n const l = useLabels(ruleEditorLabels, props.labels)\n const [rule, setRule] = useControllable<RuleValue>(props.value, () => defaultRule(actionCatalog), props.onChange)\n const condition = useMemo(() => normalizeRuleCondition(rule.condition), [rule.condition])\n const [nameTouched, setNameTouched] = useState(false)\n const edit = (patch: Partial<RuleValue>) => setRule({ ...rule, ...patch })\n const hasAdvanced = !!(rule.validFrom || rule.validUntil || (rule.tags && rule.tags.length) || (rule.status && rule.status !== 'active'))\n const root = conditionRootName(condition)\n const rootWord = root === 'reference' ? l.rootNames.reference : root === 'value' ? l.rootNames.value : root\n const kind = [...(actionCatalog ?? defaultRuleActions), CUSTOM_KIND].find((k) => k.kind === rule.action.kind)\n const [tagDraft, setTagDraft] = useState('')\n\n return (\n <div className=\"ty-node-form ty-rule-editor\">\n <div className=\"ty-rule-editor__basics\">\n <TextField\n label={l.name}\n required\n value={rule.name}\n onChange={(name) => edit({ name })}\n onBlur={() => setNameTouched(true)}\n {...(nameTouched && !rule.name.trim() ? { errorMessage: l.nameRequired } : {})}\n />\n <NumberInput label={l.priority} integer min={0} value={rule.priority} onChange={(v) => edit({ priority: v === null ? 0 : Math.max(0, Math.round(v)) })} />\n <Switch label={l.active} isSelected={rule.enabled} onChange={(enabled) => edit({ enabled })} />\n <TextArea label={l.description} rows={2} value={rule.description ?? ''} onChange={(d) => edit(d ? { description: d } : { description: undefined })} />\n </div>\n\n <section className=\"ty-expr-form__section\" aria-labelledby={`${rule.id ?? 'rule'}-condition`}>\n <h3 id={`${rule.id ?? 'rule'}-condition`} className=\"ty-expr-form__section-title\">\n {l.conditionHeading} <Tag size=\"small\">{rootWord}</Tag>\n </h3>\n <RuleConditionBuilder value={condition} onChange={(c) => edit({ condition: c })} references={references} labels={props.labels} {...(catalog ? { catalog } : {})} />\n </section>\n\n <section className=\"ty-expr-form__section\" aria-labelledby={`${rule.id ?? 'rule'}-action`}>\n <h3 id={`${rule.id ?? 'rule'}-action`} className=\"ty-expr-form__section-title\">\n {l.actionHeading} <Tag size=\"small\">{kind ? (l.actions[kind.labelKey] ?? kind.labelKey) : rule.action.kind}</Tag>\n </h3>\n <RuleActionBuilder\n value={rule.action}\n onChange={(action) => edit({ action })}\n references={references}\n labels={props.labels}\n {...(actionCatalog ? { actionCatalog } : {})}\n {...(allowCustom !== undefined ? { allowCustom } : {})}\n {...(actionContext ? { actionContext } : {})}\n {...(referenceTypes ? { referenceTypes } : {})}\n {...(onValidate ? { onValidate } : {})}\n />\n </section>\n\n <Disclosure className=\"ty-rule-editor__disclosure\" defaultExpanded={hasAdvanced}>\n <Heading level={3} className=\"ty-expr-form__section-title\">\n <AriaButton slot=\"trigger\" className=\"ty-rule-editor__disclosure-trigger\">\n <ChevronRight className=\"ty-rule-editor__chevron\" aria-hidden=\"true\" focusable=\"false\" />\n {l.advanced}\n </AriaButton>\n </Heading>\n <DisclosurePanel className=\"ty-rule-editor__panel\">\n <div className=\"ty-rule-editor__basics\">\n <DateTimeField label={l.validFrom} value={rule.validFrom} errorText={l.invalidDate} onChange={(validFrom) => edit({ validFrom })} />\n <DateTimeField label={l.validUntil} value={rule.validUntil} errorText={l.invalidDate} onChange={(validUntil) => edit({ validUntil })} />\n <NativeSelect label={l.status} options={statuses.map((s) => ({ value: s, label: l.statusNames[s] ?? s }))} value={rule.status ?? 'active'} onChange={(status) => edit({ status })} />\n </div>\n <div className=\"ty-rule-editor__tags\">\n {rule.tags?.length ? <TagList label={l.tags} items={rule.tags.map((t) => ({ id: t, label: t }))} onRemove={(id) => edit({ tags: (rule.tags ?? []).filter((t) => t !== id) })} /> : null}\n <TextField label={l.newTag} value={tagDraft} onChange={setTagDraft} />\n <Button\n variant=\"secondary\"\n size=\"compact\"\n leadingIcon={<Plus />}\n disabled={!tagDraft.trim()}\n onPress={() => {\n const t = tagDraft.trim()\n if (t && !(rule.tags ?? []).includes(t)) edit({ tags: [...(rule.tags ?? []), t] })\n setTagDraft('')\n }}\n >\n {l.addTag}\n </Button>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n )\n}\n","// RuleNodeForm: a rule step points at one saved rule and says whether the\n// step is active; the rule itself is authored elsewhere (onManageRules).\n\nimport { useEffect, useState } from 'react'\nimport { Button, InlineNotice, NativeSelect, Spinner, Switch } from '../../index'\nimport { NodeFormFooter } from '../forms/NodeFormFooter'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { conditionSummary } from './ruleCondition'\n\nexport interface SavedRuleSummary {\n id: string\n name: string\n condition?: unknown\n}\n\nexport interface RuleNodeFormLabels {\n rule: string\n placeholder: string\n option: string\n loading: string\n loadError: string\n legacy: string\n summary: string\n newRule: string\n manageRules: string\n enabled: string\n enabledHint: string\n save: string\n cancel: string\n}\n\nexport const ruleNodeFormLabels = defineLabels<RuleNodeFormLabels>('RuleNodeForm', {\n en: {\n rule: 'Saved rule',\n placeholder: 'Choose a saved rule',\n option: '{name} ({id})',\n loading: 'Loading rules',\n loadError: 'Rules could not be loaded: {message}',\n legacy: 'This step still has an inline condition. Pick a saved rule to replace it.',\n summary: '{root} with {clauses, plural, one {# clause} other {# clauses}}',\n newRule: 'New rule',\n manageRules: 'Manage rules',\n enabled: 'Step active',\n enabledHint: 'Turns this step on or off for runs, whatever the rule’s own state.',\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n rule: 'Regra salva',\n placeholder: 'Escolha uma regra salva',\n option: '{name} ({id})',\n loading: 'Carregando regras',\n loadError: 'Não foi possível carregar as regras: {message}',\n legacy: 'Esta etapa ainda tem uma condição própria. Escolha uma regra salva para substituí-la.',\n summary: '{root} com {clauses, plural, one {# cláusula} other {# cláusulas}}',\n newRule: 'Nova regra',\n manageRules: 'Gerenciar regras',\n enabled: 'Etapa ativa',\n enabledHint: 'Liga ou desliga esta etapa nas execuções, qualquer que seja o estado da regra.',\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n rule: 'Regla guardada',\n placeholder: 'Elija una regla guardada',\n option: '{name} ({id})',\n loading: 'Cargando reglas',\n loadError: 'No se pudieron cargar las reglas: {message}',\n legacy: 'Este paso aún tiene una condición propia. Elija una regla guardada para reemplazarla.',\n summary: '{root} con {clauses, plural, one {# cláusula} other {# cláusulas}}',\n newRule: 'Nueva regla',\n manageRules: 'Gestionar reglas',\n enabled: 'Paso activo',\n enabledHint: 'Activa o desactiva este paso en las ejecuciones, sea cual sea el estado de la regla.',\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultRuleNodeFormLabels: RuleNodeFormLabels = ruleNodeFormLabels.bundles.en\n\nexport interface RuleNodeFormProps {\n value: { ruleId?: string; enabled?: boolean; [key: string]: unknown }\n rules?: SavedRuleSummary[]\n loadRules?: () => Promise<SavedRuleSummary[]>\n onManageRules: () => void\n onSave: (value: { kind: 'rule'; ruleId?: string; enabled: boolean }) => void\n onCancel: () => void\n labels?: Partial<RuleNodeFormLabels>\n}\n\nconst LEGACY_KEYS = ['condition', 'conditions', 'expression', 'rule']\n\nexport function RuleNodeForm({ value, rules, loadRules, onManageRules, onSave, onCancel, labels }: RuleNodeFormProps) {\n const l = useLabels(ruleNodeFormLabels, labels)\n const { locale } = useFlowLocale()\n const [loaded, setLoaded] = useState<{ state: 'ready'; list: SavedRuleSummary[] } | { state: 'loading' } | { state: 'error'; message: string }>(() => (rules ? { state: 'ready', list: rules } : loadRules ? { state: 'loading' } : { state: 'ready', list: [] }))\n const [ruleId, setRuleId] = useState(value.ruleId ?? '')\n const [enabled, setEnabled] = useState(value.enabled !== false)\n\n useEffect(() => {\n if (rules) {\n setLoaded({ state: 'ready', list: rules })\n return\n }\n if (!loadRules) return\n let live = true\n setLoaded({ state: 'loading' })\n loadRules().then(\n (list) => {\n if (live) setLoaded({ state: 'ready', list })\n },\n (e: unknown) => {\n if (live) setLoaded({ state: 'error', message: e instanceof Error ? e.message : String(e) })\n },\n )\n return () => {\n live = false\n }\n }, [rules, loadRules])\n\n const list = loaded.state === 'ready' ? loaded.list : []\n const legacy = !value.ruleId && LEGACY_KEYS.some((k) => k in value)\n const chosen = list.find((r) => r.id === ruleId)\n const options = [{ value: '', label: l.placeholder }, ...list.map((r) => ({ value: r.id, label: fill(l.option, { name: r.name, id: r.id }, locale) })), ...(ruleId && !chosen ? [{ value: ruleId, label: ruleId }] : [])]\n const summary = chosen ? conditionSummary(chosen.condition) : null\n\n return (\n <div className=\"ty-node-form ty-rule-node-form\">\n {legacy ? (\n <InlineNotice tone=\"warning\" urgency=\"polite\">\n {l.legacy}\n </InlineNotice>\n ) : null}\n {loaded.state === 'error' ? (\n <InlineNotice tone=\"danger\" urgency=\"assertive\">\n {fill(l.loadError, { message: loaded.message }, locale)}\n </InlineNotice>\n ) : null}\n {loaded.state === 'loading' ? (\n <div className=\"ty-rule-node-form__loading\" aria-busy=\"true\">\n <Spinner size=\"small\" label={l.loading} showLabel />\n </div>\n ) : (\n <NativeSelect label={l.rule} options={options} value={ruleId} onChange={setRuleId} />\n )}\n {chosen ? (\n <div className=\"ty-rule-node-form__summary\">\n <p className=\"ty-rule-node-form__summary-name\">{chosen.name}</p>\n {summary ? <p className=\"ty-rule-node-form__summary-line\">{fill(l.summary, { root: summary.root, clauses: summary.clauses }, locale)}</p> : null}\n </div>\n ) : null}\n <Button variant=\"secondary\" onPress={onManageRules}>\n {loaded.state === 'ready' && list.length === 0 ? l.newRule : l.manageRules}\n </Button>\n <Switch label={l.enabled} description={l.enabledHint} isSelected={enabled} onChange={setEnabled} />\n <NodeFormFooter\n onSave={() => onSave({ kind: 'rule', ...(ruleId ? { ruleId } : {}), enabled })}\n onCancel={onCancel}\n saveDisabled={loaded.state === 'loading' && !value.ruleId}\n labels={{ save: l.save, cancel: l.cancel }}\n />\n </div>\n )\n}\n","// Evaluation traces of an expression on sample data, and the small client\n// that asks the engine to produce one (the \"dry run\"). The host always gives\n// the endpoint; the engine may answer in snake case, which is accepted too.\n\nexport interface TraceSpan {\n kind: 'operation' | 'ref' | 'value'\n label: string\n args?: Record<string, unknown>\n /** Absent when the engine recorded no result for the frame. */\n result?: unknown\n children?: TraceSpan[]\n}\n\nexport interface TraceReport {\n trace: TraceSpan\n truncated: boolean\n frameCount: number\n frameLimit: number\n}\n\nexport interface DryRunRequest {\n config: Record<string, unknown>\n inputs?: Record<string, unknown>\n nodeOutputs?: Record<string, unknown>\n}\n\nexport interface DryRunResponse {\n result: unknown\n trace: TraceReport\n}\n\n/** A loose record read from the wire, with alias-aware lookups. */\nclass Wire {\n private readonly bag: Record<string, unknown>\n constructor(raw: unknown) {\n this.bag = raw !== null && typeof raw === 'object' ? (raw as Record<string, unknown>) : {}\n }\n /** First present value among the spellings. */\n get(...spellings: string[]): unknown {\n const hit = spellings.find((s) => Object.prototype.hasOwnProperty.call(this.bag, s))\n return hit === undefined ? undefined : this.bag[hit]\n }\n has(name: string): boolean {\n return Object.prototype.hasOwnProperty.call(this.bag, name)\n }\n}\n\nconst KIND_ALIASES: Record<string, TraceSpan['kind']> = { ref: 'ref', reference: 'ref', value: 'value', literal: 'value' }\n\nfunction toSpan(raw: unknown): TraceSpan {\n const w = new Wire(raw)\n const span: TraceSpan = { kind: KIND_ALIASES[String(w.get('kind', 'span_kind') ?? '')] ?? 'operation', label: String(w.get('label', 'name', 'operation') ?? '') }\n const args = w.get('args', 'arguments')\n if (args !== null && typeof args === 'object' && !Array.isArray(args)) span.args = args as Record<string, unknown>\n if (w.has('result')) span.result = w.get('result')\n const kids = w.get('children', 'child_spans')\n if (Array.isArray(kids) && kids.length > 0) span.children = kids.map(toSpan)\n return span\n}\n\n/** Maps a report whose keys may be snake case (frame_count …) onto TraceReport. */\nexport function traceReportFromWire(raw: unknown): TraceReport {\n const w = new Wire(raw)\n const count = (...names: string[]) => Number(w.get(...names) ?? 0)\n return { trace: toSpan(w.get('trace', 'root')), truncated: Boolean(w.get('truncated', 'is_truncated')), frameCount: count('frameCount', 'frame_count'), frameLimit: count('frameLimit', 'frame_limit') }\n}\n\n/** Why a dry run failed: the HTTP status (0 for network or unreadable bodies) and the server's text. */\nexport class DryRunFailure extends Error {\n readonly status: number\n constructor(status: number, message: string) {\n super(message)\n this.name = 'DryRunFailure'\n this.status = status\n }\n}\n\nconst messageOf = (why: unknown) => (why instanceof Error ? why.message : String(why))\n\n/** Runs `step`; any throw becomes a DryRunFailure with `status`. */\nasync function orFail<T>(status: number, step: () => Promise<T>): Promise<T> {\n try {\n return await step()\n } catch (why) {\n throw why instanceof DryRunFailure ? why : new DryRunFailure(status, messageOf(why))\n }\n}\n\nexport async function runDryRun(endpoint: string, request: DryRunRequest, fetchImpl: typeof fetch = globalThis.fetch): Promise<DryRunResponse> {\n const init: RequestInit = { method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json' }, body: JSON.stringify(request) }\n const response = await orFail(0, () => fetchImpl(endpoint, init))\n if (!response.ok) {\n const said = await response.text().catch(() => response.statusText)\n throw new DryRunFailure(response.status, said || response.statusText)\n }\n const body = new Wire(await orFail(response.status, () => response.json() as Promise<unknown>))\n return { result: body.get('result'), trace: traceReportFromWire(body.get('trace')) }\n}\n","// SchemaConfigForm: builds a node's settings form from the field schema the\n// node kind catalog serves, so most kinds need no form of their own. Each\n// property gets the editor its shape asks for; Save merges the edits over the\n// incoming value, keeping keys the schema does not mention.\n\nimport { useReducer, type ReactNode } from 'react'\nimport { NativeSelect, Switch, TextArea, TextField } from '../../index'\nimport type { ConfigSchema, FieldSchema } from '../catalog/kindCatalog'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { NodeFormFooter } from './NodeFormFooter'\n\nexport interface SchemaConfigFormLabels {\n save: string\n cancel: string\n none: string\n yes: string\n no: string\n empty: string\n invalidStructured: string\n required: string\n}\n\nexport const schemaConfigFormLabels = defineLabels<SchemaConfigFormLabels>('SchemaConfigForm', {\n en: {\n save: 'Save',\n cancel: 'Cancel',\n none: 'None',\n yes: 'Yes',\n no: 'No',\n empty: 'This step has nothing to configure.',\n invalidStructured: 'Not valid structured text: {detail}',\n required: 'Fill in this field.',\n },\n 'pt-BR': {\n save: 'Salvar',\n cancel: 'Cancelar',\n none: 'Nenhum',\n yes: 'Sim',\n no: 'Não',\n empty: 'Esta etapa não tem nada a configurar.',\n invalidStructured: 'Texto estruturado inválido: {detail}',\n required: 'Preencha este campo.',\n },\n es: {\n save: 'Guardar',\n cancel: 'Cancelar',\n none: 'Ninguno',\n yes: 'Sí',\n no: 'No',\n empty: 'Este paso no tiene nada que configurar.',\n invalidStructured: 'Texto estructurado no válido: {detail}',\n required: 'Complete este campo.',\n },\n})\n\nexport const defaultSchemaConfigFormLabels: SchemaConfigFormLabels = schemaConfigFormLabels.bundles.en\n\n/**\n * Label from a property key when the schema has no title. Only ASCII keys are\n * split (camelCase, snake_case, kebab-case); keys in any other script are\n * shown as they are, so no script is broken apart.\n */\nexport function labelFromKey(key: string): string {\n if (!/^[\\x20-\\x7e]+$/.test(key)) return key\n const lower = key\n .split(/(?<=[a-z0-9])(?=[A-Z])|[_-]+/)\n .filter(Boolean)\n .join(' ')\n .toLowerCase()\n return lower ? lower.charAt(0).toUpperCase() + lower.slice(1) : key\n}\n\nexport interface SchemaConfigFormProps {\n value: Record<string, unknown>\n schema: ConfigSchema\n onSave: (value: Record<string, unknown>) => void\n onCancel: () => void\n saveDisabled?: boolean\n labels?: Partial<SchemaConfigFormLabels>\n}\n\ntype Control = 'select' | 'number' | 'switch' | 'structured' | 'multiline' | 'line'\n\n/** Keys whose text is long enough to deserve a multi-line area. */\nconst LONG_TEXT = /(prompt|template|body|instructions?|input|code)$/i\n\n/** Shape tests in priority order; the first that matches picks the editor. */\nconst SHAPES: ReadonlyArray<[Control, (key: string, f: FieldSchema) => boolean]> = [\n ['select', (_k, f) => !!f.enum?.length],\n ['number', (_k, f) => f.type === 'number' || f.type === 'integer'],\n ['switch', (_k, f) => f.type === 'boolean'],\n ['structured', (_k, f) => f.type === 'array' || f.type === 'object'],\n ['multiline', (k) => LONG_TEXT.test(k)],\n]\n\nexport function controlFor(key: string, field: FieldSchema): Control {\n return SHAPES.find(([, test]) => test(key, field))?.[0] ?? 'line'\n}\n\n/** Per-field working state: the value to save (absent = unchanged), raw JSON text, its problem, whether it was visited. */\ninterface Slot {\n changed?: { to: unknown }\n text?: string\n problem?: string\n visited?: boolean\n}\n\ntype Slots = Record<string, Slot>\nconst patchSlot = (slots: Slots, [key, patch]: [string, Slot]): Slots => ({ ...slots, [key]: { ...slots[key], ...patch } })\n\nconst asText = (v: unknown) => (v === undefined || v === null ? '' : String(v))\nconst isEmpty = (v: unknown) => v === undefined || v === null || v === ''\n\n/** Everything a field editor needs. */\ninterface FieldCtx {\n name: string\n field: FieldSchema\n label: string\n required: boolean\n current: unknown\n slot: Slot\n problem?: string\n l: SchemaConfigFormLabels\n put: (to: unknown) => void\n visit: () => void\n typeJson: (text: string) => void\n}\n\nconst shared = (c: FieldCtx) => ({ label: c.label, hint: c.field.description, required: c.required, ...(c.problem ? { errorMessage: c.problem } : {}) })\n\nconst EDITORS: Record<Control, (c: FieldCtx) => ReactNode> = {\n select: (c) => (\n <NativeSelect\n {...shared(c)}\n placeholder={c.l.none}\n options={c.field.enum!.map((o) => ({ value: String(o), label: String(o) }))}\n value={asText(c.current)}\n onChange={(picked) => c.put(picked === '' ? undefined : c.field.enum!.find((o) => String(o) === picked))}\n />\n ),\n number: (c) => (\n <TextField\n {...shared(c)}\n inputType=\"number\"\n value={typeof c.current === 'number' ? String(c.current) : ''}\n onChange={(t) => c.put(t.trim() === '' || Number.isNaN(Number(t)) ? undefined : Number(t))}\n onBlur={c.visit}\n />\n ),\n switch: (c) => <Switch label={c.label} {...(c.field.description ? { description: c.field.description } : {})} isSelected={c.current === true} onChange={c.put} />,\n structured: (c) => <TextArea {...shared(c)} monospace className=\"ty-ltr-text\" rows={5} value={c.slot.text ?? ''} onChange={c.typeJson} />,\n multiline: (c) => <TextArea {...shared(c)} rows={4} autoGrow value={asText(c.current)} onChange={c.put} />,\n line: (c) => <TextField {...shared(c)} value={asText(c.current)} onChange={c.put} onBlur={c.visit} />,\n}\n\nexport function SchemaConfigForm({ value, schema, onSave, onCancel, saveDisabled = false, labels }: SchemaConfigFormProps) {\n const l = useLabels(schemaConfigFormLabels, labels)\n const { locale } = useFlowLocale()\n const fields = Object.entries(schema.properties ?? {})\n const needed = schema.required ?? []\n const [slots, patch] = useReducer(patchSlot, undefined, () =>\n Object.fromEntries(fields.filter(([k, f]) => controlFor(k, f) === 'structured').map(([k]) => [k, { text: value[k] === undefined ? '' : JSON.stringify(value[k], null, 2) }])),\n )\n\n const valueOf = (key: string) => (slots[key]?.changed ? slots[key]!.changed!.to : value[key])\n\n /** Structured text: blank unsets, valid JSON replaces, invalid keeps the last good value and explains. */\n const typeJsonFor = (key: string) => (text: string) => {\n if (!text.trim()) return patch([key, { text, problem: '', changed: { to: undefined } }])\n try {\n patch([key, { text, problem: '', changed: { to: JSON.parse(text) as unknown } }])\n } catch (why) {\n patch([key, { text, problem: fill(l.invalidStructured, { detail: why instanceof Error ? why.message : String(why) }, locale) }])\n }\n }\n\n const merged = () => {\n const out = { ...value }\n for (const [key, slot] of Object.entries(slots)) {\n if (!slot.changed) continue\n if (slot.changed.to === undefined) delete out[key]\n else out[key] = slot.changed.to\n }\n return out\n }\n\n const editors = fields.map(([name, field]) => {\n const slot = slots[name] ?? {}\n const required = needed.includes(name)\n const current = valueOf(name)\n const problem = slot.problem || (required && slot.visited && isEmpty(current) ? l.required : undefined)\n const ctx: FieldCtx = {\n name,\n field,\n label: field.title ?? labelFromKey(name),\n required,\n current,\n slot,\n ...(problem ? { problem } : {}),\n l,\n put: (to) => patch([name, { changed: { to } }]),\n visit: () => patch([name, { visited: true }]),\n typeJson: typeJsonFor(name),\n }\n return <div key={name} className=\"ty-schema-form__field\">{EDITORS[controlFor(name, field)](ctx)}</div>\n })\n\n return (\n <div className=\"ty-node-form ty-schema-form\">\n {editors.length ? <div className=\"ty-node-form__fields\">{editors}</div> : <p className=\"ty-node-form__empty\">{l.empty}</p>}\n <NodeFormFooter onSave={() => onSave(merged())} onCancel={onCancel} saveDisabled={saveDisabled} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// State and rules behind VariableListEditor, kept apart from the markup.\n//\n// The editor's own state is only the entry being typed, a complaint about it\n// and the last sentence for the live region; the list itself belongs to the\n// host. `nameListStep` is a reducer over that small state.\n\nexport type NameIssue = 'blank' | 'duplicate'\n\n/** Why the name at `position` would not survive a save, or null. */\nexport function issueAt(list: readonly string[], position: number): NameIssue | null {\n const candidate = list[position] ?? ''\n if (candidate.trim() === '') return 'blank'\n return list.indexOf(candidate) < position ? 'duplicate' : null\n}\n\n/**\n * Which remove control should hold focus once `position` has been taken out\n * of the list (`remaining` rows now). -1 means the entry field.\n */\nexport function focusTargetAfter(position: number, remaining: number): number {\n if (remaining === 0) return -1\n return Math.min(position, remaining - 1)\n}\n\nexport interface EntryState {\n draft: string\n complaint: 'duplicate' | null\n spoken: { kind: 'added' | 'removed'; name: string } | null\n}\n\nexport type EntryEvent =\n | { type: 'typed'; text: string }\n | { type: 'refused' }\n | { type: 'accepted'; name: string }\n | { type: 'dropped'; name: string }\n\nexport const EMPTY_ENTRY: EntryState = { draft: '', complaint: null, spoken: null }\n\nexport function nameListStep(state: EntryState, event: EntryEvent): EntryState {\n switch (event.type) {\n case 'typed':\n return { ...state, draft: event.text, complaint: null }\n case 'refused':\n return { ...state, complaint: 'duplicate' }\n case 'accepted':\n return { draft: '', complaint: null, spoken: { kind: 'added', name: event.name } }\n case 'dropped':\n return { ...state, spoken: { kind: 'removed', name: event.name } }\n }\n}\n\n/** Outcome of trying to add the current draft to `list`. */\nexport function admit(list: readonly string[], draft: string): { kind: 'empty' } | { kind: 'taken' } | { kind: 'ok'; name: string; next: string[] } {\n const name = draft.trim()\n if (!name) return { kind: 'empty' }\n if (list.includes(name)) return { kind: 'taken' }\n return { kind: 'ok', name, next: [...list, name] }\n}\n\nexport const replaceAt = (list: readonly string[], position: number, name: string): string[] => list.map((n, i) => (i === position ? name : n))\nexport const withoutAt = (list: readonly string[], position: number): string[] => list.filter((_, i) => i !== position)\n","// VariableListEditor: an ordered list of unique names (flow inputs, outputs,\n// aggregated values) edited in place. The rules and the typing state live in\n// nameListModel.ts; this file only lays out three parts: the caption, the\n// list of slots and the entry for a new name, plus one polite region.\n\nimport { Fragment, useId, useReducer, useRef, type KeyboardEvent, type ReactNode, type Ref } from 'react'\nimport { Plus, X } from 'lucide-react'\nimport { Button, TextField } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { admit, EMPTY_ENTRY, focusTargetAfter, issueAt, nameListStep, replaceAt, withoutAt } from './nameListModel'\n\nexport type VariableListTone = 'input' | 'output' | 'aggregate' | 'terminal' | 'neutral'\n\nexport interface VariableListEditorLabels {\n placeholder: string\n add: string\n addField: string\n remove: string\n rowField: string\n duplicate: string\n blank: string\n empty: string\n added: string\n removed: string\n}\n\nexport const variableListEditorLabels = defineLabels<VariableListEditorLabels>('VariableListEditor', {\n en: {\n placeholder: 'New name',\n add: 'Add',\n addField: 'New name',\n remove: 'Remove {name}',\n rowField: 'Name {n, number}',\n duplicate: 'Already in the list',\n blank: 'Name is empty; it will be dropped on save',\n empty: 'No names yet.',\n added: '{name} added',\n removed: '{name} removed',\n },\n 'pt-BR': {\n placeholder: 'Novo nome',\n add: 'Adicionar',\n addField: 'Novo nome',\n remove: 'Remover {name}',\n rowField: 'Nome {n, number}',\n duplicate: 'Já está na lista',\n blank: 'Nome vazio; será descartado ao salvar',\n empty: 'Nenhum nome ainda.',\n added: '{name} adicionado',\n removed: '{name} removido',\n },\n es: {\n placeholder: 'Nombre nuevo',\n add: 'Añadir',\n addField: 'Nombre nuevo',\n remove: 'Quitar {name}',\n rowField: 'Nombre {n, number}',\n duplicate: 'Ya está en la lista',\n blank: 'Nombre vacío; se descartará al guardar',\n empty: 'Todavía no hay nombres.',\n added: '{name} añadido',\n removed: '{name} quitado',\n },\n})\n\nexport const defaultVariableListEditorLabels: VariableListEditorLabels = variableListEditorLabels.bundles.en\n\nexport interface VariableListEditorProps {\n value: string[]\n onChange: (names: string[]) => void\n label?: string\n placeholder?: string\n addLabel?: string\n tone?: VariableListTone\n numbered?: boolean\n editable?: boolean\n /** Maximum length; 0 means unlimited. */\n max?: number\n /** No add row (the list is only shown and pruned). */\n readOnly?: boolean\n labels?: Partial<VariableListEditorLabels>\n}\n\n/** Marker colour per role (decorative; the name carries the meaning). */\nconst ROLE_SWATCH: Readonly<Record<VariableListTone, string>> = {\n neutral: 'neutral',\n input: 'categorical-3',\n aggregate: 'categorical-8',\n output: 'categorical-1',\n terminal: 'categorical-6',\n}\n\ntype RemoveHandle = HTMLButtonElement | HTMLAnchorElement | null\n\ninterface SlotContext {\n list: readonly string[]\n numbered: boolean\n editable: boolean\n canRemove: boolean\n locale: string\n text: VariableListEditorLabels\n keepHandle: (position: number, el: RemoveHandle) => void\n rename: (position: number, name: string) => void\n remove: (position: number) => void\n}\n\nfunction slotMarker(ctx: SlotContext, position: number): ReactNode {\n return (\n <span className=\"ty-var-list__marker\" aria-hidden={ctx.numbered ? undefined : true} data-numbered={ctx.numbered || undefined}>\n {ctx.numbered ? new Intl.NumberFormat(ctx.locale).format(position + 1) : ''}\n </span>\n )\n}\n\nfunction slotName(ctx: SlotContext, position: number, name: string): ReactNode {\n if (!ctx.editable) {\n return (\n <span className=\"ty-var-list__name ty-mono ty-ltr-text\" dir=\"ltr\">\n {name}\n </span>\n )\n }\n const issue = issueAt(ctx.list, position)\n const message = issue === 'blank' ? ctx.text.blank : issue === 'duplicate' ? ctx.text.duplicate : null\n return (\n <TextField\n className=\"ty-var-list__name-field\"\n accessibleLabel={fill(ctx.text.rowField, { n: position + 1 }, ctx.locale)}\n value={name}\n onChange={(v) => ctx.rename(position, v)}\n {...(message ? { errorMessage: message } : {})}\n />\n )\n}\n\nfunction slotRemove(ctx: SlotContext, position: number, name: string): ReactNode {\n if (!ctx.canRemove) return null\n return (\n <Button\n ref={(el) => ctx.keepHandle(position, el)}\n variant=\"quiet\"\n size=\"compact\"\n shape=\"circle\"\n iconOnly\n accessibleLabel={fill(ctx.text.remove, { name }, ctx.locale)}\n leadingIcon={<X />}\n onPress={() => ctx.remove(position)}\n />\n )\n}\n\n/** The parts of one row, in order; each is a function of the row. */\nconst SLOT_PARTS = [\n (ctx: SlotContext, position: number) => slotMarker(ctx, position),\n (ctx: SlotContext, position: number, name: string) => slotName(ctx, position, name),\n (ctx: SlotContext, position: number, name: string) => slotRemove(ctx, position, name),\n] as const\n\ninterface EntryProps {\n draft: string\n complaint: string | null\n fieldLabel: string\n placeholder: string\n buttonText: string\n fieldRef: Ref<HTMLInputElement>\n onType: (text: string) => void\n onCommit: () => void\n}\n\nfunction NewNameEntry(p: EntryProps) {\n const commitOnEnter = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' && (e.target as HTMLElement).tagName === 'INPUT') {\n e.preventDefault()\n p.onCommit()\n }\n }\n return (\n <div className=\"ty-var-list__add\" onKeyDown={commitOnEnter}>\n <TextField ref={p.fieldRef} accessibleLabel={p.fieldLabel} placeholder={p.placeholder} value={p.draft} onChange={p.onType} {...(p.complaint ? { errorMessage: p.complaint } : {})} />\n <Button variant=\"secondary\" leadingIcon={<Plus />} disabled={p.draft.trim() === ''} onPress={p.onCommit}>\n {p.buttonText}\n </Button>\n </div>\n )\n}\n\nexport function VariableListEditor(props: VariableListEditorProps) {\n const text = useLabels(variableListEditorLabels, props.labels)\n const { locale } = useFlowLocale()\n const captionId = useId()\n const [entry, dispatch] = useReducer(nameListStep, EMPTY_ENTRY)\n const entryField = useRef<HTMLInputElement>(null)\n const handles = useRef(new Map<number, RemoveHandle>())\n\n const list = props.value\n const limit = props.max ?? 0\n const accepting = !props.readOnly && (limit <= 0 || list.length < limit)\n\n const commit = () => {\n const verdict = admit(list, entry.draft)\n if (verdict.kind === 'empty') return\n if (verdict.kind === 'taken') {\n dispatch({ type: 'refused' })\n return\n }\n props.onChange(verdict.next)\n dispatch({ type: 'accepted', name: verdict.name })\n entryField.current?.focus()\n }\n\n const ctx: SlotContext = {\n list,\n numbered: props.numbered ?? false,\n editable: props.editable ?? false,\n canRemove: !props.readOnly,\n locale,\n text,\n keepHandle: (position, el) => {\n if (el) handles.current.set(position, el)\n else handles.current.delete(position)\n },\n rename: (position, name) => props.onChange(replaceAt(list, position, name)),\n remove: (position) => {\n const rest = withoutAt(list, position)\n props.onChange(rest)\n dispatch({ type: 'dropped', name: list[position]! })\n const target = focusTargetAfter(position, rest.length)\n requestAnimationFrame(() => {\n const handle = target >= 0 ? handles.current.get(target) : null\n ;(handle?.isConnected ? handle : entryField.current)?.focus()\n })\n },\n }\n\n const spoken = entry.spoken ? fill(entry.spoken.kind === 'added' ? text.added : text.removed, { name: entry.spoken.name }, locale) : ''\n const caption = props.label ? (\n <span id={captionId} className=\"ty-var-list__label\">\n {props.label}\n </span>\n ) : null\n\n let listing: ReactNode = null\n if (list.length) {\n listing = (\n <ul className=\"ty-var-list__rows\" role=\"list\" aria-labelledby={props.label ? captionId : undefined}>\n {list.map((name, position) => (\n <li key={position} className=\"ty-var-list__row\">\n {SLOT_PARTS.map((part, i) => (\n <Fragment key={i}>{part(ctx, position, name)}</Fragment>\n ))}\n </li>\n ))}\n </ul>\n )\n } else if (!accepting) {\n listing = <p className=\"ty-var-list__empty\">{text.empty}</p>\n }\n\n return (\n <div className=\"ty-var-list\" data-tone={ROLE_SWATCH[props.tone ?? 'input']}>\n {caption}\n {listing}\n {accepting ? (\n <NewNameEntry\n draft={entry.draft}\n complaint={entry.complaint ? text.duplicate : null}\n fieldLabel={text.addField}\n placeholder={props.placeholder ?? text.placeholder}\n buttonText={props.addLabel ?? text.add}\n fieldRef={entryField}\n onType={(t) => dispatch({ type: 'typed', text: t })}\n onCommit={commit}\n />\n ) : null}\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {spoken}\n </p>\n </div>\n )\n}\n","// ToolServerListField: zero or more external tool servers (Model Context\n// Protocol) for an agent, each reached by a remote address or a local\n// command. Headers are kept untouched (secrets live on credential screens).\n\nimport { useEffect, useId, useRef, useState } from 'react'\nimport { Plus, Trash2 } from 'lucide-react'\nimport { Button, Fieldset, TextField } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\n\nexport interface ToolServer {\n prefix?: string\n url?: string\n command?: string\n args?: string[]\n headers?: Record<string, string>\n}\n\nexport interface ToolServerListLabels {\n label: string\n add: string\n empty: string\n legend: string\n prefix: string\n prefixHint: string\n url: string\n urlPlaceholder: string\n command: string\n args: string\n argsHint: string\n remove: string\n incomplete: string\n badUrl: string\n added: string\n}\n\nexport const toolServerListLabels = defineLabels<ToolServerListLabels>('ToolServerListField', {\n en: {\n label: 'Tool servers',\n add: 'Add server',\n empty: 'No tool server attached.',\n legend: 'Server {n, number}',\n prefix: 'Tool name prefix',\n prefixHint: 'Put in front of every tool this server offers.',\n url: 'Remote address',\n urlPlaceholder: 'https://',\n command: 'Local command',\n args: 'Command arguments',\n argsHint: 'Separated by spaces.',\n remove: 'Remove server {n, number}',\n incomplete: 'Without an address or a command this server will be ignored on save.',\n badUrl: 'Not a valid address.',\n added: 'Server added',\n },\n 'pt-BR': {\n label: 'Servidores de ferramentas',\n add: 'Adicionar servidor',\n empty: 'Nenhum servidor de ferramentas associado.',\n legend: 'Servidor {n, number}',\n prefix: 'Prefixo dos nomes das ferramentas',\n prefixHint: 'Vai antes de cada ferramenta oferecida por este servidor.',\n url: 'Endereço remoto',\n urlPlaceholder: 'https://',\n command: 'Comando local',\n args: 'Argumentos do comando',\n argsHint: 'Separados por espaços.',\n remove: 'Remover servidor {n, number}',\n incomplete: 'Sem endereço nem comando, este servidor será ignorado ao salvar.',\n badUrl: 'Endereço inválido.',\n added: 'Servidor adicionado',\n },\n es: {\n label: 'Servidores de herramientas',\n add: 'Añadir servidor',\n empty: 'No hay servidores de herramientas.',\n legend: 'Servidor {n, number}',\n prefix: 'Prefijo de los nombres de herramientas',\n prefixHint: 'Se antepone a cada herramienta que ofrece este servidor.',\n url: 'Dirección remota',\n urlPlaceholder: 'https://',\n command: 'Comando local',\n args: 'Argumentos del comando',\n argsHint: 'Separados por espacios.',\n remove: 'Quitar servidor {n, number}',\n incomplete: 'Sin dirección ni comando, este servidor se ignorará al guardar.',\n badUrl: 'La dirección no es válida.',\n added: 'Servidor añadido',\n },\n})\n\nexport const defaultToolServerListLabels: ToolServerListLabels = toolServerListLabels.bundles.en\n\nexport interface ToolServerListFieldProps {\n value: ToolServer[]\n /** Every edit, add or removal (raw; clean with cleanToolServers on save). */\n onChange: (list: ToolServer[]) => void\n /** Hosts that forbid local processes hide command and arguments. */\n allowCommand?: boolean\n labels?: Partial<ToolServerListLabels>\n}\n\nconst splitArgs = (text: string) => text.split(/\\s+/).filter(Boolean)\n\n/** Trims fields, drops empty arguments and entries without address or command; undefined when nothing remains. */\nexport function cleanToolServers(list: readonly ToolServer[] | undefined): ToolServer[] | undefined {\n const out: ToolServer[] = []\n for (const s of list ?? []) {\n const prefix = s.prefix?.trim()\n const url = s.url?.trim()\n const command = s.command?.trim()\n const args = (s.args ?? []).map((a) => a.trim()).filter(Boolean)\n if (!url && !command) continue\n out.push({\n ...(prefix ? { prefix } : {}),\n ...(url ? { url } : {}),\n ...(command ? { command } : {}),\n ...(args.length ? { args } : {}),\n ...(s.headers ? { headers: s.headers } : {}),\n })\n }\n return out.length ? out : undefined\n}\n\nfunction isUrl(text: string): boolean {\n try {\n const u = new URL(text.trim())\n return u.protocol === 'http:' || u.protocol === 'https:'\n } catch {\n return false\n }\n}\n\nexport function ToolServerListField({ value, onChange, allowCommand = true, labels }: ToolServerListFieldProps) {\n const l = useLabels(toolServerListLabels, labels)\n const { locale } = useFlowLocale()\n const headingId = useId()\n // Argument text is kept as typed so spaces survive while editing.\n const [argText, setArgText] = useState<string[]>(() => value.map((s) => (s.args ?? []).join(' ')))\n const [urlChecked, setUrlChecked] = useState<Record<number, boolean>>({})\n const [live, setLive] = useState('')\n const firstFields = useRef<Array<HTMLInputElement | null>>([])\n const addRef = useRef<HTMLButtonElement | HTMLAnchorElement | null>(null)\n const pendingFocus = useRef<number | 'add' | null>(null)\n\n useEffect(() => {\n if (pendingFocus.current === null) return\n const target = pendingFocus.current === 'add' ? addRef.current : firstFields.current[pendingFocus.current]\n pendingFocus.current = null\n target?.focus()\n })\n\n const patch = (i: number, p: Partial<ToolServer>) => onChange(value.map((s, k) => (k === i ? { ...s, ...p } : s)))\n\n const add = () => {\n setArgText((t) => [...t, ''])\n pendingFocus.current = value.length\n onChange([...value, {}])\n setLive(l.added)\n }\n\n const remove = (i: number) => {\n setArgText((t) => t.filter((_, k) => k !== i))\n const next = value.filter((_, k) => k !== i)\n pendingFocus.current = next.length ? Math.min(i, next.length - 1) : 'add'\n onChange(next)\n }\n\n return (\n <div className=\"ty-tool-servers\" role=\"group\" aria-labelledby={headingId}>\n <div className=\"ty-tool-servers__header\">\n <span id={headingId} className=\"ty-tool-servers__label\">\n {l.label}\n </span>\n <Button ref={addRef} variant=\"secondary\" size=\"compact\" leadingIcon={<Plus />} onPress={add}>\n {l.add}\n </Button>\n </div>\n {value.length === 0 ? <p className=\"ty-tool-servers__empty\">{l.empty}</p> : null}\n {value.map((s, i) => {\n const n = i + 1\n const incomplete = !s.url?.trim() && !s.command?.trim()\n const badUrl = urlChecked[i] && !!s.url?.trim() && !isUrl(s.url)\n return (\n <Fieldset key={i} legend={fill(l.legend, { n }, locale)} className=\"ty-tool-servers__entry\">\n <TextField\n ref={(el) => {\n firstFields.current[i] = el\n }}\n label={l.prefix}\n hint={l.prefixHint}\n value={s.prefix ?? ''}\n onChange={(v) => patch(i, { prefix: v })}\n />\n <div className=\"ty-tool-servers__reach\" data-command={allowCommand || undefined}>\n <TextField\n label={l.url}\n inputType=\"url\"\n placeholder={l.urlPlaceholder}\n className=\"ty-ltr-text\"\n value={s.url ?? ''}\n onChange={(v) => patch(i, { url: v })}\n onBlur={() => setUrlChecked((c) => ({ ...c, [i]: true }))}\n {...(badUrl ? { errorMessage: l.badUrl } : {})}\n />\n {allowCommand ? (\n <TextField label={l.command} className=\"ty-tool-servers__mono ty-ltr-text\" value={s.command ?? ''} onChange={(v) => patch(i, { command: v })} />\n ) : null}\n </div>\n {allowCommand ? (\n <TextField\n label={l.args}\n hint={l.argsHint}\n className=\"ty-tool-servers__mono ty-ltr-text\"\n value={argText[i] ?? (s.args ?? []).join(' ')}\n onChange={(v) => {\n setArgText((t) => {\n const copy = [...t]\n copy[i] = v\n return copy\n })\n patch(i, { args: splitArgs(v) })\n }}\n />\n ) : null}\n {incomplete ? (\n <p className=\"ty-tool-servers__hint\" data-tone=\"warning\">\n {l.incomplete}\n </p>\n ) : null}\n <div className=\"ty-tool-servers__actions\">\n <Button variant=\"quiet\" size=\"compact\" leadingIcon={<Trash2 />} onPress={() => remove(i)} accessibleLabel={fill(l.remove, { n }, locale)}>\n {fill(l.remove, { n }, locale)}\n </Button>\n </div>\n </Fieldset>\n )\n })}\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {live}\n </p>\n </div>\n )\n}\n","// StartNodeForm: which inputs a run asks for, and a starting value for each.\n// Nothing leaves the form until Save; Save cleans the names and keeps only the\n// defaults that still belong to a named variable and are not empty.\n\nimport { useId, useReducer } from 'react'\nimport { TextField } from '../../index'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport { NodeFormFooter } from './NodeFormFooter'\nimport { VariableListEditor } from './VariableListEditor'\n\nexport interface StartConfig {\n kind: 'start'\n inputVariables: string[]\n inputDefaults: Record<string, string>\n [key: string]: unknown\n}\n\nexport interface StartNodeFormLabels {\n variables: string\n add: string\n placeholder: string\n defaults: string\n defaultPlaceholder: string\n save: string\n cancel: string\n}\n\nexport const startNodeFormLabels = defineLabels<StartNodeFormLabels>('StartNodeForm', {\n en: { variables: 'Input variables', add: 'Add variable', placeholder: 'Variable name', defaults: 'Default values', defaultPlaceholder: 'Default value', save: 'Save', cancel: 'Cancel' },\n 'pt-BR': { variables: 'Variáveis de entrada', add: 'Adicionar variável', placeholder: 'Nome da variável', defaults: 'Valores padrão', defaultPlaceholder: 'Valor padrão', save: 'Salvar', cancel: 'Cancelar' },\n es: { variables: 'Variables de entrada', add: 'Añadir variable', placeholder: 'Nombre de la variable', defaults: 'Valores predeterminados', defaultPlaceholder: 'Valor predeterminado', save: 'Guardar', cancel: 'Cancelar' },\n})\n\nexport const defaultStartNodeFormLabels: StartNodeFormLabels = startNodeFormLabels.bundles.en\n\nexport interface StartNodeFormProps {\n config: { inputVariables?: string[]; inputDefaults?: Record<string, string>; [key: string]: unknown }\n onSave: (config: StartConfig) => void\n onCancel: () => void\n labels?: Partial<StartNodeFormLabels>\n}\n\ninterface Draft {\n names: string[]\n fallback: Record<string, string>\n}\n\ntype DraftEdit = { names: string[] } | { name: string; fallback: string }\n\nfunction edit(draft: Draft, change: DraftEdit): Draft {\n return 'names' in change ? { ...draft, names: change.names } : { ...draft, fallback: { ...draft.fallback, [change.name]: change.fallback } }\n}\n\n/** The start configuration Save emits: unique trimmed names, non-empty defaults of those names, other keys untouched. */\nfunction settle(config: StartNodeFormProps['config'], draft: Draft): StartConfig {\n const inputVariables = Array.from(new Set(draft.names.map((n) => n.trim()).filter(Boolean)))\n const inputDefaults = Object.fromEntries(inputVariables.flatMap((n) => (draft.fallback[n] ? [[n, draft.fallback[n]!]] : [])))\n return { ...config, kind: 'start', inputVariables, inputDefaults }\n}\n\nfunction DefaultValues({ names, fallback, heading, placeholder, onEdit }: { names: string[]; fallback: Record<string, string>; heading: string; placeholder: string; onEdit: (name: string, value: string) => void }) {\n const headingId = useId()\n return (\n <div className=\"ty-start-form__defaults\" role=\"group\" aria-labelledby={headingId}>\n <span id={headingId} className=\"ty-start-form__defaults-title\">\n {heading}\n </span>\n <div className=\"ty-start-form__grid\">\n {names.map((name) => (\n <TextField key={name} className=\"ty-start-form__default\" label={name} placeholder={placeholder} value={fallback[name] ?? ''} onChange={(v) => onEdit(name, v)} />\n ))}\n </div>\n </div>\n )\n}\n\nexport function StartNodeForm({ config, onSave, onCancel, labels }: StartNodeFormProps) {\n const l = useLabels(startNodeFormLabels, labels)\n const [draft, change] = useReducer(edit, config, (c): Draft => ({ names: [...(c.inputVariables ?? [])], fallback: { ...(c.inputDefaults ?? {}) } }))\n const named = draft.names.filter((n) => n.trim() !== '')\n return (\n <div className=\"ty-node-form ty-start-form\">\n <VariableListEditor label={l.variables} value={draft.names} onChange={(names) => change({ names })} numbered editable tone=\"input\" addLabel={l.add} placeholder={l.placeholder} />\n {named.length > 0 && <DefaultValues names={named} fallback={draft.fallback} heading={l.defaults} placeholder={l.defaultPlaceholder} onEdit={(name, fallback) => change({ name, fallback })} />}\n <NodeFormFooter onSave={() => onSave(settle(config, draft))} onCancel={onCancel} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// AgentNodeForm: an agent step references a saved agent and holds only the\n// per-run user prompt; every other agent setting lives on the saved agent.\n\nimport { useEffect, useState } from 'react'\nimport { ActorChip, InlineNotice, Link, ListboxSelect, Spinner, TextArea } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { NodeFormFooter } from './NodeFormFooter'\n\nexport interface SavedAgentSummary {\n id: string\n name: string\n model?: string\n}\n\nexport interface AgentNodeConfigValue {\n agentRef?: string\n /** Older name of the reference; read as agentRef. */\n agentId?: string\n userPrompt?: string\n [legacy: string]: unknown\n}\n\nexport interface AgentNodeFormLabels {\n picker: string\n placeholder: string\n loading: string\n loadError: string\n legacy: string\n legacyHint: string\n model: string\n newAgent: string\n manageAgents: string\n prompt: string\n promptHint: string\n save: string\n cancel: string\n}\n\nexport const agentNodeFormLabels = defineLabels<AgentNodeFormLabels>('AgentNodeForm', {\n en: {\n picker: 'Saved agent',\n placeholder: 'Choose a saved agent',\n loading: 'Loading saved agents',\n loadError: 'Saved agents could not be loaded: {message}',\n legacy: 'This step still carries its own model settings. Choose a saved agent; saving will keep only the reference and the prompt.',\n legacyHint: 'Choosing a saved agent replaces the settings stored on this step.',\n model: 'Model',\n newAgent: 'New agent',\n manageAgents: 'Manage agents',\n prompt: 'User prompt',\n promptHint: 'You can refer to earlier steps, for example {example}.',\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n picker: 'Agente salvo',\n placeholder: 'Escolha um agente salvo',\n loading: 'Carregando agentes salvos',\n loadError: 'Não foi possível carregar os agentes salvos: {message}',\n legacy: 'Esta etapa ainda guarda configurações próprias de modelo. Escolha um agente salvo; ao salvar, ficam só a referência e o prompt.',\n legacyHint: 'Escolher um agente salvo substitui as configurações guardadas nesta etapa.',\n model: 'Modelo',\n newAgent: 'Novo agente',\n manageAgents: 'Gerenciar agentes',\n prompt: 'Prompt do usuário',\n promptHint: 'Você pode citar etapas anteriores, por exemplo {example}.',\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n picker: 'Agente guardado',\n placeholder: 'Elija un agente guardado',\n loading: 'Cargando agentes guardados',\n loadError: 'No se pudieron cargar los agentes guardados: {message}',\n legacy: 'Este paso aún guarda su propia configuración de modelo. Elija un agente guardado; al guardar solo quedan la referencia y el prompt.',\n legacyHint: 'Elegir un agente guardado reemplaza la configuración de este paso.',\n model: 'Modelo',\n newAgent: 'Nuevo agente',\n manageAgents: 'Administrar agentes',\n prompt: 'Prompt del usuario',\n promptHint: 'Puede citar pasos anteriores, por ejemplo {example}.',\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultAgentNodeFormLabels: AgentNodeFormLabels = agentNodeFormLabels.bundles.en\n\nexport interface AgentNodeFormProps {\n config: AgentNodeConfigValue\n onSave: (config: { kind: 'agent'; agentRef?: string; userPrompt?: string }) => void\n onCancel: () => void\n /** Pre-loaded agents; when given, nothing is loaded. */\n agents?: SavedAgentSummary[]\n loadAgents?: () => Promise<SavedAgentSummary[]>\n /** Where \"New agent\" / \"Manage agents\" go, through the router adapter. */\n agentsHref: string\n labels?: Partial<AgentNodeFormLabels>\n}\n\n/** Keys that meant \"inline agent settings\" in older flows. */\nconst INLINE_KEYS = ['model', 'provider', 'systemPrompt', 'temperature', 'topP', 'maxTokens', 'modelId']\n\ntype Load = { state: 'idle' | 'loading' | 'ready' | 'error'; agents: SavedAgentSummary[]; message?: string }\n\nexport function AgentNodeForm({ config, onSave, onCancel, agents, loadAgents, agentsHref, labels }: AgentNodeFormProps) {\n const l = useLabels(agentNodeFormLabels, labels)\n const { locale } = useFlowLocale()\n const [agentRef, setAgentRef] = useState<string | undefined>(config.agentRef ?? config.agentId)\n const [prompt, setPrompt] = useState(config.userPrompt ?? '')\n const [load, setLoad] = useState<Load>(() => (agents ? { state: 'ready', agents } : { state: loadAgents ? 'loading' : 'ready', agents: [] }))\n\n useEffect(() => {\n if (agents) {\n setLoad({ state: 'ready', agents })\n return\n }\n if (!loadAgents) return\n let live = true\n setLoad({ state: 'loading', agents: [] })\n loadAgents().then(\n (list) => live && setLoad({ state: 'ready', agents: list }),\n (err: unknown) => live && setLoad({ state: 'error', agents: [], message: err instanceof Error ? err.message : String(err) }),\n )\n // A late answer after unmount or new inputs is ignored.\n return () => {\n live = false\n }\n }, [agents, loadAgents])\n\n const legacy = !(config.agentRef ?? config.agentId) && INLINE_KEYS.some((k) => config[k] !== undefined)\n const chosen = load.agents.find((a) => a.id === agentRef)\n\n const save = () => {\n const p = prompt.trim()\n onSave({ kind: 'agent', ...(agentRef ? { agentRef } : {}), ...(p ? { userPrompt: prompt } : {}) })\n }\n\n return (\n <div className=\"ty-node-form ty-agent-form\">\n {legacy ? (\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {l.legacy}\n </InlineNotice>\n ) : null}\n {load.state === 'error' ? <InlineNotice tone=\"danger\">{fill(l.loadError, { message: load.message ?? '' }, locale)}</InlineNotice> : null}\n {load.state === 'loading' ? (\n <p className=\"ty-agent-form__loading\" role=\"status\">\n <Spinner size=\"small\" label={l.loading} />\n <span aria-hidden=\"true\">{l.loading}</span>\n </p>\n ) : (\n <ListboxSelect\n label={l.picker}\n placeholder={l.placeholder}\n options={load.agents.map((a) => ({ value: a.id, label: a.name, ...(a.model ? { description: a.model } : {}) }))}\n value={agentRef ?? null}\n onChange={setAgentRef}\n {...(legacy ? { hint: l.legacyHint } : {})}\n />\n )}\n {chosen ? (\n <div className=\"ty-agent-form__summary\">\n {/* ActorChip shows the model identifier in mono (§2.11). */}\n <ActorChip kind=\"agent\" name={chosen.name} {...(chosen.model ? { model: chosen.model } : {})} />\n </div>\n ) : null}\n {load.state !== 'loading' ? (\n <Link href={agentsHref} standalone>\n {load.agents.length ? l.manageAgents : l.newAgent}\n </Link>\n ) : null}\n <TextArea label={l.prompt} hint={fill(l.promptHint, { example: '{{source.text}}' }, locale)} rows={4} autoGrow maxRows={12} value={prompt} onChange={setPrompt} />\n <NodeFormFooter onSave={save} onCancel={onCancel} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// GroupNodeForm: name, description and marker tone of a group frame. The tone\n// is decorative; each swatch carries its tone word and the checked one also a\n// check mark, so the choice never depends on colour.\n\nimport { useId, useState, type KeyboardEvent } from 'react'\nimport { Label, Radio, RadioGroup } from 'react-aria-components'\nimport { Check } from 'lucide-react'\nimport { TextArea, TextField } from '../../index'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport { NodeFormFooter } from './NodeFormFooter'\n\n/** Opaque tone name of a categorical token, never a raw colour. */\nexport type GroupTone = string\n\nexport const DEFAULT_GROUP_TONES: readonly GroupTone[] = ['categorical-1', 'categorical-2', 'categorical-3', 'categorical-4', 'categorical-5']\n\nexport interface GroupNodeFormLabels {\n name: string\n namePlaceholder: string\n nameRequired: string\n description: string\n descriptionPlaceholder: string\n tone: string\n toneNames: Record<string, string>\n save: string\n cancel: string\n}\n\nexport const groupNodeFormLabels = defineLabels<GroupNodeFormLabels>('GroupNodeForm', {\n en: {\n name: 'Name',\n namePlaceholder: 'Group name',\n nameRequired: 'Give the group a name.',\n description: 'Description',\n descriptionPlaceholder: 'What these steps do together',\n tone: 'Marker colour',\n toneNames: { 'categorical-1': 'Blue', 'categorical-2': 'Orange', 'categorical-3': 'Green', 'categorical-4': 'Pink', 'categorical-5': 'Teal', neutral: 'Grey' },\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n name: 'Nome',\n namePlaceholder: 'Nome do grupo',\n nameRequired: 'Dê um nome ao grupo.',\n description: 'Descrição',\n descriptionPlaceholder: 'O que estas etapas fazem juntas',\n tone: 'Cor do marcador',\n toneNames: { 'categorical-1': 'Azul', 'categorical-2': 'Laranja', 'categorical-3': 'Verde', 'categorical-4': 'Rosa', 'categorical-5': 'Azul-petróleo', neutral: 'Cinza' },\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n name: 'Nombre',\n namePlaceholder: 'Nombre del grupo',\n nameRequired: 'Dé un nombre al grupo.',\n description: 'Descripción',\n descriptionPlaceholder: 'Lo que estos pasos hacen juntos',\n tone: 'Color del marcador',\n toneNames: { 'categorical-1': 'Azul', 'categorical-2': 'Naranja', 'categorical-3': 'Verde', 'categorical-4': 'Rosa', 'categorical-5': 'Verde azulado', neutral: 'Gris' },\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultGroupNodeFormLabels: GroupNodeFormLabels = groupNodeFormLabels.bundles.en\n\nexport interface GroupNodeValue {\n label: string\n description?: string\n tone: GroupTone\n [key: string]: unknown\n}\n\nexport interface GroupNodeFormProps {\n value: GroupNodeValue\n tones?: readonly GroupTone[]\n onSave: (value: GroupNodeValue) => void\n onCancel: () => void\n labels?: Partial<GroupNodeFormLabels>\n}\n\nexport function GroupNodeForm({ value, tones = DEFAULT_GROUP_TONES, onSave, onCancel, labels }: GroupNodeFormProps) {\n const l = useLabels(groupNodeFormLabels, labels)\n const toneLabelId = useId()\n const [name, setName] = useState(value.label ?? '')\n const [description, setDescription] = useState(value.description ?? '')\n const [tone, setTone] = useState<GroupTone>(tones.includes(value.tone) ? value.tone : (tones[0] ?? 'neutral'))\n const [showError, setShowError] = useState(false)\n const blank = !name.trim()\n\n const save = () => {\n if (blank) {\n setShowError(true)\n return\n }\n const { description: _old, ...rest } = value\n const d = description.trim()\n onSave({ ...rest, label: name.trim(), tone, ...(d ? { description: d } : {}) })\n }\n\n const onNameKey = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' && (e.target as HTMLElement).tagName === 'INPUT') {\n e.preventDefault()\n if (!blank) save()\n else setShowError(true)\n }\n }\n\n return (\n <div className=\"ty-node-form ty-group-form\">\n <div onKeyDown={onNameKey}>\n <TextField\n label={l.name}\n required\n placeholder={l.namePlaceholder}\n value={name}\n onChange={setName}\n onBlur={() => setShowError(true)}\n {...(showError && blank ? { errorMessage: l.nameRequired } : {})}\n />\n </div>\n <TextArea label={l.description} placeholder={l.descriptionPlaceholder} rows={3} value={description} onChange={setDescription} />\n <RadioGroup className=\"ty-group-form__tones\" value={tone} onChange={setTone} orientation=\"horizontal\" aria-labelledby={toneLabelId}>\n <Label id={toneLabelId} className=\"ty-group-form__tones-label\">\n {l.tone}\n </Label>\n <div className=\"ty-group-form__swatches\">\n {tones.map((t) => {\n const word = l.toneNames[t] ?? t\n return (\n <Radio key={t} value={t} className=\"ty-group-form__swatch\" aria-label={word}>\n {({ isSelected }) => (\n <>\n <span className=\"ty-group-form__chip\" data-tone={t} aria-hidden=\"true\">\n {isSelected ? <Check className=\"ty-group-form__check\" /> : null}\n </span>\n <span className=\"ty-group-form__word\">{word}</span>\n </>\n )}\n </Radio>\n )\n })}\n </div>\n </RadioGroup>\n <NodeFormFooter onSave={save} onCancel={onCancel} saveDisabled={blank} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// OutputSchemaBuilder: visual editor for the structured output of an agent\n// node, limited to the object-with-fields subset of JSON Schema the engine\n// validates. One nested level below the top; deeper levels are raw schema.\n\nimport { useEffect, useId, useRef, useState } from 'react'\nimport { Plus, Trash2 } from 'lucide-react'\nimport { Button, Checkbox, NativeSelect, TextField } from '../../index'\nimport { createId } from '../internal/ids'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\n\nexport type OutputFieldType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array'\n\nexport type OutputSchema = {\n type: 'object'\n properties: Record<string, OutputFieldSchema>\n required?: string[]\n description?: string\n}\n\nexport type OutputFieldSchema =\n | { type: 'string' | 'number' | 'integer' | 'boolean'; description?: string }\n | { type: 'object'; properties: Record<string, OutputFieldSchema>; required?: string[]; description?: string }\n | { type: 'array'; items: { type: 'object'; properties: Record<string, OutputFieldSchema>; required?: string[] }; description?: string }\n\nexport interface OutputSchemaBuilderLabels {\n emptyText: string\n addSchema: string\n unsupportedText: string\n reset: string\n heading: string\n removeSchema: string\n addField: string\n newField: string\n name: string\n type: string\n typeNames: Record<OutputFieldType, string>\n required: string\n description: string\n remove: string\n nested: string\n itemShape: string\n nestedRegion: string\n depthNotice: string\n duplicate: string\n}\n\nexport const outputSchemaBuilderLabels = defineLabels<OutputSchemaBuilderLabels>('OutputSchemaBuilder', {\n en: {\n emptyText: 'Without an output schema the agent returns its text as it is.',\n addSchema: 'Add output schema',\n unsupportedText: 'The top level of an output schema must be an object with fields.',\n reset: 'Reset to object',\n heading: 'Top-level fields',\n removeSchema: 'Remove schema',\n addField: 'Add field',\n newField: 'New field',\n name: 'Field name',\n type: 'Type',\n typeNames: { string: 'Text', number: 'Number', integer: 'Whole number', boolean: 'True or false', object: 'Nested object', array: 'List of objects' },\n required: 'Required',\n description: 'Description',\n remove: 'Remove field {name}',\n nested: 'Nested fields',\n itemShape: 'Item shape',\n nestedRegion: 'Nested fields of {name}',\n depthNotice: 'Deeper levels must be edited as raw schema.',\n duplicate: 'Another field already has this name.',\n },\n 'pt-BR': {\n emptyText: 'Sem esquema de saída, o agente devolve o texto como está.',\n addSchema: 'Adicionar esquema de saída',\n unsupportedText: 'O nível superior de um esquema de saída precisa ser um objeto com campos.',\n reset: 'Voltar a objeto',\n heading: 'Campos do nível superior',\n removeSchema: 'Remover esquema',\n addField: 'Adicionar campo',\n newField: 'Novo campo',\n name: 'Nome do campo',\n type: 'Tipo',\n typeNames: { string: 'Texto', number: 'Número', integer: 'Número inteiro', boolean: 'Verdadeiro ou falso', object: 'Objeto aninhado', array: 'Lista de objetos' },\n required: 'Obrigatório',\n description: 'Descrição',\n remove: 'Remover campo {name}',\n nested: 'Campos aninhados',\n itemShape: 'Forma de cada item',\n nestedRegion: 'Campos aninhados de {name}',\n depthNotice: 'Níveis mais profundos precisam ser editados como esquema bruto.',\n duplicate: 'Outro campo já tem este nome.',\n },\n es: {\n emptyText: 'Sin esquema de salida, el agente devuelve su texto tal cual.',\n addSchema: 'Añadir esquema de salida',\n unsupportedText: 'El nivel superior de un esquema de salida debe ser un objeto con campos.',\n reset: 'Volver a objeto',\n heading: 'Campos de nivel superior',\n removeSchema: 'Quitar esquema',\n addField: 'Añadir campo',\n newField: 'Campo nuevo',\n name: 'Nombre del campo',\n type: 'Tipo',\n typeNames: { string: 'Texto', number: 'Número', integer: 'Número entero', boolean: 'Verdadero o falso', object: 'Objeto anidado', array: 'Lista de objetos' },\n required: 'Obligatorio',\n description: 'Descripción',\n remove: 'Quitar campo {name}',\n nested: 'Campos anidados',\n itemShape: 'Forma de cada elemento',\n nestedRegion: 'Campos anidados de {name}',\n depthNotice: 'Los niveles más profundos deben editarse como esquema sin procesar.',\n duplicate: 'Otro campo ya tiene este nombre.',\n },\n})\n\nexport const defaultOutputSchemaBuilderLabels: OutputSchemaBuilderLabels = outputSchemaBuilderLabels.bundles.en\n\n/** Nesting levels offered below the top level. */\nexport const OUTPUT_SCHEMA_MAX_DEPTH = 1\n\ninterface Row {\n key: string\n name: string\n type: OutputFieldType\n required: boolean\n description: string\n children: Row[]\n /** Sub-schema beyond the editable depth, carried through untouched. */\n raw?: Record<string, OutputFieldSchema>\n rawRequired?: string[]\n}\n\nconst TYPES: OutputFieldType[] = ['string', 'number', 'integer', 'boolean', 'object', 'array']\n\nfunction rowsOf(properties: Record<string, OutputFieldSchema> | undefined, required: string[] | undefined, depth: number): Row[] {\n return Object.entries(properties ?? {}).map(([name, f]) => {\n const inner = f.type === 'object' ? f : f.type === 'array' ? f.items : null\n const tooDeep = depth >= OUTPUT_SCHEMA_MAX_DEPTH\n return {\n key: createId('field'),\n name,\n type: f.type,\n required: (required ?? []).includes(name),\n description: f.description ?? '',\n children: inner && !tooDeep ? rowsOf(inner.properties, inner.required, depth + 1) : [],\n ...(inner && tooDeep ? { raw: inner.properties, ...(inner.required ? { rawRequired: inner.required } : {}) } : {}),\n }\n })\n}\n\nfunction objectOf(rows: Row[]): { properties: Record<string, OutputFieldSchema>; required?: string[] } {\n const properties: Record<string, OutputFieldSchema> = {}\n const required: string[] = []\n for (const r of rows) {\n const name = r.name.trim()\n if (!name) continue\n const desc = r.description.trim() ? { description: r.description.trim() } : {}\n if (r.type === 'object' || r.type === 'array') {\n const inner = r.raw ? { properties: r.raw, ...(r.rawRequired?.length ? { required: r.rawRequired } : {}) } : objectOf(r.children)\n properties[name] = r.type === 'object' ? { type: 'object', ...inner, ...desc } : { type: 'array', items: { type: 'object', ...inner }, ...desc }\n } else {\n properties[name] = { type: r.type, ...desc }\n }\n if (r.required) required.push(name)\n }\n return { properties, ...(required.length ? { required } : {}) }\n}\n\nexport interface OutputSchemaBuilderProps {\n value: OutputSchema | Record<string, unknown> | undefined\n onChange: (next: OutputSchema | undefined) => void\n /** Current nesting level (0 at the top). */\n depth?: number\n labels?: Partial<OutputSchemaBuilderLabels>\n}\n\nexport function OutputSchemaBuilder({ value, onChange, labels }: OutputSchemaBuilderProps) {\n const l = useLabels(outputSchemaBuilderLabels, labels)\n const headingId = useId()\n const supported = !!value && (value as { type?: unknown }).type === 'object'\n const [rows, setRows] = useState<Row[]>(() => (supported ? rowsOf((value as OutputSchema).properties, (value as OutputSchema).required, 0) : []))\n // Keeps editor rows in step when the host replaces the schema from outside.\n const lastEmitted = useRef<unknown>(value)\n useEffect(() => {\n if (value === lastEmitted.current) return\n lastEmitted.current = value\n setRows(supported ? rowsOf((value as OutputSchema).properties, (value as OutputSchema).required, 0) : [])\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value])\n\n const emit = (next: Row[]) => {\n setRows(next)\n const base = supported ? (value as OutputSchema) : undefined\n const schema: OutputSchema = { type: 'object', ...objectOf(next), ...(base?.description ? { description: base.description } : {}) }\n lastEmitted.current = schema\n onChange(schema)\n }\n\n if (value === undefined) {\n return (\n <div className=\"ty-output-schema\" data-state=\"empty\">\n <p className=\"ty-output-schema__text\">{l.emptyText}</p>\n <Button variant=\"secondary\" leadingIcon={<Plus />} onPress={() => onChange({ type: 'object', properties: {} })}>\n {l.addSchema}\n </Button>\n </div>\n )\n }\n if (!supported) {\n return (\n <div className=\"ty-output-schema\" data-state=\"unsupported\">\n <p className=\"ty-output-schema__text\">{l.unsupportedText}</p>\n <Button variant=\"secondary\" onPress={() => onChange({ type: 'object', properties: {} })}>\n {l.reset}\n </Button>\n </div>\n )\n }\n return (\n <section className=\"ty-output-schema\" data-state=\"editing\" aria-labelledby={headingId}>\n <div className=\"ty-output-schema__head\">\n <h3 id={headingId} className=\"ty-output-schema__heading\">\n {l.heading}\n </h3>\n <Button variant=\"quiet\" size=\"compact\" leadingIcon={<Trash2 />} onPress={() => onChange(undefined)}>\n {l.removeSchema}\n </Button>\n </div>\n <FieldRows rows={rows} onRows={emit} depth={0} l={l} />\n </section>\n )\n}\n\nfunction FieldRows({ rows, onRows, depth, l }: { rows: Row[]; onRows: (rows: Row[]) => void; depth: number; l: OutputSchemaBuilderLabels }) {\n const { locale } = useFlowLocale()\n const nameRefs = useRef(new Map<string, HTMLInputElement | null>())\n const addRef = useRef<HTMLButtonElement | HTMLAnchorElement | null>(null)\n const focusNext = useRef<string | 'add' | null>(null)\n\n useEffect(() => {\n const target = focusNext.current\n if (target === null) return\n focusNext.current = null\n if (target === 'add') addRef.current?.focus()\n else nameRefs.current.get(target)?.focus()\n })\n\n const patch = (key: string, p: Partial<Row>) => onRows(rows.map((r) => (r.key === key ? { ...r, ...p } : r)))\n const counts = new Map<string, number>()\n for (const r of rows) if (r.name.trim()) counts.set(r.name.trim(), (counts.get(r.name.trim()) ?? 0) + 1)\n\n return (\n <div className=\"ty-output-schema__rows\" data-depth={depth}>\n {rows.map((r, index) => {\n const display = r.name.trim() || l.newField\n const nestedType = r.type === 'object' || r.type === 'array'\n const duplicate = !!r.name.trim() && (counts.get(r.name.trim()) ?? 0) > 1\n return (\n <div key={r.key} className=\"ty-output-schema__row\" role=\"group\" aria-label={display}>\n <div className=\"ty-output-schema__controls\">\n <TextField\n ref={(el) => {\n nameRefs.current.set(r.key, el)\n }}\n className=\"ty-output-schema__name ty-ltr-text\"\n label={l.name}\n value={r.name}\n onChange={(name) => patch(r.key, { name })}\n {...(duplicate ? { errorMessage: l.duplicate } : {})}\n />\n <NativeSelect\n className=\"ty-output-schema__type\"\n label={l.type}\n options={TYPES.map((t) => ({ value: t, label: l.typeNames[t] }))}\n value={r.type}\n onChange={(t) => {\n const type = t as OutputFieldType\n const nested = type === 'object' || type === 'array'\n // A new nested type starts as an empty object; a primitive drops any sub-schema.\n const { raw: _r, rawRequired: _rr, ...rest } = r\n onRows(rows.map((x) => (x.key === r.key ? { ...rest, type, children: nested ? (nestedType ? r.children : []) : [], ...(nested && nestedType && r.raw ? { raw: r.raw } : nested && depth >= OUTPUT_SCHEMA_MAX_DEPTH ? { raw: {} } : {}) } : x)))\n }}\n />\n <Checkbox className=\"ty-output-schema__required\" label={l.required} isSelected={r.required} onChange={(required) => patch(r.key, { required })} />\n <Button\n variant=\"quiet\"\n size=\"compact\"\n shape=\"circle\"\n iconOnly\n accessibleLabel={fill(l.remove, { name: display }, locale)}\n leadingIcon={<Trash2 />}\n onPress={() => {\n const next = rows.filter((x) => x.key !== r.key)\n focusNext.current = next[index]?.key ?? next[index - 1]?.key ?? 'add'\n onRows(next)\n }}\n />\n </div>\n <TextField className=\"ty-output-schema__description\" label={l.description} value={r.description} onChange={(description) => patch(r.key, { description })} />\n {nestedType ? (\n depth >= OUTPUT_SCHEMA_MAX_DEPTH ? (\n <p className=\"ty-output-schema__depth\">{l.depthNotice}</p>\n ) : (\n <section className=\"ty-output-schema__nested\" aria-label={fill(l.nestedRegion, { name: display }, locale)}>\n <p className=\"ty-output-schema__nested-title\">{r.type === 'array' ? l.itemShape : l.nested}</p>\n <FieldRows rows={r.children} onRows={(children) => patch(r.key, { children })} depth={depth + 1} l={l} />\n </section>\n )\n ) : null}\n </div>\n )\n })}\n <Button\n ref={addRef}\n variant=\"secondary\"\n size=\"compact\"\n leadingIcon={<Plus />}\n onPress={() => {\n const row: Row = { key: createId('field'), name: '', type: 'string', required: false, description: '', children: [] }\n focusNext.current = row.key\n onRows([...rows, row])\n }}\n >\n {l.addField}\n </Button>\n </div>\n )\n}\n","// DataSourceNodeForm: which connection, table, columns and filters a data\n// source step reads, where the rows go and how many. A sectioned dialog: the\n// rail moves through the five sections; choosing a connection or a table moves\n// on by itself.\n\nimport { useEffect, useMemo, useState } from 'react'\nimport { Check, Database, Plus, Trash2 } from 'lucide-react'\nimport { ListBox, ListBoxItem, Radio, RadioGroup } from 'react-aria-components'\nimport { Button, Checkbox, CheckboxGroup, InlineNotice, NativeSelect, Skeleton, TextField } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { NodeFormFooter } from './NodeFormFooter'\n\nexport type FilterOperator = 'eq' | 'neq' | 'lt' | 'lte' | 'gt' | 'gte' | 'like' | 'in'\nexport const FILTER_OPERATORS: readonly FilterOperator[] = ['eq', 'neq', 'lt', 'lte', 'gt', 'gte', 'like', 'in']\n\nexport interface DataSourceFilter {\n column: string\n operator: FilterOperator\n value: string | string[]\n}\n\nexport interface DataSourceNodeConfig {\n kind?: 'datasource'\n sourceId?: string\n dialect?: string\n table?: string\n columns?: string[]\n filters?: DataSourceFilter[]\n outputVariable?: string\n limit?: number\n /** Legacy shape: flow variable → column, read as \"equals\" filters. */\n filterMap?: Record<string, string>\n [key: string]: unknown\n}\n\nexport interface DataSourceOption {\n id: string\n name: string\n dialect: string\n}\n\nexport interface ColumnInfo {\n name: string\n type: string\n nullable?: boolean\n}\n\nexport interface DataSourceNodeFormLabels {\n title: string\n subtitle: string\n rail: string\n connection: string\n table: string\n columns: string\n filters: string\n output: string\n connectionGroup: string\n tableSearch: string\n tableList: string\n columnSearch: string\n results: string\n selectedCount: string\n selectAll: string\n clearAll: string\n loadError: string\n retry: string\n noTables: string\n filterLegend: string\n filterColumn: string\n filterOperator: string\n filterValue: string\n filterValueHint: string\n removeFilter: string\n addFilter: string\n noColumn: string\n operators: Record<FilterOperator, string>\n outputVariable: string\n limit: string\n summary: string\n summaryConnection: string\n summaryTable: string\n summaryColumns: string\n summaryFilters: string\n none: string\n save: string\n cancel: string\n}\n\nconst operators = (o: string[]) => Object.fromEntries(FILTER_OPERATORS.map((k, i) => [k, o[i]!])) as Record<FilterOperator, string>\n\nexport const dataSourceNodeFormLabels = defineLabels<DataSourceNodeFormLabels>('DataSourceNodeForm', {\n en: {\n title: 'Data source',\n subtitle: '{dialect} · {table}',\n rail: 'Sections',\n connection: 'Connection',\n table: 'Table',\n columns: 'Columns',\n filters: 'Filters',\n output: 'Output',\n connectionGroup: 'Connection',\n tableSearch: 'Find a table',\n tableList: 'Tables',\n columnSearch: 'Find a column',\n results: '{count, plural, =0 {No results} one {# result} other {# results}}',\n selectedCount: '{selected, number} of {total, number} selected',\n selectAll: 'Select all',\n clearAll: 'Clear all',\n loadError: 'Could not load: {message}',\n retry: 'Try again',\n noTables: 'No tables in this connection.',\n filterLegend: 'Filter {n, number}',\n filterColumn: 'Column',\n filterOperator: 'Operator',\n filterValue: 'Value',\n filterValueHint: 'Separate list members with commas.',\n removeFilter: 'Remove filter {n, number}',\n addFilter: 'Add filter',\n noColumn: 'Choose a column',\n operators: operators(['equals', 'not equals', 'less than', 'at most', 'greater than', 'at least', 'matches pattern', 'member of list']),\n outputVariable: 'Output variable',\n limit: 'Row limit',\n summary: 'Summary',\n summaryConnection: 'Connection',\n summaryTable: 'Table',\n summaryColumns: 'Columns',\n summaryFilters: '{n, plural, =0 {No filters} one {# filter} other {# filters}}',\n none: 'None',\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n title: 'Fonte de dados',\n rail: 'Seções',\n connection: 'Conexão',\n table: 'Tabela',\n columns: 'Colunas',\n filters: 'Filtros',\n output: 'Saída',\n connectionGroup: 'Conexão',\n tableSearch: 'Encontrar uma tabela',\n tableList: 'Tabelas',\n columnSearch: 'Encontrar uma coluna',\n results: '{count, plural, =0 {Nenhum resultado} one {# resultado} other {# resultados}}',\n selectedCount: '{selected, number} de {total, number} selecionadas',\n selectAll: 'Selecionar todas',\n clearAll: 'Limpar todas',\n loadError: 'Não foi possível carregar: {message}',\n retry: 'Tentar de novo',\n noTables: 'Nenhuma tabela nesta conexão.',\n filterLegend: 'Filtro {n, number}',\n filterColumn: 'Coluna',\n filterOperator: 'Operador',\n filterValue: 'Valor',\n filterValueHint: 'Separe os itens da lista com vírgulas.',\n removeFilter: 'Remover filtro {n, number}',\n addFilter: 'Adicionar filtro',\n noColumn: 'Escolha uma coluna',\n operators: operators(['igual a', 'diferente de', 'menor que', 'no máximo', 'maior que', 'no mínimo', 'corresponde ao padrão', 'está na lista']),\n outputVariable: 'Variável de saída',\n limit: 'Limite de linhas',\n summary: 'Resumo',\n summaryConnection: 'Conexão',\n summaryTable: 'Tabela',\n summaryColumns: 'Colunas',\n summaryFilters: '{n, plural, =0 {Nenhum filtro} one {# filtro} other {# filtros}}',\n none: 'Nenhuma',\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n title: 'Fuente de datos',\n rail: 'Secciones',\n connection: 'Conexión',\n table: 'Tabla',\n columns: 'Columnas',\n filters: 'Filtros',\n output: 'Salida',\n connectionGroup: 'Conexión',\n tableSearch: 'Buscar una tabla',\n tableList: 'Tablas',\n columnSearch: 'Buscar una columna',\n results: '{count, plural, =0 {Sin resultados} one {# resultado} other {# resultados}}',\n selectedCount: '{selected, number} de {total, number} seleccionadas',\n selectAll: 'Seleccionar todas',\n clearAll: 'Borrar todas',\n loadError: 'No se pudo cargar: {message}',\n retry: 'Reintentar',\n noTables: 'No hay tablas en esta conexión.',\n filterLegend: 'Filtro {n, number}',\n filterColumn: 'Columna',\n filterOperator: 'Operador',\n filterValue: 'Valor',\n filterValueHint: 'Separe los elementos de la lista con comas.',\n removeFilter: 'Quitar filtro {n, number}',\n addFilter: 'Añadir filtro',\n noColumn: 'Elija una columna',\n operators: operators(['igual a', 'distinto de', 'menor que', 'como máximo', 'mayor que', 'como mínimo', 'coincide con el patrón', 'está en la lista']),\n outputVariable: 'Variable de salida',\n limit: 'Límite de filas',\n summary: 'Resumen',\n summaryConnection: 'Conexión',\n summaryTable: 'Tabla',\n summaryColumns: 'Columnas',\n summaryFilters: '{n, plural, =0 {Sin filtros} one {# filtro} other {# filtros}}',\n none: 'Ninguna',\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultDataSourceNodeFormLabels: DataSourceNodeFormLabels = dataSourceNodeFormLabels.bundles.en\n\nexport interface DataSourceNodeFormProps {\n open: boolean\n value: DataSourceNodeConfig\n sources: DataSourceOption[]\n loadTables: (sourceId: string) => Promise<string[]>\n loadColumns: (sourceId: string, table: string) => Promise<ColumnInfo[]>\n readOnly?: boolean\n /** Highest row limit accepted (from the contract). */\n maxLimit?: number\n onSave: (config: DataSourceNodeConfig) => void\n onCancel: () => void\n labels?: Partial<DataSourceNodeFormLabels>\n}\n\ntype SectionId = 'connection' | 'table' | 'columns' | 'filters' | 'output'\n\n/** Reads \"a, b ,c,\" as [\"a\",\"b\",\"c\"]. */\nexport function parseListValue(text: string): string[] {\n return text\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean)\n}\n\n/** Keeps the value meaningful when the operator changes to or from \"member of list\". */\nexport function convertFilterValue(value: string | string[], to: FilterOperator): string | string[] {\n if (to === 'in') return Array.isArray(value) ? value : value === '' ? [] : [value]\n return Array.isArray(value) ? (value[0] ?? '') : value\n}\n\nfunction initialFilters(v: DataSourceNodeConfig): DataSourceFilter[] {\n const rows = [...(v.filters ?? [])]\n for (const [variable, column] of Object.entries(v.filterMap ?? {})) rows.push({ column, operator: 'eq', value: `{{${variable}}}` })\n return rows\n}\n\ntype Load<T> = { state: 'idle' } | { state: 'loading' } | { state: 'error'; message: string } | { state: 'ready'; data: T }\n\nfunction useLoader<T>(key: string | null, load: () => Promise<T>): [Load<T>, () => void] {\n const [result, setResult] = useState<Load<T>>({ state: 'idle' })\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n if (!key) {\n setResult({ state: 'idle' })\n return\n }\n let live = true\n setResult({ state: 'loading' })\n load().then(\n (data) => live && setResult({ state: 'ready', data }),\n (e: unknown) => live && setResult({ state: 'error', message: e instanceof Error ? e.message : String(e) }),\n )\n return () => {\n live = false\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key, attempt])\n return [result, () => setAttempt((a) => a + 1)]\n}\n\nexport function DataSourceNodeForm(props: DataSourceNodeFormProps) {\n const { open, value, sources, loadTables, loadColumns, readOnly = false, maxLimit, onSave, onCancel } = props\n const l = useLabels(dataSourceNodeFormLabels, props.labels)\n const { locale } = useFlowLocale()\n const [sourceId, setSourceId] = useState(value.sourceId ?? '')\n const [table, setTable] = useState(value.table ?? '')\n const [columns, setColumns] = useState<string[]>(value.columns ?? [])\n const [filters, setFilters] = useState<DataSourceFilter[]>(() => initialFilters(value))\n const [outputVariable, setOutputVariable] = useState(value.outputVariable ?? 'rows')\n const [limit, setLimit] = useState(String(value.limit ?? 100))\n const [section, setSection] = useState<SectionId>(value.sourceId ? (value.table ? 'columns' : 'table') : 'connection')\n const [tableQuery, setTableQuery] = useState('')\n const [columnQuery, setColumnQuery] = useState('')\n // Raw text of \"member of list\" fields while typing (the stored value is the parsed list).\n const [listDrafts, setListDrafts] = useState<Record<number, string>>({})\n\n const source = sources.find((s) => s.id === sourceId)\n const [tables, retryTables] = useLoader(sourceId || null, () => loadTables(sourceId))\n const [columnList, retryColumns] = useLoader(sourceId && table ? `${sourceId}/${table}` : null, () => loadColumns(sourceId, table))\n\n const allColumns = columnList.state === 'ready' ? columnList.data : []\n const shownTables = useMemo(() => (tables.state === 'ready' ? tables.data.filter((t) => t.toLowerCase().includes(tableQuery.toLowerCase())) : []), [tables, tableQuery])\n const shownColumns = allColumns.filter((c) => c.name.toLowerCase().includes(columnQuery.toLowerCase()))\n\n const pickSource = (id: string) => {\n if (id === sourceId) return\n setSourceId(id)\n setTable('')\n setColumns([])\n setFilters([])\n setSection('table')\n }\n const pickTable = (name: string) => {\n if (name !== table) {\n setColumns([])\n setFilters([])\n }\n setTable(name)\n setSection('columns')\n }\n\n const canSave = !!sourceId && !!table && columns.length > 0\n const save = () => {\n if (!canSave) return\n const { filterMap: _legacy, ...rest } = value\n const n = Number(limit)\n onSave({\n ...rest,\n kind: 'datasource',\n sourceId,\n dialect: source?.dialect ?? value.dialect ?? '',\n table,\n columns,\n filters: filters.filter((f) => f.column),\n outputVariable: outputVariable.trim() || 'rows',\n limit: Number.isFinite(n) && n > 0 ? Math.min(Math.round(n), maxLimit ?? Infinity) : 100,\n })\n }\n\n const loadState = (s: Load<unknown>, retry: () => void) =>\n s.state === 'loading' ? (\n <div aria-busy=\"true\">\n <Skeleton lines={4} />\n </div>\n ) : s.state === 'error' ? (\n <InlineNotice\n tone=\"danger\"\n actions={\n <Button variant=\"secondary\" size=\"compact\" onPress={retry}>\n {l.retry}\n </Button>\n }\n >\n {fill(l.loadError, { message: s.message }, locale)}\n </InlineNotice>\n ) : null\n\n const connectionPane = (\n <RadioGroup className=\"ty-ds-form__tiles\" aria-label={l.connectionGroup} value={sourceId || null} onChange={pickSource} isDisabled={readOnly}>\n {sources.map((s) => (\n <Radio key={s.id} value={s.id} className=\"ty-ds-form__tile\" isDisabled={readOnly && s.id !== sourceId}>\n {({ isSelected }) => (\n <>\n <Database className=\"ty-ds-form__tile-icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-ds-form__tile-text\">\n <span className=\"ty-ds-form__tile-name\">{s.name}</span>\n <span className=\"ty-ds-form__tile-meta\">{s.dialect}</span>\n </span>\n {isSelected ? <Check className=\"ty-ds-form__tile-check\" aria-hidden=\"true\" focusable=\"false\" /> : null}\n </>\n )}\n </Radio>\n ))}\n </RadioGroup>\n )\n\n const tablePane = (\n <div className=\"ty-ds-form__pane\">\n <TextField mode=\"search\" label={l.tableSearch} value={tableQuery} onChange={setTableQuery} disabled={readOnly} />\n {loadState(tables, retryTables)}\n {tables.state === 'ready' ? (\n <>\n <p className=\"ty-visually-hidden\" role=\"status\">\n {tableQuery ? fill(l.results, { count: shownTables.length }, locale) : ''}\n </p>\n <ListBox\n className=\"ty-ds-form__list\"\n aria-label={l.tableList}\n selectionMode=\"single\"\n selectedKeys={table ? [table] : []}\n onSelectionChange={(keys) => {\n const [k] = keys === 'all' ? [] : [...keys]\n if (k !== undefined) pickTable(String(k))\n }}\n items={shownTables.map((t) => ({ id: t }))}\n disabledKeys={readOnly ? shownTables.filter((t) => t !== table) : []}\n renderEmptyState={() => <p className=\"ty-node-form__empty\">{l.noTables}</p>}\n >\n {(item) => (\n <ListBoxItem id={item.id} textValue={item.id} className=\"ty-ds-form__option\">\n {({ isSelected }) => (\n <>\n <span className=\"ty-ds-form__option-name ty-ltr-text\">{item.id}</span>\n {isSelected ? <Check className=\"ty-ds-form__tile-check\" aria-hidden=\"true\" focusable=\"false\" /> : null}\n </>\n )}\n </ListBoxItem>\n )}\n </ListBox>\n </>\n ) : null}\n </div>\n )\n\n const allSelected = allColumns.length > 0 && columns.length === allColumns.length\n const columnsPane = (\n <div className=\"ty-ds-form__pane\">\n {loadState(columnList, retryColumns)}\n {columnList.state === 'ready' ? (\n <>\n <div className=\"ty-ds-form__bar\">\n <span className=\"ty-ds-form__count\">{fill(l.selectedCount, { selected: columns.length, total: allColumns.length }, locale)}</span>\n <Button variant=\"quiet\" size=\"compact\" disabled={readOnly} onPress={() => setColumns(allSelected ? [] : allColumns.map((c) => c.name))}>\n {allSelected ? l.clearAll : l.selectAll}\n </Button>\n </div>\n <TextField mode=\"search\" label={l.columnSearch} value={columnQuery} onChange={setColumnQuery} />\n <p className=\"ty-visually-hidden\" role=\"status\">\n {columnQuery ? fill(l.results, { count: shownColumns.length }, locale) : ''}\n </p>\n <CheckboxGroup label={l.columns} value={columns} onChange={setColumns} disabled={readOnly}>\n {shownColumns.map((c) => (\n <Checkbox key={c.name} value={c.name} label={c.name} description={c.type} className=\"ty-ds-form__column\" />\n ))}\n </CheckboxGroup>\n </>\n ) : null}\n </div>\n )\n\n const columnOptions = [{ value: '', label: l.noColumn }, ...allColumns.map((c) => ({ value: c.name, label: c.name })), ...filters.filter((f) => f.column && !allColumns.some((c) => c.name === f.column)).map((f) => ({ value: f.column, label: f.column }))]\n const patchFilter = (i: number, patch: Partial<DataSourceFilter>) => setFilters((fs) => fs.map((f, j) => (j === i ? { ...f, ...patch } : f)))\n const filtersPane = (\n <div className=\"ty-ds-form__pane\">\n {filters.map((f, i) => (\n <fieldset key={i} className=\"ty-ds-form__filter\" disabled={readOnly}>\n <legend className=\"ty-ds-form__legend\">{fill(l.filterLegend, { n: i + 1 }, locale)}</legend>\n <NativeSelect label={l.filterColumn} options={columnOptions} value={f.column} onChange={(column) => patchFilter(i, { column })} />\n <NativeSelect\n label={l.filterOperator}\n options={FILTER_OPERATORS.map((o) => ({ value: o, label: l.operators[o] }))}\n value={f.operator}\n onChange={(o) => {\n setListDrafts(({ [i]: _gone, ...rest }) => rest)\n patchFilter(i, { operator: o as FilterOperator, value: convertFilterValue(f.value, o as FilterOperator) })\n }}\n />\n <TextField\n label={l.filterValue}\n {...(f.operator === 'in' ? { hint: l.filterValueHint } : {})}\n value={f.operator === 'in' ? (listDrafts[i] ?? (Array.isArray(f.value) ? f.value.join(', ') : f.value)) : Array.isArray(f.value) ? f.value.join(', ') : f.value}\n onChange={(text) => {\n if (f.operator === 'in') setListDrafts((d) => ({ ...d, [i]: text }))\n patchFilter(i, { value: f.operator === 'in' ? parseListValue(text) : text })\n }}\n />\n {readOnly ? null : (\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={fill(l.removeFilter, { n: i + 1 }, locale)} leadingIcon={<Trash2 />} onPress={() => {\n setListDrafts({})\n setFilters((fs) => fs.filter((_, j) => j !== i))\n }} />\n )}\n </fieldset>\n ))}\n {readOnly ? null : (\n <Button variant=\"secondary\" size=\"compact\" leadingIcon={<Plus />} onPress={() => setFilters((fs) => [...fs, { column: '', operator: 'eq', value: '' }])}>\n {l.addFilter}\n </Button>\n )}\n </div>\n )\n\n const outputPane = (\n <div className=\"ty-ds-form__pane\">\n <TextField className=\"ty-ltr-text\" label={l.outputVariable} value={outputVariable} onChange={setOutputVariable} readOnly={readOnly} />\n <TextField inputType=\"number\" label={l.limit} value={limit} onChange={setLimit} readOnly={readOnly} />\n <section aria-label={l.summary} className=\"ty-ds-form__summary\">\n <dl>\n <dt>{l.summaryConnection}</dt>\n <dd>{source ? `${source.name} · ${source.dialect}` : l.none}</dd>\n <dt>{l.summaryTable}</dt>\n <dd className=\"ty-ltr-text\">{table || l.none}</dd>\n <dt>{l.summaryColumns}</dt>\n <dd>{columns.length ? columns.join(', ') : l.none}</dd>\n </dl>\n <p>{fill(l.summaryFilters, { n: filters.filter((f) => f.column).length }, locale)}</p>\n </section>\n </div>\n )\n\n return (\n <SectionedModal\n isOpen={open}\n onOpenChange={(o) => {\n if (!o) onCancel()\n }}\n title={source?.name ?? l.title}\n subtitle={source && table ? fill(l.subtitle, { dialect: source.dialect, table }, locale) : undefined}\n icon={<Database />}\n tone=\"categorical-6\"\n className=\"ty-ds-form\"\n railLabel={l.rail}\n activeSection={section}\n onActiveSectionChange={(id) => setSection(id as SectionId)}\n {...(readOnly ? {} : { onSubmitShortcut: save, footer: <NodeFormFooter onSave={save} onCancel={onCancel} saveDisabled={!canSave} labels={{ save: l.save, cancel: l.cancel }} /> })}\n sections={[\n { id: 'connection', label: l.connection, content: connectionPane },\n { id: 'table', label: l.table, content: tablePane },\n { id: 'columns', label: l.columns, content: columnsPane },\n { id: 'filters', label: l.filters, content: filtersPane },\n { id: 'output', label: l.output, content: outputPane },\n ]}\n />\n )\n}\n","// MarkdownView: a small, safe reader for the Markdown a language model writes\n// (paragraphs, headings, lists, fenced code, quotes, inline code, strong,\n// emphasis, links). Output is React elements only: no HTML string is ever\n// injected, and links are kept only for http(s), mailto and app-relative paths.\n\nimport { Fragment, type ReactNode } from 'react'\n\ntype Block =\n | { kind: 'heading'; level: number; text: string }\n | { kind: 'paragraph'; text: string }\n | { kind: 'list'; ordered: boolean; items: string[] }\n | { kind: 'code'; lang: string; text: string }\n | { kind: 'quote'; text: string }\n\nconst SAFE_HREF = /^(https?:\\/\\/|mailto:|\\/(?!\\/))/i\n\n/** Splits Markdown into blocks, line by line. */\nexport function markdownBlocks(source: string): Block[] {\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n')\n const blocks: Block[] = []\n let para: string[] = []\n const flush = () => {\n if (para.length) blocks.push({ kind: 'paragraph', text: para.join(' ') })\n para = []\n }\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!\n const fence = /^\\s*```(\\w*)\\s*$/.exec(line)\n if (fence) {\n flush()\n const body: string[] = []\n i++\n while (i < lines.length && !/^\\s*```\\s*$/.test(lines[i]!)) body.push(lines[i++]!)\n blocks.push({ kind: 'code', lang: fence[1] ?? '', text: body.join('\\n') })\n continue\n }\n if (!line.trim()) {\n flush()\n continue\n }\n const heading = /^(#{1,6})\\s+(.*)$/.exec(line)\n if (heading) {\n flush()\n blocks.push({ kind: 'heading', level: heading[1]!.length, text: heading[2]!.trim() })\n continue\n }\n const bullet = /^\\s*(?:[-*+]|(\\d+)[.)])\\s+(.*)$/.exec(line)\n if (bullet) {\n flush()\n const ordered = bullet[1] !== undefined\n const prev = blocks[blocks.length - 1]\n if (prev && prev.kind === 'list' && prev.ordered === ordered) prev.items.push(bullet[2]!)\n else blocks.push({ kind: 'list', ordered, items: [bullet[2]!] })\n continue\n }\n const quote = /^\\s*>\\s?(.*)$/.exec(line)\n if (quote) {\n flush()\n const prev = blocks[blocks.length - 1]\n if (prev && prev.kind === 'quote') prev.text += ` ${quote[1]}`\n else blocks.push({ kind: 'quote', text: quote[1] ?? '' })\n continue\n }\n para.push(line.trim())\n }\n flush()\n return blocks\n}\n\nconst INLINE = /(`[^`]+`)|(\\*\\*[^*]+\\*\\*|__[^_]+__)|(\\*[^*\\s][^*]*\\*|_[^_\\s][^_]*_)|(\\[[^\\]]+\\]\\([^)\\s]+\\))/\n\n/** Inline spans: code, strong, emphasis and safe links. */\nexport function renderInline(text: string, keyPrefix = 'i'): ReactNode[] {\n const out: ReactNode[] = []\n let rest = text\n let n = 0\n while (rest) {\n const m = INLINE.exec(rest)\n if (!m) {\n out.push(rest)\n break\n }\n if (m.index > 0) out.push(rest.slice(0, m.index))\n const token = m[0]\n const key = `${keyPrefix}-${n++}`\n if (m[1]) out.push(<code key={key}>{token.slice(1, -1)}</code>)\n else if (m[2]) out.push(<strong key={key}>{renderInline(token.slice(2, -2), key)}</strong>)\n else if (m[3]) out.push(<em key={key}>{renderInline(token.slice(1, -1), key)}</em>)\n else {\n const link = /^\\[([^\\]]+)\\]\\(([^)\\s]+)\\)$/.exec(token)!\n const href = link[2]!\n out.push(\n SAFE_HREF.test(href) ? (\n <a key={key} href={href} {...(/^https?:/i.test(href) ? { target: '_blank', rel: 'noreferrer noopener' } : {})}>\n {renderInline(link[1]!, key)}\n </a>\n ) : (\n <Fragment key={key}>{link[1]}</Fragment>\n ),\n )\n }\n rest = rest.slice(m.index + token.length)\n }\n return out\n}\n\nexport interface MarkdownViewProps {\n source: string\n /** Level of a top-level \"#\" heading; deeper headings follow, capped at 6. */\n baseHeadingLevel?: 2 | 3 | 4\n className?: string\n}\n\nexport function MarkdownView({ source, baseHeadingLevel = 3, className }: MarkdownViewProps) {\n const blocks = markdownBlocks(source)\n return (\n <div className={['ty-flow-markdown', className].filter(Boolean).join(' ')}>\n {blocks.map((b, i) => {\n const key = `b${i}`\n switch (b.kind) {\n case 'heading': {\n const level = Math.min(6, baseHeadingLevel + b.level - 1)\n const H = `h${level}` as 'h2'\n return (\n <H key={key} className=\"ty-flow-markdown__heading\">\n {renderInline(b.text, key)}\n </H>\n )\n }\n case 'list': {\n const L = b.ordered ? 'ol' : 'ul'\n return (\n <L key={key} className=\"ty-flow-markdown__list\">\n {b.items.map((item, j) => (\n <li key={j}>{renderInline(item, `${key}-${j}`)}</li>\n ))}\n </L>\n )\n }\n case 'code':\n return (\n <pre key={key} className=\"ty-flow-markdown__code\" tabIndex={0} data-lang={b.lang || undefined}>\n <code>{b.text}</code>\n </pre>\n )\n case 'quote':\n return (\n <blockquote key={key} className=\"ty-flow-markdown__quote\">\n {renderInline(b.text, key)}\n </blockquote>\n )\n default:\n return (\n <p key={key} className=\"ty-flow-markdown__paragraph\">\n {renderInline(b.text, key)}\n </p>\n )\n }\n })}\n </div>\n )\n}\n","// ReportView (stand-in for the design system's wave-2 ReportView): renders a\n// report definition as stacked sections. Used by AssistantVisualBlock and\n// ReportOutputNodeForm. Charts are drawn in SVG from chart tokens, always with\n// a text summary, a legend in words and a data-table toggle, so no value is\n// carried by colour alone.\n\nimport { useId, useState, type ReactNode } from 'react'\nimport { useLocale } from 'react-aria-components'\nimport { MarkdownView } from '../assistant/MarkdownView'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\n\nexport type ValueFormat = 'number' | 'currency' | 'percent'\n\nexport interface FigureItem {\n label: string\n value: number | string\n format?: ValueFormat\n}\n\nexport type ReportSection =\n | { type: 'figures'; title?: string; data: { items: FigureItem[] } }\n | { type: 'bar' | 'line' | 'area'; title?: string; data: { rows: Array<Record<string, unknown>>; x: string; y: string[]; format?: ValueFormat } }\n | { type: 'table'; title?: string; data: { rows: Array<Record<string, unknown>>; columns: Array<{ key: string; label: string; format?: ValueFormat }> } }\n | { type: 'markdown'; title?: string; data: { body: string } }\n | { type: 'region-map'; title?: string; data: { country?: string; items: Array<{ region: string; label: string; value: number }>; format?: ValueFormat } }\n | { type: 'flow'; title?: string; data: { graph: unknown } }\n | { type: 'note'; title?: string; data: Record<string, unknown> }\n\nexport interface ReportSpec {\n title?: string\n subtitle?: string\n sections: ReportSection[]\n}\n\nexport interface ReportIssue {\n path: string\n message: string\n}\n\n/** Structural check: an object with a sections list whose items have a type and a data object. */\nexport function validateReport(spec: unknown): ReportIssue[] {\n const issues: ReportIssue[] = []\n if (!spec || typeof spec !== 'object' || Array.isArray(spec)) return [{ path: '', message: 'not an object' }]\n const sections = (spec as { sections?: unknown }).sections\n if (!Array.isArray(sections)) return [{ path: 'sections', message: 'missing list' }]\n if (!sections.length) issues.push({ path: 'sections', message: 'empty' })\n sections.forEach((s, i) => {\n if (!s || typeof s !== 'object') issues.push({ path: `sections.${i}`, message: 'not an object' })\n else {\n if (typeof (s as { type?: unknown }).type !== 'string') issues.push({ path: `sections.${i}.type`, message: 'missing' })\n const d = (s as { data?: unknown }).data\n if (!d || typeof d !== 'object') issues.push({ path: `sections.${i}.data`, message: 'missing' })\n }\n })\n return issues\n}\n\n/**\n * Locale-aware value text. Percent accepts a fraction (0.25) or a whole\n * percentage (25). Currency needs a currency code from the host; without one\n * the value is shown as a number with two decimals.\n */\nexport function formatValue(value: unknown, format: ValueFormat | undefined, locale?: string, currency?: string): string {\n if (typeof value !== 'number' || !Number.isFinite(value)) return value === null || value === undefined ? '' : String(value)\n if (format === 'currency') {\n return currency\n ? new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value)\n : new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(value)\n }\n if (format === 'percent') return new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 }).format(Math.abs(value) > 1 ? value / 100 : value)\n return new Intl.NumberFormat(locale).format(value)\n}\n\nexport interface ReportViewLabels {\n showTable: string\n showChart: string\n chartSummary: string\n bar: string\n line: string\n area: string\n table: string\n region: string\n value: string\n noContent: string\n}\n\nexport const reportViewLabels = defineLabels<ReportViewLabels>('reportView', {\n en: {\n showTable: 'Show data table',\n showChart: 'Show chart',\n chartSummary: '{kind} of {series} by {x}, {count, plural, one {# row} other {# rows}}',\n bar: 'Bar chart',\n line: 'Line chart',\n area: 'Area chart',\n table: 'Data table',\n region: 'Region',\n value: 'Value',\n noContent: 'This section has no content to show.',\n },\n 'pt-BR': {\n showTable: 'Mostrar tabela de dados',\n showChart: 'Mostrar gráfico',\n chartSummary: '{kind} de {series} por {x}, {count, plural, one {# linha} other {# linhas}}',\n bar: 'Gráfico de barras',\n line: 'Gráfico de linhas',\n area: 'Gráfico de área',\n table: 'Tabela de dados',\n region: 'Região',\n value: 'Valor',\n noContent: 'Esta seção não tem conteúdo para mostrar.',\n },\n es: {\n showTable: 'Mostrar tabla de datos',\n showChart: 'Mostrar gráfico',\n chartSummary: '{kind} de {series} por {x}, {count, plural, one {# fila} other {# filas}}',\n bar: 'Gráfico de barras',\n line: 'Gráfico de líneas',\n area: 'Gráfico de área',\n table: 'Tabla de datos',\n region: 'Región',\n value: 'Valor',\n noContent: 'Esta sección no tiene contenido para mostrar.',\n },\n})\n\n/** English defaults (plain object). */\nexport const defaultReportViewLabels: ReportViewLabels = reportViewLabels.bundles.en\n\nexport interface ReportViewProps {\n spec: ReportSpec\n locale?: string\n currency?: string\n /** Heading level of the report title (sections use the next level). */\n headingLevel?: 2 | 3 | 4\n /** Charts start as a chart or as their data table (phones: table). */\n defaultChartView?: 'chart' | 'table'\n labels?: Partial<ReportViewLabels>\n className?: string\n}\n\ntype HeadingTag = 'h2' | 'h3' | 'h4' | 'h5'\n\nexport function ReportView({ spec, locale, currency, headingLevel = 3, defaultChartView = 'chart', labels, className }: ReportViewProps) {\n const l = useLabels(reportViewLabels, labels)\n const provider = useLocale()\n const loc = locale ?? provider.locale\n const H = `h${headingLevel}` as HeadingTag\n const S = `h${Math.min(5, headingLevel + 1)}` as HeadingTag\n const fmt = (v: unknown, f?: ValueFormat) => formatValue(v, f, loc, currency)\n return (\n <div className={['ty-flow-report', className].filter(Boolean).join(' ')}>\n {spec.title ? <H className=\"ty-flow-report__title\">{spec.title}</H> : null}\n {spec.subtitle ? <p className=\"ty-flow-report__subtitle\">{spec.subtitle}</p> : null}\n {spec.sections.map((section, i) => (\n <section key={i} className=\"ty-flow-report__section\" data-type={section.type}>\n {section.title && !isChart(section) ? <S className=\"ty-flow-report__section-title\">{section.title}</S> : null}\n {renderSection(section, { fmt, l, S, defaultChartView, locale: loc })}\n </section>\n ))}\n </div>\n )\n}\n\nfunction isChart(s: ReportSection): s is Extract<ReportSection, { type: 'bar' | 'line' | 'area' }> {\n return s.type === 'bar' || s.type === 'line' || s.type === 'area'\n}\n\ninterface Ctx {\n fmt: (v: unknown, f?: ValueFormat) => string\n l: ReportViewLabels\n S: HeadingTag\n defaultChartView: 'chart' | 'table'\n locale: string\n}\n\nfunction renderSection(section: ReportSection, ctx: Ctx): ReactNode {\n const { fmt, l } = ctx\n switch (section.type) {\n case 'figures':\n return (\n <dl className=\"ty-flow-report__figures\">\n {section.data.items.map((f, i) => (\n <div key={i} className=\"ty-flow-report__figure\">\n <dt className=\"ty-flow-report__figure-label\">{f.label}</dt>\n <dd className=\"ty-flow-report__figure-value\">{fmt(f.value, f.format)}</dd>\n </div>\n ))}\n </dl>\n )\n case 'table':\n return (\n <ScrollTable label={section.title ?? l.table}>\n <thead>\n <tr>\n {section.data.columns.map((c) => (\n <th key={c.key} scope=\"col\">\n {c.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {section.data.rows.map((r, i) => (\n <tr key={i}>\n {section.data.columns.map((c) => (\n <td key={c.key} data-numeric={typeof r[c.key] === 'number' || undefined}>\n {fmt(r[c.key], c.format)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </ScrollTable>\n )\n case 'bar':\n case 'line':\n case 'area':\n return <ChartBlock section={section} ctx={ctx} />\n case 'markdown':\n return <MarkdownView source={section.data.body} baseHeadingLevel={4} />\n case 'region-map':\n return (\n <ScrollTable label={section.title ?? l.table}>\n <thead>\n <tr>\n <th scope=\"col\">{l.region}</th>\n <th scope=\"col\">{l.value}</th>\n </tr>\n </thead>\n <tbody>\n {section.data.items.map((it) => (\n <tr key={it.region}>\n <th scope=\"row\">\n {it.label} <span className=\"ty-flow-report__code\">{it.region}</span>\n </th>\n <td data-numeric=\"true\">{fmt(it.value, section.data.format)}</td>\n </tr>\n ))}\n </tbody>\n </ScrollTable>\n )\n default:\n return <p className=\"ty-flow-report__note\">{l.noContent}</p>\n }\n}\n\nfunction ScrollTable({ label, children }: { label: string; children: ReactNode }) {\n return (\n <div className=\"ty-flow-report__table-wrap\" tabIndex={0} role=\"region\" aria-label={label}>\n <table className=\"ty-flow-report__table\">{children}</table>\n </div>\n )\n}\n\nconst W = 480\nconst H = 200\nconst PAD = { top: 12, right: 12, bottom: 28, left: 12 }\n\nfunction ChartBlock({ section, ctx }: { section: Extract<ReportSection, { type: 'bar' | 'line' | 'area' }>; ctx: Ctx }) {\n const { rows, x, y, format } = section.data\n const { l, fmt, S } = ctx\n const [view, setView] = useState<'chart' | 'table'>(ctx.defaultChartView)\n const tableId = useId()\n const captionId = useId()\n const values = rows.flatMap((r) => y.map((k) => (typeof r[k] === 'number' ? (r[k] as number) : 0)))\n const max = Math.max(0, ...values)\n const min = Math.min(0, ...values)\n const span = max - min || 1\n const plotW = W - PAD.left - PAD.right\n const plotH = H - PAD.top - PAD.bottom\n const yOf = (v: number) => PAD.top + plotH - ((v - min) / span) * plotH\n const baseline = yOf(0)\n const band = plotW / Math.max(1, rows.length)\n const kind = section.type === 'bar' ? l.bar : section.type === 'line' ? l.line : l.area\n const summary = fill(l.chartSummary, { kind, series: y.join(', '), x, count: rows.length }, ctx.locale)\n\n const marks: ReactNode[] = []\n y.forEach((key, s) => {\n const val = (r: Record<string, unknown>) => (typeof r[key] === 'number' ? (r[key] as number) : 0)\n if (section.type === 'bar') {\n const barW = Math.max(2, (band * 0.7) / y.length)\n rows.forEach((r, i) => {\n const v = val(r)\n const top = Math.min(yOf(v), baseline)\n marks.push(<rect key={`${key}-${i}`} className=\"ty-flow-report__mark\" data-series={s % 8} x={PAD.left + band * i + band * 0.15 + barW * s} y={top} width={barW} height={Math.max(1, Math.abs(yOf(v) - baseline))} />)\n })\n } else {\n const pts = rows.map((r, i) => `${PAD.left + band * i + band / 2},${yOf(val(r))}`)\n if (section.type === 'area' && rows.length) {\n const first = PAD.left + band / 2\n const last = PAD.left + band * (rows.length - 1) + band / 2\n marks.push(<polygon key={`${key}-fill`} className=\"ty-flow-report__area\" data-series={s % 8} points={`${first},${baseline} ${pts.join(' ')} ${last},${baseline}`} />)\n }\n marks.push(<polyline key={key} className=\"ty-flow-report__line\" data-series={s % 8} points={pts.join(' ')} />)\n rows.forEach((r, i) => marks.push(<circle key={`${key}-p${i}`} className=\"ty-flow-report__point\" data-series={s % 8} data-shape={s % 3} cx={PAD.left + band * i + band / 2} cy={yOf(val(r))} r={3.5} />))\n }\n })\n\n return (\n <figure className=\"ty-flow-report__chart\" aria-labelledby={captionId}>\n <figcaption id={captionId} className=\"ty-flow-report__caption\">\n {section.title ? <S className=\"ty-flow-report__section-title\">{section.title}</S> : null}\n <span className=\"ty-flow-report__summary\">{summary}</span>\n </figcaption>\n {view === 'chart' ? (\n <>\n <svg className=\"ty-flow-report__svg\" viewBox={`0 0 ${W} ${H}`} role=\"img\" aria-label={summary} preserveAspectRatio=\"none\">\n <line className=\"ty-flow-report__axis\" x1={PAD.left} x2={W - PAD.right} y1={baseline} y2={baseline} />\n {marks}\n {rows.map((r, i) => (\n <text key={i} className=\"ty-flow-report__tick\" x={PAD.left + band * i + band / 2} y={H - 8} textAnchor=\"middle\">\n {String(r[x] ?? '')}\n </text>\n ))}\n </svg>\n {y.length > 1 ? (\n <ul className=\"ty-flow-report__legend\">\n {y.map((k, s) => (\n <li key={k} className=\"ty-flow-report__legend-item\" data-series={s % 8} data-shape={s % 3}>\n <span className=\"ty-flow-report__swatch\" aria-hidden=\"true\" />\n {k}\n </li>\n ))}\n </ul>\n ) : null}\n </>\n ) : null}\n <button type=\"button\" className=\"ty-flow-report__toggle\" aria-expanded={view === 'table'} aria-controls={tableId} onClick={() => setView((v) => (v === 'chart' ? 'table' : 'chart'))}>\n {view === 'chart' ? l.showTable : l.showChart}\n </button>\n <div id={tableId} hidden={view !== 'table'}>\n <ScrollTable label={section.title ?? l.table}>\n <thead>\n <tr>\n <th scope=\"col\">{x}</th>\n {y.map((k) => (\n <th key={k} scope=\"col\">\n {k}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r, i) => (\n <tr key={i}>\n <th scope=\"row\">{String(r[x] ?? '')}</th>\n {y.map((k) => (\n <td key={k} data-numeric=\"true\">\n {fmt(r[k], format)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </ScrollTable>\n </div>\n </figure>\n )\n}\n","// ReportOutputNodeForm: the terminal step that publishes a report, either\n// pointing at a report an earlier step produced, or holding a fixed report\n// definition written inline, with an optional live preview.\n\nimport { useId, useMemo, useState } from 'react'\nimport { ChevronDown } from 'lucide-react'\nimport { Button as AriaButton, Radio, RadioGroup, Label } from 'react-aria-components'\nimport { EmptyState, TextArea, TextField } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { ReportView, validateReport, type ReportIssue, type ReportSpec } from '../report/ReportView'\nimport { NodeFormFooter } from './NodeFormFooter'\n\nexport interface ReportOutputNodeFormLabels {\n source: string\n fromStep: string\n inline: string\n reference: string\n referenceHint: string\n definition: string\n definitionHint: string\n parseError: string\n preview: string\n previewEmpty: string\n previewInvalid: string\n previewNeedsRun: string\n save: string\n cancel: string\n}\n\nexport const reportOutputNodeFormLabels = defineLabels<ReportOutputNodeFormLabels>('ReportOutputNodeForm', {\n en: {\n source: 'Report source',\n fromStep: 'From an earlier step',\n inline: 'Inline definition',\n reference: 'Report reference',\n referenceHint: 'Path to a report produced upstream, for example step1.report.',\n definition: 'Report definition',\n definitionHint: 'Structured text (JSON) with a list of sections.',\n parseError: 'This text is not valid structured data: {message}',\n preview: 'Preview',\n previewEmpty: 'Write a definition to see its preview.',\n previewInvalid: 'The definition has no section to show yet.',\n previewNeedsRun: 'The preview of a report from an earlier step needs a run.',\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n source: 'Origem do relatório',\n fromStep: 'De uma etapa anterior',\n inline: 'Definição própria',\n reference: 'Referência do relatório',\n referenceHint: 'Caminho de um relatório produzido antes, por exemplo etapa1.relatorio.',\n definition: 'Definição do relatório',\n definitionHint: 'Texto estruturado (JSON) com uma lista de seções.',\n parseError: 'Este texto não é um dado estruturado válido: {message}',\n preview: 'Prévia',\n previewEmpty: 'Escreva uma definição para ver a prévia.',\n previewInvalid: 'A definição ainda não tem seção para mostrar.',\n previewNeedsRun: 'A prévia de um relatório de etapa anterior precisa de uma execução.',\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n source: 'Origen del informe',\n fromStep: 'De un paso anterior',\n inline: 'Definición propia',\n reference: 'Referencia del informe',\n referenceHint: 'Ruta de un informe producido antes, por ejemplo paso1.informe.',\n definition: 'Definición del informe',\n definitionHint: 'Texto estructurado (JSON) con una lista de secciones.',\n parseError: 'Este texto no es un dato estructurado válido: {message}',\n preview: 'Vista previa',\n previewEmpty: 'Escriba una definición para ver la vista previa.',\n previewInvalid: 'La definición aún no tiene secciones para mostrar.',\n previewNeedsRun: 'La vista previa de un informe de un paso anterior necesita una ejecución.',\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultReportOutputNodeFormLabels: ReportOutputNodeFormLabels = reportOutputNodeFormLabels.bundles.en\n\nexport type ReportOutputConfig = { kind: 'report-output'; from: string } | { kind: 'report-output'; report: Record<string, unknown> }\n\nexport interface ReportOutputNodeFormProps {\n value: { from?: string; report?: Record<string, unknown>; [key: string]: unknown }\n validate?: (spec: unknown) => ReportIssue[]\n onSave: (value: ReportOutputConfig) => void\n onCancel: () => void\n labels?: Partial<ReportOutputNodeFormLabels>\n}\n\ntype Parsed = { ok: true; value: Record<string, unknown> | null } | { ok: false; message: string }\n\nfunction parse(text: string): Parsed {\n if (!text.trim()) return { ok: true, value: null }\n try {\n const v = JSON.parse(text) as unknown\n if (!v || typeof v !== 'object' || Array.isArray(v)) return { ok: false, message: 'object expected' }\n return { ok: true, value: v as Record<string, unknown> }\n } catch (e) {\n return { ok: false, message: e instanceof Error ? e.message : String(e) }\n }\n}\n\nexport function ReportOutputNodeForm({ value, validate = validateReport, onSave, onCancel, labels }: ReportOutputNodeFormProps) {\n const l = useLabels(reportOutputNodeFormLabels, labels)\n const { locale } = useFlowLocale()\n const previewId = useId()\n const [mode, setMode] = useState<'reference' | 'inline'>(value.report ? 'inline' : 'reference')\n const [from, setFrom] = useState(value.from ?? '')\n const [text, setText] = useState(() => (value.report ? JSON.stringify(value.report, null, 2) : ''))\n const [previewOpen, setPreviewOpen] = useState(false)\n const [showError, setShowError] = useState(false)\n const parsed = useMemo(() => parse(text), [text])\n const issues = parsed.ok && parsed.value ? validate(parsed.value) : null\n\n const save = () => {\n if (mode === 'reference') return onSave({ kind: 'report-output', from: from.trim() })\n if (!parsed.ok) {\n setShowError(true)\n return\n }\n onSave({ kind: 'report-output', report: parsed.value ?? {} })\n }\n\n const preview =\n mode === 'reference' ? (\n <EmptyState framing=\"inline\" title={l.previewNeedsRun} />\n ) : !parsed.ok || !parsed.value ? (\n <EmptyState framing=\"inline\" title={parsed.ok ? l.previewEmpty : l.previewInvalid} />\n ) : issues && issues.length ? (\n <EmptyState framing=\"inline\" title={l.previewInvalid} />\n ) : (\n <ReportView spec={parsed.value as unknown as ReportSpec} locale={locale} headingLevel={4} />\n )\n\n return (\n <div className=\"ty-node-form ty-report-form\">\n <RadioGroup className=\"ty-report-form__source\" value={mode} onChange={(m) => setMode(m as 'reference' | 'inline')} orientation=\"horizontal\">\n <Label className=\"ty-report-form__label\">{l.source}</Label>\n <div className=\"ty-report-form__radios\">\n <Radio value=\"reference\" className=\"ty-report-form__radio\">\n {l.fromStep}\n </Radio>\n <Radio value=\"inline\" className=\"ty-report-form__radio\">\n {l.inline}\n </Radio>\n </div>\n </RadioGroup>\n {mode === 'reference' ? (\n <TextField className=\"ty-ltr-text\" label={l.reference} hint={l.referenceHint} value={from} onChange={setFrom} />\n ) : (\n <TextArea\n className=\"ty-ltr-text\"\n monospace\n rows={8}\n label={l.definition}\n hint={l.definitionHint}\n value={text}\n onChange={(t) => {\n setText(t)\n setShowError(false)\n }}\n {...(!parsed.ok && (showError || text.trim()) ? { errorMessage: fill(l.parseError, { message: parsed.message }, locale) } : {})}\n />\n )}\n <div className=\"ty-report-form__preview\">\n <AriaButton className=\"ty-report-form__toggle\" aria-expanded={previewOpen} aria-controls={previewId} onPress={() => setPreviewOpen((o) => !o)}>\n <ChevronDown className=\"ty-report-form__chevron\" data-open={previewOpen || undefined} aria-hidden=\"true\" focusable=\"false\" />\n {l.preview}\n </AriaButton>\n <section id={previewId} aria-label={l.preview} className=\"ty-report-form__preview-body\" hidden={!previewOpen}>\n {previewOpen ? preview : null}\n </section>\n </div>\n <NodeFormFooter onSave={save} onCancel={onCancel} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// DecisionNodeForm (backlog B-002): what the decision reads, which values it\n// may choose, how the model is asked, which provider, model and version\n// decide, and the confidence below which a person reviews the result.\n\nimport { useId, useRef, useState } from 'react'\nimport { Plus, Trash2 } from 'lucide-react'\nimport { Button, InlineNotice, NativeSelect, TextArea, TextField } from '../../index'\nimport type { DecisionConfig, DecisionOption } from '../decision/types'\nimport { createId } from '../internal/ids'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { NodeFormFooter } from './NodeFormFooter'\n\nexport interface DecisionNodeFormLabels {\n input: string\n inputHint: string\n inputRequired: string\n references: string\n options: string\n optionLegend: string\n optionValue: string\n optionLabel: string\n addOption: string\n removeOption: string\n tooFew: string\n duplicate: string\n blankValue: string\n instruction: string\n instructionHint: string\n provider: string\n model: string\n modelVersion: string\n modelVersionHint: string\n none: string\n outputVariable: string\n threshold: string\n thresholdHint: string\n thresholdInvalid: string\n save: string\n cancel: string\n}\n\nexport const decisionNodeFormLabels = defineLabels<DecisionNodeFormLabels>('DecisionNodeForm', {\n en: {\n input: 'Input state',\n inputHint: 'Reference to the upstream value the decision reads.',\n inputRequired: 'Choose what the decision reads.',\n references: 'Available values',\n options: 'Options',\n optionLegend: 'Option {n, number}',\n optionValue: 'Value',\n optionLabel: 'Label',\n addOption: 'Add option',\n removeOption: 'Remove option {n, number}',\n tooFew: 'A decision needs at least two options.',\n duplicate: 'This value is already used by another option.',\n blankValue: 'Give the option a value.',\n instruction: 'Instruction',\n instructionHint: 'What the model is asked to decide. May reference upstream values.',\n provider: 'Provider',\n model: 'Model',\n modelVersion: 'Model version',\n modelVersionHint: 'Pinned and recorded with every result.',\n none: 'None',\n outputVariable: 'Output variable',\n threshold: 'Review threshold',\n thresholdHint: 'From 0 to 1. Below it, a person reviews the result.',\n thresholdInvalid: 'Use a number from 0 to 1.',\n save: 'Save',\n cancel: 'Cancel',\n },\n 'pt-BR': {\n input: 'Estado de entrada',\n inputHint: 'Referência ao valor anterior que a decisão lê.',\n inputRequired: 'Escolha o que a decisão lê.',\n references: 'Valores disponíveis',\n options: 'Opções',\n optionLegend: 'Opção {n, number}',\n optionValue: 'Valor',\n optionLabel: 'Rótulo',\n addOption: 'Adicionar opção',\n removeOption: 'Remover opção {n, number}',\n tooFew: 'Uma decisão precisa de pelo menos duas opções.',\n duplicate: 'Este valor já é usado por outra opção.',\n blankValue: 'Dê um valor à opção.',\n instruction: 'Instrução',\n instructionHint: 'O que o modelo deve decidir. Pode citar valores anteriores.',\n provider: 'Provedor',\n model: 'Modelo',\n modelVersion: 'Versão do modelo',\n modelVersionHint: 'Fixada e registrada em cada resultado.',\n none: 'Nenhum',\n outputVariable: 'Variável de saída',\n threshold: 'Limiar de revisão',\n thresholdHint: 'De 0 a 1. Abaixo dele, uma pessoa revisa o resultado.',\n thresholdInvalid: 'Use um número de 0 a 1.',\n save: 'Salvar',\n cancel: 'Cancelar',\n },\n es: {\n input: 'Estado de entrada',\n inputHint: 'Referencia al valor anterior que lee la decisión.',\n inputRequired: 'Elija qué lee la decisión.',\n references: 'Valores disponibles',\n options: 'Opciones',\n optionLegend: 'Opción {n, number}',\n optionValue: 'Valor',\n optionLabel: 'Etiqueta',\n addOption: 'Añadir opción',\n removeOption: 'Quitar opción {n, number}',\n tooFew: 'Una decisión necesita al menos dos opciones.',\n duplicate: 'Este valor ya lo usa otra opción.',\n blankValue: 'Dé un valor a la opción.',\n instruction: 'Instrucción',\n instructionHint: 'Qué debe decidir el modelo. Puede citar valores anteriores.',\n provider: 'Proveedor',\n model: 'Modelo',\n modelVersion: 'Versión del modelo',\n modelVersionHint: 'Fijada y registrada con cada resultado.',\n none: 'Ninguno',\n outputVariable: 'Variable de salida',\n threshold: 'Umbral de revisión',\n thresholdHint: 'De 0 a 1. Por debajo, una persona revisa el resultado.',\n thresholdInvalid: 'Use un número de 0 a 1.',\n save: 'Guardar',\n cancel: 'Cancelar',\n },\n})\n\nexport const defaultDecisionNodeFormLabels: DecisionNodeFormLabels = decisionNodeFormLabels.bundles.en\n\nexport interface DecisionNodeFormProps {\n value: Partial<DecisionConfig> & Record<string, unknown>\n references?: string[]\n providers?: Array<{ id: string; name: string }>\n models?: Array<{ id: string; name?: string; provider?: string }>\n onSave: (value: DecisionConfig) => void\n onCancel: () => void\n labels?: Partial<DecisionNodeFormLabels>\n}\n\ntype Row = DecisionOption & { key: string }\n\nexport interface DecisionValidation {\n input?: string\n options?: string\n rows: Record<string, string>\n threshold?: string\n}\n\n/** Checks the rules of the decision form; empty result means valid. */\nexport function validateDecision(inputRef: string, rows: Array<{ key: string; value: string }>, threshold: string): { input: boolean; tooFew: boolean; blank: string[]; duplicate: string[]; threshold: boolean } {\n const values = rows.map((r) => r.value.trim())\n const seen = new Map<string, number>()\n for (const v of values) if (v) seen.set(v, (seen.get(v) ?? 0) + 1)\n const t = threshold.trim() === '' ? null : Number(threshold)\n return {\n input: !inputRef.trim(),\n tooFew: rows.filter((r) => r.value.trim()).length < 2,\n blank: rows.filter((r) => !r.value.trim()).map((r) => r.key),\n duplicate: rows.filter((r) => r.value.trim() && (seen.get(r.value.trim()) ?? 0) > 1).map((r) => r.key),\n threshold: t !== null && !(Number.isFinite(t) && t >= 0 && t <= 1),\n }\n}\n\nexport function DecisionNodeForm({ value, references = [], providers = [], models = [], onSave, onCancel, labels }: DecisionNodeFormProps) {\n const l = useLabels(decisionNodeFormLabels, labels)\n const { locale } = useFlowLocale()\n const reasonId = useId()\n const [inputRef, setInputRef] = useState(value.input?.ref ?? '')\n const [rows, setRows] = useState<Row[]>(() => (value.options ?? []).map((o) => ({ ...o, key: createId('option') })))\n const [instruction, setInstruction] = useState(value.instruction ?? '')\n const [provider, setProvider] = useState(value.provider ?? '')\n const [model, setModel] = useState(value.model ?? '')\n const [modelVersion, setModelVersion] = useState(value.modelVersion ?? '')\n const [outputVariable, setOutputVariable] = useState(value.outputVariable ?? 'decision')\n const [threshold, setThreshold] = useState(value.threshold === undefined ? '' : String(value.threshold))\n const [attempted, setAttempted] = useState(false)\n const focusKey = useRef<string | null>(null)\n\n const v = validateDecision(inputRef, rows, threshold)\n const valid = !v.input && !v.tooFew && !v.blank.length && !v.duplicate.length && !v.threshold\n const shownModels = provider ? models.filter((m) => !m.provider || m.provider === provider) : models\n\n const save = () => {\n setAttempted(true)\n if (!valid) return\n const out: DecisionConfig = {\n ...(value as Record<string, unknown>),\n kind: 'decision',\n input: { ...(value.input ?? {}), ref: inputRef.trim() },\n options: rows.map(({ key: _k, ...o }) => ({ ...o, value: o.value.trim(), label: o.label.trim() || o.value.trim() })),\n outputVariable: outputVariable.trim() || 'decision',\n }\n const set = (k: 'instruction' | 'provider' | 'model' | 'modelVersion', s: string) => {\n if (s.trim()) out[k] = s.trim()\n else delete out[k]\n }\n set('instruction', instruction)\n set('provider', provider)\n set('model', model)\n set('modelVersion', modelVersion)\n if (threshold.trim()) out.threshold = Number(threshold)\n else delete out.threshold\n onSave(out)\n }\n\n return (\n <div className=\"ty-node-form ty-decision-form\">\n <div className=\"ty-decision-form__input\">\n <TextField\n className=\"ty-ltr-text\"\n label={l.input}\n hint={l.inputHint}\n value={inputRef}\n onChange={setInputRef}\n required\n {...(attempted && v.input ? { errorMessage: l.inputRequired } : {})}\n />\n {references.length ? (\n <div className=\"ty-decision-form__refs\" role=\"group\" aria-label={l.references}>\n {references.map((r) => (\n <Button key={r} size=\"compact\" variant={r === inputRef ? 'primary' : 'secondary'} current={r === inputRef} onPress={() => setInputRef(r)}>\n <span className=\"ty-ltr-text\">{r}</span>\n </Button>\n ))}\n </div>\n ) : null}\n </div>\n\n <section className=\"ty-decision-form__options\" aria-label={l.options}>\n <h3 className=\"ty-decision-form__heading\">{l.options}</h3>\n {rows.map((r, i) => (\n <fieldset key={r.key} className=\"ty-decision-form__option\">\n <legend className=\"ty-decision-form__legend\">{fill(l.optionLegend, { n: i + 1 }, locale)}</legend>\n <TextField\n className=\"ty-ltr-text\"\n label={l.optionValue}\n value={r.value}\n autoFocus={focusKey.current === r.key}\n onChange={(value) => setRows((rs) => rs.map((x) => (x.key === r.key ? { ...x, value } : x)))}\n {...(v.duplicate.includes(r.key) ? { errorMessage: l.duplicate } : attempted && v.blank.includes(r.key) ? { errorMessage: l.blankValue } : {})}\n />\n <TextField label={l.optionLabel} value={r.label} onChange={(label) => setRows((rs) => rs.map((x) => (x.key === r.key ? { ...x, label } : x)))} />\n <Button\n variant=\"quiet\"\n size=\"compact\"\n shape=\"circle\"\n iconOnly\n accessibleLabel={fill(l.removeOption, { n: i + 1 }, locale)}\n leadingIcon={<Trash2 />}\n onPress={() => setRows((rs) => rs.filter((x) => x.key !== r.key))}\n />\n </fieldset>\n ))}\n {v.tooFew && (attempted || rows.length > 0) ? (\n <InlineNotice tone=\"warning\" urgency=\"polite\">\n <span id={reasonId}>{l.tooFew}</span>\n </InlineNotice>\n ) : null}\n <Button\n variant=\"secondary\"\n size=\"compact\"\n leadingIcon={<Plus />}\n onPress={() => {\n const key = createId('option')\n focusKey.current = key\n setRows((rs) => [...rs, { key, value: '', label: '' }])\n }}\n >\n {l.addOption}\n </Button>\n </section>\n\n <TextArea label={l.instruction} hint={l.instructionHint} rows={3} value={instruction} onChange={setInstruction} />\n <div className=\"ty-decision-form__model\">\n <NativeSelect\n label={l.provider}\n options={[{ value: '', label: l.none }, ...providers.map((p) => ({ value: p.id, label: p.name }))]}\n value={provider}\n onChange={(p) => {\n setProvider(p)\n if (model && !models.some((m) => m.id === model && (!m.provider || m.provider === p))) setModel('')\n }}\n />\n <NativeSelect label={l.model} options={[{ value: '', label: l.none }, ...shownModels.map((m) => ({ value: m.id, label: m.name ?? m.id }))]} value={model} onChange={setModel} />\n <TextField className=\"ty-ltr-text ty-mono\" label={l.modelVersion} hint={l.modelVersionHint} value={modelVersion} onChange={setModelVersion} />\n </div>\n <div className=\"ty-decision-form__model\">\n <TextField className=\"ty-ltr-text\" label={l.outputVariable} value={outputVariable} onChange={setOutputVariable} />\n <TextField\n inputType=\"number\"\n label={l.threshold}\n hint={l.thresholdHint}\n value={threshold}\n onChange={setThreshold}\n {...(v.threshold ? { errorMessage: l.thresholdInvalid } : {})}\n />\n </div>\n <NodeFormFooter onSave={save} onCancel={onCancel} saveDisabled={!valid} disabledReasonId={reasonId} labels={{ save: l.save, cancel: l.cancel }} />\n </div>\n )\n}\n","// NodeConfigDialog: the one modal that edits a node's configuration. The form\n// is chosen from the catalog entry's form kind; each form owns its footer.\n\nimport { useEffect, useRef, useSyncExternalStore, type ComponentType, type ReactNode } from 'react'\nimport { InlineNotice } from '../../index'\nimport { nodeKindCatalog, type FormKind, type NodeKindCatalogStore } from '../catalog/kindCatalog'\nimport { humaniseKey, useRenderCatalog } from '../catalog/RenderCatalog'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { defineLabels, useFlowLocale, useLabels } from '../internal/labels'\nimport { useDialogStack, useActiveDialog, type NodeConfigPayload } from '../state/dialogStack'\nimport { useOptionalFlowEditorStore } from '../state/editorState'\nimport { ComputeNodeForm, RuleNodeForm, SimulationNodeForm } from '../expressions'\nimport { AgentNodeForm, DataSourceNodeForm, DecisionNodeForm, GroupNodeForm, ReportOutputNodeForm, SchemaConfigForm, StartNodeForm } from '../forms'\n\nexport interface NodeConfigDialogLabels {\n eyebrow: string\n experimental: string\n /** Title per node kind; falls back to the catalog label. */\n titles: Record<string, string>\n}\n\nexport const nodeConfigDialogLabels = defineLabels<NodeConfigDialogLabels>('NodeConfigDialog', {\n en: {\n eyebrow: 'Node configuration',\n experimental: 'This step is experimental: its configuration is saved, but the engine may pass inputs through unchanged.',\n titles: {},\n },\n 'pt-BR': {\n eyebrow: 'Configuração do passo',\n experimental: 'Este passo é experimental: a configuração é salva, mas o motor pode repassar as entradas sem alterá-las.',\n titles: {},\n },\n es: {\n eyebrow: 'Configuración del paso',\n experimental: 'Este paso es experimental: su configuración se guarda, pero el motor puede pasar las entradas sin cambios.',\n titles: {},\n },\n})\nexport const defaultNodeConfigDialogLabels = nodeConfigDialogLabels.bundles.en\n\nexport interface NodeConfigDataSource {\n id: string\n name: string\n dialect: string\n}\n\nexport interface NodeConfigDialogProps {\n onSave: (nodeId: string, config: Record<string, unknown>) => void\n dataSources?: NodeConfigDataSource[]\n loadTables?: (dataSourceId: string) => Promise<string[]>\n loadColumns?: (dataSourceId: string, table: string) => Promise<Array<{ name: string; type: string; nullable?: boolean }>>\n /** Enables the compute form's dry run; hidden when absent. */\n runDryRun?: (request: unknown) => Promise<unknown>\n // Pass-throughs for the forms that pick a saved thing or a model.\n agents?: Array<{ id: string; name: string; model?: string }>\n loadAgents?: () => Promise<Array<{ id: string; name: string; model?: string }>>\n agentsHref?: string\n rules?: Array<{ id: string; name: string; condition?: unknown }>\n loadRules?: () => Promise<Array<{ id: string; name: string; condition?: unknown }>>\n onManageRules?: () => void\n providers?: Array<{ id: string; name: string }>\n models?: Array<{ id: string; name?: string; provider?: string }>\n /** Catalog to read form kinds from (defaults to the installed one). */\n catalog?: NodeKindCatalogStore\n labels?: Partial<NodeConfigDialogLabels>\n}\n\n// Forms are built by sibling groups; they are addressed through a loose prop shape here.\ntype AnyForm = ComponentType<Record<string, unknown>>\nconst asForm = (c: unknown) => c as AnyForm\n\n/** Focuses the node's main control on the canvas, if it is there. */\nexport function focusCanvasNode(nodeId: string): void {\n const esc = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(nodeId) : nodeId\n const el = document.querySelector<HTMLElement>(`[data-ty-node-id=\"${esc}\"] [data-ty-node-focus]`) ?? document.querySelector<HTMLElement>(`[data-ty-node-id=\"${esc}\"]`)\n el?.focus()\n}\n\nexport function NodeConfigDialog(props: NodeConfigDialogProps) {\n const { onSave, catalog = nodeKindCatalog } = props\n const l = useLabels(nodeConfigDialogLabels, props.labels)\n // The overlay is portalled outside the host's dir; the body carries the reading direction.\n const { direction } = useFlowLocale()\n useSyncExternalStore(catalog.subscribe, catalog.getVersion, catalog.getVersion)\n const active = useActiveDialog<NodeConfigPayload>('node-config')\n const stack = useDialogStack()\n const editor = useOptionalFlowEditorStore()\n const render = useRenderCatalog()\n const bodyRef = useRef<HTMLDivElement>(null)\n\n const payload = active?.payload ?? null\n const entry = payload ? catalog.entry(payload.kind) : undefined\n\n useEffect(() => {\n if (payload && !entry) console.warn(`NodeConfigDialog: no catalog entry for node kind \"${payload.kind}\"; the host must install the node catalog.`)\n }, [payload, entry])\n\n if (!payload || !entry) return null\n const { nodeId } = payload\n\n const close = () => {\n stack.close()\n editor?.actions.setEditingNode(null)\n requestAnimationFrame(() => focusCanvasNode(nodeId))\n }\n const save = (config: Record<string, unknown>) => {\n onSave(nodeId, config)\n close()\n }\n const formKind: FormKind = entry.formKind ?? 'schema'\n const common = { onSave: save, onCancel: close }\n const Icon = render.icon(payload.kind)\n const title = l.titles[payload.kind] ?? entry.label ?? humaniseKey(payload.kind)\n\n if (formKind === 'datasource') {\n const Form = asForm(DataSourceNodeForm)\n return (\n <Form\n open\n value={payload.config}\n sources={props.dataSources ?? []}\n loadTables={props.loadTables ?? (() => Promise.resolve([]))}\n loadColumns={props.loadColumns ?? (() => Promise.resolve([]))}\n {...common}\n />\n )\n }\n\n let form: ReactNode\n switch (formKind) {\n case 'compute': {\n const Form = asForm(ComputeNodeForm)\n form = <Form value={payload.config} references={payload.references} {...(props.runDryRun ? { onDryRun: props.runDryRun } : {})} {...common} />\n break\n }\n case 'simulation': {\n const Form = asForm(SimulationNodeForm)\n form = <Form value={payload.config} references={payload.references} {...common} />\n break\n }\n case 'start': {\n const Form = asForm(StartNodeForm)\n form = <Form config={payload.config} {...common} />\n break\n }\n case 'agent': {\n const Form = asForm(AgentNodeForm)\n form = <Form config={payload.config} agents={props.agents} loadAgents={props.loadAgents} agentsHref={props.agentsHref ?? ''} {...common} />\n break\n }\n case 'rule': {\n const Form = asForm(RuleNodeForm)\n form = <Form value={payload.config} rules={props.rules} loadRules={props.loadRules} onManageRules={props.onManageRules ?? (() => {})} {...common} />\n break\n }\n case 'report-output': {\n const Form = asForm(ReportOutputNodeForm)\n form = <Form value={payload.config} {...common} />\n break\n }\n case 'group': {\n const Form = asForm(GroupNodeForm)\n form = <Form value={payload.config} {...common} />\n break\n }\n case 'decision': {\n const Form = asForm(DecisionNodeForm)\n form = <Form value={payload.config} references={payload.references} providers={props.providers} models={props.models} {...common} />\n break\n }\n default: {\n const Form = asForm(SchemaConfigForm)\n form = <Form value={payload.config} schema={entry.configSchema ?? {}} {...common} />\n }\n }\n\n // Ctrl/Cmd+Enter: press the form's save control (marked by the form, else its primary button).\n const submitShortcut = () => {\n const body = bodyRef.current\n const save = body?.querySelector<HTMLButtonElement>('[data-ty-form-save]') ?? body?.querySelector<HTMLButtonElement>('button[data-variant=\"primary\"]')\n if (save && !save.disabled && save.getAttribute('aria-disabled') !== 'true') save.click()\n }\n\n return (\n <SectionedModal\n isOpen\n onOpenChange={(open) => {\n if (!open) close()\n }}\n title={title}\n subtitle={payload.label}\n eyebrow={l.eyebrow}\n icon={<Icon />}\n tone={render.tone(payload.kind)}\n onSubmitShortcut={submitShortcut}\n className=\"ty-node-config-dialog\"\n >\n <div ref={bodyRef} className=\"ty-node-config-dialog__body\" data-form-kind={formKind} dir={direction}>\n {catalog.isExperimental(payload.kind) ? (\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {l.experimental}\n </InlineNotice>\n ) : null}\n {form}\n </div>\n </SectionedModal>\n )\n}\n","// Run lineage and run comparison, as pure data functions.\n//\n// A derived run carries an origin tag written by the engine (\"replay:r7\",\n// \"approval:r7:review\"). Comparison lines two execution records up by step id\n// and names what differs, using one canonical text form for every equality.\n\nexport type LineageKind = 'reset' | 'replay' | 'resume' | 'fork' | 'signal' | 'timer' | 'approval'\n\n/** Origin of a derived run: how it was made and from which run (and step, for approvals). */\nexport interface Lineage {\n kind: LineageKind\n baseRunId: string\n nodeId?: string\n}\n\nconst ORIGIN_TAG = /^(reset|replay|resume|fork|signal|timer|approval):(.+)$/s\n\n/** Origin of a run from its tag; null for root runs (people, webhooks, schedules) and malformed tags. */\nexport function parseLineage(tag: string | null | undefined): Lineage | null {\n const match = tag ? ORIGIN_TAG.exec(tag) : null\n if (!match) return null\n const kind = match[1] as LineageKind\n const tail = match[2]!\n if (kind !== 'approval') return { kind, baseRunId: tail }\n const [run, ...stepParts] = tail.split(':')\n if (!run) return null\n const step = stepParts.join(':')\n return step ? { kind, baseRunId: run, nodeId: step } : { kind, baseRunId: run }\n}\n\n/** Id of the last carried-over step (stored order), or null. */\nexport function findForkPoint(steps: ReadonlyArray<{ nodeId: string; restored?: boolean }>): string | null {\n return steps.reduce<string | null>((found, step) => (step.restored ? step.nodeId : found), null)\n}\n\n/** Wire spellings of a status (\"PausedForApproval\", \"PAUSED_FOR_APPROVAL\", \"paused for approval\") collapse to snake case. */\nexport function normaliseStatus(raw: string): string {\n const words = raw\n .trim()\n .split(/(?<=[a-z0-9])(?=[A-Z])|[\\s_-]+/)\n .filter(Boolean)\n return words.join('_').toLowerCase()\n}\n\n/** Structured text of a value with object keys in sorted order at every depth. */\nexport function canonicalEncode(value: unknown): string {\n const text = JSON.stringify(value, (_key, v: unknown) =>\n v && typeof v === 'object' && !Array.isArray(v)\n ? Object.fromEntries(Object.entries(v as Record<string, unknown>).sort(([p], [q]) => (p < q ? -1 : p > q ? 1 : 0)))\n : v,\n )\n return text ?? 'undefined'\n}\n\nconst sameValue = (x: unknown, y: unknown) => canonicalEncode(x) === canonicalEncode(y)\n\n/** One step of a recorded execution, as compared. */\nexport interface DiffEntry {\n nodeId: string\n nodeKind: string\n status: string\n durationMs: number | null\n outputs?: Record<string, unknown> | null\n error?: string | null\n restored?: boolean\n}\n\nexport type DiffKind = 'onlyA' | 'onlyB' | 'identical' | 'diverged'\n\nexport interface NodeDiff {\n nodeId: string\n nodeKind: string\n diff: DiffKind\n a: DiffEntry | null\n b: DiffEntry | null\n changedKeys: string[]\n}\n\nexport interface VariableDiff {\n key: string\n diff: DiffKind\n a: unknown\n b: unknown\n}\n\n/** Keys of A first, then keys only B has, each once. */\nfunction unionKeys(left: Record<string, unknown>, right: Record<string, unknown>): string[] {\n return [...new Set([...Object.keys(left), ...Object.keys(right)])]\n}\n\nfunction verdict(inLeft: boolean, inRight: boolean, equal: () => boolean): DiffKind {\n if (!inRight) return 'onlyA'\n if (!inLeft) return 'onlyB'\n return equal() ? 'identical' : 'diverged'\n}\n\n/** Step-by-step comparison: A's order, then steps only B ran, in B's order. */\nexport function diffTimelines(a: readonly DiffEntry[], b: readonly DiffEntry[]): NodeDiff[] {\n const left = new Map(a.map((s) => [s.nodeId, s]))\n const right = new Map(b.map((s) => [s.nodeId, s]))\n const order = [...new Set([...left.keys(), ...right.keys()])]\n return order.map((id) => {\n const x = left.get(id) ?? null\n const y = right.get(id) ?? null\n const outputsX = x?.outputs ?? {}\n const outputsY = y?.outputs ?? {}\n const changedKeys = x && y ? unionKeys(outputsX, outputsY).filter((k) => !sameValue(outputsX[k], outputsY[k])) : []\n const diff = verdict(!!x, !!y, () => normaliseStatus(x!.status) === normaliseStatus(y!.status) && (x!.error ?? null) === (y!.error ?? null) && changedKeys.length === 0)\n return { nodeId: id, nodeKind: (x ?? y)!.nodeKind, diff, a: x, b: y, changedKeys }\n })\n}\n\n/** One row per variable of either map. */\nexport function diffVariables(a?: Record<string, unknown> | null, b?: Record<string, unknown> | null): VariableDiff[] {\n const left = a ?? {}\n const right = b ?? {}\n return unionKeys(left, right).map((key) => ({\n key,\n diff: verdict(key in left, key in right, () => sameValue(left[key], right[key])),\n a: left[key],\n b: right[key],\n }))\n}\n","// Status of a run or of a node inside a run: always an icon and a word\n// (design direction §2.3, §2.11); the tone only reinforces them.\n\nimport { CircleCheck, CircleDashed, CircleHelp, CircleSlash, CircleX, Clock, History, LoaderCircle } from 'lucide-react'\nimport type { ComponentType, SVGProps } from 'react'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport { normaliseStatus } from './lineage'\nimport type { RunWord } from './types'\n\nexport type RunWordLabels = Record<RunWord, string>\n\nexport const runWordLabels = defineLabels<RunWordLabels>('run-status', {\n en: { idle: 'idle', pending: 'pending', running: 'running', completed: 'completed', failed: 'failed', skipped: 'skipped', restored: 'restored', unknown: 'unknown' },\n 'pt-BR': { idle: 'parada', pending: 'pendente', running: 'em execução', completed: 'concluída', failed: 'falhou', skipped: 'pulada', restored: 'reaproveitada', unknown: 'desconhecido' },\n es: { idle: 'inactiva', pending: 'pendiente', running: 'en ejecución', completed: 'completada', failed: 'falló', skipped: 'omitida', restored: 'restaurada', unknown: 'desconocido' },\n})\n\nexport const defaultRunWordLabels: RunWordLabels = runWordLabels.bundles.en\n\nconst WORD_OF: Record<string, RunWord> = {\n idle: 'idle',\n pending: 'pending',\n queued: 'pending',\n waiting: 'pending',\n running: 'running',\n in_progress: 'running',\n started: 'running',\n streaming: 'running',\n completed: 'completed',\n complete: 'completed',\n succeeded: 'completed',\n success: 'completed',\n done: 'completed',\n failed: 'failed',\n error: 'failed',\n errored: 'failed',\n cancelled: 'failed',\n canceled: 'failed',\n skipped: 'skipped',\n restored: 'restored',\n served_from_history: 'restored',\n}\n\n/** Engine spellings (COMPLETED, succeeded, success …) → one word of the view vocabulary. */\nexport function runWordOf(status: string | undefined | null): RunWord {\n if (!status) return 'idle'\n return WORD_OF[normaliseStatus(status)] ?? 'unknown'\n}\n\nconst ICONS: Record<RunWord, ComponentType<SVGProps<SVGSVGElement>>> = {\n idle: CircleDashed,\n pending: Clock,\n running: LoaderCircle,\n completed: CircleCheck,\n failed: CircleX,\n skipped: CircleSlash,\n restored: History,\n unknown: CircleHelp,\n}\n\nexport interface RunStatusMarkProps {\n status: string | RunWord\n labels?: Partial<RunWordLabels>\n /** Hide the word visually (it stays in the accessible text). */\n quiet?: boolean\n className?: string\n}\n\nexport function RunStatusMark({ status, labels, quiet = false, className }: RunStatusMarkProps) {\n const l = useLabels(runWordLabels, labels)\n const word = runWordOf(status)\n const Icon = ICONS[word]\n return (\n <span className={['ty-run-status', className].filter(Boolean).join(' ')} data-status={word}>\n <Icon className=\"ty-run-status__icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className={quiet ? 'ty-visually-hidden' : 'ty-run-status__word'}>{l[word]}</span>\n </span>\n )\n}\n","// RunPanel: docked progress of the flow in the editor, one row per executable\n// node, with Run and Stop.\n\nimport { useId } from 'react'\nimport { Play, Square } from 'lucide-react'\nimport { Button } from '../../index'\nimport { DockedPanel } from '../internal/DockedPanel'\nimport { formatDuration } from '../internal/format'\nimport { defineLabels, useFlowLocale, useLabels } from '../internal/labels'\nimport { useFlowEditorState } from '../state/editorState'\nimport { RunStatusMark, type RunWordLabels } from './RunStatusMark'\n\nexport interface RunPanelLabels {\n title: string\n running: string\n run: string\n stop: string\n close: string\n empty: string\n noStart: string\n noEnd: string\n}\n\nexport const runPanelLabels = defineLabels<RunPanelLabels>('run-panel', {\n en: {\n title: 'Run',\n running: 'Running',\n run: 'Run',\n stop: 'Stop',\n close: 'Close run panel',\n empty: 'This flow has no steps to run yet.',\n noStart: 'Add and configure a start step to run this flow.',\n noEnd: 'Add an end step to run this flow.',\n },\n 'pt-BR': {\n title: 'Execução',\n running: 'Em execução',\n run: 'Executar',\n stop: 'Parar',\n close: 'Fechar painel de execução',\n empty: 'Este fluxo ainda não tem passos para executar.',\n noStart: 'Adicione e configure um passo de início para executar este fluxo.',\n noEnd: 'Adicione um passo de fim para executar este fluxo.',\n },\n es: {\n title: 'Ejecución',\n running: 'En ejecución',\n run: 'Ejecutar',\n stop: 'Detener',\n close: 'Cerrar panel de ejecución',\n empty: 'Este flujo aún no tiene pasos para ejecutar.',\n noStart: 'Agregue y configure un paso de inicio para ejecutar este flujo.',\n noEnd: 'Agregue un paso de fin para ejecutar este flujo.',\n },\n})\nexport const defaultRunPanelLabels: RunPanelLabels = runPanelLabels.bundles.en\n\n/** Kinds that never run and never get a row. */\nexport const NON_EXECUTABLE_KINDS: readonly string[] = ['note', 'group']\nconst START_KINDS = ['start']\nconst END_KINDS = ['end', 'answer']\n\nexport interface RunPanelProps {\n open: boolean\n onClose: () => void\n onRun: () => void\n onStop: () => void\n labels?: Partial<RunPanelLabels>\n statusLabels?: Partial<RunWordLabels>\n}\n\nexport function RunPanel({ open, onClose, onRun, onStop, labels, statusLabels }: RunPanelProps) {\n if (!open) return null\n return <RunPanelBody onClose={onClose} onRun={onRun} onStop={onStop} labels={labels} statusLabels={statusLabels} />\n}\n\nfunction RunPanelBody({ onClose, onRun, onStop, labels, statusLabels }: Omit<RunPanelProps, 'open'>) {\n const l = useLabels(runPanelLabels, labels)\n const { locale } = useFlowLocale()\n const hintId = useId()\n const nodes = useFlowEditorState((s) => s.nodes)\n const isRunning = useFlowEditorState((s) => s.isRunning)\n const results = useFlowEditorState((s) => s.nodeResults)\n\n const rows = nodes.filter((n) => !NON_EXECUTABLE_KINDS.includes(n.kind))\n const hasStart = nodes.some((n) => START_KINDS.includes(n.kind))\n const hasEnd = nodes.some((n) => END_KINDS.includes(n.kind))\n const blocker = !hasStart ? l.noStart : !hasEnd ? l.noEnd : null\n\n const action = isRunning ? (\n <Button variant=\"danger\" size=\"compact\" leadingIcon={<Square />} onPress={onStop}>\n {l.stop}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"compact\" leadingIcon={<Play />} disabled={!!blocker} focusableWhenDisabled onPress={onRun}>\n {l.run}\n </Button>\n )\n\n return (\n <DockedPanel title={l.title} edge=\"bottom\" onClose={onClose} closeLabel={l.close} actions={action} className=\"ty-run-panel\" data={{ 'data-running': isRunning ? 'true' : undefined }}>\n <div role=\"status\" aria-live=\"polite\" className={isRunning ? 'ty-run-panel__running' : 'ty-visually-hidden'}>\n {isRunning ? <RunStatusMark status=\"running\" labels={{ ...statusLabels, running: l.running }} /> : ''}\n </div>\n {blocker && !isRunning ? (\n <p id={hintId} className=\"ty-run-panel__hint\">\n {blocker}\n </p>\n ) : null}\n {rows.length === 0 ? (\n <p className=\"ty-run-empty\">{l.empty}</p>\n ) : (\n <ul className=\"ty-run-rows\" aria-label={l.title}>\n {rows.map((n) => {\n const r = results[n.id]\n const errorId = `${hintId}-${n.id}-error`\n const label = typeof n.data.label === 'string' && n.data.label ? n.data.label : n.id\n return (\n <li key={n.id} className=\"ty-run-row\" data-status={r?.status ?? 'idle'} aria-describedby={r?.error ? errorId : undefined}>\n <RunStatusMark status={r?.status ?? 'pending'} labels={statusLabels} />\n <span className=\"ty-run-row__label\">{label}</span>\n <span className=\"ty-run-row__kind\">{n.kind}</span>\n {r?.durationMs !== undefined ? <span className=\"ty-run-row__duration\">{formatDuration(r.durationMs, locale)}</span> : null}\n {r?.error ? (\n <span id={errorId} className=\"ty-run-row__error\">\n {r.error}\n </span>\n ) : null}\n </li>\n )\n })}\n </ul>\n )}\n </DockedPanel>\n )\n}\n","// Run history loading plus two readers that dig usage figures out of the\n// free-form outputs steps report (token counts, tool calls).\n\nimport { useCallback, useEffect, useReducer, useRef } from 'react'\nimport type { LoadRuns, RunSummary } from './types'\n\nexport interface RunHistory {\n runs: RunSummary[]\n state: 'idle' | 'loading' | 'ready' | 'error'\n error: string | null\n retry: () => void\n}\n\ntype Ledger = Omit<RunHistory, 'retry'> & { round: number }\ntype LedgerStep = { to: 'loading' } | { to: 'ready'; runs: RunSummary[] } | { to: 'error'; message: string } | { to: 'again' }\n\nfunction ledger(prev: Ledger, step: LedgerStep): Ledger {\n if (step.to === 'again') return { ...prev, round: prev.round + 1 }\n if (step.to === 'loading') return { ...prev, state: 'loading', error: null }\n if (step.to === 'ready') return { ...prev, state: 'ready', runs: step.runs }\n return { ...prev, state: 'error', error: step.message }\n}\n\n/** Fetches the runs while `active`, again when `reloadKey` changes; an answer that arrives late is dropped. */\nexport function useRunHistory(flowId: string, loadRuns: LoadRuns | undefined, active: boolean, reloadKey: unknown = 0): RunHistory {\n const [book, apply] = useReducer(ledger, { runs: [], state: 'idle', error: null, round: 0 })\n useEffect(() => {\n if (!active || !loadRuns) return\n let current = true\n apply({ to: 'loading' })\n loadRuns(flowId)\n .then((runs) => current && apply({ to: 'ready', runs }))\n .catch((why: unknown) => current && apply({ to: 'error', message: why instanceof Error ? why.message : String(why) }))\n return () => {\n current = false\n }\n }, [flowId, loadRuns, active, reloadKey, book.round])\n const retry = useCallback(() => apply({ to: 'again' }), [])\n return { runs: book.runs, state: book.state, error: book.error, retry }\n}\n\n/** Runs `effect` once each time `value` goes from `from` to `to`. */\nexport function useTransition<T>(value: T, from: T, to: T, effect: () => void): void {\n const seen = useRef(value)\n const handler = useRef(effect)\n handler.current = effect\n useEffect(() => {\n const before = seen.current\n seen.current = value\n if (Object.is(before, from) && Object.is(value, to)) handler.current()\n }, [value, from, to])\n}\n\nexport interface TokenUsage {\n input: number\n output: number\n total: number\n}\n\ntype Bag = Record<string, unknown>\nconst isBag = (v: unknown): v is Bag => typeof v === 'object' && v !== null && !Array.isArray(v)\nconst count = (v: unknown): number => (typeof v === 'number' && Number.isFinite(v) ? v : 0)\n\n/** Spellings providers use for the (in, out) token pair. */\nconst TOKEN_FIELDS: ReadonlyArray<readonly [string, string]> = [\n ['input_tokens', 'output_tokens'],\n ['inputTokens', 'outputTokens'],\n ['prompt_tokens', 'completion_tokens'],\n ['promptTokens', 'completionTokens'],\n ['input', 'output'],\n]\nconst USAGE_HOLDERS = ['usage', 'tokenUsage', 'token_usage', 'tokens']\nconst TOOL_LISTS = ['toolCalls', 'tool_calls', 'tools']\n\n/** Every usage block found in a value, searching nested objects up to a small depth. */\nfunction* usageBlocks(v: unknown, depth = 0): Generator<[number, number]> {\n if (!isBag(v) || depth > 3) return\n const holder = USAGE_HOLDERS.map((k) => v[k]).find(isBag)\n const pair = holder && TOKEN_FIELDS.find(([i, o]) => typeof holder[i] === 'number' || typeof holder[o] === 'number')\n if (holder && pair) {\n yield [count(holder[pair[0]]), count(holder[pair[1]])]\n return\n }\n for (const inner of Object.values(v)) yield* usageBlocks(inner, depth + 1)\n}\n\n/** Token usage summed over step outputs; null when no step reports any. */\nexport function sumTokens(outputs: readonly unknown[]): TokenUsage | null {\n const blocks = outputs.flatMap((o) => [...usageBlocks(o)])\n if (blocks.length === 0) return null\n const input = blocks.reduce((s, [i]) => s + i, 0)\n const output = blocks.reduce((s, [, o]) => s + o, 0)\n return { input, output, total: input + output }\n}\n\nfunction toolName(call: unknown): string | undefined {\n if (typeof call === 'string') return call || undefined\n if (!isBag(call)) return undefined\n const named = call.name ?? call.tool ?? (isBag(call.function) ? call.function.name : undefined)\n return typeof named === 'string' && named ? named : undefined\n}\n\n/** How often each tool was called, from common tool-call shapes; null when none. */\nexport function countTools(outputs: readonly unknown[]): Array<{ name: string; count: number }> | null {\n const names = outputs\n .filter(isBag)\n .flatMap((o) => TOOL_LISTS.flatMap((k) => (Array.isArray(o[k]) ? (o[k] as unknown[]) : [])))\n .map(toolName)\n .filter((n): n is string => !!n)\n if (!names.length) return null\n const tally = names.reduce((m, n) => m.set(n, (m.get(n) ?? 0) + 1), new Map<string, number>())\n return Array.from(tally, ([name, n]) => ({ name, count: n }))\n}\n\n/** Readable text of an output value (strings as they are, the rest indented). */\nexport function prettyValue(value: unknown): string {\n if (value === undefined) return ''\n if (typeof value === 'string') return value\n try {\n return JSON.stringify(value, null, 2)\n } catch {\n return String(value)\n }\n}\n","// RunDrawer: the docked, full run view. Live run and history in tabs; a run\n// shows metrics, token usage, tools called and a per-node breakdown. Non-modal\n// complementary landmark: the canvas stays usable.\n\nimport { useEffect, useId, useRef, useState } from 'react'\nimport { ArrowLeft, ChevronRight, CircleAlert, Minimize2, Workflow } from 'lucide-react'\nimport { Button, Spinner, TabPanel, Tabs } from '../../index'\nimport { DockedPanel } from '../internal/DockedPanel'\nimport { formatDateTime, formatDuration, formatNumber } from '../internal/format'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport { useFlowEditorState } from '../state/editorState'\nimport { NON_EXECUTABLE_KINDS } from './RunPanel'\nimport { RunStatusMark, runWordLabels, runWordOf, type RunWordLabels } from './RunStatusMark'\nimport { countTools, prettyValue, sumTokens, useRunHistory, useTransition } from './runData'\nimport type { LoadRuns, RunNodeResult, RunSummary } from './types'\n\nexport interface RunDrawerLabels {\n title: string\n close: string\n tabs: string\n live: string\n history: string\n idleHint: string\n back: string\n totalDuration: string\n nodeCount: string\n succeeded: string\n errors: string\n errorsTerm: string\n tokens: string\n tokensIn: string\n tokensOut: string\n tokensTotal: string\n tokensNotReported: string\n tools: string\n toolCalls: string\n toolsNotReported: string\n nodes: string\n output: string\n notReported: string\n loading: string\n loadError: string\n retry: string\n empty: string\n runRow: string\n compact: string\n statusChanged: string\n}\n\nexport const runDrawerLabels = defineLabels<RunDrawerLabels>('run-drawer', {\n en: {\n title: 'Run details',\n close: 'Close run details',\n tabs: 'Run views',\n live: 'Live',\n history: 'History',\n idleHint: 'Start a run to follow it here, step by step.',\n back: 'Back to runs',\n totalDuration: 'Total duration',\n nodeCount: 'Steps',\n succeeded: 'Succeeded',\n errors: '{count, plural, =0 {No errors} one {# error} other {# errors}}',\n errorsTerm: 'Errors',\n tokens: 'Model tokens',\n tokensIn: 'Input',\n tokensOut: 'Output',\n tokensTotal: 'Total',\n tokensNotReported: 'Token usage was not reported.',\n tools: 'Tools called',\n toolCalls: '{count, plural, one {# call} other {# calls}}',\n toolsNotReported: 'No tool calls were reported.',\n nodes: 'Steps of this run',\n output: 'Output of {node}',\n notReported: 'not reported',\n loading: 'Loading runs',\n loadError: 'Runs could not be loaded: {message}',\n retry: 'Try again',\n empty: 'This flow has not been run yet.',\n runRow: 'Run started {time}',\n compact: 'Switch to compact view',\n statusChanged: 'Run {status}',\n },\n 'pt-BR': {\n title: 'Detalhes da execução',\n close: 'Fechar detalhes da execução',\n tabs: 'Visões da execução',\n live: 'Ao vivo',\n history: 'Histórico',\n idleHint: 'Inicie uma execução para acompanhá-la aqui, passo a passo.',\n back: 'Voltar às execuções',\n totalDuration: 'Duração total',\n nodeCount: 'Passos',\n succeeded: 'Concluídos',\n errors: '{count, plural, =0 {Nenhum erro} one {# erro} other {# erros}}',\n errorsTerm: 'Erros',\n tokens: 'Tokens do modelo',\n tokensIn: 'Entrada',\n tokensOut: 'Saída',\n tokensTotal: 'Total',\n tokensNotReported: 'O uso de tokens não foi informado.',\n tools: 'Ferramentas chamadas',\n toolCalls: '{count, plural, one {# chamada} other {# chamadas}}',\n toolsNotReported: 'Nenhuma chamada de ferramenta foi informada.',\n nodes: 'Passos desta execução',\n output: 'Saída de {node}',\n notReported: 'não informado',\n loading: 'Carregando execuções',\n loadError: 'Não foi possível carregar as execuções: {message}',\n retry: 'Tentar de novo',\n empty: 'Este fluxo ainda não foi executado.',\n runRow: 'Execução iniciada {time}',\n compact: 'Mudar para a visão compacta',\n statusChanged: 'Execução {status}',\n },\n es: {\n title: 'Detalles de la ejecución',\n close: 'Cerrar detalles de la ejecución',\n tabs: 'Vistas de la ejecución',\n live: 'En vivo',\n history: 'Historial',\n idleHint: 'Inicie una ejecución para seguirla aquí, paso a paso.',\n back: 'Volver a las ejecuciones',\n totalDuration: 'Duración total',\n nodeCount: 'Pasos',\n succeeded: 'Completados',\n errors: '{count, plural, =0 {Sin errores} one {# error} other {# errores}}',\n errorsTerm: 'Errores',\n tokens: 'Tokens del modelo',\n tokensIn: 'Entrada',\n tokensOut: 'Salida',\n tokensTotal: 'Total',\n tokensNotReported: 'No se informó el uso de tokens.',\n tools: 'Herramientas llamadas',\n toolCalls: '{count, plural, one {# llamada} other {# llamadas}}',\n toolsNotReported: 'No se informaron llamadas a herramientas.',\n nodes: 'Pasos de esta ejecución',\n output: 'Salida de {node}',\n notReported: 'no informado',\n loading: 'Cargando ejecuciones',\n loadError: 'No se pudieron cargar las ejecuciones: {message}',\n retry: 'Reintentar',\n empty: 'Este flujo aún no se ha ejecutado.',\n runRow: 'Ejecución iniciada {time}',\n compact: 'Cambiar a la vista compacta',\n statusChanged: 'Ejecución {status}',\n },\n})\nexport const defaultRunDrawerLabels: RunDrawerLabels = runDrawerLabels.bundles.en\n\nexport type RunDrawerTab = 'live' | 'history'\n\nexport interface RunDrawerProps {\n open: boolean\n onClose: () => void\n flowId: string\n isRunning: boolean\n /** Engine status of the current run; normalised to idle, running, completed or failed. */\n runStatus: string\n loadRuns: LoadRuns\n labels?: Partial<RunDrawerLabels>\n statusLabels?: Partial<RunWordLabels>\n tab?: RunDrawerTab\n onTabChange?: (tab: RunDrawerTab) => void\n selectedRunId?: string | null\n onSelectedRunChange?: (id: string | null) => void\n /** Node whose output is expanded (the failing node on a failed run). */\n selectedNodeId?: string | null\n onSelectedNodeChange?: (id: string | null) => void\n /** Shows the \"compact view\" control that switches to RunPreviewPanel. */\n onCompact?: () => void\n returnFocusTo?: HTMLElement | null\n}\n\nexport function RunDrawer(props: RunDrawerProps) {\n if (!props.open) return null\n return <DrawerBody {...props} />\n}\n\nfunction drawerWord(status: string, isRunning: boolean): 'idle' | 'running' | 'completed' | 'failed' {\n if (isRunning) return 'running'\n const w = runWordOf(status)\n return w === 'running' || w === 'completed' || w === 'failed' ? w : 'idle'\n}\n\nfunction DrawerBody(props: RunDrawerProps) {\n const { onClose, flowId, isRunning, runStatus, loadRuns, labels, statusLabels, onCompact, returnFocusTo } = props\n const l = useLabels(runDrawerLabels, labels)\n const words = useLabels(runWordLabels, statusLabels)\n const { locale } = useFlowLocale()\n const [tab, setTab] = useControllable<RunDrawerTab>(props.tab, 'live', props.onTabChange)\n const [runId, setRunId] = useControllable<string | null>(props.selectedRunId, null, props.onSelectedRunChange)\n const [expandedNode, setExpandedNode] = useControllable<string | null>(props.selectedNodeId, null, props.onSelectedNodeChange)\n const nodes = useFlowEditorState((s) => s.nodes)\n const results = useFlowEditorState((s) => s.nodeResults)\n const history = useRunHistory(flowId, loadRuns, tab === 'history')\n const rowRefs = useRef(new Map<string, HTMLButtonElement>())\n const lastSelected = useRef<string | null>(null)\n const word = drawerWord(runStatus, isRunning)\n const [announcement, setAnnouncement] = useState('')\n\n // A new run takes the drawer to Live and clears any history selection.\n useTransition(isRunning, false, true, () => {\n setTab('live')\n setRunId(null)\n })\n const firstWord = useRef(true)\n useEffect(() => {\n if (firstWord.current) {\n firstWord.current = false\n return\n }\n setAnnouncement(fill(l.statusChanged, { status: words[word] }, locale))\n // Announce status changes only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [word])\n\n const liveRows: RunNodeResult[] = nodes\n .filter((n) => !NON_EXECUTABLE_KINDS.includes(n.kind) && results[n.id])\n .map((n) => {\n const r = results[n.id]!\n return { nodeId: n.id, label: typeof n.data.label === 'string' ? n.data.label : undefined, kind: n.kind, status: r.status, ...(r.durationMs !== undefined ? { durationMs: r.durationMs } : {}), ...(r.error ? { error: r.error } : {}), outputs: r.data }\n })\n const selectedRun = runId ? history.runs.find((r) => r.id === runId) : undefined\n const back = () => {\n const target = lastSelected.current\n setRunId(null)\n requestAnimationFrame(() => (target ? rowRefs.current.get(target)?.focus() : undefined))\n }\n\n return (\n <DockedPanel\n title={l.title}\n landmark=\"complementary\"\n edge=\"end\"\n icon={<Workflow />}\n onClose={onClose}\n closeLabel={l.close}\n returnFocusTo={returnFocusTo ?? null}\n className=\"ty-run-drawer\"\n data={{ 'data-status': word }}\n actions={\n <>\n <RunStatusMark status={word} labels={statusLabels} className=\"ty-run-drawer__status\" />\n {onCompact ? <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={l.compact} leadingIcon={<Minimize2 />} onPress={onCompact} className=\"ty-run-switch\" /> : null}\n </>\n }\n >\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {announcement}\n </p>\n <Tabs label={l.tabs} tabs={[{ id: 'live', label: l.live }, { id: 'history', label: l.history }]} selectedKey={tab} onSelectionChange={(k) => setTab(k as RunDrawerTab)}>\n <TabPanel id=\"live\">\n {liveRows.length === 0 && !isRunning ? (\n <p className=\"ty-run-empty\">{l.idleHint}</p>\n ) : (\n <RunDetail rows={liveRows} total={undefined} failed={word === 'failed'} labels={l} statusLabels={statusLabels} locale={locale} expanded={expandedNode} onExpanded={setExpandedNode} />\n )}\n </TabPanel>\n <TabPanel id=\"history\">\n {selectedRun ? (\n <div className=\"ty-run-drawer__run\">\n <Button variant=\"quiet\" size=\"compact\" leadingIcon={<ArrowLeft className=\"ty-run-mirror\" />} onPress={back}>\n {l.back}\n </Button>\n <RunDetail\n rows={selectedRun.nodeResults ?? []}\n total={selectedRun.durationMs}\n failed={runWordOf(selectedRun.status) === 'failed'}\n labels={l}\n statusLabels={statusLabels}\n locale={locale}\n expanded={expandedNode}\n onExpanded={setExpandedNode}\n />\n </div>\n ) : (\n <HistoryList\n history={history}\n labels={l}\n statusLabels={statusLabels}\n locale={locale}\n rowRefs={rowRefs.current}\n onSelect={(run) => {\n lastSelected.current = run.id\n setRunId(run.id)\n }}\n />\n )}\n </TabPanel>\n </Tabs>\n </DockedPanel>\n )\n}\n\nfunction HistoryList({\n history,\n labels: l,\n statusLabels,\n locale,\n rowRefs,\n onSelect,\n}: {\n history: ReturnType<typeof useRunHistory>\n labels: RunDrawerLabels\n statusLabels?: Partial<RunWordLabels>\n locale: string\n rowRefs: Map<string, HTMLButtonElement>\n onSelect: (run: RunSummary) => void\n}) {\n if (history.state === 'loading' || history.state === 'idle') {\n return (\n <div aria-busy=\"true\" role=\"status\" className=\"ty-run-loading\">\n <Spinner size=\"small\" label={l.loading} showLabel />\n </div>\n )\n }\n if (history.state === 'error') {\n return (\n <div className=\"ty-run-load-error\" role=\"alert\">\n <p>{fill(l.loadError, { message: history.error ?? '' }, locale)}</p>\n <Button size=\"compact\" onPress={history.retry}>\n {l.retry}\n </Button>\n </div>\n )\n }\n if (!history.runs.length) return <p className=\"ty-run-empty\">{l.empty}</p>\n return (\n <ul className=\"ty-run-items\">\n {history.runs.map((run) => (\n <li key={run.id}>\n <button\n type=\"button\"\n className=\"ty-run-item\"\n data-status={runWordOf(run.status)}\n ref={(el) => {\n if (el) rowRefs.set(run.id, el)\n }}\n onClick={() => onSelect(run)}\n >\n <RunStatusMark status={run.status} labels={statusLabels} />\n <span className=\"ty-run-item__name\">{fill(l.runRow, { time: formatDateTime(run.startedAt, locale) }, locale)}</span>\n <span className=\"ty-run-item__meta\">{run.durationMs === undefined ? l.notReported : formatDuration(run.durationMs, locale)}</span>\n </button>\n </li>\n ))}\n </ul>\n )\n}\n\nfunction RunDetail({\n rows,\n total,\n failed,\n labels: l,\n statusLabels,\n locale,\n expanded,\n onExpanded,\n}: {\n rows: readonly RunNodeResult[]\n total: number | undefined\n failed: boolean\n labels: RunDrawerLabels\n statusLabels?: Partial<RunWordLabels>\n locale: string\n expanded: string | null\n onExpanded: (id: string | null) => void\n}) {\n const baseId = useId()\n const succeeded = rows.filter((r) => runWordOf(r.status) === 'completed').length\n const errorCount = rows.filter((r) => runWordOf(r.status) === 'failed').length\n const totalMs = total ?? rows.reduce((sum, r) => sum + (r.durationMs ?? 0), 0)\n const outputs = rows.map((r) => r.outputs)\n const tokens = sumTokens(outputs)\n const tools = countTools(outputs)\n const firstFailing = rows.find((r) => runWordOf(r.status) === 'failed')?.nodeId ?? null\n // A failed run opens with the failing node expanded.\n const [autoOpened, setAutoOpened] = useState(false)\n useEffect(() => {\n if (failed && firstFailing && !autoOpened && expanded === null) {\n setAutoOpened(true)\n onExpanded(firstFailing)\n }\n }, [failed, firstFailing, autoOpened, expanded, onExpanded])\n const num = (v: number) => formatNumber(v, locale)\n\n return (\n <div className=\"ty-run-detail\" data-failed={failed || undefined}>\n {failed ? <div className=\"ty-run-detail__band\" aria-hidden=\"true\" /> : null}\n <dl className=\"ty-run-metrics\">\n <div className=\"ty-run-metric\">\n <dt>{l.totalDuration}</dt>\n <dd>{formatDuration(totalMs, locale)}</dd>\n </div>\n <div className=\"ty-run-metric\">\n <dt>{l.nodeCount}</dt>\n <dd>{num(rows.length)}</dd>\n </div>\n <div className=\"ty-run-metric\">\n <dt>{l.succeeded}</dt>\n <dd>{num(succeeded)}</dd>\n </div>\n <div className=\"ty-run-metric\" data-tone={errorCount > 0 ? 'danger' : undefined}>\n <dt className=\"ty-visually-hidden\">{l.errorsTerm}</dt>\n <dd className=\"ty-run-metric__errors\">\n {errorCount > 0 ? <CircleAlert aria-hidden=\"true\" focusable=\"false\" /> : null}\n {fill(l.errors, { count: errorCount }, locale)}\n </dd>\n </div>\n </dl>\n\n <section className=\"ty-run-section\" aria-labelledby={`${baseId}-tokens`}>\n <h3 id={`${baseId}-tokens`} className=\"ty-run-section__title\">\n {l.tokens}\n </h3>\n {tokens ? (\n <dl className=\"ty-run-facts\" data-testid=\"run-tokens\">\n <div>\n <dt>{l.tokensIn}</dt>\n <dd>{num(tokens.input)}</dd>\n </div>\n <div>\n <dt>{l.tokensOut}</dt>\n <dd>{num(tokens.output)}</dd>\n </div>\n <div>\n <dt>{l.tokensTotal}</dt>\n <dd>{num(tokens.total)}</dd>\n </div>\n </dl>\n ) : (\n <p className=\"ty-run-hint\">{l.tokensNotReported}</p>\n )}\n </section>\n\n <section className=\"ty-run-section\" aria-labelledby={`${baseId}-tools`}>\n <h3 id={`${baseId}-tools`} className=\"ty-run-section__title\">\n {l.tools}\n </h3>\n {tools ? (\n <ul className=\"ty-run-tools\">\n {tools.map((t) => (\n <li key={t.name}>\n <code className=\"ty-run-mono\">{t.name}</code> <span>{fill(l.toolCalls, { count: t.count }, locale)}</span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"ty-run-hint\">{l.toolsNotReported}</p>\n )}\n </section>\n\n <section className=\"ty-run-section\" aria-labelledby={`${baseId}-nodes`}>\n <h3 id={`${baseId}-nodes`} className=\"ty-run-section__title\">\n {l.nodes}\n </h3>\n <ul className=\"ty-run-rows\">\n {rows.map((r) => {\n const open = expanded === r.nodeId\n const panelId = `${baseId}-${r.nodeId}`\n return (\n <li key={r.nodeId} className=\"ty-run-row\" data-status={runWordOf(r.status)}>\n <button type=\"button\" className=\"ty-run-row__toggle\" aria-expanded={open} aria-controls={panelId} onClick={() => onExpanded(open ? null : r.nodeId)}>\n <ChevronRight className=\"ty-run-row__chevron ty-run-mirror\" aria-hidden=\"true\" focusable=\"false\" />\n <RunStatusMark status={r.status} labels={statusLabels} />\n <span className=\"ty-run-row__label\">{r.label ?? r.nodeId}</span>\n {r.kind ? <span className=\"ty-run-row__kind\">{r.kind}</span> : null}\n <span className=\"ty-run-row__duration\">{r.durationMs === undefined ? l.notReported : formatDuration(r.durationMs, locale)}</span>\n </button>\n {r.error ? <p className=\"ty-run-row__error\">{r.error}</p> : null}\n {open ? (\n <pre id={panelId} className=\"ty-run-output\" tabIndex={0} aria-label={fill(l.output, { node: r.label ?? r.nodeId }, locale)}>\n {r.outputs === undefined ? l.notReported : prettyValue(r.outputs)}\n </pre>\n ) : null}\n </li>\n )\n })}\n </ul>\n </section>\n </div>\n )\n}\n","// RunPreviewPanel: the compact floating run view. Live node results while a\n// run executes, then the recent history with drill-down to one node's output.\n\nimport { useEffect, useRef, useState } from 'react'\nimport { Maximize2, X } from 'lucide-react'\nimport { Button, Spinner } from '../../index'\nimport { DockedPanel } from '../internal/DockedPanel'\nimport { formatDateTime, formatDuration } from '../internal/format'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport { useFlowEditorState } from '../state/editorState'\nimport { NON_EXECUTABLE_KINDS } from './RunPanel'\nimport { RunStatusMark, runWordOf, type RunWordLabels } from './RunStatusMark'\nimport { prettyValue, useRunHistory, useTransition } from './runData'\nimport type { LoadRuns, RunNodeResult } from './types'\n\nexport interface RunPreviewPanelLabels {\n title: string\n close: string\n live: string\n history: string\n liveSummary: string\n nodeDetail: string\n closeDetail: string\n outputs: string\n duration: string\n notReported: string\n empty: string\n loading: string\n error: string\n retry: string\n expand: string\n runRow: string\n}\n\nexport const runPreviewPanelLabels = defineLabels<RunPreviewPanelLabels>('run-preview-panel', {\n en: {\n title: 'Run preview',\n close: 'Close run preview',\n live: 'Live results',\n history: 'Recent runs',\n liveSummary: '{done} of {total} steps finished',\n nodeDetail: 'Result of {node}',\n closeDetail: 'Close result',\n outputs: 'Outputs',\n duration: 'Duration',\n notReported: 'not reported',\n empty: 'This flow has not been run yet.',\n loading: 'Loading runs',\n error: 'Runs could not be loaded: {message}',\n retry: 'Try again',\n expand: 'Open full run details',\n runRow: 'Run started {time}',\n },\n 'pt-BR': {\n title: 'Prévia da execução',\n close: 'Fechar prévia da execução',\n live: 'Resultados ao vivo',\n history: 'Execuções recentes',\n liveSummary: '{done} de {total} passos concluídos',\n nodeDetail: 'Resultado de {node}',\n closeDetail: 'Fechar resultado',\n outputs: 'Saídas',\n duration: 'Duração',\n notReported: 'não informado',\n empty: 'Este fluxo ainda não foi executado.',\n loading: 'Carregando execuções',\n error: 'Não foi possível carregar as execuções: {message}',\n retry: 'Tentar de novo',\n expand: 'Abrir detalhes completos',\n runRow: 'Execução iniciada {time}',\n },\n es: {\n title: 'Vista previa de la ejecución',\n close: 'Cerrar vista previa de la ejecución',\n live: 'Resultados en vivo',\n history: 'Ejecuciones recientes',\n liveSummary: '{done} de {total} pasos terminados',\n nodeDetail: 'Resultado de {node}',\n closeDetail: 'Cerrar resultado',\n outputs: 'Salidas',\n duration: 'Duración',\n notReported: 'no informado',\n empty: 'Este flujo aún no se ha ejecutado.',\n loading: 'Cargando ejecuciones',\n error: 'No se pudieron cargar las ejecuciones: {message}',\n retry: 'Reintentar',\n expand: 'Abrir detalles completos',\n runRow: 'Ejecución iniciada {time}',\n },\n})\nexport const defaultRunPreviewPanelLabels: RunPreviewPanelLabels = runPreviewPanelLabels.bundles.en\n\nexport interface RunPreviewPanelProps {\n open: boolean\n onClose: () => void\n flowId: string\n loadRuns: LoadRuns\n labels?: Partial<RunPreviewPanelLabels>\n statusLabels?: Partial<RunWordLabels>\n /** Selected run (null: live results). Shared with RunDrawer through RunViews. */\n selectedRunId?: string | null\n onSelectedRunChange?: (id: string | null) => void\n selectedNodeId?: string | null\n onSelectedNodeChange?: (id: string | null) => void\n /** Shows the \"expand\" control that switches to the drawer. */\n onExpand?: () => void\n returnFocusTo?: HTMLElement | null\n}\n\nexport function RunPreviewPanel(props: RunPreviewPanelProps) {\n if (!props.open) return null\n return <PreviewBody {...props} />\n}\n\nfunction PreviewBody(props: RunPreviewPanelProps) {\n const { onClose, flowId, loadRuns, labels, statusLabels, onExpand, returnFocusTo } = props\n const l = useLabels(runPreviewPanelLabels, labels)\n const { locale } = useFlowLocale()\n const [runId, setRunId] = useControllable<string | null>(props.selectedRunId, null, props.onSelectedRunChange)\n const [nodeId, setNodeId] = useControllable<string | null>(props.selectedNodeId, null, props.onSelectedNodeChange)\n const isRunning = useFlowEditorState((s) => s.isRunning)\n const nodes = useFlowEditorState((s) => s.nodes)\n const results = useFlowEditorState((s) => s.nodeResults)\n const [finished, setFinished] = useState(0)\n useTransition(isRunning, true, false, () => setFinished((f) => f + 1))\n const history = useRunHistory(flowId, loadRuns, true, finished)\n const detailHeading = useRef<HTMLHeadingElement>(null)\n const rowRefs = useRef(new Map<string, HTMLButtonElement>())\n\n const live: RunNodeResult[] = nodes\n .filter((n) => !NON_EXECUTABLE_KINDS.includes(n.kind) && results[n.id])\n .map((n) => {\n const r = results[n.id]!\n return { nodeId: n.id, label: typeof n.data.label === 'string' ? n.data.label : undefined, kind: n.kind, status: r.status, ...(r.durationMs !== undefined ? { durationMs: r.durationMs } : {}), ...(r.error ? { error: r.error } : {}), outputs: r.data }\n })\n const selectedRun = runId ? history.runs.find((r) => r.id === runId) : undefined\n const detail: RunNodeResult | undefined = nodeId ? (selectedRun ? selectedRun.nodeResults?.find((n) => n.nodeId === nodeId) : live.find((n) => n.nodeId === nodeId)) : undefined\n\n useEffect(() => {\n if (detail) detailHeading.current?.focus()\n // Only when the selected node changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [nodeId])\n\n const dur = (ms?: number) => (ms === undefined ? l.notReported : formatDuration(ms, locale))\n const doneCount = live.filter((r) => r.status === 'success' || r.status === 'error').length\n\n const closeDetail = () => {\n const back = nodeId ? rowRefs.current.get(`${runId ?? 'live'}:${nodeId}`) : null\n setNodeId(null)\n requestAnimationFrame(() => back?.focus())\n }\n\n const nodeRow = (scope: string, r: RunNodeResult) => (\n <li key={r.nodeId}>\n <button\n type=\"button\"\n className=\"ty-run-item\"\n ref={(el) => {\n if (el) rowRefs.current.set(`${scope}:${r.nodeId}`, el)\n }}\n data-selected={nodeId === r.nodeId || undefined}\n onClick={() => setNodeId(r.nodeId)}\n >\n <RunStatusMark status={r.status} labels={statusLabels} />\n <span className=\"ty-run-item__name\">{r.label ?? r.nodeId}</span>\n <span className=\"ty-run-item__meta\">{dur(r.durationMs)}</span>\n </button>\n </li>\n )\n\n return (\n <DockedPanel\n title={l.title}\n edge=\"float\"\n onClose={onClose}\n closeLabel={l.close}\n returnFocusTo={returnFocusTo ?? null}\n className=\"ty-run-preview\"\n actions={\n onExpand ? (\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={l.expand} leadingIcon={<Maximize2 />} onPress={onExpand} className=\"ty-run-switch\" />\n ) : null\n }\n >\n {isRunning ? (\n <section className=\"ty-run-section\" aria-label={l.live}>\n <h3 className=\"ty-run-section__title\">{l.live}</h3>\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {fill(l.liveSummary, { done: doneCount, total: nodes.filter((n) => !NON_EXECUTABLE_KINDS.includes(n.kind)).length }, locale)}\n </p>\n <ul className=\"ty-run-items\">{live.map((r) => nodeRow('live', r))}</ul>\n </section>\n ) : null}\n\n {detail ? (\n <section className=\"ty-run-detail\" aria-labelledby=\"ty-run-preview-detail\">\n <div className=\"ty-run-detail__head\">\n <h3 id=\"ty-run-preview-detail\" ref={detailHeading} tabIndex={-1} className=\"ty-run-section__title\">\n {fill(l.nodeDetail, { node: detail.label ?? detail.nodeId })}\n </h3>\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={l.closeDetail} leadingIcon={<X />} onPress={closeDetail} />\n </div>\n <dl className=\"ty-run-facts\">\n <div>\n <dt>{l.duration}</dt>\n <dd>{dur(detail.durationMs)}</dd>\n </div>\n </dl>\n <RunStatusMark status={detail.status} labels={statusLabels} />\n {detail.error ? <p className=\"ty-run-error\">{detail.error}</p> : null}\n <h4 className=\"ty-run-subtitle\">{l.outputs}</h4>\n <pre className=\"ty-run-output\" tabIndex={0} aria-label={l.outputs}>\n {detail.outputs === undefined ? l.notReported : prettyValue(detail.outputs)}\n </pre>\n </section>\n ) : null}\n\n <section className=\"ty-run-section\" aria-label={l.history} aria-busy={history.state === 'loading' || undefined}>\n <h3 className=\"ty-run-section__title\">{l.history}</h3>\n {history.state === 'loading' ? (\n <p role=\"status\" className=\"ty-run-loading\">\n <Spinner size=\"small\" label={l.loading} showLabel />\n </p>\n ) : history.state === 'error' ? (\n <div className=\"ty-run-load-error\" role=\"alert\">\n <p>{fill(l.error, { message: history.error ?? '' })}</p>\n <Button size=\"compact\" onPress={history.retry}>\n {l.retry}\n </Button>\n </div>\n ) : history.runs.length === 0 && history.state === 'ready' ? (\n <p className=\"ty-run-empty\">{l.empty}</p>\n ) : (\n <ul className=\"ty-run-items\">\n {history.runs.map((run) => {\n const expanded = runId === run.id\n return (\n <li key={run.id} className=\"ty-run-history-item\">\n <button\n type=\"button\"\n className=\"ty-run-item\"\n aria-expanded={expanded}\n aria-controls={`ty-run-${run.id}`}\n data-status={runWordOf(run.status)}\n onClick={() => {\n setRunId(expanded ? null : run.id)\n setNodeId(null)\n }}\n >\n <RunStatusMark status={run.status} labels={statusLabels} />\n <span className=\"ty-run-item__name\">{fill(l.runRow, { time: formatDateTime(run.startedAt, locale) })}</span>\n <span className=\"ty-run-item__meta\">{dur(run.durationMs)}</span>\n </button>\n {expanded ? (\n <ul id={`ty-run-${run.id}`} className=\"ty-run-items ty-run-items--nested\">\n {(run.nodeResults ?? []).map((r) => nodeRow(run.id, r))}\n </ul>\n ) : null}\n </li>\n )\n })}\n </ul>\n )}\n </section>\n </DockedPanel>\n )\n}\n","// RunViewModes: RunPreviewPanel (compact, floating) and RunDrawer (full,\n// docked) as two modes of one feature. The selected run, the selected node and\n// the drawer tab live here, so switching mode keeps them.\n\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport { useMediaQuery } from '../../index'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport { useFlowEditorState } from '../state/editorState'\nimport { RunDrawer, type RunDrawerLabels, type RunDrawerTab } from './RunDrawer'\nimport { RunPreviewPanel, type RunPreviewPanelLabels } from './RunPreviewPanel'\nimport type { RunWordLabels } from './RunStatusMark'\nimport { useTransition } from './runData'\nimport type { LoadRuns } from './types'\n\nexport type RunViewMode = 'panel' | 'drawer'\n\nexport interface RunViewState {\n mode: RunViewMode\n open: boolean\n}\n\nexport interface PreferredRunModeStore {\n get(): RunViewMode | null\n set(mode: RunViewMode): void\n}\n\nexport interface RunViewsLabels {\n nowPanel: string\n nowDrawer: string\n}\n\nexport const runViewsLabels = defineLabels<RunViewsLabels>('run-views', {\n en: { nowPanel: 'Showing the compact run view', nowDrawer: 'Showing the full run details' },\n 'pt-BR': { nowPanel: 'Mostrando a visão compacta da execução', nowDrawer: 'Mostrando os detalhes completos da execução' },\n es: { nowPanel: 'Mostrando la vista compacta de la ejecución', nowDrawer: 'Mostrando los detalles completos de la ejecución' },\n})\nexport const defaultRunViewsLabels: RunViewsLabels = runViewsLabels.bundles.en\n\nexport interface RunViewsProps {\n flowId: string\n loadRuns: LoadRuns\n runView?: RunViewState\n defaultRunView?: RunViewState\n onRunViewChange?: (next: RunViewState) => void\n /** Open the current mode when a run starts. */\n openOnRun?: boolean\n preferredModeStore?: PreferredRunModeStore\n labels?: Partial<RunViewsLabels> & { panel?: Partial<RunPreviewPanelLabels>; drawer?: Partial<RunDrawerLabels> }\n statusLabels?: Partial<RunWordLabels>\n /** Element focus returns to when a view closes (the run details button). */\n opener?: HTMLElement | null\n /** Engine status of the current run; derived from node results when absent. */\n runStatus?: string\n}\n\nconst CLOSED: RunViewState = { mode: 'drawer', open: false }\n\nexport function RunViews(props: RunViewsProps) {\n const { flowId, loadRuns, openOnRun = false, preferredModeStore, labels, statusLabels, opener } = props\n const l = useLabels(runViewsLabels, labels)\n const wide = useMediaQuery('(min-width: 1024px)', true)\n const [view, setView] = useControllable<RunViewState>(props.runView, props.defaultRunView ?? CLOSED, props.onRunViewChange)\n const isRunning = useFlowEditorState((s) => s.isRunning)\n const results = useFlowEditorState((s) => s.nodeResults)\n const [runId, setRunId] = useState<string | null>(null)\n const [nodeId, setNodeId] = useState<string | null>(null)\n const [tab, setTab] = useState<RunDrawerTab>('live')\n const [announcement, setAnnouncement] = useState('')\n const root = useRef<HTMLDivElement>(null)\n const focusSwitch = useRef(false)\n const preferenceApplied = useRef(false)\n\n // First opening follows the person's remembered mode.\n useTransition(view.open, false, true, () => {\n if (preferenceApplied.current || !preferredModeStore) return\n preferenceApplied.current = true\n const remembered = preferredModeStore.get()\n if (remembered && remembered !== view.mode) setView({ mode: remembered, open: true })\n })\n\n useTransition(isRunning, false, true, () => {\n if (openOnRun && !view.open) setView({ ...view, open: true })\n })\n\n // A failure always opens the drawer on the failing node (design direction §3.10).\n const failing = Object.entries(results).find(([, r]) => r.status === 'error')?.[0] ?? null\n const seenFailure = useRef<string | null>(null)\n useEffect(() => {\n if (!failing || failing === seenFailure.current) {\n if (!failing) seenFailure.current = null\n return\n }\n seenFailure.current = failing\n setRunId(null)\n setTab('live')\n setNodeId(failing)\n setView({ mode: 'drawer', open: true })\n // setView identity changes per render; the failing id is the trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [failing])\n\n const switchTo = useCallback(\n (mode: RunViewMode) => {\n focusSwitch.current = true\n if (mode === 'drawer') setTab(runId ? 'history' : 'live')\n preferredModeStore?.set(mode)\n setAnnouncement(mode === 'panel' ? l.nowPanel : l.nowDrawer)\n setView({ mode, open: true })\n },\n [preferredModeStore, l, setView, runId],\n )\n\n useLayoutEffect(() => {\n if (!focusSwitch.current) return\n focusSwitch.current = false\n root.current?.querySelector<HTMLElement>('.ty-run-switch')?.focus()\n })\n\n const close = () => setView({ ...view, open: false })\n const mode: RunViewMode = wide ? view.mode : 'drawer'\n const runStatus = props.runStatus ?? (isRunning ? 'running' : failing ? 'failed' : Object.keys(results).length ? 'completed' : 'idle')\n\n return (\n <div ref={root} className=\"ty-run-views\" data-mode={view.open ? mode : 'closed'}>\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {announcement}\n </p>\n {view.open && mode === 'panel' ? (\n <RunPreviewPanel\n open\n onClose={close}\n flowId={flowId}\n loadRuns={loadRuns}\n labels={labels?.panel}\n statusLabels={statusLabels}\n selectedRunId={runId}\n onSelectedRunChange={setRunId}\n selectedNodeId={nodeId}\n onSelectedNodeChange={setNodeId}\n onExpand={() => switchTo('drawer')}\n returnFocusTo={opener ?? null}\n />\n ) : null}\n {view.open && mode === 'drawer' ? (\n <RunDrawer\n open\n onClose={close}\n flowId={flowId}\n isRunning={isRunning}\n runStatus={runStatus}\n loadRuns={loadRuns}\n labels={labels?.drawer}\n statusLabels={statusLabels}\n tab={tab}\n onTabChange={setTab}\n selectedRunId={runId}\n onSelectedRunChange={(id) => {\n setRunId(id)\n if (id) setTab('history')\n }}\n selectedNodeId={nodeId}\n onSelectedNodeChange={setNodeId}\n {...(wide ? { onCompact: () => switchTo('panel') } : {})}\n returnFocusTo={opener ?? null}\n />\n ) : null}\n </div>\n )\n}\n","// CanvasContextMenus: node, selection and empty-canvas menus on the design\n// system's ActionMenu (context mode, opened at a screen point). Every item\n// closes the menu after acting; closing returns focus to whatever opened it.\n\nimport { useEffect, useRef, type KeyboardEvent } from 'react'\nimport {\n AlignCenterHorizontal,\n AlignCenterVertical,\n AlignEndHorizontal,\n AlignEndVertical,\n AlignHorizontalSpaceAround,\n AlignStartHorizontal,\n AlignStartVertical,\n AlignVerticalSpaceAround,\n ClipboardPaste,\n Copy,\n CopyPlus,\n Group,\n Maximize,\n Pencil,\n SquareDashedMousePointer,\n StickyNote,\n Trash2,\n} from 'lucide-react'\nimport { ActionMenu, type ActionMenuEntry } from '../../index'\nimport type { AlignEdge, DistributeAxis } from '../geometry/arrange'\nimport { FALLBACK_NODE_SIZE } from '../geometry/rect'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport type { FlowNode, Point, Size } from '../model/types'\n\nexport interface CanvasMenuLabels {\n nodeMenu: string\n selectionMenu: string\n canvasMenu: string\n edit: string\n duplicate: string\n copy: string\n delete: string\n group: string\n alignLeft: string\n alignRight: string\n alignTop: string\n alignBottom: string\n centreHorizontal: string\n centreVertical: string\n distributeHorizontal: string\n distributeVertical: string\n paste: string\n selectAll: string\n fitView: string\n addNote: string\n}\n\nexport const canvasMenuLabels = defineLabels<CanvasMenuLabels>('canvasContextMenus', {\n en: {\n nodeMenu: 'Node actions',\n selectionMenu: 'Selection actions',\n canvasMenu: 'Canvas actions',\n edit: 'Edit',\n duplicate: 'Duplicate',\n copy: 'Copy',\n delete: 'Delete',\n group: 'Group selection',\n alignLeft: 'Align to start',\n alignRight: 'Align to end',\n alignTop: 'Align top',\n alignBottom: 'Align bottom',\n centreHorizontal: 'Centre horizontally',\n centreVertical: 'Centre vertically',\n distributeHorizontal: 'Distribute horizontally',\n distributeVertical: 'Distribute vertically',\n paste: 'Paste',\n selectAll: 'Select all',\n fitView: 'Fit to view',\n addNote: 'Add note',\n },\n 'pt-BR': {\n nodeMenu: 'Ações do nó',\n selectionMenu: 'Ações da seleção',\n canvasMenu: 'Ações do canvas',\n edit: 'Editar',\n duplicate: 'Duplicar',\n copy: 'Copiar',\n delete: 'Excluir',\n group: 'Agrupar seleção',\n alignLeft: 'Alinhar ao início',\n alignRight: 'Alinhar ao fim',\n alignTop: 'Alinhar ao topo',\n alignBottom: 'Alinhar à base',\n centreHorizontal: 'Centralizar na horizontal',\n centreVertical: 'Centralizar na vertical',\n distributeHorizontal: 'Distribuir na horizontal',\n distributeVertical: 'Distribuir na vertical',\n paste: 'Colar',\n selectAll: 'Selecionar tudo',\n fitView: 'Ajustar à tela',\n addNote: 'Adicionar nota',\n },\n es: {\n nodeMenu: 'Acciones del nodo',\n selectionMenu: 'Acciones de la selección',\n canvasMenu: 'Acciones del lienzo',\n edit: 'Editar',\n duplicate: 'Duplicar',\n copy: 'Copiar',\n delete: 'Eliminar',\n group: 'Agrupar selección',\n alignLeft: 'Alinear al inicio',\n alignRight: 'Alinear al final',\n alignTop: 'Alinear arriba',\n alignBottom: 'Alinear abajo',\n centreHorizontal: 'Centrar en horizontal',\n centreVertical: 'Centrar en vertical',\n distributeHorizontal: 'Distribuir en horizontal',\n distributeVertical: 'Distribuir en vertical',\n paste: 'Pegar',\n selectAll: 'Seleccionar todo',\n fitView: 'Ajustar a la vista',\n addNote: 'Añadir nota',\n },\n})\n\nexport const defaultCanvasMenuLabels: CanvasMenuLabels = canvasMenuLabels.bundles.en\n\n/** Rendered size of a node, else its declared size, else the documented default. */\nexport function nodeSize(node: Pick<FlowNode, 'measured' | 'size'>, fallback: Size = FALLBACK_NODE_SIZE): Size {\n if (node.measured && node.measured.width > 0 && node.measured.height > 0) return { ...node.measured }\n if (node.size && node.size.width > 0 && node.size.height > 0) return { ...node.size }\n return { ...fallback }\n}\n\n/** True for the keys that open a context menu from the keyboard (Shift+F10, ContextMenu). */\nexport function isContextMenuKey(e: Pick<KeyboardEvent, 'key' | 'shiftKey'>): boolean {\n return e.key === 'ContextMenu' || (e.shiftKey && e.key === 'F10')\n}\n\ninterface MenuBase {\n /** Screen position (pointer, or the focused element's corner). */\n anchor: Point\n onClose: () => void\n labels?: Partial<CanvasMenuLabels>\n}\n\n/** Remembers the element focused when a menu opened and returns focus to it on close. */\nfunction useReturnFocus() {\n const opener = useRef<HTMLElement | null>(null)\n useEffect(() => {\n const el = document.activeElement\n opener.current = el instanceof HTMLElement && el !== document.body ? el : null\n return () => {\n const back = opener.current\n requestAnimationFrame(() => {\n if (back?.isConnected && (!document.activeElement || document.activeElement === document.body)) back.focus()\n })\n }\n }, [])\n}\n\nfunction MenuAt({ anchor, onClose, label, items, run }: { anchor: Point; onClose: () => void; label: string; items: ActionMenuEntry[]; run: (id: string) => void }) {\n useReturnFocus()\n return (\n <ActionMenu\n mode=\"context\"\n open\n position={anchor}\n label={label}\n items={items}\n className=\"ty-canvas-menu\"\n onOpenChange={(open) => {\n if (!open) onClose()\n }}\n onAction={(id) => {\n run(id)\n onClose()\n }}\n />\n )\n}\n\nexport interface NodeContextMenuProps extends MenuBase {\n targetId: string\n onEdit: (id: string) => void\n onDuplicate: (id: string) => void\n onCopy: (id: string) => void\n onDelete: (id: string) => void\n}\n\nexport function NodeContextMenu({ anchor, onClose, targetId, onEdit, onDuplicate, onCopy, onDelete, labels }: NodeContextMenuProps) {\n const l = useLabels(canvasMenuLabels, labels)\n const act: Record<string, (id: string) => void> = { edit: onEdit, duplicate: onDuplicate, copy: onCopy, delete: onDelete }\n return (\n <MenuAt\n anchor={anchor}\n onClose={onClose}\n label={l.nodeMenu}\n run={(id) => act[id]?.(targetId)}\n items={[\n { id: 'edit', label: l.edit, icon: Pencil },\n { id: 'duplicate', label: l.duplicate, icon: CopyPlus },\n { id: 'copy', label: l.copy, icon: Copy },\n { type: 'separator' },\n { id: 'delete', label: l.delete, icon: Trash2, tone: 'danger' },\n ]}\n />\n )\n}\n\nexport interface SelectionContextMenuProps extends MenuBase {\n /** Number of selected nodes: align needs 2, distribute 3. */\n count: number\n onCopy: () => void\n onDuplicate: () => void\n onDelete: () => void\n onGroup: () => void\n onAlign: (direction: AlignEdge) => void\n onDistribute: (axis: DistributeAxis) => void\n}\n\nexport function SelectionContextMenu({ anchor, onClose, count, onCopy, onDuplicate, onDelete, onGroup, onAlign, onDistribute, labels }: SelectionContextMenuProps) {\n const l = useLabels(canvasMenuLabels, labels)\n const run = (id: string) => {\n if (id === 'copy') onCopy()\n else if (id === 'duplicate') onDuplicate()\n else if (id === 'delete') onDelete()\n else if (id === 'group') onGroup()\n else if (id.startsWith('align:')) onAlign(id.slice(6) as AlignEdge)\n else if (id.startsWith('distribute:')) onDistribute(id.slice(11) as DistributeAxis)\n }\n return (\n <MenuAt\n anchor={anchor}\n onClose={onClose}\n label={l.selectionMenu}\n run={run}\n items={[\n { id: 'copy', label: l.copy, icon: Copy },\n { id: 'duplicate', label: l.duplicate, icon: CopyPlus },\n { id: 'group', label: l.group, icon: Group, disabled: count < 2 },\n { id: 'delete', label: l.delete, icon: Trash2, tone: 'danger' },\n { type: 'separator' },\n { id: 'align:left', label: l.alignLeft, icon: AlignStartVertical, disabled: count < 2 },\n { id: 'align:right', label: l.alignRight, icon: AlignEndVertical, disabled: count < 2 },\n { id: 'align:top', label: l.alignTop, icon: AlignStartHorizontal, disabled: count < 2 },\n { id: 'align:bottom', label: l.alignBottom, icon: AlignEndHorizontal, disabled: count < 2 },\n { id: 'align:centerHorizontal', label: l.centreHorizontal, icon: AlignCenterVertical, disabled: count < 2 },\n { id: 'align:centerVertical', label: l.centreVertical, icon: AlignCenterHorizontal, disabled: count < 2 },\n { type: 'separator' },\n { id: 'distribute:horizontal', label: l.distributeHorizontal, icon: AlignHorizontalSpaceAround, disabled: count < 3 },\n { id: 'distribute:vertical', label: l.distributeVertical, icon: AlignVerticalSpaceAround, disabled: count < 3 },\n ]}\n />\n )\n}\n\nexport interface CanvasBackgroundMenuProps extends MenuBase {\n canvasPosition: Point\n hasClipboardContent: boolean\n onPaste: () => void\n onSelectAll: () => void\n onFitView: () => void\n onAddNote: (canvasPosition: Point) => void\n}\n\nexport function CanvasBackgroundMenu({ anchor, onClose, canvasPosition, hasClipboardContent, onPaste, onSelectAll, onFitView, onAddNote, labels }: CanvasBackgroundMenuProps) {\n const l = useLabels(canvasMenuLabels, labels)\n const run = (id: string) => {\n if (id === 'paste') onPaste()\n else if (id === 'select-all') onSelectAll()\n else if (id === 'fit') onFitView()\n else if (id === 'note') onAddNote(canvasPosition)\n }\n return (\n <MenuAt\n anchor={anchor}\n onClose={onClose}\n label={l.canvasMenu}\n run={run}\n items={[\n { id: 'paste', label: l.paste, icon: ClipboardPaste, disabled: !hasClipboardContent },\n { id: 'select-all', label: l.selectAll, icon: SquareDashedMousePointer },\n { id: 'fit', label: l.fitView, icon: Maximize },\n { type: 'separator' },\n { id: 'note', label: l.addNote, icon: StickyNote },\n ]}\n />\n )\n}\n","const TABBABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\n/** Focuses the first tabbable element after `container` in document order (never traps focus). */\nexport function focusAfter(container: Element | null): boolean {\n if (!container) return false\n const all = [...document.querySelectorAll<HTMLElement>(TABBABLE)]\n const next = all.find((el) => !container.contains(el) && container.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING)\n if (next) {\n next.focus()\n return true\n }\n return false\n}\n\n/** Focuses the canvas's exit target (the tool bar), else the next element after the canvas. */\nexport function leaveCanvas(scope: Element | null): void {\n const exit = scope?.querySelector<HTMLElement>('[data-ty-canvas-exit] button, [data-ty-canvas-exit] [tabindex]')\n if (exit) {\n exit.focus()\n return\n }\n focusAfter(scope)\n}\n","// The editor's single meeting point with the node and connector groups: which\n// component draws a kind, sizes before measurement, port anchors, connection\n// rules and connector drawing. Hosts replace renderers through FlowEditor's\n// `extraNodeKinds`; the canvas code only talks to this module.\n\nimport type { ReactNode } from 'react'\nimport type { RenderCatalog } from '../catalog/RenderCatalog'\nimport { renderConditionalConnector, splitConnector } from '../connectors/ConditionalConnector'\nimport type { FlowConnector, FlowNode, LayoutDirection, Size } from '../model/types'\nimport { AlignmentGuidesOverlay } from '../nodes/AlignmentGuides'\nimport type { CardDensity } from '../nodes/GraphNodeCard'\nimport { canConnect, declaredNodeSize, nodeAccessibleName, nodeComponentFor, portAnchorFor } from '../nodes/registry'\nimport type { FlowNodeComponent } from '../nodes/types'\nimport type { ConnectorParts, ConnectorShape, PortAnchor } from '../surface/types'\n\n/** Title of a node: per-instance label, then identity, then catalog label, then kind. */\nexport function nodeTitle(node: FlowNode, catalog: RenderCatalog): string {\n const label = typeof node.data.label === 'string' && node.data.label ? node.data.label : undefined\n return label ?? catalog.identity(node.kind, node.data)?.title ?? catalog.entry(node.kind)?.label ?? node.kind\n}\n\n/** \"kind: title\", for lists, menus and announcements. */\nexport const nodeName = (node: FlowNode, catalog: RenderCatalog): string => nodeAccessibleName(node, catalog)\n\nexport const componentForKind = (kind: string, extra?: Record<string, FlowNodeComponent>): FlowNodeComponent => nodeComponentFor(kind, extra)\n\nexport const sizeForNode = (node: FlowNode, density: CardDensity): Size => declaredNodeSize(node, density)\n\nexport const anchorFor = (node: FlowNode, portId: string | undefined, role: 'source' | 'target', direction: LayoutDirection, catalog: RenderCatalog): PortAnchor =>\n portAnchorFor(node, portId, role, direction, catalog)\n\nexport const connectionAllowed = (source: FlowNode, target: FlowNode, sourcePort?: string, targetPort?: string): boolean => canConnect(source, target, sourcePort, targetPort)\n\nexport interface ConnectorRenderOptions {\n sourceName: string\n targetName: string\n locked: boolean\n selected: boolean\n active?: boolean\n onSelect: (id: string) => void\n onDelete: (id: string) => void\n onInsertStep: (id: string, kind: string, point: { x: number; y: number }) => void\n onOpenInsertPicker?: (connectorId: string, point: { x: number; y: number }) => void\n insertableKinds?: Array<{ kind: string; label: string }>\n}\n\nexport function renderConnectorParts(connector: FlowConnector, shape: ConnectorShape, o: ConnectorRenderOptions): ConnectorParts {\n return renderConditionalConnector(connector, shape, {\n sourceName: o.sourceName,\n targetName: o.targetName,\n locked: o.locked,\n selected: o.selected,\n ...(o.active ? { active: true } : {}),\n onSelect: o.onSelect,\n onDelete: o.onDelete,\n onInsertStep: o.onInsertStep,\n ...(o.onOpenInsertPicker ? { onOpenInsertPicker: o.onOpenInsertPicker } : {}),\n ...(o.insertableKinds ? { insertableKinds: o.insertableKinds } : {}),\n })\n}\n\nexport const splitConnectorThrough = (connectors: FlowConnector[], id: string, newNodeId: string): FlowConnector[] => splitConnector(connectors, id, newNodeId)\n\nexport function guideOverlay(guides: { horizontal: number | null; vertical: number | null }): ReactNode {\n return <AlignmentGuidesOverlay guides={guides} />\n}\n","// NodePalette: everything that can be placed on the canvas, in collapsible\n// sections, searchable, draggable (React Aria drag and drop) and placeable by\n// keyboard or tap through `onPlace` (Enter on an item).\n\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { Bot, ChevronRight, Database, GripVertical, Plus, Scale, Server } from 'lucide-react'\nimport { Button as AriaButton, Disclosure, DisclosurePanel, GridList, GridListItem, Heading, useDragAndDrop } from 'react-aria-components'\nimport { Button, TextField, type IconComponent } from '../../index'\nimport { useRenderCatalog } from '../catalog/RenderCatalog'\nimport { nodeKindCatalog, PICKER_KINDS, type NodeKindCatalogStore, type NodeKindEntry } from '../catalog/kindCatalog'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useSyncExternalStore } from 'react'\n\n/** Drag payload media type; its data is JSON of PalettePayload. */\nexport const PALETTE_MEDIA_TYPE = 'application/x-tympan-node'\n\nexport interface PalettePayload {\n kind: string\n label: string\n entityId?: string\n config?: Record<string, unknown>\n}\n\nexport interface PaletteAgent {\n id: string\n name: string\n role?: string\n tier?: string\n}\nexport interface PaletteRule {\n id: string\n name: string\n enabled: boolean\n}\nexport interface PaletteEntity {\n id: string\n name: string\n dialect?: string\n}\nexport interface PaletteProvider {\n id: string\n name: string\n configured: boolean\n modelCount: number\n}\n\nexport interface NodePaletteLabels {\n palette: string\n search: string\n results: string\n noResults: string\n agents: string\n rules: string\n dataSources: string\n providers: string\n addAgent: string\n addRule: string\n addDataSource: string\n addProvider: string\n emptyAgents: string\n emptyRules: string\n emptyDataSources: string\n emptyProviders: string\n emptySteps: string\n on: string\n off: string\n configured: string\n needsSetup: string\n models: string\n count: string\n dragItem: string\n}\n\nexport const nodePaletteLabels = defineLabels<NodePaletteLabels>('NodePalette', {\n en: {\n palette: 'Steps to add',\n search: 'Search steps',\n results: '{count, plural, =0 {No results} one {# result} other {# results}}',\n noResults: 'Nothing matches this search',\n agents: 'Agents',\n rules: 'Rules',\n dataSources: 'Data sources',\n providers: 'Model providers',\n addAgent: 'Add agent',\n addRule: 'Add rule',\n addDataSource: 'Add data source',\n addProvider: 'Add model provider',\n emptyAgents: 'No agents yet',\n emptyRules: 'No rules yet',\n emptyDataSources: 'No data sources yet',\n emptyProviders: 'No providers yet',\n emptySteps: 'Loading the step catalogue',\n dragItem: 'Drag {name}',\n on: 'on',\n off: 'off',\n configured: 'configured',\n needsSetup: 'needs setup',\n models: '{count, plural, one {# model} other {# models}}',\n count: '{count, plural, one {# item} other {# items}}',\n },\n 'pt-BR': {\n palette: 'Passos para adicionar',\n search: 'Buscar passos',\n results: '{count, plural, =0 {Nenhum resultado} one {# resultado} other {# resultados}}',\n noResults: 'Nada corresponde a esta busca',\n agents: 'Agentes',\n rules: 'Regras',\n dataSources: 'Fontes de dados',\n providers: 'Provedores de modelo',\n addAgent: 'Adicionar agente',\n addRule: 'Adicionar regra',\n addDataSource: 'Adicionar fonte de dados',\n addProvider: 'Adicionar provedor de modelo',\n emptyAgents: 'Nenhum agente ainda',\n emptyRules: 'Nenhuma regra ainda',\n emptyDataSources: 'Nenhuma fonte de dados ainda',\n emptyProviders: 'Nenhum provedor ainda',\n emptySteps: 'Carregando o catálogo de passos',\n dragItem: 'Arrastar {name}',\n on: 'ligada',\n off: 'desligada',\n configured: 'configurado',\n needsSetup: 'precisa de configuração',\n models: '{count, plural, one {# modelo} other {# modelos}}',\n count: '{count, plural, one {# item} other {# itens}}',\n },\n es: {\n palette: 'Pasos para añadir',\n search: 'Buscar pasos',\n results: '{count, plural, =0 {Sin resultados} one {# resultado} other {# resultados}}',\n noResults: 'Nada coincide con esta búsqueda',\n agents: 'Agentes',\n rules: 'Reglas',\n dataSources: 'Fuentes de datos',\n providers: 'Proveedores de modelos',\n addAgent: 'Añadir agente',\n addRule: 'Añadir regla',\n addDataSource: 'Añadir fuente de datos',\n addProvider: 'Añadir proveedor de modelos',\n emptyAgents: 'Aún no hay agentes',\n emptyRules: 'Aún no hay reglas',\n emptyDataSources: 'Aún no hay fuentes de datos',\n emptyProviders: 'Aún no hay proveedores',\n emptySteps: 'Cargando el catálogo de pasos',\n dragItem: 'Arrastrar {name}',\n on: 'activada',\n off: 'desactivada',\n configured: 'configurado',\n needsSetup: 'requiere configuración',\n models: '{count, plural, one {# modelo} other {# modelos}}',\n count: '{count, plural, one {# elemento} other {# elementos}}',\n },\n})\nexport const defaultNodePaletteLabels: NodePaletteLabels = nodePaletteLabels.bundles.en\n\n/** Device storage for which sections are open; failures are silent. */\nexport interface PaletteStorage {\n get(key: string): string | null\n set(key: string, value: string): void\n}\n\nconst safeLocalStorage: PaletteStorage = {\n get(key) {\n try {\n return window.localStorage.getItem(key)\n } catch {\n return null\n }\n },\n set(key, value) {\n try {\n window.localStorage.setItem(key, value)\n } catch {\n // storage unavailable (private mode, quota): the default is used next time\n }\n },\n}\n\ninterface PaletteItem {\n key: string\n payload: PalettePayload\n name: string\n description?: string\n icon?: IconComponent\n tone: string\n extra?: ReactNode\n onActivate?: () => void\n}\n\n/** Drag items for a palette entry: the JSON payload plus a plain-text fallback. */\nexport function paletteDragItems(payload: PalettePayload) {\n return [{ [PALETTE_MEDIA_TYPE]: JSON.stringify(payload), 'text/plain': payload.label }]\n}\n\nfunction Items({ label, items, onPlace, emptyText, dragLabel }: { label: string; items: PaletteItem[]; onPlace?: NodePaletteProps['onPlace']; emptyText: string; dragLabel: (name: string) => string }) {\n const { dragAndDropHooks } = useDragAndDrop({\n getItems: (keys) => items.filter((i) => keys.has(i.key)).flatMap((i) => paletteDragItems(i.payload)),\n getAllowedDropOperations: () => ['copy'],\n })\n return (\n <GridList\n aria-label={label}\n className=\"ty-flow-palette__list\"\n items={items}\n dragAndDropHooks={dragAndDropHooks}\n renderEmptyState={() => <p className=\"ty-flow-palette__empty\">{emptyText}</p>}\n onAction={(key) => {\n const item = items.find((i) => i.key === key)\n if (!item) return\n if (item.onActivate) item.onActivate()\n else onPlace?.(item.payload.kind, item.payload)\n }}\n >\n {(item) => {\n const Icon = item.icon\n return (\n <GridListItem id={item.key} textValue={item.name} className=\"ty-flow-palette__item\">\n <AriaButton slot=\"drag\" className=\"ty-flow-palette__grip\" aria-label={dragLabel(item.name)}>\n <GripVertical aria-hidden=\"true\" focusable=\"false\" />\n </AriaButton>\n <span className=\"ty-flow-palette__bubble\" data-tone={item.tone} aria-hidden=\"true\">\n {Icon ? <Icon focusable=\"false\" /> : null}\n </span>\n <span className=\"ty-flow-palette__text\">\n <span className=\"ty-flow-palette__name\">{item.name}</span>\n {item.description ? <span className=\"ty-flow-palette__description\">{item.description}</span> : null}\n </span>\n {item.extra ? <span className=\"ty-flow-palette__extra\">{item.extra}</span> : null}\n </GridListItem>\n )\n }}\n </GridList>\n )\n}\n\ninterface SectionProps {\n id: string\n title: string\n icon?: IconComponent\n count: number\n addLabel?: string\n onAdd?: () => void\n expanded: boolean\n onExpandedChange: (open: boolean) => void\n children: ReactNode\n}\n\nfunction Section({ id, title, icon: Icon, count, addLabel, onAdd, expanded, onExpandedChange, children }: SectionProps) {\n const { locale } = useFlowLocale()\n const l = useLabels(nodePaletteLabels, undefined)\n return (\n <Disclosure id={id} className=\"ty-flow-palette__section\" isExpanded={expanded} onExpandedChange={onExpandedChange}>\n <div className=\"ty-flow-palette__header\">\n <Heading level={3} className=\"ty-flow-palette__heading\">\n <AriaButton slot=\"trigger\" className=\"ty-flow-palette__trigger\">\n <ChevronRight className=\"ty-flow-palette__chevron\" aria-hidden=\"true\" focusable=\"false\" />\n {Icon ? <Icon className=\"ty-flow-palette__section-icon\" aria-hidden=\"true\" focusable=\"false\" /> : null}\n <span>{title}</span>\n <span className=\"ty-flow-palette__count\">{fill(l.count, { count }, locale)}</span>\n </AriaButton>\n </Heading>\n {onAdd && addLabel ? <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={addLabel} leadingIcon={<Plus />} onPress={onAdd} /> : null}\n </div>\n <DisclosurePanel className=\"ty-flow-palette__panel\">{children}</DisclosurePanel>\n </Disclosure>\n )\n}\n\nexport interface NodeKindListProps {\n /** Kinds to list, in order (defaults to the catalog minus experimental, deprecated and picker kinds). */\n kinds?: string[]\n onPlace?: (kind: string, payload: PalettePayload) => void\n emptyMessage?: string\n store?: NodeKindCatalogStore\n /** Filters by label (the palette's search). */\n query?: string\n /** Accessible name of the list. */\n label?: string\n}\n\n/** Step kinds of the catalog that the palette offers. */\nexport function placeableKinds(store: NodeKindCatalogStore = nodeKindCatalog): NodeKindEntry[] {\n return store.kinds()\n .map((k) => store.entry(k)!)\n .filter((e) => !e.experimental && !e.deprecated && !PICKER_KINDS.includes(e.kind) && e.kind !== 'data-source')\n}\n\nfunction useCatalogVersion(store: NodeKindCatalogStore) {\n return useSyncExternalStore(store.subscribe, store.getVersion, store.getVersion)\n}\n\nfunction kindItems(entries: NodeKindEntry[], store: NodeKindCatalogStore, catalog: ReturnType<typeof useRenderCatalog>): PaletteItem[] {\n return entries.map((e) => ({\n key: `kind:${e.kind}`,\n name: e.label,\n ...(e.description ? { description: e.description } : {}),\n icon: catalog.icon(e.kind),\n tone: catalog.tone(e.kind),\n payload: { kind: e.kind, label: e.label, ...(store.createDefaultConfig(e.kind) ? { config: store.createDefaultConfig(e.kind)! } : {}) },\n }))\n}\n\n/** The draggable list of step kinds alone, for hosts that compose their own palette. */\nexport function NodeKindList({ kinds, onPlace, emptyMessage, store = nodeKindCatalog, query = '', label }: NodeKindListProps) {\n const l = useLabels(nodePaletteLabels, undefined)\n const catalog = useRenderCatalog()\n useCatalogVersion(store)\n const entries = (kinds ? kinds.map((k) => store.entry(k)).filter((e): e is NodeKindEntry => !!e) : placeableKinds(store)).filter((e) => e.label.toLocaleLowerCase().includes(query.toLocaleLowerCase()))\n return <Items label={label ?? l.palette} items={kindItems(entries, store, catalog)} {...(onPlace ? { onPlace } : {})} emptyText={emptyMessage ?? (store.isLoaded() ? l.noResults : l.emptySteps)} dragLabel={(name) => fill(l.dragItem, { name })} />\n}\n\nexport interface NodePaletteProps {\n agents?: PaletteAgent[]\n rules?: PaletteRule[]\n entities?: PaletteEntity[]\n modelProviders?: PaletteProvider[]\n onCreateAgent?: () => void\n onCreateRule?: () => void\n onCreateDataSource?: () => void\n onAddModelProvider?: () => void\n onConfigureProvider?: (providerId: string) => void\n /** Placement by keyboard or tap: the host places the node and focuses it. */\n onPlace?: (kind: string, payload: PalettePayload) => void\n kinds?: string[]\n store?: NodeKindCatalogStore\n storage?: PaletteStorage\n /** Storage key prefix for open sections. */\n storageKey?: string\n labels?: Partial<NodePaletteLabels>\n className?: string\n}\n\nexport function NodePalette(props: NodePaletteProps) {\n const { agents = [], rules = [], entities = [], modelProviders = [], onPlace, store = nodeKindCatalog, storage = safeLocalStorage, storageKey = 'ty-flow-palette' } = props\n const l = useLabels(nodePaletteLabels, props.labels)\n const { locale } = useFlowLocale()\n const catalog = useRenderCatalog()\n useCatalogVersion(store)\n const [query, setQuery] = useState('')\n const [open, setOpen] = useState<Record<string, boolean>>({})\n const isOpen = (id: string) => open[id] ?? storage.get(`${storageKey}:${id}`) !== 'closed'\n const toggle = (id: string) => (next: boolean) => {\n setOpen((o) => ({ ...o, [id]: next }))\n storage.set(`${storageKey}:${id}`, next ? 'open' : 'closed')\n }\n const q = query.trim().toLocaleLowerCase()\n const match = (s: string) => !q || s.toLocaleLowerCase().includes(q)\n\n const sections = useMemo(() => {\n const out: Array<{ id: string; title: string; icon?: IconComponent; items: PaletteItem[]; addLabel?: string; onAdd?: () => void; empty: string }> = []\n out.push({\n id: 'agents',\n title: l.agents,\n icon: Bot,\n items: agents.filter((a) => match(a.name)).map((a) => ({\n key: `agent:${a.id}`,\n name: a.name,\n ...(a.role ? { description: a.role } : {}),\n icon: Bot,\n tone: catalog.tone('agent'),\n payload: { kind: 'agent', label: a.name, entityId: a.id, config: { agentRef: a.id } },\n ...(a.tier ? { extra: <span className=\"ty-flow-palette__tag\">{a.tier}</span> } : {}),\n })),\n ...(props.onCreateAgent ? { addLabel: l.addAgent, onAdd: props.onCreateAgent } : {}),\n empty: l.emptyAgents,\n })\n out.push({\n id: 'rules',\n title: l.rules,\n icon: Scale,\n items: rules.filter((r) => match(r.name)).map((r) => ({\n key: `rule:${r.id}`,\n name: r.name,\n icon: Scale,\n tone: catalog.tone('rule'),\n payload: { kind: 'rule', label: r.name, entityId: r.id, config: { ruleId: r.id } },\n extra: <span className=\"ty-flow-palette__state\" data-on={r.enabled || undefined}>{r.enabled ? l.on : l.off}</span>,\n })),\n ...(props.onCreateRule ? { addLabel: l.addRule, onAdd: props.onCreateRule } : {}),\n empty: l.emptyRules,\n })\n out.push({\n id: 'data-sources',\n title: l.dataSources,\n icon: Database,\n items: entities.filter((e) => match(e.name)).map((e) => ({\n key: `datasource:${e.id}`,\n name: e.name,\n ...(e.dialect ? { description: e.dialect } : {}),\n icon: Database,\n tone: catalog.tone('datasource'),\n payload: { kind: 'datasource', label: e.name, entityId: e.id, config: { sourceId: e.id } },\n })),\n ...(props.onCreateDataSource ? { addLabel: l.addDataSource, onAdd: props.onCreateDataSource } : {}),\n empty: l.emptyDataSources,\n })\n out.push({\n id: 'providers',\n title: l.providers,\n icon: Server,\n items: modelProviders.filter((p) => match(p.name)).map((p) => ({\n key: `provider:${p.id}`,\n name: p.name,\n description: `${p.configured ? l.configured : l.needsSetup} · ${fill(l.models, { count: p.modelCount }, locale)}`,\n icon: Server,\n tone: 'neutral',\n payload: { kind: 'provider', label: p.name, entityId: p.id },\n ...(props.onConfigureProvider ? { onActivate: () => props.onConfigureProvider!(p.id) } : {}),\n })),\n ...(props.onAddModelProvider ? { addLabel: l.addProvider, onAdd: props.onAddModelProvider } : {}),\n empty: l.emptyProviders,\n })\n const allowed = props.kinds ? new Set(props.kinds) : null\n const byCategory = new Map<string, NodeKindEntry[]>()\n for (const e of placeableKinds(store)) {\n if (allowed && !allowed.has(e.kind)) continue\n if (!match(e.label)) continue\n if (!byCategory.has(e.category)) byCategory.set(e.category, [])\n byCategory.get(e.category)!.push(e)\n }\n // Categories in catalog order, including those with no match (they show their empty message while searching).\n for (const g of store.byCategory()) {\n const entries = byCategory.get(g.category) ?? []\n if (!g.entries.some((e) => placeableKinds(store).includes(e))) continue\n out.push({ id: `category:${g.category}`, title: g.category, items: kindItems(entries, store, catalog), empty: l.noResults })\n }\n return out\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [agents, rules, entities, modelProviders, q, l, store, catalog, props.kinds, props.onCreateAgent, props.onCreateRule, props.onCreateDataSource, props.onAddModelProvider, props.onConfigureProvider, locale])\n\n const total = sections.reduce((n, s) => n + s.items.length, 0)\n\n return (\n <section className={['ty-flow-palette', props.className].filter(Boolean).join(' ')} aria-label={l.palette}>\n <TextField mode=\"search\" label={l.search} value={query} onChange={setQuery} />\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {q ? fill(l.results, { count: total }, locale) : ''}\n </p>\n {q && total === 0 ? <p className=\"ty-flow-palette__no-results\">{l.noResults}</p> : null}\n {sections.map((s) => (\n <Section key={s.id} id={s.id} title={s.title} {...(s.icon ? { icon: s.icon } : {})} count={s.items.length} {...(s.addLabel && s.onAdd ? { addLabel: s.addLabel, onAdd: s.onAdd } : {})} expanded={q ? true : isOpen(s.id)} onExpandedChange={toggle(s.id)}>\n <Items label={s.title} items={s.items} {...(onPlace ? { onPlace } : {})} emptyText={q ? l.noResults : s.empty} dragLabel={(name) => fill(l.dragItem, { name })} />\n </Section>\n ))}\n </section>\n )\n}\n","// FlowPreview: a read-only picture of a flow for chat replies, run inspection\n// and live previews. Layout and fit follow the graph only; selection and\n// statuses never move the view.\n\nimport { useId, useLayoutEffect, useMemo, useRef, type ReactNode, type Ref } from 'react'\nimport { PreviewStatusMark, usePreviewStatusWord } from '../nodes/nodeChrome'\nimport { builtInNodeComponents } from '../nodes/registry'\nimport { useRenderCatalog } from '../catalog/RenderCatalog'\nimport { absoluteRect } from '../geometry/rect'\nimport { defineLabels, useFlowLocale, useLabels } from '../internal/labels'\nimport { autoLayout, rankDirectionOf } from '../layout/autoLayout'\nimport { layerIndex } from '../model/graph'\nimport type { FlowConnector, FlowNode, RunStatus } from '../model/types'\nimport { CanvasSurface } from '../surface/CanvasSurface'\nimport type { CanvasApi, SurfaceNode } from '../surface/types'\nimport type { FlowReferenceData } from '../nodes/types'\nimport { focusAfter } from './focusOut'\nimport { anchorFor, componentForKind, sizeForNode } from './nodeBridge'\n\nexport interface FlowPreviewLabels {\n canvas: string\n}\n\nexport const flowPreviewLabels = defineLabels<FlowPreviewLabels>('FlowPreview', {\n en: { canvas: 'Flow preview' },\n 'pt-BR': { canvas: 'Prévia do fluxo' },\n es: { canvas: 'Vista previa del flujo' },\n})\nexport const defaultFlowPreviewLabels: FlowPreviewLabels = flowPreviewLabels.bundles.en\n\n/**\n * Status mark for node kinds whose card does not draw one (the generic card\n * does): glyph and word over the card, the word added to the card's\n * accessible description, and a \"not run\" pattern instead of opacity alone.\n */\nfunction StatusFrame({ status, children }: { status: RunStatus; children: ReactNode }) {\n const ref = useRef<HTMLDivElement>(null)\n const id = useId()\n const word = usePreviewStatusWord(status)\n useLayoutEffect(() => {\n const target = ref.current?.querySelector<HTMLElement>('[data-ty-node-focus]')\n if (!target) return\n const own = (target.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter((t) => t && t !== id)\n target.setAttribute('aria-describedby', [...own, id].join(' '))\n })\n return (\n <div ref={ref} className=\"ty-flow-preview__frame\" data-status={status}>\n {children}\n <PreviewStatusMark status={status} />\n <span id={id} className=\"ty-visually-hidden\">\n {word}\n </span>\n </div>\n )\n}\n\nexport interface FlowPreviewProps {\n graph: { nodes: FlowNode[]; connectors: FlowConnector[] }\n /** When given, nodes without an entry read as \"not run\". */\n nodeStatuses?: Record<string, RunStatus>\n selectedNodeId?: string | null\n onNodeActivate?: (nodeId: string) => void\n layout?: 'auto' | 'preserve'\n direction?: 'top-down' | 'left-right'\n /** Keep a horizontal auto layout left to right in right-to-left locales. */\n keepLtrLayout?: boolean\n /** Inside a chat bubble: no pinch and no wheel zoom, so the page keeps scrolling. */\n embedded?: boolean\n reference?: FlowReferenceData\n apiRef?: Ref<CanvasApi>\n label?: string\n labels?: Partial<FlowPreviewLabels>\n className?: string\n}\n\n/** Reading order: layer, then position across the layer. */\nexport function flowReadingOrder(nodes: FlowNode[], connectors: FlowConnector[], horizontal: boolean): FlowNode[] {\n const layer = layerIndex(\n nodes.map((n) => n.id),\n connectors,\n )\n return [...nodes].sort((a, b) => (layer.get(a.id) ?? 0) - (layer.get(b.id) ?? 0) || (horizontal ? a.position.y - b.position.y : a.position.x - b.position.x))\n}\n\nexport function FlowPreview(props: FlowPreviewProps) {\n const { graph, nodeStatuses, selectedNodeId = null, onNodeActivate, layout = 'auto', direction = 'top-down', keepLtrLayout = false, embedded = false, reference, apiRef, className } = props\n const l = useLabels(flowPreviewLabels, props.labels)\n const catalog = useRenderCatalog()\n const { rtl } = useFlowLocale()\n const rootRef = useRef<HTMLDivElement>(null)\n const editorDirection = direction === 'left-right' ? 'right' : 'down'\n\n // Recomputed only when the graph (or its layout settings) change.\n const placed = useMemo(() => {\n const sized = graph.nodes.map((n) => ({ ...n, size: sizeForNode(n, 'detailed') }))\n const laid = layout === 'auto' ? autoLayout(sized, graph.connectors, rankDirectionOf(editorDirection, rtl, keepLtrLayout)) : sized\n return flowReadingOrder(laid, graph.connectors, editorDirection === 'right')\n }, [graph, layout, editorDirection, rtl, keepLtrLayout])\n\n const byId = useMemo(() => new Map(placed.map((n) => [n.id, n])), [placed])\n const surfaceNodes: SurfaceNode[] = placed.map((n) => ({\n id: n.id,\n rect: absoluteRect(n, byId),\n layer: n.kind === 'group' ? 0 : 1,\n fixedHeight: n.kind === 'group' || n.kind === 'note',\n selected: n.id === selectedNodeId,\n ...(n.hidden ? { hidden: true } : {}),\n tone: catalog.tone(n.kind),\n }))\n\n return (\n <div ref={rootRef} className={['ty-flow-preview', className].filter(Boolean).join(' ')}>\n <CanvasSurface\n label={props.label ?? l.canvas}\n nodes={surfaceNodes}\n connectors={graph.connectors}\n fitKey={placed}\n wheel={embedded ? 'none' : 'zoom'}\n pinch={!embedded}\n {...(apiRef ? { apiRef } : {})}\n portAnchor={(id, port, role) => {\n const n = byId.get(id)\n return n ? anchorFor(n, port, role, editorDirection, catalog) : 'border'\n }}\n onLeave={() => focusAfter(rootRef.current)}\n renderNode={(sn) => {\n const node = byId.get(sn.id)!\n const Card = componentForKind(node.kind)\n const status: RunStatus | undefined = nodeStatuses ? (nodeStatuses[node.id] ?? 'unknown') : undefined\n const card = (\n <Card\n node={node}\n density=\"detailed\"\n direction={editorDirection}\n locked\n preview\n selected={node.id === selectedNodeId}\n {...(status ? { runStatus: status } : {})}\n {...(onNodeActivate ? { onConfigure: onNodeActivate } : {})}\n {...(reference ? { reference } : {})}\n />\n )\n // The generic card draws its own status mark; other kinds get the frame.\n return status && builtInNodeComponents[node.kind] ? <StatusFrame status={status}>{card}</StatusFrame> : card\n }}\n />\n </div>\n )\n}\n","// The editor's keyboard map, kept as data so the shortcut panel, tool tips and\n// the listener read the same list. \"Mod\" is Command on Apple platforms and\n// Control elsewhere.\n\nexport type EditorAction =\n | 'escape'\n | 'selectTool'\n | 'panTool'\n | 'toggleGrid'\n | 'toggleMinimap'\n | 'zoom100'\n | 'zoom50'\n | 'group'\n | 'ungroup'\n | 'undo'\n | 'redo'\n | 'copy'\n | 'paste'\n | 'selectAll'\n | 'duplicate'\n | 'fit'\n | 'zoomOut'\n | 'zoomIn'\n | 'delete'\n\nexport interface KeyBinding {\n action: EditorAction\n /** Display chords, e.g. \"Mod+Shift+Z\". */\n chords: string[]\n /** A bare character key (WCAG 2.1.4: only while the canvas has focus, host can turn off). */\n singleKey?: boolean\n}\n\nexport const editorKeyMap: readonly KeyBinding[] = Object.freeze([\n { action: 'escape', chords: ['Escape'] },\n { action: 'selectTool', chords: ['V'], singleKey: true },\n { action: 'panTool', chords: ['H'], singleKey: true },\n { action: 'toggleGrid', chords: ['G'], singleKey: true },\n { action: 'toggleMinimap', chords: ['M'], singleKey: true },\n { action: 'zoom100', chords: ['Shift+1'] },\n { action: 'zoom50', chords: ['Shift+5'] },\n { action: 'group', chords: ['Mod+G'] },\n { action: 'ungroup', chords: ['Mod+Shift+G'] },\n { action: 'undo', chords: ['Mod+Z'] },\n { action: 'redo', chords: ['Mod+Shift+Z', 'Mod+Y'] },\n { action: 'copy', chords: ['Mod+C'] },\n { action: 'paste', chords: ['Mod+V'] },\n { action: 'selectAll', chords: ['Mod+A'] },\n { action: 'duplicate', chords: ['Mod+D'] },\n { action: 'fit', chords: ['Mod+1', 'Mod+Shift+F'] },\n { action: 'zoomOut', chords: ['Mod+-'] },\n { action: 'zoomIn', chords: ['Mod+=', 'Mod++'] },\n { action: 'delete', chords: ['Delete', 'Backspace'] },\n])\n\nexport function isApplePlatform(): boolean {\n if (typeof navigator === 'undefined') return false\n const p = (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ?? navigator.platform ?? ''\n return /mac|iphone|ipad|ipod/i.test(p)\n}\n\n/** Physical digit keys under Shift (Shift+1 reads \"!\" on many layouts). */\nfunction keyName(e: KeyboardEvent): string {\n if (/^Digit\\d$/.test(e.code)) return e.code.slice(5)\n if (e.key === '+' || e.key === '=' || e.code === 'Equal') return e.key === '+' ? '+' : '='\n if (e.key === '-' || e.code === 'Minus') return '-'\n return e.key.length === 1 ? e.key.toUpperCase() : e.key\n}\n\n/** The chord of a keyboard event in the map's notation. */\nexport function chordOf(e: KeyboardEvent, apple = isApplePlatform()): string {\n const mod = apple ? e.metaKey : e.ctrlKey\n const parts: string[] = []\n if (mod) parts.push('Mod')\n if (e.shiftKey && e.key !== 'Shift') parts.push('Shift')\n parts.push(keyName(e))\n return parts.join('+')\n}\n\n/** Binding matched by an event, or undefined. */\nexport function matchBinding(e: KeyboardEvent, apple = isApplePlatform()): KeyBinding | undefined {\n if (e.altKey) return undefined\n const chord = chordOf(e, apple)\n // \"Mod++\" arrives as Shift+= on most layouts.\n const alt = chord === 'Mod+Shift+=' ? 'Mod+=' : chord\n return editorKeyMap.find((b) => b.chords.includes(chord) || b.chords.includes(alt))\n}\n\n/** aria-keyshortcuts value for a binding (Mod resolved for the platform). */\nexport function ariaShortcut(action: EditorAction, apple = isApplePlatform()): string {\n const b = editorKeyMap.find((k) => k.action === action)\n return b ? b.chords.map((c) => c.replace('Mod', apple ? 'Meta' : 'Control')).join(' ') : ''\n}\n","// EditorShortcuts: the key listener (scoped to the canvas element, never the\n// whole document) and stand-alone, reactive history and clipboard helpers for\n// hosts that do not use the shared editor store.\n\nimport { useCallback, useEffect, useRef, useState, type RefObject } from 'react'\nimport type { FlowConnector, FlowNode } from '../model/types'\nimport { clonePiece, copySelection, freezeSnapshot, mergePiece, recordHistory, stepBack, stepForward, type GraphSnapshot, type HistoryStacks } from '../state/graphEdits'\nimport { matchBinding, type EditorAction } from './keyMap'\n\n/** A handler returns false when it did nothing (the event is then left alone). */\nexport type ShortcutHandlers = Partial<Record<EditorAction, () => boolean | void>>\n\nexport interface ShortcutOptions {\n /** The canvas element (or a ref to it). Keys are heard only inside it. */\n scope: Element | RefObject<Element | null> | null\n enabled?: boolean\n /** Single-character keys (V, H, G, M). WCAG 2.1.4: the host can turn them off. */\n singleKey?: boolean\n /** Escape found nothing to clear: move focus out of the canvas (never trapped). */\n onLeave?: () => void\n}\n\nconst TEXT_ENTRY = 'input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"textbox\"], [role=\"combobox\"], [role=\"searchbox\"]'\n\nfunction isTextEntry(target: EventTarget | null): boolean {\n return target instanceof Element && !!target.closest(TEXT_ENTRY)\n}\n\nfunction dialogOpen(target: EventTarget | null): boolean {\n if (target instanceof Element && target.closest('[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"]')) return true\n return !!document.querySelector('[role=\"alertdialog\"], [role=\"dialog\"][aria-modal=\"true\"]')\n}\n\nexport function useEditorShortcuts(handlers: ShortcutHandlers, options: ShortcutOptions): void {\n const latest = useRef({ handlers, options })\n latest.current = { handlers, options }\n const resolve = (): Element | null =>\n options.scope && 'current' in (options.scope as object) ? (options.scope as RefObject<Element | null>).current : (options.scope as Element | null)\n\n // The scope is read after commit (a ref is empty during the first render),\n // and re-read on every commit so a swapped element is followed.\n useEffect(() => {\n const el = resolve()\n if (!el || options.enabled === false) return\n const onKey = (event: Event) => {\n const e = event as KeyboardEvent\n if (e.defaultPrevented) return\n if (isTextEntry(e.target) || dialogOpen(e.target)) return\n const binding = matchBinding(e)\n if (!binding) return\n const { handlers: h, options: o } = latest.current\n if (binding.singleKey && o.singleKey === false) return\n // Connector handles and tool bars own Delete for themselves.\n if (binding.action === 'delete' && e.target instanceof Element && e.target.closest('[data-ty-surface-chrome]')) return\n const run = h[binding.action]\n if (binding.action === 'escape') {\n const cleared = run ? run() !== false : false\n e.preventDefault()\n if (!cleared) o.onLeave?.()\n return\n }\n if (!run) return\n if (run() === false) return\n e.preventDefault()\n e.stopPropagation()\n }\n el.addEventListener('keydown', onKey, true)\n return () => el.removeEventListener('keydown', onKey, true)\n })\n}\n\ntype Setter<T> = (next: T | ((prev: T) => T)) => void\n\n/** Reactive undo/redo over caller-owned node and connector state. */\nexport function useEditorHistory(nodes: FlowNode[], edges: FlowConnector[], setNodes: Setter<FlowNode[]>, setEdges: Setter<FlowConnector[]>, bound = 50) {\n const [stacks, setStacks] = useState<HistoryStacks>({ past: [], future: [] })\n const graph = useRef<GraphSnapshot>({ nodes, connectors: edges })\n graph.current = { nodes, connectors: edges }\n const apply = (g: GraphSnapshot) => {\n setNodes(g.nodes)\n setEdges(g.connectors)\n }\n const snapshot = useCallback(() => setStacks((s) => recordHistory(s, freezeSnapshot(graph.current.nodes, graph.current.connectors), bound)), [bound])\n const undo = useCallback(() => {\n setStacks((s) => {\n const r = stepBack(s, freezeSnapshot(graph.current.nodes, graph.current.connectors))\n if (!r) return s\n apply(r.graph)\n return r.stacks\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n const redo = useCallback(() => {\n setStacks((s) => {\n const r = stepForward(s, freezeSnapshot(graph.current.nodes, graph.current.connectors))\n if (!r) return s\n apply(r.graph)\n return r.stacks\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n return { undo, redo, snapshot, canUndo: stacks.past.length > 0, canRedo: stacks.future.length > 0 }\n}\n\n/** Reactive copy/paste; repeated pastes cascade from the previous copy. */\nexport function useEditorClipboard(nodes: FlowNode[], edges: FlowConnector[], setNodes: Setter<FlowNode[]>, setEdges: Setter<FlowConnector[]>, snapshot: () => void) {\n const [clip, setClip] = useState<GraphSnapshot | null>(null)\n const copy = useCallback(() => {\n const piece = copySelection(nodes, edges)\n if (piece) setClip(piece)\n }, [nodes, edges])\n const paste = useCallback(() => {\n if (!clip) return\n snapshot()\n const piece = clonePiece(clip)\n const merged = mergePiece({ nodes, connectors: edges }, piece)\n setNodes(merged.nodes)\n setEdges(merged.connectors)\n setClip(freezeSnapshot(piece.nodes, piece.connectors))\n }, [clip, nodes, edges, setNodes, setEdges, snapshot])\n return { copy, paste, hasCopied: !!clip && clip.nodes.length > 0 }\n}\n","// SelectionArrange: group, ungroup, align, distribute and measure for the\n// selected nodes. Every mutating action takes exactly one snapshot first, so it\n// is one undo step; a selection too small for the action is a no-op.\n\nimport { useCallback, useRef } from 'react'\nimport { alignBoxes, distributeBoxes, frameAround, type AlignEdge, type DistributeAxis, type Placed } from '../geometry/arrange'\nimport { absoluteRect, sizeOf } from '../geometry/rect'\nimport { createId } from '../internal/ids'\nimport type { FlowNode, Size } from '../model/types'\n\n/** Inner padding of a new group frame and the height of its header band. */\nconst FRAME_PADDING = 24\nconst FRAME_HEADER = 40\n\nexport interface GroupHandlers {\n onEdit?: (id: string) => void\n onToggleExpanded?: (id: string) => void\n onRemove?: (id: string) => void\n}\n\nexport interface SelectionArrangeArgs {\n nodes: FlowNode[]\n setNodes: (next: FlowNode[] | ((prev: FlowNode[]) => FlowNode[])) => void\n snapshot: () => void\n /** Kept by the editor and passed to the frame's renderer (not stored in node data, which must stay serialisable). */\n groupHandlers?: GroupHandlers\n locked?: boolean\n /** Default name of a new group (from the i18n adapter). */\n groupName?: string\n /** Polite announcement after an action (\"4 nodes aligned left\"). */\n announce?: (action: 'group' | 'ungroup' | 'align' | 'distribute', detail: { count: number; edge?: AlignEdge; axis?: DistributeAxis }) => void\n}\n\nexport function useSelectionArrange({ nodes, setNodes, snapshot, locked = false, groupName = 'Group', announce }: SelectionArrangeArgs) {\n const current = useRef(nodes)\n current.current = nodes\n\n const measure = useCallback((node: FlowNode): Size => sizeOf(node), [])\n\n const selectedBoxes = (): Placed[] => {\n const byId = new Map(current.current.map((n) => [n.id, n]))\n return current.current.filter((n) => n.selected && !n.hidden).map((n) => ({ id: n.id, rect: absoluteRect(n, byId) }))\n }\n\n /** Moves nodes to absolute canvas points, converting back to frame-relative positions. */\n const moveTo = (points: Map<string, { x: number; y: number }>) => {\n setNodes((prev) => {\n const byId = new Map(prev.map((n) => [n.id, n]))\n return prev.map((n) => {\n const p = points.get(n.id)\n if (!p) return n\n const parent = n.parentId ? byId.get(n.parentId) : undefined\n const origin = parent ? absoluteRect(parent, byId) : { x: 0, y: 0 }\n return { ...n, position: { x: p.x - origin.x, y: p.y - origin.y } }\n })\n })\n }\n\n const group = useCallback(() => {\n if (locked) return\n const boxes = selectedBoxes().filter((b) => !current.current.find((n) => n.id === b.id)?.parentId)\n if (boxes.length < 2) return\n const frame = frameAround(boxes, FRAME_PADDING, FRAME_HEADER)!\n snapshot()\n const id = createId('group')\n const members = new Set(boxes.map((b) => b.id))\n setNodes((prev) => {\n const byId = new Map(prev.map((n) => [n.id, n]))\n const rest = prev.map((n) => {\n if (!members.has(n.id)) return n.selected ? { ...n, selected: false } : n\n const abs = absoluteRect(n, byId)\n return { ...n, parentId: id, selected: false, position: { x: abs.x - frame.x, y: abs.y - frame.y } }\n })\n const frameNode: FlowNode = {\n id,\n kind: 'group',\n position: { x: frame.x, y: frame.y },\n size: { width: frame.width, height: frame.height },\n data: { label: groupName, tone: 'neutral', expanded: true, autoFit: true },\n }\n // First in the list so it renders behind its members.\n return [frameNode, ...rest]\n })\n announce?.('group', { count: boxes.length })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [locked, snapshot, setNodes, groupName, announce])\n\n const ungroup = useCallback(() => {\n if (locked) return\n const frames = new Set(current.current.filter((n) => n.selected && n.kind === 'group').map((n) => n.id))\n if (!frames.size) return\n snapshot()\n setNodes((prev) => {\n const byId = new Map(prev.map((n) => [n.id, n]))\n return prev\n .filter((n) => !frames.has(n.id))\n .map((n) => {\n if (!n.parentId || !frames.has(n.parentId)) return n\n const abs = absoluteRect(n, byId)\n const { parentId: _drop, ...rest } = n\n return { ...rest, hidden: false, position: { x: abs.x, y: abs.y } }\n })\n })\n announce?.('ungroup', { count: frames.size })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [locked, snapshot, setNodes, announce])\n\n const align = useCallback(\n (edge: AlignEdge) => {\n if (locked) return\n const boxes = selectedBoxes()\n if (boxes.length < 2) return\n snapshot()\n moveTo(alignBoxes(boxes, edge))\n announce?.('align', { count: boxes.length, edge })\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [locked, snapshot, announce],\n )\n\n const distribute = useCallback(\n (axis: DistributeAxis) => {\n if (locked) return\n const boxes = selectedBoxes()\n if (boxes.length < 3) return\n snapshot()\n moveTo(distributeBoxes(boxes, axis))\n announce?.('distribute', { count: boxes.length, axis })\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [locked, snapshot, announce],\n )\n\n return { group, ungroup, align, distribute, measure }\n}\n","// FlowEditor: the editable DAG canvas of an analysis. It owns one editor\n// store per mount (FlowEditorState), draws the graph on CanvasSurface through\n// the node and connector groups (nodeBridge) and research steps (steps/), and\n// wires the step palette, the four ways to add a step (the \"+\" under a step,\n// the \"+\" on a link, a palette drag, the A key and dock item), typed wiring\n// checks, the side panel (flow summary or step settings), the list view (the\n// keyboard view of the canvas), shortcuts, menus, dialogs and run views.\n// Graph changes are reported debounced (onGraphChange) and immediately per\n// commit (onGraphCommit, used by AutosaveController).\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type DragEvent,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { Button, Drawer, useMediaQuery } from '../../index'\nimport { Plus } from 'lucide-react'\nimport { nodeKindCatalog } from '../catalog/kindCatalog'\nimport { useRenderCatalog } from '../catalog/RenderCatalog'\nimport { absoluteRect } from '../geometry/rect'\nimport { AnnouncerProvider, useAnnounce } from '../internal/Announcer'\nimport { ConfirmProvider } from '../internal/confirm'\nimport { createId } from '../internal/ids'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { autoLayout, rankDirectionOf } from '../layout/autoLayout'\nimport { ancestorsOf } from '../model/graph'\nimport type { FlowConnector, FlowGraph, FlowNode, Point, Viewport } from '../model/types'\nimport { useAlignmentGuides } from '../nodes/AlignmentGuides'\nimport { fitGroupToMembers } from '../nodes/groupLayout'\nimport type { FlowNodeComponent, FlowReferenceData, StoredRule } from '../nodes/types'\nimport { DialogStackProvider, useActiveDialog, useDialogStack, type AgentEditorPayload, type NodeConfigPayload } from '../state/dialogStack'\nimport {\n createFlowEditorStore,\n FlowEditorStateProvider,\n useFlowEditorState,\n useFlowEditorStore,\n type FlowEditorStore,\n} from '../state/editorState'\nimport { CanvasSurface } from '../surface/CanvasSurface'\nimport type { CanvasApi, PortRef, SurfaceNode } from '../surface/types'\nimport { CanvasNodeSearch } from '../toolbar/CanvasNodeSearch'\nimport { CanvasToolbar } from '../toolbar/CanvasToolbar'\nimport type { CanvasToolItem } from '../toolbar/canvasTools'\nimport { AddStepPicker } from '../steps/AddStepPicker'\nimport { FlowSidePanel, type FlowFacts, type OutputPreview } from '../steps/FlowSidePanel'\nimport { IssueBar } from '../steps/IssueBar'\nimport { researchStepCatalog, specOfNode, STEP_KIND, type ReadyStep, type StepCatalog } from '../steps/researchSteps'\nimport type { DataShape } from '../steps/shapes'\nimport { alongEdge, STEP_CARD_SIZE, StepCard } from '../steps/StepCard'\nimport { StepListView } from '../steps/StepListView'\nimport { StepPalette, STEP_MEDIA_TYPE, stepOfDrag, type StepPaletteProps } from '../steps/StepPalette'\nimport { StepsProvider, useReadyCatalog } from '../steps/StepsContext'\nimport { stepEditorWords } from '../steps/stepLabels'\nimport { stepToolItems } from '../steps/stepTools'\nimport { givenShape, inputIndex, linkAfter, linkThrough, stepNode, stepsAccepting, swapNeighbours, wiringIssues, type WiringIssue } from '../steps/wiring'\nimport { NodeConfigDialog, type NodeConfigDialogProps } from '../dialogs/NodeConfigDialog'\nimport { RunViews, type RunViewsProps } from '../run/RunViews'\nimport { CanvasBackgroundMenu, isContextMenuKey, NodeContextMenu, SelectionContextMenu } from './CanvasContextMenus'\nimport type { LayoutCycle } from './editorTools'\nimport { focusAfter } from './focusOut'\nimport { anchorFor, componentForKind, connectionAllowed, guideOverlay, nodeTitle, renderConnectorParts, sizeForNode, splitConnectorThrough } from './nodeBridge'\nimport { PALETTE_MEDIA_TYPE, type PalettePayload } from './NodePalette'\nimport { flowReadingOrder } from './FlowPreview'\nimport { useEditorShortcuts } from './useEditorShortcuts'\nimport { useSelectionArrange } from './useSelectionArrange'\n\nexport interface FlowEditorLabels {\n canvas: string\n roleDescription: string\n tools: string\n outline: string\n palette: string\n openPalette: string\n aligned: string\n arranged: string\n canConnect: string\n cannotConnect: string\n group: string\n noteText: string\n}\n\nexport const flowEditorLabels = defineLabels<FlowEditorLabels>('FlowEditor', {\n en: {\n canvas: 'Flow canvas',\n roleDescription: 'canvas',\n tools: 'Canvas tools',\n outline: 'Flow steps',\n palette: 'Steps to add',\n openPalette: 'Show steps',\n aligned: '{count, plural, one {# node} other {# nodes}} arranged',\n arranged: '{count, plural, one {# node} other {# nodes}} grouped',\n canConnect: '{name}: can connect',\n cannotConnect: '{name}: cannot connect',\n group: 'Group',\n noteText: '',\n },\n 'pt-BR': {\n canvas: 'Canvas do fluxo',\n roleDescription: 'canvas',\n tools: 'Ferramentas do canvas',\n outline: 'Etapas do fluxo',\n palette: 'Etapas para adicionar',\n openPalette: 'Mostrar passos',\n aligned: '{count, plural, one {# nó organizado} other {# nós organizados}}',\n arranged: '{count, plural, one {# nó agrupado} other {# nós agrupados}}',\n canConnect: '{name}: pode conectar',\n cannotConnect: '{name}: não pode conectar',\n group: 'Grupo',\n noteText: '',\n },\n es: {\n canvas: 'Lienzo del flujo',\n roleDescription: 'lienzo',\n tools: 'Herramientas del lienzo',\n outline: 'Pasos del flujo',\n palette: 'Pasos para añadir',\n openPalette: 'Mostrar pasos',\n aligned: '{count, plural, one {# nodo organizado} other {# nodos organizados}}',\n arranged: '{count, plural, one {# nodo agrupado} other {# nodos agrupados}}',\n canConnect: '{name}: se puede conectar',\n cannotConnect: '{name}: no se puede conectar',\n group: 'Grupo',\n noteText: '',\n },\n})\nexport const defaultFlowEditorLabels = flowEditorLabels.bundles.en\n\n// ---- provider -------------------------------------------------------------\n\nexport interface FlowEditorBootstrap {\n graph?: FlowGraph | null\n reference?: FlowReferenceData\n}\n\ninterface ProviderValue {\n data: FlowEditorBootstrap | null\n status: 'idle' | 'loading' | 'ready' | 'error'\n error: unknown\n}\n\nconst ProviderContext = createContext<ProviderValue | null>(null)\n\nexport interface FlowEditorProviderProps {\n flowId?: string\n /** Loads the flow and its reference data from the host backend. */\n load?: (flowId: string) => Promise<FlowEditorBootstrap>\n onLoadError?: (error: unknown) => void\n children: ReactNode\n}\n\n/** Optional context that loads a flow and its reference data by id. */\nexport function FlowEditorProvider({ flowId, load, onLoadError, children }: FlowEditorProviderProps) {\n const [value, setValue] = useState<ProviderValue>({ data: null, status: 'idle', error: null })\n const report = useRef(onLoadError)\n report.current = onLoadError\n useEffect(() => {\n if (!flowId || !load) return\n let live = true\n setValue({ data: null, status: 'loading', error: null })\n load(flowId).then(\n (data) => live && setValue({ data, status: 'ready', error: null }),\n (error: unknown) => {\n if (!live) return\n setValue({ data: null, status: 'error', error })\n report.current?.(error)\n },\n )\n return () => {\n live = false\n }\n }, [flowId, load])\n return <ProviderContext.Provider value={value}>{children}</ProviderContext.Provider>\n}\n\nexport function useFlowEditorBootstrap(): ProviderValue | null {\n return useContext(ProviderContext)\n}\n\n// ---- editor ---------------------------------------------------------------\n\nexport interface FlowEditorProps {\n flowId?: string\n /** Graph hydrated once on mount. */\n initialGraph?: FlowGraph | null\n reference?: FlowReferenceData\n /** Debounced graph report; also flushed when the page is hidden or unloaded. */\n onGraphChange?: (graph: FlowGraph) => void\n /** Every committed change, undebounced (AutosaveController). */\n onGraphCommit?: (graph: FlowGraph) => void\n debounceMs?: number\n onToggleRule?: (rule: StoredRule) => void\n extraNodeKinds?: Record<string, FlowNodeComponent>\n /** Replaces the built-in node configuration dialog. */\n renderNodeEditor?: (ctx: { payload: NodeConfigPayload; save: (config: Record<string, unknown>) => void; close: () => void }) => ReactNode\n /** Agent editor (host-supplied; the dialog-stack payload tells create or edit). */\n renderAgentEditor?: (ctx: { payload: AgentEditorPayload; close: () => void }) => ReactNode\n isCreatingAgent?: boolean\n onCancelCreateAgent?: () => void\n /** Props for the built-in node configuration dialog (data sources, loaders …). */\n nodeEditorProps?: Omit<NodeConfigDialogProps, 'onSave'>\n /** Host dock: receives the tool items; the built-in bottom toolbar otherwise. */\n renderTools?: (items: CanvasToolItem[]) => ReactNode\n /** Step palette props; `false` hides the palette. */\n palette?: Pick<StepPaletteProps, 'className'> | false\n /** Research steps and their shelves (default: the built-in research verbs). */\n steps?: StepCatalog\n /** False when the project allows no agents: AI steps are unavailable. */\n agentsAllowed?: boolean\n /** Start in the list view instead of the canvas. */\n defaultListView?: boolean\n /** `false` hides the side panel (flow summary / step settings). */\n sidePanel?: boolean\n /** Facts the summary shows next to what the editor counts. */\n flowFacts?: FlowFacts\n onRunFlow?: () => void\n /** Called after \"validate flow\" with the wiring issues found. */\n onValidate?: (issues: readonly WiringIssue[]) => void\n onTestStep?: (nodeId: string) => void\n /** Problems the host found in steps' settings (e.g. the API's validation), by node id, then field key ('' for the whole configuration). */\n stepProblems?: ReadonlyMap<string, Record<string, string>>\n /** A few rows of a step's output for the side panel. */\n outputPreview?: (nodeId: string) => OutputPreview | null\n /** Horizontal layouts read left to right even in RTL locales. */\n keepLtrLayout?: boolean\n locked?: boolean\n singleKeyShortcuts?: boolean\n historyLimit?: number\n /** Run views (panel and drawer); shown when a loader is given. */\n runs?: Omit<RunViewsProps, 'flowId'>\n /** Existing store (hosts that drive runs or tests); one is created otherwise. */\n store?: FlowEditorStore\n labels?: Partial<FlowEditorLabels>\n className?: string\n}\n\nfunction graphOf(store: FlowEditorStore, viewport: Viewport): FlowGraph {\n const s = store.getState()\n return {\n nodes: s.nodes.map(({ selected: _s, measured: _m, ...n }) => n),\n connectors: s.connectors.map(({ selected: _s, ...c }) => c),\n viewport,\n }\n}\n\nexport function FlowEditor(props: FlowEditorProps) {\n const boot = useFlowEditorBootstrap()\n const [store] = useState(\n () =>\n props.store ??\n createFlowEditorStore({\n historyLimit: props.historyLimit ?? 50,\n initial: {\n nodes: props.initialGraph?.nodes ?? boot?.data?.graph?.nodes ?? [],\n connectors: props.initialGraph?.connectors ?? boot?.data?.graph?.connectors ?? [],\n locked: !!props.locked,\n },\n }),\n )\n // A provider that finishes loading after mount hydrates an empty editor once.\n const hydrated = useRef(store.getState().nodes.length > 0)\n useEffect(() => {\n const g = boot?.data?.graph\n if (!hydrated.current && g) {\n hydrated.current = true\n store.setState({ nodes: g.nodes, connectors: g.connectors })\n }\n }, [boot?.data?.graph, store])\n useEffect(() => {\n store.actions.setLocked(!!props.locked)\n }, [props.locked, store])\n\n return (\n <FlowEditorStateProvider store={store}>\n <DialogStackProvider>\n <ConfirmProvider>\n <AnnouncerProvider>\n <EditorBody {...props} reference={props.reference ?? boot?.data?.reference ?? {}} />\n </AnnouncerProvider>\n </ConfirmProvider>\n </DialogStackProvider>\n </FlowEditorStateProvider>\n )\n}\n\nconst LAYOUT_TO_CYCLE: Record<string, LayoutCycle> = { down: 'top-down', right: 'left-right' }\nconst NUDGE = 8\n/** Step flows keep their main chain on one line with branches after it. */\nconst STEP_SPACING = (rtl: boolean) => ({ rankGap: 54, siblingGap: 24, alignment: 'start' as const, rtl })\nconst DRAWN = (n: FlowNode) => n.kind !== 'note' && n.kind !== 'group'\nconst isTyping = (el: HTMLElement) => !!el.closest('input, textarea, select, [contenteditable=\"true\"]')\nconst plainA = (e: KeyboardEvent<HTMLElement>) => (e.key === 'a' || e.key === 'A') && !e.metaKey && !e.ctrlKey && !e.altKey\n\n/** Where a new step goes: after a step, inside a link, or loose near a point. */\ntype Placement = { after: string } | { through: string } | { near: Point }\n\ninterface PickerState {\n title: string\n /** Shorter title for the search placeholder. */\n placeholder?: string\n arriving?: DataShape | null\n options: ReadyStep[]\n place: (stepId: string) => void\n}\n\nfunction EditorBody(props: FlowEditorProps & { reference: FlowReferenceData }) {\n const { reference, debounceMs = 800, extraNodeKinds, keepLtrLayout = false, singleKeyShortcuts = true } = props\n const l = useLabels(flowEditorLabels, props.labels)\n const sw = useLabels(stepEditorWords, undefined)\n const { locale, rtl } = useFlowLocale()\n const store = useFlowEditorStore()\n const actions = store.actions\n const catalog = useRenderCatalog()\n const announce = useAnnounce()\n const dialogs = useDialogStack()\n const wide = useMediaQuery('(min-width: 1024px)', true)\n const ready = useReadyCatalog(props.steps ?? researchStepCatalog)\n const aiAllowed = props.agentsAllowed !== false\n const [paletteOpen, setPaletteOpen] = useState(false)\n\n const nodes = useFlowEditorState((s) => s.nodes)\n const connectors = useFlowEditorState((s) => s.connectors)\n const locked = useFlowEditorState((s) => s.locked)\n const mode = useFlowEditorState((s) => s.controlMode)\n const density = useFlowEditorState((s) => s.cardDensity)\n const direction = useFlowEditorState((s) => s.layoutDirection)\n const panels = useFlowEditorState((s) => s.panels)\n const clipboard = useFlowEditorState((s) => !!s.clipboard)\n const menu = useFlowEditorState((s) => s.contextMenu)\n\n const apiRef = useRef<CanvasApi>(null)\n const rootRef = useRef<HTMLDivElement>(null)\n const canvasRef = useRef<HTMLDivElement>(null)\n const sideRef = useRef<HTMLElement>(null)\n const [viewport, setViewport] = useState<Viewport>(props.initialGraph?.viewport ?? { x: 0, y: 0, zoom: 1 })\n const viewportRef = useRef(viewport)\n viewportRef.current = viewport\n const [listView, setListView] = useState(!!props.defaultListView)\n const [searchOpen, setSearchOpen] = useState(false)\n const [picker, setPicker] = useState<PickerState | null>(null)\n const pickerAnchor = useRef<HTMLElement | null>(null)\n const [dragStep, setDragStep] = useState<string | null>(null)\n const [dropAt, setDropAt] = useState<{ start: number; top: number } | null>(null)\n const [recent, setRecent] = useState<string[]>([])\n const [validation, setValidation] = useState<string | null>(null)\n const searchTrigger = useRef<HTMLElement | null>(null)\n\n const kinds = useMemo(() => ({ [STEP_KIND]: StepCard, ...(extraNodeKinds ?? {}) }), [extraNodeKinds])\n const sizeOf = useCallback((n: FlowNode) => (n.kind === STEP_KIND ? (n.size ?? { ...STEP_CARD_SIZE }) : sizeForNode(n, density)), [density])\n const byId = useMemo(() => new Map(nodes.map((n) => [n.id, n])), [nodes])\n const titleOf = useCallback(\n (n: FlowNode) => {\n const label = typeof n.data.label === 'string' && n.data.label ? n.data.label : undefined\n return label ?? (n.kind === STEP_KIND ? specOfNode(n, ready.byId)?.name : undefined) ?? nodeTitle(n, catalog)\n },\n [ready, catalog],\n )\n const nameOf = useCallback((id: string) => {\n const n = byId.get(id)\n return n ? titleOf(n) : id\n }, [byId, titleOf])\n\n // ---- graph reporting -------------------------------------------------\n const dragging = useRef(false)\n const report = useRef({ change: props.onGraphChange, commit: props.onGraphCommit })\n report.current = { change: props.onGraphChange, commit: props.onGraphCommit }\n const pending = useRef<ReturnType<typeof setTimeout> | null>(null)\n const flush = useCallback(() => {\n if (!pending.current) return\n clearTimeout(pending.current)\n pending.current = null\n report.current.change?.(graphOf(store, viewportRef.current))\n }, [store])\n useEffect(() => {\n let last = { nodes: store.getState().nodes, connectors: store.getState().connectors }\n return store.subscribe(() => {\n const s = store.getState()\n if (s.nodes === last.nodes && s.connectors === last.connectors) return\n // Selection alone is not an edit.\n const selectionOnly =\n s.nodes.length === last.nodes.length &&\n s.connectors.length === last.connectors.length &&\n s.nodes.every((n, i) => n === last.nodes[i] || (n.id === last.nodes[i]!.id && n.position === last.nodes[i]!.position && n.data === last.nodes[i]!.data && n.size === last.nodes[i]!.size && n.hidden === last.nodes[i]!.hidden && n.parentId === last.nodes[i]!.parentId)) &&\n s.connectors.every((c, i) => c === last.connectors[i] || (c.id === last.connectors[i]!.id && c.source === last.connectors[i]!.source && c.target === last.connectors[i]!.target && c.hidden === last.connectors[i]!.hidden))\n last = { nodes: s.nodes, connectors: s.connectors }\n if (selectionOnly || dragging.current) return\n const graph = graphOf(store, viewportRef.current)\n report.current.commit?.(graph)\n if (pending.current) clearTimeout(pending.current)\n pending.current = setTimeout(() => {\n pending.current = null\n report.current.change?.(graphOf(store, viewportRef.current))\n }, debounceMs)\n })\n }, [store, debounceMs])\n useEffect(() => {\n const onHidden = () => {\n if (document.visibilityState === 'hidden') flush()\n }\n document.addEventListener('visibilitychange', onHidden)\n window.addEventListener('pagehide', flush)\n return () => {\n document.removeEventListener('visibilitychange', onHidden)\n window.removeEventListener('pagehide', flush)\n flush()\n }\n }, [flush])\n\n // ---- surface model and wiring checks ----------------------------------\n const ordered = useMemo(() => flowReadingOrder(nodes, connectors, direction === 'right'), [nodes, connectors, direction])\n const surfaceNodes: SurfaceNode[] = useMemo(\n () =>\n ordered.map((n) => {\n const sized = { ...n, size: sizeOf(n) }\n return {\n id: n.id,\n rect: absoluteRect(sized, byId, sized.size),\n layer: n.kind === 'group' ? 0 : 1,\n fixedHeight: n.kind === 'group' || n.kind === 'note' || n.kind === STEP_KIND,\n ...(n.selected ? { selected: true } : {}),\n ...(n.hidden ? { hidden: true } : {}),\n draggable: !locked,\n tone: catalog.tone(n.kind),\n }\n }),\n [ordered, sizeOf, byId, locked, catalog],\n )\n const issues = useMemo(() => wiringIssues(nodes, connectors, ready.steps, aiAllowed), [nodes, connectors, ready, aiAllowed])\n const issuesByNode = useMemo(() => {\n const m = new Map<string, WiringIssue[]>()\n for (const i of issues) m.set(i.nodeId, [...(m.get(i.nodeId) ?? []), i])\n return m\n }, [issues])\n\n // ---- actions ---------------------------------------------------------\n const guides = useAlignmentGuides({ nameOf })\n const dragOrigin = useRef(new Map<string, Point>())\n const arrange = useSelectionArrange({\n nodes,\n setNodes: actions.setNodes,\n snapshot: actions.snapshot,\n locked,\n groupName: l.group,\n announce: (action, d) => announce(fill(action === 'group' ? l.arranged : l.aligned, { count: d.count }, locale)),\n })\n const focusNodeSoon = (id: string) => requestAnimationFrame(() => apiRef.current?.focusNode(id))\n\n const layoutNow = useCallback(\n (cycle: LayoutCycle, snapshot: boolean) => {\n const dir = cycle === 'left-right' ? 'right' : 'down'\n actions.setLayoutDirection(dir)\n const sized = store.getState().nodes.map((n) => ({ ...n, size: sizeOf(n) }))\n const laid = autoLayout(sized, store.getState().connectors, rankDirectionOf(dir, rtl, keepLtrLayout), STEP_SPACING(rtl && !keepLtrLayout))\n if (snapshot) actions.snapshot()\n const moved = new Map(laid.map((n) => [n.id, n.position]))\n actions.setNodes((prev) => prev.map((n) => (moved.get(n.id) === n.position ? n : { ...n, position: moved.get(n.id) ?? n.position })))\n requestAnimationFrame(() => apiRef.current?.fit())\n },\n [store, sizeOf, actions, rtl, keepLtrLayout],\n )\n const currentCycle = useCallback((): LayoutCycle => LAYOUT_TO_CYCLE[store.getState().layoutDirection] ?? 'top-down', [store])\n\n /** A node of a host kind (old palette payloads, notes from the canvas menu). */\n const addNode = useCallback(\n (kind: string, at: Point, payload?: Partial<PalettePayload>) => {\n if (locked) return null\n const id = createId(kind)\n const config = payload?.config ?? nodeKindCatalog.createDefaultConfig(kind) ?? {}\n const data: Record<string, unknown> = { ...config, ...(payload?.label ? { label: payload.label } : {}) }\n if (payload?.entityId) data[kind === 'agent' ? 'agentRef' : kind === 'rule' ? 'ruleId' : 'sourceId'] = payload.entityId\n const size = sizeForNode({ id, kind, position: at, data }, density)\n actions.snapshot()\n actions.setNodes((prev) => [...prev.map((n) => (n.selected ? { ...n, selected: false } : n)), { id, kind, data, position: { x: at.x - size.width / 2, y: at.y - size.height / 2 }, selected: true }])\n return id\n },\n [locked, density, actions],\n )\n\n /** Adds a research step, links it and lays the flow out again (one undo step). */\n const insertStep = useCallback(\n (stepId: string, place: Placement) => {\n const step = ready.byId.get(stepId)\n if (!step || store.getState().locked || (step.usesAI && !aiAllowed)) return null\n const id = createId(step.kind)\n const all = store.getState().nodes\n const anchor = 'after' in place ? all.find((n) => n.id === place.after) : undefined\n const link = 'through' in place ? store.getState().connectors.find((c) => c.id === place.through) : undefined\n const ends = link ? [all.find((n) => n.id === link.source), all.find((n) => n.id === link.target)] : []\n const at =\n 'near' in place\n ? { x: place.near.x - STEP_CARD_SIZE.width / 2, y: place.near.y - STEP_CARD_SIZE.height / 2 }\n : anchor\n ? { x: anchor.position.x, y: anchor.position.y + 140 }\n : ends[0] && ends[1]\n ? { x: (ends[0].position.x + ends[1].position.x) / 2, y: (ends[0].position.y + ends[1].position.y) / 2 }\n : { x: 0, y: 0 }\n actions.snapshot()\n actions.setNodes((prev) => [...prev.map((n) => (n.selected ? { ...n, selected: false } : n)), { ...stepNode(step, id, at), selected: true }])\n if ('after' in place) actions.setConnectors((prev) => linkAfter(prev, place.after, id, () => createId('connector')))\n else if ('through' in place) actions.setConnectors((prev) => linkThrough(prev, place.through, id, () => createId('connector')))\n if (!('near' in place)) layoutNow(currentCycle(), false)\n setRecent((r) => [stepId, ...r.filter((x) => x !== stepId)].slice(0, 8))\n announce(fill(sw.added, { name: step.name }, locale))\n requestAnimationFrame(() => apiRef.current?.focusNode(id))\n return id\n },\n [ready, store, aiAllowed, actions, layoutNow, currentCycle, announce, sw, locale],\n )\n\n /** Step a loose step should follow: the selection, else the nearest open end that fits. */\n const sourceFor = useCallback(\n (step: ReadyStep, near: Point): string | null => {\n const accepts = step.inputs[0]\n if (!accepts || step.primitive) return null\n const s = store.getState()\n const index = new Map(s.nodes.map((n) => [n.id, n]))\n const fits = (n: FlowNode) => {\n const g = givenShape(n, ready.byId)\n return !!g && accepts.includes(g)\n }\n const chosen = s.nodes.find((n) => n.selected && fits(n))\n if (chosen) return chosen.id\n const open = new Set(s.nodes.map((n) => n.id))\n for (const c of s.connectors) open.delete(c.source)\n let best: string | null = null\n let score = Infinity\n for (const n of s.nodes) {\n if (!fits(n)) continue\n const r = absoluteRect({ ...n, size: sizeOf(n) }, index, sizeOf(n))\n const gap = Math.hypot(r.x + r.width / 2 - near.x, r.y + r.height / 2 - near.y)\n const d = (Number.isFinite(gap) ? gap : 0) + (open.has(n.id) ? 0 : 100000)\n if (d < score) {\n best = n.id\n score = d\n }\n }\n return best\n },\n [store, ready, sizeOf],\n )\n\n /** Palette placement (tap, Enter or drop): follows a fitting step when there is one. */\n const placeLoose = useCallback(\n (stepId: string, near: Point) => {\n const step = ready.byId.get(stepId)\n if (!step) return null\n const from = sourceFor(step, near)\n return insertStep(stepId, from ? { after: from } : { near })\n },\n [ready, sourceFor, insertStep],\n )\n\n const canvasCentre = () => apiRef.current?.visibleCentre() ?? { x: 0, y: 0 }\n const openPicker = (trigger: HTMLElement | null, state: PickerState) => {\n pickerAnchor.current = trigger ?? rootRef.current\n setPicker(state)\n }\n const openAfter = useCallback(\n (nodeId: string, trigger: HTMLElement | null) => {\n const n = store.getState().nodes.find((x) => x.id === nodeId)\n if (!n || store.getState().locked) return\n const shape = givenShape(n, ready.byId)\n const name = nameOf(nodeId)\n openPicker(trigger, {\n title: fill(sw.pickerAfter, { name }, locale),\n placeholder: fill(sw.pickerAfter, { name: [...name].length > 14 ? `${[...name].slice(0, 7).join('').trimEnd()}...` : name }, locale),\n arriving: shape,\n // After one step: steps with a single input (a join also needs its second input).\n options: shape === null ? [] : stepsAccepting(shape, ready.steps, aiAllowed).filter((st) => st.inputs.length === 1),\n place: (id) => insertStep(id, { after: nodeId }),\n })\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [store, ready, sw, nameOf, locale, aiAllowed, insertStep],\n )\n const openThrough = (connectorId: string) => {\n const c = store.getState().connectors.find((x) => x.id === connectorId)\n const from = c ? byId.get(c.source) : undefined\n if (!c || !from) return\n const shape = givenShape(from, ready.byId)\n const active = document.activeElement instanceof HTMLElement && canvasRef.current?.contains(document.activeElement) ? document.activeElement : canvasRef.current\n openPicker(active, {\n title: fill(sw.pickerBetween, { from: nameOf(c.source), to: nameOf(c.target) }, locale),\n arriving: shape,\n options: shape === null ? [] : stepsAccepting(shape, ready.steps, aiAllowed),\n place: (id) => insertStep(id, { through: connectorId }),\n })\n }\n const openLoose = (trigger: HTMLElement | null) =>\n openPicker(trigger, {\n title: sw.pickerFree,\n options: ready.steps.filter((s) => !s.primitive && (!s.usesAI || aiAllowed)),\n place: (id) => placeLoose(id, canvasCentre()),\n })\n /** Dock item and the A key: after the selected step, else a loose step. */\n const addFromDock = () => {\n const chosen = store.getState().nodes.find((n) => n.selected)\n const dockButton = rootRef.current?.querySelector<HTMLElement>('[data-tool=\"add-step\"]') ?? null\n if (chosen && DRAWN(chosen)) openAfter(chosen.id, rootRef.current?.querySelector<HTMLElement>(`[data-ty-add-after=\"${chosen.id}\"]`) ?? dockButton)\n else openLoose(dockButton)\n }\n\n const showSettings = (id: string) => {\n actions.select([id])\n requestAnimationFrame(() => sideRef.current?.querySelector<HTMLElement>('input, textarea')?.focus())\n }\n const openConfig = useCallback(\n (id: string) => {\n const n = store.getState().nodes.find((x) => x.id === id)\n if (!n || store.getState().locked) return\n if (n.kind === 'note') return\n if (n.kind === STEP_KIND && props.sidePanel !== false) {\n showSettings(id)\n return\n }\n actions.setEditingNode(id)\n const references = ancestorsOf(id, store.getState().connectors)\n dialogs.open<NodeConfigPayload>('node-config', { nodeId: id, kind: n.kind, label: nodeTitle(n, catalog), config: n.data, references })\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [store, actions, dialogs, catalog, props.sidePanel],\n )\n\n const saveConfig = useCallback(\n (nodeId: string, config: Record<string, unknown>) => {\n actions.snapshot()\n actions.setNodes((prev) => prev.map((n) => (n.id === nodeId ? { ...n, data: { ...config, ...(typeof n.data.label === 'string' && config.label === undefined ? { label: n.data.label } : {}) } } : n)))\n },\n [actions],\n )\n const editStep = (nodeId: string, patch: Record<string, unknown>) => {\n actions.snapshot()\n actions.setNodes((prev) =>\n prev.map((n) => {\n if (n.id !== nodeId) return n\n const data = { ...n.data, ...patch }\n for (const k of Object.keys(patch)) if (patch[k] === undefined) delete data[k]\n return { ...n, data }\n }),\n )\n }\n\n const connect = useCallback(\n (from: PortRef, to: PortRef) => {\n if (store.getState().locked) return\n const exists = store.getState().connectors.some((c) => c.source === from.nodeId && c.target === to.nodeId && (c.sourcePort ?? null) === (from.portId ?? null))\n if (exists) return\n actions.snapshot()\n actions.setConnectors((prev) => [\n ...prev,\n { id: createId('connector'), source: from.nodeId, target: to.nodeId, ...(from.portId ? { sourcePort: from.portId } : {}), ...(to.portId ? { targetPort: to.portId } : {}) },\n ])\n },\n [store, actions],\n )\n\n const autoArrange = useCallback(\n (cycle: LayoutCycle) => {\n if (!locked) layoutNow(cycle, true)\n },\n [locked, layoutNow],\n )\n\n const repair = (issue: WiringIssue) => {\n const fix = issue.repair\n if (fix.kind === 'replace') {\n actions.snapshot()\n actions.setNodes((prev) => prev.map((n) => (n.id === fix.nodeId ? { ...n, data: { stepId: fix.stepId } } : n)))\n announce(fill(sw.added, { name: ready.byId.get(fix.stepId)?.name ?? fix.stepId }, locale))\n } else if (fix.kind === 'insert') insertStep(fix.stepId, { through: issue.connectorId })\n else actions.removeConnector(issue.connectorId)\n }\n const validate = () => {\n setValidation(issues.length ? fill(sw.issueCount, { count: issues.length }, locale) : sw.validOk)\n props.onValidate?.(issues)\n }\n\n /** List view reorder: swaps linked neighbours, else their places. */\n const moveInList = (id: string, towards: -1 | 1) => {\n const list = ordered.filter(DRAWN)\n const i = list.findIndex((n) => n.id === id)\n const other = list[i + towards]\n if (!other || locked) return\n const [first, second] = towards === 1 ? [id, other.id] : [other.id, id]\n const swapped = swapNeighbours(store.getState().connectors, first, second)\n actions.snapshot()\n if (swapped) {\n actions.setConnectors(() => swapped)\n layoutNow(currentCycle(), false)\n } else {\n const a = list[i]!\n actions.setNodes((prev) => prev.map((n) => (n.id === a.id ? { ...n, position: other.position } : n.id === other.id ? { ...n, position: a.position } : n)))\n }\n announce(fill(sw.moved, { name: nameOf(id), position: i + towards + 1 }, locale))\n }\n\n const escape = useCallback(() => {\n const s = store.getState()\n if (s.contextMenu) {\n actions.closeContextMenu()\n return true\n }\n if (s.nodes.some((n) => n.selected) || s.connectors.some((c) => c.selected)) {\n actions.deselectAll()\n return true\n }\n return false\n }, [store, actions])\n\n const leave = useCallback(() => {\n const tools = rootRef.current?.querySelector<HTMLElement>('[data-ty-canvas-exit] button, [data-ty-canvas-exit] [role=\"button\"]')\n if (tools) tools.focus()\n else focusAfter(canvasRef.current)\n }, [])\n\n useEditorShortcuts(\n {\n escape,\n selectTool: () => actions.setControlMode('select'),\n panTool: () => actions.setControlMode('pan'),\n toggleGrid: () => actions.togglePanel('grid'),\n toggleMinimap: () => actions.togglePanel('minimap'),\n zoom100: () => apiRef.current?.zoomTo(1),\n zoom50: () => apiRef.current?.zoomTo(0.5),\n group: () => {\n if (store.getState().nodes.filter((n) => n.selected).length < 2) return false\n arrange.group()\n },\n ungroup: () => arrange.ungroup(),\n undo: () => {\n if (!store.getState().past.length) return false\n actions.undo()\n },\n redo: () => {\n if (!store.getState().future.length) return false\n actions.redo()\n },\n copy: () => actions.copy(),\n paste: () => {\n if (!store.getState().clipboard) return false\n actions.paste()\n },\n selectAll: () => actions.selectAll(),\n duplicate: () => actions.duplicate(),\n fit: () => apiRef.current?.fit(),\n zoomOut: () => apiRef.current?.zoomOut(),\n zoomIn: () => apiRef.current?.zoomIn(),\n delete: () => {\n if (store.getState().locked) return false\n actions.removeSelection()\n },\n },\n { scope: canvasRef, enabled: true, singleKey: singleKeyShortcuts, onLeave: leave },\n )\n\n // ---- node keys: add after, nudge, context menu -----------------------\n const onNodeKeyDown = (id: string, e: KeyboardEvent<HTMLElement>) => {\n const target = e.target as HTMLElement\n if (isTyping(target)) return\n if (isContextMenuKey(e)) {\n e.preventDefault()\n const r = target.getBoundingClientRect()\n const selectedCount = store.getState().nodes.filter((n) => n.selected).length\n actions.openContextMenu({ kind: selectedCount > 1 ? 'selection' : 'node', position: { x: r.left + 8, y: r.bottom }, targetId: id })\n return\n }\n if (plainA(e) && singleKeyShortcuts && !locked && target.hasAttribute('data-ty-node-focus')) {\n e.preventDefault()\n e.stopPropagation()\n openAfter(id, rootRef.current?.querySelector<HTMLElement>(`[data-ty-add-after=\"${id}\"]`) ?? target)\n return\n }\n const steps: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }\n const step = steps[e.key]\n if (!step || locked || e.metaKey || e.ctrlKey || e.altKey) return\n if (!target.hasAttribute('data-ty-node-focus')) return\n e.preventDefault()\n e.stopPropagation()\n const amount = e.shiftKey ? NUDGE * 4 : NUDGE\n // Arrow keys move on screen: left is left in both reading directions.\n actions.snapshot()\n actions.setNodes((prev) => prev.map((n) => (n.id === id ? { ...n, position: { x: n.position.x + step[0] * amount, y: n.position.y + step[1] * amount } } : n)))\n const moved = store.getState().nodes.find((n) => n.id === id)\n if (moved) {\n const all = store.getState().nodes.filter((n) => !n.hidden && n.id !== id).map((n) => ({ id: n.id, rect: absoluteRect(n, byId, sizeOf(n)) }))\n guides.onKeyboardMove(all, absoluteRect(moved, byId, sizeOf(moved)), id)\n }\n }\n\n // ---- palette drop ----------------------------------------------------\n const onDragOver = (e: DragEvent<HTMLDivElement>) => {\n if (locked) return\n const types = [...e.dataTransfer.types]\n if (types.includes(STEP_MEDIA_TYPE) || types.includes(PALETTE_MEDIA_TYPE)) {\n e.preventDefault()\n e.dataTransfer.dropEffect = 'copy'\n }\n if (types.includes(STEP_MEDIA_TYPE) && canvasRef.current) {\n const named = stepOfDrag(types)\n if (named && named !== dragStep) setDragStep(ready.steps.find((st) => st.id.toLowerCase() === named)?.id ?? null)\n const r = canvasRef.current.getBoundingClientRect()\n // The drop outline stays whole inside the canvas.\n const half = { w: STEP_CARD_SIZE.width / 2 + 8, h: STEP_CARD_SIZE.height / 2 + 8 }\n const clamp = (v: number, lo: number, hi: number) => Math.min(Math.max(v, lo), Math.max(lo, hi))\n setDropAt({ start: clamp(rtl ? r.right - e.clientX : e.clientX - r.left, half.w, r.width - half.w), top: clamp(e.clientY - r.top, half.h, r.height - half.h) })\n }\n }\n const onDragLeave = (e: DragEvent<HTMLDivElement>) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setDropAt(null)\n }\n const onDrop = (e: DragEvent<HTMLDivElement>) => {\n setDropAt(null)\n setDragStep(null)\n if (locked) return\n const at = apiRef.current?.clientToCanvas({ x: e.clientX, y: e.clientY }) ?? { x: 0, y: 0 }\n const stepRaw = e.dataTransfer.getData(STEP_MEDIA_TYPE)\n const hostRaw = e.dataTransfer.getData(PALETTE_MEDIA_TYPE)\n if (!stepRaw && !hostRaw) return\n e.preventDefault()\n try {\n if (stepRaw) {\n const { stepId } = JSON.parse(stepRaw) as { stepId: string }\n placeLoose(stepId, at)\n } else {\n const payload = JSON.parse(hostRaw) as PalettePayload\n const id = addNode(payload.kind, at, payload)\n if (id) focusNodeSoon(id)\n }\n } catch {\n // Not a palette payload: ignore.\n }\n }\n\n // ---- tools -----------------------------------------------------------\n const items = stepToolItems({\n words: sw,\n mode,\n onModeChange: actions.setControlMode,\n onAdd: locked ? undefined : addFromDock,\n onArrange: locked ? undefined : () => autoArrange(currentCycle()),\n onFit: () => apiRef.current?.fit(),\n listView,\n onToggleList: () => setListView((v) => !v),\n onSearch: () => {\n searchTrigger.current = rootRef.current?.querySelector<HTMLElement>('[data-tool=\"search\"]') ?? null\n setSearchOpen(true)\n },\n })\n\n // ---- rendering ---------------------------------------------------------\n const renderNode = (sn: SurfaceNode) => {\n const node = byId.get(sn.id)!\n const Card = componentForKind(node.kind, kinds)\n return (\n <div\n className=\"ty-editor__node\"\n onFocus={(e) => {\n // Keyboard focus selects the node (unless it is already in the selection).\n if (e.target.hasAttribute('data-ty-node-focus') && !node.selected) actions.select([node.id])\n }}\n // Capture phase: React Aria buttons inside cards stop key propagation.\n onKeyDownCapture={(e) => onNodeKeyDown(node.id, e)}\n onPointerDown={(e) => {\n if (e.shiftKey || e.metaKey || e.ctrlKey) actions.select([node.id], true)\n else if (!node.selected) actions.select([node.id])\n }}\n >\n <Card\n node={node}\n density={density}\n direction={direction}\n locked={locked}\n selected={!!node.selected}\n reference={reference}\n onConfigure={openConfig}\n onRemove={(id) => actions.removeNodes([id])}\n onDuplicate={(id) => actions.duplicate([id])}\n onRename={(id, label) => {\n actions.snapshot()\n actions.setNodes((prev) => prev.map((n) => (n.id === id ? { ...n, data: { ...n.data, label } } : n)))\n }}\n {...(props.onToggleRule ? { onToggleRule: props.onToggleRule } : {})}\n />\n </div>\n )\n }\n\n const chosen = nodes.filter((n) => n.selected)\n const single = chosen.length === 1 && DRAWN(chosen[0]!) ? chosen[0]! : null\n const nodeConfig = useActiveDialog<NodeConfigPayload>('node-config')\n const agentDialog = useActiveDialog<AgentEditorPayload>('agent-editor')\n useEffect(() => {\n if (props.isCreatingAgent) dialogs.open<AgentEditorPayload>('agent-editor', { mode: 'create' })\n }, [props.isCreatingAgent, dialogs])\n\n const closeConfig = () => {\n const id = nodeConfig?.payload.nodeId\n dialogs.close()\n actions.setEditingNode(null)\n if (id) focusNodeSoon(id)\n }\n\n const tools = props.renderTools ? props.renderTools(items) : <CanvasToolbar items={items} label={l.tools} placement=\"dock\" />\n const issueBar = <IssueBar issues={issues} nameOf={nameOf} locked={locked} onRepair={repair} onShow={(id) => (listView ? showSettings(id) : (apiRef.current?.reveal(id), actions.select([id]), focusNodeSoon(id)))} />\n\n // Below 1024 px the palette opens as a bottom drawer and steps are placed by tap.\n const paletteBody =\n props.palette === false ? null : (\n <StepPalette\n {...(props.palette ?? {})}\n recent={recent}\n onDragChange={setDragStep}\n onPlace={(stepId) => {\n setPaletteOpen(false)\n placeLoose(stepId, canvasCentre())\n }}\n />\n )\n\n const dragName = dragStep ? ready.byId.get(dragStep)?.name : undefined\n\n return (\n <StepsProvider catalog={props.steps ?? researchStepCatalog} aiAllowed={aiAllowed} issues={issuesByNode} {...(props.stepProblems ? { problems: props.stepProblems } : {})} addAfter={openAfter}>\n <div\n ref={rootRef}\n className={['ty-editor', props.className].filter(Boolean).join(' ')}\n data-view={listView ? 'list' : 'canvas'}\n data-side={props.sidePanel === false ? 'none' : 'shown'}\n data-palette={props.palette === false || (listView && wide) ? 'none' : 'shown'}\n data-locked={locked ? 'true' : 'false'}\n >\n {props.palette !== false && wide && !listView ? <aside className=\"ty-editor__palette\" aria-label={l.palette}>{paletteBody}</aside> : null}\n {props.palette !== false && !wide ? (\n <>\n <Button className=\"ty-editor__palette-open\" variant=\"secondary\" leadingIcon={<Plus />} onPress={() => setPaletteOpen(true)}>\n {l.openPalette}\n </Button>\n <Drawer open={paletteOpen} onOpenChange={setPaletteOpen} title={l.palette} placement=\"bottom\">\n {paletteBody}\n </Drawer>\n </>\n ) : null}\n {listView ? (\n <div\n className=\"ty-editor__canvas\"\n data-view=\"list\"\n onKeyDown={(e) => {\n if (plainA(e) && !locked && !isTyping(e.target as HTMLElement) && !(e.target as HTMLElement).closest('.ty-flow-step-list__main')) {\n e.preventDefault()\n addFromDock()\n }\n }}\n >\n {issueBar}\n <StepListView\n nodes={ordered.filter(DRAWN)}\n locked={locked}\n activeId={single?.id ?? null}\n onConfigure={showSettings}\n onMove={moveInList}\n onRemove={(id) => actions.removeNodes([id])}\n onAddAfter={(id, trigger) => openAfter(id, trigger)}\n onActiveChange={(id) => actions.select([id])}\n />\n <div className=\"ty-editor__list-dock\">{tools}</div>\n </div>\n ) : (\n <div\n ref={canvasRef}\n className=\"ty-editor__canvas\"\n onDragOver={onDragOver}\n onDragLeave={onDragLeave}\n onDrop={onDrop}\n onKeyDown={(e) => {\n const t = e.target as HTMLElement\n if (plainA(e) && singleKeyShortcuts && !locked && !isTyping(t) && !t.closest('[data-ty-node-id]')) {\n e.preventDefault()\n addFromDock()\n }\n }}\n >\n {issueBar}\n <CanvasSurface\n label={l.canvas}\n roleDescription={l.roleDescription}\n nodes={surfaceNodes}\n connectors={connectors}\n viewport={viewport}\n onViewportChange={setViewport}\n fit=\"resize\"\n fitPadding={24}\n fitAlign=\"top\"\n mode={mode}\n dragNodes={!locked}\n marquee\n grid={panels.grid}\n minimap={panels.minimap}\n apiRef={apiRef}\n portAnchor={(id, port, role) => {\n const n = byId.get(id)\n if (!n) return 'border'\n if (n.kind === STEP_KIND) {\n const count = specOfNode(n, ready.byId)?.inputs.length ?? 1\n return role === 'source' ? { side: 'bottom', along: 0.5 } : { side: 'top', along: alongEdge(inputIndex(port), Math.max(1, count)) }\n }\n return anchorFor(n, port, role, direction, catalog)\n }}\n floating={catalog.floatingConnections}\n renderNode={renderNode}\n renderConnector={(c, shape) => {\n const conn = c as FlowConnector\n return renderConnectorParts(conn, shape, {\n sourceName: nameOf(c.source),\n targetName: nameOf(c.target),\n locked,\n selected: !!conn.selected,\n onSelect: (id) => actions.selectConnector(id),\n onDelete: (id) => actions.removeConnector(id),\n onOpenInsertPicker: (id) => openThrough(id),\n onInsertStep: (id, kind, point) => {\n const newId = addNode(kind, point)\n if (!newId) return\n // addNode took the snapshot: the split joins the same undo step.\n actions.setConnectors((prev) => splitConnectorThrough(prev, id, newId))\n },\n })\n }}\n overlay={guideOverlay(guides.guides)}\n onNodeDrag={(e) => {\n if (locked) return\n if (e.phase === 'start') {\n actions.snapshot()\n dragging.current = true\n dragOrigin.current = new Map(e.ids.map((id) => [id, byId.get(id)?.position ?? { x: 0, y: 0 }]))\n if (!e.ids.every((id) => byId.get(id)?.selected)) actions.select(e.ids)\n return\n }\n actions.setNodes((prev) => prev.map((n) => {\n const o = dragOrigin.current.get(n.id)\n return o ? { ...n, position: { x: o.x + e.delta.x, y: o.y + e.delta.y } } : n\n }))\n const ref = e.ids[0]!\n const moving = store.getState().nodes.find((n) => n.id === ref)\n if (moving && e.phase === 'move') {\n const all = store.getState().nodes.filter((n) => !n.hidden).map((n) => ({ id: n.id, rect: absoluteRect(n, byId, sizeOf(n)) }))\n guides.createDragHandler(all)(absoluteRect(moving, byId, sizeOf(moving)), ref, e.ids)\n }\n if (e.phase === 'end') {\n guides.onDragStop()\n // Groups that fit their members follow them.\n const parents = new Set(e.ids.map((id) => byId.get(id)?.parentId).filter((p): p is string => !!p))\n for (const p of parents) {\n if (byId.get(p)?.data.autoFit !== false) actions.setNodes((prev) => fitGroupToMembers(prev, p))\n }\n dragging.current = false\n // Commit the whole drag as one change.\n actions.setNodes((prev) => [...prev])\n }\n }}\n onMarquee={(ids, additive) => actions.select(ids, additive)}\n onBackgroundPress={() => actions.deselectAll()}\n onBackgroundContextMenu={(screen, canvasPoint) => actions.openContextMenu({ kind: 'canvas', position: screen, targetId: `${canvasPoint.x},${canvasPoint.y}` })}\n onNodeContextMenu={(id, screen) => {\n const many = store.getState().nodes.filter((n) => n.selected).length > 1 && byId.get(id)?.selected\n actions.openContextMenu({ kind: many ? 'selection' : 'node', position: screen, targetId: id })\n }}\n onEscape={escape}\n onLeave={leave}\n connect={{\n canConnect: (a, b) => {\n const s = byId.get(a.nodeId)\n const t = byId.get(b.nodeId)\n return !locked && !!s && !!t && connectionAllowed(s, t, a.portId, b.portId)\n },\n onConnect: connect,\n nameOf,\n labels: { canConnect: (name) => fill(l.canConnect, { name }, locale), cannotConnect: (name) => fill(l.cannotConnect, { name }, locale) },\n }}\n data={{ 'data-locked': locked ? 'true' : undefined }}\n >\n {tools}\n </CanvasSurface>\n {dropAt && dragName ? (\n <div className=\"ty-editor__drop\" style={{ insetInlineStart: dropAt.start, insetBlockStart: dropAt.top }} aria-hidden=\"true\">\n {fill(sw.dropHere, { name: dragName }, locale)}\n </div>\n ) : null}\n </div>\n )}\n {props.sidePanel !== false ? (\n <aside ref={sideRef} className=\"ty-editor__side\" aria-label={single ? nameOf(single.id) : sw.summaryTitle}>\n <FlowSidePanel\n nodes={nodes}\n selected={single}\n {...(props.flowFacts ? { facts: props.flowFacts } : {})}\n preview={single && props.outputPreview ? props.outputPreview(single.id) : null}\n locked={locked}\n validation={validation}\n {...(props.onRunFlow ? { onRunFlow: props.onRunFlow } : {})}\n onValidate={validate}\n {...(props.onTestStep ? { onTestStep: props.onTestStep } : {})}\n onRemove={(id) => actions.removeNodes([id])}\n onEdit={editStep}\n onBack={() => actions.deselectAll()}\n />\n </aside>\n ) : null}\n {picker ? (\n <AddStepPicker\n title={picker.title}\n {...(picker.placeholder ? { placeholder: picker.placeholder } : {})}\n {...(picker.arriving !== undefined ? { arriving: picker.arriving } : {})}\n options={picker.options}\n triggerRef={pickerAnchor}\n onPick={picker.place}\n onClose={() => setPicker(null)}\n />\n ) : null}\n {searchOpen ? (\n <CanvasNodeSearch\n isOpen\n onOpenChange={setSearchOpen}\n triggerRef={searchTrigger}\n nodes={nodes.filter((n) => !n.hidden).map((n) => ({ id: n.id, label: titleOf(n), kindLabel: n.kind === STEP_KIND ? (specOfNode(n, ready.byId)?.name ?? n.kind) : (catalog.entry(n.kind)?.label ?? n.kind) }))}\n onPick={(id) => {\n if (listView) {\n showSettings(id)\n return\n }\n apiRef.current?.reveal(id)\n actions.select([id])\n focusNodeSoon(id)\n }}\n />\n ) : null}\n {menu?.kind === 'node' && menu.targetId ? (\n <NodeContextMenu\n anchor={menu.position}\n targetId={menu.targetId}\n onClose={actions.closeContextMenu}\n onEdit={openConfig}\n onDuplicate={(id) => actions.duplicate([id])}\n onCopy={(id) => {\n actions.select([id])\n actions.copy()\n }}\n onDelete={(id) => actions.removeNodes([id])}\n />\n ) : null}\n {menu?.kind === 'selection' ? (\n <SelectionContextMenu\n anchor={menu.position}\n count={chosen.length}\n onClose={actions.closeContextMenu}\n onCopy={actions.copy}\n onDuplicate={() => actions.duplicate()}\n onDelete={actions.removeSelection}\n onGroup={arrange.group}\n onAlign={arrange.align}\n onDistribute={arrange.distribute}\n />\n ) : null}\n {menu?.kind === 'canvas' ? (\n <CanvasBackgroundMenu\n anchor={menu.position}\n onClose={actions.closeContextMenu}\n canvasPosition={parsePoint(menu.targetId)}\n hasClipboardContent={clipboard}\n onPaste={() => actions.paste()}\n onSelectAll={actions.selectAll}\n onFitView={() => apiRef.current?.fit()}\n onAddNote={(p) => {\n const id = addNode('note', p)\n if (id) focusNodeSoon(id)\n }}\n />\n ) : null}\n {nodeConfig\n ? props.renderNodeEditor\n ? props.renderNodeEditor({\n payload: nodeConfig.payload,\n save: (config) => {\n saveConfig(nodeConfig.payload.nodeId, config)\n closeConfig()\n },\n close: closeConfig,\n })\n : <NodeConfigDialog {...(props.nodeEditorProps ?? {})} onSave={(id, config) => saveConfig(id, config)} />\n : null}\n {agentDialog && props.renderAgentEditor\n ? props.renderAgentEditor({\n payload: agentDialog.payload,\n close: () => {\n dialogs.close()\n if (agentDialog.payload.mode === 'create') props.onCancelCreateAgent?.()\n },\n })\n : null}\n {props.runs && props.flowId ? <RunViews flowId={props.flowId} {...props.runs} /> : null}\n </div>\n </StepsProvider>\n )\n}\n\nfunction parsePoint(s: string | undefined): Point {\n const [x, y] = (s ?? '0,0').split(',').map(Number)\n return { x: x ?? 0, y: y ?? 0 }\n}\n","// AutosaveController wraps FlowEditor and fans every committed graph out to\n// two sinks, always in the same order: the snapshot sink (local mirrors such\n// as an unsaved-changes guard) and then the autosave sink (the host debounces\n// and persists). The relay handed to the editor is created once; it reads the\n// sinks from a box refreshed on each render, so new callback identities never\n// re-mount the canvas or lose its viewport and selection.\n\nimport { createElement, useState } from 'react'\nimport type { FlowGraph } from '../model/types'\nimport { FlowEditor, type FlowEditorProps } from './FlowEditor'\n\nexport interface AutosaveControllerProps extends Omit<FlowEditorProps, 'onGraphCommit'> {\n onAutosave: (graph: FlowGraph) => void\n onSnapshot?: (graph: FlowGraph) => void\n}\n\ntype Sink = ((graph: FlowGraph) => void) | undefined\n\nexport function AutosaveController(props: AutosaveControllerProps) {\n const { onAutosave, onSnapshot, ...editorProps } = props\n const [box] = useState<{ sinks: Sink[] }>(() => ({ sinks: [] }))\n box.sinks = [onSnapshot, onAutosave]\n const [relay] = useState(() => (graph: FlowGraph) => box.sinks.forEach((sink) => sink?.(graph)))\n return createElement(FlowEditor, { ...editorProps, onGraphCommit: relay })\n}\n","// Editor tools: the shared canvas tools (canvasTools.ts) plus the editing\n// ones (undo, redo, view toggles, layout direction, shortcut list). Same item\n// shape, so a host can hand them to its dock.\n\nimport { ArrowDownToLine, ArrowRightToLine, Grid3x3, Keyboard, Map as MapIcon, Move, Redo2, Rows3, Undo2 } from 'lucide-react'\nimport { canvasToolItems, type CanvasToolItem, type CanvasToolOptions } from '../toolbar/canvasTools'\nimport { defineLabels, fill } from '../internal/labels'\nimport { ariaShortcut } from './keyMap'\n\nexport type LayoutCycle = 'free' | 'left-right' | 'top-down'\n\n/** Tool groups beyond the shared ones only draw dividers. */\nconst grp = (name: string) => name as CanvasToolItem['group']\n\n/** free → left-right → top-down → free */\nexport function nextLayout(current: LayoutCycle): LayoutCycle {\n return current === 'free' ? 'left-right' : current === 'left-right' ? 'top-down' : 'free'\n}\n\nexport interface EditorToolLabels {\n undo: string\n redo: string\n minimap: string\n grid: string\n compact: string\n layout: string\n layoutFree: string\n layoutLeftRight: string\n layoutTopDown: string\n shortcuts: string\n}\n\nexport const editorToolLabels = defineLabels<EditorToolLabels>('editorTools', {\n en: {\n undo: 'Undo',\n redo: 'Redo',\n minimap: 'Overview map',\n grid: 'Dot grid',\n compact: 'Compact cards',\n layout: 'Layout: {direction}',\n layoutFree: 'free',\n layoutLeftRight: 'in reading direction',\n layoutTopDown: 'top to bottom',\n shortcuts: 'Keyboard shortcuts',\n },\n 'pt-BR': {\n undo: 'Desfazer',\n redo: 'Refazer',\n minimap: 'Mapa geral',\n grid: 'Grade de pontos',\n compact: 'Cartões compactos',\n layout: 'Disposição: {direction}',\n layoutFree: 'livre',\n layoutLeftRight: 'no sentido da leitura',\n layoutTopDown: 'de cima para baixo',\n shortcuts: 'Atalhos de teclado',\n },\n es: {\n undo: 'Deshacer',\n redo: 'Rehacer',\n minimap: 'Mapa general',\n grid: 'Cuadrícula de puntos',\n compact: 'Tarjetas compactas',\n layout: 'Disposición: {direction}',\n layoutFree: 'libre',\n layoutLeftRight: 'en el sentido de la lectura',\n layoutTopDown: 'de arriba abajo',\n shortcuts: 'Atajos de teclado',\n },\n})\n\nexport const defaultEditorToolLabels: EditorToolLabels = editorToolLabels.bundles.en\n\nexport interface EditorToolOptions extends Partial<CanvasToolOptions> {\n canUndo: boolean\n canRedo: boolean\n onUndo: () => void\n onRedo: () => void\n showMap: boolean\n showGrid: boolean\n compactCards: boolean\n onToggleMap: () => void\n onToggleGrid: () => void\n onToggleCompact: () => void\n layoutDirection: LayoutCycle\n onLayoutDirectionChange: (next: LayoutCycle) => void\n shortcutsOpen?: boolean\n onToggleShortcuts?: () => void\n editorLabels: EditorToolLabels\n}\n\n/** Editor tools in bar order; canvas tools are included when their handlers are given. */\nexport function editorToolItems(o: EditorToolOptions): CanvasToolItem[] {\n const l = o.editorLabels\n const base =\n o.onModeChange && o.onZoomIn && o.onZoomOut && o.onZoomReset && o.onFit\n ? canvasToolItems({\n zoom: o.zoom ?? 1,\n mode: o.mode ?? 'select',\n onModeChange: o.onModeChange,\n onZoomIn: o.onZoomIn,\n onZoomOut: o.onZoomOut,\n onZoomReset: o.onZoomReset,\n onFit: o.onFit,\n ...(o.onAutoLayout ? { onAutoLayout: o.onAutoLayout } : {}),\n ...(o.onToggleListView ? { onToggleListView: o.onToggleListView, listView: !!o.listView } : {}),\n ...(o.onSearch ? { onSearch: o.onSearch } : {}),\n ...(o.locale ? { locale: o.locale } : {}),\n ...(o.labels ? { labels: o.labels } : {}),\n ...(o.omit ? { omit: o.omit } : {}),\n })\n : []\n const direction = o.layoutDirection === 'free' ? l.layoutFree : o.layoutDirection === 'left-right' ? l.layoutLeftRight : l.layoutTopDown\n const history: CanvasToolItem[] = [\n { id: 'undo', label: l.undo, icon: Undo2, kind: 'action', disabled: !o.canUndo, shortcut: ariaShortcut('undo'), group: grp('history'), onPress: o.onUndo },\n { id: 'redo', label: l.redo, icon: Redo2, kind: 'action', disabled: !o.canRedo, shortcut: ariaShortcut('redo'), group: grp('history'), onPress: o.onRedo },\n ]\n const toggles: CanvasToolItem[] = [\n { id: 'minimap', label: l.minimap, icon: MapIcon, kind: 'toggle', pressed: o.showMap, shortcut: 'M', group: grp('toggles'), onPress: o.onToggleMap },\n { id: 'grid', label: l.grid, icon: Grid3x3, kind: 'toggle', pressed: o.showGrid, shortcut: 'G', group: grp('toggles'), onPress: o.onToggleGrid },\n { id: 'compact', label: l.compact, icon: Rows3, kind: 'toggle', pressed: o.compactCards, group: grp('toggles'), onPress: o.onToggleCompact },\n {\n id: 'layout-direction',\n label: fill(l.layout, { direction }),\n icon: o.layoutDirection === 'top-down' ? ArrowDownToLine : o.layoutDirection === 'left-right' ? ArrowRightToLine : Move,\n kind: 'action',\n group: 'layout',\n onPress: () => o.onLayoutDirectionChange(nextLayout(o.layoutDirection)),\n },\n ]\n const help: CanvasToolItem[] = o.onToggleShortcuts\n ? [{ id: 'shortcuts', label: l.shortcuts, icon: Keyboard, kind: 'toggle', pressed: !!o.shortcutsOpen, group: 'find', onPress: o.onToggleShortcuts }]\n : []\n return [...base, ...history, ...toggles, ...help]\n}\n","// CanvasCommandBar: a floating, movable bar of editor tools. The grip (its own\n// tab stop, before the toolbar) moves the bar by pointer or arrow keys; the\n// tools form one APG toolbar; the shortcut list is a non-modal popover dialog.\n// Below 640 px the bar docks to the bottom edge and extra tools go into \"More\".\n\nimport { useEffect, useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent } from 'react'\nimport { GripVertical } from 'lucide-react'\nimport { Dialog, Heading, Popover } from 'react-aria-components'\nimport { ActionMenu, useMediaQuery } from '../../index'\nimport { CanvasToolbar } from '../toolbar/CanvasToolbar'\nimport type { CanvasToolItem } from '../toolbar/canvasTools'\nimport { defineLabels, useFlowLocale, useLabels } from '../internal/labels'\nimport type { Point } from '../model/types'\nimport { editorToolItems, editorToolLabels, type EditorToolLabels, type LayoutCycle } from './editorTools'\nimport { editorKeyMap, isApplePlatform, type EditorAction } from './keyMap'\n\nexport interface CommandBarLabels extends EditorToolLabels {\n bar: string\n grip: string\n more: string\n shortcutsTitle: string\n select: string\n pan: string\n zoomIn: string\n zoomOut: string\n fit: string\n /** One description per action of the key map. */\n actions: Record<EditorAction, string>\n}\n\nconst actionsEn: Record<EditorAction, string> = {\n escape: 'Clear selection, then leave the canvas',\n selectTool: 'Pointer mode',\n panTool: 'Hand mode',\n toggleGrid: 'Show or hide the grid',\n toggleMinimap: 'Show or hide the overview map',\n zoom100: 'Zoom to 100%',\n zoom50: 'Zoom to 50%',\n group: 'Group the selection',\n ungroup: 'Ungroup',\n undo: 'Undo',\n redo: 'Redo',\n copy: 'Copy',\n paste: 'Paste',\n selectAll: 'Select all',\n duplicate: 'Duplicate',\n fit: 'Fit to view',\n zoomOut: 'Zoom out',\n zoomIn: 'Zoom in',\n delete: 'Delete the selection',\n}\nconst actionsPt: Record<EditorAction, string> = {\n escape: 'Limpar a seleção e depois sair do canvas',\n selectTool: 'Modo de seleção',\n panTool: 'Modo mão',\n toggleGrid: 'Mostrar ou ocultar a grade',\n toggleMinimap: 'Mostrar ou ocultar o mapa geral',\n zoom100: 'Zoom em 100%',\n zoom50: 'Zoom em 50%',\n group: 'Agrupar a seleção',\n ungroup: 'Desagrupar',\n undo: 'Desfazer',\n redo: 'Refazer',\n copy: 'Copiar',\n paste: 'Colar',\n selectAll: 'Selecionar tudo',\n duplicate: 'Duplicar',\n fit: 'Ajustar à tela',\n zoomOut: 'Diminuir zoom',\n zoomIn: 'Aumentar zoom',\n delete: 'Excluir a seleção',\n}\n\nconst actionsEs: Record<EditorAction, string> = {\n escape: 'Borrar la selección y luego salir del lienzo',\n selectTool: 'Modo puntero',\n panTool: 'Modo mano',\n toggleGrid: 'Mostrar u ocultar la cuadrícula',\n toggleMinimap: 'Mostrar u ocultar el mapa general',\n zoom100: 'Zoom al 100%',\n zoom50: 'Zoom al 50%',\n group: 'Agrupar la selección',\n ungroup: 'Desagrupar',\n undo: 'Deshacer',\n redo: 'Rehacer',\n copy: 'Copiar',\n paste: 'Pegar',\n selectAll: 'Seleccionar todo',\n duplicate: 'Duplicar',\n fit: 'Ajustar a la vista',\n zoomOut: 'Alejar',\n zoomIn: 'Acercar',\n delete: 'Eliminar la selección',\n}\n\nexport const commandBarLabels = defineLabels<CommandBarLabels>('canvasCommandBar', {\n en: {\n ...editorToolLabels.bundles.en,\n bar: 'Canvas tools',\n grip: 'Move tool bar',\n more: 'More tools',\n shortcutsTitle: 'Keyboard shortcuts',\n select: 'Pointer',\n pan: 'Hand',\n zoomIn: 'Zoom in',\n zoomOut: 'Zoom out',\n fit: 'Fit to view',\n actions: actionsEn,\n },\n 'pt-BR': {\n ...editorToolLabels.bundles['pt-BR'],\n bar: 'Ferramentas do canvas',\n grip: 'Mover a barra de ferramentas',\n more: 'Mais ferramentas',\n shortcutsTitle: 'Atalhos de teclado',\n select: 'Seleção',\n pan: 'Mão',\n zoomIn: 'Aumentar zoom',\n zoomOut: 'Diminuir zoom',\n fit: 'Ajustar à tela',\n actions: actionsPt,\n },\n es: {\n ...editorToolLabels.bundles.es,\n bar: 'Herramientas del lienzo',\n grip: 'Mover la barra de herramientas',\n more: 'Más herramientas',\n shortcutsTitle: 'Atajos de teclado',\n select: 'Puntero',\n pan: 'Mano',\n zoomIn: 'Acercar',\n zoomOut: 'Alejar',\n fit: 'Ajustar a la vista',\n actions: actionsEs,\n },\n})\n\nexport const defaultCommandBarLabels: CommandBarLabels = commandBarLabels.bundles.en\n\nexport interface CanvasCommandBarProps {\n mode: 'pointer' | 'pan'\n onModeChange: (mode: 'pointer' | 'pan') => void\n onZoomIn: () => void\n onZoomOut: () => void\n onFit: () => void\n onUndo: () => void\n onRedo: () => void\n canUndo: boolean\n canRedo: boolean\n showMap: boolean\n showGrid: boolean\n compactCards: boolean\n onToggleMap: () => void\n onToggleGrid: () => void\n onToggleCompact: () => void\n layoutDirection: LayoutCycle\n onLayoutDirectionChange: (direction: LayoutCycle) => void\n shortcutsOpen: boolean\n onToggleShortcuts: () => void\n onCloseShortcuts: () => void\n labels?: Partial<CommandBarLabels>\n /** Initial offset from the resting position (screen px). */\n defaultOffset?: Point\n className?: string\n}\n\nconst NUDGE = 8\n/** Tools kept in the bar on narrow screens; the rest go into \"More\". */\nconst NARROW_KEEP = 5\n\nexport function CanvasCommandBar(props: CanvasCommandBarProps) {\n const l = useLabels(commandBarLabels, props.labels)\n const narrow = !useMediaQuery('(min-width: 640px)', true)\n const [offset, setOffset] = useState<Point>(props.defaultOffset ?? { x: 0, y: 0 })\n const [dragging, setDragging] = useState(false)\n const drag = useRef<{ id: number; start: Point; origin: Point } | null>(null)\n const barRef = useRef<HTMLDivElement>(null)\n const shortcutsRef = useRef<HTMLElement | null>(null)\n\n const { locale } = useFlowLocale()\n const items = editorToolItems({\n locale,\n mode: props.mode === 'pointer' ? 'select' : 'pan',\n onModeChange: (m) => props.onModeChange(m === 'select' ? 'pointer' : 'pan'),\n onZoomIn: props.onZoomIn,\n onZoomOut: props.onZoomOut,\n onZoomReset: props.onFit,\n onFit: props.onFit,\n labels: { select: l.select, pan: l.pan, zoomIn: l.zoomIn, zoomOut: l.zoomOut, fit: l.fit },\n omit: ['zoom-level'],\n canUndo: props.canUndo,\n canRedo: props.canRedo,\n onUndo: props.onUndo,\n onRedo: props.onRedo,\n showMap: props.showMap,\n showGrid: props.showGrid,\n compactCards: props.compactCards,\n onToggleMap: props.onToggleMap,\n onToggleGrid: props.onToggleGrid,\n onToggleCompact: props.onToggleCompact,\n layoutDirection: props.layoutDirection,\n onLayoutDirectionChange: props.onLayoutDirectionChange,\n shortcutsOpen: props.shortcutsOpen,\n onToggleShortcuts: props.onToggleShortcuts,\n editorLabels: l,\n })\n\n useEffect(() => {\n shortcutsRef.current = barRef.current?.querySelector<HTMLElement>('[data-tool=\"shortcuts\"]') ?? null\n })\n\n const visible: CanvasToolItem[] = narrow ? items.slice(0, NARROW_KEEP) : items\n const overflow: CanvasToolItem[] = narrow ? items.slice(NARROW_KEEP) : []\n\n const onGripDown = (e: ReactPointerEvent<HTMLButtonElement>) => {\n if (narrow || e.button !== 0) return\n drag.current = { id: e.pointerId, start: { x: e.clientX, y: e.clientY }, origin: offset }\n e.currentTarget.setPointerCapture?.(e.pointerId)\n setDragging(true)\n }\n const onGripMove = (e: ReactPointerEvent<HTMLButtonElement>) => {\n const d = drag.current\n if (!d || d.id !== e.pointerId) return\n setOffset({ x: d.origin.x + e.clientX - d.start.x, y: d.origin.y + e.clientY - d.start.y })\n }\n const onGripUp = (e: ReactPointerEvent<HTMLButtonElement>) => {\n if (drag.current?.id !== e.pointerId) return\n drag.current = null\n setDragging(false)\n }\n const onGripKey = (e: KeyboardEvent<HTMLButtonElement>) => {\n const step = e.shiftKey ? NUDGE * 4 : NUDGE\n const moves: Record<string, Point> = { ArrowLeft: { x: -step, y: 0 }, ArrowRight: { x: step, y: 0 }, ArrowUp: { x: 0, y: -step }, ArrowDown: { x: 0, y: step } }\n const m = moves[e.key]\n if (!m || narrow) return\n e.preventDefault()\n setOffset((o) => ({ x: o.x + m.x, y: o.y + m.y }))\n }\n\n const apple = isApplePlatform()\n return (\n <div\n ref={barRef}\n className={['ty-command-bar', props.className].filter(Boolean).join(' ')}\n data-docked={narrow ? 'bottom' : 'floating'}\n data-dragging={dragging || undefined}\n data-ty-surface-chrome=\"\"\n style={narrow ? undefined : { translate: `${offset.x}px ${offset.y}px` }}\n >\n {narrow ? null : (\n <button\n type=\"button\"\n className=\"ty-command-bar__grip\"\n aria-label={l.grip}\n aria-describedby={undefined}\n onPointerDown={onGripDown}\n onPointerMove={onGripMove}\n onPointerUp={onGripUp}\n onPointerCancel={onGripUp}\n onKeyDown={onGripKey}\n >\n <GripVertical aria-hidden=\"true\" focusable=\"false\" />\n </button>\n )}\n <CanvasToolbar\n items={visible}\n label={l.bar}\n placement=\"inline\"\n after={\n overflow.length ? (\n <ActionMenu\n label={l.more}\n items={overflow.map((i) => ({ id: i.id, label: i.label, ...(i.icon ? { icon: i.icon } : {}), ...(i.disabled ? { disabled: true } : {}) }))}\n onAction={(id) => overflow.find((i) => i.id === id)?.onPress?.()}\n />\n ) : null\n }\n />\n <Popover\n isOpen={props.shortcutsOpen}\n onOpenChange={(open) => {\n if (!open) props.onCloseShortcuts()\n }}\n triggerRef={shortcutsRef}\n isNonModal\n placement=\"top\"\n offset={8}\n className=\"ty-command-bar__shortcuts\"\n >\n <Dialog\n aria-label={l.shortcutsTitle}\n className=\"ty-command-bar__shortcuts-dialog\"\n >\n <Heading slot=\"title\" className=\"ty-command-bar__shortcuts-title\">\n {l.shortcutsTitle}\n </Heading>\n <dl className=\"ty-command-bar__keys\">\n {editorKeyMap.map((b) => (\n <div key={b.action} className=\"ty-command-bar__key-row\">\n <dt>{l.actions[b.action]}</dt>\n <dd>\n {b.chords.map((c) => (\n <kbd key={c} className=\"ty-command-bar__kbd\">\n {c.replace('Mod', apple ? '⌘' : 'Ctrl')}\n </kbd>\n ))}\n </dd>\n </div>\n ))}\n </dl>\n </Dialog>\n </Popover>\n </div>\n )\n}\n","// FlowOutline: the keyboard and screen-reader alternative to the canvas. Every\n// step in reading order (rank, then position), with its outgoing connections,\n// and every editing operation as an ordinary button or menu: add, configure,\n// connect (\"Connect to…\"), remove a connection, move earlier or later, delete.\n\nimport { useMemo, useState } from 'react'\nimport { ArrowDown, ArrowUp, Crosshair, Link2, Pencil, Trash2, Unlink } from 'lucide-react'\nimport { ActionMenu, Button, NativeSelect } from '../../index'\nimport { useRenderCatalog } from '../catalog/RenderCatalog'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowConnector, FlowNode } from '../model/types'\nimport { flowReadingOrder } from './FlowPreview'\nimport { nodeName, nodeTitle } from './nodeBridge'\n\nexport interface FlowOutlineLabels {\n outline: string\n steps: string\n empty: string\n addKind: string\n add: string\n configure: string\n connect: string\n noTargets: string\n disconnect: string\n moveUp: string\n moveDown: string\n delete: string\n show: string\n leadsTo: string\n branch: string\n count: string\n}\n\nexport const flowOutlineLabels = defineLabels<FlowOutlineLabels>('FlowOutline', {\n en: {\n outline: 'Flow as a list',\n steps: 'Steps in reading order',\n empty: 'This flow has no steps yet.',\n addKind: 'Step to add',\n add: 'Add step',\n configure: 'Configure {name}',\n connect: 'Connect {name} to',\n noTargets: 'No step can receive a connection from here',\n disconnect: 'Remove connection from {source} to {target}',\n moveUp: 'Move {name} earlier',\n moveDown: 'Move {name} later',\n delete: 'Delete {name}',\n show: 'Show {name} on the canvas',\n leadsTo: 'Leads to',\n branch: '{branch} branch',\n count: '{count, plural, one {# step} other {# steps}}',\n },\n 'pt-BR': {\n outline: 'Fluxo como lista',\n steps: 'Passos em ordem de leitura',\n empty: 'Este fluxo ainda não tem passos.',\n addKind: 'Passo a adicionar',\n add: 'Adicionar passo',\n configure: 'Configurar {name}',\n connect: 'Conectar {name} a',\n noTargets: 'Nenhum passo pode receber uma conexão daqui',\n disconnect: 'Remover a conexão de {source} para {target}',\n moveUp: 'Mover {name} para antes',\n moveDown: 'Mover {name} para depois',\n delete: 'Excluir {name}',\n show: 'Mostrar {name} no canvas',\n leadsTo: 'Leva a',\n branch: 'ramo {branch}',\n count: '{count, plural, one {# passo} other {# passos}}',\n },\n es: {\n outline: 'Flujo como lista',\n steps: 'Pasos en orden de lectura',\n empty: 'Este flujo aún no tiene pasos.',\n addKind: 'Paso para añadir',\n add: 'Añadir paso',\n configure: 'Configurar {name}',\n connect: 'Conectar {name} con',\n noTargets: 'Ningún paso puede recibir una conexión desde aquí',\n disconnect: 'Quitar la conexión de {source} a {target}',\n moveUp: 'Mover {name} antes',\n moveDown: 'Mover {name} después',\n delete: 'Eliminar {name}',\n show: 'Mostrar {name} en el lienzo',\n leadsTo: 'Lleva a',\n branch: 'rama {branch}',\n count: '{count, plural, one {# paso} other {# pasos}}',\n },\n})\nexport const defaultFlowOutlineLabels: FlowOutlineLabels = flowOutlineLabels.bundles.en\n\nexport interface FlowOutlineProps {\n nodes: FlowNode[]\n connectors: FlowConnector[]\n /** Kinds the \"add\" picker offers. */\n addableKinds?: Array<{ kind: string; label: string }>\n locked?: boolean\n horizontal?: boolean\n canConnect: (source: FlowNode, target: FlowNode) => boolean\n onAdd?: (kind: string) => void\n onConfigure?: (id: string) => void\n onConnect?: (sourceId: string, targetId: string) => void\n onDisconnect?: (connectorId: string) => void\n /** Swap with the neighbour before (-1) or after (+1) in reading order. */\n onMove?: (id: string, towards: -1 | 1) => void\n onDelete?: (id: string) => void\n onShow?: (id: string) => void\n labels?: Partial<FlowOutlineLabels>\n className?: string\n}\n\nexport function FlowOutline(props: FlowOutlineProps) {\n const { nodes, connectors, addableKinds = [], locked = false, horizontal = false, canConnect } = props\n const l = useLabels(flowOutlineLabels, props.labels)\n const { locale } = useFlowLocale()\n const catalog = useRenderCatalog()\n const [kindToAdd, setKindToAdd] = useState(addableKinds[0]?.kind ?? '')\n const ordered = useMemo(() => flowReadingOrder(nodes, connectors, horizontal), [nodes, connectors, horizontal])\n const byId = new Map(nodes.map((n) => [n.id, n]))\n const edit = !locked\n\n return (\n <section className={['ty-flow-outline', props.className].filter(Boolean).join(' ')} aria-label={l.outline}>\n {edit && props.onAdd && addableKinds.length ? (\n <div className=\"ty-flow-outline__add\">\n <NativeSelect label={l.addKind} options={addableKinds.map((k) => ({ value: k.kind, label: k.label }))} value={kindToAdd} onChange={setKindToAdd} />\n <Button variant=\"secondary\" onPress={() => kindToAdd && props.onAdd?.(kindToAdd)}>\n {l.add}\n </Button>\n </div>\n ) : null}\n <h3 className=\"ty-flow-outline__title\">\n {l.steps} <span className=\"ty-flow-outline__count\">{fill(l.count, { count: ordered.length }, locale)}</span>\n </h3>\n {ordered.length === 0 ? <p className=\"ty-flow-outline__empty\">{l.empty}</p> : null}\n <ol className=\"ty-flow-outline__list\">\n {ordered.map((n, i) => {\n const name = nodeName(n, catalog)\n const title = nodeTitle(n, catalog)\n const out = connectors.filter((c) => c.source === n.id)\n const targets = edit ? ordered.filter((t) => t.id !== n.id && !out.some((c) => c.target === t.id) && canConnect(n, t)) : []\n return (\n <li key={n.id} className=\"ty-flow-outline__item\" data-kind={n.kind}>\n <div className=\"ty-flow-outline__row\">\n <span className=\"ty-flow-outline__bubble\" data-tone={catalog.tone(n.kind)} aria-hidden=\"true\" />\n <span className=\"ty-flow-outline__name\">{name}</span>\n <div className=\"ty-flow-outline__actions\">\n {props.onShow ? <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.show, { name: title }, locale)} leadingIcon={<Crosshair />} onPress={() => props.onShow!(n.id)} /> : null}\n {edit && props.onConfigure ? <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.configure, { name: title }, locale)} leadingIcon={<Pencil />} onPress={() => props.onConfigure!(n.id)} /> : null}\n {edit && props.onConnect && n.kind !== 'note' ? (\n <ActionMenu\n label={fill(l.connect, { name: title }, locale)}\n trigger={<Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.connect, { name: title }, locale)} leadingIcon={<Link2 />} />}\n items={targets.length ? targets.map((t) => ({ id: t.id, label: nodeName(t, catalog) })) : [{ id: '__none', label: l.noTargets, disabled: true }]}\n onAction={(id) => {\n if (id !== '__none') props.onConnect!(n.id, id)\n }}\n />\n ) : null}\n {edit && props.onMove ? (\n <>\n <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.moveUp, { name: title }, locale)} leadingIcon={<ArrowUp />} disabled={i === 0} onPress={() => props.onMove!(n.id, -1)} />\n <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.moveDown, { name: title }, locale)} leadingIcon={<ArrowDown />} disabled={i === ordered.length - 1} onPress={() => props.onMove!(n.id, 1)} />\n </>\n ) : null}\n {edit && props.onDelete ? <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.delete, { name: title }, locale)} leadingIcon={<Trash2 />} onPress={() => props.onDelete!(n.id)} /> : null}\n </div>\n </div>\n {out.length ? (\n <ul className=\"ty-flow-outline__links\" aria-label={`${l.leadsTo}: ${title}`}>\n {out.map((c) => {\n const t = byId.get(c.target)\n if (!t) return null\n const tTitle = nodeTitle(t, catalog)\n const branch = c.label ?? c.sourcePort\n return (\n <li key={c.id} className=\"ty-flow-outline__link\">\n <span>\n {l.leadsTo} {nodeName(t, catalog)}\n {branch && branch !== 'out' ? <span className=\"ty-flow-outline__branch\"> · {fill(l.branch, { branch }, locale)}</span> : null}\n </span>\n {edit && props.onDisconnect ? (\n <Button variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.disconnect, { source: title, target: tTitle }, locale)} leadingIcon={<Unlink />} onPress={() => props.onDisconnect!(c.id)} />\n ) : null}\n </li>\n )\n })}\n </ul>\n ) : null}\n </li>\n )\n })}\n </ol>\n </section>\n )\n}\n","// FlowSwitcherBar: the person's flows above the editor. Each flow is a button\n// (aria-current on the open one) followed by its own delete button, never\n// nested. Arrow keys move between flow buttons. Below 640 px: a select.\n\nimport { useRef, type KeyboardEvent } from 'react'\nimport { CircleCheck, PencilLine, Plus, Trash2 } from 'lucide-react'\nimport { Button, NativeSelect, Skeleton, StatusPill, useMediaQuery } from '../../index'\nimport { formatRelative } from '../internal/format'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\n\nexport interface FlowSummary {\n id: string\n name: string\n version: number\n isDraft: boolean\n updatedAt?: string | Date\n}\n\nexport interface FlowSwitcherLabels {\n bar: string\n draft: string\n published: string\n newFlow: string\n delete: string\n loading: string\n version: string\n select: string\n}\n\nexport const flowSwitcherLabels = defineLabels<FlowSwitcherLabels>('FlowSwitcherBar', {\n en: { bar: 'Flows', draft: 'Draft', published: 'Published', newFlow: 'New flow', delete: 'Delete flow {name}', loading: 'Loading flows', version: 'v{version}', select: 'Open flow' },\n 'pt-BR': { bar: 'Fluxos', draft: 'Rascunho', published: 'Publicado', newFlow: 'Novo fluxo', delete: 'Excluir o fluxo {name}', loading: 'Carregando os fluxos', version: 'v{version}', select: 'Abrir fluxo' },\n es: { bar: 'Flujos', draft: 'Borrador', published: 'Publicado', newFlow: 'Nuevo flujo', delete: 'Eliminar el flujo {name}', loading: 'Cargando los flujos', version: 'v{version}', select: 'Abrir flujo' },\n})\nexport const defaultFlowSwitcherLabels: FlowSwitcherLabels = flowSwitcherLabels.bundles.en\n\nexport interface FlowSwitcherBarProps {\n flows: FlowSummary[]\n activeFlowId: string | null\n isLoading: boolean\n onSelect: (flow: FlowSummary) => void\n onCreate: () => void\n onDelete: (id: string, name: string) => void\n labels?: Partial<FlowSwitcherLabels>\n /** Reference time for relative dates (tests). */\n now?: Date\n className?: string\n}\n\nexport function FlowSwitcherBar({ flows, activeFlowId, isLoading, onSelect, onCreate, onDelete, labels, now, className }: FlowSwitcherBarProps) {\n const l = useLabels(flowSwitcherLabels, labels)\n const { locale } = useFlowLocale()\n const narrow = !useMediaQuery('(min-width: 640px)', true)\n const listRef = useRef<HTMLUListElement>(null)\n const canDelete = flows.length > 1\n\n if (isLoading) {\n return (\n <nav className={['ty-flow-switcher', className].filter(Boolean).join(' ')} aria-label={l.bar} aria-busy=\"true\">\n <span role=\"status\" className=\"ty-visually-hidden\">\n {l.loading}\n </span>\n <div className=\"ty-flow-switcher__skeletons\" aria-hidden=\"true\">\n {[0, 1, 2].map((i) => (\n <Skeleton key={i} shape=\"rect\" width=\"160px\" />\n ))}\n </div>\n </nav>\n )\n }\n\n if (narrow) {\n const active = flows.find((f) => f.id === activeFlowId)\n return (\n <nav className={['ty-flow-switcher', className].filter(Boolean).join(' ')} aria-label={l.bar} data-narrow=\"\">\n <NativeSelect\n label={l.select}\n options={flows.map((f) => ({ value: f.id, label: `${f.name} · ${fill(l.version, { version: f.version }, locale)}` }))}\n value={activeFlowId ?? ''}\n onChange={(id) => {\n const f = flows.find((x) => x.id === id)\n if (f) onSelect(f)\n }}\n />\n {active && canDelete ? <Button variant=\"quiet\" iconOnly accessibleLabel={fill(l.delete, { name: active.name }, locale)} leadingIcon={<Trash2 />} onPress={() => onDelete(active.id, active.name)} /> : null}\n <Button variant=\"secondary\" leadingIcon={<Plus />} onPress={onCreate}>\n {l.newFlow}\n </Button>\n </nav>\n )\n }\n\n const onKeyDown = (e: KeyboardEvent<HTMLUListElement>) => {\n const keys = ['ArrowLeft', 'ArrowRight', 'Home', 'End']\n if (!keys.includes(e.key)) return\n const buttons = [...(listRef.current?.querySelectorAll<HTMLElement>('[data-flow-button]') ?? [])]\n const at = buttons.indexOf(document.activeElement as HTMLElement)\n if (at < 0) return\n e.preventDefault()\n const rtl = getComputedStyle(listRef.current!).direction === 'rtl'\n const forward = (e.key === 'ArrowRight') !== rtl\n const next = e.key === 'Home' ? 0 : e.key === 'End' ? buttons.length - 1 : (at + (forward ? 1 : -1) + buttons.length) % buttons.length\n buttons[next]?.focus()\n }\n\n return (\n <nav className={['ty-flow-switcher', className].filter(Boolean).join(' ')} aria-label={l.bar}>\n <ul className=\"ty-flow-switcher__list\" ref={listRef} onKeyDown={onKeyDown}>\n {flows.map((f) => {\n const current = f.id === activeFlowId\n const when = f.updatedAt ? formatRelative(f.updatedAt, locale, now) : ''\n return (\n <li key={f.id} className=\"ty-flow-switcher__item\" data-current={current || undefined}>\n <button type=\"button\" className=\"ty-flow-switcher__flow\" data-flow-button=\"\" aria-current={current ? 'page' : undefined} onClick={() => onSelect(f)}>\n <span className=\"ty-flow-switcher__name\">{f.name}</span>\n <span className=\"ty-flow-switcher__meta\">\n <code className=\"ty-flow-switcher__version\">{fill(l.version, { version: f.version }, locale)}</code>\n {when ? <time dateTime={new Date(f.updatedAt!).toISOString()}>{when}</time> : null}\n </span>\n </button>\n <StatusPill\n status={f.isDraft ? 'draft' : 'published'}\n size=\"small\"\n statusMap={{\n draft: { label: l.draft, tone: 'warning', icon: <PencilLine /> },\n published: { label: l.published, tone: 'success', icon: <CircleCheck /> },\n }}\n />\n {canDelete ? (\n <Button className=\"ty-flow-switcher__delete\" variant=\"quiet\" size=\"compact\" iconOnly accessibleLabel={fill(l.delete, { name: f.name }, locale)} leadingIcon={<Trash2 />} onPress={() => onDelete(f.id, f.name)} />\n ) : null}\n </li>\n )\n })}\n </ul>\n <Button variant=\"secondary\" leadingIcon={<Plus />} onPress={onCreate}>\n {l.newFlow}\n </Button>\n </nav>\n )\n}\n","// SaveStatus: whether the editor is saving, has saved, or failed to save.\n// The status region stays mounted while idle so the next change is announced.\n\nimport { CircleAlert, CircleCheck, LoaderCircle } from 'lucide-react'\nimport { defineLabels, useLabels } from '../internal/labels'\n\nexport type SaveState = 'idle' | 'saving' | 'saved' | 'error'\n\nexport interface SaveStatusLabels {\n saving: string\n saved: string\n error: string\n}\n\nexport const saveStatusLabels = defineLabels<SaveStatusLabels>('SaveStatus', {\n en: { saving: 'Saving', saved: 'Saved', error: 'Not saved' },\n 'pt-BR': { saving: 'Salvando', saved: 'Salvo', error: 'Não salvo' },\n es: { saving: 'Guardando', saved: 'Guardado', error: 'No guardado' },\n})\nexport const defaultSaveStatusLabels: SaveStatusLabels = saveStatusLabels.bundles.en\n\nexport interface SaveStatusProps {\n status: SaveState\n labels?: Partial<SaveStatusLabels>\n /** Show the word visibly (default). When false it stays available to assistive technology. */\n showLabel?: boolean\n className?: string\n}\n\nconst GLYPH = { saving: LoaderCircle, saved: CircleCheck, error: CircleAlert } as const\n\nexport function SaveStatus({ status, labels, showLabel = true, className }: SaveStatusProps) {\n const l = useLabels(saveStatusLabels, labels)\n const Glyph = status === 'idle' ? null : GLYPH[status]\n return (\n <span className={['ty-save-status', className].filter(Boolean).join(' ')} role=\"status\" aria-live=\"polite\" data-status={status}>\n {Glyph ? (\n <>\n <Glyph className=\"ty-save-status__glyph\" aria-hidden=\"true\" focusable=\"false\" />\n <span className={showLabel ? 'ty-save-status__word' : 'ty-visually-hidden'}>{l[status as Exclude<SaveState, 'idle'>]}</span>\n </>\n ) : null}\n </span>\n )\n}\n","// RunControls: save status slot, run history, publish, and one run/stop button\n// that keeps its element (and focus) while its action and name switch.\n\nimport { useEffect, useRef, useState, type ReactNode } from 'react'\nimport { History, LoaderCircle, Play, Square } from 'lucide-react'\nimport { Tooltip, TooltipTrigger } from 'react-aria-components'\nimport { Button } from '../../index'\nimport { defineLabels, useLabels } from '../internal/labels'\n\nexport interface RunControlsLabels {\n run: string\n stop: string\n history: string\n publish: string\n publishing: string\n started: string\n stopped: string\n group: string\n}\n\nexport const runControlsLabels = defineLabels<RunControlsLabels>('RunControls', {\n en: { run: 'Run', stop: 'Stop', history: 'Run history', publish: 'Publish version', publishing: 'Publishing', started: 'Run started', stopped: 'Run stopped', group: 'Run controls' },\n 'pt-BR': { run: 'Executar', stop: 'Parar', history: 'Histórico de execuções', publish: 'Publicar versão', publishing: 'Publicando', started: 'Execução iniciada', stopped: 'Execução parada', group: 'Controles de execução' },\n es: { run: 'Ejecutar', stop: 'Detener', history: 'Historial de ejecuciones', publish: 'Publicar versión', publishing: 'Publicando', started: 'Ejecución iniciada', stopped: 'Ejecución detenida', group: 'Controles de ejecución' },\n})\nexport const defaultRunControlsLabels: RunControlsLabels = runControlsLabels.bundles.en\n\nexport interface RunControlsProps {\n isRunning: boolean\n onRun: () => void\n onStop: () => void\n onOpenHistory?: () => void\n onPublish?: () => void\n isPublishing?: boolean\n saveStatus?: ReactNode\n labels?: Partial<RunControlsLabels>\n placement?: 'overlay' | 'inline'\n /** Whether Run is the single primary action of the view (gradient); otherwise secondary. */\n primary?: boolean\n className?: string\n}\n\nexport function RunControls({ isRunning, onRun, onStop, onOpenHistory, onPublish, isPublishing = false, saveStatus, labels, placement = 'overlay', primary = true, className }: RunControlsProps) {\n const l = useLabels(runControlsLabels, labels)\n const [announcement, setAnnouncement] = useState('')\n const first = useRef(true)\n useEffect(() => {\n if (first.current) {\n first.current = false\n return\n }\n setAnnouncement(isRunning ? l.started : l.stopped)\n }, [isRunning, l.started, l.stopped])\n\n return (\n <div className={['ty-run-controls', className].filter(Boolean).join(' ')} role=\"group\" aria-label={l.group} data-placement={placement} data-ty-surface-chrome=\"\">\n {saveStatus ? <div className=\"ty-run-controls__status\">{saveStatus}</div> : null}\n {onOpenHistory ? (\n <TooltipTrigger delay={300}>\n <Button className=\"ty-run-controls__history\" variant=\"quiet\" iconOnly accessibleLabel={l.history} leadingIcon={<History />} onPress={onOpenHistory} />\n <Tooltip className=\"ty-run-controls__tooltip\" offset={6}>\n {l.history}\n </Tooltip>\n </TooltipTrigger>\n ) : null}\n {onPublish ? (\n <Button variant=\"secondary\" busy={isPublishing} busyLabel={l.publishing} disabled={isPublishing} onPress={onPublish}>\n {isPublishing ? l.publishing : l.publish}\n </Button>\n ) : null}\n <Button\n className=\"ty-run-controls__main\"\n variant={isRunning ? 'danger' : primary ? 'primary' : 'secondary'}\n leadingIcon={isRunning ? <LoaderCircle className=\"ty-run-controls__spinner\" /> : <Play />}\n trailingIcon={isRunning ? <Square className=\"ty-run-controls__stop-glyph\" /> : undefined}\n onPress={isRunning ? onStop : onRun}\n >\n {isRunning ? l.stop : l.run}\n </Button>\n <span className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {announcement}\n </span>\n </div>\n )\n}\n","// Bridge from the canvas tool list to the research dock of the design system\n// (the `contextual` slot of FloatingActionBar). Each tool becomes one dock\n// entry; unavailable tools are dropped. Anything that is not a plain action\n// (modes, toggles) reports its on/off state, so the dock can set aria-pressed.\n// The zoom readout carries its percentage as text rather than a pictogram, and\n// the tool's `group` lets the dock draw dividers between clusters.\n\nimport type { ActionBarItem } from '../../index'\nimport type { CanvasToolItem } from './canvasTools'\n\ntype Tool = CanvasToolItem\ntype DockEntry = ActionBarItem\n\n/**\n * Optional dock fields, each described by the rule that decides whether a\n * tool contributes it and how its value is read. Fields absent from the\n * result stay absent (no `undefined` keys), which keeps equality checks and\n * snapshots of the dock stable.\n */\nconst optionalFields: ReadonlyArray<{\n field: 'onPress' | 'pressed' | 'shortcut'\n appliesTo: (tool: Tool) => boolean\n read: (tool: Tool) => DockEntry[keyof DockEntry]\n}> = [\n { field: 'onPress', appliesTo: (tool) => tool.onPress != null, read: (tool) => tool.onPress },\n { field: 'pressed', appliesTo: (tool) => tool.kind !== 'action', read: (tool) => tool.pressed === true },\n { field: 'shortcut', appliesTo: (tool) => Boolean(tool.shortcut), read: (tool) => tool.shortcut },\n]\n\nfunction pictogram(tool: Tool) {\n if (tool.text) return <span className=\"ty-canvas-tool__text\">{tool.text}</span>\n const Glyph = tool.icon\n if (!Glyph) return null\n return <Glyph className=\"ty-icon\" aria-hidden=\"true\" focusable=\"false\" />\n}\n\nfunction toDockEntry(tool: Tool): DockEntry {\n const entry: DockEntry = { id: tool.id, label: tool.label, icon: pictogram(tool), group: tool.group }\n for (const rule of optionalFields) {\n if (rule.appliesTo(tool)) Object.assign(entry, { [rule.field]: rule.read(tool) })\n }\n return entry\n}\n\nexport function dockItemsFromCanvasTools(items: readonly CanvasToolItem[]): ActionBarItem[] {\n const usable: DockEntry[] = []\n for (const tool of items) {\n if (!tool.disabled) usable.push(toDockEntry(tool))\n }\n return usable\n}\n","// RunExecutionState: start and stop a run through host transport, follow its\n// event stream and project the events onto FlowEditorState.\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { useOptionalFlowEditorStore, type FlowEditorActions } from '../state/editorState'\nimport type { RunEvent, StreamStatus } from './types'\n\ntype ProjectionActions = Pick<FlowEditorActions, 'setRunning' | 'setNodeResult' | 'clearNodeResults'>\n\nconst num = (v: unknown): number | undefined => (typeof v === 'number' && Number.isFinite(v) ? v : undefined)\n\n/** Applies one run event to the editor state. Pure apart from the actions it calls. */\nexport function applyRunEvent(actions: ProjectionActions, event: RunEvent): void {\n const e = event as Record<string, unknown> & { type: string }\n const nodeId = typeof e.nodeId === 'string' ? e.nodeId : null\n switch (e.type) {\n case 'run-started':\n // Never clears results: a suspended run that resumes sends it again.\n actions.setRunning(true)\n return\n case 'node-started':\n if (nodeId) actions.setNodeResult(nodeId, { status: 'running' })\n return\n case 'node-completed':\n case 'node-restored':\n if (nodeId) {\n const durationMs = num(e.durationMs)\n actions.setNodeResult(nodeId, { status: 'success', data: e.outputs, ...(durationMs !== undefined ? { durationMs } : {}) })\n }\n return\n case 'node-failed':\n if (nodeId) {\n const durationMs = num(e.durationMs)\n actions.setNodeResult(nodeId, { status: 'error', ...(typeof e.error === 'string' ? { error: e.error } : {}), ...(durationMs !== undefined ? { durationMs } : {}) })\n }\n return\n case 'run-completed':\n case 'run-failed':\n actions.setRunning(false)\n return\n default:\n return\n }\n}\n\n/** Clears results and sets not running. */\nexport function resetRunProjection(actions: ProjectionActions): void {\n actions.clearNodeResults()\n actions.setRunning(false)\n}\n\nconst TERMINAL: readonly StreamStatus[] = ['completed', 'failed', 'error']\n\n/**\n * Applies only the events not yet applied. Clears results only on a genuine\n * reset (status idle, or the list got shorter: a new run). A terminal stream\n * status forces not running; it never forces running.\n */\nexport function useRunProjection(events: readonly RunEvent[], streamStatus: StreamStatus, target?: ProjectionActions): void {\n const store = useOptionalFlowEditorStore()\n const actions = target ?? store?.actions ?? null\n const applied = useRef(0)\n useEffect(() => {\n if (!actions) return\n if (streamStatus === 'idle' || events.length < applied.current) {\n if (applied.current > 0 || streamStatus === 'idle') resetRunProjection(actions)\n applied.current = 0\n if (streamStatus === 'idle') return\n }\n for (let i = applied.current; i < events.length; i++) applyRunEvent(actions, events[i]!)\n applied.current = events.length\n if (TERMINAL.includes(streamStatus)) actions.setRunning(false)\n }, [events, streamStatus, actions])\n}\n\nexport type StartRun = (flowId: string, inputs?: Record<string, unknown>) => Promise<{ id: string }>\n\nexport interface RunStreamHandlers {\n onEvent(event: RunEvent): void\n onStatus?(status: StreamStatus): void\n signal: AbortSignal\n}\n\n/** Host transport for the run-event stream; may return a disposer. */\nexport type OpenRunStream = (runId: string, handlers: RunStreamHandlers) => void | (() => void)\n\nexport type CancelRun = (runId: string) => Promise<void>\n\nexport interface FlowExecution {\n isRunning: boolean\n start(inputs?: Record<string, unknown>): Promise<void>\n stop(): Promise<void>\n runId: string | null\n streamStatus: StreamStatus\n /** After stop without cancelRun the run continues server side: say \"stopped following\". */\n stopped: null | 'cancelled' | 'stopped-following'\n events: readonly RunEvent[]\n}\n\nconst ENDS = new Set(['run-completed', 'run-failed'])\n\nexport function useFlowExecution(flowId: string, startRun: StartRun, openStream: OpenRunStream, cancelRun?: CancelRun): FlowExecution {\n const [isRunning, setIsRunning] = useState(false)\n const [runId, setRunId] = useState<string | null>(null)\n const [events, setEvents] = useState<RunEvent[]>([])\n const [streamStatus, setStreamStatus] = useState<StreamStatus>('idle')\n const [stopped, setStopped] = useState<FlowExecution['stopped']>(null)\n const controller = useRef<AbortController | null>(null)\n const dispose = useRef<(() => void) | null>(null)\n const generation = useRef(0)\n const live = useRef({ startRun, openStream, cancelRun })\n live.current = { startRun, openStream, cancelRun }\n\n useRunProjection(events, streamStatus)\n\n const detach = useCallback(() => {\n controller.current?.abort()\n controller.current = null\n dispose.current?.()\n dispose.current = null\n }, [])\n\n const forget = useCallback(() => {\n generation.current++\n detach()\n setIsRunning(false)\n setRunId(null)\n setEvents([])\n setStreamStatus('idle')\n }, [detach])\n\n // A different flow resets everything.\n useEffect(() => {\n forget()\n setStopped(null)\n return detach\n }, [flowId, forget, detach])\n\n const start = useCallback(\n async (inputs?: Record<string, unknown>) => {\n detach()\n const gen = ++generation.current\n setStopped(null)\n setEvents([])\n setStreamStatus('idle')\n setIsRunning(true)\n let run: { id: string }\n try {\n run = await live.current.startRun(flowId, inputs)\n } catch (err) {\n if (gen === generation.current) setIsRunning(false)\n throw err\n }\n if (gen !== generation.current) return\n setRunId(run.id)\n const ac = new AbortController()\n controller.current = ac\n setStreamStatus('streaming')\n const off = live.current.openStream(run.id, {\n signal: ac.signal,\n onEvent: (event) => {\n if (gen !== generation.current) return\n setEvents((prev) => [...prev, event])\n // Run content decides the end, not the connection.\n if (ENDS.has(event.type)) setIsRunning(false)\n },\n onStatus: (status) => {\n if (gen !== generation.current) return\n setStreamStatus(status)\n if (TERMINAL.includes(status) && status !== 'error') setIsRunning(false)\n },\n })\n if (typeof off === 'function') dispose.current = off\n },\n [flowId, detach],\n )\n\n const stop = useCallback(async () => {\n const id = runId\n const cancel = live.current.cancelRun\n if (id && cancel) await cancel(id)\n setStopped(cancel ? 'cancelled' : 'stopped-following')\n forget()\n }, [runId, forget])\n\n return { isRunning, start, stop, runId, streamStatus, stopped, events }\n}\n","// A long identifier shown as a short prefix, with the full value kept in the\n// accessible text and the title (never cut for assistive technology).\n\nexport function ShortId({ id, label, visible = 8 }: { id: string; label?: string; visible?: number }) {\n const short = id.length > visible ? id.slice(0, visible) : id\n return (\n <span className=\"ty-run-shortid\" title={id}>\n {label ? <span className=\"ty-run-shortid__label\">{label} </span> : null}\n <code className=\"ty-run-mono\" aria-hidden=\"true\">\n {short}\n </code>\n <span className=\"ty-visually-hidden\">{id}</span>\n </span>\n )\n}\n","// Number field of the run dialogs, on React Aria NumberField (the design\n// system has none yet). Label on top, the variable's identifier as a hint,\n// an optional currency sign before the digits, whole numbers on request.\n\nimport type { ReactNode } from 'react'\nimport { FieldError, Group, Input, Label, NumberField, Text, type NumberFieldProps } from 'react-aria-components'\n\nexport interface NumberInputProps {\n label: string\n hint?: ReactNode\n value: number | null\n onChange: (value: number | null) => void\n integer?: boolean\n /** Visible currency symbol before the value. */\n prefix?: string\n errorMessage?: string\n autoFocus?: boolean\n name?: string\n}\n\nconst WHOLE: Intl.NumberFormatOptions = { maximumFractionDigits: 0, useGrouping: false }\nconst ANY: Intl.NumberFormatOptions = { maximumFractionDigits: 20, useGrouping: false }\n\n/** React Aria reports an empty field as NaN; the dialogs speak null. */\nconst fromField = (n: number): number | null => (Number.isNaN(n) ? null : n)\nconst toField = (n: number | null): number => (n === null ? Number.NaN : n)\n\nexport function NumberInput(props: NumberInputProps) {\n const fieldProps: NumberFieldProps = {\n className: 'ty-run-number',\n value: toField(props.value),\n onChange: (n) => props.onChange(fromField(n)),\n formatOptions: props.integer ? WHOLE : ANY,\n isInvalid: Boolean(props.errorMessage),\n }\n if (props.integer) fieldProps.step = 1\n if (props.autoFocus) fieldProps.autoFocus = true\n if (props.name) fieldProps.name = props.name\n const adornment = props.prefix ? (\n <span className=\"ty-run-number__prefix\" aria-hidden=\"true\">\n {props.prefix}\n </span>\n ) : null\n return (\n <NumberField {...fieldProps}>\n <Label className=\"ty-run-field__label\">{props.label}</Label>\n {props.hint ? (\n <Text slot=\"description\" className=\"ty-run-field__hint\">\n {props.hint}\n </Text>\n ) : null}\n <Group className=\"ty-run-number__group\">\n {adornment}\n <Input className=\"ty-run-number__input\" data-integer={props.integer ? true : undefined} />\n </Group>\n {props.errorMessage ? <FieldError className=\"ty-run-field__error\">{props.errorMessage}</FieldError> : null}\n </NumberField>\n )\n}\n","// RunInputDialog: before a run starts, ask for a value for every input the\n// flow's start step declares, pre-filled with its saved defaults each time the\n// dialog opens.\n\nimport { useEffect, useId, useState, type FormEvent } from 'react'\nimport { Button, ModalDialog, TextField } from '../../index'\nimport { defineLabels, useLabels } from '../internal/labels'\nimport { createFlowEditorStore, useOptionalFlowEditorStore } from '../state/editorState'\nimport { useStoreSelector } from '../state/store'\nimport { NumberInput } from './NumberInput'\n\nexport interface RunInputDialogLabels {\n title: string\n subtitle: string\n empty: string\n valuePlaceholder: string\n cancel: string\n run: string\n}\n\nexport const runInputDialogLabels = defineLabels<RunInputDialogLabels>('run-input-dialog', {\n en: { title: 'Run this flow', subtitle: 'Give a value to each input the flow declares.', empty: 'This flow declares no inputs. It runs as it is.', valuePlaceholder: 'Value', cancel: 'Cancel', run: 'Run' },\n 'pt-BR': { title: 'Executar este fluxo', subtitle: 'Informe um valor para cada entrada que o fluxo declara.', empty: 'Este fluxo não declara entradas. Ele roda como está.', valuePlaceholder: 'Valor', cancel: 'Cancelar', run: 'Executar' },\n es: { title: 'Ejecutar este flujo', subtitle: 'Indique un valor para cada entrada que declara el flujo.', empty: 'Este flujo no declara entradas. Se ejecuta tal cual.', valuePlaceholder: 'Valor', cancel: 'Cancelar', run: 'Ejecutar' },\n})\nexport const defaultRunInputDialogLabels: RunInputDialogLabels = runInputDialogLabels.bundles.en\n\nexport type InputFieldKind = 'currency' | 'count' | 'text'\nexport type RunInputValue = string | number | boolean | null\n\nexport interface RunInputDialogProps {\n open: boolean\n onClose: () => void\n onRun: (inputs: Record<string, RunInputValue>) => void\n classifyVariable?: (name: string) => InputFieldKind\n currencySymbol?: string\n labels?: Partial<RunInputDialogLabels>\n}\n\n/** \"loanAmount\", \"loan_amount\" and \"loan-amount\" read as \"Loan amount\" (any script's letter cases). */\nexport function humaniseIdentifier(id: string): string {\n const spaced = id\n .split(/(?<=[\\p{Ll}\\p{N}])(?=\\p{Lu})|[_-]+/u)\n .filter(Boolean)\n .join(' ')\n .toLowerCase()\n return spaced ? spaced.charAt(0).toUpperCase() + spaced.slice(1) : id\n}\n\n/** Declared inputs as names; objects with a name are reduced to it, anything else is stringified. */\nexport function declaredInputNames(raw: unknown): string[] {\n if (!Array.isArray(raw)) return []\n return raw.map((item: unknown) => {\n if (typeof item === 'string') return item\n const named = item && typeof item === 'object' ? (item as { name?: unknown }).name : undefined\n if (typeof named === 'string') return named\n return typeof item === 'object' ? JSON.stringify(item) : String(item)\n })\n}\n\ntype Raw = string | number | null\ninterface Declared {\n names: string[]\n saved: Record<string, unknown>\n}\n\nconst NO_START: Declared = { names: [], saved: {} }\n\n/** Inputs and saved defaults of the start step (config either nested or flat). */\nfunction declaredBy(nodes: ReadonlyArray<{ kind: string; data: Record<string, unknown> }>): Declared {\n const start = nodes.find((n) => n.kind === 'start')\n if (!start) return NO_START\n const nested = start.data.config\n const cfg = (nested && typeof nested === 'object' ? nested : start.data) as Record<string, unknown>\n const saved = cfg.inputDefaults && typeof cfg.inputDefaults === 'object' ? (cfg.inputDefaults as Record<string, unknown>) : {}\n return { names: declaredInputNames(cfg.inputVariables), saved }\n}\n\nconst seedOf = (saved: unknown): Raw => (saved === undefined || saved === null ? '' : typeof saved === 'number' ? saved : String(saved))\nconst numeric = (raw: Raw | undefined): number | null => {\n if (typeof raw === 'number') return raw\n if (raw === null || raw === undefined || raw === '') return null\n const n = Number(raw)\n return Number.isNaN(n) ? null : n\n}\n/** What `onRun` receives for a field: text as text, numbers as numbers, empty as an empty string. */\nconst outgoing = (kind: InputFieldKind, raw: Raw | undefined): RunInputValue => (kind === 'text' ? (raw === null || raw === undefined ? '' : String(raw)) : (numeric(raw) ?? ''))\n\nconst orphanStore = createFlowEditorStore()\n\nexport function RunInputDialog({ open, onClose, onRun, classifyVariable, currencySymbol, labels }: RunInputDialogProps) {\n const l = useLabels(runInputDialogLabels, labels)\n const nodes = useStoreSelector(useOptionalFlowEditorStore() ?? orphanStore, (s) => s.nodes)\n const { names, saved } = declaredBy(nodes)\n const formId = useId()\n const [entered, setEntered] = useState<Record<string, Raw>>({})\n const kindOf = (name: string): InputFieldKind => classifyVariable?.(name) ?? 'text'\n\n // Each opening starts again from the saved defaults.\n useEffect(() => {\n if (open) setEntered(Object.fromEntries(names.map((n) => [n, seedOf(saved[n])])))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const put = (name: string) => (v: Raw) => setEntered((prev) => ({ ...prev, [name]: v }))\n const send = (e?: FormEvent) => {\n e?.preventDefault()\n const inputs = Object.fromEntries(names.map((n) => [n, outgoing(kindOf(n), entered[n])]))\n setEntered({})\n onRun(inputs)\n onClose()\n }\n\n const fields = names.map((name, index) => {\n const kind = kindOf(name)\n const common = { label: humaniseIdentifier(name), hint: <code className=\"ty-run-mono\">{name}</code>, name }\n return kind === 'text' ? (\n <TextField key={name} {...common} placeholder={l.valuePlaceholder} value={String(entered[name] ?? '')} onChange={put(name)} {...(index === 0 ? { autoFocus: true } : {})} />\n ) : (\n <NumberInput key={name} {...common} integer={kind === 'count'} {...(kind === 'currency' && currencySymbol ? { prefix: currencySymbol } : {})} value={numeric(entered[name])} onChange={put(name)} autoFocus={index === 0} />\n )\n })\n\n return (\n <ModalDialog\n isOpen={open}\n onOpenChange={(stillOpen) => (stillOpen ? undefined : onClose())}\n title={l.title}\n description={l.subtitle}\n width=\"regular\"\n actions={\n <>\n <Button variant=\"quiet\" onPress={onClose}>\n {l.cancel}\n </Button>\n <Button variant=\"primary\" type=\"submit\" form={formId}>\n {l.run}\n </Button>\n </>\n }\n >\n <form id={formId} className=\"ty-run-form\" onSubmit={send} noValidate>\n {fields.length ? fields : <p className=\"ty-run-empty\">{l.empty}</p>}\n {/* Lets Enter in a single-line field submit. */}\n <button type=\"submit\" hidden tabIndex={-1} aria-hidden=\"true\" />\n </form>\n </ModalDialog>\n )\n}\n","// RunReplayDialog: runs a past run again. Every original input is shown with\n// an editor that fits its type; only the inputs the person changed are sent,\n// turned back into their original type. Untouched inputs keep their value.\n\nimport { useEffect, useId, useRef, useState, type FormEvent, type ReactNode } from 'react'\nimport { RotateCcw } from 'lucide-react'\nimport { Button, InlineNotice, SegmentedControl, Tag, TextArea, TextField } from '../../index'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\nimport { NumberInput } from './NumberInput'\nimport { ShortId } from './ShortId'\n\nexport interface RunReplayDialogLabels {\n title: string\n subtitle: string\n empty: string\n text: string\n number: string\n boolean: string\n structured: string\n yes: string\n no: string\n reset: string\n resetKey: string\n invalidNumber: string\n invalidStructured: string\n run: string\n flow: string\n cancel: string\n replay: string\n replaying: string\n}\n\nexport const runReplayDialogLabels = defineLabels<RunReplayDialogLabels>('run-replay-dialog', {\n en: {\n title: 'Replay run',\n subtitle: 'Inputs you leave untouched keep their original value.',\n empty: 'This run had no inputs. It will replay as it was.',\n text: 'text',\n number: 'number',\n boolean: 'true or false',\n structured: 'structured',\n yes: 'true',\n no: 'false',\n reset: 'Reset',\n resetKey: 'Reset {key} to its original value',\n invalidNumber: '{key} must be a finite number.',\n invalidStructured: '{key} is not valid structured data.',\n run: 'Run',\n flow: 'Flow',\n cancel: 'Cancel',\n replay: 'Replay',\n replaying: 'Replaying',\n },\n 'pt-BR': {\n title: 'Reexecutar',\n subtitle: 'As entradas que você não alterar mantêm o valor original.',\n empty: 'Esta execução não teve entradas. Será reexecutada como foi.',\n text: 'texto',\n number: 'número',\n boolean: 'verdadeiro ou falso',\n structured: 'estruturado',\n yes: 'verdadeiro',\n no: 'falso',\n reset: 'Restaurar',\n resetKey: 'Restaurar {key} ao valor original',\n invalidNumber: '{key} precisa ser um número finito.',\n invalidStructured: '{key} não é um dado estruturado válido.',\n run: 'Execução',\n flow: 'Fluxo',\n cancel: 'Cancelar',\n replay: 'Reexecutar',\n replaying: 'Reexecutando',\n },\n es: {\n title: 'Repetir la ejecución',\n subtitle: 'Las entradas que no cambie conservan su valor original.',\n empty: 'Esta ejecución no tuvo entradas. Se repetirá tal como fue.',\n text: 'texto',\n number: 'número',\n boolean: 'verdadero o falso',\n structured: 'estructurado',\n yes: 'verdadero',\n no: 'falso',\n reset: 'Restablecer',\n resetKey: 'Restablecer {key} a su valor original',\n invalidNumber: '{key} debe ser un número finito.',\n invalidStructured: '{key} no es un dato estructurado válido.',\n run: 'Ejecución',\n flow: 'Flujo',\n cancel: 'Cancelar',\n replay: 'Repetir',\n replaying: 'Repitiendo',\n },\n})\nexport const defaultRunReplayDialogLabels: RunReplayDialogLabels = runReplayDialogLabels.bundles.en\n\ntype Draft = string | number | boolean | null\n\n/** Outcome of turning a draft back into a value. */\ntype Parsed = { value: unknown } | { problem: 'invalidNumber' | 'invalidStructured' }\n\n/** How one kind of input value is detected, drafted, read back and edited. */\ninterface Codec {\n word: (l: RunReplayDialogLabels) => string\n draft: (original: unknown) => Draft\n read: (draft: Draft) => Parsed\n editor: (p: { label: string; draft: Draft; l: RunReplayDialogLabels; put: (d: Draft) => void }) => ReactNode\n}\n\nconst CODECS = {\n number: {\n word: (l) => l.number,\n draft: (v) => v as number,\n read: (d) => (typeof d === 'number' && Number.isFinite(d) ? { value: d } : { problem: 'invalidNumber' }),\n editor: ({ label, draft, put }) => <NumberInput label={label} value={typeof draft === 'number' ? draft : null} onChange={put} />,\n },\n boolean: {\n word: (l) => l.boolean,\n draft: (v) => v as boolean,\n read: (d) => ({ value: Boolean(d) }),\n editor: ({ label, draft, l, put }) => (\n <SegmentedControl label={label} options={[{ value: 'true', label: l.yes }, { value: 'false', label: l.no }]} value={draft ? 'true' : 'false'} onChange={(v) => put(v === 'true')} />\n ),\n },\n structured: {\n word: (l) => l.structured,\n draft: (v) => JSON.stringify(v, null, 2),\n read: (d) => {\n const text = String(d ?? '').trim()\n if (!text) return { value: null }\n try {\n return { value: JSON.parse(text) as unknown }\n } catch {\n return { problem: 'invalidStructured' }\n }\n },\n editor: ({ label, draft, put }) => <TextArea label={label} monospace rows={4} value={String(draft ?? '')} onChange={put} />,\n },\n text: {\n word: (l) => l.text,\n draft: (v) => (v === null || v === undefined ? '' : String(v)),\n read: (d) => ({ value: String(d ?? '') }),\n editor: ({ label, draft, put }) => <TextField label={label} value={String(draft ?? '')} onChange={put} />,\n },\n} satisfies Record<string, Codec>\n\ntype Kind = keyof typeof CODECS\n\n/** Null and missing originals are text. */\nconst kindOf = (v: unknown): Kind => (typeof v === 'number' ? 'number' : typeof v === 'boolean' ? 'boolean' : v !== null && typeof v === 'object' ? 'structured' : 'text')\n\nexport interface RunReplayDialogProps {\n open: boolean\n onClose: () => void\n runId: string\n flowId: string\n originalInputs: Record<string, unknown>\n onReplay: (overrides: Record<string, unknown>) => Promise<void>\n labels?: Partial<RunReplayDialogLabels>\n}\n\nexport function RunReplayDialog({ open, onClose, runId, flowId, originalInputs, onReplay, labels }: RunReplayDialogProps) {\n const l = useLabels(runReplayDialogLabels, labels)\n const formId = useId()\n /** Drafts of the edited inputs only; an input absent here is untouched. */\n const [edited, setEdited] = useState<ReadonlyMap<string, Draft>>(new Map())\n const [notice, setNotice] = useState<string | null>(null)\n const [sending, setSending] = useState(false)\n const noticeRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!open) return\n setEdited(new Map())\n setNotice(null)\n setSending(false)\n }, [open])\n\n useEffect(() => {\n if (notice) noticeRef.current?.focus()\n }, [notice])\n\n const keys = Object.keys(originalInputs)\n const put = (key: string, d: Draft) => setEdited((m) => new Map(m).set(key, d))\n const restore = (key: string) =>\n setEdited((m) => {\n const next = new Map(m)\n next.delete(key)\n return next\n })\n\n const collect = (): { overrides: Record<string, unknown> } | { problem: string } => {\n const overrides: Record<string, unknown> = {}\n for (const [key, draft] of edited) {\n const parsed: Parsed = CODECS[kindOf(originalInputs[key])].read(draft)\n if ('problem' in parsed) return { problem: fill(l[parsed.problem], { key }) }\n overrides[key] = parsed.value\n }\n return { overrides }\n }\n\n const send = async (e?: FormEvent) => {\n e?.preventDefault()\n const result = collect()\n if ('problem' in result) return setNotice(result.problem)\n setNotice(null)\n setSending(true)\n try {\n await onReplay(result.overrides)\n setSending(false)\n onClose()\n } catch (why) {\n setSending(false)\n setNotice(why instanceof Error ? why.message : String(why))\n }\n }\n\n const rows = keys.map((key) => {\n const codec = CODECS[kindOf(originalInputs[key])]\n const touched = edited.has(key)\n const draft = touched ? edited.get(key)! : codec.draft(originalInputs[key])\n const word = codec.word(l)\n return (\n <div key={key} className=\"ty-run-replay-row\" data-touched={touched || undefined}>\n <div className=\"ty-run-replay-row__head\">\n <code className=\"ty-run-mono\">{key}</code>\n <Tag size=\"small\">{word}</Tag>\n {touched && (\n <Button variant=\"quiet\" size=\"compact\" leadingIcon={<RotateCcw />} onPress={() => restore(key)} className=\"ty-run-replay-row__reset\">\n <span aria-hidden=\"true\">{l.reset}</span>\n <span className=\"ty-visually-hidden\">{fill(l.resetKey, { key })}</span>\n </Button>\n )}\n </div>\n {codec.editor({ label: `${key} (${word})`, draft, l, put: (d) => put(key, d) })}\n </div>\n )\n })\n\n return (\n <SectionedModal\n isOpen={open}\n onOpenChange={(stillOpen) => {\n if (!stillOpen && !sending) onClose()\n }}\n title={l.title}\n subtitle={l.subtitle}\n width=\"wide\"\n busy={sending}\n onSubmitShortcut={() => void send()}\n footer={\n <div className=\"ty-run-dialog-footer\">\n <span className=\"ty-run-dialog-footer__ids\">\n <ShortId id={runId} label={l.run} />\n <ShortId id={flowId} label={l.flow} />\n </span>\n <Button variant=\"quiet\" onPress={onClose} disabled={sending}>\n {l.cancel}\n </Button>\n <Button variant=\"primary\" type=\"submit\" form={formId} busy={sending} busyLabel={l.replaying}>\n {l.replay}\n </Button>\n </div>\n }\n >\n <form id={formId} className=\"ty-run-form\" onSubmit={(e) => void send(e)} noValidate>\n {notice && (\n <div ref={noticeRef} tabIndex={-1} className=\"ty-run-dialog-error\">\n <InlineNotice tone=\"danger\" urgency=\"assertive\">\n {notice}\n </InlineNotice>\n </div>\n )}\n {rows.length ? rows : <p className=\"ty-run-empty\">{l.empty}</p>}\n </form>\n </SectionedModal>\n )\n}\n","// The decision behind a rewind, apart from its dialog: which steps may be the\n// cut, what is reused and what runs again, and the small state machine of\n// the dialog (choosing, sending, failed).\n\nimport { useEffect, useMemo, useReducer } from 'react'\nimport { normaliseStatus } from './lineage'\n\nexport interface RewindNode {\n nodeId: string\n nodeKind: string\n status: string\n}\n\n/** A step can be the cut only when it finished. */\nexport const canCutAt = (step: RewindNode): boolean => normaliseStatus(step.status) === 'completed'\n\n/**\n * Reused = finished steps up to and including the cut; again = everything\n * after the cut, whatever its state. No cut: nothing is reused.\n */\nexport function splitAtCut(steps: readonly RewindNode[], cut: string | null): { kept: RewindNode[]; rerun: RewindNode[] } {\n const kept: RewindNode[] = []\n const rerun: RewindNode[] = []\n let passed = cut === null || !steps.some((s) => s.nodeId === cut)\n for (const step of steps) {\n if (passed) rerun.push(step)\n else if (canCutAt(step)) kept.push(step)\n if (step.nodeId === cut) passed = true\n }\n return { kept, rerun }\n}\n\nexport type RewindPhase = { name: 'editing' } | { name: 'sending' } | { name: 'failed'; message: string }\n\nexport interface RewindDraft {\n cut: string | null\n reason: string\n phase: RewindPhase\n /** Sentence for the polite region after the person moves the cut. */\n echo: { kept: number; rerun: number } | null\n}\n\nexport type RewindAction =\n | { kind: 'reset'; cut: string | null }\n | { kind: 'cut'; cut: string; kept: number; rerun: number }\n | { kind: 'reason'; text: string }\n | { kind: 'send' }\n | { kind: 'fail'; message: string }\n | { kind: 'sent' }\n\nconst transitions: { [K in RewindAction['kind']]: (d: RewindDraft, a: Extract<RewindAction, { kind: K }>) => RewindDraft } = {\n reset: (_d, a) => ({ cut: a.cut, reason: '', phase: { name: 'editing' }, echo: null }),\n cut: (d, a) => ({ ...d, cut: a.cut, echo: { kept: a.kept, rerun: a.rerun } }),\n reason: (d, a) => ({ ...d, reason: a.text }),\n send: (d) => ({ ...d, phase: { name: 'sending' } }),\n fail: (d, a) => ({ ...d, phase: { name: 'failed', message: a.message } }),\n sent: (d) => ({ ...d, phase: { name: 'editing' } }),\n}\n\nexport function rewindStep(draft: RewindDraft, action: RewindAction): RewindDraft {\n return (transitions[action.kind] as (d: RewindDraft, a: RewindAction) => RewindDraft)(draft, action)\n}\n\n/** Dialog state; re-seeds on every opening (requested step if eligible, else the first eligible). */\nexport function useRewindPlan(open: boolean, steps: readonly RewindNode[], requested: string | undefined) {\n const eligible = useMemo(() => steps.filter(canCutAt), [steps])\n const [draft, act] = useReducer(rewindStep, { cut: null, reason: '', phase: { name: 'editing' }, echo: null })\n useEffect(() => {\n if (open) act({ kind: 'reset', cut: (eligible.find((s) => s.nodeId === requested) ?? eligible[0])?.nodeId ?? null })\n // re-seed on opening only\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n const split = useMemo(() => splitAtCut(steps, draft.cut), [steps, draft.cut])\n const moveCut = (cut: string) => {\n const preview = splitAtCut(steps, cut)\n act({ kind: 'cut', cut, kept: preview.kept.length, rerun: preview.rerun.length })\n }\n return { eligible, draft, act, split, moveCut }\n}\n","// RunRewindDialog: the dialog around rewindPlan.ts. It asks for the last\n// step to keep and an optional reason, previews what is reused and what runs\n// again, and sends the fork request. The rules live in rewindPlan.ts.\n\nimport type { ReactNode } from 'react'\nimport { History, RotateCw, type LucideIcon } from 'lucide-react'\nimport { Button, InlineNotice, NativeSelect, TextField } from '../../index'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useRewindPlan, type RewindNode } from './rewindPlan'\nimport { ShortId } from './ShortId'\n\nexport { splitAtCut, canCutAt, type RewindNode } from './rewindPlan'\n\nexport interface RunRewindDialogLabels {\n title: string\n subtitle: string\n picker: string\n reason: string\n reasonPlaceholder: string\n keptHeading: string\n rerunHeading: string\n none: string\n noEligible: string\n counts: string\n run: string\n cancel: string\n confirm: string\n confirming: string\n}\n\nexport const runRewindDialogLabels = defineLabels<RunRewindDialogLabels>('run-rewind-dialog', {\n en: {\n title: 'Rewind and run again',\n subtitle: 'Choose the last step to keep. Every step after it runs again with the current flow.',\n picker: 'Keep results up to',\n reason: 'Reason (optional)',\n reasonPlaceholder: 'What is being corrected',\n keptHeading: '{count, plural, one {Kept from this run: # step} other {Kept from this run: # steps}}',\n rerunHeading: '{count, plural, one {Will run again: # step} other {Will run again: # steps}}',\n none: 'none',\n noEligible: 'No step of this run completed, so there is nothing to keep. Start a new run instead.',\n counts: '{kept} kept, {rerun} will run again',\n run: 'Run',\n cancel: 'Cancel',\n confirm: 'Rewind',\n confirming: 'Rewinding',\n },\n 'pt-BR': {\n title: 'Voltar e executar de novo',\n subtitle: 'Escolha o último passo a manter. Todos os passos seguintes rodam de novo com o fluxo atual.',\n picker: 'Manter resultados até',\n reason: 'Motivo (opcional)',\n reasonPlaceholder: 'O que está sendo corrigido',\n keptHeading: '{count, plural, one {Mantido desta execução: # passo} other {Mantidos desta execução: # passos}}',\n rerunHeading: '{count, plural, one {Roda de novo: # passo} other {Rodam de novo: # passos}}',\n none: 'nenhum',\n noEligible: 'Nenhum passo desta execução foi concluído, então não há o que manter. Inicie uma nova execução.',\n counts: '{kept} mantidos, {rerun} rodam de novo',\n run: 'Execução',\n cancel: 'Cancelar',\n confirm: 'Voltar',\n confirming: 'Voltando',\n },\n es: {\n title: 'Retroceder y ejecutar de nuevo',\n subtitle: 'Elija el último paso que se conserva. Todos los pasos siguientes se ejecutan de nuevo con el flujo actual.',\n picker: 'Conservar resultados hasta',\n reason: 'Motivo (opcional)',\n reasonPlaceholder: 'Qué se está corrigiendo',\n keptHeading: '{count, plural, one {Conservado de esta ejecución: # paso} other {Conservados de esta ejecución: # pasos}}',\n rerunHeading: '{count, plural, one {Se ejecuta de nuevo: # paso} other {Se ejecutan de nuevo: # pasos}}',\n none: 'ninguno',\n noEligible: 'Ningún paso de esta ejecución terminó, así que no hay nada que conservar. Inicie una nueva ejecución.',\n counts: '{kept} conservados, {rerun} se ejecutan de nuevo',\n run: 'Ejecución',\n cancel: 'Cancelar',\n confirm: 'Retroceder',\n confirming: 'Retrocediendo',\n },\n})\nexport const defaultRunRewindDialogLabels: RunRewindDialogLabels = runRewindDialogLabels.bundles.en\n\nexport interface RunRewindDialogProps {\n open: boolean\n onClose: () => void\n runId: string\n nodes: readonly RewindNode[]\n initialNodeId?: string\n onRewind: (input: { resetToNode: string; reason?: string }) => Promise<void>\n labels?: Partial<RunRewindDialogLabels>\n}\n\n/** The two preview columns, described once and drawn the same way. */\nconst PREVIEW_COLUMNS: ReadonlyArray<{ id: string; icon: LucideIcon; heading: 'keptHeading' | 'rerunHeading'; pick: 'kept' | 'rerun' }> = [\n { id: 'ty-rewind-kept', icon: History, heading: 'keptHeading', pick: 'kept' },\n { id: 'ty-rewind-rerun', icon: RotateCw, heading: 'rerunHeading', pick: 'rerun' },\n]\n\nfunction stepLines(steps: readonly RewindNode[], labelledBy: string, emptyWord: string): ReactNode {\n if (!steps.length) return <p className=\"ty-run-hint\">{emptyWord}</p>\n return (\n <ul aria-labelledby={labelledBy} className=\"ty-run-rewind__items\">\n {steps.map(({ nodeId, nodeKind }) => (\n <li key={nodeId}>\n <code className=\"ty-run-mono\">{nodeId}</code> <span className=\"ty-run-row__kind\">{nodeKind}</span>\n </li>\n ))}\n </ul>\n )\n}\n\nexport function RunRewindDialog(props: RunRewindDialogProps) {\n const text = useLabels(runRewindDialogLabels, props.labels)\n const { locale } = useFlowLocale()\n const { eligible, draft, act, split, moveCut } = useRewindPlan(props.open, props.nodes, props.initialNodeId)\n const sending = draft.phase.name === 'sending'\n const nothingToKeep = eligible.length === 0\n\n const submit = async () => {\n const cut = draft.cut\n if (!cut) return\n const reason = draft.reason.trim()\n act({ kind: 'send' })\n try {\n await props.onRewind(reason ? { resetToNode: cut, reason } : { resetToNode: cut })\n act({ kind: 'sent' })\n props.onClose()\n } catch (problem) {\n act({ kind: 'fail', message: problem instanceof Error ? problem.message : String(problem) })\n }\n }\n\n const preview = PREVIEW_COLUMNS.map((col) => {\n const steps = split[col.pick]\n const Icon = col.icon\n return (\n <section key={col.id} className=\"ty-run-rewind__list\" aria-labelledby={col.id}>\n <h3 id={col.id} className=\"ty-run-section__title\">\n <Icon aria-hidden=\"true\" focusable=\"false\" className=\"ty-run-rewind__icon\" />\n {fill(text[col.heading], { count: steps.length }, locale)}\n </h3>\n {stepLines(steps, col.id, text.none)}\n </section>\n )\n })\n\n const form = (\n <div className=\"ty-run-form\">\n {draft.phase.name === 'failed' ? (\n <InlineNotice tone=\"danger\" urgency=\"assertive\">\n {draft.phase.message}\n </InlineNotice>\n ) : null}\n <NativeSelect label={text.picker} options={eligible.map((s) => ({ value: s.nodeId, label: `${s.nodeId}, ${s.nodeKind}` }))} value={draft.cut ?? ''} onChange={moveCut} />\n <TextField label={text.reason} placeholder={text.reasonPlaceholder} value={draft.reason} onChange={(t) => act({ kind: 'reason', text: t })} />\n <div className=\"ty-run-rewind__preview\">{preview}</div>\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {draft.echo ? fill(text.counts, draft.echo, locale) : ''}\n </p>\n </div>\n )\n\n const footer = (\n <div className=\"ty-run-dialog-footer\">\n <span className=\"ty-run-dialog-footer__ids\">\n <ShortId id={props.runId} label={text.run} />\n </span>\n <Button variant=\"quiet\" onPress={props.onClose} disabled={sending}>\n {text.cancel}\n </Button>\n {nothingToKeep ? null : (\n <Button variant=\"primary\" onPress={() => void submit()} disabled={!draft.cut} busy={sending} busyLabel={text.confirming}>\n {text.confirm}\n </Button>\n )}\n </div>\n )\n\n return (\n <SectionedModal\n isOpen={props.open}\n onOpenChange={(stays) => {\n if (!stays && !sending) props.onClose()\n }}\n title={text.title}\n subtitle={text.subtitle}\n tone=\"warning\"\n width=\"wide\"\n busy={sending}\n className=\"ty-run-rewind\"\n footer={footer}\n >\n {nothingToKeep ? <InlineNotice tone=\"warning\">{text.noEligible}</InlineNotice> : form}\n </SectionedModal>\n )\n}\n","// ExecutionTimeline: a run step by step. A listbox of steps (status, timing)\n// beside an inspector for the selected step: facts, model usage, model and tool\n// calls, inputs, outputs and error.\n\nimport { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'\nimport { ListBox, ListBoxItem } from 'react-aria-components'\nimport { ActorChip, Button, Tag, useMediaQuery } from '../../index'\nimport { formatDateTime, formatDuration, formatNumber } from '../internal/format'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { useControllable } from '../internal/useControllable'\nimport { RunStatusMark, type RunWordLabels } from './RunStatusMark'\nimport { prettyValue } from './runData'\nimport type { RunActor } from './types'\n\nexport type TimelineStatus = 'completed' | 'running' | 'failed' | 'pending' | 'skipped'\n\nexport interface ModelCall {\n sequence?: number\n turn: number\n agent?: string\n tokensIn?: number\n tokensOut?: number\n cacheRead?: number\n cacheWrite?: number\n cost?: number\n timeToFirstTokenMs?: number\n durationMs?: number\n stopReason?: string\n input?: unknown\n output?: unknown\n}\n\nexport interface ToolCall {\n sequence?: number\n status: string\n tool: string\n turn?: number\n durationMs?: number\n}\n\nexport interface StepMetrics {\n provider?: string\n model?: string\n tokensIn?: number\n tokensOut?: number\n cost?: number\n /** ISO 4217 code for the cost; plain number when absent. */\n currency?: string\n}\n\nexport interface TimelineEntry {\n nodeId: string\n nodeKind: string\n status: TimelineStatus\n startedAt?: string | null\n completedAt?: string | null\n durationMs?: number | null\n inputs?: unknown\n outputs?: unknown\n error?: string | null\n metrics?: StepMetrics\n modelCalls?: ModelCall[]\n toolCalls?: ToolCall[]\n restored?: boolean\n /** Agent (or person, system) that produced this step (§2.11). */\n actor?: RunActor\n}\n\nexport type AuditEvent =\n | ({ kind: 'model-call'; nodeId: string; sequence: number } & Omit<ModelCall, 'sequence'>)\n | ({ kind: 'tool-call'; nodeId: string; sequence: number } & Omit<ToolCall, 'sequence'>)\n | { kind: string; nodeId?: string; sequence?: number; [k: string]: unknown }\n\n/**\n * New entries with model-call and tool-call events attached to their node in\n * sequence order. Unknown nodes and other event kinds are ignored; entries\n * that gain nothing stay the same objects; with nothing to attach the input\n * list itself is returned.\n */\nexport function attachAuditEvents(entries: readonly TimelineEntry[], events: readonly AuditEvent[]): readonly TimelineEntry[] {\n const known = new Set(entries.map((e) => e.nodeId))\n const byNode = new Map<string, { model: ModelCall[]; tool: ToolCall[] }>()\n const sorted = events\n .filter((e) => (e.kind === 'model-call' || e.kind === 'tool-call') && typeof e.nodeId === 'string' && known.has(e.nodeId))\n .slice()\n .sort((a, b) => Number(a.sequence ?? 0) - Number(b.sequence ?? 0))\n if (!sorted.length) return entries\n for (const e of sorted) {\n const { kind, nodeId, ...rest } = e as { kind: string; nodeId: string } & Record<string, unknown>\n if (!byNode.has(nodeId)) byNode.set(nodeId, { model: [], tool: [] })\n const bucket = byNode.get(nodeId)!\n if (kind === 'model-call') bucket.model.push(rest as unknown as ModelCall)\n else bucket.tool.push(rest as unknown as ToolCall)\n }\n return entries.map((entry) => {\n const add = byNode.get(entry.nodeId)\n if (!add) return entry\n return {\n ...entry,\n ...(add.model.length ? { modelCalls: [...(entry.modelCalls ?? []), ...add.model] } : {}),\n ...(add.tool.length ? { toolCalls: [...(entry.toolCalls ?? []), ...add.tool] } : {}),\n }\n })\n}\n\nexport interface TimelineLabels {\n steps: string\n empty: string\n details: string\n restored: string\n started: string\n finished: string\n duration: string\n status: string\n notReported: string\n metrics: string\n model: string\n tokens: string\n tokensTerm: string\n cost: string\n error: string\n modelCalls: string\n toolCalls: string\n modelCallSummary: string\n cache: string\n firstToken: string\n stopReason: string\n modelInput: string\n modelOutput: string\n toolCallSummary: string\n inputs: string\n outputs: string\n backToSteps: string\n stepName: string\n selected: string\n}\n\nexport const timelineLabels = defineLabels<TimelineLabels>('execution-timeline', {\n en: {\n steps: 'Steps',\n empty: 'This run has no steps to show.',\n details: 'Details of {node}',\n restored: 'restored',\n started: 'Started',\n finished: 'Finished',\n duration: 'Duration',\n status: 'Status',\n notReported: 'not reported',\n metrics: 'Model usage',\n model: 'Model',\n tokens: '{input} in, {output} out',\n tokensTerm: 'Tokens',\n cost: 'Cost',\n error: 'Error',\n modelCalls: 'Model calls',\n toolCalls: 'Tool calls',\n modelCallSummary: 'Turn {turn}',\n cache: 'cache {read} read, {write} written',\n firstToken: 'first token {time}',\n stopReason: 'stop: {reason}',\n modelInput: 'Model input',\n modelOutput: 'Model output',\n toolCallSummary: '{tool}, turn {turn}',\n inputs: 'Inputs',\n outputs: 'Outputs',\n backToSteps: 'Back to steps',\n stepName: 'Step {ordinal}: {node}, {kind}',\n selected: 'Showing {node}',\n },\n 'pt-BR': {\n steps: 'Passos',\n empty: 'Esta execução não tem passos para mostrar.',\n details: 'Detalhes de {node}',\n restored: 'reaproveitado',\n started: 'Início',\n finished: 'Fim',\n duration: 'Duração',\n status: 'Estado',\n notReported: 'não informado',\n metrics: 'Uso do modelo',\n model: 'Modelo',\n tokens: '{input} de entrada, {output} de saída',\n tokensTerm: 'Tokens',\n cost: 'Custo',\n error: 'Erro',\n modelCalls: 'Chamadas ao modelo',\n toolCalls: 'Chamadas de ferramenta',\n modelCallSummary: 'Turno {turn}',\n cache: 'cache {read} lidos, {write} gravados',\n firstToken: 'primeiro token {time}',\n stopReason: 'parada: {reason}',\n modelInput: 'Entrada do modelo',\n modelOutput: 'Saída do modelo',\n toolCallSummary: '{tool}, turno {turn}',\n inputs: 'Entradas',\n outputs: 'Saídas',\n backToSteps: 'Voltar aos passos',\n stepName: 'Passo {ordinal}: {node}, {kind}',\n selected: 'Mostrando {node}',\n },\n es: {\n steps: 'Pasos',\n empty: 'Esta ejecución no tiene pasos para mostrar.',\n details: 'Detalles de {node}',\n restored: 'restaurado',\n started: 'Inicio',\n finished: 'Fin',\n duration: 'Duración',\n status: 'Estado',\n notReported: 'no informado',\n metrics: 'Uso del modelo',\n model: 'Modelo',\n tokens: '{input} de entrada, {output} de salida',\n tokensTerm: 'Tokens',\n cost: 'Costo',\n error: 'Error',\n modelCalls: 'Llamadas al modelo',\n toolCalls: 'Llamadas a herramientas',\n modelCallSummary: 'Turno {turn}',\n cache: 'caché {read} leídos, {write} escritos',\n firstToken: 'primer token {time}',\n stopReason: 'parada: {reason}',\n modelInput: 'Entrada del modelo',\n modelOutput: 'Salida del modelo',\n toolCallSummary: '{tool}, turno {turn}',\n inputs: 'Entradas',\n outputs: 'Salidas',\n backToSteps: 'Volver a los pasos',\n stepName: 'Paso {ordinal}: {node}, {kind}',\n selected: 'Mostrando {node}',\n },\n})\nexport const defaultTimelineLabels: TimelineLabels = timelineLabels.bundles.en\n\nexport interface ExecutionTimelineProps {\n entries: readonly TimelineEntry[]\n selectedNodeId?: string\n onSelect?: (nodeId: string) => void\n inspectorActions?: (entry: TimelineEntry) => ReactNode\n labels?: Partial<TimelineLabels>\n statusLabels?: Partial<RunWordLabels>\n /** Hides the restored Tag when false (the spec: omitting the label hides it). */\n showRestored?: boolean\n}\n\n/** Default selection: the first failed step, else the first step. */\nexport function defaultTimelineSelection(entries: readonly TimelineEntry[]): string | undefined {\n return (entries.find((e) => e.status === 'failed') ?? entries[0])?.nodeId\n}\n\nexport function ExecutionTimeline({ entries, selectedNodeId, onSelect, inspectorActions, labels, statusLabels, showRestored = true }: ExecutionTimelineProps) {\n const l = useLabels(timelineLabels, labels)\n const { locale } = useFlowLocale()\n const wide = useMediaQuery('(min-width: 1024px)', true)\n const [selected, setSelected] = useControllable<string | undefined>(selectedNodeId, () => defaultTimelineSelection(entries), onSelect ? (id) => id && onSelect(id) : undefined)\n const listRef = useRef<HTMLDivElement>(null)\n const inspectorId = useId()\n const [announce, setAnnounce] = useState('')\n const first = useRef(true)\n const entry = useMemo(() => entries.find((e) => e.nodeId === selected) ?? (selectedNodeId === undefined ? entries.find((e) => e.nodeId === defaultTimelineSelection(entries)) : undefined), [entries, selected, selectedNodeId])\n\n useEffect(() => {\n if (first.current) {\n first.current = false\n return\n }\n if (entry) setAnnounce(fill(l.selected, { node: entry.nodeId }, locale))\n // Announce changes of the selected node only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [entry?.nodeId])\n\n if (!entries.length) return <p className=\"ty-run-empty ty-timeline__empty\">{l.empty}</p>\n\n const dur = (ms?: number | null) => (ms === null || ms === undefined ? l.notReported : formatDuration(ms, locale))\n const when = (iso?: string | null) => (iso ? formatDateTime(iso, locale, { timeStyle: 'medium' }) : l.notReported)\n const num = (n?: number) => (n === undefined ? l.notReported : formatNumber(n, locale))\n const money = (n?: number, currency?: string) => (n === undefined ? l.notReported : currency ? formatNumber(n, locale, { style: 'currency', currency, maximumFractionDigits: 4 }) : formatNumber(n, locale, { maximumFractionDigits: 6 }))\n\n return (\n <div className=\"ty-timeline\" data-layout={wide ? 'columns' : 'stacked'}>\n <div className=\"ty-timeline__steps\" ref={listRef}>\n <ListBox\n aria-label={l.steps}\n className=\"ty-timeline__list\"\n selectionMode=\"single\"\n disallowEmptySelection\n selectedKeys={entry ? [entry.nodeId] : []}\n onSelectionChange={(keys) => {\n const k = [...(keys as Set<string | number>)][0]\n if (k !== undefined) setSelected(String(k))\n }}\n items={entries.map((e, i) => ({ ...e, id: e.nodeId, ordinal: i + 1 }))}\n >\n {(e) => (\n <ListBoxItem id={e.nodeId} textValue={fill(l.stepName, { ordinal: e.ordinal, node: e.nodeId, kind: e.nodeKind }, locale)} className=\"ty-timeline__step\" data-status={e.status}>\n <span className=\"ty-timeline__ordinal\" aria-hidden=\"true\">\n {formatNumber(e.ordinal, locale)}\n </span>\n <span className=\"ty-timeline__step-main\">\n <span className=\"ty-timeline__node\">\n <code className=\"ty-run-mono\">{e.nodeId}</code>\n <span className=\"ty-run-row__kind\">{e.nodeKind}</span>\n </span>\n <span className=\"ty-timeline__step-meta\">\n <RunStatusMark status={e.status} labels={statusLabels} />\n <span>{dur(e.durationMs)}</span>\n {e.startedAt ? <time dateTime={e.startedAt}>{when(e.startedAt)}</time> : null}\n </span>\n </span>\n </ListBoxItem>\n )}\n </ListBox>\n </div>\n {entry ? (\n <section id={inspectorId} className=\"ty-timeline__inspector\" aria-label={fill(l.details, { node: entry.nodeId }, locale)}>\n {!wide ? (\n <Button\n variant=\"quiet\"\n size=\"compact\"\n onPress={() => listRef.current?.querySelector<HTMLElement>('[role=\"option\"][aria-selected=\"true\"]')?.focus()}\n className=\"ty-timeline__back\"\n >\n {l.backToSteps}\n </Button>\n ) : null}\n <header className=\"ty-timeline__head\">\n <h3 className=\"ty-run-section__title\">\n <code className=\"ty-run-mono\">{entry.nodeId}</code>\n </h3>\n {entry.restored && showRestored ? <Tag size=\"small\">{l.restored}</Tag> : null}\n <RunStatusMark status={entry.status} labels={statusLabels} />\n {entry.actor ? <ActorChip kind={entry.actor.kind} name={entry.actor.name} {...(entry.actor.agentKey ? { agentKey: entry.actor.agentKey } : {})} {...(entry.actor.model ? { model: entry.actor.model } : {})} compact /> : null}\n {entry.startedAt ? (\n <time className=\"ty-timeline__time\" dateTime={entry.startedAt}>\n {when(entry.startedAt)}\n </time>\n ) : null}\n {inspectorActions ? <div className=\"ty-timeline__actions\">{inspectorActions(entry)}</div> : null}\n </header>\n <dl className=\"ty-run-facts\">\n <div>\n <dt>{l.started}</dt>\n <dd>{when(entry.startedAt)}</dd>\n </div>\n <div>\n <dt>{l.finished}</dt>\n <dd>{when(entry.completedAt)}</dd>\n </div>\n <div>\n <dt>{l.duration}</dt>\n <dd>{dur(entry.durationMs)}</dd>\n </div>\n <div>\n <dt>{l.status}</dt>\n <dd>\n <RunStatusMark status={entry.status} labels={statusLabels} />\n </dd>\n </div>\n </dl>\n {entry.metrics ? (\n <section className=\"ty-run-section\">\n <h4 className=\"ty-run-subtitle\">{l.metrics}</h4>\n <dl className=\"ty-run-facts\">\n <div>\n <dt>{l.model}</dt>\n <dd>\n <code className=\"ty-run-mono\">{[entry.metrics.provider, entry.metrics.model].filter(Boolean).join(' · ') || l.notReported}</code>\n </dd>\n </div>\n <div>\n <dt>{l.tokensTerm}</dt>\n <dd>{fill(l.tokens, { input: num(entry.metrics.tokensIn), output: num(entry.metrics.tokensOut) }, locale)}</dd>\n </div>\n <div>\n <dt>{l.cost}</dt>\n <dd>{money(entry.metrics.cost, entry.metrics.currency)}</dd>\n </div>\n </dl>\n </section>\n ) : null}\n {entry.error ? (\n <section className=\"ty-run-section\">\n <h4 className=\"ty-run-subtitle\">{l.error}</h4>\n <p className=\"ty-run-error\">{entry.error}</p>\n </section>\n ) : null}\n {entry.modelCalls?.length ? (\n <section className=\"ty-run-section\">\n <h4 className=\"ty-run-subtitle\">{l.modelCalls}</h4>\n {entry.modelCalls.map((c, i) => (\n <details key={i} className=\"ty-timeline__call\">\n <summary className=\"ty-timeline__call-summary\">\n {[\n fill(l.modelCallSummary, { turn: c.turn }, locale),\n c.agent,\n c.tokensIn !== undefined || c.tokensOut !== undefined ? fill(l.tokens, { input: num(c.tokensIn), output: num(c.tokensOut) }, locale) : null,\n c.cacheRead !== undefined || c.cacheWrite !== undefined ? fill(l.cache, { read: num(c.cacheRead ?? 0), write: num(c.cacheWrite ?? 0) }, locale) : null,\n c.cost !== undefined ? money(c.cost, entry.metrics?.currency) : null,\n c.timeToFirstTokenMs !== undefined ? fill(l.firstToken, { time: formatDuration(c.timeToFirstTokenMs, locale) }, locale) : null,\n c.durationMs !== undefined ? formatDuration(c.durationMs, locale) : null,\n c.stopReason ? fill(l.stopReason, { reason: c.stopReason }, locale) : null,\n ]\n .filter(Boolean)\n .join(' · ')}\n </summary>\n <h5 className=\"ty-run-subtitle\">{l.modelInput}</h5>\n <Transcript value={c.input} />\n <h5 className=\"ty-run-subtitle\">{l.modelOutput}</h5>\n <Transcript value={c.output} />\n </details>\n ))}\n </section>\n ) : null}\n {entry.toolCalls?.length ? (\n <section className=\"ty-run-section\">\n <h4 className=\"ty-run-subtitle\">{l.toolCalls}</h4>\n <ul className=\"ty-run-rows\">\n {entry.toolCalls.map((t, i) => (\n <li key={i} className=\"ty-run-row\">\n <RunStatusMark status={t.status} labels={statusLabels} />\n <span>{fill(l.toolCallSummary, { tool: t.tool, turn: t.turn ?? '' }, locale)}</span>\n <span className=\"ty-run-row__duration\">{dur(t.durationMs)}</span>\n </li>\n ))}\n </ul>\n </section>\n ) : null}\n <section className=\"ty-run-section\">\n <h4 className=\"ty-run-subtitle\">{l.inputs}</h4>\n <pre className=\"ty-run-output\" tabIndex={0} aria-label={l.inputs}>\n {entry.inputs === undefined ? l.notReported : prettyValue(entry.inputs)}\n </pre>\n <h4 className=\"ty-run-subtitle\">{l.outputs}</h4>\n <pre className=\"ty-run-output\" tabIndex={0} aria-label={l.outputs}>\n {entry.outputs === undefined ? l.notReported : prettyValue(entry.outputs)}\n </pre>\n </section>\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {announce}\n </p>\n </section>\n ) : null}\n </div>\n )\n}\n\n/** Model transcript: text blocks as readable text, other blocks as structured text. */\nfunction Transcript({ value }: { value: unknown }) {\n if (value === undefined || value === null) return null\n if (typeof value === 'string') return <p className=\"ty-timeline__text\">{value}</p>\n if (Array.isArray(value)) {\n return (\n <div className=\"ty-timeline__transcript\">\n {value.map((item, i) => (\n <TranscriptBlock key={i} block={item} />\n ))}\n </div>\n )\n }\n return <TranscriptBlock block={value} />\n}\n\nfunction TranscriptBlock({ block }: { block: unknown }) {\n if (typeof block === 'string') return <p className=\"ty-timeline__text\">{block}</p>\n if (block && typeof block === 'object') {\n const b = block as Record<string, unknown>\n if (b.type === 'text' && typeof b.text === 'string') return <p className=\"ty-timeline__text\">{b.text}</p>\n if ('content' in b && typeof b.role === 'string') {\n return (\n <div className=\"ty-timeline__message\" data-role={b.role}>\n <span className=\"ty-timeline__role\">{b.role}</span>\n <Transcript value={b.content} />\n </div>\n )\n }\n }\n return <pre className=\"ty-run-output\">{prettyValue(block)}</pre>\n}\n","// VariableInspector: for each node in execution order, the variables it\n// consumes and produces, so authors can trace data through the flow.\n\nimport { ChevronRight } from 'lucide-react'\nimport { Button as AriaButton, Disclosure, DisclosureGroup, DisclosurePanel, Heading } from 'react-aria-components'\nimport { useRenderCatalog } from '../catalog/RenderCatalog'\nimport { DockedPanel } from '../internal/DockedPanel'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { topologicalOrder } from '../model/graph'\nimport type { FlowNode } from '../model/types'\nimport { useFlowEditorState } from '../state/editorState'\n\nexport type VariableType = 'any' | 'array' | 'number' | 'boolean' | 'string'\n\nexport interface InferredVariable {\n name: string\n type: VariableType\n}\n\nexport interface NodeVariables {\n inputs: InferredVariable[]\n outputs: InferredVariable[]\n}\n\nconst cfg = (n: FlowNode): Record<string, unknown> => (n.data.config && typeof n.data.config === 'object' ? (n.data.config as Record<string, unknown>) : n.data)\n\nconst names = (v: unknown): string[] =>\n Array.isArray(v) ? v.map((x) => (typeof x === 'string' ? x : x && typeof x === 'object' && typeof (x as { name?: unknown }).name === 'string' ? (x as { name: string }).name : '')).filter(Boolean) : []\n\nconst str = (v: unknown, fallback: string) => (typeof v === 'string' && v ? v : fallback)\n\n/** Variables a node consumes and produces, inferred from its kind and configuration. */\nexport function inferVariables(node: FlowNode): NodeVariables {\n const c = cfg(node)\n switch (node.kind) {\n case 'start':\n return { inputs: [], outputs: names(c.inputVariables).map((name) => ({ name, type: 'any' })) }\n case 'end':\n return { inputs: names(c.outputs ?? c.outputVariables).map((name) => ({ name, type: 'any' })), outputs: [] }\n case 'code':\n case 'compute': {\n const expr = (c.expression ?? c.root ?? c) as Record<string, unknown>\n return { inputs: [{ name: str(expr.operation, 'input'), type: 'any' }], outputs: [{ name: str(c.outputVariable, 'result'), type: 'any' }] }\n }\n case 'if-else':\n case 'branch': {\n const conditions = Array.isArray(c.conditions) ? (c.conditions as Array<Record<string, unknown>>) : []\n const vars = [...new Set(conditions.map((x) => str(x.variable ?? x.ref, '')).filter(Boolean))]\n return { inputs: vars.map((name) => ({ name, type: 'any' })), outputs: [{ name: 'true', type: 'boolean' }, { name: 'false', type: 'boolean' }] }\n }\n case 'iteration':\n case 'loop':\n return { inputs: [{ name: str(c.collection ?? c.iterator, 'items'), type: 'array' }], outputs: [{ name: 'item', type: 'any' }, { name: 'index', type: 'number' }] }\n case 'answer':\n return { inputs: [{ name: str(c.templateName, 'template'), type: 'string' }], outputs: names(c.outputs).map((name) => ({ name, type: 'any' })) }\n default:\n return { inputs: [], outputs: [] }\n }\n}\n\nexport interface VariableInspectorLabels {\n title: string\n close: string\n inputs: string\n outputs: string\n variables: string\n noVariables: string\n noNodes: string\n any: string\n array: string\n number: string\n boolean: string\n string: string\n}\n\nexport const variableInspectorLabels = defineLabels<VariableInspectorLabels>('variable-inspector', {\n en: {\n title: 'Variables',\n close: 'Close variables',\n inputs: 'Inputs',\n outputs: 'Outputs',\n variables: '{count, plural, =0 {no variables} one {# variable} other {# variables}}',\n noVariables: 'This step neither reads nor writes variables.',\n noNodes: 'Add steps to the flow to see their variables.',\n any: 'any',\n array: 'list',\n number: 'number',\n boolean: 'true or false',\n string: 'text',\n },\n 'pt-BR': {\n title: 'Variáveis',\n close: 'Fechar variáveis',\n inputs: 'Entradas',\n outputs: 'Saídas',\n variables: '{count, plural, =0 {nenhuma variável} one {# variável} other {# variáveis}}',\n noVariables: 'Este passo não lê nem escreve variáveis.',\n noNodes: 'Adicione passos ao fluxo para ver suas variáveis.',\n any: 'qualquer',\n array: 'lista',\n number: 'número',\n boolean: 'verdadeiro ou falso',\n string: 'texto',\n },\n es: {\n title: 'Variables',\n close: 'Cerrar variables',\n inputs: 'Entradas',\n outputs: 'Salidas',\n variables: '{count, plural, =0 {sin variables} one {# variable} other {# variables}}',\n noVariables: 'Este paso no lee ni escribe variables.',\n noNodes: 'Agregue pasos al flujo para ver sus variables.',\n any: 'cualquiera',\n array: 'lista',\n number: 'número',\n boolean: 'verdadero o falso',\n string: 'texto',\n },\n})\nexport const defaultVariableInspectorLabels: VariableInspectorLabels = variableInspectorLabels.bundles.en\n\nexport interface VariableInspectorProps {\n open: boolean\n onClose: () => void\n labels?: Partial<VariableInspectorLabels>\n}\n\nexport function VariableInspector({ open, onClose, labels }: VariableInspectorProps) {\n if (!open) return null\n return <InspectorBody onClose={onClose} labels={labels} />\n}\n\nfunction InspectorBody({ onClose, labels }: Omit<VariableInspectorProps, 'open'>) {\n const l = useLabels(variableInspectorLabels, labels)\n const { locale } = useFlowLocale()\n const catalog = useRenderCatalog()\n const nodes = useFlowEditorState((s) => s.nodes)\n const connectors = useFlowEditorState((s) => s.connectors)\n const steps = nodes.filter((n) => n.kind !== 'note')\n const byId = new Map(steps.map((n) => [n.id, n]))\n const ordered = topologicalOrder(\n steps.map((n) => n.id),\n connectors,\n ).map((id) => byId.get(id)!)\n\n const varList = (vars: InferredVariable[], heading: string) => (\n <section className=\"ty-variables__group\">\n <h4 className=\"ty-run-subtitle\">{heading}</h4>\n <ul className=\"ty-variables__list\">\n {vars.map((v) => (\n <li key={v.name} className=\"ty-variables__item\">\n <code className=\"ty-run-mono\">{v.name}</code>\n <span className=\"ty-variables__type\">{l[v.type]}</span>\n </li>\n ))}\n </ul>\n </section>\n )\n\n return (\n <DockedPanel title={l.title} onClose={onClose} closeLabel={l.close} className=\"ty-variables\">\n {ordered.length === 0 ? (\n <p className=\"ty-run-empty\">{l.noNodes}</p>\n ) : (\n <DisclosureGroup allowsMultipleExpanded className=\"ty-variables__entries\">\n {ordered.map((n) => {\n const vars = inferVariables(n)\n const count = vars.inputs.length + vars.outputs.length\n const Icon = catalog.icon(n.kind)\n const label = typeof n.data.label === 'string' && n.data.label ? n.data.label : (catalog.entry(n.kind)?.label ?? n.id)\n return (\n <Disclosure key={n.id} id={n.id} className=\"ty-variables__entry\">\n <Heading level={3} className=\"ty-variables__heading\">\n <AriaButton slot=\"trigger\" className=\"ty-variables__trigger\">\n <ChevronRight className=\"ty-variables__chevron ty-run-mirror\" aria-hidden=\"true\" focusable=\"false\" />\n <Icon className=\"ty-variables__icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-variables__label\">{label}</span>\n <span className=\"ty-variables__count\">{fill(l.variables, { count }, locale)}</span>\n </AriaButton>\n </Heading>\n <DisclosurePanel className=\"ty-variables__panel\">\n {count === 0 ? (\n <p className=\"ty-run-hint\">{l.noVariables}</p>\n ) : (\n <>\n {vars.inputs.length ? varList(vars.inputs, l.inputs) : null}\n {vars.outputs.length ? varList(vars.outputs, l.outputs) : null}\n </>\n )}\n </DisclosurePanel>\n </Disclosure>\n )\n })}\n </DisclosureGroup>\n )}\n </DockedPanel>\n )\n}\n","// VersionHistoryPanel: the published versions of a flow, newest first; each\n// can be previewed read-only or restored as the working draft (the host\n// confirms). The live version is marked by a word and a border.\n\nimport { useEffect, useState } from 'react'\nimport { ActorChip, Button, InlineNotice, Skeleton } from '../../index'\nimport { DockedPanel } from '../internal/DockedPanel'\nimport { formatDateTime } from '../internal/format'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { RunActor } from './types'\n\nexport interface FlowVersion {\n number: number\n publishedAt: string\n publishedBy: RunActor\n nodeCount: number\n connectorCount: number\n}\n\nexport interface VersionHistoryPanelLabels {\n title: string\n close: string\n loading: string\n error: string\n retry: string\n empty: string\n current: string\n version: string\n publishedBy: string\n counts: string\n preview: string\n restore: string\n}\n\nexport const versionHistoryPanelLabels = defineLabels<VersionHistoryPanelLabels>('VersionHistoryPanel', {\n en: {\n title: 'Versions',\n close: 'Close versions',\n loading: 'Loading versions',\n error: 'Versions could not be loaded: {message}',\n retry: 'Try again',\n empty: 'No version has been published yet.',\n current: 'current',\n version: 'Version {number, number}',\n publishedBy: 'Published by',\n counts: '{nodes, plural, one {# node} other {# nodes}}, {connectors, plural, one {# connector} other {# connectors}}',\n preview: 'Preview version {number, number}',\n restore: 'Restore version {number, number}',\n },\n 'pt-BR': {\n title: 'Versões',\n close: 'Fechar versões',\n loading: 'Carregando versões',\n error: 'Não foi possível carregar as versões: {message}',\n retry: 'Tentar de novo',\n empty: 'Nenhuma versão foi publicada ainda.',\n current: 'atual',\n version: 'Versão {number, number}',\n publishedBy: 'Publicada por',\n counts: '{nodes, plural, one {# nó} other {# nós}}, {connectors, plural, one {# conexão} other {# conexões}}',\n preview: 'Ver versão {number, number}',\n restore: 'Restaurar versão {number, number}',\n },\n es: {\n title: 'Versiones',\n close: 'Cerrar versiones',\n loading: 'Cargando versiones',\n error: 'No se pudieron cargar las versiones: {message}',\n retry: 'Reintentar',\n empty: 'Aún no se ha publicado ninguna versión.',\n current: 'actual',\n version: 'Versión {number, number}',\n publishedBy: 'Publicada por',\n counts: '{nodes, plural, one {# nodo} other {# nodos}}, {connectors, plural, one {# conexión} other {# conexiones}}',\n preview: 'Ver versión {number, number}',\n restore: 'Restaurar versión {number, number}',\n },\n})\n\nexport const defaultVersionHistoryPanelLabels: VersionHistoryPanelLabels = versionHistoryPanelLabels.bundles.en\n\nexport interface VersionHistoryPanelProps {\n open: boolean\n onClose: () => void\n flowId: string\n currentVersion: number\n loadVersions?: (flowId: string) => Promise<FlowVersion[]>\n onPreview: (version: FlowVersion) => void\n onRestore: (version: FlowVersion) => void\n labels?: Partial<VersionHistoryPanelLabels>\n returnFocusTo?: HTMLElement | null\n}\n\ntype State = { kind: 'loading' } | { kind: 'error'; message: string } | { kind: 'ready'; versions: FlowVersion[] }\n\nexport function VersionHistoryPanel(props: VersionHistoryPanelProps) {\n const { open, onClose, flowId, currentVersion, loadVersions, onPreview, onRestore, returnFocusTo } = props\n const l = useLabels(versionHistoryPanelLabels, props.labels)\n const { locale } = useFlowLocale()\n const [state, setState] = useState<State>({ kind: 'loading' })\n const [attempt, setAttempt] = useState(0)\n\n useEffect(() => {\n if (!open) return\n if (!loadVersions) {\n setState({ kind: 'ready', versions: [] })\n return\n }\n let live = true\n setState({ kind: 'loading' })\n loadVersions(flowId).then(\n (versions) => live && setState({ kind: 'ready', versions: [...versions].sort((a, b) => b.number - a.number) }),\n (e: unknown) => live && setState({ kind: 'error', message: e instanceof Error ? e.message : String(e) }),\n )\n return () => {\n live = false\n }\n }, [open, flowId, loadVersions, attempt])\n\n if (!open) return null\n\n return (\n <DockedPanel title={l.title} landmark=\"complementary\" onClose={onClose} closeLabel={l.close} returnFocusTo={returnFocusTo ?? null} busy={state.kind === 'loading'} className=\"ty-versions\">\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {state.kind === 'loading' ? l.loading : state.kind === 'error' ? fill(l.error, { message: state.message }, locale) : ''}\n </p>\n {state.kind === 'loading' ? (\n <div aria-busy=\"true\">\n <Skeleton lines={3} />\n </div>\n ) : state.kind === 'error' ? (\n <InlineNotice\n tone=\"danger\"\n urgency=\"none\"\n actions={\n <Button variant=\"secondary\" size=\"compact\" onPress={() => setAttempt((a) => a + 1)}>\n {l.retry}\n </Button>\n }\n >\n {fill(l.error, { message: state.message }, locale)}\n </InlineNotice>\n ) : state.versions.length === 0 ? (\n <p className=\"ty-run-empty\">{l.empty}</p>\n ) : (\n <ul className=\"ty-versions__list\">\n {state.versions.map((v) => {\n const current = v.number === currentVersion\n return (\n <li key={v.number} className=\"ty-versions__entry\" data-current={current ? 'true' : 'false'}>\n <div className=\"ty-versions__head\">\n <span className=\"ty-versions__number\">{fill(l.version, { number: v.number }, locale)}</span>\n {current ? <span className=\"ty-versions__current\">{l.current}</span> : null}\n </div>\n <div className=\"ty-versions__meta\">\n <span className=\"ty-visually-hidden\">{l.publishedBy}</span>\n <ActorChip kind={v.publishedBy.kind} name={v.publishedBy.name} compact {...(v.publishedBy.agentKey ? { agentKey: v.publishedBy.agentKey } : {})} {...(v.publishedBy.model ? { model: v.publishedBy.model } : {})} />\n <time dateTime={v.publishedAt}>{formatDateTime(v.publishedAt, locale)}</time>\n <span>{fill(l.counts, { nodes: v.nodeCount, connectors: v.connectorCount }, locale)}</span>\n </div>\n <div className=\"ty-versions__actions\">\n <Button variant=\"secondary\" size=\"compact\" onPress={() => onPreview(v)}>\n {fill(l.preview, { number: v.number }, locale)}\n </Button>\n {current ? null : (\n <Button variant=\"quiet\" size=\"compact\" onPress={() => onRestore(v)}>\n {fill(l.restore, { number: v.number }, locale)}\n </Button>\n )}\n </div>\n </li>\n )\n })}\n </ul>\n )}\n </DockedPanel>\n )\n}\n","// FlowSettingsDialog: edits a flow's name, description and (when the opener\n// knows them) its slug and lifecycle switches. Save sends name and description\n// always, and every other field only when it changed.\n\nimport { useEffect, useId, useState, type KeyboardEvent } from 'react'\nimport { Button, Fieldset, Switch, TextArea, TextField } from '../../index'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { defineLabels, useFlowLocale, useLabels } from '../internal/labels'\nimport { useActiveDialog, useDialogStack, type FlowSettingsPayload } from '../state/dialogStack'\n\nexport interface FlowSettingsPatch {\n name: string\n description: string\n slug?: string | null\n isDraft?: boolean\n isActive?: boolean\n}\n\nexport interface FlowSettingsDialogLabels {\n eyebrow: string\n title: string\n subtitle: string\n name: string\n nameRequired: string\n description: string\n slug: string\n slugHint: string\n lifecycle: string\n draft: string\n draftOn: string\n draftOff: string\n active: string\n activeOn: string\n activeOff: string\n cancel: string\n save: string\n saving: string\n}\n\nexport const flowSettingsDialogLabels = defineLabels<FlowSettingsDialogLabels>('FlowSettingsDialog', {\n en: {\n eyebrow: 'Flow',\n title: 'Flow settings',\n subtitle: 'Name, description and lifecycle of this flow.',\n name: 'Name',\n nameRequired: 'Give the flow a name.',\n description: 'Description',\n slug: 'Address name',\n slugHint: 'Leave blank to use the generated one.',\n lifecycle: 'Lifecycle',\n draft: 'Draft',\n draftOn: 'Editable; runs are not affected.',\n draftOff: 'Published: edits need a new version.',\n active: 'Active',\n activeOn: 'Listed and runnable.',\n activeOff: 'Archived: hidden from default listings.',\n cancel: 'Cancel',\n save: 'Save',\n saving: 'Saving',\n },\n 'pt-BR': {\n eyebrow: 'Fluxo',\n title: 'Configurações do fluxo',\n subtitle: 'Nome, descrição e ciclo de vida deste fluxo.',\n name: 'Nome',\n nameRequired: 'Dê um nome ao fluxo.',\n description: 'Descrição',\n slug: 'Nome no endereço',\n slugHint: 'Deixe em branco para usar o gerado.',\n lifecycle: 'Ciclo de vida',\n draft: 'Rascunho',\n draftOn: 'Editável; execuções não são afetadas.',\n draftOff: 'Publicado: edições exigem nova versão.',\n active: 'Ativo',\n activeOn: 'Listado e executável.',\n activeOff: 'Arquivado: fora das listagens padrão.',\n cancel: 'Cancelar',\n save: 'Salvar',\n saving: 'Salvando',\n },\n es: {\n eyebrow: 'Flujo',\n title: 'Ajustes del flujo',\n subtitle: 'Nombre, descripción y ciclo de vida de este flujo.',\n name: 'Nombre',\n nameRequired: 'Dale un nombre al flujo.',\n description: 'Descripción',\n slug: 'Nombre en la dirección',\n slugHint: 'Déjalo en blanco para usar el generado.',\n lifecycle: 'Ciclo de vida',\n draft: 'Borrador',\n draftOn: 'Editable; las ejecuciones no se ven afectadas.',\n draftOff: 'Publicado: los cambios requieren una nueva versión.',\n active: 'Activo',\n activeOn: 'Listado y ejecutable.',\n activeOff: 'Archivado: oculto en los listados predeterminados.',\n cancel: 'Cancelar',\n save: 'Guardar',\n saving: 'Guardando',\n },\n})\nexport const defaultFlowSettingsDialogLabels = flowSettingsDialogLabels.bundles.en\n\nexport interface FlowSettingsDialogProps {\n onSave: (patch: FlowSettingsPatch) => Promise<void>\n labels?: Partial<FlowSettingsDialogLabels>\n}\n\n/** What the person is editing; `undefined` switches are not offered. */\ninterface Sheet {\n name: string\n description: string\n slug: string\n isDraft?: boolean\n isActive?: boolean\n}\n\nconst sheetFrom = (p: FlowSettingsPayload): Sheet => ({\n name: p.name,\n description: p.description,\n slug: p.slug ?? '',\n ...(p.isDraft !== undefined ? { isDraft: p.isDraft } : {}),\n ...(p.isActive !== undefined ? { isActive: p.isActive } : {}),\n})\n\n/** The patch for the edited values against the opening data. */\nexport function flowSettingsPatch(original: FlowSettingsPayload, edited: Sheet): FlowSettingsPatch {\n const patch: FlowSettingsPatch = { name: edited.name.trim(), description: edited.description.trim() }\n const newSlug = edited.slug.trim()\n if (original.slug !== undefined && newSlug !== (original.slug ?? '')) patch.slug = newSlug || null\n const flips = (['isDraft', 'isActive'] as const).filter((k) => original[k] !== undefined && edited[k] !== undefined && edited[k] !== original[k])\n for (const k of flips) patch[k] = edited[k]!\n return patch\n}\n\n/** Enter saves from single-line text inputs only (the description keeps its line breaks). */\nconst savesOnEnter = (e: KeyboardEvent<HTMLElement>) => e.key === 'Enter' && !e.shiftKey && e.target instanceof HTMLInputElement && (e.target.type === 'text' || e.target.type === '')\n\nexport function FlowSettingsDialog({ onSave, labels }: FlowSettingsDialogProps) {\n const l = useLabels(flowSettingsDialogLabels, labels)\n const { direction } = useFlowLocale()\n const opened = useActiveDialog<FlowSettingsPayload>('flow-settings')\n const stack = useDialogStack()\n const original = opened?.payload ?? null\n const [sheet, setSheet] = useState<Sheet>({ name: '', description: '', slug: '' })\n const [blankName, setBlankName] = useState(false)\n const [saving, setSaving] = useState(false)\n const draftNote = useId()\n const activeNote = useId()\n\n useEffect(() => {\n if (!original) return\n setSheet(sheetFrom(original))\n setBlankName(false)\n setSaving(false)\n }, [original])\n\n if (!original) return null\n const put = (change: Partial<Sheet>) => setSheet((s) => ({ ...s, ...change }))\n\n const commit = async () => {\n if (saving) return\n if (!sheet.name.trim()) return setBlankName(true)\n setSaving(true)\n try {\n await onSave(flowSettingsPatch(original, sheet))\n stack.close()\n } catch {\n // The host reports the error; the values stay for another try.\n setSaving(false)\n }\n }\n\n const switches = [\n { key: 'isDraft' as const, label: l.draft, on: l.draftOn, off: l.draftOff, noteId: draftNote },\n { key: 'isActive' as const, label: l.active, on: l.activeOn, off: l.activeOff, noteId: activeNote },\n ].filter((s) => sheet[s.key] !== undefined)\n\n return (\n <SectionedModal\n isOpen\n onOpenChange={(stillOpen) => {\n if (!stillOpen && !saving) stack.close()\n }}\n eyebrow={l.eyebrow}\n title={l.title}\n subtitle={l.subtitle}\n width=\"regular\"\n busy={saving}\n className=\"ty-flow-settings\"\n footer={\n <>\n <Button variant=\"secondary\" onPress={() => stack.close()} disabled={saving}>\n {l.cancel}\n </Button>\n <Button variant=\"primary\" busy={saving} busyLabel={l.saving} onPress={() => void commit()}>\n {l.save}\n </Button>\n </>\n }\n >\n <div\n className=\"ty-flow-settings__fields\"\n dir={direction}\n onKeyDown={(e) => {\n if (!savesOnEnter(e)) return\n e.preventDefault()\n void commit()\n }}\n >\n <TextField\n label={l.name}\n value={sheet.name}\n required\n readOnly={saving}\n onChange={(name) => {\n put({ name })\n if (name.trim()) setBlankName(false)\n }}\n {...(blankName ? { errorMessage: l.nameRequired } : {})}\n />\n <TextArea label={l.description} value={sheet.description} onChange={(description) => put({ description })} readOnly={saving} rows={3} />\n {original.slug !== undefined && <TextField label={l.slug} hint={l.slugHint} value={sheet.slug} onChange={(slug) => put({ slug })} readOnly={saving} />}\n {switches.length > 0 && (\n <Fieldset legend={l.lifecycle}>\n {switches.map((s) => (\n <div key={s.key} className=\"ty-flow-settings__switch\">\n <Switch\n label={s.label}\n isSelected={sheet[s.key]!}\n onChange={(v) => put({ [s.key]: v })}\n readOnly={saving}\n description={<span id={s.noteId}>{sheet[s.key] ? s.on : s.off}</span>}\n />\n </div>\n ))}\n </Fieldset>\n )}\n </div>\n </SectionedModal>\n )\n}\n","// DefinitionExportDialog: shows a flow's portable definition (metadata plus\n// graph), copies the whole text or downloads it as a file.\n\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { Button, InlineNotice } from '../../index'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowConnector, FlowNode, Viewport } from '../model/types'\n\nexport interface ExportableGraph {\n nodes: FlowNode[]\n connectors: FlowConnector[]\n viewport: Viewport\n}\n\nexport interface FlowDefinitionMeta {\n name: string\n description?: string\n version: number\n}\n\nexport interface DefinitionExportDialogLabels {\n title: string\n description: string\n name: string\n version: string\n nodes: string\n connectors: string\n preview: string\n more: string\n copy: string\n copied: string\n copyFailed: string\n download: string\n}\n\nexport const definitionExportDialogLabels = defineLabels<DefinitionExportDialogLabels>('DefinitionExportDialog', {\n en: {\n title: 'Export definition',\n description: 'A portable copy of this flow that another project can import.',\n name: 'Name',\n version: 'Version',\n nodes: 'Steps',\n connectors: 'Connections',\n preview: 'Definition preview',\n more: '… {count, plural, one {# more line} other {# more lines}}',\n copy: 'Copy',\n copied: 'Copied',\n copyFailed: 'Could not copy. Select the text in the preview and copy it by hand.',\n download: 'Download',\n },\n 'pt-BR': {\n title: 'Exportar definição',\n description: 'Uma cópia portátil deste fluxo, que outro projeto pode importar.',\n name: 'Nome',\n version: 'Versão',\n nodes: 'Passos',\n connectors: 'Conexões',\n preview: 'Prévia da definição',\n more: '… {count, plural, one {mais # linha} other {mais # linhas}}',\n copy: 'Copiar',\n copied: 'Copiado',\n copyFailed: 'Não foi possível copiar. Selecione o texto da prévia e copie manualmente.',\n download: 'Baixar',\n },\n es: {\n title: 'Exportar definición',\n description: 'Una copia portátil de este flujo que otro proyecto puede importar.',\n name: 'Nombre',\n version: 'Versión',\n nodes: 'Pasos',\n connectors: 'Conexiones',\n preview: 'Vista previa de la definición',\n more: '… {count, plural, one {# línea más} other {# líneas más}}',\n copy: 'Copiar',\n copied: 'Copiado',\n copyFailed: 'No se pudo copiar. Selecciona el texto de la vista previa y cópialo a mano.',\n download: 'Descargar',\n },\n})\nexport const defaultDefinitionExportDialogLabels = definitionExportDialogLabels.bundles.en\n\n/** The portable definition: metadata, export time and the graph, with stable indentation. */\nexport function flowDefinitionText(flow: FlowDefinitionMeta, graph: ExportableGraph, exportedAt: Date = new Date()): string {\n const definition = {\n name: flow.name,\n description: flow.description ?? '',\n version: flow.version,\n exportedAt: exportedAt.toISOString(),\n graph: { nodes: graph.nodes, connectors: graph.connectors, viewport: graph.viewport },\n }\n return JSON.stringify(definition, null, 2)\n}\n\n/** File name from the flow name and version, without characters file systems refuse. */\nexport function definitionFileName(flow: FlowDefinitionMeta): string {\n // Letters of any script stay; only characters file systems refuse are removed.\n const base = flow.name\n .normalize('NFC')\n .replace(/[<>:\"/\\\\|?*\\u0000-\\u001f]+/g, '')\n .trim()\n .replace(/\\s+/g, '-')\n .replace(/^\\.+/, '')\n return `${base || 'flow'}-v${flow.version}.json`\n}\n\nasync function copyText(text: string): Promise<boolean> {\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text)\n return true\n }\n } catch {\n // fall through to the selection copy\n }\n try {\n const area = document.createElement('textarea')\n area.value = text\n area.setAttribute('readonly', '')\n area.className = 'ty-visually-hidden'\n document.body.append(area)\n area.select()\n const ok = typeof document.execCommand === 'function' && document.execCommand('copy')\n area.remove()\n return !!ok\n } catch {\n return false\n }\n}\n\nexport interface DefinitionExportDialogProps {\n open: boolean\n onClose: () => void\n flow: FlowDefinitionMeta\n graph: ExportableGraph\n previewLineLimit?: number\n /** Clock for the export time (tests). */\n now?: () => Date\n labels?: Partial<DefinitionExportDialogLabels>\n}\n\nconst COPIED_MS = 2000\n\nexport function DefinitionExportDialog({ open, onClose, flow, graph, previewLineLimit = 40, now, labels }: DefinitionExportDialogProps) {\n const l = useLabels(definitionExportDialogLabels, labels)\n const { locale, direction } = useFlowLocale()\n const n = (v: number) => new Intl.NumberFormat(locale).format(v)\n const [copyState, setCopyState] = useState<'idle' | 'copied' | 'failed'>('idle')\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const text = useMemo(() => (open ? flowDefinitionText(flow, graph, now?.() ?? new Date()) : ''), [open, flow, graph, now])\n const lines = text.split('\\n')\n const shown = lines.slice(0, previewLineLimit)\n const hidden = lines.length - shown.length\n\n useEffect(() => () => {\n if (timer.current) clearTimeout(timer.current)\n }, [])\n useEffect(() => {\n if (!open) setCopyState('idle')\n }, [open])\n\n const copy = async () => {\n const ok = await copyText(text)\n setCopyState(ok ? 'copied' : 'failed')\n if (timer.current) clearTimeout(timer.current)\n if (ok) timer.current = setTimeout(() => setCopyState('idle'), COPIED_MS)\n }\n const download = () => {\n const blob = new Blob([text], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = definitionFileName(flow)\n a.className = 'ty-visually-hidden'\n document.body.append(a)\n a.click()\n a.remove()\n setTimeout(() => URL.revokeObjectURL(url), 0)\n }\n\n return (\n <SectionedModal\n isOpen={open}\n onOpenChange={(o) => {\n if (!o) onClose()\n }}\n title={l.title}\n subtitle={l.description}\n width=\"wide\"\n className=\"ty-definition-export\"\n footer={\n <>\n <Button variant=\"secondary\" onPress={() => void copy()}>\n {copyState === 'copied' ? l.copied : l.copy}\n </Button>\n <Button variant=\"primary\" onPress={download}>\n {l.download}\n </Button>\n </>\n }\n >\n <dl className=\"ty-definition-export__meta\" dir={direction}>\n <div>\n <dt>{l.name}</dt>\n <dd>{flow.name}</dd>\n </div>\n <div>\n <dt>{l.version}</dt>\n <dd className=\"ty-definition-export__mono\">{n(flow.version)}</dd>\n </div>\n <div>\n <dt>{l.nodes}</dt>\n <dd className=\"ty-definition-export__mono\">{n(graph.nodes.length)}</dd>\n </div>\n <div>\n <dt>{l.connectors}</dt>\n <dd className=\"ty-definition-export__mono\">{n(graph.connectors.length)}</dd>\n </div>\n </dl>\n <pre className=\"ty-definition-export__preview\" dir=\"ltr\" tabIndex={0} role=\"region\" aria-label={l.preview}>\n {shown.join('\\n')}\n {hidden > 0 ? `\\n${fill(l.more, { count: hidden }, locale)}` : ''}\n </pre>\n {copyState === 'failed' ? (\n <InlineNotice tone=\"danger\" urgency=\"assertive\">\n {l.copyFailed}\n </InlineNotice>\n ) : null}\n <p className=\"ty-visually-hidden\" role=\"status\" aria-live=\"polite\">\n {copyState === 'copied' ? l.copied : ''}\n </p>\n </SectionedModal>\n )\n}\n","// DefinitionImportDialog: takes a flow definition file by drop or by the\n// file picker, validates its structure, lists every problem and imports the\n// normalised graph. The zone only receives drops; the picker button is the\n// interactive element.\n\nimport { useEffect, useRef, useState } from 'react'\nimport { DropZone, FileTrigger, type DropZoneProps } from 'react-aria-components'\nimport { FileUp } from 'lucide-react'\nimport { Button, InlineNotice, useMediaQuery } from '../../index'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport type { FlowConnector, FlowGraph, FlowNode } from '../model/types'\n\nexport interface DefinitionImportDialogLabels {\n title: string\n description: string\n dropHere: string\n dropActive: string\n chooseFile: string\n fileHint: string\n chooseAnother: string\n reading: string\n valid: string\n invalidTitle: string\n invalidFormat: string\n notObject: string\n missingNodes: string\n missingConnectors: string\n missingViewport: string\n nodeField: string\n connectorField: string\n cancel: string\n import: string\n}\n\nexport const definitionImportDialogLabels = defineLabels<DefinitionImportDialogLabels>('DefinitionImportDialog', {\n en: {\n title: 'Import definition',\n description: 'Replace this flow with an exported flow definition.',\n dropHere: 'Drop a definition file here',\n dropActive: 'Release to read the file',\n chooseFile: 'Choose file',\n fileHint: 'A .json file exported from a flow.',\n chooseAnother: 'Choose another file',\n reading: 'Reading the file',\n valid: '{nodes, plural, one {# step} other {# steps}} and {connectors, plural, one {# connection} other {# connections}} ready to import.',\n invalidTitle: 'This file cannot be imported',\n invalidFormat: 'Invalid format: the file is not readable structured data.',\n notObject: 'The definition must be an object.',\n missingNodes: 'The list of steps (nodes) is missing.',\n missingConnectors: 'The list of connections (connectors) is missing.',\n missingViewport: 'The viewport object is missing.',\n nodeField: 'Step {index}: missing {field}.',\n connectorField: 'Connection {index}: missing {field}.',\n cancel: 'Cancel',\n import: 'Import',\n },\n 'pt-BR': {\n title: 'Importar definição',\n description: 'Substitui este fluxo por uma definição de fluxo exportada.',\n dropHere: 'Solte aqui um arquivo de definição',\n dropActive: 'Solte para ler o arquivo',\n chooseFile: 'Escolher arquivo',\n fileHint: 'Um arquivo .json exportado de um fluxo.',\n chooseAnother: 'Escolher outro arquivo',\n reading: 'Lendo o arquivo',\n valid: '{nodes, plural, one {# passo} other {# passos}} e {connectors, plural, one {# conexão} other {# conexões}} prontos para importar.',\n invalidTitle: 'Este arquivo não pode ser importado',\n invalidFormat: 'Formato inválido: o arquivo não é um dado estruturado legível.',\n notObject: 'A definição precisa ser um objeto.',\n missingNodes: 'Falta a lista de passos (nodes).',\n missingConnectors: 'Falta a lista de conexões (connectors).',\n missingViewport: 'Falta o objeto de enquadramento (viewport).',\n nodeField: 'Passo {index}: falta {field}.',\n connectorField: 'Conexão {index}: falta {field}.',\n cancel: 'Cancelar',\n import: 'Importar',\n },\n es: {\n title: 'Importar definición',\n description: 'Reemplaza este flujo por una definición de flujo exportada.',\n dropHere: 'Suelta aquí un archivo de definición',\n dropActive: 'Suelta para leer el archivo',\n chooseFile: 'Elegir archivo',\n fileHint: 'Un archivo .json exportado de un flujo.',\n chooseAnother: 'Elegir otro archivo',\n reading: 'Leyendo el archivo',\n valid: '{nodes, plural, one {# paso} other {# pasos}} y {connectors, plural, one {# conexión} other {# conexiones}} listos para importar.',\n invalidTitle: 'Este archivo no se puede importar',\n invalidFormat: 'Formato no válido: el archivo no es un dato estructurado legible.',\n notObject: 'La definición debe ser un objeto.',\n missingNodes: 'Falta la lista de pasos (nodes).',\n missingConnectors: 'Falta la lista de conexiones (connectors).',\n missingViewport: 'Falta el objeto de encuadre (viewport).',\n nodeField: 'Paso {index}: falta {field}.',\n connectorField: 'Conexión {index}: falta {field}.',\n cancel: 'Cancelar',\n import: 'Importar',\n },\n})\nexport const defaultDefinitionImportDialogLabels = definitionImportDialogLabels.bundles.en\n\ntype DropEvent = Parameters<NonNullable<DropZoneProps['onDrop']>>[0]\ntype DropItem = DropEvent['items'][number]\n\nexport type DefinitionCheck = { ok: true; graph: FlowGraph } | { ok: false; errors: string[] }\n\nconst isObject = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v)\nconst num = (v: unknown, fallback: number) => (typeof v === 'number' && Number.isFinite(v) ? v : fallback)\n\n/** Parses and validates a definition; every problem is listed with its item index. */\nexport function checkFlowDefinition(text: string, labels: DefinitionImportDialogLabels = defaultDefinitionImportDialogLabels, locale?: string): DefinitionCheck {\n let root: unknown\n try {\n root = JSON.parse(text)\n } catch {\n return { ok: false, errors: [labels.invalidFormat] }\n }\n if (!isObject(root)) return { ok: false, errors: [labels.notObject] }\n const g = isObject(root.graph) ? root.graph : root\n const errors: string[] = []\n const nodes = g.nodes\n const connectors = g.connectors\n if (!Array.isArray(nodes)) errors.push(labels.missingNodes)\n if (!Array.isArray(connectors)) errors.push(labels.missingConnectors)\n if (!isObject(g.viewport)) errors.push(labels.missingViewport)\n if (Array.isArray(nodes)) {\n nodes.forEach((n, index) => {\n const item = isObject(n) ? n : {}\n for (const field of ['id', 'kind', 'position'] as const) {\n const ok = field === 'position' ? isObject(item.position) : typeof item[field] === 'string' && item[field] !== ''\n if (!ok) errors.push(fill(labels.nodeField, { index, field }, locale))\n }\n })\n }\n if (Array.isArray(connectors)) {\n connectors.forEach((c, index) => {\n const item = isObject(c) ? c : {}\n for (const field of ['id', 'source', 'target'] as const) {\n if (typeof item[field] !== 'string' || item[field] === '') errors.push(fill(labels.connectorField, { index, field }, locale))\n }\n })\n }\n if (errors.length) return { ok: false, errors }\n const vp = g.viewport as Record<string, unknown>\n const graph: FlowGraph = {\n nodes: (nodes as Array<Record<string, unknown>>).map((n) => {\n const p = n.position as Record<string, unknown>\n return {\n ...(n as unknown as FlowNode),\n position: { x: num(p.x, 0), y: num(p.y, 0) },\n data: isObject(n.data) ? n.data : { label: '' },\n }\n }),\n connectors: (connectors as Array<Record<string, unknown>>).map((c) => ({\n ...(c as unknown as FlowConnector),\n sourcePort: typeof c.sourcePort === 'string' && c.sourcePort ? c.sourcePort : 'out',\n targetPort: typeof c.targetPort === 'string' && c.targetPort ? c.targetPort : 'in',\n })),\n viewport: { x: num(vp.x, 0), y: num(vp.y, 0), zoom: num(vp.zoom, 1) },\n }\n return { ok: true, graph }\n}\n\nfunction readFile(file: File): Promise<string> {\n if (typeof file.text === 'function') return file.text()\n return new Promise((resolve, reject) => {\n const r = new FileReader()\n r.onload = () => resolve(String(r.result ?? ''))\n r.onerror = () => reject(r.error)\n r.readAsText(file)\n })\n}\n\nexport interface DefinitionImportDialogProps {\n open: boolean\n onClose: () => void\n onImport: (graph: FlowGraph) => void\n labels?: Partial<DefinitionImportDialogLabels>\n}\n\ntype Picked = { name: string; status: 'reading' } | { name: string; status: 'done'; check: DefinitionCheck }\n\nexport function DefinitionImportDialog({ open, onClose, onImport, labels }: DefinitionImportDialogProps) {\n const l = useLabels(definitionImportDialogLabels, labels)\n const { locale, direction } = useFlowLocale()\n const coarse = useMediaQuery('(pointer: coarse)')\n const [picked, setPicked] = useState<Picked | null>(null)\n const pickerRef = useRef<HTMLButtonElement>(null)\n const refocusPicker = useRef(false)\n\n useEffect(() => {\n if (!open) setPicked(null)\n }, [open])\n useEffect(() => {\n if (!picked && refocusPicker.current) {\n refocusPicker.current = false\n requestAnimationFrame(() => pickerRef.current?.focus())\n }\n }, [picked])\n\n const accept = async (file: File | undefined | null) => {\n if (!file) return\n setPicked({ name: file.name, status: 'reading' })\n try {\n const text = await readFile(file)\n setPicked({ name: file.name, status: 'done', check: checkFlowDefinition(text, l, locale) })\n } catch {\n setPicked({ name: file.name, status: 'done', check: { ok: false, errors: [l.invalidFormat] } })\n }\n }\n\n const onDrop = async (e: DropEvent) => {\n const item = e.items.find((i: DropItem) => i.kind === 'file')\n if (item && item.kind === 'file') await accept(await item.getFile())\n }\n\n const check = picked?.status === 'done' ? picked.check : null\n\n return (\n <SectionedModal\n isOpen={open}\n onOpenChange={(o) => {\n if (!o) onClose()\n }}\n title={l.title}\n subtitle={l.description}\n width=\"regular\"\n className=\"ty-definition-import\"\n footer={\n <>\n <Button variant=\"secondary\" onPress={onClose}>\n {l.cancel}\n </Button>\n <Button\n variant=\"primary\"\n disabled={!check?.ok}\n onPress={() => {\n if (check?.ok) {\n onImport(check.graph)\n onClose()\n }\n }}\n >\n {l.import}\n </Button>\n </>\n }\n >\n {picked ? (\n <div className=\"ty-definition-import__result\" dir={direction}>\n <div className=\"ty-definition-import__file\">\n <span className=\"ty-definition-import__file-name\">{picked.name}</span>\n <Button\n variant=\"quiet\"\n size=\"compact\"\n onPress={() => {\n refocusPicker.current = true\n setPicked(null)\n }}\n >\n {l.chooseAnother}\n </Button>\n </div>\n <div role=\"status\" aria-live=\"polite\" className=\"ty-definition-import__status\">\n {picked.status === 'reading' ? <p className=\"ty-definition-import__reading\">{l.reading}</p> : null}\n {check?.ok ? (\n <InlineNotice tone=\"success\" urgency=\"none\">\n {fill(l.valid, { nodes: check.graph.nodes.length, connectors: check.graph.connectors.length }, locale)}\n </InlineNotice>\n ) : null}\n {check && !check.ok ? (\n <InlineNotice tone=\"danger\" urgency=\"none\" title={l.invalidTitle}>\n <ul className=\"ty-definition-import__errors\">\n {check.errors.map((e, i) => (\n <li key={i}>{e}</li>\n ))}\n </ul>\n </InlineNotice>\n ) : null}\n </div>\n </div>\n ) : (\n <DropZone className=\"ty-definition-import__zone\" dir={direction} aria-label={l.dropHere} onDrop={(e) => void onDrop(e)}>\n {({ isDropTarget }) => (\n <>\n <FileUp className=\"ty-definition-import__icon\" aria-hidden=\"true\" focusable=\"false\" />\n <p className=\"ty-definition-import__instruction\" data-drop-target={isDropTarget || undefined}>\n {coarse ? l.chooseFile : isDropTarget ? l.dropActive : l.dropHere}\n </p>\n <p className=\"ty-definition-import__hint\">{l.fileHint}</p>\n <FileTrigger acceptedFileTypes={['application/json', '.json']} onSelect={(files) => void accept(files?.[0])}>\n <Button ref={pickerRef} variant=\"secondary\">\n {l.chooseFile}\n </Button>\n </FileTrigger>\n </>\n )}\n </DropZone>\n )}\n </SectionedModal>\n )\n}\n","// Small pieces the agent editors share while the design system's wave 2 is\n// pending (its StepList, ChoiceTile and TagField intents). Not exported as\n// @datatechsolutions/tympan components.\n\nimport { useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode, type RefObject } from 'react'\nimport { Button as AriaButton, Label, Radio, RadioGroup } from 'react-aria-components'\nimport { Bot, Check, X } from 'lucide-react'\nimport { TextField } from '../../index'\nimport { fill } from '../internal/labels'\n\nconst SAFE_IMAGE = /^(https?:|data:|blob:|\\/)/\n\n/** The agent's mark (design direction §2.11): dashed square with a bot glyph, or the agent's own image. */\nexport function AgentMark({ image, size = 'md' }: { image?: string | null; size?: 'sm' | 'md' | 'lg' }) {\n const [broken, setBroken] = useState(false)\n const usable = !broken && !!image && SAFE_IMAGE.test(image)\n const face = usable ? <img src={image!} alt=\"\" onError={() => setBroken(true)} /> : <Bot focusable=\"false\" />\n return (\n <span className=\"ty-agent-mark\" data-size={size} aria-hidden=\"true\">\n {face}\n </span>\n )\n}\n\nexport interface StepListProps {\n steps: string[]\n /** 1-based current step. */\n current: number\n /** Steps before this one (1-based) are completed and can be jumped to. */\n reached: number\n label: string\n completedWord: string\n onJump: (step: number) => void\n locale?: string\n}\n\ntype StepState = 'done' | 'current' | 'future'\n\nconst stepState = (n: number, current: number, reached: number): StepState => (n === current ? 'current' : n < Math.max(current, reached) ? 'done' : 'future')\n\n/** Ordered list of the wizard's steps; finished steps are buttons, the current one is marked for assistive tech. */\nexport function StepList({ steps, current, reached, label, completedWord, onJump, locale }: StepListProps) {\n const numeral = new Intl.NumberFormat(locale)\n return (\n <ol className=\"ty-flow-step-list\" aria-label={label}>\n {steps.map((title, index) => {\n const n = index + 1\n const state = stepState(n, current, reached)\n const face = (\n <>\n <span className=\"ty-flow-step-list__marker\" aria-hidden=\"true\">\n {state === 'done' ? <Check focusable=\"false\" /> : numeral.format(n)}\n </span>\n <span className=\"ty-flow-step-list__name\">{title}</span>\n </>\n )\n return (\n <li key={title} className=\"ty-flow-step-list__item\" data-state={state} aria-current={state === 'current' ? 'step' : undefined}>\n {state === 'done' ? (\n <AriaButton className=\"ty-flow-step-list__jump\" onPress={() => onJump(n)}>\n {face}\n <span className=\"ty-visually-hidden\">, {completedWord}</span>\n </AriaButton>\n ) : (\n <span className=\"ty-flow-step-list__static\">{face}</span>\n )}\n </li>\n )\n })}\n </ol>\n )\n}\n\nexport interface ChoiceTile {\n value: string\n title: string\n detail?: string\n icon?: ReactNode\n}\n\nfunction TileFace({ tile, chosen }: { tile: ChoiceTile; chosen: boolean }) {\n return (\n <>\n {tile.icon ? (\n <span className=\"ty-flow-choice-tile__icon\" aria-hidden=\"true\">\n {tile.icon}\n </span>\n ) : null}\n <span className=\"ty-flow-choice-tile__text\">\n <span className=\"ty-flow-choice-tile__title\">{tile.title}</span>\n {tile.detail ? <span className=\"ty-flow-choice-tile__detail\">{tile.detail}</span> : null}\n </span>\n <span className=\"ty-flow-choice-tile__check\" aria-hidden=\"true\">\n {chosen ? <Check focusable=\"false\" /> : null}\n </span>\n </>\n )\n}\n\n/** A single choice laid out as tiles (APG radio group); the choice shows a check mark, not only a colour. */\nexport function ChoiceTiles({ label, tiles, value, onChange, hideLabel = false }: { label: string; tiles: ChoiceTile[]; value: string | null; onChange: (v: string) => void; hideLabel?: boolean }) {\n const naming = hideLabel ? { 'aria-label': label } : {}\n return (\n <RadioGroup className=\"ty-choice-tiles\" value={value} onChange={onChange} {...naming}>\n {!hideLabel && <Label className=\"ty-choice-tiles__label\">{label}</Label>}\n <div className=\"ty-choice-tiles__grid\">\n {tiles.map((tile) => (\n <Radio key={tile.value} value={tile.value} className=\"ty-flow-choice-tile\" aria-label={[tile.title, tile.detail].filter(Boolean).join(', ')}>\n {({ isSelected }) => <TileFace tile={tile} chosen={isSelected} />}\n </Radio>\n ))}\n </div>\n </RadioGroup>\n )\n}\n\n/** Words typed so far, split at commas, trimmed, without blanks or repeats of `known`. */\nfunction freshTags(typed: string, known: readonly string[]): string[] {\n const out: string[] = []\n for (const piece of typed.split(',')) {\n const tag = piece.trim()\n if (tag && !known.includes(tag) && !out.includes(tag)) out.push(tag)\n }\n return out\n}\n\n/** Stand-in tag field: Enter or a comma turns the typed word into a tag; each tag has its own remove button. */\nexport function TagInput({ label, value, onChange, placeholder, removeLabel }: { label: string; value: string[]; onChange: (tags: string[]) => void; placeholder?: string; removeLabel: string }) {\n const [typed, setTyped] = useState('')\n const settle = () => {\n const extra = freshTags(typed, value)\n if (extra.length) onChange([...value, ...extra])\n setTyped('')\n }\n const onKey = (e: KeyboardEvent<HTMLDivElement>) => {\n const isInput = (e.target as HTMLElement).tagName === 'INPUT'\n if (!isInput || (e.key !== 'Enter' && e.key !== ',')) return\n e.preventDefault()\n e.stopPropagation()\n settle()\n }\n return (\n <div className=\"ty-tag-input\">\n <div onKeyDown={onKey}>\n <TextField label={label} value={typed} onChange={setTyped} {...(placeholder ? { placeholder } : {})} onBlur={settle} />\n </div>\n {value.length > 0 && (\n <ul className=\"ty-tag-input__list\" aria-label={label}>\n {value.map((tag) => (\n <li key={tag} className=\"ty-tag-input__tag\">\n <span>{tag}</span>\n <AriaButton className=\"ty-tag-input__remove\" aria-label={fill(removeLabel, { tag })} onPress={() => onChange(value.filter((t) => t !== tag))}>\n <X focusable=\"false\" aria-hidden=\"true\" />\n </AriaButton>\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n\n/** Writes a spoken value (tier or range name) on a React Aria slider input, which only formats numbers itself. */\nexport function useValueText(inputRef: RefObject<HTMLInputElement | null>, text: string) {\n const spoken = useRef(text)\n spoken.current = text\n useLayoutEffect(() => {\n const input = inputRef.current\n if (input) input.setAttribute('aria-valuetext', spoken.current)\n })\n}\n","// AgentEditorDialog: create or edit a saved agent (identity, engine,\n// instructions, tools). Saves by itself a moment after each genuine edit;\n// opening and hydrating the form is never an edit.\n\nimport { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\nimport {\n Button as AriaButton,\n Disclosure,\n DisclosurePanel,\n Heading,\n Input,\n Label,\n Slider,\n SliderOutput,\n SliderThumb,\n SliderTrack,\n TextField as AriaTextField,\n ToggleButton,\n ToggleButtonGroup,\n} from 'react-aria-components'\nimport { ChevronDown, CircleAlert, CircleCheck, Clock, Loader } from 'lucide-react'\nimport { Button, InlineNotice, Link, NativeSelect, SegmentedControl, Switch, TextArea, TextField } from '../../index'\nimport { useConfirm } from '../internal/confirm'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { SectionedModal } from '../internal/SectionedModal'\nimport { useActiveDialog, useDialogStack, type AgentEditorPayload } from '../state/dialogStack'\nimport { cleanToolServers, OutputSchemaBuilder, ToolServerListField } from '../forms'\nimport { AgentMark, TagInput, useValueText } from './parts'\n\nexport interface AgentModel {\n id: string\n name?: string\n family: string\n /** Position on the host's capability scale (same scale as the tiers). */\n capability: number\n contextSize?: number\n outputLimit?: number\n reasoning?: boolean\n supports?: { maxOutput?: boolean; topP?: boolean; topK?: boolean }\n}\n\nexport interface AgentProvider {\n id: string\n name: string\n families: string[]\n configured: boolean\n}\n\n/** A named band of the capability scale; `temperature` is the tier's sampling default. */\nexport interface CapabilityTier {\n key: string\n min: number\n max: number\n temperature?: number\n}\n\nexport interface AutonomyLevel {\n key: 'low' | 'medium' | 'high' | 'full'\n /** Capability rating the level jumps to. */\n rating: number\n}\n\nexport type ReasoningEffort = 'low' | 'medium' | 'high' | 'very_high'\n\nexport interface ToolServerEntry {\n prefix?: string\n url?: string\n command?: string\n args?: string[]\n headers?: Record<string, string>\n}\n\nexport interface AgentPayload {\n id?: string\n name: string\n description?: string\n active: boolean\n tags: string[]\n image?: string\n model?: string\n provider?: string\n temperature?: number\n reasoningEffort?: ReasoningEffort\n maxOutputTokens?: number\n topP?: number\n topK?: number\n systemPrompt?: string\n outputSchema?: Record<string, unknown>\n toolServers?: ToolServerEntry[]\n}\n\nexport interface AgentEditorDialogLabels {\n createTitle: string\n editTitle: string\n sections: string\n engine: string\n instructions: string\n tools: string\n name: string\n namePlaceholder: string\n image: string\n active: string\n description: string\n tags: string\n removeTag: string\n capability: string\n tierNames: Record<string, string>\n autonomy: string\n autonomyNames: Record<AutonomyLevel['key'], string>\n model: string\n contextSize: string\n outputLimit: string\n servedVia: string\n connected: string\n needsSetup: string\n noProvider: string\n advanced: string\n manualModel: string\n maxOutput: string\n topP: string\n topK: string\n credentials: string\n manageCredentials: string\n temperature: string\n temperatureRanges: { precise: string; balanced: string; creative: string }\n reasoningEffort: string\n effortNames: Record<ReasoningEffort, string>\n systemPrompt: string\n outputSchema: string\n statusSaving: string\n statusPending: string\n statusSaved: string\n statusFailed: string\n retry: string\n unsaved: string\n confirmCloseTitle: string\n confirmCloseMessage: string\n confirmClose: string\n keepEditing: string\n untitled: string\n agentWord: string\n}\n\nconst en: AgentEditorDialogLabels = {\n createTitle: 'New agent',\n editTitle: 'Agent',\n sections: 'Agent sections',\n engine: 'Engine',\n instructions: 'Instructions',\n tools: 'Tools',\n name: 'Agent name',\n namePlaceholder: 'Untitled agent',\n image: 'Image address',\n active: 'Active',\n description: 'Description',\n tags: 'Tags',\n removeTag: 'Remove tag {tag}',\n capability: 'Capability',\n tierNames: {},\n autonomy: 'Autonomy',\n autonomyNames: { low: 'Low', medium: 'Medium', high: 'High', full: 'Full' },\n model: 'Model',\n contextSize: 'Context: {size, number} tokens',\n outputLimit: 'Output up to {size, number} tokens',\n servedVia: 'Served via {provider}',\n connected: 'connected',\n needsSetup: 'needs setup',\n noProvider: 'No configured provider serves this model family.',\n advanced: 'Advanced',\n manualModel: 'Choose the model',\n maxOutput: 'Maximum output tokens',\n topP: 'Nucleus sampling (top-p)',\n topK: 'Top-k sampling',\n credentials: 'Provider credentials',\n manageCredentials: 'Manage credentials',\n temperature: 'Sampling',\n temperatureRanges: { precise: 'precise', balanced: 'balanced', creative: 'creative' },\n reasoningEffort: 'Reasoning effort',\n effortNames: { low: 'Low', medium: 'Medium', high: 'High', very_high: 'Very high' },\n systemPrompt: 'System prompt',\n outputSchema: 'Output schema',\n statusSaving: 'Saving',\n statusPending: 'Will save in a moment',\n statusSaved: 'Saved',\n statusFailed: 'Not saved',\n retry: 'Retry',\n unsaved: 'Your last change was not saved.',\n confirmCloseTitle: 'Close without saving?',\n confirmCloseMessage: 'The last change could not be saved and will be lost.',\n confirmClose: 'Close',\n keepEditing: 'Keep editing',\n untitled: 'Untitled agent',\n agentWord: 'agent',\n}\n\nexport const agentEditorDialogLabels = defineLabels<AgentEditorDialogLabels>('AgentEditorDialog', {\n en,\n 'pt-BR': {\n createTitle: 'Novo agente',\n editTitle: 'Agente',\n sections: 'Seções do agente',\n engine: 'Motor',\n instructions: 'Instruções',\n tools: 'Ferramentas',\n name: 'Nome do agente',\n namePlaceholder: 'Agente sem nome',\n image: 'Endereço da imagem',\n active: 'Ativo',\n description: 'Descrição',\n tags: 'Etiquetas',\n removeTag: 'Remover etiqueta {tag}',\n capability: 'Capacidade',\n tierNames: {},\n autonomy: 'Autonomia',\n autonomyNames: { low: 'Baixa', medium: 'Média', high: 'Alta', full: 'Total' },\n model: 'Modelo',\n contextSize: 'Contexto: {size, number} tokens',\n outputLimit: 'Saída de até {size, number} tokens',\n servedVia: 'Servido por {provider}',\n connected: 'conectado',\n needsSetup: 'precisa de configuração',\n noProvider: 'Nenhum provedor configurado atende esta família de modelos.',\n advanced: 'Avançado',\n manualModel: 'Escolher o modelo',\n maxOutput: 'Máximo de tokens de saída',\n topP: 'Amostragem de núcleo (top-p)',\n topK: 'Amostragem top-k',\n credentials: 'Credenciais dos provedores',\n manageCredentials: 'Gerenciar credenciais',\n temperature: 'Amostragem',\n temperatureRanges: { precise: 'precisa', balanced: 'equilibrada', creative: 'criativa' },\n reasoningEffort: 'Esforço de raciocínio',\n effortNames: { low: 'Baixo', medium: 'Médio', high: 'Alto', very_high: 'Muito alto' },\n systemPrompt: 'Prompt de sistema',\n outputSchema: 'Esquema de saída',\n statusSaving: 'Salvando',\n statusPending: 'Será salvo em instantes',\n statusSaved: 'Salvo',\n statusFailed: 'Não salvo',\n retry: 'Tentar de novo',\n unsaved: 'A última alteração não foi salva.',\n confirmCloseTitle: 'Fechar sem salvar?',\n confirmCloseMessage: 'Não foi possível salvar a última alteração; ela será perdida.',\n confirmClose: 'Fechar',\n keepEditing: 'Continuar editando',\n untitled: 'Agente sem nome',\n agentWord: 'agente',\n },\n es: {\n createTitle: 'Nuevo agente',\n editTitle: 'Agente',\n sections: 'Secciones del agente',\n engine: 'Motor',\n instructions: 'Instrucciones',\n tools: 'Herramientas',\n name: 'Nombre del agente',\n namePlaceholder: 'Agente sin nombre',\n image: 'Dirección de la imagen',\n active: 'Activo',\n description: 'Descripción',\n tags: 'Etiquetas',\n removeTag: 'Quitar la etiqueta {tag}',\n capability: 'Capacidad',\n tierNames: {},\n autonomy: 'Autonomía',\n autonomyNames: { low: 'Baja', medium: 'Media', high: 'Alta', full: 'Total' },\n model: 'Modelo',\n contextSize: 'Contexto: {size, number} tokens',\n outputLimit: 'Salida de hasta {size, number} tokens',\n servedVia: 'Servido por {provider}',\n connected: 'conectado',\n needsSetup: 'requiere configuración',\n noProvider: 'Ningún proveedor configurado sirve esta familia de modelos.',\n advanced: 'Avanzado',\n manualModel: 'Elegir el modelo',\n maxOutput: 'Máximo de tokens de salida',\n topP: 'Muestreo de núcleo (top-p)',\n topK: 'Muestreo top-k',\n credentials: 'Credenciales de los proveedores',\n manageCredentials: 'Gestionar credenciales',\n temperature: 'Muestreo',\n temperatureRanges: { precise: 'preciso', balanced: 'equilibrado', creative: 'creativo' },\n reasoningEffort: 'Esfuerzo de razonamiento',\n effortNames: { low: 'Bajo', medium: 'Medio', high: 'Alto', very_high: 'Muy alto' },\n systemPrompt: 'Prompt de sistema',\n outputSchema: 'Esquema de salida',\n statusSaving: 'Guardando',\n statusPending: 'Se guardará en un momento',\n statusSaved: 'Guardado',\n statusFailed: 'No guardado',\n retry: 'Reintentar',\n unsaved: 'El último cambio no se guardó.',\n confirmCloseTitle: '¿Cerrar sin guardar?',\n confirmCloseMessage: 'No se pudo guardar el último cambio y se perderá.',\n confirmClose: 'Cerrar',\n keepEditing: 'Seguir editando',\n untitled: 'Agente sin nombre',\n agentWord: 'agente',\n },\n})\nexport const defaultAgentEditorDialogLabels = agentEditorDialogLabels.bundles.en\n\n/** Even split of a 0–100 scale when the host gives no tiers (the product sets the real bands). */\nexport const DEFAULT_CAPABILITY_TIERS: readonly CapabilityTier[] = [\n { key: 'basic', min: 0, max: 33, temperature: 0.3 },\n { key: 'capable', min: 34, max: 66, temperature: 0.7 },\n { key: 'advanced', min: 67, max: 100, temperature: 0.9 },\n]\n\nexport const DEFAULT_AUTONOMY_LEVELS: readonly AutonomyLevel[] = [\n { key: 'low', rating: 12 },\n { key: 'medium', rating: 37 },\n { key: 'high', rating: 62 },\n { key: 'full', rating: 88 },\n]\n\n/** The most capable model whose rating does not exceed `rating` (else the least capable). */\nexport function modelForRating(models: readonly AgentModel[], rating: number): AgentModel | undefined {\n const sorted = [...models].sort((a, b) => a.capability - b.capability)\n let pick = sorted[0]\n for (const m of sorted) if (m.capability <= rating) pick = m\n return pick\n}\n\nexport function tierForRating(tiers: readonly CapabilityTier[], rating: number): CapabilityTier | undefined {\n return tiers.find((t) => rating >= t.min && rating <= t.max) ?? (rating < (tiers[0]?.min ?? 0) ? tiers[0] : tiers[tiers.length - 1])\n}\n\ntype SaveStatus = 'idle' | 'pending' | 'saving' | 'saved' | 'failed'\n\nexport interface AgentEditorDialogProps {\n onPersist?: (payload: AgentPayload) => Promise<void>\n /** Legacy hook after an explicit save; autosave never calls it. */\n onSaved?: () => void\n models: AgentModel[]\n providers: AgentProvider[]\n credentialsHref: string\n tiers?: readonly CapabilityTier[]\n autonomyLevels?: readonly AutonomyLevel[]\n /** Idle time before an edit is saved (ms). */\n saveDelay?: number\n labels?: Partial<AgentEditorDialogLabels>\n}\n\ninterface FormState {\n id?: string\n name: string\n description: string\n active: boolean\n tags: string[]\n image: string\n rating: number\n modelId: string\n temperature: number\n reasoningEffort: ReasoningEffort\n maxOutput: string\n topP: string\n topK: string\n systemPrompt: string\n outputSchema?: Record<string, unknown>\n toolServers: ToolServerEntry[]\n}\n\nfunction hydrate(agent: AgentEditorPayload['agent'], models: readonly AgentModel[], tiers: readonly CapabilityTier[]): FormState {\n const a = (agent ?? {}) as Partial<AgentPayload> & { id?: string }\n const model = models.find((m) => m.id === a.model) ?? modelForRating(models, tiers[0]?.min ?? 0)\n const rating = model?.capability ?? tiers[0]?.min ?? 0\n const num = (v: number | undefined) => (typeof v === 'number' ? String(v) : '')\n return {\n ...(a.id ? { id: a.id } : {}),\n name: a.name ?? '',\n description: a.description ?? '',\n active: a.active ?? true,\n tags: a.tags ?? [],\n image: a.image ?? '',\n rating,\n modelId: model?.id ?? '',\n temperature: a.temperature ?? tierForRating(tiers, rating)?.temperature ?? 0.7,\n reasoningEffort: a.reasoningEffort ?? 'medium',\n maxOutput: num(a.maxOutputTokens),\n topP: num(a.topP),\n topK: num(a.topK),\n systemPrompt: a.systemPrompt ?? '',\n ...(a.outputSchema ? { outputSchema: a.outputSchema } : {}),\n toolServers: a.toolServers ?? [],\n }\n}\n\nexport function AgentEditorDialog(props: AgentEditorDialogProps) {\n const { onPersist, models, providers, credentialsHref, tiers = DEFAULT_CAPABILITY_TIERS, autonomyLevels = DEFAULT_AUTONOMY_LEVELS, saveDelay = 1200 } = props\n const l = useLabels(agentEditorDialogLabels, props.labels)\n const { locale, direction } = useFlowLocale()\n const active = useActiveDialog<AgentEditorPayload>('agent-editor')\n const stack = useDialogStack()\n const confirm = useConfirm()\n\n const [form, setForm] = useState<FormState | null>(null)\n const [mode, setMode] = useState<'create' | 'edit'>('edit')\n const [status, setStatus] = useState<SaveStatus>('idle')\n const [section, setSection] = useState('engine')\n const formRef = useRef<FormState | null>(null)\n formRef.current = form\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const inFlight = useRef<Promise<void> | null>(null)\n const again = useRef(false)\n\n // Hydrate on open; never counts as an edit.\n useEffect(() => {\n if (!active) {\n setForm(null)\n return\n }\n setForm(hydrate(active.payload.agent, models, tiers))\n setMode(active.payload.mode)\n setStatus('idle')\n setSection('engine')\n // Only a new opening re-hydrates.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [active])\n\n useEffect(() => () => {\n if (timer.current) clearTimeout(timer.current)\n }, [])\n\n const model = form ? models.find((m) => m.id === form.modelId) : undefined\n const provider = model ? providers.find((p) => p.families.includes(model.family)) : undefined\n\n const payloadOf = useCallback(\n (f: FormState): AgentPayload => {\n const m = models.find((x) => x.id === f.modelId)\n const p = m ? providers.find((x) => x.families.includes(m.family)) : undefined\n const numOrUndef = (s: string) => (s.trim() !== '' && Number.isFinite(Number(s)) ? Number(s) : undefined)\n const out: AgentPayload = { name: f.name.trim(), active: f.active, tags: f.tags }\n if (f.id) out.id = f.id\n if (f.description.trim()) out.description = f.description.trim()\n if (f.image.trim()) out.image = f.image.trim()\n if (m) out.model = m.id\n if (p) out.provider = p.id\n if (m?.reasoning) out.reasoningEffort = f.reasoningEffort\n else out.temperature = f.temperature\n const mo = numOrUndef(f.maxOutput)\n const tp = numOrUndef(f.topP)\n const tk = numOrUndef(f.topK)\n if (mo !== undefined && m?.supports?.maxOutput) out.maxOutputTokens = mo\n if (tp !== undefined && m?.supports?.topP) out.topP = tp\n if (tk !== undefined && m?.supports?.topK) out.topK = tk\n if (f.systemPrompt.trim()) out.systemPrompt = f.systemPrompt\n if (f.outputSchema) out.outputSchema = f.outputSchema\n const servers = cleanToolServers(f.toolServers) as ToolServerEntry[] | undefined\n if (servers) out.toolServers = servers\n return out\n },\n [models, providers],\n )\n\n const persistNow = useCallback(async (): Promise<void> => {\n if (timer.current) {\n clearTimeout(timer.current)\n timer.current = null\n }\n const f = formRef.current\n if (!f || !onPersist) return\n if (inFlight.current) {\n again.current = true\n return inFlight.current\n }\n setStatus('saving')\n const run = onPersist(payloadOf(f))\n .then(() => {\n setStatus('saved')\n setMode('edit')\n })\n .catch(() => setStatus('failed'))\n .finally(() => {\n inFlight.current = null\n if (again.current) {\n again.current = false\n void persistNow()\n }\n })\n inFlight.current = run\n return run\n }, [onPersist, payloadOf])\n\n const edit = (patch: Partial<FormState>) => {\n setForm((prev) => (prev ? { ...prev, ...patch } : prev))\n setStatus('pending')\n if (timer.current) clearTimeout(timer.current)\n timer.current = setTimeout(() => void persistNow(), saveDelay)\n }\n\n const close = async () => {\n if (status === 'failed') {\n const ok = await confirm({ title: l.confirmCloseTitle, message: l.confirmCloseMessage, confirmLabel: l.confirmClose, cancelLabel: l.keepEditing, tone: 'danger' })\n if (!ok) return\n } else if (timer.current || inFlight.current) {\n await persistNow()\n }\n stack.close()\n }\n\n const tier = form ? tierForRating(tiers, form.rating) : undefined\n const tierName = tier ? (l.tierNames[tier.key] ?? tier.key) : ''\n const nf = useMemo(() => new Intl.NumberFormat(locale), [locale])\n const capabilityRef = useRef<HTMLInputElement>(null)\n const temperatureRef = useRef<HTMLInputElement>(null)\n const temperatureRange = form ? (form.temperature < 0.4 ? l.temperatureRanges.precise : form.temperature < 1 ? l.temperatureRanges.balanced : l.temperatureRanges.creative) : ''\n useValueText(capabilityRef, form ? `${nf.format(form.rating)}, ${tierName}` : '')\n useValueText(temperatureRef, form ? `${nf.format(form.temperature)}, ${temperatureRange}` : '')\n const statusId = useId()\n\n if (!active || !form) return null\n\n const bandOf = (level: AutonomyLevel) => {\n const idx = autonomyLevels.indexOf(level)\n const next = autonomyLevels[idx + 1]\n return form.rating >= level.rating - (idx === 0 ? Infinity : 0) && (!next || form.rating < next.rating)\n }\n const currentAutonomy = autonomyLevels.find(bandOf)?.key ?? null\n\n const setRating = (rating: number) => {\n const m = modelForRating(models, rating)\n const t = tierForRating(tiers, rating)\n edit({ rating, modelId: m?.id ?? form.modelId, ...(t?.temperature !== undefined ? { temperature: t.temperature } : {}) })\n }\n\n const statusView = (\n <div className=\"ty-agent-editor__status\" data-status={status}>\n <p id={statusId} role=\"status\" aria-live=\"polite\" className=\"ty-agent-editor__status-line\">\n {status === 'saving' ? (\n <>\n <Loader aria-hidden=\"true\" focusable=\"false\" className=\"ty-agent-editor__spin\" />\n {l.statusSaving}\n </>\n ) : status === 'pending' ? (\n <>\n <Clock aria-hidden=\"true\" focusable=\"false\" />\n {l.statusPending}\n </>\n ) : status === 'saved' ? (\n <>\n <CircleCheck aria-hidden=\"true\" focusable=\"false\" />\n {l.statusSaved}\n </>\n ) : status === 'failed' ? (\n <>\n <CircleAlert aria-hidden=\"true\" focusable=\"false\" />\n {l.statusFailed}\n </>\n ) : null}\n </p>\n {status === 'failed' ? (\n <Button size=\"compact\" variant=\"secondary\" onPress={() => void persistNow()}>\n {l.retry}\n </Button>\n ) : null}\n </div>\n )\n\n const identity = (\n <div className=\"ty-agent-editor__identity\">\n <div className=\"ty-agent-editor__identity-head\">\n <AgentMark image={form.image} size=\"lg\" />\n <div className=\"ty-agent-editor__name-block\">\n <AriaTextField className=\"ty-agent-editor__name\" value={form.name} onChange={(name) => edit({ name })}>\n <Label className=\"ty-visually-hidden\">{l.name}</Label>\n <Input className=\"ty-agent-editor__name-input\" placeholder={l.namePlaceholder} />\n </AriaTextField>\n <span className=\"ty-agent-editor__kind-word\">{l.agentWord}</span>\n </div>\n </div>\n <Switch label={l.active} isSelected={form.active} onChange={(v) => edit({ active: v })} />\n <TextField label={l.image} inputType=\"url\" value={form.image} onChange={(image) => edit({ image })} />\n <TextArea label={l.description} value={form.description} onChange={(description) => edit({ description })} rows={2} />\n <TagInput label={l.tags} value={form.tags} onChange={(tags) => edit({ tags })} removeLabel={l.removeTag} />\n </div>\n )\n\n const engine = (\n <div className=\"ty-agent-editor__section\">\n <Slider className=\"ty-agent-slider\" minValue={0} maxValue={100} step={1} value={form.rating} onChange={(v) => setRating(Array.isArray(v) ? v[0]! : v)}>\n <div className=\"ty-agent-slider__head\">\n <Label className=\"ty-agent-slider__label\">{l.capability}</Label>\n <SliderOutput className=\"ty-agent-slider__output\">{() => tierName}</SliderOutput>\n </div>\n <SliderTrack className=\"ty-agent-slider__track\">\n {({ state }) => (\n <>\n <span className=\"ty-agent-slider__fill\" style={{ inlineSize: `${state.getThumbPercent(0) * 100}%` }} />\n <SliderThumb className=\"ty-agent-slider__thumb\" inputRef={capabilityRef} />\n </>\n )}\n </SliderTrack>\n </Slider>\n <div className=\"ty-agent-editor__autonomy\">\n <p className=\"ty-agent-editor__label\" id={`${statusId}-autonomy`}>\n {l.autonomy}\n </p>\n <ToggleButtonGroup\n className=\"ty-agent-autonomy\"\n aria-labelledby={`${statusId}-autonomy`}\n selectionMode=\"single\"\n disallowEmptySelection\n selectedKeys={currentAutonomy ? [currentAutonomy] : []}\n onSelectionChange={(keys) => {\n const key = [...keys][0]\n const level = autonomyLevels.find((a) => a.key === key)\n if (level) setRating(level.rating)\n }}\n >\n {autonomyLevels.map((a) => (\n <ToggleButton key={a.key} id={a.key} className=\"ty-agent-autonomy__level\">\n {l.autonomyNames[a.key]}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n </div>\n <dl className=\"ty-agent-editor__summary\">\n <div>\n <dt>{l.model}</dt>\n <dd className=\"ty-agent-editor__mono\">{model ? (model.name ?? model.id) : ''}</dd>\n {model?.contextSize ? <dd className=\"ty-agent-editor__meta\">{fill(l.contextSize, { size: model.contextSize }, locale)}</dd> : null}\n {model?.outputLimit ? <dd className=\"ty-agent-editor__meta\">{fill(l.outputLimit, { size: model.outputLimit }, locale)}</dd> : null}\n </div>\n </dl>\n {model && provider ? (\n <p className=\"ty-agent-editor__served\" data-configured={provider.configured}>\n {fill(l.servedVia, { provider: provider.name })}\n <span className=\"ty-agent-editor__provider-state\">\n {provider.configured ? <CircleCheck aria-hidden=\"true\" focusable=\"false\" /> : <CircleAlert aria-hidden=\"true\" focusable=\"false\" />}\n {provider.configured ? l.connected : l.needsSetup}\n </span>\n </p>\n ) : model ? (\n <InlineNotice tone=\"warning\" urgency=\"none\">\n {l.noProvider}\n </InlineNotice>\n ) : null}\n <Disclosure className=\"ty-agent-editor__advanced\">\n <Heading level={3} className=\"ty-agent-editor__advanced-heading\">\n <AriaButton slot=\"trigger\" className=\"ty-agent-editor__advanced-trigger\">\n <ChevronDown aria-hidden=\"true\" focusable=\"false\" className=\"ty-agent-editor__chevron\" />\n {l.advanced}\n </AriaButton>\n </Heading>\n <DisclosurePanel className=\"ty-agent-editor__advanced-panel\">\n <NativeSelect\n label={l.manualModel}\n value={form.modelId}\n options={models.map((m) => ({ value: m.id, label: m.name ?? m.id }))}\n onChange={(id) => {\n const m = models.find((x) => x.id === id)\n edit({ modelId: id, ...(m ? { rating: m.capability } : {}) })\n }}\n />\n {model?.supports?.maxOutput ? <TextField label={l.maxOutput} inputType=\"number\" value={form.maxOutput} onChange={(maxOutput) => edit({ maxOutput })} /> : null}\n {model?.supports?.topP ? <TextField label={l.topP} inputType=\"number\" value={form.topP} onChange={(topP) => edit({ topP })} /> : null}\n {model?.supports?.topK ? <TextField label={l.topK} inputType=\"number\" value={form.topK} onChange={(topK) => edit({ topK })} /> : null}\n <div className=\"ty-agent-editor__credentials\">\n <p className=\"ty-agent-editor__label\">{l.credentials}</p>\n <ul className=\"ty-agent-editor__credential-list\">\n {providers.map((p) => (\n <li key={p.id}>\n <span>{p.name}</span>\n <span className=\"ty-agent-editor__provider-state\">\n {p.configured ? <CircleCheck aria-hidden=\"true\" focusable=\"false\" /> : <CircleAlert aria-hidden=\"true\" focusable=\"false\" />}\n {p.configured ? l.connected : l.needsSetup}\n </span>\n </li>\n ))}\n </ul>\n <Link href={credentialsHref}>{l.manageCredentials}</Link>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n )\n\n const effortKeys: ReasoningEffort[] = ['low', 'medium', 'high', 'very_high']\n const instructions = (\n <div className=\"ty-agent-editor__section\">\n {model?.reasoning ? (\n <SegmentedControl\n label={l.reasoningEffort}\n options={effortKeys.map((k) => ({ value: k, label: l.effortNames[k] }))}\n value={form.reasoningEffort}\n onChange={(v) => edit({ reasoningEffort: v as ReasoningEffort })}\n />\n ) : (\n <Slider className=\"ty-agent-slider\" minValue={0} maxValue={2} step={0.1} value={form.temperature} onChange={(v) => edit({ temperature: Array.isArray(v) ? v[0]! : v })}>\n <div className=\"ty-agent-slider__head\">\n <Label className=\"ty-agent-slider__label\">{l.temperature}</Label>\n <SliderOutput className=\"ty-agent-slider__output\">{() => temperatureRange}</SliderOutput>\n </div>\n <SliderTrack className=\"ty-agent-slider__track\">\n {({ state }) => (\n <>\n <span className=\"ty-agent-slider__fill\" style={{ inlineSize: `${state.getThumbPercent(0) * 100}%` }} />\n <SliderThumb className=\"ty-agent-slider__thumb\" inputRef={temperatureRef} />\n </>\n )}\n </SliderTrack>\n </Slider>\n )}\n <TextArea label={l.systemPrompt} value={form.systemPrompt} onChange={(systemPrompt) => edit({ systemPrompt })} rows={6} autoGrow />\n <div className=\"ty-agent-editor__schema\">\n <p className=\"ty-agent-editor__label\">{l.outputSchema}</p>\n <OutputSchemaBuilder value={form.outputSchema} onChange={(outputSchema: Record<string, unknown> | undefined) => edit(outputSchema ? { outputSchema } : { outputSchema: undefined })} />\n </div>\n </div>\n )\n\n const tools = (\n <div className=\"ty-agent-editor__section\">\n <ToolServerListField value={form.toolServers} onChange={(toolServers: ToolServerEntry[]) => edit({ toolServers })} />\n </div>\n )\n\n return (\n <SectionedModal\n isOpen\n onOpenChange={(open) => {\n if (!open) void close()\n }}\n title={mode === 'create' ? l.createTitle : form.name.trim() || l.editTitle}\n eyebrow={l.agentWord}\n icon={<AgentMark image={null} size=\"sm\" />}\n width=\"xwide\"\n className=\"ty-agent-editor\"\n sections={[\n { id: 'engine', label: l.engine, content: engine },\n { id: 'instructions', label: l.instructions, content: instructions },\n { id: 'tools', label: l.tools, content: tools },\n ]}\n railLabel={l.sections}\n activeSection={section}\n onActiveSectionChange={setSection}\n railHeader={<div dir={direction}>{identity}</div>}\n railFooter={\n <div dir={direction}>\n {statusView}\n {status === 'failed' ? (\n <InlineNotice tone=\"warning\" urgency=\"polite\">\n {l.unsaved}\n </InlineNotice>\n ) : null}\n </div>\n }\n />\n )\n}\n","// AgentCreationWizard: a full-page, five-step flow for a new agent (starting\n// point, identity, model, behaviour, review). The active step is mirrored to\n// the host (address bar) through onStepChange; the host's initialStep moves\n// the wizard back and forward.\n\nimport { useEffect, useId, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { ArrowLeft, ArrowRight, Bot, ChartColumn, FileSearch, Quote, Scale, Sparkles } from 'lucide-react'\nimport { Button, InlineNotice, NativeSelect, TextArea, TextField } from '../../index'\nimport { useConfirm, type ConfirmFn } from '../internal/confirm'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { AgentMark, ChoiceTiles, StepList, TagInput } from './parts'\n\nexport interface WizardModel {\n id: string\n name?: string\n}\n\nexport interface WizardConnection {\n id: string\n name: string\n provider?: string\n}\n\nexport interface AgentPreset {\n id: string\n name: string\n role: string\n systemPrompt?: string\n temperature?: number\n topP?: number\n maxOutputTokens?: number\n framework?: string\n}\n\nexport type AgentDifficulty = 'beginner' | 'intermediate' | 'advanced' | 'expert'\n\nexport interface NewAgentInput {\n name: string\n role?: string\n description?: string\n avatar?: string\n connectionId?: string\n framework?: string\n model?: string\n outputSchema?: string\n systemPrompt?: string\n userPrompt?: string\n temperature?: number\n topP?: number\n topK?: number\n maxOutputTokens?: number\n difficulty?: AgentDifficulty\n tags?: string[]\n}\n\nexport interface AgentCreationWizardLabels {\n steps: string\n stepCounter: string\n completed: string\n titles: { start: string; identity: string; model: string; behaviour: string; review: string }\n subtitles: { start: string; identity: string; model: string; behaviour: string; review: string }\n custom: string\n customDetail: string\n presets: string\n avatar: string\n avatarNames: Record<string, string>\n name: string\n nameRequired: string\n role: string\n description: string\n connection: string\n noConnection: string\n framework: string\n model: string\n noModels: string\n modelField: string\n outputSchema: string\n systemPrompt: string\n userPrompt: string\n temperature: string\n topP: string\n topK: string\n maxOutput: string\n difficulty: string\n difficultyNames: Record<AgentDifficulty, string>\n tags: string\n removeTag: string\n edit: string\n editGroup: string\n notSet: string\n cancel: string\n back: string\n next: string\n create: string\n creating: string\n failed: string\n untitled: string\n confirmCancelTitle: string\n confirmCancelMessage: string\n confirmCancel: string\n keepEditing: string\n}\n\nconst en: AgentCreationWizardLabels = {\n steps: 'Steps',\n stepCounter: 'Step {n, number} of {total, number}',\n completed: 'completed',\n titles: { start: 'Starting point', identity: 'Identity', model: 'Model', behaviour: 'Behaviour and metadata', review: 'Review' },\n subtitles: {\n start: 'Start from a preset or from scratch.',\n identity: 'How the agent appears to people.',\n model: 'Which connection and model the agent runs on.',\n behaviour: 'Instructions, sampling and tags.',\n review: 'Check everything before creating the agent.',\n },\n custom: 'Custom',\n customDetail: 'Start from scratch',\n presets: 'Starting point',\n avatar: 'Mark',\n avatarNames: { bot: 'Assistant', search: 'Researcher', quote: 'Coder', scale: 'Reviewer', chart: 'Analyst', sparkles: 'Writer' },\n name: 'Name',\n nameRequired: 'Give the agent a name.',\n role: 'Role',\n description: 'Description',\n connection: 'Provider connection',\n noConnection: 'Choose a connection',\n framework: 'Agent framework',\n model: 'Model',\n noModels: 'No model available',\n modelField: 'Model identifier',\n outputSchema: 'Output schema (structured text)',\n systemPrompt: 'System prompt',\n userPrompt: 'User prompt',\n temperature: 'Temperature',\n topP: 'Nucleus sampling (top-p)',\n topK: 'Top-k sampling',\n maxOutput: 'Maximum output tokens',\n difficulty: 'Difficulty',\n difficultyNames: { beginner: 'Beginner', intermediate: 'Intermediate', advanced: 'Advanced', expert: 'Expert' },\n tags: 'Tags',\n removeTag: 'Remove tag {tag}',\n edit: 'Edit',\n editGroup: 'Edit {group}',\n notSet: 'not set',\n cancel: 'Cancel',\n back: 'Back',\n next: 'Next',\n create: 'Create agent',\n creating: 'Creating',\n failed: 'The agent could not be created.',\n untitled: 'Untitled agent',\n confirmCancelTitle: 'Discard this agent?',\n confirmCancelMessage: 'What you entered will be lost.',\n confirmCancel: 'Discard',\n keepEditing: 'Keep editing',\n}\n\nexport const agentCreationWizardLabels = defineLabels<AgentCreationWizardLabels>('AgentCreationWizard', {\n en,\n 'pt-BR': {\n steps: 'Etapas',\n stepCounter: 'Etapa {n, number} de {total, number}',\n completed: 'concluída',\n titles: { start: 'Ponto de partida', identity: 'Identidade', model: 'Modelo', behaviour: 'Comportamento e metadados', review: 'Revisão' },\n subtitles: {\n start: 'Comece de um modelo pronto ou do zero.',\n identity: 'Como o agente aparece para as pessoas.',\n model: 'Em qual conexão e modelo o agente roda.',\n behaviour: 'Instruções, amostragem e etiquetas.',\n review: 'Confira tudo antes de criar o agente.',\n },\n custom: 'Personalizado',\n customDetail: 'Começar do zero',\n presets: 'Ponto de partida',\n avatar: 'Marca',\n avatarNames: { bot: 'Assistente', search: 'Pesquisador', quote: 'Codificador', scale: 'Revisor', chart: 'Analista', sparkles: 'Redator' },\n name: 'Nome',\n nameRequired: 'Dê um nome ao agente.',\n role: 'Papel',\n description: 'Descrição',\n connection: 'Conexão com o provedor',\n noConnection: 'Escolha uma conexão',\n framework: 'Framework do agente',\n model: 'Modelo',\n noModels: 'Nenhum modelo disponível',\n modelField: 'Identificador do modelo',\n outputSchema: 'Esquema de saída (texto estruturado)',\n systemPrompt: 'Prompt de sistema',\n userPrompt: 'Prompt do usuário',\n temperature: 'Temperatura',\n topP: 'Amostragem de núcleo (top-p)',\n topK: 'Amostragem top-k',\n maxOutput: 'Máximo de tokens de saída',\n difficulty: 'Dificuldade',\n difficultyNames: { beginner: 'Iniciante', intermediate: 'Intermediário', advanced: 'Avançado', expert: 'Especialista' },\n tags: 'Etiquetas',\n removeTag: 'Remover etiqueta {tag}',\n edit: 'Editar',\n editGroup: 'Editar {group}',\n notSet: 'não definido',\n cancel: 'Cancelar',\n back: 'Voltar',\n next: 'Avançar',\n create: 'Criar agente',\n creating: 'Criando',\n failed: 'Não foi possível criar o agente.',\n untitled: 'Agente sem nome',\n confirmCancelTitle: 'Descartar este agente?',\n confirmCancelMessage: 'O que você preencheu será perdido.',\n confirmCancel: 'Descartar',\n keepEditing: 'Continuar editando',\n },\n es: {\n steps: 'Pasos',\n stepCounter: 'Paso {n, number} de {total, number}',\n completed: 'completado',\n titles: { start: 'Punto de partida', identity: 'Identidad', model: 'Modelo', behaviour: 'Comportamiento y metadatos', review: 'Revisión' },\n subtitles: {\n start: 'Empiece desde una plantilla o desde cero.',\n identity: 'Cómo ven las personas al agente.',\n model: 'En qué conexión y modelo funciona el agente.',\n behaviour: 'Instrucciones, muestreo y etiquetas.',\n review: 'Revise todo antes de crear el agente.',\n },\n custom: 'Personalizado',\n customDetail: 'Empezar desde cero',\n presets: 'Punto de partida',\n avatar: 'Marca',\n avatarNames: { bot: 'Asistente', search: 'Investigador', quote: 'Codificador', scale: 'Revisor', chart: 'Analista', sparkles: 'Redactor' },\n name: 'Nombre',\n nameRequired: 'Dé un nombre al agente.',\n role: 'Rol',\n description: 'Descripción',\n connection: 'Conexión con el proveedor',\n noConnection: 'Elija una conexión',\n framework: 'Marco del agente',\n model: 'Modelo',\n noModels: 'No hay modelos disponibles',\n modelField: 'Identificador del modelo',\n outputSchema: 'Esquema de salida (texto estructurado)',\n systemPrompt: 'Prompt de sistema',\n userPrompt: 'Prompt de usuario',\n temperature: 'Temperatura',\n topP: 'Muestreo de núcleo (top-p)',\n topK: 'Muestreo top-k',\n maxOutput: 'Máximo de tokens de salida',\n difficulty: 'Dificultad',\n difficultyNames: { beginner: 'Principiante', intermediate: 'Intermedio', advanced: 'Avanzado', expert: 'Experto' },\n tags: 'Etiquetas',\n removeTag: 'Quitar etiqueta {tag}',\n edit: 'Editar',\n editGroup: 'Editar {group}',\n notSet: 'sin definir',\n cancel: 'Cancelar',\n back: 'Atrás',\n next: 'Siguiente',\n create: 'Crear agente',\n creating: 'Creando',\n failed: 'No se pudo crear el agente.',\n untitled: 'Agente sin nombre',\n confirmCancelTitle: '¿Descartar este agente?',\n confirmCancelMessage: 'Se perderá lo que ha escrito.',\n confirmCancel: 'Descartar',\n keepEditing: 'Seguir editando',\n },\n})\n\nexport const defaultAgentCreationWizardLabels = agentCreationWizardLabels.bundles.en\n\nexport interface AgentCreationWizardProps {\n labels?: Partial<AgentCreationWizardLabels>\n models: WizardModel[]\n /** Empty array: the host has no credential system; the model is typed inline. */\n connections: WizardConnection[]\n presets?: AgentPreset[]\n frameworks?: Array<{ id: string; label: string }>\n initialStep?: number\n onStepChange?: (step: number) => void\n onSubmit: (input: NewAgentInput) => Promise<void>\n onCancel: () => void\n /** Confirmation service (defaults to the nearest ConfirmProvider). */\n confirm?: ConfirmFn\n}\n\nconst STEP_KEYS = ['start', 'identity', 'model', 'behaviour', 'review'] as const\nconst TOTAL = STEP_KEYS.length\nconst AVATARS = [\n { key: 'bot', icon: Bot },\n { key: 'search', icon: FileSearch },\n { key: 'quote', icon: Quote },\n { key: 'scale', icon: Scale },\n { key: 'chart', icon: ChartColumn },\n { key: 'sparkles', icon: Sparkles },\n] as const\nconst DIFFICULTIES: AgentDifficulty[] = ['beginner', 'intermediate', 'advanced', 'expert']\nconst CUSTOM = '__custom__'\n\nconst clampStep = (n: number | undefined) => Math.min(TOTAL, Math.max(1, Math.round(Number.isFinite(n) ? (n as number) : 1)))\n\ninterface Draft {\n preset: string\n avatar: string\n name: string\n role: string\n description: string\n connectionId: string\n framework: string\n model: string\n outputSchema: string\n systemPrompt: string\n userPrompt: string\n temperature: string\n topP: string\n topK: string\n maxOutput: string\n difficulty: AgentDifficulty\n tags: string[]\n}\n\nfunction isTextEntry(el: EventTarget | null): boolean {\n if (!(el instanceof HTMLElement)) return false\n return el.isContentEditable || el.closest('input, textarea, select, button, [role=\"button\"], [role=\"radio\"], a') !== null\n}\n\nexport function AgentCreationWizard(props: AgentCreationWizardProps) {\n const { models, connections, presets = [], frameworks = [], onStepChange, onSubmit, onCancel } = props\n const l = useLabels(agentCreationWizardLabels, props.labels)\n const { locale } = useFlowLocale()\n const contextConfirm = useConfirm()\n const confirm = props.confirm ?? contextConfirm\n const headingRef = useRef<HTMLHeadingElement>(null)\n const firstRender = useRef(true)\n const nameId = useId()\n\n const [step, setStep] = useState(() => clampStep(props.initialStep))\n const [reached, setReached] = useState(step)\n const [touched, setTouched] = useState(false)\n const [nameError, setNameError] = useState(false)\n const [busy, setBusy] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [d, setD] = useState<Draft>(() => ({\n preset: CUSTOM,\n avatar: 'bot',\n name: '',\n role: '',\n description: '',\n connectionId: connections[0]?.id ?? '',\n framework: frameworks[0]?.id ?? '',\n model: models[0]?.id ?? '',\n outputSchema: '',\n systemPrompt: '',\n userPrompt: '',\n temperature: '',\n topP: '',\n topK: '',\n maxOutput: '',\n difficulty: 'beginner',\n tags: [],\n }))\n\n // Host navigation (back/forward) moves the wizard.\n useEffect(() => {\n if (props.initialStep === undefined) return\n setStep(clampStep(props.initialStep))\n }, [props.initialStep])\n\n useEffect(() => {\n if (firstRender.current) {\n firstRender.current = false\n return\n }\n headingRef.current?.focus()\n }, [step])\n\n const go = (n: number) => {\n const next = clampStep(n)\n setStep(next)\n setReached((r) => Math.max(r, next))\n onStepChange?.(next)\n }\n\n const edit = <K extends keyof Draft>(key: K, value: Draft[K]) => {\n setTouched(true)\n setD((prev) => ({ ...prev, [key]: value }))\n if (key === 'name' && String(value).trim()) setNameError(false)\n }\n\n const choosePreset = (id: string) => {\n setTouched(true)\n const p = presets.find((x) => x.id === id)\n setD((prev) =>\n p\n ? {\n ...prev,\n preset: id,\n name: p.name,\n role: p.role,\n systemPrompt: p.systemPrompt ?? prev.systemPrompt,\n temperature: p.temperature !== undefined ? String(p.temperature) : prev.temperature,\n topP: p.topP !== undefined ? String(p.topP) : prev.topP,\n maxOutput: p.maxOutputTokens !== undefined ? String(p.maxOutputTokens) : prev.maxOutput,\n framework: p.framework ?? prev.framework,\n }\n : { ...prev, preset: CUSTOM },\n )\n }\n\n const next = () => {\n if (step === 2 && !d.name.trim()) {\n setNameError(true)\n return\n }\n go(step + 1)\n }\n\n const input = (): NewAgentInput => {\n const preset = presets.find((p) => p.id === d.preset)\n const num = (s: string) => (s.trim() !== '' && Number.isFinite(Number(s)) ? Number(s) : undefined)\n const out: NewAgentInput = { name: d.name.trim() || preset?.name || l.untitled }\n const text: Array<[keyof NewAgentInput, string]> = [\n ['role', d.role],\n ['description', d.description],\n ['connectionId', d.connectionId],\n ['framework', d.framework],\n ['model', d.model],\n ['outputSchema', d.outputSchema],\n ['systemPrompt', d.systemPrompt],\n ['userPrompt', d.userPrompt],\n ]\n for (const [k, v] of text) if (v.trim()) (out as unknown as Record<string, unknown>)[k] = v.trim()\n out.avatar = d.avatar\n const nums: Array<[keyof NewAgentInput, string]> = [\n ['temperature', d.temperature],\n ['topP', d.topP],\n ['topK', d.topK],\n ['maxOutputTokens', d.maxOutput],\n ]\n for (const [k, v] of nums) {\n const n = num(v)\n if (n !== undefined) (out as unknown as Record<string, unknown>)[k] = n\n }\n out.difficulty = d.difficulty\n if (d.tags.length) out.tags = d.tags\n return out\n }\n\n const create = async () => {\n setBusy(true)\n setError(null)\n try {\n await onSubmit(input())\n } catch (e) {\n setError(e instanceof Error && e.message ? e.message : l.failed)\n } finally {\n setBusy(false)\n }\n }\n\n const cancel = async () => {\n if (!touched) {\n onCancel()\n return\n }\n const ok = await confirm({ title: l.confirmCancelTitle, message: l.confirmCancelMessage, confirmLabel: l.confirmCancel, cancelLabel: l.keepEditing, tone: 'danger' })\n if (ok) onCancel()\n }\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.defaultPrevented) return\n if (e.key === 'Escape') {\n e.preventDefault()\n void cancel()\n } else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey) && step === TOTAL) {\n e.preventDefault()\n void create()\n } else if (e.key === 'Enter' && !e.shiftKey && !isTextEntry(e.target)) {\n e.preventDefault()\n if (step === TOTAL) void create()\n else next()\n }\n }\n\n const key = STEP_KEYS[step - 1]!\n const stepNames = STEP_KEYS.map((k) => l.titles[k])\n const presetTiles = useMemo(\n () => [...presets.map((p) => ({ value: p.id, title: p.name, detail: p.role })), { value: CUSTOM, title: l.custom, detail: l.customDetail }],\n [presets, l.custom, l.customDetail],\n )\n const modelName = (id: string) => models.find((m) => m.id === id)?.name ?? id\n const shown = (v: string | undefined) => (v && v.trim() ? v : l.notSet)\n\n return (\n <div className=\"ty-agent-wizard\" onKeyDown={onKeyDown}>\n <header className=\"ty-agent-wizard__header\">\n <p className=\"ty-agent-wizard__counter\">{fill(l.stepCounter, { n: step, total: TOTAL }, locale)}</p>\n <h1 ref={headingRef} tabIndex={-1} className=\"ty-agent-wizard__title\">\n {l.titles[key]}\n </h1>\n <p className=\"ty-agent-wizard__subtitle\">{l.subtitles[key]}</p>\n <StepList steps={stepNames} current={step} reached={reached} label={l.steps} completedWord={l.completed} onJump={(n) => (n < step || n <= reached ? go(n) : undefined)} locale={locale} />\n </header>\n\n <div className=\"ty-agent-wizard__surface\">\n {key === 'start' ? <ChoiceTiles label={l.presets} tiles={presetTiles} value={d.preset} onChange={choosePreset} /> : null}\n\n {key === 'identity' ? (\n <div className=\"ty-agent-wizard__fields\">\n <ChoiceTiles\n label={l.avatar}\n value={d.avatar}\n onChange={(v) => edit('avatar', v)}\n tiles={AVATARS.map(({ key: k, icon: Icon }) => ({ value: k, title: l.avatarNames[k] ?? k, icon: <Icon focusable=\"false\" /> }))}\n />\n <TextField id={nameId} label={l.name} required value={d.name} onChange={(v) => edit('name', v)} {...(nameError ? { errorMessage: l.nameRequired } : {})} />\n <TextField label={l.role} value={d.role} onChange={(v) => edit('role', v)} />\n <TextArea label={l.description} value={d.description} onChange={(v) => edit('description', v)} rows={3} />\n </div>\n ) : null}\n\n {key === 'model' ? (\n <div className=\"ty-agent-wizard__fields\">\n {connections.length ? (\n <NativeSelect label={l.connection} value={d.connectionId} onChange={(v) => edit('connectionId', v)} options={connections.map((c) => ({ value: c.id, label: c.provider ? `${c.name} · ${c.provider}` : c.name }))} />\n ) : (\n <TextField label={l.modelField} value={d.model} onChange={(v) => edit('model', v)} />\n )}\n {frameworks.length ? <NativeSelect label={l.framework} value={d.framework} onChange={(v) => edit('framework', v)} options={frameworks.map((f) => ({ value: f.id, label: f.label }))} /> : null}\n {connections.length ? (\n <NativeSelect\n label={l.model}\n value={d.model}\n onChange={(v) => edit('model', v)}\n options={models.length ? models.map((m) => ({ value: m.id, label: m.name ?? m.id })) : [{ value: '', label: l.noModels }]}\n />\n ) : null}\n <TextArea label={l.outputSchema} value={d.outputSchema} onChange={(v) => edit('outputSchema', v)} rows={4} monospace />\n </div>\n ) : null}\n\n {key === 'behaviour' ? (\n <div className=\"ty-agent-wizard__fields\">\n <TextArea label={l.systemPrompt} value={d.systemPrompt} onChange={(v) => edit('systemPrompt', v)} rows={4} />\n <TextArea label={l.userPrompt} value={d.userPrompt} onChange={(v) => edit('userPrompt', v)} rows={3} />\n <div className=\"ty-agent-wizard__numbers\">\n <TextField label={l.temperature} inputType=\"number\" value={d.temperature} onChange={(v) => edit('temperature', v)} />\n <TextField label={l.topP} inputType=\"number\" value={d.topP} onChange={(v) => edit('topP', v)} />\n <TextField label={l.topK} inputType=\"number\" value={d.topK} onChange={(v) => edit('topK', v)} />\n <TextField label={l.maxOutput} inputType=\"number\" value={d.maxOutput} onChange={(v) => edit('maxOutput', v)} />\n </div>\n <NativeSelect label={l.difficulty} value={d.difficulty} onChange={(v) => edit('difficulty', v as AgentDifficulty)} options={DIFFICULTIES.map((x) => ({ value: x, label: l.difficultyNames[x] }))} />\n <TagInput label={l.tags} value={d.tags} onChange={(t) => edit('tags', t)} removeLabel={l.removeTag} />\n </div>\n ) : null}\n\n {key === 'review' ? (\n <div className=\"ty-agent-wizard__review\">\n <ReviewGroup title={l.titles.identity} editLabel={fill(l.editGroup, { group: l.titles.identity }, locale)} onEdit={() => go(2)} editWord={l.edit}>\n <div className=\"ty-agent-wizard__review-mark\">\n <AgentMark />\n <span>{shown(d.name || presets.find((p) => p.id === d.preset)?.name)}</span>\n </div>\n <Row term={l.role} value={shown(d.role)} />\n <Row term={l.description} value={shown(d.description)} />\n </ReviewGroup>\n <ReviewGroup title={l.titles.model} editLabel={fill(l.editGroup, { group: l.titles.model }, locale)} onEdit={() => go(3)} editWord={l.edit}>\n {connections.length ? <Row term={l.connection} value={shown(connections.find((c) => c.id === d.connectionId)?.name)} /> : null}\n {frameworks.length ? <Row term={l.framework} value={shown(frameworks.find((f) => f.id === d.framework)?.label)} /> : null}\n <Row term={l.model} value={shown(modelName(d.model))} mono />\n </ReviewGroup>\n <ReviewGroup title={l.titles.behaviour} editLabel={fill(l.editGroup, { group: l.titles.behaviour }, locale)} onEdit={() => go(4)} editWord={l.edit}>\n <Row term={l.systemPrompt} value={shown(d.systemPrompt)} />\n <Row term={l.difficulty} value={l.difficultyNames[d.difficulty]} />\n <Row term={l.tags} value={d.tags.length ? d.tags.join(', ') : l.notSet} />\n </ReviewGroup>\n </div>\n ) : null}\n\n {error ? (\n <InlineNotice tone=\"danger\" title={l.failed} urgency=\"assertive\">\n {error}\n </InlineNotice>\n ) : null}\n </div>\n\n <footer className=\"ty-agent-wizard__footer\">\n <Button variant=\"quiet\" onPress={() => void cancel()}>\n {l.cancel}\n </Button>\n <span className=\"ty-agent-wizard__spacer\" />\n {step > 1 ? (\n <Button variant=\"secondary\" leadingIcon={<ArrowLeft className=\"ty-agent-wizard__arrow\" />} onPress={() => go(step - 1)}>\n {l.back}\n </Button>\n ) : null}\n {step < TOTAL ? (\n <Button variant=\"secondary\" trailingIcon={<ArrowRight className=\"ty-agent-wizard__arrow\" />} onPress={next}>\n {l.next}\n </Button>\n ) : (\n <Button variant=\"primary\" busy={busy} busyLabel={l.creating} onPress={() => void create()}>\n {l.create}\n </Button>\n )}\n </footer>\n </div>\n )\n}\n\nfunction ReviewGroup({ title, editLabel, editWord, onEdit, children }: { title: string; editLabel: string; editWord: string; onEdit: () => void; children: ReactNode }) {\n return (\n <section className=\"ty-agent-wizard__group\">\n <div className=\"ty-agent-wizard__group-head\">\n <h2 className=\"ty-agent-wizard__group-title\">{title}</h2>\n <Button variant=\"quiet\" size=\"compact\" onPress={onEdit}>\n <span aria-hidden=\"true\">{editWord}</span>\n <span className=\"ty-visually-hidden\">{editLabel}</span>\n </Button>\n </div>\n <dl className=\"ty-agent-wizard__rows\">{children}</dl>\n </section>\n )\n}\n\nfunction Row({ term, value, mono = false }: { term: string; value: string; mono?: boolean }) {\n return (\n <div className=\"ty-agent-wizard__row\">\n <dt>{term}</dt>\n <dd data-mono={mono || undefined} {...(mono ? { dir: 'ltr' } : {})}>\n {value}\n </dd>\n </div>\n )\n}\n","// Assistant visual payloads → report blocks. The producer is a language model,\n// so the reader is lenient about key names (English, Portuguese and Spanish aliases)\n// and strict about what each type needs.\n\nimport type { ReportSection, ReportSpec, ValueFormat } from '../report/ReportView'\n\nexport type VisualType = 'figures' | 'bar' | 'line' | 'area' | 'table' | 'sections' | 'prose' | 'region-map' | 'flow'\n\nexport interface VisualEnvelope {\n type: VisualType\n title: string\n subtitle?: string\n rows: Array<Record<string, unknown>>\n xKey?: string\n yKeys?: string[]\n format?: ValueFormat\n columnFormats?: Record<string, ValueFormat>\n country?: string\n graph?: Record<string, unknown>\n body?: string\n}\n\nconst TYPE_ALIASES: Record<string, VisualType> = {\n figures: 'figures', figure: 'figures', kpi: 'figures', kpis: 'figures', numbers: 'figures', figuras: 'figures', numeros: 'figures', números: 'figures', indicadores: 'figures', cifras: 'figures',\n bar: 'bar', bars: 'bar', column: 'bar', columns: 'bar', barra: 'bar', barras: 'bar', colunas: 'bar', columnas: 'bar',\n line: 'line', lines: 'line', linha: 'line', linhas: 'line', linea: 'line', línea: 'line', lineas: 'line', líneas: 'line',\n area: 'area', área: 'area',\n table: 'table', tabela: 'table', tabla: 'table', grid: 'table',\n sections: 'sections', secoes: 'sections', seções: 'sections', report: 'sections', relatorio: 'sections', relatório: 'sections', secciones: 'sections', informe: 'sections',\n prose: 'prose', text: 'prose', texto: 'prose', md: 'prose', markdown: 'prose', note: 'prose', nota: 'prose', prosa: 'prose',\n 'region-map': 'region-map', region_map: 'region-map', regionmap: 'region-map', map: 'region-map', mapa: 'region-map', choropleth: 'region-map', regions: 'region-map', regioes: 'region-map', regiões: 'region-map', coropletico: 'region-map', coroplético: 'region-map', regiones: 'region-map',\n flow: 'flow', graph: 'flow', grafo: 'flow', fluxo: 'flow', workflow: 'flow', flujo: 'flow', flow_graph: 'flow', 'flow-graph': 'flow',\n}\n\nconst KEYS = {\n type: ['type', 'tipo', 'chart', 'grafico', 'gráfico', 'visual'],\n title: ['title', 'titulo', 'título', 'name', 'nome', 'nombre'],\n subtitle: ['subtitle', 'subtitulo', 'subtítulo', 'description', 'descricao', 'descrição', 'descripcion', 'descripción'],\n data: ['data', 'dados', 'rows', 'linhas', 'items', 'itens', 'values', 'valores', 'datos', 'filas', 'elementos'],\n x: ['xKey', 'x_key', 'x', 'eixoX', 'eixo_x', 'category', 'categoria'],\n y: ['yKeys', 'y_keys', 'y', 'series', 'séries', 'eixoY', 'eixo_y'],\n format: ['valueFormat', 'value_format', 'format', 'formato'],\n columnFormats: ['columnFormats', 'column_formats', 'formats', 'formatos'],\n country: ['country', 'pais', 'país', 'countryCode', 'country_code'],\n graph: ['graph', 'grafo', 'flow', 'fluxo', 'flujo'],\n body: ['body', 'markdown', 'corpo', 'content', 'conteudo', 'conteúdo', 'contenido', 'cuerpo', 'text', 'texto'],\n}\n\nconst isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v)\n\nfunction pick(o: Record<string, unknown>, keys: readonly string[]): unknown {\n for (const k of keys) if (o[k] !== undefined && o[k] !== null) return o[k]\n return undefined\n}\n\nfunction asFormat(v: unknown): ValueFormat | undefined {\n const s = typeof v === 'string' ? v.toLowerCase() : ''\n if (['number', 'numero', 'número', 'integer'].includes(s)) return 'number'\n if (['currency', 'moeda', 'moneda', 'money', 'dinero'].includes(s)) return 'currency'\n if (['percent', 'percentage', 'porcentagem', 'percentual', 'porcentaje', '%'].includes(s)) return 'percent'\n return undefined\n}\n\n/**\n * Reads a visualization tool output. Accepts an object (or its JSON text)\n * marked as a visualization or carrying a type; returns null when it is not a\n * usable visual (the chat then shows the tool's text summary instead).\n */\nexport function parseAssistantVisual(output: unknown): VisualEnvelope | null {\n let o = output\n if (typeof o === 'string') {\n try {\n o = JSON.parse(o)\n } catch {\n return null\n }\n }\n if (!isRecord(o)) return null\n // A wrapper such as { visualization: {...} } is unwrapped.\n if (isRecord(o.visualization)) o = o.visualization\n if (!isRecord(o)) return null\n const rawType = pick(o, KEYS.type)\n if (typeof rawType !== 'string') return null\n const type = TYPE_ALIASES[rawType.trim().toLowerCase()]\n if (!type) return null\n const title = pick(o, KEYS.title)\n if (typeof title !== 'string' || !title.trim()) return null\n\n const data = pick(o, KEYS.data)\n const rows = (Array.isArray(data) ? data : []).filter(isRecord)\n const env: VisualEnvelope = { type, title: title.trim(), rows }\n\n const subtitle = pick(o, KEYS.subtitle)\n if (typeof subtitle === 'string' && subtitle.trim()) env.subtitle = subtitle.trim()\n const x = pick(o, KEYS.x)\n if (typeof x === 'string') env.xKey = x\n const y = pick(o, KEYS.y)\n if (typeof y === 'string') env.yKeys = [y]\n else if (Array.isArray(y)) env.yKeys = y.filter((k): k is string => typeof k === 'string')\n const format = asFormat(pick(o, KEYS.format))\n if (format) env.format = format\n const cf = pick(o, KEYS.columnFormats)\n if (isRecord(cf)) {\n const out: Record<string, ValueFormat> = {}\n for (const [k, v] of Object.entries(cf)) {\n const f = asFormat(v)\n if (f) out[k] = f\n }\n env.columnFormats = out\n }\n const country = pick(o, KEYS.country)\n if (typeof country === 'string') env.country = country\n\n if (type === 'flow') {\n const graph = pick(o, KEYS.graph)\n if (!isRecord(graph)) return null\n env.graph = graph\n return env\n }\n if (type === 'prose') {\n const body = pick(o, KEYS.body)\n if (typeof body !== 'string' || !body.trim()) return null\n env.body = body\n return env\n }\n return rows.length ? env : null\n}\n\nconst isNumeric = (v: unknown) => typeof v === 'number' && Number.isFinite(v)\n\n/** x key and series keys: from the envelope, else the first non-numeric column and the numeric ones. */\nexport function inferAxes(env: Pick<VisualEnvelope, 'rows' | 'xKey' | 'yKeys'>): { x: string; y: string[] } {\n const first = env.rows[0] ?? {}\n const keys = Object.keys(first)\n const x = env.xKey ?? keys.find((k) => !isNumeric(first[k])) ?? keys[0] ?? 'x'\n const y = env.yKeys?.length ? env.yKeys : keys.filter((k) => k !== x && isNumeric(first[k]))\n return { x, y }\n}\n\nconst REGION_KEYS = ['region', 'regiao', 'região', 'región', 'code', 'codigo', 'código', 'uf', 'state', 'estado', 'iso']\nconst LABEL_KEYS = ['label', 'title', 'titulo', 'título', 'name', 'nome', 'nombre', 'rotulo', 'rótulo', 'etiqueta']\nconst VALUE_KEYS = ['value', 'valor', 'total', 'count', 'contagem', 'conteo', 'n']\n\nexport interface EnvelopeToReportOptions {\n /** Country used by region maps without one (from the host configuration). */\n defaultCountry?: string\n}\n\n/** Converts a parsed envelope into a ReportView definition. */\nexport function envelopeToReport(env: VisualEnvelope, options: EnvelopeToReportOptions = {}): ReportSpec {\n const base: Pick<ReportSpec, 'title' | 'subtitle'> = { title: env.title, ...(env.subtitle ? { subtitle: env.subtitle } : {}) }\n const sections: ReportSection[] = []\n switch (env.type) {\n case 'figures':\n sections.push({\n type: 'figures',\n data: {\n items: env.rows.map((r) => {\n const label = pick(r, LABEL_KEYS)\n const value = pick(r, VALUE_KEYS)\n const format = asFormat(pick(r, KEYS.format)) ?? env.format\n return { label: typeof label === 'string' ? label : '', value: isNumeric(value) || typeof value === 'string' ? (value as number | string) : '', ...(format ? { format } : {}) }\n }),\n },\n })\n break\n case 'sections':\n for (const r of env.rows) {\n if (typeof r.type === 'string' && isRecord(r.data)) sections.push({ ...(r as object), type: r.type, data: r.data } as ReportSection)\n }\n break\n case 'prose':\n sections.push({ type: 'markdown', data: { body: env.body ?? '' } })\n break\n case 'region-map': {\n const items = env.rows.flatMap((r) => {\n const region = pick(r, REGION_KEYS)\n if (typeof region !== 'string' || !region.trim()) return []\n const label = pick(r, LABEL_KEYS)\n const value = pick(r, VALUE_KEYS)\n return [{ region: region.trim(), label: typeof label === 'string' ? label : region.trim(), value: isNumeric(value) ? (value as number) : Number(value) || 0 }]\n })\n const country = env.country ?? options.defaultCountry\n sections.push({ type: 'region-map', data: { items, ...(country ? { country } : {}), ...(env.format ? { format: env.format } : {}) } })\n break\n }\n case 'table': {\n const first = env.rows[0] ?? {}\n const columns = Object.keys(first).map((key) => {\n const format = env.columnFormats?.[key] ?? (isNumeric(first[key]) ? 'number' : undefined)\n return { key, label: key, ...(format ? { format } : {}) }\n })\n sections.push({ type: 'table', data: { rows: env.rows, columns } })\n break\n }\n case 'flow':\n sections.push({ type: 'flow', data: { graph: env.graph } })\n break\n default: {\n const { x, y } = inferAxes(env)\n sections.push({ type: env.type, data: { rows: env.rows, x, y, ...(env.format ? { format: env.format } : {}) } })\n }\n }\n return { ...base, sections }\n}\n","// useAssistantSession: one conversation with the platform assistant. The host\n// supplies how questions travel: `openStream` (a stream of signals) or\n// `askOnce` (a single reply). Everything the session keeps (utterances,\n// phase, thread, draft) lives in one reducer; a signal from the transport is\n// folded into the answering utterance by pure functions, so both transports\n// share the same rules.\n\nimport { useCallback, useEffect, useMemo, useReducer, useRef } from 'react'\nimport { createId } from '../internal/ids'\nimport { parseAssistantVisual, type VisualEnvelope } from './visual'\n\nexport type Speaker = 'person' | 'assistant'\n\n/** A piece of an utterance, in arrival order. */\nexport type Block =\n | { kind: 'prose'; body: string }\n | { kind: 'thinking'; body: string }\n | { kind: 'toolCall'; callId: string; tool: string; phase: 'working' | 'ok' | 'broken'; note?: string; args?: unknown; result?: unknown }\n | { kind: 'figure'; callId: string; envelope: VisualEnvelope }\n\nexport interface Utterance {\n key: string\n speaker: Speaker\n blocks: Block[]\n /** waiting: nothing arrived yet; arriving: blocks coming in; settled; broken. */\n phase: 'waiting' | 'arriving' | 'settled' | 'broken'\n problem?: string\n}\n\n/** Something the assistant asks the app to do; only \"goTo\" is acted upon. */\nexport type Directive = { kind: 'goTo'; to: string } | { kind: string; [field: string]: unknown }\n\n/** What a streaming transport reports, one signal at a time. */\nexport type SessionSignal =\n | { signal: 'opened'; threadId?: string; linkId?: string }\n | { signal: 'prose'; chunk: string }\n | { signal: 'thinking'; chunk: string }\n | { signal: 'toolAnnounced'; callId: string; tool: string }\n | { signal: 'toolArgs'; callId: string; tool: string; args?: unknown }\n | { signal: 'toolResult'; callId: string; result?: unknown; failure?: string; note?: string }\n | { signal: 'directive'; directive: Directive }\n | { signal: 'closed'; threadId?: string }\n | { signal: 'fault'; reason: string }\n\n/** What the transport receives for one question. */\nexport interface SessionRequest {\n question: string\n /** Earlier settled, non-empty utterances as plain text. */\n transcript: Array<{ speaker: Speaker; text: string }>\n threadId: string | null\n where: { audience: 'app' | 'conversation' | 'admin'; path?: string; screenName?: string; flowId?: string }\n}\n\n/** A one-shot transport's answer. */\nexport interface SessionReply {\n answer: string\n directives?: Directive[]\n toolCalls?: Array<{ callId: string; tool: string; args?: unknown; result?: unknown; failure?: string; note?: string }>\n linkId?: string\n threadId?: string\n}\n\nexport interface AssistantSessionOptions {\n openStream?: (request: SessionRequest, wire: { signal: AbortSignal; deliver: (s: SessionSignal) => void }) => Promise<void>\n askOnce?: (request: SessionRequest) => Promise<SessionReply>\n path?: string\n screenName?: string\n audience?: 'app' | 'conversation' | 'admin'\n onGoTo?: (path: string) => void\n flowId?: string\n /** Name of the reserved tool whose results are drawn as figures. */\n figureTool?: string\n /** Localised error texts owned by the session. */\n texts?: { missingTransport?: string; failed?: string }\n}\n\nexport type SessionPhase = 'idle' | 'asking' | 'receiving' | 'broken'\n\nexport interface SavedThread {\n id: string\n utterances: unknown[]\n}\n\nexport interface AssistantSession {\n utterances: Utterance[]\n phase: SessionPhase\n working: boolean\n loadingHistory: boolean\n threadId: string | null\n draft: string\n setDraft: (text: string) => void\n ask: (text?: string) => void\n halt: () => void\n askAgain: () => void\n canAskAgain: boolean\n setLoadingHistory: (on: boolean) => void\n reset: () => void\n restore: (saved: SavedThread) => void\n}\n\nconst FIGURE_TOOL = 'render_visual'\n\ntype ToolBlock = Extract<Block, { kind: 'toolCall' }>\ntype Written = Extract<Block, { kind: 'prose' | 'thinking' }>\n\n/** The prose of an utterance (prose blocks only, joined). */\nexport function plainText(u: Pick<Utterance, 'blocks'>): string {\n let out = ''\n for (const b of u.blocks) if (b.kind === 'prose') out += b.body\n return out\n}\n\n// ---- folding signals into blocks -----------------------------------------\n\nfunction extendWritten(blocks: Block[], kind: Written['kind'], chunk: string): Block[] {\n const last = blocks[blocks.length - 1]\n if (last && last.kind === kind) return blocks.slice(0, -1).concat({ kind, body: last.body + chunk })\n return blocks.concat({ kind, body: chunk })\n}\n\nfunction indexOfCall(blocks: Block[], callId: string): number {\n return blocks.findIndex((b) => b.kind === 'toolCall' && b.callId === callId)\n}\n\nfunction withCall(blocks: Block[], callId: string, tool: string, args?: { value: unknown }): Block[] {\n const at = indexOfCall(blocks, callId)\n if (at < 0) return blocks.concat({ kind: 'toolCall', callId, tool, phase: 'working', ...(args ? { args: args.value } : {}) })\n if (!args) return blocks\n const copy = blocks.slice()\n copy[at] = { ...(copy[at] as ToolBlock), args: args.value }\n return copy\n}\n\ninterface Outcome {\n callId: string\n tool?: string\n args?: unknown\n result?: unknown\n failure?: string\n note?: string\n}\n\nfunction withOutcome(blocks: Block[], o: Outcome, figureTool: string): Block[] {\n const at = indexOfCall(blocks, o.callId)\n const copy = blocks.slice()\n const base: ToolBlock = at >= 0 ? (copy[at] as ToolBlock) : { kind: 'toolCall', callId: o.callId, tool: o.tool ?? '', phase: 'working', ...(o.args !== undefined ? { args: o.args } : {}) }\n const note = o.note ?? o.failure\n const done: ToolBlock = { ...base, phase: o.failure ? 'broken' : 'ok', result: o.result, ...(note ? { note } : {}) }\n if (at >= 0) copy[at] = done\n else copy.push(done)\n if (o.failure || done.tool !== figureTool) return copy\n const envelope = parseAssistantVisual(o.result)\n return envelope ? copy.concat({ kind: 'figure', callId: o.callId, envelope }) : copy\n}\n\n/** Block change for a signal, or null for signals that change no block. */\nconst BLOCK_FOLDS: Partial<Record<SessionSignal['signal'], (blocks: Block[], s: SessionSignal, figureTool: string) => Block[]>> = {\n prose: (b, s) => extendWritten(b, 'prose', (s as { chunk: string }).chunk),\n thinking: (b, s) => extendWritten(b, 'thinking', (s as { chunk: string }).chunk),\n toolAnnounced: (b, s) => {\n const a = s as Extract<SessionSignal, { signal: 'toolAnnounced' }>\n return withCall(b, a.callId, a.tool)\n },\n toolArgs: (b, s) => {\n const a = s as Extract<SessionSignal, { signal: 'toolArgs' }>\n return withCall(b, a.callId, a.tool, { value: a.args })\n },\n toolResult: (b, s, fig) => withOutcome(b, s as unknown as Outcome, fig),\n}\n\n// ---- stored threads -------------------------------------------------------\n\nconst BLOCK_SHAPES: Record<string, (o: Record<string, unknown>) => boolean> = {\n prose: (o) => typeof o.body === 'string',\n thinking: (o) => typeof o.body === 'string',\n toolCall: (o) => typeof o.callId === 'string' && typeof o.tool === 'string' && ['working', 'ok', 'broken'].includes(String(o.phase)),\n figure: (o) => typeof o.callId === 'string' && parseAssistantVisual(o.envelope) !== null,\n}\n\nfunction isBlock(x: unknown): x is Block {\n if (!x || typeof x !== 'object') return false\n const check = BLOCK_SHAPES[String((x as { kind?: unknown }).kind)]\n return !!check && check(x as Record<string, unknown>)\n}\n\n/** Keeps only well-formed saved utterances and blocks. */\nexport function acceptSaved(raw: unknown[]): Utterance[] {\n const out: Utterance[] = []\n for (const item of raw) {\n if (!item || typeof item !== 'object') continue\n const o = item as Record<string, unknown>\n if (o.speaker !== 'person' && o.speaker !== 'assistant') continue\n out.push({ key: typeof o.key === 'string' ? o.key : createId('utt'), speaker: o.speaker, blocks: Array.isArray(o.blocks) ? o.blocks.filter(isBlock) : [], phase: 'settled' })\n }\n return out\n}\n\n// ---- session state --------------------------------------------------------\n\ninterface SessionState {\n utterances: Utterance[]\n phase: SessionPhase\n threadId: string | null\n loadingHistory: boolean\n draft: string\n}\n\ntype Move =\n | { type: 'draft'; text: string }\n | { type: 'loading'; on: boolean }\n | { type: 'pose'; question: Utterance | null; answer: Utterance }\n | { type: 'fold'; key: string; signal: SessionSignal; figureTool: string }\n | { type: 'reply'; key: string; reply: SessionReply; figureTool: string }\n | { type: 'thread'; id: string }\n | { type: 'end'; key: string; problem?: string }\n | { type: 'drop-last' }\n | { type: 'replace'; utterances: Utterance[]; threadId: string | null }\n\nconst EMPTY: SessionState = { utterances: [], phase: 'idle', threadId: null, loadingHistory: false, draft: '' }\n\nfunction touch(state: SessionState, key: string, change: (u: Utterance) => Utterance): Utterance[] {\n return state.utterances.map((u) => (u.key === key ? change(u) : u))\n}\n\nfunction sessionReducer(state: SessionState, move: Move): SessionState {\n switch (move.type) {\n case 'draft':\n return { ...state, draft: move.text }\n case 'loading':\n return { ...state, loadingHistory: move.on }\n case 'pose':\n return { ...state, phase: 'asking', utterances: [...state.utterances, ...(move.question ? [move.question] : []), move.answer] }\n case 'fold': {\n const fold = BLOCK_FOLDS[move.signal.signal]\n if (!fold) return state\n return { ...state, phase: 'receiving', utterances: touch(state, move.key, (u) => ({ ...u, phase: 'arriving', blocks: fold(u.blocks, move.signal, move.figureTool) })) }\n }\n case 'reply': {\n const r = move.reply\n return {\n ...state,\n ...(r.threadId ? { threadId: r.threadId } : {}),\n utterances: touch(state, move.key, (u) => {\n let blocks = u.blocks\n for (const call of r.toolCalls ?? []) blocks = withOutcome(blocks, call, move.figureTool)\n return { ...u, blocks: r.answer ? blocks.concat({ kind: 'prose', body: r.answer }) : blocks }\n }),\n }\n }\n case 'thread':\n return { ...state, threadId: move.id }\n case 'end':\n return {\n ...state,\n phase: move.problem === undefined ? 'idle' : 'broken',\n utterances: touch(state, move.key, (u) => (move.problem === undefined ? { ...u, phase: 'settled' } : { ...u, phase: 'broken', problem: move.problem })),\n }\n case 'drop-last':\n return { ...state, utterances: state.utterances.slice(0, -1) }\n case 'replace':\n return { ...state, utterances: move.utterances, threadId: move.threadId, phase: 'idle', draft: '' }\n }\n}\n\n/** App-relative paths only (\"/records\"); never another origin. */\nfunction insideApp(path: unknown): path is string {\n return typeof path === 'string' && path.startsWith('/') && !path.startsWith('//')\n}\n\nfunction reasonOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/** The question being answered: its cancel switch, the answering utterance, the question text. */\ninterface InFlight {\n cancel: AbortController\n answerKey: string\n question: string\n finished: boolean\n}\n\nexport function useAssistantSession(options: AssistantSessionOptions = {}): AssistantSession {\n const [state, dispatch] = useReducer(sessionReducer, EMPTY)\n // Read at ask time without re-creating callbacks.\n const latest = useRef({ options, state })\n latest.current = { options, state }\n const inFlight = useRef<InFlight | null>(null)\n const lastQuestion = useRef<string | null>(null)\n\n const finish = useCallback((f: InFlight, problem?: string) => {\n if (f.finished || inFlight.current !== f || f.cancel.signal.aborted) return\n f.finished = true\n inFlight.current = null\n dispatch(problem === undefined ? { type: 'end', key: f.answerKey } : { type: 'end', key: f.answerKey, problem })\n }, [])\n\n const obey = useCallback((d: Directive) => {\n if (d.kind === 'goTo' && insideApp(d.to)) latest.current.options.onGoTo?.(d.to)\n }, [])\n\n const run = useCallback(\n async (question: string, repeat: boolean) => {\n const { options: o, state: s } = latest.current\n const figureTool = o.figureTool ?? FIGURE_TOOL\n const transcript: SessionRequest['transcript'] = []\n for (const u of s.utterances) {\n const text = plainText(u)\n if (u.phase === 'settled' && text.trim()) transcript.push({ speaker: u.speaker, text })\n }\n const where: SessionRequest['where'] = { audience: o.audience ?? 'app' }\n if (o.path !== undefined) where.path = o.path\n if (o.screenName !== undefined) where.screenName = o.screenName\n if (o.flowId) where.flowId = o.flowId\n const request: SessionRequest = { question, transcript, threadId: s.threadId, where }\n\n const f: InFlight = { cancel: new AbortController(), answerKey: createId('utt'), question, finished: false }\n inFlight.current = f\n lastQuestion.current = question\n dispatch({\n type: 'pose',\n question: repeat ? null : { key: createId('utt'), speaker: 'person', blocks: [{ kind: 'prose', body: question }], phase: 'settled' },\n answer: { key: f.answerKey, speaker: 'assistant', blocks: [], phase: 'waiting' },\n })\n const alive = () => inFlight.current === f && !f.cancel.signal.aborted && !f.finished\n\n if (o.openStream) {\n const deliver = (sig: SessionSignal) => {\n if (!alive()) return\n if (BLOCK_FOLDS[sig.signal]) return dispatch({ type: 'fold', key: f.answerKey, signal: sig, figureTool })\n if ((sig.signal === 'opened' || sig.signal === 'closed') && sig.threadId) dispatch({ type: 'thread', id: sig.threadId })\n if (sig.signal === 'directive') obey(sig.directive)\n else if (sig.signal === 'closed') finish(f)\n else if (sig.signal === 'fault') finish(f, sig.reason)\n }\n try {\n await o.openStream(request, { signal: f.cancel.signal, deliver })\n finish(f)\n } catch (error) {\n if (!f.cancel.signal.aborted) finish(f, reasonOf(error))\n }\n return\n }\n if (!o.askOnce) {\n finish(f, o.texts?.missingTransport ?? 'The assistant is not configured: no transport was provided.')\n return\n }\n try {\n const reply = await o.askOnce(request)\n if (!alive()) return\n dispatch({ type: 'reply', key: f.answerKey, reply, figureTool })\n reply.directives?.forEach(obey)\n finish(f)\n } catch (error) {\n finish(f, reasonOf(error))\n }\n },\n [finish, obey],\n )\n\n const working = state.phase === 'asking' || state.phase === 'receiving'\n\n const ask = useCallback(\n (text?: string) => {\n const question = (text ?? latest.current.state.draft).trim()\n if (!question || inFlight.current) return\n if (text === undefined) dispatch({ type: 'draft', text: '' })\n void run(question, false)\n },\n [run],\n )\n\n const halt = useCallback(() => {\n const f = inFlight.current\n if (!f) return\n inFlight.current = null\n f.finished = true\n f.cancel.abort()\n // What arrived so far stays as the answer; the question is not failed.\n dispatch({ type: 'end', key: f.answerKey })\n }, [])\n\n const last = state.utterances[state.utterances.length - 1]\n const canAskAgain = last?.phase === 'broken' && !!lastQuestion.current && !working\n\n const askAgain = useCallback(() => {\n const question = lastQuestion.current\n const all = latest.current.state.utterances\n if (!question || all[all.length - 1]?.phase !== 'broken' || inFlight.current) return\n // The broken answer goes; the question stays once.\n latest.current = { ...latest.current, state: { ...latest.current.state, utterances: all.slice(0, -1) } }\n dispatch({ type: 'drop-last' })\n void run(question, true)\n }, [run])\n\n const replaceWith = useCallback((utterances: Utterance[], threadId: string | null) => {\n inFlight.current?.cancel.abort()\n inFlight.current = null\n lastQuestion.current = null\n dispatch({ type: 'replace', utterances, threadId })\n }, [])\n\n const reset = useCallback(() => replaceWith([], null), [replaceWith])\n const restore = useCallback(\n (saved: SavedThread) => {\n replaceWith(acceptSaved(Array.isArray(saved.utterances) ? saved.utterances : []), saved.id)\n dispatch({ type: 'loading', on: false })\n },\n [replaceWith],\n )\n const setDraft = useCallback((text: string) => dispatch({ type: 'draft', text }), [])\n const setLoadingHistory = useCallback((on: boolean) => dispatch({ type: 'loading', on }), [])\n\n useEffect(() => () => inFlight.current?.cancel.abort(), [])\n\n return useMemo(\n () => ({\n utterances: state.utterances,\n phase: state.phase,\n working,\n loadingHistory: state.loadingHistory,\n threadId: state.threadId,\n draft: state.draft,\n setDraft,\n ask,\n halt,\n askAgain,\n canAskAgain,\n setLoadingHistory,\n reset,\n restore,\n }),\n [state, working, setDraft, ask, halt, askAgain, canAskAgain, setLoadingHistory, reset, restore],\n )\n}\n\nexport interface FlowArtifact {\n callId: string\n flowId?: string\n graph: Record<string, unknown>\n}\n\n/** Newest successful tool result that carries a flow graph (create, edit, read …), if any. */\nexport function newestFlowArtifact(utterances: readonly Utterance[]): FlowArtifact | null {\n for (let i = utterances.length - 1; i >= 0; i--) {\n const blocks = utterances[i]!.blocks\n for (let j = blocks.length - 1; j >= 0; j--) {\n const b = blocks[j]!\n if (b.kind !== 'toolCall' || b.phase !== 'ok' || !b.result || typeof b.result !== 'object') continue\n const result = b.result as Record<string, unknown>\n const graph = result.graph as Record<string, unknown> | undefined\n if (!graph || typeof graph !== 'object' || !Array.isArray(graph.nodes)) continue\n const flowId = typeof result.flowId === 'string' ? result.flowId : typeof result.id === 'string' ? result.id : undefined\n return flowId ? { callId: b.callId, flowId, graph } : { callId: b.callId, graph }\n }\n }\n return null\n}\n","// AssistantVisualBlock: a parsed visual answer drawn with the same ReportView\n// as reports, or a flow card with an \"open in canvas\" action.\n\nimport { useId } from 'react'\nimport { Workflow } from 'lucide-react'\nimport { useLocale } from 'react-aria-components'\nimport { Button } from '../../index'\nimport { defineLabels, fill, useLabels } from '../internal/labels'\nimport { ReportView } from '../report/ReportView'\nimport { envelopeToReport, type VisualEnvelope } from './visual'\n\nexport interface AssistantVisualBlockLabels {\n open: string\n flow: string\n}\n\nexport const assistantVisualBlockLabels = defineLabels<AssistantVisualBlockLabels>('AssistantVisualBlock', {\n en: { open: 'Open {title} in canvas', flow: 'Flow' },\n 'pt-BR': { open: 'Abrir {title} no canvas', flow: 'Fluxo' },\n es: { open: 'Abrir {title} en el lienzo', flow: 'Flujo' },\n})\n\nexport const defaultAssistantVisualBlockLabels: AssistantVisualBlockLabels = assistantVisualBlockLabels.bundles.en\n\nexport interface AssistantVisualBlockProps {\n envelope: VisualEnvelope\n /** Honoured only for flow graph payloads. */\n onOpen?: () => void\n locale?: string\n /** ISO 4217 code from the project settings; needed only for currency values. */\n currency?: string\n /** Country used by region maps that do not name one. */\n defaultCountry?: string\n labels?: Partial<AssistantVisualBlockLabels>\n className?: string\n}\n\nexport function AssistantVisualBlock({ envelope, onOpen, locale, currency, defaultCountry, labels, className }: AssistantVisualBlockProps) {\n const l = useLabels(assistantVisualBlockLabels, labels)\n const provider = useLocale()\n const loc = locale ?? provider.locale\n const titleId = useId()\n const cls = ['ty-visual-block', className].filter(Boolean).join(' ')\n\n if (envelope.type === 'flow') {\n return (\n <figure className={cls} data-type=\"flow\" aria-labelledby={titleId}>\n <figcaption className=\"ty-visual-block__flow\">\n <Workflow className=\"ty-visual-block__flow-icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-visual-block__flow-text\">\n <span className=\"ty-visual-block__flow-kind\">{l.flow}</span>\n <span id={titleId} className=\"ty-visual-block__title\" dir=\"auto\">\n {envelope.title}\n </span>\n </span>\n {onOpen ? (\n <Button variant=\"secondary\" size=\"compact\" onPress={onOpen}>\n {fill(l.open, { title: envelope.title }, loc)}\n </Button>\n ) : null}\n </figcaption>\n </figure>\n )\n }\n\n const spec = envelopeToReport(envelope, defaultCountry ? { defaultCountry } : {})\n return (\n <figure className={cls} data-type={envelope.type} aria-labelledby={titleId}>\n <figcaption id={titleId} className=\"ty-visually-hidden\">\n {envelope.title}\n </figcaption>\n <ReportView spec={spec} locale={loc} {...(currency ? { currency } : {})} headingLevel={3} />\n </figure>\n )\n}\n","// AssistantConversation: the dialogue surface over useAssistantSession. The log\n// is a polite live region marked busy while a turn streams, so a completed\n// turn is read once instead of every delta; failures go to an assertive\n// region. The composer stays editable while the assistant answers.\n\nimport { useEffect, useLayoutEffect, useRef, useState, type FormEvent, type KeyboardEvent, type ReactNode, type Ref } from 'react'\nimport { CircleCheck, CircleX, LoaderCircle, PanelRight, RotateCcw, SendHorizontal, Square } from 'lucide-react'\nimport { Label, TextArea, TextField } from 'react-aria-components'\nimport { Button, Skeleton } from '../../index'\nimport { defineLabels, fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { AssistantVisualBlock } from './AssistantVisualBlock'\nimport { MarkdownView } from './MarkdownView'\nimport type { AssistantSession, Block, Utterance } from './useAssistantSession'\n\nexport interface AssistantLabels {\n log: string\n you: string\n assistant: string\n thinking: string\n composer: string\n placeholder: string\n send: string\n stop: string\n retry: string\n openCanvas: string\n emptyTitle: string\n emptyHint: string\n suggestions: string\n loading: string\n reasoning: string\n toolRunning: string\n toolSucceeded: string\n toolFailed: string\n turnFailed: string\n // ConversationShell\n history: string\n newConversation: string\n favouritesOnly: string\n favourite: string\n delete: string\n deleteTitle: string\n deleteMessage: string\n confirmDelete: string\n cancel: string\n historyEmpty: string\n noResults: string\n today: string\n yesterday: string\n lastWeek: string\n older: string\n moreAgents: string\n liveCanvas: string\n closeCanvas: string\n openHistory: string\n flowId: string\n canvasUnavailable: string\n}\n\nexport const assistantLabels = defineLabels<AssistantLabels>('Assistant', {\n en: {\n log: 'Conversation',\n you: 'You',\n assistant: 'Assistant',\n thinking: 'Thinking',\n composer: 'Message to the assistant',\n placeholder: 'Ask about your research',\n send: 'Send',\n stop: 'Stop',\n retry: 'Try again',\n openCanvas: 'Open canvas',\n emptyTitle: 'Ask the research assistant',\n emptyHint: 'It can read your records, run analyses and build flows. Start from a suggestion or write your own question.',\n suggestions: 'Suggestions',\n loading: 'Loading the conversation',\n reasoning: 'Reasoning',\n toolRunning: '{tool}: running',\n toolSucceeded: '{tool}: done',\n toolFailed: '{tool}: failed',\n turnFailed: 'The assistant could not answer: {message}',\n history: 'Conversation history',\n newConversation: 'New conversation',\n favouritesOnly: 'Favourites only',\n favourite: 'Favourite {title}',\n delete: 'Delete {title}',\n deleteTitle: 'Delete “{title}”?',\n deleteMessage: 'The conversation and its messages will be removed.',\n confirmDelete: 'Delete',\n cancel: 'Cancel',\n historyEmpty: 'No conversations yet.',\n noResults: 'No conversation matches this filter.',\n today: 'Today',\n yesterday: 'Yesterday',\n lastWeek: 'Last 7 days',\n older: 'Older',\n moreAgents: '+{n, number}',\n liveCanvas: 'Live canvas',\n closeCanvas: 'Close canvas',\n openHistory: 'Conversations',\n flowId: 'Flow {id}',\n canvasUnavailable: 'The canvas preview is not available here.',\n },\n 'pt-BR': {\n log: 'Conversa',\n you: 'Você',\n assistant: 'Assistente',\n thinking: 'Pensando',\n composer: 'Mensagem para o assistente',\n placeholder: 'Pergunte sobre a sua pesquisa',\n send: 'Enviar',\n stop: 'Parar',\n retry: 'Tentar de novo',\n openCanvas: 'Abrir canvas',\n emptyTitle: 'Pergunte ao assistente de pesquisa',\n emptyHint: 'Ele lê os registros, executa análises e monta fluxos. Comece por uma sugestão ou escreva a sua pergunta.',\n suggestions: 'Sugestões',\n loading: 'Carregando a conversa',\n reasoning: 'Raciocínio',\n toolRunning: '{tool}: em execução',\n toolSucceeded: '{tool}: concluída',\n toolFailed: '{tool}: falhou',\n turnFailed: 'O assistente não conseguiu responder: {message}',\n history: 'Histórico de conversas',\n newConversation: 'Nova conversa',\n favouritesOnly: 'Só favoritas',\n favourite: 'Favoritar {title}',\n delete: 'Excluir {title}',\n deleteTitle: 'Excluir “{title}”?',\n deleteMessage: 'A conversa e as mensagens serão removidas.',\n confirmDelete: 'Excluir',\n cancel: 'Cancelar',\n historyEmpty: 'Ainda não há conversas.',\n noResults: 'Nenhuma conversa com esse filtro.',\n today: 'Hoje',\n yesterday: 'Ontem',\n lastWeek: 'Últimos 7 dias',\n older: 'Anteriores',\n moreAgents: '+{n, number}',\n liveCanvas: 'Canvas ao vivo',\n closeCanvas: 'Fechar canvas',\n openHistory: 'Conversas',\n flowId: 'Fluxo {id}',\n canvasUnavailable: 'A prévia do canvas não está disponível aqui.',\n },\n es: {\n log: 'Conversación',\n you: 'Tú',\n assistant: 'Asistente',\n thinking: 'Pensando',\n composer: 'Mensaje para el asistente',\n placeholder: 'Pregunta sobre tu investigación',\n send: 'Enviar',\n stop: 'Detener',\n retry: 'Intentar de nuevo',\n openCanvas: 'Abrir lienzo',\n emptyTitle: 'Pregunta al asistente de investigación',\n emptyHint: 'Lee los registros, ejecuta análisis y arma flujos. Empieza por una sugerencia o escribe tu pregunta.',\n suggestions: 'Sugerencias',\n loading: 'Cargando la conversación',\n reasoning: 'Razonamiento',\n toolRunning: '{tool}: en curso',\n toolSucceeded: '{tool}: listo',\n toolFailed: '{tool}: falló',\n turnFailed: 'El asistente no pudo responder: {message}',\n history: 'Historial de conversaciones',\n newConversation: 'Nueva conversación',\n favouritesOnly: 'Solo favoritas',\n favourite: 'Marcar {title} como favorita',\n delete: 'Eliminar {title}',\n deleteTitle: '¿Eliminar «{title}»?',\n deleteMessage: 'Se eliminarán la conversación y sus mensajes.',\n confirmDelete: 'Eliminar',\n cancel: 'Cancelar',\n historyEmpty: 'Todavía no hay conversaciones.',\n noResults: 'Ninguna conversación coincide con este filtro.',\n today: 'Hoy',\n yesterday: 'Ayer',\n lastWeek: 'Últimos 7 días',\n older: 'Anteriores',\n moreAgents: '+{n, number}',\n liveCanvas: 'Lienzo en vivo',\n closeCanvas: 'Cerrar lienzo',\n openHistory: 'Conversaciones',\n flowId: 'Flujo {id}',\n canvasUnavailable: 'La vista previa del lienzo no está disponible aquí.',\n },\n})\n\nexport const defaultAssistantLabels: AssistantLabels = assistantLabels.bundles.en\n\nexport interface AssistantConversationProps {\n session: AssistantSession\n labels?: Partial<AssistantLabels>\n suggestions?: string[]\n variant?: 'panel' | 'full'\n appMark?: ReactNode\n onOpenCanvas?: () => void\n canOpenCanvas?: boolean\n /** Number formatting of visual answers. */\n locale?: string\n currency?: string\n composerRef?: Ref<HTMLTextAreaElement>\n className?: string\n}\n\nconst NEAR_BOTTOM = 96\n\nexport function AssistantConversation(props: AssistantConversationProps) {\n const { session, suggestions = [], variant = 'panel', appMark, onOpenCanvas, canOpenCanvas = false, locale, currency, composerRef, className } = props\n const l = useLabels(assistantLabels, props.labels)\n const { locale: providerLocale } = useFlowLocale()\n const loc = locale ?? providerLocale\n const logRef = useRef<HTMLDivElement>(null)\n const nearBottom = useRef(true)\n const [alert, setAlert] = useState('')\n const announcedFailure = useRef<string | null>(null)\n\n const last = session.utterances[session.utterances.length - 1]\n useEffect(() => {\n if (last?.phase === 'broken' && announcedFailure.current !== last.key) {\n announcedFailure.current = last.key\n setAlert(fill(l.turnFailed, { message: last.problem ?? '' }, loc))\n }\n }, [last, l.turnFailed, loc])\n\n useLayoutEffect(() => {\n const el = logRef.current\n if (el && nearBottom.current) el.scrollTop = el.scrollHeight\n }, [session.utterances])\n\n const onScroll = () => {\n const el = logRef.current\n if (el) nearBottom.current = el.scrollHeight - el.scrollTop - el.clientHeight < NEAR_BOTTOM\n }\n\n const submit = (e?: FormEvent) => {\n e?.preventDefault()\n if (session.working) return\n session.ask()\n }\n\n const onComposerKey = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key !== 'Enter' || e.shiftKey || e.nativeEvent.isComposing) return\n e.preventDefault()\n submit()\n }\n\n const empty = !session.loadingHistory && session.utterances.length === 0\n\n return (\n <section className={['ty-chat', className].filter(Boolean).join(' ')} data-variant={variant} aria-label={l.log}>\n {session.loadingHistory ? (\n <div className=\"ty-chat__loading\" role=\"status\" aria-busy=\"true\">\n <span className=\"ty-visually-hidden\">{l.loading}</span>\n {[0, 1, 2].map((i) => (\n <div key={i} className=\"ty-chat__ghost\" data-align={i % 2 ? 'end' : 'start'} aria-hidden=\"true\">\n <Skeleton shape=\"rect\" width={i % 2 ? 'medium' : 'long'} />\n </div>\n ))}\n </div>\n ) : empty ? (\n <div className=\"ty-chat__empty\">\n {appMark ? (\n <div className=\"ty-chat__mark\" aria-hidden=\"true\">\n {appMark}\n </div>\n ) : null}\n <h2 className=\"ty-chat__empty-title\">{l.emptyTitle}</h2>\n <p className=\"ty-chat__empty-hint\">{l.emptyHint}</p>\n {suggestions.length ? (\n <ul className=\"ty-chat__suggestions\" aria-label={l.suggestions}>\n {suggestions.map((s) => (\n <li key={s}>\n <Button variant=\"secondary\" size=\"compact\" shape=\"pill\" onPress={() => session.ask(s)}>\n <span dir=\"auto\">{s}</span>\n </Button>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n ) : null}\n <div\n ref={logRef}\n className=\"ty-chat__log\"\n role=\"log\"\n aria-live=\"polite\"\n aria-label={l.log}\n aria-busy={session.working || undefined}\n hidden={empty || session.loadingHistory}\n tabIndex={-1}\n onScroll={onScroll}\n >\n {session.utterances.map((m, i) => (\n <Bubble key={m.key} utterance={m} l={l} loc={loc} currency={currency} isLast={i === session.utterances.length - 1} session={session} onOpenCanvas={onOpenCanvas} />\n ))}\n </div>\n <div className=\"ty-visually-hidden\" role=\"alert\">\n {alert}\n </div>\n <form className=\"ty-chat__composer\" onSubmit={submit}>\n <TextField className=\"ty-chat__field\" value={session.draft} onChange={session.setDraft}>\n <Label className=\"ty-visually-hidden\">\n {l.composer}\n </Label>\n <TextArea ref={composerRef} className=\"ty-chat__input\" rows={2} placeholder={l.placeholder} dir=\"auto\" data-ty-composer=\"\" onKeyDown={onComposerKey} />\n </TextField>\n <div className=\"ty-chat__actions\">\n {canOpenCanvas && onOpenCanvas ? (\n <Button variant=\"quiet\" size=\"compact\" leadingIcon={<PanelRight />} onPress={onOpenCanvas}>\n {l.openCanvas}\n </Button>\n ) : null}\n {session.working ? (\n <Button variant=\"secondary\" iconOnly accessibleLabel={l.stop} leadingIcon={<Square />} onPress={session.halt} />\n ) : (\n <Button className=\"ty-chat__send\" variant=\"primary\" iconOnly accessibleLabel={l.send} leadingIcon={<SendHorizontal />} type=\"submit\" disabled={!session.draft.trim()} />\n )}\n </div>\n </form>\n </section>\n )\n}\n\nfunction Bubble({ utterance, l, loc, currency, isLast, session, onOpenCanvas }: { utterance: Utterance; l: AssistantLabels; loc: string; currency: string | undefined; isLast: boolean; session: AssistantSession; onOpenCanvas: (() => void) | undefined }) {\n const user = utterance.speaker === 'person'\n return (\n <div className=\"ty-chat__message\" data-speaker={utterance.speaker} data-align={user ? 'end' : 'start'} data-phase={utterance.phase}>\n <span className=\"ty-visually-hidden\">{user ? l.you : l.assistant}</span>\n <div className=\"ty-chat__bubble\" dir=\"auto\">\n {utterance.phase === 'waiting' && !utterance.blocks.length ? (\n <p className=\"ty-chat__thinking\">\n {l.thinking}\n <span className=\"ty-chat__dots\" aria-hidden=\"true\">\n <span />\n <span />\n <span />\n </span>\n </p>\n ) : null}\n {utterance.blocks.map((p, i) => (\n <BlockView key={i} block={p} user={user} l={l} loc={loc} currency={currency} onOpenCanvas={onOpenCanvas} />\n ))}\n {utterance.phase === 'broken' ? (\n <div className=\"ty-chat__failure\">\n <p className=\"ty-chat__error\">\n <CircleX aria-hidden=\"true\" focusable=\"false\" />\n <span>{utterance.problem}</span>\n </p>\n {isLast && session.canAskAgain ? (\n <Button variant=\"secondary\" size=\"compact\" leadingIcon={<RotateCcw />} onPress={session.askAgain}>\n {l.retry}\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n </div>\n )\n}\n\n/** Icon, label key and CSS state of a tool call in each phase. */\nconst TOOL_LOOK = {\n working: { icon: LoaderCircle, label: 'toolRunning', state: 'running' },\n ok: { icon: CircleCheck, label: 'toolSucceeded', state: 'succeeded' },\n broken: { icon: CircleX, label: 'toolFailed', state: 'failed' },\n} as const\n\nfunction BlockView({ block, user, l, loc, currency, onOpenCanvas }: { block: Block; user: boolean; l: AssistantLabels; loc: string; currency: string | undefined; onOpenCanvas: (() => void) | undefined }) {\n const kind = block.kind\n if (kind === 'prose') return user ? <p className=\"ty-chat__plain\">{block.body}</p> : <MarkdownView source={block.body} />\n if (kind === 'thinking')\n return (\n <details className=\"ty-chat__reasoning\">\n <summary>{l.reasoning}</summary>\n <p>{block.body}</p>\n </details>\n )\n if (kind === 'figure') return <AssistantVisualBlock envelope={block.envelope} locale={loc} {...(currency ? { currency } : {})} {...(onOpenCanvas ? { onOpen: onOpenCanvas } : {})} />\n const look = TOOL_LOOK[block.phase]\n const Icon = look.icon\n return (\n <p className=\"ty-chat__tool\" data-state={look.state}>\n <Icon className=\"ty-chat__tool-icon\" aria-hidden=\"true\" focusable=\"false\" />\n <span className=\"ty-chat__tool-name\">{fill(l[look.label], { tool: block.tool }, loc)}</span>\n {block.note ? <span className=\"ty-chat__tool-summary\">{block.note}</span> : null}\n </p>\n )\n}\n","// Day buckets for the conversation history: today, yesterday, the seven days\n// before, older. Days are calendar days in a time zone (the device's unless\n// one is given), so \"yesterday\" changes at local midnight.\n\nexport type DayBucket = 'today' | 'yesterday' | 'lastWeek' | 'older'\n\nconst MS_PER_DAY = 86_400_000\n\n/** Whole days since the epoch of the calendar date `instant` falls on in `zone`. */\nexport function dayNumber(instant: Date, zone?: string): number {\n const parts = new Intl.DateTimeFormat('en-CA', { timeZone: zone, year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(instant)\n const pick = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((p) => p.type === type)?.value ?? NaN)\n return Math.floor(Date.UTC(pick('year'), pick('month') - 1, pick('day')) / MS_PER_DAY)\n}\n\n/** Upper age limit (in days) of each bucket, in display order. */\nconst LIMITS: ReadonlyArray<readonly [DayBucket, number]> = [\n ['today', 0],\n ['yesterday', 1],\n ['lastWeek', 7],\n ['older', Number.POSITIVE_INFINITY],\n]\n\nfunction bucketFor(age: number): DayBucket {\n for (const [bucket, limit] of LIMITS) if (age <= limit) return bucket\n return 'older'\n}\n\n/**\n * Groups threads by day bucket. An unreadable date counts as older; empty\n * buckets are left out; the given order is kept inside a bucket.\n */\nexport function groupThreadsByDay<T extends { updatedAt: string | number | Date }>(threads: readonly T[], now: Date = new Date(), zone?: string): Array<{ bucket: DayBucket; threads: T[] }> {\n const today = dayNumber(now, zone)\n const found = new Map<DayBucket, T[]>()\n for (const t of threads) {\n const when = new Date(t.updatedAt)\n const bucket = Number.isNaN(when.getTime()) ? 'older' : bucketFor(today - dayNumber(when, zone))\n const list = found.get(bucket) ?? []\n list.push(t)\n found.set(bucket, list)\n }\n return LIMITS.flatMap(([bucket]) => (found.has(bucket) ? [{ bucket, threads: found.get(bucket)! }] : []))\n}\n","// Past threads, as a navigation landmark: a start button, a \"starred only\"\n// toggle, then shelves of threads by calendar day. Every entry keeps its star\n// and remove controls visible (never hover-only) so keyboard and touch reach\n// them.\n\nimport type { ReactNode } from 'react'\nimport { MessageSquarePlus, Star, Trash2 } from 'lucide-react'\nimport { ToggleButton } from 'react-aria-components'\nimport { Button } from '../../index'\nimport { fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { assistantLabels, type AssistantLabels } from './AssistantConversation'\nimport { groupThreadsByDay, type DayBucket } from './threadDays'\n\nexport interface ThreadSummary {\n id: string\n title: string\n updatedAt: string | number | Date\n agents?: string[]\n flowId?: string\n flowName?: string\n}\n\n/** Host persistence for starred threads. */\nexport interface StarredThreads {\n ids: string[]\n onChange: (ids: string[]) => void\n}\n\nconst PIN_KEY = 'ty-assistant-favourites'\n\nfunction readPins(): string[] {\n const raw = window.localStorage.getItem(PIN_KEY)\n const parsed: unknown = raw ? JSON.parse(raw) : []\n return Array.isArray(parsed) ? parsed.filter((x): x is string => typeof x === 'string') : []\n}\n\n/** Stars kept in this browser when the host keeps none. Any storage error is swallowed. */\nexport const deviceStarStore = {\n load: (): string[] => {\n try {\n return readPins()\n } catch {\n return []\n }\n },\n save: (ids: string[]): void => {\n try {\n window.localStorage.setItem(PIN_KEY, JSON.stringify(ids))\n } catch {\n /* stars then live only as long as the page */\n }\n },\n}\n\nconst SHOWN_AGENTS = 3\n\n/** Short id, the first agents and a \"+n\" for the rest. */\nexport function ThreadMetaLine({ id, agents = [], labels }: { id: string; agents?: string[]; labels?: Partial<AssistantLabels> }) {\n const words = useLabels(assistantLabels, labels)\n const { locale } = useFlowLocale()\n const [visible, hidden] = [agents.slice(0, SHOWN_AGENTS), Math.max(0, agents.length - SHOWN_AGENTS)]\n return (\n <span className=\"ty-convo-meta\">\n <code className=\"ty-convo-meta__id\" title={id}>\n {id.slice(0, 8)}\n </code>\n {visible.map((name) => (\n <span key={name} className=\"ty-convo-meta__agent\" dir=\"auto\">\n {name}\n </span>\n ))}\n {hidden ? <span className=\"ty-convo-meta__more\">{fill(words.moreAgents, { n: hidden }, locale)}</span> : null}\n </span>\n )\n}\n\nexport interface ThreadHistoryProps {\n threads: readonly ThreadSummary[]\n currentId: string | null\n starred: readonly string[]\n starredOnly: boolean\n zone?: string\n labels: AssistantLabels\n locale: string\n onStarredOnly: (on: boolean) => void\n onStar: (id: string, on: boolean) => void\n onOpen: (id: string) => void\n onRemove: (thread: ThreadSummary) => void\n onStart: () => void\n}\n\ntype Shelf = readonly [key: DayBucket, caption: string, entries: readonly ThreadSummary[]]\n\n/** Shelves to draw, or the sentence to show instead of them. */\nfunction arrange(p: ThreadHistoryProps): Shelf[] | string {\n if (!p.threads.length) return p.labels.historyEmpty\n const kept = p.starredOnly ? p.threads.filter((t) => p.starred.includes(t.id)) : [...p.threads]\n if (!kept.length) return p.labels.noResults\n return groupThreadsByDay(kept, new Date(), p.zone).map(({ bucket, threads }) => [bucket, p.labels[bucket], threads] as const)\n}\n\n/** The three parts of an entry, drawn in this order. */\nconst ENTRY_PARTS: ReadonlyArray<(t: ThreadSummary, p: ThreadHistoryProps) => ReactNode> = [\n (t, p) => (\n <button key=\"open\" type=\"button\" className=\"ty-convo-row__main\" aria-current={t.id === p.currentId ? 'page' : undefined} title={t.title} onClick={() => p.onOpen(t.id)}>\n <span className=\"ty-convo-row__title\" dir=\"auto\">\n {t.title}\n </span>\n <ThreadMetaLine id={t.id} {...(t.agents ? { agents: t.agents } : {})} labels={p.labels} />\n </button>\n ),\n (t, p) => (\n <ToggleButton key=\"star\" className=\"ty-convo-row__fav\" aria-label={fill(p.labels.favourite, { title: t.title }, p.locale)} isSelected={p.starred.includes(t.id)} onChange={(on) => p.onStar(t.id, on)}>\n <Star aria-hidden=\"true\" focusable=\"false\" />\n </ToggleButton>\n ),\n (t, p) => <Button key=\"remove\" variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={fill(p.labels.delete, { title: t.title }, p.locale)} leadingIcon={<Trash2 />} onPress={() => p.onRemove(t)} />,\n]\n\nfunction ShelfBlock({ shelf, p }: { shelf: Shelf; p: ThreadHistoryProps }) {\n const [key, caption, entries] = shelf\n const captionId = `ty-convo-group-${key}`\n return (\n <section className=\"ty-convo-history__group\" aria-labelledby={captionId}>\n <h3 id={captionId} className=\"ty-convo-history__group-title\">\n {caption}\n </h3>\n <ul className=\"ty-convo-history__list\">\n {entries.map((t) => (\n <li key={t.id} className=\"ty-convo-row\" data-active={t.id === p.currentId || undefined}>\n {ENTRY_PARTS.map((draw) => draw(t, p))}\n </li>\n ))}\n </ul>\n </section>\n )\n}\n\nexport function ThreadHistory(props: ThreadHistoryProps) {\n const words = props.labels\n const layout = arrange(props)\n return (\n <nav className=\"ty-convo-history\" aria-label={words.history}>\n <div className=\"ty-convo-history__tools\">\n <Button variant=\"secondary\" size=\"compact\" leadingIcon={<MessageSquarePlus />} onPress={props.onStart}>\n {words.newConversation}\n </Button>\n <ToggleButton className=\"ty-convo-toggle\" isSelected={props.starredOnly} onChange={props.onStarredOnly}>\n <Star aria-hidden=\"true\" focusable=\"false\" />\n <span>{words.favouritesOnly}</span>\n </ToggleButton>\n </div>\n {typeof layout === 'string' ? <p className=\"ty-convo-history__empty\">{layout}</p> : layout.map((shelf) => <ShelfBlock key={shelf[0]} shelf={shelf} p={props} />)}\n </nav>\n )\n}\n","// The live canvas beside the dialogue: the newest flow the assistant built or\n// opened. A complementary landmark on wide screens, a full-screen drawer on\n// narrow ones. The body is the host's editor mount, or a read-only preview.\n\nimport type { ReactNode } from 'react'\nimport { X } from 'lucide-react'\nimport { Button, Drawer } from '../../index'\nimport { FlowPreview } from '../editor/FlowPreview'\nimport { fill } from '../internal/labels'\nimport type { FlowConnector, FlowNode } from '../model/types'\nimport type { AssistantLabels } from './AssistantConversation'\nimport type { FlowArtifact } from './useAssistantSession'\n\nfunction previewGraph(graph: Record<string, unknown>): { nodes: FlowNode[]; connectors: FlowConnector[] } {\n const nodes = Array.isArray(graph.nodes) ? (graph.nodes as FlowNode[]) : []\n const connectors = Array.isArray(graph.connectors) ? (graph.connectors as FlowConnector[]) : Array.isArray(graph.edges) ? (graph.edges as FlowConnector[]) : []\n return { nodes, connectors }\n}\n\nexport interface LiveCanvasPanelProps {\n artifact: FlowArtifact\n docked: boolean\n labels: AssistantLabels\n locale: string\n render?: (artifact: FlowArtifact) => ReactNode\n onClose: () => void\n}\n\nexport function LiveCanvasPanel({ artifact, docked, labels: l, locale, render, onClose }: LiveCanvasPanelProps) {\n const body = <div className=\"ty-convo-canvas__body\">{render ? render(artifact) : <FlowPreview graph={previewGraph(artifact.graph)} />}</div>\n if (!docked) {\n return (\n <Drawer open onOpenChange={(open) => (open ? undefined : onClose())} title={l.liveCanvas} placement=\"bottom\" maxHeight=\"100dvh\">\n {body}\n </Drawer>\n )\n }\n return (\n <aside className=\"ty-convo-canvas\" aria-label={l.liveCanvas}>\n <header className=\"ty-convo-canvas__header\">\n <h2 className=\"ty-convo-canvas__title\">{l.liveCanvas}</h2>\n {artifact.flowId ? (\n <code className=\"ty-convo-canvas__id\" title={artifact.flowId}>\n {fill(l.flowId, { id: artifact.flowId.slice(0, 8) }, locale)}\n </code>\n ) : null}\n <Button variant=\"quiet\" size=\"compact\" shape=\"circle\" iconOnly accessibleLabel={l.closeCanvas} leadingIcon={<X />} onPress={onClose} />\n </header>\n {body}\n </aside>\n )\n}\n","// ConversationShell: the assistant's full-screen workspace, assembled from\n// three regions: the thread history (inline start), the dialogue (centre) and\n// the live canvas (inline end) when the assistant produced or opened a flow.\n// Below the small breakpoint the history lives in a drawer; below the medium\n// one the canvas does.\n\nimport { useMemo, useReducer, useRef, type ReactNode } from 'react'\nimport { History } from 'lucide-react'\nimport { Button, Drawer, useMediaQuery } from '../../index'\nimport { useConfirm, type ConfirmFn } from '../internal/confirm'\nimport { fill, useFlowLocale, useLabels } from '../internal/labels'\nimport { AssistantConversation, assistantLabels, type AssistantLabels } from './AssistantConversation'\nimport { LiveCanvasPanel } from './LiveCanvasPanel'\nimport { deviceStarStore, ThreadHistory, type StarredThreads, type ThreadSummary } from './ThreadHistory'\nimport { newestFlowArtifact, type AssistantSession, type FlowArtifact } from './useAssistantSession'\n\nexport interface ConversationShellProps {\n session: AssistantSession\n threads: ThreadSummary[]\n onOpenThread: (id: string) => void\n onRemoveThread: (id: string) => Promise<void> | void\n onStartThread: () => void\n labels?: Partial<AssistantLabels>\n suggestions?: string[]\n /** Mounts the real editor for a flow artifact; a read-only preview otherwise. */\n renderCanvas?: (artifact: FlowArtifact) => ReactNode\n banner?: ReactNode\n appMark?: ReactNode\n starred?: StarredThreads\n /** Time zone of the day groups (the device's by default). */\n timeZone?: string\n /** Confirmation service (the nearest ConfirmProvider by default). */\n confirm?: ConfirmFn\n locale?: string\n currency?: string\n className?: string\n}\n\ninterface Workspace {\n starredOnly: boolean\n historyDrawer: boolean\n localStars: string[]\n /** Artifact the person closed; a newer one opens the canvas again. */\n dismissed: string | null\n}\n\ntype WorkspaceMove = { set: Partial<Workspace> }\n\nconst workspaceReducer = (w: Workspace, m: WorkspaceMove): Workspace => ({ ...w, ...m.set })\n\nexport function ConversationShell(props: ConversationShellProps) {\n const { session, threads, timeZone, currency } = props\n const l = useLabels(assistantLabels, props.labels)\n const fromProvider = useFlowLocale().locale\n const locale = props.locale ?? fromProvider\n const contextConfirm = useConfirm()\n const confirm = props.confirm ?? contextConfirm\n const historyBeside = useMediaQuery('(min-width: 640px)', true)\n const canvasBeside = useMediaQuery('(min-width: 768px)', true)\n const rootRef = useRef<HTMLDivElement>(null)\n const [w, move] = useReducer(workspaceReducer, undefined, (): Workspace => ({ starredOnly: false, historyDrawer: false, localStars: props.starred ? [] : deviceStarStore.load(), dismissed: null }))\n const set = (patch: Partial<Workspace>) => move({ set: patch })\n\n const starredIds = props.starred?.ids ?? w.localStars\n const star = (id: string, on: boolean) => {\n const next = on ? [...starredIds, id] : starredIds.filter((x) => x !== id)\n if (props.starred) {\n props.starred.onChange(next)\n return\n }\n set({ localStars: next })\n deviceStarStore.save(next)\n }\n\n const artifact = useMemo(() => newestFlowArtifact(session.utterances), [session.utterances])\n const canvasOpen = !!artifact && w.dismissed !== artifact.callId\n const closeCanvas = () => {\n if (artifact) set({ dismissed: artifact.callId })\n requestAnimationFrame(() => rootRef.current?.querySelector<HTMLElement>('[data-ty-composer]')?.focus())\n }\n\n const remove = async (t: ThreadSummary) => {\n const ok = await confirm({ title: fill(l.deleteTitle, { title: t.title }, locale), message: l.deleteMessage, confirmLabel: l.confirmDelete, cancelLabel: l.cancel, tone: 'danger' })\n if (ok) await props.onRemoveThread(t.id)\n }\n\n const history = (\n <ThreadHistory\n threads={threads}\n currentId={session.threadId}\n starred={starredIds}\n starredOnly={w.starredOnly}\n {...(timeZone ? { zone: timeZone } : {})}\n labels={l}\n locale={locale}\n onStarredOnly={(on) => set({ starredOnly: on })}\n onStar={star}\n onOpen={(id) => {\n props.onOpenThread(id)\n set({ historyDrawer: false })\n }}\n onRemove={(t) => void remove(t)}\n onStart={props.onStartThread}\n />\n )\n\n const regions: Array<{ key: string; node: ReactNode }> = [\n {\n key: 'history',\n node: historyBeside ? (\n history\n ) : (\n <Drawer open={w.historyDrawer} onOpenChange={(open) => set({ historyDrawer: open })} title={l.history} placement=\"bottom\">\n {history}\n </Drawer>\n ),\n },\n {\n key: 'centre',\n node: (\n <div className=\"ty-convo-shell__centre\">\n {historyBeside ? null : (\n <div className=\"ty-convo-shell__bar\">\n <Button variant=\"secondary\" size=\"compact\" leadingIcon={<History />} onPress={() => set({ historyDrawer: true })}>\n {l.openHistory}\n </Button>\n </div>\n )}\n {props.banner ? <div className=\"ty-convo-shell__banner\">{props.banner}</div> : null}\n <AssistantConversation\n session={session}\n labels={l}\n variant=\"full\"\n {...(props.suggestions ? { suggestions: props.suggestions } : {})}\n {...(props.appMark ? { appMark: props.appMark } : {})}\n canOpenCanvas={!!artifact && !canvasOpen}\n onOpenCanvas={() => set({ dismissed: null })}\n locale={locale}\n {...(currency ? { currency } : {})}\n />\n </div>\n ),\n },\n {\n key: 'canvas',\n node: artifact && canvasOpen ? <LiveCanvasPanel artifact={artifact} docked={canvasBeside} labels={l} locale={locale} {...(props.renderCanvas ? { render: props.renderCanvas } : {})} onClose={closeCanvas} /> : null,\n },\n ]\n\n return (\n <div ref={rootRef} className={['ty-convo-shell', props.className].filter(Boolean).join(' ')} data-canvas={canvasOpen && canvasBeside ? 'open' : undefined}>\n {regions.map((r) => (r.node ? <RegionSlot key={r.key}>{r.node}</RegionSlot> : null))}\n </div>\n )\n}\n\n/** Keeps each region's element as a direct child of the shell grid. */\nfunction RegionSlot({ children }: { children: ReactNode }) {\n return <>{children}</>\n}\n"],"mappings":";;;;;;;;;AAkFA,MAAa,kBAA4B,OAAO,OAAO;CAAE,GAAG;CAAG,GAAG;CAAG,MAAM;AAAE,CAAC;;;ACrE9E,SAAS,UA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