@mapomodule/form 2.0.0-beta.15 → 2.0.0-beta.16

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 (32) hide show
  1. package/dist/__tests__/MapoWygEditor.component.test.d.ts +2 -0
  2. package/dist/__tests__/MapoWygEditor.component.test.d.ts.map +1 -0
  3. package/dist/__tests__/formatHtml.test.d.ts +2 -0
  4. package/dist/__tests__/formatHtml.test.d.ts.map +1 -0
  5. package/dist/__tests__/sanitizeHtml.test.d.ts +2 -0
  6. package/dist/__tests__/sanitizeHtml.test.d.ts.map +1 -0
  7. package/dist/index.d.mts +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/module.json +1 -1
  11. package/dist/runtime/components/fields/MapoWygEditor.vue +157 -50
  12. package/dist/runtime/components/fields/MapoWygEditor.vue.d.ts.map +1 -1
  13. package/dist/runtime/types/descriptor.d.ts +55 -0
  14. package/dist/runtime/types/descriptor.d.ts.map +1 -1
  15. package/dist/runtime/types/index.d.ts +1 -1
  16. package/dist/runtime/types/index.d.ts.map +1 -1
  17. package/dist/runtime/utils/formatHtml.d.ts +16 -0
  18. package/dist/runtime/utils/formatHtml.d.ts.map +1 -0
  19. package/dist/runtime/utils/formatHtml.js +137 -0
  20. package/dist/runtime/utils/sanitizeHtml.d.ts +16 -0
  21. package/dist/runtime/utils/sanitizeHtml.d.ts.map +1 -0
  22. package/dist/runtime/utils/sanitizeHtml.js +37 -0
  23. package/package.json +2 -2
  24. package/src/__tests__/MapoWygEditor.component.test.ts +525 -0
  25. package/src/__tests__/formatHtml.test.ts +145 -0
  26. package/src/__tests__/sanitizeHtml.test.ts +40 -0
  27. package/src/index.ts +2 -0
  28. package/src/runtime/components/fields/MapoWygEditor.vue +199 -69
  29. package/src/runtime/types/descriptor.ts +63 -1
  30. package/src/runtime/types/index.ts +2 -0
  31. package/src/runtime/utils/formatHtml.ts +198 -0
  32. package/src/runtime/utils/sanitizeHtml.ts +60 -0
