payload-live-preview 2.1.2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +191 -62
  2. package/dist/adapters/astro/index.d.ts +7 -7
  3. package/dist/adapters/astro/index.js +1 -1
  4. package/dist/adapters/astro/index.js.map +1 -1
  5. package/dist/adapters/astro/middleware-entry.d.ts +3 -3
  6. package/dist/adapters/astro/middleware-entry.js +1 -1
  7. package/dist/adapters/astro/middleware-entry.js.map +1 -1
  8. package/dist/adapters/nextjs/index.d.ts +2 -2
  9. package/dist/adapters/nextjs/index.js +1 -1
  10. package/dist/adapters/nextjs/index.js.map +1 -1
  11. package/dist/adapters/nuxt/index.d.ts +4 -4
  12. package/dist/adapters/nuxt/index.js +1 -1
  13. package/dist/adapters/nuxt/index.js.map +1 -1
  14. package/dist/adapters/nuxt/module.d.ts +1 -1
  15. package/dist/adapters/react/index.d.ts +2 -2
  16. package/dist/adapters/react/index.js +1 -1
  17. package/dist/adapters/react/index.js.map +1 -1
  18. package/dist/adapters/sveltekit/index.d.ts +5 -5
  19. package/dist/adapters/sveltekit/index.js +1 -1
  20. package/dist/adapters/sveltekit/index.js.map +1 -1
  21. package/dist/adapters/vue/index.d.ts +2 -2
  22. package/dist/adapters/vue/index.js +1 -1
  23. package/dist/adapters/vue/index.js.map +1 -1
  24. package/dist/annotate.d.ts +22 -15
  25. package/dist/annotate.js +1 -1
  26. package/dist/annotate.js.map +1 -1
  27. package/dist/client.cjs +1 -1
  28. package/dist/client.cjs.map +1 -1
  29. package/dist/client.d.cts +114 -114
  30. package/dist/client.d.ts +114 -114
  31. package/dist/client.js +1 -1
  32. package/dist/client.js.map +1 -1
  33. package/dist/codegen-cli.js +1 -1
  34. package/dist/codegen-cli.js.map +1 -1
  35. package/dist/codegen.cjs +1 -1
  36. package/dist/codegen.cjs.map +1 -1
  37. package/dist/codegen.d.cts +14 -16
  38. package/dist/codegen.d.ts +14 -16
  39. package/dist/codegen.js +1 -1
  40. package/dist/codegen.js.map +1 -1
  41. package/dist/core.cjs +1 -1
  42. package/dist/core.cjs.map +1 -1
  43. package/dist/core.d.cts +178 -172
  44. package/dist/core.d.ts +178 -172
  45. package/dist/core.js +1 -1
  46. package/dist/core.js.map +1 -1
  47. package/dist/doctor-cli.d.ts +1 -1
  48. package/dist/doctor-cli.js +1 -1
  49. package/dist/doctor-cli.js.map +1 -1
  50. package/dist/doctor.d.ts +15 -2
  51. package/dist/doctor.js +1 -1
  52. package/dist/doctor.js.map +1 -1
  53. package/dist/{document-session-DWi9H3Qk.d.ts → document-session-Bkd181PV.d.ts} +3 -2
  54. package/dist/{fragment-endpoint-B2qcRw5T.d.ts → fragment-endpoint-DGGLIijM.d.ts} +1 -1
  55. package/dist/fragment.cjs.map +1 -1
  56. package/dist/fragment.d.cts +3 -3
  57. package/dist/fragment.d.ts +3 -3
  58. package/dist/fragment.js.map +1 -1
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +183 -177
  62. package/dist/index.d.ts +183 -177
  63. package/dist/index.js +1 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/lean.cjs +1 -1
  66. package/dist/lean.cjs.map +1 -1
  67. package/dist/lean.js +1 -1
  68. package/dist/lean.js.map +1 -1
  69. package/dist/lexical.cjs +1 -1
  70. package/dist/lexical.cjs.map +1 -1
  71. package/dist/lexical.js +1 -1
  72. package/dist/lexical.js.map +1 -1
  73. package/dist/{locals-B1mF3aTb.d.ts → locals-zz2gi9dj.d.ts} +1 -1
  74. package/dist/{middleware-BGobLN9P.d.ts → middleware-CI-UTf6R.d.ts} +2 -2
  75. package/dist/{options-Cm8fC7dj.d.ts → options-CnYybG51.d.ts} +8 -0
  76. package/dist/plugins.cjs +1 -1
  77. package/dist/plugins.cjs.map +1 -1
  78. package/dist/plugins.d.cts +3 -3
  79. package/dist/plugins.d.ts +3 -3
  80. package/dist/plugins.js +1 -1
  81. package/dist/plugins.js.map +1 -1
  82. package/dist/{probe-DGPDsnbj.d.ts → probe-D-IHg9dF.d.ts} +3 -3
  83. package/dist/structural.cjs +2 -2
  84. package/dist/structural.cjs.map +1 -1
  85. package/dist/structural.d.cts +27 -27
  86. package/dist/structural.d.ts +27 -27
  87. package/dist/structural.js +2 -2
  88. package/dist/structural.js.map +1 -1
  89. package/package.json +11 -6
