@creaditor/web-starterkit 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/3847.creaditor.bundle.js +173 -116
  2. package/dist/3847.creaditor.bundle.js.gz +0 -0
  3. package/dist/5156.creaditor.bundle.js +1 -1
  4. package/dist/5156.creaditor.bundle.js.gz +0 -0
  5. package/dist/5909.creaditor.bundle.js +19 -19
  6. package/dist/5909.creaditor.bundle.js.gz +0 -0
  7. package/dist/7209.creaditor.bundle.js +32 -30
  8. package/dist/7209.creaditor.bundle.js.gz +0 -0
  9. package/dist/767.creaditor.bundle.js +26 -70
  10. package/dist/767.creaditor.bundle.js.gz +0 -0
  11. package/dist/8547.creaditor.bundle.js +1 -1
  12. package/dist/8547.creaditor.bundle.js.gz +0 -0
  13. package/dist/8646.creaditor.bundle.js +36 -37
  14. package/dist/8646.creaditor.bundle.js.gz +0 -0
  15. package/dist/creaditor.bundle.js +554 -224
  16. package/dist/creaditor.bundle.js.gz +0 -0
  17. package/dist/service-worker.js +1 -1
  18. package/dist/service-worker.js.gz +0 -0
  19. package/package.json +2 -2
  20. package/dist/1260.creaditor.bundle.js +0 -459
  21. package/dist/1260.creaditor.bundle.js.gz +0 -0
  22. package/dist/1393.creaditor.bundle.js +0 -1
  23. package/dist/1393.creaditor.bundle.js.gz +0 -0
  24. package/dist/1452.creaditor.bundle.js +0 -23
  25. package/dist/1452.creaditor.bundle.js.gz +0 -0
  26. package/dist/1565.creaditor.bundle.js +0 -1216
  27. package/dist/1565.creaditor.bundle.js.gz +0 -0
  28. package/dist/1756.creaditor.bundle.js +0 -1
  29. package/dist/1756.creaditor.bundle.js.gz +0 -0
  30. package/dist/1936.creaditor.bundle.js +0 -177
  31. package/dist/1936.creaditor.bundle.js.LICENSE.txt +0 -29
  32. package/dist/1936.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  33. package/dist/1936.creaditor.bundle.js.gz +0 -0
  34. package/dist/2438.creaditor.bundle.js +0 -67
  35. package/dist/2438.creaditor.bundle.js.gz +0 -0
  36. package/dist/2834.creaditor.bundle.js +0 -14
  37. package/dist/2834.creaditor.bundle.js.LICENSE.txt +0 -5
  38. package/dist/2834.creaditor.bundle.js.gz +0 -0
  39. package/dist/307.creaditor.bundle.js +0 -23
  40. package/dist/307.creaditor.bundle.js.gz +0 -0
  41. package/dist/3095.creaditor.bundle.js +0 -194
  42. package/dist/3095.creaditor.bundle.js.gz +0 -0
  43. package/dist/365.creaditor.bundle.js +0 -26
  44. package/dist/365.creaditor.bundle.js.gz +0 -0
  45. package/dist/3778.creaditor.bundle.js +0 -1
  46. package/dist/3778.creaditor.bundle.js.gz +0 -0
  47. package/dist/3932.creaditor.bundle.js +0 -30
  48. package/dist/3932.creaditor.bundle.js.gz +0 -0
  49. package/dist/4217.creaditor.bundle.js +0 -105
  50. package/dist/4217.creaditor.bundle.js.gz +0 -0
  51. package/dist/453.creaditor.bundle.js.LICENSE.txt +0 -5
  52. package/dist/4569.creaditor.bundle.js +0 -887
  53. package/dist/4569.creaditor.bundle.js.gz +0 -0
  54. package/dist/4739.creaditor.bundle.js +0 -1
  55. package/dist/4739.creaditor.bundle.js.gz +0 -0
  56. package/dist/4970.creaditor.bundle.js +0 -1316
  57. package/dist/4970.creaditor.bundle.js.gz +0 -0
  58. package/dist/5340.creaditor.bundle.js +0 -157
  59. package/dist/5340.creaditor.bundle.js.gz +0 -0
  60. package/dist/5428.creaditor.bundle.js +0 -23
  61. package/dist/5428.creaditor.bundle.js.gz +0 -0
  62. package/dist/5813.creaditor.bundle.js +0 -613
  63. package/dist/5813.creaditor.bundle.js.LICENSE.txt +0 -10
  64. package/dist/5813.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  65. package/dist/5813.creaditor.bundle.js.gz +0 -0
  66. package/dist/6151.creaditor.bundle.js +0 -1
  67. package/dist/6151.creaditor.bundle.js.gz +0 -0
  68. package/dist/6459.creaditor.bundle.js +0 -23
  69. package/dist/6459.creaditor.bundle.js.gz +0 -0
  70. package/dist/6713.creaditor.bundle.js +0 -151
  71. package/dist/6713.creaditor.bundle.js.gz +0 -0
  72. package/dist/763.creaditor.bundle.js +0 -1
  73. package/dist/763.creaditor.bundle.js.gz +0 -0
  74. package/dist/7759.creaditor.bundle.js +0 -25
  75. package/dist/7759.creaditor.bundle.js.gz +0 -0
  76. package/dist/8141.creaditor.bundle.js.LICENSE.txt +0 -5
  77. package/dist/8303.creaditor.bundle.js +0 -57
  78. package/dist/8303.creaditor.bundle.js.LICENSE.txt +0 -10
  79. package/dist/8303.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  80. package/dist/8303.creaditor.bundle.js.gz +0 -0
  81. package/dist/8305.creaditor.bundle.js +0 -32
  82. package/dist/8305.creaditor.bundle.js.gz +0 -0
  83. package/dist/8386.creaditor.bundle.js +0 -1420
  84. package/dist/8386.creaditor.bundle.js.gz +0 -0
  85. package/dist/84702e107adede1a967468c78921d455.mp4 +0 -0
  86. package/dist/8478.creaditor.bundle.js +0 -1
  87. package/dist/8478.creaditor.bundle.js.gz +0 -0
  88. package/dist/8676.creaditor.bundle.js +0 -24
  89. package/dist/8676.creaditor.bundle.js.gz +0 -0
  90. package/dist/88.creaditor.bundle.js +0 -1
  91. package/dist/88.creaditor.bundle.js.gz +0 -0
  92. package/dist/8876.creaditor.bundle.js +0 -25
  93. package/dist/8876.creaditor.bundle.js.LICENSE.txt +0 -32
  94. package/dist/8876.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  95. package/dist/8876.creaditor.bundle.js.gz +0 -0
  96. package/dist/9089.creaditor.bundle.js +0 -21
  97. package/dist/9089.creaditor.bundle.js.gz +0 -0
  98. package/dist/9162.creaditor.bundle.js +0 -24
  99. package/dist/9162.creaditor.bundle.js.gz +0 -0
  100. package/dist/9184.creaditor.bundle.js +0 -23
  101. package/dist/9184.creaditor.bundle.js.gz +0 -0
  102. package/dist/9193.creaditor.bundle.js +0 -1
  103. package/dist/9193.creaditor.bundle.js.gz +0 -0
  104. package/dist/9338.creaditor.bundle.js +0 -1
  105. package/dist/9338.creaditor.bundle.js.gz +0 -0
  106. package/dist/951.creaditor.bundle.js +0 -1
  107. package/dist/951.creaditor.bundle.js.gz +0 -0
