react-ecosistema-unp 2.6.1 → 2.7.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.
Files changed (80) hide show
  1. package/README.md +3 -1
  2. package/dist/{AppList-CNtk-CBh.js → AppList-BMiq1ohd.js} +65 -65
  3. package/dist/{Button-eLVX04GZ.js → Button-CFf-9Lsg.js} +1 -1
  4. package/dist/{Card-_JzS9Ssz.js → Card-pj1hogT6.js} +2 -2
  5. package/dist/{CardBody-CUEPjltD.js → CardBody-osBHz8Sj.js} +1 -1
  6. package/dist/FormCheck-C44kvYaC.js +109 -0
  7. package/dist/{FormControl-DshWdHuR.js → FormControl-CjlQ5vZ8.js} +6 -6
  8. package/dist/{FormGroup-B8RAswur.js → FormGroup-BKpeUcMi.js} +3 -3
  9. package/dist/{Spinner-D69BfVXa.js → Spinner-DlaZVI7E.js} +1 -1
  10. package/dist/{TabPane-D71zhQGl.js → TabPane-C7rqu9vB.js} +1 -1
  11. package/dist/{Table-cUZFLrPi.js → Table-CYSh6C16.js} +1 -1
  12. package/dist/ThemeProvider-D8TYBK1p.js +41 -0
  13. package/dist/assets/SmartTextArea.css +1 -1
  14. package/dist/cards/tarjeta/Tarjeta.js +3 -3
  15. package/dist/cards/tarjeta/nuevo-elemento/NuevoElemento.js +2 -2
  16. package/dist/cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js +1 -1
  17. package/dist/cards/tarjeta-info/TarjetaInfo.js +3 -3
  18. package/dist/cards/tarjeta-lectura/TarjetaLectura.js +1 -1
  19. package/dist/data/tarjeta-datos/TarjetaDatos.js +2 -2
  20. package/dist/ia/diccionario/analisisRiesgo.js +245 -0
  21. package/dist/ia/diccionario/index.js +9 -0
  22. package/dist/ia/diccionario/tipos.js +4 -0
  23. package/dist/ia/larissa/larissaService.js +160 -0
  24. package/dist/ia/smart-textarea/DiffResult.js +7 -0
  25. package/dist/ia/smart-textarea/SmartTextArea.js +550 -0
  26. package/dist/ia/smart-textarea/diff.js +55 -0
  27. package/dist/ia.js +26 -0
  28. package/dist/{index-HaNVi1BU.js → index-DBLHT45t.js} +61 -61
  29. package/dist/lib/ia/diccionario/analisisRiesgo.d.ts +170 -0
  30. package/dist/lib/ia/diccionario/index.d.ts +10 -0
  31. package/dist/lib/ia/diccionario/tipos.d.ts +40 -0
  32. package/dist/lib/ia/larissa/larissaService.d.ts +153 -0
  33. package/dist/lib/ia/smart-textarea/DiffResult.d.ts +7 -0
  34. package/dist/lib/ia/smart-textarea/SmartTextArea.d.ts +82 -0
  35. package/dist/lib/ia/smart-textarea/diff.d.ts +15 -0
  36. package/dist/lib/ia.d.ts +8 -0
  37. package/dist/lib/ui.d.ts +0 -2
  38. package/dist/shared/app-list/AppList.js +2 -2
  39. package/dist/shared/breadcrumb/Breadcrumb.js +1 -1
  40. package/dist/shared/iconos-sistema/IconosSistema.js +1 -1
  41. package/dist/shared/iconos-sistema/logout-button/LogoutButton.js +1 -1
  42. package/dist/shared/menu-lateral/MenuLateral.js +3 -4
  43. package/dist/shared/notificacion-usuario/NotificacionUsuario.js +20 -21
  44. package/dist/shared/tab-ventana/TabVentana.js +1 -1
  45. package/dist/shared/ventana-tabs/VentanaTabs.js +3 -3
  46. package/dist/tables/custom-data-table/CustomDataTable.js +4 -5
  47. package/dist/tables/custom-data-table-split/CustomDataTableSplit.js +4 -5
  48. package/dist/tables/eco-data-table/components/EcoBandejaEncabezado.js +3 -4
  49. package/dist/tables/eco-data-table/components/EcoDataTable/EcoDataTable.js +14 -14
  50. package/dist/tables/eco-data-table/components/EcoDataTableLoading.js +1 -1
  51. package/dist/tables/eco-data-table/components/EcoDataTablePageStatus.js +1 -1
  52. package/dist/tables/tabla-registros/buscador/Buscador.js +4 -4
  53. package/dist/tables/tabla-registros/encabezado-tabla/EncabezadoTabla.js +3 -4
  54. package/dist/tables/tabla-registros/modal-v2/EcoModal.js +8 -8
  55. package/dist/tables/tabla-registros/tabla/Tabla.js +17 -17
  56. package/dist/ui/alertas/AlertaFormulario.js +1 -1
  57. package/dist/ui/contenido-modal/ContenidoModal.js +1 -1
  58. package/dist/ui/contenido-modal/ContenidoModalv0.1.js +1 -1
  59. package/dist/ui/contenido-modal-v2/ContenidoModalV2.js +3 -3
  60. package/dist/ui/contenido-modal-v2/ModalV2Menu.js +1 -1
  61. package/dist/ui/icono-tooltip/IconoTooltip.js +24 -24
  62. package/dist/ui/items-modal/ItemsModal.js +1 -1
  63. package/dist/ui/nav-formularios-lateral/NavFormulariosLateral.js +1 -1
  64. package/dist/ui/notificacion-popover-v2/NotificacionPopoverV2.js +55 -55
  65. package/dist/ui/paginador/Paginador.js +2 -2
  66. package/dist/ui/seccion-formulario/SeccionFormulario.js +1 -1
  67. package/dist/ui/status-filter-bar/StatusFilterBar.js +7 -7
  68. package/dist/ui/status-semaphore/StatusSemaphore.js +1 -1
  69. package/dist/ui/stepper-v2/StepperV2.js +2 -2
  70. package/dist/ui.js +6 -8
  71. package/dist/utils/eco-provider/EcoContext.js +3 -4
  72. package/dist/utils/modal-radicados/AuxRadicadosComponents/TarjetaRadicado.js +11 -12
  73. package/dist/utils/modal-radicados/DocumentoVisorEstado.js +4 -5
  74. package/dist/utils/modal-radicados/ModalDocumento.js +10 -10
  75. package/dist/utils/modal-radicados/ModalRadicado.js +152 -254
  76. package/dist/utils/unp-historico/UnpHistorico.js +4 -5
  77. package/package.json +5 -1
  78. package/dist/ThemeProvider-Cv61y4Uy.js +0 -27
  79. package/dist/lib/ui/smart-textarea/SmartTextArea.d.ts +0 -17
  80. package/dist/ui/smart-textarea/SmartTextArea.js +0 -123
