@bagelink/vue 1.5.7 → 1.5.11
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBtn.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/SelectBtn.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectBtn.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/SelectBtn.vue"],"names":[],"mappings":"AAwEA,UAAU,MAAM;IACf,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,UAAU,KAAK;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,KAAK,WAAW,GAAG,KAAK,CAAC;AAsCzB,KAAK,iBAAiB,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;CAC3D,GAAG,WAAW,CAAC;;;;;;iBA3CD,OAAO;;AA8ItB,wBASG"}
|
package/dist/index.cjs
CHANGED
|
@@ -134,7 +134,7 @@ var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof
|
|
|
134
134
|
</head>
|
|
135
135
|
<body class="richtext-editor-content">${c}</body>
|
|
136
136
|
</html>
|
|
137
|
-
`,f=o.value.contentDocument||(e=o.value.contentWindow)?.document;if(!f)return;f.open(),f.write(u),f.close(),await new Promise(e=>setTimeout(e,0)),f.designMode=`on`,f.body.contentEditable=`true`,f.body.dir=Ue.value?`rtl`:`ltr`;let p=f.body.querySelectorAll(`blockquote, ul, ol`);console.log(`Found existing block elements:`,p.length),p.forEach(e=>{let t=e;if(console.log(`Processing element:`,t.tagName,`current dir:`,t.dir),t.dir||(t.dir=f.body.dir||`ltr`,console.log(`Applied direction to existing`,t.tagName,`:`,t.dir)),t.tagName===`UL`||t.tagName===`OL`){let e=t.querySelectorAll(`li`);e.forEach(e=>{let n=e;n.dir||(n.dir=t.dir,console.log(`Applied direction to list item:`,n.dir))})}}),s.state.content=f.body.innerHTML,s.init(f),Td(f,d),r.basic&&r.modelValue&&setTimeout(()=>{let e=f.body.querySelectorAll(`*`);e.forEach(e=>{if(e.tagName!==`P`&&e.tagName!==`BR`){let n=e.textContent||``;if(n.trim()){var t;let r=f.createElement(`p`);r.textContent=n,(t=e.parentNode)?.replaceChild(r,e)}else e.remove()}else e.tagName===`P`&&Array.from(e.attributes).forEach(t=>{t.name!==`dir`&&e.removeAttribute(t.name)})}),z(f)},100),f.addEventListener(`selectionchange`,()=>{setTimeout(()=>{ie()},10)}),f.addEventListener(`mouseup`,()=>{setTimeout(()=>{ie()},10)}),f.addEventListener(`click`,e=>{setTimeout(()=>{let e=f.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&ae()},10)}),f.addEventListener(`keydown`,e=>{[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Escape`].includes(e.key)&&setTimeout(()=>{let e=f.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&ae()},10)});let m=f.createTreeWalker(f.body,NodeFilter.SHOW_TEXT),h=[],g;for(;g=m.nextNode();)g.parentElement===f.body&&h.push(g);if(h.forEach(e=>{var t;if((t=e.textContent)?.trim()){let t=f.createElement(`p`);t.dir=f.body.dir,t.appendChild(e.cloneNode()),f.body.replaceChild(t,e)}else f.body.removeChild(e)}),f.addEventListener(`contextmenu`,e=>{let t=e.target,n=t.closest(`td, th`);if(n&&n.closest(`table`)){e.preventDefault(),L.value=n;let t=o.value.getBoundingClientRect();ee.value={x:t.left+e.clientX,y:t.top+e.clientY},I.value=!0}}),f.addEventListener(`click`,e=>{f.querySelectorAll(`.table-cell-selected`).forEach(e=>{e.classList.remove(`table-cell-selected`)});let t=e.target,n=t.closest(`td, th`);n&&n.closest(`table`)&&(n.classList.add(`table-cell-selected`),L.value=n)}),Ke(f),console.log(`About to setup table edit buttons...`),Ge(f),console.log(`Table edit buttons setup completed`),z(f),!f.body.innerHTML.trim()||!f.body.querySelector(`p,h1,h2,h3,h4,h5,h6,blockquote,ul,ol,table`)){let e=f.createElement(`p`);e.dir=f.body.dir,f.body.appendChild(e);let t=f.createRange();t.selectNodeContents(e),t.collapse(!0);let n=f.getSelection();n&&(n.removeAllRanges(),n.addRange(t)),z(f)}r.autofocus===!0&&f.body.focus(),l.value=!0}catch(e){console.error(`Error during editor initialization:`,e)}finally{c.value=!1}}}(0,u.watch)(()=>r.modelValue,(e,t)=>{e!==s.state.content&&(!t||Math.abs(e.length-t.length)>50?(l.value=!1,s.state.content=e,s.updateState.content(`html`),setTimeout(()=>{s.state.doc&&(z(s.state.doc),Ge(s.state.doc))},100)):setTimeout(()=>{s.state.doc&&Ge(s.state.doc)},50))}),(0,u.watch)(()=>s.state.content,e=>{var t;(t=s.state.doc)?.body&&(s.state.doc.body.dir=Ue.value?`rtl`:`ltr`),i(`update:modelValue`,e)}),(0,u.watch)(()=>F.value.alignment,e=>{if(R?.existingTable){let t=R.existingTable;e===`center`?(t.style.marginLeft=`auto`,t.style.marginRight=`auto`):e===`right`?(t.style.marginLeft=`auto`,t.style.marginRight=`0`):(t.style.marginLeft=`0`,t.style.marginRight=`auto`),s.state.doc&&z(s.state.doc)}});function Je(){I.value=!1}return typeof window<`u`&&window.addEventListener(`click`,Je),(0,u.onBeforeUnmount)(()=>{typeof window<`u`&&window.removeEventListener(`click`,Je)}),t({editor:s,commands:d}),(e,t)=>{var n,r,i,c,l;return(0,u.openBlock)(),(0,u.createElementBlock)(u.Fragment,null,[(0,u.createElementVNode)(`div`,(0,u.mergeProps)({class:`bagel-input`},(0,u.unref)(a)),[e.label?((0,u.openBlock)(),(0,u.createElementBlock)(`label`,Ed,(0,u.toDisplayString)(e.label),1)):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`div`,{class:(0,u.normalizeClass)([`rounded`,[{"rich-text-editor pt-05 px-05 pb-075":!e.basic,"rich-text-editor--basic":e.basic,"fullscreen-mode":(0,u.unref)(s).state.isFullscreen}]])},[(0,u.unref)(s).state.hasInit&&f.value?((0,u.openBlock)(),(0,u.createBlock)(td,{key:0,config:m.value,selectedStyles:(0,u.unref)(s).state.selectedStyles,"hide-images":e.hideImages,"hide-videos":e.hideVideos,"hide-embeds":e.hideEmbed,"hide-tables":e.hideTables,"hide-alignment":e.hideAlignment,"hide-directions":e.hideDirections,"hide-h5-h6":e.hideH5H6,hide:h.value,onAction:(0,u.unref)(d).execute},null,8,[`config`,`selectedStyles`,`hide-images`,`hide-videos`,`hide-embeds`,`hide-tables`,`hide-alignment`,`hide-directions`,`hide-h5-h6`,`hide`,`onAction`])):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`div`,{class:(0,u.normalizeClass)([`editor-container`,{"split-view":(0,u.unref)(s).state.isSplitView}])},[(0,u.createElementVNode)(`div`,{class:`content-area radius-1`,style:(0,u.normalizeStyle)({height:(0,u.unref)(s).state.isFullscreen?`calc(100vh - 4rem)`:(0,u.unref)(We)})},[(0,u.createElementVNode)(`iframe`,{id:`rich-text-iframe`,ref_key:`iframe`,ref:o,class:`editableContent`,title:`Editor`,srcdoc:``,sandbox:`allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation`,onLoad:qe,onContextmenu:Ve},null,544)],4),(0,u.unref)(s).state.isSplitView?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(Uc),{key:0,modelValue:(0,u.unref)(s).state.content,"onUpdate:modelValue":[t[0]||=e=>(0,u.unref)(s).state.content=e,t[1]||=e=>(0,u.unref)(s).updateState.content(`html`)],language:`html`,height:(0,u.unref)(s).state.isFullscreen?`calc(100vh - 4rem)`:(0,u.unref)(We)},null,8,[`modelValue`,`height`])):(0,u.createCommentVNode)(``,!0)],2),e.debug?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Dd,[t[75]||=(0,u.createElementVNode)(`p`,{class:`txt12 txt-gray mb-0 p-0`},` Debug `,-1),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`visibility`,onClick:B},{default:(0,u.withCtx)(()=>t[71]||=[(0,u.createTextVNode)(` Show Content `)]),_:1,__:[71]}),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`delete`,onClick:(n=(0,u.unref)(He))?.clearSession},{default:(0,u.withCtx)(()=>t[72]||=[(0,u.createTextVNode)(` Clear Session `)]),_:1,__:[72]},8,[`onClick`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`download`,onClick:(r=(0,u.unref)(He))?.downloadSession},{default:(0,u.withCtx)(()=>t[73]||=[(0,u.createTextVNode)(` Download Log `)]),_:1,__:[73]},8,[`onClick`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`content_copy`,onClick:t[2]||=e=>{var t;return(0,u.unref)(Us)((t=(0,u.unref)(He))?.exportDebugWithPrompt()||``)}},{default:(0,u.withCtx)(()=>t[74]||=[(0,u.createTextVNode)(` Copy Log `)]),_:1,__:[74]})])):(0,u.createCommentVNode)(``,!0)],2),O.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:1,class:`inline-toolbar`,style:(0,u.normalizeStyle)({position:`fixed`,top:`${k.value.top}px`,left:`${k.value.left}px`,zIndex:99})},[(0,u.createElementVNode)(`div`,Od,[(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`format_bold`,class:(0,u.normalizeClass)({active:(0,u.unref)(s).state.selectedStyles.has(`bold`)}),onClick:t[3]||=e=>oe(`bold`)},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`format_italic`,class:(0,u.normalizeClass)({active:(0,u.unref)(s).state.selectedStyles.has(`italic`)}),onClick:t[4]||=e=>oe(`italic`)},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`format_underlined`,class:(0,u.normalizeClass)({active:(0,u.unref)(s).state.selectedStyles.has(`underline`)}),onClick:t[5]||=e=>oe(`underline`)},null,8,[`class`]),t[76]||=(0,u.createElementVNode)(`span`,{class:`separator`},`|`,-1),(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`add_link`,onClick:t[6]||=e=>oe(`link`)})])],4)):(0,u.createCommentVNode)(``,!0),I.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:2,class:`table-context-menu`,style:(0,u.normalizeStyle)({position:`fixed`,top:`${ee.value.y}px`,left:`${ee.value.x}px`,zIndex:1001})},[(0,u.createElementVNode)(`div`,{class:`context-menu-content`,onClick:t[17]||=(0,u.withModifiers)(()=>{},[`stop`])},[(0,u.createElementVNode)(`div`,kd,[t[77]||=(0,u.createElementVNode)(`span`,null,`Table Actions`,-1),(0,u.createElementVNode)(`button`,{class:`close-btn`,onClick:t[7]||=e=>I.value=!1},` × `)]),(0,u.createElementVNode)(`div`,Ad,[Re.value?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`start`,class:`context-menu-btn`,onClick:t[8]||=e=>{ke(),I.value=!1}},{default:(0,u.withCtx)(()=>t[78]||=[(0,u.createTextVNode)(` Merge Right `)]),_:1,__:[78]})):(0,u.createCommentVNode)(``,!0),ze.value?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:1,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`text_select_move_down`,class:`context-menu-btn`,onClick:t[9]||=e=>{Ae(),I.value=!1}},{default:(0,u.withCtx)(()=>t[79]||=[(0,u.createTextVNode)(` Merge Down `)]),_:1,__:[79]})):(0,u.createCommentVNode)(``,!0),Be.value?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:2,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`call_split`,class:`context-menu-btn`,onClick:t[10]||=e=>{je(),I.value=!1}},{default:(0,u.withCtx)(()=>t[80]||=[(0,u.createTextVNode)(` Split Cell `)]),_:1,__:[80]})):(0,u.createCommentVNode)(``,!0),Re.value||ze.value||Be.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,jd)):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_above`,class:`context-menu-btn`,onClick:t[11]||=e=>{Me(),I.value=!1}},{default:(0,u.withCtx)(()=>t[81]||=[(0,u.createTextVNode)(` Insert Row Above `)]),_:1,__:[81]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_below`,class:`context-menu-btn`,onClick:t[12]||=e=>{Ne(),I.value=!1}},{default:(0,u.withCtx)(()=>t[82]||=[(0,u.createTextVNode)(` Insert Row Below `)]),_:1,__:[82]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[13]||=e=>{Pe(),I.value=!1}},{default:(0,u.withCtx)(()=>t[83]||=[(0,u.createTextVNode)(` Delete Row `)]),_:1,__:[83]}),t[87]||=(0,u.createElementVNode)(`div`,{class:`context-menu-separator`},null,-1),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_left`,class:`context-menu-btn`,onClick:t[14]||=e=>{Fe(),I.value=!1}},{default:(0,u.withCtx)(()=>t[84]||=[(0,u.createTextVNode)(` Insert Column Left `)]),_:1,__:[84]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_right`,class:`context-menu-btn`,onClick:t[15]||=e=>{Ie(),I.value=!1}},{default:(0,u.withCtx)(()=>t[85]||=[(0,u.createTextVNode)(` Insert Column Right `)]),_:1,__:[85]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[16]||=e=>{Le(),I.value=!1}},{default:(0,u.withCtx)(()=>t[86]||=[(0,u.createTextVNode)(` Delete Column `)]),_:1,__:[86]})])])],4)):(0,u.createCommentVNode)(``,!0)],16),(0,u.createVNode)((0,u.unref)(Ow),{visible:g.value,"onUpdate:visible":t[21]||=e=>g.value=e,title:`Add Link`,width:`400`},{footer:(0,u.withCtx)(()=>[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[20]||=e=>g.value=!1}),(0,u.createVNode)((0,u.unref)(T),{value:`Add Link`,disabled:!de(_.value.url),onClick:le},null,8,[`disabled`])]),default:(0,u.withCtx)(()=>[(0,u.createElementVNode)(`div`,Md,[(0,u.createVNode)(H,{modelValue:_.value.url,"onUpdate:modelValue":t[18]||=e=>_.value.url=e,label:`URL`,type:`url`,placeholder:`https://example.com`,onKeydown:(0,u.withKeys)(le,[`enter`])},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(T),{icon:`open_in_new`,class:`mb-05 radius-1`,flat:``,disabled:!de(_.value.url),onClick:ue},null,8,[`disabled`])]),(0,u.createVNode)(Fc,{modelValue:_.value.openInNewTab,"onUpdate:modelValue":t[19]||=e=>_.value.openInNewTab=e,label:`Open in new tab`,type:`checkbox`,class:`mb-2 mt-05`},null,8,[`modelValue`])]),_:1},8,[`visible`]),v.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:0,class:`editor-tooltip`,style:(0,u.normalizeStyle)({left:`${y.value.x}px`,top:`${y.value.y}px`})},(0,u.toDisplayString)(y.value.message),5)):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(Ow),{visible:x.value,"onUpdate:visible":t[29]||=e=>x.value=e,title:(i=(0,u.unref)(C))?.existingImage?`Edit Image`:`Insert Image`,width:`500`},{footer:(0,u.withCtx)(()=>{var e,n;return[(0,u.createElementVNode)(`div`,Pd,[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[28]||=e=>x.value=!1}),(e=(0,u.unref)(C))?.existingImage?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Image`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:De})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{class:`ms-auto`,value:(n=(0,u.unref)(C))?.existingImage?`Save Changes`:`Insert Image`,disabled:!S.value.src,onClick:pe},null,8,[`value`,`disabled`])])]}),default:(0,u.withCtx)(()=>[(0,u.createVNode)(H,{modelValue:S.value.src,"onUpdate:modelValue":t[22]||=e=>S.value.src=e,label:`Image URL`,type:`url`,placeholder:`https://example.com/image.jpg`,onKeydown:(0,u.withKeys)(pe,[`enter`])},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:S.value.alt,"onUpdate:modelValue":t[23]||=e=>S.value.alt=e,label:`Alt Text`,placeholder:`Describe the image`},null,8,[`modelValue`]),(0,u.createElementVNode)(`div`,Nd,[(0,u.createVNode)(H,{modelValue:S.value.width,"onUpdate:modelValue":t[24]||=e=>S.value.width=e,label:`Width`,placeholder:`100% or 500px or auto`,help:`Examples: 100%, 500px, auto`},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:S.value.height,"onUpdate:modelValue":t[25]||=e=>S.value.height=e,label:`Height`,placeholder:`auto or 300px`,help:`Examples: auto, 300px`},null,8,[`modelValue`])]),(0,u.createVNode)(H,{modelValue:S.value.credit,"onUpdate:modelValue":t[26]||=e=>S.value.credit=e,label:`Photo Credit`,placeholder:`Photographer name (optional)`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:S.value.figcaption,"onUpdate:modelValue":t[27]||=e=>S.value.figcaption=e,label:`Show alt text as caption`,help:`Photo credit will always be shown if provided`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),(0,u.createVNode)((0,u.unref)(Ow),{visible:w.value,"onUpdate:visible":t[35]||=e=>w.value=e,title:(c=(0,u.unref)(D))?.existingEmbed?`Edit Embed`:`Insert Embed`,width:`500`},{footer:(0,u.withCtx)(()=>{var e,n;return[(0,u.createElementVNode)(`div`,Id,[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[34]||=e=>w.value=!1}),(e=(0,u.unref)(D))?.existingEmbed?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Embed`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Oe})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{value:(n=(0,u.unref)(D))?.existingEmbed?`Save Changes`:`Insert Embed`,disabled:!E.value.src,class:`ms-auto`,onClick:ge},null,8,[`value`,`disabled`])])]}),default:(0,u.withCtx)(()=>[(0,u.createVNode)(H,{modelValue:E.value.src,"onUpdate:modelValue":t[30]||=e=>E.value.src=e,label:`Embed URL or Code`,type:`url`,placeholder:`https://www.youtube.com/embed/... or paste iframe code`,onKeydown:(0,u.withKeys)(ge,[`enter`])},null,8,[`modelValue`]),(0,u.createElementVNode)(`div`,Fd,[(0,u.createVNode)(H,{modelValue:E.value.width,"onUpdate:modelValue":t[31]||=e=>E.value.width=e,label:`Width`,placeholder:`560`},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:E.value.height,"onUpdate:modelValue":t[32]||=e=>E.value.height=e,label:`Height`,placeholder:`315`},null,8,[`modelValue`])]),(0,u.createVNode)(H,{modelValue:E.value.alt,"onUpdate:modelValue":t[33]||=e=>E.value.alt=e,label:`Caption`,placeholder:`Enter caption (optional)`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),(0,u.createVNode)((0,u.unref)(Ow),{visible:j.value,"onUpdate:visible":t[48]||=e=>j.value=e,title:`Insert Video`,width:`500`},{footer:(0,u.withCtx)(()=>{var e;return[(0,u.createElementVNode)(`div`,Hd,[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[47]||=e=>j.value=!1}),(e=(0,u.unref)(N))?.existingVideo?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Video`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:be})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{value:`Insert Video`,class:`ms-auto`,disabled:!M.value.src||!ve(M.value.src),onClick:ye},null,8,[`disabled`])])]}),default:(0,u.withCtx)(()=>[(0,u.createElementVNode)(`div`,Ld,[(0,u.createVNode)(H,{modelValue:M.value.src,"onUpdate:modelValue":t[36]||=e=>M.value.src=e,label:`Video URL or Embed Code`,type:`url`,placeholder:`Paste YouTube URL, video file URL, or iframe embed code...`,class:(0,u.normalizeClass)({error:M.value.src&&!ve(M.value.src)}),onKeydown:(0,u.withKeys)(ye,[`enter`])},null,8,[`modelValue`,`class`]),M.value.src&&!ve(M.value.src)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Rd,[(0,u.createVNode)((0,u.unref)($),{name:`warning`}),t[88]||=(0,u.createElementVNode)(`p`,{class:`txt12`},` Please enter a valid video URL or iframe embed code `,-1)])):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)(H,{modelValue:M.value.width,"onUpdate:modelValue":t[37]||=e=>M.value.width=e,label:`Width`,placeholder:`100% or 500px or 50vw`,help:`Examples: 100%, 500px, 50vw, 300`},null,8,[`modelValue`]),(0,u.createVNode)(ju,{modelValue:M.value.aspectRatio,"onUpdate:modelValue":t[38]||=e=>M.value.aspectRatio=e,label:`Aspect Ratio`,options:[{value:`16:9`,label:`16:9 (Standard)`},{value:`4:3`,label:`4:3 (Classic)`},{value:`9:16`,label:`9:16 (Vertical/Shorts)`},{value:`21:9`,label:`21:9 (Cinematic)`},{value:`1:1`,label:`1:1 (Square)`},{value:`custom`,label:`Custom`}]},null,8,[`modelValue`]),M.value.aspectRatio===`custom`?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,zd,[(0,u.createVNode)(H,{modelValue:M.value.customWidth,"onUpdate:modelValue":t[39]||=e=>M.value.customWidth=e,label:`Width ratio`,placeholder:`16`,type:`number`},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:M.value.customHeight,"onUpdate:modelValue":t[40]||=e=>M.value.customHeight=e,label:`Height ratio`,placeholder:`9`,type:`number`},null,8,[`modelValue`])])):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`div`,Bd,[(0,u.createVNode)(Fc,{modelValue:M.value.controls,"onUpdate:modelValue":t[41]||=e=>M.value.controls=e,label:`Show controls`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.autoplay,"onUpdate:modelValue":t[42]||=e=>M.value.autoplay=e,label:`Autoplay`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.mute,"onUpdate:modelValue":t[43]||=e=>M.value.mute=e,label:`Mute`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.loop,"onUpdate:modelValue":t[44]||=e=>M.value.loop=e,label:`Loop`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.showCaption,"onUpdate:modelValue":t[45]||=e=>M.value.showCaption=e,class:`grid-span-2`,label:`Show caption below video`},null,8,[`modelValue`]),M.value.showCaption?((0,u.openBlock)(),(0,u.createBlock)(H,{key:0,modelValue:M.value.caption,"onUpdate:modelValue":t[46]||=e=>M.value.caption=e,label:`Caption`,class:`grid-span-2`,placeholder:`Describe the video content`},null,8,[`modelValue`])):(0,u.createCommentVNode)(``,!0)]),M.value.src&&ve(M.value.src)?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(dr),{key:2,frame:``,thin:``,class:`bg-gray-20`},{default:(0,u.withCtx)(()=>[t[89]||=(0,u.createElementVNode)(`p`,{class:`label`},` Preview: `,-1),(0,u.createElementVNode)(`div`,Vd,[(0,u.createVNode)((0,u.unref)(un),{src:M.value.src,class:``,"aspect-ratio":M.value.aspectRatio===`custom`&&M.value.customWidth&&M.value.customHeight?`${M.value.customWidth}:${M.value.customHeight}`:M.value.aspectRatio,autoplay:!1,mute:M.value.mute,controls:M.value.controls,loop:M.value.loop},null,8,[`src`,`aspect-ratio`,`mute`,`controls`,`loop`])])]),_:1,__:[89]})):(0,u.createCommentVNode)(``,!0)])]),_:1},8,[`visible`]),(0,u.createVNode)((0,u.unref)(Ow),{visible:P.value,"onUpdate:visible":t[70]||=e=>P.value=e,title:(l=(0,u.unref)(R))?.existingTable?`Edit Table`:`Insert Table`,width:`700`},{default:(0,u.withCtx)(()=>[(0,u.createElementVNode)(`div`,Ud,[t[92]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Structure `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)(Ul,{modelValue:F.value.rows,"onUpdate:modelValue":t[49]||=e=>F.value.rows=e,min:1,max:20,label:`Rows`},null,8,[`modelValue`]),(0,u.createVNode)(Ul,{modelValue:F.value.cols,"onUpdate:modelValue":t[50]||=e=>F.value.cols=e,min:1,max:10,label:`Columns`},null,8,[`modelValue`]),(0,u.createElementVNode)(`div`,Wd,[t[90]||=(0,u.createElementVNode)(`label`,{class:`label`},`Cell Text Alignment`,-1),(0,u.createElementVNode)(`div`,Gd,[(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.alignment===`left`}),flat:``,thin:``,icon:`format_align_left`,title:`Align Left`,onClick:t[51]||=e=>F.value.alignment=`left`},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.alignment===`center`}),flat:``,thin:``,icon:`format_align_center`,title:`Align Center`,onClick:t[52]||=e=>F.value.alignment=`center`},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.alignment===`right`}),flat:``,thin:``,icon:`format_align_right`,title:`Align Right`,onClick:t[53]||=e=>F.value.alignment=`right`},null,8,[`class`])])]),(0,u.createElementVNode)(`div`,Kd,[t[91]||=(0,u.createElementVNode)(`label`,{class:`label`},`Text Direction`,-1),(0,u.createElementVNode)(`div`,qd,[(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.direction===`ltr`}),flat:``,thin:``,value:`LTR`,title:`Left to Right`,onClick:t[54]||=e=>F.value.direction=`ltr`},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.direction===`rtl`}),flat:``,thin:``,value:`RTL`,title:`Right to Left`,onClick:t[55]||=e=>F.value.direction=`rtl`},null,8,[`class`])])]),t[93]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Style `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)(Ul,{modelValue:F.value.width,"onUpdate:modelValue":t[56]||=e=>F.value.width=e,label:`Width (%)`,min:25,max:100},null,8,[`modelValue`]),(0,u.createVNode)(Ul,{modelValue:F.value.cellPadding,"onUpdate:modelValue":t[57]||=e=>F.value.cellPadding=e,label:`Cell Padding (px)`,min:2,max:20},null,8,[`modelValue`]),(0,u.createVNode)(Ul,{modelValue:F.value.borderWidth,"onUpdate:modelValue":t[58]||=e=>F.value.borderWidth=e,label:`Border Width (px)`,min:0,max:5},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.borderColor,"onUpdate:modelValue":t[59]||=e=>F.value.borderColor=e,label:`Border Color`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:F.value.fixedLayout,"onUpdate:modelValue":t[60]||=e=>F.value.fixedLayout=e,label:`Fixed cell width (doesn't change by content)`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),t[94]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Cell Colors: `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.cellBgColor,"onUpdate:modelValue":t[61]||=e=>F.value.cellBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Background Color`},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.cellTextColor,"onUpdate:modelValue":t[62]||=e=>F.value.cellTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Text Color`},null,8,[`modelValue`]),t[95]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Row Styles: `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)(Fc,{modelValue:F.value.showHeaders,"onUpdate:modelValue":t[63]||=e=>F.value.showHeaders=e,label:`Show header row`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),F.value.showHeaders?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Jd,[(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.headerBgColor,"onUpdate:modelValue":t[64]||=e=>F.value.headerBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Background Color`},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.headerTextColor,"onUpdate:modelValue":t[65]||=e=>F.value.headerTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Text Color`},null,8,[`modelValue`])])):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)(Fc,{modelValue:F.value.alternateRows,"onUpdate:modelValue":t[66]||=e=>F.value.alternateRows=e,label:`Alternating Row Colors`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),F.value.alternateRows?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Yd,[(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.alternateRowBgColor,"onUpdate:modelValue":t[67]||=e=>F.value.alternateRowBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Background:`},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.alternateRowTextColor,"onUpdate:modelValue":t[68]||=e=>F.value.alternateRowTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Text:`},null,8,[`modelValue`])])):(0,u.createCommentVNode)(``,!0)]),t[96]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Preview `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createElementVNode)(`div`,{style:{zoom:`0.8`},class:`opacity-7 user-select-none pointer-events-none`,innerHTML:te.value},null,8,Xd)]),footer:(0,u.withCtx)(()=>{var e,n;return[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[69]||=e=>P.value=!1}),(e=(0,u.unref)(R))?.existingTable?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Table`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Te})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{value:(n=(0,u.unref)(R))?.existingTable?`Save`:`Insert Table`,class:`ms-auto`,onClick:Ce},null,8,[`value`])]}),_:1},8,[`visible`,`title`])],64)}}}),Qd=v(Zd,[[`__scopeId`,`data-v-b0eaafbe`]]);const $d={class:`flex flex-wrap gap-05 SelectBtn`};var ef=(0,u.defineComponent)({__name:`SelectBtn`,props:(0,u.mergeModels)({options:{},thin:{type:Boolean},outline:{type:Boolean},multiselect:{type:Boolean,default:!1}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=(0,u.useModel)(e,`modelValue`);function r(e){if(t.multiselect){let t=Array.isArray(n.value)?n.value:[],r=t.indexOf(e);r>-1?n.value=t.filter(t=>t!==e):n.value=[...t,e]}else n.value===e?n.value=null:n.value=e}function i(e){return Array.isArray(n.value)?n.value.includes(e):n.value===e}return(e,t)=>((0,u.openBlock)(),(0,u.createElementBlock)(`div`,$d,[((0,u.openBlock)(!0),(0,u.createElementBlock)(u.Fragment,null,(0,u.renderList)(e.options,t=>((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:t.value,thin:e.thin,outline:e.outline,class:(0,u.normalizeClass)([i(t.value)?`primary`:`bg-transparent`,`border px-075 radius-2`]),type:`button`,onClick:e=>r(t.value)},{default:(0,u.withCtx)(()=>[t.icon?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)($),{key:0,name:t.icon,weight:`300`},null,8,[`name`])):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`p`,null,(0,u.toDisplayString)(t.label),1)]),_:2},1032,[`thin`,`outline`,`class`,`onClick`]))),128))]))}}),tf=v(ef,[[`__scopeId`,`data-v-405ca648`]]),nf=class{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt((this.x-e.x)**2+(this.y-e.y)**2)}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time===e.time?0:this.distanceTo(e)/(this.time-e.time)}},rf=class e{static fromPoints(t,n){let r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=t.x-n.x,o=t.y-n.y,s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=Math.sqrt(r*r+i*i),u=Math.sqrt(a*a+o*o),d=s.x-c.x,f=s.y-c.y,p=l+u==0?0:u/(l+u),m={x:c.x+d*p,y:c.y+f*p},h=t.x-m.x,g=t.y-m.y;return{c1:new nf(s.x+h,s.y+g),c2:new nf(c.x+h,c.y+g)}}constructor(e,t,n,r,i,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}length(){let e=10,t=0,n,r;for(let i=0;i<=e;i+=1){let a=i/e,o=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(i>0){let e=o-n,i=s-r;t+=Math.sqrt(e*e+i*i)}n=o,r=s}return t}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},af=class{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};function sf(e,t=250){let n=0,r=null,i,a,o,s=()=>{n=Date.now(),r=null,i=e.apply(a,o),r||(a=null,o=[])};return function(...c){let l=Date.now(),u=t-(l-n);return a=this,o=c,u<=0||u>t?(r&&(clearTimeout(r),r=null),n=l,i=e.apply(a,o),r||(a=null,o=[])):r||=window.setTimeout(s,u),i}}var cf=class e extends af{constructor(t,n={}){var r,i,a;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=e=>{!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))},this._handleMouseMove=e=>{if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))},this._handleMouseUp=e=>{this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))},this._handleTouchStart=e=>{e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))},this._handleTouchMove=e=>{if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}},this._handleTouchEnd=e=>{e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))},this._handlePointerDown=e=>{!e.isPrimary||!this._isLeftButtonPressed(e)||this._drawingStroke||this._strokePointerId!==void 0&&this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))},this._handlePointerMove=e=>{if(!(!e.isPrimary||this._strokePointerId!==this._getPointerId(e))){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}},this._handlePointerUp=e=>{!e.isPrimary||this._isLeftButtonPressed(e)||this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=void 0,e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=(r=n.throttle)??16,this.minDistance=(i=n.minDistance)??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||`black`,this.backgroundColor=n.backgroundColor||`rgba(0,0,0,0)`,this.compositeOperation=n.compositeOperation||`source-over`,this.canvasContextOptions=(a=n.canvasContextOptions)??{},this._strokeMoveUpdate=this.throttle?sf(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._ctx=t.getContext(`2d`,this.canvasContextOptions),this.clear(),this.on()}clear(){let{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(e,t={}){return new Promise((n,r)=>{let i=new Image,a=t.ratio||window.devicePixelRatio||1,o=t.width||this.canvas.width/a,s=t.height||this.canvas.height/a,c=t.xOffset||0,l=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,c,l,o,s),n()},i.onerror=e=>{r(e)},i.crossOrigin=`anonymous`,i.src=e,this._isEmpty=!1})}toDataURL(e=`image/png`,t){switch(e){case`image/svg+xml`:return typeof t!=`object`&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!=`number`&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction=`none`,this.canvas.style.msTouchAction=`none`,this.canvas.style.userSelect=`none`;let e=/Macintosh/.test(navigator.userAgent)&&`ontouchstart`in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),`ontouchstart`in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction=`auto`,this.canvas.style.msTouchAction=`auto`,this.canvas.style.userSelect=`auto`,this.canvas.removeEventListener(`pointerdown`,this._handlePointerDown),this.canvas.removeEventListener(`mousedown`,this._handleMouseDown),this.canvas.removeEventListener(`touchstart`,this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;let t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)??this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){let{removeEventListener:e}=this._getListenerFunctions();e(`pointermove`,this._handlePointerMove),e(`pointerup`,this._handlePointerUp),e(`mousemove`,this._handleMouseMove),e(`mouseup`,this._handleMouseUp),e(`touchmove`,this._handleTouchMove),e(`touchend`,this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)==1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:`pressure`in e?e.pressure:0}}_touchEventToSignatureEvent(e){let t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_getPointGroupOptions(e){return{penColor:e&&`penColor`in e?e.penColor:this.penColor,dotSize:e&&`dotSize`in e?e.dotSize:this.dotSize,minWidth:e&&`minWidth`in e?e.minWidth:this.minWidth,maxWidth:e&&`maxWidth`in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&`velocityFilterWeight`in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&`compositeOperation`in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){let t=!this.dispatchEvent(new CustomEvent(`beginStroke`,{detail:e,cancelable:!0}));if(t)return;let{addEventListener:n}=this._getListenerFunctions();switch(e.event.type){case`mousedown`:n(`mousemove`,this._handleMouseMove,{passive:!1}),n(`mouseup`,this._handleMouseUp,{passive:!1});break;case`touchstart`:n(`touchmove`,this._handleTouchMove,{passive:!1}),n(`touchend`,this._handleTouchEnd,{passive:!1});break;case`pointerdown`:n(`pointermove`,this._handlePointerMove,{passive:!1}),n(`pointerup`,this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;let r=this._getPointGroupOptions(),i=Object.assign(Object.assign({},r),{points:[]});this._data.push(i),this._reset(r),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent(`beforeUpdateStroke`,{detail:e}));let t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],a=i?t.distanceTo(i)<=this.minDistance:!1,o=this._getPointGroupOptions(n);if(!i||!(i&&a)){let e=this._addPoint(t,o);i?e&&this._drawCurve(e,o):this._drawDot(t,o),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent(`afterUpdateStroke`,{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent(`endStroke`,{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`pointerdown`,this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`mousedown`,this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener(`touchstart`,this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){let r=this.canvas.getBoundingClientRect();return new nf(e-r.left,t-r.top,n,new Date().getTime())}_addPoint(e,t){let{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);let e=this._calculateCurveWidths(n[1],n[2],t),r=rf.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){let r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){let r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){let n=this._ctx,r=e.endWidth-e.startWidth,i=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){let a=n/i,o=a*a,s=o*a,c=1-a,l=c*c,u=l*c,d=u*e.startPoint.x;d+=3*l*a*e.control1.x,d+=3*c*o*e.control2.x,d+=s*e.endPoint.x;let f=u*e.startPoint.y;f+=3*l*a*e.control1.y,f+=3*c*o*e.control2.y,f+=s*e.endPoint.y;let p=Math.min(e.startWidth+s*r,t.maxWidth);this._drawCurveSegment(d,f,p)}n.closePath(),n.fill()}_drawDot(e,t){let n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(let r of e){let{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){let r=e[n],a=new nf(r.x,r.y,r.pressure,r.time);n===0&&this._reset(i);let o=this._addPoint(a,i);o&&t(o,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1}={}){let t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=0,i=0,a=this.canvas.width/n,o=this.canvas.height/n,s=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(s.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),s.setAttribute(`xmlns:xlink`,`http://www.w3.org/1999/xlink`),s.setAttribute(`viewBox`,`${r} ${i} ${a} ${o}`),s.setAttribute(`width`,a.toString()),s.setAttribute(`height`,o.toString()),e&&this.backgroundColor){let e=document.createElement(`rect`);e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),e.setAttribute(`fill`,this.backgroundColor),s.appendChild(e)}return this._fromData(t,(e,{penColor:t})=>{let n=document.createElement(`path`);if(!isNaN(e.control1.x)&&!isNaN(e.control1.y)&&!isNaN(e.control2.x)&&!isNaN(e.control2.y)){let r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute(`d`,r),n.setAttribute(`stroke-width`,(e.endWidth*2.25).toFixed(3)),n.setAttribute(`stroke`,t),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-linecap`,`round`),s.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{let a=document.createElement(`circle`),o=n>0?n:(r+i)/2;a.setAttribute(`r`,o.toString()),a.setAttribute(`cx`,e.x.toString()),a.setAttribute(`cy`,e.y.toString()),a.setAttribute(`fill`,t),s.appendChild(a)}),s.outerHTML}};const lf=[`disabled`],uf=[`required`];var df=(0,u.defineComponent)({__name:`SignaturePad`,props:(0,u.mergeModels)({sigOption:{},width:{},height:{},ratio:{},clearOnResize:{type:Boolean},waterMark:{},disabled:{type:Boolean},defaultUrl:{},format:{},clearable:{type:Boolean,default:!0},required:{type:Boolean}},{modelValue:{},modelModifiers:{},file:{},fileModifiers:{}}),emits:[`update:modelValue`,`update:file`],setup(e,{expose:t}){let n=e,r=(0,u.useModel)(e,`modelValue`),i=(0,u.useModel)(e,`file`),a=(0,u.ref)(),o=(0,u.ref)(),s=(0,u.ref)(!0);function c(){var e;(e=o.value)?.clear(),s.value=!0,r.value=void 0}function l(e){var t,r;return e||=n.format,e?(t=o.value)?.toDataURL(e):(r=o.value)?.toDataURL()}function d(){let e=l();if(e)if(n.format===`image/svg+xml`)i.value=new File([e],`signature.svg`,{type:`image/svg+xml`});else try{let t=e.split(`,`)[1];if(!t)throw Error(`Invalid data URL format`);let r=atob(t),a=new Uint8Array(Array.from(r,e=>e.charCodeAt(0))),o=n.format||`image/png`,s=new Blob([a],{type:o}),c=o.split(`/`)[1];i.value=new File([s],`signature.${c}`,{type:o})}catch(e){console.error(`Error saving signature file:`,e)}}function f(e){var t,r,i;return(t=o.value)?.fromDataURL(e,{height:(r=a.value)?.height,width:(i=a.value)?.width,ratio:n.ratio,xOffset:0,yOffset:0})}let p=()=>{var e;return(e=o.value)?.isEmpty()};function m(){var e;let t=(e=o.value)?.toData();if(t){var n;t.pop(),(n=o.value)?.fromData(t)}}let h=(0,u.ref)({penColor:`rgb(0, 0, 0)`,backgroundColor:`rgb(255, 255, 255)`}),g=(0,u.computed)(()=>({...h.value,...n.sigOption}));(0,u.watch)(()=>n.disabled,e=>{var t,n;e?(t=o.value)?.off():(n=o.value)?.on()});function _(e){if(Object.prototype.toString.call(e)!==`[object Object]`)throw Error(`Expected Object, got ${typeof e}.`);{var t;let n={text:e.text||``,x:e.x||20,y:e.y||20,sx:e.sx||40,sy:e.sy||40},r=(t=a.value)?.getContext(`2d`);if(!r)return;r.font=e.font||`20px sans-serif`,r.fillStyle=e.fillStyle||`#333`,r.strokeStyle=e.strokeStyle||`#333`,e.style===`all`?(r.fillText(n.text,n.x,n.y),r.strokeText(n.text,n.sx,n.sy)):e.style===`stroke`?r.strokeText(n.text,n.sx,n.sy):r.fillText(n.text,n.x,n.y)}}function v(){var e;s.value=(e=o.value)?.isEmpty()??!1;let t=l();r.value=t,d()}function y(e){if(!e)return;let t=new FileReader;return new Promise(n=>{t.onload=e=>{var t;let i=String((t=e.target)?.result);f(i),s.value=!1,r.value=i,n(!0)},t.readAsDataURL(e)})}(0,u.watch)(i,e=>{y(e)});function b(){let e;p()||(e=l());let t=n.ratio??1/2,{width:r}=a.value.getBoundingClientRect();a.value.width=n.width?Number(n.width.replaceAll(`px`,``)):r,a.value.height=n.height?Number(n.height.replaceAll(`px`,``)):r*t,c(),!n.clearOnResize&&e!==void 0&&f(e),n.waterMark&&_(n.waterMark)}function x(){o.value=new cf(a.value,g.value),b(),n.disabled?o.value.off():o.value.on(),s.value=o.value.isEmpty(),i.value&&y(i.value)}return(0,u.onMounted)(x),Bt(()=>a.value,b),Pt(()=>o.value,`endStroke`,v),t({save:l,clear:c,isEmpty:p,undo:m,addWaterMark:_,fromDataURL:f}),(e,t)=>((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{class:(0,u.normalizeClass)([`bgl_input signature-pad relative`,{"bg-transparent":e.disabled}]),onTouchmove:t[0]||=(0,u.withModifiers)(()=>{},[`prevent`])},[e.clearable&&!e.disabled?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,flat:``,thin:``,icon:`refresh`,class:`position-bottom-end`,onClick:c})):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`canvas`,{ref_key:`vCanvas`,ref:a,class:`canvas`,disabled:e.disabled},null,8,lf),(0,u.createElementVNode)(`input`,{placeholder:`required`,type:`text`,required:e.required&&(0,u.unref)(s),class:`pixel opacity-0`,inputMode:`none`},null,8,uf)],34))}}),ff=df;
|
|
137
|
+
`,f=o.value.contentDocument||(e=o.value.contentWindow)?.document;if(!f)return;f.open(),f.write(u),f.close(),await new Promise(e=>setTimeout(e,0)),f.designMode=`on`,f.body.contentEditable=`true`,f.body.dir=Ue.value?`rtl`:`ltr`;let p=f.body.querySelectorAll(`blockquote, ul, ol`);console.log(`Found existing block elements:`,p.length),p.forEach(e=>{let t=e;if(console.log(`Processing element:`,t.tagName,`current dir:`,t.dir),t.dir||(t.dir=f.body.dir||`ltr`,console.log(`Applied direction to existing`,t.tagName,`:`,t.dir)),t.tagName===`UL`||t.tagName===`OL`){let e=t.querySelectorAll(`li`);e.forEach(e=>{let n=e;n.dir||(n.dir=t.dir,console.log(`Applied direction to list item:`,n.dir))})}}),s.state.content=f.body.innerHTML,s.init(f),Td(f,d),r.basic&&r.modelValue&&setTimeout(()=>{let e=f.body.querySelectorAll(`*`);e.forEach(e=>{if(e.tagName!==`P`&&e.tagName!==`BR`){let n=e.textContent||``;if(n.trim()){var t;let r=f.createElement(`p`);r.textContent=n,(t=e.parentNode)?.replaceChild(r,e)}else e.remove()}else e.tagName===`P`&&Array.from(e.attributes).forEach(t=>{t.name!==`dir`&&e.removeAttribute(t.name)})}),z(f)},100),f.addEventListener(`selectionchange`,()=>{setTimeout(()=>{ie()},10)}),f.addEventListener(`mouseup`,()=>{setTimeout(()=>{ie()},10)}),f.addEventListener(`click`,e=>{setTimeout(()=>{let e=f.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&ae()},10)}),f.addEventListener(`keydown`,e=>{[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Escape`].includes(e.key)&&setTimeout(()=>{let e=f.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&ae()},10)});let m=f.createTreeWalker(f.body,NodeFilter.SHOW_TEXT),h=[],g;for(;g=m.nextNode();)g.parentElement===f.body&&h.push(g);if(h.forEach(e=>{var t;if((t=e.textContent)?.trim()){let t=f.createElement(`p`);t.dir=f.body.dir,t.appendChild(e.cloneNode()),f.body.replaceChild(t,e)}else f.body.removeChild(e)}),f.addEventListener(`contextmenu`,e=>{let t=e.target,n=t.closest(`td, th`);if(n&&n.closest(`table`)){e.preventDefault(),L.value=n;let t=o.value.getBoundingClientRect();ee.value={x:t.left+e.clientX,y:t.top+e.clientY},I.value=!0}}),f.addEventListener(`click`,e=>{f.querySelectorAll(`.table-cell-selected`).forEach(e=>{e.classList.remove(`table-cell-selected`)});let t=e.target,n=t.closest(`td, th`);n&&n.closest(`table`)&&(n.classList.add(`table-cell-selected`),L.value=n)}),Ke(f),console.log(`About to setup table edit buttons...`),Ge(f),console.log(`Table edit buttons setup completed`),z(f),!f.body.innerHTML.trim()||!f.body.querySelector(`p,h1,h2,h3,h4,h5,h6,blockquote,ul,ol,table`)){let e=f.createElement(`p`);e.dir=f.body.dir,f.body.appendChild(e);let t=f.createRange();t.selectNodeContents(e),t.collapse(!0);let n=f.getSelection();n&&(n.removeAllRanges(),n.addRange(t)),z(f)}r.autofocus===!0&&f.body.focus(),l.value=!0}catch(e){console.error(`Error during editor initialization:`,e)}finally{c.value=!1}}}(0,u.watch)(()=>r.modelValue,(e,t)=>{e!==s.state.content&&(!t||Math.abs(e.length-t.length)>50?(l.value=!1,s.state.content=e,s.updateState.content(`html`),setTimeout(()=>{s.state.doc&&(z(s.state.doc),Ge(s.state.doc))},100)):setTimeout(()=>{s.state.doc&&Ge(s.state.doc)},50))}),(0,u.watch)(()=>s.state.content,e=>{var t;(t=s.state.doc)?.body&&(s.state.doc.body.dir=Ue.value?`rtl`:`ltr`),i(`update:modelValue`,e)}),(0,u.watch)(()=>F.value.alignment,e=>{if(R?.existingTable){let t=R.existingTable;e===`center`?(t.style.marginLeft=`auto`,t.style.marginRight=`auto`):e===`right`?(t.style.marginLeft=`auto`,t.style.marginRight=`0`):(t.style.marginLeft=`0`,t.style.marginRight=`auto`),s.state.doc&&z(s.state.doc)}});function Je(){I.value=!1}return typeof window<`u`&&window.addEventListener(`click`,Je),(0,u.onBeforeUnmount)(()=>{typeof window<`u`&&window.removeEventListener(`click`,Je)}),t({editor:s,commands:d}),(e,t)=>{var n,r,i,c,l;return(0,u.openBlock)(),(0,u.createElementBlock)(u.Fragment,null,[(0,u.createElementVNode)(`div`,(0,u.mergeProps)({class:`bagel-input`},(0,u.unref)(a)),[e.label?((0,u.openBlock)(),(0,u.createElementBlock)(`label`,Ed,(0,u.toDisplayString)(e.label),1)):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`div`,{class:(0,u.normalizeClass)([`rounded`,[{"rich-text-editor pt-05 px-05 pb-075":!e.basic,"rich-text-editor--basic":e.basic,"fullscreen-mode":(0,u.unref)(s).state.isFullscreen}]])},[(0,u.unref)(s).state.hasInit&&f.value?((0,u.openBlock)(),(0,u.createBlock)(td,{key:0,config:m.value,selectedStyles:(0,u.unref)(s).state.selectedStyles,"hide-images":e.hideImages,"hide-videos":e.hideVideos,"hide-embeds":e.hideEmbed,"hide-tables":e.hideTables,"hide-alignment":e.hideAlignment,"hide-directions":e.hideDirections,"hide-h5-h6":e.hideH5H6,hide:h.value,onAction:(0,u.unref)(d).execute},null,8,[`config`,`selectedStyles`,`hide-images`,`hide-videos`,`hide-embeds`,`hide-tables`,`hide-alignment`,`hide-directions`,`hide-h5-h6`,`hide`,`onAction`])):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`div`,{class:(0,u.normalizeClass)([`editor-container`,{"split-view":(0,u.unref)(s).state.isSplitView}])},[(0,u.createElementVNode)(`div`,{class:`content-area radius-1`,style:(0,u.normalizeStyle)({height:(0,u.unref)(s).state.isFullscreen?`calc(100vh - 4rem)`:(0,u.unref)(We)})},[(0,u.createElementVNode)(`iframe`,{id:`rich-text-iframe`,ref_key:`iframe`,ref:o,class:`editableContent`,title:`Editor`,srcdoc:``,sandbox:`allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation`,onLoad:qe,onContextmenu:Ve},null,544)],4),(0,u.unref)(s).state.isSplitView?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(Uc),{key:0,modelValue:(0,u.unref)(s).state.content,"onUpdate:modelValue":[t[0]||=e=>(0,u.unref)(s).state.content=e,t[1]||=e=>(0,u.unref)(s).updateState.content(`html`)],language:`html`,height:(0,u.unref)(s).state.isFullscreen?`calc(100vh - 4rem)`:(0,u.unref)(We)},null,8,[`modelValue`,`height`])):(0,u.createCommentVNode)(``,!0)],2),e.debug?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Dd,[t[75]||=(0,u.createElementVNode)(`p`,{class:`txt12 txt-gray mb-0 p-0`},` Debug `,-1),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`visibility`,onClick:B},{default:(0,u.withCtx)(()=>t[71]||=[(0,u.createTextVNode)(` Show Content `)]),_:1,__:[71]}),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`delete`,onClick:(n=(0,u.unref)(He))?.clearSession},{default:(0,u.withCtx)(()=>t[72]||=[(0,u.createTextVNode)(` Clear Session `)]),_:1,__:[72]},8,[`onClick`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`download`,onClick:(r=(0,u.unref)(He))?.downloadSession},{default:(0,u.withCtx)(()=>t[73]||=[(0,u.createTextVNode)(` Download Log `)]),_:1,__:[73]},8,[`onClick`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,color:`gray`,icon:`content_copy`,onClick:t[2]||=e=>{var t;return(0,u.unref)(Us)((t=(0,u.unref)(He))?.exportDebugWithPrompt()||``)}},{default:(0,u.withCtx)(()=>t[74]||=[(0,u.createTextVNode)(` Copy Log `)]),_:1,__:[74]})])):(0,u.createCommentVNode)(``,!0)],2),O.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:1,class:`inline-toolbar`,style:(0,u.normalizeStyle)({position:`fixed`,top:`${k.value.top}px`,left:`${k.value.left}px`,zIndex:99})},[(0,u.createElementVNode)(`div`,Od,[(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`format_bold`,class:(0,u.normalizeClass)({active:(0,u.unref)(s).state.selectedStyles.has(`bold`)}),onClick:t[3]||=e=>oe(`bold`)},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`format_italic`,class:(0,u.normalizeClass)({active:(0,u.unref)(s).state.selectedStyles.has(`italic`)}),onClick:t[4]||=e=>oe(`italic`)},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`format_underlined`,class:(0,u.normalizeClass)({active:(0,u.unref)(s).state.selectedStyles.has(`underline`)}),onClick:t[5]||=e=>oe(`underline`)},null,8,[`class`]),t[76]||=(0,u.createElementVNode)(`span`,{class:`separator`},`|`,-1),(0,u.createVNode)((0,u.unref)(T),{thin:``,flat:``,icon:`add_link`,onClick:t[6]||=e=>oe(`link`)})])],4)):(0,u.createCommentVNode)(``,!0),I.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:2,class:`table-context-menu`,style:(0,u.normalizeStyle)({position:`fixed`,top:`${ee.value.y}px`,left:`${ee.value.x}px`,zIndex:1001})},[(0,u.createElementVNode)(`div`,{class:`context-menu-content`,onClick:t[17]||=(0,u.withModifiers)(()=>{},[`stop`])},[(0,u.createElementVNode)(`div`,kd,[t[77]||=(0,u.createElementVNode)(`span`,null,`Table Actions`,-1),(0,u.createElementVNode)(`button`,{class:`close-btn`,onClick:t[7]||=e=>I.value=!1},` × `)]),(0,u.createElementVNode)(`div`,Ad,[Re.value?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`start`,class:`context-menu-btn`,onClick:t[8]||=e=>{ke(),I.value=!1}},{default:(0,u.withCtx)(()=>t[78]||=[(0,u.createTextVNode)(` Merge Right `)]),_:1,__:[78]})):(0,u.createCommentVNode)(``,!0),ze.value?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:1,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`text_select_move_down`,class:`context-menu-btn`,onClick:t[9]||=e=>{Ae(),I.value=!1}},{default:(0,u.withCtx)(()=>t[79]||=[(0,u.createTextVNode)(` Merge Down `)]),_:1,__:[79]})):(0,u.createCommentVNode)(``,!0),Be.value?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:2,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`call_split`,class:`context-menu-btn`,onClick:t[10]||=e=>{je(),I.value=!1}},{default:(0,u.withCtx)(()=>t[80]||=[(0,u.createTextVNode)(` Split Cell `)]),_:1,__:[80]})):(0,u.createCommentVNode)(``,!0),Re.value||ze.value||Be.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,jd)):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_above`,class:`context-menu-btn`,onClick:t[11]||=e=>{Me(),I.value=!1}},{default:(0,u.withCtx)(()=>t[81]||=[(0,u.createTextVNode)(` Insert Row Above `)]),_:1,__:[81]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_below`,class:`context-menu-btn`,onClick:t[12]||=e=>{Ne(),I.value=!1}},{default:(0,u.withCtx)(()=>t[82]||=[(0,u.createTextVNode)(` Insert Row Below `)]),_:1,__:[82]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[13]||=e=>{Pe(),I.value=!1}},{default:(0,u.withCtx)(()=>t[83]||=[(0,u.createTextVNode)(` Delete Row `)]),_:1,__:[83]}),t[87]||=(0,u.createElementVNode)(`div`,{class:`context-menu-separator`},null,-1),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_left`,class:`context-menu-btn`,onClick:t[14]||=e=>{Fe(),I.value=!1}},{default:(0,u.withCtx)(()=>t[84]||=[(0,u.createTextVNode)(` Insert Column Left `)]),_:1,__:[84]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_right`,class:`context-menu-btn`,onClick:t[15]||=e=>{Ie(),I.value=!1}},{default:(0,u.withCtx)(()=>t[85]||=[(0,u.createTextVNode)(` Insert Column Right `)]),_:1,__:[85]}),(0,u.createVNode)((0,u.unref)(T),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[16]||=e=>{Le(),I.value=!1}},{default:(0,u.withCtx)(()=>t[86]||=[(0,u.createTextVNode)(` Delete Column `)]),_:1,__:[86]})])])],4)):(0,u.createCommentVNode)(``,!0)],16),(0,u.createVNode)((0,u.unref)(Ow),{visible:g.value,"onUpdate:visible":t[21]||=e=>g.value=e,title:`Add Link`,width:`400`},{footer:(0,u.withCtx)(()=>[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[20]||=e=>g.value=!1}),(0,u.createVNode)((0,u.unref)(T),{value:`Add Link`,disabled:!de(_.value.url),onClick:le},null,8,[`disabled`])]),default:(0,u.withCtx)(()=>[(0,u.createElementVNode)(`div`,Md,[(0,u.createVNode)(H,{modelValue:_.value.url,"onUpdate:modelValue":t[18]||=e=>_.value.url=e,label:`URL`,type:`url`,placeholder:`https://example.com`,onKeydown:(0,u.withKeys)(le,[`enter`])},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(T),{icon:`open_in_new`,class:`mb-05 radius-1`,flat:``,disabled:!de(_.value.url),onClick:ue},null,8,[`disabled`])]),(0,u.createVNode)(Fc,{modelValue:_.value.openInNewTab,"onUpdate:modelValue":t[19]||=e=>_.value.openInNewTab=e,label:`Open in new tab`,type:`checkbox`,class:`mb-2 mt-05`},null,8,[`modelValue`])]),_:1},8,[`visible`]),v.value?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:0,class:`editor-tooltip`,style:(0,u.normalizeStyle)({left:`${y.value.x}px`,top:`${y.value.y}px`})},(0,u.toDisplayString)(y.value.message),5)):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(Ow),{visible:x.value,"onUpdate:visible":t[29]||=e=>x.value=e,title:(i=(0,u.unref)(C))?.existingImage?`Edit Image`:`Insert Image`,width:`500`},{footer:(0,u.withCtx)(()=>{var e,n;return[(0,u.createElementVNode)(`div`,Pd,[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[28]||=e=>x.value=!1}),(e=(0,u.unref)(C))?.existingImage?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Image`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:De})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{class:`ms-auto`,value:(n=(0,u.unref)(C))?.existingImage?`Save Changes`:`Insert Image`,disabled:!S.value.src,onClick:pe},null,8,[`value`,`disabled`])])]}),default:(0,u.withCtx)(()=>[(0,u.createVNode)(H,{modelValue:S.value.src,"onUpdate:modelValue":t[22]||=e=>S.value.src=e,label:`Image URL`,type:`url`,placeholder:`https://example.com/image.jpg`,onKeydown:(0,u.withKeys)(pe,[`enter`])},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:S.value.alt,"onUpdate:modelValue":t[23]||=e=>S.value.alt=e,label:`Alt Text`,placeholder:`Describe the image`},null,8,[`modelValue`]),(0,u.createElementVNode)(`div`,Nd,[(0,u.createVNode)(H,{modelValue:S.value.width,"onUpdate:modelValue":t[24]||=e=>S.value.width=e,label:`Width`,placeholder:`100% or 500px or auto`,help:`Examples: 100%, 500px, auto`},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:S.value.height,"onUpdate:modelValue":t[25]||=e=>S.value.height=e,label:`Height`,placeholder:`auto or 300px`,help:`Examples: auto, 300px`},null,8,[`modelValue`])]),(0,u.createVNode)(H,{modelValue:S.value.credit,"onUpdate:modelValue":t[26]||=e=>S.value.credit=e,label:`Photo Credit`,placeholder:`Photographer name (optional)`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:S.value.figcaption,"onUpdate:modelValue":t[27]||=e=>S.value.figcaption=e,label:`Show alt text as caption`,help:`Photo credit will always be shown if provided`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),(0,u.createVNode)((0,u.unref)(Ow),{visible:w.value,"onUpdate:visible":t[35]||=e=>w.value=e,title:(c=(0,u.unref)(D))?.existingEmbed?`Edit Embed`:`Insert Embed`,width:`500`},{footer:(0,u.withCtx)(()=>{var e,n;return[(0,u.createElementVNode)(`div`,Id,[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[34]||=e=>w.value=!1}),(e=(0,u.unref)(D))?.existingEmbed?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Embed`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Oe})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{value:(n=(0,u.unref)(D))?.existingEmbed?`Save Changes`:`Insert Embed`,disabled:!E.value.src,class:`ms-auto`,onClick:ge},null,8,[`value`,`disabled`])])]}),default:(0,u.withCtx)(()=>[(0,u.createVNode)(H,{modelValue:E.value.src,"onUpdate:modelValue":t[30]||=e=>E.value.src=e,label:`Embed URL or Code`,type:`url`,placeholder:`https://www.youtube.com/embed/... or paste iframe code`,onKeydown:(0,u.withKeys)(ge,[`enter`])},null,8,[`modelValue`]),(0,u.createElementVNode)(`div`,Fd,[(0,u.createVNode)(H,{modelValue:E.value.width,"onUpdate:modelValue":t[31]||=e=>E.value.width=e,label:`Width`,placeholder:`560`},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:E.value.height,"onUpdate:modelValue":t[32]||=e=>E.value.height=e,label:`Height`,placeholder:`315`},null,8,[`modelValue`])]),(0,u.createVNode)(H,{modelValue:E.value.alt,"onUpdate:modelValue":t[33]||=e=>E.value.alt=e,label:`Caption`,placeholder:`Enter caption (optional)`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),(0,u.createVNode)((0,u.unref)(Ow),{visible:j.value,"onUpdate:visible":t[48]||=e=>j.value=e,title:`Insert Video`,width:`500`},{footer:(0,u.withCtx)(()=>{var e;return[(0,u.createElementVNode)(`div`,Hd,[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[47]||=e=>j.value=!1}),(e=(0,u.unref)(N))?.existingVideo?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Video`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:be})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{value:`Insert Video`,class:`ms-auto`,disabled:!M.value.src||!ve(M.value.src),onClick:ye},null,8,[`disabled`])])]}),default:(0,u.withCtx)(()=>[(0,u.createElementVNode)(`div`,Ld,[(0,u.createVNode)(H,{modelValue:M.value.src,"onUpdate:modelValue":t[36]||=e=>M.value.src=e,label:`Video URL or Embed Code`,type:`url`,placeholder:`Paste YouTube URL, video file URL, or iframe embed code...`,class:(0,u.normalizeClass)({error:M.value.src&&!ve(M.value.src)}),onKeydown:(0,u.withKeys)(ye,[`enter`])},null,8,[`modelValue`,`class`]),M.value.src&&!ve(M.value.src)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Rd,[(0,u.createVNode)((0,u.unref)($),{name:`warning`}),t[88]||=(0,u.createElementVNode)(`p`,{class:`txt12`},` Please enter a valid video URL or iframe embed code `,-1)])):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)(H,{modelValue:M.value.width,"onUpdate:modelValue":t[37]||=e=>M.value.width=e,label:`Width`,placeholder:`100% or 500px or 50vw`,help:`Examples: 100%, 500px, 50vw, 300`},null,8,[`modelValue`]),(0,u.createVNode)(ju,{modelValue:M.value.aspectRatio,"onUpdate:modelValue":t[38]||=e=>M.value.aspectRatio=e,label:`Aspect Ratio`,options:[{value:`16:9`,label:`16:9 (Standard)`},{value:`4:3`,label:`4:3 (Classic)`},{value:`9:16`,label:`9:16 (Vertical/Shorts)`},{value:`21:9`,label:`21:9 (Cinematic)`},{value:`1:1`,label:`1:1 (Square)`},{value:`custom`,label:`Custom`}]},null,8,[`modelValue`]),M.value.aspectRatio===`custom`?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,zd,[(0,u.createVNode)(H,{modelValue:M.value.customWidth,"onUpdate:modelValue":t[39]||=e=>M.value.customWidth=e,label:`Width ratio`,placeholder:`16`,type:`number`},null,8,[`modelValue`]),(0,u.createVNode)(H,{modelValue:M.value.customHeight,"onUpdate:modelValue":t[40]||=e=>M.value.customHeight=e,label:`Height ratio`,placeholder:`9`,type:`number`},null,8,[`modelValue`])])):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`div`,Bd,[(0,u.createVNode)(Fc,{modelValue:M.value.controls,"onUpdate:modelValue":t[41]||=e=>M.value.controls=e,label:`Show controls`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.autoplay,"onUpdate:modelValue":t[42]||=e=>M.value.autoplay=e,label:`Autoplay`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.mute,"onUpdate:modelValue":t[43]||=e=>M.value.mute=e,label:`Mute`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.loop,"onUpdate:modelValue":t[44]||=e=>M.value.loop=e,label:`Loop`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:M.value.showCaption,"onUpdate:modelValue":t[45]||=e=>M.value.showCaption=e,class:`grid-span-2`,label:`Show caption below video`},null,8,[`modelValue`]),M.value.showCaption?((0,u.openBlock)(),(0,u.createBlock)(H,{key:0,modelValue:M.value.caption,"onUpdate:modelValue":t[46]||=e=>M.value.caption=e,label:`Caption`,class:`grid-span-2`,placeholder:`Describe the video content`},null,8,[`modelValue`])):(0,u.createCommentVNode)(``,!0)]),M.value.src&&ve(M.value.src)?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(dr),{key:2,frame:``,thin:``,class:`bg-gray-20`},{default:(0,u.withCtx)(()=>[t[89]||=(0,u.createElementVNode)(`p`,{class:`label`},` Preview: `,-1),(0,u.createElementVNode)(`div`,Vd,[(0,u.createVNode)((0,u.unref)(un),{src:M.value.src,class:``,"aspect-ratio":M.value.aspectRatio===`custom`&&M.value.customWidth&&M.value.customHeight?`${M.value.customWidth}:${M.value.customHeight}`:M.value.aspectRatio,autoplay:!1,mute:M.value.mute,controls:M.value.controls,loop:M.value.loop},null,8,[`src`,`aspect-ratio`,`mute`,`controls`,`loop`])])]),_:1,__:[89]})):(0,u.createCommentVNode)(``,!0)])]),_:1},8,[`visible`]),(0,u.createVNode)((0,u.unref)(Ow),{visible:P.value,"onUpdate:visible":t[70]||=e=>P.value=e,title:(l=(0,u.unref)(R))?.existingTable?`Edit Table`:`Insert Table`,width:`700`},{default:(0,u.withCtx)(()=>[(0,u.createElementVNode)(`div`,Ud,[t[92]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Structure `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)(Ul,{modelValue:F.value.rows,"onUpdate:modelValue":t[49]||=e=>F.value.rows=e,min:1,max:20,label:`Rows`},null,8,[`modelValue`]),(0,u.createVNode)(Ul,{modelValue:F.value.cols,"onUpdate:modelValue":t[50]||=e=>F.value.cols=e,min:1,max:10,label:`Columns`},null,8,[`modelValue`]),(0,u.createElementVNode)(`div`,Wd,[t[90]||=(0,u.createElementVNode)(`label`,{class:`label`},`Cell Text Alignment`,-1),(0,u.createElementVNode)(`div`,Gd,[(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.alignment===`left`}),flat:``,thin:``,icon:`format_align_left`,title:`Align Left`,onClick:t[51]||=e=>F.value.alignment=`left`},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.alignment===`center`}),flat:``,thin:``,icon:`format_align_center`,title:`Align Center`,onClick:t[52]||=e=>F.value.alignment=`center`},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.alignment===`right`}),flat:``,thin:``,icon:`format_align_right`,title:`Align Right`,onClick:t[53]||=e=>F.value.alignment=`right`},null,8,[`class`])])]),(0,u.createElementVNode)(`div`,Kd,[t[91]||=(0,u.createElementVNode)(`label`,{class:`label`},`Text Direction`,-1),(0,u.createElementVNode)(`div`,qd,[(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.direction===`ltr`}),flat:``,thin:``,value:`LTR`,title:`Left to Right`,onClick:t[54]||=e=>F.value.direction=`ltr`},null,8,[`class`]),(0,u.createVNode)((0,u.unref)(T),{class:(0,u.normalizeClass)({activeBtn:F.value.direction===`rtl`}),flat:``,thin:``,value:`RTL`,title:`Right to Left`,onClick:t[55]||=e=>F.value.direction=`rtl`},null,8,[`class`])])]),t[93]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Style `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)(Ul,{modelValue:F.value.width,"onUpdate:modelValue":t[56]||=e=>F.value.width=e,label:`Width (%)`,min:25,max:100},null,8,[`modelValue`]),(0,u.createVNode)(Ul,{modelValue:F.value.cellPadding,"onUpdate:modelValue":t[57]||=e=>F.value.cellPadding=e,label:`Cell Padding (px)`,min:2,max:20},null,8,[`modelValue`]),(0,u.createVNode)(Ul,{modelValue:F.value.borderWidth,"onUpdate:modelValue":t[58]||=e=>F.value.borderWidth=e,label:`Border Width (px)`,min:0,max:5},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.borderColor,"onUpdate:modelValue":t[59]||=e=>F.value.borderColor=e,label:`Border Color`},null,8,[`modelValue`]),(0,u.createVNode)(Fc,{modelValue:F.value.fixedLayout,"onUpdate:modelValue":t[60]||=e=>F.value.fixedLayout=e,label:`Fixed cell width (doesn't change by content)`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),t[94]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Cell Colors: `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.cellBgColor,"onUpdate:modelValue":t[61]||=e=>F.value.cellBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Background Color`},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.cellTextColor,"onUpdate:modelValue":t[62]||=e=>F.value.cellTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Text Color`},null,8,[`modelValue`]),t[95]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Row Styles: `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createVNode)(Fc,{modelValue:F.value.showHeaders,"onUpdate:modelValue":t[63]||=e=>F.value.showHeaders=e,label:`Show header row`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),F.value.showHeaders?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Jd,[(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.headerBgColor,"onUpdate:modelValue":t[64]||=e=>F.value.headerBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Background Color`},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.headerTextColor,"onUpdate:modelValue":t[65]||=e=>F.value.headerTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Text Color`},null,8,[`modelValue`])])):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)(Fc,{modelValue:F.value.alternateRows,"onUpdate:modelValue":t[66]||=e=>F.value.alternateRows=e,label:`Alternating Row Colors`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),F.value.alternateRows?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,Yd,[(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.alternateRowBgColor,"onUpdate:modelValue":t[67]||=e=>F.value.alternateRowBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Background:`},null,8,[`modelValue`]),(0,u.createVNode)((0,u.unref)(qc),{modelValue:F.value.alternateRowTextColor,"onUpdate:modelValue":t[68]||=e=>F.value.alternateRowTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Text:`},null,8,[`modelValue`])])):(0,u.createCommentVNode)(``,!0)]),t[96]||=(0,u.createElementVNode)(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[(0,u.createElementVNode)(`div`,{class:`line`}),(0,u.createElementVNode)(`p`,{class:`label grid-span-4 m_grid-span-2`},` Preview `),(0,u.createElementVNode)(`div`,{class:`line`})],-1),(0,u.createElementVNode)(`div`,{style:{zoom:`0.8`},class:`opacity-7 user-select-none pointer-events-none`,innerHTML:te.value},null,8,Xd)]),footer:(0,u.withCtx)(()=>{var e,n;return[(0,u.createVNode)((0,u.unref)(T),{value:`Cancel`,flat:``,thin:``,onClick:t[69]||=e=>P.value=!1}),(e=(0,u.unref)(R))?.existingTable?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,value:`Delete Table`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Te})):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)((0,u.unref)(T),{value:(n=(0,u.unref)(R))?.existingTable?`Save`:`Insert Table`,class:`ms-auto`,onClick:Ce},null,8,[`value`])]}),_:1},8,[`visible`,`title`])],64)}}}),Qd=v(Zd,[[`__scopeId`,`data-v-b0eaafbe`]]);const $d={class:`flex flex-wrap gap-05 SelectBtn`};var ef=(0,u.defineComponent)({__name:`SelectBtn`,props:(0,u.mergeModels)({options:{},thin:{type:Boolean},outline:{type:Boolean},multiselect:{type:Boolean,default:!1}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=(0,u.useModel)(e,`modelValue`);function r(e){if(t.multiselect){let t=Array.isArray(n.value)?n.value:[],r=t.indexOf(e);r>-1?n.value=t.filter(t=>t!==e):n.value=[...t,e]}else n.value===e?n.value=null:n.value=e}function i(e){return Array.isArray(n.value)?n.value.includes(e):n.value===e}return(e,t)=>((0,u.openBlock)(),(0,u.createElementBlock)(`div`,$d,[((0,u.openBlock)(!0),(0,u.createElementBlock)(u.Fragment,null,(0,u.renderList)(e.options,t=>((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:t.value,thin:e.thin,outline:e.outline,class:(0,u.normalizeClass)([i(t.value)?`primary color-white`:`bg-transparent`,`border px-075 radius-2`]),style:{color:`var(--bgl-border-color)`},type:`button`,onClick:e=>r(t.value)},{default:(0,u.withCtx)(()=>[t.icon?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)($),{key:0,name:t.icon,weight:`300`},null,8,[`name`])):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`p`,null,(0,u.toDisplayString)(t.label),1)]),_:2},1032,[`thin`,`outline`,`class`,`onClick`]))),128))]))}}),tf=v(ef,[[`__scopeId`,`data-v-50b10a3e`]]),nf=class{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt((this.x-e.x)**2+(this.y-e.y)**2)}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time===e.time?0:this.distanceTo(e)/(this.time-e.time)}},rf=class e{static fromPoints(t,n){let r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=t.x-n.x,o=t.y-n.y,s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=Math.sqrt(r*r+i*i),u=Math.sqrt(a*a+o*o),d=s.x-c.x,f=s.y-c.y,p=l+u==0?0:u/(l+u),m={x:c.x+d*p,y:c.y+f*p},h=t.x-m.x,g=t.y-m.y;return{c1:new nf(s.x+h,s.y+g),c2:new nf(c.x+h,c.y+g)}}constructor(e,t,n,r,i,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}length(){let e=10,t=0,n,r;for(let i=0;i<=e;i+=1){let a=i/e,o=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(i>0){let e=o-n,i=s-r;t+=Math.sqrt(e*e+i*i)}n=o,r=s}return t}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},af=class{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};function sf(e,t=250){let n=0,r=null,i,a,o,s=()=>{n=Date.now(),r=null,i=e.apply(a,o),r||(a=null,o=[])};return function(...c){let l=Date.now(),u=t-(l-n);return a=this,o=c,u<=0||u>t?(r&&(clearTimeout(r),r=null),n=l,i=e.apply(a,o),r||(a=null,o=[])):r||=window.setTimeout(s,u),i}}var cf=class e extends af{constructor(t,n={}){var r,i,a;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=e=>{!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))},this._handleMouseMove=e=>{if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))},this._handleMouseUp=e=>{this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))},this._handleTouchStart=e=>{e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))},this._handleTouchMove=e=>{if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}},this._handleTouchEnd=e=>{e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))},this._handlePointerDown=e=>{!e.isPrimary||!this._isLeftButtonPressed(e)||this._drawingStroke||this._strokePointerId!==void 0&&this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))},this._handlePointerMove=e=>{if(!(!e.isPrimary||this._strokePointerId!==this._getPointerId(e))){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}},this._handlePointerUp=e=>{!e.isPrimary||this._isLeftButtonPressed(e)||this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=void 0,e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=(r=n.throttle)??16,this.minDistance=(i=n.minDistance)??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||`black`,this.backgroundColor=n.backgroundColor||`rgba(0,0,0,0)`,this.compositeOperation=n.compositeOperation||`source-over`,this.canvasContextOptions=(a=n.canvasContextOptions)??{},this._strokeMoveUpdate=this.throttle?sf(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._ctx=t.getContext(`2d`,this.canvasContextOptions),this.clear(),this.on()}clear(){let{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(e,t={}){return new Promise((n,r)=>{let i=new Image,a=t.ratio||window.devicePixelRatio||1,o=t.width||this.canvas.width/a,s=t.height||this.canvas.height/a,c=t.xOffset||0,l=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,c,l,o,s),n()},i.onerror=e=>{r(e)},i.crossOrigin=`anonymous`,i.src=e,this._isEmpty=!1})}toDataURL(e=`image/png`,t){switch(e){case`image/svg+xml`:return typeof t!=`object`&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!=`number`&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction=`none`,this.canvas.style.msTouchAction=`none`,this.canvas.style.userSelect=`none`;let e=/Macintosh/.test(navigator.userAgent)&&`ontouchstart`in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),`ontouchstart`in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction=`auto`,this.canvas.style.msTouchAction=`auto`,this.canvas.style.userSelect=`auto`,this.canvas.removeEventListener(`pointerdown`,this._handlePointerDown),this.canvas.removeEventListener(`mousedown`,this._handleMouseDown),this.canvas.removeEventListener(`touchstart`,this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;let t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)??this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){let{removeEventListener:e}=this._getListenerFunctions();e(`pointermove`,this._handlePointerMove),e(`pointerup`,this._handlePointerUp),e(`mousemove`,this._handleMouseMove),e(`mouseup`,this._handleMouseUp),e(`touchmove`,this._handleTouchMove),e(`touchend`,this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)==1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:`pressure`in e?e.pressure:0}}_touchEventToSignatureEvent(e){let t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_getPointGroupOptions(e){return{penColor:e&&`penColor`in e?e.penColor:this.penColor,dotSize:e&&`dotSize`in e?e.dotSize:this.dotSize,minWidth:e&&`minWidth`in e?e.minWidth:this.minWidth,maxWidth:e&&`maxWidth`in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&`velocityFilterWeight`in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&`compositeOperation`in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){let t=!this.dispatchEvent(new CustomEvent(`beginStroke`,{detail:e,cancelable:!0}));if(t)return;let{addEventListener:n}=this._getListenerFunctions();switch(e.event.type){case`mousedown`:n(`mousemove`,this._handleMouseMove,{passive:!1}),n(`mouseup`,this._handleMouseUp,{passive:!1});break;case`touchstart`:n(`touchmove`,this._handleTouchMove,{passive:!1}),n(`touchend`,this._handleTouchEnd,{passive:!1});break;case`pointerdown`:n(`pointermove`,this._handlePointerMove,{passive:!1}),n(`pointerup`,this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;let r=this._getPointGroupOptions(),i=Object.assign(Object.assign({},r),{points:[]});this._data.push(i),this._reset(r),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent(`beforeUpdateStroke`,{detail:e}));let t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],a=i?t.distanceTo(i)<=this.minDistance:!1,o=this._getPointGroupOptions(n);if(!i||!(i&&a)){let e=this._addPoint(t,o);i?e&&this._drawCurve(e,o):this._drawDot(t,o),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent(`afterUpdateStroke`,{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent(`endStroke`,{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`pointerdown`,this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`mousedown`,this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener(`touchstart`,this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){let r=this.canvas.getBoundingClientRect();return new nf(e-r.left,t-r.top,n,new Date().getTime())}_addPoint(e,t){let{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);let e=this._calculateCurveWidths(n[1],n[2],t),r=rf.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){let r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){let r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){let n=this._ctx,r=e.endWidth-e.startWidth,i=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){let a=n/i,o=a*a,s=o*a,c=1-a,l=c*c,u=l*c,d=u*e.startPoint.x;d+=3*l*a*e.control1.x,d+=3*c*o*e.control2.x,d+=s*e.endPoint.x;let f=u*e.startPoint.y;f+=3*l*a*e.control1.y,f+=3*c*o*e.control2.y,f+=s*e.endPoint.y;let p=Math.min(e.startWidth+s*r,t.maxWidth);this._drawCurveSegment(d,f,p)}n.closePath(),n.fill()}_drawDot(e,t){let n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(let r of e){let{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){let r=e[n],a=new nf(r.x,r.y,r.pressure,r.time);n===0&&this._reset(i);let o=this._addPoint(a,i);o&&t(o,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1}={}){let t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=0,i=0,a=this.canvas.width/n,o=this.canvas.height/n,s=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(s.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),s.setAttribute(`xmlns:xlink`,`http://www.w3.org/1999/xlink`),s.setAttribute(`viewBox`,`${r} ${i} ${a} ${o}`),s.setAttribute(`width`,a.toString()),s.setAttribute(`height`,o.toString()),e&&this.backgroundColor){let e=document.createElement(`rect`);e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),e.setAttribute(`fill`,this.backgroundColor),s.appendChild(e)}return this._fromData(t,(e,{penColor:t})=>{let n=document.createElement(`path`);if(!isNaN(e.control1.x)&&!isNaN(e.control1.y)&&!isNaN(e.control2.x)&&!isNaN(e.control2.y)){let r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute(`d`,r),n.setAttribute(`stroke-width`,(e.endWidth*2.25).toFixed(3)),n.setAttribute(`stroke`,t),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-linecap`,`round`),s.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{let a=document.createElement(`circle`),o=n>0?n:(r+i)/2;a.setAttribute(`r`,o.toString()),a.setAttribute(`cx`,e.x.toString()),a.setAttribute(`cy`,e.y.toString()),a.setAttribute(`fill`,t),s.appendChild(a)}),s.outerHTML}};const lf=[`disabled`],uf=[`required`];var df=(0,u.defineComponent)({__name:`SignaturePad`,props:(0,u.mergeModels)({sigOption:{},width:{},height:{},ratio:{},clearOnResize:{type:Boolean},waterMark:{},disabled:{type:Boolean},defaultUrl:{},format:{},clearable:{type:Boolean,default:!0},required:{type:Boolean}},{modelValue:{},modelModifiers:{},file:{},fileModifiers:{}}),emits:[`update:modelValue`,`update:file`],setup(e,{expose:t}){let n=e,r=(0,u.useModel)(e,`modelValue`),i=(0,u.useModel)(e,`file`),a=(0,u.ref)(),o=(0,u.ref)(),s=(0,u.ref)(!0);function c(){var e;(e=o.value)?.clear(),s.value=!0,r.value=void 0}function l(e){var t,r;return e||=n.format,e?(t=o.value)?.toDataURL(e):(r=o.value)?.toDataURL()}function d(){let e=l();if(e)if(n.format===`image/svg+xml`)i.value=new File([e],`signature.svg`,{type:`image/svg+xml`});else try{let t=e.split(`,`)[1];if(!t)throw Error(`Invalid data URL format`);let r=atob(t),a=new Uint8Array(Array.from(r,e=>e.charCodeAt(0))),o=n.format||`image/png`,s=new Blob([a],{type:o}),c=o.split(`/`)[1];i.value=new File([s],`signature.${c}`,{type:o})}catch(e){console.error(`Error saving signature file:`,e)}}function f(e){var t,r,i;return(t=o.value)?.fromDataURL(e,{height:(r=a.value)?.height,width:(i=a.value)?.width,ratio:n.ratio,xOffset:0,yOffset:0})}let p=()=>{var e;return(e=o.value)?.isEmpty()};function m(){var e;let t=(e=o.value)?.toData();if(t){var n;t.pop(),(n=o.value)?.fromData(t)}}let h=(0,u.ref)({penColor:`rgb(0, 0, 0)`,backgroundColor:`rgb(255, 255, 255)`}),g=(0,u.computed)(()=>({...h.value,...n.sigOption}));(0,u.watch)(()=>n.disabled,e=>{var t,n;e?(t=o.value)?.off():(n=o.value)?.on()});function _(e){if(Object.prototype.toString.call(e)!==`[object Object]`)throw Error(`Expected Object, got ${typeof e}.`);{var t;let n={text:e.text||``,x:e.x||20,y:e.y||20,sx:e.sx||40,sy:e.sy||40},r=(t=a.value)?.getContext(`2d`);if(!r)return;r.font=e.font||`20px sans-serif`,r.fillStyle=e.fillStyle||`#333`,r.strokeStyle=e.strokeStyle||`#333`,e.style===`all`?(r.fillText(n.text,n.x,n.y),r.strokeText(n.text,n.sx,n.sy)):e.style===`stroke`?r.strokeText(n.text,n.sx,n.sy):r.fillText(n.text,n.x,n.y)}}function v(){var e;s.value=(e=o.value)?.isEmpty()??!1;let t=l();r.value=t,d()}function y(e){if(!e)return;let t=new FileReader;return new Promise(n=>{t.onload=e=>{var t;let i=String((t=e.target)?.result);f(i),s.value=!1,r.value=i,n(!0)},t.readAsDataURL(e)})}(0,u.watch)(i,e=>{y(e)});function b(){let e;p()||(e=l());let t=n.ratio??1/2,{width:r}=a.value.getBoundingClientRect();a.value.width=n.width?Number(n.width.replaceAll(`px`,``)):r,a.value.height=n.height?Number(n.height.replaceAll(`px`,``)):r*t,c(),!n.clearOnResize&&e!==void 0&&f(e),n.waterMark&&_(n.waterMark)}function x(){o.value=new cf(a.value,g.value),b(),n.disabled?o.value.off():o.value.on(),s.value=o.value.isEmpty(),i.value&&y(i.value)}return(0,u.onMounted)(x),Bt(()=>a.value,b),Pt(()=>o.value,`endStroke`,v),t({save:l,clear:c,isEmpty:p,undo:m,addWaterMark:_,fromDataURL:f}),(e,t)=>((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{class:(0,u.normalizeClass)([`bgl_input signature-pad relative`,{"bg-transparent":e.disabled}]),onTouchmove:t[0]||=(0,u.withModifiers)(()=>{},[`prevent`])},[e.clearable&&!e.disabled?((0,u.openBlock)(),(0,u.createBlock)((0,u.unref)(T),{key:0,flat:``,thin:``,icon:`refresh`,class:`position-bottom-end`,onClick:c})):(0,u.createCommentVNode)(``,!0),(0,u.createElementVNode)(`canvas`,{ref_key:`vCanvas`,ref:a,class:`canvas`,disabled:e.disabled},null,8,lf),(0,u.createElementVNode)(`input`,{placeholder:`required`,type:`text`,required:e.required&&(0,u.unref)(s),class:`pixel opacity-0`,inputMode:`none`},null,8,uf)],34))}}),ff=df;
|
|
138
138
|
/**!
|
|
139
139
|
* Sortable 1.14.0
|
|
140
140
|
* @author RubaXa <trash@rubaxa.org>
|
package/dist/index.mjs
CHANGED
|
@@ -134,7 +134,7 @@ var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof
|
|
|
134
134
|
</head>
|
|
135
135
|
<body class="richtext-editor-content">${o}</body>
|
|
136
136
|
</html>
|
|
137
|
-
`,c=f.value.contentDocument||(e=f.value.contentWindow)?.document;if(!c)return;c.open(),c.write(s),c.close(),await new Promise(e=>setTimeout(e,0)),c.designMode=`on`,c.body.contentEditable=`true`,c.body.dir=et.value?`rtl`:`ltr`;let l=c.body.querySelectorAll(`blockquote, ul, ol`);console.log(`Found existing block elements:`,l.length),l.forEach(e=>{let t=e;if(console.log(`Processing element:`,t.tagName,`current dir:`,t.dir),t.dir||(t.dir=c.body.dir||`ltr`,console.log(`Applied direction to existing`,t.tagName,`:`,t.dir)),t.tagName===`UL`||t.tagName===`OL`){let e=t.querySelectorAll(`li`);e.forEach(e=>{let n=e;n.dir||(n.dir=t.dir,console.log(`Applied direction to list item:`,n.dir))})}}),h.state.content=c.body.innerHTML,h.init(c),Tf(c,v),i.basic&&i.modelValue&&setTimeout(()=>{let e=c.body.querySelectorAll(`*`);e.forEach(e=>{if(e.tagName!==`P`&&e.tagName!==`BR`){let n=e.textContent||``;if(n.trim()){var t;let r=c.createElement(`p`);r.textContent=n,(t=e.parentNode)?.replaceChild(r,e)}else e.remove()}else e.tagName===`P`&&Array.from(e.attributes).forEach(t=>{t.name!==`dir`&&e.removeAttribute(t.name)})}),fe(c)},100),c.addEventListener(`selectionchange`,()=>{setTimeout(()=>{ge()},10)}),c.addEventListener(`mouseup`,()=>{setTimeout(()=>{ge()},10)}),c.addEventListener(`click`,e=>{setTimeout(()=>{let e=c.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&_e()},10)}),c.addEventListener(`keydown`,e=>{[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Escape`].includes(e.key)&&setTimeout(()=>{let e=c.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&_e()},10)});let u=c.createTreeWalker(c.body,NodeFilter.SHOW_TEXT),d=[],p;for(;p=u.nextNode();)p.parentElement===c.body&&d.push(p);if(d.forEach(e=>{var t;if((t=e.textContent)?.trim()){let t=c.createElement(`p`);t.dir=c.body.dir,t.appendChild(e.cloneNode()),c.body.replaceChild(t,e)}else c.body.removeChild(e)}),c.addEventListener(`contextmenu`,e=>{let t=e.target,n=t.closest(`td, th`);if(n&&n.closest(`table`)){e.preventDefault(),K.value=n;let t=f.value.getBoundingClientRect();se.value={x:t.left+e.clientX,y:t.top+e.clientY},oe.value=!0}}),c.addEventListener(`click`,e=>{c.querySelectorAll(`.table-cell-selected`).forEach(e=>{e.classList.remove(`table-cell-selected`)});let t=e.target,n=t.closest(`td, th`);n&&n.closest(`table`)&&(n.classList.add(`table-cell-selected`),K.value=n)}),rt(c),console.log(`About to setup table edit buttons...`),nt(c),console.log(`Table edit buttons setup completed`),fe(c),!c.body.innerHTML.trim()||!c.body.querySelector(`p,h1,h2,h3,h4,h5,h6,blockquote,ul,ol,table`)){let e=c.createElement(`p`);e.dir=c.body.dir,c.body.appendChild(e);let t=c.createRange();t.selectNodeContents(e),t.collapse(!0);let n=c.getSelection();n&&(n.removeAllRanges(),n.addRange(t)),fe(c)}i.autofocus===!0&&c.body.focus(),_.value=!0}catch(e){console.error(`Error during editor initialization:`,e)}finally{g.value=!1}}}q(()=>i.modelValue,(e,t)=>{e!==h.state.content&&(!t||Math.abs(e.length-t.length)>50?(_.value=!1,h.state.content=e,h.updateState.content(`html`),setTimeout(()=>{h.state.doc&&(fe(h.state.doc),nt(h.state.doc))},100)):setTimeout(()=>{h.state.doc&&nt(h.state.doc)},50))}),q(()=>h.state.content,e=>{var t;(t=h.state.doc)?.body&&(h.state.doc.body.dir=et.value?`rtl`:`ltr`),a(`update:modelValue`,e)}),q(()=>W.value.alignment,e=>{if(ce?.existingTable){let t=ce.existingTable;e===`center`?(t.style.marginLeft=`auto`,t.style.marginRight=`auto`):e===`right`?(t.style.marginLeft=`auto`,t.style.marginRight=`0`):(t.style.marginLeft=`0`,t.style.marginRight=`auto`),h.state.doc&&fe(h.state.doc)}});function at(){oe.value=!1}return typeof window<`u`&&window.addEventListener(`click`,at),A(()=>{typeof window<`u`&&window.removeEventListener(`click`,at)}),t({editor:h,commands:v}),(e,t)=>{var r,i,a,o,g;return P(),u(n,null,[d(`div`,T({class:`bagel-input`},G(s)),[e.label?(P(),u(`label`,Ef,U(e.label),1)):l(``,!0),d(`div`,{class:D([`rounded`,[{"rich-text-editor pt-05 px-05 pb-075":!e.basic,"rich-text-editor--basic":e.basic,"fullscreen-mode":G(h).state.isFullscreen}]])},[G(h).state.hasInit&&y.value?(P(),c(Zd,{key:0,config:x.value,selectedStyles:G(h).state.selectedStyles,"hide-images":e.hideImages,"hide-videos":e.hideVideos,"hide-embeds":e.hideEmbed,"hide-tables":e.hideTables,"hide-alignment":e.hideAlignment,"hide-directions":e.hideDirections,"hide-h5-h6":e.hideH5H6,hide:S.value,onAction:G(v).execute},null,8,[`config`,`selectedStyles`,`hide-images`,`hide-videos`,`hide-embeds`,`hide-tables`,`hide-alignment`,`hide-directions`,`hide-h5-h6`,`hide`,`onAction`])):l(``,!0),d(`div`,{class:D([`editor-container`,{"split-view":G(h).state.isSplitView}])},[d(`div`,{class:`content-area radius-1`,style:k({height:G(h).state.isFullscreen?`calc(100vh - 4rem)`:G(tt)})},[d(`iframe`,{id:`rich-text-iframe`,ref_key:`iframe`,ref:f,class:`editableContent`,title:`Editor`,srcdoc:``,sandbox:`allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation`,onLoad:it,onContextmenu:Qe},null,544)],4),G(h).state.isSplitView?(P(),c(G(Rl),{key:0,modelValue:G(h).state.content,"onUpdate:modelValue":[t[0]||=e=>G(h).state.content=e,t[1]||=e=>G(h).updateState.content(`html`)],language:`html`,height:G(h).state.isFullscreen?`calc(100vh - 4rem)`:G(tt)},null,8,[`modelValue`,`height`])):l(``,!0)],2),e.debug?(P(),u(`div`,Df,[t[75]||=d(`p`,{class:`txt12 txt-gray mb-0 p-0`},` Debug `,-1),m(G(X),{thin:``,color:`gray`,icon:`visibility`,onClick:pe},{default:J(()=>t[71]||=[p(` Show Content `)]),_:1,__:[71]}),m(G(X),{thin:``,color:`gray`,icon:`delete`,onClick:(r=G($e))?.clearSession},{default:J(()=>t[72]||=[p(` Clear Session `)]),_:1,__:[72]},8,[`onClick`]),m(G(X),{thin:``,color:`gray`,icon:`download`,onClick:(i=G($e))?.downloadSession},{default:J(()=>t[73]||=[p(` Download Log `)]),_:1,__:[73]},8,[`onClick`]),m(G(X),{thin:``,color:`gray`,icon:`content_copy`,onClick:t[2]||=e=>{var t;return G(Rc)((t=G($e))?.exportDebugWithPrompt()||``)}},{default:J(()=>t[74]||=[p(` Copy Log `)]),_:1,__:[74]})])):l(``,!0)],2),z.value?(P(),u(`div`,{key:1,class:`inline-toolbar`,style:k({position:`fixed`,top:`${B.value.top}px`,left:`${B.value.left}px`,zIndex:99})},[d(`div`,Of,[m(G(X),{thin:``,flat:``,icon:`format_bold`,class:D({active:G(h).state.selectedStyles.has(`bold`)}),onClick:t[3]||=e=>ve(`bold`)},null,8,[`class`]),m(G(X),{thin:``,flat:``,icon:`format_italic`,class:D({active:G(h).state.selectedStyles.has(`italic`)}),onClick:t[4]||=e=>ve(`italic`)},null,8,[`class`]),m(G(X),{thin:``,flat:``,icon:`format_underlined`,class:D({active:G(h).state.selectedStyles.has(`underline`)}),onClick:t[5]||=e=>ve(`underline`)},null,8,[`class`]),t[76]||=d(`span`,{class:`separator`},`|`,-1),m(G(X),{thin:``,flat:``,icon:`add_link`,onClick:t[6]||=e=>ve(`link`)})])],4)):l(``,!0),oe.value?(P(),u(`div`,{key:2,class:`table-context-menu`,style:k({position:`fixed`,top:`${se.value.y}px`,left:`${se.value.x}px`,zIndex:1001})},[d(`div`,{class:`context-menu-content`,onClick:t[17]||=he(()=>{},[`stop`])},[d(`div`,kf,[t[77]||=d(`span`,null,`Table Actions`,-1),d(`button`,{class:`close-btn`,onClick:t[7]||=e=>oe.value=!1},` × `)]),d(`div`,Af,[Ye.value?(P(),c(G(X),{key:0,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`start`,class:`context-menu-btn`,onClick:t[8]||=e=>{Be(),oe.value=!1}},{default:J(()=>t[78]||=[p(` Merge Right `)]),_:1,__:[78]})):l(``,!0),Xe.value?(P(),c(G(X),{key:1,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`text_select_move_down`,class:`context-menu-btn`,onClick:t[9]||=e=>{Ve(),oe.value=!1}},{default:J(()=>t[79]||=[p(` Merge Down `)]),_:1,__:[79]})):l(``,!0),Ze.value?(P(),c(G(X),{key:2,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`call_split`,class:`context-menu-btn`,onClick:t[10]||=e=>{He(),oe.value=!1}},{default:J(()=>t[80]||=[p(` Split Cell `)]),_:1,__:[80]})):l(``,!0),Ye.value||Xe.value||Ze.value?(P(),u(`div`,jf)):l(``,!0),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_above`,class:`context-menu-btn`,onClick:t[11]||=e=>{Ue(),oe.value=!1}},{default:J(()=>t[81]||=[p(` Insert Row Above `)]),_:1,__:[81]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_below`,class:`context-menu-btn`,onClick:t[12]||=e=>{We(),oe.value=!1}},{default:J(()=>t[82]||=[p(` Insert Row Below `)]),_:1,__:[82]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[13]||=e=>{Ge(),oe.value=!1}},{default:J(()=>t[83]||=[p(` Delete Row `)]),_:1,__:[83]}),t[87]||=d(`div`,{class:`context-menu-separator`},null,-1),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_left`,class:`context-menu-btn`,onClick:t[14]||=e=>{Ke(),oe.value=!1}},{default:J(()=>t[84]||=[p(` Insert Column Left `)]),_:1,__:[84]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_right`,class:`context-menu-btn`,onClick:t[15]||=e=>{qe(),oe.value=!1}},{default:J(()=>t[85]||=[p(` Insert Column Right `)]),_:1,__:[85]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[16]||=e=>{Je(),oe.value=!1}},{default:J(()=>t[86]||=[p(` Delete Column `)]),_:1,__:[86]})])])],4)):l(``,!0)],16),m(G(MT),{visible:C.value,"onUpdate:visible":t[21]||=e=>C.value=e,title:`Add Link`,width:`400`},{footer:J(()=>[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[20]||=e=>C.value=!1}),m(G(X),{value:`Add Link`,disabled:!Ce(w.value.url),onClick:xe},null,8,[`disabled`])]),default:J(()=>[d(`div`,Mf,[m(Pd,{modelValue:w.value.url,"onUpdate:modelValue":t[18]||=e=>w.value.url=e,label:`URL`,type:`url`,placeholder:`https://example.com`,onKeydown:me(xe,[`enter`])},null,8,[`modelValue`]),m(G(X),{icon:`open_in_new`,class:`mb-05 radius-1`,flat:``,disabled:!Ce(w.value.url),onClick:Se},null,8,[`disabled`])]),m(Al,{modelValue:w.value.openInNewTab,"onUpdate:modelValue":t[19]||=e=>w.value.openInNewTab=e,label:`Open in new tab`,type:`checkbox`,class:`mb-2 mt-05`},null,8,[`modelValue`])]),_:1},8,[`visible`]),E.value?(P(),u(`div`,{key:0,class:`editor-tooltip`,style:k({left:`${O.value.x}px`,top:`${O.value.y}px`})},U(O.value.message),5)):l(``,!0),m(G(MT),{visible:ee.value,"onUpdate:visible":t[29]||=e=>ee.value=e,title:(a=G(F))?.existingImage?`Edit Image`:`Insert Image`,width:`500`},{footer:J(()=>{var e,n;return[d(`div`,Pf,[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[28]||=e=>ee.value=!1}),(e=G(F))?.existingImage?(P(),c(G(X),{key:0,value:`Delete Image`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Re})):l(``,!0),m(G(X),{class:`ms-auto`,value:(n=G(F))?.existingImage?`Save Changes`:`Insert Image`,disabled:!N.value.src,onClick:Te},null,8,[`value`,`disabled`])])]}),default:J(()=>[m(Pd,{modelValue:N.value.src,"onUpdate:modelValue":t[22]||=e=>N.value.src=e,label:`Image URL`,type:`url`,placeholder:`https://example.com/image.jpg`,onKeydown:me(Te,[`enter`])},null,8,[`modelValue`]),m(Pd,{modelValue:N.value.alt,"onUpdate:modelValue":t[23]||=e=>N.value.alt=e,label:`Alt Text`,placeholder:`Describe the image`},null,8,[`modelValue`]),d(`div`,Nf,[m(Pd,{modelValue:N.value.width,"onUpdate:modelValue":t[24]||=e=>N.value.width=e,label:`Width`,placeholder:`100% or 500px or auto`,help:`Examples: 100%, 500px, auto`},null,8,[`modelValue`]),m(Pd,{modelValue:N.value.height,"onUpdate:modelValue":t[25]||=e=>N.value.height=e,label:`Height`,placeholder:`auto or 300px`,help:`Examples: auto, 300px`},null,8,[`modelValue`])]),m(Pd,{modelValue:N.value.credit,"onUpdate:modelValue":t[26]||=e=>N.value.credit=e,label:`Photo Credit`,placeholder:`Photographer name (optional)`},null,8,[`modelValue`]),m(Al,{modelValue:N.value.figcaption,"onUpdate:modelValue":t[27]||=e=>N.value.figcaption=e,label:`Show alt text as caption`,help:`Photo credit will always be shown if provided`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),m(G(MT),{visible:I.value,"onUpdate:visible":t[35]||=e=>I.value=e,title:(o=G(te))?.existingEmbed?`Edit Embed`:`Insert Embed`,width:`500`},{footer:J(()=>{var e,n;return[d(`div`,If,[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[34]||=e=>I.value=!1}),(e=G(te))?.existingEmbed?(P(),c(G(X),{key:0,value:`Delete Embed`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:ze})):l(``,!0),m(G(X),{value:(n=G(te))?.existingEmbed?`Save Changes`:`Insert Embed`,disabled:!L.value.src,class:`ms-auto`,onClick:De},null,8,[`value`,`disabled`])])]}),default:J(()=>[m(Pd,{modelValue:L.value.src,"onUpdate:modelValue":t[30]||=e=>L.value.src=e,label:`Embed URL or Code`,type:`url`,placeholder:`https://www.youtube.com/embed/... or paste iframe code`,onKeydown:me(De,[`enter`])},null,8,[`modelValue`]),d(`div`,Ff,[m(Pd,{modelValue:L.value.width,"onUpdate:modelValue":t[31]||=e=>L.value.width=e,label:`Width`,placeholder:`560`},null,8,[`modelValue`]),m(Pd,{modelValue:L.value.height,"onUpdate:modelValue":t[32]||=e=>L.value.height=e,label:`Height`,placeholder:`315`},null,8,[`modelValue`])]),m(Pd,{modelValue:L.value.alt,"onUpdate:modelValue":t[33]||=e=>L.value.alt=e,label:`Caption`,placeholder:`Enter caption (optional)`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),m(G(MT),{visible:re.value,"onUpdate:visible":t[48]||=e=>re.value=e,title:`Insert Video`,width:`500`},{footer:J(()=>{var e;return[d(`div`,Hf,[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[47]||=e=>re.value=!1}),(e=G(H))?.existingVideo?(P(),c(G(X),{key:0,value:`Delete Video`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:je})):l(``,!0),m(G(X),{value:`Insert Video`,class:`ms-auto`,disabled:!V.value.src||!ke(V.value.src),onClick:Ae},null,8,[`disabled`])])]}),default:J(()=>[d(`div`,Lf,[m(Pd,{modelValue:V.value.src,"onUpdate:modelValue":t[36]||=e=>V.value.src=e,label:`Video URL or Embed Code`,type:`url`,placeholder:`Paste YouTube URL, video file URL, or iframe embed code...`,class:D({error:V.value.src&&!ke(V.value.src)}),onKeydown:me(Ae,[`enter`])},null,8,[`modelValue`,`class`]),V.value.src&&!ke(V.value.src)?(P(),u(`div`,Rf,[m(G($),{name:`warning`}),t[88]||=d(`p`,{class:`txt12`},` Please enter a valid video URL or iframe embed code `,-1)])):l(``,!0),m(Pd,{modelValue:V.value.width,"onUpdate:modelValue":t[37]||=e=>V.value.width=e,label:`Width`,placeholder:`100% or 500px or 50vw`,help:`Examples: 100%, 500px, 50vw, 300`},null,8,[`modelValue`]),m(Ed,{modelValue:V.value.aspectRatio,"onUpdate:modelValue":t[38]||=e=>V.value.aspectRatio=e,label:`Aspect Ratio`,options:[{value:`16:9`,label:`16:9 (Standard)`},{value:`4:3`,label:`4:3 (Classic)`},{value:`9:16`,label:`9:16 (Vertical/Shorts)`},{value:`21:9`,label:`21:9 (Cinematic)`},{value:`1:1`,label:`1:1 (Square)`},{value:`custom`,label:`Custom`}]},null,8,[`modelValue`]),V.value.aspectRatio===`custom`?(P(),u(`div`,zf,[m(Pd,{modelValue:V.value.customWidth,"onUpdate:modelValue":t[39]||=e=>V.value.customWidth=e,label:`Width ratio`,placeholder:`16`,type:`number`},null,8,[`modelValue`]),m(Pd,{modelValue:V.value.customHeight,"onUpdate:modelValue":t[40]||=e=>V.value.customHeight=e,label:`Height ratio`,placeholder:`9`,type:`number`},null,8,[`modelValue`])])):l(``,!0),d(`div`,Bf,[m(Al,{modelValue:V.value.controls,"onUpdate:modelValue":t[41]||=e=>V.value.controls=e,label:`Show controls`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.autoplay,"onUpdate:modelValue":t[42]||=e=>V.value.autoplay=e,label:`Autoplay`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.mute,"onUpdate:modelValue":t[43]||=e=>V.value.mute=e,label:`Mute`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.loop,"onUpdate:modelValue":t[44]||=e=>V.value.loop=e,label:`Loop`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.showCaption,"onUpdate:modelValue":t[45]||=e=>V.value.showCaption=e,class:`grid-span-2`,label:`Show caption below video`},null,8,[`modelValue`]),V.value.showCaption?(P(),c(Pd,{key:0,modelValue:V.value.caption,"onUpdate:modelValue":t[46]||=e=>V.value.caption=e,label:`Caption`,class:`grid-span-2`,placeholder:`Describe the video content`},null,8,[`modelValue`])):l(``,!0)]),V.value.src&&ke(V.value.src)?(P(),c(G(ai),{key:2,frame:``,thin:``,class:`bg-gray-20`},{default:J(()=>[t[89]||=d(`p`,{class:`label`},` Preview: `,-1),d(`div`,Vf,[m(G(ir),{src:V.value.src,class:``,"aspect-ratio":V.value.aspectRatio===`custom`&&V.value.customWidth&&V.value.customHeight?`${V.value.customWidth}:${V.value.customHeight}`:V.value.aspectRatio,autoplay:!1,mute:V.value.mute,controls:V.value.controls,loop:V.value.loop},null,8,[`src`,`aspect-ratio`,`mute`,`controls`,`loop`])])]),_:1,__:[89]})):l(``,!0)])]),_:1},8,[`visible`]),m(G(MT),{visible:ie.value,"onUpdate:visible":t[70]||=e=>ie.value=e,title:(g=G(ce))?.existingTable?`Edit Table`:`Insert Table`,width:`700`},{default:J(()=>[d(`div`,Uf,[t[92]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Structure `),d(`div`,{class:`line`})],-1),m(Ru,{modelValue:W.value.rows,"onUpdate:modelValue":t[49]||=e=>W.value.rows=e,min:1,max:20,label:`Rows`},null,8,[`modelValue`]),m(Ru,{modelValue:W.value.cols,"onUpdate:modelValue":t[50]||=e=>W.value.cols=e,min:1,max:10,label:`Columns`},null,8,[`modelValue`]),d(`div`,Wf,[t[90]||=d(`label`,{class:`label`},`Cell Text Alignment`,-1),d(`div`,Gf,[m(G(X),{class:D({activeBtn:W.value.alignment===`left`}),flat:``,thin:``,icon:`format_align_left`,title:`Align Left`,onClick:t[51]||=e=>W.value.alignment=`left`},null,8,[`class`]),m(G(X),{class:D({activeBtn:W.value.alignment===`center`}),flat:``,thin:``,icon:`format_align_center`,title:`Align Center`,onClick:t[52]||=e=>W.value.alignment=`center`},null,8,[`class`]),m(G(X),{class:D({activeBtn:W.value.alignment===`right`}),flat:``,thin:``,icon:`format_align_right`,title:`Align Right`,onClick:t[53]||=e=>W.value.alignment=`right`},null,8,[`class`])])]),d(`div`,Kf,[t[91]||=d(`label`,{class:`label`},`Text Direction`,-1),d(`div`,qf,[m(G(X),{class:D({activeBtn:W.value.direction===`ltr`}),flat:``,thin:``,value:`LTR`,title:`Left to Right`,onClick:t[54]||=e=>W.value.direction=`ltr`},null,8,[`class`]),m(G(X),{class:D({activeBtn:W.value.direction===`rtl`}),flat:``,thin:``,value:`RTL`,title:`Right to Left`,onClick:t[55]||=e=>W.value.direction=`rtl`},null,8,[`class`])])]),t[93]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Style `),d(`div`,{class:`line`})],-1),m(Ru,{modelValue:W.value.width,"onUpdate:modelValue":t[56]||=e=>W.value.width=e,label:`Width (%)`,min:25,max:100},null,8,[`modelValue`]),m(Ru,{modelValue:W.value.cellPadding,"onUpdate:modelValue":t[57]||=e=>W.value.cellPadding=e,label:`Cell Padding (px)`,min:2,max:20},null,8,[`modelValue`]),m(Ru,{modelValue:W.value.borderWidth,"onUpdate:modelValue":t[58]||=e=>W.value.borderWidth=e,label:`Border Width (px)`,min:0,max:5},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.borderColor,"onUpdate:modelValue":t[59]||=e=>W.value.borderColor=e,label:`Border Color`},null,8,[`modelValue`]),m(Al,{modelValue:W.value.fixedLayout,"onUpdate:modelValue":t[60]||=e=>W.value.fixedLayout=e,label:`Fixed cell width (doesn't change by content)`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),t[94]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Cell Colors: `),d(`div`,{class:`line`})],-1),m(G(Hl),{modelValue:W.value.cellBgColor,"onUpdate:modelValue":t[61]||=e=>W.value.cellBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Background Color`},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.cellTextColor,"onUpdate:modelValue":t[62]||=e=>W.value.cellTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Text Color`},null,8,[`modelValue`]),t[95]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Row Styles: `),d(`div`,{class:`line`})],-1),m(Al,{modelValue:W.value.showHeaders,"onUpdate:modelValue":t[63]||=e=>W.value.showHeaders=e,label:`Show header row`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),W.value.showHeaders?(P(),u(`div`,Jf,[m(G(Hl),{modelValue:W.value.headerBgColor,"onUpdate:modelValue":t[64]||=e=>W.value.headerBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Background Color`},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.headerTextColor,"onUpdate:modelValue":t[65]||=e=>W.value.headerTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Text Color`},null,8,[`modelValue`])])):l(``,!0),m(Al,{modelValue:W.value.alternateRows,"onUpdate:modelValue":t[66]||=e=>W.value.alternateRows=e,label:`Alternating Row Colors`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),W.value.alternateRows?(P(),u(`div`,Yf,[m(G(Hl),{modelValue:W.value.alternateRowBgColor,"onUpdate:modelValue":t[67]||=e=>W.value.alternateRowBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Background:`},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.alternateRowTextColor,"onUpdate:modelValue":t[68]||=e=>W.value.alternateRowTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Text:`},null,8,[`modelValue`])])):l(``,!0)]),t[96]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Preview `),d(`div`,{class:`line`})],-1),d(`div`,{style:{zoom:`0.8`},class:`opacity-7 user-select-none pointer-events-none`,innerHTML:le.value},null,8,Xf)]),footer:J(()=>{var e,n;return[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[69]||=e=>ie.value=!1}),(e=G(ce))?.existingTable?(P(),c(G(X),{key:0,value:`Delete Table`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Ie})):l(``,!0),m(G(X),{value:(n=G(ce))?.existingTable?`Save`:`Insert Table`,class:`ms-auto`,onClick:Pe},null,8,[`value`])]}),_:1},8,[`visible`,`title`])],64)}}}),Qf=Y(Zf,[[`__scopeId`,`data-v-b0eaafbe`]]);const $f={class:`flex flex-wrap gap-05 SelectBtn`};var ep=h({__name:`SelectBtn`,props:w({options:{},thin:{type:Boolean},outline:{type:Boolean},multiselect:{type:Boolean,default:!1}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,r=se(e,`modelValue`);function i(e){if(t.multiselect){let t=Array.isArray(r.value)?r.value:[],n=t.indexOf(e);n>-1?r.value=t.filter(t=>t!==e):r.value=[...t,e]}else r.value===e?r.value=null:r.value=e}function a(e){return Array.isArray(r.value)?r.value.includes(e):r.value===e}return(e,t)=>(P(),u(`div`,$f,[(P(!0),u(n,null,z(e.options,t=>(P(),c(G(X),{key:t.value,thin:e.thin,outline:e.outline,class:D([a(t.value)?`primary`:`bg-transparent`,`border px-075 radius-2`]),type:`button`,onClick:e=>i(t.value)},{default:J(()=>[t.icon?(P(),c(G($),{key:0,name:t.icon,weight:`300`},null,8,[`name`])):l(``,!0),d(`p`,null,U(t.label),1)]),_:2},1032,[`thin`,`outline`,`class`,`onClick`]))),128))]))}}),tp=Y(ep,[[`__scopeId`,`data-v-405ca648`]]),np=class{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt((this.x-e.x)**2+(this.y-e.y)**2)}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time===e.time?0:this.distanceTo(e)/(this.time-e.time)}},rp=class e{static fromPoints(t,n){let r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=t.x-n.x,o=t.y-n.y,s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=Math.sqrt(r*r+i*i),u=Math.sqrt(a*a+o*o),d=s.x-c.x,f=s.y-c.y,p=l+u==0?0:u/(l+u),m={x:c.x+d*p,y:c.y+f*p},h=t.x-m.x,g=t.y-m.y;return{c1:new np(s.x+h,s.y+g),c2:new np(c.x+h,c.y+g)}}constructor(e,t,n,r,i,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}length(){let e=10,t=0,n,r;for(let i=0;i<=e;i+=1){let a=i/e,o=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(i>0){let e=o-n,i=s-r;t+=Math.sqrt(e*e+i*i)}n=o,r=s}return t}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},ip=class{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};function ap(e,t=250){let n=0,r=null,i,a,o,s=()=>{n=Date.now(),r=null,i=e.apply(a,o),r||(a=null,o=[])};return function(...c){let l=Date.now(),u=t-(l-n);return a=this,o=c,u<=0||u>t?(r&&(clearTimeout(r),r=null),n=l,i=e.apply(a,o),r||(a=null,o=[])):r||=window.setTimeout(s,u),i}}var op=class e extends ip{constructor(t,n={}){var r,i,a;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=e=>{!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))},this._handleMouseMove=e=>{if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))},this._handleMouseUp=e=>{this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))},this._handleTouchStart=e=>{e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))},this._handleTouchMove=e=>{if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}},this._handleTouchEnd=e=>{e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))},this._handlePointerDown=e=>{!e.isPrimary||!this._isLeftButtonPressed(e)||this._drawingStroke||this._strokePointerId!==void 0&&this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))},this._handlePointerMove=e=>{if(!(!e.isPrimary||this._strokePointerId!==this._getPointerId(e))){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}},this._handlePointerUp=e=>{!e.isPrimary||this._isLeftButtonPressed(e)||this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=void 0,e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=(r=n.throttle)??16,this.minDistance=(i=n.minDistance)??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||`black`,this.backgroundColor=n.backgroundColor||`rgba(0,0,0,0)`,this.compositeOperation=n.compositeOperation||`source-over`,this.canvasContextOptions=(a=n.canvasContextOptions)??{},this._strokeMoveUpdate=this.throttle?ap(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._ctx=t.getContext(`2d`,this.canvasContextOptions),this.clear(),this.on()}clear(){let{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(e,t={}){return new Promise((n,r)=>{let i=new Image,a=t.ratio||window.devicePixelRatio||1,o=t.width||this.canvas.width/a,s=t.height||this.canvas.height/a,c=t.xOffset||0,l=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,c,l,o,s),n()},i.onerror=e=>{r(e)},i.crossOrigin=`anonymous`,i.src=e,this._isEmpty=!1})}toDataURL(e=`image/png`,t){switch(e){case`image/svg+xml`:return typeof t!=`object`&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!=`number`&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction=`none`,this.canvas.style.msTouchAction=`none`,this.canvas.style.userSelect=`none`;let e=/Macintosh/.test(navigator.userAgent)&&`ontouchstart`in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),`ontouchstart`in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction=`auto`,this.canvas.style.msTouchAction=`auto`,this.canvas.style.userSelect=`auto`,this.canvas.removeEventListener(`pointerdown`,this._handlePointerDown),this.canvas.removeEventListener(`mousedown`,this._handleMouseDown),this.canvas.removeEventListener(`touchstart`,this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;let t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)??this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){let{removeEventListener:e}=this._getListenerFunctions();e(`pointermove`,this._handlePointerMove),e(`pointerup`,this._handlePointerUp),e(`mousemove`,this._handleMouseMove),e(`mouseup`,this._handleMouseUp),e(`touchmove`,this._handleTouchMove),e(`touchend`,this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)==1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:`pressure`in e?e.pressure:0}}_touchEventToSignatureEvent(e){let t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_getPointGroupOptions(e){return{penColor:e&&`penColor`in e?e.penColor:this.penColor,dotSize:e&&`dotSize`in e?e.dotSize:this.dotSize,minWidth:e&&`minWidth`in e?e.minWidth:this.minWidth,maxWidth:e&&`maxWidth`in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&`velocityFilterWeight`in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&`compositeOperation`in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){let t=!this.dispatchEvent(new CustomEvent(`beginStroke`,{detail:e,cancelable:!0}));if(t)return;let{addEventListener:n}=this._getListenerFunctions();switch(e.event.type){case`mousedown`:n(`mousemove`,this._handleMouseMove,{passive:!1}),n(`mouseup`,this._handleMouseUp,{passive:!1});break;case`touchstart`:n(`touchmove`,this._handleTouchMove,{passive:!1}),n(`touchend`,this._handleTouchEnd,{passive:!1});break;case`pointerdown`:n(`pointermove`,this._handlePointerMove,{passive:!1}),n(`pointerup`,this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;let r=this._getPointGroupOptions(),i=Object.assign(Object.assign({},r),{points:[]});this._data.push(i),this._reset(r),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent(`beforeUpdateStroke`,{detail:e}));let t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],a=i?t.distanceTo(i)<=this.minDistance:!1,o=this._getPointGroupOptions(n);if(!i||!(i&&a)){let e=this._addPoint(t,o);i?e&&this._drawCurve(e,o):this._drawDot(t,o),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent(`afterUpdateStroke`,{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent(`endStroke`,{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`pointerdown`,this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`mousedown`,this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener(`touchstart`,this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){let r=this.canvas.getBoundingClientRect();return new np(e-r.left,t-r.top,n,new Date().getTime())}_addPoint(e,t){let{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);let e=this._calculateCurveWidths(n[1],n[2],t),r=rp.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){let r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){let r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){let n=this._ctx,r=e.endWidth-e.startWidth,i=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){let a=n/i,o=a*a,s=o*a,c=1-a,l=c*c,u=l*c,d=u*e.startPoint.x;d+=3*l*a*e.control1.x,d+=3*c*o*e.control2.x,d+=s*e.endPoint.x;let f=u*e.startPoint.y;f+=3*l*a*e.control1.y,f+=3*c*o*e.control2.y,f+=s*e.endPoint.y;let p=Math.min(e.startWidth+s*r,t.maxWidth);this._drawCurveSegment(d,f,p)}n.closePath(),n.fill()}_drawDot(e,t){let n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(let r of e){let{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){let r=e[n],a=new np(r.x,r.y,r.pressure,r.time);n===0&&this._reset(i);let o=this._addPoint(a,i);o&&t(o,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1}={}){let t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=0,i=0,a=this.canvas.width/n,o=this.canvas.height/n,s=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(s.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),s.setAttribute(`xmlns:xlink`,`http://www.w3.org/1999/xlink`),s.setAttribute(`viewBox`,`${r} ${i} ${a} ${o}`),s.setAttribute(`width`,a.toString()),s.setAttribute(`height`,o.toString()),e&&this.backgroundColor){let e=document.createElement(`rect`);e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),e.setAttribute(`fill`,this.backgroundColor),s.appendChild(e)}return this._fromData(t,(e,{penColor:t})=>{let n=document.createElement(`path`);if(!isNaN(e.control1.x)&&!isNaN(e.control1.y)&&!isNaN(e.control2.x)&&!isNaN(e.control2.y)){let r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute(`d`,r),n.setAttribute(`stroke-width`,(e.endWidth*2.25).toFixed(3)),n.setAttribute(`stroke`,t),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-linecap`,`round`),s.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{let a=document.createElement(`circle`),o=n>0?n:(r+i)/2;a.setAttribute(`r`,o.toString()),a.setAttribute(`cx`,e.x.toString()),a.setAttribute(`cy`,e.y.toString()),a.setAttribute(`fill`,t),s.appendChild(a)}),s.outerHTML}};const sp=[`disabled`],cp=[`required`];var lp=h({__name:`SignaturePad`,props:w({sigOption:{},width:{},height:{},ratio:{},clearOnResize:{type:Boolean},waterMark:{},disabled:{type:Boolean},defaultUrl:{},format:{},clearable:{type:Boolean,default:!0},required:{type:Boolean}},{modelValue:{},modelModifiers:{},file:{},fileModifiers:{}}),emits:[`update:modelValue`,`update:file`],setup(e,{expose:t}){let n=e,r=se(e,`modelValue`),i=se(e,`file`),a=R(),s=R(),f=R(!0);function p(){var e;(e=s.value)?.clear(),f.value=!0,r.value=void 0}function m(e){var t,r;return e||=n.format,e?(t=s.value)?.toDataURL(e):(r=s.value)?.toDataURL()}function h(){let e=m();if(e)if(n.format===`image/svg+xml`)i.value=new File([e],`signature.svg`,{type:`image/svg+xml`});else try{let t=e.split(`,`)[1];if(!t)throw Error(`Invalid data URL format`);let r=atob(t),a=new Uint8Array(Array.from(r,e=>e.charCodeAt(0))),o=n.format||`image/png`,s=new Blob([a],{type:o}),c=o.split(`/`)[1];i.value=new File([s],`signature.${c}`,{type:o})}catch(e){console.error(`Error saving signature file:`,e)}}function g(e){var t,r,i;return(t=s.value)?.fromDataURL(e,{height:(r=a.value)?.height,width:(i=a.value)?.width,ratio:n.ratio,xOffset:0,yOffset:0})}let _=()=>{var e;return(e=s.value)?.isEmpty()};function v(){var e;let t=(e=s.value)?.toData();if(t){var n;t.pop(),(n=s.value)?.fromData(t)}}let y=R({penColor:`rgb(0, 0, 0)`,backgroundColor:`rgb(255, 255, 255)`}),b=o(()=>({...y.value,...n.sigOption}));q(()=>n.disabled,e=>{var t,n;e?(t=s.value)?.off():(n=s.value)?.on()});function x(e){if(Object.prototype.toString.call(e)!==`[object Object]`)throw Error(`Expected Object, got ${typeof e}.`);{var t;let n={text:e.text||``,x:e.x||20,y:e.y||20,sx:e.sx||40,sy:e.sy||40},r=(t=a.value)?.getContext(`2d`);if(!r)return;r.font=e.font||`20px sans-serif`,r.fillStyle=e.fillStyle||`#333`,r.strokeStyle=e.strokeStyle||`#333`,e.style===`all`?(r.fillText(n.text,n.x,n.y),r.strokeText(n.text,n.sx,n.sy)):e.style===`stroke`?r.strokeText(n.text,n.sx,n.sy):r.fillText(n.text,n.x,n.y)}}function S(){var e;f.value=(e=s.value)?.isEmpty()??!1;let t=m();r.value=t,h()}function C(e){if(!e)return;let t=new FileReader;return new Promise(n=>{t.onload=e=>{var t;let i=String((t=e.target)?.result);g(i),f.value=!1,r.value=i,n(!0)},t.readAsDataURL(e)})}q(i,e=>{C(e)});function w(){let e;_()||(e=m());let t=n.ratio??1/2,{width:r}=a.value.getBoundingClientRect();a.value.width=n.width?Number(n.width.replaceAll(`px`,``)):r,a.value.height=n.height?Number(n.height.replaceAll(`px`,``)):r*t,p(),!n.clearOnResize&&e!==void 0&&g(e),n.waterMark&&x(n.waterMark)}function T(){s.value=new op(a.value,b.value),w(),n.disabled?s.value.off():s.value.on(),f.value=s.value.isEmpty(),i.value&&C(i.value)}return j(T),Fn(()=>a.value,w),kn(()=>s.value,`endStroke`,S),t({save:m,clear:p,isEmpty:_,undo:v,addWaterMark:x,fromDataURL:g}),(e,t)=>(P(),u(`div`,{class:D([`bgl_input signature-pad relative`,{"bg-transparent":e.disabled}]),onTouchmove:t[0]||=he(()=>{},[`prevent`])},[e.clearable&&!e.disabled?(P(),c(G(X),{key:0,flat:``,thin:``,icon:`refresh`,class:`position-bottom-end`,onClick:p})):l(``,!0),d(`canvas`,{ref_key:`vCanvas`,ref:a,class:`canvas`,disabled:e.disabled},null,8,sp),d(`input`,{placeholder:`required`,type:`text`,required:e.required&&G(f),class:`pixel opacity-0`,inputMode:`none`},null,8,cp)],34))}}),up=lp;
|
|
137
|
+
`,c=f.value.contentDocument||(e=f.value.contentWindow)?.document;if(!c)return;c.open(),c.write(s),c.close(),await new Promise(e=>setTimeout(e,0)),c.designMode=`on`,c.body.contentEditable=`true`,c.body.dir=et.value?`rtl`:`ltr`;let l=c.body.querySelectorAll(`blockquote, ul, ol`);console.log(`Found existing block elements:`,l.length),l.forEach(e=>{let t=e;if(console.log(`Processing element:`,t.tagName,`current dir:`,t.dir),t.dir||(t.dir=c.body.dir||`ltr`,console.log(`Applied direction to existing`,t.tagName,`:`,t.dir)),t.tagName===`UL`||t.tagName===`OL`){let e=t.querySelectorAll(`li`);e.forEach(e=>{let n=e;n.dir||(n.dir=t.dir,console.log(`Applied direction to list item:`,n.dir))})}}),h.state.content=c.body.innerHTML,h.init(c),Tf(c,v),i.basic&&i.modelValue&&setTimeout(()=>{let e=c.body.querySelectorAll(`*`);e.forEach(e=>{if(e.tagName!==`P`&&e.tagName!==`BR`){let n=e.textContent||``;if(n.trim()){var t;let r=c.createElement(`p`);r.textContent=n,(t=e.parentNode)?.replaceChild(r,e)}else e.remove()}else e.tagName===`P`&&Array.from(e.attributes).forEach(t=>{t.name!==`dir`&&e.removeAttribute(t.name)})}),fe(c)},100),c.addEventListener(`selectionchange`,()=>{setTimeout(()=>{ge()},10)}),c.addEventListener(`mouseup`,()=>{setTimeout(()=>{ge()},10)}),c.addEventListener(`click`,e=>{setTimeout(()=>{let e=c.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&_e()},10)}),c.addEventListener(`keydown`,e=>{[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Escape`].includes(e.key)&&setTimeout(()=>{let e=c.getSelection();(!e||e.rangeCount===0||e.getRangeAt(0).collapsed)&&_e()},10)});let u=c.createTreeWalker(c.body,NodeFilter.SHOW_TEXT),d=[],p;for(;p=u.nextNode();)p.parentElement===c.body&&d.push(p);if(d.forEach(e=>{var t;if((t=e.textContent)?.trim()){let t=c.createElement(`p`);t.dir=c.body.dir,t.appendChild(e.cloneNode()),c.body.replaceChild(t,e)}else c.body.removeChild(e)}),c.addEventListener(`contextmenu`,e=>{let t=e.target,n=t.closest(`td, th`);if(n&&n.closest(`table`)){e.preventDefault(),K.value=n;let t=f.value.getBoundingClientRect();se.value={x:t.left+e.clientX,y:t.top+e.clientY},oe.value=!0}}),c.addEventListener(`click`,e=>{c.querySelectorAll(`.table-cell-selected`).forEach(e=>{e.classList.remove(`table-cell-selected`)});let t=e.target,n=t.closest(`td, th`);n&&n.closest(`table`)&&(n.classList.add(`table-cell-selected`),K.value=n)}),rt(c),console.log(`About to setup table edit buttons...`),nt(c),console.log(`Table edit buttons setup completed`),fe(c),!c.body.innerHTML.trim()||!c.body.querySelector(`p,h1,h2,h3,h4,h5,h6,blockquote,ul,ol,table`)){let e=c.createElement(`p`);e.dir=c.body.dir,c.body.appendChild(e);let t=c.createRange();t.selectNodeContents(e),t.collapse(!0);let n=c.getSelection();n&&(n.removeAllRanges(),n.addRange(t)),fe(c)}i.autofocus===!0&&c.body.focus(),_.value=!0}catch(e){console.error(`Error during editor initialization:`,e)}finally{g.value=!1}}}q(()=>i.modelValue,(e,t)=>{e!==h.state.content&&(!t||Math.abs(e.length-t.length)>50?(_.value=!1,h.state.content=e,h.updateState.content(`html`),setTimeout(()=>{h.state.doc&&(fe(h.state.doc),nt(h.state.doc))},100)):setTimeout(()=>{h.state.doc&&nt(h.state.doc)},50))}),q(()=>h.state.content,e=>{var t;(t=h.state.doc)?.body&&(h.state.doc.body.dir=et.value?`rtl`:`ltr`),a(`update:modelValue`,e)}),q(()=>W.value.alignment,e=>{if(ce?.existingTable){let t=ce.existingTable;e===`center`?(t.style.marginLeft=`auto`,t.style.marginRight=`auto`):e===`right`?(t.style.marginLeft=`auto`,t.style.marginRight=`0`):(t.style.marginLeft=`0`,t.style.marginRight=`auto`),h.state.doc&&fe(h.state.doc)}});function at(){oe.value=!1}return typeof window<`u`&&window.addEventListener(`click`,at),A(()=>{typeof window<`u`&&window.removeEventListener(`click`,at)}),t({editor:h,commands:v}),(e,t)=>{var r,i,a,o,g;return P(),u(n,null,[d(`div`,T({class:`bagel-input`},G(s)),[e.label?(P(),u(`label`,Ef,U(e.label),1)):l(``,!0),d(`div`,{class:D([`rounded`,[{"rich-text-editor pt-05 px-05 pb-075":!e.basic,"rich-text-editor--basic":e.basic,"fullscreen-mode":G(h).state.isFullscreen}]])},[G(h).state.hasInit&&y.value?(P(),c(Zd,{key:0,config:x.value,selectedStyles:G(h).state.selectedStyles,"hide-images":e.hideImages,"hide-videos":e.hideVideos,"hide-embeds":e.hideEmbed,"hide-tables":e.hideTables,"hide-alignment":e.hideAlignment,"hide-directions":e.hideDirections,"hide-h5-h6":e.hideH5H6,hide:S.value,onAction:G(v).execute},null,8,[`config`,`selectedStyles`,`hide-images`,`hide-videos`,`hide-embeds`,`hide-tables`,`hide-alignment`,`hide-directions`,`hide-h5-h6`,`hide`,`onAction`])):l(``,!0),d(`div`,{class:D([`editor-container`,{"split-view":G(h).state.isSplitView}])},[d(`div`,{class:`content-area radius-1`,style:k({height:G(h).state.isFullscreen?`calc(100vh - 4rem)`:G(tt)})},[d(`iframe`,{id:`rich-text-iframe`,ref_key:`iframe`,ref:f,class:`editableContent`,title:`Editor`,srcdoc:``,sandbox:`allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation`,onLoad:it,onContextmenu:Qe},null,544)],4),G(h).state.isSplitView?(P(),c(G(Rl),{key:0,modelValue:G(h).state.content,"onUpdate:modelValue":[t[0]||=e=>G(h).state.content=e,t[1]||=e=>G(h).updateState.content(`html`)],language:`html`,height:G(h).state.isFullscreen?`calc(100vh - 4rem)`:G(tt)},null,8,[`modelValue`,`height`])):l(``,!0)],2),e.debug?(P(),u(`div`,Df,[t[75]||=d(`p`,{class:`txt12 txt-gray mb-0 p-0`},` Debug `,-1),m(G(X),{thin:``,color:`gray`,icon:`visibility`,onClick:pe},{default:J(()=>t[71]||=[p(` Show Content `)]),_:1,__:[71]}),m(G(X),{thin:``,color:`gray`,icon:`delete`,onClick:(r=G($e))?.clearSession},{default:J(()=>t[72]||=[p(` Clear Session `)]),_:1,__:[72]},8,[`onClick`]),m(G(X),{thin:``,color:`gray`,icon:`download`,onClick:(i=G($e))?.downloadSession},{default:J(()=>t[73]||=[p(` Download Log `)]),_:1,__:[73]},8,[`onClick`]),m(G(X),{thin:``,color:`gray`,icon:`content_copy`,onClick:t[2]||=e=>{var t;return G(Rc)((t=G($e))?.exportDebugWithPrompt()||``)}},{default:J(()=>t[74]||=[p(` Copy Log `)]),_:1,__:[74]})])):l(``,!0)],2),z.value?(P(),u(`div`,{key:1,class:`inline-toolbar`,style:k({position:`fixed`,top:`${B.value.top}px`,left:`${B.value.left}px`,zIndex:99})},[d(`div`,Of,[m(G(X),{thin:``,flat:``,icon:`format_bold`,class:D({active:G(h).state.selectedStyles.has(`bold`)}),onClick:t[3]||=e=>ve(`bold`)},null,8,[`class`]),m(G(X),{thin:``,flat:``,icon:`format_italic`,class:D({active:G(h).state.selectedStyles.has(`italic`)}),onClick:t[4]||=e=>ve(`italic`)},null,8,[`class`]),m(G(X),{thin:``,flat:``,icon:`format_underlined`,class:D({active:G(h).state.selectedStyles.has(`underline`)}),onClick:t[5]||=e=>ve(`underline`)},null,8,[`class`]),t[76]||=d(`span`,{class:`separator`},`|`,-1),m(G(X),{thin:``,flat:``,icon:`add_link`,onClick:t[6]||=e=>ve(`link`)})])],4)):l(``,!0),oe.value?(P(),u(`div`,{key:2,class:`table-context-menu`,style:k({position:`fixed`,top:`${se.value.y}px`,left:`${se.value.x}px`,zIndex:1001})},[d(`div`,{class:`context-menu-content`,onClick:t[17]||=he(()=>{},[`stop`])},[d(`div`,kf,[t[77]||=d(`span`,null,`Table Actions`,-1),d(`button`,{class:`close-btn`,onClick:t[7]||=e=>oe.value=!1},` × `)]),d(`div`,Af,[Ye.value?(P(),c(G(X),{key:0,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`start`,class:`context-menu-btn`,onClick:t[8]||=e=>{Be(),oe.value=!1}},{default:J(()=>t[78]||=[p(` Merge Right `)]),_:1,__:[78]})):l(``,!0),Xe.value?(P(),c(G(X),{key:1,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`text_select_move_down`,class:`context-menu-btn`,onClick:t[9]||=e=>{Ve(),oe.value=!1}},{default:J(()=>t[79]||=[p(` Merge Down `)]),_:1,__:[79]})):l(``,!0),Ze.value?(P(),c(G(X),{key:2,"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`call_split`,class:`context-menu-btn`,onClick:t[10]||=e=>{He(),oe.value=!1}},{default:J(()=>t[80]||=[p(` Split Cell `)]),_:1,__:[80]})):l(``,!0),Ye.value||Xe.value||Ze.value?(P(),u(`div`,jf)):l(``,!0),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_above`,class:`context-menu-btn`,onClick:t[11]||=e=>{Ue(),oe.value=!1}},{default:J(()=>t[81]||=[p(` Insert Row Above `)]),_:1,__:[81]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_row_below`,class:`context-menu-btn`,onClick:t[12]||=e=>{We(),oe.value=!1}},{default:J(()=>t[82]||=[p(` Insert Row Below `)]),_:1,__:[82]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[13]||=e=>{Ge(),oe.value=!1}},{default:J(()=>t[83]||=[p(` Delete Row `)]),_:1,__:[83]}),t[87]||=d(`div`,{class:`context-menu-separator`},null,-1),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_left`,class:`context-menu-btn`,onClick:t[14]||=e=>{Ke(),oe.value=!1}},{default:J(()=>t[84]||=[p(` Insert Column Left `)]),_:1,__:[84]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`add_column_right`,class:`context-menu-btn`,onClick:t[15]||=e=>{qe(),oe.value=!1}},{default:J(()=>t[85]||=[p(` Insert Column Right `)]),_:1,__:[85]}),m(G(X),{"full-width":``,"align-txt":`start`,thin:``,flat:``,icon:`remove`,class:`context-menu-btn`,onClick:t[16]||=e=>{Je(),oe.value=!1}},{default:J(()=>t[86]||=[p(` Delete Column `)]),_:1,__:[86]})])])],4)):l(``,!0)],16),m(G(MT),{visible:C.value,"onUpdate:visible":t[21]||=e=>C.value=e,title:`Add Link`,width:`400`},{footer:J(()=>[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[20]||=e=>C.value=!1}),m(G(X),{value:`Add Link`,disabled:!Ce(w.value.url),onClick:xe},null,8,[`disabled`])]),default:J(()=>[d(`div`,Mf,[m(Pd,{modelValue:w.value.url,"onUpdate:modelValue":t[18]||=e=>w.value.url=e,label:`URL`,type:`url`,placeholder:`https://example.com`,onKeydown:me(xe,[`enter`])},null,8,[`modelValue`]),m(G(X),{icon:`open_in_new`,class:`mb-05 radius-1`,flat:``,disabled:!Ce(w.value.url),onClick:Se},null,8,[`disabled`])]),m(Al,{modelValue:w.value.openInNewTab,"onUpdate:modelValue":t[19]||=e=>w.value.openInNewTab=e,label:`Open in new tab`,type:`checkbox`,class:`mb-2 mt-05`},null,8,[`modelValue`])]),_:1},8,[`visible`]),E.value?(P(),u(`div`,{key:0,class:`editor-tooltip`,style:k({left:`${O.value.x}px`,top:`${O.value.y}px`})},U(O.value.message),5)):l(``,!0),m(G(MT),{visible:ee.value,"onUpdate:visible":t[29]||=e=>ee.value=e,title:(a=G(F))?.existingImage?`Edit Image`:`Insert Image`,width:`500`},{footer:J(()=>{var e,n;return[d(`div`,Pf,[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[28]||=e=>ee.value=!1}),(e=G(F))?.existingImage?(P(),c(G(X),{key:0,value:`Delete Image`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Re})):l(``,!0),m(G(X),{class:`ms-auto`,value:(n=G(F))?.existingImage?`Save Changes`:`Insert Image`,disabled:!N.value.src,onClick:Te},null,8,[`value`,`disabled`])])]}),default:J(()=>[m(Pd,{modelValue:N.value.src,"onUpdate:modelValue":t[22]||=e=>N.value.src=e,label:`Image URL`,type:`url`,placeholder:`https://example.com/image.jpg`,onKeydown:me(Te,[`enter`])},null,8,[`modelValue`]),m(Pd,{modelValue:N.value.alt,"onUpdate:modelValue":t[23]||=e=>N.value.alt=e,label:`Alt Text`,placeholder:`Describe the image`},null,8,[`modelValue`]),d(`div`,Nf,[m(Pd,{modelValue:N.value.width,"onUpdate:modelValue":t[24]||=e=>N.value.width=e,label:`Width`,placeholder:`100% or 500px or auto`,help:`Examples: 100%, 500px, auto`},null,8,[`modelValue`]),m(Pd,{modelValue:N.value.height,"onUpdate:modelValue":t[25]||=e=>N.value.height=e,label:`Height`,placeholder:`auto or 300px`,help:`Examples: auto, 300px`},null,8,[`modelValue`])]),m(Pd,{modelValue:N.value.credit,"onUpdate:modelValue":t[26]||=e=>N.value.credit=e,label:`Photo Credit`,placeholder:`Photographer name (optional)`},null,8,[`modelValue`]),m(Al,{modelValue:N.value.figcaption,"onUpdate:modelValue":t[27]||=e=>N.value.figcaption=e,label:`Show alt text as caption`,help:`Photo credit will always be shown if provided`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),m(G(MT),{visible:I.value,"onUpdate:visible":t[35]||=e=>I.value=e,title:(o=G(te))?.existingEmbed?`Edit Embed`:`Insert Embed`,width:`500`},{footer:J(()=>{var e,n;return[d(`div`,If,[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[34]||=e=>I.value=!1}),(e=G(te))?.existingEmbed?(P(),c(G(X),{key:0,value:`Delete Embed`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:ze})):l(``,!0),m(G(X),{value:(n=G(te))?.existingEmbed?`Save Changes`:`Insert Embed`,disabled:!L.value.src,class:`ms-auto`,onClick:De},null,8,[`value`,`disabled`])])]}),default:J(()=>[m(Pd,{modelValue:L.value.src,"onUpdate:modelValue":t[30]||=e=>L.value.src=e,label:`Embed URL or Code`,type:`url`,placeholder:`https://www.youtube.com/embed/... or paste iframe code`,onKeydown:me(De,[`enter`])},null,8,[`modelValue`]),d(`div`,Ff,[m(Pd,{modelValue:L.value.width,"onUpdate:modelValue":t[31]||=e=>L.value.width=e,label:`Width`,placeholder:`560`},null,8,[`modelValue`]),m(Pd,{modelValue:L.value.height,"onUpdate:modelValue":t[32]||=e=>L.value.height=e,label:`Height`,placeholder:`315`},null,8,[`modelValue`])]),m(Pd,{modelValue:L.value.alt,"onUpdate:modelValue":t[33]||=e=>L.value.alt=e,label:`Caption`,placeholder:`Enter caption (optional)`},null,8,[`modelValue`])]),_:1},8,[`visible`,`title`]),m(G(MT),{visible:re.value,"onUpdate:visible":t[48]||=e=>re.value=e,title:`Insert Video`,width:`500`},{footer:J(()=>{var e;return[d(`div`,Hf,[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[47]||=e=>re.value=!1}),(e=G(H))?.existingVideo?(P(),c(G(X),{key:0,value:`Delete Video`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:je})):l(``,!0),m(G(X),{value:`Insert Video`,class:`ms-auto`,disabled:!V.value.src||!ke(V.value.src),onClick:Ae},null,8,[`disabled`])])]}),default:J(()=>[d(`div`,Lf,[m(Pd,{modelValue:V.value.src,"onUpdate:modelValue":t[36]||=e=>V.value.src=e,label:`Video URL or Embed Code`,type:`url`,placeholder:`Paste YouTube URL, video file URL, or iframe embed code...`,class:D({error:V.value.src&&!ke(V.value.src)}),onKeydown:me(Ae,[`enter`])},null,8,[`modelValue`,`class`]),V.value.src&&!ke(V.value.src)?(P(),u(`div`,Rf,[m(G($),{name:`warning`}),t[88]||=d(`p`,{class:`txt12`},` Please enter a valid video URL or iframe embed code `,-1)])):l(``,!0),m(Pd,{modelValue:V.value.width,"onUpdate:modelValue":t[37]||=e=>V.value.width=e,label:`Width`,placeholder:`100% or 500px or 50vw`,help:`Examples: 100%, 500px, 50vw, 300`},null,8,[`modelValue`]),m(Ed,{modelValue:V.value.aspectRatio,"onUpdate:modelValue":t[38]||=e=>V.value.aspectRatio=e,label:`Aspect Ratio`,options:[{value:`16:9`,label:`16:9 (Standard)`},{value:`4:3`,label:`4:3 (Classic)`},{value:`9:16`,label:`9:16 (Vertical/Shorts)`},{value:`21:9`,label:`21:9 (Cinematic)`},{value:`1:1`,label:`1:1 (Square)`},{value:`custom`,label:`Custom`}]},null,8,[`modelValue`]),V.value.aspectRatio===`custom`?(P(),u(`div`,zf,[m(Pd,{modelValue:V.value.customWidth,"onUpdate:modelValue":t[39]||=e=>V.value.customWidth=e,label:`Width ratio`,placeholder:`16`,type:`number`},null,8,[`modelValue`]),m(Pd,{modelValue:V.value.customHeight,"onUpdate:modelValue":t[40]||=e=>V.value.customHeight=e,label:`Height ratio`,placeholder:`9`,type:`number`},null,8,[`modelValue`])])):l(``,!0),d(`div`,Bf,[m(Al,{modelValue:V.value.controls,"onUpdate:modelValue":t[41]||=e=>V.value.controls=e,label:`Show controls`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.autoplay,"onUpdate:modelValue":t[42]||=e=>V.value.autoplay=e,label:`Autoplay`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.mute,"onUpdate:modelValue":t[43]||=e=>V.value.mute=e,label:`Mute`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.loop,"onUpdate:modelValue":t[44]||=e=>V.value.loop=e,label:`Loop`},null,8,[`modelValue`]),m(Al,{modelValue:V.value.showCaption,"onUpdate:modelValue":t[45]||=e=>V.value.showCaption=e,class:`grid-span-2`,label:`Show caption below video`},null,8,[`modelValue`]),V.value.showCaption?(P(),c(Pd,{key:0,modelValue:V.value.caption,"onUpdate:modelValue":t[46]||=e=>V.value.caption=e,label:`Caption`,class:`grid-span-2`,placeholder:`Describe the video content`},null,8,[`modelValue`])):l(``,!0)]),V.value.src&&ke(V.value.src)?(P(),c(G(ai),{key:2,frame:``,thin:``,class:`bg-gray-20`},{default:J(()=>[t[89]||=d(`p`,{class:`label`},` Preview: `,-1),d(`div`,Vf,[m(G(ir),{src:V.value.src,class:``,"aspect-ratio":V.value.aspectRatio===`custom`&&V.value.customWidth&&V.value.customHeight?`${V.value.customWidth}:${V.value.customHeight}`:V.value.aspectRatio,autoplay:!1,mute:V.value.mute,controls:V.value.controls,loop:V.value.loop},null,8,[`src`,`aspect-ratio`,`mute`,`controls`,`loop`])])]),_:1,__:[89]})):l(``,!0)])]),_:1},8,[`visible`]),m(G(MT),{visible:ie.value,"onUpdate:visible":t[70]||=e=>ie.value=e,title:(g=G(ce))?.existingTable?`Edit Table`:`Insert Table`,width:`700`},{default:J(()=>[d(`div`,Uf,[t[92]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Structure `),d(`div`,{class:`line`})],-1),m(Ru,{modelValue:W.value.rows,"onUpdate:modelValue":t[49]||=e=>W.value.rows=e,min:1,max:20,label:`Rows`},null,8,[`modelValue`]),m(Ru,{modelValue:W.value.cols,"onUpdate:modelValue":t[50]||=e=>W.value.cols=e,min:1,max:10,label:`Columns`},null,8,[`modelValue`]),d(`div`,Wf,[t[90]||=d(`label`,{class:`label`},`Cell Text Alignment`,-1),d(`div`,Gf,[m(G(X),{class:D({activeBtn:W.value.alignment===`left`}),flat:``,thin:``,icon:`format_align_left`,title:`Align Left`,onClick:t[51]||=e=>W.value.alignment=`left`},null,8,[`class`]),m(G(X),{class:D({activeBtn:W.value.alignment===`center`}),flat:``,thin:``,icon:`format_align_center`,title:`Align Center`,onClick:t[52]||=e=>W.value.alignment=`center`},null,8,[`class`]),m(G(X),{class:D({activeBtn:W.value.alignment===`right`}),flat:``,thin:``,icon:`format_align_right`,title:`Align Right`,onClick:t[53]||=e=>W.value.alignment=`right`},null,8,[`class`])])]),d(`div`,Kf,[t[91]||=d(`label`,{class:`label`},`Text Direction`,-1),d(`div`,qf,[m(G(X),{class:D({activeBtn:W.value.direction===`ltr`}),flat:``,thin:``,value:`LTR`,title:`Left to Right`,onClick:t[54]||=e=>W.value.direction=`ltr`},null,8,[`class`]),m(G(X),{class:D({activeBtn:W.value.direction===`rtl`}),flat:``,thin:``,value:`RTL`,title:`Right to Left`,onClick:t[55]||=e=>W.value.direction=`rtl`},null,8,[`class`])])]),t[93]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Table Style `),d(`div`,{class:`line`})],-1),m(Ru,{modelValue:W.value.width,"onUpdate:modelValue":t[56]||=e=>W.value.width=e,label:`Width (%)`,min:25,max:100},null,8,[`modelValue`]),m(Ru,{modelValue:W.value.cellPadding,"onUpdate:modelValue":t[57]||=e=>W.value.cellPadding=e,label:`Cell Padding (px)`,min:2,max:20},null,8,[`modelValue`]),m(Ru,{modelValue:W.value.borderWidth,"onUpdate:modelValue":t[58]||=e=>W.value.borderWidth=e,label:`Border Width (px)`,min:0,max:5},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.borderColor,"onUpdate:modelValue":t[59]||=e=>W.value.borderColor=e,label:`Border Color`},null,8,[`modelValue`]),m(Al,{modelValue:W.value.fixedLayout,"onUpdate:modelValue":t[60]||=e=>W.value.fixedLayout=e,label:`Fixed cell width (doesn't change by content)`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),t[94]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Cell Colors: `),d(`div`,{class:`line`})],-1),m(G(Hl),{modelValue:W.value.cellBgColor,"onUpdate:modelValue":t[61]||=e=>W.value.cellBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Background Color`},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.cellTextColor,"onUpdate:modelValue":t[62]||=e=>W.value.cellTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Text Color`},null,8,[`modelValue`]),t[95]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Row Styles: `),d(`div`,{class:`line`})],-1),m(Al,{modelValue:W.value.showHeaders,"onUpdate:modelValue":t[63]||=e=>W.value.showHeaders=e,label:`Show header row`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),W.value.showHeaders?(P(),u(`div`,Jf,[m(G(Hl),{modelValue:W.value.headerBgColor,"onUpdate:modelValue":t[64]||=e=>W.value.headerBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Background Color`},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.headerTextColor,"onUpdate:modelValue":t[65]||=e=>W.value.headerTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Header Text Color`},null,8,[`modelValue`])])):l(``,!0),m(Al,{modelValue:W.value.alternateRows,"onUpdate:modelValue":t[66]||=e=>W.value.alternateRows=e,label:`Alternating Row Colors`,class:`grid-span-4 m_grid-span-2`},null,8,[`modelValue`]),W.value.alternateRows?(P(),u(`div`,Yf,[m(G(Hl),{modelValue:W.value.alternateRowBgColor,"onUpdate:modelValue":t[67]||=e=>W.value.alternateRowBgColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Background:`},null,8,[`modelValue`]),m(G(Hl),{modelValue:W.value.alternateRowTextColor,"onUpdate:modelValue":t[68]||=e=>W.value.alternateRowTextColor=e,class:`grid-span-2 m_grid-span-1`,label:`Alternate Row Text:`},null,8,[`modelValue`])])):l(``,!0)]),t[96]||=d(`div`,{class:`flex gap-05 white-space mt-0 grid-span-4 m_grid-span-2 pt-1 pb-05`},[d(`div`,{class:`line`}),d(`p`,{class:`label grid-span-4 m_grid-span-2`},` Preview `),d(`div`,{class:`line`})],-1),d(`div`,{style:{zoom:`0.8`},class:`opacity-7 user-select-none pointer-events-none`,innerHTML:le.value},null,8,Xf)]),footer:J(()=>{var e,n;return[m(G(X),{value:`Cancel`,flat:``,thin:``,onClick:t[69]||=e=>ie.value=!1}),(e=G(ce))?.existingTable?(P(),c(G(X),{key:0,value:`Delete Table`,color:`red`,flat:``,thin:``,icon:`delete`,onClick:Ie})):l(``,!0),m(G(X),{value:(n=G(ce))?.existingTable?`Save`:`Insert Table`,class:`ms-auto`,onClick:Pe},null,8,[`value`])]}),_:1},8,[`visible`,`title`])],64)}}}),Qf=Y(Zf,[[`__scopeId`,`data-v-b0eaafbe`]]);const $f={class:`flex flex-wrap gap-05 SelectBtn`};var ep=h({__name:`SelectBtn`,props:w({options:{},thin:{type:Boolean},outline:{type:Boolean},multiselect:{type:Boolean,default:!1}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,r=se(e,`modelValue`);function i(e){if(t.multiselect){let t=Array.isArray(r.value)?r.value:[],n=t.indexOf(e);n>-1?r.value=t.filter(t=>t!==e):r.value=[...t,e]}else r.value===e?r.value=null:r.value=e}function a(e){return Array.isArray(r.value)?r.value.includes(e):r.value===e}return(e,t)=>(P(),u(`div`,$f,[(P(!0),u(n,null,z(e.options,t=>(P(),c(G(X),{key:t.value,thin:e.thin,outline:e.outline,class:D([a(t.value)?`primary color-white`:`bg-transparent`,`border px-075 radius-2`]),style:{color:`var(--bgl-border-color)`},type:`button`,onClick:e=>i(t.value)},{default:J(()=>[t.icon?(P(),c(G($),{key:0,name:t.icon,weight:`300`},null,8,[`name`])):l(``,!0),d(`p`,null,U(t.label),1)]),_:2},1032,[`thin`,`outline`,`class`,`onClick`]))),128))]))}}),tp=Y(ep,[[`__scopeId`,`data-v-50b10a3e`]]),np=class{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt((this.x-e.x)**2+(this.y-e.y)**2)}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time===e.time?0:this.distanceTo(e)/(this.time-e.time)}},rp=class e{static fromPoints(t,n){let r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=t.x-n.x,o=t.y-n.y,s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=Math.sqrt(r*r+i*i),u=Math.sqrt(a*a+o*o),d=s.x-c.x,f=s.y-c.y,p=l+u==0?0:u/(l+u),m={x:c.x+d*p,y:c.y+f*p},h=t.x-m.x,g=t.y-m.y;return{c1:new np(s.x+h,s.y+g),c2:new np(c.x+h,c.y+g)}}constructor(e,t,n,r,i,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}length(){let e=10,t=0,n,r;for(let i=0;i<=e;i+=1){let a=i/e,o=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(i>0){let e=o-n,i=s-r;t+=Math.sqrt(e*e+i*i)}n=o,r=s}return t}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},ip=class{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};function ap(e,t=250){let n=0,r=null,i,a,o,s=()=>{n=Date.now(),r=null,i=e.apply(a,o),r||(a=null,o=[])};return function(...c){let l=Date.now(),u=t-(l-n);return a=this,o=c,u<=0||u>t?(r&&(clearTimeout(r),r=null),n=l,i=e.apply(a,o),r||(a=null,o=[])):r||=window.setTimeout(s,u),i}}var op=class e extends ip{constructor(t,n={}){var r,i,a;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=e=>{!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))},this._handleMouseMove=e=>{if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))},this._handleMouseUp=e=>{this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))},this._handleTouchStart=e=>{e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))},this._handleTouchMove=e=>{if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}},this._handleTouchEnd=e=>{e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))},this._handlePointerDown=e=>{!e.isPrimary||!this._isLeftButtonPressed(e)||this._drawingStroke||this._strokePointerId!==void 0&&this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))},this._handlePointerMove=e=>{if(!(!e.isPrimary||this._strokePointerId!==this._getPointerId(e))){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}},this._handlePointerUp=e=>{!e.isPrimary||this._isLeftButtonPressed(e)||this._strokePointerId!==this._getPointerId(e)||(this._strokePointerId=void 0,e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=(r=n.throttle)??16,this.minDistance=(i=n.minDistance)??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||`black`,this.backgroundColor=n.backgroundColor||`rgba(0,0,0,0)`,this.compositeOperation=n.compositeOperation||`source-over`,this.canvasContextOptions=(a=n.canvasContextOptions)??{},this._strokeMoveUpdate=this.throttle?ap(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._ctx=t.getContext(`2d`,this.canvasContextOptions),this.clear(),this.on()}clear(){let{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(e,t={}){return new Promise((n,r)=>{let i=new Image,a=t.ratio||window.devicePixelRatio||1,o=t.width||this.canvas.width/a,s=t.height||this.canvas.height/a,c=t.xOffset||0,l=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,c,l,o,s),n()},i.onerror=e=>{r(e)},i.crossOrigin=`anonymous`,i.src=e,this._isEmpty=!1})}toDataURL(e=`image/png`,t){switch(e){case`image/svg+xml`:return typeof t!=`object`&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!=`number`&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction=`none`,this.canvas.style.msTouchAction=`none`,this.canvas.style.userSelect=`none`;let e=/Macintosh/.test(navigator.userAgent)&&`ontouchstart`in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),`ontouchstart`in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction=`auto`,this.canvas.style.msTouchAction=`auto`,this.canvas.style.userSelect=`auto`,this.canvas.removeEventListener(`pointerdown`,this._handlePointerDown),this.canvas.removeEventListener(`mousedown`,this._handleMouseDown),this.canvas.removeEventListener(`touchstart`,this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;let t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)??this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){let{removeEventListener:e}=this._getListenerFunctions();e(`pointermove`,this._handlePointerMove),e(`pointerup`,this._handlePointerUp),e(`mousemove`,this._handleMouseMove),e(`mouseup`,this._handleMouseUp),e(`touchmove`,this._handleTouchMove),e(`touchend`,this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)==1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:`pressure`in e?e.pressure:0}}_touchEventToSignatureEvent(e){let t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_getPointGroupOptions(e){return{penColor:e&&`penColor`in e?e.penColor:this.penColor,dotSize:e&&`dotSize`in e?e.dotSize:this.dotSize,minWidth:e&&`minWidth`in e?e.minWidth:this.minWidth,maxWidth:e&&`maxWidth`in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&`velocityFilterWeight`in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&`compositeOperation`in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){let t=!this.dispatchEvent(new CustomEvent(`beginStroke`,{detail:e,cancelable:!0}));if(t)return;let{addEventListener:n}=this._getListenerFunctions();switch(e.event.type){case`mousedown`:n(`mousemove`,this._handleMouseMove,{passive:!1}),n(`mouseup`,this._handleMouseUp,{passive:!1});break;case`touchstart`:n(`touchmove`,this._handleTouchMove,{passive:!1}),n(`touchend`,this._handleTouchEnd,{passive:!1});break;case`pointerdown`:n(`pointermove`,this._handlePointerMove,{passive:!1}),n(`pointerup`,this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;let r=this._getPointGroupOptions(),i=Object.assign(Object.assign({},r),{points:[]});this._data.push(i),this._reset(r),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent(`beforeUpdateStroke`,{detail:e}));let t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],a=i?t.distanceTo(i)<=this.minDistance:!1,o=this._getPointGroupOptions(n);if(!i||!(i&&a)){let e=this._addPoint(t,o);i?e&&this._drawCurve(e,o):this._drawDot(t,o),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent(`afterUpdateStroke`,{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent(`endStroke`,{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`pointerdown`,this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener(`mousedown`,this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener(`touchstart`,this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){let r=this.canvas.getBoundingClientRect();return new np(e-r.left,t-r.top,n,new Date().getTime())}_addPoint(e,t){let{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);let e=this._calculateCurveWidths(n[1],n[2],t),r=rp.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){let r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){let r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){let n=this._ctx,r=e.endWidth-e.startWidth,i=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){let a=n/i,o=a*a,s=o*a,c=1-a,l=c*c,u=l*c,d=u*e.startPoint.x;d+=3*l*a*e.control1.x,d+=3*c*o*e.control2.x,d+=s*e.endPoint.x;let f=u*e.startPoint.y;f+=3*l*a*e.control1.y,f+=3*c*o*e.control2.y,f+=s*e.endPoint.y;let p=Math.min(e.startWidth+s*r,t.maxWidth);this._drawCurveSegment(d,f,p)}n.closePath(),n.fill()}_drawDot(e,t){let n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(let r of e){let{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){let r=e[n],a=new np(r.x,r.y,r.pressure,r.time);n===0&&this._reset(i);let o=this._addPoint(a,i);o&&t(o,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1}={}){let t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=0,i=0,a=this.canvas.width/n,o=this.canvas.height/n,s=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(s.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),s.setAttribute(`xmlns:xlink`,`http://www.w3.org/1999/xlink`),s.setAttribute(`viewBox`,`${r} ${i} ${a} ${o}`),s.setAttribute(`width`,a.toString()),s.setAttribute(`height`,o.toString()),e&&this.backgroundColor){let e=document.createElement(`rect`);e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),e.setAttribute(`fill`,this.backgroundColor),s.appendChild(e)}return this._fromData(t,(e,{penColor:t})=>{let n=document.createElement(`path`);if(!isNaN(e.control1.x)&&!isNaN(e.control1.y)&&!isNaN(e.control2.x)&&!isNaN(e.control2.y)){let r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute(`d`,r),n.setAttribute(`stroke-width`,(e.endWidth*2.25).toFixed(3)),n.setAttribute(`stroke`,t),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-linecap`,`round`),s.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{let a=document.createElement(`circle`),o=n>0?n:(r+i)/2;a.setAttribute(`r`,o.toString()),a.setAttribute(`cx`,e.x.toString()),a.setAttribute(`cy`,e.y.toString()),a.setAttribute(`fill`,t),s.appendChild(a)}),s.outerHTML}};const sp=[`disabled`],cp=[`required`];var lp=h({__name:`SignaturePad`,props:w({sigOption:{},width:{},height:{},ratio:{},clearOnResize:{type:Boolean},waterMark:{},disabled:{type:Boolean},defaultUrl:{},format:{},clearable:{type:Boolean,default:!0},required:{type:Boolean}},{modelValue:{},modelModifiers:{},file:{},fileModifiers:{}}),emits:[`update:modelValue`,`update:file`],setup(e,{expose:t}){let n=e,r=se(e,`modelValue`),i=se(e,`file`),a=R(),s=R(),f=R(!0);function p(){var e;(e=s.value)?.clear(),f.value=!0,r.value=void 0}function m(e){var t,r;return e||=n.format,e?(t=s.value)?.toDataURL(e):(r=s.value)?.toDataURL()}function h(){let e=m();if(e)if(n.format===`image/svg+xml`)i.value=new File([e],`signature.svg`,{type:`image/svg+xml`});else try{let t=e.split(`,`)[1];if(!t)throw Error(`Invalid data URL format`);let r=atob(t),a=new Uint8Array(Array.from(r,e=>e.charCodeAt(0))),o=n.format||`image/png`,s=new Blob([a],{type:o}),c=o.split(`/`)[1];i.value=new File([s],`signature.${c}`,{type:o})}catch(e){console.error(`Error saving signature file:`,e)}}function g(e){var t,r,i;return(t=s.value)?.fromDataURL(e,{height:(r=a.value)?.height,width:(i=a.value)?.width,ratio:n.ratio,xOffset:0,yOffset:0})}let _=()=>{var e;return(e=s.value)?.isEmpty()};function v(){var e;let t=(e=s.value)?.toData();if(t){var n;t.pop(),(n=s.value)?.fromData(t)}}let y=R({penColor:`rgb(0, 0, 0)`,backgroundColor:`rgb(255, 255, 255)`}),b=o(()=>({...y.value,...n.sigOption}));q(()=>n.disabled,e=>{var t,n;e?(t=s.value)?.off():(n=s.value)?.on()});function x(e){if(Object.prototype.toString.call(e)!==`[object Object]`)throw Error(`Expected Object, got ${typeof e}.`);{var t;let n={text:e.text||``,x:e.x||20,y:e.y||20,sx:e.sx||40,sy:e.sy||40},r=(t=a.value)?.getContext(`2d`);if(!r)return;r.font=e.font||`20px sans-serif`,r.fillStyle=e.fillStyle||`#333`,r.strokeStyle=e.strokeStyle||`#333`,e.style===`all`?(r.fillText(n.text,n.x,n.y),r.strokeText(n.text,n.sx,n.sy)):e.style===`stroke`?r.strokeText(n.text,n.sx,n.sy):r.fillText(n.text,n.x,n.y)}}function S(){var e;f.value=(e=s.value)?.isEmpty()??!1;let t=m();r.value=t,h()}function C(e){if(!e)return;let t=new FileReader;return new Promise(n=>{t.onload=e=>{var t;let i=String((t=e.target)?.result);g(i),f.value=!1,r.value=i,n(!0)},t.readAsDataURL(e)})}q(i,e=>{C(e)});function w(){let e;_()||(e=m());let t=n.ratio??1/2,{width:r}=a.value.getBoundingClientRect();a.value.width=n.width?Number(n.width.replaceAll(`px`,``)):r,a.value.height=n.height?Number(n.height.replaceAll(`px`,``)):r*t,p(),!n.clearOnResize&&e!==void 0&&g(e),n.waterMark&&x(n.waterMark)}function T(){s.value=new op(a.value,b.value),w(),n.disabled?s.value.off():s.value.on(),f.value=s.value.isEmpty(),i.value&&C(i.value)}return j(T),Fn(()=>a.value,w),kn(()=>s.value,`endStroke`,S),t({save:m,clear:p,isEmpty:_,undo:v,addWaterMark:x,fromDataURL:g}),(e,t)=>(P(),u(`div`,{class:D([`bgl_input signature-pad relative`,{"bg-transparent":e.disabled}]),onTouchmove:t[0]||=he(()=>{},[`prevent`])},[e.clearable&&!e.disabled?(P(),c(G(X),{key:0,flat:``,thin:``,icon:`refresh`,class:`position-bottom-end`,onClick:p})):l(``,!0),d(`canvas`,{ref_key:`vCanvas`,ref:a,class:`canvas`,disabled:e.disabled},null,8,sp),d(`input`,{placeholder:`required`,type:`text`,required:e.required&&G(f),class:`pixel opacity-0`,inputMode:`none`},null,8,cp)],34))}}),up=lp;
|
|
138
138
|
/**!
|
|
139
139
|
* Sortable 1.14.0
|
|
140
140
|
* @author RubaXa <trash@rubaxa.org>
|