hanbiro-react16-sdk 1.0.6 → 1.0.7
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/README.md +130 -45
- package/dist/components/ChatAIDraft/SettingPopper.d.ts +2 -0
- package/dist/components/ChatAIDraft/index.d.ts +1 -0
- package/dist/components/LoadingCircular/index.d.ts +9 -0
- package/dist/components/LoadingContainer/index.d.ts +10 -0
- package/dist/components/TinyMceEditor/index.d.ts +41 -0
- package/dist/components/TinyMceEditor/scrollStyle.d.ts +1 -0
- package/dist/components/TinyMceEditor/useEditor.d.ts +24 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/hanbiro-react16-sdk.es.js +1595 -835
- package/dist/hanbiro-react16-sdk.style.css +5 -0
- package/dist/hanbiro-react16-sdk.umd.js +84 -33
- package/dist/utils/index.d.ts +1 -1
- package/package.json +4 -2
- package/dist/style.css +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* hanbiro-react16-sdk v1.0.6
|
|
3
|
+
* Build Date: 2026-03-26
|
|
4
|
+
*/
|
|
5
|
+
@charset "UTF-8";button.icon-button{background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:999px;transition:background .15s ease-in-out,color .15s ease-in-out;color:var(--grey-main)}button.icon-button:hover,button.icon-button:active{background-color:#f4f4f4}button.icon-button[disabled]{cursor:not-allowed;color:var(--grey-lighter)}button.icon-button.primary,button.icon-button[color=primary]{color:var(--primary-main)}button.icon-button.primary:hover,button.icon-button[color=primary]:hover{background-color:var(--primary-lighter)}button.icon-button.primary:active,button.icon-button[color=primary]:active{background-color:var(--primary-light)}button.icon-button.primary[disabled],button.icon-button[color=primary][disabled]{cursor:not-allowed;color:var(--primary-lighter);background:transparent}button.icon-button{width:36px;height:36px}button.icon-button svg{width:18px;height:18px}button.icon-button.small{width:32px;height:32px}button.icon-button.small svg{width:16px;height:16px}button.icon-button.large{width:40px;height:40px}button.icon-button.large svg{width:20px;height:20px}.circular-container{display:inline-block;animation:rotate 1.4s linear infinite}.circular-container .circular-svg{display:block}.circular-container .circular-circle{stroke-linecap:round;animation:dash 1.4s ease-in-out infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1px,200px;stroke-dashoffset:0}50%{stroke-dasharray:100px,200px;stroke-dashoffset:-15px}to{stroke-dasharray:100px,200px;stroke-dashoffset:-125px}}p{font-size:13px}:root{--primary-lighter: #d9edfd;--primary-light: #42a5f5;--primary-main: #0080fe;--primary-dark: #064476;--primary-darker: #03223b;--primary-contrasttext: #fff;--grey-lighter: #bebebe;--grey-light: #a9a9a9;--grey-main: #7f7f7f;--grey-dark: #6a6a6a;--grey-darker: #3f3f3f;--text-primary: #001737;--text-secondary: #8392a5;--background-softGrey: #f4f4f4;--background-lightGrey: #f9f9f9}
|
|
@@ -1,57 +1,108 @@
|
|
|
1
|
-
(function(y,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],k):(y=typeof globalThis<"u"?globalThis:y||self,k(y.HanbiroReact16SDK={},y.React))})(this,function(y,k){"use strict";var Ft=Object.defineProperty;var Kt=(y,k,A)=>k in y?Ft(y,k,{enumerable:!0,configurable:!0,writable:!0,value:A}):y[k]=A;var g=(y,k,A)=>Kt(y,typeof k!="symbol"?k+"":k,A);var me;function A(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const u=A(k);let U;const Ne=new Uint8Array(16);function He(){if(!U&&(U=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!U))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return U(Ne)}const v=[];for(let t=0;t<256;++t)v.push((t+256).toString(16).slice(1));function Ue(t,e=0){return v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]}const xe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function We(t,e,n){if(xe.randomUUID&&!t)return xe.randomUUID();t=t||{};const r=t.random||(t.rng||He)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ue(r)}function Ze(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var we={exports:{}},Ge="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Fe=Ge,Ke=Fe;function ye(){}function ve(){}ve.resetWarningCache=ye;var Ve=function(){function t(r,i,s,o,a,p){if(p!==Ke){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:ve,resetWarningCache:ye};return n.PropTypes=n,n};we.exports=Ve();var Qe=we.exports;const T=Ze(Qe);function Y(){return Y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Y.apply(this,arguments)}function Je(t,e){if(t==null)return{};var n=Xe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Xe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var W=k.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,s=i===void 0?24:i,o=Je(t,["color","size"]);return k.createElement("svg",Y({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),k.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),k.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))});W.propTypes={color:T.string,size:T.oneOfType([T.string,T.number])},W.displayName="Copy";function ee(){return ee=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ee.apply(this,arguments)}function Ye(t,e){if(t==null)return{};var n=et(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function et(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var te=k.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,s=i===void 0?24:i,o=Ye(t,["color","size"]);return k.createElement("svg",ee({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),k.createElement("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),k.createElement("polygon",{points:"22 2 15 22 11 13 2 9 22 2"}))});te.propTypes={color:T.string,size:T.oneOfType([T.string,T.number])},te.displayName="Send";function ne(){return ne=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ne.apply(this,arguments)}function tt(t,e){if(t==null)return{};var n=nt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function nt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var re=k.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,s=i===void 0?24:i,o=tt(t,["color","size"]);return k.createElement("svg",ne({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),k.createElement("circle",{cx:"12",cy:"12",r:"3"}),k.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}))});re.propTypes={color:T.string,size:T.oneOfType([T.string,T.number])},re.displayName="Settings";const ie=[{label:"Korean",value:"KR",extra:"ko"},{label:"English",value:"US",extra:"en"},{label:"Japanese",value:"JP"},{label:"Simplified Chinese",value:"zh-CN",extra:"zh-chs"},{label:"Traditional Chinese (Taiwan)",value:"zh-TW"},{label:"Traditional Chinese (Hong Kong)",value:"zh-HK",extra:"zh-cht"},{label:"Vietnamese",value:"VN",extra:"vi"},{label:"Indonesian",value:"ID",extra:"id"}],rt=({isGradient:t=!1,stroke:e=1.5,size:n=40})=>{const r="ai-gradient-"+Math.random().toString(36).substr(2,9);return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",style:{flexShrink:0}},t&&u.createElement("defs",null,u.createElement("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u.createElement("stop",{offset:"0%",stopColor:"#9D50BB"},u.createElement("animate",{attributeName:"offset",values:"0%;0.4;0%",dur:"1s",repeatCount:"indefinite"})),u.createElement("stop",{offset:"30%",stopColor:"#6E48AA"},u.createElement("animate",{attributeName:"offset",values:"0.4;0.7;0.4",dur:"1s",repeatCount:"indefinite"})),u.createElement("stop",{offset:"50%",stopColor:"#4776E6"},u.createElement("animate",{attributeName:"offset",values:"0.5;0.7;0.5",dur:"1s",repeatCount:"indefinite"})),u.createElement("animateTransform",{attributeName:"gradientTransform",type:"translate",from:"0,0",to:"100,0",dur:"1s",repeatCount:"indefinite"}))),u.createElement("path",{fill:"none",stroke:t?`url(#${r})`:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:e,d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"}))};async function it(t,{setContent:e,setIsLoading:n,setConversationId:r,signer:i,baseUrl:s}){let o="";try{n(!0);const a={method:"POST",baseURL:s,url:"/nmail/chatdraft",params:t};let p={};i&&typeof i.generateHeaders=="function"&&(p=await i.generateHeaders(a));const l=await fetch(`${s}/nmail/chatdraft`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*",...p}});if(n(!1),!l.body)throw new Error("Response body is not available for streaming.");const c=l.body.getReader();let d="",h=0;for(;;){const{done:w,value:f}=await c.read();if(w)break;let x="",R="";try{const $=new TextDecoder().decode(f);d+=$;const O=/"answer":".*?"/g,E=/"conversation_id"\s*:\s*"([^"]+)"/,M=[...d.matchAll(O)],N=d.match(E);for(N&&N[1]&&r(N[1]);h<M.length;){const H=M[h];try{x=H[0];const z=x.slice(10,x.length-1);R=`"${z}"`,z.endsWith("\\")&&(R=`"${z}\\"`);const Gt=JSON.parse(R);o+=Gt,e(o)}catch(z){console.error("Parse error: ",z,x,R)}h++}}catch($){console.error("TextDecoder error: ",$,x)}}return o}catch(a){console.error("Summary error:",a),e("")}finally{n(!1)}return""}function se(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var L=se();function Se(t){L=t}var D={exec:()=>null};function m(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(S.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var S={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},st=/^(?:[ \t]*(?:\n|$))+/,at=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,j=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ot=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ae=/(?:[*+-]|\d{1,9}[.)])/,Re=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Te=m(Re).replace(/bull/g,ae).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ct=m(Re).replace(/bull/g,ae).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),le=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pt=/^[^\n]+/,oe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ht=m(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",oe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ut=m(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ae).getRegex(),Z="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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ce=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gt=m("^ {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|$))","i").replace("comment",ce).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ee=m(le).replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").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",Z).getRegex(),dt=m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ee).getRegex(),pe={blockquote:dt,code:at,def:ht,fences:lt,heading:ot,hr:j,html:gt,lheading:Te,list:ut,newline:st,paragraph:Ee,table:D,text:pt},$e=m("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\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",Z).getRegex(),ft={...pe,lheading:ct,table:$e,paragraph:m(le).replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$e).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",Z).getRegex()},mt={...pe,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce).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:D,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(le).replace("hr",j).replace("heading",` *#{1,6} *[^
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=qt(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const r=q(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:q(e[0],`
|
|
1
|
+
/*!
|
|
2
|
+
* hanbiro-react16-sdk v1.0.6
|
|
3
|
+
* Build Date: 2026-03-26
|
|
4
|
+
*/
|
|
5
|
+
(function(C,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],y):(C=typeof globalThis<"u"?globalThis:C||self,y(C.HanbiroReact16SDK={},C.React,C.ReactDOM))})(this,function(C,y,M){"use strict";var Tn=Object.defineProperty;var In=(C,y,M)=>y in C?Tn(C,y,{enumerable:!0,configurable:!0,writable:!0,value:M}):C[y]=M;var b=(C,y,M)=>In(C,typeof y!="symbol"?y+"":y,M);var Ee;function Re(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const d=Re(y),st=Re(M);let W;const at=new Uint8Array(16);function lt(){if(!W&&(W=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!W))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return W(at)}const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function ct(t,e=0){return _[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]}const Te={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ut(t,e,n){if(Te.randomUUID&&!t)return Te.randomUUID();t=t||{};const r=t.random||(t.rng||lt)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ct(r)}function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ie={exports:{}},ht="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ft=ht,dt=ft;function $e(){}function ze(){}ze.resetWarningCache=$e;var gt=function(){function t(r,i,o,s,a,c){if(c!==dt){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:ze,resetWarningCache:$e};return n.PropTypes=n,n};Ie.exports=gt();var p=Ie.exports;const $=pt(p);function te(){return te=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},te.apply(this,arguments)}function mt(t,e){if(t==null)return{};var n=bt(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function bt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var F=y.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,s=mt(t,["color","size"]);return y.createElement("svg",te({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),y.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),y.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))});F.propTypes={color:$.string,size:$.oneOfType([$.string,$.number])},F.displayName="Copy";function ne(){return ne=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ne.apply(this,arguments)}function kt(t,e){if(t==null)return{};var n=vt(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var re=y.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,s=kt(t,["color","size"]);return y.createElement("svg",ne({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),y.createElement("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.createElement("polygon",{points:"22 2 15 22 11 13 2 9 22 2"}))});re.propTypes={color:$.string,size:$.oneOfType([$.string,$.number])},re.displayName="Send";function ie(){return ie=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ie.apply(this,arguments)}function yt(t,e){if(t==null)return{};var n=xt(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var oe=y.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,s=yt(t,["color","size"]);return y.createElement("svg",ie({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),y.createElement("circle",{cx:"12",cy:"12",r:"3"}),y.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}))});oe.propTypes={color:$.string,size:$.oneOfType([$.string,$.number])},oe.displayName="Settings";const se=[{label:"Korean",value:"KR",extra:"ko"},{label:"English",value:"US",extra:"en"},{label:"Japanese",value:"JP"},{label:"Simplified Chinese",value:"zh-CN",extra:"zh-chs"},{label:"Traditional Chinese (Taiwan)",value:"zh-TW"},{label:"Traditional Chinese (Hong Kong)",value:"zh-HK",extra:"zh-cht"},{label:"Vietnamese",value:"VN",extra:"vi"},{label:"Indonesian",value:"ID",extra:"id"}],wt=({isGradient:t=!1,stroke:e=1.5,size:n=40})=>{const r="ai-gradient-"+Math.random().toString(36).substr(2,9);return d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",style:{flexShrink:0}},t&&d.createElement("defs",null,d.createElement("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},d.createElement("stop",{offset:"0%",stopColor:"#9D50BB"},d.createElement("animate",{attributeName:"offset",values:"0%;0.4;0%",dur:"1s",repeatCount:"indefinite"})),d.createElement("stop",{offset:"30%",stopColor:"#6E48AA"},d.createElement("animate",{attributeName:"offset",values:"0.4;0.7;0.4",dur:"1s",repeatCount:"indefinite"})),d.createElement("stop",{offset:"50%",stopColor:"#4776E6"},d.createElement("animate",{attributeName:"offset",values:"0.5;0.7;0.5",dur:"1s",repeatCount:"indefinite"})),d.createElement("animateTransform",{attributeName:"gradientTransform",type:"translate",from:"0,0",to:"100,0",dur:"1s",repeatCount:"indefinite"}))),d.createElement("path",{fill:"none",stroke:t?`url(#${r})`:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:e,d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"}))};async function St(t,{setContent:e,setIsLoading:n,setConversationId:r,signer:i,baseUrl:o}){let s="";try{n(!0);const a={method:"POST",baseURL:o,url:"/nmail/chatdraft",params:t};let c={};i&&typeof i.generateHeaders=="function"&&(c=await i.generateHeaders(a));const l=await fetch(`${o}/nmail/chatdraft`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*",...c}});if(n(!1),!l.body)throw new Error("Response body is not available for streaming.");const u=l.body.getReader();let f="",h=0;for(;;){const{done:v,value:g}=await u.read();if(v)break;let m="",k="";try{const S=new TextDecoder().decode(g);f+=S;const R=/"answer":".*?"/g,E=/"conversation_id"\s*:\s*"([^"]+)"/,z=[...f.matchAll(R)],D=f.match(E);for(D&&D[1]&&r(D[1]);h<z.length;){const P=z[h];try{m=P[0];const T=m.slice(10,m.length-1);k=`"${T}"`,T.endsWith("\\")&&(k=`"${T}\\"`);const G=JSON.parse(k);s+=G,e(s)}catch(T){console.error("Parse error: ",T,m,k)}h++}}catch(S){console.error("TextDecoder error: ",S,m)}}return s}catch(a){console.error("Summary error:",a),e("")}finally{n(!1)}return""}function ae(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var B=ae();function Le(t){B=t}var N={exec:()=>null};function x(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,o)=>{let s=typeof o=="string"?o:o.source;return s=s.replace(I.caret,"$1"),n=n.replace(i,s),r},getRegex:()=>new RegExp(n,e)};return r}var I={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Et=/^(?:[ \t]*(?:\n|$))+/,Ct=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_t=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,H=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,le=/(?:[*+-]|\d{1,9}[.)])/,Pe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Oe=x(Pe).replace(/bull/g,le).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Tt=x(Pe).replace(/bull/g,le).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ce=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,It=/^[^\n]+/,ue=/(?!\s*\])(?:\\.|[^\[\]\\])+/,$t=x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ue).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zt=x(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,le).getRegex(),V="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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",pe=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lt=x("^ {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|$))","i").replace("comment",pe).replace("tag",V).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ae=x(ce).replace("hr",H).replace("heading"," {0,3}#{1,6}(?:\\s|$)").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",V).getRegex(),Pt=x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ae).getRegex(),he={blockquote:Pt,code:Ct,def:$t,fences:_t,heading:Rt,hr:H,html:Lt,lheading:Oe,list:zt,newline:Et,paragraph:Ae,table:N,text:It},De=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",H).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\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",V).getRegex(),Ot={...he,lheading:Tt,table:De,paragraph:x(ce).replace("hr",H).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",De).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",V).getRegex()},At={...he,html:x(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe).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:N,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(ce).replace("hr",H).replace("heading",` *#{1,6} *[^
|
|
6
|
+
]`).replace("lheading",Oe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Dt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Be=/^( {2,}|\\)\n(?!\s*$)/,jt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,K=/[\p{P}\p{S}]/u,fe=/[\s\p{P}\p{S}]/u,je=/[^\s\p{P}\p{S}]/u,Mt=x(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,fe).getRegex(),Me=/(?!~)[\p{P}\p{S}]/u,Nt=/(?!~)[\s\p{P}\p{S}]/u,Ht=/(?:[^\s\p{P}\p{S}]|~)/u,Ut=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ne=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qt=x(Ne,"u").replace(/punct/g,K).getRegex(),Gt=x(Ne,"u").replace(/punct/g,Me).getRegex(),He="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Wt=x(He,"gu").replace(/notPunctSpace/g,je).replace(/punctSpace/g,fe).replace(/punct/g,K).getRegex(),Ft=x(He,"gu").replace(/notPunctSpace/g,Ht).replace(/punctSpace/g,Nt).replace(/punct/g,Me).getRegex(),Vt=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,je).replace(/punctSpace/g,fe).replace(/punct/g,K).getRegex(),Kt=x(/\\(punct)/,"gu").replace(/punct/g,K).getRegex(),Zt=x(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),Qt=x(pe).replace("(?:-->|$)","-->").getRegex(),Jt=x("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Qt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Z=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Yt=x(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Z).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ue=x(/^!?\[(label)\]\[(ref)\]/).replace("label",Z).replace("ref",ue).getRegex(),qe=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",ue).getRegex(),Xt=x("reflink|nolink(?!\\()","g").replace("reflink",Ue).replace("nolink",qe).getRegex(),de={_backpedal:N,anyPunctuation:Kt,autolink:Zt,blockSkip:Ut,br:Be,code:Bt,del:N,emStrongLDelim:qt,emStrongRDelimAst:Wt,emStrongRDelimUnd:Vt,escape:Dt,link:Yt,nolink:qe,punctuation:Mt,reflink:Ue,reflinkSearch:Xt,tag:Jt,text:jt,url:N},en={...de,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",Z).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z).getRegex()},ge={...de,emStrongRDelimAst:Ft,emStrongLDelim:Gt,url:x(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\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.!#$%&'*+\/=?_`{\|}~-]+@)))/},tn={...ge,br:x(Be).replace("{2,}","*").getRegex(),text:x(ge.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:he,gfm:Ot,pedantic:At},U={normal:de,gfm:ge,breaks:tn,pedantic:en},nn={"&":"&","<":"<",">":">",'"':""","'":"'"},Ge=t=>nn[t];function L(t,e){if(e){if(I.escapeTest.test(t))return t.replace(I.escapeReplace,Ge)}else if(I.escapeTestNoEncode.test(t))return t.replace(I.escapeReplaceNoEncode,Ge);return t}function We(t){try{t=encodeURI(t).replace(I.percentDecode,"%")}catch{return null}return t}function Fe(t,e){var o;const n=t.replace(I.findPipe,(s,a,c)=>{let l=!1,u=a;for(;--u>=0&&c[u]==="\\";)l=!l;return l?"|":" |"}),r=n.split(I.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!((o=r.at(-1))!=null&&o.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(I.slashPipe,"|");return r}function q(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function rn(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ve(t,e,n,r,i){const o=e.href,s=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const c={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function on(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
|
|
7
|
+
`).map(o=>{const s=o.match(n.other.beginningSpace);if(s===null)return o;const[a]=s;return a.length>=i.length?o.slice(i.length):o}).join(`
|
|
8
|
+
`)}var J=class{constructor(t){b(this,"options");b(this,"rules");b(this,"lexer");this.options=t||B}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:q(n,`
|
|
9
|
+
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=on(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const r=q(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:q(e[0],`
|
|
6
10
|
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=q(e[0],`
|
|
7
11
|
`).split(`
|
|
8
|
-
`),r="",i="";const
|
|
9
|
-
`),
|
|
12
|
+
`),r="",i="";const o=[];for(;n.length>0;){let s=!1;const a=[];let c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))a.push(n[c]),s=!0;else if(!s)a.push(n[c]);else break;n=n.slice(c);const l=a.join(`
|
|
13
|
+
`),u=l.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
14
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
11
15
|
${l}`:l,i=i?`${i}
|
|
12
|
-
${
|
|
16
|
+
${u}`:u;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=f,n.length===0)break;const h=o.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){const v=h,g=v.raw+`
|
|
13
17
|
`+n.join(`
|
|
14
|
-
`),
|
|
18
|
+
`),m=this.blockquote(g);o[o.length-1]=m,r=r.substring(0,r.length-v.raw.length)+m.raw,i=i.substring(0,i.length-v.text.length)+m.text;break}else if((h==null?void 0:h.type)==="list"){const v=h,g=v.raw+`
|
|
15
19
|
`+n.join(`
|
|
16
|
-
`),
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:
|
|
18
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs
|
|
19
|
-
`,1)[0],
|
|
20
|
-
`,t=t.substring(h.length+1),
|
|
21
|
-
`,1)[0];let
|
|
22
|
-
`+
|
|
23
|
-
`+h}!
|
|
24
|
-
`,t=t.substring(
|
|
25
|
-
`):[],
|
|
26
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const
|
|
27
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var i,s
|
|
20
|
+
`),m=this.list(g);o[o.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,i=i.substring(0,i.length-v.raw.length)+m.raw,n=g.substring(o.at(-1).raw.length).split(`
|
|
21
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:o,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const o=this.rules.other.listItemRegex(n);let s=!1;for(;t;){let c=!1,l="",u="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let f=e[2].split(`
|
|
22
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,S=>" ".repeat(3*S.length)),h=t.split(`
|
|
23
|
+
`,1)[0],v=!f.trim(),g=0;if(this.options.pedantic?(g=2,u=f.trimStart()):v?g=e[1].length+1:(g=e[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=f.slice(g),g+=e[1].length),v&&this.rules.other.blankLine.test(h)&&(l+=h+`
|
|
24
|
+
`,t=t.substring(h.length+1),c=!0),!c){const S=this.rules.other.nextBulletRegex(g),R=this.rules.other.hrRegex(g),E=this.rules.other.fencesBeginRegex(g),z=this.rules.other.headingBeginRegex(g),D=this.rules.other.htmlBeginRegex(g);for(;t;){const P=t.split(`
|
|
25
|
+
`,1)[0];let T;if(h=P,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),T=h):T=h.replace(this.rules.other.tabCharGlobal," "),E.test(h)||z.test(h)||D.test(h)||S.test(h)||R.test(h))break;if(T.search(this.rules.other.nonSpaceChar)>=g||!h.trim())u+=`
|
|
26
|
+
`+T.slice(g);else{if(v||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(f)||z.test(f)||R.test(f))break;u+=`
|
|
27
|
+
`+h}!v&&!h.trim()&&(v=!0),l+=P+`
|
|
28
|
+
`,t=t.substring(P.length+1),f=T.slice(g)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(s=!0));let m=null,k;this.options.gfm&&(m=this.rules.other.listIsTask.exec(u),m&&(k=m[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:l,task:!!m,checked:k,loose:!1,text:u,tokens:[]}),i.raw+=l}const a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){const l=i.items[c].tokens.filter(f=>f.type==="space"),u=l.length>0&&l.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=u}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){var s;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=Fe(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(s=e[3])!=null&&s.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
29
|
+
`):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const a of r)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<n.length;a++)o.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:o.align[a]});for(const a of i)o.rows.push(Fe(a,o.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[l]})));return o}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
|
|
30
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const o=q(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{const o=rn(e[2],"()");if(o===-2)return;if(o>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ve(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Ve(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const o=[...r[0]].length-1;let s,a,c=o,l=0;const u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+o);(r=u.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){c+=a;continue}else if((r[5]||r[6])&&o%3&&!((o+a)%3)){l+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c+l);const f=[...r[0]][0].length,h=t.slice(0,o+r.index+f+a);if(Math.min(o,a)%2){const g=h.slice(1,-1);return{type:"em",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}const v=h.slice(2,-2);return{type:"strong",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let o;do o=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(o!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},O=class Ce{constructor(e){b(this,"tokens");b(this,"options");b(this,"state");b(this,"tokenizer");b(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||B,this.options.tokenizer=this.options.tokenizer||new J,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 n={other:I,block:Q.normal,inline:U.normal};this.options.pedantic?(n.block=Q.pedantic,n.inline=U.pedantic):this.options.gfm&&(n.block=Q.gfm,this.options.breaks?n.inline=U.breaks:n.inline=U.gfm),this.tokenizer.rules=n}static get rules(){return{block:Q,inline:U}}static lex(e,n){return new Ce(n).lex(e)}static lexInline(e,n){return new Ce(n).inlineTokens(e)}lex(e){e=e.replace(I.carriageReturn,`
|
|
31
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var i,o,s;for(this.options.pedantic&&(e=e.replace(I.tabCharGlobal," ").replace(I.spaceLine,""));e;){let a;if((o=(i=this.options.extensions)==null?void 0:i.block)!=null&&o.some(l=>(a=l.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const l=n.at(-1);a.raw.length===1&&l!==void 0?l.raw+=`
|
|
28
32
|
`:n.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const l=n.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
|
|
29
33
|
`+a.raw,l.text+=`
|
|
30
34
|
`+a.text,this.inlineQueue.at(-1).src=l.text):n.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);const l=n.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
|
|
31
35
|
`+a.raw,l.text+=`
|
|
32
|
-
`+a.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),n.push(a);continue}let
|
|
36
|
+
`+a.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),n.push(a);continue}let c=e;if((s=this.options.extensions)!=null&&s.startBlock){let l=1/0;const u=e.slice(1);let f;this.options.extensions.startBlock.forEach(h=>{f=h.call({lexer:this},u),typeof f=="number"&&f>=0&&(l=Math.min(l,f))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){const l=n.at(-1);r&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
|
|
33
37
|
`+a.raw,l.text+=`
|
|
34
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a),r=
|
|
38
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a),r=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const l=n.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
|
|
35
39
|
`+a.raw,l.text+=`
|
|
36
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var a,
|
|
37
|
-
`;return r?'<pre><code class="language-'+
|
|
38
|
-
`:"<pre><code>"+(n?i:
|
|
40
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var a,c,l;let r=e,i=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,s="";for(;e;){o||(s=""),o=!1;let u;if((c=(a=this.options.extensions)==null?void 0:a.inline)!=null&&c.some(h=>(u=h.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const h=n.at(-1);u.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,s)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let f=e;if((l=this.options.extensions)!=null&&l.startInline){let h=1/0;const v=e.slice(1);let g;this.options.extensions.startInline.forEach(m=>{g=m.call({lexer:this},v),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(f=e.substring(0,h+1))}if(u=this.tokenizer.inlineText(f)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(s=u.raw.slice(-1)),o=!0;const h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Y=class{constructor(t){b(this,"options");b(this,"parser");this.options=t||B}space(t){return""}code({text:t,lang:e,escaped:n}){var o;const r=(o=(e||"").match(I.notSpaceStart))==null?void 0:o[0],i=t.replace(I.endingNewline,"")+`
|
|
41
|
+
`;return r?'<pre><code class="language-'+L(r)+'">'+(n?i:L(i,!0))+`</code></pre>
|
|
42
|
+
`:"<pre><code>"+(n?i:L(i,!0))+`</code></pre>
|
|
39
43
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
40
44
|
${this.parser.parse(t)}</blockquote>
|
|
41
45
|
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
42
46
|
`}hr(t){return`<hr>
|
|
43
|
-
`}list(t){const e=t.ordered,n=t.start;let r="";for(let
|
|
47
|
+
`}list(t){const e=t.ordered,n=t.start;let r="";for(let s=0;s<t.items.length;s++){const a=t.items[s];r+=this.listitem(a)}const i=e?"ol":"ul",o=e&&n!==1?' start="'+n+'"':"";return"<"+i+o+`>
|
|
44
48
|
`+r+"</"+i+`>
|
|
45
|
-
`}listitem(t){var n;let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?((n=t.tokens[0])==null?void 0:n.type)==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+
|
|
49
|
+
`}listitem(t){var n;let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?((n=t.tokens[0])==null?void 0:n.type)==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+L(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
46
50
|
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
47
|
-
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){const
|
|
51
|
+
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){const o=t.rows[i];n="";for(let s=0;s<o.length;s++)n+=this.tablecell(o[s]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
48
52
|
<thead>
|
|
49
53
|
`+e+`</thead>
|
|
50
54
|
`+r+`</table>
|
|
51
55
|
`}tablerow({text:t}){return`<tr>
|
|
52
56
|
${t}</tr>
|
|
53
57
|
`}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
54
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${
|
|
55
|
-
`+this.renderer.text(l);n?r+=this.renderer.paragraph({type:"paragraph",raw:
|
|
56
|
-
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+
|
|
57
|
-
`,"");const a=i.replace(
|
|
58
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${L(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),i=We(t);if(i===null)return r;t=i;let o='<a href="'+t+'"';return e&&(o+=' title="'+L(e)+'"'),o+=">"+r+"</a>",o}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=We(t);if(i===null)return L(n);t=i;let o=`<img src="${t}" alt="${n}"`;return e&&(o+=` title="${L(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:L(t.text)}},me=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},A=class _e{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||B,this.options.renderer=this.options.renderer||new Y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new me}static parse(e,n){return new _e(n).parse(e)}static parseInline(e,n){return new _e(n).parseInline(e)}parse(e,n=!0){var i,o;let r="";for(let s=0;s<e.length;s++){const a=e[s];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[a.type]){const l=a,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){r+=u||"";continue}}const c=a;switch(c.type){case"space":{r+=this.renderer.space(c);continue}case"hr":{r+=this.renderer.hr(c);continue}case"heading":{r+=this.renderer.heading(c);continue}case"code":{r+=this.renderer.code(c);continue}case"table":{r+=this.renderer.table(c);continue}case"blockquote":{r+=this.renderer.blockquote(c);continue}case"list":{r+=this.renderer.list(c);continue}case"html":{r+=this.renderer.html(c);continue}case"paragraph":{r+=this.renderer.paragraph(c);continue}case"text":{let l=c,u=this.renderer.text(l);for(;s+1<e.length&&e[s+1].type==="text";)l=e[++s],u+=`
|
|
59
|
+
`+this.renderer.text(l);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,n=this.renderer){var i,o;let r="";for(let s=0;s<e.length;s++){const a=e[s];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[a.type]){const l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=l||"";continue}}const c=a;switch(c.type){case"escape":{r+=n.text(c);break}case"html":{r+=n.html(c);break}case"link":{r+=n.link(c);break}case"image":{r+=n.image(c);break}case"strong":{r+=n.strong(c);break}case"em":{r+=n.em(c);break}case"codespan":{r+=n.codespan(c);break}case"br":{r+=n.br(c);break}case"del":{r+=n.del(c);break}case"text":{r+=n.text(c);break}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},X=(Ee=class{constructor(t){b(this,"options");b(this,"block");this.options=t||B}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?O.lex:O.lexInline}provideParser(){return this.block?A.parse:A.parseInline}},b(Ee,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ee),sn=class{constructor(...t){b(this,"defaults",ae());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",A);b(this,"Renderer",Y);b(this,"TextRenderer",me);b(this,"Lexer",O);b(this,"Tokenizer",J);b(this,"Hooks",X);this.use(...t)}walkTokens(t,e){var r,i;let n=[];for(const o of t)switch(n=n.concat(e.call(this,o)),o.type){case"table":{const s=o;for(const a of s.header)n=n.concat(this.walkTokens(a.tokens,e));for(const a of s.rows)for(const c of a)n=n.concat(this.walkTokens(c.tokens,e));break}case"list":{const s=o;n=n.concat(this.walkTokens(s.items,e));break}default:{const s=o;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{const c=s[a].flat(1/0);n=n.concat(this.walkTokens(c,e))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const o=e.renderers[i.name];o?e.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=o.apply(this,s)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=e[i.level];o?o.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=this.defaults.renderer||new Y(this.defaults);for(const o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;const s=o,a=n.renderer[s],c=i[s];i[s]=(...l)=>{let u=a.apply(i,l);return u===!1&&(u=c.apply(i,l)),u||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new J(this.defaults);for(const o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const s=o,a=n.tokenizer[s],c=i[s];i[s]=(...l)=>{let u=a.apply(i,l);return u===!1&&(u=c.apply(i,l)),u}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new X;for(const o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;const s=o,a=n.hooks[s],c=i[s];X.passThroughHooks.has(o)?i[s]=l=>{if(this.defaults.async)return Promise.resolve(a.call(i,l)).then(f=>c.call(i,f));const u=a.call(i,l);return c.call(i,u)}:i[s]=(...l)=>{let u=a.apply(i,l);return u===!1&&(u=c.apply(i,l)),u}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(s){let a=[];return a.push(o.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return O.lex(t,e??this.defaults)}parser(t,e){return A.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const i={...r},o={...this.defaults,...i},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=t);const a=o.hooks?o.hooks.provideLexer():t?O.lex:O.lexInline,c=o.hooks?o.hooks.provideParser():t?A.parse:A.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(l=>a(l,o)).then(l=>o.hooks?o.hooks.processAllTokens(l):l).then(l=>o.walkTokens?Promise.all(this.walkTokens(l,o.walkTokens)).then(()=>l):l).then(l=>c(l,o)).then(l=>o.hooks?o.hooks.postprocess(l):l).catch(s);try{o.hooks&&(n=o.hooks.preprocess(n));let l=a(n,o);o.hooks&&(l=o.hooks.processAllTokens(l)),o.walkTokens&&this.walkTokens(l,o.walkTokens);let u=c(l,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(l){return s(l)}}}onError(t,e){return n=>{if(n.message+=`
|
|
60
|
+
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+L(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},j=new sn;function w(t,e){return j.parse(t,e)}w.options=w.setOptions=function(t){return j.setOptions(t),w.defaults=j.defaults,Le(w.defaults),w},w.getDefaults=ae,w.defaults=B,w.use=function(...t){return j.use(...t),w.defaults=j.defaults,Le(w.defaults),w},w.walkTokens=function(t,e){return j.walkTokens(t,e)},w.parseInline=j.parseInline,w.Parser=A,w.parser=A.parse,w.Renderer=Y,w.TextRenderer=me,w.Lexer=O,w.lexer=O.lex,w.Tokenizer=J,w.Hooks=X,w.parse=w,w.options,w.setOptions,w.use,w.walkTokens,w.parseInline,A.parse,O.lex;const Ke=({data:t,style:e})=>d.createElement("div",{style:{maxWidth:"80%",...e}},t&&t.subject?d.createElement("div",{dangerouslySetInnerHTML:{__html:w.parse(t.body,{async:!1})}}):d.createElement("p",{style:{margin:0,whiteSpace:"pre-wrap"}},t?t.question:"")),be=({size:t=40,color:e="var(--primary-main)",thickness:n=3.6})=>{const i=2*Math.PI*20;return y.createElement("div",{className:"circular-container",style:{width:t,height:t},role:"progressbar"},y.createElement("svg",{className:"circular-svg",viewBox:"22 22 44 44"},y.createElement("circle",{className:"circular-circle",cx:"44",cy:"44",r:20,fill:"none",stroke:e,strokeWidth:n,strokeDasharray:i,style:{strokeDashoffset:i*.7}})))},an=({items:t,onApply:e,getEditorContent:n})=>{const r=async i=>{const o=/제목:[^\n]*/g;((o.exec(i)||[])[0]||"").replace("제목: ","").replace(`
|
|
61
|
+
`,"");const a=i.replace(o,"").replace("본문: ","");let c=await w.parse(a);const l=/<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g,u=n?n():"",f=l.exec(u)||[];f[0]&&(c=c+"<br>"+f[0]),e({html:c})};return d.createElement("div",{style:{flex:1,minHeight:0,position:"relative",overflowY:"auto",paddingRight:16,marginRight:-16,marginBottom:8,display:"flex",flexDirection:"column"}},t&&t.map(i=>d.createElement("div",{key:i.id,style:{display:"flex",flexDirection:"column",marginBottom:16}},d.createElement("div",{style:{width:"100%",display:"flex",alignItems:"flex-end",flexDirection:"column",position:"relative",marginTop:8}},d.createElement(Ke,{data:{question:i.question},style:{borderRadius:8,borderTopRightRadius:0,padding:"8px 12px",background:"var(--background-softGrey)"}})),d.createElement("div",{style:{width:"100%",display:"flex",alignItems:"flex-start",flexDirection:"column",position:"relative",marginTop:8}},i!=null&&i.isLoading?d.createElement(be,{size:32}):d.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%"}},d.createElement(Ke,{data:{subject:i.subject,body:i.body},style:{background:"var(--background-softGrey)",borderRadius:8,borderTopLeftRadius:0,padding:"8px 12px",flexShrink:0}}),d.createElement("button",{type:"button",title:"Apply content",onClick:()=>r(i.body),className:"icon-button small",style:{marginLeft:4}},d.createElement(F,{size:16,color:"#666"})))))))},ln={small:28,medium:40},Ze=({style:t,fullHeight:e=!1,size:n="medium",label:r})=>y.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:e?"100%":350,...t}},y.createElement(be,{size:ln[n]}),r&&y.createElement("p",{color:"text.secondary",style:{marginTop:16,fontSize:n==="small"?12:13}},r)),cn=`
|
|
62
|
+
::-webkit-scrollbar,
|
|
63
|
+
*::-webkit-scrollbar {
|
|
64
|
+
width: 8px;
|
|
65
|
+
height: 8px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
*::-webkit-scrollbar-track {
|
|
69
|
+
background: transparent;
|
|
70
|
+
backdrop-filter: blur(6px);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
::-webkit-scrollbar-thumb,
|
|
74
|
+
*::-webkit-scrollbar-thumb {
|
|
75
|
+
background: #e0e0e0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
::-webkit-scrollbar-thumb:focus,
|
|
79
|
+
*::-webkit-scrollbar-thumb:focus {
|
|
80
|
+
background: #bdbdbd;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
::-webkit-scrollbar-thumb:active,
|
|
84
|
+
*::-webkit-scrollbar-thumb:active {
|
|
85
|
+
background: #bdbdbd;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
::-webkit-scrollbar-thumb:hover,
|
|
89
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
90
|
+
background: #bdbdbd;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
::-webkit-scrollbar-corner,
|
|
94
|
+
*::-webkit-scrollbar-corner {
|
|
95
|
+
background-color: transparent;
|
|
96
|
+
}
|
|
97
|
+
`;var ke=function(){return ke=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ke.apply(this,arguments)},Qe={onActivate:p.func,onAddUndo:p.func,onBeforeAddUndo:p.func,onBeforeExecCommand:p.func,onBeforeGetContent:p.func,onBeforeRenderUI:p.func,onBeforeSetContent:p.func,onBeforePaste:p.func,onBlur:p.func,onChange:p.func,onClearUndos:p.func,onClick:p.func,onContextMenu:p.func,onCommentChange:p.func,onCopy:p.func,onCut:p.func,onDblclick:p.func,onDeactivate:p.func,onDirty:p.func,onDrag:p.func,onDragDrop:p.func,onDragEnd:p.func,onDragGesture:p.func,onDragOver:p.func,onDrop:p.func,onExecCommand:p.func,onFocus:p.func,onFocusIn:p.func,onFocusOut:p.func,onGetContent:p.func,onHide:p.func,onInit:p.func,onKeyDown:p.func,onKeyPress:p.func,onKeyUp:p.func,onLoadContent:p.func,onMouseDown:p.func,onMouseEnter:p.func,onMouseLeave:p.func,onMouseMove:p.func,onMouseOut:p.func,onMouseOver:p.func,onMouseUp:p.func,onNodeChange:p.func,onObjectResizeStart:p.func,onObjectResized:p.func,onObjectSelected:p.func,onPaste:p.func,onPostProcess:p.func,onPostRender:p.func,onPreProcess:p.func,onProgressState:p.func,onRedo:p.func,onRemove:p.func,onReset:p.func,onSaveContent:p.func,onSelectionChange:p.func,onSetAttrib:p.func,onSetContent:p.func,onShow:p.func,onSubmit:p.func,onUndo:p.func,onVisualAid:p.func,onSkinLoadError:p.func,onThemeLoadError:p.func,onModelLoadError:p.func,onPluginLoadError:p.func,onIconsLoadError:p.func,onLanguageLoadError:p.func,onScriptsLoad:p.func,onScriptsLoadError:p.func},un=ke({apiKey:p.string,id:p.string,inline:p.bool,init:p.object,initialValue:p.string,onEditorChange:p.func,value:p.string,tagName:p.string,cloudChannel:p.string,plugins:p.oneOfType([p.string,p.array]),toolbar:p.oneOfType([p.string,p.array]),disabled:p.bool,textareaName:p.string,tinymceScriptSrc:p.oneOfType([p.string,p.arrayOf(p.string),p.arrayOf(p.shape({src:p.string,async:p.bool,defer:p.bool}))]),rollback:p.oneOfType([p.number,p.oneOf([!1])]),scriptLoading:p.shape({async:p.bool,defer:p.bool,delay:p.number})},Qe),ve=function(t){return typeof t=="function"},Je=function(t){return t in Qe},Ye=function(t){return t.substr(2)},pn=function(t,e,n,r,i,o,s){var a=Object.keys(i).filter(Je),c=Object.keys(o).filter(Je),l=a.filter(function(f){return o[f]===void 0}),u=c.filter(function(f){return i[f]===void 0});l.forEach(function(f){var h=Ye(f),v=s[h];n(h,v),delete s[h]}),u.forEach(function(f){var h=r(t,f),v=Ye(f);s[v]=h,e(v,h)})},hn=function(t,e,n,r,i){return pn(i,t.on.bind(t),t.off.bind(t),function(o,s){return function(a){var c;return(c=o(s))===null||c===void 0?void 0:c(a,t)}},e,n,r)},Xe=0,et=function(t){var e=Date.now(),n=Math.floor(Math.random()*1e9);return Xe++,t+"_"+n+Xe+String(e)},tt=function(t){return t!==null&&(t.tagName.toLowerCase()==="textarea"||t.tagName.toLowerCase()==="input")},nt=function(t){return typeof t>"u"||t===""?[]:Array.isArray(t)?t:t.split(" ")},fn=function(t,e){return nt(t).concat(nt(e))},dn=function(){return window.InputEvent&&typeof InputEvent.prototype.getTargetRanges=="function"},gn=function(t){if(!("isConnected"in Node.prototype)){for(var e=t,n=t.parentNode;n!=null;)e=n,n=e.parentNode;return e===t.ownerDocument}return t.isConnected},rt=function(t,e){t!==void 0&&(t.mode!=null&&typeof t.mode=="object"&&typeof t.mode.set=="function"?t.mode.set(e):t.setMode(e))},ye=function(){return ye=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ye.apply(this,arguments)},mn=function(t,e,n){var r,i,o=t.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=e.id,o.src=e.src,o.async=(r=e.async)!==null&&r!==void 0?r:!1,o.defer=(i=e.defer)!==null&&i!==void 0?i:!1;var s=function(){o.removeEventListener("load",s),o.removeEventListener("error",a),n(e.src)},a=function(c){o.removeEventListener("load",s),o.removeEventListener("error",a),n(e.src,c)};o.addEventListener("load",s),o.addEventListener("error",a),t.head&&t.head.appendChild(o)},bn=function(t){var e={},n=function(s,a){var c=e[s];c.done=!0,c.error=a;for(var l=0,u=c.handlers;l<u.length;l++){var f=u[l];f(s,a)}c.handlers=[]},r=function(s,a,c){var l=function(R){return c!==void 0?c(R):console.error(R)};if(s.length===0){l(new Error("At least one script must be provided"));return}for(var u=0,f=!1,h=function(R,E){f||(E?(f=!0,l(E)):++u===s.length&&a())},v=0,g=s;v<g.length;v++){var m=g[v],k=e[m.src];if(k)k.done?h(m.src,k.error):k.handlers.push(h);else{var S=et("tiny-");e[m.src]={id:S,src:m.src,done:!1,error:null,handlers:[h]},mn(t,ye({id:S},m),n)}}},i=function(){for(var s,a=0,c=Object.values(e);a<c.length;a++){var l=c[a],u=t.getElementById(l.id);u!=null&&u.tagName==="SCRIPT"&&((s=u.parentNode)===null||s===void 0||s.removeChild(u))}e={}},o=function(){return t};return{loadScripts:r,deleteScripts:i,getDocument:o}},kn=function(){var t=[],e=function(i){var o=t.find(function(s){return s.getDocument()===i});return o===void 0&&(o=bn(i),t.push(o)),o},n=function(i,o,s,a,c){var l=function(){return e(i).loadScripts(o,a,c)};s>0?setTimeout(l,s):l()},r=function(){for(var i=t.pop();i!=null;i=t.pop())i.deleteScripts()};return{loadList:n,reinitialize:r}},vn=kn(),xe=function(t){var e=t;return e&&e.tinymce?e.tinymce:null},yn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ee=function(){return ee=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ee.apply(this,arguments)},xn=function(t){yn(e,t);function e(n){var r,i,o,s=t.call(this,n)||this;return s.rollbackTimer=void 0,s.valueCursor=void 0,s.rollbackChange=function(){var a=s.editor,c=s.props.value;a&&c&&c!==s.currentContent&&a.undoManager.ignore(function(){if(a.setContent(c),s.valueCursor&&(!s.inline||a.hasFocus()))try{a.selection.moveToBookmark(s.valueCursor)}catch{}}),s.rollbackTimer=void 0},s.handleBeforeInput=function(a){if(s.props.value!==void 0&&s.props.value===s.currentContent&&s.editor&&(!s.inline||s.editor.hasFocus()))try{s.valueCursor=s.editor.selection.getBookmark(3)}catch{}},s.handleBeforeInputSpecial=function(a){(a.key==="Enter"||a.key==="Backspace"||a.key==="Delete")&&s.handleBeforeInput(a)},s.handleEditorChange=function(a){var c=s.editor;if(c&&c.initialized){var l=c.getContent();s.props.value!==void 0&&s.props.value!==l&&s.props.rollback!==!1&&(s.rollbackTimer||(s.rollbackTimer=window.setTimeout(s.rollbackChange,typeof s.props.rollback=="number"?s.props.rollback:200))),l!==s.currentContent&&(s.currentContent=l,ve(s.props.onEditorChange)&&s.props.onEditorChange(l,c))}},s.handleEditorChangeSpecial=function(a){(a.key==="Backspace"||a.key==="Delete")&&s.handleEditorChange(a)},s.initialise=function(a){var c,l,u;a===void 0&&(a=0);var f=s.elementRef.current;if(f){if(!gn(f)){if(a===0)setTimeout(function(){return s.initialise(1)},1);else if(a<100)setTimeout(function(){return s.initialise(a+1)},100);else throw new Error("tinymce can only be initialised when in a document");return}var h=xe(s.view);if(!h)throw new Error("tinymce should have been loaded into global scope");var v=ee(ee({},s.props.init),{selector:void 0,target:f,readonly:s.props.disabled,inline:s.inline,plugins:fn((c=s.props.init)===null||c===void 0?void 0:c.plugins,s.props.plugins),toolbar:(l=s.props.toolbar)!==null&&l!==void 0?l:(u=s.props.init)===null||u===void 0?void 0:u.toolbar,setup:function(g){s.editor=g,s.bindHandlers({}),s.inline&&!tt(f)&&g.once("PostRender",function(m){g.setContent(s.getInitialValue(),{no_events:!0})}),s.props.init&&ve(s.props.init.setup)&&s.props.init.setup(g)},init_instance_callback:function(g){var m,k,S=s.getInitialValue();s.currentContent=(m=s.currentContent)!==null&&m!==void 0?m:g.getContent(),s.currentContent!==S&&(s.currentContent=S,g.setContent(S),g.undoManager.clear(),g.undoManager.add(),g.setDirty(!1));var R=(k=s.props.disabled)!==null&&k!==void 0?k:!1;rt(s.editor,R?"readonly":"design"),s.props.init&&ve(s.props.init.init_instance_callback)&&s.props.init.init_instance_callback(g)}});s.inline||(f.style.visibility=""),tt(f)&&(f.value=s.getInitialValue()),h.init(v)}},s.id=s.props.id||et("tiny-react"),s.elementRef=d.createRef(),s.inline=(o=(r=s.props.inline)!==null&&r!==void 0?r:(i=s.props.init)===null||i===void 0?void 0:i.inline)!==null&&o!==void 0?o:!1,s.boundHandlers={},s}return Object.defineProperty(e.prototype,"view",{get:function(){var n,r;return(r=(n=this.elementRef.current)===null||n===void 0?void 0:n.ownerDocument.defaultView)!==null&&r!==void 0?r:window},enumerable:!1,configurable:!0}),e.prototype.componentDidUpdate=function(n){var r=this,i,o;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(n),this.editor.initialized)){if(this.currentContent=(i=this.currentContent)!==null&&i!==void 0?i:this.editor.getContent(),typeof this.props.initialValue=="string"&&this.props.initialValue!==n.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if(typeof this.props.value=="string"&&this.props.value!==this.currentContent){var s=this.editor;s.undoManager.transact(function(){var c;if(!r.inline||s.hasFocus())try{c=s.selection.getBookmark(3)}catch{}var l=r.valueCursor;if(s.setContent(r.props.value),!r.inline||s.hasFocus())for(var u=0,f=[c,l];u<f.length;u++){var h=f[u];if(h)try{s.selection.moveToBookmark(h),r.valueCursor=h;break}catch{}}})}if(this.props.disabled!==n.disabled){var a=(o=this.props.disabled)!==null&&o!==void 0?o:!1;rt(this.editor,a?"readonly":"design")}}},e.prototype.componentDidMount=function(){var n=this,r,i,o,s,a;if(xe(this.view)!==null)this.initialise();else if(Array.isArray(this.props.tinymceScriptSrc)&&this.props.tinymceScriptSrc.length===0)(i=(r=this.props).onScriptsLoadError)===null||i===void 0||i.call(r,new Error("No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array."));else if(!((o=this.elementRef.current)===null||o===void 0)&&o.ownerDocument){var c=function(){var u,f;(f=(u=n.props).onScriptsLoad)===null||f===void 0||f.call(u),n.initialise()},l=function(u){var f,h;(h=(f=n.props).onScriptsLoadError)===null||h===void 0||h.call(f,u)};vn.loadList(this.elementRef.current.ownerDocument,this.getScriptSources(),(a=(s=this.props.scriptLoading)===null||s===void 0?void 0:s.delay)!==null&&a!==void 0?a:0,c,l)}},e.prototype.componentWillUnmount=function(){var n=this,r=this.editor;r&&(r.off(this.changeEvents(),this.handleEditorChange),r.off(this.beforeInputEvent(),this.handleBeforeInput),r.off("keypress",this.handleEditorChangeSpecial),r.off("keydown",this.handleBeforeInputSpecial),r.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach(function(i){r.off(i,n.boundHandlers[i])}),this.boundHandlers={},r.remove(),this.editor=void 0)},e.prototype.render=function(){return this.inline?this.renderInline():this.renderIframe()},e.prototype.changeEvents=function(){var n,r,i,o=(i=(r=(n=xe(this.view))===null||n===void 0?void 0:n.Env)===null||r===void 0?void 0:r.browser)===null||i===void 0?void 0:i.isIE();return o?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"},e.prototype.beforeInputEvent=function(){return dn()?"beforeinput SelectionChange":"SelectionChange"},e.prototype.renderInline=function(){var n=this.props.tagName,r=n===void 0?"div":n;return d.createElement(r,{ref:this.elementRef,id:this.id})},e.prototype.renderIframe=function(){return d.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})},e.prototype.getScriptSources=function(){var n,r,i=(n=this.props.scriptLoading)===null||n===void 0?void 0:n.async,o=(r=this.props.scriptLoading)===null||r===void 0?void 0:r.defer;if(this.props.tinymceScriptSrc!==void 0)return typeof this.props.tinymceScriptSrc=="string"?[{src:this.props.tinymceScriptSrc,async:i,defer:o}]:this.props.tinymceScriptSrc.map(function(l){return typeof l=="string"?{src:l,async:i,defer:o}:l});var s=this.props.cloudChannel,a=this.props.apiKey?this.props.apiKey:"no-api-key",c="https://cdn.tiny.cloud/1/".concat(a,"/tinymce/").concat(s,"/tinymce.min.js");return[{src:c,async:i,defer:o}]},e.prototype.getInitialValue=function(){return typeof this.props.initialValue=="string"?this.props.initialValue:typeof this.props.value=="string"?this.props.value:""},e.prototype.bindHandlers=function(n){var r=this;if(this.editor!==void 0){hn(this.editor,n,this.props,this.boundHandlers,function(a){return r.props[a]});var i=function(a){return a.onEditorChange!==void 0||a.value!==void 0},o=i(n),s=i(this.props);!o&&s?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):o&&!s&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}},e.propTypes=un,e.defaultProps={cloudChannel:"6"},e}(d.Component);const we={baseUrl:"V3",signer:null},wn=({baseUrl:t,signer:e})=>{we.baseUrl=t,we.signer=e},it=(()=>{const t=window.location,{hostname:e}=t;return e==="localhost"||e==="127.0.0.1"})(),Se=()=>{var n;let t=window.location;const{host:e}=t;if(it){const r=(n=we.baseUrl)==null?void 0:n.split("/");return r?"https://"+(r==null?void 0:r[2]):"https://vndev.hanbiro.com"}else{const r=localStorage.getItem("host")||e,i=r==null?void 0:r.split("/");return"https://"+(i==null?void 0:i[0])}},Sn=()=>{let t=window.location;if(it)return Se()||"https://vndev.hanbiro.com/ngw";{window.location!==window.parent.location&&(t=window.parent.location);const{hostname:e,protocol:n}=t;return[n,"//",e,"/ngw"].join("")}},En=t=>{const{isSimple:e,noImage:n}=t,r=13,i=void 0,o=0,s="en",a=Se(),c="jpeg,JPEG,jpg,JPG,jpe,JPE,jfi,jif,jfif,png,PNG,gif,GIF,bmp,BMP,webp,WEBP",l={ko:'맑은고딕=Malgun Gothic;돋움="돋움",Dotum;돋움체="돋움체",DotumChe;굴림="굴림",Gulim;굴림체="굴림체",GulimChe;바탕="바탕",Batang;바탕체="바탕체",BatangChe;궁서="궁서",Gungseo;',en:"MS PGothic=MS PGothic,Sans-serif;Meiryo UI=Meiryo UI,Sans-serif;HiraKakuProN-W3=HiraKakuProN-W3;MS PMincho=MS PMincho,Sans-serif;MS Gothic=MS Gothic,Sans-serif;MS Mincho=MS Mincho,Sans-serif;",ch:"Microsoft YaHei=Microsoft YaHei,Sans-serif;"}[s]+"Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats;",u=(()=>{let m=window.location;const{hostname:k}=m;return k==="localhost"||k==="127.0.0.1"?`${a}/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload`:`${a}/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload`})();let f,h=[];e?(f="hanbiroclip",h=["fontfamily fontsize","bold italic underline","forecolor backcolor","bullist numlist","emoticons"]):(f="checklist lists link image table code codesample insertdatetime emoticons fullscreen wordcount hanbiroclip",h=["fontfamily fontsize styles","align lineheight checklist","bold italic underline","forecolor backcolor","bullist numlist","link image table","code codesample","insertdatetime emoticons","fullscreen","removeformat"]);const v=m=>{m.on("init",()=>{setTimeout(()=>{const k=m==null?void 0:m.getBody(),S=[];m.execCommand("FontSize",!1,r),S.push(`font-size: ${r}pt;`),(S==null?void 0:S.length)>0&&(k==null||k.setAttribute("style",S.join(" "))),Number(o)&&m.execCommand("Bold")},0)}),n&&m.on("BeforeSetContent",k=>{/<img[\s\S]*?>/i.test(k==null?void 0:k.content)&&m.windowManager.alert("Image is not allowed!")})},g=function(m){const k=document.createElement("input");k.setAttribute("type","file"),k.setAttribute("accept","image/*"),k.onchange=function(S){const R=S.target,E=R.files&&R.files[0];if(E){const z=new FileReader;z.onload=function(){const D="blobid"+new Date().getTime(),P=window.tinymce.activeEditor.editorUpload.blobCache,T=z.result;if(T&&typeof T=="string"){const G=T.split(",")[1],ot=P.create(D,E,G);P.add(ot),m(ot.blobUri(),{title:E.name})}},z.readAsDataURL(E)}},k.click()};return{defaultPlugins:f,defaultToolbar:h==null?void 0:h.join(" | "),imageUploadBasePath:a,imageUploadUrl:u,supportImageTypes:c,fontfamily:l,setupFunction:v,filePickerHandle:g,defaultFontType:i,defaultFontSize:r,isFontWeightBold:Number(o)===1}};class Cn extends y.Component{constructor(n){super(n);b(this,"editorRef",null);b(this,"getContent",()=>{var r;return{content:((r=this.editorRef)==null?void 0:r.getContent())||""}});b(this,"getRawContent",()=>{var r;return((r=this.editorRef)==null?void 0:r.getContent())||""});b(this,"handleEditorChange",n=>{this.props.onChange&&this.props.onChange(n)});this.state={showEditor:!1}}render(){const{value:n,isSimple:r=!1,disabled:i=!1,height:o=550,skin:s="tinymce-5",onClick:a,style:c,lang:l="en",placeholder:u="",options:f,noImage:h=!1}=this.props,{showEditor:v}=this.state,{defaultPlugins:g,defaultToolbar:m,imageUploadBasePath:k,imageUploadUrl:S,supportImageTypes:R,fontfamily:E,setupFunction:z,filePickerHandle:D,defaultFontSize:P}=En({isSimple:r,noImage:h});return y.createElement("div",{style:{position:"relative",borderRadius:1,height:o,...c}},!v&&y.createElement(Ze,{style:{position:"absolute",top:0,left:0,right:0,zIndex:12,background:"#ffffff",border:"1px solid var(--grey-main)",borderRadius:1,height:(f==null?void 0:f.height)||o}}),y.createElement(xn,{disabled:i,onEditorChange:this.handleEditorChange,value:n,onInit:(T,G)=>{this.setState({showEditor:!0}),this.editorRef=G},onClick:a,plugins:g,init:{text_patterns:!1,placeholder:u,indent:!1,visual:!1,promotion:!1,language:l||"en",branding:!1,elementpath:!1,height:o,menubar:!r,verify_html:!0,toolbar:m,toolbar_mode:"sliding",images_upload_base_path:k,images_upload_url:S,images_upload_credentials:!0,automatic_uploads:!0,images_file_types:R,font_family_formats:E,paste_data_images:!0,a11y_advanced_options:!0,image_advtab:!0,file_picker_types:"file image media",file_picker_callback:D,forced_root_block_attrs:{style:"margin: 0;"},font_size_formats:"6pt 8pt 9pt 10pt 11pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 36pt 48pt 72pt",...h&&{invalid_elements:"img"},content_style:`
|
|
98
|
+
${cn}
|
|
99
|
+
[data-mce-placeholder]::before {
|
|
100
|
+
color: rgba(0, 23, 55, 0.42) !important;
|
|
101
|
+
}
|
|
102
|
+
body {
|
|
103
|
+
font-family: Helvetica,Arial,sans-serif;
|
|
104
|
+
font-size: ${P}pt;
|
|
105
|
+
line-height: unset;
|
|
106
|
+
background: var(--background-softGrey);
|
|
107
|
+
color: var(--text-primary);
|
|
108
|
+
}`,setup:z,relative_urls:!1,remove_script_host:!1,document_base_url:"/"}}))}}class _n extends d.Component{constructor(n){super(n);b(this,"containerRef");b(this,"popperRef");b(this,"handleClickOutside",n=>{const r=n.target;this.containerRef.current&&!this.containerRef.current.contains(r)&&(!this.popperRef.current||!this.popperRef.current.contains(r))&&this.setState({open:!1})});b(this,"togglePopper",()=>{this.setState(n=>({open:!n.open}))});b(this,"handleLangChange",n=>{const r=se.find(i=>i.value===n.target.value);this.props.setLang(r||null)});this.state={open:!1},this.containerRef=d.createRef(),this.popperRef=d.createRef()}componentDidMount(){document.addEventListener("mousedown",this.handleClickOutside)}componentWillUnmount(){document.removeEventListener("mousedown",this.handleClickOutside)}render(){const{lang:n,originalEmail:r,setOriginalEmail:i,getEditorContent:o,parentRef:s}=this.props,{open:a}=this.state;let c=0,l=0,u=320;if(a&&this.containerRef.current){const f=this.containerRef.current.getBoundingClientRect();if(c=f.top+(window.scrollY||document.documentElement.scrollTop)-8,l=f.left+(window.scrollX||document.documentElement.scrollLeft),s&&s.current){const h=s.current.getBoundingClientRect();u=h.width-16,l=h.left+8}}return d.createElement("div",{ref:this.containerRef,style:{position:"relative",display:"inline-block"}},d.createElement("button",{type:"button",onClick:this.togglePopper,className:"icon-button small"},d.createElement(oe,{size:16})),a&&this.containerRef.current&&st.createPortal(d.createElement("div",{ref:this.popperRef,style:{position:"absolute",top:c,left:l,transform:"translateY(-100%)",zIndex:1051,background:"#fff",border:"1px solid #ddd",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.1)",borderRadius:8,padding:16,width:u,boxSizing:"border-box"}},d.createElement("div",{style:{display:"flex",flexDirection:"column",gap:12}},d.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4}},d.createElement("span",{style:{fontSize:12,fontWeight:500}},"Language"),d.createElement("select",{value:n?n.value:"",onChange:this.handleLangChange,style:{padding:"6px 8px",borderRadius:4,border:"1px solid #ccc",fontSize:14}},d.createElement("option",{value:"",disabled:!0},"Select Language"),se.map(f=>d.createElement("option",{key:f.value,value:f.value},f.label)))),d.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4}},d.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},d.createElement("span",{style:{fontSize:12,fontWeight:500}},"AI Context"),o&&d.createElement("button",{type:"button",title:"Copy from origin email",onClick:()=>{const f=o();i(f)},className:"icon-button"},d.createElement(F,null))),d.createElement(Cn,{value:r,onChange:f=>i(f),height:350,isSimple:!0})))),document.body))}}class Rn extends d.Component{constructor(n){super(n);b(this,"rootRef");b(this,"setAiContext",n=>{this.setState({originalEmail:n})});b(this,"handleMessageChange",n=>{this.setState({message:n.target.value})});b(this,"handleSubmit",async()=>{const{message:n,messages:r,lang:i,originalEmail:o,conversationId:s}=this.state,{signer:a,baseUrl:c=""}=this.props;if(!n.trim())return;const l=ut();let u={id:l,question:n,subject:"",body:"",created_at:new Date().getTime(),isLoading:!0};const f=[...r,u];this.setState({messages:f,message:"",isSending:!0});const h={query:n,default_language:i?i.value:"KR",original_email:o,debug_grpc:!0};s&&(h.conversation_id=s),await St(h,{setContent:k=>{this.setState(S=>({messages:S.messages.map(E=>E.id===l?{...E,subject:"Some thing not used",body:k,isLoading:!1,created_at:new Date().getTime()}:E)}))},setIsLoading:k=>{this.setState(S=>({messages:S.messages.map(E=>E.id===l?{...E,isLoading:k}:E)}))},setConversationId:k=>{this.setState({conversationId:k})},signer:a,baseUrl:c}),this.setState({isSending:!1})});b(this,"handleKeyDown",n=>{!n.shiftKey&&n.key==="Enter"&&!this.state.isSending&&(n.preventDefault(),this.handleSubmit())});b(this,"setLang",n=>{this.setState({lang:n})});b(this,"setOriginalEmail",n=>{this.setState({originalEmail:n})});this.rootRef=d.createRef(),this.state={message:"",messages:[],isSending:!1,lang:se[0],conversationId:"",originalEmail:""}}render(){const{onApply:n,getEditorContent:r}=this.props,{message:i,messages:o,isSending:s,lang:a,originalEmail:c}=this.state;return d.createElement("div",{ref:this.rootRef,style:{display:"flex",height:"100%",padding:16,flexDirection:"column",background:"#fff",fontFamily:"inherit",boxSizing:"border-box"}},o.length>0?d.createElement(an,{items:o,onApply:n,getEditorContent:r}):d.createElement("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"var(--grey-light)"}},d.createElement(wt,{size:46}),d.createElement("h2",{style:{marginTop:16,fontWeight:600,color:"inherit",fontSize:18}},"Build with Agent")),d.createElement("div",{style:{width:"100%",border:"1px solid #ddd",borderRadius:4,overflow:"hidden",background:"#fff",display:"flex",flexDirection:"column"}},d.createElement("textarea",{value:i,onChange:this.handleMessageChange,placeholder:"Describe your email",name:"ai-content",onKeyDown:this.handleKeyDown,disabled:s,style:{flex:1,minWidth:0,borderRadius:4,padding:12,fontSize:13,border:"none",resize:"none",outline:"none",minHeight:60,fontFamily:"inherit"}}),d.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"8px",boxSizing:"border-box"}},d.createElement(_n,{lang:a,setLang:this.setLang,originalEmail:c,setOriginalEmail:this.setOriginalEmail,getEditorContent:r,parentRef:this.rootRef}),d.createElement("button",{disabled:!i.trim()||s,onClick:this.handleSubmit,className:"icon-button",color:"primary"},d.createElement(re,null)))))}}C.ChatAIDraft=Rn,C.LoadingCircular=be,C.LoadingContainer=Ze,C.getBaseUrl=Se,C.getGroupwareUrl=Sn,C.initHanbiroReactSDK=wn,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { initHanbiroReactSDK, getBaseUrl, getGroupwareUrl } from './url';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hanbiro-react16-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "React 16.2.0 compatible UI components for Hanbiro",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/hanbiro-react16-sdk.umd.js",
|
|
@@ -65,9 +65,11 @@
|
|
|
65
65
|
"sass-embedded": "^1.98.0",
|
|
66
66
|
"typescript": "^5.5.0",
|
|
67
67
|
"vite": "^5.4.0",
|
|
68
|
-
"vite-plugin-dts": "^3.9.1"
|
|
68
|
+
"vite-plugin-dts": "^3.9.1",
|
|
69
|
+
"@types/tinymce": "^4.6.6"
|
|
69
70
|
},
|
|
70
71
|
"dependencies": {
|
|
72
|
+
"@tinymce/tinymce-react": "^4.3.0",
|
|
71
73
|
"axios": "^1.13.6",
|
|
72
74
|
"marked": "^15.0.12",
|
|
73
75
|
"react-feather": "^2.0.10",
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
button.icon-button{background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:999px;transition:background .15s ease-in-out,color .15s ease-in-out;color:var(--grey-main)}button.icon-button:hover,button.icon-button:active{background-color:#f4f4f4}button.icon-button[disabled]{cursor:not-allowed;color:var(--grey-lighter)}button.icon-button.primary,button.icon-button[color=primary]{color:var(--primary-main)}button.icon-button.primary:hover,button.icon-button[color=primary]:hover{background-color:var(--primary-lighter)}button.icon-button.primary:active,button.icon-button[color=primary]:active{background-color:var(--primary-light)}button.icon-button.primary[disabled],button.icon-button[color=primary][disabled]{cursor:not-allowed;color:var(--primary-lighter);background:transparent}button.icon-button{width:36px;height:36px}button.icon-button svg{width:18px;height:18px}button.icon-button.small{width:32px;height:32px}button.icon-button.small svg{width:16px;height:16px}button.icon-button.large{width:40px;height:40px}button.icon-button.large svg{width:20px;height:20px}p{font-size:13px}:root{--primary-lighter: #d9edfd;--primary-light: #42a5f5;--primary-main: #0080fe;--primary-dark: #064476;--primary-darker: #03223b;--primary-contrasttext: #fff;--grey-lighter: #bebebe;--grey-light: #a9a9a9;--grey-main: #7f7f7f;--grey-dark: #6a6a6a;--grey-darker: #3f3f3f;--text-primary: #001737;--text-secondary: #8392a5;--background-softGrey: #f4f4f4;--background-lightGrey: #f9f9f9}
|