wpmind/build/editor.js
2023-10-26 21:22:56 +03:00

5 lines
No EOL
73 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(){"use strict";var e,t={181:function(e,t,n){var r={};n.r(r),n.d(r,{getSettingsPageURL:function(){return p},isConnected:function(){return u}});var s={};n.r(s),n.d(s,{getHighlightBlocks:function(){return g}});var i={};n.r(i),n.d(i,{removeHighlightBlocks:function(){return f},setHighlightBlocks:function(){return m}});var o={};n.r(o),n.d(o,{close:function(){return ie},open:function(){return se},requestAI:function(){return ge},reset:function(){return me},setContext:function(){return ae},setError:function(){return de},setInput:function(){return le},setInsertionPlace:function(){return ce},setLoading:function(){return pe},setResponse:function(){return he},setScreen:function(){return ue},toggle:function(){return oe}});var l={};n.r(l),n.d(l,{getContext:function(){return be},getError:function(){return ye},getInput:function(){return ke},getInsertionPlace:function(){return we},getLoading:function(){return _e},getResponse:function(){return Ee},getScreen:function(){return xe},isOpen:function(){return fe}});const{connected:a,settingsPageURL:c}=window.mindData;function u(){return"1"===a}function p(){return c}var h=window.wp.data;const d=(0,h.createReduxStore)("mind",{selectors:r,reducer(e){return e}});(0,h.register)(d);function g(e){return e?.highlightBlocks||[]}function m(e){return{type:"SET_HIGHLIGHT_BLOCKS",highlightBlocks:e}}function f(e){return{type:"REMOVE_HIGHLIGHT_BLOCKS",removeBlocks:e}}const k=(0,h.createReduxStore)("mind/blocks",{reducer:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{highlightBlocks:[]},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t.type){case"SET_HIGHLIGHT_BLOCKS":if(t.highlightBlocks&&t.highlightBlocks.length)return{...e,highlightBlocks:[...e.highlightBlocks,...t.highlightBlocks]};break;case"REMOVE_HIGHLIGHT_BLOCKS":if(e.highlightBlocks&&e.highlightBlocks.length&&t.removeBlocks&&t.removeBlocks.length)return{...e,highlightBlocks:e.highlightBlocks.filter((e=>!t.removeBlocks.includes(e)))}}return e},selectors:s,actions:i});(0,h.register)(k);let b={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const w=/[&<>"']/,x=new RegExp(w.source,"g"),_=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,E=new RegExp(_.source,"g"),y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},v=e=>y[e];function S(e,t){if(t){if(w.test(e))return e.replace(x,v)}else if(_.test(e))return e.replace(E,v);return e}const C=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function O(e){return e.replace(C,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const A=/(^|[^\[])\^/g;function F(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,r)=>(r=(r=r.source||r).replace(A,"$1"),e=e.replace(t,r),n),getRegex:()=>new RegExp(e,t)};return n}const $=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(e,t,n){if(e){let e;try{e=decodeURIComponent(O(n)).replace($,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!I.test(n)&&(n=function(e,t){T[" "+e]||(z.test(e)?T[" "+e]=e+"/":T[" "+e]=D(e,"/",!0));const n=-1===(e=T[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(P,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(M,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}const T={},z=/^[^:]+:\/*[^/]*$/,P=/^([^:]+:)[\s\S]*$/,M=/^([^:]+:\/*[^/]*)[\s\S]*$/,B={exec:function(){}};function j(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let r=!1,s=t;for(;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function D(e,t,n){const r=e.length;if(0===r)return"";let s=0;for(;s<r;){const i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.slice(0,r-s)}function L(e,t,n,r){const s=t.href,i=t.title?S(t.title):null,o=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:s,title:i,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:s,title:i,text:S(o)}}class q{constructor(e){this.options=e||b}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:D(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const r=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=D(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,r,s,i,o,l,a,c,u,p,h,d,g=t[1].trim();const m=g.length>1,f={type:"list",raw:"",ordered:m,start:m?+g.slice(0,-1):"",loose:!1,items:[]};g=m?`\\d{1,9}\\${g.slice(-1)}`:`\\${g}`,this.options.pedantic&&(g=m?g:"[*+-]");const k=new RegExp(`^( {0,3}${g})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;e&&(d=!1,t=k.exec(e))&&!this.rules.block.hr.test(e);){if(n=t[0],e=e.substring(n.length),c=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),u=e.split("\n",1)[0],this.options.pedantic?(i=2,h=c.trimLeft()):(i=t[2].search(/[^ ]/),i=i>4?1:i,h=c.slice(i),i+=t[1].length),l=!1,!c&&/^ *$/.test(u)&&(n+=u+"\n",e=e.substring(u.length+1),d=!0),!d){const t=new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),s=new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),o=new RegExp(`^ {0,${Math.min(3,i-1)}}#`);for(;e&&(p=e.split("\n",1)[0],u=p,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!s.test(u))&&!o.test(u)&&!t.test(u)&&!r.test(e);){if(u.search(/[^ ]/)>=i||!u.trim())h+="\n"+u.slice(i);else{if(l)break;if(c.search(/[^ ]/)>=4)break;if(s.test(c))break;if(o.test(c))break;if(r.test(c))break;h+="\n"+u}l||u.trim()||(l=!0),n+=p+"\n",e=e.substring(p.length+1),c=u.slice(i)}}f.loose||(a?f.loose=!0:/\n *\n *$/.test(n)&&(a=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(h),r&&(s="[ ] "!==r[0],h=h.replace(/^\[[ xX]\] +/,""))),f.items.push({type:"list_item",raw:n,task:!!r,checked:s,loose:!1,text:h}),f.raw+=n}f.items[f.items.length-1].raw=n.trimRight(),f.items[f.items.length-1].text=h.trimRight(),f.raw=f.raw.trimRight();const b=f.items.length;for(o=0;o<b;o++)if(this.lexer.state.top=!1,f.items[o].tokens=this.lexer.blockTokens(f.items[o].text,[]),!f.loose){const e=f.items[o].tokens.filter((e=>"space"===e.type)),t=e.length>0&&e.some((e=>/\n.*\n/.test(e.raw)));f.loose=t}if(f.loose)for(o=0;o<b;o++)f.items[o].loose=!0;return f}}html(e){const t=this.rules.block.html.exec(e);if(t){const e={type:"html",block:!0,raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};if(this.options.sanitize){const n=this.options.sanitizer?this.options.sanitizer(t[0]):S(t[0]);e.type="paragraph",e.text=n,e.tokens=this.lexer.inline(n)}return e}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:j(t[1]).map((e=>({text:e}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let n,r,s,i,o=e.align.length;for(n=0;n<o;n++)/^ *-+: *$/.test(e.align[n])?e.align[n]="right":/^ *:-+: *$/.test(e.align[n])?e.align[n]="center":/^ *:-+ *$/.test(e.align[n])?e.align[n]="left":e.align[n]=null;for(o=e.rows.length,n=0;n<o;n++)e.rows[n]=j(e.rows[n],e.header.length).map((e=>({text:e})));for(o=e.header.length,r=0;r<o;r++)e.header[r].tokens=this.lexer.inline(e.header[r].text);for(o=e.rows.length,r=0;r<o;r++)for(i=e.rows[r],s=0;s<i.length;s++)i[s].tokens=this.lexer.inline(i[s].text);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:S(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):S(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=D(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let r=0,s=0;for(;s<n;s++)if("\\"===e[s])s++;else if(e[s]===t[0])r++;else if(e[s]===t[1]&&(r--,r<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),L(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:r?r.replace(this.rules.inline._escapes,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return L(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrong.lDelim.exec(e);if(!r)return;if(r[3]&&n.match(/[\p{L}\p{N}]/u))return;const s=r[1]||r[2]||"";if(!s||s&&(""===n||this.rules.inline.punctuation.exec(n))){const n=r[0].length-1;let s,i,o=n,l=0;const a="*"===r[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=a.exec(t));){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=s.length,r[3]||r[4]){o+=i;continue}if((r[5]||r[6])&&n%3&&!((n+i)%3)){l+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+l);const t=e.slice(0,n+r.index+(r[0].length-s.length)+i);if(Math.min(n,i)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const a=t.slice(2,-2);return{type:"strong",raw:t,text:a,tokens:this.lexer.inlineTokens(a)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=S(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,r;return"@"===n[2]?(e=S(this.options.mangle?t(n[1]):n[1]),r="mailto:"+e):(e=S(n[1]),r=e),{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,r;if("@"===n[2])e=S(this.options.mangle?t(n[0]):n[0]),r="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=S(n[0]),r="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):S(n[0]):n[0]:S(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const N={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:B,lheading:/^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};N.def=F(N.def).replace("label",N._label).replace("title",N._title).getRegex(),N.bullet=/(?:[*+-]|\d{1,9}[.)])/,N.listItemStart=F(/^( *)(bull) */).replace("bull",N.bullet).getRegex(),N.list=F(N.list).replace(/bull/g,N.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+N.def.source+")").getRegex(),N._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",N._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,N.html=F(N.html,"i").replace("comment",N._comment).replace("tag",N._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),N.lheading=F(N.lheading).replace(/bull/g,N.bullet).getRegex(),N.paragraph=F(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.blockquote=F(N.blockquote).replace("paragraph",N.paragraph).getRegex(),N.normal={...N},N.gfm={...N.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},N.gfm.table=F(N.gfm.table).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.gfm.paragraph=F(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",N.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.pedantic={...N.normal,html:F("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",N._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:B,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:F(N.normal._paragraph).replace("hr",N.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",N.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const Z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:B,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:B,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function H(e){return e.replace(/---/g,"—").replace(/--/g,"").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1").replace(/'/g,"").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function U(e){let t,n,r="";const s=e.length;for(t=0;t<s;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}Z._uc_punctuation="\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E42\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65",Z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"+Z._uc_punctuation,Z.punctuation=F(Z.punctuation).replace(/punctuation/g,Z._punctuation).getRegex(),Z.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Z.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,Z._comment=F(N._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),Z.emStrong.lDelim=F(Z.emStrong.lDelim).replace(/punct/g,Z._punctuation).getRegex(),Z.emStrong.rDelimAst=F(Z.emStrong.rDelimAst,"g").replace(/punct/g,Z._punctuation).getRegex(),Z.emStrong.rDelimUnd=F(Z.emStrong.rDelimUnd,"g").replace(/punct/g,Z._punctuation).getRegex(),Z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Z._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Z.autolink=F(Z.autolink).replace("scheme",Z._scheme).replace("email",Z._email).getRegex(),Z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Z.tag=F(Z.tag).replace("comment",Z._comment).replace("attribute",Z._attribute).getRegex(),Z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Z._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Z.link=F(Z.link).replace("label",Z._label).replace("href",Z._href).replace("title",Z._title).getRegex(),Z.reflink=F(Z.reflink).replace("label",Z._label).replace("ref",N._label).getRegex(),Z.nolink=F(Z.nolink).replace("ref",N._label).getRegex(),Z.reflinkSearch=F(Z.reflinkSearch,"g").replace("reflink",Z.reflink).replace("nolink",Z.nolink).getRegex(),Z.normal={...Z},Z.pedantic={...Z.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",Z._label).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z._label).getRegex()},Z.gfm={...Z.normal,escape:F(Z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Z.gfm.url=F(Z.gfm.url,"i").replace("email",Z.gfm._extended_email).getRegex(),Z.breaks={...Z.gfm,br:F(Z.br).replace("{2,}","*").getRegex(),text:F(Z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class G{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b,this.options.tokenizer=this.options.tokenizer||new q,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:N.normal,inline:Z.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=Z.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=Z.breaks:t.inline=Z.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:Z}}static lex(e,t){return new G(t).lex(e)}static lexInline(e,t){return new G(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,r,s,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?t.push(n):(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(s=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach((function(e){r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))r=t[t.length-1],i&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),i=s.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,s,i,o,l,a=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(a));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.escapedEmSt.exec(a));)a=a.slice(0,i.index+i[0].length-2)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(o||(l=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,l))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,U))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,U))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach((function(e){r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s,H))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(l=n.raw.slice(-1)),o=!0,r=t[t.length-1],r&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class Q{constructor(e){this.options=e||b}code(e,t,n){const r=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,r);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",r?'<pre><code class="'+this.options.langPrefix+S(r)+'">'+(n?e:S(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:S(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n,r){return this.options.headerIds?`<h${t} id="${this.options.headerPrefix+r.slug(n)}">${e}</h${t}>\n`:`<h${t}>${e}</h${t}>\n`}hr(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}list(e,t,n){const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}listitem(e){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){if(null===(e=R(this.options.sanitize,this.options.baseUrl,e)))return n;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){if(null===(e=R(this.options.sanitize,this.options.baseUrl,e)))return n;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=this.options.xhtml?"/>":">",r}text(e){return e}}class W{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class V{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,r=0;if(this.seen.hasOwnProperty(n)){r=this.seen[e];do{r++,n=e+"-"+r}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=r,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class K{constructor(e){this.options=e||b,this.options.renderer=this.options.renderer||new Q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new W,this.slugger=new V}static parse(e,t){return new K(t).parse(e)}static parseInline(e,t){return new K(t).parseInline(e)}parse(e,t=!0){let n,r,s,i,o,l,a,c,u,p,h,d,g,m,f,k,b,w,x,_="";const E=e.length;for(n=0;n<E;n++)if(p=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[p.type]&&(x=this.options.extensions.renderers[p.type].call({parser:this},p),!1!==x||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)))_+=x||"";else switch(p.type){case"space":continue;case"hr":_+=this.renderer.hr();continue;case"heading":_+=this.renderer.heading(this.parseInline(p.tokens),p.depth,O(this.parseInline(p.tokens,this.textRenderer)),this.slugger);continue;case"code":_+=this.renderer.code(p.text,p.lang,p.escaped);continue;case"table":for(c="",a="",i=p.header.length,r=0;r<i;r++)a+=this.renderer.tablecell(this.parseInline(p.header[r].tokens),{header:!0,align:p.align[r]});for(c+=this.renderer.tablerow(a),u="",i=p.rows.length,r=0;r<i;r++){for(l=p.rows[r],a="",o=l.length,s=0;s<o;s++)a+=this.renderer.tablecell(this.parseInline(l[s].tokens),{header:!1,align:p.align[s]});u+=this.renderer.tablerow(a)}_+=this.renderer.table(c,u);continue;case"blockquote":u=this.parse(p.tokens),_+=this.renderer.blockquote(u);continue;case"list":for(h=p.ordered,d=p.start,g=p.loose,i=p.items.length,u="",r=0;r<i;r++)f=p.items[r],k=f.checked,b=f.task,m="",f.task&&(w=this.renderer.checkbox(k),g?f.tokens.length>0&&"paragraph"===f.tokens[0].type?(f.tokens[0].text=w+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&"text"===f.tokens[0].tokens[0].type&&(f.tokens[0].tokens[0].text=w+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:w}):m+=w),m+=this.parse(f.tokens,g),u+=this.renderer.listitem(m,b,k);_+=this.renderer.list(u,h,d);continue;case"html":_+=this.renderer.html(p.text,p.block);continue;case"paragraph":_+=this.renderer.paragraph(this.parseInline(p.tokens));continue;case"text":for(u=p.tokens?this.parseInline(p.tokens):p.text;n+1<E&&"text"===e[n+1].type;)p=e[++n],u+="\n"+(p.tokens?this.parseInline(p.tokens):p.text);_+=t?this.renderer.paragraph(u):u;continue;default:{const e='Token with "'+p.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return _}parseInline(e,t){t=t||this.renderer;let n,r,s,i="";const o=e.length;for(n=0;n<o;n++)if(r=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]&&(s=this.options.extensions.renderers[r.type].call({parser:this},r),!1!==s||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)))i+=s||"";else switch(r.type){case"escape":case"text":i+=t.text(r.text);break;case"html":i+=t.html(r.text);break;case"link":i+=t.link(r.href,r.title,this.parseInline(r.tokens,t));break;case"image":i+=t.image(r.href,r.title,r.text);break;case"strong":i+=t.strong(this.parseInline(r.tokens,t));break;case"em":i+=t.em(this.parseInline(r.tokens,t));break;case"codespan":i+=t.codespan(r.text);break;case"br":i+=t.br();break;case"del":i+=t.del(this.parseInline(r.tokens,t));break;default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return i}}class X{constructor(e){this.options=e||b}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(e){return e}postprocess(e){return e}}function J(e,t){return(n,r,s)=>{"function"==typeof r&&(s=r,r=null);const i={...r},o=function(e,t,n){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+S(r.message+"",!0)+"</pre>";return t?Promise.resolve(e):n?void n(null,e):e}if(t)return Promise.reject(r);if(!n)throw r;n(r)}}((r={...Y.defaults,...i}).silent,r.async,s);if(null==n)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(function(e,t){e&&!e.silent&&(t&&console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async"),(e.sanitize||e.sanitizer)&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),(e.highlight||"language-"!==e.langPrefix)&&console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight."),e.mangle&&console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`."),e.baseUrl&&console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url."),e.smartypants&&console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants."),e.xhtml&&console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml."),(e.headerIds||e.headerPrefix)&&console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`."))}(r,s),r.hooks&&(r.hooks.options=r),s){const i=r.highlight;let l;try{r.hooks&&(n=r.hooks.preprocess(n)),l=e(n,r)}catch(e){return o(e)}const a=function(e){let n;if(!e)try{r.walkTokens&&Y.walkTokens(l,r.walkTokens),n=t(l,r),r.hooks&&(n=r.hooks.postprocess(n))}catch(t){e=t}return r.highlight=i,e?o(e):s(null,n)};if(!i||i.length<3)return a();if(delete r.highlight,!l.length)return a();let c=0;return Y.walkTokens(l,(function(e){"code"===e.type&&(c++,setTimeout((()=>{i(e.text,e.lang,(function(t,n){if(t)return a(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),c--,0===c&&a()}))}),0))})),void(0===c&&a())}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then((t=>e(t,r))).then((e=>r.walkTokens?Promise.all(Y.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>t(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));const s=e(n,r);r.walkTokens&&Y.walkTokens(s,r.walkTokens);let i=t(s,r);return r.hooks&&(i=r.hooks.postprocess(i)),i}catch(e){return o(e)}}}function Y(e,t,n){return J(G.lex,K.parse)(e,t,n)}function ee(e){let t=Y.parse(e);return t=t.replace(/<pre><code/g,"<pre").replace(/<\/code><\/pre>/g,"</pre>"),t}Y.options=Y.setOptions=function(e){var t;return Y.defaults={...Y.defaults,...e},t=Y.defaults,b=t,Y},Y.getDefaults=function(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}},Y.defaults=b,Y.use=function(...e){const t=Y.defaults.extensions||{renderers:{},childTokens:{}};e.forEach((e=>{const n={...e};if(n.async=Y.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");t[e.level]?t[e.level].unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=Y.defaults.renderer||new Q;for(const n in e.renderer){const r=t[n];t[n]=(...s)=>{let i=e.renderer[n].apply(t,s);return!1===i&&(i=r.apply(t,s)),i}}n.renderer=t}if(e.tokenizer){const t=Y.defaults.tokenizer||new q;for(const n in e.tokenizer){const r=t[n];t[n]=(...s)=>{let i=e.tokenizer[n].apply(t,s);return!1===i&&(i=r.apply(t,s)),i}}n.tokenizer=t}if(e.hooks){const t=Y.defaults.hooks||new X;for(const n in e.hooks){const r=t[n];X.passThroughHooks.has(n)?t[n]=s=>{if(Y.defaults.async)return Promise.resolve(e.hooks[n].call(t,s)).then((e=>r.call(t,e)));const i=e.hooks[n].call(t,s);return r.call(t,i)}:t[n]=(...s)=>{let i=e.hooks[n].apply(t,s);return!1===i&&(i=r.apply(t,s)),i}}n.hooks=t}if(e.walkTokens){const t=Y.defaults.walkTokens;n.walkTokens=function(n){let r=[];return r.push(e.walkTokens.call(this,n)),t&&(r=r.concat(t.call(this,n))),r}}Y.setOptions(n)}))},Y.walkTokens=function(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(Y,r)),r.type){case"table":for(const e of r.header)n=n.concat(Y.walkTokens(e.tokens,t));for(const e of r.rows)for(const r of e)n=n.concat(Y.walkTokens(r.tokens,t));break;case"list":n=n.concat(Y.walkTokens(r.items,t));break;default:Y.defaults.extensions&&Y.defaults.extensions.childTokens&&Y.defaults.extensions.childTokens[r.type]?Y.defaults.extensions.childTokens[r.type].forEach((function(e){n=n.concat(Y.walkTokens(r[e],t))})):r.tokens&&(n=n.concat(Y.walkTokens(r.tokens,t)))}return n},Y.parseInline=J(G.lexInline,K.parseInline),Y.Parser=K,Y.parser=K.parse,Y.Renderer=Q,Y.TextRenderer=W,Y.Lexer=G,Y.lexer=G.lex,Y.Tokenizer=q,Y.Slugger=V,Y.Hooks=X,Y.parse=Y,Y.options,Y.setOptions,Y.use,Y.walkTokens,Y.parseInline,K.parse,G.lex,Y.use({headerIds:!1});var te=window.wp.i18n,ne=window.wp.apiFetch,re=n.n(ne);function se(){return{type:"OPEN"}}function ie(){return{type:"CLOSE"}}function oe(){return{type:"TOGGLE"}}function le(e){return{type:"SET_INPUT",input:e}}function ae(e){return{type:"SET_CONTEXT",context:e}}function ce(e){return{type:"SET_INSERTION_PLACE",insertionPlace:e}}function ue(e){return{type:"SET_SCREEN",screen:e}}function pe(e){return{type:"SET_LOADING",loading:e}}function he(e){return{type:"SET_RESPONSE",response:e}}function de(e){return{type:"SET_ERROR",error:e}}function ge(){return e=>{let{dispatch:t,select:n}=e;if(!u)return;if(n.getLoading())return;t({type:"REQUEST_AI_PENDING"});const r=n.getContext(),s={request:n.getInput()};"selected-blocks"===r&&(s.context=function(){const{getBlock:e,getSelectedBlockClientIds:t}=wp.data.select("core/block-editor"),n=t();let r="";return n.forEach((t=>{const n=e(t);n?.attributes?.content&&(r=`${r}<p>${n.attributes.content}</p>`)})),r}()),re()({path:"/mind/v1/request_ai",method:"POST",data:s}).then((e=>(t({type:"REQUEST_AI_SUCCESS",payload:e.response}),e.response))).catch((e=>{t({type:"REQUEST_AI_ERROR",payload:e?.response||e?.error_code||(0,te.__)("Something went wrong, please, try again…","mind")})}))}}function me(){return{type:"RESET"}}function fe(e){return e?.isOpen||!1}function ke(e){return e?.input||""}function be(e){return e?.context||""}function we(e){return e?.insertionPlace||""}function xe(e){return e?.screen||""}function _e(e){return e?.loading||!1}function Ee(e){return e?.response||!1}function ye(e){return e?.error||!1}const ve=(0,h.createReduxStore)("mind/popup",{reducer:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isOpen:!1,input:"",context:"",insertionPlace:"",screen:"",loading:!1,response:!1,error:!1},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t.type){case"CLOSE":if(e.isOpen)return{...e,isOpen:!1};break;case"OPEN":if(!e.isOpen)return{...e,isOpen:!0};break;case"TOGGLE":return{...e,isOpen:!e.isOpen};case"SET_INPUT":if(e.input!==t.input)return{...e,input:t.input};break;case"SET_CONTEXT":if(e.context!==t.context)return{...e,context:t.context};break;case"SET_INSERTION_PLACE":if(e.insertionPlace!==t.insertionPlace)return{...e,insertionPlace:t.insertionPlace};break;case"SET_SCREEN":if(e.screen!==t.screen)return{...e,screen:t.screen};break;case"SET_LOADING":if(e.loading!==t.loading)return{...e,loading:t.loading};break;case"SET_RESPONSE":if(e.response!==t.response)return{...e,response:t.response};break;case"SET_ERROR":if(e.error!==t.error)return{...e,error:t.error};break;case"REQUEST_AI_PENDING":return{...e,loading:!0,isOpen:!0,screen:"request"};case"REQUEST_AI_SUCCESS":return{...e,loading:!1,response:!!t.payload&&ee(t.payload)};case"REQUEST_AI_ERROR":return{...e,loading:!1,error:t.payload||"",response:!1};case"RESET":return{...e,input:"",context:"",insertionPlace:"",screen:"",response:!1,error:!1,loading:!1}}return e},actions:o,selectors:l});(0,h.register)(ve);var Se=window.wp.element,Ce=window.wp.components,Oe=window.wp.blocks,Ae=window.wp.domReady,Fe=n.n(Ae);function $e(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=$e(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}var Ie,Re=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=$e(e))&&(r&&(r+=" "),r+=t);return r},Te=window.React;function ze(){return ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ze.apply(this,arguments)}var Pe,Me,Be,je,De,Le,qe,Ne,Ze,He,Ue,Ge=function(e){return Te.createElement("svg",ze({width:20,height:20,viewBox:"0 0 66 66",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Ie||(Ie=Te.createElement("path",{d:"M24.667 24.316C28.83 20.17 31.675 11 31.675 11s2.59 9.163 6.658 13.316C42.531 28.601 52 31.325 52 31.325s-9.477 2.717-13.667 7.008C34.186 42.581 31.675 52 31.675 52s-2.767-9.425-7.008-13.667C20.425 34.093 11 31.325 11 31.325s9.417-2.776 13.667-7.009ZM48.667 51.521C50.393 49.802 51.573 46 51.573 46s1.073 3.8 2.76 5.521C56.073 53.298 60 54.427 60 54.427s-3.93 1.127-5.667 2.906c-1.72 1.762-2.76 5.667-2.76 5.667s-1.148-3.908-2.906-5.667C46.908 55.575 43 54.427 43 54.427s3.904-1.15 5.667-2.906ZM6.667 45.573C7.784 44.46 8.547 42 8.547 42s.695 2.458 1.786 3.573c1.127 1.15 3.667 1.88 3.667 1.88s-2.543.729-3.667 1.88C9.221 50.473 8.547 53 8.547 53s-.742-2.529-1.88-3.667S3 47.453 3 47.453s2.526-.745 3.667-1.88ZM50.333 6.222C51.653 4.907 52.556 2 52.556 2s.82 2.905 2.11 4.222C55.999 7.581 59 8.444 59 8.444s-3.005.862-4.333 2.223C53.352 12.014 52.556 15 52.556 15s-.878-2.989-2.223-4.333C48.99 9.322 46 8.444 46 8.444s2.986-.88 4.333-2.222Z",fill:"currentColor"})))};function Qe(e){const{onInsert:t}=e,n=(0,Se.useRef)(),{reset:r,setInput:s,setScreen:i,requestAI:o}=(0,h.useDispatch)("mind/popup"),{isOpen:l,input:a,context:c,screen:u,loading:p,response:d}=(0,h.useSelect)((e=>{const{isOpen:t,getInput:n,getContext:r,getScreen:s,getLoading:i,getResponse:o}=e("mind/popup");return{isOpen:t(),input:n(),context:r(),screen:s(),loading:i(),response:o()}}));let g=c;switch(c){case"selected-blocks":g=(0,te.__)("Selected Blocks");break;case"post-title":g=(0,te.__)("Post Title")}return(0,Se.useEffect)((()=>{l&&!p&&n?.current&&n.current.focus()}),[l,p,n]),(0,Se.useEffect)((()=>{""===u&&a&&i("request")}),[u,a,i]),(0,Se.useEffect)((()=>{if(n?.current){n.current.style.height="0px";const e=n.current.scrollHeight;n.current.style.height=e+"px"}}),[n,a]),(0,Se.createElement)("div",{className:"mind-popup-input"},(0,Se.createElement)(Ge,null),(0,Se.createElement)("textarea",{ref:n,placeholder:(0,te.__)("Ask AI to write anything…","mind"),value:a,onChange:e=>{s(e.target.value)},onKeyDown:function(e){""===u||"Backspace"!==e.key||e.target.value?!d||"Enter"!==e.key||e.shiftKey?"request"!==u||"Enter"!==e.key||e.shiftKey||o():t():r()},disabled:p,rows:1}),g?(0,Se.createElement)("span",{className:"mind-popup-input-context"},g):null)}function We(){return(0,Se.createElement)("div",{className:"mind-popup-loading-line"},(0,Se.createElement)("span",null))}function Ve(e){return(0,Se.createElement)("span",{className:"mind-popup-loading-text"},e.children)}function Ke(e){const{type:t,children:n}=e;return(0,Se.createElement)("div",{className:"mind-popup-notice "+(t?`mind-popup-notice-${t}`:"")},n)}function Xe(){return Xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xe.apply(this,arguments)}function Je(){return Je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Je.apply(this,arguments)}function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ye.apply(this,arguments)}function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},et.apply(this,arguments)}function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tt.apply(this,arguments)}function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nt.apply(this,arguments)}const rt=[{type:"category",label:(0,te.__)("Post Presets","mind")},{type:"request",label:(0,te.__)("Post title about…","mind"),request:(0,te.__)("Write a post title about ","mind"),icon:(0,Se.createElement)((function(e){return Te.createElement("svg",Xe({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Pe||(Pe=Te.createElement("path",{d:"M8 5v6M11 5H5M5 19h8M5 15h15",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))}),null)},{type:"request",label:(0,te.__)("Post about…","mind"),request:(0,te.__)("Write a blog post about ","mind"),icon:(0,Se.createElement)((function(e){return Te.createElement("svg",Je({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Me||(Me=Te.createElement("path",{d:"M7.5 7.25h9M7.5 10.75h9M7.5 14.25H13",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})),Be||(Be=Te.createElement("rect",{x:5.25,y:3.75,width:13.5,height:16.5,rx:1.25,stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))}),null)},{type:"request",label:(0,te.__)("Outline about…","mind"),request:(0,te.__)("Write a blog post outline about ","mind"),icon:(0,Se.createElement)((function(e){return Te.createElement("svg",Ye({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),je||(je=Te.createElement("path",{d:"M10 6.25h11M10 11.75h11M10 17.25h11",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})),De||(De=Te.createElement("circle",{cx:5.5,cy:11.75,r:1.5,fill:"currentColor"})),Le||(Le=Te.createElement("circle",{cx:5.5,cy:17.25,r:1.5,fill:"currentColor"})),qe||(qe=Te.createElement("circle",{cx:5.5,cy:6.25,r:1.5,fill:"currentColor"})))}),null)},{type:"category",label:(0,te.__)("Content Presets","mind")},{type:"request",label:(0,te.__)("Paragraph about…","mind"),request:(0,te.__)("Create a paragraph about ","mind"),icon:(0,Se.createElement)((function(e){return Te.createElement("svg",et({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Ne||(Ne=Te.createElement("path",{d:"M3 7.25h18M3 11.75h18M3 16.25h11",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))}),null)},{type:"request",label:(0,te.__)("List about…","mind"),request:(0,te.__)("Create a list about ","mind"),icon:(0,Se.createElement)((function(e){return Te.createElement("svg",tt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Ze||(Ze=Te.createElement("path",{d:"M3 6.25h18M10 11.75h11M3 17.25h18",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})),He||(He=Te.createElement("circle",{cx:4.75,cy:11.75,r:1.75,fill:"currentColor"})))}),null)},{type:"request",label:(0,te.__)("Table about…","mind"),request:(0,te.__)("Create a table about ","mind"),icon:(0,Se.createElement)((function(e){return Te.createElement("svg",nt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Ue||(Ue=Te.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2ZM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5Zm8 5.5h6.5v3.5H13V10Zm-1.5 3.5h-7V10h7v3.5Zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5Zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5Z",fill:"currentColor"})))}),null)}];function st(){const e=(0,Se.useRef)(),{setInput:t,setScreen:n}=(0,h.useDispatch)("mind/popup"),{isOpen:r,input:s,screen:i,loading:o,response:l,error:a}=(0,h.useSelect)((e=>{const{isOpen:t,getInput:n,getContext:r,getScreen:s,getLoading:i,getResponse:o,getError:l}=e("mind/popup");return{isOpen:t(),input:n(),context:r(),screen:s(),loading:i(),response:o(),error:l()}}));return(0,Se.useEffect)((()=>{r&&!o&&e?.current&&function(){if(e?.current){const t=e.current.querySelector("input");t&&t.focus()}}()}),[r,o,e]),(0,Se.useEffect)((()=>{""===i&&s&&n("request")}),[i,s,n]),(0,Se.createElement)("div",{className:"mind-popup-content"},""===i?(0,Se.createElement)("div",{className:"mind-popup-commands"},rt.map((e=>"category"===e.type?(0,Se.createElement)("span",{key:e.type+e.label,className:"mind-popup-commands-category"},e.label):(0,Se.createElement)(Ce.Button,{key:e.type+e.label,className:"mind-popup-commands-button",onClick:()=>{t(e.request),n("request")}},e.icon||"",e.label)))):null,"request"===i&&(0,Se.createElement)("div",{className:"mind-popup-request"},o&&(0,Se.createElement)(Ve,null,(0,te.__)("Waiting for AI response","mind")),!o&&l&&(0,Se.createElement)(Se.RawHTML,null,l),!o&&a&&(0,Se.createElement)(Ke,{type:"error"},a)))}function it(e){const{onInsert:t}=e,{close:n,reset:r,setError:s,requestAI:i}=(0,h.useDispatch)("mind/popup"),{input:o,loading:l,response:a}=(0,h.useSelect)((e=>{const{getInput:t,getContext:n,getScreen:r,getLoading:s,getResponse:i}=e("mind/popup");return{input:t(),context:n(),screen:r(),loading:s(),response:i()}}));return a||o&&!l&&!a?(0,Se.createElement)("div",{className:"mind-popup-footer"},(0,Se.createElement)("div",{className:"mind-popup-footer-actions"},o&&!l&&!a&&(0,Se.createElement)(Ce.Button,{onClick:()=>{i()}},(0,te.__)("Get Answer","mind")," ",(0,Se.createElement)("kbd",null,"⏎")),a&&(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(Ce.Button,{onClick:()=>{s(""),i()}},(0,te.__)("Regenerate","mind")," ",(0,Se.createElement)("kbd",null,"↻")),(0,Se.createElement)(Ce.Button,{onClick:()=>{window.navigator.clipboard.writeText(a),r(),n()}},(0,te.__)("Copy","mind")),(0,Se.createElement)(Ce.Button,{onClick:t},(0,te.__)("Insert","mind")," ",(0,Se.createElement)("kbd",null,"⏎"))))):null}var ot;function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lt.apply(this,arguments)}var at=function(e){return Te.createElement("svg",lt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),ot||(ot=Te.createElement("path",{d:"M7.636 9.92a1.557 1.557 0 0 1-.475-1.142c0-.445.159-.826.475-1.142a1.557 1.557 0 0 1 1.142-.475c.445 0 .826.159 1.142.475.317.316.475.697.475 1.142 0 .445-.158.826-.475 1.142a1.557 1.557 0 0 1-1.142.475c-.445 0-.826-.158-1.142-.475Zm-2.747 2.747c-1.079-1.079-1.618-2.375-1.618-3.889 0-1.514.54-2.81 1.618-3.889C5.968 3.81 7.264 3.271 8.78 3.271c1.513 0 2.81.54 3.888 1.618.758.758 1.248 1.639 1.47 2.643a5.513 5.513 0 0 1-.132 2.938l6.366 6.365v3.536l-5.426-.014-.326-2.298-2.346-.347-.428-2.332-1.375-1.375a5.567 5.567 0 0 1-2.935.128c-1.006-.22-1.888-.708-2.646-1.466Zm1.06-1.06c.679.678 1.47 1.06 2.377 1.147.906.086 1.732-.092 2.478-.535l2.434 2.434.315 1.722 2.391.372.283 2.118h2.638v-1.414l-6.646-6.647c.443-.746.621-1.572.535-2.478-.087-.906-.47-1.698-1.147-2.376-.778-.778-1.721-1.167-2.829-1.167s-2.05.389-2.828 1.167-1.167 1.72-1.167 2.828c0 1.108.389 2.05 1.167 2.829Z",fill:"currentColor"})))};function ct(){const{settingsPageURL:e}=(0,h.useSelect)((e=>{const{getSettingsPageURL:t}=e("mind");return{settingsPageURL:t()}}));return(0,Se.createElement)("div",{className:"mind-popup-connected-screen"},(0,Se.createElement)("h2",null,(0,Se.createElement)(at,null),(0,te.__)("OpenAI Key","mind")),(0,Se.createElement)("div",null,(0,Se.createElement)("p",null,(0,te.__)("In order to use Mind, you will need to provide your OpenAI API key. Please insert your API key in the plugin settings to get started.","mind"))),(0,Se.createElement)("div",null,(0,Se.createElement)("a",{className:"mind-popup-connected-screen-button",href:e},(0,te.__)("Go to Settings","mind"))))}const ut="mind-popup-container";function pt(){const{setHighlightBlocks:e}=(0,h.useDispatch)("mind/blocks"),{close:t,reset:n}=(0,h.useDispatch)("mind/popup"),{connected:r,isOpen:s,insertionPlace:i,loading:o,response:l}=(0,h.useSelect)((e=>{const{isConnected:t}=e("mind"),{isOpen:n,getInsertionPlace:r,getLoading:s,getResponse:i}=e("mind/popup");return{connected:t(),isOpen:n(),insertionPlace:r(),loading:s(),response:i()}})),{selectedClientIds:a}=(0,h.useSelect)((e=>{const{getSelectedBlockClientIds:t}=e("core/block-editor");return{selectedClientIds:t()}}),[]),{insertBlocks:c,replaceBlocks:u}=(0,h.useDispatch)("core/block-editor");function p(){!function(){const t=(0,Oe.rawHandler)({HTML:l});t.length&&("selected-blocks"===i?u(a,t):c(t),e(t.map((e=>e.clientId))))}(),n(),t()}return s?(0,Se.createElement)(Ce.Modal,{title:!1,className:Re("mind-popup",!r&&"mind-popup-not-connected"),overlayClassName:"mind-popup-overlay",onRequestClose:()=>{n(),t()},__experimentalHideHeader:!0},r?(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(Qe,{onInsert:p}),o&&(0,Se.createElement)(We,null),(0,Se.createElement)(st,null),(0,Se.createElement)(it,{onInsert:p})):(0,Se.createElement)(ct,null)):null}Fe()((()=>{if(document.querySelector(`.${ut}`))return;const e=document.querySelector(".block-editor");if(!e)return;const t=document.createElement("div");t.classList.add(ut),e.appendChild(t),(0,Se.createRoot)(t).render((0,Se.createElement)(pt,null))}));var ht,dt=window.wp.hooks,gt=window.wp.blockEditor,mt=window.wp.compose;function ft(){return ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ft.apply(this,arguments)}var kt,bt=function(e){return Te.createElement("svg",ft({xmlns:"http://www.w3.org/2000/svg",height:24,viewBox:"0 -960 960 960",width:24},e),ht||(ht=Te.createElement("path",{d:"M376-253.847 333.847-296l184-184-184-184L376-706.153 602.153-480 376-253.847Z"})))};function wt(){return wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wt.apply(this,arguments)}var xt,_t=function(e){return Te.createElement("svg",wt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),kt||(kt=Te.createElement("path",{d:"M7.333 14.274C8.044 13.566 8.53 12 8.53 12s.442 1.565 1.137 2.274C10.383 15.005 12 15.47 12 15.47s-1.618.464-2.333 1.197C8.959 17.392 8.53 19 8.53 19s-.473-1.61-1.197-2.333C6.61 15.942 5 15.47 5 15.47s1.608-.474 2.333-1.197ZM15.333 17.3c.407-.405.684-1.3.684-1.3s.253.894.65 1.3c.41.417 1.333.683 1.333.683s-.924.265-1.333.684c-.405.414-.65 1.333-.65 1.333s-.27-.92-.684-1.333c-.413-.414-1.333-.684-1.333-.684s.919-.27 1.333-.684ZM11.333 6.248C12.35 5.236 13.043 3 13.043 3s.631 2.235 1.624 3.248C15.69 7.293 18 7.958 18 7.958s-2.311.662-3.333 1.709C13.655 10.703 13.043 13 13.043 13s-.675-2.299-1.71-3.333C10.3 8.632 8 7.957 8 7.957s2.297-.677 3.333-1.71Z",fill:"currentColor"})))};function Et(){return Et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Et.apply(this,arguments)}var yt,vt=function(e){return Te.createElement("svg",Et({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),xt||(xt=Te.createElement("path",{d:"M8.5 12.5 12 16l7.5-7.5m-16 4L7 16l1-1m6.5-6.5-3.25 3.25",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))};function St(){return St=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},St.apply(this,arguments)}var Ct,Ot=function(e){return Te.createElement("svg",St({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),yt||(yt=Te.createElement("path",{d:"M3 9.75h18M3 14.25h12",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))};function At(){return At=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},At.apply(this,arguments)}var Ft,$t=function(e){return Te.createElement("svg",At({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Ct||(Ct=Te.createElement("path",{d:"M3 5.25h18M3 9.75h18M3 14.25h18M3 18.75h12",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))};function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}var Rt,Tt=function(e){return Te.createElement("svg",It({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Ft||(Ft=Te.createElement("path",{d:"M3 7.75h18M3 12.25h6M11 12.25h5M18 12.25h3M3 16.75h4M9 16.75h4",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))};function zt(){return zt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zt.apply(this,arguments)}var Pt,Mt,Bt=function(e){return Te.createElement("svg",zt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Rt||(Rt=Te.createElement("path",{d:"M13.647 6.955 15.53 4.25H8.471l1.882 2.705m3.294 0L16 17.386l-4 3.864-4-3.864 2.353-10.431m3.294 0h-3.294",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))};function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jt.apply(this,arguments)}var Dt,Lt=function(e){return Te.createElement("svg",jt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Pt||(Pt=Te.createElement("path",{d:"M19.75 12A7.75 7.75 0 0 0 6.52 6.52L5.4 7.64M4.25 12a7.75 7.75 0 0 0 13.23 5.48l1.12-1.12",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})),Mt||(Mt=Te.createElement("path",{d:"M4.75 4.25v4h4M19.25 19.75v-4h-4",stroke:"currentColor",strokeWidth:1.5,fill:"transparent"})))};function qt(){return qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qt.apply(this,arguments)}var Nt=function(e){return Te.createElement("svg",qt({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Dt||(Dt=Te.createElement("path",{d:"m11.876 21 3.711-10.2h1.702L21 21h-1.701l-.86-2.596H14.48L13.595 21h-1.718Zm3.1-4.084H17.9l-1.426-4.204h-.072l-1.426 4.204ZM5.445 18.45l-1.151-1.2 4.119-4.297a13.309 13.309 0 0 1-1.35-1.843A14.345 14.345 0 0 1 6.057 9.1h1.701c.248.511.51.97.786 1.377.276.406.61.838 1.004 1.293a11.953 11.953 0 0 0 1.496-2.094 13.27 13.27 0 0 0 .993-2.276H3V5.7h5.705V4h1.63v1.7h5.704v1.7h-2.374a16.04 16.04 0 0 1-1.16 2.925c-.487.948-1.09 1.84-1.807 2.674l1.949 2.08-.611 1.745L9.52 14.2l-4.075 4.25Z"})))};function Zt(e,t){return t={tagName:"span",className:"",...t},e.replace(/\p{RI}\p{RI}|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u{200D}\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?)+|\p{EPres}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})/gu,`<${t.tagName}${t.className?` class="${t.className}"`:""} role="img" aria-hidden="true">$&</${t.tagName}>`)}const Ht=["core/paragraph","core/heading"],Ut=[[(0,te.__)("professional","mind"),(0,te.__)("🧐 Professional","mind")],[(0,te.__)("friendly","mind"),(0,te.__)("😀 Friendly","mind")],[(0,te.__)("straightforward","mind"),(0,te.__)("🙂 Straightforward","mind")],[(0,te.__)("educational","mind"),(0,te.__)("🎓 Educational","mind")],[(0,te.__)("confident","mind"),(0,te.__)("😎 Confident","mind")],[(0,te.__)("witty","mind"),(0,te.__)("🤣 Witty","mind")],[(0,te.__)("heartfelt","mind"),(0,te.__)("🤗 Heartfelt","mind")]],Gt=[[(0,te.__)("chinese","mind"),(0,te.__)("🇨🇳 Chinese","mind")],[(0,te.__)("dutch","mind"),(0,te.__)("🇳🇱 Dutch","mind")],[(0,te.__)("english","mind"),(0,te.__)("🇺🇸 English","mind")],[(0,te.__)("filipino","mind"),(0,te.__)("🇵🇭 Filipino","mind")],[(0,te.__)("french","mind"),(0,te.__)("🇫🇷 French","mind")],[(0,te.__)("german","mind"),(0,te.__)("🇩🇪 German","mind")],[(0,te.__)("indonesian","mind"),(0,te.__)("🇮🇩 Indonesian","mind")],[(0,te.__)("italian","mind"),(0,te.__)("🇮🇹 Italian","mind")],[(0,te.__)("japanese","mind"),(0,te.__)("🇯🇵 Japanese","mind")],[(0,te.__)("korean","mind"),(0,te.__)("🇰🇷 Korean","mind")],[(0,te.__)("portuguese","mind"),(0,te.__)("🇵🇹 Portuguese","mind")],[(0,te.__)("russian","mind"),(0,te.__)("🇷🇺 Russian","mind")],[(0,te.__)("spanish","mind"),(0,te.__)("🇪🇸 Spanish","mind")],[(0,te.__)("vietnamese","mind"),(0,te.__)("🇻🇳 Vietnamese","mind")]];function Qt(){const{open:e,setInput:t,setContext:n,setInsertionPlace:r,requestAI:s}=(0,h.useDispatch)("mind/popup");function i(i){e(),t(i),n("selected-blocks"),r("selected-blocks"),s()}return(0,Se.createElement)(Ce.ToolbarGroup,null,(0,Se.createElement)(Ce.DropdownMenu,{icon:(0,Se.createElement)(Ge,null),label:(0,te.__)("Mind","@@text_domain"),className:"mind-toolbar-toggle",popoverProps:{className:"mind-toolbar-dropdown"}},(()=>(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(Ce.MenuGroup,null,(0,Se.createElement)(Ce.MenuItem,{icon:(0,Se.createElement)(_t,null),iconPosition:"left",onClick:()=>{i((0,te.__)("Improve writing language","mind"))}},(0,te.__)("Improve","mind")),(0,Se.createElement)(Ce.MenuItem,{icon:(0,Se.createElement)(vt,null),iconPosition:"left",onClick:()=>{i((0,te.__)("Fix spelling and grammar","mind"))}},(0,te.__)("Fix Spelling & Grammar","mind")),(0,Se.createElement)(Ce.MenuItem,{icon:(0,Se.createElement)(Ot,null),iconPosition:"left",onClick:()=>{i((0,te.__)("Make shorter","mind"))}},(0,te.__)("Make Shorter","mind")),(0,Se.createElement)(Ce.MenuItem,{icon:(0,Se.createElement)($t,null),iconPosition:"left",onClick:()=>{i((0,te.__)("Make longer","mind"))}},(0,te.__)("Make Longer","mind")),(0,Se.createElement)(Ce.MenuItem,{icon:(0,Se.createElement)(Tt,null),iconPosition:"left",onClick:()=>{i((0,te.__)("Summarize","mind"))}},(0,te.__)("Summarize","mind")),(0,Se.createElement)(Ce.MenuItem,{icon:(0,Se.createElement)(Lt,null),iconPosition:"left",onClick:()=>{i((0,te.__)("Paraphrase","mind"))}},(0,te.__)("Paraphrase","mind"))),(0,Se.createElement)(Ce.MenuGroup,null,(0,Se.createElement)(Ce.DropdownMenu,{icon:(0,Se.createElement)(Bt,null),iconPosition:"left",toggleProps:{children:(0,Se.createElement)(Se.Fragment,null,(0,te.__)("Adjust Tone","mind"),(0,Se.createElement)(bt,null))},popoverProps:{placement:"right-end",className:"mind-toolbar-dropdown"},className:"mind-toolbar-dropdown-toggle"},(()=>(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(Ce.MenuGroup,{label:(0,te.__)("Select Tone","@@text_domain")},Ut.map((e=>(0,Se.createElement)(Ce.MenuItem,{key:e[0],onClick:()=>{i((0,te.sprintf)(
// translators: %s - tone.
(0,te.__)("Change tone to %s","mind"),e[0]))}},(0,Se.createElement)(Se.RawHTML,null,Zt(e[1]))))))))),(0,Se.createElement)(Ce.DropdownMenu,{icon:(0,Se.createElement)(Nt,null),iconPosition:"left",toggleProps:{children:(0,Se.createElement)(Se.Fragment,null,(0,te.__)("Translate","mind"),(0,Se.createElement)(bt,null))},popoverProps:{placement:"right-end",className:"mind-toolbar-dropdown"},className:"mind-toolbar-dropdown-toggle"},(()=>(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(Ce.MenuGroup,{label:(0,te.__)("Select Language","@@text_domain")},Gt.map((e=>(0,Se.createElement)(Ce.MenuItem,{key:e[0],onClick:()=>{i((0,te.sprintf)(
// translators: %s - tone.
(0,te.__)("Translate to %s","mind"),e[0]))}},(0,Se.createElement)(Se.RawHTML,null,Zt(e[1]))))))))))))))}const Wt=(0,mt.createHigherOrderComponent)((e=>function(t){var n;return n=t,Ht.includes(n.name)?(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(e,t),(0,Se.createElement)(gt.BlockControls,{group:"other"},(0,Se.createElement)(Qt,null))):(0,Se.createElement)(e,t)}),"withToolbarControl");(0,dt.addFilter)("editor.BlockEdit","mind/block-toolbar-toggle",Wt);var Vt=window.lodash;const{elementContext:Kt,__unstableElementContext:Xt}=gt.BlockList,Jt=Kt||Xt;function Yt(e){const{styles:t}=e,n=(0,Se.useMemo)((()=>{const e=(0,gt.transformStyles)([{css:t}],".editor-styles-wrapper");let n="";return(0,Vt.map)((0,Vt.compact)(e),(e=>{n+=e})),n}),[t]),r=(0,Se.useContext)(Jt);return n&&r&&(0,Se.createPortal)((0,Se.createElement)("style",{dangerouslySetInnerHTML:{__html:n}}),r)}const en=["core/paragraph","core/list","core/code","core/preformatted","core/quote","core/blockquote"],tn=(0,mt.createHigherOrderComponent)((e=>function(t){const{name:n,clientId:r}=t,[s,i]=(0,Se.useState)(!1),{removeHighlightBlocks:o}=(0,h.useDispatch)("mind/blocks"),{highlightBlocks:l}=(0,h.useSelect)((e=>{const{getHighlightBlocks:t}=e("mind/blocks");return{highlightBlocks:t()}})),a=en.includes(n)&&l&&l.length&&l.includes(r);return(0,Se.useEffect)((()=>{a&&setTimeout((()=>{i(!0),setTimeout((()=>{i(!1),o([r])}),3e3)}),3e3)}),[a,r,o]),a?(0,Se.createElement)(Se.Fragment,null,(0,Se.createElement)(e,t),(0,Se.createElement)(Yt,{styles:`\n\t\t\t\t\t\t\t[data-block="${r}"] {\n\t\t\t\t\t\t\t\tbackground-color: rgba(228, 85, 223, 0.1);\n\t\t\t\t\t\t\t\tbox-shadow: 0 0 0 0.75rem rgba(228, 85, 223, 0.1);\n\t\t\t\t\t\t\t\t${s?"transition: 3s background-color, 3s box-shadow;":""}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t${s?`\n\t\t\t\t\t\t\t\t\t\t[data-block="${r}"] {\n\t\t\t\t\t\t\t\t\t\t\tbackground-color: rgba(228, 85, 223, 0);\n\t\t\t\t\t\t\t\t\t\t\tbox-shadow: 0 0 0 0.75rem rgba(228, 85, 223, 0);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t`:""}\n\t\t\t\t\t\t`})):(0,Se.createElement)(e,t)}),"withMindAIEditorStyles");(0,dt.addFilter)("editor.BlockEdit","mind/editor-styles",tn);const nn=(0,te.getLocaleData)(),rn="Type / to choose a block",sn=nn&&void 0!==nn[rn]?nn[rn]:rn;(0,te.setLocaleData)({[rn]:[`${sn}... Press \`space\` for AI`]},"default");const on=(0,mt.createHigherOrderComponent)((e=>function(t){const{name:n,attributes:r}=t,{content:s}=r,i=(0,mt.usePrevious)(s),{open:o,setInsertionPlace:l}=(0,h.useDispatch)("mind/popup");return(0,Se.useEffect)((()=>{"core/paragraph"!==n||i||" "!==s||(o(),l("selected-blocks"))}),[n,i,s,o,l]),(0,Se.createElement)(e,t)}),"withMindAI");(0,dt.addFilter)("editor.BlockEdit","mind/open-popup",on);const ln="mind-post-toolbar-toggle";function an(){const{toggle:e}=(0,h.useDispatch)("mind/popup");return(0,Se.createElement)("button",{type:"button",className:"components-button components-icon-button",onClick:t=>{t.preventDefault(),e()}},(0,Se.createElement)(Ge,null),(0,te.__)("Open Mind","@@text_domain"))}Fe()((()=>{(0,h.subscribe)((0,Vt.throttle)((()=>{if(document.querySelector(`.${ln}`))return;const e=document.querySelector(".edit-post-header__toolbar");e&&(e=>{const t=document.createElement("div");t.classList.add(ln),e.appendChild(t),(0,Se.createRoot)(t).render((0,Se.createElement)(an,null))})(e)}),200,{trailing:!0}))}))}},n={};function r(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.m=t,e=[],r.O=function(t,n,s,i){if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],s=e[u][1],i=e[u][2];for(var l=!0,a=0;a<n.length;a++)(!1&i||o>=i)&&Object.keys(r.O).every((function(e){return r.O[e](n[a])}))?n.splice(a--,1):(l=!1,i<o&&(o=i));if(l){e.splice(u--,1);var c=s();void 0!==c&&(t=c)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,s,i]},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e={189:0,307:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,i,o=n[0],l=n[1],a=n[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(s in l)r.o(l,s)&&(r.m[s]=l[s]);if(a)var u=a(r)}for(t&&t(n);c<o.length;c++)i=o[c],r.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return r.O(u)},n=self.webpackChunkmind=self.webpackChunkmind||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var s=r.O(void 0,[307],(function(){return r(181)}));s=r.O(s)}();