@joryio/web-sdk 1.4.0-beta.6 → 1.4.0-beta.7
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/CHANGELOG.md +6 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/editor/editor-model.d.ts +16 -8
- package/dist/editor/editor-model.d.ts.map +1 -1
- package/dist/editor/editor-strings.d.ts +11 -1
- package/dist/editor/editor-strings.d.ts.map +1 -1
- package/dist/editor/editor-ui.d.ts +3 -2
- package/dist/editor/editor-ui.d.ts.map +1 -1
- package/dist/editor/liquid-field.d.ts +22 -0
- package/dist/editor/liquid-field.d.ts.map +1 -0
- package/dist/editor/visual-editor.d.ts +6 -0
- package/dist/editor/visual-editor.d.ts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/joryio-cards-ui.min.js +1 -1
- package/dist/joryio-editor.min.js +2 -2
- package/dist/joryio-editor.min.js.map +1 -1
- package/dist/joryio-sw.js +1 -1
- package/dist/joryio.cjs.js +2 -2
- package/dist/joryio.min.js +2 -2
- package/dist/joryio.min.js.map +1 -1
- package/dist/joryio.mjs +2 -2
- package/dist/joryio.umd.js +2 -2
- package/package.json +1 -1
- package/src/core/config.ts +1 -1
- package/src/editor/editor-model.ts +89 -38
- package/src/editor/editor-strings.ts +11 -1
- package/src/editor/editor-ui.ts +33 -5
- package/src/editor/liquid-field.ts +301 -0
- package/src/editor/visual-editor.ts +280 -63
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## 1.4.0 - 2026-11-18
|
|
4
4
|
|
|
5
|
+
Changed (1.4.0-beta.7): a fallback per variable in the editor's "New text" field. A click on a pill (or Enter / Space on it) opens a small popover, "If <field> is missing" with one input, that writes `| default: "..."` on that variable only; a pill with a fallback shows it after its name ("firstName · friend"). The single "If a value is missing" field, which wrote one fallback onto every variable of the text, is gone; an existing edit loads with each variable's own default on its pill (text saved with the old field has it on its variables, now shown per pill), untouched variables keep their Liquid byte for byte. The fallback is plain text: Liquid in it (`{{`, `{%`) is refused with a short note. Quoting: `"..."`, `'...'` when the text has a `"`, and with both kinds each `'` becomes the typographic apostrophe (Liquid has no escape inside a string), so nothing typed is dropped. Esc, Enter or Done closes the popover (Esc does not close the panel); it sits in the panel's flow, so it follows a right-to-left panel. The live preview resolves each variable on its own: its sample value, else its own fallback, else the placeholder pill. New editor words `fallbackFor` ("If {name} is missing"), `fallbackBad`, `fallbackDone`; `fallback` is no longer used (a dashboard may keep sending it).
|
|
6
|
+
|
|
7
|
+
Changed (1.4.0-beta.7): "Create content for this slot →" in the editor's Add content slot. A saved slot edit - right after Save, and when an existing slot edit is opened - shows what fills that slot: no campaign, a "Create content for this slot →" button; campaigns, "In this slot: <name> (status)" (each clickable) and "+ Add another campaign". The editor never calls the Joryio API: `joryio:editor-context` `placements` entries may carry `campaigns: [{ id, name, status, statusLabel? }]`, and a dashboard that handles the shortcut sets `openSlot: true`; a click posts `joryio:editor-open-slot { placementKey, campaignId? }` to the dashboard (origin- and window-checked like every message) and focuses the dashboard tab, which opens the campaign or a new Placement campaign for that slot. Without `openSlot` (a dashboard before this) a slot saves and closes the panel as before and no shortcut shows; 1.4.0-beta.6 ignores both new context fields. New editor words `slotCreate`, `slotIn`, `slotAddAnother`. `joryio-editor.min.js` 16992 bytes gzip (budget 17000). Web only: iOS, Android, React Native and Unity are not applicable - the editor edits a web page in a browser tab, and the other SDKs have no editor.
|
|
8
|
+
|
|
9
|
+
Changed (1.4.0-beta.7): the on-site Web personalization editor (`joryio-editor.min.js`) shows variables as placeholder pills. In the live preview on the page, a variable with no sample value from the dashboard and no fallback (`| default:`) is a small rounded pill with the field name (`firstName`) in the editor's teal, instead of the text `[firstName]`, so it cannot be mistaken for page text: an inline custom element with its own shadow root (the site's CSS cannot restyle it, the site's `:nth-of-type` selectors do not move), on the element's own line height, its own bidi island in a right-to-left page; a click on it selects the element it is in and never reaches the site. With a sample value the page shows the value, with only a fallback the fallback, as before. The side panel's "New text" field shows the same pills in the text: an Insert chip puts a pill at the caret; a pill is one token (Backspace / Delete remove all of it, the arrow keys step over it, copy puts its Liquid on the clipboard, paste is plain text and its Liquid becomes pills). The stored value is the same Liquid as before (`{{ user.firstName }}`, `| default:` from "If a value is missing"). The Insert row takes the dashboard's full personalization catalog: `attributes` in `joryio:editor-context` may be `{ key, label, group }` (`key` the Liquid path, inserted as is) as well as the older `{ name, custom? }`; the common fields (first name, last name, email, city when present, else the first ones) are chips with their labels, and "More…" opens a searchable picker grouped by `group` (↑ / ↓ and Enter in the search box, Esc closes it) that inserts the same Liquid a chip does, as a pill with the label. A new collapsible "Liquid code" section shows and edits the raw text; Liquid a pill cannot show (`{% if %}`, filters other than `default`) keeps the field as raw text with a short note, so nothing is lost. Fixed: selecting an element that already has an edit (a click, the arrow keys, the breadcrumb) opened a fresh draft with the page's original text while the page showed the edit ("Blog" in the field, "Blog 123" on the page), and its Save made a second edit; it now opens that edit - the latest one when the element has several, with a dot on the tiles of its other edits, which open them - with its value, its fallback and "Was:" the page's original text, and Save updates the same edit (an edit from the dashboard's context too). The page-edit rendering for visitors is unchanged: visitors never see pills. `joryio-editor.min.js` 16087 bytes gzip, budget raised from 14000 to 17000 (loaded only in a tab the dashboard opened for the editor). Web only: iOS, Android, React Native and Unity are not applicable - the editor edits a web page in a browser tab, and the other SDKs have no editor and no page-edit preview.
|
|
10
|
+
|
|
5
11
|
Changed (1.4.0-beta.6): the on-site Web personalization editor (`joryio-editor.min.js`) is redesigned (Joryio BACKLOG D444, design handoff screens 1-3). All of its UI is in one closed shadow root on an `all: initial` host, so the site's CSS cannot restyle it and its CSS cannot reach the site; the previews it puts in the page are custom elements with their own shadow roots (never a `div`, so the site's `:nth-of-type` selectors do not move). Hover shows a dashed outline with a label ("Heading · h1"); a click selects (it never reaches the site); arrow up / down, two buttons and a breadcrumb ("Page › Main › Heading") move to the element around it or the first one inside it. A light side panel names the element and how many elements its selector matches (1 match / "Matches N - all will change" / Not found) and offers Change text, Change link (off with "Not a link"), Change image (images only, `replace_image`), Hide it and Add content slot (`insert_placement`, Above it / Below it / Instead of it = position `replace` / inside at the start or end), each with its own field: the new text with "Was:", Insert chips for profile fields (`{{ user.firstName }}`, the dashboard's format) and "If a value is missing" (the `| default:`); the address; the slot name, turned into a placement key as typed ("after blog" -> `after_blog`, never refused). A collapsible CSS selector field for developers. Every edit shows live on the page while editing, with the dashboard's sample values for the variables, else their fallbacks; text is set as text, addresses must be http(s), and the original nodes come back on cancel, undo and stop. A dock shows campaign, variant and page, "N edits" (a click jumps to that edit), Undo and "Save & return to Joryio" (Esc still finishes). New messages with the dashboard, all origin- and window-checked: `joryio:editor-context` (dashboard -> editor: campaign and variant names, the variant's edits, profile fields, placements, sample values, translated words and `dir`), `joryio:editor-focus` `{ id }` (jump to an edit), `joryio:editor-remove` `{ id }` (Undo of a new edit) and `joryio:editor-done`; `joryio:editor-pick` now carries the edit's `id` (an id the dashboard has replaces that edit). A dashboard that sends no context works as before, with Undo off. The editor's words are English unless the dashboard sends its translations. `joryio-editor.min.js` 13127 bytes gzip, budget raised from 3500 to 14000 (loaded only in a tab the dashboard opened for the editor; no visitor downloads it). Web only: iOS, Android, React Native and Unity are not applicable - the editor edits a web page in a browser tab.
|
|
6
12
|
|
|
7
13
|
Fixed (1.4.0-beta.6): a beta reports its own version. The release build writes the beta (`1.4.0-beta.6`) into `SDK_VERSION` of the published copy, not only into `package.json`: the beta sends it in `X-Joryio-SDK-Version`, and its side files (`joryio-cards-ui.min.js`, `joryio-editor.min.js`) are loaded from `sdk.joryio.com/web/1.4.0-beta.6/`. Before, a beta said `1.4.0`, so an npm beta (bundled into the site, or loaded from a CDN that is not sdk.joryio.com) asked `web/1.4.0/` and `web/1/` - neither exists for a beta - and the card feed showed `unavailable`. A pre-release never falls back to the major channel `web/<major>/` (it holds finals only); a final keeps it as the last resort. The source keeps saying `1.4.0`. The same fix on iOS, Android, React Native and Unity.
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.4.0-beta.
|
|
1
|
+
export declare const SDK_VERSION = "1.4.0-beta.7";
|
|
2
2
|
export declare const SDK_PLATFORM_HEADER = "X-Joryio-SDK";
|
|
3
3
|
export declare const SDK_VERSION_HEADER = "X-Joryio-SDK-Version";
|
|
4
4
|
export declare const SDK_PLATFORM = "web";
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { EditorStringKey } from './editor-strings';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
8
|
-
export declare
|
|
9
|
-
export
|
|
2
|
+
export declare const quoted: (fallback: string) => string;
|
|
3
|
+
export declare const isPlainFallback: (v: string) => boolean;
|
|
4
|
+
export declare function varFallback(src: string): string | null;
|
|
5
|
+
export declare function setVarFallback(src: string, fallback: string): string;
|
|
6
|
+
export declare const variableTag: (name: string, custom: boolean, fallback?: string | null) => string;
|
|
7
|
+
export declare const pathTag: (path: string, fallback?: string | null) => string;
|
|
8
|
+
export declare const VAR_PATH: RegExp;
|
|
9
|
+
export interface LiquidVar {
|
|
10
|
+
name: string;
|
|
11
|
+
path: string;
|
|
12
|
+
src: string;
|
|
13
|
+
}
|
|
14
|
+
export type LiquidPart = string | LiquidVar;
|
|
15
|
+
export declare function previewParts(value: string, sample: Record<string, string>): LiquidPart[];
|
|
16
|
+
export declare const previewText: (value: string, sample: Record<string, string>) => string;
|
|
17
|
+
export declare function liquidParts(value: string): LiquidPart[] | null;
|
|
10
18
|
export declare function slugify(name: string): string;
|
|
11
19
|
export declare const newEditId: () => string;
|
|
12
20
|
export declare function kindKey(tagOrSelector: string, isSelector?: boolean): EditorStringKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-model.d.ts","sourceRoot":"","sources":["../../src/editor/editor-model.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor-model.d.ts","sourceRoot":"","sources":["../../src/editor/editor-model.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAYxD,eAAO,MAAM,MAAM,GAAI,UAAU,MAAM,KAAG,MACuF,CAAC;AAGlI,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,KAAG,OAA6D,CAAC;AAG1G,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAItD;AAGD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGpE;AAGD,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAQ,OAAO,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,MAA4E,CAAC;AAGnK,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,MAAuF,CAAC;AAGzJ,eAAO,MAAM,QAAQ,QAAsE,CAAC;AAG5F,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AACD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AAW5C,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,UAAU,EAAE,CAuBxF;AAGD,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,MAAsG,CAAC;AAWnL,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,IAAI,CAe9D;AAGD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ5C;AAGD,eAAO,MAAM,SAAS,QAAO,MAAsE,CAAC;AAGpG,wBAAgB,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,eAAe,CAoBlF"}
|
|
@@ -34,8 +34,15 @@ export declare const EDITOR_STRINGS: {
|
|
|
34
34
|
newText: string;
|
|
35
35
|
was: string;
|
|
36
36
|
insert: string;
|
|
37
|
-
|
|
37
|
+
fallbackFor: string;
|
|
38
38
|
fallbackHelp: string;
|
|
39
|
+
fallbackBad: string;
|
|
40
|
+
fallbackDone: string;
|
|
41
|
+
liquid: string;
|
|
42
|
+
more: string;
|
|
43
|
+
search: string;
|
|
44
|
+
noMatch: string;
|
|
45
|
+
rawNote: string;
|
|
39
46
|
newLink: string;
|
|
40
47
|
newImage: string;
|
|
41
48
|
urlBad: string;
|
|
@@ -45,6 +52,9 @@ export declare const EDITOR_STRINGS: {
|
|
|
45
52
|
savedAs: string;
|
|
46
53
|
slotHelp: string;
|
|
47
54
|
slotEmpty: string;
|
|
55
|
+
slotCreate: string;
|
|
56
|
+
slotIn: string;
|
|
57
|
+
slotAddAnother: string;
|
|
48
58
|
where: string;
|
|
49
59
|
posBefore: string;
|
|
50
60
|
posAfter: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-strings.d.ts","sourceRoot":"","sources":["../../src/editor/editor-strings.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"editor-strings.d.ts","sourceRoot":"","sources":["../../src/editor/editor-strings.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmF1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,cAAc,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAG5D,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,CASzD;AAGD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,GAAG,MAAM,CAErF"}
|
|
@@ -19,7 +19,8 @@ export type IconName = keyof typeof ICONS;
|
|
|
19
19
|
export declare function icon(name: IconName, size?: number): SVGSVGElement;
|
|
20
20
|
export declare const HOST_STYLE = "all:initial !important;position:fixed !important;top:0 !important;left:0 !important;width:0 !important;height:0 !important;z-index:2147483647 !important;display:block !important";
|
|
21
21
|
export declare const PREVIEW_HOST_STYLE = "all:initial !important;display:block !important;margin:10px 0 !important";
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
22
|
+
export declare const PREVIEW_VAR_HOST_STYLE = "all:unset !important;display:inline !important;unicode-bidi:isolate !important";
|
|
23
|
+
export declare const PREVIEW_CSS = ".v{font-family:ui-monospace,\"SF Mono\",Menlo,monospace;font-size:.8em;font-weight:600;line-height:1;padding:.12em .5em;border-radius:999px;background:rgba(0,169,154,.14);color:#0F766E;box-shadow:inset 0 0 0 1px rgba(0,169,154,.5);white-space:nowrap;unicode-bidi:isolate;font-style:normal;text-transform:none;letter-spacing:0}.s,.x{font:12.5px/1.4 Inter,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;border-radius:10px;padding:14px 16px;text-align:center}.s{border:2px dashed #7A6CFF;background:#F4F2FF;color:#4C3FD1}.s b{font-weight:700}.s code{font-family:ui-monospace,\"SF Mono\",Menlo,monospace}.s div{font-size:11.5px;color:#6B5FD9;margin-top:3px}.x{border:1.5px dashed #F04438;background:#FEF3F2;color:#B42318;text-align:start;padding:10px 12px;font-size:12px}";
|
|
24
|
+
export declare const EDITOR_CSS = "\n*{box-sizing:border-box}\n.r{font:13px/1.4 Inter,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;color:#242B3A;-webkit-font-smoothing:antialiased}\nbutton{font:inherit;color:inherit;cursor:pointer}\nbutton:disabled{cursor:not-allowed}\nbutton:focus-visible,input:focus-visible,textarea:focus-visible,.ce:focus{outline:2px solid #31D6C8;outline-offset:1px}\n.box{position:fixed;pointer-events:none;border:2px dashed #00A99A;background:rgba(0,169,154,.07);border-radius:4px;display:none}\n.box.sel{border-style:solid;background:rgba(0,169,154,.04)}\n.chip{position:absolute;bottom:100%;inset-inline-start:-2px;margin-bottom:2px;background:#00A99A;color:#fff;font-size:11px;font-weight:600;padding:3px 8px;border-radius:6px 6px 6px 0;white-space:nowrap;max-width:60vw;overflow:hidden;text-overflow:ellipsis}\n.help{position:fixed;top:16px;inset-inline-end:16px;width:240px;background:#fff;border:1px solid #E5EAF2;border-radius:10px;box-shadow:0 8px 24px rgba(10,18,64,.14);padding:10px 12px}\n.help h3{margin:0 0 6px;font-size:11px;font-weight:700;color:#6B7280;letter-spacing:.5px;text-transform:uppercase}\n.help .row{display:flex;align-items:center;gap:8px;font-size:12px;padding:3px 0}\n.kbd{min-width:38px;text-align:center;font-size:11px;font-weight:600;border:1px solid #E5EAF2;border-radius:5px;padding:1px 5px;background:#F8FAFC}\n.help .x{position:absolute;top:6px;inset-inline-end:6px;border:0;background:none;color:#8990A8;padding:2px;display:grid}\n.dock{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:6px;background:#071342;color:#fff;border-radius:14px;padding:7px 7px 7px 14px;box-shadow:0 12px 32px rgba(10,18,64,.35);white-space:nowrap;max-width:calc(100vw - 24px)}\n.r.open .dock{left:calc(50% - 190px)}\n.r.open[dir=rtl] .dock{left:calc(50% + 190px)}\n.logo{width:22px;height:22px;border-radius:6px;background:#fff;color:#071342;display:grid;place-items:center;font-weight:800;font-size:13px;flex:none}\n.name{font-size:12.5px;font-weight:600;margin-inline-start:4px;overflow:hidden;text-overflow:ellipsis;max-width:200px}\n.sub{font-size:12px;color:#A8AEC1;overflow:hidden;text-overflow:ellipsis;max-width:220px}\n.sep{width:1px;height:22px;background:#2A3366;margin:0 8px;flex:none}\n.hint{font-size:12px;color:#C9CEDD;display:inline-flex;align-items:center;gap:6px}\n.hint svg{color:#31D6C8}\n.db{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border-radius:8px;border:0;background:#1B245A;color:#fff;font-size:12.5px;font-weight:600}\n.ib{height:32px;width:32px;border-radius:8px;border:0;background:transparent;color:#fff;display:grid;place-items:center}\n.ib:disabled{color:#4A527A}\n.go{height:32px;padding:0 14px;border-radius:8px;border:0;background:#31D6C8;color:#071342;font-size:12.5px;font-weight:700}\n.pop{position:absolute;bottom:calc(100% + 10px);left:0;right:0;min-width:280px;max-height:50vh;overflow:auto;background:#fff;color:#242B3A;border-radius:12px;border:1px solid #E5EAF2;box-shadow:0 12px 32px rgba(10,18,64,.18);padding:6px;white-space:normal}\n.pop .e{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:none;border-radius:8px;font-size:12.5px;text-align:start}\n.pop .e:hover{background:#F8FAFC}\n.pop .empty{padding:12px;font-size:12.5px;color:#6B7280}\n.num{width:20px;height:20px;border-radius:99px;background:#071342;color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center;flex:none}\n.panel{position:fixed;top:0;bottom:0;inset-inline-end:0;width:380px;max-width:100vw;background:#fff;border-inline-start:1px solid #E5EAF2;box-shadow:-8px 0 24px rgba(10,18,64,.06);display:flex;flex-direction:column}\n.hd{padding:16px 18px 14px;border-bottom:1px solid #E5EAF2}\n.crumbs{display:flex;align-items:center;flex-wrap:wrap;gap:4px;font-size:11.5px;color:#6B7280;margin-bottom:6px}\n.crumbs svg{color:#A8AEC1}\n.crumb{border:0;background:transparent;color:#6B7280;font-weight:500;font-size:11.5px;padding:2px 6px;border-radius:5px}\n.crumb.cur{background:#E5F9F6;color:#0F766E;font-weight:600}\n.nav{margin-inline-start:auto;display:flex;gap:2px}\n.nav button{border:1px solid #E5EAF2;background:#fff;border-radius:6px;width:24px;height:22px;display:grid;place-items:center;color:#3A4060;padding:0}\n.nav button:disabled{opacity:.4}\n.tr{display:flex;align-items:center;gap:10px}\n.title{font-size:17px;font-weight:700;color:#0A1240;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}\n.pill{margin-inline-start:auto;display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;padding:3px 8px;border-radius:999px;white-space:nowrap;flex:none}\n.pill.ok{background:#E5F9F6;color:#0F766E}\n.pill.many{background:#FFF7E6;color:#92400E}\n.pill.none{background:#FEF3F2;color:#B42318}\n.bd{padding:16px 18px;overflow:auto;flex:1}\n.lbl{display:block;font-size:12.5px;font-weight:600;color:#242B3A;margin-bottom:8px}\n.tiles{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:18px}\n.tile{display:flex;align-items:center;gap:9px;padding:10px 11px;border-radius:10px;text-align:start;background:#fff;border:1.5px solid #E5EAF2;color:#3A4060}\n.tile[aria-checked=true]{background:#E5F9F6;border-color:#00C8B7;color:#0F766E}\n.tile.slot[aria-checked=true]{background:#F4F2FF;border-color:#7A6CFF;color:#4C3FD1}\n.tile:disabled{opacity:.55}\n.tile[data-e]>span::after{content:'';display:inline-block;width:6px;height:6px;border-radius:9px;background:#00A99A;margin-inline-start:6px;vertical-align:middle}\n.tile b{display:block;font-size:12.5px;font-weight:600;color:#0A1240}\n.tile small{display:block;font-size:10.5px;color:#6B7280}\n.fr{display:flex;align-items:baseline;margin-bottom:8px}\n.fr .lbl{margin:0}\n.was{margin-inline-start:auto;font-size:11.5px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:55%}\ntextarea,input,.ce{width:100%;font:inherit;font-size:13.5px;color:#0F1424;padding:10px 12px;border-radius:10px;border:1.5px solid #E5EAF2;background:#fff;outline:none}\ntextarea,.ce{line-height:1.5;resize:vertical;border-color:#00C8B7}\n.ce{min-height:72px;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text}\n.vp{font-family:ui-monospace,\"SF Mono\",Menlo,monospace;font-size:.8em;font-weight:600;line-height:1;padding:.12em .5em;border-radius:999px;background:rgba(0,169,154,.14);color:#0F766E;box-shadow:inset 0 0 0 1px rgba(0,169,154,.5);white-space:nowrap;unicode-bidi:isolate;font-style:normal;text-transform:none;letter-spacing:0;cursor:pointer}\n.vp .vfb{font-weight:400;opacity:.75}\n.fbp .vc{margin-top:8px}\n.slotc{display:flex;flex-direction:column;align-items:flex-start;gap:6px}\n.slotc .lbl{margin:0}\n.lnk{border:0;background:none;padding:0;color:#4C3FD1;font-size:12.5px;font-weight:600;text-align:start}\ntextarea.mono{height:auto}\ninput{height:40px;padding:0 12px}\ninput.slotin{border-color:#7A6CFF}\n.mono{font-family:ui-monospace,\"SF Mono\",Menlo,monospace;font-size:12px;height:36px;background:#F8FAFC;border-width:1px}\n.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}\n.chips span{font-size:11.5px;color:#6B7280;margin-inline-end:2px}\n.vc{font-family:ui-monospace,\"SF Mono\",Menlo,monospace;font-size:11.5px;padding:3px 8px;border-radius:6px;border:1px solid #E5EAF2;background:#F8FAFC;color:#3A4060}\n.pk{margin-top:8px;border:1px solid #E5EAF2;border-radius:10px;padding:6px;background:#fff;box-shadow:0 8px 24px rgba(10,18,64,.1)}\n.pk input{height:34px}\n.pk [role=listbox]{max-height:220px;overflow:auto;margin-top:4px}\n.pk .g{font-size:10.5px;font-weight:700;color:#6B7280;text-transform:uppercase;letter-spacing:.4px;padding:8px 8px 3px}\n.pk .o{display:flex;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;border-radius:7px;font-size:12.5px;cursor:pointer}\n.pk .o[aria-selected=true],.pk .o:hover{background:#E5F9F6}\n.pk code{font-family:ui-monospace,\"SF Mono\",Menlo,monospace;font-size:11px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n[hidden]{display:none!important}\n.help2{font-size:11.5px;color:#6B7280;margin-top:5px}\n.err{font-size:11.5px;color:#B42318;margin-top:5px}\n.mt{margin-top:14px}\n.note{background:#FFF7E6;border:1px solid #FCD34D;border-radius:10px;padding:10px 12px;font-size:12.5px;color:#92400E;line-height:1.5}\n.key{font-family:ui-monospace,\"SF Mono\",Menlo,monospace;color:#4C3FD1;background:#F4F2FF;padding:1px 6px;border-radius:4px}\n.seg{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;background:#F3F5FA;border-radius:9px;padding:3px}\n.seg button{border:0;background:transparent;border-radius:7px;padding:6px 4px;font-size:12px;color:#3A4060}\n.seg button[aria-checked=true]{background:#fff;color:#0A1240;font-weight:600;box-shadow:0 1px 2px rgba(10,18,64,.08)}\n.css{margin-top:20px;display:inline-flex;align-items:center;gap:6px;border:0;background:transparent;padding:0;color:#6B7280;font-size:12px}\n.ft{padding:12px 18px;border-top:1px solid #E5EAF2;display:flex;gap:10px;background:#F8FAFC}\n.cancel{height:38px;padding:0 14px;border-radius:10px;border:1px solid #E5EAF2;background:#fff;color:#242B3A;font-size:13px;font-weight:600}\n.save{flex:1;height:38px;border-radius:10px;border:0;background:#071342;color:#fff;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.save:disabled{opacity:.45}\n@media (max-width:760px){.r.open .dock{display:none}.help{display:none}}\n";
|
|
24
25
|
export {};
|
|
25
26
|
//# sourceMappingURL=editor-ui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-ui.d.ts","sourceRoot":"","sources":["../../src/editor/editor-ui.ts"],"names":[],"mappings":"AAWA,KAAK,GAAG,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;AAEpD,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAQtK;AAGD,QAAA,MAAM,KAAK;;;;;;;;;;;;;;CAcV,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,SAAK,GAAG,aAAa,CAS7D;AAGD,eAAO,MAAM,UAAU,sLAAsL,CAAC;AAG9M,eAAO,MAAM,kBAAkB,6EAA6E,CAAC;
|
|
1
|
+
{"version":3,"file":"editor-ui.d.ts","sourceRoot":"","sources":["../../src/editor/editor-ui.ts"],"names":[],"mappings":"AAWA,KAAK,GAAG,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;AAEpD,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAQtK;AAGD,QAAA,MAAM,KAAK;;;;;;;;;;;;;;CAcV,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,SAAK,GAAG,aAAa,CAS7D;AAGD,eAAO,MAAM,UAAU,sLAAsL,CAAC;AAG9M,eAAO,MAAM,kBAAkB,6EAA6E,CAAC;AAW7G,eAAO,MAAM,sBAAsB,mFAAmF,CAAC;AAKvH,eAAO,MAAM,WAAW,4wBAA2X,CAAC;AAEpZ,eAAO,MAAM,UAAU,mwSAkGtB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface LiquidField {
|
|
2
|
+
el: HTMLElement;
|
|
3
|
+
set(value: string): void;
|
|
4
|
+
insert(tag: string): void;
|
|
5
|
+
closePop(): boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface FallbackWords {
|
|
8
|
+
title: string;
|
|
9
|
+
help: string;
|
|
10
|
+
bad: string;
|
|
11
|
+
done: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function serialize(n: Node): string;
|
|
14
|
+
export declare function liquidField(opts: {
|
|
15
|
+
label: string;
|
|
16
|
+
rawNote: string;
|
|
17
|
+
root: ShadowRoot | null;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
labelOf?: (path: string) => string | undefined;
|
|
20
|
+
fallback?: FallbackWords;
|
|
21
|
+
}): LiquidField;
|
|
22
|
+
//# sourceMappingURL=liquid-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid-field.d.ts","sourceRoot":"","sources":["../../src/editor/liquid-field.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,WAAW,CAAC;IAEhB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,QAAQ,IAAI,OAAO,CAAC;CACrB;AAGD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAMzC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,GAAG,WAAW,CA0Od"}
|
|
@@ -7,6 +7,7 @@ export declare const EDITOR_SESSION_MESSAGES: {
|
|
|
7
7
|
readonly FOCUS: "joryio:editor-focus";
|
|
8
8
|
readonly REMOVE: "joryio:editor-remove";
|
|
9
9
|
readonly DONE: "joryio:editor-done";
|
|
10
|
+
readonly OPEN_SLOT: "joryio:editor-open-slot";
|
|
10
11
|
};
|
|
11
12
|
export declare function cssEscape(value: string): string;
|
|
12
13
|
export declare function robustSelector(el: Element): string | null;
|
|
@@ -41,6 +42,8 @@ export declare class VisualEditor {
|
|
|
41
42
|
private selected;
|
|
42
43
|
private draft;
|
|
43
44
|
private showCss;
|
|
45
|
+
private showLiquid;
|
|
46
|
+
private closeOverlay;
|
|
44
47
|
private popOpen;
|
|
45
48
|
private edits;
|
|
46
49
|
private history;
|
|
@@ -60,6 +63,7 @@ export declare class VisualEditor {
|
|
|
60
63
|
private applyContext;
|
|
61
64
|
private place;
|
|
62
65
|
private move;
|
|
66
|
+
private editsOn;
|
|
63
67
|
select(el: Element, edit?: PageEditWire): void;
|
|
64
68
|
private enabled;
|
|
65
69
|
private newDraft;
|
|
@@ -68,6 +72,7 @@ export declare class VisualEditor {
|
|
|
68
72
|
focusEdit(id: unknown): boolean;
|
|
69
73
|
private draftEdit;
|
|
70
74
|
private save;
|
|
75
|
+
openSlot(placementKey: string, campaignId?: string): boolean;
|
|
71
76
|
pick(el: Element | null, selector: string, operation: PageEditOperation, value: string, opts?: {
|
|
72
77
|
id?: string;
|
|
73
78
|
position?: PageEditPosition;
|
|
@@ -81,6 +86,7 @@ export declare class VisualEditor {
|
|
|
81
86
|
private previewNode;
|
|
82
87
|
private applyPreview;
|
|
83
88
|
private renderHelp;
|
|
89
|
+
private labelOf;
|
|
84
90
|
private editTitle;
|
|
85
91
|
private togglePop;
|
|
86
92
|
private renderDock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-editor.d.ts","sourceRoot":"","sources":["../../src/editor/visual-editor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"visual-editor.d.ts","sourceRoot":"","sources":["../../src/editor/visual-editor.ts"],"names":[],"mappings":"AA0EA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAA8C,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClJ,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAO,MAAM,uBAAuB;;;;;;CAM1B,CAAC;AAaX,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa/C;AAuCD,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCzD;AAGD,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,iBAAiB,EAAE,CAO9D;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,eAAe,CAAC,IAAI,CAAC;IAElC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AA+DD,qBAAa,YAAY;IAgCrB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IAlChB,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAA4B;IAExC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAQ;IAC/B,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,OAAO,CAA0D;IAEzE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,CAAC,CAAwC;IACjD,OAAO,CAAC,GAAG,CAAwB;IACnC,OAAO,CAAC,GAAG,CAAqH;IAChI,OAAO,CAAC,WAAW,CAAyB;IAE5C,OAAO,CAAC,SAAS,CAAqF;gBAG5F,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,IAAsB;IAI9C,KAAK,IAAI,IAAI;IAgBb,QAAQ,IAAI,OAAO;IAKnB,QAAQ,IAAI,YAAY,EAAE;IAI1B,IAAI,IAAI,IAAI;IAiBZ,OAAO,CAAC,IAAI;IAWZ,OAAO,CAAC,QAAQ;IAsEhB,OAAO,CAAC,YAAY;IAoEpB,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,IAAI;IAOZ,OAAO,CAAC,OAAO;IAYf,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,IAAI;IAiB9C,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,IAAI;IAKZ,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO;IA2B/B,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,IAAI;IAYZ,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO;IAgB5D,IAAI,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAA;KAAO,GAAG,OAAO;IA0BzJ,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,UAAU;IAalB,IAAI,IAAI,OAAO;IAsBf,IAAI,IAAI,IAAI;IAiBZ,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,YAAY;IAgEpB,OAAO,CAAC,UAAU;IA4BlB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,WAAW;IA6GnB,OAAO,CAAC,YAAY;CAwMrB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -343,7 +343,7 @@ declare class IdentityManager {
|
|
|
343
343
|
isIdentified(): boolean;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
declare const SDK_VERSION = "1.4.0-beta.
|
|
346
|
+
declare const SDK_VERSION = "1.4.0-beta.7";
|
|
347
347
|
interface InAppDisplayOptions {
|
|
348
348
|
defaultPosition?: 'top' | 'center' | 'bottom';
|
|
349
349
|
defaultAnimation?: 'fade' | 'slide' | 'none';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Joryio Web SDK v1.4.0-beta.
|
|
2
|
+
* Joryio Web SDK v1.4.0-beta.7
|
|
3
3
|
* (c) 2026 Joryio. All rights reserved.
|
|
4
4
|
* @license Commercial - see https://github.com/joryio/joryio-web-sdk/blob/main/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const t=["before","after","prepend","append","replace"],e=/^[a-z0-9][a-z0-9_]{0,63}$/;function i(t){if("string"!=typeof t)return!1;const e=t.trim();if(!e||e.length>500)return!1;if(/[{};<@]/.test(e)||e.includes("/*")||e.includes("*/"))return!1;if(/[\u0000-\u001f\u007f]/.test(e))return!1;try{"undefined"!=typeof document&&document.createDocumentFragment().querySelector(e)}catch(t){return!1}return!0}function n(t){if("string"!=typeof t)return!1;const e=t.trim();return!(!e||e.length>2048)&&!/[\u0000-\u001f\u007f\s]/.test(e)&&/^https?:\/\/[^/?#\s]+/i.test(e)}const o=/\/joryio(?:\.umd)?(?:\.min)?\.js$/;function s(t){if(!t||"string"!=typeof t)return null;let e;try{e=new URL(t)}catch(t){return null}return"https:"===e.protocol&&o.test(e.pathname)?`${e.origin}${e.pathname.replace(/[^/]*$/,"")}`:null}!function(){if("undefined"==typeof document)return null;try{const t=document.currentScript,e=s(t&&t.src);if(e||t&&t.src)return e;const i=document.querySelectorAll("script[src]");for(let t=i.length-1;t>=0;t--){const e=s(i[t].src);if(e)return e}}catch(t){}}();const r="joryio:editor-pick",a="__joryioEditor",l={title:"Joryio editor",variant:"Variant {name}",hintPoint:"Point at anything on the page",hintEditing:"Editing · changes show live",editsOne:"1 edit",editsMany:"{n} edits",noEdits:"No edits yet.",undo:"Undo last edit",undoOffline:"Undo is available once the Joryio dashboard is connected",saveReturn:"Save & return to Joryio",clickToEdit:"click to edit",helpTitle:"Not the right box?",helpUp:"Select the section around it",helpDown:"Select something inside it",helpClickKey:"Click",helpClick:"Edit this one",dismiss:"Dismiss",page:"Page",up:"Select the element around it",down:"Select the first element inside it",matchOne:"1 match on page",matchMany:"Matches {n} - all will change",matchNone:"Not found",whatToDo:"What do you want to do?",actText:"Change text",actLink:"Change link",actImage:"Change image",actHide:"Hide it",actSlot:"Add content slot",noText:"No text here",notLink:"Not a link",notImage:"Not an image",newText:"New text",was:'Was: "{value}"',insert:"Insert",fallback:"If a value is missing",fallbackHelp:"Shown to visitors we don't know yet.",newLink:"New link address",newImage:"New image address",urlBad:"Enter an address starting with https:// (or http://).",hideNote:"The {kind} is removed for people in this campaign's audience. Everyone else still sees it.",hiddenFor:"Hidden for this audience",slotName:"Slot name",savedAs:"Saved as",slotHelp:"Filled by a Placement campaign or a journey step.",slotEmpty:"Enter a name for the slot.",where:"Where",posBefore:"Above it",posAfter:"Below it",posReplace:"Instead of it",posPrepend:"Inside, at the start",posAppend:"Inside, at the end",slotPreview:"Content slot",css:"CSS selector",cssHelp:"For developers. Matches {n} on this page.",cssBad:"Not a selector this page can use.",cancel:"Cancel",save:"Save · {action}",noSelector:"This element has no stable selector. Choose the element around it (arrow up) or another one.",kHeading:"Heading",kText:"Text",kLink:"Link",kButton:"Button",kImage:"Image",kList:"List",kSection:"Section",kMain:"Main",kHeader:"Header",kFooter:"Footer",kNav:"Navigation",kForm:"Form",kElement:"Element"};function c(t,e={}){return t.replace(/\{(\w+)\}/g,(t,i)=>i in e?String(e[i]):t)}const d=/\{\{-?([\s\S]*?)-?\}\}/g,p=/\|\s*default\s*:\s*("[^"]*"|'[^']*'|[^|}]*?)\s*(?=\||$)/,h=t=>t.trim().replace(/^(["'])([\s\S]*)\1$/,"$2");function u(t){const e=[],i=new RegExp(d.source,"g");let n;for(;n=i.exec(t||"");){const t=n[1].trim(),i=p.exec(t);e.push({expr:t,fallback:i?h(i[1]):null})}return e}function f(t){const e=u(t);if(!e.length)return null;const i=e.filter(t=>null!==t.fallback)[0];return i?i.fallback:""}const x=t=>t.includes('"')?`'${t.replace(/'/g,"")}'`:`"${t}"`;function b(t,e,i){const n=e?`user.custom.${t}`:`user.${t}`;return i?`{{ ${n} | default: ${x(i)} }}`:`{{ ${n} }}`}function g(t){return(t||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,64).replace(/_+$/,"")}function m(t,e=!1){let i=(t||"").toLowerCase();if(e){const t=i.trim().split(/[\s>+~]+/).filter(Boolean),e=/^[a-z][a-z0-9]*/.exec(t[t.length-1]||"");i=e?e[0]:""}return/^h[1-6]$/.test(i)?"kHeading":/^(p|span|strong|em|small|label|blockquote|b|i)$/.test(i)?"kText":"a"===i?"kLink":"button"===i?"kButton":"img"===i||"picture"===i?"kImage":/^(ul|ol|li)$/.test(i)?"kList":"main"===i?"kMain":"header"===i?"kHeader":"footer"===i?"kFooter":"nav"===i?"kNav":"form"===i?"kForm":/^(section|div|article|aside)$/.test(i)?"kSection":"kElement"}function k(t,e,...i){const n=document.createElement(t);for(const[t,i]of Object.entries(e||{}))void 0!==i&&!1!==i&&n.setAttribute(t,!0===i?"":i);for(const t of i)null!=t&&!1!==t&&n.appendChild("string"==typeof t?document.createTextNode(t):t);return n}const y="http://www.w3.org/2000/svg",w={text:["M4 7V5h16v2M9 19h6M12 5v14"],link:["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71","M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"],image:["M3 5h18v14H3z","m3 16 5-5 4 4 3-3 6 6","M15.5 8.5h.01"],hide:["M9.88 9.88a3 3 0 1 0 4.24 4.24","M10.73 5.08A10.4 10.4 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.67 2.68","M6.61 6.61A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.39-1.61","m2 2 20 20"],slot:["M3 3h18v18H3z","M7 9h10v6H7z"],undo:["M3 7v6h6","M21 17a9 9 0 0 0-15-6.7L3 13"],up:["m18 15-6-6-6 6"],down:["m6 9 6 6 6-6"],cursor:["m4 4 7.07 17 2.51-7.39L21 11.07z"],code:["m16 18 6-6-6-6M8 6l-6 6 6 6"],chevron:["m9 18 6-6-6-6"],check:["M20 6 9 17l-5-5"],close:["M18 6 6 18M6 6l12 12"]};function v(t,e=15){const i=document.createElementNS(y,"svg");for(const[t,n]of Object.entries({width:String(e),height:String(e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.9","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"}))i.setAttribute(t,n);for(const e of w[t]){const t=document.createElementNS(y,"path");t.setAttribute("d",e),i.appendChild(t)}return i}const j='Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif',F='ui-monospace,"SF Mono",Menlo,monospace',A=`.s,.x{font:12.5px/1.4 ${j};border-radius:10px;padding:14px 16px;text-align:center}.s{border:2px dashed #7A6CFF;background:#F4F2FF;color:#4C3FD1}.s b{font-weight:700}.s code{font-family:${F}}.s div{font-size:11.5px;color:#6B5FD9;margin-top:3px}.x{border:1.5px dashed #F04438;background:#FEF3F2;color:#B42318;text-align:start;padding:10px 12px;font-size:12px}`,$=`\n*{box-sizing:border-box}\n.r{font:13px/1.4 ${j};color:#242B3A;-webkit-font-smoothing:antialiased}\nbutton{font:inherit;color:inherit;cursor:pointer}\nbutton:disabled{cursor:not-allowed}\nbutton:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid #31D6C8;outline-offset:1px}\n.box{position:fixed;pointer-events:none;border:2px dashed #00A99A;background:rgba(0,169,154,.07);border-radius:4px;display:none}\n.box.sel{border-style:solid;background:rgba(0,169,154,.04)}\n.chip{position:absolute;bottom:100%;inset-inline-start:-2px;margin-bottom:2px;background:#00A99A;color:#fff;font-size:11px;font-weight:600;padding:3px 8px;border-radius:6px 6px 6px 0;white-space:nowrap;max-width:60vw;overflow:hidden;text-overflow:ellipsis}\n.help{position:fixed;top:16px;inset-inline-end:16px;width:240px;background:#fff;border:1px solid #E5EAF2;border-radius:10px;box-shadow:0 8px 24px rgba(10,18,64,.14);padding:10px 12px}\n.help h3{margin:0 0 6px;font-size:11px;font-weight:700;color:#6B7280;letter-spacing:.5px;text-transform:uppercase}\n.help .row{display:flex;align-items:center;gap:8px;font-size:12px;padding:3px 0}\n.kbd{min-width:38px;text-align:center;font-size:11px;font-weight:600;border:1px solid #E5EAF2;border-radius:5px;padding:1px 5px;background:#F8FAFC}\n.help .x{position:absolute;top:6px;inset-inline-end:6px;border:0;background:none;color:#8990A8;padding:2px;display:grid}\n.dock{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:6px;background:#071342;color:#fff;border-radius:14px;padding:7px 7px 7px 14px;box-shadow:0 12px 32px rgba(10,18,64,.35);white-space:nowrap;max-width:calc(100vw - 24px)}\n.r.open .dock{left:calc(50% - 190px)}\n.r.open[dir=rtl] .dock{left:calc(50% + 190px)}\n.logo{width:22px;height:22px;border-radius:6px;background:#fff;color:#071342;display:grid;place-items:center;font-weight:800;font-size:13px;flex:none}\n.name{font-size:12.5px;font-weight:600;margin-inline-start:4px;overflow:hidden;text-overflow:ellipsis;max-width:200px}\n.sub{font-size:12px;color:#A8AEC1;overflow:hidden;text-overflow:ellipsis;max-width:220px}\n.sep{width:1px;height:22px;background:#2A3366;margin:0 8px;flex:none}\n.hint{font-size:12px;color:#C9CEDD;display:inline-flex;align-items:center;gap:6px}\n.hint svg{color:#31D6C8}\n.db{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border-radius:8px;border:0;background:#1B245A;color:#fff;font-size:12.5px;font-weight:600}\n.ib{height:32px;width:32px;border-radius:8px;border:0;background:transparent;color:#fff;display:grid;place-items:center}\n.ib:disabled{color:#4A527A}\n.go{height:32px;padding:0 14px;border-radius:8px;border:0;background:#31D6C8;color:#071342;font-size:12.5px;font-weight:700}\n.pop{position:absolute;bottom:calc(100% + 10px);left:0;right:0;min-width:280px;max-height:50vh;overflow:auto;background:#fff;color:#242B3A;border-radius:12px;border:1px solid #E5EAF2;box-shadow:0 12px 32px rgba(10,18,64,.18);padding:6px;white-space:normal}\n.pop .e{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:none;border-radius:8px;font-size:12.5px;text-align:start}\n.pop .e:hover{background:#F8FAFC}\n.pop .empty{padding:12px;font-size:12.5px;color:#6B7280}\n.num{width:20px;height:20px;border-radius:99px;background:#071342;color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center;flex:none}\n.panel{position:fixed;top:0;bottom:0;inset-inline-end:0;width:380px;max-width:100vw;background:#fff;border-inline-start:1px solid #E5EAF2;box-shadow:-8px 0 24px rgba(10,18,64,.06);display:flex;flex-direction:column}\n.hd{padding:16px 18px 14px;border-bottom:1px solid #E5EAF2}\n.crumbs{display:flex;align-items:center;flex-wrap:wrap;gap:4px;font-size:11.5px;color:#6B7280;margin-bottom:6px}\n.crumbs svg{color:#A8AEC1}\n.crumb{border:0;background:transparent;color:#6B7280;font-weight:500;font-size:11.5px;padding:2px 6px;border-radius:5px}\n.crumb.cur{background:#E5F9F6;color:#0F766E;font-weight:600}\n.nav{margin-inline-start:auto;display:flex;gap:2px}\n.nav button{border:1px solid #E5EAF2;background:#fff;border-radius:6px;width:24px;height:22px;display:grid;place-items:center;color:#3A4060;padding:0}\n.nav button:disabled{opacity:.4}\n.tr{display:flex;align-items:center;gap:10px}\n.title{font-size:17px;font-weight:700;color:#0A1240;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}\n.pill{margin-inline-start:auto;display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;padding:3px 8px;border-radius:999px;white-space:nowrap;flex:none}\n.pill.ok{background:#E5F9F6;color:#0F766E}\n.pill.many{background:#FFF7E6;color:#92400E}\n.pill.none{background:#FEF3F2;color:#B42318}\n.bd{padding:16px 18px;overflow:auto;flex:1}\n.lbl{display:block;font-size:12.5px;font-weight:600;color:#242B3A;margin-bottom:8px}\n.tiles{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:18px}\n.tile{display:flex;align-items:center;gap:9px;padding:10px 11px;border-radius:10px;text-align:start;background:#fff;border:1.5px solid #E5EAF2;color:#3A4060}\n.tile[aria-checked=true]{background:#E5F9F6;border-color:#00C8B7;color:#0F766E}\n.tile.slot[aria-checked=true]{background:#F4F2FF;border-color:#7A6CFF;color:#4C3FD1}\n.tile:disabled{opacity:.55}\n.tile b{display:block;font-size:12.5px;font-weight:600;color:#0A1240}\n.tile small{display:block;font-size:10.5px;color:#6B7280}\n.fr{display:flex;align-items:baseline;margin-bottom:8px}\n.fr .lbl{margin:0}\n.was{margin-inline-start:auto;font-size:11.5px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:55%}\ntextarea,input{width:100%;font:inherit;font-size:13.5px;color:#0F1424;padding:10px 12px;border-radius:10px;border:1.5px solid #E5EAF2;background:#fff;outline:none}\ntextarea{line-height:1.5;resize:vertical;border-color:#00C8B7}\ninput{height:40px;padding:0 12px}\ninput.slotin{border-color:#7A6CFF}\ninput.mono{font-family:${F};font-size:12px;height:36px;background:#F8FAFC;border-width:1px}\n.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}\n.chips span{font-size:11.5px;color:#6B7280;margin-inline-end:2px}\n.vc{font-family:${F};font-size:11.5px;padding:3px 8px;border-radius:6px;border:1px solid #E5EAF2;background:#F8FAFC;color:#3A4060}\n.help2{font-size:11.5px;color:#6B7280;margin-top:5px}\n.err{font-size:11.5px;color:#B42318;margin-top:5px}\n.mt{margin-top:14px}\n.note{background:#FFF7E6;border:1px solid #FCD34D;border-radius:10px;padding:10px 12px;font-size:12.5px;color:#92400E;line-height:1.5}\n.key{font-family:${F};color:#4C3FD1;background:#F4F2FF;padding:1px 6px;border-radius:4px}\n.seg{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;background:#F3F5FA;border-radius:9px;padding:3px}\n.seg button{border:0;background:transparent;border-radius:7px;padding:6px 4px;font-size:12px;color:#3A4060}\n.seg button[aria-checked=true]{background:#fff;color:#0A1240;font-weight:600;box-shadow:0 1px 2px rgba(10,18,64,.08)}\n.css{margin-top:20px;display:inline-flex;align-items:center;gap:6px;border:0;background:transparent;padding:0;color:#6B7280;font-size:12px}\n.ft{padding:12px 18px;border-top:1px solid #E5EAF2;display:flex;gap:10px;background:#F8FAFC}\n.cancel{height:38px;padding:0 14px;border-radius:10px;border:1px solid #E5EAF2;background:#fff;color:#242B3A;font-size:13px;font-weight:600}\n.save{flex:1;height:38px;border-radius:10px;border:0;background:#071342;color:#fff;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.save:disabled{opacity:.45}\n@media (max-width:760px){.r.open .dock{display:none}.help{display:none}}\n`,E=["data-joryio-id","data-testid","data-test","data-qa","data-cy","data-id","name"],z=/^[a-z0-9][a-z0-9_]{0,63}$/,O=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,_=2e3,S="jry_editor_help_dismissed",C=t=>!!t&&!!t.closest("[data-joryio-editor]");function M(t){if(!i(t))return[];try{return Array.from(document.querySelectorAll(t)).filter(t=>!C(t))}catch(t){return[]}}const B=(t,e,i)=>{try{const n=Array.from(t.querySelectorAll(e)).filter(t=>!C(t));return 1===n.length&&n[0]===i}catch(t){return!1}};const N=["text","link","image","hide","slot"],I={text:"replace_text",link:"replace_link",image:"replace_image",hide:"hide",slot:"insert_placement"},D={replace_text:"text",replace_link:"link",replace_image:"image",hide:"hide",insert_placement:"slot"},H={text:"actText",link:"actLink",image:"actImage",hide:"actHide",slot:"actSlot"},L={text:"text",link:"link",image:"image",hide:"hide",slot:"slot"},T=[["before","posBefore"],["after","posAfter"],["replace","posReplace"],["prepend","posPrepend"],["append","posAppend"]],P=(t,e)=>"string"==typeof t?t.trim().slice(0,e):"",R=t=>(t&&t.textContent||"").replace(/\s+/g," ").trim();class U{constructor(t,e,i,n=()=>{}){this.dashboardOrigin=t,this.opener=e,this.logger=i,this.onStop=n,this.listeners=[],this.active=!1,this.host=null,this.root=null,this.wrap=null,this.hoverBox=null,this.selBox=null,this.dock=null,this.panel=null,this.help=null,this.hovered=null,this.selected=null,this.draft=null,this.showCss=!1,this.popOpen=!1,this.edits=[],this.history=[],this.synced=!1,this.t=Object.assign({},l),this.dir="ltr",this.ctx={campaignName:"",variantName:"",attributes:[],placements:[],sample:{}},this.previewUndo=[],this.originals=new WeakMap}start(){if(this.active)return;this.active=!0;const t=t=>{const e=t.data;e&&"string"==typeof e.type&&t.origin===this.dashboardOrigin&&t.source===this.opener&&("joryio:editor-close"===e.type?this.stop():"joryio:editor-context"===e.type?this.applyContext(e):"joryio:editor-focus"===e.type&&this.focusEdit(e.id))};window.addEventListener("message",t),this.listeners.push(()=>window.removeEventListener("message",t)),this.activate()}isActive(){return this.active}editList(){return this.edits.slice()}stop(){var t;if(this.active){this.send({type:"joryio:editor-closed"}),this.active=!1;for(const t of this.listeners.splice(0))t();this.clearPreview(),null===(t=this.host)||void 0===t||t.remove(),this.host=this.root=this.wrap=this.hoverBox=this.selBox=this.dock=this.panel=this.help=null,this.selected=this.hovered=null,this.draft=null;try{this.onStop()}catch(t){this.logger.debug("Joryio editor stop callback failed",t)}}}send(t){if(this.active)try{this.opener.postMessage(t,this.dashboardOrigin)}catch(t){}}activate(){const t=document,e=t.createElement("joryio-editor");e.setAttribute("data-joryio-editor","root"),e.setAttribute("style","all:initial !important;position:fixed !important;top:0 !important;left:0 !important;width:0 !important;height:0 !important;z-index:2147483647 !important;display:block !important");const i=e.attachShadow({mode:"closed"});i.appendChild(k("style",null,$));const n=k("div",{class:"r",dir:this.dir});this.hoverBox=k("div",{class:"box","data-j":"hover"}),this.selBox=k("div",{class:"box sel","data-j":"selected"}),n.append(this.hoverBox,this.selBox),i.appendChild(n),t.documentElement.appendChild(e),this.host=e,this.root=i,this.wrap=n;const o=e=>{const i=e.target instanceof Element?e.target:null;C(i)||(this.hovered=i&&i!==t.body&&i!==t.documentElement?i:null,this.place(this.hoverBox,this.hovered===this.selected?null:this.hovered,!0))},s=e=>{C(e.target instanceof Element?e.target:null)||(e.preventDefault(),e.stopPropagation(),e.target instanceof Element&&e.target!==t.body&&e.target!==t.documentElement&&this.select(e.target))},r=t=>{if("Escape"!==t.key){if(!C(t.target instanceof Element?t.target:null)&&("ArrowUp"===t.key||"ArrowDown"===t.key)){const e=this.selected||this.hovered;if(!e)return;t.preventDefault(),t.stopPropagation(),this.move("ArrowUp"===t.key?"up":"down",e)}}else this.popOpen?this.togglePop(!1):this.panel?this.cancel():this.stop()},a=()=>{this.place(this.hoverBox,this.hovered===this.selected?null:this.hovered,!0),this.place(this.selBox,this.selected)};t.addEventListener("mousemove",o,!0),t.addEventListener("click",s,!0),t.addEventListener("keydown",r,!0),window.addEventListener("scroll",a,!0),window.addEventListener("resize",a),this.listeners.push(()=>t.removeEventListener("mousemove",o,!0),()=>t.removeEventListener("click",s,!0),()=>t.removeEventListener("keydown",r,!0),()=>window.removeEventListener("scroll",a,!0),()=>window.removeEventListener("resize",a)),this.renderDock(),this.renderHelp(),this.send({type:"joryio:editor-active",url:`${location.origin}${location.pathname}`})}applyContext(o){var s;this.synced=!0,this.t=function(t){const e=Object.assign({},l);if(t&&"object"==typeof t)for(const i of Object.keys(l)){const n=t[i];"string"==typeof n&&n.trim()&&n.length<=500&&(e[i]=n)}return e}(o.strings),this.dir="rtl"===o.dir?"rtl":"ltr",null===(s=this.wrap)||void 0===s||s.setAttribute("dir",this.dir);const r=(t,e,i)=>(Array.isArray(t)?t:[]).map(e).filter(t=>null!==t).slice(0,i);if(this.ctx={campaignName:P(o.campaignName,120),variantName:P(o.variantName,60),attributes:r(o.attributes,t=>t&&"string"==typeof t.name&&O.test(t.name)?{name:t.name,custom:!0===t.custom}:null,40),placements:r(o.placements,t=>t&&"string"==typeof t.key&&z.test(t.key)?{key:t.key,name:P(t.name,80)}:null,40),sample:{}},o.sample&&"object"==typeof o.sample)for(const[t,e]of Object.entries(o.sample).slice(0,100))/^user\.[A-Za-z0-9_.]{1,80}$/.test(t)&&"string"==typeof e&&(this.ctx.sample[t]=e.slice(0,200));Array.isArray(o.edits)&&(this.edits=r(o.edits,o=>function(o){if(!o||"object"!=typeof o||"string"!=typeof o.id||!i(o.selector))return null;const s=Object.assign({id:o.id,selector:o.selector.trim()},!0===o.personalized?{personalized:!0}:{});switch(o.operation){case"hide":return Object.assign(Object.assign({},s),{operation:"hide"});case"replace_text":return"string"==typeof o.value&&o.value.length<=2e3?Object.assign(Object.assign({},s),{operation:"replace_text",value:o.value}):null;case"replace_image":case"replace_link":return n(o.value)?Object.assign(Object.assign({},s),{operation:o.operation,value:o.value.trim()}):null;case"insert_placement":return"string"==typeof o.placementKey&&e.test(o.placementKey)?Object.assign(Object.assign({},s),{operation:"insert_placement",placementKey:o.placementKey,position:t.includes(o.position)?o.position:"after"}):null;default:return null}}(o),100).map(t=>{const{personalized:e}=t,i=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}(t,["personalized"]);return i}),this.history=[]),this.renderPreview(),this.renderDock(),this.renderHelp(),this.draft&&this.renderPanel(),"string"==typeof o.focusId&&this.focusEdit(o.focusId)}place(t,e,i=!1){if(!t)return;if(!e||!e.isConnected)return void(t.style.display="none");const n=e.getBoundingClientRect();Object.assign(t.style,{display:"block",top:n.top-2+"px",left:n.left-2+"px",width:`${n.width+4}px`,height:`${n.height+4}px`}),t.textContent="";const o=`${this.t[m(e.tagName)]} · ${e.tagName.toLowerCase()}`;t.appendChild(k("span",{class:"chip","data-j":"label"},i?`${o} - ${this.t.clickToEdit}`:o))}move(t,e){const i="up"===t?e.parentElement:Array.from(e.children).filter(t=>!C(t))[0]||null;i&&i!==document.body&&i!==document.documentElement&&this.select(i)}select(t,e){if(!this.active)return;this.selected=t,this.hovered=null,this.place(this.hoverBox,null),this.place(this.selBox,t),this.popOpen=!1;const n=e?e.selector:function(t){const e=t.ownerDocument;if(!e)return null;const n=t=>{if((i=t.id)&&i.length<=64&&!/\d{4,}/.test(i)&&!/^(ember|react|radix|headlessui|mui)[-_:]/i.test(i)&&!/:/.test(i)){const i=`#${function(t){const e=globalThis.CSS;if(e&&"function"==typeof e.escape)return e.escape(t);let i="";for(let e=0;e<t.length;e++){const n=t[e],o=t.charCodeAt(e);0===o?i+="�":/[0-9]/.test(n)&&(0===e||1===e&&"-"===t[0])?i+=`\\${o.toString(16)} `:/[A-Za-z0-9_-]/.test(n)||o>=128?i+=n:i+=`\\${n}`}return i}(t.id)}`;if(B(e,i,t))return i}var i;for(const i of E){const n=t.getAttribute(i);if(!n||n.length>100)continue;const o=`${t.tagName.toLowerCase()}[${i}="${n.replace(/["\\]/g,"\\$&")}"]`;if(B(e,o,t))return o}return null},o=n(t);if(o)return i(o)?o:null;const s=[];let r=t;for(;r&&r!==e.body&&r!==e.documentElement;){const t=s.length?n(r):null;if(t){s.unshift(t);break}const i=r.tagName.toLowerCase(),o=r.parentElement,a=o?Array.from(o.children).filter(t=>t.tagName===r.tagName):[];s.unshift(a.length>1?`${i}:nth-of-type(${a.indexOf(r)+1})`:i),r=o,r===e.body&&s.unshift("body")}const a=s.join(" > ");return a&&i(a)&&B(e,a,t)?a:null}(t)||"";this.showCss=!n,this.draft=e?this.draftOf(e):this.newDraft(t,n),this.renderPanel(),this.renderDock(),this.renderHelp(),this.renderPreview()}enabled(t,e){return!e||("text"===t?"IMG"!==e.tagName&&!!this.orig(e).text:"link"===t?"A"===e.tagName:"image"!==t||"IMG"===e.tagName)}newDraft(t,e){const i=this.orig(t),n="IMG"===t.tagName?"image":this.enabled("text",t)?"text":"A"===t.tagName?"link":"hide";return{action:n,text:i.text.slice(0,_),url:("image"===n?i.src:i.href)||"",slotName:"",position:"after",selector:e,editingId:null,touched:!1}}draftOf(t){const e=D[t.operation];return{action:e,text:"replace_text"===t.operation&&t.value||"",url:("link"===e||"image"===e)&&t.value||"",slotName:t.placementKey||"",position:t.position||"after",selector:t.selector,editingId:t.id,touched:!0}}orig(t){return this.originals.get(t)||{text:R(t),href:t.getAttribute("href"),src:t.getAttribute("src")}}focusEdit(t){const e=this.edits.filter(e=>e.id===t)[0];if(!e||!this.active)return!1;const i=M(e.selector)[0]||null;if(i){try{i.scrollIntoView({block:"center"})}catch(t){}this.select(i,e)}else this.selected=null,this.place(this.selBox,null),this.draft=this.draftOf(e),this.showCss=!0,this.renderPanel(),this.renderDock(),this.renderHelp(),this.renderPreview();return!0}draftEdit(t){const e={id:t.editingId||"",selector:t.selector.trim()};if(!i(e.selector))return null;const o=I[t.action];if("hide"===t.action)return Object.assign(Object.assign({},e),{operation:o});if("text"===t.action)return t.text.trim()&&t.text.length<=_?Object.assign(Object.assign({},e),{operation:o,value:t.text}):null;if("link"===t.action||"image"===t.action)return n(t.url)?Object.assign(Object.assign({},e),{operation:o,value:t.url.trim()}):null;const s=g(t.slotName);return z.test(s)?Object.assign(Object.assign({},e),{operation:o,placementKey:s,position:t.position}):null}save(){var t,e;const i=this.draft,n=i&&this.draftEdit(i);if(!i||!n)return;const o=this.selected||M(n.selector)[0]||null;this.pick(o,n.selector,n.operation,null!==(e=null!==(t=n.value)&&void 0!==t?t:n.placementKey)&&void 0!==e?e:"",{id:i.editingId||void 0,position:n.position})}pick(t,e,o,s,a={}){const l=a.id||`e${Math.random().toString(36).slice(2,10).padEnd(8,"0")}`,c=t?t.tagName.toLowerCase():"",d=t?this.orig(t).text.slice(0,200):"";let p=null;if(i(e)){const t={id:l,selector:e.trim()};if("hide"===o)p=Object.assign(Object.assign({},t),{operation:o});else if("replace_text"===o)p=(s||d)&&(s||d).length<=_?Object.assign(Object.assign({},t),{operation:o,value:s||d}):null;else if("replace_image"===o||"replace_link"===o)p=n(s)?Object.assign(Object.assign({},t),{operation:o,value:s.trim()}):null;else if("insert_placement"===o){const e=g(s);p=z.test(e)?Object.assign(Object.assign({},t),{operation:o,placementKey:e,position:a.position||"after"}):null}}if(!p)return!1;const h=Object.assign(Object.assign({type:r},p),{tag:c,text:d});this.send(h);const u=this.edits.map(t=>t.id).indexOf(l);return this.history.push({id:l,before:u>=0?this.edits[u]:null}),u>=0?this.edits[u]=p:this.edits.push(p),this.closePanel(),!0}cancel(){this.closePanel()}closePanel(){var t,e;this.draft=null,this.selected=null,null===(t=this.panel)||void 0===t||t.remove(),this.panel=null,null===(e=this.wrap)||void 0===e||e.classList.remove("open"),this.place(this.selBox,null),this.renderPreview(),this.renderDock(),this.renderHelp()}undo(){if(!this.synced)return!1;const t=this.history.pop();if(!t)return!1;const e=this.edits.map(t=>t.id).indexOf(t.id);if(t.before){e>=0&&(this.edits[e]=t.before);const i=t.before;this.send(Object.assign(Object.assign({type:r},i),{tag:"",text:""}))}else e>=0&&this.edits.splice(e,1),this.send({type:"joryio:editor-remove",id:t.id});return this.draft?this.closePanel():(this.renderPreview(),this.renderDock()),!0}done(){this.send({type:"joryio:editor-done"}),this.stop();try{this.opener.focus()}catch(t){}try{window.close()}catch(t){}}clearPreview(){for(const t of this.previewUndo.splice(0).reverse())try{t()}catch(t){}}renderPreview(){if(this.clearPreview(),!this.active)return;const t=this.draft,e=t?this.draftEdit(t):null,i=[];for(const n of this.edits)i.push(t&&t.editingId===n.id&&e||n);t&&!t.editingId&&e&&t.touched&&i.push(e);for(const t of i)for(const e of M(t.selector).slice(0,50))this.applyPreview(t,e);this.selected&&this.place(this.selBox,this.selected)}previewNode(t){const e=document.createElement("joryio-editor-preview");e.setAttribute("data-joryio-editor","preview"),e.setAttribute("style","all:initial !important;display:block !important;margin:10px 0 !important");const i=e.attachShadow({mode:"open"});return i.appendChild(k("style",null,A)),t(i),e}applyPreview(t,e){this.originals.has(e)||this.originals.set(e,{text:R(e),href:e.getAttribute("href"),src:e.getAttribute("src")});const i=this.previewUndo,n=(t,n)=>{const o=e.getAttribute(t);null===n?e.removeAttribute(t):e.setAttribute(t,n),i.push(()=>null===o?e.removeAttribute(t):e.setAttribute(t,o))},o=()=>{const t=e.style;if(!t)return;const n=t.getPropertyValue("display"),o=t.getPropertyPriority("display");t.setProperty("display","none","important"),i.push(()=>n?t.setProperty("display",n,o):t.removeProperty("display"))},s=(t,n)=>{const o=e.parentNode;"before"===n&&o?o.insertBefore(t,e):"after"!==n&&"replace"!==n||!o?"prepend"===n?e.insertBefore(t,e.firstChild):e.appendChild(t):o.insertBefore(t,e.nextSibling),i.push(()=>t.parentNode&&t.parentNode.removeChild(t))};switch(t.operation){case"replace_text":{const n=Array.from(e.childNodes);e.textContent=(r=t.value||"",a=this.ctx.sample,(r||"").replace(new RegExp(d.source,"g"),(t,e)=>{const i=e.trim(),n=i.split("|")[0].trim(),o=p.exec(i);return Object.prototype.hasOwnProperty.call(a,n)&&""!==a[n]?a[n]:o&&h(o[1])?h(o[1]):`[${n.replace(/^user\.(custom\.)?/,"")}]`})),i.push(()=>{e.textContent="";for(const t of n)e.appendChild(t)});break}case"replace_link":n("href",t.value||null);break;case"replace_image":n("srcset",null),n("src",t.value||null);break;case"hide":{const t=`${this.t[m(e.tagName)]} "${this.orig(e).text.slice(0,40)}"`;s(this.previewNode(e=>e.appendChild(k("div",{class:"x"},`${this.t.hiddenFor}: ${t}`))),"after"),o();break}case"insert_placement":{const e=t.position||"after";s(this.previewNode(e=>e.appendChild(k("div",{class:"s"},k("b",null,`${this.t.slotPreview} · `),k("code",null,t.placementKey||""),k("div",null,this.t.slotHelp)))),e),"replace"===e&&o();break}}var r,a}renderHelp(){var t;null===(t=this.help)||void 0===t||t.remove(),this.help=null;let e=!1;try{e="1"===localStorage.getItem(S)}catch(t){}if(e||this.draft||!this.wrap)return;const i=this.t,n=(t,e)=>k("div",{class:"row"},k("span",{class:"kbd"},t),e),o=k("button",{class:"x",type:"button","aria-label":i.dismiss,title:i.dismiss,"data-j":"help-dismiss"},v("close",13));o.addEventListener("click",()=>{var t;try{localStorage.setItem(S,"1")}catch(t){}null===(t=this.help)||void 0===t||t.remove(),this.help=null}),this.help=k("div",{class:"help","data-j":"help",role:"note"},o,k("h3",null,i.helpTitle),n("↑",i.helpUp),n("↓",i.helpDown),n(i.helpClickKey,i.helpClick)),this.wrap.appendChild(this.help)}editTitle(t){const e=M(t.selector)[0],i=this.t[e?m(e.tagName):m(t.selector,!0)];return`${this.t[H[D[t.operation]]]} · ${i}`}togglePop(t){this.popOpen=t,this.renderDock()}renderDock(){var t;if(!this.wrap)return;const e=this.t;null===(t=this.dock)||void 0===t||t.remove();const i=this.edits.length,n=[this.ctx.variantName?c(e.variant,{name:this.ctx.variantName}):"",location.pathname||"/"].filter(Boolean).join(" · "),o=k("button",{class:"db",type:"button","aria-expanded":String(this.popOpen),"data-j":"edits"},1===i?e.editsOne:c(e.editsMany,{n:i}),v(this.popOpen?"down":"up",11));o.addEventListener("click",()=>this.togglePop(!this.popOpen));const s=this.synced&&this.history.length>0,r=k("button",{class:"ib",type:"button","aria-label":e.undo,title:this.synced?e.undo:e.undoOffline,disabled:!s,"data-j":"undo"},v("undo",14));r.addEventListener("click",()=>this.undo());const a=k("button",{class:"go",type:"button","data-j":"done"},e.saveReturn);a.addEventListener("click",()=>this.done());const l=k("div",{class:"dock","data-j":"dock",role:"toolbar","aria-label":e.title},k("span",{class:"logo","aria-hidden":"true"},"J"),k("span",{class:"name","data-j":"campaign"},this.ctx.campaignName||e.title),k("span",{class:"sub"},`· ${n}`),k("span",{class:"sep"}),k("span",{class:"hint","data-j":"hint"},v("cursor",13),this.draft?e.hintEditing:e.hintPoint),k("span",{class:"sep"}),o,r,a);if(this.popOpen){const t=k("div",{class:"pop","data-j":"edit-list",role:"menu"});i||t.appendChild(k("div",{class:"empty"},e.noEdits)),this.edits.forEach((e,i)=>{const n=k("button",{class:"e",type:"button",role:"menuitem","data-j":"edit-item","data-edit-id":e.id},k("span",{class:"num"},String(i+1)),this.editTitle(e));n.addEventListener("click",()=>this.focusEdit(e.id)),t.appendChild(n)}),l.appendChild(t)}this.dock=l,this.wrap.appendChild(l)}renderPanel(){var t;const e=this.draft;if(!e||!this.wrap)return;const n=this.t,o=this.selected;null===(t=this.panel)||void 0===t||t.remove(),this.wrap.classList.add("open");const s=k("div",{class:"crumbs","data-j":"crumbs"});if(o){const t=[];for(let e=o;e&&e!==document.body&&e!==document.documentElement;e=e.parentElement)t.unshift(e);const e=t.slice(-3),i=(t,e,i)=>{const n=k("button",{class:i?"crumb cur":"crumb",type:"button","data-j":"crumb","aria-current":i?"true":void 0,disabled:!e},t);return e&&!i&&n.addEventListener("click",()=>this.select(e)),n};s.appendChild(i(n.page,null,!1));for(const t of e)s.append(v("chevron",9),i(n[m(t.tagName)],t,t===o));const r=k("button",{type:"button","aria-label":n.up,title:n.up,"data-j":"up",disabled:!o.parentElement||o.parentElement===document.body},v("up",12));r.addEventListener("click",()=>this.move("up",o));const a=k("button",{type:"button","aria-label":n.down,title:n.down,"data-j":"down",disabled:!Array.from(o.children).some(t=>!C(t))},v("down",12));a.addEventListener("click",()=>this.move("down",o)),s.appendChild(k("span",{class:"nav"},r,a))}const r=n[o?m(o.tagName):m(e.selector,!0)],a=o?"IMG"===o.tagName?o.getAttribute("alt")||"":this.orig(o).text:"",l=k("div",{class:"title","data-j":"title"},a?`${r} "${a.slice(0,40)}"`:r),d=k("span",{class:"pill","data-j":"matches"}),p=k("div",{class:"hd"},s,k("div",{class:"tr"},l,d)),h=k("div",{class:"tiles",role:"radiogroup","aria-label":n.whatToDo});for(const t of N){const i=e.action===t,s=i||this.enabled(t,o),r=s?"":"link"===t?n.notLink:"image"===t?n.notImage:n.noText,a=k("button",{class:"slot"===t?"tile slot":"tile",type:"button",role:"radio","aria-checked":String(i),disabled:!s,"data-j":`action-${t}`},v(L[t]),k("span",null,k("b",null,n[H[t]]),r?k("small",null,r):null));a.addEventListener("click",()=>{this.draft&&this.draft.action!==t&&(this.draft.action=t,this.draft.touched=!0,"link"!==t&&"image"!==t||!o||(this.draft.url=("image"===t?this.orig(o).src:this.orig(o).href)||""),this.renderPanel(),this.renderPreview())}),h.appendChild(a)}const u=k("div",{"data-j":"fields"}),f=k("button",{class:"save",type:"button","data-j":"save"}),x=()=>{const t=!!this.draftEdit(e);f.disabled=!t,f.textContent=c(n.save,{action:n[H[e.action]]});const i=M(e.selector).length;d.className="pill "+(1===i?"ok":i>1?"many":"none"),d.textContent=1===i?n.matchOne:i>1?c(n.matchMany,{n:i}):n.matchNone},b=()=>{e.touched=!0,x(),this.renderPreview()};this.renderFields(u,e,o,b);const g=k("button",{class:"css",type:"button","aria-expanded":String(this.showCss),"data-j":"css-toggle"},v("code",13),n.css,v(this.showCss?"up":"down",10));g.addEventListener("click",()=>{this.showCss=!this.showCss,this.renderPanel()});const y=k("div",{class:"bd"},k("span",{class:"lbl"},n.whatToDo),h,u,g);if(this.showCss){const t=k("input",{class:"mono",dir:"ltr","aria-label":n.css,spellcheck:"false","data-j":"selector"});t.value=e.selector;const o=k("div",{class:"help2"}),s=()=>{const t=i(e.selector);o.className=t?"help2":"err",o.textContent=e.selector.trim()?t?c(n.cssHelp,{n:M(e.selector).length}):n.cssBad:n.noSelector};t.addEventListener("input",()=>{e.selector=t.value,s(),b()}),s(),y.append(k("div",{class:"mt"},t,o))}const w=k("button",{class:"cancel",type:"button","data-j":"cancel"},n.cancel);w.addEventListener("click",()=>this.cancel()),f.addEventListener("click",()=>this.save());const j=k("aside",{class:"panel","data-j":"panel",role:"dialog","aria-label":n.whatToDo},p,y,k("div",{class:"ft"},w,f));x(),this.panel=j,this.wrap.appendChild(j)}renderFields(t,e,i,o){const s=this.t;t.textContent="";const r=t=>t?k("span",{class:"was",title:t},c(s.was,{value:t.slice(0,60)})):null;if("text"===e.action){const n=k("textarea",{rows:"3",dir:"auto","data-j":"text","aria-label":s.newText});n.value=e.text;const a=k("div",{"data-j":"fallback-box"}),l=()=>{a.textContent="";const t=f(e.text);if(null===t)return;const i=k("input",{dir:"auto","data-j":"fallback","aria-label":s.fallback});i.value=t,i.addEventListener("input",()=>{var t,s;e.text=(t=e.text,s=i.value,(t||"").replace(new RegExp(d.source,"g"),(t,e)=>{const i=e.trim().replace(new RegExp(p.source,"g"),"").trim();return s?`{{ ${i} | default: ${x(s)} }}`:`{{ ${i} }}`})),n.value=e.text,o()}),a.append(k("div",{class:"mt"},k("label",{class:"lbl"},s.fallback),i,k("div",{class:"help2"},s.fallbackHelp)))};let c=u(e.text).length>0;n.addEventListener("input",()=>{e.text=n.value;const t=u(e.text).length>0;t!==c&&(c=t,l()),o()});const h=k("div",{class:"chips","data-j":"chips"},k("span",null,s.insert)),g=this.ctx.attributes.length?this.ctx.attributes:[{name:"firstName",custom:!1},{name:"lastName",custom:!1}];for(const t of g.slice(0,12)){const i=k("button",{class:"vc",type:"button","data-j":"chip"},t.name);i.addEventListener("click",()=>{const i=b(t.name,t.custom,f(e.text)||null);e.text=e.text?`${e.text.replace(/\s+$/,"")} ${i}`:i,n.value=e.text,c||(c=!0,l()),o()}),h.appendChild(i)}t.append(k("div",{class:"fr"},k("label",{class:"lbl"},s.newText),r(i?this.orig(i).text:null)),n,h,a),l()}else if("link"===e.action||"image"===e.action){const a=k("input",{type:"url",dir:"ltr",inputmode:"url",placeholder:"https://","data-j":"url","aria-label":"link"===e.action?s.newLink:s.newImage});a.value=e.url;const l=k("div",{class:"err"}),c=()=>l.textContent=e.url.trim()&&!n(e.url)?s.urlBad:"";a.addEventListener("input",()=>{e.url=a.value,c(),o()}),c();const d=i?"image"===e.action?this.orig(i).src:this.orig(i).href:null;t.append(k("div",{class:"fr"},k("label",{class:"lbl"},"link"===e.action?s.newLink:s.newImage),r(d)),a,l)}else if("hide"===e.action){const n=s[i?m(i.tagName):m(e.selector,!0)].toLowerCase();t.appendChild(k("div",{class:"note","data-j":"hide-note"},c(s.hideNote,{kind:n})))}else{const i=k("input",{class:"slotin",dir:"auto","data-j":"slot-name","aria-label":s.slotName,maxlength:"80"});i.value=e.slotName;const n=k("span",{class:"key","data-j":"slot-key"}),r=k("div",{class:"help2"}),a=()=>{const t=g(e.slotName);n.textContent=t||"-",r.textContent="",r.append(`${s.savedAs} `,n,t?"":` · ${s.slotEmpty}`)};if(i.addEventListener("input",()=>{e.slotName=i.value,a(),o()}),a(),t.append(k("label",{class:"lbl"},s.slotName),i,r),this.ctx.placements.length){const n=k("div",{class:"chips","data-j":"placements"});for(const t of this.ctx.placements.slice(0,12)){const s=k("button",{class:"vc",type:"button",title:t.name||t.key,"data-j":"placement"},t.key);s.addEventListener("click",()=>{e.slotName=t.key,i.value=t.key,a(),o()}),n.appendChild(s)}t.appendChild(n)}t.appendChild(k("div",{class:"help2"},s.slotHelp));const l=k("div",{class:"seg",role:"radiogroup","aria-label":s.where,"data-j":"positions"});for(const[t,i]of T){const n=k("button",{type:"button",role:"radio","aria-checked":String(e.position===t),"data-j":`pos-${t}`},s[i]);n.addEventListener("click",()=>{e.position=t;for(const t of Array.from(l.children))t.setAttribute("aria-checked",String(t===n));o()}),l.appendChild(n)}t.append(k("div",{class:"mt"},k("span",{class:"lbl"},s.where),l))}}}const J={version:1,start({dashboardOrigin:t,opener:e,logger:i,onStop:n}){const o=new U(t,e,i,n);return o.start(),{stop:()=>o.stop()}}};"undefined"==typeof window||window[a]||(window[a]=J)}();
|
|
6
|
+
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const t=["before","after","prepend","append","replace"],e=/^[a-z0-9][a-z0-9_]{0,63}$/;function i(t){if("string"!=typeof t)return!1;const e=t.trim();if(!e||e.length>500)return!1;if(/[{};<@]/.test(e)||e.includes("/*")||e.includes("*/"))return!1;if(/[\u0000-\u001f\u007f]/.test(e))return!1;try{"undefined"!=typeof document&&document.createDocumentFragment().querySelector(e)}catch(t){return!1}return!0}function n(t){if("string"!=typeof t)return!1;const e=t.trim();return!(!e||e.length>2048)&&!/[\u0000-\u001f\u007f\s]/.test(e)&&/^https?:\/\/[^/?#\s]+/i.test(e)}const o=/\/joryio(?:\.umd)?(?:\.min)?\.js$/;function s(t){if(!t||"string"!=typeof t)return null;let e;try{e=new URL(t)}catch(t){return null}return"https:"===e.protocol&&o.test(e.pathname)?`${e.origin}${e.pathname.replace(/[^/]*$/,"")}`:null}!function(){if("undefined"==typeof document)return null;try{const t=document.currentScript,e=s(t&&t.src);if(e||t&&t.src)return e;const i=document.querySelectorAll("script[src]");for(let t=i.length-1;t>=0;t--){const e=s(i[t].src);if(e)return e}}catch(t){}}();const a="joryio:editor-pick",r="__joryioEditor",l={title:"Joryio editor",variant:"Variant {name}",hintPoint:"Point at anything on the page",hintEditing:"Editing · changes show live",editsOne:"1 edit",editsMany:"{n} edits",noEdits:"No edits yet.",undo:"Undo last edit",undoOffline:"Undo is available once the Joryio dashboard is connected",saveReturn:"Save & return to Joryio",clickToEdit:"click to edit",helpTitle:"Not the right box?",helpUp:"Select the section around it",helpDown:"Select something inside it",helpClickKey:"Click",helpClick:"Edit this one",dismiss:"Dismiss",page:"Page",up:"Select the element around it",down:"Select the first element inside it",matchOne:"1 match on page",matchMany:"Matches {n} - all will change",matchNone:"Not found",whatToDo:"What do you want to do?",actText:"Change text",actLink:"Change link",actImage:"Change image",actHide:"Hide it",actSlot:"Add content slot",noText:"No text here",notLink:"Not a link",notImage:"Not an image",newText:"New text",was:'Was: "{value}"',insert:"Insert",fallbackFor:"If {name} is missing",fallbackHelp:"Shown to visitors we don't know yet.",fallbackBad:"Plain text only - no Liquid here.",fallbackDone:"Done",liquid:"Liquid code",more:"More…",search:"Search fields",noMatch:"No matching fields",rawNote:"Shown as code: this text uses Liquid beyond profile fields and fallbacks.",newLink:"New link address",newImage:"New image address",urlBad:"Enter an address starting with https:// (or http://).",hideNote:"The {kind} is removed for people in this campaign's audience. Everyone else still sees it.",hiddenFor:"Hidden for this audience",slotName:"Slot name",savedAs:"Saved as",slotHelp:"Filled by a Placement campaign or a journey step.",slotEmpty:"Enter a name for the slot.",slotCreate:"Create content for this slot →",slotIn:"In this slot:",slotAddAnother:"+ Add another campaign",where:"Where",posBefore:"Above it",posAfter:"Below it",posReplace:"Instead of it",posPrepend:"Inside, at the start",posAppend:"Inside, at the end",slotPreview:"Content slot",css:"CSS selector",cssHelp:"For developers. Matches {n} on this page.",cssBad:"Not a selector this page can use.",cancel:"Cancel",save:"Save · {action}",noSelector:"This element has no stable selector. Choose the element around it (arrow up) or another one.",kHeading:"Heading",kText:"Text",kLink:"Link",kButton:"Button",kImage:"Image",kList:"List",kSection:"Section",kMain:"Main",kHeader:"Header",kFooter:"Footer",kNav:"Navigation",kForm:"Form",kElement:"Element"};function c(t,e={}){return t.replace(/\{(\w+)\}/g,(t,i)=>i in e?String(e[i]):t)}const d=/\{\{-?([\s\S]*?)-?\}\}/g,p=/\|\s*default\s*:\s*("[^"]*"|'[^']*'|[^|}]*?)\s*(?=\||$)/,h=t=>t.trim().replace(/^(["'])([\s\S]*)\1$/,"$2");function u(t){const e=/^\{\{-?([\s\S]*?)-?\}\}$/.exec((t||"").trim()),i=e&&p.exec(e[1].trim());return i?h(i[1]):null}const f=(t,e)=>e?`{{ ${t} | default: ${(t=>t.includes('"')?t.includes("'")?`'${t.replace(/'/g,"’")}'`:`'${t}'`:`"${t}"`)(e)} }}`:`{{ ${t} }}`,b=/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,4}$/,x=t=>t.replace(/^user\.(custom\.)?/,""),g=/^\{\{-?\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*)\s*(?:\|\s*default\s*:\s*(?:"[^"]*"|'[^']*')\s*)?-?\}\}$/;function m(t){const e=[],i=new RegExp(d.source,"g");let n,o=0;for(t=t||"";n=i.exec(t);){const s=g.exec(n[0]);if(!s)return null;n.index>o&&e.push(t.slice(o,n.index)),e.push({name:x(s[1]),path:s[1],src:n[0]}),o=i.lastIndex}return o<t.length&&e.push(t.slice(o)),e.some(t=>"string"==typeof t&&/\{[{%]|[}%]\}/.test(t))?null:e}function k(t){return(t||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,64).replace(/_+$/,"")}const y=()=>`e${Math.random().toString(36).slice(2,10).padEnd(8,"0")}`;function w(t,e=!1){let i=(t||"").toLowerCase();if(e){const t=i.trim().split(/[\s>+~]+/).filter(Boolean),e=/^[a-z][a-z0-9]*/.exec(t[t.length-1]||"");i=e?e[0]:""}return/^h[1-6]$/.test(i)?"kHeading":/^(p|span|strong|em|small|label|blockquote|b|i)$/.test(i)?"kText":"a"===i?"kLink":"button"===i?"kButton":"img"===i||"picture"===i?"kImage":/^(ul|ol|li)$/.test(i)?"kList":"main"===i?"kMain":"header"===i?"kHeader":"footer"===i?"kFooter":"nav"===i?"kNav":"form"===i?"kForm":/^(section|div|article|aside)$/.test(i)?"kSection":"kElement"}function v(t,e,...i){const n=document.createElement(t);for(const[t,i]of Object.entries(e||{}))void 0!==i&&!1!==i&&n.setAttribute(t,!0===i?"":i);for(const t of i)null!=t&&!1!==t&&n.appendChild("string"==typeof t?document.createTextNode(t):t);return n}const j="http://www.w3.org/2000/svg",A={text:["M4 7V5h16v2M9 19h6M12 5v14"],link:["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71","M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"],image:["M3 5h18v14H3z","m3 16 5-5 4 4 3-3 6 6","M15.5 8.5h.01"],hide:["M9.88 9.88a3 3 0 1 0 4.24 4.24","M10.73 5.08A10.4 10.4 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.67 2.68","M6.61 6.61A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.39-1.61","m2 2 20 20"],slot:["M3 3h18v18H3z","M7 9h10v6H7z"],undo:["M3 7v6h6","M21 17a9 9 0 0 0-15-6.7L3 13"],up:["m18 15-6-6-6 6"],down:["m6 9 6 6 6-6"],cursor:["m4 4 7.07 17 2.51-7.39L21 11.07z"],code:["m16 18 6-6-6-6M8 6l-6 6 6 6"],chevron:["m9 18 6-6-6-6"],check:["M20 6 9 17l-5-5"],close:["M18 6 6 18M6 6l12 12"]};function F(t,e=15){const i=document.createElementNS(j,"svg");for(const[t,n]of Object.entries({width:String(e),height:String(e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.9","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"}))i.setAttribute(t,n);for(const e of A[t]){const t=document.createElementNS(j,"path");t.setAttribute("d",e),i.appendChild(t)}return i}const $='Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif',z='ui-monospace,"SF Mono",Menlo,monospace',E=`font-family:${z};font-size:.8em;font-weight:600;line-height:1;padding:.12em .5em;border-radius:999px;background:rgba(0,169,154,.14);color:#0F766E;box-shadow:inset 0 0 0 1px rgba(0,169,154,.5);white-space:nowrap;unicode-bidi:isolate;font-style:normal;text-transform:none;letter-spacing:0`,O=`.v{${E}}.s,.x{font:12.5px/1.4 ${$};border-radius:10px;padding:14px 16px;text-align:center}.s{border:2px dashed #7A6CFF;background:#F4F2FF;color:#4C3FD1}.s b{font-weight:700}.s code{font-family:${z}}.s div{font-size:11.5px;color:#6B5FD9;margin-top:3px}.x{border:1.5px dashed #F04438;background:#FEF3F2;color:#B42318;text-align:start;padding:10px 12px;font-size:12px}`,_=`\n*{box-sizing:border-box}\n.r{font:13px/1.4 ${$};color:#242B3A;-webkit-font-smoothing:antialiased}\nbutton{font:inherit;color:inherit;cursor:pointer}\nbutton:disabled{cursor:not-allowed}\nbutton:focus-visible,input:focus-visible,textarea:focus-visible,.ce:focus{outline:2px solid #31D6C8;outline-offset:1px}\n.box{position:fixed;pointer-events:none;border:2px dashed #00A99A;background:rgba(0,169,154,.07);border-radius:4px;display:none}\n.box.sel{border-style:solid;background:rgba(0,169,154,.04)}\n.chip{position:absolute;bottom:100%;inset-inline-start:-2px;margin-bottom:2px;background:#00A99A;color:#fff;font-size:11px;font-weight:600;padding:3px 8px;border-radius:6px 6px 6px 0;white-space:nowrap;max-width:60vw;overflow:hidden;text-overflow:ellipsis}\n.help{position:fixed;top:16px;inset-inline-end:16px;width:240px;background:#fff;border:1px solid #E5EAF2;border-radius:10px;box-shadow:0 8px 24px rgba(10,18,64,.14);padding:10px 12px}\n.help h3{margin:0 0 6px;font-size:11px;font-weight:700;color:#6B7280;letter-spacing:.5px;text-transform:uppercase}\n.help .row{display:flex;align-items:center;gap:8px;font-size:12px;padding:3px 0}\n.kbd{min-width:38px;text-align:center;font-size:11px;font-weight:600;border:1px solid #E5EAF2;border-radius:5px;padding:1px 5px;background:#F8FAFC}\n.help .x{position:absolute;top:6px;inset-inline-end:6px;border:0;background:none;color:#8990A8;padding:2px;display:grid}\n.dock{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:6px;background:#071342;color:#fff;border-radius:14px;padding:7px 7px 7px 14px;box-shadow:0 12px 32px rgba(10,18,64,.35);white-space:nowrap;max-width:calc(100vw - 24px)}\n.r.open .dock{left:calc(50% - 190px)}\n.r.open[dir=rtl] .dock{left:calc(50% + 190px)}\n.logo{width:22px;height:22px;border-radius:6px;background:#fff;color:#071342;display:grid;place-items:center;font-weight:800;font-size:13px;flex:none}\n.name{font-size:12.5px;font-weight:600;margin-inline-start:4px;overflow:hidden;text-overflow:ellipsis;max-width:200px}\n.sub{font-size:12px;color:#A8AEC1;overflow:hidden;text-overflow:ellipsis;max-width:220px}\n.sep{width:1px;height:22px;background:#2A3366;margin:0 8px;flex:none}\n.hint{font-size:12px;color:#C9CEDD;display:inline-flex;align-items:center;gap:6px}\n.hint svg{color:#31D6C8}\n.db{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border-radius:8px;border:0;background:#1B245A;color:#fff;font-size:12.5px;font-weight:600}\n.ib{height:32px;width:32px;border-radius:8px;border:0;background:transparent;color:#fff;display:grid;place-items:center}\n.ib:disabled{color:#4A527A}\n.go{height:32px;padding:0 14px;border-radius:8px;border:0;background:#31D6C8;color:#071342;font-size:12.5px;font-weight:700}\n.pop{position:absolute;bottom:calc(100% + 10px);left:0;right:0;min-width:280px;max-height:50vh;overflow:auto;background:#fff;color:#242B3A;border-radius:12px;border:1px solid #E5EAF2;box-shadow:0 12px 32px rgba(10,18,64,.18);padding:6px;white-space:normal}\n.pop .e{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:none;border-radius:8px;font-size:12.5px;text-align:start}\n.pop .e:hover{background:#F8FAFC}\n.pop .empty{padding:12px;font-size:12.5px;color:#6B7280}\n.num{width:20px;height:20px;border-radius:99px;background:#071342;color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center;flex:none}\n.panel{position:fixed;top:0;bottom:0;inset-inline-end:0;width:380px;max-width:100vw;background:#fff;border-inline-start:1px solid #E5EAF2;box-shadow:-8px 0 24px rgba(10,18,64,.06);display:flex;flex-direction:column}\n.hd{padding:16px 18px 14px;border-bottom:1px solid #E5EAF2}\n.crumbs{display:flex;align-items:center;flex-wrap:wrap;gap:4px;font-size:11.5px;color:#6B7280;margin-bottom:6px}\n.crumbs svg{color:#A8AEC1}\n.crumb{border:0;background:transparent;color:#6B7280;font-weight:500;font-size:11.5px;padding:2px 6px;border-radius:5px}\n.crumb.cur{background:#E5F9F6;color:#0F766E;font-weight:600}\n.nav{margin-inline-start:auto;display:flex;gap:2px}\n.nav button{border:1px solid #E5EAF2;background:#fff;border-radius:6px;width:24px;height:22px;display:grid;place-items:center;color:#3A4060;padding:0}\n.nav button:disabled{opacity:.4}\n.tr{display:flex;align-items:center;gap:10px}\n.title{font-size:17px;font-weight:700;color:#0A1240;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}\n.pill{margin-inline-start:auto;display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;padding:3px 8px;border-radius:999px;white-space:nowrap;flex:none}\n.pill.ok{background:#E5F9F6;color:#0F766E}\n.pill.many{background:#FFF7E6;color:#92400E}\n.pill.none{background:#FEF3F2;color:#B42318}\n.bd{padding:16px 18px;overflow:auto;flex:1}\n.lbl{display:block;font-size:12.5px;font-weight:600;color:#242B3A;margin-bottom:8px}\n.tiles{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:18px}\n.tile{display:flex;align-items:center;gap:9px;padding:10px 11px;border-radius:10px;text-align:start;background:#fff;border:1.5px solid #E5EAF2;color:#3A4060}\n.tile[aria-checked=true]{background:#E5F9F6;border-color:#00C8B7;color:#0F766E}\n.tile.slot[aria-checked=true]{background:#F4F2FF;border-color:#7A6CFF;color:#4C3FD1}\n.tile:disabled{opacity:.55}\n.tile[data-e]>span::after{content:'';display:inline-block;width:6px;height:6px;border-radius:9px;background:#00A99A;margin-inline-start:6px;vertical-align:middle}\n.tile b{display:block;font-size:12.5px;font-weight:600;color:#0A1240}\n.tile small{display:block;font-size:10.5px;color:#6B7280}\n.fr{display:flex;align-items:baseline;margin-bottom:8px}\n.fr .lbl{margin:0}\n.was{margin-inline-start:auto;font-size:11.5px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:55%}\ntextarea,input,.ce{width:100%;font:inherit;font-size:13.5px;color:#0F1424;padding:10px 12px;border-radius:10px;border:1.5px solid #E5EAF2;background:#fff;outline:none}\ntextarea,.ce{line-height:1.5;resize:vertical;border-color:#00C8B7}\n.ce{min-height:72px;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text}\n.vp{${E};cursor:pointer}\n.vp .vfb{font-weight:400;opacity:.75}\n.fbp .vc{margin-top:8px}\n.slotc{display:flex;flex-direction:column;align-items:flex-start;gap:6px}\n.slotc .lbl{margin:0}\n.lnk{border:0;background:none;padding:0;color:#4C3FD1;font-size:12.5px;font-weight:600;text-align:start}\ntextarea.mono{height:auto}\ninput{height:40px;padding:0 12px}\ninput.slotin{border-color:#7A6CFF}\n.mono{font-family:${z};font-size:12px;height:36px;background:#F8FAFC;border-width:1px}\n.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}\n.chips span{font-size:11.5px;color:#6B7280;margin-inline-end:2px}\n.vc{font-family:${z};font-size:11.5px;padding:3px 8px;border-radius:6px;border:1px solid #E5EAF2;background:#F8FAFC;color:#3A4060}\n.pk{margin-top:8px;border:1px solid #E5EAF2;border-radius:10px;padding:6px;background:#fff;box-shadow:0 8px 24px rgba(10,18,64,.1)}\n.pk input{height:34px}\n.pk [role=listbox]{max-height:220px;overflow:auto;margin-top:4px}\n.pk .g{font-size:10.5px;font-weight:700;color:#6B7280;text-transform:uppercase;letter-spacing:.4px;padding:8px 8px 3px}\n.pk .o{display:flex;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;border-radius:7px;font-size:12.5px;cursor:pointer}\n.pk .o[aria-selected=true],.pk .o:hover{background:#E5F9F6}\n.pk code{font-family:${z};font-size:11px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n[hidden]{display:none!important}\n.help2{font-size:11.5px;color:#6B7280;margin-top:5px}\n.err{font-size:11.5px;color:#B42318;margin-top:5px}\n.mt{margin-top:14px}\n.note{background:#FFF7E6;border:1px solid #FCD34D;border-radius:10px;padding:10px 12px;font-size:12.5px;color:#92400E;line-height:1.5}\n.key{font-family:${z};color:#4C3FD1;background:#F4F2FF;padding:1px 6px;border-radius:4px}\n.seg{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;background:#F3F5FA;border-radius:9px;padding:3px}\n.seg button{border:0;background:transparent;border-radius:7px;padding:6px 4px;font-size:12px;color:#3A4060}\n.seg button[aria-checked=true]{background:#fff;color:#0A1240;font-weight:600;box-shadow:0 1px 2px rgba(10,18,64,.08)}\n.css{margin-top:20px;display:inline-flex;align-items:center;gap:6px;border:0;background:transparent;padding:0;color:#6B7280;font-size:12px}\n.ft{padding:12px 18px;border-top:1px solid #E5EAF2;display:flex;gap:10px;background:#F8FAFC}\n.cancel{height:38px;padding:0 14px;border-radius:10px;border:1px solid #E5EAF2;background:#fff;color:#242B3A;font-size:13px;font-weight:600}\n.save{flex:1;height:38px;border-radius:10px;border:0;background:#071342;color:#fff;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.save:disabled{opacity:.45}\n@media (max-width:760px){.r.open .dock{display:none}.help{display:none}}\n`,S="data-liquid",M=t=>!!t&&1===t.nodeType&&t.hasAttribute(S);function B(t){if(3===t.nodeType)return t.data;if(M(t))return t.getAttribute(S)||"";let e="";for(const i of Array.from(t.childNodes))e+=B(i);return e}const C=["data-joryio-id","data-testid","data-test","data-qa","data-cy","data-id","name"],N=/^[a-z0-9][a-z0-9_]{0,63}$/,D=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,I=2e3,L="jry_editor_help_dismissed",H=t=>!!t&&!!t.closest("[data-joryio-editor]"),P="var";function Z(t){let e=t instanceof Element?t:null;return e&&e.getAttribute("data-joryio-editor")===P&&(e=e.parentElement),e&&!H(e)&&e!==document.body&&e!==document.documentElement?e:null}function T(t){if(!i(t))return[];try{return Array.from(document.querySelectorAll(t)).filter(t=>!H(t))}catch(t){return[]}}const q=(t,e,i)=>{try{const n=Array.from(t.querySelectorAll(e)).filter(t=>!H(t));return 1===n.length&&n[0]===i}catch(t){return!1}};function R(t){const e=t.ownerDocument;if(!e)return null;const n=t=>{if((i=t.id)&&i.length<=64&&!/\d{4,}/.test(i)&&!/^(ember|react|radix|headlessui|mui)[-_:]/i.test(i)&&!/:/.test(i)){const i=`#${function(t){const e=globalThis.CSS;if(e&&"function"==typeof e.escape)return e.escape(t);let i="";for(let e=0;e<t.length;e++){const n=t[e],o=t.charCodeAt(e);0===o?i+="�":/[0-9]/.test(n)&&(0===e||1===e&&"-"===t[0])?i+=`\\${o.toString(16)} `:/[A-Za-z0-9_-]/.test(n)||o>=128?i+=n:i+=`\\${n}`}return i}(t.id)}`;if(q(e,i,t))return i}var i;for(const i of C){const n=t.getAttribute(i);if(!n||n.length>100)continue;const o=`${t.tagName.toLowerCase()}[${i}="${n.replace(/["\\]/g,"\\$&")}"]`;if(q(e,o,t))return o}return null},o=n(t);if(o)return i(o)?o:null;const s=[];let a=t;for(;a&&a!==e.body&&a!==e.documentElement;){const t=s.length?n(a):null;if(t){s.unshift(t);break}const i=a.tagName.toLowerCase(),o=a.parentElement,r=o?Array.from(o.children).filter(t=>t.tagName===a.tagName):[];s.unshift(r.length>1?`${i}:nth-of-type(${r.indexOf(a)+1})`:i),a=o,a===e.body&&s.unshift("body")}const r=s.join(" > ");return r&&i(r)&&q(e,r,t)?r:null}const U=["text","link","image","hide","slot"],V={text:"replace_text",link:"replace_link",image:"replace_image",hide:"hide",slot:"insert_placement"},J={replace_text:"text",replace_link:"link",replace_image:"image",hide:"hide",insert_placement:"slot"},K={text:"actText",link:"actLink",image:"actImage",hide:"actHide",slot:"actSlot"},G={text:"text",link:"link",image:"image",hide:"hide",slot:"slot"},W=[["before","posBefore"],["after","posAfter"],["replace","posReplace"],["prepend","posPrepend"],["append","posAppend"]],X=["user.firstName","user.lastName","user.email","user.custom.city"],Q=/^[A-Za-z0-9_-]{1,64}$/,Y=(t,e)=>"string"==typeof t?t.trim().slice(0,e):"",tt=t=>(t&&t.textContent||"").replace(/\s+/g," ").trim();class et{constructor(t,e,i,n=()=>{}){this.dashboardOrigin=t,this.opener=e,this.logger=i,this.onStop=n,this.listeners=[],this.active=!1,this.host=null,this.root=null,this.wrap=null,this.hoverBox=null,this.selBox=null,this.dock=null,this.panel=null,this.help=null,this.hovered=null,this.selected=null,this.draft=null,this.showCss=!1,this.showLiquid=!1,this.closeOverlay=null,this.popOpen=!1,this.edits=[],this.history=[],this.synced=!1,this.t=Object.assign({},l),this.dir="ltr",this.ctx={campaignName:"",variantName:"",attributes:[],placements:[],sample:{},openSlot:!1},this.previewUndo=[],this.originals=new WeakMap}start(){if(this.active)return;this.active=!0;const t=t=>{const e=t.data;e&&"string"==typeof e.type&&t.origin===this.dashboardOrigin&&t.source===this.opener&&("joryio:editor-close"===e.type?this.stop():"joryio:editor-context"===e.type?this.applyContext(e):"joryio:editor-focus"===e.type&&this.focusEdit(e.id))};window.addEventListener("message",t),this.listeners.push(()=>window.removeEventListener("message",t)),this.activate()}isActive(){return this.active}editList(){return this.edits.slice()}stop(){var t;if(this.active){this.send({type:"joryio:editor-closed"}),this.active=!1;for(const t of this.listeners.splice(0))t();this.clearPreview(),null===(t=this.host)||void 0===t||t.remove(),this.host=this.root=this.wrap=this.hoverBox=this.selBox=this.dock=this.panel=this.help=null,this.selected=this.hovered=null,this.draft=null;try{this.onStop()}catch(t){this.logger.debug("Joryio editor stop callback failed",t)}}}send(t){if(this.active)try{this.opener.postMessage(t,this.dashboardOrigin)}catch(t){}}activate(){const t=document,e=t.createElement("joryio-editor");e.setAttribute("data-joryio-editor","root"),e.setAttribute("style","all:initial !important;position:fixed !important;top:0 !important;left:0 !important;width:0 !important;height:0 !important;z-index:2147483647 !important;display:block !important");const i=e.attachShadow({mode:"closed"});i.appendChild(v("style",null,_));const n=v("div",{class:"r",dir:this.dir});this.hoverBox=v("div",{class:"box","data-j":"hover"}),this.selBox=v("div",{class:"box sel","data-j":"selected"}),n.append(this.hoverBox,this.selBox),i.appendChild(n),t.documentElement.appendChild(e),this.host=e,this.root=i,this.wrap=n;const o=t=>{const e=t.target instanceof Element?t.target:null;H(e)&&e.getAttribute("data-joryio-editor")!==P||(this.hovered=Z(e),this.place(this.hoverBox,this.hovered===this.selected?null:this.hovered,!0))},s=t=>{if(t.target instanceof Element&&t.target.closest('[data-joryio-editor="root"]'))return;t.preventDefault(),t.stopPropagation();const e=Z(t.target);e&&this.select(e)},a=t=>{if("Escape"!==t.key){if(!H(t.target instanceof Element?t.target:null)&&("ArrowUp"===t.key||"ArrowDown"===t.key)){const e=this.selected||this.hovered;if(!e)return;t.preventDefault(),t.stopPropagation(),this.move("ArrowUp"===t.key?"up":"down",e)}}else{if(this.closeOverlay&&this.closeOverlay())return;this.popOpen?this.togglePop(!1):this.panel?this.cancel():this.stop()}},r=()=>{this.place(this.hoverBox,this.hovered===this.selected?null:this.hovered,!0),this.place(this.selBox,this.selected)};t.addEventListener("mousemove",o,!0),t.addEventListener("click",s,!0),t.addEventListener("keydown",a,!0),window.addEventListener("scroll",r,!0),window.addEventListener("resize",r),this.listeners.push(()=>t.removeEventListener("mousemove",o,!0),()=>t.removeEventListener("click",s,!0),()=>t.removeEventListener("keydown",a,!0),()=>window.removeEventListener("scroll",r,!0),()=>window.removeEventListener("resize",r)),this.renderDock(),this.renderHelp(),this.send({type:"joryio:editor-active",url:`${location.origin}${location.pathname}`})}applyContext(o){var s;this.synced=!0,this.t=function(t){const e=Object.assign({},l);if(t&&"object"==typeof t)for(const i of Object.keys(l)){const n=t[i];"string"==typeof n&&n.trim()&&n.length<=500&&(e[i]=n)}return e}(o.strings),this.dir="rtl"===o.dir?"rtl":"ltr",null===(s=this.wrap)||void 0===s||s.setAttribute("dir",this.dir);const a=(t,e,i)=>(Array.isArray(t)?t:[]).map(e).filter(t=>null!==t).slice(0,i);if(this.ctx={campaignName:Y(o.campaignName,120),variantName:Y(o.variantName,60),attributes:a(o.attributes,t=>t?"string"==typeof t.key&&b.test(t.key)?{path:t.key,label:Y(t.label,60)||t.key.split(".").pop(),group:Y(t.group,40)}:"string"==typeof t.name&&D.test(t.name)?{path:`user.${!0===t.custom?"custom.":""}${t.name}`,label:t.name,group:""}:null:null,400),placements:a(o.placements,t=>t&&"string"==typeof t.key&&N.test(t.key)?{key:t.key,name:Y(t.name,80),campaigns:a(t.campaigns,t=>t&&"string"==typeof t.id&&Q.test(t.id)?{id:t.id,name:Y(t.name,120)||t.id,status:Y(t.status,30),statusLabel:Y(t.statusLabel,40)}:null,10)}:null,200),sample:{},openSlot:!0===o.openSlot},o.sample&&"object"==typeof o.sample)for(const[t,e]of Object.entries(o.sample).slice(0,100))/^user\.[A-Za-z0-9_.]{1,80}$/.test(t)&&"string"==typeof e&&(this.ctx.sample[t]=e.slice(0,200));Array.isArray(o.edits)&&(this.edits=a(o.edits,o=>function(o){if(!o||"object"!=typeof o||"string"!=typeof o.id||!i(o.selector))return null;const s=Object.assign({id:o.id,selector:o.selector.trim()},!0===o.personalized?{personalized:!0}:{});switch(o.operation){case"hide":return Object.assign(Object.assign({},s),{operation:"hide"});case"replace_text":return"string"==typeof o.value&&o.value.length<=2e3?Object.assign(Object.assign({},s),{operation:"replace_text",value:o.value}):null;case"replace_image":case"replace_link":return n(o.value)?Object.assign(Object.assign({},s),{operation:o.operation,value:o.value.trim()}):null;case"insert_placement":return"string"==typeof o.placementKey&&e.test(o.placementKey)?Object.assign(Object.assign({},s),{operation:"insert_placement",placementKey:o.placementKey,position:t.includes(o.position)?o.position:"after"}):null;default:return null}}(o),100).map(t=>{const{personalized:e}=t,i=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}(t,["personalized"]);return i}),this.history=[]),this.renderPreview(),this.renderDock(),this.renderHelp(),this.draft&&this.renderPanel(),"string"==typeof o.focusId&&this.focusEdit(o.focusId)}place(t,e,i=!1){if(!t)return;if(!e||!e.isConnected)return void(t.style.display="none");const n=e.getBoundingClientRect();Object.assign(t.style,{display:"block",top:n.top-2+"px",left:n.left-2+"px",width:`${n.width+4}px`,height:`${n.height+4}px`}),t.textContent="";const o=`${this.t[w(e.tagName)]} · ${e.tagName.toLowerCase()}`;t.appendChild(v("span",{class:"chip","data-j":"label"},i?`${o} - ${this.t.clickToEdit}`:o))}move(t,e){const i="up"===t?e.parentElement:Array.from(e.children).filter(t=>!H(t))[0]||null;i&&i!==document.body&&i!==document.documentElement&&this.select(i)}editsOn(t){if(!t)return[];const e=R(t);return this.edits.filter(i=>i.selector===e||T(i.selector).indexOf(t)>=0)}select(t,e){if(!this.active)return;e=e||this.editsOn(t).pop(),this.selected=t,this.hovered=null,this.place(this.hoverBox,null),this.place(this.selBox,t),this.popOpen=!1;const i=e?e.selector:R(t)||"";this.showCss=!i,this.draft=e?this.draftOf(e):this.newDraft(t,i),this.renderPanel(),this.renderDock(),this.renderHelp(),this.renderPreview()}enabled(t,e){return!e||("text"===t?"IMG"!==e.tagName&&!!this.orig(e).text:"link"===t?"A"===e.tagName:"image"!==t||"IMG"===e.tagName)}newDraft(t,e){const i=this.orig(t),n="IMG"===t.tagName?"image":this.enabled("text",t)?"text":"A"===t.tagName?"link":"hide";return{action:n,text:i.text.slice(0,I),url:("image"===n?i.src:i.href)||"",slotName:"",position:"after",selector:e,editingId:null,touched:!1}}draftOf(t){const e=J[t.operation];return{action:e,text:"replace_text"===t.operation&&t.value||"",url:("link"===e||"image"===e)&&t.value||"",slotName:t.placementKey||"",position:t.position||"after",selector:t.selector,editingId:t.id,touched:!0}}orig(t){return this.originals.get(t)||{text:tt(t),href:t.getAttribute("href"),src:t.getAttribute("src")}}focusEdit(t){const e=this.edits.filter(e=>e.id===t)[0];if(!e||!this.active)return!1;const i=T(e.selector)[0]||null;if(i){try{i.scrollIntoView({block:"center"})}catch(t){}this.select(i,e)}else this.selected=null,this.place(this.selBox,null),this.draft=this.draftOf(e),this.showCss=!0,this.renderPanel(),this.renderDock(),this.renderHelp(),this.renderPreview();return!0}draftEdit(t){const e={id:t.editingId||"",selector:t.selector.trim()};if(!i(e.selector))return null;const o=V[t.action];if("hide"===t.action)return Object.assign(Object.assign({},e),{operation:o});if("text"===t.action)return t.text.trim()&&t.text.length<=I?Object.assign(Object.assign({},e),{operation:o,value:t.text}):null;if("link"===t.action||"image"===t.action)return n(t.url)?Object.assign(Object.assign({},e),{operation:o,value:t.url.trim()}):null;const s=k(t.slotName);return N.test(s)?Object.assign(Object.assign({},e),{operation:o,placementKey:s,position:t.position}):null}save(){var t,e;const i=this.draft,n=i&&this.draftEdit(i);if(!i||!n)return;const o=this.selected||T(n.selector)[0]||null,s=i.editingId||y();this.pick(o,n.selector,n.operation,null!==(e=null!==(t=n.value)&&void 0!==t?t:n.placementKey)&&void 0!==e?e:"",{id:s,position:n.position})&&"insert_placement"===n.operation&&this.ctx.openSlot&&this.focusEdit(s)}openSlot(t,e){if(!this.ctx.openSlot||!N.test(t))return!1;this.send(Object.assign({type:"joryio:editor-open-slot",placementKey:t},e?{campaignId:e}:{}));try{this.opener.focus()}catch(t){}return!0}pick(t,e,o,s,r={}){const l=r.id||y(),c=t?t.tagName.toLowerCase():"",d=t?this.orig(t).text.slice(0,200):"";let p=null;if(i(e)){const t={id:l,selector:e.trim()};if("hide"===o)p=Object.assign(Object.assign({},t),{operation:o});else if("replace_text"===o)p=(s||d)&&(s||d).length<=I?Object.assign(Object.assign({},t),{operation:o,value:s||d}):null;else if("replace_image"===o||"replace_link"===o)p=n(s)?Object.assign(Object.assign({},t),{operation:o,value:s.trim()}):null;else if("insert_placement"===o){const e=k(s);p=N.test(e)?Object.assign(Object.assign({},t),{operation:o,placementKey:e,position:r.position||"after"}):null}}if(!p)return!1;const h=Object.assign(Object.assign({type:a},p),{tag:c,text:d});this.send(h);const u=this.edits.map(t=>t.id).indexOf(l);return this.history.push({id:l,before:u>=0?this.edits[u]:null}),u>=0?this.edits[u]=p:this.edits.push(p),this.closePanel(),!0}cancel(){this.closePanel()}closePanel(){var t,e;this.draft=null,this.selected=null,null===(t=this.panel)||void 0===t||t.remove(),this.panel=null,null===(e=this.wrap)||void 0===e||e.classList.remove("open"),this.place(this.selBox,null),this.renderPreview(),this.renderDock(),this.renderHelp()}undo(){if(!this.synced)return!1;const t=this.history.pop();if(!t)return!1;const e=this.edits.map(t=>t.id).indexOf(t.id);if(t.before){e>=0&&(this.edits[e]=t.before);const i=t.before;this.send(Object.assign(Object.assign({type:a},i),{tag:"",text:""}))}else e>=0&&this.edits.splice(e,1),this.send({type:"joryio:editor-remove",id:t.id});return this.draft?this.closePanel():(this.renderPreview(),this.renderDock()),!0}done(){this.send({type:"joryio:editor-done"}),this.stop();try{this.opener.focus()}catch(t){}try{window.close()}catch(t){}}clearPreview(){for(const t of this.previewUndo.splice(0).reverse())try{t()}catch(t){}}renderPreview(){if(this.clearPreview(),!this.active)return;const t=this.draft,e=t?this.draftEdit(t):null,i=[];for(const n of this.edits)i.push(t&&t.editingId===n.id&&e||n);t&&!t.editingId&&e&&t.touched&&i.push(e);for(const t of i)for(const e of T(t.selector).slice(0,50))this.applyPreview(t,e);this.selected&&this.place(this.selBox,this.selected)}previewNode(t,e="all:initial !important;display:block !important;margin:10px 0 !important",i="preview"){const n=document.createElement("joryio-editor-preview");n.setAttribute("data-joryio-editor",i),n.setAttribute("style",e);const o=n.attachShadow({mode:"open"});return o.appendChild(v("style",null,O)),t(o),n}applyPreview(t,e){this.originals.has(e)||this.originals.set(e,{text:tt(e),href:e.getAttribute("href"),src:e.getAttribute("src")});const i=this.previewUndo,n=(t,n)=>{const o=e.getAttribute(t);null===n?e.removeAttribute(t):e.setAttribute(t,n),i.push(()=>null===o?e.removeAttribute(t):e.setAttribute(t,o))},o=()=>{const t=e.style;if(!t)return;const n=t.getPropertyValue("display"),o=t.getPropertyPriority("display");t.setProperty("display","none","important"),i.push(()=>n?t.setProperty("display",n,o):t.removeProperty("display"))},s=(t,n)=>{const o=e.parentNode;"before"===n&&o?o.insertBefore(t,e):"after"!==n&&"replace"!==n||!o?"prepend"===n?e.insertBefore(t,e.firstChild):e.appendChild(t):o.insertBefore(t,e.nextSibling),i.push(()=>t.parentNode&&t.parentNode.removeChild(t))};switch(t.operation){case"replace_text":{const n=Array.from(e.childNodes);e.textContent="";for(const i of function(t,e){const i=[],n=new RegExp(d.source,"g");let o,s=0;const a=t=>{t&&("string"==typeof i[i.length-1]?i[i.length-1]+=t:i.push(t))};for(t=t||"";o=n.exec(t);){a(t.slice(s,o.index)),s=n.lastIndex;const r=o[1].trim(),l=r.split("|")[0].trim(),c=p.exec(r);Object.prototype.hasOwnProperty.call(e,l)&&""!==e[l]?a(e[l]):c&&h(c[1])?a(h(c[1])):i.push({name:x(l),path:l,src:o[0]})}return a(t.slice(s)),i}(t.value||"",this.ctx.sample))e.appendChild("string"==typeof i?document.createTextNode(i):this.previewNode(t=>t.appendChild(v("span",{class:"v",dir:"auto"},this.labelOf(i.path)||i.name)),"all:unset !important;display:inline !important;unicode-bidi:isolate !important",P));i.push(()=>{e.textContent="";for(const t of n)e.appendChild(t)});break}case"replace_link":n("href",t.value||null);break;case"replace_image":n("srcset",null),n("src",t.value||null);break;case"hide":{const t=`${this.t[w(e.tagName)]} "${this.orig(e).text.slice(0,40)}"`;s(this.previewNode(e=>e.appendChild(v("div",{class:"x"},`${this.t.hiddenFor}: ${t}`))),"after"),o();break}case"insert_placement":{const e=t.position||"after";s(this.previewNode(e=>e.appendChild(v("div",{class:"s"},v("b",null,`${this.t.slotPreview} · `),v("code",null,t.placementKey||""),v("div",null,this.t.slotHelp)))),e),"replace"===e&&o();break}}}renderHelp(){var t;null===(t=this.help)||void 0===t||t.remove(),this.help=null;let e=!1;try{e="1"===localStorage.getItem(L)}catch(t){}if(e||this.draft||!this.wrap)return;const i=this.t,n=(t,e)=>v("div",{class:"row"},v("span",{class:"kbd"},t),e),o=v("button",{class:"x",type:"button","aria-label":i.dismiss,title:i.dismiss,"data-j":"help-dismiss"},F("close",13));o.addEventListener("click",()=>{var t;try{localStorage.setItem(L,"1")}catch(t){}null===(t=this.help)||void 0===t||t.remove(),this.help=null}),this.help=v("div",{class:"help","data-j":"help",role:"note"},o,v("h3",null,i.helpTitle),n("↑",i.helpUp),n("↓",i.helpDown),n(i.helpClickKey,i.helpClick)),this.wrap.appendChild(this.help)}labelOf(t){const e=this.ctx.attributes.filter(e=>e.path===t)[0];return e&&e.label}editTitle(t){const e=T(t.selector)[0],i=this.t[e?w(e.tagName):w(t.selector,!0)];return`${this.t[K[J[t.operation]]]} · ${i}`}togglePop(t){this.popOpen=t,this.renderDock()}renderDock(){var t;if(!this.wrap)return;const e=this.t;null===(t=this.dock)||void 0===t||t.remove();const i=this.edits.length,n=[this.ctx.variantName?c(e.variant,{name:this.ctx.variantName}):"",location.pathname||"/"].filter(Boolean).join(" · "),o=v("button",{class:"db",type:"button","aria-expanded":String(this.popOpen),"data-j":"edits"},1===i?e.editsOne:c(e.editsMany,{n:i}),F(this.popOpen?"down":"up",11));o.addEventListener("click",()=>this.togglePop(!this.popOpen));const s=this.synced&&this.history.length>0,a=v("button",{class:"ib",type:"button","aria-label":e.undo,title:this.synced?e.undo:e.undoOffline,disabled:!s,"data-j":"undo"},F("undo",14));a.addEventListener("click",()=>this.undo());const r=v("button",{class:"go",type:"button","data-j":"done"},e.saveReturn);r.addEventListener("click",()=>this.done());const l=v("div",{class:"dock","data-j":"dock",role:"toolbar","aria-label":e.title},v("span",{class:"logo","aria-hidden":"true"},"J"),v("span",{class:"name","data-j":"campaign"},this.ctx.campaignName||e.title),v("span",{class:"sub"},`· ${n}`),v("span",{class:"sep"}),v("span",{class:"hint","data-j":"hint"},F("cursor",13),this.draft?e.hintEditing:e.hintPoint),v("span",{class:"sep"}),o,a,r);if(this.popOpen){const t=v("div",{class:"pop","data-j":"edit-list",role:"menu"});i||t.appendChild(v("div",{class:"empty"},e.noEdits)),this.edits.forEach((e,i)=>{const n=v("button",{class:"e",type:"button",role:"menuitem","data-j":"edit-item","data-edit-id":e.id},v("span",{class:"num"},String(i+1)),this.editTitle(e));n.addEventListener("click",()=>this.focusEdit(e.id)),t.appendChild(n)}),l.appendChild(t)}this.dock=l,this.wrap.appendChild(l)}renderPanel(){var t;const e=this.draft;if(!e||!this.wrap)return;const n=this.t,o=this.selected;null===(t=this.panel)||void 0===t||t.remove(),this.wrap.classList.add("open");const s=v("div",{class:"crumbs","data-j":"crumbs"});if(o){const t=[];for(let e=o;e&&e!==document.body&&e!==document.documentElement;e=e.parentElement)t.unshift(e);const e=t.slice(-3),i=(t,e,i)=>{const n=v("button",{class:i?"crumb cur":"crumb",type:"button","data-j":"crumb","aria-current":i?"true":void 0,disabled:!e},t);return e&&!i&&n.addEventListener("click",()=>this.select(e)),n};s.appendChild(i(n.page,null,!1));for(const t of e)s.append(F("chevron",9),i(n[w(t.tagName)],t,t===o));const a=v("button",{type:"button","aria-label":n.up,title:n.up,"data-j":"up",disabled:!o.parentElement||o.parentElement===document.body},F("up",12));a.addEventListener("click",()=>this.move("up",o));const r=v("button",{type:"button","aria-label":n.down,title:n.down,"data-j":"down",disabled:!Array.from(o.children).some(t=>!H(t))},F("down",12));r.addEventListener("click",()=>this.move("down",o)),s.appendChild(v("span",{class:"nav"},a,r))}const a=n[o?w(o.tagName):w(e.selector,!0)],r=o?"IMG"===o.tagName?o.getAttribute("alt")||"":this.orig(o).text:"",l=v("div",{class:"title","data-j":"title"},r?`${a} "${r.slice(0,40)}"`:a),d=v("span",{class:"pill","data-j":"matches"}),p=v("div",{class:"hd"},s,v("div",{class:"tr"},l,d)),h=v("div",{class:"tiles",role:"radiogroup","aria-label":n.whatToDo}),u=this.editsOn(o);for(const t of U){const i=e.action===t,s=i||this.enabled(t,o),a=s?"":"link"===t?n.notLink:"image"===t?n.notImage:n.noText,r=u.filter(e=>J[e.operation]===t).pop(),l=v("button",{class:"slot"===t?"tile slot":"tile",type:"button",role:"radio","aria-checked":String(i),disabled:!s,"data-e":!!r,"data-j":`action-${t}`},F(G[t]),v("span",null,v("b",null,n[K[t]]),a?v("small",null,a):null));l.addEventListener("click",()=>{this.draft&&this.draft.action!==t&&(r?this.draft=this.draftOf(r):(o&&this.draft.editingId&&(this.draft=this.newDraft(o,this.draft.selector)),this.draft.action=t,this.draft.touched=!0,"link"!==t&&"image"!==t||!o||(this.draft.url=("image"===t?this.orig(o).src:this.orig(o).href)||"")),this.renderPanel(),this.renderPreview())}),h.appendChild(l)}const f=v("div",{"data-j":"fields"}),b=v("button",{class:"save",type:"button","data-j":"save"}),x=()=>{const t=!!this.draftEdit(e);b.disabled=!t,b.textContent=c(n.save,{action:n[K[e.action]]});const i=T(e.selector).length;d.className="pill "+(1===i?"ok":i>1?"many":"none"),d.textContent=1===i?n.matchOne:i>1?c(n.matchMany,{n:i}):n.matchNone},g=()=>{e.touched=!0,x(),this.renderPreview()};this.renderFields(f,e,o,g);const m=v("button",{class:"css",type:"button","aria-expanded":String(this.showCss),"data-j":"css-toggle"},F("code",13),n.css,F(this.showCss?"up":"down",10));m.addEventListener("click",()=>{this.showCss=!this.showCss,this.renderPanel()});const k=v("div",{class:"bd"},v("span",{class:"lbl"},n.whatToDo),h,f,m);if(this.showCss){const t=v("input",{class:"mono",dir:"ltr","aria-label":n.css,spellcheck:"false","data-j":"selector"});t.value=e.selector;const o=v("div",{class:"help2"}),s=()=>{const t=i(e.selector);o.className=t?"help2":"err",o.textContent=e.selector.trim()?t?c(n.cssHelp,{n:T(e.selector).length}):n.cssBad:n.noSelector};t.addEventListener("input",()=>{e.selector=t.value,s(),g()}),s(),k.append(v("div",{class:"mt"},t,o))}const y=v("button",{class:"cancel",type:"button","data-j":"cancel"},n.cancel);y.addEventListener("click",()=>this.cancel()),b.addEventListener("click",()=>this.save());const j=v("aside",{class:"panel","data-j":"panel",role:"dialog","aria-label":n.whatToDo},p,k,v("div",{class:"ft"},y,b));x(),this.panel=j,this.wrap.appendChild(j)}renderFields(t,e,i,o){const s=this.t;t.textContent="",this.closeOverlay=null;const a=t=>t?v("span",{class:"was",title:t},c(s.was,{value:t.slice(0,60)})):null;if("text"===e.action){let n=null;const r=t=>{var i;e.text=t,n&&n!==(null===(i=this.root)||void 0===i?void 0:i.activeElement)&&(n.value=t),o()},l=function(t){const e=v("div",{"data-j":"text-box"});let i="",n=null,o=null,s=null;const a=()=>{const e=t.root;return(e&&"function"==typeof e.getSelection?e.getSelection():null)||document.getSelection()},r=()=>{const e=a();if(!e||!e.rangeCount)return null;let i=e.getRangeAt(0);const o=e.getComposedRanges;if(t.root&&o&&(!n||!n.contains(i.startContainer)))try{const n=o.call(e,{shadowRoots:[t.root]})[0];i=document.createRange(),i.setStart(n.startContainer,n.startOffset),i.setEnd(n.endContainer,n.endOffset)}catch(t){i=null}return n&&i&&n.contains(i.startContainer)&&n.contains(i.endContainer)?i:null},l=()=>{const t=r();t&&(o=t.cloneRange())},d=()=>{n&&"DIV"===n.tagName&&(i=B(n)),l(),t.onChange(i)},p=t=>{const e=a();try{e&&e.setBaseAndExtent?e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset):e&&(e.removeAllRanges(),e.addRange(t))}catch(t){}o=t.cloneRange()},h=e=>t.labelOf&&t.labelOf(e.path)||e.name,b=e=>{const i=u(e.src),n=h(e),o=t.fallback;return v("span",Object.assign({class:"vp",contenteditable:"false",dir:"auto",title:e.src,[S]:e.src,"data-path":e.path},o?{role:"button",tabindex:"0","aria-haspopup":"dialog","aria-label":i?`${n} · ${i}`:n}:{}),n,i?v("span",{class:"vfb","data-j":"pill-fallback"},` · ${i}`):null)},x=()=>!!s&&(s.remove(),s=null,!0),g=o=>{const a=t.fallback;if(!a||!n||"DIV"!==n.tagName)return;x();let r=o;const l={path:r.getAttribute("data-path")||"",name:"",src:r.getAttribute(S)||""};l.name=l.path.replace(/^user\.(custom\.)?/,"");const d=c(a.title,{name:h(l)}),p=v("input",{dir:"auto","data-j":"fallback","aria-label":d,maxlength:"200"});p.value=u(l.src)||"";const g=v("div",{class:"err","data-j":"fallback-error",role:"alert"}),m=v("button",{class:"vc",type:"button","data-j":"fallback-done"},a.done),k=v("div",{class:"pk fbp",role:"dialog","aria-label":d,"data-j":"fallback-pop"},v("label",{class:"lbl"},d),p,g,v("div",{class:"help2"},a.help),m),y=()=>{x();try{r.focus()}catch(t){}};p.addEventListener("input",()=>{const e=(t=>t.length<=200&&!/\{[{%]|[}%]\}|[\r\n]/.test(t))(p.value);if(g.textContent=e?"":a.bad,!e)return;const o=function(t,e){const i=/^\{\{-?\s*([A-Za-z_][A-Za-z0-9_.]*)/.exec((t||"").trim());return i?f(i[1],e.trim()||null):t}(r.getAttribute(S)||"",p.value),s=b(Object.assign(Object.assign({},l),{src:o}));r.parentNode&&r.parentNode.replaceChild(s,r),r=s,n&&"DIV"===n.tagName&&(i=B(n)),t.onChange(i)}),p.addEventListener("keydown",t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),t.stopPropagation(),y())}),m.addEventListener("click",y),s=k,e.appendChild(k),p.focus()},k=a=>{i=a,o=null,s=null,e.textContent="";const c=m(a);if(!c){const o=v("textarea",{rows:"3",dir:"auto","data-j":"text","aria-label":t.label});return o.value=a,o.addEventListener("input",()=>{i=o.value,t.onChange(i)}),o.addEventListener("blur",()=>m(i)&&k(i)),n=o,void e.append(o,v("div",{class:"help2","data-j":"raw-note"},t.rawNote))}const h=v("div",{class:"ce",contenteditable:"true",role:"textbox","aria-multiline":"true",dir:"auto",spellcheck:"false","data-j":"text","aria-label":t.label});for(const t of c)h.append("string"==typeof t?document.createTextNode(t):b(t));h.addEventListener("input",d),h.addEventListener("keyup",l),h.addEventListener("mouseup",l),h.addEventListener("click",t=>{const e=t.target instanceof Element?t.target.closest(`[${S}]`):null;e&&h.contains(e)&&g(e)}),h.addEventListener("keydown",t=>{const e=t.target instanceof Element&&M(t.target)?t.target:null;if(e&&("Enter"===t.key||" "===t.key))return t.preventDefault(),g(e);if("Enter"===t.key)return t.preventDefault();if("Backspace"!==t.key&&"Delete"!==t.key)return;const i=r();if(!i||!i.collapsed)return;const n="Backspace"===t.key,o=i.startContainer,s=i.startOffset;let a=null;3===o.nodeType?n&&0===s?a=o.previousSibling:n||s!==o.length||(a=o.nextSibling):a=o.childNodes[n?s-1:s]||null,M(a)&&(t.preventDefault(),a.remove(),d())});const u=t=>e=>{const i=r();i&&!i.collapsed&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData("text/plain",B(i.cloneContents())),t&&(i.deleteContents(),d()))};h.addEventListener("copy",u(!1)),h.addEventListener("cut",u(!0)),h.addEventListener("paste",t=>{t.preventDefault();const e=(t.clipboardData&&t.clipboardData.getData("text/plain")||"").replace(/\r/g,""),n=r();if(!e||!n)return;n.deleteContents();const o=document.createTextNode(e);n.insertNode(o),n.setStartAfter(o),n.collapse(!0),p(n),d(),/\{[{%]/.test(e)&&k(i)}),h.addEventListener("blur",()=>Array.from(h.childNodes).some(t=>3===t.nodeType&&/\{[{%]/.test(t.data))&&k(i)),n=h,e.appendChild(h)};return{el:e,set:k,insert:e=>{const s=r()||(o&&n&&n.isConnected&&n.contains(o.startContainer)?o:null);if(!s||!n||"DIV"!==n.tagName)return k(i?`${i.replace(/\s+$/,"")} ${e}`:e),t.onChange(i);const a=m(e),l=a&&a[0];if(!l||"string"==typeof l)return;n.focus(),s.deleteContents();const c=document.createRange();c.selectNodeContents(n),c.setEnd(s.startContainer,s.startOffset);const h=B(c.cloneContents()),u=document.createDocumentFragment();h&&!/\s$/.test(h)&&u.appendChild(document.createTextNode(" "));const f=b(l);u.appendChild(f),s.insertNode(u),s.setStartAfter(f),s.collapse(!0),p(s),d()},closePop:x}}({label:s.newText,rawNote:s.rawNote,root:this.root,onChange:r,labelOf:t=>this.labelOf(t),fallback:{title:s.fallbackFor,help:s.fallbackHelp,bad:s.fallbackBad,done:s.fallbackDone}});l.set(e.text);const d=t=>l.insert(f(t.path)),p=this.ctx.attributes.length?this.ctx.attributes:["firstName","lastName"].map(t=>({path:`user.${t}`,label:t,group:""})),h=X.map(t=>p.filter(e=>e.path===t)[0]).filter(Boolean),b=h.concat(p.filter(t=>h.indexOf(t)<0)).slice(0,4),x=v("div",{class:"chips","data-j":"chips"},v("span",null,s.insert)),g=v("div",{class:"pk","data-j":"var-picker",hidden:!0});for(const t of b){const e=v("button",{class:"vc",type:"button",title:t.path,"data-j":"chip"},t.label);e.addEventListener("mousedown",t=>t.preventDefault()),e.addEventListener("click",()=>d(t)),x.appendChild(e)}if(p.length>b.length){const t=v("button",{class:"vc",type:"button","aria-expanded":"false","data-j":"more"},s.more),e=v("input",{dir:"auto","aria-label":s.search,placeholder:s.search,"data-j":"var-search",role:"combobox","aria-expanded":"true"}),i=v("div",{role:"listbox","aria-label":s.insert,"data-j":"var-list"});g.append(e,i);let n=[],o=0;const a=()=>!g.hidden&&(g.hidden=!0,t.setAttribute("aria-expanded","false"),!0),r=t=>{t&&(a(),d(t))},c=()=>{const t=e.value.trim().toLowerCase();n=p.filter(e=>!t||`${e.label} ${e.path} ${e.group}`.toLowerCase().indexOf(t)>=0).slice(0,200),o=Math.min(o,Math.max(n.length-1,0)),i.textContent="",n.length||i.appendChild(v("div",{class:"g"},s.noMatch));let a=null;n.forEach((t,e)=>{t.group!==a&&(a=t.group,a&&i.appendChild(v("div",{class:"g",role:"presentation"},a)));const n=v("div",{class:"o",role:"option",id:`jv${e}`,"aria-selected":String(e===o),"data-j":"var-option"},v("span",{dir:"auto"},t.label),v("code",{dir:"ltr"},t.path));n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",()=>r(t)),i.appendChild(n)}),e.setAttribute("aria-activedescendant",n.length?`jv${o}`:"")};e.addEventListener("input",()=>{o=0,c()}),e.addEventListener("keydown",t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){t.preventDefault(),o=(o+("ArrowDown"===t.key?1:n.length-1))%Math.max(n.length,1),c();const e=i.querySelector('[aria-selected="true"]');e&&e.scrollIntoView&&e.scrollIntoView({block:"nearest"})}else"Enter"===t.key&&(t.preventDefault(),r(n[o]))}),t.addEventListener("mousedown",t=>t.preventDefault()),t.addEventListener("click",()=>{a()||(g.hidden=!1,t.setAttribute("aria-expanded","true"),e.value="",o=0,c(),e.focus())}),this.closeOverlay=()=>l.closePop()||a(),x.appendChild(t)}const k=v("button",{class:"css",type:"button","aria-expanded":String(this.showLiquid),"data-j":"liquid-toggle"},F("code",13),s.liquid,F(this.showLiquid?"up":"down",10));if(k.addEventListener("click",()=>{this.showLiquid=!this.showLiquid,this.renderPanel()}),this.closeOverlay||(this.closeOverlay=()=>l.closePop()),t.append(v("div",{class:"fr"},v("label",{class:"lbl"},s.newText),a(i?this.orig(i).text:null)),l.el,x,g,k),this.showLiquid){const i=v("textarea",{class:"mono",rows:"3",dir:"ltr",spellcheck:"false","aria-label":s.liquid,"data-j":"liquid"});i.value=e.text,i.addEventListener("input",()=>{l.set(i.value),r(i.value)}),n=i,t.appendChild(v("div",{class:"mt"},i))}}else if("link"===e.action||"image"===e.action){const r=v("input",{type:"url",dir:"ltr",inputmode:"url",placeholder:"https://","data-j":"url","aria-label":"link"===e.action?s.newLink:s.newImage});r.value=e.url;const l=v("div",{class:"err"}),c=()=>l.textContent=e.url.trim()&&!n(e.url)?s.urlBad:"";r.addEventListener("input",()=>{e.url=r.value,c(),o()}),c();const d=i?"image"===e.action?this.orig(i).src:this.orig(i).href:null;t.append(v("div",{class:"fr"},v("label",{class:"lbl"},"link"===e.action?s.newLink:s.newImage),a(d)),r,l)}else if("hide"===e.action){const n=s[i?w(i.tagName):w(e.selector,!0)].toLowerCase();t.appendChild(v("div",{class:"note","data-j":"hide-note"},c(s.hideNote,{kind:n})))}else{const i=v("input",{class:"slotin",dir:"auto","data-j":"slot-name","aria-label":s.slotName,maxlength:"80"});i.value=e.slotName;const n=v("span",{class:"key","data-j":"slot-key"}),a=v("div",{class:"help2"}),r=()=>{const t=k(e.slotName);n.textContent=t||"-",a.textContent="",a.append(`${s.savedAs} `,n,t?"":` · ${s.slotEmpty}`)};if(i.addEventListener("input",()=>{e.slotName=i.value,r(),o()}),r(),t.append(v("label",{class:"lbl"},s.slotName),i,a),this.ctx.placements.length){const n=v("div",{class:"chips","data-j":"placements"});for(const t of this.ctx.placements.slice(0,12)){const s=v("button",{class:"vc",type:"button",title:t.name||t.key,"data-j":"placement"},t.key);s.addEventListener("click",()=>{e.slotName=t.key,i.value=t.key,r(),o()}),n.appendChild(s)}t.appendChild(n)}t.appendChild(v("div",{class:"help2"},s.slotHelp));const l=v("div",{class:"seg",role:"radiogroup","aria-label":s.where,"data-j":"positions"});for(const[t,i]of W){const n=v("button",{type:"button",role:"radio","aria-checked":String(e.position===t),"data-j":`pos-${t}`},s[i]);n.addEventListener("click",()=>{e.position=t;for(const t of Array.from(l.children))t.setAttribute("aria-checked",String(t===n));o()}),l.appendChild(n)}t.append(v("div",{class:"mt"},v("span",{class:"lbl"},s.where),l));const c=this.ctx.openSlot&&e.editingId?this.edits.filter(t=>t.id===e.editingId)[0]:void 0,d=c&&c.placementKey;if(d){const e=(this.ctx.placements.filter(t=>t.key===d)[0]||{campaigns:[]}).campaigns,i=v("div",{class:"mt slotc","data-j":"slot-content"}),n=(t,e,i)=>{const n=v("button",{class:"lnk",type:"button","data-j":e},t);return n.addEventListener("click",()=>this.openSlot(d,i)),n};if(e.length){i.appendChild(v("span",{class:"lbl"},s.slotIn));for(const t of e)i.appendChild(n(t.statusLabel||t.status?`${t.name} (${t.statusLabel||t.status})`:t.name,"slot-campaign",t.id));i.appendChild(n(s.slotAddAnother,"slot-add"))}else i.appendChild(n(s.slotCreate,"slot-create"));t.appendChild(i)}}}}const it={version:1,start({dashboardOrigin:t,opener:e,logger:i,onStop:n}){const o=new et(t,e,i,n);return o.start(),{stop:()=>o.stop()}}};"undefined"==typeof window||window[r]||(window[r]=it)}();
|
|
7
7
|
//# sourceMappingURL=joryio-editor.min.js.map
|