@@ -0,0 +1,40 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { isSafeUrl, sanitizeHtml } from "../runtime/utils/sanitizeHtml.js";
4
+
5
+ // The URL check behind the editor's sanitizer and its Link extension. The
6
+ // sanitizer itself walks a DOM, which these tests do not have.
7
+
8
+ describe("isSafeUrl", () => {
9
+ it("accepts relative URLs and the allowed protocols", () => {
10
+ for (const url of [
11
+ "/page",
12
+ "page#anchor",
13
+ "?q=1",
14
+ "https://example.com",
15
+ "http://example.com",
16
+ "mailto:a@example.com",
17
+ "tel:+39000",
18
+ ]) {
19
+ expect(isSafeUrl(url), url).toBe(true);
20
+ }
21
+ });
22
+
23
+ it("rejects script and data protocols, whatever their case", () => {
24
+ for (const url of [
25
+ "javascript:alert(1)",
26
+ "JavaScript:alert(1)",
27
+ "vbscript:msgbox(1)",
28
+ "data:text/html,<script>alert(1)</script>",
29
+ ]) {
30
+ expect(isSafeUrl(url), url).toBe(false);
31
+ }
32
+ });
33
+ });
34
+
35
+ describe("sanitizeHtml", () => {
36
+ it("returns the HTML as it is without a DOM (server side)", () => {
37
+ expect(sanitizeHtml("<p>a</p>")).toBe("<p>a</p>");
38
+ expect(sanitizeHtml("")).toBe("");
39
+ });
40
+ });
package/src/index.ts CHANGED
@@ -38,6 +38,8 @@ export type {
38
38
  ColorDescriptor,
39
39
  FileDescriptor,
40
40
  EditorDescriptor,
41
+ EditorToolbarItem,
42
+ EditorToolbarEditor,
41
43
  SeoDescriptor,
42
44
  MapDescriptor,
43
45
  RepeaterDescriptor,
@@ -1,5 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { ref, watch, onBeforeUnmount, resolveComponent } from "vue";
2
+ import {
3
+ computed,
4
+ ref,
5
+ watch,
6
+ onBeforeUnmount,
7
+ resolveComponent,
8
+ useId,
9
+ } from "vue";
3
10
  import { useI18n } from "vue-i18n";
4
11
  import { useEditor, EditorContent } from "@tiptap/vue-3";
5
12
  import type { AnyExtension } from "@tiptap/vue-3";
@@ -7,7 +14,18 @@ import StarterKit from "@tiptap/starter-kit";
7
14
  import Link from "@tiptap/extension-link";
8
15
  import Underline from "@tiptap/extension-underline";
9
16
  import Image from "@tiptap/extension-image";
10
- import type { EditorDescriptor } from "../../types/index.js";
17
+ import { debounce } from "@mapomodule/utils";
18
+ import type {
19
+ EditorDescriptor,
20
+ EditorToolbarEditor,
21
+ EditorToolbarItem,
22
+ } from "../../types/index.js";
23
+ import { formatHtml } from "../../utils/formatHtml.js";
24
+ import {
25
+ ALLOWED_LINK_PROTOCOLS,
26
+ isSafeUrl,
27
+ sanitizeHtml,
28
+ } from "../../utils/sanitizeHtml.js";
11
29
 
12
30
  const props = defineProps<{
13
31
  modelValue: unknown;
@@ -24,60 +42,6 @@ const { t } = useI18n();
24
42
  const extraExtensions =
25
43
  (props.descriptor.attrs?.extensions as AnyExtension[] | undefined) ?? [];
26
44
 
27
- // Protocol allowlist for user-entered links. Without this,
28
- // `<a href="javascript:...">` would be accepted, leading to XSS when content is
29
- // rendered elsewhere (preview, server-side, other editors).
30
- const ALLOWED_LINK_PROTOCOLS = ["http", "https", "mailto", "tel"];
31
-
32
- function isSafeUrl(url: string): boolean {
33
- try {
34
- // URL relativi (es. "/page") non hanno protocol — li accettiamo.
35
- if (!/^[a-z][a-z0-9+.-]*:/i.test(url)) return true;
36
- const proto = new URL(url, "https://placeholder.local").protocol
37
- .replace(":", "")
38
- .toLowerCase();
39
- return ALLOWED_LINK_PROTOCOLS.includes(proto);
40
- } catch {
41
- return false;
42
- }
43
- }
44
-
45
- // Sanitise incoming HTML from external sources (initial set, server sync)
46
- // by removing <script>, inline handlers (on*), and href: javascript:. This is
47
- // intentionally minimal (no DOMPurify) to avoid a heavy dependency: it covers the
48
- // most common vectors; for truly untrusted HTML the consumer should use DOMPurify
49
- // at the app level.
50
- function sanitizeHtml(html: string): string {
51
- if (typeof window === "undefined" || !html) return html;
52
- const tpl = document.createElement("template");
53
- tpl.innerHTML = html;
54
- const walker = document.createTreeWalker(
55
- tpl.content,
56
- NodeFilter.SHOW_ELEMENT,
57
- );
58
- const toRemove: Element[] = [];
59
- let node = walker.nextNode() as Element | null;
60
- while (node) {
61
- if (node.tagName === "SCRIPT" || node.tagName === "STYLE") {
62
- toRemove.push(node);
63
- } else {
64
- for (const attr of Array.from(node.attributes)) {
65
- const name = attr.name.toLowerCase();
66
- if (name.startsWith("on")) node.removeAttribute(attr.name);
67
- if (
68
- (name === "href" || name === "src" || name === "xlink:href") &&
69
- !isSafeUrl(attr.value)
70
- ) {
71
- node.removeAttribute(attr.name);
72
- }
73
- }
74
- }
75
- node = walker.nextNode() as Element | null;
76
- }
77
- toRemove.forEach((el) => el.remove());
78
- return tpl.innerHTML;
79
- }
80
-
81
45
  const editor = useEditor({
82
46
  content: sanitizeHtml((props.modelValue as string) ?? ""),
83
47
  editable: !props.readonly && !props.disabled,
@@ -103,7 +67,65 @@ watch(
103
67
  ([ro, dis]) => editor.value?.setEditable(!ro && !dis),
104
68
  );
105
69
 
106
- // Sync modelValue esterno → editor (es. reset dopo save)
70
+ // ─── HTML source view (`attrs.source`) ────────────────────────────────────
71
+ // The textarea edits a copy of the HTML. After each pause in the typing the
72
+ // copy goes through the editor (sanitizer, then schema), and the editor's HTML
73
+ // is what the field emits: the saved value is sanitized and normalized even
74
+ // when the form is saved from the source view. The editor stays mounted behind
75
+ // the textarea (`v-show`), so its history survives the switch.
76
+ const SOURCE_SYNC_DELAY_MS = 250;
77
+
78
+ const hasSourceView = props.descriptor.attrs?.source === true;
79
+ const sourceMode = ref(false);
80
+ const sourceHtml = ref("");
81
+ const sourceHintId = useId();
82
+ // Whether the textarea holds typing the editor has not received yet.
83
+ let sourcePending = false;
84
+
85
+ const isLocked = computed(() => props.readonly || props.disabled);
86
+ const isToolbarDisabled = computed(() => isLocked.value || sourceMode.value);
87
+
88
+ /** Writes the textarea's typing into the editor and emits the result. */
89
+ function flushSource() {
90
+ syncSource.cancel();
91
+ const current = editor.value;
92
+ if (!current) return;
93
+ if (!sourcePending) return;
94
+ sourcePending = false;
95
+ const before = current.getHTML();
96
+ current.commands.setContent(sanitizeHtml(sourceHtml.value), false);
97
+ const after = current.getHTML();
98
+ // Like the visual editor, emit only when the document changed: typing that
99
+ // the schema drops, or whitespace, leaves the value as it is.
100
+ const documentChanged = after !== before;
101
+ if (documentChanged) emit("update:modelValue", after);
102
+ }
103
+
104
+ const syncSource = debounce(flushSource, SOURCE_SYNC_DELAY_MS);
105
+
106
+ function onSourceInput(value: unknown) {
107
+ if (isLocked.value) return;
108
+ sourceHtml.value = String(value ?? "");
109
+ sourcePending = true;
110
+ syncSource();
111
+ }
112
+
113
+ function toggleSource() {
114
+ const current = editor.value;
115
+ if (!current) return;
116
+ if (sourceMode.value) {
117
+ // The editor is up to date once the last typing is in.
118
+ flushSource();
119
+ sourceMode.value = false;
120
+ return;
121
+ }
122
+ sourceHtml.value = formatHtml(current.getHTML());
123
+ sourceMode.value = true;
124
+ }
125
+
126
+ // Sync modelValue esterno → editor (es. reset dopo save). The field's own
127
+ // emits come back here as the editor's HTML and are skipped, so the textarea
128
+ // is never rewritten under the cursor.
107
129
  watch(
108
130
  () => props.modelValue,
109
131
  (val) => {
@@ -112,11 +134,56 @@ watch(
112
134
  sanitizeHtml((val as string) ?? ""),
113
135
  false,
114
136
  );
137
+ if (!sourceMode.value) return;
138
+ // A value from outside (a reset, a draft) replaces the typing.
139
+ syncSource.cancel();
140
+ sourcePending = false;
141
+ sourceHtml.value = formatHtml(editor.value.getHTML());
115
142
  }
116
143
  },
117
144
  );
118
145
 
119
- onBeforeUnmount(() => editor.value?.destroy());
146
+ onBeforeUnmount(() => {
147
+ // Typing still waiting for the pause is not lost when the field goes away.
148
+ flushSource();
149
+ editor.value?.destroy();
150
+ });
151
+
152
+ // ─── Custom toolbar buttons (`attrs.toolbar`) ─────────────────────────────
153
+ const toolbarItems: EditorToolbarItem[] = props.descriptor.attrs?.toolbar ?? [];
154
+
155
+ /**
156
+ * Asks an item's predicate about the editor; no predicate means `false`. One
157
+ * that throws (a command whose extension the field does not load) gives
158
+ * `fallback` instead of breaking the toolbar.
159
+ */
160
+ function askItem(
161
+ question: (editor: EditorToolbarEditor) => boolean | undefined,
162
+ fallback: boolean,
163
+ ): boolean {
164
+ const current = editor.value;
165
+ if (!current) return fallback;
166
+ try {
167
+ return question(current) ?? false;
168
+ } catch {
169
+ return fallback;
170
+ }
171
+ }
172
+
173
+ function isItemDisabled(item: EditorToolbarItem): boolean {
174
+ if (isToolbarDisabled.value) return true;
175
+ return askItem((current) => item.isDisabled?.(current), true);
176
+ }
177
+
178
+ function isItemActive(item: EditorToolbarItem): boolean {
179
+ return askItem((current) => item.isActive?.(current), false);
180
+ }
181
+
182
+ function runItem(item: EditorToolbarItem) {
183
+ const current = editor.value;
184
+ if (!current) return;
185
+ item.action(current);
186
+ }
120
187
 
121
188
  // ─── Image insertion ──────────────────────────────────────────────────────
122
189
  // MapoMediaManagerDialog is globally registered by @mapomodule/uikit.
@@ -161,7 +228,7 @@ function onImageConfirm(
161
228
  size="xs"
162
229
  variant="ghost"
163
230
  color="neutral"
164
- :disabled="readonly || disabled"
231
+ :disabled="isToolbarDisabled"
165
232
  :class="{ 'bg-gray-200': editor.isActive('bold') }"
166
233
  @click="editor.chain().focus().toggleBold().run()"
167
234
  >
@@ -171,7 +238,7 @@ function onImageConfirm(
171
238
  size="xs"
172
239
  variant="ghost"
173
240
  color="neutral"
174
- :disabled="readonly || disabled"
241
+ :disabled="isToolbarDisabled"
175
242
  :class="{ 'bg-gray-200': editor.isActive('italic') }"
176
243
  @click="editor.chain().focus().toggleItalic().run()"
177
244
  >
@@ -181,7 +248,7 @@ function onImageConfirm(
181
248
  size="xs"
182
249
  variant="ghost"
183
250
  color="neutral"
184
- :disabled="readonly || disabled"
251
+ :disabled="isToolbarDisabled"
185
252
  :class="{ 'bg-gray-200': editor.isActive('underline') }"
186
253
  @click="editor.chain().focus().toggleUnderline().run()"
187
254
  >
@@ -194,7 +261,7 @@ function onImageConfirm(
194
261
  size="xs"
195
262
  variant="ghost"
196
263
  color="neutral"
197
- :disabled="readonly || disabled"
264
+ :disabled="isToolbarDisabled"
198
265
  :class="{ 'bg-gray-200': editor.isActive('heading', { level: 2 }) }"
199
266
  @click="editor.chain().focus().toggleHeading({ level: 2 }).run()"
200
267
  >
@@ -204,7 +271,7 @@ function onImageConfirm(
204
271
  size="xs"
205
272
  variant="ghost"
206
273
  color="neutral"
207
- :disabled="readonly || disabled"
274
+ :disabled="isToolbarDisabled"
208
275
  :class="{ 'bg-gray-200': editor.isActive('heading', { level: 3 }) }"
209
276
  @click="editor.chain().focus().toggleHeading({ level: 3 }).run()"
210
277
  >
@@ -217,7 +284,7 @@ function onImageConfirm(
217
284
  size="xs"
218
285
  variant="ghost"
219
286
  color="neutral"
220
- :disabled="readonly || disabled"
287
+ :disabled="isToolbarDisabled"
221
288
  :class="{ 'bg-gray-200': editor.isActive('bulletList') }"
222
289
  icon="i-lucide-list"
223
290
  @click="editor.chain().focus().toggleBulletList().run()"
@@ -226,7 +293,7 @@ function onImageConfirm(
226
293
  size="xs"
227
294
  variant="ghost"
228
295
  color="neutral"
229
- :disabled="readonly || disabled"
296
+ :disabled="isToolbarDisabled"
230
297
  :class="{ 'bg-gray-200': editor.isActive('orderedList') }"
231
298
  icon="i-lucide-list-ordered"
232
299
  @click="editor.chain().focus().toggleOrderedList().run()"
@@ -238,7 +305,7 @@ function onImageConfirm(
238
305
  size="xs"
239
306
  variant="ghost"
240
307
  color="neutral"
241
- :disabled="readonly || disabled"
308
+ :disabled="isToolbarDisabled"
242
309
  icon="i-lucide-undo"
243
310
  @click="editor.chain().focus().undo().run()"
244
311
  />
@@ -246,7 +313,7 @@ function onImageConfirm(
246
313
  size="xs"
247
314
  variant="ghost"
248
315
  color="neutral"
249
- :disabled="readonly || disabled"
316
+ :disabled="isToolbarDisabled"
250
317
  icon="i-lucide-redo"
251
318
  @click="editor.chain().focus().redo().run()"
252
319
  />
@@ -267,18 +334,81 @@ function onImageConfirm(
267
334
  variant="ghost"
268
335
  color="neutral"
269
336
  icon="i-lucide-image"
270
- :disabled="readonly || disabled || !hasMediaManager"
337
+ :disabled="isToolbarDisabled || !hasMediaManager"
271
338
  @click="imagePickerOpen = true"
272
339
  />
273
340
  </UTooltip>
341
+
342
+ <!-- Custom buttons (`attrs.toolbar`), after the built-in ones -->
343
+ <template v-if="toolbarItems.length">
344
+ <USeparator orientation="vertical" class="mx-1 h-5" />
345
+ <UTooltip
346
+ v-for="item in toolbarItems"
347
+ :key="item.key"
348
+ :text="item.label"
349
+ :delay-duration="300"
350
+ >
351
+ <UButton
352
+ size="xs"
353
+ variant="ghost"
354
+ color="neutral"
355
+ :icon="item.icon"
356
+ :label="item.icon ? undefined : item.label"
357
+ :aria-label="item.label"
358
+ :disabled="isItemDisabled(item)"
359
+ :class="{ 'bg-gray-200': isItemActive(item) }"
360
+ @click="runItem(item)"
361
+ />
362
+ </UTooltip>
363
+ </template>
364
+
365
+ <!-- HTML source toggle (`attrs.source`): stays active in the source
366
+ view, and on a read-only field, which can show its source. -->
367
+ <template v-if="hasSourceView">
368
+ <USeparator orientation="vertical" class="mx-1 h-5" />
369
+ <UTooltip :text="t('mapo.wygEditor.source')" :delay-duration="300">
370
+ <UButton
371
+ size="xs"
372
+ variant="ghost"
373
+ color="neutral"
374
+ icon="i-lucide-code-xml"
375
+ :aria-label="t('mapo.wygEditor.source')"
376
+ :aria-pressed="sourceMode"
377
+ :class="{ 'bg-gray-200': sourceMode }"
378
+ @click="toggleSource"
379
+ />
380
+ </UTooltip>
381
+ </template>
274
382
  </div>
275
383
 
276
- <!-- Editor content -->
384
+ <!-- Editor content: hidden, not unmounted, in the source view -->
277
385
  <EditorContent
386
+ v-show="!sourceMode"
278
387
  :editor="editor"
279
388
  class="prose prose-sm max-w-none px-3 py-2 focus-within:outline-none"
280
389
  />
281
390
 
391
+ <div v-if="sourceMode" class="px-3 py-2">
392
+ <UTextarea
393
+ :model-value="sourceHtml"
394
+ autoresize
395
+ :rows="6"
396
+ :readonly="isLocked"
397
+ spellcheck="false"
398
+ autocapitalize="off"
399
+ autocomplete="off"
400
+ :aria-label="t('mapo.wygEditor.source')"
401
+ :aria-describedby="sourceHintId"
402
+ :ui="{ base: 'font-mono text-xs' }"
403
+ class="w-full"
404
+ @update:model-value="onSourceInput"
405
+ @blur="flushSource"
406
+ />
407
+ <p :id="sourceHintId" class="mt-1 text-xs text-muted">
408
+ {{ t("mapo.wygEditor.sourceHint") }}
409
+ </p>
410
+ </div>
411
+
282
412
  <p
283
413
  v-for="err in errors"
284
414
  :key="err"
@@ -284,12 +284,74 @@ export interface FileDescriptor<
284
284
  attrs?: { accept?: string; maxSize?: number };
285
285
  }
286
286
 
287
+ /**
288
+ * The Tiptap editor a toolbar button acts on, described by the members a button
289
+ * needs so that the descriptor types do not depend on Tiptap. At runtime it is
290
+ * the field's Tiptap `Editor`: cast it for the rest of its API. The command
291
+ * builders are untyped because the commands available depend on the extensions
292
+ * the field loads (`attrs.extensions`).
293
+ */
294
+ export interface EditorToolbarEditor {
295
+ /** Starts a command chain, as in `editor.chain().focus().toggleBold().run()`. */
296
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
297
+ chain(): any;
298
+ /** Dry-runs commands: `editor.can().addRowAfter()` is `true` when the command would apply. */
299
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
300
+ can(): any;
301
+ /** Runs one command, as in `editor.commands.setHorizontalRule()`. */
302
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
303
+ readonly commands: any;
304
+ /** Whether a mark or a node is active at the selection, as in `editor.isActive('table')`. */
305
+ isActive(name: string, attributes?: Record<string, unknown>): boolean;
306
+ }
307
+
308
+ /**
309
+ * A button that `attrs.toolbar` adds to an editor field, after the built-in
310
+ * buttons. Methods, not function properties: a function typed with Tiptap's own
311
+ * `Editor` fits them too.
312
+ */
313
+ export interface EditorToolbarItem {
314
+ /** Identifies the button among the custom ones; unique within the toolbar. */
315
+ key: string;
316
+ /** Tooltip and accessible name of the button; its text when it has no `icon`. */
317
+ label: string;
318
+ /** Icon name, as `UButton` takes it (e.g. `i-lucide-table`). */
319
+ icon?: string;
320
+ /** Runs on click, as in `(editor) => editor.chain().focus().insertTable().run()`. */
321
+ action(editor: EditorToolbarEditor): void;
322
+ /** Shows the button as active, like the built-in ones on bold text or a heading. */
323
+ isActive?(editor: EditorToolbarEditor): boolean;
324
+ /**
325
+ * Disables the button, as in `(editor) => !editor.can().addRowAfter()`. The
326
+ * button is also disabled when the field is read-only and in the source view.
327
+ */
328
+ isDisabled?(editor: EditorToolbarEditor): boolean;
329
+ }
330
+
287
331
  /** Descriptor for a Tiptap rich-text editor. */
288
332
  export interface EditorDescriptor<
289
333
  T = Record<string, unknown>,
290
334
  > extends FieldBase<T> {
291
335
  type: `${KnownFieldType.Editor}`;
292
- attrs?: { extensions?: unknown[] };
336
+ attrs?: {
337
+ /** Tiptap v2 extensions loaded after the built-in ones (StarterKit, Link, Underline, Image). */
338
+ extensions?: unknown[];
339
+ /**
340
+ * Adds an HTML source toggle at the end of the toolbar. The source view
341
+ * edits the HTML in a textarea; what it saves goes through the editor, so it
342
+ * is sanitized, and the tags and attributes no extension supports are
343
+ * dropped. A read-only field shows the source without letting it change.
344
+ * Default: `false`.
345
+ */
346
+ source?: boolean;
347
+ /**
348
+ * Buttons added after the built-in ones, past a separator: typically the
349
+ * commands of the `extensions` the field loads. Each item is
350
+ * `{ key, label, icon?, action(editor), isActive?(editor), isDisabled?(editor) }`.
351
+ * Disabled when the field is read-only and in the source view.
352
+ */
353
+ toolbar?: EditorToolbarItem[];
354
+ };
293
355
  }
294
356
 
295
357
  /** Descriptor for the SEO preview field (title + description + live SERP preview). */
@@ -18,6 +18,8 @@ export type {
18
18
  ColorDescriptor,
19
19
  FileDescriptor,
20
20
  EditorDescriptor,
21
+ EditorToolbarItem,
22
+ EditorToolbarEditor,
21
23
  SeoDescriptor,
22
24
  MapDescriptor,
23
25
  RepeaterDescriptor,