@@ -0,0 +1,550 @@
1
+ import { jsx as n, jsxs as u, Fragment as T } from "react/jsx-runtime";
2
+ import * as C from "react";
3
+ import { useContext as ie, useEffect as Re, useState as N, useRef as U } from "react";
4
+ import { notificarAviso as Qe, notificarAccion as Ue, notificarExito as We } from "../../utils/notifications/SileoNotifications.js";
5
+ import { avisarUbicacion as Xe, nuevoIdSesion as Ye, informarSesion as Ze, fetchLarissaCorrection as Pe, informarAplicado as ea } from "../larissa/larissaService.js";
6
+ import { contarPalabras as aa, computeDiff as ta, palabrasEditadas as na } from "./diff.js";
7
+ import { DiffResult as ra } from "./DiffResult.js";
8
+ import { S as Se } from "../../Spinner-DlaZVI7E.js";
9
+ import { c as y } from "../../index-ZphT3dr_.js";
10
+ import { P as se } from "../../index-DNv2B0Nc.js";
11
+ import { F as W } from "../../FormCheck-C44kvYaC.js";
12
+ import { F as oa } from "../../FormControl-CjlQ5vZ8.js";
13
+ import { u as x, a as sa, b as ia } from "../../ThemeProvider-D8TYBK1p.js";
14
+ import { b as ce, F as Le } from "../../FormGroup-BKpeUcMi.js";
15
+ import { w as ca } from "../../warning-DfuoVnCC.js";
16
+ import '../../assets/SmartTextArea.css';function la({
17
+ as: a,
18
+ bsPrefix: t,
19
+ className: o,
20
+ ...s
21
+ }) {
22
+ t = x(t, "col");
23
+ const c = sa(), i = ia(), l = [], h = [];
24
+ return c.forEach((p) => {
25
+ const m = s[p];
26
+ delete s[p];
27
+ let g, _, $;
28
+ typeof m == "object" && m != null ? {
29
+ span: g,
30
+ offset: _,
31
+ order: $
32
+ } = m : g = m;
33
+ const F = p !== i ? `-${p}` : "";
34
+ g && l.push(g === !0 ? `${t}${F}` : `${t}${F}-${g}`), $ != null && h.push(`order${F}-${$}`), _ != null && h.push(`offset${F}-${_}`);
35
+ }), [{
36
+ ...s,
37
+ className: y(o, ...l, ...h)
38
+ }, {
39
+ as: a,
40
+ bsPrefix: t,
41
+ spans: l
42
+ }];
43
+ }
44
+ const Ee = /* @__PURE__ */ C.forwardRef(
45
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
46
+ (a, t) => {
47
+ const [{
48
+ className: o,
49
+ ...s
50
+ }, {
51
+ as: c = "div",
52
+ bsPrefix: i,
53
+ spans: l
54
+ }] = la(a);
55
+ return /* @__PURE__ */ n(c, {
56
+ ...s,
57
+ ref: t,
58
+ className: y(o, !l.length && i)
59
+ });
60
+ }
61
+ );
62
+ Ee.displayName = "Col";
63
+ const ke = /* @__PURE__ */ C.forwardRef(({
64
+ className: a,
65
+ bsPrefix: t,
66
+ as: o = "div",
67
+ ...s
68
+ }, c) => (t = x(t, "form-floating"), /* @__PURE__ */ n(o, {
69
+ ref: c,
70
+ className: y(a, t),
71
+ ...s
72
+ })));
73
+ ke.displayName = "FormFloating";
74
+ const Te = /* @__PURE__ */ C.forwardRef(({
75
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
76
+ as: a = "label",
77
+ bsPrefix: t,
78
+ column: o = !1,
79
+ visuallyHidden: s = !1,
80
+ className: c,
81
+ htmlFor: i,
82
+ ...l
83
+ }, h) => {
84
+ const {
85
+ controlId: p
86
+ } = ie(ce);
87
+ t = x(t, "form-label");
88
+ let m = "col-form-label";
89
+ typeof o == "string" && (m = `${m} ${m}-${o}`);
90
+ const g = y(c, t, s && "visually-hidden", o && m);
91
+ return process.env.NODE_ENV !== "production" && ca(p == null || !i, "`controlId` is ignored on `<FormLabel>` when `htmlFor` is specified."), i = i || p, o ? /* @__PURE__ */ n(Ee, {
92
+ ref: h,
93
+ as: "label",
94
+ className: g,
95
+ htmlFor: i,
96
+ ...l
97
+ }) : (
98
+ // eslint-disable-next-line jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control
99
+ /* @__PURE__ */ n(a, {
100
+ ref: h,
101
+ className: g,
102
+ htmlFor: i,
103
+ ...l
104
+ })
105
+ );
106
+ });
107
+ Te.displayName = "FormLabel";
108
+ const _e = /* @__PURE__ */ C.forwardRef(({
109
+ bsPrefix: a,
110
+ className: t,
111
+ id: o,
112
+ ...s
113
+ }, c) => {
114
+ const {
115
+ controlId: i
116
+ } = ie(ce);
117
+ return a = x(a, "form-range"), /* @__PURE__ */ n("input", {
118
+ ...s,
119
+ type: "range",
120
+ ref: c,
121
+ className: y(t, a),
122
+ id: o || i
123
+ });
124
+ });
125
+ _e.displayName = "FormRange";
126
+ const Ie = /* @__PURE__ */ C.forwardRef(({
127
+ bsPrefix: a,
128
+ size: t,
129
+ htmlSize: o,
130
+ className: s,
131
+ isValid: c = !1,
132
+ isInvalid: i = !1,
133
+ id: l,
134
+ ...h
135
+ }, p) => {
136
+ const {
137
+ controlId: m
138
+ } = ie(ce);
139
+ return a = x(a, "form-select"), /* @__PURE__ */ n("select", {
140
+ ...h,
141
+ size: o,
142
+ ref: p,
143
+ className: y(s, a, t && `${a}-${t}`, c && "is-valid", i && "is-invalid"),
144
+ id: l || m
145
+ });
146
+ });
147
+ Ie.displayName = "FormSelect";
148
+ const De = /* @__PURE__ */ C.forwardRef(
149
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
150
+ ({
151
+ bsPrefix: a,
152
+ className: t,
153
+ as: o = "small",
154
+ muted: s,
155
+ ...c
156
+ }, i) => (a = x(a, "form-text"), /* @__PURE__ */ n(o, {
157
+ ...c,
158
+ ref: i,
159
+ className: y(t, a, s && "text-muted")
160
+ }))
161
+ );
162
+ De.displayName = "FormText";
163
+ const Me = /* @__PURE__ */ C.forwardRef((a, t) => /* @__PURE__ */ n(W, {
164
+ ...a,
165
+ ref: t,
166
+ type: "switch"
167
+ }));
168
+ Me.displayName = "Switch";
169
+ const da = Object.assign(Me, {
170
+ Input: W.Input,
171
+ Label: W.Label
172
+ }), Ae = /* @__PURE__ */ C.forwardRef(({
173
+ bsPrefix: a,
174
+ className: t,
175
+ children: o,
176
+ controlId: s,
177
+ label: c,
178
+ ...i
179
+ }, l) => (a = x(a, "form-floating"), /* @__PURE__ */ u(Le, {
180
+ ref: l,
181
+ className: y(t, a),
182
+ controlId: s,
183
+ ...i,
184
+ children: [o, /* @__PURE__ */ n("label", {
185
+ htmlFor: s,
186
+ children: c
187
+ })]
188
+ })));
189
+ Ae.displayName = "FloatingLabel";
190
+ const ua = {
191
+ /**
192
+ * The Form `ref` will be forwarded to the underlying element,
193
+ * which means, unless it's rendered `as` a composite component,
194
+ * it will be a DOM node, when resolved.
195
+ *
196
+ * @type {ReactRef}
197
+ * @alias ref
198
+ */
199
+ _ref: se.any,
200
+ /**
201
+ * Mark a form as having been validated. Setting it to `true` will
202
+ * toggle any validation styles on the forms elements.
203
+ */
204
+ validated: se.bool,
205
+ as: se.elementType
206
+ }, le = /* @__PURE__ */ C.forwardRef(({
207
+ className: a,
208
+ validated: t,
209
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
210
+ as: o = "form",
211
+ ...s
212
+ }, c) => /* @__PURE__ */ n(o, {
213
+ ...s,
214
+ ref: c,
215
+ className: y(a, t && "was-validated")
216
+ }));
217
+ le.displayName = "Form";
218
+ le.propTypes = ua;
219
+ const ma = Object.assign(le, {
220
+ Group: Le,
221
+ Control: oa,
222
+ Floating: ke,
223
+ Check: W,
224
+ Switch: da,
225
+ Label: Te,
226
+ Text: De,
227
+ Range: _e,
228
+ Select: Ie,
229
+ FloatingLabel: Ae
230
+ }), fa = 6e4;
231
+ function xe(a) {
232
+ return {
233
+ id: Ye(),
234
+ interactuo: !1,
235
+ caracteresInicio: 0,
236
+ activoMs: 0,
237
+ ultimo: Date.now(),
238
+ enFoco: !1,
239
+ esperando: !1,
240
+ iaHabilitada: a,
241
+ solicitudes: 0,
242
+ pendiente: null,
243
+ aplicada: null,
244
+ ediciones: []
245
+ };
246
+ }
247
+ const La = ({
248
+ apiUrl: a,
249
+ iaEnabled: t = !1,
250
+ getToken: o,
251
+ servicio: s,
252
+ ruta: c,
253
+ value: i,
254
+ onChange: l,
255
+ name: h,
256
+ disabled: p,
257
+ maxLength: m,
258
+ inputHeader: g,
259
+ inputFooter: _,
260
+ notificaMax: $ = !1,
261
+ normalizaSaltos: F = !1,
262
+ campo: A,
263
+ ubicacion: R,
264
+ rol: X,
265
+ registro: Y,
266
+ ...Be
267
+ }) => {
268
+ const B = { servicio: s, ruta: c }, Oe = R ? JSON.stringify(R) : "";
269
+ Re(() => {
270
+ Xe(R);
271
+ }, [Oe]);
272
+ const [f, L] = N(null), [de, O] = N([]), [Z, ue] = N(null), [me, j] = N(null), [P, ee] = N(!1), [fe, V] = N(null), [E, I] = N(!1), [pe, D] = N(null), [z, G] = N(null), [ae, te] = N(null), ne = Z !== null, b = typeof i == "string" ? i : String(i ?? ""), q = de.filter((e) => e.changed && e.text.trim() !== "").length, S = f !== null && q === 0, he = (f == null ? void 0 : f.length) ?? 0, v = typeof m == "number" ? m : void 0, H = v !== void 0 && he > v, je = f !== null && fe !== null && b !== fe, d = U(null);
273
+ d.current === null && (d.current = xe(t)), t && (d.current.iaHabilitada = !0);
274
+ const J = U(b);
275
+ J.current = b;
276
+ const ge = U({ apiUrl: a, getToken: o, opciones: B, campo: A, ubicacion: R, rol: X, registro: Y, iaEnabled: t });
277
+ ge.current = { apiUrl: a, getToken: o, opciones: B, campo: A, ubicacion: R, rol: X, registro: Y, iaEnabled: t };
278
+ const M = () => {
279
+ const e = d.current, r = Date.now();
280
+ (e.enFoco || e.esperando) && (e.activoMs += Math.min(r - e.ultimo, fa)), e.ultimo = r;
281
+ }, K = () => {
282
+ const e = d.current;
283
+ M(), e.interactuo || (e.interactuo = !0, e.caracteresInicio = J.current.length);
284
+ }, Ve = () => {
285
+ K(), d.current.enFoco = !0;
286
+ }, ze = () => {
287
+ M(), d.current.enFoco = !1;
288
+ }, Ne = () => {
289
+ const e = d.current;
290
+ e.aplicada && (e.ediciones.push({
291
+ id_diaglarissa: e.aplicada.id,
292
+ palabras_editadas: na(e.aplicada.texto, J.current)
293
+ }), e.aplicada = null);
294
+ }, be = () => {
295
+ const e = d.current;
296
+ if (!e.interactuo && e.solicitudes === 0) return;
297
+ M(), Ne();
298
+ const r = ge.current;
299
+ if (r.campo !== void 0 || r.ubicacion) {
300
+ const w = J.current;
301
+ Ze({
302
+ id_sesion: e.id,
303
+ metrica: { campo: r.campo, ubicacion: r.ubicacion, rol: r.rol, registro: r.registro },
304
+ tiempo_activo_ms: e.activoMs,
305
+ caracteres_inicio: e.caracteresInicio,
306
+ caracteres_fin: w.length,
307
+ palabras_fin: aa(w),
308
+ ia_habilitada: e.iaHabilitada,
309
+ solicitudes: e.solicitudes,
310
+ pendiente: e.pendiente,
311
+ ediciones: e.ediciones
312
+ }, r.apiUrl, r.getToken, r.opciones);
313
+ }
314
+ d.current = xe(r.iaEnabled), d.current.enFoco = e.enFoco;
315
+ }, re = U(be);
316
+ re.current = be, Re(() => {
317
+ const e = () => re.current();
318
+ return window.addEventListener("pagehide", e), () => {
319
+ window.removeEventListener("pagehide", e), re.current();
320
+ };
321
+ }, []);
322
+ const oe = (e, r, w) => {
323
+ const k = d.current;
324
+ k.pendiente = null, ae && (ea(ae, e, a, o, B, r), e && w !== void 0 && (k.aplicada = { id: ae, texto: w }), te(null));
325
+ }, ve = async (e) => {
326
+ if (!b.trim()) return;
327
+ f !== null && (S ? te(null) : oe(!1, "reemplazada"));
328
+ const r = d.current;
329
+ M(), Ne(), r.solicitudes++, r.esperando = !0;
330
+ const w = r.id;
331
+ ue(e), L(null), O([]), j(null), ee(!1), I(!1), D(null), V(null), G(null);
332
+ try {
333
+ const Q = await Pe(
334
+ b,
335
+ e,
336
+ a,
337
+ o,
338
+ A === void 0 && !R ? void 0 : { campo: A, ubicacion: R, rol: X, registro: Y, sesion: w },
339
+ B
340
+ ), we = ta(b, Q.corrected_text);
341
+ O(we), L(Q.corrected_text), te(Q.id_diaglarissa ?? null), V(b), G(e);
342
+ const Ke = we.some(($e) => $e.changed && $e.text.trim() !== "");
343
+ d.current.id === w && (d.current.pendiente = Ke ? Q.id_diaglarissa ?? null : null);
344
+ } catch (k) {
345
+ j(k instanceof Error ? k.message : "No se pudo conectar con Larissa.");
346
+ } finally {
347
+ M(), d.current.esperando = !1, ue(null);
348
+ }
349
+ }, Ce = () => {
350
+ f === null || H || Ue(
351
+ "¿Aplicar corrección?",
352
+ "El campo será reemplazado con el texto corregido.",
353
+ () => {
354
+ l && (l({
355
+ target: { value: f, name: h ?? "" },
356
+ currentTarget: { value: f, name: h ?? "" }
357
+ }), oe(!0, void 0, f), L(null), O([]), j(null), V(null), I(!1), D(null), G(null), We("Texto corregido aplicado con éxito.", "Corrección aplicada"));
358
+ },
359
+ () => {
360
+ },
361
+ "Sí, aplicar",
362
+ "Cancelar"
363
+ );
364
+ }, ye = () => {
365
+ S || oe(!1, "descartada"), L(null), O([]), j(null), V(null), I(!1), D(null), G(null);
366
+ }, Fe = () => {
367
+ D(f), I(!0), ee(!1);
368
+ }, Ge = () => {
369
+ pe !== null && L(pe), I(!1), D(null);
370
+ }, qe = (e) => {
371
+ let r = e.target.value;
372
+ F && (r = r.replace(/\r\n/g, `
373
+ `)), $ && v !== void 0 && r.length > v && (r = r.slice(0, v), Qe(
374
+ `Has alcanzado el máximo de ${v} caracteres.`,
375
+ "Límite alcanzado"
376
+ )), (F || $) && (e.target.value = r), l == null || l(e);
377
+ }, He = z === "drafting" ? "Propuesta de redacción" : "Texto corregido", Je = z === "drafting" ? "Propuesta de redacción generada por Larissa. Revisa y edita el contenido antes de aplicarlo." : "Texto corregido automáticamente por Larissa. Verifica que el contenido sea correcto antes de aplicar el cambio.";
378
+ return /* @__PURE__ */ u(
379
+ "div",
380
+ {
381
+ className: "sia-wrapper",
382
+ onFocus: Ve,
383
+ onBlur: ze,
384
+ onInput: K,
385
+ onKeyDown: K,
386
+ onPointerDown: K,
387
+ children: [
388
+ (t || g) && /* @__PURE__ */ u("div", { className: "sia-header-row", children: [
389
+ g && /* @__PURE__ */ n("div", { className: "sia-header-left", children: g }),
390
+ t && /* @__PURE__ */ u("div", { className: "sia-actions-row", children: [
391
+ /* @__PURE__ */ n(
392
+ "button",
393
+ {
394
+ type: "button",
395
+ className: "sia-btn",
396
+ disabled: ne || p || !b.trim(),
397
+ onClick: () => ve("spelling"),
398
+ title: "Corrección ortográfica con Larissa",
399
+ children: Z === "spelling" ? /* @__PURE__ */ u(T, { children: [
400
+ /* @__PURE__ */ n(Se, { as: "span", animation: "border", size: "sm", className: "sia-spinner-bs" }),
401
+ " Corrigiendo..."
402
+ ] }) : "Ortografía"
403
+ }
404
+ ),
405
+ /* @__PURE__ */ n(
406
+ "button",
407
+ {
408
+ type: "button",
409
+ className: "sia-btn",
410
+ disabled: ne || p || !b.trim(),
411
+ onClick: () => ve("drafting"),
412
+ title: "Mejora de redacción con Larissa",
413
+ children: Z === "drafting" ? /* @__PURE__ */ u(T, { children: [
414
+ /* @__PURE__ */ n(Se, { as: "span", animation: "border", size: "sm", className: "sia-spinner-bs" }),
415
+ " Redactando..."
416
+ ] }) : "Redacción"
417
+ }
418
+ )
419
+ ] })
420
+ ] }),
421
+ /* @__PURE__ */ n(
422
+ ma.Control,
423
+ {
424
+ as: "textarea",
425
+ value: i,
426
+ onChange: F || $ ? qe : l,
427
+ name: h,
428
+ disabled: p || ne,
429
+ maxLength: m,
430
+ ...Be
431
+ }
432
+ ),
433
+ _,
434
+ me && /* @__PURE__ */ n("div", { className: "sia-error", children: me }),
435
+ f !== null && /* @__PURE__ */ u("div", { className: "sia-panel", children: [
436
+ /* @__PURE__ */ u("div", { className: "sia-panel-header", children: [
437
+ /* @__PURE__ */ n("span", { className: "sia-panel-title", children: E ? "Editando corrección" : He }),
438
+ /* @__PURE__ */ u("div", { className: "sia-panel-header-right", children: [
439
+ v !== void 0 && /* @__PURE__ */ u("span", { className: `sia-char-count${H ? " sia-char-count--over" : ""}`, children: [
440
+ he,
441
+ "/",
442
+ v
443
+ ] }),
444
+ !E && /* @__PURE__ */ n("span", { className: `sia-panel-hint${S ? " sia-panel-hint--ok" : ""}`, children: S ? "✓ Sin cambios" : z === "drafting" ? "Texto redactado" : `${q} palabra${q !== 1 ? "s" : ""} corregida${q !== 1 ? "s" : ""}` }),
445
+ !S && !E && /* @__PURE__ */ n(
446
+ "button",
447
+ {
448
+ type: "button",
449
+ className: "sia-collapse-btn",
450
+ onClick: () => ee((e) => !e),
451
+ title: P ? "Ver texto corregido" : "Ocultar texto corregido",
452
+ children: P ? "▼" : "▲"
453
+ }
454
+ )
455
+ ] })
456
+ ] }),
457
+ je && !E && /* @__PURE__ */ n("div", { className: "sia-stale-banner", children: "⚠ El texto fue modificado. Esta corrección puede estar desactualizada." }),
458
+ E ? /* @__PURE__ */ n(
459
+ "textarea",
460
+ {
461
+ className: "sia-edit-textarea",
462
+ value: f,
463
+ onChange: (e) => L(e.target.value),
464
+ rows: 5
465
+ }
466
+ ) : !S && !P && (z === "drafting" ? /* @__PURE__ */ n("div", { className: "sia-diff-box", children: f }) : /* @__PURE__ */ n(ra, { tokens: de })),
467
+ /* @__PURE__ */ u("div", { className: "sia-panel-footer", children: [
468
+ /* @__PURE__ */ n("div", { className: "sia-panel-footer-actions", children: E ? /* @__PURE__ */ u(T, { children: [
469
+ !H && /* @__PURE__ */ n(
470
+ "button",
471
+ {
472
+ type: "button",
473
+ className: "sia-btn sia-btn--primary",
474
+ onClick: Ce,
475
+ children: "Cambiar"
476
+ }
477
+ ),
478
+ /* @__PURE__ */ n(
479
+ "button",
480
+ {
481
+ type: "button",
482
+ className: "sia-btn sia-btn--ghost",
483
+ onClick: Ge,
484
+ children: "Cancelar edición"
485
+ }
486
+ )
487
+ ] }) : S ? /* @__PURE__ */ n(
488
+ "button",
489
+ {
490
+ type: "button",
491
+ className: "sia-btn sia-btn--ghost",
492
+ onClick: ye,
493
+ children: "Cerrar"
494
+ }
495
+ ) : /* @__PURE__ */ u(T, { children: [
496
+ H ? /* @__PURE__ */ u(T, { children: [
497
+ /* @__PURE__ */ u("div", { className: "sia-limit-warning", children: [
498
+ "⚠ El texto corregido supera los ",
499
+ v,
500
+ " caracteres. Edítalo para reducirlo."
501
+ ] }),
502
+ /* @__PURE__ */ n(
503
+ "button",
504
+ {
505
+ type: "button",
506
+ className: "sia-btn",
507
+ onClick: Fe,
508
+ children: "Editar corrección"
509
+ }
510
+ )
511
+ ] }) : /* @__PURE__ */ u(T, { children: [
512
+ /* @__PURE__ */ n(
513
+ "button",
514
+ {
515
+ type: "button",
516
+ className: "sia-btn sia-btn--primary",
517
+ onClick: Ce,
518
+ children: "Cambiar"
519
+ }
520
+ ),
521
+ /* @__PURE__ */ n(
522
+ "button",
523
+ {
524
+ type: "button",
525
+ className: "sia-btn",
526
+ onClick: Fe,
527
+ children: "Editar corrección"
528
+ }
529
+ )
530
+ ] }),
531
+ /* @__PURE__ */ n(
532
+ "button",
533
+ {
534
+ type: "button",
535
+ className: "sia-btn sia-btn--ghost",
536
+ onClick: ye,
537
+ children: "Limpiar"
538
+ }
539
+ )
540
+ ] }) }),
541
+ /* @__PURE__ */ n("p", { className: "sia-disclaimer", children: /* @__PURE__ */ n("em", { children: Je }) })
542
+ ] })
543
+ ] })
544
+ ]
545
+ }
546
+ );
547
+ };
548
+ export {
549
+ La as SmartTextArea
550
+ };
@@ -0,0 +1,55 @@
1
+ function s(r) {
2
+ return r.split(/(\s+)/);
3
+ }
4
+ function f(r, h) {
5
+ const n = r.length, e = h.length, l = Array.from({ length: n + 1 }, () => new Array(e + 1).fill(0));
6
+ for (let t = 1; t <= n; t++)
7
+ for (let i = 1; i <= e; i++)
8
+ l[t][i] = r[t - 1] === h[i - 1] ? l[t - 1][i - 1] + 1 : Math.max(l[t - 1][i], l[t][i - 1]);
9
+ return l;
10
+ }
11
+ function p(r, h) {
12
+ const n = s(r), e = s(h), l = f(n, e), t = [];
13
+ let i = n.length, o = e.length;
14
+ for (; i > 0 || o > 0; )
15
+ i > 0 && o > 0 && n[i - 1] === e[o - 1] ? (t.unshift({ text: e[o - 1], changed: !1 }), i--, o--) : o > 0 && (i === 0 || l[i][o - 1] >= l[i - 1][o]) ? (t.unshift({ text: e[o - 1], changed: !0 }), o--) : i--;
16
+ return t;
17
+ }
18
+ const c = /[0-9a-záéíóúüñ]/i, g = 4e6;
19
+ function a(r) {
20
+ return r.split(/\s+/).filter(Boolean);
21
+ }
22
+ function m(r) {
23
+ return a(r).filter((h) => c.test(h)).length;
24
+ }
25
+ function u(r, h) {
26
+ if (r.length * h.length > g) {
27
+ const l = /* @__PURE__ */ new Map();
28
+ for (const i of r) l.set(i, (l.get(i) ?? 0) + 1);
29
+ let t = 0;
30
+ for (const i of h) {
31
+ const o = l.get(i) ?? 0;
32
+ o > 0 && (t++, l.set(i, o - 1));
33
+ }
34
+ return t;
35
+ }
36
+ let n = new Array(h.length + 1).fill(0), e = new Array(h.length + 1).fill(0);
37
+ for (let l = 1; l <= r.length; l++) {
38
+ for (let t = 1; t <= h.length; t++)
39
+ e[t] = r[l - 1] === h[t - 1] ? n[t - 1] + 1 : Math.max(n[t], e[t - 1]);
40
+ [n, e] = [e, n];
41
+ }
42
+ return n[h.length];
43
+ }
44
+ function d(r, h) {
45
+ let n = a(r), e = a(h), l = 0;
46
+ for (; l < Math.min(n.length, e.length) && n[l] === e[l]; ) l++;
47
+ let t = 0;
48
+ for (; t < Math.min(n.length, e.length) - l && n[n.length - 1 - t] === e[e.length - 1 - t]; ) t++;
49
+ return n = n.slice(l, n.length - t), e = e.slice(l, e.length - t), !n.length || !e.length ? Math.max(n.length, e.length) : Math.max(n.length, e.length) - u(n, e);
50
+ }
51
+ export {
52
+ p as computeDiff,
53
+ m as contarPalabras,
54
+ d as palabrasEditadas
55
+ };
package/dist/ia.js ADDED
@@ -0,0 +1,26 @@
1
+ import { SmartTextArea as o } from "./ia/smart-textarea/SmartTextArea.js";
2
+ import { computeDiff as e, contarPalabras as c, palabrasEditadas as t } from "./ia/smart-textarea/diff.js";
3
+ import { LIMITES_UBICACION as I, RUTA_LARISSA as f, RUTA_SPELLING as A, TIEMPO_SESION_MAX_MS as S, fetchLarissaCorrection as m, fetchSpellingCorrection as p, informarAplicado as s, informarSesion as _, nuevoIdSesion as C, revisarUbicacion as b } from "./ia/larissa/larissaService.js";
4
+ import { ubicacionPara as l } from "./ia/diccionario/tipos.js";
5
+ import { ROL_IA as L, UBICACION_IA as u, ubicacionCalidad as E, ubicacionMatriz as M } from "./ia/diccionario/analisisRiesgo.js";
6
+ export {
7
+ I as LIMITES_UBICACION,
8
+ L as ROL_IA,
9
+ f as RUTA_LARISSA,
10
+ A as RUTA_SPELLING,
11
+ o as SmartTextArea,
12
+ S as TIEMPO_SESION_MAX_MS,
13
+ u as UBICACION_IA,
14
+ e as computeDiff,
15
+ c as contarPalabras,
16
+ m as fetchLarissaCorrection,
17
+ p as fetchSpellingCorrection,
18
+ s as informarAplicado,
19
+ _ as informarSesion,
20
+ C as nuevoIdSesion,
21
+ t as palabrasEditadas,
22
+ b as revisarUbicacion,
23
+ E as ubicacionCalidad,
24
+ M as ubicacionMatriz,
25
+ l as ubicacionPara
26
+ };