@uipath/case-tool 1.204.0 → 1.205.0-preview.258

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.
Files changed (135) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +24 -11
  2. package/dist/{authoring-6ckkzfc9.js → authoring-kqh34zzm.js} +49 -30
  3. package/dist/{business-rule-export-kg5bk8aw.js → business-rule-export-ey588rv7.js} +2 -2
  4. package/dist/canvas-notes-86fxx1t8.js +19 -0
  5. package/dist/{case-api-rvamfn02.js → case-api-sme7esce.js} +6 -6
  6. package/dist/case-bindings-service-cht20gqt.js +430 -0
  7. package/dist/case-debug-solution-projects-h3w2nx0a.js +34 -0
  8. package/dist/{case-debug-studio-web-service-xxfesw4v.js → case-debug-studio-web-service-3mkrtaet.js} +16 -10
  9. package/dist/{case-described-io-service-14hdnqcc.js → case-described-io-service-dx1f4nxe.js} +37 -11
  10. package/dist/case-event-trigger-bindings-g9ftnm4x.js +16 -0
  11. package/dist/{case-format-service-yb48785t.js → case-format-service-6aew6tqc.js} +2 -2
  12. package/dist/{case-pack-service-9185h6ez.js → case-pack-service-pqq8wnfd.js} +6 -6
  13. package/dist/case-schema-version-h820ne16.js +20 -0
  14. package/dist/{case-shape-reader-mw58avr0.js → case-shape-reader-dsbraetf.js} +1 -1
  15. package/dist/{case-splice-service-tkmb7xjp.js → case-splice-service-s5gccctq.js} +53 -8
  16. package/dist/{case-validate-service-c84e2bhv.js → case-validate-service-rey6btew.js} +128 -42
  17. package/dist/{connector-enrichment-service-hfv0kwht.js → connector-enrichment-service-crqs2216.js} +23 -20
  18. package/dist/{connector-lookup-service-whgjceyj.js → connector-lookup-service-dwv8q5eh.js} +6 -6
  19. package/dist/connector-task-shape-mpazkf7s.js +14 -0
  20. package/dist/{connector-task-spec-k0cwavrm.js → connector-task-spec-trs4tcb3.js} +196 -40
  21. package/dist/{de-MUJPA4EB-dpg7t2rw.js → de-UZI7FJDO-mwvc4cxe.js} +29 -2
  22. package/dist/{de-FGHEJRCI-rv513mfh.js → de-WLW6KWOJ-2qnsqdtw.js} +238 -31
  23. package/dist/{debug-service-ch3v6jmm.js → debug-service-7q98j726.js} +3 -3
  24. package/dist/{embedded-file-reader-v8c2yj2a.js → embedded-file-reader-r66242ey.js} +2 -2
  25. package/dist/{en-FBPVNKFN-dqt573xn.js → en-EJCBA3LK-dtpdghgj.js} +12 -4
  26. package/dist/{en-BWGKA5OE-1qkvb9rn.js → en-M7GQYBV2-5nfmpnfz.js} +88 -6
  27. package/dist/{enrichment-service-3f1kygjs.js → enrichment-service-hv7ff88p.js} +56 -12
  28. package/dist/{es-7SE7HX2X-8yh1aj2y.js → es-4UBUTCQA-m1ytpyx2.js} +29 -2
  29. package/dist/{es-KR3ZSNMP-84zphx0x.js → es-5THCNRFN-tqwyrdgy.js} +235 -28
  30. package/dist/{es-MX-2MYFZU7X-3rek4r73.js → es-MX-5RELIXKI-9jhqtddc.js} +29 -2
  31. package/dist/{es-MX-XXZJGC4R-2mr8jtgm.js → es-MX-TWZBRAXK-gqd9swzw.js} +237 -30
  32. package/dist/filter-engine-7ep90g7f.js +11 -0
  33. package/dist/{fr-Y6NPVODW-8vr1ja4b.js → fr-CERONSRC-edpxhbmb.js} +237 -30
  34. package/dist/{fr-MDFKNZ4C-h4a122k9.js → fr-VBM5WRC2-63z7w4mh.js} +29 -2
  35. package/dist/index-332n0kxj.js +282 -0
  36. package/dist/{index-wmffgzmr.js → index-5dxh9z60.js} +21751 -11098
  37. package/dist/{index-aw2gqqat.js → index-a2fvrrth.js} +4 -4
  38. package/dist/{index-4yanx3rn.js → index-ekwtgx7y.js} +1089 -218
  39. package/dist/{index-ng2f77my.js → index-fyc0k5dd.js} +985 -617
  40. package/dist/index-n9qvnx4x.js +29 -0
  41. package/dist/{index-hhsf00x8.js → index-ngs0a2he.js} +1 -1
  42. package/dist/{index-j2r3jb6c.js → index-xq6ajhgq.js} +2 -2
  43. package/dist/index.js +12 -12
  44. package/dist/init-entry-points-hhpv3e3f.js +98 -0
  45. package/dist/{input-reader-1tcqt27f.js → input-reader-c7wz8ra2.js} +3 -3
  46. package/dist/{ja-UTQEAP34-8e0q6swp.js → ja-43QL7CGO-c3q8gre9.js} +29 -2
  47. package/dist/{ja-Q5PXKJ2V-p4msxzjd.js → ja-U2MCNHGT-gz0ap1jk.js} +235 -28
  48. package/dist/{known-types-0h9kqwyy.js → known-types-jvkdgmzz.js} +5 -4
  49. package/dist/{ko-AXCHW2OK-askct7f6.js → ko-TLL6Z6CD-wrt3n8a9.js} +29 -2
  50. package/dist/{ko-AYBDSRZG-41mdmsg1.js → ko-XAUYQWDR-zp81gjp4.js} +237 -30
  51. package/dist/localSolutionDiscovery-yyx234ak.js +13 -0
  52. package/dist/migration-diagnosis-ns5cw4e3.js +99 -0
  53. package/dist/{node-strategy-5pz40tee.js → node-strategy-v442hwgd.js} +1 -1
  54. package/dist/node-sync-service-1wkcyn1n.js +57 -0
  55. package/dist/out-target-wjgmna0r.js +111 -0
  56. package/dist/{packager-tool-85q4f3pq.js → packager-tool-1pcmxqny.js} +3 -3
  57. package/dist/{packager-tool-8a9yqfq7.js → packager-tool-1yfw674x.js} +4 -2
  58. package/dist/{packager-tool-pdhhzfr5.js → packager-tool-29x6vran.js} +296 -417
  59. package/dist/packager-tool-2sn7d8fd.js +41 -0
  60. package/dist/packager-tool-4p11fvf4.js +92 -0
  61. package/dist/{packager-tool-25hng8h4.js → packager-tool-4rtktkhv.js} +16211 -13084
  62. package/dist/{packager-tool-yfm83bzd.js → packager-tool-67vy1fz3.js} +4 -3
  63. package/dist/{packager-tool-d88rqwk8.js → packager-tool-6z1hsm2h.js} +13 -5
  64. package/dist/packager-tool-7hw344bt.js +107 -0
  65. package/dist/{packager-tool-3q3d1hk8.js → packager-tool-83v804p7.js} +56 -6
  66. package/dist/{packager-tool-00y70spr.js → packager-tool-87y6xw3a.js} +2 -1
  67. package/dist/packager-tool-93mdeqay.js +18 -0
  68. package/dist/{packager-tool-64rg5ekd.js → packager-tool-9e59z4d6.js} +75 -7
  69. package/dist/{packager-tool-vepqrsse.js → packager-tool-9kf3fqtr.js} +2 -2
  70. package/dist/packager-tool-9kvkzc05.js +74 -0
  71. package/dist/{packager-tool-s6619wtx.js → packager-tool-9sd483vs.js} +2 -2
  72. package/dist/{packager-tool-f78ntj5g.js → packager-tool-9y1w2wds.js} +51 -6
  73. package/dist/packager-tool-a17g0pj1.js +62 -0
  74. package/dist/{packager-tool-167qap9m.js → packager-tool-aagnvyba.js} +845 -38
  75. package/dist/{packager-tool-0p6dbsp0.js → packager-tool-c5q10254.js} +5 -5
  76. package/dist/{packager-tool-wj9d9mqe.js → packager-tool-e15kqpyh.js} +12 -13
  77. package/dist/{packager-tool-c31qx8kc.js → packager-tool-ezds6t5e.js} +2 -2
  78. package/dist/{packager-tool-d3zvghjd.js → packager-tool-f2z2dscy.js} +308 -120
  79. package/dist/{packager-tool-hvzjm2nk.js → packager-tool-f8vwy92w.js} +2093 -5805
  80. package/dist/{packager-tool-rgpdaxbx.js → packager-tool-gx2cer6a.js} +5385 -1098
  81. package/dist/{packager-tool-xdxr3ync.js → packager-tool-hdxtgckw.js} +11 -1
  82. package/dist/{packager-tool-mr149jsw.js → packager-tool-k5cpxdm4.js} +17 -7
  83. package/dist/packager-tool-k6jbedyc.js +69 -0
  84. package/dist/packager-tool-kdhey8gz.js +153 -0
  85. package/dist/{packager-tool-cenvh23g.js → packager-tool-kyrm4e5m.js} +718 -87
  86. package/dist/packager-tool-mqy97y5f.js +52 -0
  87. package/dist/{packager-tool-jfysbxdt.js → packager-tool-mzf4gmph.js} +4 -4
  88. package/dist/packager-tool-n7w9wx62.js +25 -0
  89. package/dist/{packager-tool-7q6z6npd.js → packager-tool-pcvhcn2k.js} +93 -11
  90. package/dist/packager-tool-r0x3qh59.js +307 -0
  91. package/dist/{packager-tool-w1b5pyj6.js → packager-tool-r6b5ktzb.js} +730 -14
  92. package/dist/{packager-tool-zbrda9sn.js → packager-tool-rk25wp3c.js} +1 -1
  93. package/dist/{packager-tool-xcd87qyx.js → packager-tool-v2kcgjbf.js} +2 -3
  94. package/dist/{case-bindings-service-d9vezn69.js → packager-tool-wekqkmgn.js} +20 -231
  95. package/dist/packager-tool-yct6zp4m.js +335 -0
  96. package/dist/{packager-tool-kpqr938m.js → packager-tool-ydyvtknp.js} +26 -3
  97. package/dist/{packager-tool-v99ygh9f.js → packager-tool-yn33pw57.js} +124 -58
  98. package/dist/{packager-tool-4rqd21wc.js → packager-tool-yn7r7zq2.js} +19 -5
  99. package/dist/{packager-tool-cmwets3m.js → packager-tool-zf8f9pmm.js} +1 -1
  100. package/dist/packager-tool.js +3 -3
  101. package/dist/{project-artifacts-rng5m6r2.js → project-artifacts-bgyyb0dm.js} +1 -1
  102. package/dist/{pt-BR-TKHNHMET-sn91xyq0.js → pt-BR-GNQNAAZ2-xadharv4.js} +237 -30
  103. package/dist/{pt-BR-Y6K6XHXK-mp3hwhw1.js → pt-BR-USP2T7GD-pedn77m1.js} +29 -2
  104. package/dist/{pt-3DIO5QWG-59b3f4bc.js → pt-RMIAKZB4-67enhx3m.js} +29 -2
  105. package/dist/{pt-ROXU257Y-2f6bxev4.js → pt-TO2DARY2-ftcce1bv.js} +237 -30
  106. package/dist/{resolved-check-p99hysaw.js → resolved-check-aqw7568y.js} +1 -1
  107. package/dist/{resourcesSyncService-zwjyp1qx.js → resourcesSyncService-d302jnap.js} +32 -170
  108. package/dist/{ro-BWR3ONRR-vzx3hy8a.js → ro-GHOBYW2S-mhnqsgaa.js} +29 -2
  109. package/dist/{ro-AVAWPKOO-b89pw79r.js → ro-WUYJV6OW-a8d9qy1n.js} +235 -28
  110. package/dist/{sdd-convert-service-vf0ps358.js → sdd-convert-service-8jpew7vz.js} +686 -445
  111. package/dist/{sdd-lookup-dwzpvvwn.js → sdd-lookup-fe900sdb.js} +2 -2
  112. package/dist/{sdd-resolve-service-mjqad2nn.js → sdd-resolve-service-qdtmxw9b.js} +38 -13
  113. package/dist/sdd-resolve-siblings-6kfxc2t6.js +53 -0
  114. package/dist/{solution-auth-kddmbm0p.js → solution-auth-30yycqtv.js} +3 -3
  115. package/dist/solution-discovery-g6ksnrg1.js +38 -0
  116. package/dist/{strict-case-rules-tz37bspw.js → strict-case-rules-4tjcaznr.js} +3 -2
  117. package/dist/{strict-entry-points-v14d7y50.js → strict-entry-points-g2pd4mf4.js} +29 -1
  118. package/dist/{strict-sdd-audit-4aqdeh59.js → strict-sdd-audit-q7tb9yj7.js} +7 -5
  119. package/dist/task-type-declaration-7a8fqdvs.js +46 -0
  120. package/dist/tool.js +12 -12
  121. package/dist/{tr-5IIHSFW5-hw4cewew.js → tr-GDTLECMM-k5fhmq13.js} +29 -2
  122. package/dist/{tr-JMIP7ZSL-c39b6pe4.js → tr-M3F5A6AU-bb0tg39m.js} +235 -28
  123. package/dist/{trigger-enrichment-service-g3vt051f.js → trigger-enrichment-service-sj0p2d1j.js} +23 -20
  124. package/dist/trigger-entry-point-id-yhqwnkx9.js +15 -0
  125. package/dist/{zh-CN-IFFXSEJS-9wm9gmrv.js → zh-CN-C5G4PC7C-ds9gkptg.js} +235 -28
  126. package/dist/{zh-CN-R2KU4U5L-tc1hat59.js → zh-CN-I5D7WHBD-sr5h0a98.js} +29 -2
  127. package/dist/{zh-TW-GNKMELBF-j674515r.js → zh-TW-2AVLM723-288pkc1z.js} +29 -2
  128. package/dist/{zh-TW-IYBNYAMG-8727c7v2.js → zh-TW-62HZIG6O-787kdwex.js} +234 -27
  129. package/package.json +2 -2
  130. package/dist/migration-diagnosis-ag2sgd1e.js +0 -71
  131. package/dist/node-sync-service-2tfrgbjs.js +0 -36
  132. package/dist/out-target-jakehnd3.js +0 -70
  133. package/dist/packager-tool-57pzrd0g.js +0 -32
  134. package/dist/packager-tool-dthjwajc.js +0 -13
  135. package/dist/packager-tool-xy04yy0v.js +0 -32