@@ -1,10 +1,10 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>g,PUBLISH_ERROR_EVENT:()=>f,PUBLISH_EVENT:()=>u});var s=i(59929),o=i(86319),r=i(93432),n=i(90090),a=i(86959),l=i(15604);const c=`${(0,a.Ay)()?"http://127.0.0.1:8000":"https://studio.creaditor.ai"}/api/seo-generate`;const d=s.qy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>g,PUBLISH_ERROR_EVENT:()=>f,PUBLISH_EVENT:()=>u});var o=i(59929),s=i(86319),r=i(93432),n=i(90090),a=i(86959),l=i(15604);const c=`${(0,a.Ay)()?"http://127.0.0.1:8000":"https://studio.creaditor.ai"}/api/seo-generate`;const d=o.qy`
2
2
  <svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16" aria-hidden="true">
3
3
  <path
4
4
  d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z"
5
5
  />
6
6
  </svg>
7
- `;class h extends s.WF{constructor(){super(),this.resolver=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.onCancel=()=>{this.loading||(this.settle(null),this.dismiss())},this.onKeywordKeydown=e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),this.commitDraftKeyword()):"Backspace"===e.key&&""===this.keywordDraft&&this.keywordList.length&&(this.keywordList=this.keywordList.slice(0,-1))},this.generateField=async e=>{if(this.loading||this.generatingField)return;const t=function(){const e=document.getElementById("main-page-wrapper");return(e?.innerText||"").trim()}();if(t){this.generatingField=e;try{const i="rtl"===this.direction?"he":"en",s=await this.requestSeo(e,t,i);if("keywords"===e){const e=(Array.isArray(s)?s:String(s).split(",")).map(e=>e.trim()).filter(Boolean),t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t}else"title"===e?this.title=String(s).slice(0,100):this.description=String(s).slice(0,255)}catch(e){console.error("[seo-generate] failed:",e),this.snackbar(this.t("seo_generate_failed","Couldn't generate. Please try again."))}finally{this.generatingField=""}}else this.snackbar(this.t("seo_generate_empty","Add some content to the page first."))},this.onPublish=()=>{this.loading||(this.commitDraftKeyword(),this.loading=!0,this.settle({seo:{title:this.title.trim(),description:this.description.trim(),keywords:[...this.keywordList]},busy:e=>{this.isConnected&&(this.loading=e)},done:this.dismiss}))},this.loading=!1,this.title="",this.description="",this.keywordList=[],this.keywordDraft="",this.keywordsFocused=!1,this.generatingField=""}static open(){const e=document.createElement("cdtr-publish-seo"),t=o.M.get("app","seo")||{};return e.title=t.title||"",e.description=t.description||"",e.keywordList=(Array.isArray(t.keywords)?t.keywords:String(t.keywords||"").split(",")).map(e=>String(e).trim()).filter(Boolean),document.body.appendChild(e),e.waitForChoice()}waitForChoice(){return new Promise(e=>{this.resolver=e})}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}settle(e){this.resolver&&(this.resolver(e),this.resolver=null)}commitDraftKeyword(){const e=this.keywordDraft.split(",").map(e=>e.trim()).filter(Boolean);if(!e.length)return;const t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t,this.keywordDraft=""}removeKeyword(e){this.keywordList=this.keywordList.filter((t,i)=>i!==e)}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}async requestSeo(e,t,i){const s=async s=>{const o=await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=l.Ay;if("function"==typeof t.studioTokenProvider)try{const i=await t.studioTokenProvider({forceRefresh:e});if("string"==typeof i&&i.length>0)return i}catch{}return"string"==typeof t.studioToken&&t.studioToken.length>0?t.studioToken:null}(s),r={"Content-Type":"application/json",Accept:"application/json"};return o&&(r.Authorization=`Bearer ${o}`),fetch(c,{method:"POST",headers:r,body:JSON.stringify({content:t,field:e,language:i})})};let o=await s(!1);if(401===o.status&&(o=await s(!0)),!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();if(!r.ok||void 0===r.value)throw new Error("bad response");return r.value}magicButton(e){const t=this.generatingField===e;return s.qy`
7
+ `;class h extends o.WF{constructor(){super(),this.resolver=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.onCancel=()=>{this.loading||(this.settle(null),this.dismiss())},this.onKeywordKeydown=e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),this.commitDraftKeyword()):"Backspace"===e.key&&""===this.keywordDraft&&this.keywordList.length&&(this.keywordList=this.keywordList.slice(0,-1))},this.generateField=async e=>{if(this.loading||this.generatingField)return;const t=function(){const e=document.getElementById("main-page-wrapper");return(e?.innerText||"").trim()}();if(t){this.generatingField=e;try{const i="rtl"===this.direction?"he":"en",o=await this.requestSeo(e,t,i);if("keywords"===e){const e=(Array.isArray(o)?o:String(o).split(",")).map(e=>e.trim()).filter(Boolean),t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t}else"title"===e?this.title=String(o).slice(0,100):this.description=String(o).slice(0,255)}catch(e){console.error("[seo-generate] failed:",e),this.snackbar(this.t("seo_generate_failed","Couldn't generate. Please try again."))}finally{this.generatingField=""}}else this.snackbar(this.t("seo_generate_empty","Add some content to the page first."))},this.onPublish=()=>{this.loading||(this.commitDraftKeyword(),this.loading=!0,this.settle({seo:{title:this.title.trim(),description:this.description.trim(),keywords:[...this.keywordList]},busy:e=>{this.isConnected&&(this.loading=e)},done:this.dismiss}))},this.loading=!1,this.title="",this.description="",this.keywordList=[],this.keywordDraft="",this.keywordsFocused=!1,this.generatingField=""}static open(){const e=document.createElement("cdtr-publish-seo"),t=s.M.get("app","seo")||{};return e.title=t.title||"",e.description=t.description||"",e.keywordList=(Array.isArray(t.keywords)?t.keywords:String(t.keywords||"").split(",")).map(e=>String(e).trim()).filter(Boolean),document.body.appendChild(e),e.waitForChoice()}waitForChoice(){return new Promise(e=>{this.resolver=e})}t(e,t){return s.M.get("lang",e)||t}get direction(){const e=s.M.get("theme");return e?.direction||"rtl"}settle(e){this.resolver&&(this.resolver(e),this.resolver=null)}commitDraftKeyword(){const e=this.keywordDraft.split(",").map(e=>e.trim()).filter(Boolean);if(!e.length)return;const t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t,this.keywordDraft=""}removeKeyword(e){this.keywordList=this.keywordList.filter((t,i)=>i!==e)}snackbar(e){const t=s.M.get("commands");t?.snackbar?.(e)}async requestSeo(e,t,i){const o=async o=>{const s=await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=l.Ay;if("function"==typeof t.studioTokenProvider)try{const i=await t.studioTokenProvider({forceRefresh:e});if("string"==typeof i&&i.length>0)return i}catch{}return"string"==typeof t.studioToken&&t.studioToken.length>0?t.studioToken:null}(o),r={"Content-Type":"application/json",Accept:"application/json"};return s&&(r.Authorization=`Bearer ${s}`),fetch(c,{method:"POST",headers:r,body:JSON.stringify({content:t,field:e,language:i})})};let s=await o(!1);if(401===s.status&&(s=await o(!0)),!s.ok)throw new Error(`HTTP ${s.status}`);const r=await s.json();if(!r.ok||void 0===r.value)throw new Error("bad response");return r.value}magicButton(e){const t=this.generatingField===e;return o.qy`
8
8
  <button
9
9
  class="magic"
10
10
  type="button"
@@ -13,9 +13,9 @@
13
13
  ?disabled=${this.loading||!!this.generatingField}
14
14
  @click=${()=>this.generateField(e)}
15
15
  >
16
- ${t?s.qy`<span class="mini-spinner"></span>`:d}
16
+ ${t?o.qy`<span class="mini-spinner"></span>`:d}
17
17
  </button>
18
- `}render(){const e=this.direction;return s.qy`
18
+ `}render(){const e=this.direction;return o.qy`
19
19
  <div class="backdrop" @click=${this.onCancel}></div>
20
20
  <div class="card" dir=${e}>
21
21
  <h2 class="heading">${this.t("ready_to_publish","Ready to publish")}</h2>
@@ -63,7 +63,7 @@
63
63
  class="chips ${this.keywordsFocused?"focused":""}"
64
64
  @click=${e=>{const t=e.currentTarget.querySelector("input");t?.focus()}}
65
65
  >
66
- ${this.keywordList.map((e,t)=>s.qy`
66
+ ${this.keywordList.map((e,t)=>o.qy`
67
67
  <span class="chip">
68
68
  ${e}
69
69
  <button
@@ -90,14 +90,14 @@
90
90
 
91
91
  <div class="actions">
92
92
  <button class="publish" ?disabled=${this.loading} @click=${this.onPublish}>
93
- ${this.loading?s.qy`<span class="spinner"></span>`:this.t("publish","Publish")}
93
+ ${this.loading?o.qy`<span class="spinner"></span>`:this.t("publish","Publish")}
94
94
  </button>
95
95
  <button class="cancel" ?disabled=${this.loading} @click=${this.onCancel}>
96
96
  ${this.t("cancel","Cancel")}
97
97
  </button>
98
98
  </div>
99
99
  </div>
100
- `}}h.styles=s.AH`
100
+ `}}h.styles=o.AH`
101
101
  :host {
102
102
  position: fixed;
103
103
  inset: 0;
@@ -343,20 +343,20 @@
343
343
  @keyframes spin {
344
344
  to { transform: rotate(360deg); }
345
345
  }
346
- `,h.properties={loading:{type:Boolean},title:{type:String},description:{type:String},keywordList:{type:Array},keywordDraft:{type:String},keywordsFocused:{type:Boolean},generatingField:{type:String}},customElements.define("cdtr-publish-seo",h);class p extends s.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.onKeyDown=e=>{"Escape"===e.key&&this.dismiss()},this.dismiss=()=>{this.isConnected&&this.remove()},this.copyLink=async()=>{if(this.url)try{await navigator.clipboard.writeText(this.url),this.copied=!0,setTimeout(()=>this.copied=!1,2e3)}catch{}},this.message="",this.sub="",this.url="",this.seoTitle="",this.seoDescription="",this.copied=!1}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.onKeyDown)}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer),document.removeEventListener("keydown",this.onKeyDown)}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}get host(){return this.url?this.url.replace(/^https?:\/\//,"").replace(/\/+$/,""):""}launchConfetti(){const e=this.renderRoot.querySelector("canvas");if(!e)return;const t=e.getContext("2d");if(!t)return;const i=window.devicePixelRatio||1,s=window.innerWidth,o=window.innerHeight;e.width=s*i,e.height=o*i,t.scale(i,i);const r=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],n=s/2,a=.42*o,l=Math.min(220,Math.round(s/6)),c=Array.from({length:l},(e,t)=>{const i=2*Math.PI*t/l+t%3*.4,s=4+t%9;return{x:n,y:a,vx:Math.cos(i)*s,vy:Math.sin(i)*s-3,size:5+t%5,color:r[t%r.length],rot:t,vrot:(t%2?1:-1)*(.1+t%5*.03),life:1}}),d=performance.now(),h=e=>{const i=e-d;t.clearRect(0,0,s,o);let r=!1;for(const e of c)e.vy+=.16,e.x+=e.vx,e.y+=e.vy,e.rot+=e.vrot,i>2600*.55&&(e.life=Math.max(0,e.life-.02)),e.life>0&&e.y<o+40&&(r=!0),t.save(),t.globalAlpha=e.life,t.translate(e.x,e.y),t.rotate(e.rot),t.fillStyle=e.color,t.fillRect(-e.size/2,-e.size/2,e.size,.6*e.size),t.restore();r&&i<3e3?this.raf=requestAnimationFrame(h):t.clearRect(0,0,s,o)};this.raf=requestAnimationFrame(h)}renderPreview(){const e=this.host;if(!e)return s.s6;const t=(this.seoTitle||"").trim()||(this.seoDescription?"":e),i=(this.seoDescription||"").trim(),o=(t||e).charAt(0);return s.qy`
346
+ `,h.properties={loading:{type:Boolean},title:{type:String},description:{type:String},keywordList:{type:Array},keywordDraft:{type:String},keywordsFocused:{type:Boolean},generatingField:{type:String}},customElements.define("cdtr-publish-seo",h);class p extends o.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.onKeyDown=e=>{"Escape"===e.key&&this.dismiss()},this.dismiss=()=>{this.isConnected&&this.remove()},this.copyLink=async()=>{if(this.url)try{await navigator.clipboard.writeText(this.url),this.copied=!0,setTimeout(()=>this.copied=!1,2e3)}catch{}},this.message="",this.sub="",this.url="",this.seoTitle="",this.seoDescription="",this.copied=!1}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.onKeyDown)}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer),document.removeEventListener("keydown",this.onKeyDown)}t(e,t){return s.M.get("lang",e)||t}get direction(){const e=s.M.get("theme");return e?.direction||"rtl"}get host(){return this.url?this.url.replace(/^https?:\/\//,"").replace(/\/+$/,""):""}launchConfetti(){const e=this.renderRoot.querySelector("canvas");if(!e)return;const t=e.getContext("2d");if(!t)return;const i=window.devicePixelRatio||1,o=window.innerWidth,s=window.innerHeight;e.width=o*i,e.height=s*i,t.scale(i,i);const r=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],n=o/2,a=.42*s,l=Math.min(220,Math.round(o/6)),c=Array.from({length:l},(e,t)=>{const i=2*Math.PI*t/l+t%3*.4,o=4+t%9;return{x:n,y:a,vx:Math.cos(i)*o,vy:Math.sin(i)*o-3,size:5+t%5,color:r[t%r.length],rot:t,vrot:(t%2?1:-1)*(.1+t%5*.03),life:1}}),d=performance.now(),h=e=>{const i=e-d;t.clearRect(0,0,o,s);let r=!1;for(const e of c)e.vy+=.16,e.x+=e.vx,e.y+=e.vy,e.rot+=e.vrot,i>2600*.55&&(e.life=Math.max(0,e.life-.02)),e.life>0&&e.y<s+40&&(r=!0),t.save(),t.globalAlpha=e.life,t.translate(e.x,e.y),t.rotate(e.rot),t.fillStyle=e.color,t.fillRect(-e.size/2,-e.size/2,e.size,.6*e.size),t.restore();r&&i<3e3?this.raf=requestAnimationFrame(h):t.clearRect(0,0,o,s)};this.raf=requestAnimationFrame(h)}renderPreview(){const e=this.host;if(!e)return o.s6;const t=(this.seoTitle||"").trim()||(this.seoDescription?"":e),i=(this.seoDescription||"").trim(),s=(t||e).charAt(0);return o.qy`
347
347
  <div class="preview">
348
348
  <p class="preview-caption">${this.t("search_preview_label","How your page will look on Google")}</p>
349
349
  <div class="result-head">
350
- <span class="favicon">${o}</span>
350
+ <span class="favicon">${s}</span>
351
351
  <div class="result-url">
352
352
  <div class="result-host">${e.split("/")[0]}</div>
353
353
  <div class="result-crumb">${e}</div>
354
354
  </div>
355
355
  </div>
356
- ${t?s.qy`<p class="result-title">${t}</p>`:s.s6}
357
- ${i?s.qy`<p class="result-desc">${i}</p>`:s.s6}
356
+ ${t?o.qy`<p class="result-title">${t}</p>`:o.s6}
357
+ ${i?o.qy`<p class="result-desc">${i}</p>`:o.s6}
358
358
  </div>
359
- `}render(){const e=this.direction,t=this.copied?s.qy`<svg viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`:s.qy`<svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2" stroke="currentColor" stroke-width="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>`;return s.qy`
359
+ `}render(){const e=this.direction,t=this.copied?o.qy`<svg viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`:o.qy`<svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2" stroke="currentColor" stroke-width="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>`;return o.qy`
360
360
  <canvas @click=${this.dismiss}></canvas>
361
361
  <div class="card" dir=${e}>
362
362
  <button
@@ -378,7 +378,7 @@
378
378
 
379
379
  ${this.renderPreview()}
380
380
 
381
- ${this.url?s.qy`
381
+ ${this.url?o.qy`
382
382
  <div class="actions">
383
383
  <a class="view" href=${this.url} target="_blank" rel="noopener">
384
384
  <svg viewBox="0 0 24 24" fill="none"><path d="M14 4h6v6M20 4l-9 9M18 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
@@ -389,9 +389,9 @@
389
389
  ${this.copied?this.t("link_copied","Link copied"):this.t("copy_link","Copy link")}
390
390
  </button>
391
391
  </div>
392
- `:s.s6}
392
+ `:o.s6}
393
393
  </div>
394
- `}}p.styles=s.AH`
394
+ `}}p.styles=o.AH`
395
395
  :host {
396
396
  position: fixed;
397
397
  inset: 0;
@@ -624,21 +624,21 @@
624
624
  width: 15px;
625
625
  height: 15px;
626
626
  }
627
- `,p.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",p);const u="creaditor:publish",f="creaditor:publish-error";class g extends s.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=o.M.get("config","onNextStep")),this.onPublish||(this.onPublish=o.M.get("config","onPublish")),this.channel||(this.channel=o.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(this.isLocked||this.isLoading)return;const e=!!o.M.get("config","access"),t="web"===this.channel,i=e&&t;let s=null;if(t&&(s=await h.open(),!s))return;const a=s?s.seo:null;this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t&&s){let e=!1;try{i&&a&&(await(0,n.YE)({seo:a}),await(0,n.bK)({})),"function"==typeof this.onPublish?e=await this.runHostPublish(this.onPublish,a,i,s):"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:a??void 0})}finally{s.done()}return void(e||(this.emitPublished(i,a),this.celebratePublish(a)))}"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2}),this.emitPublished(i,a)}catch(e){console.error("Error in publish/onNextStep:",e),this.emitPublishError(i,a,e),this.snackbar(o.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}runHostPublish(e,t,i,s){return new Promise(a=>{let l=!1;const c=(e,r,n)=>{l||(l=!0,clearTimeout(d),s.done(),e?(this.celebratePublish(t),this.emitPublished(i,t)):(this.snackbar(n||o.M.get("lang","publishError")||"Publish failed"),this.emitPublishError(i,t,r)),a(!0))},d=setTimeout(()=>{l||(console.warn("config.onPublish never signalled completion — finishing the publish without it. Call success() or error() (or return a promise) so the modal can come down."),l=!0,s.done(),a(!1))},6e4),h={title:t.title,description:t.description,keywords:t.keywords},p={loading:function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s.busy(e)},success:()=>c(!0),confetti:()=>c(!0),error:e=>c(!1,new Error(e||"host publish failed"),e),commands:{patchSite:e=>(0,n.YE)(e??{}),publishSite:e=>(0,n.bK)(e??{}),toHTML:r.FE,toJSON:r.U2}};let u;try{u=e(h,p)}catch(e){return console.error("Error in config.onPublish:",e),void c(!1,e)}u&&"function"==typeof u.then&&Promise.resolve(u).then(()=>c(!0),e=>{console.error("Error in config.onPublish:",e),c(!1,e)})})}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}siteUrl(){const e=o.M.get("app","domains"),t=e?.[0]?.name;if(t)return/^https?:\/\//.test(t)?t:`https://${t}`}emitPublished(e,t){const i={channel:this.channel,selfPublish:e,seo:t??void 0,url:this.siteUrl(),toHTML:r.FE,toJSON:r.U2};window.dispatchEvent(new CustomEvent(u,{detail:i}))}emitPublishError(e,t,i){const s={channel:this.channel,selfPublish:e,seo:t??void 0,error:i};window.dispatchEvent(new CustomEvent(f,{detail:s}))}celebratePublish(e){const t=document.createElement("cdtr-publish-success");e&&(t.seoTitle=e.title,t.seoDescription=e.description);const i=this.siteUrl();i&&(t.url=i),document.body.appendChild(t)}render(){const e=!!o.M.get("config","access");if(!(this.onNextStep||"function"==typeof this.onPublish||"web"===this.channel&&e))return null;const t="web"===this.channel?"publish":"next";return s.qy`
627
+ `,p.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",p);const u="creaditor:publish",f="creaditor:publish-error";class g extends o.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=s.M.get("config","onNextStep")),this.onPublish||(this.onPublish=s.M.get("config","onPublish")),this.channel||(this.channel=s.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(this.isLocked||this.isLoading)return;const e=!!s.M.get("config","access"),t="web"===this.channel,i=e&&t;let o=null;if(t&&(o=await h.open(),!o))return;const a=o?o.seo:null;this.isLoading=!0,this.isLocked=!0;const l=Date.now();this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t&&o){let e=!1;try{i&&a&&(await(0,n.YE)({seo:a}),await(0,n.bK)({})),"function"==typeof this.onPublish?e=await this.runHostPublish(this.onPublish,a,i,o):"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:a??void 0})}finally{o.done()}return void(e||(this.emitPublished(i,a),this.celebratePublish(a)))}const e=s.M.get("config","editor","props","onSave"),l=Date.now();"function"==typeof e&&await e({transactions:[],toJson:r.U2,toJSON:r.U2,toHTML:r.FE});const c=Date.now()-l;c<3e3&&await new Promise(e=>setTimeout(e,3e3-c)),"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2}),this.emitPublished(i,a)}catch(e){console.error("Error in publish/onNextStep:",e),this.emitPublishError(i,a,e),this.snackbar(s.M.get("lang","publishError")||"Publish failed")}finally{const e=Date.now()-l;e<400&&await new Promise(t=>setTimeout(t,400-e)),this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}runHostPublish(e,t,i,o){return new Promise(a=>{let l=!1;const c=(e,r,n)=>{l||(l=!0,clearTimeout(d),o.done(),e?(this.celebratePublish(t),this.emitPublished(i,t)):(this.snackbar(n||s.M.get("lang","publishError")||"Publish failed"),this.emitPublishError(i,t,r)),a(!0))},d=setTimeout(()=>{l||(console.warn("config.onPublish never signalled completion — finishing the publish without it. Call success() or error() (or return a promise) so the modal can come down."),l=!0,o.done(),a(!1))},6e4),h={title:t.title,description:t.description,keywords:t.keywords},p={loading:function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return o.busy(e)},success:()=>c(!0),confetti:()=>c(!0),error:e=>c(!1,new Error(e||"host publish failed"),e),commands:{patchSite:e=>(0,n.YE)(e??{}),publishSite:e=>(0,n.bK)(e??{}),toHTML:r.FE,toJSON:r.U2}};let u;try{u=e(h,p)}catch(e){return console.error("Error in config.onPublish:",e),void c(!1,e)}u&&"function"==typeof u.then&&Promise.resolve(u).then(()=>c(!0),e=>{console.error("Error in config.onPublish:",e),c(!1,e)})})}snackbar(e){const t=s.M.get("commands");t?.snackbar?.(e)}siteUrl(){const e=s.M.get("app","domains"),t=e?.[0]?.name;if(t)return/^https?:\/\//.test(t)?t:`https://${t}`}emitPublished(e,t){const i={channel:this.channel,selfPublish:e,seo:t??void 0,url:this.siteUrl(),toHTML:r.FE,toJSON:r.U2};window.dispatchEvent(new CustomEvent(u,{detail:i}))}emitPublishError(e,t,i){const o={channel:this.channel,selfPublish:e,seo:t??void 0,error:i};window.dispatchEvent(new CustomEvent(f,{detail:o}))}celebratePublish(e){const t=document.createElement("cdtr-publish-success");e&&(t.seoTitle=e.title,t.seoDescription=e.description);const i=this.siteUrl();i&&(t.url=i),document.body.appendChild(t)}render(){const e=!!s.M.get("config","access");if(!(this.onNextStep||"function"==typeof this.onPublish||"web"===this.channel&&e))return null;const t="web"===this.channel?"publish":"next";return o.qy`
628
628
  <paper-button
629
629
  @click=${this.handleClick}
630
630
  class="next-button"
631
631
  ?disabled=${this.isLocked}
632
632
  >
633
- ${this.isLoading?s.qy`
633
+ ${this.isLoading?o.qy`
634
634
  <div class="loading-spinner"></div>
635
- `:s.qy`
635
+ `:o.qy`
636
636
  <div class="button-content ${this.isLoading?"loading":""}">
637
637
  <lang-text text=${t}></lang-text>
638
638
  </div>
639
639
  `}
640
640
  </paper-button>
641
- `}}g.styles=s.AH`
641
+ `}}g.styles=o.AH`
642
642
  :host {
643
643
  display: block;
644
644
  }
Binary file
@@ -1,4 +1,4 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2590,7209],{93967(e,t,s){s.d(t,{T:()=>r});const r=s(59929).AH`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2590,7209],{93967(e,t,s){s.d(t,{T:()=>i});const i=s(59929).AH`
2
2
  :host {
3
3
  direction: var(--direction-locale, ltr);
4
4
  }
@@ -27,7 +27,7 @@
27
27
  }
28
28
  .moved {
29
29
  position: absolute;
30
- left: 0;
30
+ inset-inline-start: 0;
31
31
  top: 0;
32
32
  width: 100%;
33
33
  background: #fff;
@@ -88,6 +88,8 @@
88
88
  background: var(--color-bg-subtle, var(--alpha));
89
89
  height: 100vh;
90
90
  max-width: 210px;
91
+ box-sizing: border-box;
92
+ padding-inline: var(--space-4, 16px);
91
93
  }
92
94
  .search {
93
95
  --cdtr-input-height: 36px;
@@ -110,7 +112,7 @@
110
112
  width: 100%;
111
113
  top: 100%;
112
114
  transform: translateY(-100%);
113
- left: 0;
115
+ inset-inline-start: 0;
114
116
  }
115
117
  .scroll-body::-webkit-scrollbar {
116
118
  width: var(--scrollbar-width, 6px);
@@ -146,7 +148,7 @@
146
148
  .gallery-container {
147
149
  padding: var(--space-8, 32px) var(--space-5, 20px);
148
150
  }
149
- `},27209(e,t,s){s.r(t),s.d(t,{CreaditorGalleryWrapper:()=>g});var r=s(59929),i=s(5441),o=s(86319),a=s(49549),l=s(91597),n=s(21421),d=s(93967);function c(e){try{localStorage.setItem("creaditor-gallery-folder",e)}catch(e){console.warn("Could not write to localStorage:",e)}}class p extends r.WF{constructor(){super(),this.newFolderModalRef=(0,n._)(),this.newFolderInputRef=(0,n._)(),this.drop=this.drop.bind(this),this.controls=!0,this.folderName=o.M.get("lang","myImages")||"My Images",this.sendFiles=this.sendFiles.bind(this),this.onSearch=this.onSearch.bind(this),this.coverEl=document.createElement("div"),this.sortItems=[{index:0,text:"fromNewToOld",value:{filter:"date",sortBy:"ASC"},checked:!0},{index:1,text:"fromOldToNew",value:{filter:"date",sortBy:"DESC"},checked:!1},{index:2,text:o.M.get("lang","aToZ"),value:{filter:"name",sortBy:"ASC"},checked:!1},{index:3,text:o.M.get("lang","zToA"),value:{filter:"name",sortBy:"DESC"},checked:!1}],this.filterItems=[{index:0,text:o.M.get("lang","folders"),value:"folders",checked:!0},{index:1,text:o.M.get("lang","images"),value:"images",checked:!0}]}openNewFolderModal(e){const t=this.newFolderModalRef.value;t&&(t.positionTarget=e.target,t.open(),this.newFolderInputRef.value.focus())}sendFiles(){const e={detail:this.files.filter(e=>e.selected),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onLiked(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("like",t))}onClickFolder(e,t){this.freeImages=!1,this.controls=t;const s={detail:e,bubbles:!1,composed:!1};this.folderName=e.name,this.dispatchEvent(new CustomEvent("folder",s))}onSelectFile(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}onSelectPexelsImage(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}onUpload(){const e=(0,i.A)("input",{hidden:!0,type:"file",accept:"image/*"});e.onchange=e=>{const t=e.target;if(t.files&&t.files[0]){const e=new FileReader,s=t.files[0];e.onload=e=>{const t={detail:s,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("upload",t))},e.readAsDataURL(s)}},e.click()}onCreateNewFolder(){const e=this.newFolderInputRef.value.value;if(e.length<=30){const t={detail:e,bubbles:!1,composed:!1};this.newFolderModalRef.value.close(),this.dispatchEvent(new CustomEvent("newFolder",t)),this.newFolderInputRef.value.value=""}}onClickCategory(){}onReset(){c(null),this.freeImages=!1,this._favorites=!1,this.folderName=o.M.get("lang","myImages"),this.filterItems=this.filterItems.map(e=>"folders"===e.value?{...e,checked:!0}:e),this.dispatchEvent(new CustomEvent("reset",{}))}onFavorites(){c(null),this.freeImages=!1,this._favorites=!0,this.folderName="",this.filterItems=this.filterItems.map(e=>"folders"===e.value?{...e,checked:!1}:e),this.dispatchEvent(new CustomEvent("search",{detail:{value:"",isLiked:!0},bubbles:!1,composed:!1}))}onSearch(e,t){c(null),this.freeImages=!1;let s=!1;"object"==typeof t&&t.isLiked&&(s=!0);const r=e.target?.value||"";(0,l.A)(()=>{const e={detail:{value:r,isLiked:s},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("search",e))})}drop(e,t){e.preventDefault();const s=e.dataTransfer.getData("fileId"),r=(e.dataTransfer.getData("folderId"),{detail:{fileId:s,folderId:t},bubbles:!1,composed:!1});this.dispatchEvent(new CustomEvent("moveFile",r))}onFilterMedia(e){const t=e.detail.value,s=t.index,r=[...this.filterItems];r[s].checked=!r[s].checked,this.filterItems=r}onSort(e){const t=e.detail.value,s={detail:t,bubbles:!1,composed:!1},r=t.index,i=[...this.sortItems];i.forEach((e,t)=>{e.checked=r===t}),this.sortItems=i,this.dispatchEvent(new CustomEvent("filter",s))}onDeleteFile(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("deleteFile",t))}onDeleteFolder(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("deleteFolder",t))}dragStart(e,t){e.dataTransfer.setData("fileId",t)}dragOver(e,t){e.dataTransfer.setData("folderId",t),e.preventDefault()}onFreeImages(){this.freeImages=!0,c("freeImages"),s.e(767).then(s.bind(s,70767))}onScroll(e){const t=e.target;if(t.scrollTop+t.offsetHeight>=t.scrollHeight-50){const e={detail:{folderId:this.folderId,page:this.page},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("loadMore",e))}}connectedCallback(){super.connectedCallback(),s.e(5156).then(s.bind(s,85156));"freeImages"===function(){try{return localStorage.getItem("creaditor-gallery-folder")}catch(e){return console.warn("Could not read from localStorage:",e),null}}()&&(this.freeImages=!0,s.e(767).then(s.bind(s,70767)))}render(){Array.isArray(this.files)||(this.files=[]),Array.isArray(this.folders)||(this.folders=[]);const e=this.folders.filter(e=>"public"!==e.visibility),t=this.folders.filter(e=>"public"===e.visibility);return r.qy` <cdtr-row>
151
+ `},27209(e,t,s){s.r(t),s.d(t,{CreaditorGalleryWrapper:()=>b,DEFAULT_LABELS:()=>g});var i=s(59929),r=s(5441),o=s(86319),a=s(49549),l=s(91597),n=s(21421),d=s(93967);function c(e){try{localStorage.setItem("creaditor-gallery-folder",e)}catch(e){console.warn("Could not write to localStorage:",e)}}class p extends i.WF{constructor(){super(),this.newFolderModalRef=(0,n._)(),this.newFolderInputRef=(0,n._)(),this.drop=this.drop.bind(this),this.controls=!0,this.folderName=o.M.get("lang","myImages")||"My Images",this.sendFiles=this.sendFiles.bind(this),this.onSearch=this.onSearch.bind(this),this.coverEl=document.createElement("div"),this.sortItems=[{index:0,text:"fromNewToOld",value:{filter:"date",sortBy:"ASC"},checked:!0},{index:1,text:"fromOldToNew",value:{filter:"date",sortBy:"DESC"},checked:!1},{index:2,text:o.M.get("lang","aToZ"),value:{filter:"name",sortBy:"ASC"},checked:!1},{index:3,text:o.M.get("lang","zToA"),value:{filter:"name",sortBy:"DESC"},checked:!1}],this.filterItems=[{index:0,text:o.M.get("lang","folders"),value:"folders",checked:!0},{index:1,text:o.M.get("lang","images"),value:"images",checked:!0}]}openNewFolderModal(e){const t=this.newFolderModalRef.value;t&&(t.positionTarget=e.target,t.open(),this.newFolderInputRef.value.focus())}sendFiles(){const e={detail:this.files.filter(e=>e.selected),bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",e))}onLiked(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("like",t))}onClickFolder(e,t){this.freeImages=!1,this.controls=t;const s={detail:e,bubbles:!1,composed:!1};this.folderName=e.name,this.dispatchEvent(new CustomEvent("folder",s))}onSelectFile(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}onSelectPexelsImage(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}onUpload(){const e=(0,r.A)("input",{hidden:!0,type:"file",accept:"image/*"});e.onchange=e=>{const t=e.target;if(t.files&&t.files[0]){const e=new FileReader,s=t.files[0];e.onload=e=>{const t={detail:s,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("upload",t))},e.readAsDataURL(s)}},e.click()}onCreateNewFolder(){const e=this.newFolderInputRef.value.value;if(e.length<=30){const t={detail:e,bubbles:!1,composed:!1};this.newFolderModalRef.value.close(),this.dispatchEvent(new CustomEvent("newFolder",t)),this.newFolderInputRef.value.value=""}}onClickCategory(){}onReset(){c(null),this.freeImages=!1,this._favorites=!1,this.folderName=o.M.get("lang","myImages"),this.filterItems=this.filterItems.map(e=>"folders"===e.value?{...e,checked:!0}:e),this.dispatchEvent(new CustomEvent("reset",{}))}onFavorites(){c(null),this.freeImages=!1,this._favorites=!0,this.folderName="",this.filterItems=this.filterItems.map(e=>"folders"===e.value?{...e,checked:!1}:e),this.dispatchEvent(new CustomEvent("search",{detail:{value:"",isLiked:!0},bubbles:!1,composed:!1}))}onSearch(e,t){c(null),this.freeImages=!1;let s=!1;"object"==typeof t&&t.isLiked&&(s=!0);const i=e.target?.value||"";(0,l.A)(()=>{const e={detail:{value:i,isLiked:s},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("search",e))})}drop(e,t){e.preventDefault();const s=e.dataTransfer.getData("fileId"),i=(e.dataTransfer.getData("folderId"),{detail:{fileId:s,folderId:t},bubbles:!1,composed:!1});this.dispatchEvent(new CustomEvent("moveFile",i))}onFilterMedia(e){const t=e.detail.value,s=t.index,i=[...this.filterItems];i[s].checked=!i[s].checked,this.filterItems=i}onSort(e){const t=e.detail.value,s={detail:t,bubbles:!1,composed:!1},i=t.index,r=[...this.sortItems];r.forEach((e,t)=>{e.checked=i===t}),this.sortItems=r,this.dispatchEvent(new CustomEvent("filter",s))}onDeleteFile(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("deleteFile",t))}onDeleteFolder(e){const t={detail:e,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("deleteFolder",t))}dragStart(e,t){e.dataTransfer.setData("fileId",t)}dragOver(e,t){e.dataTransfer.setData("folderId",t),e.preventDefault()}onFreeImages(){this.freeImages=!0,c("freeImages"),s.e(767).then(s.bind(s,70767))}onScroll(e){const t=e.target;if(t.scrollTop+t.offsetHeight>=t.scrollHeight-50){const e={detail:{folderId:this.folderId,page:this.page},bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("loadMore",e))}}connectedCallback(){super.connectedCallback(),s.e(5156).then(s.bind(s,85156));"freeImages"===function(){try{return localStorage.getItem("creaditor-gallery-folder")}catch(e){return console.warn("Could not read from localStorage:",e),null}}()&&(this.freeImages=!0,s.e(767).then(s.bind(s,70767)))}render(){Array.isArray(this.files)||(this.files=[]),Array.isArray(this.folders)||(this.folders=[]);const e=this.folders.filter(e=>"public"!==e.visibility),t=this.folders.filter(e=>"public"===e.visibility);return i.qy` <cdtr-row>
150
152
  <cdtr-col class="list" sm="3">
151
153
  <cdtr-row alignItems="center" class="upload-container">
152
154
  <paper-button @click=${this.onUpload} class="upload">
@@ -162,17 +164,17 @@
162
164
  ><lang-text text="favorites"></lang-text
163
165
  ></paper-item>
164
166
  <paper-item @click=${this.onFreeImages}> <lang-text text="freeImages"></lang-text> </paper-item>
165
- ${Array.isArray(t)?t.map(e=>r.qy`<paper-item
167
+ ${Array.isArray(t)?t.map(e=>i.qy`<paper-item
166
168
  @click=${()=>this.onClickFolder(e,!1)}
167
169
  ><lang-text text="${e.name}"></lang-text
168
170
  ></paper-item>`):null}
169
171
  </paper-listbox>
170
172
  </cdtr-col>
171
- ${this.freeImages?r.qy`<cdtr-col>
173
+ ${this.freeImages?i.qy`<cdtr-col>
172
174
  <cdtr-pexels-gallery
173
175
  @file=${e=>this.onSelectPexelsImage(e.detail)}
174
176
  ></cdtr-pexels-gallery>
175
- </cdtr-col>`:r.qy`<cdtr-col>
177
+ </cdtr-col>`:i.qy`<cdtr-col>
176
178
  <div class="gallery-container">
177
179
  <cdtr-row alignItems="center">
178
180
  <cdtr-input
@@ -193,7 +195,7 @@
193
195
  ></paper-button>
194
196
  </cdtr-row>
195
197
  <cdtr-row mt="1">
196
- ${this.folderName?r.qy`
198
+ ${this.folderName?i.qy`
197
199
  <cdtr-title style="font-size:14px"
198
200
  ><lang-text text="main"></lang-text
199
201
  ></cdtr-title>
@@ -207,7 +209,7 @@
207
209
  `:null}
208
210
  </cdtr-row>
209
211
  <cdtr-row mt="2" justify="space-between">
210
- ${this.filterItems[0].checked?r.qy` <cdtr-col sm="2">
212
+ ${this.filterItems[0].checked?i.qy` <cdtr-col sm="2">
211
213
  <cdtr-row
212
214
  spacing="2px"
213
215
  class="scroll-body"
@@ -221,7 +223,7 @@
221
223
  name=${o.M.get("lang","myImages")}
222
224
  ></cdtr-editor-media-card>
223
225
  </cdtr-col>
224
- ${(0,a.u)(e||[],e=>e.id,(e,t)=>r.qy`<cdtr-col sm="12">
226
+ ${(0,a.u)(e||[],e=>e.id,(e,t)=>i.qy`<cdtr-col sm="12">
225
227
  <cdtr-editor-media-card
226
228
  @deleteFolder=${()=>this.onDeleteFolder(e)}
227
229
  @deleteFile=${()=>this.onDeleteFile(e)}
@@ -237,19 +239,19 @@
237
239
  </cdtr-col>`)}
238
240
  </cdtr-row>
239
241
  </cdtr-col>`:null}
240
- ${this.filterItems[1].checked?r.qy` <cdtr-col sm="10">
242
+ ${this.filterItems[1].checked?i.qy` <cdtr-col sm="10">
241
243
  <cdtr-row
242
244
  @scroll=${this.onScroll}
243
245
  class="scroll-body"
244
246
  justify="space-evenly"
245
247
  >
246
- ${this.files&&0!==this.files.length||this.filterItems[0].checked?null:r.qy`<cdtr-empty-state
248
+ ${this.files&&0!==this.files.length||this.filterItems[0].checked?null:i.qy`<cdtr-empty-state
247
249
  icon="image"
248
250
  heading="noImagesYet"
249
251
  description="uploadOrPickImages"
250
252
  ></cdtr-empty-state>`}
251
- ${(0,a.u)(this.files||[],e=>e.id,(e,t)=>r.qy`<cdtr-col class="file-col" sm="3">
252
- ${e.moved?r.qy` <div class="moved"></div> `:null}
253
+ ${(0,a.u)(this.files||[],e=>e.id,(e,t)=>i.qy`<cdtr-col class="file-col" sm="3">
254
+ ${e.moved?i.qy` <div class="moved"></div> `:null}
253
255
  <cdtr-editor-media-card
254
256
  @deleteFile=${()=>this.onDeleteFile(e)}
255
257
  @deleteFolder=${()=>this.onDeleteFolder(e)}
@@ -306,7 +308,7 @@
306
308
  </cdtr-row>
307
309
  </form>
308
310
  </paper-dialog>
309
- </cdtr-row>`}}p.styles=d.T,p.properties={folders:{type:Array},files:{type:Array},pageCount:{type:Number},prevUrl:{type:String},nextUrl:{type:String},folderName:{type:String},filterItems:{type:Array},multi:{type:Boolean},controls:{type:Boolean},freeImages:{type:Boolean}},customElements.define("cdtr-gallery-files",p);class h extends r.WF{constructor(){super(),this.uploads={}}connectedCallback(){super.connectedCallback(),this.addEventListener("upload-start",this.handleUploadStart.bind(this)),this.addEventListener("upload-progress",this.handleUploadProgress.bind(this)),this.addEventListener("upload-complete",this.handleUploadComplete.bind(this)),this.addEventListener("upload-error",this.handleUploadError.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("upload-start",this.handleUploadStart.bind(this)),this.removeEventListener("upload-progress",this.handleUploadProgress.bind(this)),this.removeEventListener("upload-complete",this.handleUploadComplete.bind(this)),this.removeEventListener("upload-error",this.handleUploadError.bind(this))}handleUploadStart(e){const{uploadId:t,fileName:s}=e.detail;this.uploads[t]={fileName:s,status:"uploading",progress:0,error:null},this.requestUpdate()}handleUploadProgress(e){const{uploadId:t,progress:s}=e.detail;this.uploads[t]&&(this.uploads[t].progress=s,this.requestUpdate())}handleUploadComplete(e){const{uploadId:t}=e.detail;this.uploads[t]&&(this.uploads[t].status="completed",this.uploads[t].progress=100,this.requestUpdate(),setTimeout(()=>{this.removeUpload(t)},3e3))}handleUploadError(e){const{uploadId:t,error:s}=e.detail;this.uploads[t]&&(this.uploads[t].status="error",this.uploads[t].error=s,this.requestUpdate(),setTimeout(()=>{this.removeUpload(t)},5e3))}removeUpload(e){delete this.uploads[e],this.requestUpdate()}getStatusIcon(e){switch(e){case"uploading":default:return r.qy`<div class="status-icon uploading"></div>`;case"completed":return r.qy`<div class="status-icon completed"></div>`;case"error":return r.qy`<div class="status-icon error"></div>`}}getProgressFillClass(e){switch(e){case"completed":return"progress-fill completed";case"error":return"progress-fill error";default:return"progress-fill"}}render(){const e=Object.entries(this.uploads).map(e=>{let[t,s]=e;return r.qy`
311
+ </cdtr-row>`}}p.styles=d.T,p.properties={folders:{type:Array},files:{type:Array},pageCount:{type:Number},prevUrl:{type:String},nextUrl:{type:String},folderName:{type:String},filterItems:{type:Array},multi:{type:Boolean},controls:{type:Boolean},freeImages:{type:Boolean}},customElements.define("cdtr-gallery-files",p);class h extends i.WF{constructor(){super(),this.uploads={}}connectedCallback(){super.connectedCallback(),this.addEventListener("upload-start",this.handleUploadStart.bind(this)),this.addEventListener("upload-progress",this.handleUploadProgress.bind(this)),this.addEventListener("upload-complete",this.handleUploadComplete.bind(this)),this.addEventListener("upload-error",this.handleUploadError.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("upload-start",this.handleUploadStart.bind(this)),this.removeEventListener("upload-progress",this.handleUploadProgress.bind(this)),this.removeEventListener("upload-complete",this.handleUploadComplete.bind(this)),this.removeEventListener("upload-error",this.handleUploadError.bind(this))}handleUploadStart(e){const{uploadId:t,fileName:s}=e.detail;this.uploads[t]={fileName:s,status:"uploading",progress:0,error:null},this.requestUpdate()}handleUploadProgress(e){const{uploadId:t,progress:s}=e.detail;this.uploads[t]&&(this.uploads[t].progress=s,this.requestUpdate())}handleUploadComplete(e){const{uploadId:t}=e.detail;this.uploads[t]&&(this.uploads[t].status="completed",this.uploads[t].progress=100,this.requestUpdate(),setTimeout(()=>{this.removeUpload(t)},3e3))}handleUploadError(e){const{uploadId:t,error:s}=e.detail;this.uploads[t]&&(this.uploads[t].status="error",this.uploads[t].error=s,this.requestUpdate(),setTimeout(()=>{this.removeUpload(t)},5e3))}removeUpload(e){delete this.uploads[e],this.requestUpdate()}getStatusIcon(e){switch(e){case"uploading":default:return i.qy`<div class="status-icon uploading"></div>`;case"completed":return i.qy`<div class="status-icon completed"></div>`;case"error":return i.qy`<div class="status-icon error"></div>`}}getProgressFillClass(e){switch(e){case"completed":return"progress-fill completed";case"error":return"progress-fill error";default:return"progress-fill"}}render(){const e=Object.entries(this.uploads).map(e=>{let[t,s]=e;return i.qy`
310
312
  <div class="upload-item">
311
313
  <div class="upload-header">
312
314
  <span class="file-name" title="${s.fileName}">${s.fileName}</span>
@@ -331,22 +333,22 @@
331
333
  ${"uploading"===s.status?`${s.progress}%`:"completed"===s.status?"Upload completed":"error"===s.status?"Upload failed":""}
332
334
  </div>
333
335
 
334
- ${s.error?r.qy`
336
+ ${s.error?i.qy`
335
337
  <div class="error-message">
336
338
  ${s.error.message||s.error}
337
339
  </div>
338
340
  `:""}
339
341
  </div>
340
- `});return r.qy`
342
+ `});return i.qy`
341
343
  <div>
342
344
  ${e}
343
345
  </div>
344
- `}}h.styles=r.AH`
346
+ `}}h.styles=i.AH`
345
347
  :host {
346
348
  display: block;
347
349
  position: fixed;
348
350
  top: 20px;
349
- right: 20px;
351
+ inset-inline-end: 20px;
350
352
  z-index: 9999;
351
353
  max-width: 300px;
352
354
  }
@@ -447,7 +449,7 @@
447
449
  .progress-text {
448
450
  font-size: 12px;
449
451
  color: #666;
450
- text-align: right;
452
+ text-align: end;
451
453
  }
452
454
 
453
455
  .error-message {
@@ -473,7 +475,7 @@
473
475
  .close-btn:hover {
474
476
  color: #666;
475
477
  }
476
- `,h.properties={uploads:{type:Object}},customElements.define("cdtr-upload-loading",h);s(2590);class u extends r.WF{constructor(){super(),this.isVisible=!1,this.fileName="",this.status="uploading",this.progress=0,this.timeElapsed=0,this.pollInterval=null,this.timeoutId=null,this.progressInterval=null,this.startTime=null,this.maxDuration=3e4,this.pollFrequency=7e3}connectedCallback(){super.connectedCallback(),window.addEventListener("cdtr-upload-start",this.handleUploadStart.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.cleanup(),window.removeEventListener("cdtr-upload-start",this.handleUploadStart.bind(this))}handleUploadStart(e){console.log("Upload monitor received event:",e.detail);const{fileName:t,file:s}=e.detail;this.startUploadMonitor(t,s)}startUploadMonitor(e,t){console.log("Starting upload monitor for:",e),this.fileName=e,this.isVisible=!0,this.status="uploading",this.progress=0,this.timeElapsed=0,this.startTime=Date.now(),this.uploadedFile=t,console.log("Component should be visible now, isVisible:",this.isVisible),this.requestUpdate(),this.simulateUploadProgress(),setTimeout(()=>{this.status="checking",this.startPolling(),this.startTimeout()},this.pollFrequency)}simulateUploadProgress(){let e=0;this.progressInterval=setInterval(()=>{e+=15*Math.random(),e>=90&&(e=90,clearInterval(this.progressInterval),this.progressInterval=null),this.progress=Math.floor(e),this.requestUpdate()},300)}startPolling(){this.progress=100,this.status="completed",this.requestUpdate(),setTimeout(()=>{this.isVisible=!1,this.requestUpdate()},5e3)}startTimeout(){this.timeoutId=setTimeout(()=>{"completed"!==this.status&&this.handleTimeout()},this.maxDuration)}handleUploadSuccess(){this.cleanup(),this.status="completed",this.progress=100,this.requestUpdate(),setTimeout(()=>{this.isVisible=!1,this.requestUpdate()},2e3)}handleTimeout(){this.cleanup(),this.status="timeout",this.requestUpdate(),setTimeout(()=>{this.isVisible=!1,this.requestUpdate()},1e4)}cleanup(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.progressInterval&&(clearInterval(this.progressInterval),this.progressInterval=null)}getCircleProgress(){const e=2*Math.PI*26;return e-this.progress/100*e}renderContent(){switch(this.status){case"uploading":return r.qy`
478
+ `,h.properties={uploads:{type:Object}},customElements.define("cdtr-upload-loading",h);s(2590);class u extends i.WF{constructor(){super(),this.isVisible=!1,this.fileName="",this.status="uploading",this.progress=0,this.timeElapsed=0,this.pollInterval=null,this.timeoutId=null,this.progressInterval=null,this.startTime=null,this.maxDuration=3e4,this.pollFrequency=7e3}connectedCallback(){super.connectedCallback(),window.addEventListener("cdtr-upload-start",this.handleUploadStart.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.cleanup(),window.removeEventListener("cdtr-upload-start",this.handleUploadStart.bind(this))}handleUploadStart(e){console.log("Upload monitor received event:",e.detail);const{fileName:t,file:s}=e.detail;this.startUploadMonitor(t,s)}startUploadMonitor(e,t){console.log("Starting upload monitor for:",e),this.fileName=e,this.isVisible=!0,this.status="uploading",this.progress=0,this.timeElapsed=0,this.startTime=Date.now(),this.uploadedFile=t,console.log("Component should be visible now, isVisible:",this.isVisible),this.requestUpdate(),this.simulateUploadProgress(),setTimeout(()=>{this.status="checking",this.startPolling(),this.startTimeout()},this.pollFrequency)}simulateUploadProgress(){let e=0;this.progressInterval=setInterval(()=>{e+=15*Math.random(),e>=90&&(e=90,clearInterval(this.progressInterval),this.progressInterval=null),this.progress=Math.floor(e),this.requestUpdate()},300)}startPolling(){this.progress=100,this.status="completed",this.requestUpdate(),setTimeout(()=>{this.isVisible=!1,this.requestUpdate()},5e3)}startTimeout(){this.timeoutId=setTimeout(()=>{"completed"!==this.status&&this.handleTimeout()},this.maxDuration)}handleUploadSuccess(){this.cleanup(),this.status="completed",this.progress=100,this.requestUpdate(),setTimeout(()=>{this.isVisible=!1,this.requestUpdate()},2e3)}handleTimeout(){this.cleanup(),this.status="timeout",this.requestUpdate(),setTimeout(()=>{this.isVisible=!1,this.requestUpdate()},1e4)}cleanup(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.progressInterval&&(clearInterval(this.progressInterval),this.progressInterval=null)}getCircleProgress(){const e=2*Math.PI*26;return e-this.progress/100*e}renderContent(){switch(this.status){case"uploading":return i.qy`
477
479
  <div class="progress-circle">
478
480
  <svg class="progress-ring" width="60" height="60">
479
481
  <circle class="progress-ring-bg" cx="30" cy="30" r="26"></circle>
@@ -491,31 +493,31 @@
491
493
  <lang-text text="uploading"></lang-text>
492
494
  </div>
493
495
  <div class="file-name" title="${this.fileName}">${this.fileName}</div>
494
- `;case"checking":return r.qy`
496
+ `;case"checking":return i.qy`
495
497
  <div class="spinner"></div>
496
498
  <div class="status-text">
497
499
  <lang-text text="verifying"></lang-text>
498
500
  </div>
499
501
  <div class="file-name" title="${this.fileName}">${this.fileName}</div>
500
- `;case"completed":return r.qy`
502
+ `;case"completed":return i.qy`
501
503
  <div class="success-icon"></div>
502
504
  <div class="status-text">
503
505
  <lang-text text="completed"></lang-text>
504
506
  </div>
505
507
  <div class="file-name" title="${this.fileName}">${this.fileName}</div>
506
- `;case"timeout":return r.qy`
508
+ `;case"timeout":return i.qy`
507
509
  <div class="error-icon"></div>
508
510
  <div class="status-text"><lang-text text="timeout"></lang-text></div>
509
511
  <div class="file-name" title="${this.fileName}">${this.fileName}</div>
510
512
  <div style="font-size: 10px; color: #666; margin-top: 4px;">
511
513
  File may be uploaded. Refresh gallery.
512
514
  </div>
513
- `;default:return r.qy``}}render(){return console.log("Render called - isVisible:",this.isVisible,"status:",this.status,"progress:",this.progress),this.isVisible?r.qy` <div class="upload-card">${this.renderContent()}</div> `:r.qy``}}u.styles=r.AH`
515
+ `;default:return i.qy``}}render(){return console.log("Render called - isVisible:",this.isVisible,"status:",this.status,"progress:",this.progress),this.isVisible?i.qy` <div class="upload-card">${this.renderContent()}</div> `:i.qy``}}u.styles=i.AH`
514
516
  :host {
515
517
  display: block;
516
518
  position: fixed;
517
519
  bottom: 20px;
518
- left: 20px;
520
+ inset-inline-start: 20px;
519
521
  z-index: 10000;
520
522
  }
521
523
 
@@ -575,7 +577,7 @@
575
577
  .progress-text {
576
578
  position: absolute;
577
579
  top: 50%;
578
- left: 50%;
580
+ inset-inline-start: 50%;
579
581
  transform: translate(-50%, -50%);
580
582
  font-size: 14px;
581
583
  font-weight: 600;
@@ -665,7 +667,7 @@
665
667
  color: white;
666
668
  font-weight: bold;
667
669
  }
668
- `,u.properties={isVisible:{type:Boolean},fileName:{type:String},status:{type:String},progress:{type:Number},timeElapsed:{type:Number}},customElements.define("cdtr-upload-progress-monitor",u);var f=s(18396),m=s(13681);class g extends r.WF{constructor(){super(),this.sortBy="ASC",this.files=[],this.folders=[],this.uploadStatus={},this.onSearch=this.onSearch.bind(this),this.close=this.close.bind(this),this.reset=this.reset.bind(this);const e=new f.A;this.eventEmitter=e;const t=o.M.get("config","editor","configure","mediaGalleryManager");e.files=this.files,e.close=this.close,"function"==typeof t&&(e.render=this.reset,console.log("init mediaGalleryManager"),t(e)),this.reset()}reset(){this.dirId=null,this.eventEmitter.dispatch("load-folders",{resolve:e=>{this.folders=e}}),this.eventEmitter.dispatch("load-files",{resolve:e=>{this.files=Array.isArray(e)?[...e]:[]}})}uploadFile(e){this.folders||(this.folders=[]);const t=e.detail,s=this.folders.find(e=>e.selected),r=`${t.name}-${Date.now()}`;this.uploadStatus[r]={fileName:t.name,status:"uploading",progress:0,error:null},console.log("Dispatching cdtr-upload-start event for:",t.name),this.dispatchEvent(new CustomEvent("cdtr-upload-start",{detail:{uploadId:r,fileName:t.name,file:t},bubbles:!0,composed:!0})),console.log("Event dispatched"),this.eventEmitter.dispatch("upload-file",{file:t,dirId:s?s.id:null,uploadId:r,execCommand:(e,t)=>{o.M.get("editor").store().execCommand(e,t)},options:{},onProgress:e=>{this.uploadStatus[r]&&(this.uploadStatus[r].progress=e,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("upload-progress",{detail:{uploadId:r,fileName:t.name,progress:e},bubbles:!0,composed:!0})))},onComplete:e=>{this.uploadStatus[r]&&(this.uploadStatus[r].status="completed",this.uploadStatus[r].progress=100,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("cdtr-upload-complete",{detail:{uploadId:r,fileName:t.name,result:e},bubbles:!0,composed:!0})),setTimeout(()=>{delete this.uploadStatus[r],this.requestUpdate("uploadStatus")},3e3))},onError:e=>{this.uploadStatus[r]&&(this.uploadStatus[r].status="error",this.uploadStatus[r].error=e,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("cdtr-upload-error",{detail:{uploadId:r,fileName:t.name,error:e},bubbles:!0,composed:!0})),setTimeout(()=>{delete this.uploadStatus[r],this.requestUpdate("uploadStatus")},5e3))}}),this.opened=!1}onSearch(e){const{value:t,isLiked:s}=e.detail;s?this.eventEmitter.dispatch("load-files",{isLiked:s,resolve:e=>{Array.isArray(e)?this.files=[...e]:console.error("files is not array",e)}}):t.trim().length>2?this.eventEmitter.dispatch("load-files",{filter:"name",search:t,resolve:e=>{this.files=Array.isArray(e)?[...e]:[]}}):0===t.trim().length&&this.reset()}onFilter(e){const t=e.detail;this.eventEmitter.dispatch("load-files",{filter:"name",search:t.value})}onSelectFolder(e){const t=e.detail,s=this.sortBy,r=t.id;this.dirId=r,this.eventEmitter.dispatch("load-files",{filter:"dir",dirId:r,sortBy:s,resolve:e=>{this.files=e}})}oncreateNewFolder(e){const t=e.detail;this.eventEmitter.dispatch("create-folder",{name:t,resolve:e=>{this.folders||(this.folders=[]);const t=[...this.folders];t.forEach(e=>e.selected=!1),e.selected=!0,t.unshift(e),this.folders=t,this.onSelectFolder({detail:e})}})}onMoveFile(e){const t=e.detail;this.eventEmitter.dispatch("on-move-file",{data:t,resolve:e=>{if(this.folders||(this.folders=[]),this.dirId===t.folderId)return;const s=this.files.findIndex(e=>e.id===t.fileId);if(-1!==s){const e=[...this.files];e[s].moved=!0,this.files=e}const r=this.folders.findIndex(e=>e.id===t.folderId);if(-1!==r){const e=[...this.folders];e[r].file_count+=1,this.folders=e}}})}onLike(e){const t=e.detail;this.eventEmitter.dispatch("on-like",{fileId:t.id,resolve:e=>{const s=this.files.findIndex(e=>e.id===t.id);if(-1!==s){const e=[...this.files];e[s].isLiked=!e[s].isLiked,this.files=e}}})}onselectFile(e){const t={detail:e.detail,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}close(){this.dispatchEvent(new CustomEvent("close",{}))}onDleteFile(e){const t=e.detail;this.eventEmitter.dispatch("delete-file",{id:t.id,type:"image",resolve:e=>{const s=this.files.findIndex(e=>e.id===t.id);if(-1!==s){const e=[...this.files];e.splice(s,1),this.files=e}}})}onLoadMore(){this.eventEmitter.dispatch("lazy-load-files-on-scroll",{resolve:e=>{if(Array.isArray(e)&&e.length>0){const t=[...this.files,...e];this.files=t}}})}onDeleteFolder(e){const t=e.detail;this.eventEmitter.dispatch("delete-folder",{id:t.id,resolve:e=>{this.folders||(this.folders=[]);const s=this.folders.findIndex(e=>e.id===t.id);if(-1!==s){const e=[...this.folders];e.splice(s,1),this.folders=e}}})}connectedCallback(){super.connectedCallback(),m.vP.on("on:upload-file","gallery:on:upload-file",async e=>{let{image:t,type:s}=e;if("base64"===s){const e=t.split(",")[1]||t,s=atob(e),r=new Array(s.length);for(let e=0;e<s.length;e++)r[e]=s.charCodeAt(e);const i=new Uint8Array(r),o=new Blob([i],{type:"image/png"}),a=new File([o],"uploaded-image.png",{type:"image/png"});this.uploadFile({detail:a})}else if("url"===s){const e=await fetch(t),s=await e.blob(),r=new File([s],"uploaded-image.png",{type:s.type||"image/png"});this.uploadFile({detail:r})}})}render(){return r.qy`
670
+ `,u.properties={isVisible:{type:Boolean},fileName:{type:String},status:{type:String},progress:{type:Number},timeElapsed:{type:Number}},customElements.define("cdtr-upload-progress-monitor",u);var m=s(18396),f=s(13681);const g={upload:"Upload Image",myImages:"My Images",favorites:"Favorites",freeImages:"Free images",search:"Search",newFolder:"New Folder",main:"Main",noImagesYet:"No images yet",uploadOrPickImages:"Upload an image or browse free stock.",choose:"Choose",addFolder:"Add folder",folderName:"Folder name","yes,Create":"Yes, Create",aToZ:"A-Z",zToA:"Z-A",folders:"Folders",images:"Images",savedSuccess:"Saved successfully",refresh:"Refresh",loading:"Loading…",loadingMore:"Loading more images...",uploading:"Uploading...",verifying:"Verifying...",completed:"Completed!",timeout:"Upload timeout"};let v=!1;class b extends i.WF{constructor(){super(),function(){if(v)return;v=!0;const e=o.M.get("lang")||{};Object.keys(g).some(t=>!(t in e))&&o.M.set({lang:{...g,...e}})}(),this.sortBy="ASC",this.files=[],this.folders=[],this.uploadStatus={},this.onSearch=this.onSearch.bind(this),this.close=this.close.bind(this),this.reset=this.reset.bind(this);const e=new m.A;this.eventEmitter=e,e.files=this.files,e.close=this.close;const t=this._manager||o.M.get("config","editor","configure","mediaGalleryManager");this._wireManager(t),this.reset()}get manager(){return this._manager}set manager(e){this._manager=e,this._wireManager(e),this.eventEmitter&&this.reset()}_wireManager(e){"function"==typeof e&&(this.eventEmitter.render=this.reset,console.log("init mediaGalleryManager"),e(this.eventEmitter))}get labels(){return this._labels}set labels(e){this._labels=e,e&&Object.keys(e).length>0&&o.M.set({lang:{...o.M.get("lang")||{},...e}})}reset(){this.dirId=null,this.eventEmitter.dispatch("load-folders",{resolve:e=>{this.folders=e}}),this.eventEmitter.dispatch("load-files",{resolve:e=>{this.files=Array.isArray(e)?[...e]:[]}})}uploadFile(e){this.folders||(this.folders=[]);const t=e.detail,s=this.folders.find(e=>e.selected),i=`${t.name}-${Date.now()}`;this.uploadStatus[i]={fileName:t.name,status:"uploading",progress:0,error:null},console.log("Dispatching cdtr-upload-start event for:",t.name),this.dispatchEvent(new CustomEvent("cdtr-upload-start",{detail:{uploadId:i,fileName:t.name,file:t},bubbles:!0,composed:!0})),console.log("Event dispatched"),this.eventEmitter.dispatch("upload-file",{file:t,dirId:s?s.id:null,uploadId:i,execCommand:(e,t)=>{const s=o.M.get("editor");s&&"function"==typeof s.store&&s.store().execCommand(e,t)},options:{},onProgress:e=>{this.uploadStatus[i]&&(this.uploadStatus[i].progress=e,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("upload-progress",{detail:{uploadId:i,fileName:t.name,progress:e},bubbles:!0,composed:!0})))},onComplete:e=>{this.uploadStatus[i]&&(this.uploadStatus[i].status="completed",this.uploadStatus[i].progress=100,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("cdtr-upload-complete",{detail:{uploadId:i,fileName:t.name,result:e},bubbles:!0,composed:!0})),setTimeout(()=>{delete this.uploadStatus[i],this.requestUpdate("uploadStatus")},3e3))},onError:e=>{this.uploadStatus[i]&&(this.uploadStatus[i].status="error",this.uploadStatus[i].error=e,this.requestUpdate("uploadStatus"),this.dispatchEvent(new CustomEvent("cdtr-upload-error",{detail:{uploadId:i,fileName:t.name,error:e},bubbles:!0,composed:!0})),setTimeout(()=>{delete this.uploadStatus[i],this.requestUpdate("uploadStatus")},5e3))}}),this.opened=!1}onSearch(e){const{value:t,isLiked:s}=e.detail;s?this.eventEmitter.dispatch("load-files",{isLiked:s,resolve:e=>{Array.isArray(e)?this.files=[...e]:console.error("files is not array",e)}}):t.trim().length>2?this.eventEmitter.dispatch("load-files",{filter:"name",search:t,resolve:e=>{this.files=Array.isArray(e)?[...e]:[]}}):0===t.trim().length&&this.reset()}onFilter(e){const t=e.detail;this.eventEmitter.dispatch("load-files",{filter:"name",search:t.value})}onSelectFolder(e){const t=e.detail,s=this.sortBy,i=t.id;this.dirId=i,this.eventEmitter.dispatch("load-files",{filter:"dir",dirId:i,sortBy:s,resolve:e=>{this.files=e}})}oncreateNewFolder(e){const t=e.detail;this.eventEmitter.dispatch("create-folder",{name:t,resolve:e=>{this.folders||(this.folders=[]);const t=[...this.folders];t.forEach(e=>e.selected=!1),e.selected=!0,t.unshift(e),this.folders=t,this.onSelectFolder({detail:e})}})}onMoveFile(e){const t=e.detail;this.eventEmitter.dispatch("on-move-file",{data:t,resolve:e=>{if(this.folders||(this.folders=[]),this.dirId===t.folderId)return;const s=this.files.findIndex(e=>e.id===t.fileId);if(-1!==s){const e=[...this.files];e[s].moved=!0,this.files=e}const i=this.folders.findIndex(e=>e.id===t.folderId);if(-1!==i){const e=[...this.folders];e[i].file_count+=1,this.folders=e}}})}onLike(e){const t=e.detail;this.eventEmitter.dispatch("on-like",{fileId:t.id,resolve:e=>{const s=this.files.findIndex(e=>e.id===t.id);if(-1!==s){const e=[...this.files];e[s].isLiked=!e[s].isLiked,this.files=e}}})}onselectFile(e){const t={detail:e.detail,bubbles:!1,composed:!1};this.dispatchEvent(new CustomEvent("file",t))}close(){this.dispatchEvent(new CustomEvent("close",{}))}onDleteFile(e){const t=e.detail;this.eventEmitter.dispatch("delete-file",{id:t.id,type:"image",resolve:e=>{const s=this.files.findIndex(e=>e.id===t.id);if(-1!==s){const e=[...this.files];e.splice(s,1),this.files=e}}})}onLoadMore(){this.eventEmitter.dispatch("lazy-load-files-on-scroll",{resolve:e=>{if(Array.isArray(e)&&e.length>0){const t=[...this.files,...e];this.files=t}}})}onDeleteFolder(e){const t=e.detail;this.eventEmitter.dispatch("delete-folder",{id:t.id,resolve:e=>{this.folders||(this.folders=[]);const s=this.folders.findIndex(e=>e.id===t.id);if(-1!==s){const e=[...this.folders];e.splice(s,1),this.folders=e}}})}connectedCallback(){super.connectedCallback(),f.vP.on("on:upload-file","gallery:on:upload-file",async e=>{let{image:t,type:s}=e;if("base64"===s){const e=t.split(",")[1]||t,s=atob(e),i=new Array(s.length);for(let e=0;e<s.length;e++)i[e]=s.charCodeAt(e);const r=new Uint8Array(i),o=new Blob([r],{type:"image/png"}),a=new File([o],"uploaded-image.png",{type:"image/png"});this.uploadFile({detail:a})}else if("url"===s){const e=await fetch(t),s=await e.blob(),i=new File([s],"uploaded-image.png",{type:s.type||"image/png"});this.uploadFile({detail:i})}})}render(){return i.qy`
669
671
  <cdtr-upload-loading></cdtr-upload-loading>
670
672
  <cdtr-upload-progress-monitor></cdtr-upload-progress-monitor>
671
673
  <cdtr-drawer
@@ -693,9 +695,9 @@
693
695
  .multi=${this.multi}
694
696
  .folders=${this.folders}
695
697
  ></cdtr-gallery-files>
696
- </cdtr-drawer>`}}g.styles=r.AH``,g.properties={folders:{type:Array},files:{type:Array},pageCount:{type:Number},prevUrl:{type:String},nextUrl:{type:String},opened:{type:Boolean},multi:{type:Boolean},uploadStatus:{type:Object}},customElements.define("cdtr-gallery",g)},2590(e,t,s){s.r(t),s.d(t,{TitleEditor:()=>o});var r=s(59929),i=s(86319);class o extends r.WF{constructor(){super(),this.text="",this.whiteSpace="pre"}connectedCallback(){super.connectedCallback(),this.style.fontFamily="var(--font-sans)",this.bold&&(this.style.fontWeight="bold"),this._onStoreChange=()=>this.requestUpdate(),i.M.connect(["lang","theme"],this._onStoreChange)}disconnectedCallback(){this._onStoreChange&&(i.M.disconnect(this._onStoreChange),this._onStoreChange=null),super.disconnectedCallback()}render(){const e=i.M.get("theme");e&&(this.style.direction=e.direction,this.style.textAlign=this.textAlign||e.textAlign);const t=i.M.get("lang",this.text);return r.qy`<slot
698
+ </cdtr-drawer>`}}b.styles=i.AH``,b.properties={folders:{type:Array},files:{type:Array},pageCount:{type:Number},prevUrl:{type:String},nextUrl:{type:String},opened:{type:Boolean},multi:{type:Boolean},uploadStatus:{type:Object}},customElements.define("cdtr-gallery",b)},2590(e,t,s){s.r(t),s.d(t,{TitleEditor:()=>o});var i=s(59929),r=s(86319);class o extends i.WF{constructor(){super(),this.text="",this.whiteSpace="pre"}connectedCallback(){super.connectedCallback(),this.style.fontFamily="var(--font-sans)",this.bold&&(this.style.fontWeight="bold"),this._onStoreChange=()=>this.requestUpdate(),r.M.connect(["lang","theme"],this._onStoreChange)}disconnectedCallback(){this._onStoreChange&&(r.M.disconnect(this._onStoreChange),this._onStoreChange=null),super.disconnectedCallback()}render(){const e=r.M.get("theme");e&&(this.style.direction=e.direction,this.style.textAlign=this.textAlign||e.textAlign);const t=r.M.get("lang",this.text);return i.qy`<slot
697
699
  ><span
698
700
  style="-webkit-font-smoothing: antialiased;display:inline-block;direction:var(--direction-locale);text-align:var(--text-align-locale);white-space:${this.whiteSpace}"
699
701
  >${t||this.text}</span
700
702
  ></slot
701
- >`}}o.properties={text:{type:String,reflect:!1},whiteSpace:{type:String},textAlign:{type:String},bold:{type:Boolean}},customElements.get("lang-text")||customElements.define("lang-text",o)},13681(e,t,s){s.d(t,{vP:()=>c});const r=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=r,window[r]||(window[r]={});const i=window[r],o=window.__cdtrEvents||{};function a(e){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)).then(e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join(""))}function l(e){if(e.length%2!=0)throw new Error("Invalid hex string");const t=new Uint8Array(e.length/2);for(let s=0;s<e.length;s+=2)t[s/2]=parseInt(e.substr(s,2),16);return t}async function n(e){const t=await a(e),s=i[t];if(s){const e=await crypto.subtle.importKey("raw",l(t),{name:"AES-GCM"},!1,["encrypt","decrypt"]),r=await async function(e,t,s){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,s);return(new TextDecoder).decode(r)}(e,s.iv,s.encrypted);return JSON.parse(r)}return null}function d(e,t){if(o[e])for(const s in o[e])Object.prototype.hasOwnProperty.call(o[e],s)&&o[e][s].forEach(e=>e(t));Array.isArray(o["*"])&&o["*"].forEach(e=>e(t))}window.__cdtrEvents=o;const c={set:async function(e,t){const s=JSON.parse(JSON.stringify(t)),r=await a(e),n=await crypto.subtle.importKey("raw",l(r),{name:"AES-GCM"},!1,["encrypt","decrypt"]),c=await async function(e,t){const s=crypto.getRandomValues(new Uint8Array(12)),r=(new TextEncoder).encode(t),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},e,r);return{iv:s,encrypted:new Uint8Array(i)}}(n,JSON.stringify(s));i[r]=c,o.set&&o.set[r]&&o.set[r].forEach(e=>e(s)),Array.isArray(o["*"])&&o["*"].forEach(e=>e(s)),d(e,s)},get:n,remove:async function(e){const t=await a(e);delete i[t]},on:async function(e,t,s){o[e]||(o[e]={});const r=await a(t);o[e][r]||(o[e][r]=[]),o[e][r].push(e=>{!function(){const e=(new Error).stack;if(e&&e.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),s(e)});const i=await n(t);return i&&s(i),r},off:function(e,t){o[e]&&o[e][t]&&delete o[e][t]},dispatch:d,OPTIONS:{SET:"set"}}}}]);
703
+ >`}}o.properties={text:{type:String,reflect:!1},whiteSpace:{type:String},textAlign:{type:String},bold:{type:Boolean}},customElements.get("lang-text")||customElements.define("lang-text",o)},13681(e,t,s){s.d(t,{vP:()=>c});const i=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=i,window[i]||(window[i]={});const r=window[i],o=window.__cdtrEvents||{};function a(e){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)).then(e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join(""))}function l(e){if(e.length%2!=0)throw new Error("Invalid hex string");const t=new Uint8Array(e.length/2);for(let s=0;s<e.length;s+=2)t[s/2]=parseInt(e.substr(s,2),16);return t}async function n(e){const t=await a(e),s=r[t];if(s){const e=await crypto.subtle.importKey("raw",l(t),{name:"AES-GCM"},!1,["encrypt","decrypt"]),i=await async function(e,t,s){const i=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,s);return(new TextDecoder).decode(i)}(e,s.iv,s.encrypted);return JSON.parse(i)}return null}function d(e,t){if(o[e])for(const s in o[e])Object.prototype.hasOwnProperty.call(o[e],s)&&o[e][s].forEach(e=>e(t));Array.isArray(o["*"])&&o["*"].forEach(e=>e(t))}window.__cdtrEvents=o;const c={set:async function(e,t){const s=JSON.parse(JSON.stringify(t)),i=await a(e),n=await crypto.subtle.importKey("raw",l(i),{name:"AES-GCM"},!1,["encrypt","decrypt"]),c=await async function(e,t){const s=crypto.getRandomValues(new Uint8Array(12)),i=(new TextEncoder).encode(t),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},e,i);return{iv:s,encrypted:new Uint8Array(r)}}(n,JSON.stringify(s));r[i]=c,o.set&&o.set[i]&&o.set[i].forEach(e=>e(s)),Array.isArray(o["*"])&&o["*"].forEach(e=>e(s)),d(e,s)},get:n,remove:async function(e){const t=await a(e);delete r[t]},on:async function(e,t,s){o[e]||(o[e]={});const i=await a(t);o[e][i]||(o[e][i]=[]),o[e][i].push(e=>{!function(){const e=(new Error).stack;if(e&&e.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),s(e)});const r=await n(t);return r&&s(r),i},off:function(e,t){o[e]&&o[e][t]&&delete o[e][t]},dispatch:d,OPTIONS:{SET:"set"}}}}]);
Binary file