@creaditor/newsletter-starterkit 1.0.16 → 1.0.17

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.
Binary file
@@ -0,0 +1,29 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5674],{55674:(t,e,i)=>{i.r(e),i.d(e,{default:()=>r});var o=i(56666),s=i(21293);class n extends s.oi{constructor(){super(),this.onInput=this.onInput.bind(this),this.isLocked=!0,this.top=0,this.left=0,this.bottom=0,this.right=0}connectedCallback(){super.connectedCallback()}onInput(t,e){t.preventDefault();const i=t.target.value,o=i;this.isLocked?(this.top=i,this.left=i,this.bottom=i,this.right=i,this.json={top:o,left:o,bottom:o,right:o}):(this.top=parseInt(this.top||0)||0,this.left=parseInt(this.left||0)||0,this.bottom=parseInt(this.bottom||0)||0,this.right=parseInt(this.right||0)||0,this.json={top:parseInt(this.top||0)||0,left:parseInt(this.left||0)||0,bottom:parseInt(this.bottom||0)||0,right:parseInt(this.right||0)||0},this.json[e]=o),this.value=i,this.directionKey=e;const s=new UIEvent("input",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(s)}resolveIcon(t){let e;switch(t){case"top":e="arrowUp";break;case"left":e="arrowLeft";break;case"bottom":e="arrowDown";break;case"right":e="arrowRight"}return s.dy`<cdtr-icon
2
+ width="15"
3
+ height="15"
4
+ icon="${e}"
5
+ ></cdtr-icon>`}onChangeLock(){this.isLocked=!this.isLocked}render(){this.isLocked=this.top===this.left&&this.bottom===this.right&&this.top===this.bottom;this.onChange;const t=this.onInput;return s.dy`<cdtr-row
6
+ alignItems="center"
7
+ spacing="3px"
8
+ style="position:relative;"
9
+ >
10
+ ${["top","left","bottom","right"].map((e=>s.dy`<cdtr-col>
11
+ ${this.resolveIcon(e)}
12
+ <cdtr-number-input
13
+ .type=${"number"}
14
+ .max=${300}
15
+ .min=${0}
16
+ value="${parseFloat(this[e])}"
17
+ @input=${i=>t(i,e)}
18
+ style="width:100%"
19
+ ></cdtr-number-input
20
+ ></cdtr-col>`))}
21
+ <cdtr-button @click=${this.onChangeLock}>
22
+ <cdtr-icon
23
+ style="height:10px"
24
+ width="20"
25
+ height="20"
26
+ .icon="${this.isLocked?"lock":"unlock"}"
27
+ ></cdtr-icon>
28
+ </cdtr-button>
29
+ </cdtr-row>`}}(0,o.Z)(n,"properties",{value:{type:Number},json:{type:Object},onChange:{type:Function},top:{type:Number},left:{type:Number},bottom:{type:Number},right:{type:Number},isLocked:{type:Boolean},directionKey:{type:String}});const r=n}}]);
Binary file
@@ -1,39 +1,38 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6737],{36737:(t,e,r)=>{r.r(e),r.d(e,{BorderEditor:()=>s});var o=r(56666),d=r(21293),i=r(70235);r(45607);class s extends d.oi{constructor(t){super(),this.theme=i.h.get("theme"),this.borderStyle="solid",this.borderTypes=[{name:"none",value:"none"},{name:"solid",value:"solid"},{name:"dashed",value:"dashed"},{name:"dotted",value:"dotted"},{name:"outset",value:"outset"},{name:"groove",value:"groove"},{name:"double",value:"double"},{name:"ridge",value:"ridge"}],this.cmds={onChangeSize:t=>{const e=t.target.value;this.borderWidth=e+"px",this.key="borderWidth",this.dispacher()},onChangeborderStyle:t=>{this.borderStyle=t,this.key="borderStyle",this.dispacher()},onChangeColor(t){const e=t.target.value;this.color=e,this.borderColor=e,this.key="color",this.dispacher()},onChangeRadius:t=>{const e=t.target.json;this.borderTopRightRadius=e.borderTopRightRadius,this.borderTopLeftRadius=e.borderTopLeftRadius,this.borderBottomRightRadius=e.borderBottomRightRadius,this.borderBottomLeftRadius=e.borderBottomLeftRadius,this.key="borderRadius",this.dispacher()}}}dispacher(){const t=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){const t=(this.borderRadius||"").toString().split(/\s+/);let[e=0,r=0,o=0,i=0]=t.map((t=>parseFloat(t)||0));return e=this.borderTopRightRadius||e,r=this.borderTopLeftRadius||r,o=this.borderBottomRightRadius||o,i=this.borderBottomLeftRadius||i,d.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6737],{36737:(t,e,r)=>{r.r(e),r.d(e,{BorderEditor:()=>s});var o=r(56666),d=r(21293),i=r(70235);class s extends d.oi{constructor(t){super(),this.theme=i.h.get("theme"),this.borderStyle="solid",this.borderTypes=[{name:"none",value:"none"},{name:"solid",value:"solid"},{name:"dashed",value:"dashed"},{name:"dotted",value:"dotted"},{name:"outset",value:"outset"},{name:"groove",value:"groove"},{name:"double",value:"double"},{name:"ridge",value:"ridge"}],this.cmds={onChangeBorderWidth:t=>{if(t.target.isLock)this.borderWidth=t.target.value+"px",this.borderTopWidth=t.target.value,this.borderBottomWidth=t.target.value,this.borderLeftWidth=t.target.value,this.borderRightWidth=t.target.value,this.key="borderWidth",this.dispacher();else{const e=t.target.topValue,r=t.target.bottomValue,o=t.target.leftValue,d=t.target.rightValue;this.borderWidth=e,this.borderTopWidth=e,this.borderBottomWidth=r,this.borderLeftWidth=o,this.borderRightWidth=d,this.key="borderWidth",this.dispacher()}},onChangeborderStyle:t=>{this.borderStyle=t,this.key="borderStyle",this.dispacher()},onChangeColor(t){const e=t.target.value;this.color=e,this.borderColor=e,this.key="color",this.dispacher()},onChangeRadius:t=>{const e=t.target.json;this.borderTopRightRadius=e.borderTopRightRadius,this.borderTopLeftRadius=e.borderTopLeftRadius,this.borderBottomRightRadius=e.borderBottomRightRadius,this.borderBottomLeftRadius=e.borderBottomLeftRadius,this.key="borderRadius",this.dispacher()}}}dispacher(){const t={borderColor:this.borderColor||this.color||"",borderStyle:this.borderStyle||"solid",borderWidth:this.borderWidth||0,borderTopWidth:this.borderTopWidth??0,borderBottomWidth:this.borderBottomWidth??0,borderLeftWidth:this.borderLeftWidth??0,borderRightWidth:this.borderRightWidth??0,borderRadius:this.borderRadius??0,borderTopRightRadius:this.borderTopRightRadius??0,borderTopLeftRadius:this.borderTopLeftRadius??0,borderBottomRightRadius:this.borderBottomRightRadius??0,borderBottomLeftRadius:this.borderBottomLeftRadius??0,key:this.key},e=new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:t});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){const t=(this.borderRadius||"").toString().split(/\s+/);let[e=0,r=0,o=0,i=0]=t.map((t=>parseFloat(t)||0));const s=this.borderTopWidth||0,h=this.borderBottomWidth||0,a=this.borderLeftWidth||0,l=this.borderRightWidth||0;return e=this.borderTopRightRadius||e,r=this.borderTopLeftRadius||r,o=this.borderBottomRightRadius||o,i=this.borderBottomLeftRadius||i,d.dy`
2
2
  <h5>
3
3
  <lang-text text="border_editor"></lang-text>
4
4
  </h5>
5
5
  <cdtr-editor-container>
6
- <cdtr-colorpicker-editor
6
+ <cdtr-colorpicker-editor .hasAlpha=${!1}
7
7
  @change=${this.cmds.onChangeColor}
8
8
  .value=${this.color||this.borderColor}
9
9
  text="color"
10
10
  ></cdtr-colorpicker-editor>
11
11
  </cdtr-editor-container>
12
12
 
13
- <cdtr-editor-container>
14
- <cdtr-row>
15
- <cdtr-title><lang-text text="size"></lang-text></cdtr-title>
16
- </cdtr-row>
17
- <cdtr-range-input
18
- .value="${parseInt(this.borderWidth)||0}"
19
- @input=${this.cmds.onChangeSize}
20
- unitColor=${this.theme.primary}
21
- unit="px"
22
- max="20"
23
- min="1"
24
- ></cdtr-range-input>
25
- </cdtr-editor-container>
26
13
  <cdtr-editor-container>
27
14
  <cdtr-row>
28
15
  <cdtr-title><lang-text text="radius"></lang-text></cdtr-title>
29
16
  </cdtr-row>
30
- <cdtr-radius-editor
17
+ <cdtr-radius-editor
31
18
  .borderTopRightRadius=${e}
32
19
  .borderTopLeftRadius=${r}
33
20
  .borderBottomRightRadius=${o}
34
21
  .borderBottomLeftRadius=${i}
35
22
  @input=${this.cmds.onChangeRadius}
36
23
  ></cdtr-radius-editor>
24
+ <cdtr-row>
25
+ <cdtr-title><lang-text text="size"></lang-text></cdtr-title>
26
+ </cdtr-row>
27
+
28
+ <cdtr-spacing style="display:flex;justify-content:center;"
29
+ topValue=${s}
30
+ bottomValue=${h}
31
+ leftValue=${a}
32
+ rightValue=${l}
33
+ @input=${this.cmds.onChangeBorderWidth}
34
+ >
35
+ </cdtr-spacing>
37
36
  </cdtr-editor-container>
38
37
  <cdtr-editor-container>
39
38
  <cdtr-row alignItems="center" jusitfyContent="space-between">
@@ -73,4 +72,4 @@
73
72
  :host {
74
73
  direction: var(--direction-locale);
75
74
  }
76
- `),(0,o.Z)(s,"properties",{type:{type:String},color:{type:String},borderColor:{type:String},borderStyle:{type:String},borderWidth:{type:Number},borderRadius:{type:Number},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number}}),customElements.define("cdtr-border-editor",s)}}]);
75
+ `),(0,o.Z)(s,"properties",{type:{type:String},color:{type:String},borderColor:{type:String},borderStyle:{type:String},borderWidth:{type:Number},borderRadius:{type:Number},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},borderTopWidth:{type:Number},borderBottomWidth:{type:Number},borderLeftWidth:{type:Number},borderRightWidth:{type:Number}}),customElements.define("cdtr-border-editor",s)}}]);
Binary file
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see 7988.creaditor.bundle.js.LICENSE.txt */
2
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7988,2340],{87988:(t,e,i)=>{i.r(e),i.d(e,{default:()=>d});const n=t=>{{const{component:e,commands:i,helpers:n}=t,s=e.tiptap,r=s.state.selection.$anchor.node().attrs,o=s.isActive("heading",{level:1})?"h1":s.isActive("heading",{level:2})?"h2":s.isActive("heading",{level:3})?"h3":s.isActive("heading",{level:4})?"h4":s.isActive("heading",{level:5})?"h5":s.isActive("heading",{level:6})?"h6":"paragraph";return{select:t=>{let{changeTab:e,tab:i}=t},tabs:t=>{const e=[{text:"design",selected:!0},{text:"settings"}];return e.forEach((e=>e.selected=e.selected=e.text===t)),e},layout:t=>{let{tab:n,changeTab:a,tabs:l}=t;const c=[{type:"info",text:"text_micro_copy",active:()=>"design"===n.text},{type:"dropdown",active:()=>"design"===n.text,title:"type",value:o,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:t=>{const e=t.target.value;switch(e){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":s.chain().setHeading({level:parseInt(e.slice(1))}).run();break;case"paragraph":s.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(s.getAttributes("textStyle").fontSize||"16px"),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setFontSize(i).run():n.chain().setFontSize(i).run()}},{type:"divider"},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(r.lineHeight||1),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setLineHeight(i).run():n.chain().setLineHeight(i).run()}},{type:"divider"},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(r.letterSpacing)||1,active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;i<=1?s.from===s.to?n.chain().selectAll().setLetterSpacing("normal").run():n.chain().setLetterSpacing("normal").run():s.from===s.to?n.chain().selectAll().setLetterSpacing(i+"px").run():n.chain().setLetterSpacing(i+"px").run()}},{type:"divider"},{type:"colorpicker",title:"font_color",alpha:!1,value:s.getAttributes("textStyle").color||"#0000",onChange:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;if(s.from===s.to){const{state:t,view:e}=n,r=t.tr,{from:o,to:a}=s.from===s.to?{from:0,to:t.doc.content.size}:{from:s.from,to:s.to};t.doc.nodesBetween(o,a,((e,n)=>{if(e.isText){t.doc.resolve(n);if(!e.marks.some((t=>"link"===t.type.name))){const s=n,o=n+e.nodeSize;r.addMark(s,o,t.schema.marks.textStyle.create({color:i}))}}})),e.dispatch(r)}else n.chain().setColor(i).run()}},{type:"divider"},{type:"colorpicker",title:"backgroundColor",value:e.props.style.background||e.props.style.backgroundColor||"#fff",onChange:t=>{const e=t.target.value;i.execCommand("style",{background:e,backgroundColor:null})}},{type:"divider"},{type:"slider",title:"maxWidth",value:parseFloat(e.props.style.width),min:20,max:1e3,onInput:t=>{const e=t.target.value;i.execCommand("style",{width:e+"px"})}},{type:"divider"}];return c}}}};var s=i(46245);const r=t=>{let{helpers:e,tiptap:i,composeId:n,template:r}=t;return{set:(t,o,a)=>{switch(o){case"style":return"object"==typeof a&&(t[o]=(0,s.Z)(t[o],a),e.mergeDiff(r,{style:t[o]})),!0;case"text":t[o]=a;const l=i.getJSON();return a&&"object"==typeof a&&JSON.stringify(l)!==JSON.stringify(a.childNodes)&&(a&&a.focusedElement&&a.focusedElement===n?(i.chain().focus().setContent(a.childNodes).run(),a.to&&a.from&&i.commands.setTextSelection({from:a.from,to:a.to})):i.chain().setContent(a.childNodes).run()),delete t?.text?.markdown,!0}}}};var o=i(57701),a=i.n(o),l=i(70235);i(32340);const c=[],d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="text";return{name:e,create:i=>{const{createElement:s,compose:o,helpers:d}=i,{mergeDiff:p}=d,h=document.createElement("div");p(h,{style:o.props.style});const u=l.h.get("config","editor","configure","editorProps","fonts");let g=l.h.get("config","target");"string"==typeof g&&(g=document.querySelector(g)),g||(g=document.body);const m=a()({element:h,container:g||document.body,editable:!0,offsetTop:40,onClickMagic:t=>{let{insertContent:e,getJSON:i,getHTML:n,getText:s,selectAll:r,insertContentHtml:o}=t;const a=l.h.get("injectEditor"),c=document.createElement("cdtr-text-prompt-editor");a(c),c.context=s(),c.addEventListener("text-generation-start",(t=>{r()})),c.addEventListener("text-generation-chunk",(t=>{e(t.detail.chunk)})),c.addEventListener("text-generation-complete",(t=>{r(),o(t.detail.text)})),c.addEventListener("text-generation-error",(t=>{console.error("Text generation error:",t.detail.error)}))},content:"string"==typeof o.props.text.markdown?o.props.text.markdown:o.props.text.childNodes,defaultDirection:"rtl",onFocus:()=>{c.length>0&&(c[c.length-1].hideEditor(),c.pop()),c.push(m)},onUpdate:t=>{let{editor:e,transaction:i}=t;if(0===i.steps.length)return;const n=i.curSelection.from,s=i.curSelection.to,r={childNodes:e.getJSON(),from:n,to:s,focusedElement:o.id};f.commands.execCommand("text",r)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:u||[],useCloud:!0},{type:"fontSize",sizes:t.fontSize||[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74]},{type:"horizonRule"},{type:"clearFormat"},{type:"bold"},{type:"strike"},{type:"italic"},{type:"underline"},{type:"table"},{type:"emoji"},{type:"unLink"},{type:"link"},{type:"numbered"},{type:"bullet"},{type:"backcolor"},{type:"fontColor"},{type:"direction"},{type:"justify"},{type:"right"},{type:"center"},{type:"left"},{type:"image"},{type:"mergeTags"},{type:"magic"}]}),f=s({name:e,id:o.id,template:h,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},handleBar:!0,validator:r({template:h,helpers:d,tiptap:m,composeId:o.id}),schema:o.schema,onSelect:t=>{h.classList.add(t)},onDeselect:t=>{h.classList.remove(t)},elementProps:o,remove:()=>{h.remove()},createEditor:n});return o.props.text.markdown&&m.chain().insertContent(" ").run(),f.addProp("tiptap",m),f}}}},32340:(t,e,i)=>{i.r(e),i.d(e,{TextPromptEditor:()=>ft});var n=i(56666),s=i(76828);const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;class c{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}}const d=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:p,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:f}=Object,y=globalThis,b=y.trustedTypes,v=b?b.emptyScript:"",x=y.reactiveElementPolyfillSupport,$=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},A=(t,e)=>!p(t,e),E={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:A};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:s}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const r=n?.call(this);s?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...g(t),...m(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),n=r.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=n;const r=s.fromAttribute(e,t.type);this[n]=r??this._$Ej?.get(n)??r,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const n=this.constructor,s=this[t];if(i??=n.getPropertyOptions(t),!((i.hasChanged??A)(s,e)||i.useDefault&&i.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:s},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==s||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,i,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[$("elementProperties")]=new Map,w[$("finalized")]=new Map,x?.({ReactiveElement:w}),(y.reactiveElementVersions??=[]).push("2.1.1");const S=globalThis,C=S.trustedTypes,T=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+P,H=`<${N}>`,O=document,U=()=>O.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,I=Array.isArray,L=t=>I(t)||"function"==typeof t?.[Symbol.iterator],R="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,B=/>/g,j=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,W=/"/g,J=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),q=Y(1),V=(Y(2),Y(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),G=new WeakMap,K=O.createTreeWalker(O,129);function Q(t,e){if(!I(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const X=(t,e)=>{const i=t.length-1,n=[];let s,r=2===e?"<svg>":3===e?"<math>":"",o=z;for(let e=0;e<i;e++){const i=t[e];let a,l,c=-1,d=0;for(;d<i.length&&(o.lastIndex=d,l=o.exec(i),null!==l);)d=o.lastIndex,o===z?"!--"===l[1]?o=D:void 0!==l[1]?o=B:void 0!==l[2]?(J.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=j):void 0!==l[3]&&(o=j):o===j?">"===l[0]?(o=s??z,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?j:'"'===l[3]?W:F):o===W||o===F?o=j:o===D||o===B?o=z:(o=j,s=void 0);const p=o===j&&t[e+1].startsWith("/>")?" ":"";r+=o===z?i+H:c>=0?(n.push(a),i.slice(0,c)+k+i.slice(c)+P+p):i+P+(-2===c?e:p)}return[Q(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class tt{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,r=0;const o=t.length-1,a=this.parts,[l,c]=X(t,e);if(this.el=tt.createElement(l,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=K.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(k)){const e=c[r++],i=n.getAttribute(t).split(P),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:o[2],strings:i,ctor:"."===o[1]?rt:"?"===o[1]?ot:"@"===o[1]?at:st}),n.removeAttribute(t)}else t.startsWith(P)&&(a.push({type:6,index:s}),n.removeAttribute(t));if(J.test(n.tagName)){const t=n.textContent.split(P),e=t.length-1;if(e>0){n.textContent=C?C.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],U()),K.nextNode(),a.push({type:2,index:++s});n.append(t[e],U())}}}else if(8===n.nodeType)if(n.data===N)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(P,t+1));)a.push({type:7,index:s}),t+=P.length-1}s++}}static createElement(t,e){const i=O.createElement("template");return i.innerHTML=t,i}}function et(t,e,i=t,n){if(e===V)return e;let s=void 0!==n?i._$Co?.[n]:i._$Cl;const r=M(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),void 0===r?s=void 0:(s=new r(t),s._$AT(t,i,n)),void 0!==n?(i._$Co??=[])[n]=s:i._$Cl=s),void 0!==s&&(e=et(t,s._$AS(t,e.values),s,n)),e}class it{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,n=(t?.creationScope??O).importNode(e,!0);K.currentNode=n;let s=K.nextNode(),r=0,o=0,a=i[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new nt(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new lt(s,this,t)),this._$AV.push(e),a=i[++o]}r!==a?.index&&(s=K.nextNode(),r++)}return K.currentNode=O,n}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):L(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Z&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=tt.createElement(Q(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new it(n,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){I(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new nt(this.O(U()),this.O(U()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,s){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Z}_$AI(t,e=this,i,n){const s=this.strings;let r=!1;if(void 0===s)t=et(this,t,e,0),r=!M(t)||t!==this._$AH&&t!==V,r&&(this._$AH=t);else{const n=t;let o,a;for(t=s[0],o=0;o<s.length-1;o++)a=et(this,n[i+o],e,o),a===V&&(a=this._$AH[o]),r||=!M(a)||a!==this._$AH[o],a===Z?t=Z:t!==Z&&(t+=(a??"")+s[o+1]),this._$AH[o]=a}r&&!n&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}class ot extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Z)}}class at extends st{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??Z)===V)return;const i=this._$AH,n=t===Z&&i!==Z||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==Z&&(i===Z||n);n&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const ct=S.litHtmlPolyfillSupport;ct?.(tt,nt),(S.litHtmlVersions??=[]).push("3.3.1");const dt=globalThis;class pt extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const n=i?.renderBefore??e;let s=n._$litPart$;if(void 0===s){const t=i?.renderBefore??null;n._$litPart$=s=new nt(e.insertBefore(U(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}pt._$litElement$=!0,pt.finalized=!0,dt.litElementHydrateSupport?.({LitElement:pt});const ht=dt.litElementPolyfillSupport;ht?.({LitElement:pt});(dt.litElementVersions??=[]).push("4.2.1");var ut,gt,mt;let ft=(ut=(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("cdtr-text-prompt-editor"),ut((mt=class extends pt{constructor(){super(),this.prompt=localStorage.getItem("textPromptEditor_prompt")||"",this.generatedText="",this.isLoading=!1,this.context="",this.businessType=localStorage.getItem("textPromptEditor_businessType")||"",this.businessName=localStorage.getItem("textPromptEditor_businessName")||"",this.includeContext="true"===localStorage.getItem("textPromptEditor_includeContext")||!1,this.url=localStorage.getItem("textPromptEditor_url")||"",this.detectCurrentElementType()}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.detectCurrentElementType()}),100)}detectCurrentElementType(){try{const t=window.getSelection();if(t&&t.rangeCount>0){const e=t.getRangeAt(0).commonAncestorContainer;let i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;i&&i!==document.body;){if(i.tagName&&/^h[1-6]$/i.test(i.tagName)){const t=i.parentElement,e=Array.from(t?.children||[]),n=e.some((t=>t!==i&&/^h[1-6]$/i.test(t.tagName))),s=e.some((t=>t!==i&&/^p$|^div$/i.test(t.tagName)));return!s||n&&!s?(this.contentType="title",void console.log("TextPromptEditor: Detected standalone heading from DOM")):(this.contentType="paragraph",void console.log("TextPromptEditor: Detected heading within paragraph structure"))}this.contentType="paragraph",i=i.parentElement}}this.contentType||(this.contentType="paragraph",console.log("TextPromptEditor: Defaulting to paragraph"))}catch(t){console.warn("Error detecting current element type:",t),this.contentType||(this.contentType="paragraph")}}handleIncludeContextChange(t){this.includeContext=!t.target.checked,localStorage.setItem("textPromptEditor_includeContext",this.includeContext)}handleContentTypeChange(t){this.contentType=t,this.dispatchEvent(new CustomEvent("content-type-changed",{detail:{contentType:this.contentType},bubbles:!0,composed:!0}))}handlePromptChange(t){this.prompt=t.target.value,localStorage.setItem("textPromptEditor_prompt",this.prompt);["כתוב כותרת","כתוב תמונה","כתבי כותרת","write heading"].some((t=>this.prompt.startsWith(t)))&&this.handleContentTypeChange("title")}handleBusinessTypeChange(t){this.businessType=t.target.value,localStorage.setItem("textPromptEditor_businessType",this.businessType)}handleBusinessNameChange(t){this.businessName=t.target.value,localStorage.setItem("textPromptEditor_businessName",this.businessName)}handleUrlChange(t){this.url=t.target.value,localStorage.setItem("textPromptEditor_url",this.url)}async handleGenerate(){this.isLoading=!0,this.generatedText="";try{if("title"===this.contentType){Array.from(document.querySelectorAll(".text-component")).map((t=>t.textContent)).join("\n")}this.context.length>1500&&(this.context=this.context.slice(0,1500));const t=s.W7.agent_url,e=await fetch(t+"prompt/text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:this.prompt,context:this.includeContext?this.context:"",businessType:this.businessType,businessName:this.businessName,contentType:this.contentType,url:this.url,options:{maxTokens:1e3,temperature:0,model:"gpt-3.5-turbo"}})});if(!e.ok)throw new Error("Failed to generate text");const i=e.body.getReader(),n=new TextDecoder;let r="";for(;;){const{done:t,value:e}=await i.read();if(t){this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0}));break}r+=n.decode(e,{stream:!0});const s=r.split("\n\n");for(let t=0;t<s.length-1;t++){const e=s[t];if(e.startsWith("data: "))try{const t=e.slice(6),i=JSON.parse(t);if("start"===i.metadata?.type){this.generatedText="",this.dispatchEvent(new CustomEvent("text-generation-start",{detail:{model:i.metadata.model},bubbles:!0,composed:!0}));continue}i.text&&(this.generatedText+=i.text,this.dispatchEvent(new CustomEvent("text-generation-chunk",{detail:{chunk:i.text,fullText:this.generatedText},bubbles:!0,composed:!0}))),"complete"===i.status&&(this.generatedText=this.generatedText.replace(/^"|"$/g,""),this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0})))}catch(t){console.error("Error parsing JSON:",t)}}r=s[s.length-1]}}catch(t){console.error("Error generating text:",t),this.dispatchEvent(new CustomEvent("text-generation-error",{detail:{error:t.message},bubbles:!0,composed:!0}))}finally{this.isLoading=!1}}render(){const t=this.contentType;return q`
2
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[7988,2340],{87988:(t,e,i)=>{i.r(e),i.d(e,{default:()=>d});const n=t=>{{const{component:e,commands:i,helpers:n}=t,s=e.tiptap,r=s.state.selection.$anchor.node().attrs,o=s.isActive("heading",{level:1})?"h1":s.isActive("heading",{level:2})?"h2":s.isActive("heading",{level:3})?"h3":s.isActive("heading",{level:4})?"h4":s.isActive("heading",{level:5})?"h5":s.isActive("heading",{level:6})?"h6":"paragraph";return{select:t=>{let{changeTab:e,tab:i}=t},tabs:t=>{const e=[{text:"design",selected:!0},{text:"settings"}];return e.forEach((e=>e.selected=e.selected=e.text===t)),e},layout:t=>{let{tab:n,changeTab:a,tabs:l}=t;const c=[{type:"info",text:"text_micro_copy",active:()=>"design"===n.text},{type:"dropdown",active:()=>"design"===n.text,title:"type",value:o,items:[{value:"H1"},{value:"H2"},{value:"H3"},{value:"H4"},{value:"H5"},{value:"H6"},{value:"paragraph"}],onChange:t=>{const e=t.target.value;switch(e){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":s.chain().setHeading({level:parseInt(e.slice(1))}).run();break;case"paragraph":s.chain().setParagraph().run()}}},{type:"slider",title:"fontSize",min:8,step:2,max:74,value:parseInt(s.getAttributes("textStyle").fontSize||"16px"),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setFontSize(i).run():n.chain().setFontSize(i).run()}},{type:"divider"},{type:"slider",title:"lineHeight",min:1,max:3,step:.1,value:parseFloat(r.lineHeight||1),active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;s.from===s.to?n.chain().selectAll().setLineHeight(i).run():n.chain().setLineHeight(i).run()}},{type:"divider"},{type:"slider",title:"letterSpacing",min:1,max:10,step:1,value:parseFloat(r.letterSpacing)||1,active:()=>"design"===n.text,onInput:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;i<=1?s.from===s.to?n.chain().selectAll().setLetterSpacing("normal").run():n.chain().setLetterSpacing("normal").run():s.from===s.to?n.chain().selectAll().setLetterSpacing(i+"px").run():n.chain().setLetterSpacing(i+"px").run()}},{type:"divider"},{type:"colorpicker",title:"font_color",alpha:!1,value:s.getAttributes("textStyle").color||"#0000",onChange:t=>{const i=t.target.value,n=e.tiptap,s=n.view.state.selection;if(s.from===s.to){const{state:t,view:e}=n,r=t.tr,{from:o,to:a}=s.from===s.to?{from:0,to:t.doc.content.size}:{from:s.from,to:s.to};t.doc.nodesBetween(o,a,((e,n)=>{if(e.isText){t.doc.resolve(n);if(!e.marks.some((t=>"link"===t.type.name))){const s=n,o=n+e.nodeSize;r.addMark(s,o,t.schema.marks.textStyle.create({color:i}))}}})),e.dispatch(r)}else n.chain().setColor(i).run()}},{type:"divider"},{type:"colorpicker",title:"backgroundColor",value:e.props.style.background||e.props.style.backgroundColor||"#fff",onChange:t=>{const e=t.target.value;i.execCommand("style",{background:e,backgroundColor:null})}},{type:"divider"},{type:"slider",title:"maxWidth",value:parseFloat(e.props.style.width),min:20,max:1e3,onInput:t=>{const e=t.target.value;i.execCommand("style",{width:e+"px"})}},{type:"divider"}];return c}}}};var s=i(46245);const r=t=>{let{helpers:e,tiptap:i,composeId:n,template:r}=t;return{set:(t,o,a)=>{switch(o){case"style":return"object"==typeof a&&(t[o]=(0,s.Z)(t[o],a),e.mergeDiff(r,{style:t[o]})),!0;case"text":t[o]=a;const l=i.getJSON();return a&&"object"==typeof a&&JSON.stringify(l)!==JSON.stringify(a.childNodes)&&(a&&a.focusedElement&&a.focusedElement===n?(i.chain().focus().setContent(a.childNodes).run(),a.to&&a.from&&i.commands.setTextSelection({from:a.from,to:a.to})):i.chain().setContent(a.childNodes).run()),delete t?.text?.markdown,!0}}}};var o=i(57701),a=i.n(o),l=i(70235);i(32340);const c=[],d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="text";return{name:e,create:i=>{const{createElement:s,compose:o,helpers:d}=i,{mergeDiff:p}=d,h=document.createElement("div");p(h,{style:o.props.style});const u=l.h.get("config","editor","configure","editorProps","fonts");let g=l.h.get("config","target");"string"==typeof g&&(g=document.querySelector(g)),g||(g=document.body);const m=a()({element:h,container:g||document.body,editable:!0,offsetTop:40,onClickMagic:t=>{let{insertContent:e,getJSON:i,getHTML:n,getText:s,selectAll:r,insertContentHtml:o}=t;const a=l.h.get("injectEditor"),c=document.createElement("cdtr-text-prompt-editor");a(c),c.context=s(),c.addEventListener("text-generation-start",(t=>{r()})),c.addEventListener("text-generation-chunk",(t=>{e(t.detail.chunk)})),c.addEventListener("text-generation-complete",(t=>{r(),o(t.detail.text)})),c.addEventListener("text-generation-error",(t=>{console.error("Text generation error:",t.detail.error)}))},content:"string"==typeof o.props.text.markdown?o.props.text.markdown:o.props.text.childNodes,defaultDirection:"rtl",onFocus:()=>{c.length>0&&(c[c.length-1].hideEditor(),c.pop()),c.push(m)},onUpdate:t=>{let{editor:e,transaction:i}=t;if(0===i.steps.length)return;const n=i.curSelection.from,s=i.curSelection.to,r={childNodes:e.getJSON(),from:n,to:s,focusedElement:o.id};f.commands.execCommand("text",r)},ignoresBlurByQuerySelectors:[".ignore-events"],builder:[{type:"fontFamily",fonts:u||[],useCloud:!0},{type:"fontSize",sizes:t.fontSize||[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74]},{type:"horizonRule"},{type:"clearFormat"},{type:"bold"},{type:"strike"},{type:"italic"},{type:"underline"},{type:"table"},{type:"emoji"},{type:"unLink"},{type:"link"},{type:"numbered"},{type:"bullet"},{type:"backcolor"},{type:"fontColor"},{type:"direction"},{type:"justify"},{type:"right"},{type:"center"},{type:"left"},{type:"image"},{type:"mergeTags"},{type:"magic"}]}),f=s({name:e,id:o.id,template:h,defaultProps:{text:{},style:{}},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>h,handleBar:!0,validator:r({template:h,helpers:d,tiptap:m,composeId:o.id}),schema:o.schema,onSelect:t=>{h.classList.add(t)},onDeselect:t=>{h.classList.remove(t)},elementProps:o,remove:()=>{h.remove()},createEditor:n});return o.props.text.markdown&&m.chain().insertContent(" ").run(),f.addProp("tiptap",m),f}}}},32340:(t,e,i)=>{i.r(e),i.d(e,{TextPromptEditor:()=>ft});var n=i(56666),s=i(76828);const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;class c{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}}const d=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:p,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:f}=Object,y=globalThis,b=y.trustedTypes,v=b?b.emptyScript:"",x=y.reactiveElementPolyfillSupport,$=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},A=(t,e)=>!p(t,e),E={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:A};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:s}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const r=n?.call(this);s?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...g(t),...m(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),n=r.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=n;const r=s.fromAttribute(e,t.type);this[n]=r??this._$Ej?.get(n)??r,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const n=this.constructor,s=this[t];if(i??=n.getPropertyOptions(t),!((i.hasChanged??A)(s,e)||i.useDefault&&i.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:s},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==s||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,i,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[$("elementProperties")]=new Map,w[$("finalized")]=new Map,x?.({ReactiveElement:w}),(y.reactiveElementVersions??=[]).push("2.1.1");const S=globalThis,C=S.trustedTypes,T=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+P,H=`<${N}>`,O=document,U=()=>O.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,I=Array.isArray,L=t=>I(t)||"function"==typeof t?.[Symbol.iterator],R="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,B=/>/g,j=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,W=/"/g,J=/^(?:script|style|textarea|title)$/i,Y=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),q=Y(1),V=(Y(2),Y(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),G=new WeakMap,K=O.createTreeWalker(O,129);function Q(t,e){if(!I(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const X=(t,e)=>{const i=t.length-1,n=[];let s,r=2===e?"<svg>":3===e?"<math>":"",o=z;for(let e=0;e<i;e++){const i=t[e];let a,l,c=-1,d=0;for(;d<i.length&&(o.lastIndex=d,l=o.exec(i),null!==l);)d=o.lastIndex,o===z?"!--"===l[1]?o=D:void 0!==l[1]?o=B:void 0!==l[2]?(J.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=j):void 0!==l[3]&&(o=j):o===j?">"===l[0]?(o=s??z,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?j:'"'===l[3]?W:F):o===W||o===F?o=j:o===D||o===B?o=z:(o=j,s=void 0);const p=o===j&&t[e+1].startsWith("/>")?" ":"";r+=o===z?i+H:c>=0?(n.push(a),i.slice(0,c)+k+i.slice(c)+P+p):i+P+(-2===c?e:p)}return[Q(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class tt{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,r=0;const o=t.length-1,a=this.parts,[l,c]=X(t,e);if(this.el=tt.createElement(l,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=K.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(k)){const e=c[r++],i=n.getAttribute(t).split(P),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:o[2],strings:i,ctor:"."===o[1]?rt:"?"===o[1]?ot:"@"===o[1]?at:st}),n.removeAttribute(t)}else t.startsWith(P)&&(a.push({type:6,index:s}),n.removeAttribute(t));if(J.test(n.tagName)){const t=n.textContent.split(P),e=t.length-1;if(e>0){n.textContent=C?C.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],U()),K.nextNode(),a.push({type:2,index:++s});n.append(t[e],U())}}}else if(8===n.nodeType)if(n.data===N)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=n.data.indexOf(P,t+1));)a.push({type:7,index:s}),t+=P.length-1}s++}}static createElement(t,e){const i=O.createElement("template");return i.innerHTML=t,i}}function et(t,e,i=t,n){if(e===V)return e;let s=void 0!==n?i._$Co?.[n]:i._$Cl;const r=M(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),void 0===r?s=void 0:(s=new r(t),s._$AT(t,i,n)),void 0!==n?(i._$Co??=[])[n]=s:i._$Cl=s),void 0!==s&&(e=et(t,s._$AS(t,e.values),s,n)),e}class it{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,n=(t?.creationScope??O).importNode(e,!0);K.currentNode=n;let s=K.nextNode(),r=0,o=0,a=i[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new nt(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new lt(s,this,t)),this._$AV.push(e),a=i[++o]}r!==a?.index&&(s=K.nextNode(),r++)}return K.currentNode=O,n}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=Z,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===Z||null==t||""===t?(this._$AH!==Z&&this._$AR(),this._$AH=Z):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):L(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Z&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=tt.createElement(Q(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new it(n,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){I(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new nt(this.O(U()),this.O(U()),this,this.options)):i=e[n],i._$AI(s),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,s){this.type=1,this._$AH=Z,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Z}_$AI(t,e=this,i,n){const s=this.strings;let r=!1;if(void 0===s)t=et(this,t,e,0),r=!M(t)||t!==this._$AH&&t!==V,r&&(this._$AH=t);else{const n=t;let o,a;for(t=s[0],o=0;o<s.length-1;o++)a=et(this,n[i+o],e,o),a===V&&(a=this._$AH[o]),r||=!M(a)||a!==this._$AH[o],a===Z?t=Z:t!==Z&&(t+=(a??"")+s[o+1]),this._$AH[o]=a}r&&!n&&this.j(t)}j(t){t===Z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Z?void 0:t}}class ot extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Z)}}class at extends st{constructor(t,e,i,n,s){super(t,e,i,n,s),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??Z)===V)return;const i=this._$AH,n=t===Z&&i!==Z||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==Z&&(i===Z||n);n&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const ct=S.litHtmlPolyfillSupport;ct?.(tt,nt),(S.litHtmlVersions??=[]).push("3.3.1");const dt=globalThis;class pt extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const n=i?.renderBefore??e;let s=n._$litPart$;if(void 0===s){const t=i?.renderBefore??null;n._$litPart$=s=new nt(e.insertBefore(U(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}pt._$litElement$=!0,pt.finalized=!0,dt.litElementHydrateSupport?.({LitElement:pt});const ht=dt.litElementPolyfillSupport;ht?.({LitElement:pt});(dt.litElementVersions??=[]).push("4.2.1");var ut,gt,mt;let ft=(ut=(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("cdtr-text-prompt-editor"),ut((mt=class extends pt{constructor(){super(),this.prompt=localStorage.getItem("textPromptEditor_prompt")||"",this.generatedText="",this.isLoading=!1,this.context="",this.businessType=localStorage.getItem("textPromptEditor_businessType")||"",this.businessName=localStorage.getItem("textPromptEditor_businessName")||"",this.includeContext="true"===localStorage.getItem("textPromptEditor_includeContext")||!1,this.url=localStorage.getItem("textPromptEditor_url")||"",this.detectCurrentElementType()}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.detectCurrentElementType()}),100)}detectCurrentElementType(){try{const t=window.getSelection();if(t&&t.rangeCount>0){const e=t.getRangeAt(0).commonAncestorContainer;let i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;i&&i!==document.body;){if(i.tagName&&/^h[1-6]$/i.test(i.tagName)){const t=i.parentElement,e=Array.from(t?.children||[]),n=e.some((t=>t!==i&&/^h[1-6]$/i.test(t.tagName))),s=e.some((t=>t!==i&&/^p$|^div$/i.test(t.tagName)));return!s||n&&!s?(this.contentType="title",void console.log("TextPromptEditor: Detected standalone heading from DOM")):(this.contentType="paragraph",void console.log("TextPromptEditor: Detected heading within paragraph structure"))}this.contentType="paragraph",i=i.parentElement}}this.contentType||(this.contentType="paragraph",console.log("TextPromptEditor: Defaulting to paragraph"))}catch(t){console.warn("Error detecting current element type:",t),this.contentType||(this.contentType="paragraph")}}handleIncludeContextChange(t){this.includeContext=!t.target.checked,localStorage.setItem("textPromptEditor_includeContext",this.includeContext)}handleContentTypeChange(t){this.contentType=t,this.dispatchEvent(new CustomEvent("content-type-changed",{detail:{contentType:this.contentType},bubbles:!0,composed:!0}))}handlePromptChange(t){this.prompt=t.target.value,localStorage.setItem("textPromptEditor_prompt",this.prompt);["כתוב כותרת","כתוב תמונה","כתבי כותרת","write heading"].some((t=>this.prompt.startsWith(t)))&&this.handleContentTypeChange("title")}handleBusinessTypeChange(t){this.businessType=t.target.value,localStorage.setItem("textPromptEditor_businessType",this.businessType)}handleBusinessNameChange(t){this.businessName=t.target.value,localStorage.setItem("textPromptEditor_businessName",this.businessName)}handleUrlChange(t){this.url=t.target.value,localStorage.setItem("textPromptEditor_url",this.url)}async handleGenerate(){this.isLoading=!0,this.generatedText="";try{if("title"===this.contentType){Array.from(document.querySelectorAll(".text-component")).map((t=>t.textContent)).join("\n")}this.context.length>1500&&(this.context=this.context.slice(0,1500));const t=s.W7.agent_url,e=await fetch(t+"prompt/text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:this.prompt,context:this.includeContext?this.context:"",businessType:this.businessType,businessName:this.businessName,contentType:this.contentType,url:this.url,options:{maxTokens:1e3,temperature:0,model:"gpt-3.5-turbo"}})});if(!e.ok)throw new Error("Failed to generate text");const i=e.body.getReader(),n=new TextDecoder;let r="";for(;;){const{done:t,value:e}=await i.read();if(t){this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0}));break}r+=n.decode(e,{stream:!0});const s=r.split("\n\n");for(let t=0;t<s.length-1;t++){const e=s[t];if(e.startsWith("data: "))try{const t=e.slice(6),i=JSON.parse(t);if("start"===i.metadata?.type){this.generatedText="",this.dispatchEvent(new CustomEvent("text-generation-start",{detail:{model:i.metadata.model},bubbles:!0,composed:!0}));continue}i.text&&(this.generatedText+=i.text,this.dispatchEvent(new CustomEvent("text-generation-chunk",{detail:{chunk:i.text,fullText:this.generatedText},bubbles:!0,composed:!0}))),"complete"===i.status&&(this.generatedText=this.generatedText.replace(/^"|"$/g,""),this.dispatchEvent(new CustomEvent("text-generation-complete",{detail:{text:this.generatedText},bubbles:!0,composed:!0})))}catch(t){console.error("Error parsing JSON:",t)}}r=s[s.length-1]}}catch(t){console.error("Error generating text:",t),this.dispatchEvent(new CustomEvent("text-generation-error",{detail:{error:t.message},bubbles:!0,composed:!0}))}finally{this.isLoading=!1}}render(){const t=this.contentType;return q`
3
3
  <cdtr-editor-container>
4
4
  <div class="editor-container">
5
5
  <div class="prompt-section">
Binary file
@@ -1,7 +1,7 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[9766],{29766:(t,e,o)=>{o.r(e),o.d(e,{BlockEditor:()=>p});var r=o(56666),i=o(21293),d=o(70235),a=(o(67237),o(45607)),n=o(58860),s=o(1670),c=o(98766);var l=o(50939),h=o(35210),g=o(11961);o(7592);o.e(4807).then(o.bind(o,54807));class p extends i.oi{constructor(t){super(),(0,r.Z)(this,"onChangeBakgroundExpanding",(t=>{const e=t.target.checked;a.Z.store().execCommand("expand_image_for_outlook",!e)})),(0,r.Z)(this,"getInnerBlocks",(()=>{const t=[],e=this.component.parent("section");return e&&e.children.forEach((e=>{const o=d.h.get("components",e);o&&"block"===o.type&&t.push(o)})),t})),this.onChangeWidth=this.onChangeWidth.bind(this),this.getInnerBlocks=this.getInnerBlocks.bind(this),this.isBackgroundImage=!1,this.backgroundVideo="",this.galleryOpened=!1,this.onChangeBakgroundExpanding=this.onChangeBakgroundExpanding.bind(this),this.tabs=[{text:"background"},{text:"design",selected:!0},{text:"settings"}],this.tabName="design",this.maxWidth=0,this.background="",this.padding={topValue:0,bottomValue:0,leftValue:0,rightValue:0},this.margin={topValue:0,bottomValue:0},this.borderStyle="solid",this.borderWidth=0,this.borderColor="#000",this.theme=d.h.get("theme"),this.connectWith=this.connectWith.bind(this),this.cmds={onchangeRadius:t=>{a.Z.store().execCommand("style",{...t.target.json})},toggleResponsive:t=>{this.noResponsive=!t.target.checked,a.Z.store().execCommand("noResponsive",this.noResponsive)},onChangeBorderStyle:t=>{this.borderStyle=t.target.borderStyle||"solid",this.borderWidth=t.target.borderWidth||1,this.borderColor=t.target.borderColor||"#000",this.borderRadius=t.target.borderRadius||0;t.target.json;a.Z.store().execCommand("style",{borderStyle:t.target.borderStyle,borderWidth:t.target.borderWidth,borderColor:t.target.borderColor,borderTopRightRadius:t.target.borderTopRightRadius+"px",borderTopLeftRadius:t.target.borderTopLeftRadius+"px",borderBottomRightRadius:t.target.borderBottomRightRadius+"px",borderBottomLeftRadius:t.target.borderBottomLeftRadius+"px",borderRadius:null})},onRemoveBackgroundVideo:()=>{this.backgroundVideo="",this.backgroundInstance={},a.Z.store().execCommand("background","transparent")},onChangeBackgroundVideo:t=>{const e=t.target.value;let o;if((0,s.Z)(e)){const t=g.x.find((t=>"images"===t.type));t.preset.properties.src=e,o=t.preset}else if((0,c.Z)(e));else if(function(t){if(t&&t.match(/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/))return!0;return!1}(e)){const t=g.x.find((t=>"video"===t.type));t.preset.properties.url=e,delete t.preset.properties.videoPath,o=t.preset}o&&(a.Z.store().execCommand("background",o),a.Z.store().execCommand("style",{background:null})),this.backgroundVideo=e},onChangeImage:t=>{const e=t.detail,o=[];Array.isArray(e)?e.forEach((t=>o.push(t.src))):o.push(e.src),this.cmds.onChangeBackgroundVideo({target:{value:o.join(",")}}),this.galleryOpened=!1},onChangeHeight:t=>{const e=t.target.value;a.Z.store().execCommand("style",{height:e+"%"}),this.height=e},onChangeMargin:t=>{const e=t.target.value,o=t.target.direction;"all"===o?(a.Z.store().execCommand("style",{marginTop:e+"px",marginBottom:e+"px"}),this.margin={topValue:e,bottomValue:e}):a.Z.store().execCommand("style",{[(0,l.Z)(`margin-${o.toLowerCase()}`)]:e+"px"})},onChangePadding:t=>{const e=t.target.value,o=t.target.direction,r=(0,l.Z)(`padding-${o.toLowerCase()}`);"all"===o?(a.Z.store().execCommand("style",{padding:null,"padding-top":null,"padding-bottom":null,"padding-left":null,"padding-right":null,paddingTop:e+"px",paddingBottom:e+"px",paddingLeft:e+"px",paddingRight:e+"px","padding-right":null,"padding-left":null,"padding-top":null,"padding-bottom":null}),this.padding={topValue:e,bottomValue:e,leftValue:e,rightValue:e}):(a.Z.store().execCommand("style",{[r]:e+"px",[`padding-${o.toLowerCase()}`]:null}),this.props.style={[r]:e+"px"},this[`padding${o.toLowerCase()}`]=e)},onChangebackground(t){const e=t.target.value;this.background=e;a.Z.components.forEach((t=>{const o=t.find("text");if(o&&!o.closest("card")){let t=o.tiptap.getAttributes("textStyle").color;if(!t){const e=o.element.querySelector("p,h1,h2,h3,h4,h5,h6");e&&(t=window.getComputedStyle(e).color)}if(t){if("transparent"===t)return;if(!t.includes("var(--")&&!e.includes("var(--")&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e&&"rgb(0, 0, 0)"!==e){const r=(0,h.R)(t,e);o.tiptap.chain().selectAll().setColor(r).run()}}}})),a.Z.store().execCommand("style",{background:e,backgroundColor:null});"web"!==d.h.get("config","channel")&&a.Z.store().execCommand("background",null)}}}onChangeImageBackgroundProp(t){const e=t.detail,{key:o,value:r}=e;if(this.props.background){const t=JSON.parse(JSON.stringify(this.props.background)),e=t.properties;if(!e.style[o])throw new Error(`${o} is not a valid property`);e.style[o]=r,a.Z.store().execCommand("background",t)}}connectedCallback(){super.connectedCallback(),this.connectWith(),a.Z.on("update",this.connectWith)}disconnectedCallback(){super.disconnectedCallback(),a.Z.off("update",this.connectWith)}onChangeWidth(t){let e=t.target.value;e<500&&(e=500),e>1e3&&(e=1e3);const o=this.getInnerBlocks();a.Z.store().execCommand2({transactions:[{key:"style",value:{width:e+"px",maxWidth:"100%"}}],update:[...o]}),this.maxWidth=e}connectWith(){const t=a.Z.components[a.Z.components.length-1];if(this.component=t,t&&"block"===t.type){this.props=t.props;let{style:e}=this.props;e||(e={}),t.props||(t.props={}),t.props.style||(t.props.style={}),this.expand_image_for_outlook=!!t.props.expand_image_for_outlook,this.boxShadow=t.props.style.boxShadow,this.borderStyle=t.props.style.borderStyle,this.borderWidth=t.props.style.borderWidth,this.borderTopRightRadius=t.props.style.borderTopRightRadius,this.borderTopLeftRadius=t.props.style.borderTopLeftRadius,this.borderBottomRightRadius=t.props.style.borderBottomRightRadius,this.borderBottomLeftRadius=t.props.style.borderBottomLeftRadius,this.borderColor=t.props.style.borderColor;const o=t.props.background;if(this.isBackgroundImage="images"===o?.type,this.noResponsive=!!t.props.noResponsive,this.isBackgroundImage){const t=o.properties;this.backgroundAttachment=t.style.backgroundAttachment,this.backgroundPosition=t.style.backgroundPosition,this.backgroundRepeat=t.style.backgroundRepeat,this.backgroundSize=t.style.backgroundSize}this.backgroundInstance=o,this.backgroundVideo=o?.properties?.src||o?.properties?.url||"";const r=t.element,i=window.getComputedStyle(r);this.maxWidth=parseInt(i.width),this.width=parseInt(e.width,10)||this.maxWidth,this.background=e.background||e.backgroundImage||i.backgroundColor,e.backgroundImage&&(this.background=`url(${e.backgroundImage})`),this.padding={topValue:parseInt(i.paddingTop),bottomValue:parseInt(i.paddingBottom),leftValue:parseInt(i.paddingLeft),rightValue:parseInt(i.paddingRight)},this.margin={topValue:parseInt(i.marginTop),bottomValue:parseInt(i.marginBottom)}}}changeTab(t){this.tabName=t.target.value}render(){const t=d.h.get("config","channel");return i.dy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[9766],{29766:(t,e,r)=>{r.r(e),r.d(e,{BlockEditor:()=>g});var o=r(56666),d=r(21293),i=r(70235),a=(r(67237),r(45607)),n=r(58860),s=r(1670),c=r(98766);var h=r(50939),l=r(35210),p=r(11961);r(7592);r.e(4807).then(r.bind(r,54807));class g extends d.oi{constructor(t){super(),(0,o.Z)(this,"onChangeBakgroundExpanding",(t=>{const e=t.target.checked;a.Z.store().execCommand("expand_image_for_outlook",!e)})),(0,o.Z)(this,"getInnerBlocks",(()=>{const t=[],e=this.component.parent("section");return e&&e.children.forEach((e=>{const r=i.h.get("components",e);r&&"block"===r.type&&t.push(r)})),t})),this.onChangeWidth=this.onChangeWidth.bind(this),this.getInnerBlocks=this.getInnerBlocks.bind(this),this.isBackgroundImage=!1,this.backgroundVideo="",this.galleryOpened=!1,this.onChangeBakgroundExpanding=this.onChangeBakgroundExpanding.bind(this),this.tabs=[{text:"background"},{text:"design",selected:!0},{text:"settings"}],this.tabName="design",this.maxWidth=0,this.background="",this.padding={topValue:0,bottomValue:0,leftValue:0,rightValue:0},this.margin={topValue:0,bottomValue:0},this.borderStyle="solid",this.borderWidth=0,this.borderColor="#000",this.theme=i.h.get("theme"),this.connectWith=this.connectWith.bind(this),this.cmds={onchangeRadius:t=>{a.Z.store().execCommand("style",{...t.target.json})},toggleResponsive:t=>{this.noResponsive=!t.target.checked,a.Z.store().execCommand("noResponsive",this.noResponsive)},onChangeBorderStyle:t=>{this.borderStyle=t.target.borderStyle||"solid",this.borderWidth=t.target.borderWidth||1,this.borderColor=t.target.borderColor||"#000",this.borderRadius=t.target.borderRadius||0;t.target.json;a.Z.store().execCommand("style",{borderStyle:t.target.borderStyle,borderColor:t.target.borderColor,borderTopWidth:t.target.borderTopWidth+"px",borderBottomWidth:t.target.borderBottomWidth+"px",borderLeftWidth:t.target.borderLeftWidth+"px",borderRightWidth:t.target.borderRightWidth+"px",borderTopRightRadius:parseInt(t.target.borderTopRightRadius)+"px",borderTopLeftRadius:parseInt(t.target.borderTopLeftRadius)+"px",borderBottomRightRadius:parseInt(t.target.borderBottomRightRadius)+"px",borderBottomLeftRadius:parseInt(t.target.borderBottomLeftRadius)+"px",borderRadius:null})},onRemoveBackgroundVideo:()=>{this.backgroundVideo="",this.backgroundInstance={},a.Z.store().execCommand("background","transparent")},onChangeBackgroundVideo:t=>{const e=t.target.value;let r;if((0,s.Z)(e)){const t=p.x.find((t=>"images"===t.type));t.preset.properties.src=e,r=t.preset}else if((0,c.Z)(e));else if(function(t){if(t&&t.match(/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/))return!0;return!1}(e)){const t=p.x.find((t=>"video"===t.type));t.preset.properties.url=e,delete t.preset.properties.videoPath,r=t.preset}r&&(a.Z.store().execCommand("background",r),a.Z.store().execCommand("style",{background:null})),this.backgroundVideo=e},onChangeImage:t=>{const e=t.detail,r=[];Array.isArray(e)?e.forEach((t=>r.push(t.src))):r.push(e.src),this.cmds.onChangeBackgroundVideo({target:{value:r.join(",")}}),this.galleryOpened=!1},onChangeHeight:t=>{const e=t.target.value;a.Z.store().execCommand("style",{height:e+"%"}),this.height=e},onChangeMargin:t=>{const e=t.target.value,r=t.target.direction;"all"===r?(a.Z.store().execCommand("style",{marginTop:e+"px",marginBottom:e+"px"}),this.margin={topValue:e,bottomValue:e}):a.Z.store().execCommand("style",{[(0,h.Z)(`margin-${r.toLowerCase()}`)]:e+"px"})},onChangePadding:t=>{const e=t.target.value,r=t.target.direction,o=(0,h.Z)(`padding-${r.toLowerCase()}`);"all"===r?(a.Z.store().execCommand("style",{padding:null,"padding-top":null,"padding-bottom":null,"padding-left":null,"padding-right":null,paddingTop:e+"px",paddingBottom:e+"px",paddingLeft:e+"px",paddingRight:e+"px","padding-right":null,"padding-left":null,"padding-top":null,"padding-bottom":null}),this.padding={topValue:e,bottomValue:e,leftValue:e,rightValue:e}):(a.Z.store().execCommand("style",{[o]:e+"px",[`padding-${r.toLowerCase()}`]:null}),this.props.style={[o]:e+"px"},this[`padding${r.toLowerCase()}`]=e)},onChangebackground(t){const e=t.target.value;this.background=e;a.Z.components.forEach((t=>{const r=t.find("text");if(r&&!r.closest("card")){let t=r.tiptap.getAttributes("textStyle").color;if(!t){const e=r.element.querySelector("p,h1,h2,h3,h4,h5,h6");e&&(t=window.getComputedStyle(e).color)}if(t){if("transparent"===t)return;if(!t.includes("var(--")&&!e.includes("var(--")&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e&&"rgb(0, 0, 0)"!==e){const o=(0,l.R)(t,e);r.tiptap.chain().selectAll().setColor(o).run()}}}})),a.Z.store().execCommand("style",{background:e,backgroundColor:null});"web"!==i.h.get("config","channel")&&a.Z.store().execCommand("background",null)}}}onChangeImageBackgroundProp(t){const e=t.detail,{key:r,value:o}=e;if(this.props.background){const t=JSON.parse(JSON.stringify(this.props.background)),e=t.properties;if(!e.style[r])throw new Error(`${r} is not a valid property`);e.style[r]=o,a.Z.store().execCommand("background",t)}}connectedCallback(){super.connectedCallback(),this.connectWith(),a.Z.on("update",this.connectWith)}disconnectedCallback(){super.disconnectedCallback(),a.Z.off("update",this.connectWith)}onChangeWidth(t){let e=t.target.value;e<500&&(e=500),e>1e3&&(e=1e3);const r=this.getInnerBlocks();a.Z.store().execCommand2({transactions:[{key:"style",value:{width:e+"px",maxWidth:"100%"}}],update:[...r]}),this.maxWidth=e}connectWith(){const t=a.Z.components[a.Z.components.length-1];if(this.component=t,t&&"block"===t.type){this.props=t.props;let{style:e}=this.props;e||(e={}),t.props||(t.props={}),t.props.style||(t.props.style={}),this.expand_image_for_outlook=!!t.props.expand_image_for_outlook,this.boxShadow=t.props.style.boxShadow,this.borderStyle=t.props.style.borderStyle,this.borderWidth=t.props.style.borderWidth,this.borderTopRightRadius=parseInt(t.props.style.borderTopRightRadius),this.borderTopLeftRadius=parseInt(t.props.style.borderTopLeftRadius),this.borderBottomRightRadius=parseInt(t.props.style.borderBottomRightRadius),this.borderBottomLeftRadius=parseInt(t.props.style.borderBottomLeftRadius),this.borderTopWidth=parseInt(t.props.style.borderTopWidth),this.borderBottomWidth=parseInt(t.props.style.borderBottomWidth),this.borderLeftWidth=parseInt(t.props.style.borderLeftWidth),this.borderRightWidth=parseInt(t.props.style.borderRightWidth),this.borderColor=t.props.style.borderColor;const r=t.props.background;if(this.isBackgroundImage="images"===r?.type,this.noResponsive=!!t.props.noResponsive,this.isBackgroundImage){const t=r.properties;this.backgroundAttachment=t.style.backgroundAttachment,this.backgroundPosition=t.style.backgroundPosition,this.backgroundRepeat=t.style.backgroundRepeat,this.backgroundSize=t.style.backgroundSize}this.backgroundInstance=r,this.backgroundVideo=r?.properties?.src||r?.properties?.url||"";const o=t.element,d=window.getComputedStyle(o);this.maxWidth=parseInt(d.width),this.width=parseInt(e.width,10)||this.maxWidth,this.background=e.background||e.backgroundImage||d.backgroundColor,e.backgroundImage&&(this.background=`url(${e.backgroundImage})`),this.padding={topValue:parseInt(d.paddingTop),bottomValue:parseInt(d.paddingBottom),leftValue:parseInt(d.paddingLeft),rightValue:parseInt(d.paddingRight)},this.margin={topValue:parseInt(d.marginTop),bottomValue:parseInt(d.marginBottom)}}}changeTab(t){this.tabName=t.target.value}render(){const t=i.h.get("config","channel");return d.dy`
2
2
  <cdtr-editor-tabs .tabs=${this.tabs} @tabChanged=${this.changeTab}>
3
3
  <div slot="content">
4
- ${"background"===this.tabName?i.dy` <cdtr-editor-container>
4
+ ${"background"===this.tabName?d.dy` <cdtr-editor-container>
5
5
  <cdtr-row justify="space-between">
6
6
  <cdtr-col sm="5"
7
7
  ><paper-button
@@ -23,7 +23,7 @@
23
23
  ></cdtr-col>
24
24
  </cdtr-row>
25
25
  </cdtr-editor-container>
26
- ${this.isBackgroundImage&&"web"===t?i.dy`<cdtr-editor-container>
26
+ ${this.isBackgroundImage&&"web"===t?d.dy`<cdtr-editor-container>
27
27
  <background-editor-plugin
28
28
  backgroundAttachment=${this.backgroundAttachment}
29
29
  backgroundPosition=${this.backgroundPosition}
@@ -47,7 +47,7 @@
47
47
  style="width:100%;direction:ltr;text-align:left;"
48
48
  placeholder="https://"
49
49
  ></cdtr-input>
50
- ${"object"==typeof this.backgroundInstance&&this.backgroundInstance?.component?i.dy`<paper-button
50
+ ${"object"==typeof this.backgroundInstance&&this.backgroundInstance?.component?d.dy`<paper-button
51
51
  style=" font-size: 13px;
52
52
  padding: 0;
53
53
  text-align: var(--text-align-locale);
@@ -87,7 +87,7 @@
87
87
  </h6>
88
88
  </cdtr-editor-container>
89
89
  <cdtr-divider></cdtr-divider>`:null}
90
- ${"design"===this.tabName?i.dy`
90
+ ${"design"===this.tabName?d.dy`
91
91
  <cdtr-editor-container>
92
92
  <cdtr-colorpicker-editor
93
93
  .hasAlpha=${!1}
@@ -104,7 +104,7 @@
104
104
  min="500"
105
105
  .value="${this.width}"
106
106
  @input=${this.onChangeWidth}
107
- .sizes=${[{name:d.h.get("lang","recommended")||"recommended",value:600,default:!0},{name:d.h.get("lang","large")||"large",value:1e3}]}
107
+ .sizes=${[{name:i.h.get("lang","recommended")||"recommended",value:600,default:!0},{name:i.h.get("lang","large")||"large",value:1e3}]}
108
108
  ></cdtr-width-editor>
109
109
  <p style="font-size:12px">
110
110
  <lang-text whiteSpace="" text="email_600"></lang-text>
@@ -160,6 +160,10 @@
160
160
  .borderStyle=${this.borderStyle}
161
161
  .borderWidth=${this.borderWidth}
162
162
  .borderColor=${this.borderColor}
163
+ .borderTopWidth=${this.borderTopWidth}
164
+ .borderBottomWidth=${this.borderBottomWidth}
165
+ .borderLeftWidth=${this.borderLeftWidth}
166
+ .borderRightWidth=${this.borderRightWidth}
163
167
  .borderTopRightRadius=${this.borderTopRightRadius}
164
168
  .borderTopLeftRadius=${this.borderTopLeftRadius}
165
169
  .borderBottomRightRadius=${this.borderBottomRightRadius}
@@ -169,8 +173,8 @@
169
173
  </cdtr-editor-container>
170
174
  `:null}
171
175
 
172
- <!-- ${"typography"===this.tabName?i.dy` <cdtr-text-editor-plugin></cdtr-text-editor-plugin> `:null} -->
173
- <!-- ${"spacing"===this.tabName?i.dy`
176
+ <!-- ${"typography"===this.tabName?d.dy` <cdtr-text-editor-plugin></cdtr-text-editor-plugin> `:null} -->
177
+ <!-- ${"spacing"===this.tabName?d.dy`
174
178
  <cdtr-editor-container>
175
179
  <cdtr-row justify="center">
176
180
  <cdtr-col sm="12"
@@ -218,7 +222,7 @@
218
222
  .opened=${this.galleryOpened}
219
223
  @file=${this.cmds.onChangeImage}
220
224
  ></cdtr-gallery>
221
- `}}(0,r.Z)(p,"styles",i.iv`
225
+ `}}(0,o.Z)(g,"styles",d.iv`
222
226
  paper-button.gallery {
223
227
  background: var(--primary);
224
228
  color: var(--primary-text);
@@ -227,23 +231,23 @@
227
231
  background: BLACK;
228
232
  color: #fff;
229
233
  }
230
- `),(0,r.Z)(p,"properties",{maxWidth:{type:Number},backgroundInstance:{type:Object},padding:{type:Object},margin:{type:Object},tabs:{type:Array},tabName:{type:String},galleryOpened:{type:Boolean},backgroundVideo:{type:String,reflect:!0},isBackgroundImage:{type:Boolean},backgroundAttachment:{type:String},backgroundPosition:{type:String},backgroundRepeat:{type:String},backgroundSize:{type:String},noResponsive:{type:Boolean},borderStyle:{type:String},borderWidth:{type:Number},borderColor:{type:String},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number}}),customElements.define("block-editor",p)},7592:(t,e,o)=>{o.d(e,{Z:()=>a});var r=o(56666),i=o(21293);class d extends i.oi{constructor(){super(),this.onInput=this.onInput.bind(this),this.isLocked=!0,this.borderTopRightRadius=0,this.borderTopLeftRadius=0,this.borderBottomRightRadius=0,this.borderBottomLeftRadius=0}connectedCallback(){super.connectedCallback()}onInput(t,e){t.preventDefault();const o=t.target.value,r=o;this.isLocked?(this.borderTopRightRadius=o,this.borderTopLeftRadius=o,this.borderBottomRightRadius=o,this.borderBottomLeftRadius=o,this.json={borderTopRightRadius:r,borderTopLeftRadius:r,borderBottomRightRadius:r,borderBottomLeftRadius:r,borderRadius:null}):(this.borderTopRightRadius=parseInt(this.borderTopRightRadius||0),this.borderTopLeftRadius=parseInt(this.borderTopLeftRadius||0),this.borderBottomRightRadius=parseInt(this.borderBottomRightRadius||0),this.borderBottomLeftRadius=parseInt(this.borderBottomLeftRadius||0),this.json={borderTopRightRadius:parseInt(this.borderTopRightRadius||0),borderTopLeftRadius:parseInt(this.borderTopLeftRadius||0),borderBottomRightRadius:parseInt(this.borderBottomRightRadius||0),borderBottomLeftRadius:parseInt(this.borderBottomLeftRadius||0),borderRadius:null},this.json[e]=r),this.value=o,this.radiusKey=e;const i=new UIEvent("input",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(i)}resolveIcon(t){let e;switch(t){case"borderTopRightRadius":e="arrowTopRight";break;case"borderTopLeftRadius":e="arrowTopLeft";break;case"borderBottomRightRadius":e="arrowBottomRight";break;case"borderBottomLeftRadius":e="arrowBottomLeft"}return i.dy`<cdtr-icon
234
+ `),(0,o.Z)(g,"properties",{maxWidth:{type:Number},backgroundInstance:{type:Object},padding:{type:Object},margin:{type:Object},tabs:{type:Array},tabName:{type:String},galleryOpened:{type:Boolean},backgroundVideo:{type:String,reflect:!0},isBackgroundImage:{type:Boolean},backgroundAttachment:{type:String},backgroundPosition:{type:String},backgroundRepeat:{type:String},backgroundSize:{type:String},noResponsive:{type:Boolean},borderStyle:{type:String},borderWidth:{type:Number},borderColor:{type:String},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},borderTopWidth:{type:Number},borderBottomWidth:{type:Number},borderLeftWidth:{type:Number},borderRightWidth:{type:Number}}),customElements.define("block-editor",g)},7592:(t,e,r)=>{r.d(e,{Z:()=>a});var o=r(56666),d=r(21293);class i extends d.oi{constructor(){super(),this.onInput=this.onInput.bind(this),this.isLocked=!0,this.borderTopRightRadius=0,this.borderTopLeftRadius=0,this.borderBottomRightRadius=0,this.borderBottomLeftRadius=0}connectedCallback(){super.connectedCallback()}onInput(t,e){t.preventDefault();const r=t.target.value,o=r;this.isLocked?(this.borderTopRightRadius=r,this.borderTopLeftRadius=r,this.borderBottomRightRadius=r,this.borderBottomLeftRadius=r,this.json={borderTopRightRadius:o,borderTopLeftRadius:o,borderBottomRightRadius:o,borderBottomLeftRadius:o,borderRadius:null}):(this.borderTopRightRadius=parseInt(this.borderTopRightRadius||0),this.borderTopLeftRadius=parseInt(this.borderTopLeftRadius||0),this.borderBottomRightRadius=parseInt(this.borderBottomRightRadius||0),this.borderBottomLeftRadius=parseInt(this.borderBottomLeftRadius||0),this.json={borderTopRightRadius:parseInt(this.borderTopRightRadius||0),borderTopLeftRadius:parseInt(this.borderTopLeftRadius||0),borderBottomRightRadius:parseInt(this.borderBottomRightRadius||0),borderBottomLeftRadius:parseInt(this.borderBottomLeftRadius||0),borderRadius:null},this.json[e]=o),this.value=r,this.radiusKey=e;const d=new UIEvent("input",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(d)}resolveIcon(t){let e;switch(t){case"borderTopRightRadius":e="arrowTopRight";break;case"borderTopLeftRadius":e="arrowTopLeft";break;case"borderBottomRightRadius":e="arrowBottomRight";break;case"borderBottomLeftRadius":e="arrowBottomLeft"}return d.dy`<cdtr-icon
231
235
  width="15"
232
236
  height="15"
233
237
  icon="${e}"
234
- ></cdtr-icon>`}onChangeLock(){this.isLocked=!this.isLocked}render(){this.elementId&&this.elementId!==this.lastElementId&&(this.lastElementId=this.elementId,this.isLocked=this.borderTopRightRadius===this.borderTopLeftRadius&&this.borderBottomRightRadius===this.borderBottomLeftRadius&&this.borderTopRightRadius===this.borderBottomLeftRadius);this.onChange;const t=this.onInput;return i.dy`<cdtr-row
238
+ ></cdtr-icon>`}onChangeLock(){this.isLocked=!this.isLocked}render(){this.elementId&&this.elementId!==this.lastElementId&&(this.lastElementId=this.elementId,this.isLocked=this.borderTopRightRadius===this.borderTopLeftRadius&&this.borderBottomRightRadius===this.borderBottomLeftRadius&&this.borderTopRightRadius===this.borderBottomLeftRadius);this.onChange;const t=this.onInput;return d.dy`<cdtr-row
235
239
  alignItems="center"
236
240
  spacing="3px"
237
241
  style="position:relative;"
238
242
  >
239
- ${["borderTopRightRadius","borderTopLeftRadius","borderBottomRightRadius","borderBottomLeftRadius"].map((e=>i.dy`<cdtr-col>
243
+ ${["borderTopRightRadius","borderTopLeftRadius","borderBottomRightRadius","borderBottomLeftRadius"].map((e=>d.dy`<cdtr-col>
240
244
  ${this.resolveIcon(e)}
241
245
  <cdtr-number-input
242
246
  .type=${"number"}
243
247
  .max=${300}
244
248
  .min=${0}
245
249
  value="${parseFloat(this[e])}"
246
- @input=${o=>t(o,e)}
250
+ @input=${r=>t(r,e)}
247
251
  style="width:100%"
248
252
  ></cdtr-number-input
249
253
  ></cdtr-col>`))}
@@ -255,7 +259,7 @@
255
259
  .icon="${this.isLocked?"lock":"unlock"}"
256
260
  ></cdtr-icon>
257
261
  </cdtr-button>
258
- </cdtr-row>`}}(0,r.Z)(d,"properties",{value:{type:Number},json:{type:Object},onChange:{type:Function},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},isLocked:{type:Boolean},elementId:{type:String},radiusKey:{type:String}}),customElements.define("cdtr-radius-editor",d);const a=t=>i.dy` <cdtr-editor-container>
262
+ </cdtr-row>`}}(0,o.Z)(i,"properties",{value:{type:Number},json:{type:Object},onChange:{type:Function},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},isLocked:{type:Boolean},elementId:{type:String},radiusKey:{type:String}}),customElements.define("cdtr-radius-editor",i);const a=t=>d.dy` <cdtr-editor-container>
259
263
  <cdtr-row>
260
264
  <cdtr-title><lang-text text="${t.title}"></lang-text></cdtr-title>
261
265
  </cdtr-row>
@@ -268,4 +272,4 @@
268
272
  .borderBottomRightRadius=${t.borderBottomRightRadius||t.value||0}
269
273
  .borderBottomLeftRadius=${t.borderBottomLeftRadius||t.value||0}
270
274
  ></cdtr-radius-editor>
271
- </cdtr-editor-container>`},98766:(t,e,o)=>{o.d(e,{Z:()=>i});const r=JSON.parse('["3g2","3gp","aaf","asf","avchd","avi","drc","flv","m2v","m3u8","m4p","m4v","mkv","mng","mov","mp2","mp4","mpe","mpeg","mpg","mpv","mxf","nsv","ogg","ogv","qt","rm","rmvb","roq","svi","vob","webm","wmv","yuv"]');function i(t){const e=/(?:\.([^.]+))?$/.exec(t.toLowerCase())[1];return-1!==r.findIndex((t=>t===e))}}}]);
275
+ </cdtr-editor-container>`},98766:(t,e,r)=>{r.d(e,{Z:()=>d});const o=JSON.parse('["3g2","3gp","aaf","asf","avchd","avi","drc","flv","m2v","m3u8","m4p","m4v","mkv","mng","mov","mp2","mp4","mpe","mpeg","mpg","mpv","mxf","nsv","ogg","ogv","qt","rm","rmvb","roq","svi","vob","webm","wmv","yuv"]');function d(t){const e=/(?:\.([^.]+))?$/.exec(t.toLowerCase())[1];return-1!==o.findIndex((t=>t===e))}}}]);
Binary file