@preprio/toolkit 0.5.0-rc.5 → 0.5.1-dom.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +218 -226
- package/dist/astro/index.cjs +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/auto.cjs +4572 -0
- package/dist/auto.d.cts +42 -0
- package/dist/auto.d.ts +42 -0
- package/dist/auto.js +105 -0
- package/dist/browser/auto.js +117 -0
- package/dist/chunk-5I5TQ3NO.js +74 -0
- package/dist/chunk-AZC4BZJI.js +447 -0
- package/dist/{chunk-TG6N3C22.js → chunk-IKOOXTPM.js} +1 -1
- package/dist/{chunk-3X55JL52.js → chunk-IOSO232M.js} +4 -2
- package/dist/{chunk-SBLZANL5.js → chunk-RRM5762S.js} +2 -71
- package/dist/chunk-SZTHSJUA.js +326 -0
- package/dist/{chunk-CMUFTCG3.js → chunk-TEB7M7EM.js} +0 -4
- package/dist/chunk-UK664KSV.js +6 -0
- package/dist/{chunk-74KY5EAM.js → chunk-ZFGVP2GW.js} +28 -447
- package/dist/html-live-DzmEG9wU.d.cts +42 -0
- package/dist/html-live-DzmEG9wU.d.ts +42 -0
- package/dist/index.cjs +177 -2
- package/dist/index.d.cts +31 -28
- package/dist/index.d.ts +31 -28
- package/dist/index.js +21 -154
- package/dist/{live-preview-H4643QYF.js → live-preview-IYAS7PYV.js} +3 -2
- package/dist/nextjs/components.cjs +1 -1
- package/dist/nextjs/components.d.cts +2 -1
- package/dist/nextjs/components.d.ts +2 -1
- package/dist/nextjs/components.js +6 -3
- package/dist/nextjs/index.cjs +1 -1
- package/dist/nextjs/index.d.cts +0 -2
- package/dist/nextjs/index.d.ts +0 -2
- package/dist/nextjs/index.js +1 -1
- package/dist/nextjs/live-action.js +5 -3
- package/dist/nextjs/live.cjs +1 -4
- package/dist/nextjs/live.d.cts +1 -3
- package/dist/nextjs/live.d.ts +1 -3
- package/dist/nextjs/live.js +2 -5
- package/dist/nuxt/index.cjs +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/pixel-DwW7cXJm.d.cts +49 -0
- package/dist/pixel-DwW7cXJm.d.ts +49 -0
- package/dist/react/components.cjs +1 -1
- package/dist/react/components.js +1 -1
- package/dist/sveltekit/index.cjs +1 -1
- package/dist/sveltekit/index.js +1 -1
- package/dist/{pixel-CX422dCO.d.cts → types-DtMa_-f2.d.cts} +1 -49
- package/dist/{pixel-CX422dCO.d.ts → types-DtMa_-f2.d.ts} +1 -49
- package/package.json +12 -7
- package/dist/sveltekit/live-preview-O2ZTJNW4.js +0 -1520
- package/dist/sveltekit/live.cjs +0 -1731
- package/dist/sveltekit/live.d.cts +0 -59
- package/dist/sveltekit/live.d.ts +0 -59
- package/dist/sveltekit/live.js +0 -97
package/dist/auto.d.cts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { H as HtmlLivePreviewOptions } from './html-live-DzmEG9wU.cjs';
|
|
2
|
+
import { P as PreprToolbarProps, a as PreprPreviewOptions } from './types-DtMa_-f2.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What the server renders into `<script type="application/json"
|
|
6
|
+
* data-prepr-toolbar-props>`. The same shape the Astro `PreprToolbar` emits,
|
|
7
|
+
* plus `live`.
|
|
8
|
+
*/
|
|
9
|
+
interface PreprAutoPayload {
|
|
10
|
+
props?: PreprToolbarProps;
|
|
11
|
+
options?: PreprPreviewOptions;
|
|
12
|
+
/**
|
|
13
|
+
* How live preview applies the editor's unsaved changes; see
|
|
14
|
+
* `startHtmlLivePreview`'s `apply`. Defaults to `'dom'`, which needs no
|
|
15
|
+
* server support. `false` turns live preview off.
|
|
16
|
+
*/
|
|
17
|
+
live?: HtmlLivePreviewOptions['apply'] | false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Start the Prepr preview from server-rendered props: toolbar, click-to-edit
|
|
21
|
+
* and live preview, from one call. Reads the JSON the server put in a
|
|
22
|
+
* `<script type="application/json" data-prepr-toolbar-props>` tag and does
|
|
23
|
+
* nothing when the page has none, so it is safe to load everywhere and gate
|
|
24
|
+
* on the server.
|
|
25
|
+
*
|
|
26
|
+
* Survives client-side page swaps (Livewire `wire:navigate`, Turbo, htmx
|
|
27
|
+
* boosting): when `<body>` is replaced, or the toolbar is removed from it,
|
|
28
|
+
* the preview starts again on the new page. Inside the Prepr editor the page
|
|
29
|
+
* is reloaded instead, because the editor connects to the preview only when
|
|
30
|
+
* the frame loads.
|
|
31
|
+
*
|
|
32
|
+
* Returns a function that stops everything.
|
|
33
|
+
*/
|
|
34
|
+
declare function startPreprAuto(): () => void;
|
|
35
|
+
|
|
36
|
+
declare global {
|
|
37
|
+
interface Window {
|
|
38
|
+
__preprAutoStarted?: boolean;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { type PreprAutoPayload, startPreprAuto };
|
package/dist/auto.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { H as HtmlLivePreviewOptions } from './html-live-DzmEG9wU.js';
|
|
2
|
+
import { P as PreprToolbarProps, a as PreprPreviewOptions } from './types-DtMa_-f2.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What the server renders into `<script type="application/json"
|
|
6
|
+
* data-prepr-toolbar-props>`. The same shape the Astro `PreprToolbar` emits,
|
|
7
|
+
* plus `live`.
|
|
8
|
+
*/
|
|
9
|
+
interface PreprAutoPayload {
|
|
10
|
+
props?: PreprToolbarProps;
|
|
11
|
+
options?: PreprPreviewOptions;
|
|
12
|
+
/**
|
|
13
|
+
* How live preview applies the editor's unsaved changes; see
|
|
14
|
+
* `startHtmlLivePreview`'s `apply`. Defaults to `'dom'`, which needs no
|
|
15
|
+
* server support. `false` turns live preview off.
|
|
16
|
+
*/
|
|
17
|
+
live?: HtmlLivePreviewOptions['apply'] | false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Start the Prepr preview from server-rendered props: toolbar, click-to-edit
|
|
21
|
+
* and live preview, from one call. Reads the JSON the server put in a
|
|
22
|
+
* `<script type="application/json" data-prepr-toolbar-props>` tag and does
|
|
23
|
+
* nothing when the page has none, so it is safe to load everywhere and gate
|
|
24
|
+
* on the server.
|
|
25
|
+
*
|
|
26
|
+
* Survives client-side page swaps (Livewire `wire:navigate`, Turbo, htmx
|
|
27
|
+
* boosting): when `<body>` is replaced, or the toolbar is removed from it,
|
|
28
|
+
* the preview starts again on the new page. Inside the Prepr editor the page
|
|
29
|
+
* is reloaded instead, because the editor connects to the preview only when
|
|
30
|
+
* the frame loads.
|
|
31
|
+
*
|
|
32
|
+
* Returns a function that stops everything.
|
|
33
|
+
*/
|
|
34
|
+
declare function startPreprAuto(): () => void;
|
|
35
|
+
|
|
36
|
+
declare global {
|
|
37
|
+
interface Window {
|
|
38
|
+
__preprAutoStarted?: boolean;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { type PreprAutoPayload, startPreprAuto };
|
package/dist/auto.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
startHtmlLivePreview
|
|
3
|
+
} from "./chunk-SZTHSJUA.js";
|
|
4
|
+
import {
|
|
5
|
+
createPreprPreview
|
|
6
|
+
} from "./chunk-RRM5762S.js";
|
|
7
|
+
import "./chunk-TEB7M7EM.js";
|
|
8
|
+
import "./chunk-IKOOXTPM.js";
|
|
9
|
+
import "./chunk-URXSDJOU.js";
|
|
10
|
+
import "./chunk-AZC4BZJI.js";
|
|
11
|
+
import {
|
|
12
|
+
createScopedLogger
|
|
13
|
+
} from "./chunk-S3VT4UWM.js";
|
|
14
|
+
|
|
15
|
+
// src/core/auto-start.ts
|
|
16
|
+
var debug = createScopedLogger("auto");
|
|
17
|
+
var PAYLOAD_SELECTOR = "script[data-prepr-toolbar-props]";
|
|
18
|
+
function readPayload() {
|
|
19
|
+
const element = document.querySelector(PAYLOAD_SELECTOR);
|
|
20
|
+
if (!element?.textContent) return null;
|
|
21
|
+
try {
|
|
22
|
+
const payload = JSON.parse(element.textContent);
|
|
23
|
+
return payload && typeof payload === "object" ? payload : null;
|
|
24
|
+
} catch {
|
|
25
|
+
debug.warn("could not read the toolbar props");
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function startPreprAuto() {
|
|
30
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
31
|
+
return () => {
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const first = readPayload();
|
|
35
|
+
if (!first) return () => {
|
|
36
|
+
};
|
|
37
|
+
const inEditor = window.self !== window.top;
|
|
38
|
+
let payload = first;
|
|
39
|
+
let preview = null;
|
|
40
|
+
let live = null;
|
|
41
|
+
let body = document.body;
|
|
42
|
+
const start = () => {
|
|
43
|
+
preview = createPreprPreview({
|
|
44
|
+
props: payload.props,
|
|
45
|
+
options: payload.options
|
|
46
|
+
});
|
|
47
|
+
body = document.body;
|
|
48
|
+
watchBody();
|
|
49
|
+
};
|
|
50
|
+
if (payload.live !== false) {
|
|
51
|
+
live = startHtmlLivePreview({
|
|
52
|
+
allowedEditorOrigins: payload.options?.allowedEditorOrigins,
|
|
53
|
+
strictMode: payload.options?.strictMode,
|
|
54
|
+
apply: payload.live ?? "dom"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const restart = () => {
|
|
58
|
+
if (inEditor) {
|
|
59
|
+
window.location.reload();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
debug.log("page swapped; starting the preview again");
|
|
63
|
+
preview?.destroy();
|
|
64
|
+
payload = readPayload() ?? payload;
|
|
65
|
+
start();
|
|
66
|
+
};
|
|
67
|
+
const htmlObserver = new MutationObserver(() => {
|
|
68
|
+
if (document.body && document.body !== body) restart();
|
|
69
|
+
});
|
|
70
|
+
htmlObserver.observe(document.documentElement, { childList: true });
|
|
71
|
+
let bodyObserver = null;
|
|
72
|
+
function watchBody() {
|
|
73
|
+
bodyObserver?.disconnect();
|
|
74
|
+
const toolbar = body.querySelector(":scope > prepr-toolbar");
|
|
75
|
+
if (!toolbar) return;
|
|
76
|
+
bodyObserver = new MutationObserver(() => {
|
|
77
|
+
if (!toolbar.isConnected) restart();
|
|
78
|
+
});
|
|
79
|
+
bodyObserver.observe(body, { childList: true });
|
|
80
|
+
}
|
|
81
|
+
start();
|
|
82
|
+
return () => {
|
|
83
|
+
htmlObserver.disconnect();
|
|
84
|
+
bodyObserver?.disconnect();
|
|
85
|
+
preview?.destroy();
|
|
86
|
+
live?.stop();
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/auto.ts
|
|
91
|
+
function boot() {
|
|
92
|
+
if (window.__preprAutoStarted) return;
|
|
93
|
+
window.__preprAutoStarted = true;
|
|
94
|
+
startPreprAuto();
|
|
95
|
+
}
|
|
96
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
97
|
+
if (document.readyState === "loading") {
|
|
98
|
+
document.addEventListener("DOMContentLoaded", boot, { once: true });
|
|
99
|
+
} else {
|
|
100
|
+
boot();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
startPreprAuto
|
|
105
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var Le="Prepr-Preview-Mode",le="Prepr-Toolbar-Open",de="Prepr-Segments",ce="Prepr-ABtesting";var Ae="prepr_preview_segment",Ce="prepr_preview_ab",rt="prepr_hide_bar";var Jt="x-prepr-live";function pe(e){if(typeof document>"u")return null;let t=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`));if(!t)return null;let n=t.slice(e.length+1);return decodeURIComponent(n)}function te(e,t,n={}){if(typeof document>"u")return;let{maxAge:r,path:i="/",sameSite:o,secure:s}=n,a=`${e}=${encodeURIComponent(t)};path=${i}`;typeof r=="number"&&(a+=`;max-age=${r}`),o&&(a+=`;samesite=${o}`),s&&(a+=";secure"),document.cookie=a}function ot(e,t="/",n={}){if(typeof document>"u")return;let{sameSite:r,secure:i}=n,o=`${e}=;path=${t};expires=Thu, 01 Jan 1970 00:00:00 GMT`;r&&(o+=`;samesite=${r}`),i&&(o+=";secure"),document.cookie=o}function ke(){return typeof window>"u"||!window.isSecureContext?{}:{sameSite:"None",secure:!0}}function it(e){return typeof e=="boolean"?e:e?.enabled??!0}function Qt(e){return{segments:it(e?.segments),abTesting:it(e?.abTesting),editMode:it(e?.editMode)}}var en=Object.freeze({segments:!0,abTesting:!0,editMode:!0});var tn={common:{viewingAs:"Ansicht als:",user:"Benutzer",off:"Aus",on:"An",reset:"Zur\xFCcksetzen",toolbar:"Symbolleiste"},adaptiveContent:{adaptiveContent:"Adaptive Inhalte",enablePreview:"Vorschaumodus",segment:"Segment",ABVariant:"A/B-Variante",chooseSegment:"Segment w\xE4hlen",searchSegments:"Segmente suchen",none:"Keine Segmente",allOtherUsers:"Alle anderen Benutzer",offDescription:"Die Website als echter Benutzer ansehen (Cookies verwenden)",onDescription:"Mit der Symbolleiste Segmente und A/B-Varianten simulieren"},editingTools:{editingTools:"Bearbeitungswerkzeuge",editMode:"Bearbeitungsmodus",ariaCloseEditMode:"Bearbeitungsmodus schlie\xDFen"},visualEditor:{edit:"Bearbeiten",otherItem:"anderes Element",linkedItem:"verkn\xFCpftes Element"}};var nn={common:{viewingAs:"Viewing as:",user:"User",off:"Off",on:"On",reset:"Reset",toolbar:"Toolbar"},adaptiveContent:{adaptiveContent:"Adaptive content",enablePreview:"Preview mode",segment:"Segment",ABVariant:"A/B variant",chooseSegment:"Choose segment",searchSegments:"Search segments",none:"No segments",allOtherUsers:"All other users",offDescription:"View the site as a real user (use cookies)",onDescription:"Use the toolbar to simulate segments and A/B variants"},editingTools:{editingTools:"Editing tools",editMode:"Edit mode",ariaCloseEditMode:"Close edit mode"},visualEditor:{edit:"Edit",otherItem:"other item",linkedItem:"linked item"}};var rn={common:{viewingAs:"Affichage en tant que :",user:"Utilisateur",off:"D\xE9sactiv\xE9",on:"Activ\xE9",reset:"R\xE9initialiser",toolbar:"Barre d'outils"},adaptiveContent:{adaptiveContent:"Contenu adaptatif",enablePreview:"Mode aper\xE7u",segment:"Segment",ABVariant:"Variante A/B",chooseSegment:"Choisir un segment",searchSegments:"Rechercher des segments",none:"Aucun segment",allOtherUsers:"Tous les autres utilisateurs",offDescription:"Voir le site comme un vrai utilisateur (utiliser les cookies)",onDescription:"Utilisez la barre d'outils pour simuler des segments et des variantes A/B"},editingTools:{editingTools:"Outils d'\xE9dition",editMode:"Mode \xE9dition",ariaCloseEditMode:"Fermer le mode \xE9dition"},visualEditor:{edit:"Modifier",otherItem:"autre \xE9l\xE9ment",linkedItem:"\xE9l\xE9ment li\xE9"}};var on={common:{viewingAs:"Bekijken als:",user:"Gebruiker",off:"Uit",on:"Aan",reset:"Resetten",toolbar:"Toolbar"},adaptiveContent:{adaptiveContent:"Adaptieve inhoud",enablePreview:"Preview modus",segment:"Segment",ABVariant:"A/B-variant",chooseSegment:"Kies segment",searchSegments:"Zoek segmenten",none:"Geen segmenten",allOtherUsers:"Alle andere gebruikers",offDescription:"Bekijk de site als een echte gebruiker (gebruik cookies)",onDescription:"Gebruik de werkbalk om segmenten en A/B-varianten te simuleren"},editingTools:{editingTools:"Editing Tools",editMode:"Edit mode",ariaCloseEditMode:"Edit mode sluiten"},visualEditor:{edit:"Bewerken",otherItem:"ander item",linkedItem:"gekoppeld item"}};var Pe={en:nn,nl:on,fr:rn,de:tn},_s=Object.keys(Pe);function ne(e){return typeof e=="string"&&e in Pe}function Jr(e){return ne(e)?Pe[e]:Pe.en}function Qr(e,t){return t.split(".").reduce((n,r)=>n&&typeof n=="object"?n[r]:void 0,e)}function eo(e,t){return t?Object.keys(t).reduce((n,r)=>n.replace(new RegExp(`\\{${r}\\}`,"g"),String(t[r])),e):e}function X(e,t,n){let r=Jr(t),i=Qr(r,e);return typeof i=="string"?eo(i,n):e}var Oe=null;function st(e){Oe=e}function sn(){return Oe}function R(e,t,n){if(typeof window<"u"){let r={name:"prepr_preview_bar",event:e,...t};window.dispatchEvent(new CustomEvent("prepr_preview_bar",{detail:r})),window.parent&&window.parent!==window&&(Oe?window.parent.postMessage(r,Oe):n?.allowUntrustedTarget&&window.parent.postMessage(r,"*"))}}var Me=class{constructor(t){this.options={prefix:"[Prepr]",...t}}isEnabled(){return this.options.enabled!==void 0?this.options.enabled:an?.options?.enabled??!1}log(t,...n){if(!this.isEnabled())return;let r=this.options.prefix;console.log(`${r} ${t}`,...n)}warn(t,...n){if(!this.isEnabled())return;let r=this.options.prefix;console.warn(`${r} ${t}`,...n)}error(t,...n){if(!this.isEnabled())return;let r=this.options.prefix;console.error(`${r} ${t}`,...n)}},an=null;function ln(e=!1){an=new Me({enabled:e})}function L(e){return new Me({prefix:`[Prepr][${e}]`})}var re=L("iframe-bridge"),fn=500,to=8192,no=500,ro=2048,dn=512;function cn(e){if(Array.isArray(e))return e.slice(0,fn).filter(t=>typeof t=="string"&&t.length>0)}function pn(e){if(!Array.isArray(e))return;let t=[];for(let n of e.slice(0,fn)){let r=n?.id,i=n?.field;typeof r=="string"&&r&&typeof i=="string"&&i&&t.push({id:r,field:i})}return t}function at(e,t){return typeof e=="string"&&e&&e.length<=t?e:void 0}function un(e){if(!Array.isArray(e))return;let t=[];for(let n of e.slice(0,no)){if(!n||typeof n!="object")continue;let r=n,i=at(r.key,ro),o=at(r.field,dn);if(!i||!o)continue;let s=at(r.entryId,dn);t.push(s?{key:i,field:o,entryId:s}:{key:i,field:o})}return t}var oo="prepr.io";function lt(e,t){if(t)return t.includes("*")?e!=="null":t.includes(e);let n;try{n=new URL(e)}catch{return!1}if(n.protocol!=="https:"||n.port!=="")return!1;let r=`.${oo}`;if(!n.hostname.endsWith(r))return!1;let i=n.hostname.slice(0,-r.length);return i.length>0&&!i.includes(".")}function gn(e,t={}){let n=t.allowedEditorOrigins,r=t.onScrollToField,i=t.onHandshake,o=t.onReferences,s=t.onAssets,a=t.onAllowNavigation,d=null,c=g=>{let l=g.key.toLowerCase();(g.ctrlKey||g.metaKey)&&["s","p","l"].includes(l)&&g.preventDefault()},u=g=>{let l=g?.data;if(l?.event==="prepr:initVE"&&!d){if(!lt(g.origin,n)){re.warn("ignored editor handshake from origin",g.origin);return}if(d=g.origin,st(d),l.scrollPosition!=null){let w=l.scrollPosition;setTimeout(()=>window.scrollTo(0,w),1)}e?.set({previewMode:!0,editMode:l.editMode??!0});let p=typeof l.itemId=="string"&&l.itemId?l.itemId:void 0,f=pn(l.referencedIds),m=cn(l.componentIds),v=ne(l.uiLocale)?l.uiLocale:void 0,b=l.navigationGuard===!0,_=un(l.assets);try{i?.({...p&&{itemId:p},...f&&{referencedIds:f},...m&&{componentIds:m},...v&&{uiLocale:v},...b&&{navigationGuard:b},..._&&{assets:_}})}catch(w){re.warn("handshake handler failed",w)}}if(!(!d||g.origin!==d)){if(l?.event==="prepr:references"){let p=un(l.assets);if(p)try{s?.(p)}catch(m){re.warn("assets handler failed",m)}let f=pn(l.referencedIds);if(!f)return;try{o?.(f,cn(l.componentIds))}catch(m){re.warn("references handler failed",m)}}if(l?.event==="prepr:getScrollPosition"){let p=window.scrollY||document.documentElement.scrollTop;R("getScrollPosition",{value:p})}if(l?.event==="prepr:scrollToField"){if(typeof l.field!="string"||!l.field||l.id!==void 0&&typeof l.id!="string")return;let p=typeof l.block=="number"&&Number.isInteger(l.block)?l.block:void 0,f=typeof l.entryId=="string"&&l.entryId?l.entryId:void 0,m=typeof l.fieldById=="string"&&l.fieldById?l.fieldById:void 0;try{r?.({field:l.field,id:l.id,block:p,entryId:f,fieldById:m})}catch(v){re.warn("scrollToField handler failed",v)}}if(l?.event==="prepr:allowNavigation"){let p=l.href;if(typeof p!="string"||!p||p.length>to)return;try{a?.(p)}catch(f){re.warn("allowNavigation handler failed",f)}}}};return{start(){let g=e?.get().features;R("loaded",g?{features:g}:void 0,{allowUntrustedTarget:!0}),window.addEventListener("keydown",c),window.addEventListener("message",u)},stop(){window.removeEventListener("keydown",c),window.removeEventListener("message",u),d=null,st(null)}}}var vn={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},ue={0:8203,1:8204,2:8205,3:65279},io={0:String.fromCodePoint(ue[0]),1:String.fromCodePoint(ue[1]),2:String.fromCodePoint(ue[2]),3:String.fromCodePoint(ue[3])},Re=new Array(4).fill(String.fromCodePoint(ue[0])).join(""),mn="\0";var Ie=Object.fromEntries(Object.entries(io).map(e=>[e[1],+e[0]])),hn=Object.fromEntries(Object.entries(vn).map(e=>e.reverse())),so=`${Object.values(vn).map(e=>`\\u{${e.toString(16)}}`).join("")}`,dt=new RegExp(`[${so}]{4,}`,"gu");function ct(e){let t=e.match(dt);if(t)return ao(t[0],!0)[0]}function ao(e,t=!1){let n=Array.from(e),r=1/0,i=-1;for(let o=0;o<n.length;++o)n[o]===Re[0]&&n[o+1]===Re[1]&&n[o+2]===Re[2]&&n[o+3]===Re[3]&&(r=Math.min(r,o),i=Math.max(i,o));if(i===-1)return lo(n,t);for(let o=r;o<=i;++o)if(!((n.length-o)%4))try{let s=n.slice(o+4),a=new Uint8Array(s.length/4);for(let c=0;c<a.length;c++)a[c]=Ie[s[c*4]]<<6|Ie[s[c*4+1]]<<4|Ie[s[c*4+2]]<<2|Ie[s[c*4+3]];let d=new TextDecoder().decode(a);if(t){let c=d.indexOf(mn);return c===-1&&(c=d.length),[JSON.parse(d.slice(0,c))]}return d.split(mn).filter(Boolean).map(c=>JSON.parse(c))}catch{}return[]}function lo(e,t){var n;let r=[];for(let a=e.length*.5;a--;){let d=`${hn[e[a*2].codePointAt(0)]}${hn[e[a*2+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(d,16)))}let i=[],o=[r.join("")],s=10;for(;o.length;){let a=o.shift();try{if(i.push(JSON.parse(a)),t)return i}catch(d){if(!s--)throw d;let c=+((n=d.message.match(/\sposition\s(\d+)$/))==null?void 0:n[1]);if(!c)throw d;o.unshift(a.substring(0,c),a.substring(c))}}return i}function Z(e){var t;return{cleaned:e.replace(dt,""),encoded:((t=e.match(dt))==null?void 0:t[0])||""}}var bn=L("stega:clean");function Ne(e){if(!e)return null;try{let t=ct(e);if(t?.href)return t}catch(t){bn.log("error decoding stega data",t);let n=e.match(/{"origin.*?}/);if(n)try{let r=ct(n[0]);if(r?.href)return r}catch(r){bn.log("error decoding stega regex match",r)}}return null}var co="script, style, noscript";function fe(e){return e.parentElement?.closest(co)?!0:!e.textContent?.trim()}function ge(e,t){let n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:i=>fe(i)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),r;for(;r=n.nextNode();)t(r)}function me(e){let t=e.parentElement;if(!t)return null;let n=t.closest("[data-prepr-edit-target]");return n||(po(t)?t:null)}function po(e){if(e.hidden||e.getClientRects().length===0)return!1;let t=e.ownerDocument.defaultView?.getComputedStyle(e);return t?t.visibility!=="hidden"&&t.display!=="none":!0}function uo(e){try{let t=new URL(e,window.location.origin);return{id:t.pathname.split("/").pop()||void 0,field:t.searchParams.get("field")||void 0,locale:t.searchParams.get("locale")||void 0}}catch{return{}}}function pt(e,t,n){n?e.setAttribute(t,n):e.removeAttribute(t)}function he(e,t){e.setAttribute("data-prepr-encoded",""),e.setAttribute("data-prepr-href",t.href),e.setAttribute("data-prepr-origin",t.origin);let{id:n,field:r,locale:i}=uo(t.href);pt(e,"data-prepr-id",n);let o=e.getAttribute("data-prepr-edit-target")?.trim()||void 0;pt(e,"data-prepr-field",r??o),pt(e,"data-prepr-locale",i)}function ve(e){return{href:e.getAttribute("data-prepr-href")??"",origin:e.getAttribute("data-prepr-origin")??"",id:e.getAttribute("data-prepr-id")??void 0,field:e.getAttribute("data-prepr-field")??void 0,locale:e.getAttribute("data-prepr-locale")??void 0,entryId:e.getAttribute("data-prepr-entry-id")||void 0}}var ut=L("stega:auto-clean"),ft=new WeakMap;function yn(e){let t=e?.enabled??!0,n=null,r=!1,i=new Set,o=new Set,s=null;function a(b){if(fe(b))return!1;let _=b.textContent,w=ft.get(b),S=t?w?.cleaned:w?.original;if(w&&_===S){if(!w.decoded)return!1;let x=me(b);return x?(i.delete(b),x.hasAttribute("data-prepr-encoded")?!1:(he(x,w.decoded),!0)):(i.add(b),!1)}try{let{cleaned:x,encoded:P}=Z(_);if(!P||x===_)return!1;let O=Ne(_);if(!O?.href&&!t||(ft.set(b,{original:_,cleaned:x,decoded:O?.href?O:null}),t&&(b.textContent=x),!O?.href))return!1;let N=me(b);if(N)return i.delete(b),he(N,O),!0;i.add(b)}catch(x){ut.log("error cleaning text node",x)}return!1}function d(){if(r=!0,ge(document.body,a),t){let b=Z(document.title);b.encoded&&(document.title=b.cleaned)}r=!1}function c(b){let _=new Set;return b.forEach(w=>{if(w.type==="childList"&&w.addedNodes.forEach(S=>{S.nodeType===Node.TEXT_NODE?_.add(S):S.nodeType===Node.ELEMENT_NODE&&ge(S,x=>_.add(x))}),w.type==="characterData"&&w.target.nodeType===Node.TEXT_NODE){let S=w.target,x=ft.get(S),P=S.textContent??"",O=t?x?.cleaned:x?.original;P!==O&&Z(P).encoded&&_.add(S)}}),_}function u(){i.size!==0&&(r=!0,[...i].forEach(b=>{if(!b.isConnected){i.delete(b);return}a(b)}),r=!1)}function g(b){if(r)return;let _=c(b);if(_.size===0){u();return}_.forEach(w=>o.add(w)),s&&clearTimeout(s),s=setTimeout(()=>{s=null,r=!0;let w=[...o];o.clear(),w.forEach(S=>{S.isConnected&&a(S)}),r=!1,u()},50)}let l=null;function p(){i.size===0||l||(l=setTimeout(()=>{l=null,u()},100))}function f(){window.addEventListener("resize",p,{passive:!0}),n=new MutationObserver(g),n.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded"]})}function m(){n||typeof window>"u"||(d(),f(),ut.log("stega auto-clean started"))}function v(){s&&(clearTimeout(s),s=null),l&&(clearTimeout(l),l=null),n&&(n.disconnect(),n=null,window.removeEventListener("resize",p)),i=new Set,o=new Set,ut.log("stega auto-clean stopped")}return{start:m,stop:v}}var fo="prepr-visual-editor";var go=[[.5,.5],[.15,.2],[.85,.2],[.15,.8],[.85,.8]];function mo(e,t){return e.left<t.right+3&&e.right>t.left-3&&e.top<t.bottom+3&&e.bottom>t.top-3}function _n(e,t){return e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom}function ho(e,t,n,r){let i=e.getBoundingClientRect();for(let o=e.parentElement;o&&!o.contains(t)&&o!==document.body;o=o.parentElement){let s=o.getBoundingClientRect();if(n<s.left||n>=s.right||r<s.top||r>=s.bottom)break;i=s}return i}function vo(e){let t=e.slice();for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++)_n(t[n],t[r])&&(t[n]={left:Math.min(t[n].left,t[r].left),top:Math.min(t[n].top,t[r].top),right:Math.max(t[n].right,t[r].right),bottom:Math.max(t[n].bottom,t[r].bottom)},t.splice(r,1),r=n);return t}function bo(e,t){let n=window.innerWidth,r=window.innerHeight,i=[],o=new Set,s=!1,a=!1;for(let[d,c]of go){let u=t.left+t.width*d,g=t.top+t.height*c;if(u<0||g<0||u>=n||g>=r)continue;s=!0;let l=document.elementFromPoint(u,g);if(!l||l===e||e.contains(l)){a=!0;continue}o.has(l)||(o.add(l),!i.some(p=>u>=p.left&&u<p.right&&g>=p.top&&g<p.bottom)&&i.push(ho(l,e,u,g)))}return s?a?vo(i):null:[]}function yo(e,t,n){let i=["-100000px -100000px","100000px -100000px","100000px 100000px","-100000px 100000px","-100000px -100000px"];for(let o of n){let s=o.left-e,a=o.top-t,d=o.right-e,c=o.bottom-t;i.push(`${s}px ${a}px`,`${d}px ${a}px`,`${d}px ${c}px`,`${s}px ${c}px`,`${s}px ${a}px`,"-100000px -100000px")}return`polygon(evenodd, ${i.join(", ")})`}var _o=`
|
|
2
|
+
:host {
|
|
3
|
+
all: initial;
|
|
4
|
+
position: fixed;
|
|
5
|
+
inset: 0;
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
z-index: 2147483646;
|
|
8
|
+
contain: strict;
|
|
9
|
+
}
|
|
10
|
+
.box {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
border-radius: 6px;
|
|
16
|
+
opacity: 0;
|
|
17
|
+
will-change: transform, width, height;
|
|
18
|
+
transition:
|
|
19
|
+
transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
|
|
20
|
+
width 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
|
|
21
|
+
height 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
|
|
22
|
+
opacity 140ms ease;
|
|
23
|
+
}
|
|
24
|
+
.box[data-visible] { opacity: 1; }
|
|
25
|
+
.box[data-instant], :host([data-scrolling]) .box {
|
|
26
|
+
transition: opacity 140ms ease;
|
|
27
|
+
}
|
|
28
|
+
.hover {
|
|
29
|
+
border: 1.5px solid rgba(79, 70, 229, 0.9);
|
|
30
|
+
background: rgba(79, 70, 229, 0.06);
|
|
31
|
+
}
|
|
32
|
+
.selected {
|
|
33
|
+
border: 2px solid #4f46e5;
|
|
34
|
+
box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
|
|
35
|
+
}
|
|
36
|
+
.label {
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: -2px;
|
|
39
|
+
bottom: 100%;
|
|
40
|
+
margin-bottom: 4px;
|
|
41
|
+
padding: 3px 7px;
|
|
42
|
+
border-radius: 5px;
|
|
43
|
+
background: #4f46e5;
|
|
44
|
+
color: #fff;
|
|
45
|
+
font: 500 11px/1.3 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
46
|
+
letter-spacing: 0.01em;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
display: flex;
|
|
49
|
+
max-width: 240px;
|
|
50
|
+
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
|
|
51
|
+
}
|
|
52
|
+
.text {
|
|
53
|
+
min-width: 0;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
text-overflow: ellipsis;
|
|
56
|
+
}
|
|
57
|
+
.hover .label { background: rgba(79, 70, 229, 0.92); }
|
|
58
|
+
/* Content of another item than the one open in the editor: still clickable,
|
|
59
|
+
but visibly not part of the item being edited. */
|
|
60
|
+
.hover[data-item-kind='other'] {
|
|
61
|
+
border: 1.5px dashed #a5b4fc;
|
|
62
|
+
background: rgba(100, 116, 139, 0.05);
|
|
63
|
+
}
|
|
64
|
+
.hover[data-item-kind='other'] .label { background: #64748b; }
|
|
65
|
+
.hover[data-item-kind='referenced'] {
|
|
66
|
+
border: 1.5px solid #a5b4fc;
|
|
67
|
+
background: rgba(79, 70, 229, 0.03);
|
|
68
|
+
}
|
|
69
|
+
.hover[data-item-kind='referenced'] .label { background: #818cf8; }
|
|
70
|
+
.box[data-label-covered] .label { visibility: hidden; }
|
|
71
|
+
.box[data-label-inside] .label {
|
|
72
|
+
bottom: auto;
|
|
73
|
+
top: 2px;
|
|
74
|
+
left: 2px;
|
|
75
|
+
margin: 0;
|
|
76
|
+
}
|
|
77
|
+
/* A clickable hover label (edit mode on the live site). Only while shown, so
|
|
78
|
+
a fading box never leaves an invisible click target behind. */
|
|
79
|
+
:host([data-label-action]) .hover[data-visible] .label {
|
|
80
|
+
pointer-events: auto;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
:host([data-label-action]) .hover .label::after {
|
|
84
|
+
content: '\\2197';
|
|
85
|
+
margin-left: 5px;
|
|
86
|
+
}
|
|
87
|
+
:host([data-label-action]) .hover .label:hover { background: #4338ca; }
|
|
88
|
+
/* Bridges the gap between the label and its element, so the pointer can
|
|
89
|
+
travel from one to the other without the hover ending on the way. */
|
|
90
|
+
:host([data-label-action]) .hover .label::before {
|
|
91
|
+
content: '';
|
|
92
|
+
position: absolute;
|
|
93
|
+
left: 0;
|
|
94
|
+
right: 0;
|
|
95
|
+
top: 100%;
|
|
96
|
+
height: 9px;
|
|
97
|
+
}
|
|
98
|
+
@media (prefers-reduced-motion: reduce) {
|
|
99
|
+
.box { transition: opacity 80ms linear; }
|
|
100
|
+
}
|
|
101
|
+
`,oe=class{constructor(t={}){this.host=null;this.hoverBox=null;this.selectedBox=null;this.frame=null;this.scrollTimeout=null;this.resizeObserver=null;this.onLabelClick=t.onLabelClick}mount(){if(this.host)return;let t=document.createElement(fo),n=t.attachShadow({mode:"open"}),r=document.createElement("style");r.textContent=_o,n.appendChild(r),this.hoverBox=this.createBox(n,"hover"),this.selectedBox=this.createBox(n,"selected");let i=this.onLabelClick;if(i){t.setAttribute("data-label-action","");let o=this.hoverBox;o.label.addEventListener("click",()=>{o.target&&i(o.target)})}document.documentElement.appendChild(t),this.host=t,typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.schedule()))}unmount(){this.frame!==null&&cancelAnimationFrame(this.frame),this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.frame=null,this.scrollTimeout=null,this.resizeObserver?.disconnect(),this.resizeObserver=null,this.host?.remove(),this.host=null,this.hoverBox=null,this.selectedBox=null}owns(t){return t!==null&&t===this.host}getHoverTarget(){return this.hoverBox?.target??null}getSelectedTarget(){return this.selectedBox?.target??null}setHover(t,n,r={}){t&&this.hoverBox?.root.setAttribute("data-item-kind",r.kind??"current"),this.retarget(this.hoverBox,t,n)}setSelected(t,n){this.retarget(this.selectedBox,t,n)}onScroll(){this.host&&(this.host.setAttribute("data-scrolling",""),this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.host?.removeAttribute("data-scrolling"),this.scrollTimeout=null},120),this.schedule())}schedule(){this.frame!==null||!this.host||(this.frame=requestAnimationFrame(()=>{this.frame=null,this.render()}))}createBox(t,n){let r=document.createElement("div");r.className=`box ${n}`;let i=document.createElement("div");i.className="label";let o=document.createElement("span");return o.className="text",i.appendChild(o),r.appendChild(i),t.appendChild(r),{root:r,label:i,text:o,target:null}}retarget(t,n,r){if(!t||t.target===n)return;let i=t.target;i&&this.resizeObserver?.unobserve(i),t.target=n,n&&(this.resizeObserver?.observe(n),t.text.textContent=r,t.root.hasAttribute("data-visible")||t.root.setAttribute("data-instant","")),this.schedule()}render(){let t=this.hoverBox?this.measure(this.hoverBox):null,n=this.selectedBox?this.measure(this.selectedBox):null;this.hoverBox&&this.paint(this.hoverBox,t,n),this.selectedBox&&this.paint(this.selectedBox,n,t)}measure(t){let n=t.target;if(!n)return null;if(!n.isConnected)return this.resizeObserver?.unobserve(n),t.target=null,null;let r=n.getBoundingClientRect();if(r.width===0&&r.height===0)return null;let i=bo(n,r);return i?{rect:r,covers:i,labelWidth:i.length?t.label.offsetWidth:0,labelHeight:i.length?t.label.offsetHeight:0}:null}paint(t,n,r=null){let i=t.root;if(!n){i.removeAttribute("data-visible");return}let{rect:o,covers:s}=n,a=o.left-3,d=o.top-3,c={left:a-2,top:d-22,right:a-2+(n.labelWidth||Math.min(240,o.width)),bottom:d},u=d<22||r!==null&&r.rect!==o&&mo(c,r.rect);i.style.transform=`translate3d(${a}px, ${d}px, 0)`,i.style.width=`${o.width+6}px`,i.style.height=`${o.height+6}px`,i.toggleAttribute("data-label-inside",u),i.style.clipPath=s.length?yo(a,d,s):"";let g=u?a+2:a-2,l=u?d+2:d-4-n.labelHeight,p={left:g,top:l,right:g+n.labelWidth,bottom:l+n.labelHeight};if(i.toggleAttribute("data-label-covered",s.some(f=>_n(f,p))),i.hasAttribute("data-instant")){i.setAttribute("data-visible",""),requestAnimationFrame(()=>i.removeAttribute("data-instant"));return}i.setAttribute("data-visible","")}};var wn=/^\d+$/,Eo=/[_-]+/g;function En(e){return e.split(".").map(t=>wn.test(t)?String(Number.parseInt(t,10)):t).join(".")}var wo=new Set(["value","text","body","content","label"]);function gt(e){let t=e.replace(Eo," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function be(e,t="en"){if(!e)return X("visualEditor.edit",t);let n=e.split(".").filter(o=>o&&o!=="items"&&!wn.test(o)),r=n[n.length-1];if(!r)return X("visualEditor.edit",t);let i=n[n.length-2];return i&&wo.has(r)?`${gt(i)} \u203A ${gt(r)}`:gt(r)}function mt(e){if(!e.field)return null;let t=document.querySelectorAll("[data-prepr-encoded]");if(e.entryId){for(let n of t)if(n.getAttribute("data-prepr-entry-id")===e.entryId)return n}for(let n of[e.field,e.fieldById]){if(!n)continue;let r=En(n);for(let i of t){let o=i.getAttribute("data-prepr-field");if(!(!o||En(o)!==r)&&!(e.id&&i.getAttribute("data-prepr-id")!==e.id))return i}}return null}var xo=L("stega:elements"),De=class{constructor(t=Ne){this.observer=null;this.decode=t}getElements(){return this.elements||(this.elements=document.querySelectorAll("[data-prepr-encoded]")),this.elements}tagFromTextNode(t){let n=this.decode(t.textContent);if(!n?.href)return!1;let r=me(t);return!r||r.hasAttribute("data-prepr-encoded")?!1:(he(r,n),!0)}scanNode(t){if(t.nodeType===Node.TEXT_NODE){if(fe(t))return;this.tagFromTextNode(t)}else t.nodeType===Node.ELEMENT_NODE&&t.childNodes.forEach(n=>this.scanNode(n))}scanDocument(t=!1){if(t){let r=document.querySelectorAll("[data-prepr-encoded]");if(r.length>0){this.elements=r;return}}let n=0;ge(document.body,r=>{this.tagFromTextNode(r)&&n++}),xo.log("document scan complete, encoded",n,"elements"),this.elements=document.querySelectorAll("[data-prepr-encoded]")}setupMutationObserver(t){this.observer&&this.observer.disconnect();let n=[],r=null,i=()=>{let o=new Set;n.forEach(s=>{s.addedNodes.forEach(a=>o.add(a)),s.type==="characterData"&&o.add(s.target),s.type==="attributes"&&o.add(s.target)}),o.forEach(s=>{s.isConnected&&this.scanNode(s)}),n=[],this.elements=document.querySelectorAll("[data-prepr-encoded]"),t?.()};this.observer=new MutationObserver(o=>{n.push(...o),r&&clearTimeout(r),r=setTimeout(i,100)}),this.observer.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded"]})}disconnect(){this.observer&&(this.observer.disconnect(),this.observer=null),this.elements=void 0}};var xn='@property --prepr-presence{syntax:"<number>";inherits:true;initial-value:1}[data-prepr-encoded]{outline:1px dashed rgba(79,70,229,calc(.3 * var(--prepr-presence,1)));outline-offset:2px}';var ht="data-prepr-stega";function vt(e=xn){let t=document.querySelector(`style[${ht}]`);if(t)return t;let n=document.createElement("style");return n.setAttribute(ht,""),n.textContent=e,document.head.appendChild(n),n}function bt(){document.querySelectorAll(`style[${ht}]`).forEach(e=>e.parentNode?.removeChild(e))}var ye=L("stega:scan"),Tn="[data-prepr-encoded]",To=400,So="[data-prepr-encoded]{cursor:pointer}";function Lo(){let e=document.documentElement;typeof e.animate=="function"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||e.animate({"--prepr-presence":["0","1"]},{duration:To,easing:"ease-out"}))}function yt(e){let t=e.tooltip??!0,n=e.locale??"en",r=new De,i=new oe({onLabelClick:S=>e.onEdit(ve(S))}),o=!1,s=null,a=null,d=0,c=0,u=!1,g=()=>{if(s=null,u&&(u=!1,a=document.elementFromPoint(d,c)),i.owns(a))return;let S=a instanceof Element?a.closest(Tn):null;i.setHover(S,S?be(S.getAttribute("data-prepr-field"),n):"")},l=()=>{s===null&&(s=requestAnimationFrame(g))},p=S=>{a=S.target,d=S.clientX,c=S.clientY,u=!1,l()},f=()=>{a=null,u=!1,i.setHover(null,"")},m=()=>{i.onScroll(),a!==null&&(u=!0,l())},v=()=>i.schedule(),b=S=>{let P=S.target?.closest(Tn);P&&(S.preventDefault(),S.stopPropagation(),e.onEdit(ve(P)))};return{start:()=>{if(o){ye.log("already initialized, skipping setup");return}if(!t){vt(So),r.scanDocument(!0),r.setupMutationObserver(()=>{}),document.addEventListener("click",b,{capture:!0}),o=!0,ye.log("stega controller started (headless)");return}vt(),Lo(),i.mount(),r.scanDocument(!0),r.setupMutationObserver(()=>{a!==null&&(u=!0,l())}),document.addEventListener("pointermove",p,{passive:!0}),document.addEventListener("pointerdown",p,{passive:!0}),document.documentElement.addEventListener("pointerleave",f),window.addEventListener("scroll",m,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),o=!0,ye.log("stega controller started")},stop:()=>{if(o){if(o=!1,!t){document.removeEventListener("click",b,{capture:!0}),r.disconnect(),bt(),ye.log("stega controller stopped (headless)");return}s!==null&&cancelAnimationFrame(s),s=null,a=null,u=!1,document.removeEventListener("pointermove",p),document.removeEventListener("pointerdown",p),document.documentElement.removeEventListener("pointerleave",f),window.removeEventListener("scroll",m,{capture:!0}),window.removeEventListener("resize",v),i.unmount(),r.disconnect(),bt(),ye.log("stega controller stopped")}}}}var Ao=L("stega:scroll"),Co=1200,He=null;function _t(e){let{field:t,id:n}=e;if(!t)return!1;let r=document.querySelectorAll("[data-prepr-encoded]"),i=null;for(let o of r)if(o.getAttribute("data-prepr-field")===t&&!(n&&o.getAttribute("data-prepr-id")!==n)){i=o;break}return i?(i.scrollIntoView({behavior:"smooth",block:"center"}),He&&clearTimeout(He),document.querySelectorAll(".prepr-overlay-active").forEach(o=>o.classList.remove("prepr-overlay-active")),i.classList.add("prepr-overlay-active"),He=setTimeout(()=>{i.classList.remove("prepr-overlay-active"),He=null},Co),!0):(Ao.log("no element found for field",t),!1)}var ko={locale:"en",segments:[],selectedSegment:null,selectedVariant:null,editMode:!1,previewMode:!1,toolbarOpen:!1,isIframe:!1,features:en};function Sn(e={}){let t={...ko,...e},n=new Set;function r(){return t}function i(s){if(Object.keys(s).some(c=>s[c]!==t[c])){t={...t,...s};for(let c of n)c(t)}}function o(s){return n.add(s),()=>{n.delete(s)}}return{get:r,set:i,subscribe:o}}function _e(){return{maxAge:31536e3,path:"/",...ke()}}function An(e){let{store:t,stega:n,features:r,editingEnabled:i}=e;function o(s){let[a,d]=Ln(e.currentPath()),c=new URLSearchParams(d);for(let[g,l]of Object.entries(s))l===null?c.delete(g):c.set(g,l);let u=c.toString();e.navigate(u?`${a}?${u}`:a)}return function(a,d){let c={};if(r.segments&&a.selectedSegment!==d.selectedSegment&&(d.selectedSegment===null?ot(de,"/",ke()):te(de,d.selectedSegment,_e()),c[Ae]=d.selectedSegment,R("segment_changed",{segment:d.selectedSegment??void 0})),r.abTesting&&a.selectedVariant!==d.selectedVariant&&(d.selectedVariant===null?ot(ce,"/",ke()):te(ce,d.selectedVariant,_e()),c[Ce]=d.selectedVariant,R("variant_changed",{variant:d.selectedVariant??void 0})),Object.keys(c).length>0&&o(c),a.editMode!==d.editMode&&(d.editMode&&i?n.start():n.stop(),R("edit_mode_toggled",{editMode:d.editMode})),a.previewMode!==d.previewMode){let u={};if(!d.previewMode&&d.editMode&&(u.editMode=!1),d.toolbarOpen&&(u.toolbarOpen=!1),Object.keys(u).length>0&&t.set(u),te(Le,String(d.previewMode),_e()),te(le,"false",_e()),R("preview_mode_toggled",{previewMode:d.previewMode}),!d.isIframe){let[g,l]=Ln(e.currentPath()),p=new URLSearchParams(l);if(p.has(Ae)||p.has(Ce)){p.delete(Ae),p.delete(Ce);let f=p.toString();e.navigate(f?`${g}?${f}`:g)}else e.reload()}}a.toolbarOpen!==d.toolbarOpen&&te(le,String(d.toolbarOpen),_e())}}function Ln(e){let t=e.indexOf("?");return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}var Ge,C,Mn,Oo,q,Cn,Rn,In,Et,Fe,Ee,Nn,Tt,wt,xt,Mo,$e={},je=[],Ro=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ke=Array.isArray;function j(e,t){for(var n in t)e[n]=t[n];return e}function St(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Lt(e,t,n){var r,i,o,s={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ge.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return Ve(e,s,r,i,null)}function Ve(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Mn,__i:-1,__u:0};return i==null&&C.vnode!=null&&C.vnode(o),o}function W(e){return e.children}function Ue(e,t){this.props=e,this.context=t}function ie(e,t){if(t==null)return e.__?ie(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ie(e):null}function Io(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=j({},t);o.__v=t.__v+1,C.vnode&&C.vnode(o),At(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??ie(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,Vn(r,o,i),t.__e=t.__=null,o.__e!=n&&Dn(o)}}function Dn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Dn(e)}function kn(e){(!e.__d&&(e.__d=!0)&&q.push(e)&&!ze.__r++||Cn!=C.debounceRendering)&&((Cn=C.debounceRendering)||Rn)(ze)}function ze(){try{for(var e,t=1;q.length;)q.length>t&&q.sort(In),e=q.shift(),t=q.length,Io(e)}finally{q.length=ze.__r=0}}function Hn(e,t,n,r,i,o,s,a,d,c,u){var g,l,p,f,m,v,b,_=r&&r.__k||je,w=t.length;for(d=No(n,t,_,d,w),g=0;g<w;g++)(p=n.__k[g])!=null&&(l=p.__i!=-1&&_[p.__i]||$e,p.__i=g,v=At(e,p,l,i,o,s,a,d,c,u),f=p.__e,p.ref&&l.ref!=p.ref&&(l.ref&&Ct(l.ref,null,p),u.push(p.ref,p.__c||f,p)),m==null&&f!=null&&(m=f),(b=!!(4&p.__u))||l.__k===p.__k?(d=Bn(p,d,e,b),b&&l.__e&&(l.__e=null)):typeof p.type=="function"&&v!==void 0?d=v:f&&(d=f.nextSibling),p.__u&=-7);return n.__e=m,d}function No(e,t,n,r,i){var o,s,a,d,c,u=n.length,g=u,l=0;for(e.__k=new Array(i),o=0;o<i;o++)(s=t[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[o]=Ve(null,s,null,null,null):Ke(s)?s=e.__k[o]=Ve(W,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[o]=Ve(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,d=o+l,s.__=e,s.__b=e.__b+1,a=null,(c=s.__i=Do(s,n,d,g))!=-1&&(g--,(a=n[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(i>u?l--:i<u&&l++),typeof s.type!="function"&&(s.__u|=4)):c!=d&&(c==d-1?l--:c==d+1?l++:(c>d?l--:l++,s.__u|=4))):e.__k[o]=null;if(g)for(o=0;o<u;o++)(a=n[o])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=ie(a)),$n(a,a));return r}function Bn(e,t,n,r){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=Bn(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=ie(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Do(e,t,n,r){var i,o,s,a=e.key,d=e.type,c=t[n],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&d==c.type)return n;if(r>(u?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((c=t[s=i>=0?i--:o++])!=null&&(2&c.__u)==0&&a==c.key&&d==c.type)return s}return-1}function Pn(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ro.test(t)?n:n+"px"}function Be(e,t,n,r,i){var o,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Pn(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Pn(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Nn,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[Ee]=r[Ee]:(n[Ee]=Tt,e.addEventListener(t,o?xt:wt,o)):e.removeEventListener(t,o?xt:wt,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function On(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Fe]==null)t[Fe]=Tt++;else if(t[Fe]<n[Ee])return;return n(C.event?C.event(t):t)}}}function At(e,t,n,r,i,o,s,a,d,c){var u,g,l,p,f,m,v,b,_,w,S,x,P,O,N,U,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),o=[a=t.__e=n.__e]),(u=C.__b)&&u(t);e:if(typeof M=="function"){g=s.length;try{if(_=t.props,w=M.prototype&&M.prototype.render,S=(u=M.contextType)&&r[u.__c],x=u?S?S.props.value:u.__:r,n.__c?b=(l=t.__c=n.__c).__=l.__E:(w?t.__c=l=new M(_,x):(t.__c=l=new Ue(_,x),l.constructor=M,l.render=Bo),S&&S.sub(l),l.state||(l.state={}),l.__n=r,p=l.__d=!0,l.__h=[],l._sb=[]),w&&l.__s==null&&(l.__s=l.state),w&&M.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=j({},l.__s)),j(l.__s,M.getDerivedStateFromProps(_,l.__s))),f=l.props,m=l.state,l.__v=t,p)w&&M.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),w&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(w&&M.getDerivedStateFromProps==null&&_!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(_,x),t.__v==n.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(_,l.__s,x)===!1){t.__v!=n.__v&&(l.props=_,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),je.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&s.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(_,l.__s,x),w&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,m,v)})}if(l.context=x,l.props=_,l.__P=e,l.__e=!1,P=C.__r,O=0,w)l.state=l.__s,l.__d=!1,P&&P(t),u=l.render(l.props,l.state,l.context),je.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,P&&P(t),u=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++O<25);l.state=l.__s,l.getChildContext!=null&&(r=j(j({},r),l.getChildContext())),w&&!p&&l.getSnapshotBeforeUpdate!=null&&(v=l.getSnapshotBeforeUpdate(f,m)),N=u!=null&&u.type===W&&u.key==null?Un(u.props.children):u,a=Hn(e,Ke(N)?N:[N],t,n,r,i,o,s,a,d,c),l.base=t.__e,t.__u&=-161,l.__h.length&&s.push(l),b&&(l.__E=l.__=null)}catch(D){if(s.length=g,t.__v=null,d||o!=null){if(D.then){for(t.__u|=d?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o!=null&&(o[o.indexOf(a)]=null),t.__e=a}else if(o!=null)for(U=o.length;U--;)St(o[U])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||Fn(t),C.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=Ho(n.__e,t,n,r,i,o,s,d,c);return(u=C.diffed)&&u(t),128&t.__u?void 0:a}function Fn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Fn))}function Vn(e,t,n){for(var r=0;r<n.length;r++)Ct(n[r],n[++r],n[++r]);C.__c&&C.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){C.__e(o,i.__v)}})}function Un(e){return typeof e!="object"||e==null||e.__b>0?e:Ke(e)?e.map(Un):e.constructor!==void 0?null:j({},e)}function Ho(e,t,n,r,i,o,s,a,d){var c,u,g,l,p,f,m,v=n.props||$e,b=t.props,_=t.type;if(_=="svg"?i="http://www.w3.org/2000/svg":_=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!_&&(_?p.localName==_:p.nodeType==3)){e=p,o[c]=null;break}}if(e==null){if(_==null)return document.createTextNode(b);e=document.createElementNS(i,_,b.is&&b),a&&(C.__m&&C.__m(t,o),a=!1),o=null}if(_==null)v===b||a&&e.data==b||(e.data=b);else{if(o=_=="textarea"&&b.defaultValue!=null?null:o&&Ge.call(e.childNodes),!a&&o!=null)for(v={},c=0;c<e.attributes.length;c++)v[(p=e.attributes[c]).name]=p.value;for(c in v)p=v[c],c=="dangerouslySetInnerHTML"?g=p:c=="children"||c in b||c=="value"&&"defaultValue"in b||c=="checked"&&"defaultChecked"in b||Be(e,c,null,p,i);for(c in b)p=b[c],c=="children"?l=p:c=="dangerouslySetInnerHTML"?u=p:c=="value"?f=p:c=="checked"?m=p:a&&typeof p!="function"||v[c]===p||Be(e,c,p,v[c],i);if(u)a||g&&(u.__html==g.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(g&&(e.innerHTML=""),Hn(t.type=="template"?e.content:e,Ke(l)?l:[l],t,n,r,_=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&&ie(n,0),a,d),o!=null)for(c=o.length;c--;)St(o[c]);a&&_!="textarea"||(c="value",_=="progress"&&f==null?e.removeAttribute("value"):f!=null&&(f!==e[c]||_=="progress"&&!f||_=="option"&&f!=v[c])&&Be(e,c,f,v[c],i),c="checked",m!=null&&m!=e[c]&&Be(e,c,m,v[c],i))}return e}function Ct(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){C.__e(i,n)}}function $n(e,t,n){var r,i;if(C.unmount&&C.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ct(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){C.__e(o,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&$n(r[i],t,n||typeof e.type!="function");n||St(e.__e),e.__c=e.__=e.__e=void 0}function Bo(e,t,n){return this.constructor(e,n)}function jn(e,t,n){var r,i,o,s;t==document&&(t=document.documentElement),C.__&&C.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],s=[],At(t,e=(!r&&n||t).__k=Lt(W,null,[e]),i||$e,$e,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?Ge.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),Vn(o,e,s),e.props.children=null}Ge=je.slice,C={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(a){e=a}throw e}},Mn=0,Oo=function(e){return e!=null&&e.constructor===void 0},Ue.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=j({},this.state),typeof e=="function"&&(e=e(j({},n),this.props)),e&&j(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),kn(this))},Ue.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),kn(this))},Ue.prototype.render=W,q=[],Rn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,In=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,Et=Math.random().toString(8),Fe="__d"+Et,Ee="__a"+Et,Nn=/(PointerCapture)$|Capture$/i,Tt=0,wt=On(!1),xt=On(!0),Mo=0;var zn=`<svg width="102" height="28" viewBox="0 0 102 28" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
102
|
+
<path d="M39.2674 2.19699C39.2757 2.18321 39.2839 2.16943 39.291 2.15528L39.2939 2.15057L39.2935 2.1502C39.3379 2.06208 39.3633 1.96308 39.3633 1.85754C39.3633 1.62109 39.2374 1.41474 39.0507 1.30231C39.0485 1.30014 39.0467 1.29651 39.0446 1.29578C35.1089 -0.88088 29.8537 -0.36627 26.3741 3.2632C24.4207 5.3006 23.4231 7.92116 23.3716 10.5544H23.3684V20.893C23.3684 21.2495 23.6538 21.5389 24.0058 21.5389H26.98C27.332 21.5389 27.6174 21.2495 27.6174 20.893V10.7698H27.6192C27.6192 9.14658 28.2169 7.52187 29.4209 6.26599C31.5699 4.02478 34.7423 3.8565 36.9299 5.03659C36.9367 5.04058 36.9439 5.04384 36.9507 5.04747C36.9557 5.05001 36.9607 5.05254 36.9657 5.05508H36.9664C37.0494 5.09497 37.1417 5.11782 37.2393 5.11782C37.4879 5.11782 37.7032 4.97276 37.808 4.76206L39.2674 2.19699Z" fill="#4338CA"/>
|
|
103
|
+
<path d="M10.6216 0.000244141C4.75551 0.000244141 0 4.82177 0 10.7693V27.3543C0 27.7108 0.285079 28.0002 0.637405 28.0002H3.61161C3.96358 28.0002 4.24902 27.7108 4.24902 27.3543V19.3853C6.02424 20.7373 8.23084 21.5388 10.622 21.5388C16.4878 21.5388 21.244 16.7173 21.244 10.7697C21.2437 4.82177 16.4878 0.000244141 10.6216 0.000244141ZM10.6216 17.2311C7.10196 17.2311 4.24866 14.3382 4.24866 10.7693C4.24866 7.20079 7.10196 4.30788 10.6216 4.30788C14.1413 4.30788 16.995 7.20079 16.995 10.7693C16.995 14.3379 14.1413 17.2311 10.6216 17.2311Z" fill="#4338CA"/>
|
|
104
|
+
<path d="M73.259 0C67.3932 0 62.6373 4.82152 62.6373 10.7691V27.3541C62.6373 27.7106 62.9228 28 63.2747 28H66.2489C66.6009 28 66.8863 27.7106 66.8863 27.3541V19.3854C68.6616 20.7374 70.8682 21.5389 73.2593 21.5389C79.1251 21.5389 83.8813 16.7174 83.8813 10.7698C83.881 4.82152 79.1248 0 73.259 0ZM73.259 17.2309C69.7393 17.2309 66.886 14.338 66.886 10.7691C66.886 7.20055 69.7393 4.30764 73.259 4.30764C76.7783 4.30764 79.632 7.20055 79.632 10.7691C79.632 14.3376 76.7783 17.2309 73.259 17.2309Z" fill="#4338CA"/>
|
|
105
|
+
<path d="M60.439 10.9845C60.439 5.03657 55.6827 0 49.817 0C43.9508 0 39.1953 4.82152 39.1953 10.7691C39.1953 16.7167 43.9508 21.5382 49.817 21.5382C53.1374 21.5382 55.8763 19.9954 57.5939 18.1031C57.5939 18.1031 57.5942 18.1027 57.5946 18.1024C57.596 18.1009 57.5975 18.0995 57.5985 18.098C57.7112 17.9812 57.7806 17.822 57.7806 17.6461C57.7806 17.4601 57.7026 17.2929 57.5785 17.1751V17.1743L57.5696 17.1671C57.5535 17.1522 57.5367 17.1384 57.5188 17.1254L55.2464 15.2501C55.1344 15.1503 54.9877 15.0891 54.8264 15.0891C54.6261 15.0891 54.4476 15.183 54.331 15.3291C53.3216 16.3707 51.7256 17.2309 49.8166 17.2309C46.2969 17.2309 43.4436 14.338 43.4436 10.7691C43.4436 7.20055 46.2969 4.30764 49.8166 4.30764C52.5909 4.30764 54.9505 6.10605 55.8255 8.61527H50.3474C49.9954 8.61527 49.71 8.90467 49.71 9.26152V12.277C49.71 12.6339 49.9954 12.9233 50.3474 12.9233H59.5884C59.6059 12.9233 59.6227 12.9218 59.6399 12.9207C59.6571 12.9222 59.6742 12.9233 59.6914 12.9233C59.9743 12.9233 60.214 12.7361 60.2973 12.4772L60.3045 12.4783C60.308 12.4551 60.3116 12.4326 60.3152 12.4097C60.3199 12.3876 60.3234 12.3655 60.3256 12.3427C60.4003 11.861 60.439 11.5172 60.439 10.9845Z" fill="#4338CA"/>
|
|
106
|
+
<path d="M101.928 2.15406L101.931 2.14934L101.93 2.14898C101.974 2.06085 102 1.96185 102 1.85632C102 1.61987 101.874 1.41351 101.687 1.30109C101.685 1.29891 101.683 1.29529 101.681 1.29456C97.7455 -0.882101 92.4903 -0.367491 89.0107 3.26198C87.0573 5.29938 86.0597 7.91993 86.0082 10.5532H86.005V20.8918C86.005 21.2483 86.2904 21.5377 86.6424 21.5377H89.6166C89.9686 21.5377 90.254 21.2483 90.254 20.8918V10.7686H90.2555C90.2555 9.14535 90.8532 7.52065 92.0571 6.26477C94.2062 4.02355 97.3785 3.85528 99.5662 5.03537C99.573 5.03936 99.5801 5.04262 99.5869 5.04624C99.5919 5.04878 99.5969 5.05132 99.6019 5.05386H99.6027C99.6856 5.09375 99.7779 5.11696 99.8756 5.11696C100.124 5.11696 100.339 4.9719 100.444 4.7612L101.905 2.19685C101.913 2.18235 101.92 2.16856 101.928 2.15406Z" fill="#4338CA"/>
|
|
107
|
+
</svg>`,Gn=`<svg width="16" height="16" viewBox="1.05 0 16 16" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
108
|
+
<path d="M9.05365 0C5.71033 0 3 2.75516 3 6.15377V15.6309C3 15.8346 3.16248 16 3.36328 16H5.05838C5.25898 16 5.42166 15.8346 5.42166 15.6309V11.0772C6.43342 11.8498 7.69104 12.3077 9.05385 12.3077C12.397 12.3077 15.1077 9.55259 15.1077 6.15397C15.1075 2.75516 12.397 0 9.05365 0ZM9.05365 9.84623C7.04766 9.84623 5.42146 8.19314 5.42146 6.15377C5.42146 4.1146 7.04766 2.46151 9.05365 2.46151C11.0596 2.46151 12.686 4.1146 12.686 6.15377C12.686 8.19293 11.0596 9.84623 9.05365 9.84623Z" fill="currentColor"/>
|
|
109
|
+
</svg>`,Kn=`<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
110
|
+
<path d="M3.37109 5.80078C3.20703 6.26562 2.6875 6.51172 2.25 6.34766C1.78516 6.18359 1.53906 5.69141 1.70312 5.22656C2.00391 4.37891 2.49609 3.58594 3.15234 2.92969C5.55859 0.550781 9.41406 0.550781 11.8203 2.92969L12.2852 3.42188V2C12.2852 1.53516 12.6953 1.125 13.1602 1.125C13.6523 1.125 14.0352 1.53516 14.0352 2V5.5C14.0352 5.99219 13.6523 6.375 13.1602 6.375H9.6875C9.19531 6.375 8.8125 5.99219 8.8125 5.5C8.8125 5.03516 9.19531 4.625 9.6875 4.625H11.0547L10.5898 4.16016C8.86719 2.46484 6.10547 2.46484 4.38281 4.16016C3.91797 4.65234 3.5625 5.19922 3.37109 5.80078ZM1.56641 8.17969C1.59375 8.15234 1.64844 8.15234 1.67578 8.15234C1.73047 8.15234 1.75781 8.125 1.8125 8.125H5.3125C5.77734 8.125 6.1875 8.53516 6.1875 9C6.1875 9.49219 5.77734 9.875 5.3125 9.875H3.91797L4.38281 10.3672C6.10547 12.0625 8.86719 12.0625 10.5898 10.3672C11.0547 9.875 11.4102 9.32812 11.6016 8.72656C11.7656 8.26172 12.2852 8.01562 12.7227 8.17969C13.1875 8.34375 13.4336 8.83594 13.2695 9.30078C12.9688 10.1484 12.4766 10.9141 11.8203 11.5977C9.41406 13.9766 5.55859 13.9766 3.15234 11.5977L2.6875 11.1055V12.5C2.6875 12.9922 2.27734 13.375 1.8125 13.375C1.32031 13.375 0.9375 12.9922 0.9375 12.5V9.02734C0.9375 8.97266 0.9375 8.91797 0.9375 8.89062C0.9375 8.83594 0.9375 8.80859 0.964844 8.78125C0.992188 8.64453 1.07422 8.50781 1.18359 8.39844C1.29297 8.28906 1.42969 8.20703 1.56641 8.17969Z" fill="currentColor"/>
|
|
111
|
+
</svg>`,Xn=`<svg width="9" height="6" viewBox="0 0 9 6" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
112
|
+
<path d="M5.24274 5.36865C4.91462 5.72412 4.3404 5.72412 4.01227 5.36865L0.512273 1.86865C0.266179 1.62256 0.184148 1.23975 0.320867 0.911621C0.457586 0.583496 0.785711 0.364746 1.14118 0.364746H8.14118C8.46931 0.364746 8.79743 0.583496 8.93415 0.911621C9.07087 1.23975 8.98884 1.62256 8.74274 1.86865L5.24274 5.36865Z" fill="currentColor"/>
|
|
113
|
+
</svg>`,kt=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
114
|
+
<path d="M4.22 4.22a.75.75 0 0 1 1.06 0L8 6.94l2.72-2.72a.75.75 0 1 1 1.06 1.06L9.06 8l2.72 2.72a.75.75 0 1 1-1.06 1.06L8 9.06l-2.72 2.72a.75.75 0 1 1-1.06-1.06L6.94 8 4.22 5.28a.75.75 0 0 1 0-1.06z" fill="currentColor"/>
|
|
115
|
+
</svg>`,qn=`<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
116
|
+
<path d="M8.17578 1.07031C8.41016 0.816406 8.82031 0.816406 9.05469 1.07031C9.30859 1.30469 9.30859 1.71484 9.05469 1.94922L5.75391 5.25L9.05469 8.57031C9.30859 8.80469 9.30859 9.21484 9.05469 9.44922C8.82031 9.70312 8.41016 9.70312 8.17578 9.44922L4.875 6.14844L1.55469 9.44922C1.32031 9.70312 0.910156 9.70312 0.675781 9.44922C0.421875 9.21484 0.421875 8.80469 0.675781 8.57031L3.97656 5.25L0.675781 1.94922C0.421875 1.71484 0.421875 1.30469 0.675781 1.07031C0.910156 0.816406 1.32031 0.816406 1.55469 1.07031L4.875 4.37109L8.17578 1.07031Z" fill="currentColor"/>
|
|
117
|
+
</svg>`;var Pt=":host{--prepr-primary:#4338ca;--prepr-bg:#eef2ff;--prepr-text:#1f2937;--prepr-radius:8px;--prepr-shadow:0px 0px 40px 0px #1f29373d;--prepr-z-index:10000;--prepr-primary-50:#eef2ff;--prepr-primary-100:#e0e7ff;--prepr-primary-800:#3730a3;--prepr-indigo-600:#4f46e5;--prepr-indigo-50:#eef2ff;--prepr-indigo-700:#4338ca;--prepr-secondary-400:#fb923c;--prepr-secondary-500:#f97316;--prepr-gray-100:#f3f4f6;--prepr-gray-200:#e5e7eb;--prepr-gray-300:#d1d5db;--prepr-gray-400:#9ca3af;--prepr-gray-500:#6b7280;--prepr-gray-700:#374151;--prepr-gray-800:#1f2937;--prepr-gray-900:#111827;--prepr-shadow-sm:0px 0px 12px 0px #c3c3c3cc;color:var(--prepr-text);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.5}:host *,:host :before,:host :after,*,:before,:after{box-sizing:border-box}button{font-family:inherit;font-size:inherit;margin:0}.prepr-regular-text{font-size:.875rem;font-weight:500;line-height:1.5}.prepr-backdrop{z-index:calc(var(--prepr-z-index) - 1);opacity:0;pointer-events:none;background:#0000001a;transition:opacity .2s ease-in-out;position:fixed;top:0;bottom:0;left:0;right:0}.prepr-backdrop[data-open=true]{opacity:1;pointer-events:auto;animation:.2s ease-in-out prepr-fade-in}.prepr-container{z-index:var(--prepr-z-index);justify-content:flex-end;align-items:center;display:flex;position:fixed;top:calc(50% - 64px);right:0}.prepr-toggle-holder{padding:.5rem}.prepr-toggle{cursor:pointer;background:var(--prepr-primary);color:#fff;border:none;border-radius:9999px;justify-content:center;align-items:center;width:2.25rem;height:2.25rem;display:flex}.prepr-toggle>span{display:flex}.prepr-toggle svg{color:#fff}.prepr-panel{z-index:var(--prepr-z-index);opacity:0;pointer-events:none;justify-content:flex-end;padding:.75rem;transition:opacity .2s ease-in-out;display:flex;position:fixed;top:50%;right:0;transform:translateY(-50%)}.prepr-panel[data-open=true]{opacity:1;pointer-events:auto;animation:.2s ease-in-out prepr-fade-in}.prepr-content{box-shadow:var(--prepr-shadow);border-radius:var(--prepr-radius);background:var(--prepr-bg);flex-direction:column;gap:2.5rem;width:100%;padding:1.5rem;display:flex}@media (min-width:640px){.prepr-panel{margin-right:4rem;padding:0}.prepr-content{width:502px;padding:2.5rem}}.prepr-header{justify-content:space-between;align-items:center;gap:.5rem;display:flex}.prepr-header-left{align-items:flex-start;gap:.75rem;display:flex}.prepr-badge{background:var(--prepr-primary-100);height:1.5rem;color:var(--prepr-primary);border-radius:4px;align-items:center;padding:.25rem .75rem;font-size:.875rem;display:flex}.prepr-header-close{cursor:pointer;background:var(--prepr-primary-100);width:2rem;height:2rem;color:var(--prepr-gray-700);border:none;border-radius:6px;justify-content:center;align-items:center;display:flex}.prepr-section{flex-direction:column;gap:.5rem;display:flex}.prepr-section-label{color:var(--prepr-gray-400);font-size:.875rem}.prepr-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.5rem 1.5rem;display:flex}.prepr-row-title{color:var(--prepr-gray-800);margin:0;font-size:1rem;font-weight:600}.prepr-radiogroup{border-radius:var(--prepr-radius);border:1px solid var(--prepr-gray-300);background:#fff;align-items:center;gap:.25rem;height:2.5rem;padding:.25rem;display:flex}.prepr-radiogroup[data-disabled=true]{cursor:not-allowed;opacity:.5}.prepr-radiogroup[data-disabled=true] .prepr-radio{pointer-events:none}.prepr-radio{cursor:pointer;white-space:nowrap;text-align:center;height:2rem;color:var(--prepr-gray-900);background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:.5rem 1.125rem;font-size:.875rem;font-weight:500;transition:all .2s ease-in-out;display:flex}.prepr-radio[data-checked=true]{background:var(--prepr-indigo-600);color:#fff;box-shadow:var(--prepr-shadow-sm)}.prepr-radio[data-checked=true][data-off=true]{background:var(--prepr-gray-800);color:#fff}.prepr-radio-variant{width:82px}.prepr-listbox{position:relative}.prepr-segment-button{border-radius:var(--prepr-radius);border:1px solid var(--prepr-gray-300);width:240px;height:2.5rem;color:var(--prepr-gray-500);cursor:pointer;background:#fff;flex-shrink:0;align-items:center;gap:.5rem;padding:0 .5rem;font-size:.875rem;font-weight:500;display:flex;overflow:hidden}@media (min-width:768px){.prepr-segment-button{padding:0 1rem}}.prepr-segment-button:disabled{cursor:not-allowed;background:var(--prepr-gray-200);color:var(--prepr-gray-400)}.prepr-segment-button[aria-expanded=true]{border-bottom-color:#fff;border-bottom-right-radius:0;border-bottom-left-radius:0}.prepr-segment-label{white-space:nowrap;text-overflow:ellipsis;text-align:left;width:100%;margin-right:auto;overflow:hidden}.prepr-segment-caret{color:var(--prepr-gray-800);display:flex}.prepr-options{z-index:calc(var(--prepr-z-index) + 1);border-left:1px solid var(--prepr-gray-300);border-right:1px solid var(--prepr-gray-300);border-bottom:1px solid var(--prepr-gray-300);-ms-overflow-style:none;scrollbar-width:none;background:#fff;border-radius:0 0 6px 6px;width:240px;max-height:300px;margin:0;padding:0;list-style:none;position:absolute;top:100%;left:0;overflow-y:auto;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.prepr-options::-webkit-scrollbar{display:none}.prepr-options[hidden]{display:none}.prepr-option-search{background:#fff;padding:.5rem;position:-webkit-sticky;position:sticky;top:0}.prepr-segment-search{border:1px solid var(--prepr-gray-300);border-radius:var(--prepr-radius);width:100%;height:2rem;font:inherit;color:var(--prepr-gray-900);box-sizing:border-box;background:#fff;padding:0 .5rem;font-size:.875rem}@media (pointer:coarse){.prepr-segment-search{font-size:16px}}.prepr-segment-search::placeholder{color:var(--prepr-gray-400)}.prepr-segment-search:focus{border-color:var(--prepr-gray-400);outline:none}.prepr-option{cursor:pointer;width:100%;color:var(--prepr-gray-900);background:#fff;align-items:center;padding:.5rem 1rem;font-size:.875rem;font-weight:500;display:flex}.prepr-option:hover{background:var(--prepr-gray-100)}.prepr-option[aria-selected=true]{background:var(--prepr-indigo-50);color:var(--prepr-indigo-700)}.prepr-option-label{white-space:nowrap;text-overflow:ellipsis;text-align:left;width:100%;margin-right:auto;overflow:hidden}.prepr-reset{background:var(--prepr-secondary-400);color:#fff;cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;gap:.5rem;width:100%;height:2.5rem;padding:.5rem .75rem;font-size:.875rem;font-weight:500;display:flex}.prepr-reset:hover:not(:disabled){background:var(--prepr-secondary-500)}.prepr-reset:disabled{background:var(--prepr-gray-400);color:var(--prepr-gray-500);cursor:not-allowed}@media (min-width:768px){.prepr-reset{width:108px}}.prepr-indicators{z-index:var(--prepr-z-index);gap:.75rem;display:flex;position:fixed;bottom:1.5rem;right:1.5rem}.prepr-status-pill{background:var(--prepr-primary);color:#fff;cursor:pointer;border:none;border-radius:9999px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.prepr-status-pill[data-interactive=false]{cursor:default;opacity:1;color:#fff}.prepr-status-pill[data-interactive=true]:hover{background:var(--prepr-primary-800)}.prepr-status-pill[hidden]{display:none}.prepr-status-viewing{color:#fff9;font-size:10px}.prepr-status-segment{text-overflow:ellipsis;white-space:nowrap;max-width:120px;display:inline-block;overflow:hidden}.prepr-status-variant{text-overflow:ellipsis;white-space:nowrap;background:#fff3;border-radius:4px;max-width:80px;padding:0 .5rem;display:inline-block;overflow:hidden}.prepr-status-x{color:#fff;width:.75rem;height:.75rem}.prepr-close-edit-pill{background:var(--prepr-primary-50);color:var(--prepr-gray-800);cursor:pointer;border:none;border-radius:9999px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.prepr-close-edit-pill:hover{background:var(--prepr-primary-100)}.prepr-close-edit-pill[hidden]{display:none}.prepr-close-edit-x{width:1rem;height:1rem;color:var(--prepr-gray-500);transition:color .15s}.prepr-close-edit-pill:hover .prepr-close-edit-x{color:var(--prepr-gray-700)}.prepr-tip{z-index:calc(var(--prepr-z-index) + 2);overflow-wrap:break-word;background:var(--prepr-gray-900);color:#fff;pointer-events:none;border-radius:6px;width:auto;max-width:min(420px,100vw - 16px);padding:.5rem .75rem;font-size:.75rem;font-weight:500;position:fixed;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.prepr-tip-arrow{border-left:6px solid #0000;border-right:6px solid #0000;border-top:6px solid var(--prepr-gray-900);width:0;height:0;position:absolute;top:100%;transform:translate(-50%)}[hidden]{display:none!important}@keyframes prepr-fade-in{0%{opacity:0}to{opacity:1}}";var Fo=0;function y(e,t,n,r,i,o){t||(t={});var s,a,d=t;if("ref"in d)for(a in d={},t)a=="ref"?s=t[a]:d[a]=t[a];var c={type:e,props:d,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Fo,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)d[a]===void 0&&(d[a]=s[a]);return C.vnode&&C.vnode(c),c}function J({svg:e,className:t}){return y("span",{className:t,dangerouslySetInnerHTML:{__html:e}})}function Vo({t:e,onClose:t}){return y("div",{class:"prepr-header",children:[y("div",{class:"prepr-header-left",children:[y(J,{svg:zn}),y("div",{class:"prepr-badge","data-prepr":"badge",children:e("common.toolbar")})]}),y("button",{type:"button",class:"prepr-header-close","data-prepr":"close","aria-label":e("common.toolbar"),onClick:t,children:y(J,{svg:qn})})]})}function Uo({state:e,t,handlers:n}){let r=String(e.previewMode),i=[{v:!1,label:t("common.off"),off:!0,tooltipKey:"adaptiveContent.offDescription"},{v:!0,label:t("common.on"),tooltipKey:"adaptiveContent.onDescription"}];return y("div",{class:"prepr-radiogroup",role:"radiogroup","data-prepr":"preview-group",children:i.map(o=>{let s=r===String(o.v);return y("button",{type:"button",class:"prepr-radio","data-prepr":"preview-mode","data-value":String(o.v),"data-off":o.off?"true":void 0,role:"radio","data-checked":String(s),"aria-checked":s,"data-tooltip-key":o.tooltipKey,onClick:()=>n.onPreviewMode(o.v),onMouseEnter:a=>n.onPreviewTooltipEnter(a.currentTarget),onMouseLeave:()=>n.onPreviewTooltipLeave(),onFocus:a=>n.onPreviewTooltipEnter(a.currentTarget),onBlur:()=>n.onPreviewTooltipLeave(),children:o.label})})})}function $o({state:e,t,listboxOpen:n,segmentFilter:r,handlers:i}){let o=e.segments,s=o.length>0,a=r.trim().toLowerCase(),d=a?o.filter(g=>g.name.toLowerCase().includes(a)):o,c;if(!s)c=t("adaptiveContent.none");else if(e.selectedSegment===null)c=t("adaptiveContent.chooseSegment");else{let g=o.find(l=>l._id===e.selectedSegment);c=g?g.name:t("adaptiveContent.chooseSegment")}let u=!s||!e.previewMode;return y("div",{class:"prepr-listbox",children:[y("button",{type:"button",class:"prepr-segment-button","data-prepr":"segment-button","aria-haspopup":"listbox","aria-expanded":n,disabled:u,onClick:()=>i.onSegmentButtonClick(),onKeyDown:g=>i.onSegmentButtonKeydown(g),children:[y("span",{class:"prepr-segment-label","data-prepr":"segment-button-label",children:c}),y("span",{class:"prepr-segment-caret",children:y(J,{svg:Xn})})]}),y("ul",{class:"prepr-options","data-prepr":"options",role:"listbox",hidden:!n,onKeyDown:g=>i.onOptionsKeydown(g),children:[y("li",{class:"prepr-option-search",role:"none",children:y("input",{type:"text",class:"prepr-segment-search","data-prepr":"segment-search",placeholder:t("adaptiveContent.searchSegments"),value:r,onInput:g=>i.onSegmentFilterInput(g.currentTarget.value)})}),d.map(g=>y(jo,{seg:g,selected:g._id===e.selectedSegment,onChoose:i.onChooseSegment},g._id))]})]})}function jo({seg:e,selected:t,onChoose:n}){return y("li",{class:"prepr-option",role:"option","data-value":e._id,tabIndex:-1,"aria-selected":t,onClick:()=>n(e._id),children:y("span",{class:"prepr-option-label",children:e.name})})}function zo({state:e,handlers:t}){let n=e.selectedVariant==="B"?"B":"A",r=["A","B"];return y("div",{class:"prepr-radiogroup",role:"radiogroup","data-prepr":"variant-group","data-disabled":String(!e.previewMode),children:r.map(i=>{let o=n===i;return y("button",{type:"button",class:"prepr-radio prepr-radio-variant","data-prepr":"variant","data-value":i,role:"radio","data-checked":String(o),"aria-checked":o,onClick:()=>t.onVariant(i),children:i})})})}function Go({state:e,t,handlers:n}){let r=String(e.editMode),i=[{v:!1,label:t("common.off"),off:!0},{v:!0,label:t("common.on")}];return y("div",{class:"prepr-radiogroup",role:"radiogroup","data-prepr":"edit-group",children:i.map(o=>{let s=r===String(o.v);return y("button",{type:"button",class:"prepr-radio","data-prepr":"edit-mode","data-value":String(o.v),"data-off":o.off?"true":void 0,role:"radio","data-checked":String(s),"aria-checked":s,onClick:()=>n.onEditMode(o.v),children:o.label})})})}function Ko({state:e,t,handlers:n}){let{features:r}=e,i=e.segments.find(d=>d._id==="all_other_users")?.name??t("adaptiveContent.allOtherUsers"),o;if(!e.previewMode||!r.segments)o=t("common.user");else if(e.selectedSegment!==null){let d=e.segments.find(c=>c._id===e.selectedSegment);o=d?d.name:i}else o=i;let s=r.segments&&e.selectedSegment!==null||r.abTesting&&e.selectedVariant==="B",a=!e.previewMode||s;return y("button",{type:"button",class:"prepr-status-pill","data-prepr":"status-pill","data-interactive":String(a),hidden:e.isIframe,disabled:!a,onClick:()=>n.onStatusPill(),children:[y("span",{class:"prepr-status-viewing","data-prepr":"status-viewing",children:t("common.viewingAs")}),y("span",{class:"prepr-status-segment","data-prepr":"status-segment",children:o}),y("span",{class:"prepr-status-variant","data-prepr":"status-variant",hidden:!r.abTesting||!e.previewMode,children:e.selectedVariant==="B"?"B":"A"}),y("span",{class:"prepr-status-x","data-prepr":"status-x",hidden:!e.previewMode||!s,children:y(J,{svg:kt})})]})}function Xo({state:e,t,handlers:n}){return y("button",{type:"button",class:"prepr-close-edit-pill","data-prepr":"close-edit-pill","aria-label":t("editingTools.ariaCloseEditMode"),hidden:!e.features.editMode||!e.editMode||e.isIframe,onClick:()=>n.onCloseEditPill(),children:[y("span",{"data-prepr":"close-edit-label",children:t("editingTools.editMode")}),y("span",{class:"prepr-close-edit-x",children:y(J,{svg:kt})})]})}function Wn({state:e,t,listboxOpen:n,segmentFilter:r,handlers:i}){let{features:o}=e,s=o.segments&&e.selectedSegment!==null||o.abTesting&&e.selectedVariant!==null,a=o.segments||o.abTesting;return y(W,{children:[y("style",{dangerouslySetInnerHTML:{__html:Pt}}),y("div",{class:"prepr-backdrop","data-prepr":"backdrop","data-open":String(e.toolbarOpen)}),y("div",{class:"prepr-container",children:y("div",{class:"prepr-toggle-holder",children:y("button",{type:"button",class:"prepr-toggle","data-prepr":"toggle","aria-label":t("common.toolbar"),onClick:()=>i.onToggle(),children:y(J,{svg:Gn})})})}),y("div",{class:"prepr-panel","data-prepr":"panel","data-open":String(e.toolbarOpen),children:y("div",{class:"prepr-content","data-prepr":"content",role:"dialog","aria-label":t("common.toolbar"),children:[y(Vo,{t,onClose:i.onClose}),a&&y("div",{class:"prepr-section","data-prepr":"section-adaptive",children:[y("span",{class:"prepr-section-label","data-prepr":"adaptive-label",children:t("adaptiveContent.adaptiveContent")}),y("div",{class:"prepr-row",children:[y("h2",{class:"prepr-row-title","data-prepr":"preview-label",children:t("adaptiveContent.enablePreview")}),y(Uo,{state:e,t,handlers:i})]}),o.segments&&y("div",{class:"prepr-row",children:[y("h2",{class:"prepr-row-title","data-prepr":"segment-label",children:t("adaptiveContent.segment")}),y($o,{state:e,t,listboxOpen:n,segmentFilter:r,handlers:i})]}),o.abTesting&&y("div",{class:"prepr-row",children:[y("h2",{class:"prepr-row-title","data-prepr":"variant-label",children:t("adaptiveContent.ABVariant")}),y(zo,{state:e,handlers:i})]})]}),o.editMode&&y("div",{class:"prepr-section","data-prepr":"section-editing",children:[y("span",{class:"prepr-section-label","data-prepr":"editing-label",children:t("editingTools.editingTools")}),y("div",{class:"prepr-row",children:[y("h2",{class:"prepr-row-title","data-prepr":"edit-label",children:t("editingTools.editMode")}),y(Go,{state:e,t,handlers:i})]})]}),y("button",{type:"button",class:"prepr-reset","data-prepr":"reset",disabled:!s,onClick:()=>i.onReset(),children:[y(J,{svg:Kn}),y("span",{"data-prepr":"reset-label",children:t("common.reset")})]})]})}),y("div",{class:"prepr-indicators",children:[y(Ko,{state:e,t,handlers:i}),y(Xo,{state:e,t,handlers:i})]}),y("div",{class:"prepr-tip","data-prepr":"tooltip",role:"tooltip",hidden:!0,children:[y("span",{"data-prepr":"tooltip-text"}),y("span",{class:"prepr-tip-arrow","data-prepr":"tooltip-arrow"})]})]})}var Yn="prepr-toolbar",qo=typeof HTMLElement>"u"?class{}:HTMLElement,Ot=class extends qo{constructor(){super(...arguments);this.store=null;this.t=n=>n;this.unsubscribe=null;this.listboxOpen=!1;this.segmentFilter="";this.handlers={onToggle:()=>this.set({toolbarOpen:!this.state.toolbarOpen}),onClose:()=>this.set({toolbarOpen:!1}),onPreviewMode:n=>this.set({previewMode:n}),onEditMode:n=>{this.state.features.editMode&&this.set({editMode:n})},onVariant:n=>{this.state.features.abTesting&&this.state.previewMode&&this.set({selectedVariant:n})},onReset:()=>this.set(this.resetPatch({editMode:!1})),onStatusPill:()=>{if(!this.state.previewMode){this.set({previewMode:!0});return}let n=this.resetPatch();("selectedSegment"in n&&this.state.selectedSegment!==null||"selectedVariant"in n&&this.state.selectedVariant!=="A")&&this.set(n)},onCloseEditPill:()=>this.set({editMode:!1}),onSegmentButtonClick:()=>this.toggleListbox(!this.listboxOpen),onSegmentButtonKeydown:n=>this.onListboxKeydown(n),onOptionsKeydown:n=>this.onListboxKeydown(n),onChooseSegment:n=>this.chooseSegment(n),onSegmentFilterInput:n=>{this.segmentFilter=n,this.renderPanel(this.state)},onPreviewTooltipEnter:n=>this.showTooltip(n),onPreviewTooltipLeave:()=>this.hideTooltip()};this.onDocumentMouseDown=n=>{if(!this.listboxOpen)return;let r=this.segmentButton(),i=this.optionsList();if(!r||!i)return;let o=n.composedPath();!o.includes(r)&&!o.includes(i)&&this.toggleListbox(!1)}}connect(n,r){this.store=n,this.t=r,this.shadowRoot||this.attachShadow({mode:"open"}),this.unsubscribe?.(),this.unsubscribe=n.subscribe(i=>this.renderPanel(i)),document.removeEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("mousedown",this.onDocumentMouseDown),this.renderPanel(n.get())}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,document.removeEventListener("mousedown",this.onDocumentMouseDown)}get state(){return this.store.get()}set(n){this.store?.set(n)}resetPatch(n={}){let{features:r}=this.state,i={...n};return r.segments&&(i.selectedSegment=null),r.abTesting&&(i.selectedVariant="A"),i}renderPanel(n){let r=this.shadowRoot;r&&jn(Lt(Wn,{state:n,t:this.t,listboxOpen:this.listboxOpen,segmentFilter:this.segmentFilter,handlers:this.handlers}),r)}tip(){return this.shadowRoot?.querySelector('[data-prepr="tooltip"]')??null}showTooltip(n){let r=this.tip();if(!r)return;let i=r.querySelector('[data-prepr="tooltip-text"]'),o=r.querySelector('[data-prepr="tooltip-arrow"]'),s=n.getAttribute("data-tooltip-key");if(!s||!i||!o)return;i.textContent=this.t(s),r.hidden=!1;let a=8,d=r.getBoundingClientRect(),c=n.getBoundingClientRect(),u=c.left+c.width/2,g=c.top-a,l=window.innerHeight-c.bottom-a,f=d.height+a<=g||d.height+a>l?c.top-d.height-8:c.bottom+8,m=u-d.width/2;m<a&&(m=a),m+d.width>window.innerWidth-a&&(m=window.innerWidth-a-d.width);let v=Math.max(10,Math.min(u-m,d.width-10));r.style.top=`${f}px`,r.style.left=`${m}px`,o.style.left=`${v}px`}hideTooltip(){let n=this.tip();n&&(n.hidden=!0)}segmentButton(){return this.shadowRoot?.querySelector('[data-prepr="segment-button"]')??null}optionsList(){return this.shadowRoot?.querySelector('[data-prepr="options"]')??null}onListboxKeydown(n){let r=n,i=this.optionEls();if(!(r.target?.getAttribute?.("data-prepr")==="segment-search"&&r.key===" ")&&!(i.length===0&&r.key!=="Escape"))switch(r.key){case"Enter":case" ":{if(r.preventDefault(),!this.listboxOpen)this.toggleListbox(!0);else{let s=this.activeOptionIndex();s>=0&&this.chooseSegment(i[s].dataset.value)}break}case"Escape":{r.preventDefault(),this.toggleListbox(!1),this.segmentButton()?.focus();break}case"ArrowDown":{r.preventDefault(),this.listboxOpen||this.toggleListbox(!0),this.moveActiveOption(1);break}case"ArrowUp":{r.preventDefault(),this.listboxOpen||this.toggleListbox(!0),this.moveActiveOption(-1);break}default:break}}optionEls(){let n=this.optionsList();return n?Array.from(n.querySelectorAll('[role="option"]')):[]}activeOptionIndex(){return this.optionEls().findIndex(n=>n.getAttribute("data-active")==="true")}moveActiveOption(n){let r=this.optionEls();if(r.length===0)return;let i=this.activeOptionIndex();i=i<0?0:(i+n+r.length)%r.length,r.forEach((o,s)=>o.setAttribute("data-active",String(s===i))),r[i].focus()}toggleListbox(n){if(!this.segmentButton()?.disabled&&(this.listboxOpen=n,this.segmentFilter="",this.renderPanel(this.state),n)){let i=this.optionEls(),o=i.findIndex(a=>a.getAttribute("aria-selected")==="true"),s=o>=0?o:0;i.forEach((a,d)=>a.setAttribute("data-active",String(d===s))),this.searchInput()?.focus()}}searchInput(){return this.shadowRoot?.querySelector('[data-prepr="segment-search"]')??null}chooseSegment(n){this.state.features.segments&&(this.listboxOpen=!1,this.segmentFilter="",this.set({selectedSegment:n}),this.renderPanel(this.state),this.segmentButton()?.focus())}};function Zn(){typeof customElements>"u"||customElements.get(Yn)||customElements.define(Yn,Ot)}var Wo=/^[a-z]{1,3}_[\w.-]*$/i,Yo="{format}",Zo=["url","href","src","image"],Jo=/^https?:\/\//i,Jn=["src","data-src"],Qn=["srcset","data-srcset"],Xe="data-prepr-asset",er=[...Jn,...Qn],Qo=["data-prepr-encoded","data-prepr-id","data-prepr-field","data-prepr-entry-id",Xe];function ei(e){try{return decodeURIComponent(e)}catch{return e}}function ti(e){return e===Yo||e.split(",").every(t=>Wo.test(t))}function Mt(e,t=0){if(!e||e.length>4096)return null;let n;try{n=new URL(e,"https://base.invalid")}catch{return null}if(n.protocol!=="https:"&&n.protocol!=="http:")return null;if(t===0)for(let s of Zo){let a=n.searchParams.get(s);if(a&&Jo.test(a))return Mt(a,1)}let r=n.pathname.split("/").filter(Boolean).map(ei),i=r.pop();if(!i)return null;let o=r.filter(s=>!ti(s));return o.push(i),o.length>=2?o.join("/"):null}function ni(e){let t=[],n=!0;for(let r of e.split(/\s+/)){if(!r)continue;if(!n){let o=r.indexOf(",");if(o===-1)continue;n=!0;let s=r.slice(o+1);if(!s)continue;t.push(s.replace(/,+$/,"")),n=s.endsWith(",");continue}let i=r.replace(/^,+|,+$/g,"");i&&t.push(i),n=r.endsWith(",")}return t}function tr(e){let t=new Map;for(let n of e){let r=Mt(n.key);r&&!t.has(r)&&t.set(r,n)}return t}function ri(e){let t=[],n=i=>{for(let o of Jn){let s=i.getAttribute(o);s&&t.push(s)}for(let o of Qn){let s=i.getAttribute(o);s&&t.push(...ni(s))}};n(e);let r=e.parentElement;if(r?.tagName==="PICTURE")for(let i of r.children)i.tagName==="SOURCE"&&n(i);return t}function oi(e,t,n){for(let r of ri(e)){let i=n.get(r);i===void 0&&(i=Mt(r),n.set(r,i));let o=i?t.get(i):void 0;if(o)return o}}function we(e,t,n){n===null?e.hasAttribute(t)&&e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function nr(e){for(let t of Qo)e.removeAttribute(t)}function rr(e,t,n){for(let r of document.getElementsByTagName("img")){let i=r.hasAttribute(Xe);if(!i&&r.hasAttribute("data-prepr-encoded"))continue;let o=e.size?oi(r,e,n):void 0;if(!o){i&&nr(r);continue}we(r,"data-prepr-encoded",""),we(r,Xe,""),we(r,"data-prepr-id",t),we(r,"data-prepr-field",o.field),we(r,"data-prepr-entry-id",o.entryId??null)}}function or(){document.querySelectorAll(`img[${Xe}]`).forEach(nr)}var ir=L("navigation-guard"),sr=e=>e.length>1&&e.endsWith("/")?e.slice(0,-1):e;function se(e){try{return new URL(e,document.baseURI)}catch{return null}}function qe(e){if(e.protocol!=="http:"&&e.protocol!=="https:")return!1;let t=window.location;return e.origin!==t.origin||sr(e.pathname)!==sr(t.pathname)}function It(e){if(!(e instanceof Element))return null;let t=e.closest("a[href]");if(!t||t.hasAttribute("download"))return null;let n=t.getAttribute("target");if(n&&n!=="_self")return null;let r=t.getAttribute("href")??"";if(r.startsWith("#"))return null;let i=se(r);return i&&qe(i)?i.href:null}function Rt(e,t){return e?.hasAttribute(t)?t==="formaction"?e.formAction:t==="formmethod"?e.formMethod:e.formTarget:null}function ii(e,t){let n=(Rt(t,"formmethod")??e.method).toLowerCase();if(n==="dialog")return null;let r=Rt(t,"formtarget")??e.target;if(r&&r!=="_self")return null;let i=se(Rt(t,"formaction")??(e.action||location.href));if(!i)return null;if(n==="get"){let o;try{o=new FormData(e,t)}catch{o=new FormData(e)}let s=new URLSearchParams;o.forEach((a,d)=>{s.append(d,typeof a=="string"?a:a.name)}),i.search=s.toString()}return i}function ar(e){let t=!1,n=null,r=null,i=null,o=null,s=f=>n===f.href,a=()=>t&&e.showsEditedContent(),d=f=>{ir.log("blocked navigation to",f),e.onBlocked(f)},c=f=>{if(f.defaultPrevented||!(f.target instanceof HTMLFormElement)||!a())return;let m=f.submitter??null,v=ii(f.target,m);!v||!qe(v)||s(v)||(f.preventDefault(),r={form:f.target,submitter:m,href:v.href},d(v.href))},u=f=>{let m=f;if(m.navigationType==="traverse"||m.navigationType==="reload"||!m.cancelable||m.hashChange||m.downloadRequest!==null||!a()||m.navigationType==="replace"&&m.destination.sameDocument)return;let v=se(m.destination.url);!v||!qe(v)||s(v)||(m.preventDefault(),d(v.href),m.destination.sameDocument&&window.location.reload())},g=()=>window.navigation;function l(){let f=history.pushState,m=function(v,b,_){if(a()&&o===m&&_!=null){let w=se(_);if(w&&qe(w)&&!s(w)){d(w.href),window.location.reload();return}}return f.call(this,v,b,_)};i=f,o=m,history.pushState=m}function p(){history.pushState===o&&i&&(history.pushState=i),i=null,o=null}return{start(){t||(t=!0,l(),window.addEventListener("submit",c),g()?.addEventListener("navigate",u))},stop(){t&&(t=!1,p(),window.removeEventListener("submit",c),g()?.removeEventListener("navigate",u),r=null)},isActive:a,block(f){d(f)},permit(f){n=se(f)?.href??null},allow(f){let m=se(f);if(!m||m.protocol!=="http:"&&m.protocol!=="https:"){ir.warn("ignored navigation to unsupported URL");return}n=m.href;let v=r;if(r=null,v&&v.href===m.href&&v.form.isConnected){try{v.form.requestSubmit(v.submitter??void 0)}catch{v.form.requestSubmit()}return}window.location.assign(m.href)}}}var Nt=L("visual-editor"),We="[data-prepr-encoded]",dr="data-prepr-reference",lr=`[${dr}]`,Dt="data-prepr-visual-editor",si=`${We}{cursor:pointer}html[data-prepr-ve-suspended] ${We}{cursor:auto}`,ai="data-prepr-ve-suspended",li=150,di=6,ci=2e3,pi={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","data-prepr-encoded",...er]};function ui(e){let t=e.getBoundingClientRect(),n=Math.max(0,(window.innerHeight-t.height)/2);window.scrollTo({top:Math.max(0,window.scrollY+t.top-n),behavior:"smooth"})}var fi=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function cr(e){let t=new oe,n=!1,r=null,i=e.locale??"en",o=!1,s=null,a=null,d=0,c=0,u=null,g=null,l=null,p=null,f=null,m=!1,v=new Map,b=new Map,_=ar({onBlocked:h=>e.onNavigationBlocked?.(h),showsEditedContent:()=>N()}),w=h=>h instanceof Element?h.closest(We):null,S=h=>be(h.getAttribute("data-prepr-field"),i),x=null,P=new Set,O=h=>{if(r===null)return!0;let E=h.getAttribute("data-prepr-id");return!E||E===r||P.has(E)},N=()=>{for(let h of document.querySelectorAll(We))if(O(h)&&fi(h))return!0;return!1},U=h=>{if(!x)return null;let E=h.getAttribute("data-prepr-id")??"";if(x.has(E))return E;let T=h.closest(lr);for(;T;){let k=T.getAttribute(dr)??"";if(x.has(k))return k;T=T.parentElement?.closest(lr)??null}return null},M=h=>O(h)?"current":x?U(h)?"referenced":null:"other",D=h=>{let E=U(h);return E?x?.get(E):void 0},et=(h,E)=>{if(E==="other")return`${S(h)} \xB7 ${X("visualEditor.otherItem",i)}`;if(E==="referenced"){let T=D(h);return`${T?`${be(T,i)} \u203A `:""}${S(h)} \xB7 ${X("visualEditor.linkedItem",i)}`}return S(h)},Y=h=>{o!==h&&(o=h,document.documentElement.toggleAttribute(ai,h),h&&t.setHover(null,""))},A=()=>{if(s=null,t.schedule(),o)return;let h=w(a),E=h===t.getSelectedTarget()?null:h;if(!E){t.setHover(null,"");return}let T=M(E);if(!T){t.setHover(null,"");return}t.setHover(E,et(E,T),{kind:T})},I=h=>{Y(h.altKey),a=h.target,d=h.clientX,c=h.clientY,s===null&&(s=requestAnimationFrame(A))},z=()=>{a=null,t.setHover(null,"")},$=h=>{if(h.altKey){let K=It(h.target);K&&_.isActive()&&_.permit(K);return}let E=w(h.target),T=E?M(E):null;if(!E||!T){if(nt(),h.ctrlKey||h.metaKey||h.shiftKey||!N())return;let K=It(h.target);if(!K)return;h.preventDefault(),_.isActive()&&(h.stopPropagation(),_.block(K));return}h.preventDefault(),h.stopPropagation();let k=Dr(E,h.target);T==="current"&&tt(k?.element??E,E,k?.index);let H=T==="referenced"?D(E):void 0,V=T==="referenced"?U(E):null;e.onEdit({...ve(E),...V&&{id:V},...k&&{block:k.index},...H&&{referenceField:H}})},F=h=>{h.key==="Alt"&&Y(h.type==="keydown"),h.type==="keydown"&&h.key==="Escape"&&nt()},G=()=>Y(!1),ae=()=>t.onScroll(),ee=()=>t.schedule(),Te=()=>t.schedule();function Dr(h,E){if(!(E instanceof Element))return null;let T=E.closest("li");if(!T||!h.contains(T)||!T.parentElement)return null;let k=Array.from(T.parentElement.children).filter(H=>H.tagName==="LI");return{element:T,index:k.indexOf(T)}}function qt(h,E){let T=h.querySelector("ul, ol");return T?Array.from(T.children).filter(H=>H.tagName==="LI")[E]??null:null}function tt(h,E,T){let k=E.getAttribute("data-prepr-entry-id");l={lookup:{field:E.getAttribute("data-prepr-field")??"",id:E.getAttribute("data-prepr-id")??void 0,...k&&{entryId:k},...T!==void 0&&{block:T}},label:E},t.setSelected(h,S(E)),t.getHoverTarget()===h&&t.setHover(null,"")}function nt(){l=null,t.setSelected(null,"")}function Hr(){if(!l||t.getSelectedTarget()?.isConnected&&l.label.isConnected)return;let E=mt(l.lookup);if(!E||!O(E)){t.setSelected(null,"");return}let{block:T}=l.lookup,k=T!==void 0?qt(E,T)??E:E;tt(k,E,T)}function Se(){b.size>ci&&b.clear(),rr(v,r,b)}let Br=()=>{u=null,v.size&&Se(),Hr();let h=t.getHoverTarget();if(h&&!h.isConnected){a=document.elementFromPoint(d,c),A();return}t.schedule()},Fr=()=>{u===null&&(!l&&!t.getHoverTarget()&&!v.size||(u=requestAnimationFrame(Br)))};function Vr(){if(document.querySelector(`style[${Dt}]`))return;let h=document.createElement("style");h.setAttribute(Dt,""),h.textContent=si,document.head.appendChild(h)}function Ur(){n||(n=!0,t.mount(),Vr(),document.addEventListener("pointermove",I,{passive:!0}),document.documentElement.addEventListener("pointerleave",z),document.addEventListener("click",$,{capture:!0}),window.addEventListener("keydown",F),window.addEventListener("keyup",F),window.addEventListener("blur",G),window.addEventListener("scroll",ae,{capture:!0,passive:!0}),window.addEventListener("resize",ee,{passive:!0}),document.addEventListener("transitionend",Te,{capture:!0,passive:!0}),document.addEventListener("animationend",Te,{capture:!0,passive:!0}),g=new MutationObserver(Fr),g.observe(document.body,pi),v.size&&Se(),Zt(),Nt.log("visual editor started"))}function $r(){n&&(n=!1,s!==null&&cancelAnimationFrame(s),u!==null&&cancelAnimationFrame(u),g?.disconnect(),g=null,Wt(),s=null,u=null,l=null,a=null,Y(!1),document.removeEventListener("pointermove",I),document.documentElement.removeEventListener("pointerleave",z),document.removeEventListener("click",$,{capture:!0}),window.removeEventListener("keydown",F),window.removeEventListener("keyup",F),window.removeEventListener("blur",G),window.removeEventListener("scroll",ae,{capture:!0}),window.removeEventListener("resize",ee),document.removeEventListener("transitionend",Te,{capture:!0}),document.removeEventListener("animationend",Te,{capture:!0}),document.querySelectorAll(`style[${Dt}]`).forEach(h=>h.remove()),t.unmount(),or(),_.stop(),Nt.log("visual editor stopped"))}function Wt(){p&&clearTimeout(p),p=null,f?.(),f=null}function jr(h){return Wt(),new Promise(E=>{let T=0,k=V=>{f=null,E(V)};f=()=>E(!1);let H=()=>{p=null;let V=mt(h);if(V){let K=h.block!==void 0?qt(V,h.block)??V:V;ui(K),n&&O(V)&&tt(K,V,h.block),k(!0);return}if(++T>=di){Nt.log("no element renders field",h.field),k(!1);return}p=setTimeout(H,li)};H()})}function zr(h,E,T){r=h,E?Yt(E,T):T&&(P=new Set(T)),n&&v.size&&Se();let k=t.getSelectedTarget(),H=k?w(k):null;H&&!O(H)&&nt()}function Gr(h){let E=v.size>0;v=tr(h),n&&(E||v.size)&&Se()}function Yt(h,E){E&&(P=new Set(E)),x=new Map;for(let{id:T,field:k}of h)x.has(T)||x.set(T,k)}function Kr(h){i=h}function Zt(){n&&m?_.start():_.stop()}function Xr(h){m=h,Zt()}return{start:Ur,stop:$r,setCurrentItem:zr,setReferences:Yt,setAssets:Gr,setLocale:Kr,focusField:jr,setNavigationGuard:Xr,allowNavigation:h=>_.allow(h)}}var Ye=L("create-preview"),gi=new WeakMap;function mi(){return{navigate:e=>window.location.assign(e),currentPath:()=>window.location.pathname+window.location.search}}function hi(e){try{let t=new URL(e,window.location.href);return t.protocol==="https:"||t.protocol==="http:"?t.href:null}catch{return null}}function vi(e){return[{_id:"all_other_users",name:"All other users"},...e]}function bi(e){let t=e?.locale;if(ne(t))return t;if(typeof navigator<"u"){let r=(Array.isArray(navigator.languages)&&navigator.languages.length?navigator.languages:[navigator.language]).filter(Boolean).map(i=>i.toLowerCase().split("-")[0]).find(ne);if(r)return r}return"en"}function pr(e={}){let{props:t,options:n}=e,r=e.navigation??mi();ln(n?.debug??!1);let i=()=>({destroy:()=>{}});if(typeof window>"u"||typeof document>"u")return i();let o=window.parent!==window,a=new URLSearchParams(window.location.search).get(rt)==="true";a&&Ye.log(`${rt}=true \u2014 no visible toolbar`);let d=(n?.ui??!0)&&!o&&!a,c=bi(n),u=Qt(n?.features),g=pe(Le)==="true",l=pe(le)==="true",p=u.segments?pe(de):null,f=u.abTesting?pe(ce):null,m=u.abTesting?t?.activeVariant??f:null,v=m==="A"||m==="B"?m:null,b=Sn({locale:c,features:u,segments:u.segments?vi(t?.segments??t?.data??[]):[],selectedSegment:u.segments?t?.activeSegment??p??null:null,selectedVariant:v,previewMode:g,toolbarOpen:l,isIframe:o}),_=null;d&&(Zn(),_=document.createElement("prepr-toolbar"),document.body.appendChild(_),_.connect(b,A=>X(A,c)));let w=u.editMode||o,S=({href:A,id:I,field:z,locale:$,block:F,entryId:G,referenceField:ae})=>{let ee=A?hi(A):null;if(A&&!ee){Ye.warn("ignored edit request with unsupported href scheme");return}o?R("field_edit_requested",{id:I,field:z,locale:$,...F!==void 0&&{block:F},...G&&{entryId:G},...ae&&{referenceField:ae}}):ee&&window.open(ee,"_blank","noopener,noreferrer")},x=o?cr({onEdit:S,locale:c,onNavigationBlocked:A=>R("navigation_blocked",{href:A})}):null,P=x??yt({tooltip:d,onEdit:S,locale:c}),O=yn({enabled:n?.autoClean});O.start();let N=An({store:b,features:u,editingEnabled:w,navigate:A=>r.navigate(A),currentPath:()=>r.currentPath(),reload:r.reload??(()=>window.location.reload()),stega:P}),U=b.get(),M=b.subscribe(A=>{let I=U;U=A,N(I,A)}),D=gn(b,{allowedEditorOrigins:n?.allowedEditorOrigins,onHandshake:({itemId:A,referencedIds:I,componentIds:z,uiLocale:$,navigationGuard:F,assets:G})=>{$&&x?.setLocale($),x?.setCurrentItem(A??null,I,z),x?.setNavigationGuard(F===!0),G&&x?.setAssets(G)},onAssets:A=>x?.setAssets(A),onAllowNavigation:A=>x?.allowNavigation(A),onReferences:(A,I)=>x?.setReferences(A,I),onScrollToField:({field:A,id:I,block:z,entryId:$,fieldById:F})=>{if(x){x.focusField({field:A,id:I,block:z,entryId:$,fieldById:F});return}_t({field:A,id:I})||Ye.log("no element on this page renders field",A)}});R("getScrollPosition",{value:0},{allowUntrustedTarget:!0}),o&&D.start();function et(){M(),P.stop(),O.stop(),o&&D.stop(),_?.remove(),Ye.log("preview destroyed")}let Y={destroy:et};return gi.set(Y,b),Y}function Ht(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var yi=3,Bt=50,fr=new Set(["__proto__","prototype","constructor"]),_i=/^https?:\/\//i,Ei=/^(?:url|href|src|link)$|(?:_url|Url)$/,wi=/[\t\n\r]/g,xi=/^(?:javascript|vbscript|data):/i;function gr(e){let t=e.replace(wi,""),n=0;for(;n<t.length&&t.charCodeAt(n)<=32;)n++;return!xi.test(t.slice(n))}function mr(e){return Ei.test(e)}function hr(e,t){return typeof t!="string"?!0:e==="url"?_i.test(t):!mr(e)||gr(t)}function Ft(e,t=0){if(e===null||Ht(e))return!0;if(t>=yi)return!1;if(Array.isArray(e))return t===0&&e.length<=Bt&&e.every(r=>Q(r)&&Ft(r,t+1));if(!Q(e))return!1;let n=Object.keys(e);return n.length>Bt?!1:n.every(r=>{if(fr.has(r))return!1;let i=e[r];return hr(r,i)?!Array.isArray(i)&&Ft(i,t+1):!1})}function vr(e,t){if(!Ft(t))return!1;let n=e.slice(e.lastIndexOf(".")+1);return typeof t!="string"||!mr(n)||gr(t)}var Ti=200;function br(e){if(!Array.isArray(e)||e.length>Ti)return null;let t=[];for(let n of e){if(!Q(n)||typeof n._id!="string"||!n._id)return null;let r={_id:n._id};if(typeof n.__typename=="string"&&(r.__typename=n.__typename),typeof n.body=="string"&&(r.body=n.body),(typeof n.format=="string"||n.format===null)&&(r.format=n.format),typeof n.typeName=="string"&&n.typeName.length<=200&&(r.typeName=n.typeName),n.fields!==void 0){if(!Q(n.fields)||!Vt(n.fields,0))return null;r.fields=n.fields}t.push(r)}return t}function Q(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype}var Si=6,Li=100;function Vt(e,t){if(e===null||Ht(e))return!0;if(t>=Si)return!1;if(Array.isArray(e))return e.length<=Bt&&e.every(r=>Ht(r)||Q(r)&&Vt(r,t+1));if(!Q(e))return!1;let n=Object.keys(e);return n.length>Li?!1:n.every(r=>{if(fr.has(r))return!1;let i=e[r];return hr(r,i)?Vt(i,t+1):!1})}var ur=1e3;function yr(e){if(!Q(e))return;let{item:t,field:n}=e;if(!(typeof t!="string"||!t||t.length>ur)&&!(typeof n!="string"||!n||n.length>ur))return{item:t,field:n}}var Ze=L("live-preview:bridge");function _r(e,t={}){let n=null,r=i=>{let o=i?.data;if(o?.event==="prepr:initVE"&&!n){lt(i.origin,t.allowedEditorOrigins?.())?n=i.origin:Ze.warn("ignored live preview handshake from origin",i.origin);return}let s=n??sn();if(!(!s||i.origin!==s)){if(o?.event==="prepr:fieldChange"){if(typeof o.itemId=="string"&&typeof o.field=="string"&&o.field&&vr(o.field,o.value)){let a=yr(o.edit);a?e.pushPatch(o.itemId,o.field,o.value,a):e.pushPatch(o.itemId,o.field,o.value)}else Ze.log("dropped malformed fieldChange",o);return}if(o?.event==="prepr:listChange"){let a=br(o.entries);typeof o.itemId=="string"&&typeof o.field=="string"&&o.field&&a?e.pushList(o.itemId,o.field,a):Ze.log("dropped malformed listChange",o);return}o?.event==="prepr:itemChanged"&&(typeof o.itemId=="string"?e.invalidate(o.itemId):Ze.log("dropped malformed itemChanged",o))}};return{start(){window.addEventListener("message",r),R("live_ready",t.strictMode?.()?{strictMode:!0}:void 0,{allowUntrustedTarget:!0})},stop(){window.removeEventListener("message",r)}}}var Ai=/^\d+$/,Er="data-prepr-live";function wr(e){return e.split(".").filter(t=>t&&t!=="items").map(t=>Ai.test(t)?String(Number.parseInt(t,10)):t).join(".")}function Ci(e){if(e.type!=="field")return[];let t=[{item:e.itemId,field:e.field}];return e.edit&&t.unshift(e.edit),t}function ki(e,t,n){let r=wr(n);return e.filter(i=>{if(i.getAttribute("data-prepr-id")!==t)return!1;let o=i.getAttribute("data-prepr-field");return o!==null&&wr(o)===r})}var Pi=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH","LINK","META","BASE","FORM","INPUT","BUTTON","TEXTAREA","SELECT"]),Oi=new Set(["A","ABBR","B","BLOCKQUOTE","BR","CODE","DEL","DIV","EM","H1","H2","H3","H4","H5","H6","HR","I","INS","LI","MARK","OL","P","PRE","S","SMALL","SPAN","STRONG","SUB","SUP","TABLE","TBODY","TD","TH","THEAD","TR","U","UL"]),Mi=/^(?:https?:|mailto:|tel:|\/|#|\.{0,2}\/|[^:]*$)/i;function Ri(e){let t=document.createElement("template");t.innerHTML=e;let n=document.createDocumentFragment(),r=(i,o)=>{for(let s of Array.from(i.childNodes)){if(s.nodeType===Node.TEXT_NODE){o.appendChild(document.createTextNode(s.textContent??""));continue}if(s.nodeType!==Node.ELEMENT_NODE)continue;let a=s,d=a.tagName.toUpperCase();if(Pi.has(d))continue;if(!Oi.has(d)){r(a,o);continue}let c=document.createElement(d.toLowerCase());if(d==="A"){let u=a.getAttribute("href")?.trim();u&&Mi.test(u.replace(/[\t\n\r]/g,""))&&c.setAttribute("href",u),a.getAttribute("target")==="_blank"&&(c.setAttribute("target","_blank"),c.setAttribute("rel","noopener noreferrer"))}r(a,c),o.appendChild(c)}};return r(t.content,n),n}var Ii=/^\s*<[a-z!/]/i;function Ni(e,t){if(!e.children.length)return e.textContent!==t&&(e.textContent=t),!0;for(let n of Array.from(e.childNodes)){let r=n.textContent??"";if(n.nodeType!==Node.TEXT_NODE||!r.trim())continue;let i=r.match(/^\s*/)[0]+t+r.match(/\s*$/)[0];return r!==i&&(n.textContent=i),!0}return!1}function xr(e,t=document){let n=Array.from(t.querySelectorAll("[data-prepr-encoded]")),r=0,i=0;for(let o of e){if(o.type!=="field"||typeof o.value!="string"){i++;continue}let s=[];for(let{item:d,field:c}of Ci(o))if(s=ki(n,d,c),s.length)break;let a=!1;for(let d of s){let c=d.closest(`[${Er}]`)?.getAttribute(Er);if(c!=="off")if(c==="html")d.replaceChildren(Ri(o.value)),a=!0;else{if(Ii.test(o.value))continue;Ni(d,o.value)&&(a=!0)}}a?r++:i++}return{applied:r,skipped:i}}var Di=L("live-preview");function xe(e){let t=new Map,n=new WeakSet,r=[];function i(o){if(o===null||typeof o!="object"||n.has(o))return;if(n.add(o),Array.isArray(o)){for(let a=0;a<o.length;a++)r.push(a),i(o[a]),r.pop();return}let s=o;if(typeof s._id=="string"){let a=t.get(s._id);a?a.push([...r]):t.set(s._id,[[...r]])}else typeof s.__typename=="string"&&Di.log("item without _id will not live-update",{__typename:s.__typename});for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r.push(a),i(s[a]),r.pop())}return i(e),t}var Hi=/(.)(?=[A-Z])/g;function Bi(e){return e.replace(Hi,"$1_").toLowerCase()}function Ut(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return t;let n=Bi(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}var Tr=[{name:"body",plain:!1},{name:"html",plain:!1},{name:"text",plain:!0}],Fi=/<[^>]+>/g;function $t(e){return e.replace(Fi,"")}function Sr(e){let t=e.__typename;return typeof t=="string"?t==="Text":"html"in e||"text"in e&&"format"in e}var Lr=/^\d+$/,Qe=new Set(["__proto__","prototype","constructor"]);function B(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function jt(e,t){let n=!1,r={...e};for(let i of Object.keys(e)){if(!(i in t)||t[i]===void 0)continue;let o=B(e[i])&&B(t[i])?jt(e[i],t[i]):t[i];o!==e[i]&&(r[i]=o,n=!0)}return n?r:e}function Ar(e,t){let n={};for(let r of Object.keys(e)){let i=t[r];n[r]=i===void 0?null:B(e[r])&&B(i)?Ar(e[r],i):i}return n}function Vi(e,t){if(t===null||Array.isArray(t)&&!t.length)return Array.isArray(e)?e.length?[]:e:null;let n=Array.isArray(t)?t:[t];if(e==null)return t;if(Array.isArray(e)){let r=e.find(B);return n.map(i=>{let o=e.find(s=>B(s)&&s._id!==void 0&&s._id===i._id);return B(o)?jt(o,i):B(r)?Ar(r,i):i})}return B(e)?jt(e,n[0]):e}function Ui(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Je(e){return Array.isArray(e)?[...e]:{...e}}function zt(e,t,n,r,i){let o=t.get(n);if(!o?.length)return e;let s=e,a=!1,d=()=>{a=!0};for(let c of o)for(let[u,g]of $i(s,c,r,i))s=ji(s,c,u,g,d);return a?s:e}function $i(e,t,n,r){let i=n.split(".");if(i[i.length-1]!=="body"||typeof r!="string")return[[n,r]];let o=e;for(let c of t)o=o[c];for(let c of i.slice(0,-1)){if(o===null||typeof o!="object")return[[n,r]];let u=o;o=Lr.test(c)?u[Number(c)]:u[Ut(u,c)??c]}if(o===null||typeof o!="object"||Array.isArray(o))return[[n,r]];let s=o;if(!Sr(s))return[[n,r]];let a=i.slice(0,-1),d=[];for(let{name:c,plain:u}of Tr)c in s&&d.push([[...a,c].join("."),u?$t(r):r]);return d.length?d:[[n,r]]}function ji(e,t,n,r,i){let o=n.split(".");if(o.some(d=>Qe.has(d)))return e;let s=e;for(let d of t)s=s[d];let a=[...t];for(let d of o){let c=d;Lr.test(d)?c=Number(d):s!==null&&typeof s=="object"&&(c=Ut(s,d)??d),a.push(c),s=s!==null&&typeof s=="object"?s[c]:void 0}return zi(e,a,r,i)}function zi(e,t,n,r=()=>{}){if(!t.length||t.some(g=>Qe.has(String(g))))return e;let i=t.length-1,o=e;for(let g=0;g<i;g++){if(o===null||typeof o!="object")return e;o=o[t[g]]}if(o===null||typeof o!="object")return e;let s=o,a=t[i];if(!(a in s))return e;let d;if(n===null||typeof n=="object")d=Vi(s[a],n);else if(Ui(s[a]))d=qi(s[a],n);else return e;if(s[a]===d)return e;let c=Je(e),u=c;for(let g=0;g<i;g++){let l=Je(u[t[g]]);u[t[g]]=l,u=l}return u[a]=d,r(),c}function Gi(e){if(!B(e))return[];let t=[];typeof e._id=="string"&&t.push(e._id);let n=Array.isArray(e.items)?e.items[0]:null;return B(n)&&typeof n._id=="string"&&t.push(n._id),t}function Ki(e,t){let n=typeof e.body=="string"?e.body:"",r={__typename:"Text",_id:e._id,body:n,html:n,text:$t(n),format:e.format??null};if(!t)return r;let i={};for(let o of Object.keys(t))i[o]=o in r?r[o]:null;return i}function Cr(e,t,n){if(e==null){let a=Cr([],t,n);return a.length?a:e}if(!Array.isArray(e))return e;let r=new Map,i=new Map;for(let a of e){for(let d of Gi(a))r.set(d,a);B(a)&&typeof a.__typename=="string"&&(i.has(a.__typename)||i.set(a.__typename,a))}if(!t.length)return e.length?[]:e;if(e.length&&!r.size||e.length&&!t.some(a=>r.has(a._id)))return e;let o=[];for(let a of t){let d=r.get(a._id),c=d===void 0&&a.fields?n?.(a):void 0;d!==void 0?o.push(d):c?o.push(c):a.__typename==="Text"&&o.push(Ki(a,i.get("Text")))}return o.length===e.length&&o.every((a,d)=>a===e[d])?e:o}function Gt(e,t,n,r,i){let o=t.get(n);if(!o?.length)return e;let s=r.split(".");if(s.some(d=>Qe.has(d)))return e;let a=e;for(let d of o)a=Xi(a,[...d,...s],i);return a}function Xi(e,t,n,r){if(!t.length||t.some(d=>Qe.has(String(d))))return e;let i=e;for(let d of t)i=i!==null&&typeof i=="object"?i[d]:void 0;let o=Cr(i,n,r);if(o===i)return e;let s=Je(e),a=s;for(let d=0;d<t.length-1;d++){let c=Je(a[t[d]]);a[t[d]]=c,a=c}return a[t[t.length-1]]=o,s}function qi(e,t){if(typeof e!="string"||typeof t!="string")return t;let{encoded:n}=Z(e);return!n||Z(t).encoded?t:t+n}var Wi=L("live-preview"),Yi=150,Zi=500;function Ji(e,t){let n=-1;for(let s=e.length-1;s>=0;s--){let a=e[s];if(a.type===t.type&&a.itemId===t.itemId&&a.field===t.field){n=s;break}}if(n===-1)return[...e,t];let r=e.slice(n+1),i=`${t.field}.`;return r.some(s=>s.type==="list"||t.type==="list"&&s.itemId===t.itemId&&s.field.startsWith(i))?[...e,t]:[...e.slice(0,n),...r,t]}function kr(e={}){let t=l=>e.accept?e.accept(l):!0,n=new Set,r=new Set,i=new Map,o=null,s=[],a=new Set;function d(l){s=Ji(s,l).slice(-Zi),a.forEach(p=>p(s))}function c(l){l.listeners.forEach(p=>p())}async function u(l){let p=l.opts.fetcher??o;if(!p||l.opts.query==null)return;let f=++l.fetchToken;try{let m=await p(l.opts.query,l.opts.variables);if(f!==l.fetchToken||!n.has(l))return;l.snapshot=m,l.index=xe(m),c(l)}catch(m){Wi.log("refetch failed, keeping previous snapshot",m)}}function g(l){i.delete(l),r.forEach(p=>p(l));for(let p of n)p.index.has(l)&&u(p)}return{register(l,p={}){let f={snapshot:l,index:xe(l),opts:p,listeners:new Set,fetchToken:0};for(let m of s)if(m.type==="field")f.snapshot=zt(f.snapshot,f.index,m.itemId,m.field,m.value);else{let v=Gt(f.snapshot,f.index,m.itemId,m.field,m.entries);v!==f.snapshot&&(f.snapshot=v,f.index=xe(v))}return n.add(f),{getSnapshot:()=>f.snapshot,subscribe(m){return f.listeners.add(m),()=>f.listeners.delete(m)},unregister(){f.listeners.clear(),n.delete(f)}}},pushPatch(l,p,f,m){let v=m?{type:"field",itemId:l,field:p,value:f,edit:m}:{type:"field",itemId:l,field:p,value:f};if(t(v)){d(v);for(let b of n){let _=zt(b.snapshot,b.index,l,p,f);_!==b.snapshot&&(b.snapshot=_,c(b))}}},pushList(l,p,f){let m={type:"list",itemId:l,field:p,entries:f};if(t(m)){d(m);for(let v of n){let b=Gt(v.snapshot,v.index,l,p,f);b!==v.snapshot&&(v.snapshot=b,v.index=xe(b),c(v))}}},invalidate(l){s.length&&(s=[],a.forEach(f=>f(s)));let p=i.get(l);p&&clearTimeout(p),i.set(l,setTimeout(()=>g(l),Yi))},setFetcher(l){o=l},onInvalidate(l){return r.add(l),()=>r.delete(l)},getLog:()=>s,onLogChange(l){return a.add(l),()=>a.delete(l)}}}function Kt(e,t){ns(e,t),os(e,t)}var Qi="data-prepr-morph-skip",es=["data-prepr-"];function ts(e){return es.some(t=>e.startsWith(t))}function ns(e,t){for(let{name:n}of Array.from(e.attributes))!t.hasAttribute(n)&&!ts(n)&&e.removeAttribute(n);for(let{name:n,value:r}of Array.from(t.attributes))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Pr(e){return e.nodeType===Node.ELEMENT_NODE&&(e.hasAttribute(Qi)||e.localName==="prepr-toolbar")}function rs(e,t){if(e.nodeType!==t.nodeType)return!1;if(e.nodeType!==Node.ELEMENT_NODE)return!0;let n=e,r=t;return n.localName===r.localName&&n.id===r.id}function os(e,t){let n=Array.from(t.childNodes).filter(i=>!Pr(i)),r=Array.from(e.childNodes).filter(i=>!Pr(i));n.forEach((i,o)=>{let s=r[o];if(s&&rs(s,i)){if(s.nodeType===Node.ELEMENT_NODE){let d=s;if(d.localName==="script")return;if(d.localName==="astro-island"&&!d.isEqualNode(i)){d.replaceWith(Or(i,e));return}Kt(d,i)}else s.nodeValue!==i.nodeValue&&(s.nodeValue=i.nodeValue);return}let a=Or(i,e);s?s.replaceWith(a):e.appendChild(a)});for(let i of r.slice(n.length))i.remove()}function Or(e,t){let n=t.ownerDocument.importNode(e,!0);if(n.nodeType===Node.ELEMENT_NODE){let r=n;(r.localName==="script"?[r]:Array.from(r.querySelectorAll("script"))).forEach(o=>o.setAttribute("data-prepr-morphed",""))}return n}var is=L("live-preview:html"),ss=/<\/html>\s*$/i,as=150;function Mr(e={}){if(typeof window>"u"||window.self===window.top)return{stop(){}};let t=kr(),n=_r(t,{allowedEditorOrigins:()=>e.allowedEditorOrigins,strictMode:()=>e.strictMode});n.start();let r=null,i=!1,o=null,s=!1,a=async l=>{i=!0;try{let p=await fetch(window.location.href,{method:l.length?"POST":"GET",headers:l.length?{"Content-Type":"application/json",[Jt]:"1"}:{},body:l.length?JSON.stringify({log:l}):void 0,credentials:"same-origin",cache:"no-store"});if(!p.ok)throw new Error(`HTTP ${p.status}`);let f=await p.text();if(s)return;if(!ss.test(f))throw new Error("incomplete page; a component failed to render");let m=new DOMParser().parseFromString(f,"text/html");m.title&&m.title!==document.title&&(document.title=m.title),Kt(document.body,m.body)}catch(p){is.log("re-render failed",p)}finally{i=!1}if(o&&!s){let p=o;o=null,a(p)}},d=l=>{r&&clearTimeout(r),r=setTimeout(()=>{r=null,i?o=l:a(l)},as)},c=e.apply??"server",u=t.onLogChange(l=>{if(l.length){if(c==="server"){d(l);return}xr(l)}}),g=t.onInvalidate(()=>d([]));return{stop(){s=!0,r&&clearTimeout(r),u(),g(),n.stop()}}}var Ir=L("auto"),ls="script[data-prepr-toolbar-props]";function Rr(){let e=document.querySelector(ls);if(!e?.textContent)return null;try{let t=JSON.parse(e.textContent);return t&&typeof t=="object"?t:null}catch{return Ir.warn("could not read the toolbar props"),null}}function Xt(){if(typeof window>"u"||typeof document>"u")return()=>{};let e=Rr();if(!e)return()=>{};let t=window.self!==window.top,n=e,r=null,i=null,o=document.body,s=()=>{r=pr({props:n.props,options:n.options}),o=document.body,u()};n.live!==!1&&(i=Mr({allowedEditorOrigins:n.options?.allowedEditorOrigins,strictMode:n.options?.strictMode,apply:n.live??"dom"}));let a=()=>{if(t){window.location.reload();return}Ir.log("page swapped; starting the preview again"),r?.destroy(),n=Rr()??n,s()},d=new MutationObserver(()=>{document.body&&document.body!==o&&a()});d.observe(document.documentElement,{childList:!0});let c=null;function u(){c?.disconnect();let g=o.querySelector(":scope > prepr-toolbar");g&&(c=new MutationObserver(()=>{g.isConnected||a()}),c.observe(o,{childList:!0}))}return s(),()=>{d.disconnect(),c?.disconnect(),r?.destroy(),i?.stop()}}function Nr(){window.__preprAutoStarted||(window.__preprAutoStarted=!0,Xt())}typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Nr,{once:!0}):Nr());export{Xt as startPreprAuto};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VERSION
|
|
3
|
+
} from "./chunk-UK664KSV.js";
|
|
4
|
+
|
|
5
|
+
// src/core/pixel.ts
|
|
6
|
+
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
|
7
|
+
var CACHE_BUST_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
8
|
+
var warnedNoPixel = false;
|
|
9
|
+
function warnNoPixelOnce() {
|
|
10
|
+
if (warnedNoPixel) return;
|
|
11
|
+
warnedNoPixel = true;
|
|
12
|
+
console.warn(
|
|
13
|
+
"[Prepr] Tracking pixel is not installed. Call loadTrackingPixel() first, or ensure the legacy Prepr snippet is present on the page."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
function loadTrackingPixel(trackingId, config) {
|
|
17
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (window.prepr) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const queueFn = ((...args) => {
|
|
24
|
+
if (queueFn.process) {
|
|
25
|
+
queueFn.process(...args);
|
|
26
|
+
} else {
|
|
27
|
+
queueFn.queue.push(args);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
queueFn.queue = [];
|
|
31
|
+
queueFn.t = Date.now();
|
|
32
|
+
window.prepr = queueFn;
|
|
33
|
+
const script = document.createElement("script");
|
|
34
|
+
script.async = true;
|
|
35
|
+
const cacheBuster = Math.ceil(Date.now() / CACHE_BUST_INTERVAL_MS) * CACHE_BUST_INTERVAL_MS;
|
|
36
|
+
script.src = `${PIXEL_SCRIPT_URL}?t=${cacheBuster}`;
|
|
37
|
+
const firstScript = document.getElementsByTagName("script")[0];
|
|
38
|
+
if (firstScript?.parentNode) {
|
|
39
|
+
firstScript.parentNode.insertBefore(script, firstScript);
|
|
40
|
+
} else {
|
|
41
|
+
document.head.appendChild(script);
|
|
42
|
+
}
|
|
43
|
+
if (config !== void 0) {
|
|
44
|
+
queueFn("init", trackingId, config);
|
|
45
|
+
} else {
|
|
46
|
+
queueFn("init", trackingId);
|
|
47
|
+
}
|
|
48
|
+
queueFn("param", "pp", VERSION);
|
|
49
|
+
queueFn("event", "pageload");
|
|
50
|
+
}
|
|
51
|
+
function trackEvent(name, data) {
|
|
52
|
+
if (typeof window === "undefined" || !window.prepr) {
|
|
53
|
+
warnNoPixelOnce();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (data !== void 0) {
|
|
57
|
+
window.prepr("event", name, data);
|
|
58
|
+
} else {
|
|
59
|
+
window.prepr("event", name);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function setTrackingParam(key, value) {
|
|
63
|
+
if (typeof window === "undefined" || !window.prepr) {
|
|
64
|
+
warnNoPixelOnce();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
window.prepr("param", key, value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
loadTrackingPixel,
|
|
72
|
+
trackEvent,
|
|
73
|
+
setTrackingParam
|
|
74
|
+
};
|