@wazobiatech/wazui 1.1.1 → 1.1.2
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/dist/{PictureBlot-k3ktT31b.js → PictureBlot-C_WrJa54.js} +2 -2
- package/dist/{PictureBlot-k3ktT31b.js.map → PictureBlot-C_WrJa54.js.map} +1 -1
- package/dist/{PictureBlot-BnvSxePh.cjs → PictureBlot-gNi_BGBG.cjs} +2 -2
- package/dist/{PictureBlot-BnvSxePh.cjs.map → PictureBlot-gNi_BGBG.cjs.map} +1 -1
- package/dist/VideoBlot-BO5DI6tu.cjs +2 -0
- package/dist/VideoBlot-BO5DI6tu.cjs.map +1 -0
- package/dist/VideoBlot-DlZMcpsq.js +119 -0
- package/dist/VideoBlot-DlZMcpsq.js.map +1 -0
- package/dist/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.d.ts.map +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/WazUiGqlMediaGalleryImage.d.ts.map +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/hooks.d.ts +5 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/hooks.d.ts.map +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/provider.d.ts.map +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/samples/queries.d.ts.map +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/types.d.ts +14 -0
- package/dist/components/wazui/WazUiGqlMediaLibrary/types.d.ts.map +1 -1
- package/dist/components/wazui/WazUiWysiwygInput/blots/VideoBlot.d.ts.map +1 -1
- package/dist/components/wazui/WazUiWysiwygInput/blots/types.d.ts +9 -2
- package/dist/components/wazui/WazUiWysiwygInput/blots/types.d.ts.map +1 -1
- package/dist/{index-DN4dcdTU.cjs → index-BpeeBaVk.cjs} +184 -183
- package/dist/index-BpeeBaVk.cjs.map +4 -0
- package/dist/{index-B6ZsepES.js → index-CjfGnQEn.js} +9473 -9410
- package/dist/index-CjfGnQEn.js.map +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{quill-DM-ji8UV.cjs → quill-CsFCK9VI.cjs} +2 -2
- package/dist/{quill-DM-ji8UV.cjs.map → quill-CsFCK9VI.cjs.map} +1 -1
- package/dist/{quill-CCxwWz9p.js → quill-DvR5ek_W.js} +2 -2
- package/dist/{quill-CCxwWz9p.js.map → quill-DvR5ek_W.js.map} +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/VideoBlot-Ckf5WiUX.js +0 -90
- package/dist/VideoBlot-Ckf5WiUX.js.map +0 -1
- package/dist/VideoBlot-Dd56DXr0.cjs +0 -2
- package/dist/VideoBlot-Dd56DXr0.cjs.map +0 -1
- package/dist/index-B6ZsepES.js.map +0 -4
- package/dist/index-DN4dcdTU.cjs.map +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wazobiatech/wazui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "`@repo/wazui` is a React component library that provides a set of reusable UI components, hooks, and providers for building modern web applications. It is built with TypeScript, Tailwind CSS, and integrates Shadcn UI components.",
|
|
6
6
|
"homepage": "https://bitbucket.org/wazobiatech/wazui#readme",
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var g = Object.defineProperty;
|
|
3
|
-
var E = (s, i, o) => i in s ? g(s, i, { enumerable: !0, configurable: !0, writable: !0, value: o }) : s[i] = o;
|
|
4
|
-
var u = (s, i, o) => E(s, typeof i != "symbol" ? i + "" : i, o);
|
|
5
|
-
const v = ["cloudfront.net", "viously.com"], y = (s, i = v) => {
|
|
6
|
-
try {
|
|
7
|
-
const o = new URL(s);
|
|
8
|
-
return o.protocol !== "http:" && o.protocol !== "https:" ? !1 : i.some((m) => o.hostname === m || o.hostname.endsWith(`.${m}`));
|
|
9
|
-
} catch {
|
|
10
|
-
return !1;
|
|
11
|
-
}
|
|
12
|
-
}, x = async () => {
|
|
13
|
-
if (typeof window > "u") return null;
|
|
14
|
-
try {
|
|
15
|
-
const i = (await import("./quill-CCxwWz9p.js")).default.import("blots/block/embed");
|
|
16
|
-
class o extends i {
|
|
17
|
-
static create(d) {
|
|
18
|
-
const c = document.createElement("div");
|
|
19
|
-
c.className = "ql-cms-video-container", c.style.margin = "1em 0";
|
|
20
|
-
const a = document.createElement("video");
|
|
21
|
-
y(d.src) && a.setAttribute("src", d.src), a.setAttribute("controls", ""), a.setAttribute("preload", "metadata"), a.style.maxWidth = "100%", a.style.height = "auto", a.style.display = "block", a.style.margin = "0 auto";
|
|
22
|
-
const t = document.createElement("div");
|
|
23
|
-
t.className = "ql-cms-video-caption", t.textContent = d.caption || "Click to edit caption...", t.style.fontStyle = "italic", t.style.color = d.caption ? "#666" : "#999", t.style.fontSize = "14px", t.style.marginTop = "8px", t.style.textAlign = "center", t.style.minHeight = "1.2em", t.style.outline = "none", t.style.padding = "4px", t.style.borderRadius = "4px", t.style.cursor = "text", t.contentEditable = "false", t.setAttribute("data-original-caption", d.caption || "");
|
|
24
|
-
let n = !1;
|
|
25
|
-
return t.addEventListener("click", (e) => {
|
|
26
|
-
e.stopPropagation(), e.preventDefault(), !n && (n = !0, t.setAttribute("data-editing", "true"), t.contentEditable = "true", t.textContent === "Click to edit caption..." && (t.textContent = "", t.style.color = "#666"), setTimeout(() => {
|
|
27
|
-
t.focus();
|
|
28
|
-
const r = document.createRange(), l = window.getSelection();
|
|
29
|
-
r.selectNodeContents(t), r.collapse(!1), l == null || l.removeAllRanges(), l == null || l.addRange(r);
|
|
30
|
-
}, 0));
|
|
31
|
-
}), t.addEventListener("blur", () => {
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
var e;
|
|
34
|
-
t.isConnected && n && (n = !1, t.removeAttribute("data-editing"), t.contentEditable = "false", (e = t.textContent) != null && e.trim() || (t.textContent = "Click to edit caption...", t.style.color = "#999"));
|
|
35
|
-
}, 10);
|
|
36
|
-
}), t.addEventListener("keydown", (e) => {
|
|
37
|
-
var r;
|
|
38
|
-
if (n) {
|
|
39
|
-
if (e.key === "Enter" || e.key === "Escape") {
|
|
40
|
-
e.stopPropagation(), e.preventDefault(), t.blur();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (e.key === "Backspace") {
|
|
44
|
-
const l = ((r = t.textContent) == null ? void 0 : r.trim()) || "";
|
|
45
|
-
if (!l || l === "Click to edit caption...") {
|
|
46
|
-
e.stopPropagation(), e.preventDefault();
|
|
47
|
-
const p = t.closest(".ql-cms-video-container");
|
|
48
|
-
p && p.parentNode && (p.parentNode.removeChild(p), setTimeout(() => {
|
|
49
|
-
const f = document.querySelector(".ql-editor");
|
|
50
|
-
f && f.focus();
|
|
51
|
-
}, 10));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
}
|
|
57
|
-
}), t.addEventListener("input", (e) => {
|
|
58
|
-
n && e.stopPropagation();
|
|
59
|
-
}), t.addEventListener("mousedown", (e) => {
|
|
60
|
-
n && e.stopPropagation();
|
|
61
|
-
}), t.addEventListener("mouseup", (e) => {
|
|
62
|
-
n && e.stopPropagation();
|
|
63
|
-
}), t.addEventListener("paste", (e) => {
|
|
64
|
-
n && e.stopPropagation();
|
|
65
|
-
}), c.appendChild(a), c.appendChild(t), c.contentEditable = "false", c;
|
|
66
|
-
}
|
|
67
|
-
static value(d) {
|
|
68
|
-
var e;
|
|
69
|
-
const c = d.querySelector("video"), a = d.querySelector(".ql-cms-video-caption");
|
|
70
|
-
let t = "";
|
|
71
|
-
if (a) {
|
|
72
|
-
const r = ((e = a.textContent) == null ? void 0 : e.trim()) || "";
|
|
73
|
-
r && r !== "Click to edit caption..." && (t = r);
|
|
74
|
-
}
|
|
75
|
-
const n = (c == null ? void 0 : c.getAttribute("src")) || "";
|
|
76
|
-
return {
|
|
77
|
-
src: y(n) ? n : "",
|
|
78
|
-
caption: t
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return u(o, "blotName", "cms-video"), u(o, "tagName", "div"), u(o, "className", "ql-cms-video-container"), o;
|
|
83
|
-
} catch (s) {
|
|
84
|
-
return console.error("Failed to create VideoBlot:", s), null;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
export {
|
|
88
|
-
x as default
|
|
89
|
-
};
|
|
90
|
-
//# sourceMappingURL=VideoBlot-Ckf5WiUX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VideoBlot-Ckf5WiUX.js","sources":["../src/components/wazui/WazUiWysiwygInput/blots/VideoBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { VideoBlotReturnValue, VideoBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst DEFAULT_ALLOWED_VIDEO_DOMAINS = ['cloudfront.net', 'viously.com'];\n\nconst isValidVideoUrl = (url: string, allowedDomains: string[] = DEFAULT_ALLOWED_VIDEO_DOMAINS): boolean => {\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false;\n return allowedDomains.some(domain => parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`));\n } catch {\n return false;\n }\n};\n\nconst createVideoBlot = async () => {\n if (typeof window === 'undefined') return null;\n\n try {\n const Quill = (await import('quill')).default;\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\n\n class VideoBlot extends (BlockEmbed as any) {\n static blotName = 'cms-video';\n static tagName = 'div';\n static className = 'ql-cms-video-container';\n\n static create(value: VideoBlotValue): HTMLElement {\n const container = document.createElement('div');\n container.className = 'ql-cms-video-container';\n container.style.margin = '1em 0';\n\n const videoElement = document.createElement('video');\n if (isValidVideoUrl(value.src)) {\n videoElement.setAttribute('src', value.src);\n }\n videoElement.setAttribute('controls', '');\n videoElement.setAttribute('preload', 'metadata');\n videoElement.style.maxWidth = '100%';\n videoElement.style.height = 'auto';\n videoElement.style.display = 'block';\n videoElement.style.margin = '0 auto';\n\n // Create caption element\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-cms-video-caption';\n captionElement.textContent = value.caption || 'Click to edit caption...';\n captionElement.style.fontStyle = 'italic';\n captionElement.style.color = value.caption ? '#666' : '#999';\n captionElement.style.fontSize = '14px';\n captionElement.style.marginTop = '8px';\n captionElement.style.textAlign = 'center';\n captionElement.style.minHeight = '1.2em';\n captionElement.style.outline = 'none';\n captionElement.style.padding = '4px';\n captionElement.style.borderRadius = '4px';\n captionElement.style.cursor = 'text';\n captionElement.contentEditable = 'false';\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n let isEditingCaption = false;\n\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return;\n\n isEditingCaption = true;\n captionElement.setAttribute('data-editing', 'true');\n captionElement.contentEditable = 'true';\n\n if (captionElement.textContent === 'Click to edit caption...') {\n captionElement.textContent = '';\n captionElement.style.color = '#666';\n }\n\n setTimeout(() => {\n captionElement.focus();\n const range = document.createRange();\n const selection = window.getSelection();\n range.selectNodeContents(captionElement);\n range.collapse(false);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n captionElement.addEventListener('blur', () => {\n setTimeout(() => {\n if (!captionElement.isConnected) return;\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n captionElement.contentEditable = 'false';\n const text = captionElement.textContent?.trim() || '';\n if (!text) {\n captionElement.textContent = 'Click to edit caption...';\n captionElement.style.color = '#999';\n }\n }\n }, 10);\n });\n\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n if (e.key === 'Backspace') {\n const text = captionElement.textContent?.trim() || '';\n if (!text || text === 'Click to edit caption...') {\n e.stopPropagation();\n e.preventDefault();\n\n const videoContainer = captionElement.closest('.ql-cms-video-container');\n if (videoContainer && videoContainer.parentNode) {\n videoContainer.parentNode.removeChild(videoContainer);\n setTimeout(() => {\n const quillEditor = document.querySelector('.ql-editor');\n if (quillEditor) {\n (quillEditor as HTMLElement).focus();\n }\n }, 10);\n }\n return;\n }\n }\n\n e.stopPropagation();\n });\n\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mousedown', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mouseup', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n container.appendChild(videoElement);\n container.appendChild(captionElement);\n container.contentEditable = 'false';\n\n return container;\n }\n\n static value(node: HTMLElement): VideoBlotReturnValue {\n const video = node.querySelector('video');\n const captionElement = node.querySelector('.ql-cms-video-caption');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.textContent?.trim() || '';\n if (text && text !== 'Click to edit caption...') {\n caption = text;\n }\n }\n\n const src = video?.getAttribute('src') || '';\n return {\n src: isValidVideoUrl(src) ? src : '',\n caption,\n };\n }\n }\n\n return VideoBlot;\n } catch (error) {\n console.error('Failed to create VideoBlot:', error);\n return null;\n }\n};\n\nexport default createVideoBlot;\n"],"names":["DEFAULT_ALLOWED_VIDEO_DOMAINS","isValidVideoUrl","url","allowedDomains","parsed","domain","createVideoBlot","BlockEmbed","VideoBlot","value","container","videoElement","captionElement","isEditingCaption","range","selection","_a","text","videoContainer","quillEditor","node","video","caption","src","__publicField","error"],"mappings":";;;;AAIA,MAAMA,IAAgC,CAAC,kBAAkB,aAAa,GAEhEC,IAAkB,CAACC,GAAaC,IAA2BH,MAA2C;AAC1G,MAAI;AACF,UAAMI,IAAS,IAAI,IAAIF,CAAG;AA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AAQ,MAAM,+BAA+BA,CAAK,GAC3C;AAAA,EACT;AACF;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";var g=Object.defineProperty;var v=(s,i,o)=>i in s?g(s,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[i]=o;var u=(s,i,o)=>v(s,typeof i!="symbol"?i+"":i,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=["cloudfront.net","viously.com"],y=(s,i=E)=>{try{const o=new URL(s);return o.protocol!=="http:"&&o.protocol!=="https:"?!1:i.some(m=>o.hostname===m||o.hostname.endsWith(`.${m}`))}catch{return!1}},b=async()=>{if(typeof window>"u")return null;try{const i=(await Promise.resolve().then(()=>require("./quill-DM-ji8UV.cjs"))).default.import("blots/block/embed");class o extends i{static create(d){const c=document.createElement("div");c.className="ql-cms-video-container",c.style.margin="1em 0";const r=document.createElement("video");y(d.src)&&r.setAttribute("src",d.src),r.setAttribute("controls",""),r.setAttribute("preload","metadata"),r.style.maxWidth="100%",r.style.height="auto",r.style.display="block",r.style.margin="0 auto";const t=document.createElement("div");t.className="ql-cms-video-caption",t.textContent=d.caption||"Click to edit caption...",t.style.fontStyle="italic",t.style.color=d.caption?"#666":"#999",t.style.fontSize="14px",t.style.marginTop="8px",t.style.textAlign="center",t.style.minHeight="1.2em",t.style.outline="none",t.style.padding="4px",t.style.borderRadius="4px",t.style.cursor="text",t.contentEditable="false",t.setAttribute("data-original-caption",d.caption||"");let n=!1;return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),!n&&(n=!0,t.setAttribute("data-editing","true"),t.contentEditable="true",t.textContent==="Click to edit caption..."&&(t.textContent="",t.style.color="#666"),setTimeout(()=>{t.focus();const a=document.createRange(),l=window.getSelection();a.selectNodeContents(t),a.collapse(!1),l==null||l.removeAllRanges(),l==null||l.addRange(a)},0))}),t.addEventListener("blur",()=>{setTimeout(()=>{var e;t.isConnected&&n&&(n=!1,t.removeAttribute("data-editing"),t.contentEditable="false",(e=t.textContent)!=null&&e.trim()||(t.textContent="Click to edit caption...",t.style.color="#999"))},10)}),t.addEventListener("keydown",e=>{var a;if(n){if(e.key==="Enter"||e.key==="Escape"){e.stopPropagation(),e.preventDefault(),t.blur();return}if(e.key==="Backspace"){const l=((a=t.textContent)==null?void 0:a.trim())||"";if(!l||l==="Click to edit caption..."){e.stopPropagation(),e.preventDefault();const p=t.closest(".ql-cms-video-container");p&&p.parentNode&&(p.parentNode.removeChild(p),setTimeout(()=>{const f=document.querySelector(".ql-editor");f&&f.focus()},10));return}}e.stopPropagation()}}),t.addEventListener("input",e=>{n&&e.stopPropagation()}),t.addEventListener("mousedown",e=>{n&&e.stopPropagation()}),t.addEventListener("mouseup",e=>{n&&e.stopPropagation()}),t.addEventListener("paste",e=>{n&&e.stopPropagation()}),c.appendChild(r),c.appendChild(t),c.contentEditable="false",c}static value(d){var e;const c=d.querySelector("video"),r=d.querySelector(".ql-cms-video-caption");let t="";if(r){const a=((e=r.textContent)==null?void 0:e.trim())||"";a&&a!=="Click to edit caption..."&&(t=a)}const n=(c==null?void 0:c.getAttribute("src"))||"";return{src:y(n)?n:"",caption:t}}}return u(o,"blotName","cms-video"),u(o,"tagName","div"),u(o,"className","ql-cms-video-container"),o}catch(s){return console.error("Failed to create VideoBlot:",s),null}};exports.default=b;
|
|
2
|
-
//# sourceMappingURL=VideoBlot-Dd56DXr0.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VideoBlot-Dd56DXr0.cjs","sources":["../src/components/wazui/WazUiWysiwygInput/blots/VideoBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { VideoBlotReturnValue, VideoBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst DEFAULT_ALLOWED_VIDEO_DOMAINS = ['cloudfront.net', 'viously.com'];\n\nconst isValidVideoUrl = (url: string, allowedDomains: string[] = DEFAULT_ALLOWED_VIDEO_DOMAINS): boolean => {\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false;\n return allowedDomains.some(domain => parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`));\n } catch {\n return false;\n }\n};\n\nconst createVideoBlot = async () => {\n if (typeof window === 'undefined') return null;\n\n try {\n const Quill = (await import('quill')).default;\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\n\n class VideoBlot extends (BlockEmbed as any) {\n static blotName = 'cms-video';\n static tagName = 'div';\n static className = 'ql-cms-video-container';\n\n static create(value: VideoBlotValue): HTMLElement {\n const container = document.createElement('div');\n container.className = 'ql-cms-video-container';\n container.style.margin = '1em 0';\n\n const videoElement = document.createElement('video');\n if (isValidVideoUrl(value.src)) {\n videoElement.setAttribute('src', value.src);\n }\n videoElement.setAttribute('controls', '');\n videoElement.setAttribute('preload', 'metadata');\n videoElement.style.maxWidth = '100%';\n videoElement.style.height = 'auto';\n videoElement.style.display = 'block';\n videoElement.style.margin = '0 auto';\n\n // Create caption element\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-cms-video-caption';\n captionElement.textContent = value.caption || 'Click to edit caption...';\n captionElement.style.fontStyle = 'italic';\n captionElement.style.color = value.caption ? '#666' : '#999';\n captionElement.style.fontSize = '14px';\n captionElement.style.marginTop = '8px';\n captionElement.style.textAlign = 'center';\n captionElement.style.minHeight = '1.2em';\n captionElement.style.outline = 'none';\n captionElement.style.padding = '4px';\n captionElement.style.borderRadius = '4px';\n captionElement.style.cursor = 'text';\n captionElement.contentEditable = 'false';\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n let isEditingCaption = false;\n\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return;\n\n isEditingCaption = true;\n captionElement.setAttribute('data-editing', 'true');\n captionElement.contentEditable = 'true';\n\n if (captionElement.textContent === 'Click to edit caption...') {\n captionElement.textContent = '';\n captionElement.style.color = '#666';\n }\n\n setTimeout(() => {\n captionElement.focus();\n const range = document.createRange();\n const selection = window.getSelection();\n range.selectNodeContents(captionElement);\n range.collapse(false);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n captionElement.addEventListener('blur', () => {\n setTimeout(() => {\n if (!captionElement.isConnected) return;\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n captionElement.contentEditable = 'false';\n const text = captionElement.textContent?.trim() || '';\n if (!text) {\n captionElement.textContent = 'Click to edit caption...';\n captionElement.style.color = '#999';\n }\n }\n }, 10);\n });\n\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n if (e.key === 'Backspace') {\n const text = captionElement.textContent?.trim() || '';\n if (!text || text === 'Click to edit caption...') {\n e.stopPropagation();\n e.preventDefault();\n\n const videoContainer = captionElement.closest('.ql-cms-video-container');\n if (videoContainer && videoContainer.parentNode) {\n videoContainer.parentNode.removeChild(videoContainer);\n setTimeout(() => {\n const quillEditor = document.querySelector('.ql-editor');\n if (quillEditor) {\n (quillEditor as HTMLElement).focus();\n }\n }, 10);\n }\n return;\n }\n }\n\n e.stopPropagation();\n });\n\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mousedown', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mouseup', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n container.appendChild(videoElement);\n container.appendChild(captionElement);\n container.contentEditable = 'false';\n\n return container;\n }\n\n static value(node: HTMLElement): VideoBlotReturnValue {\n const video = node.querySelector('video');\n const captionElement = node.querySelector('.ql-cms-video-caption');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.textContent?.trim() || '';\n if (text && text !== 'Click to edit caption...') {\n caption = text;\n }\n }\n\n const src = video?.getAttribute('src') || '';\n return {\n src: isValidVideoUrl(src) ? src : '',\n caption,\n };\n }\n }\n\n return VideoBlot;\n } catch (error) {\n console.error('Failed to create VideoBlot:', error);\n return null;\n }\n};\n\nexport default createVideoBlot;\n"],"names":["DEFAULT_ALLOWED_VIDEO_DOMAINS","isValidVideoUrl","url","allowedDomains","parsed","domain","createVideoBlot","BlockEmbed","VideoBlot","value","container","videoElement","captionElement","isEditingCaption","range","selection","_a","text","videoContainer","quillEditor","node","video","caption","src","__publicField","error"],"mappings":"iQAIA,MAAMA,EAAgC,CAAC,iBAAkB,aAAa,EAEhEC,EAAkB,CAACC,EAAaC,EAA2BH,IAA2C,CAC1G,GAAI,CACF,MAAMI,EAAS,IAAI,IAAIF,CAAG,EAC1B,OAAIE,EAAO,WAAa,SAAWA,EAAO,WAAa,SAAiB,GACjED,EAAe,KAAKE,GAAUD,EAAO,WAAaC,GAAUD,EAAO,SAAS,SAAS,IAAIC,CAAM,EAAE,CAAC,CAC3G,MAAQ,CACN,MAAO,EACT,CACF,EAEMC,EAAkB,SAAY,CAClC,GAAI,OAAO,OAAW,IAAa,OAAO,KAE1C,GAAI,CAEF,MAAMC,GADS,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,sBAAO,CAAA,GAAG,QACb,OAAO,mBAAmB,EAEnD,MAAMC,UAAmBD,CAAmB,CAK1C,OAAO,OAAOE,EAAoC,CAChD,MAAMC,EAAY,SAAS,cAAc,KAAK,EAC9CA,EAAU,UAAY,yBACtBA,EAAU,MAAM,OAAS,QAEzB,MAAMC,EAAe,SAAS,cAAc,OAAO,EAC/CV,EAAgBQ,EAAM,GAAG,GAC3BE,EAAa,aAAa,MAAOF,EAAM,GAAG,EAE5CE,EAAa,aAAa,WAAY,EAAE,EACxCA,EAAa,aAAa,UAAW,UAAU,EAC/CA,EAAa,MAAM,SAAW,OAC9BA,EAAa,MAAM,OAAS,OAC5BA,EAA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