@@ -0,0 +1,307 @@
1
+ import {
2
+ catchError
3
+ } from "./packager-tool-83v804p7.js";
4
+ import {
5
+ __require
6
+ } from "./packager-tool-1yh8g550.js";
7
+
8
+ // src/services/sdd-convert/canvas-note-match.ts
9
+ var SIMILAR = 0.5;
10
+ var UNSPACED = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+/gu;
11
+ var words = (text) => {
12
+ const lower = text.toLowerCase();
13
+ const tokens = new Set(lower.replace(UNSPACED, " ").match(/[\p{L}\p{N}]+/gu) ?? []);
14
+ for (const run of lower.match(UNSPACED) ?? []) {
15
+ const chars = [...run];
16
+ if (chars.length === 1)
17
+ tokens.add(run);
18
+ for (let at = 0;at + 1 < chars.length; at += 1)
19
+ tokens.add(chars[at] + chars[at + 1]);
20
+ }
21
+ return tokens;
22
+ };
23
+ var similarity = (a, b) => {
24
+ const left = words(a);
25
+ const right = words(b);
26
+ const shared = [...left].filter((word) => right.has(word)).length;
27
+ const all = new Set([...left, ...right]).size;
28
+ return all === 0 ? 0 : shared / all;
29
+ };
30
+ var commonRun = (a, b) => {
31
+ const length = a.map(() => new Array(b.length + 1).fill(0));
32
+ length.push(new Array(b.length + 1).fill(0));
33
+ for (let i2 = a.length - 1;i2 >= 0; i2 -= 1)
34
+ for (let j2 = b.length - 1;j2 >= 0; j2 -= 1)
35
+ length[i2][j2] = a[i2] === b[j2] ? length[i2 + 1][j2 + 1] + 1 : Math.max(length[i2 + 1][j2], length[i2][j2 + 1]);
36
+ const pairs = [];
37
+ let i = 0;
38
+ let j = 0;
39
+ while (i < a.length && j < b.length) {
40
+ if (a[i] === b[j]) {
41
+ pairs.push([i, j]);
42
+ i += 1;
43
+ j += 1;
44
+ } else if (length[i + 1][j] >= length[i][j + 1])
45
+ i += 1;
46
+ else
47
+ j += 1;
48
+ }
49
+ return pairs;
50
+ };
51
+ var inOrder = (pairs) => {
52
+ const sorted = [...pairs].sort((a, b) => a[0] - b[0]);
53
+ const length = sorted.map(() => 1);
54
+ const before = sorted.map(() => -1);
55
+ for (let i = 0;i < sorted.length; i += 1)
56
+ for (let j = 0;j < i; j += 1)
57
+ if (sorted[j][1] < sorted[i][1] && length[j] + 1 > length[i]) {
58
+ length[i] = length[j] + 1;
59
+ before[i] = j;
60
+ }
61
+ let at = length.indexOf(Math.max(0, ...length));
62
+ const chain = [];
63
+ for (;at !== -1; at = before[at])
64
+ chain.unshift(sorted[at]);
65
+ return chain;
66
+ };
67
+ var runsOf = (left) => {
68
+ const runs = [];
69
+ for (const at of left) {
70
+ const last = runs.at(-1);
71
+ if (last !== undefined && last.after === at) {
72
+ last.at.push(at);
73
+ last.after = at + 1;
74
+ } else
75
+ runs.push({ at: [at], before: at - 1, after: at + 1 });
76
+ }
77
+ return runs;
78
+ };
79
+ var pairEdits = (rows, notes, textOf, into) => {
80
+ const candidates = rows.flatMap((row, r) => notes.map((note, n) => ({
81
+ r,
82
+ n,
83
+ score: similarity(textOf(row), textOf(note))
84
+ }))).filter((pair) => pair.score >= SIMILAR).sort((a, b) => b.score - a.score || a.r - b.r || a.n - b.n);
85
+ const rowTaken = new Set;
86
+ const noteTaken = new Set;
87
+ const pairs = [];
88
+ for (const { r, n } of candidates) {
89
+ if (rowTaken.has(r) || noteTaken.has(n))
90
+ continue;
91
+ rowTaken.add(r);
92
+ noteTaken.add(n);
93
+ pairs.push([r, n]);
94
+ }
95
+ const restRows = rows.flatMap((_, r) => rowTaken.has(r) ? [] : [r]);
96
+ const restNotes = notes.flatMap((_, n) => noteTaken.has(n) ? [] : [n]);
97
+ pairs.sort((a, b) => a[0] - b[0]);
98
+ for (const [r, n] of pairs)
99
+ into.changed.push([rows[r], notes[n]]);
100
+ for (const r of restRows)
101
+ into.added.push(rows[r]);
102
+ for (const n of restNotes)
103
+ into.removed.push(notes[n]);
104
+ };
105
+ var matchNotes = (rows, notes, keyOf, textOf, idOf) => {
106
+ const match = {
107
+ same: [],
108
+ changed: [],
109
+ added: [],
110
+ removed: []
111
+ };
112
+ const rowTaken = new Set;
113
+ const noteTaken = new Set;
114
+ const anchors = [];
115
+ const pairsAt = [];
116
+ const take = (r, n, anchor) => {
117
+ rowTaken.add(r);
118
+ noteTaken.add(n);
119
+ pairsAt.push([r, n]);
120
+ match.same.push([rows[r], notes[n]]);
121
+ if (anchor)
122
+ anchors.push([r, n]);
123
+ };
124
+ rows.forEach((row, r) => {
125
+ const n = notes.findIndex((note, at) => !noteTaken.has(at) && idOf(note) === idOf(row) && keyOf(note) === keyOf(row));
126
+ if (n !== -1)
127
+ take(r, n, true);
128
+ });
129
+ const fixed = inOrder(anchors);
130
+ let fromRow = 0;
131
+ let fromNote = 0;
132
+ for (const [toRow, toNote] of [
133
+ ...fixed,
134
+ [rows.length, notes.length]
135
+ ]) {
136
+ const stretchRows = [];
137
+ for (let r = fromRow;r < toRow; r += 1)
138
+ if (!rowTaken.has(r))
139
+ stretchRows.push(r);
140
+ const stretchNotes = [];
141
+ for (let n = fromNote;n < toNote; n += 1)
142
+ if (!noteTaken.has(n))
143
+ stretchNotes.push(n);
144
+ for (const [a, b] of commonRun(stretchRows.map((r) => keyOf(rows[r])), stretchNotes.map((n) => keyOf(notes[n]))))
145
+ take(stretchRows[a], stretchNotes[b], true);
146
+ fromRow = toRow + 1;
147
+ fromNote = toNote + 1;
148
+ }
149
+ rows.forEach((row, r) => {
150
+ if (rowTaken.has(r))
151
+ return;
152
+ const n = notes.findIndex((note, at) => !noteTaken.has(at) && keyOf(note) === keyOf(row));
153
+ if (n !== -1)
154
+ take(r, n, false);
155
+ });
156
+ const refText = (ref) => textOf(ref.item);
157
+ const byWords = {
158
+ same: [],
159
+ changed: [],
160
+ added: [],
161
+ removed: []
162
+ };
163
+ pairEdits(rows.flatMap((item, at) => rowTaken.has(at) ? [] : [{ at, item }]), notes.flatMap((item, at) => noteTaken.has(at) ? [] : [{ at, item }]), refText, byWords);
164
+ const partner = new Map(pairsAt);
165
+ for (const [row, note] of byWords.changed) {
166
+ match.changed.push([row.item, note.item]);
167
+ partner.set(row.at, note.at);
168
+ }
169
+ const byAt = (refs) => refs.map((ref) => ref.at).sort((x, y) => x - y);
170
+ const rowRuns = runsOf(byAt(byWords.added));
171
+ const noteRuns = runsOf(byAt(byWords.removed));
172
+ const neighbours = (row, note) => row === -1 || row === rows.length ? note === (row === -1 ? -1 : notes.length) : partner.get(row) === note;
173
+ const used = new Set;
174
+ for (const run of rowRuns) {
175
+ const k = noteRuns.findIndex((other, at) => !used.has(at) && other.at.length === run.at.length && (neighbours(run.before, other.before) || neighbours(run.after, other.after)));
176
+ if (k === -1) {
177
+ match.added.push(...run.at.map((at) => rows[at]));
178
+ continue;
179
+ }
180
+ used.add(k);
181
+ for (const [i, at] of run.at.entries())
182
+ match.changed.push([rows[at], notes[noteRuns[k].at[i]]]);
183
+ }
184
+ noteRuns.forEach((run, k) => {
185
+ if (!used.has(k))
186
+ match.removed.push(...run.at.map((at) => notes[at]));
187
+ });
188
+ return match;
189
+ };
190
+
191
+ // src/services/sdd-convert/canvas-notes.ts
192
+ var STICKY_NOTE_TYPE = "case-management:StickyNote";
193
+ var ROOT_PARENT = { id: "root", type: "case-management:root" };
194
+ var SDD_NOTE_PREFIX = "StickyNote_sdd_";
195
+ var DETACHED_NOTE_PREFIX = "StickyNote_detached_";
196
+ var sddNoteId = (row) => `${SDD_NOTE_PREFIX}${row}`;
197
+ var isStickyNote = (node) => typeof node === "object" && node !== null && node.type === STICKY_NOTE_TYPE;
198
+ var fromSdd = (note) => typeof note.id === "string" && note.id.startsWith(SDD_NOTE_PREFIX);
199
+ var DEFAULT_COLOR = "yellow";
200
+ var noteKey = (data) => `${typeof data.color === "string" ? data.color : DEFAULT_COLOR}\x01${typeof data.content === "string" ? data.content : ""}`;
201
+ var dataOf = (note) => note.data ?? {};
202
+ var nodesOf = (document) => {
203
+ const nodes = document?.nodes;
204
+ return Array.isArray(nodes) ? nodes : undefined;
205
+ };
206
+ var emitCanvasNotes = (document, notes) => {
207
+ const nodes = nodesOf(document);
208
+ if (nodes === undefined || notes === undefined)
209
+ return 0;
210
+ for (const note of notes) {
211
+ nodes.push({
212
+ id: sddNoteId(note.row),
213
+ type: STICKY_NOTE_TYPE,
214
+ data: {
215
+ parentElement: { ...ROOT_PARENT },
216
+ ...note.color !== undefined && { color: note.color },
217
+ content: note.content
218
+ }
219
+ });
220
+ }
221
+ return notes.length;
222
+ };
223
+ var carryCanvasNotes = (document, previous, unresolved = []) => {
224
+ const nodes = nodesOf(document);
225
+ const before = nodesOf(previous)?.filter(isStickyNote) ?? [];
226
+ if (nodes === undefined || before.length === 0)
227
+ return 0;
228
+ const carried = before.map((note) => structuredClone(note));
229
+ const rows = nodes.filter(isStickyNote);
230
+ const match = matchNotes(rows, carried.filter(fromSdd).sort((a, b) => rowOf(a) - rowOf(b)), (note) => noteKey(dataOf(note)), (note) => String(dataOf(note).content ?? ""), (note) => note.id);
231
+ for (const [row, note] of match.changed)
232
+ unresolved.push({
233
+ kind: "canvas-note",
234
+ where: `nodes[${String(row.id)}]`,
235
+ detail: `the Canvas Notes row for this note now reads "${String(dataOf(row).content)}"${colorText(row)}, and the plan's note reads "${String(dataOf(note).content)}"${colorText(note)}; the plan's note is kept, since it may hold an edit made in the Case Designer — change the row or the note so they agree`
236
+ });
237
+ for (const [row, note] of [...match.same, ...match.changed])
238
+ note.id = row.id;
239
+ const ids = new Set(carried.map((note) => note.id));
240
+ let detached = 1;
241
+ for (const note of match.removed) {
242
+ while (ids.has(`${DETACHED_NOTE_PREFIX}${detached}`))
243
+ detached += 1;
244
+ note.id = `${DETACHED_NOTE_PREFIX}${detached}`;
245
+ ids.add(note.id);
246
+ unresolved.push({
247
+ kind: "canvas-note",
248
+ where: `nodes[${String(note.id)}]`,
249
+ detail: `the plan has the note "${String(dataOf(note).content)}" from a Canvas Notes row the SDD no longer has; the note is kept on the canvas, no longer tied to a row — delete it in the Case Designer if the row was removed on purpose`
250
+ });
251
+ }
252
+ const fresh = new Set(skipCopied(match.added, carried));
253
+ const others = nodes.filter((node) => !isStickyNote(node) || fresh.has(node));
254
+ nodes.splice(0, nodes.length, ...others, ...carried);
255
+ return before.length;
256
+ };
257
+ var rowOf = (note) => {
258
+ if (!fromSdd(note))
259
+ return 0;
260
+ const row = Number(String(note.id).slice(SDD_NOTE_PREFIX.length));
261
+ return Number.isInteger(row) ? row : 0;
262
+ };
263
+ var skipCopied = (added, carried) => {
264
+ const copies = new Map;
265
+ for (const note of carried) {
266
+ if (fromSdd(note))
267
+ continue;
268
+ const key = noteKey(dataOf(note));
269
+ copies.set(key, (copies.get(key) ?? 0) + 1);
270
+ }
271
+ return added.filter((row) => {
272
+ const key = noteKey(dataOf(row));
273
+ const left = copies.get(key) ?? 0;
274
+ if (left === 0)
275
+ return true;
276
+ copies.set(key, left - 1);
277
+ return false;
278
+ });
279
+ };
280
+ var colorText = (note) => {
281
+ const color = dataOf(note).color;
282
+ return typeof color === "string" ? ` (${color})` : ` (${DEFAULT_COLOR}, the default)`;
283
+ };
284
+ var carryCanvasNotesFrom = async (document, out, unresolved) => {
285
+ const { getFileSystemAsync } = await import("./index-ngs0a2he.js");
286
+ const fs = await getFileSystemAsync();
287
+ if (!await fs.exists(out))
288
+ return 0;
289
+ const [readError, text] = await catchError(fs.readFile(out, "utf-8"));
290
+ if (readError || typeof text !== "string")
291
+ return {
292
+ error: `Could not read the plan at ${out} to keep its sticky notes: ${readError?.message ?? "it read as empty"}`
293
+ };
294
+ if (text.trim() === "")
295
+ return 0;
296
+ const json = text.replace(/^\uFEFF/, "");
297
+ const [parseError, previous] = await catchError(Promise.resolve().then(() => JSON.parse(json)));
298
+ if (parseError)
299
+ return {
300
+ error: `The plan at ${out} is not valid JSON, so its sticky notes cannot be kept: ${parseError.message}`
301
+ };
302
+ return carryCanvasNotes(document, previous, unresolved);
303
+ };
304
+
305
+ export { STICKY_NOTE_TYPE, sddNoteId, emitCanvasNotes, carryCanvasNotes, carryCanvasNotesFrom };
306
+
307
+ //# debugId=FDBC5FC638B6E79B64756E2164756E21