@creaditor/web-starterkit 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PUBLISH-HOOK.md +136 -0
- package/README.md +8 -0
- package/dist/2765.creaditor.bundle.js +1 -1
- package/dist/2765.creaditor.bundle.js.gz +0 -0
- package/dist/3418.creaditor.bundle.js +1 -1
- package/dist/3418.creaditor.bundle.js.gz +0 -0
- package/dist/380.creaditor.bundle.js +7 -5
- package/dist/380.creaditor.bundle.js.gz +0 -0
- package/dist/3847.creaditor.bundle.js +40 -26
- package/dist/3847.creaditor.bundle.js.gz +0 -0
- package/dist/5119.creaditor.bundle.js +15 -1
- package/dist/5119.creaditor.bundle.js.gz +0 -0
- package/dist/5909.creaditor.bundle.js +6 -6
- package/dist/5909.creaditor.bundle.js.gz +0 -0
- package/dist/823.creaditor.bundle.js +1 -0
- package/dist/823.creaditor.bundle.js.gz +0 -0
- package/dist/8547.creaditor.bundle.js +1 -1
- package/dist/8547.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +327 -167
- package/dist/creaditor.bundle.js.gz +0 -0
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.gz +0 -0
- package/package.json +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
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:()=>
|
|
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:()=>b,PUBLISH_ERROR_EVENT:()=>g,PUBLISH_EVENT:()=>f});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"
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
@keyframes spin {
|
|
339
339
|
to { transform: rotate(360deg); }
|
|
340
340
|
}
|
|
341
|
-
`,p.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",p);var h=i(65550);class
|
|
341
|
+
`,p.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",p);var h=i(65550);class u extends o.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,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}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer)}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(),p=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(p):t.clearRect(0,0,o,s)};this.raf=requestAnimationFrame(p)}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`
|
|
342
342
|
<div class="preview">
|
|
343
343
|
<p class="preview-caption">${this.t("search_preview_label","How your page will look on Google")}</p>
|
|
344
344
|
<div class="result-head">
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
</div>
|
|
378
378
|
`:o.s6}
|
|
379
379
|
</div>
|
|
380
|
-
`}}
|
|
380
|
+
`}}u.styles=o.AH`
|
|
381
381
|
:host {
|
|
382
382
|
position: fixed;
|
|
383
383
|
inset: 0;
|
|
@@ -582,7 +582,7 @@
|
|
|
582
582
|
width: 15px;
|
|
583
583
|
height: 15px;
|
|
584
584
|
}
|
|
585
|
-
`,
|
|
585
|
+
`,u.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",u);const f="creaditor:publish",g="creaditor:publish-error";class b 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 p.open(),o)){this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t){const e=this.showBuildingLoader();let t=!1;try{i&&o&&(await(0,n.YE)({seo:o}),await(0,n.bK)({})),"function"==typeof this.onPublish?t=await this.runHostPublish(this.onPublish,o,i,e):"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:o??void 0})}finally{e()}return void(t||(this.emitPublished(i,o),this.celebratePublish(o)))}"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2}),this.emitPublished(i,o)}catch(e){console.error("Error in publish/onNextStep:",e),this.emitPublishError(i,o,e),this.snackbar(s.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}}runHostPublish(e,t,i,o){var a=this;return new Promise(l=>{let c=!1,d=o;const p=function(){arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?(d?.(),d=null):d||(d=a.showBuildingLoader())},h=(e,o,r)=>{c||(c=!0,clearTimeout(u),p(!1),e?(this.celebratePublish(t),this.emitPublished(i,t)):(this.snackbar(r||s.M.get("lang","publishError")||"Publish failed"),this.emitPublishError(i,t,o)),l(!0))},u=setTimeout(()=>{c||(console.warn("config.onPublish never signalled completion — finishing the publish without it. Call success() or error() (or return a promise) so the loader can come down."),c=!0,p(!1),l(!1))},6e4),f={title:t.title,description:t.description,keywords:t.keywords},g={loading:p,success:()=>h(!0),confetti:()=>h(!0),error:e=>h(!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 b;try{b=e(f,g)}catch(e){return console.error("Error in config.onPublish:",e),void h(!1,e)}b&&"function"==typeof b.then&&Promise.resolve(b).then(()=>h(!0),e=>{console.error("Error in config.onPublish:",e),h(!1,e)})})}snackbar(e){const t=s.M.get("commands");t?.snackbar?.(e)}showBuildingLoader(){const e=(0,h.A)();document.body.appendChild(e);let t=!1;return()=>{t||(t=!0,e.style.transition="opacity 300ms ease",e.style.opacity="0",e.style.pointerEvents="none",setTimeout(()=>e.remove(),320))}}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(f,{detail:i}))}emitPublishError(e,t,i){const o={channel:this.channel,selfPublish:e,seo:t??void 0,error:i};window.dispatchEvent(new CustomEvent(g,{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`
|
|
586
586
|
<paper-button
|
|
587
587
|
@click=${this.handleClick}
|
|
588
588
|
class="next-button"
|
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
</div>
|
|
597
597
|
`}
|
|
598
598
|
</paper-button>
|
|
599
|
-
`}}
|
|
599
|
+
`}}b.styles=o.AH`
|
|
600
600
|
:host {
|
|
601
601
|
display: block;
|
|
602
602
|
}
|
|
@@ -648,4 +648,4 @@
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
|
|
651
|
-
`,
|
|
651
|
+
`,b.properties={onNextStep:{type:Function},onPublish:{type:Function},channel:{type:String},isLoading:{type:Boolean},isLocked:{type:Boolean},lockTimer:{type:Number}},customElements.define("cdtr-next-button",b)}}]);
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[823],{30823(e,t,n){n.d(t,{default:()=>B});var a=n(61919),i=n(79795),o=n(29180);const l=[{value:"dot",label:"ask_ai_variant_dot"},{value:"pill",label:"ask_ai_variant_pill"},{value:"plain",label:"ask_ai_variant_plain"}],r=e=>{const{component:t,commands:n}=e;return{select:e=>{let{changeTab:t,tab:n}=e;n.text||t("content")},tabs:e=>{const t=[{text:"content",selected:!0},{text:"engines"},{text:"style"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:r}=e;const s=()=>"content"===r.text,p=()=>"engines"===r.text,c=()=>"style"===r.text,d=t.props.prompt||"",A=t.props.variant||"dot",m=(0,o.x8)(t.props);var u,g;return[{type:"info",active:s,text:"ask_ai_external_notice"},{type:"heading",level:6,text:"ask_ai_prompt",active:s},{type:"info",active:s,text:"ask_ai_placeholders_hint"},{type:"input",title:"ask_ai_prompt",multiline:!0,row:16,active:s,value:d,onDebounce:e=>{n.execCommand("prompt",e.target.value)}},{type:"info",active:()=>s()&&(0,o.Jq)(d,m).length>o.Ep,text:"ask_ai_prompt_too_long"},{type:"heading",level:6,text:"ask_ai_engines",active:p},...i.ug.map(e=>({type:"checkbox",title:e.label,active:p,checked:(t.props.engines||[]).includes(e.key),onChange:a=>((e,a)=>{const o=t.props.engines||[],l=i.ug.map(e=>e.key).filter(t=>t===e?a:o.includes(t));l.length&&n.execCommand("engines",l)})(e.key,!!a.target.checked)})),{type:"dropdown",title:"ask_ai_variant",active:c,value:l.find(e=>e.value===A)?.label,selected:A,items:l,onChange:e=>n.execCommand("variant",e.target.value)},{type:"input",title:"ask_ai_leading_text",active:c,value:t.props.leadingText||"",onDebounce:e=>n.execCommand("leadingText",e.target.value)},{type:"slider",title:"size",min:16,max:96,active:c,value:parseInt(t.props.iconSize,10)||34,onInput:e=>n.execCommand("iconSize",e.target.value)},{type:"slider",title:"spacing",min:0,max:60,active:c,value:parseFloat(t.props.style?.gap)||0,onInput:e=>n.execCommand("style",{gap:e.target.value+"px"})},{type:"justifyContent",active:c,value:t.props.style?.justifyContent||"flex-start",onChange:e=>n.execCommand("style",{justifyContent:e.target.value})},{type:"divider",active:c},{type:"checkbox",title:"ask_ai_brand_colors",active:c,checked:!t.props.iconColor,onChange:e=>n.execCommand("iconColor",e.target.checked?"":"000000")},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>c()&&!!t.props.iconColor,value:(u=t.props.iconColor,g="#000000",u?u.startsWith("#")?u:"#"+u:g),onChange:e=>{const t=(0,a.A)(e.target.value).toHex();n.execCommand("iconColor",t)}},{type:"colorpicker",title:"backgroundColor",active:()=>c()&&"plain"!==t.props.variant,value:t.props.bgColor||"#f2f2f2",onChange:e=>n.execCommand("bgColor",e.target.value)},{type:"colorpicker",title:"color",active:()=>c()&&("pill"===t.props.variant||!!t.props.leadingText),value:t.props.textColor||"#000000",onChange:e=>n.execCommand("textColor",e.target.value)}]}}},s=e=>{let{helpers:t}=e;return{set:(e,n,a)=>{switch(n){case"style":return e[n]=t.deepMerge(e[n],a),!0;case"engines":return!!Array.isArray(a)&&(e[n]=a.filter(e=>"string"==typeof e),!0);case"items":return!!Array.isArray(a)&&(e[n]=a,!0);case"iconSize":return e[n]=Math.min(128,Math.max(12,parseInt(a,10)||34)),!0;case"variant":return!!["dot","pill","plain"].includes(a)&&(e[n]=a,!0);case"prompt":case"leadingText":case"itemAriaLabel":case"iconColor":case"bgColor":case"textColor":case"pageUrl":case"pageTitle":case"pageDescription":case"businessName":return e[n]=a,!0}return!1}}};var p=n(72591),c=n.n(p),d=n(88639),A=n.n(d),m=n(88128),u=n.n(m),g=n(30855),C=n.n(g),h=n(93051),x=n.n(h),v=n(49606),y={};y.setAttributes=C(),y.insert=u().bind(null,"head"),y.domAPI=A(),y.insertStyleElement=x();c()(v.A,y);const f=v.A&&v.A.locals?v.A.locals:void 0;var E=n(40856);const b="ask-ai",B=()=>({name:b,create:e=>{let{createElement:t,compose:n,helpers:a}=e;const l=document.createElement("div"),p=document.createElement("div");p.classList.add(f.root),l.appendChild(p);return t({name:b,id:n.id,template:l,defaultProps:{style:{gap:"10px",justifyContent:"flex-start"},variant:"dot",engines:i.up,prompt:(0,o.Mc)(),iconSize:34,iconColor:"",bgColor:"#f2f2f2",textColor:"",leadingText:"",itemAriaLabel:"Ask {{engine}} about this page",items:[]},draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=n.props,t=(0,E.z)(e);for((0,E.S)(t,e.items)||setTimeout(()=>{n.editor?.updateComponent?.(n.id,"items",t)},0);p.firstChild;)p.removeChild(p.firstChild);if(a.mergeDiff(p,{style:e.style}),e.leadingText){const t=document.createElement("span");t.classList.add(f.leading),t.textContent=e.leadingText,e.textColor&&(t.style.color=e.textColor),p.appendChild(t)}t.forEach(t=>p.appendChild(((e,t)=>{const n=document.createElement("a");n.classList.add(f.item),"dot"===t.variant&&n.classList.add(f.dot),"pill"===t.variant&&n.classList.add(f.pill),n.setAttribute("data-id",e.id),n.href=e.href,n.target="_blank",n.rel="noopener noreferrer",n.setAttribute("aria-label",(t.itemAriaLabel||"Ask {{engine}} about this page").replace("{{engine}}",e.label)),n.title=e.label,"plain"!==t.variant&&t.bgColor&&(n.style.backgroundColor=t.bgColor),t.textColor&&(n.style.color=t.textColor);const a=document.createElement("img");a.src=e.src,a.alt="",a.setAttribute("aria-hidden","true");const i=(parseInt(t.iconSize,10)||34)+"px";if(a.style.width=i,a.style.height=i,n.appendChild(a),"pill"===t.variant){const t=document.createElement("span");t.classList.add(f.label),t.textContent=e.label,n.appendChild(t)}return n.addEventListener("click",e=>e.preventDefault()),n})(t,e)))},handleBar:!0,validator:s({helpers:a}),schema:n.schema,onSelect:e=>{l.classList.add(e)},onDeselect:e=>{l.classList.remove(e)},elementProps:n,remove:()=>{l.remove()},createEditor:r})}})},49606(e,t,n){n.d(t,{A:()=>r});var a=n(82001),i=n.n(a),o=n(40935),l=n.n(o)()(i());l.push([e.id,'.icTm1UFc5X5A8tag7W_Q {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.WiVzPdjkN11lPSsmSGBB {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n text-decoration: none;\n line-height: 0;\n transition: transform 0.15s ease, opacity 0.15s ease;\n}\n\n.WiVzPdjkN11lPSsmSGBB:hover {\n transform: translateY(-1px);\n opacity: 0.85;\n}\n\n/* "dot" variant — the circular chip the pattern is usually seen as. */\n._lQONL1oIiZTe42CyXuB {\n border-radius: 999px;\n padding: 8px;\n line-height: 0;\n}\n\n/* "pill" variant — icon plus the engine name. */\n.bTqTp8uamOPSh67_0QtJ {\n border-radius: 999px;\n padding: 6px 14px 6px 10px;\n line-height: 1;\n font-size: 14px;\n}\n\n.fY4pheZcfQxg8DP_HYgE {\n /* Inherits the block\'s font; only the icon is sized by iconSize. */\n white-space: nowrap;\n}\n\n.cnAwK9OBcEyRXbAuQ14D {\n white-space: nowrap;\n}\n\n.SCB1TtYJtUVEle7tVBiu {\n outline: 2px solid #1a73e8;\n outline-offset: 2px;\n}\n',"",{version:3,sources:["webpack://./../web-editors/ask-ai-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,SAAS;AACX;;AAEA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,uBAAuB;EACvB,QAAQ;EACR,qBAAqB;EACrB,cAAc;EACd,oDAAoD;AACtD;;AAEA;EACE,2BAA2B;EAC3B,aAAa;AACf;;AAEA,sEAAsE;AACtE;EACE,oBAAoB;EACpB,YAAY;EACZ,cAAc;AAChB;;AAEA,gDAAgD;AAChD;EACE,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,eAAe;AACjB;;AAEA;EACE,mEAAmE;EACnE,mBAAmB;AACrB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,0BAA0B;EAC1B,mBAAmB;AACrB",sourcesContent:['.root {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.item {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n text-decoration: none;\n line-height: 0;\n transition: transform 0.15s ease, opacity 0.15s ease;\n}\n\n.item:hover {\n transform: translateY(-1px);\n opacity: 0.85;\n}\n\n/* "dot" variant — the circular chip the pattern is usually seen as. */\n.dot {\n border-radius: 999px;\n padding: 8px;\n line-height: 0;\n}\n\n/* "pill" variant — icon plus the engine name. */\n.pill {\n border-radius: 999px;\n padding: 6px 14px 6px 10px;\n line-height: 1;\n font-size: 14px;\n}\n\n.label {\n /* Inherits the block\'s font; only the icon is sized by iconSize. */\n white-space: nowrap;\n}\n\n.leading {\n white-space: nowrap;\n}\n\n.selected {\n outline: 2px solid #1a73e8;\n outline-offset: 2px;\n}\n'],sourceRoot:""}]),l.locals={root:"icTm1UFc5X5A8tag7W_Q",item:"WiVzPdjkN11lPSsmSGBB",dot:"_lQONL1oIiZTe42CyXuB",pill:"bTqTp8uamOPSh67_0QtJ",label:"fY4pheZcfQxg8DP_HYgE",leading:"cnAwK9OBcEyRXbAuQ14D",selected:"SCB1TtYJtUVEle7tVBiu"};const r=l}}]);
|
|
Binary file
|
|
@@ -1267,4 +1267,4 @@
|
|
|
1267
1267
|
background: rgba(16, 24, 40, 0.055) !important;
|
|
1268
1268
|
color: #14171f;
|
|
1269
1269
|
}
|
|
1270
|
-
`,customElements.define("cdtr-font-family-editor",n)},13681(t,e,a){a.d(e,{vP:()=>d});const r=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=r,window[r]||(window[r]={});const o=window[r],i=window.__cdtrEvents||{};function s(t){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then(t=>Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join(""))}function n(t){if(t.length%2!=0)throw new Error("Invalid hex string");const e=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)e[a/2]=parseInt(t.substr(a,2),16);return e}async function l(t){const e=await s(t),a=o[e];if(a){const t=await crypto.subtle.importKey("raw",n(e),{name:"AES-GCM"},!1,["encrypt","decrypt"]),r=await async function(t,e,a){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,a);return(new TextDecoder).decode(r)}(t,a.iv,a.encrypted);return JSON.parse(r)}return null}function c(t,e){if(i[t])for(const a in i[t])Object.prototype.hasOwnProperty.call(i[t],a)&&i[t][a].forEach(t=>t(e));Array.isArray(i["*"])&&i["*"].forEach(t=>t(e))}window.__cdtrEvents=i;const d={set:async function(t,e){const a=JSON.parse(JSON.stringify(e)),r=await s(t),l=await crypto.subtle.importKey("raw",n(r),{name:"AES-GCM"},!1,["encrypt","decrypt"]),d=await async function(t,e){const a=crypto.getRandomValues(new Uint8Array(12)),r=(new TextEncoder).encode(e),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:a},t,r);return{iv:a,encrypted:new Uint8Array(o)}}(l,JSON.stringify(a));o[r]=d,i.set&&i.set[r]&&i.set[r].forEach(t=>t(a)),Array.isArray(i["*"])&&i["*"].forEach(t=>t(a)),c(t,a)},get:l,remove:async function(t){const e=await s(t);delete o[e]},on:async function(t,e,a){i[t]||(i[t]={});const r=await s(e);i[t][r]||(i[t][r]=[]),i[t][r].push(t=>{!function(){const t=(new Error).stack;if(t&&t.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),a(t)});const o=await l(e);return o&&a(o),r},off:function(t,e){i[t]&&i[t][e]&&delete i[t][e]},dispatch:c,OPTIONS:{SET:"set"}}},88385(t,e,a){a.d(e,{A:()=>n});const r=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function i(t){const e={},a=/([^&=]+)=?([^&]*)/g,r=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let i,s=-1!==o?t.substring(o+1):"";for(;null!==(i=a.exec(s));){const t=r(i[1]),a=r(i[2]);t&&(e[t]=a)}return e}function s(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class n{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...i(t)};const a=t.indexOf("?");return this.url=a>-1?t.slice(0,a):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol
|
|
1270
|
+
`,customElements.define("cdtr-font-family-editor",n)},13681(t,e,a){a.d(e,{vP:()=>d});const r=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=r,window[r]||(window[r]={});const o=window[r],i=window.__cdtrEvents||{};function s(t){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then(t=>Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join(""))}function n(t){if(t.length%2!=0)throw new Error("Invalid hex string");const e=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)e[a/2]=parseInt(t.substr(a,2),16);return e}async function l(t){const e=await s(t),a=o[e];if(a){const t=await crypto.subtle.importKey("raw",n(e),{name:"AES-GCM"},!1,["encrypt","decrypt"]),r=await async function(t,e,a){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,a);return(new TextDecoder).decode(r)}(t,a.iv,a.encrypted);return JSON.parse(r)}return null}function c(t,e){if(i[t])for(const a in i[t])Object.prototype.hasOwnProperty.call(i[t],a)&&i[t][a].forEach(t=>t(e));Array.isArray(i["*"])&&i["*"].forEach(t=>t(e))}window.__cdtrEvents=i;const d={set:async function(t,e){const a=JSON.parse(JSON.stringify(e)),r=await s(t),l=await crypto.subtle.importKey("raw",n(r),{name:"AES-GCM"},!1,["encrypt","decrypt"]),d=await async function(t,e){const a=crypto.getRandomValues(new Uint8Array(12)),r=(new TextEncoder).encode(e),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:a},t,r);return{iv:a,encrypted:new Uint8Array(o)}}(l,JSON.stringify(a));o[r]=d,i.set&&i.set[r]&&i.set[r].forEach(t=>t(a)),Array.isArray(i["*"])&&i["*"].forEach(t=>t(a)),c(t,a)},get:l,remove:async function(t){const e=await s(t);delete o[e]},on:async function(t,e,a){i[t]||(i[t]={});const r=await s(e);i[t][r]||(i[t][r]=[]),i[t][r].push(t=>{!function(){const t=(new Error).stack;if(t&&t.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),a(t)});const o=await l(e);return o&&a(o),r},off:function(t,e){i[t]&&i[t][e]&&delete i[t][e]},dispatch:c,OPTIONS:{SET:"set"}}},88385(t,e,a){a.d(e,{A:()=>n});const r=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function i(t){const e={},a=/([^&=]+)=?([^&]*)/g,r=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let i,s=-1!==o?t.substring(o+1):"";for(;null!==(i=a.exec(s));){const t=r(i[1]),a=r(i[2]);t&&(e[t]=a)}return e}function s(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class n{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...i(t)};const a=t.indexOf("?");return this.url=a>-1?t.slice(0,a):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol||this.protocol||n.getProtocol(this.href);const a=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=r(a),this.isPhone=o(a),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...i(this.href)},this.url=s(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams(),this.isAnchor="anchor:"===this.protocol||this.href.startsWith("#")}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const a in this.params){const r=this.params[a],o=encodeURIComponent(a).replace(/%24/g,"$");if(r){const a=encodeURIComponent(r).replace(/%24/g,"$");t+=`${o}=${a}&`,e+=`${o}=${a}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const a=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return a(this.protocol+"//"+t);if(this.isAnchor||"anchor:"===this.protocol)return t?a(t.startsWith("#")?t:`#${t}`):"";if("whatsapp:"===this.protocol){const r=this.extractPhoneFromTextUsingRegex(t);return r.length>0?a("https://wa.me/"+r[0]+e):a("https://wa.me/"+e)}return a(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}n.resetURL=s}}]);
|
|
Binary file
|