package/dist/lexical.js CHANGED
@@ -1,2 +1,2 @@
1
- function e(e,t){if(!function(){try{const e=globalThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;const n=globalThis,r=n.__payloadLivePreviewDeprecationsWarned??=/* @__PURE__ */new Set;if(!r.has(e)){r.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}var t=/* @__PURE__ */Symbol.for("payload-live-preview.trusted-types");function n(e){const n=function(){const e=function(){const e=globalThis,n=e[t];if(void 0!==n)return n;const r={};return e[t]=r,r}();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;const n=function(){const e=globalThis.trustedTypes;if("object"==typeof e&&null!==e)return"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===n?null:n.createPolicy("payload-live-preview",{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===n?e:n.createHTML(e)}var r=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:"]),o=/^(?:\.{1,2}\/|[a-zA-Z0-9_-]+\/?)/,i=/^[\\/]{2}/,a=/[\t\n\r]/g,l=/[\s\u0000-\u001f\u180e\u2000-\u2029]/g,s=/^([a-z][a-z0-9+.-]*):/i;function isSafeUrl(e){if("string"!=typeof e)return!1;const t=e.trim().replace(a,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?"))return!0;if(i.test(t))return!0;if(t.startsWith("/"))return!0;try{const e=new URL(t);return r.has(e.protocol)}catch{return o.test(t)&&!function(e){const t=s.exec(e.replace(l,""))?.[1];return void 0!==t&&!r.has(`${t.toLowerCase()}:`)}(t)}}function isExternalHttpUrl(e){const t=e.trim().replace(a,"");return/^https?:\/\//i.test(t)||i.test(t)}var c=/* @__PURE__ */new Set;function u(e){c.has(e)||(c.add(e),function(e){try{console.warn(e)}catch{}}(`[live-preview] LP0409: the strict sanitizer removed \`${e}\` from written markup; the 1.x default (\`sanitizerPolicy: 'compat'\`) kept it. ${function(e){return e.startsWith("data-payload-")?"A binding inside CMS content is refused by design — an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name — DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: 'compat'` to keep every `data-*` as 1.x did"}(e)}.`))}var d=/* @__PURE__ */new Set(["p","br","strong","b","em","i","u","s","strike","mark","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","blockquote","code","pre","kbd","samp","var","a","span","div","section","article","aside","header","footer","nav","figure","figcaption","img","picture","source","audio","video","sub","sup","hr","time","abbr","cite","q","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col"]),p=/* @__PURE__ */new Set(["input","button","textarea","select","option","label"]),f=/* @__PURE__ */new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),m=/* @__PURE__ */new Set(["id","class","lang","dir","title","role","tabindex"]),h="aria-",g="data-",b={a:/* @__PURE__ */new Set(["href","target","rel","download","hreflang","type"]),img:/* @__PURE__ */new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),picture:/* @__PURE__ */new Set([]),source:/* @__PURE__ */new Set(["src","srcset","sizes","type","media"]),audio:/* @__PURE__ */new Set(["src","controls","autoplay","loop","muted","preload"]),video:/* @__PURE__ */new Set(["src","poster","controls","autoplay","loop","muted","preload","width","height","playsinline"]),time:/* @__PURE__ */new Set(["datetime"]),abbr:/* @__PURE__ */new Set(["title"]),q:/* @__PURE__ */new Set(["cite"]),blockquote:/* @__PURE__ */new Set(["cite"]),table:/* @__PURE__ */new Set(["summary"]),th:/* @__PURE__ */new Set(["colspan","rowspan","scope","headers","abbr"]),td:/* @__PURE__ */new Set(["colspan","rowspan","headers"]),col:/* @__PURE__ */new Set(["span"]),colgroup:/* @__PURE__ */new Set(["span"]),ol:/* @__PURE__ */new Set(["start","reversed","type"]),li:/* @__PURE__ */new Set(["value"]),code:/* @__PURE__ */new Set(["class"]),pre:/* @__PURE__ */new Set(["class"])},y=/* @__PURE__ */new Set(["href","src","cite","poster"]),$=class extends Error{name="SanitizerEnvironmentError"},v=/* @__PURE__ */new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"]),w=/* @__PURE__ */Symbol.for("payload-live-preview.sanitizer-document");function setSanitizerDocument(t){e("set-sanitizer-document","`setSanitizerDocument()` is removed in 3.0: pass the document per call, `sanitizeHtml(html, { document })` or `lexicalToHtml(content, { document })` (ADR 0026)."),globalThis[w]=t??void 0}function sanitizeHtml(t,r){return function(t,r,o){const i=o?.document??S();if(!i)throw"undefined"!=typeof __INLINE_BUILD__&&__INLINE_BUILD__?new Error("sanitizeHtml needs a DOM"):new $("sanitizeHtml needs a DOM; pass one per call during SSR: { document } (linkedom, jsdom).");if(""===t)return"";const a=function(e,t){const n=e?.policy??t??"strict";if(!e){const e=/* @__PURE__ */new Map;for(const[t,n]of Object.entries(b))e.set(t,n);return{allowedTags:d,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:n,allowedData:/* @__PURE__ */new Set}}const r=new Set(d);if(e.additionalAllowedTags?.forEach(e=>r.add(e)),!0===e.allowFormControls)for(const e of p)r.add(e);const o=/* @__PURE__ */new Map;for(const[e,t]of Object.entries(b))o.set(e,t);for(const[t,n]of Object.entries(e.additionalAllowedAttributes??{})){const e=new Set(o.get(t));for(const t of n)e.add(t);o.set(t,e)}return{allowedTags:r,attrByTag:o,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:n,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(o,void 0);let l=t;for(let e=0;e<6;e+=1){const e=i.createElement("template");e.innerHTML=n(l),k(e.content,a);const t=e.innerHTML;if(t===l)return t;l=t}return e("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(6)} passes, so it returned an empty string (ADR 0016).`),""}(t,0,r)}function S(){if("undefined"==typeof __INLINE_BUILD__||!__INLINE_BUILD__){const e=globalThis[w];if(e)return e}if("undefined"!=typeof document)return document}function k(e,t){for(const n of Array.from(e.childNodes))1===n.nodeType?H(n,t):8===n.nodeType&&n.remove()}function H(e,t){const n=e.tagName.toLowerCase();if(!f.has(n)||t.allowFormControls&&p.has(n)){if(!t.allowedTags.has(n))return k(e,t),void e.replaceWith(...e.childNodes);!function(e,t,n){const r=n.attrByTag.get(t);for(const t of Array.from(e.attributes)){const o=t.name.toLowerCase();if(o.startsWith("on")||"style"===o)e.removeAttribute(t.name);else if("is"!==o){if("strict"===n.mode){if(n.templateMode&&v.has(o))continue;if("id"===o||"name"===o||o.startsWith("data-payload-")){e.removeAttribute(t.name),"name"===o&&!0!==r?.has(o)||u(o);continue}if(o.startsWith(g)){n.allowedData.has(o)||(e.removeAttribute(t.name),u(o));continue}if(m.has(o)||o.startsWith(h))continue}else if(m.has(o)||o.startsWith(h)||o.startsWith(g))continue;r?.has(o)?y.has(o)&&!isSafeUrl(t.value)?e.removeAttribute(t.name):"srcset"!==o||T(t.value)||e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,n,t),"a"===n&&function(e){const t=e.getAttribute("href");null!==t&&isExternalHttpUrl(t)&&(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),k(e,t)}else e.remove()}function T(e){for(const t of e.split(",")){const e=t.trim();if(0===e.length)continue;const[n=e]=e.split(/\s/,1);if(!isSafeUrl(n)||!isSafeUrl(e))return!1}return!0}var A=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"}),_=/[&<>"'/`=]/g;function escapeHtml(e){return e.replace(_,e=>A[e])}var C=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}),L=/[&<>"']/g;function escapeHtmlAttribute(e){return e.replace(L,e=>C[e])}var x={BOLD:1,ITALIC:2,STRIKETHROUGH:4,UNDERLINE:8,CODE:16,SUBSCRIPT:32,SUPERSCRIPT:64,HIGHLIGHT:128},U={1:"left",2:"center",3:"right",4:"justify"},z=/* @__PURE__ */new Set(["left","center","right","justify","start","end"]);function I(e){const t=e.format;return"string"==typeof t&&z.has(t)?t:"number"==typeof t?U[t]:void 0}function D(e){const t=e.indent;return"number"==typeof t&&t>0?t:0}function E(e){return"rtl"===e.direction?' dir="rtl"':"ltr"===e.direction?' dir="ltr"':""}function B(e){const t=I(e),n=D(e),r=[];return void 0!==t&&r.push(`lp-align-${t}`),n>0&&r.push(`lp-indent-${String(n)}`),0===r.length?"":` class="${r.join(" ")}"`}var M=/* @__PURE__ */new Set(["h1","h2","h3","h4","h5","h6"]);function N(e){return"object"==typeof e&&null!==e?e:void 0}function j(e){return N(e)}function R(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function O(e){return"string"==typeof e&&e.length>0?e:void 0}var W=' target="_blank" rel="noopener noreferrer"',P=(e,t)=>{const n=t.renderChildren(e.children??[]),r=N(e.fields),o=function(e,t){if("internal"===t?.linkType)return function(e){const t=N(N(e)?.value),n=t?.url;if("string"==typeof n&&n.length>0)return n;const r=t?.slug;return"string"==typeof r&&r.length>0?`/${r}`:void 0}(t.doc);const n=t?.url??e.url;return"string"==typeof n&&n.length>0?n:void 0}(e,r);if(void 0===o||!isSafeUrl(o))return n;const i="string"==typeof e.title?` title="${escapeHtml(e.title)}"`:"";return`<a href="${escapeHtmlAttribute(o)}"${function(e,t,n){if(!0===t?.newTab||isExternalHttpUrl(n))return W;const r="string"==typeof e.target?e.target:"";return""===r?"":"_blank"===r?W:` target="${escapeHtml(r)}"`}(e,r,o)}${i}>${n}</a>`};function q(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(const n of e.children)t+=q(n);return t}function F(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function G(e){return"string"==typeof e.mimeType?` type="${escapeHtmlAttribute(e.mimeType)}"`:""}var K=/* @__PURE__ */new Map;function Z(e,t){K.set(e,t)}function V(e){return K.get(e)}function J(){return[...K.keys()]}function Q(e,t,n,r){const o=N(e.fields)??{},i="string"==typeof o.blockType?o.blockType:"",a=R(i),l=""===a?r:`${r} ${r}--${a}`;if(""!==i){const e=V(i)??V(a);if(e)return e(o,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(i,l)}return`<${n} class="${l}"></${n}>`}function X(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}var Y={text:e=>{let t=escapeHtml("string"==typeof e.text?e.text:"");const n="number"==typeof e.format?e.format:0;return 0!==(n&x.CODE)&&(t=`<code>${t}</code>`),0!==(n&x.BOLD)&&(t=`<strong>${t}</strong>`),0!==(n&x.ITALIC)&&(t=`<em>${t}</em>`),0!==(n&x.UNDERLINE)&&(t=`<u>${t}</u>`),0!==(n&x.STRIKETHROUGH)&&(t=`<s>${t}</s>`),0!==(n&x.SUBSCRIPT)&&(t=`<sub>${t}</sub>`),0!==(n&x.SUPERSCRIPT)&&(t=`<sup>${t}</sup>`),0!==(n&x.HIGHLIGHT)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<p${E(e)}${B(e)}>${n}</p>`},heading:(e,t)=>{const n="string"==typeof e.tag?e.tag.toLowerCase():"h2",r=M.has(n)?n:"h2",o=t.renderChildren(e.children??[]);return`<${r}${E(e)}${B(e)}>${o}</${r}>`},list:(e,t)=>{const n="string"==typeof e.listType?e.listType:"bullet",r="number"===n?"ol":"ul",o="number"===n&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",i="check"===n?' role="list"':"",a=t.renderChildren(e.children??[]);return`<${r}${E(e)}${B(e)}${o}${i}>${a}</${r}>`},listitem:(e,t)=>{const n=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${B(e)}>${n}</li>`;const r="number"==typeof e.value?` value="${escapeHtml(String(e.value))}"`:"";return`<li${E(e)}${B(e)}${r}>${n}</li>`},link:P,autolink:P,quote:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<blockquote${E(e)}${B(e)}>${n}</blockquote>`},code:e=>{const t=R("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${escapeHtml(q(e))}</code></pre>`},"code-highlight":e=>{const t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${R(e.highlightType)}"`:""}>${escapeHtml(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\t",upload:e=>{const t=j(e.value);if(void 0===t)return"";const n=t.url;if("string"!=typeof n||!isSafeUrl(n))return"";const r="string"==typeof t.mimeType?t.mimeType:"";return r.startsWith("video/")?function(e,t){return`<video controls${F(e)}><source src="${escapeHtmlAttribute(t)}"${G(e)}></video>`}(t,n):r.startsWith("audio/")?function(e,t){return`<audio controls><source src="${escapeHtmlAttribute(t)}"${G(e)}></audio>`}(t,n):""===r||r.startsWith("image/")?function(e,t){const n="string"==typeof e.alt?escapeHtml(e.alt):"";return`<img src="${escapeHtmlAttribute(t)}" alt="${n}"${F(e)} loading="lazy" decoding="async">`}(t,n):function(e,t){const n="string"==typeof e.filename?escapeHtml(e.filename):escapeHtml(t);return`<a href="${escapeHtmlAttribute(t)}" target="_blank" rel="noopener noreferrer">${n}</a>`}(t,n)},relationship:e=>{const t="string"==typeof e.relationTo?e.relationTo:"",n=N(e.value),r=escapeHtml((n&&function(e){const t=O(e.title)??O(e.name)??O(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}(n))??`#${t}`),o=R(t),i=""===o?' class="lp-relation"':` class="lp-relation lp-relation--${o}"`,a=n?.url;return"string"==typeof a&&isSafeUrl(a)?`<a href="${escapeHtmlAttribute(a)}"${i}>${r}</a>`:`<span${i}>${r}</span>`},block:(e,t)=>Q(e,t,"div","lp-block"),inlineBlock:(e,t)=>Q(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${E(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{const n="number"==typeof e.headerState?e.headerState:0,r=3&n?"th":"td";return`<${r}${1===n?' scope="col"':2===n?' scope="row"':""}${X("colspan",e.colSpan)}${X("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${r}>`}},ee=/* @__PURE__ */new Map;function te(e,t){ee.set(e,t)}function ne(e){return ee.get(e)??Y[e]}var re=!1;function oe(e){if("object"!=typeof e||null===e)return!1;if(!("root"in e))return!1;const t=e.root;return"object"==typeof t&&null!==t&&"children"in t&&Array.isArray(t.children)}function ie(e,t={}){if(!oe(e))return"";const n=function(e){const t={renderChildren:e=>{let n="";for(const r of e)n+=le(r,t);return n},resolveAlignment:I,resolveIndent:D,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?n:void 0!==t.document?sanitizeHtml(n,{document:t.document}):!0===t.requireDocument||void 0!==S()?sanitizeHtml(n):(function(){if(!re){re=!0;try{console.warn('[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.')}catch{}}}(),n)}function ae(e){return oe(e)?e.root.children.map(se).join("\n").trim():""}function le(e,t){const n=ne(e.type);return n?n(e,t):void 0!==e.children?t.renderChildren(e.children):""}function se(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\n";if(void 0===e.children)return"";let t="";for(const n of e.children)t+=se(n);return t}function ce(e,t){const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function ue(e,t){const n=ce(e,t);return void 0!==n&&isSafeUrl(n)?n:void 0}function de(e){const t=ce(e,"caption");return void 0!==t?`<figcaption>${escapeHtml(t)}</figcaption>`:""}var pe=(e,t)=>{const n=R(ce(e,"importance")??"info"),r=ce(e,"title"),o=ce(e,"text"),i=function(e){const t=e.body??e.content;if("object"!=typeof t||null===t)return;const n=t.root;return n&&Array.isArray(n.children)?n.children:void 0}(e);return`<aside class="lp-block-callout lp-block-callout--${n}">${void 0!==r?`<strong>${escapeHtml(r)}</strong>`:""}${void 0!==i?t.renderChildren(i):void 0!==o?`<p>${escapeHtml(o)}</p>`:""}</aside>`},fe=e=>{const t=j(e.image),n=t?.url??ue(e,"imageUrl");if(void 0===n||!isSafeUrl(n))return"";const r=t?.alt??ce(e,"alt")??"";return`<figure class="lp-block-image"><img src="${escapeHtmlAttribute(n)}" alt="${escapeHtmlAttribute(r)}"${function(e){return`${"number"==typeof e?.width?` width="${String(e.width)}"`:""}${"number"==typeof e?.height?` height="${String(e.height)}"`:""}`}(t)} loading="lazy" decoding="async">${de(e)}</figure>`},me=e=>{const t=j(e.video),n=t?.url??ue(e,"videoUrl");if(void 0===n||!isSafeUrl(n))return"";const r=t?.mimeType??ce(e,"mimeType"),o=void 0!==r?` type="${escapeHtmlAttribute(r)}"`:"",i=ue(e,"poster");return`<figure class="lp-block-video"><video controls${void 0!==i?` poster="${escapeHtmlAttribute(i)}"`:""}><source src="${escapeHtmlAttribute(n)}"${o}></video>${de(e)}</figure>`},he=e=>{const t=ce(e,"code")??ce(e,"content");if(void 0===t)return"";const n=R(ce(e,"language")??""),r=""===n?"":` class="language-${n}"`;return`<figure class="lp-block-code">${de(e)}<pre><code${r}>${escapeHtml(t)}</code></pre></figure>`},ge=e=>{const t=ce(e,"label")??ce(e,"text"),n=ue(e,"href")??ue(e,"url");if(void 0===t||void 0===n)return"";const r=ce(e,"lead"),o=void 0!==r?`<p class="lp-block-cta__lead">${escapeHtml(r)}</p>`:"",i=[be(t,n,!0)],a=ce(e,"secondaryLabel"),l=ue(e,"secondaryHref");return void 0!==a&&void 0!==l&&i.push(be(a,l,!1)),`<div class="lp-block-cta">${o}<div class="lp-block-cta__actions">${i.join("")}</div></div>`};function be(e,t,n){const r=isExternalHttpUrl(t)?' target="_blank" rel="noopener noreferrer"':"";return`<a class="lp-block-cta__button lp-block-cta__button--${n?"primary":"secondary"}" href="${escapeHtmlAttribute(t)}"${r}>${escapeHtml(e)}</a>`}function ye(){Z("callout",pe),Z("image-block",fe),Z("imageBlock",fe),Z("image",fe),Z("video-block",me),Z("videoBlock",me),Z("video",me),Z("code-block",he),Z("codeBlock",he),Z("code",he),Z("cta-block",ge),Z("ctaBlock",ge),Z("cta",ge)}export{x as TextFormat,oe as isLexicalContent,ie as lexicalToHtml,ae as lexicalToPlainText,V as lookupBlockRenderer,ne as lookupLexicalNode,Z as registerBlockRenderer,ye as registerDefaultBlocks,te as registerLexicalNode,J as registeredBlockTypes,setSanitizerDocument};
1
+ function e(e,t){if(!function(){try{const e=globalThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;const n=globalThis,r=n.__payloadLivePreviewDeprecationsWarned??=/* @__PURE__ */new Set;if(!r.has(e)){r.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}var t=/* @__PURE__ */Symbol.for("payload-live-preview.trusted-types");function n(e){const n=function(){const e=function(){const e=globalThis,n=e[t];if(void 0!==n)return n;const r={};return e[t]=r,r}();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;const n=function(){const e=globalThis.trustedTypes;if("object"==typeof e&&null!==e)return"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===n?null:n.createPolicy("payload-live-preview",{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===n?e:n.createHTML(e)}var r=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:"]),o=/^(?:\.{1,2}\/|[a-zA-Z0-9_-]+\/?)/,i=/^[\\/]{2}/,a=/[\t\n\r]/g,s=/[\s\u0000-\u001f\u180e\u2000-\u2029]/g,l=/^([a-z][a-z0-9+.-]*):/i;function isSafeUrl(e){if("string"!=typeof e)return!1;const t=e.trim().replace(a,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?"))return!0;if(i.test(t))return!0;if(t.startsWith("/"))return!0;try{const e=new URL(t);return r.has(e.protocol)}catch{return o.test(t)&&!function(e){const t=l.exec(e.replace(s,""))?.[1];return void 0!==t&&!r.has(`${t.toLowerCase()}:`)}(t)}}function isExternalHttpUrl(e){const t=e.trim().replace(a,"");return/^https?:\/\//i.test(t)||i.test(t)}var c=/* @__PURE__ */new Set;function u(e){c.has(e)||(c.add(e),function(e){try{console.warn(e)}catch{}}(`[live-preview] LP0409: the strict sanitizer removed \`${e}\` from written markup; the 1.x default (\`sanitizerPolicy: 'compat'\`) kept it. ${function(e){return e.startsWith("data-payload-")?"A binding inside CMS content is refused by design — an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name — DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: 'compat'` to keep every `data-*` as 1.x did"}(e)}.`))}var d=/* @__PURE__ */new Set(["p","br","strong","b","em","i","u","s","strike","mark","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","blockquote","code","pre","kbd","samp","var","a","span","div","section","article","aside","header","footer","nav","figure","figcaption","img","picture","source","audio","video","sub","sup","hr","time","abbr","cite","q","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col"]),p=/* @__PURE__ */new Set(["input","button","textarea","select","option","label"]),f=/* @__PURE__ */new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),m=/* @__PURE__ */new Set(["id","class","lang","dir","title","role","tabindex"]),h="aria-",g="data-",b={a:/* @__PURE__ */new Set(["href","target","rel","download","hreflang","type"]),img:/* @__PURE__ */new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),picture:/* @__PURE__ */new Set([]),source:/* @__PURE__ */new Set(["src","srcset","sizes","type","media"]),audio:/* @__PURE__ */new Set(["src","controls","autoplay","loop","muted","preload"]),video:/* @__PURE__ */new Set(["src","poster","controls","autoplay","loop","muted","preload","width","height","playsinline"]),time:/* @__PURE__ */new Set(["datetime"]),abbr:/* @__PURE__ */new Set(["title"]),q:/* @__PURE__ */new Set(["cite"]),blockquote:/* @__PURE__ */new Set(["cite"]),table:/* @__PURE__ */new Set(["summary"]),th:/* @__PURE__ */new Set(["colspan","rowspan","scope","headers","abbr"]),td:/* @__PURE__ */new Set(["colspan","rowspan","headers"]),col:/* @__PURE__ */new Set(["span"]),colgroup:/* @__PURE__ */new Set(["span"]),ol:/* @__PURE__ */new Set(["start","reversed","type"]),li:/* @__PURE__ */new Set(["value"]),code:/* @__PURE__ */new Set(["class"]),pre:/* @__PURE__ */new Set(["class"])},y=/* @__PURE__ */new Set(["href","src","cite","poster"]),$=class extends Error{name="SanitizerEnvironmentError"},v=/* @__PURE__ */new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"]),w=/* @__PURE__ */Symbol.for("payload-live-preview.sanitizer-document");function setSanitizerDocument(t){e("set-sanitizer-document","`setSanitizerDocument()` is removed in 3.0: pass the document per call, `sanitizeHtml(html, { document })` or `lexicalToHtml(content, { document })` (ADR 0026)."),globalThis[w]=t??void 0}function sanitizeHtml(t,r){return function(t,r,o){const i=o?.document??H();if(!i)throw S();if(""===t)return"";const a=function(e,t){const n=e?.policy??t??"strict";if(!e){const e=/* @__PURE__ */new Map;for(const[t,n]of Object.entries(b))e.set(t,n);return{allowedTags:d,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:n,allowedData:/* @__PURE__ */new Set}}const r=new Set(d);if(e.additionalAllowedTags?.forEach(e=>r.add(e)),!0===e.allowFormControls)for(const e of p)r.add(e);const o=/* @__PURE__ */new Map;for(const[e,t]of Object.entries(b))o.set(e,t);for(const[t,n]of Object.entries(e.additionalAllowedAttributes??{})){const e=new Set(o.get(t));for(const t of n)e.add(t);o.set(t,e)}return{allowedTags:r,attrByTag:o,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:n,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(o,void 0);let s=t;for(let e=0;e<6;e+=1){const e=i.createElement("template");e.innerHTML=n(s);const t=e.content;T(t,a);const r=k(t);if(r===s)return r;s=r}return e("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(6)} passes, so it returned an empty string (ADR 0016).`),""}(t,0,r)}function S(){return"undefined"!=typeof __INLINE_BUILD__&&__INLINE_BUILD__?new Error("sanitizeHtml needs a DOM"):new $("sanitizeHtml needs a DOM; pass one per call during SSR: { document } (linkedom, jsdom).")}function k(e){const t=e.ownerDocument?.createElement("div");if(void 0===t)throw S();const n=e.firstChild;if(t.append(e),t.firstChild!==n)throw S();return t.innerHTML}function H(){if("undefined"==typeof __INLINE_BUILD__||!__INLINE_BUILD__){const e=globalThis[w];if(e)return e}if("undefined"!=typeof document)return document}function T(e,t){for(const n of Array.from(e.childNodes))1===n.nodeType?A(n,t):8===n.nodeType&&n.remove()}function A(e,t){const n=e.tagName.toLowerCase();if(!f.has(n)||t.allowFormControls&&p.has(n)){if(!t.allowedTags.has(n))return T(e,t),void e.replaceWith(...e.childNodes);!function(e,t,n){const r=n.attrByTag.get(t);for(const t of Array.from(e.attributes)){const o=t.name.toLowerCase();if(o.startsWith("on")||"style"===o)e.removeAttribute(t.name);else if("is"!==o){if("strict"===n.mode){if(n.templateMode&&v.has(o))continue;if("id"===o||"name"===o||o.startsWith("data-payload-")){e.removeAttribute(t.name),"name"===o&&!0!==r?.has(o)||u(o);continue}if(o.startsWith(g)){n.allowedData.has(o)||(e.removeAttribute(t.name),u(o));continue}if(m.has(o)||o.startsWith(h))continue}else if(m.has(o)||o.startsWith(h)||o.startsWith(g))continue;r?.has(o)?y.has(o)&&!isSafeUrl(t.value)?e.removeAttribute(t.name):"srcset"!==o||C(t.value)||e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,n,t),"a"===n&&function(e){const t=e.getAttribute("href");null!==t&&isExternalHttpUrl(t)&&(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),T(e,t)}else e.remove()}function C(e){for(const t of e.split(",")){const e=t.trim();if(0===e.length)continue;const[n=e]=e.split(/\s/,1);if(!isSafeUrl(n)||!isSafeUrl(e))return!1}return!0}var _=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"}),L=/[&<>"'/`=]/g;function escapeHtml(e){return e.replace(L,e=>_[e])}var x=Object.freeze({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}),U=/[&<>"']/g;function escapeHtmlAttribute(e){return e.replace(U,e=>x[e])}var z={BOLD:1,ITALIC:2,STRIKETHROUGH:4,UNDERLINE:8,CODE:16,SUBSCRIPT:32,SUPERSCRIPT:64,HIGHLIGHT:128},I={1:"left",2:"center",3:"right",4:"justify"},D=/* @__PURE__ */new Set(["left","center","right","justify","start","end"]);function E(e){const t=e.format;return"string"==typeof t&&D.has(t)?t:"number"==typeof t?I[t]:void 0}function B(e){const t=e.indent;return"number"==typeof t&&t>0?t:0}function M(e){return"rtl"===e.direction?' dir="rtl"':"ltr"===e.direction?' dir="ltr"':""}function N(e){const t=E(e),n=B(e),r=[];return void 0!==t&&r.push(`lp-align-${t}`),n>0&&r.push(`lp-indent-${String(n)}`),0===r.length?"":` class="${r.join(" ")}"`}var j=/* @__PURE__ */new Set(["h1","h2","h3","h4","h5","h6"]);function R(e){return"object"==typeof e&&null!==e?e:void 0}function O(e){return R(e)}function W(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function P(e){return"string"==typeof e&&e.length>0?e:void 0}var q=' target="_blank" rel="noopener noreferrer"',F=(e,t)=>{const n=t.renderChildren(e.children??[]),r=R(e.fields),o=function(e,t){if("internal"===t?.linkType)return function(e){const t=R(R(e)?.value),n=t?.url;if("string"==typeof n&&n.length>0)return n;const r=t?.slug;return"string"==typeof r&&r.length>0?`/${r}`:void 0}(t.doc);const n=t?.url??e.url;return"string"==typeof n&&n.length>0?n:void 0}(e,r);if(void 0===o||!isSafeUrl(o))return n;const i="string"==typeof e.title?` title="${escapeHtml(e.title)}"`:"";return`<a href="${escapeHtmlAttribute(o)}"${function(e,t,n){if(!0===t?.newTab||isExternalHttpUrl(n))return q;const r="string"==typeof e.target?e.target:"";return""===r?"":"_blank"===r?q:` target="${escapeHtml(r)}"`}(e,r,o)}${i}>${n}</a>`};function G(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(const n of e.children)t+=G(n);return t}function K(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function Z(e){return"string"==typeof e.mimeType?` type="${escapeHtmlAttribute(e.mimeType)}"`:""}var V=/* @__PURE__ */new Map;function J(e,t){V.set(e,t)}function Q(e){return V.get(e)}function X(){return[...V.keys()]}function Y(e,t,n,r){const o=R(e.fields)??{},i="string"==typeof o.blockType?o.blockType:"",a=W(i),s=""===a?r:`${r} ${r}--${a}`;if(""!==i){const e=Q(i)??Q(a);if(e)return e(o,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(i,s)}return`<${n} class="${s}"></${n}>`}function ee(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}var te={text:e=>{let t=escapeHtml("string"==typeof e.text?e.text:"");const n="number"==typeof e.format?e.format:0;return 0!==(n&z.CODE)&&(t=`<code>${t}</code>`),0!==(n&z.BOLD)&&(t=`<strong>${t}</strong>`),0!==(n&z.ITALIC)&&(t=`<em>${t}</em>`),0!==(n&z.UNDERLINE)&&(t=`<u>${t}</u>`),0!==(n&z.STRIKETHROUGH)&&(t=`<s>${t}</s>`),0!==(n&z.SUBSCRIPT)&&(t=`<sub>${t}</sub>`),0!==(n&z.SUPERSCRIPT)&&(t=`<sup>${t}</sup>`),0!==(n&z.HIGHLIGHT)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<p${M(e)}${N(e)}>${n}</p>`},heading:(e,t)=>{const n="string"==typeof e.tag?e.tag.toLowerCase():"h2",r=j.has(n)?n:"h2",o=t.renderChildren(e.children??[]);return`<${r}${M(e)}${N(e)}>${o}</${r}>`},list:(e,t)=>{const n="string"==typeof e.listType?e.listType:"bullet",r="number"===n?"ol":"ul",o="number"===n&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",i="check"===n?' role="list"':"",a=t.renderChildren(e.children??[]);return`<${r}${M(e)}${N(e)}${o}${i}>${a}</${r}>`},listitem:(e,t)=>{const n=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${N(e)}>${n}</li>`;const r="number"==typeof e.value?` value="${escapeHtml(String(e.value))}"`:"";return`<li${M(e)}${N(e)}${r}>${n}</li>`},link:F,autolink:F,quote:(e,t)=>{const n=t.renderChildren(e.children??[]);return`<blockquote${M(e)}${N(e)}>${n}</blockquote>`},code:e=>{const t=W("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${escapeHtml(G(e))}</code></pre>`},"code-highlight":e=>{const t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${W(e.highlightType)}"`:""}>${escapeHtml(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\t",upload:e=>{const t=O(e.value);if(void 0===t)return"";const n=t.url;if("string"!=typeof n||!isSafeUrl(n))return"";const r="string"==typeof t.mimeType?t.mimeType:"";return r.startsWith("video/")?function(e,t){return`<video controls${K(e)}><source src="${escapeHtmlAttribute(t)}"${Z(e)}></video>`}(t,n):r.startsWith("audio/")?function(e,t){return`<audio controls><source src="${escapeHtmlAttribute(t)}"${Z(e)}></audio>`}(t,n):""===r||r.startsWith("image/")?function(e,t){const n="string"==typeof e.alt?escapeHtml(e.alt):"";return`<img src="${escapeHtmlAttribute(t)}" alt="${n}"${K(e)} loading="lazy" decoding="async">`}(t,n):function(e,t){const n="string"==typeof e.filename?escapeHtml(e.filename):escapeHtml(t);return`<a href="${escapeHtmlAttribute(t)}" target="_blank" rel="noopener noreferrer">${n}</a>`}(t,n)},relationship:e=>{const t="string"==typeof e.relationTo?e.relationTo:"",n=R(e.value),r=escapeHtml((n&&function(e){const t=P(e.title)??P(e.name)??P(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}(n))??`#${t}`),o=W(t),i=""===o?' class="lp-relation"':` class="lp-relation lp-relation--${o}"`,a=n?.url;return"string"==typeof a&&isSafeUrl(a)?`<a href="${escapeHtmlAttribute(a)}"${i}>${r}</a>`:`<span${i}>${r}</span>`},block:(e,t)=>Y(e,t,"div","lp-block"),inlineBlock:(e,t)=>Y(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${M(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{const n="number"==typeof e.headerState?e.headerState:0,r=3&n?"th":"td";return`<${r}${1===n?' scope="col"':2===n?' scope="row"':""}${ee("colspan",e.colSpan)}${ee("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${r}>`}},ne=/* @__PURE__ */new Map;function re(e,t){ne.set(e,t)}function oe(e){return ne.get(e)??te[e]}var ie=!1;function ae(e){if("object"!=typeof e||null===e)return!1;if(!("root"in e))return!1;const t=e.root;return"object"==typeof t&&null!==t&&"children"in t&&Array.isArray(t.children)}function se(e,t={}){if(!ae(e))return"";const n=function(e){const t={renderChildren:e=>{let n="";for(const r of e)n+=ce(r,t);return n},resolveAlignment:E,resolveIndent:B,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?n:void 0!==t.document?sanitizeHtml(n,{document:t.document}):!0===t.requireDocument||void 0!==H()?sanitizeHtml(n):(function(){if(!ie){ie=!0;try{console.warn('[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.')}catch{}}}(),n)}function le(e){return ae(e)?e.root.children.map(ue).join("\n").trim():""}function ce(e,t){const n=oe(e.type);return n?n(e,t):void 0!==e.children?t.renderChildren(e.children):""}function ue(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\n";if(void 0===e.children)return"";let t="";for(const n of e.children)t+=ue(n);return t}function de(e,t){const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function pe(e,t){const n=de(e,t);return void 0!==n&&isSafeUrl(n)?n:void 0}function fe(e){const t=de(e,"caption");return void 0!==t?`<figcaption>${escapeHtml(t)}</figcaption>`:""}var me=(e,t)=>{const n=W(de(e,"importance")??"info"),r=de(e,"title"),o=de(e,"text"),i=function(e){const t=e.body??e.content;if("object"!=typeof t||null===t)return;const n=t.root;return n&&Array.isArray(n.children)?n.children:void 0}(e);return`<aside class="lp-block-callout lp-block-callout--${n}">${void 0!==r?`<strong>${escapeHtml(r)}</strong>`:""}${void 0!==i?t.renderChildren(i):void 0!==o?`<p>${escapeHtml(o)}</p>`:""}</aside>`},he=e=>{const t=O(e.image),n=t?.url??pe(e,"imageUrl");if(void 0===n||!isSafeUrl(n))return"";const r=t?.alt??de(e,"alt")??"";return`<figure class="lp-block-image"><img src="${escapeHtmlAttribute(n)}" alt="${escapeHtmlAttribute(r)}"${function(e){return`${"number"==typeof e?.width?` width="${String(e.width)}"`:""}${"number"==typeof e?.height?` height="${String(e.height)}"`:""}`}(t)} loading="lazy" decoding="async">${fe(e)}</figure>`},ge=e=>{const t=O(e.video),n=t?.url??pe(e,"videoUrl");if(void 0===n||!isSafeUrl(n))return"";const r=t?.mimeType??de(e,"mimeType"),o=void 0!==r?` type="${escapeHtmlAttribute(r)}"`:"",i=pe(e,"poster");return`<figure class="lp-block-video"><video controls${void 0!==i?` poster="${escapeHtmlAttribute(i)}"`:""}><source src="${escapeHtmlAttribute(n)}"${o}></video>${fe(e)}</figure>`},be=e=>{const t=de(e,"code")??de(e,"content");if(void 0===t)return"";const n=W(de(e,"language")??""),r=""===n?"":` class="language-${n}"`;return`<figure class="lp-block-code">${fe(e)}<pre><code${r}>${escapeHtml(t)}</code></pre></figure>`},ye=e=>{const t=de(e,"label")??de(e,"text"),n=pe(e,"href")??pe(e,"url");if(void 0===t||void 0===n)return"";const r=de(e,"lead"),o=void 0!==r?`<p class="lp-block-cta__lead">${escapeHtml(r)}</p>`:"",i=[$e(t,n,!0)],a=de(e,"secondaryLabel"),s=pe(e,"secondaryHref");return void 0!==a&&void 0!==s&&i.push($e(a,s,!1)),`<div class="lp-block-cta">${o}<div class="lp-block-cta__actions">${i.join("")}</div></div>`};function $e(e,t,n){const r=isExternalHttpUrl(t)?' target="_blank" rel="noopener noreferrer"':"";return`<a class="lp-block-cta__button lp-block-cta__button--${n?"primary":"secondary"}" href="${escapeHtmlAttribute(t)}"${r}>${escapeHtml(e)}</a>`}function ve(){J("callout",me),J("image-block",he),J("imageBlock",he),J("image",he),J("video-block",ge),J("videoBlock",ge),J("video",ge),J("code-block",be),J("codeBlock",be),J("code",be),J("cta-block",ye),J("ctaBlock",ye),J("cta",ye)}export{z as TextFormat,ae as isLexicalContent,se as lexicalToHtml,le as lexicalToPlainText,Q as lookupBlockRenderer,oe as lookupLexicalNode,J as registerBlockRenderer,ve as registerDefaultBlocks,re as registerLexicalNode,X as registeredBlockTypes,setSanitizerDocument};
2
2
  //# sourceMappingURL=lexical.js.map