@qwanyx/stack 0.2.52 → 0.2.54

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/dist/index.cjs.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var Pa=Object.defineProperty;var Oa=(r,e,t)=>e in r?Pa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Mr=(r,e,t)=>Oa(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),Ii=require("react-dom");function Ma(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ws=Ma(w);class Ia{constructor(e){Mr(this,"config");Mr(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,t={}){const n={coprocessor:"graph",method:e,system_id:this.config.system_id,params:t};try{const s=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(n)});if(!s.ok){const i=await s.text();throw new Error(`API error (${s.status}): ${i}`)}const o=await s.json();if(!o.success&&o.error)throw new Error(o.error);return o}catch(s){throw console.error("Graph API call failed:",s),s}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const t={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},n=await this.callGraph("add_node",t);if(!n.result)throw new Error("Failed to add node");return n.result}async updateNode(e,t){const n={node_id:e,updates:{...t,modified:new Date().toISOString()}},s=await this.callGraph("update_node",n);if(!s.result)throw new Error("Failed to update node");return s.result}async deleteNode(e,t=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:t})).success===!0}async getChildrenWithEdges(e,t="children",n,s){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:t,edge_type:n,node_type:s})).result||[]}async addEdge(e,t,n="link",s){return await this.callGraph("add_edge",{source_id:e,target_id:t,edge_type:n,data:s})}async deleteEdge(e,t,n){return await this.callGraph("delete_edge",{source_id:e,target_id:t,edge_type:n})}async getEdges(e,t,n){return(await this.callGraph("get_edges",{source_id:e,edge_type:t,target_id:n})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,t=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:t})).tree||[]}async moveNode(e,t){const n=await this.callGraph("move",{node_id:e,new_parent_id:t});if(!n.node)throw new Error("Failed to move node");return n.node}async searchNodes(e,t){return(await this.callGraph("search",{query:e,type:t})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const i=s.result.split(",")[1];t(i)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(e)})}async resizeImage(e,t,n){return e.type.startsWith("image/")?new Promise(s=>{const o=new Image,i=URL.createObjectURL(e);o.onload=()=>{if(URL.revokeObjectURL(i),o.width<=t&&o.height<=t){s(e);return}let l,a;o.width>o.height?(l=t,a=Math.round(o.height/o.width*t)):(a=t,l=Math.round(o.width/o.height*t));const u=document.createElement("canvas");u.width=l,u.height=a;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(o,0,0,l,a);const d=e.type==="image/png"?"image/png":"image/jpeg";u.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},o.onerror=()=>{URL.revokeObjectURL(i),s(e)},o.src=i}):e}async uploadFile(e,t,n,s={}){const o={...this.defaultUploadOptions,...s};try{let i=n;o.maxImageDimension>0&&n.type.startsWith("image/")&&(i=await this.resizeImage(n,o.maxImageDimension,o.imageQuality));const l=o.maxSizeMB*1024*1024;if(i.size>l)return{success:!1,error:`File too large (${(i.size/1024/1024).toFixed(1)} MB). Max: ${o.maxSizeMB} MB`};const a=await this.fileToBase64(i),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:a});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Upload failed"}}}async listFiles(e){var s;return(((s=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:s.files)||[]).map(o=>({filename:o.name,path:o.path}))}async deleteFile(e,t){return{success:(await this.callGraph("delete_file",{node_id:e,filename:t})).success||!1}}getFileUrl(e,t){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${t}`}}const Br=new TextEncoder,$i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kr=new Uint8Array(256);for(var En=0;En<$i.length;En++)Kr[$i.charCodeAt(En)]=En;function Is(r){let e=Math.ceil(r.length/4)*3;const t=r.length;let n=0;r.length%4===3?e--:r.length%4===2?e-=2:r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const s=new ArrayBuffer(e),o=new Uint8Array(s);for(let i=0;i<t;i+=4){let l=Kr[r.charCodeAt(i)],a=Kr[r.charCodeAt(i+1)],u=Kr[r.charCodeAt(i+2)],c=Kr[r.charCodeAt(i+3)];o[n++]=l<<2|a>>4,o[n++]=(a&15)<<4|u>>2,o[n++]=(u&3)<<6|c&63}return s}function Qr(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function is(r){if("arrayBuffer"in r)return await r.arrayBuffer();const e=new FileReader;return new Promise((t,n)=>{e.onload=function(s){t(s.target.result)},e.onerror=function(s){n(e.error)},e.readAsArrayBuffer(r)})}function zi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function $a(r,e,t){let n=r.indexOf("*");n>=0&&(r=r.substr(0,n)),e=e.toUpperCase();let s;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let o=Br.encode(t),i=[];for(let a=0,u=o.length;a<u;a++){let c=o[a];if(a<=u-2&&c===61){let d=zi(o[a+1]),f=zi(o[a+2]);if(d&&f){let h=parseInt(d+f,16);i.push(h),a+=2;continue}}i.push(c)}s=new ArrayBuffer(i.length);let l=new DataView(s);for(let a=0,u=i.length;a<u;a++)l.setUint8(a,i[a])}else e==="B"?s=Is(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Br.encode(t);return Qr(r).decode(s)}function Yr(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,o,i,l)=>e&&o===l&&i.length%4===0&&!/=$/.test(i)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,o,i)=>e&&o===i?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,o,i)=>$a(s,o,i));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function za(r,e){e=e||"utf-8";let t=[];for(let o=0;o<r.length;o++){let i=r.charAt(o);if(i==="%"&&/^[a-f0-9]{2}/i.test(r.substr(o+1,2))){let l=r.substr(o+1,2);o+=2,t.push(parseInt(l,16))}else if(i.charCodeAt(0)>126){i=Br.encode(i);for(let l=0;l<i.length;l++)t.push(i[l])}else t.push(i.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let o=0,i=t.length;o<i;o++)s.setUint8(o,t[o]);return Qr(e).decode(n)}function qa(r){let e=new Map;Object.keys(r.params).forEach(t=>{let n=t.match(/\*((\d+)\*?)?$/);if(!n)return;let s=t.substr(0,n.index).toLowerCase(),o=Number(n[2])||0,i;e.has(s)?i=e.get(s):(i={charset:!1,values:[]},e.set(s,i));let l=r.params[t];o===0&&n[0].charAt(n[0].length-1)==="*"&&(n=l.match(/^([^']*)'[^']*'(.*)$/))&&(i.charset=n[1]||"utf-8",l=n[2]),i.values.push({nr:o,value:l}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=za(t.values.sort((s,o)=>s.nr-o.nr).map(s=>s.value).join(""),t.charset)})}class Ua{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
- `)}finalize(){return is(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Wa{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let n=Math.floor(this.remainder.length/4)*4,s;n===this.remainder.length?(s=this.remainder,this.remainder=""):(s=this.remainder.substr(0,n),this.remainder=this.remainder.substr(n)),s.length&&this.chunks.push(Is(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Is(this.remainder)),is(new Blob(this.chunks,{type:"application/octet-stream"}))}}const qi=/^=[a-f0-9]{2}$/i,Ga=/(?==[a-f0-9]{2})/i,Ka=/=\r?\n/g,Va=/=[a-fA-F0-9]?$/;class Ha{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),n=new DataView(t);for(let s=0,o=e.length;s<o;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(Ka,"");let t=e.split(Ga),n=[];for(let s of t){if(s.charAt(0)!=="="){n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s);continue}if(s.length===3){qi.test(s)?n.push(s.substr(1)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s));continue}if(s.length>3){const o=s.substr(0,3);qi.test(o)?(n.push(s.substr(1,2)),this.chunks.push(this.decodeQPBytes(n)),n=[],s=s.substr(3),this.chunks.push(s)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s))}}n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[])}update(e){let t=this.decoder.decode(e)+`
3
- `;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let n=t.match(Va);if(n){if(n.index===0){this.remainder=t;return}this.remainder=t.substr(n.index),t=t.substr(0,n.index)}this.decodeChunks(t)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),is(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Ui{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new Wa:/quoted-printable/i.test(e)?this.contentDecoder=new Ha({decoder:Qr(this.contentType.parsed.params.charset)}):this.contentDecoder=new Ua}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},n=!1,s="",o="value",i=!1,l=!1,a;for(let u=0,c=e.length;u<c;u++)switch(a=e.charAt(u),o){case"key":if(a==="="){n=s.trim().toLowerCase(),o="value",s="";break}s+=a;break;case"value":if(l)s+=a;else if(a==="\\"){l=!0;continue}else i&&a===i?i=!1:!i&&a==='"'?i=a:!i&&a===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),o="key",s=""):s+=a;l=!1;break}return s=s.trim(),o==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),qa(t),t}decodeFlowedText(e,t){return e.split(/\r?\n/).reduce((n,s)=>/ $/.test(n)&&!/(^|\n)-- $/.test(n)?t?n.slice(0,-1)+s:n+s:n+`
1
+ "use strict";var Ia=Object.defineProperty;var $a=(r,e,t)=>e in r?Ia(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var qt=(r,e,t)=>$a(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),$i=require("react-dom");function za(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Ds=za(w);class qa{constructor(e){qt(this,"config");qt(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,t={}){const n={coprocessor:"graph",method:e,system_id:this.config.system_id,params:t};try{const s=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(n)});if(!s.ok){const i=await s.text();throw new Error(`API error (${s.status}): ${i}`)}const o=await s.json();if(!o.success&&o.error)throw new Error(o.error);return o}catch(s){throw console.error("Graph API call failed:",s),s}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const t={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},n=await this.callGraph("add_node",t);if(!n.result)throw new Error("Failed to add node");return n.result}async updateNode(e,t){const n={node_id:e,updates:{...t,modified:new Date().toISOString()}},s=await this.callGraph("update_node",n);if(!s.result)throw new Error("Failed to update node");return s.result}async deleteNode(e,t=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:t})).success===!0}async getChildrenWithEdges(e,t="children",n,s){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:t,edge_type:n,node_type:s})).result||[]}async addEdge(e,t,n="link",s){return await this.callGraph("add_edge",{source_id:e,target_id:t,edge_type:n,data:s})}async deleteEdge(e,t,n){return await this.callGraph("delete_edge",{source_id:e,target_id:t,edge_type:n})}async getEdges(e,t,n){return(await this.callGraph("get_edges",{source_id:e,edge_type:t,target_id:n})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,t=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:t})).tree||[]}async moveNode(e,t){const n=await this.callGraph("move",{node_id:e,new_parent_id:t});if(!n.node)throw new Error("Failed to move node");return n.node}async searchNodes(e,t){return(await this.callGraph("search",{query:e,type:t})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const i=s.result.split(",")[1];t(i)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(e)})}async resizeImage(e,t,n){return e.type.startsWith("image/")?new Promise(s=>{const o=new Image,i=URL.createObjectURL(e);o.onload=()=>{if(URL.revokeObjectURL(i),o.width<=t&&o.height<=t){s(e);return}let l,a;o.width>o.height?(l=t,a=Math.round(o.height/o.width*t)):(a=t,l=Math.round(o.width/o.height*t));const u=document.createElement("canvas");u.width=l,u.height=a;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(o,0,0,l,a);const d=e.type==="image/png"?"image/png":"image/jpeg";u.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},o.onerror=()=>{URL.revokeObjectURL(i),s(e)},o.src=i}):e}async uploadFile(e,t,n,s={}){const o={...this.defaultUploadOptions,...s};try{let i=n;o.maxImageDimension>0&&n.type.startsWith("image/")&&(i=await this.resizeImage(n,o.maxImageDimension,o.imageQuality));const l=o.maxSizeMB*1024*1024;if(i.size>l)return{success:!1,error:`File too large (${(i.size/1024/1024).toFixed(1)} MB). Max: ${o.maxSizeMB} MB`};const a=await this.fileToBase64(i),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:a});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Upload failed"}}}async listFiles(e){var s;return(((s=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:s.files)||[]).map(o=>({filename:o.name,path:o.path}))}async deleteFile(e,t){return{success:(await this.callGraph("delete_file",{node_id:e,filename:t})).success||!1}}getFileUrl(e,t){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${t}`}}const Nr=new TextEncoder,zi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kr=new Uint8Array(256);for(var En=0;En<zi.length;En++)Kr[zi.charCodeAt(En)]=En;function $s(r){let e=Math.ceil(r.length/4)*3;const t=r.length;let n=0;r.length%4===3?e--:r.length%4===2?e-=2:r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const s=new ArrayBuffer(e),o=new Uint8Array(s);for(let i=0;i<t;i+=4){let l=Kr[r.charCodeAt(i)],a=Kr[r.charCodeAt(i+1)],u=Kr[r.charCodeAt(i+2)],c=Kr[r.charCodeAt(i+3)];o[n++]=l<<2|a>>4,o[n++]=(a&15)<<4|u>>2,o[n++]=(u&3)<<6|c&63}return s}function Qr(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function is(r){if("arrayBuffer"in r)return await r.arrayBuffer();const e=new FileReader;return new Promise((t,n)=>{e.onload=function(s){t(s.target.result)},e.onerror=function(s){n(e.error)},e.readAsArrayBuffer(r)})}function qi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function Ua(r,e,t){let n=r.indexOf("*");n>=0&&(r=r.substr(0,n)),e=e.toUpperCase();let s;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let o=Nr.encode(t),i=[];for(let a=0,u=o.length;a<u;a++){let c=o[a];if(a<=u-2&&c===61){let d=qi(o[a+1]),f=qi(o[a+2]);if(d&&f){let h=parseInt(d+f,16);i.push(h),a+=2;continue}}i.push(c)}s=new ArrayBuffer(i.length);let l=new DataView(s);for(let a=0,u=i.length;a<u;a++)l.setUint8(a,i[a])}else e==="B"?s=$s(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Nr.encode(t);return Qr(r).decode(s)}function Yr(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,o,i,l)=>e&&o===l&&i.length%4===0&&!/=$/.test(i)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,o,i)=>e&&o===i?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,o,i)=>Ua(s,o,i));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function Wa(r,e){e=e||"utf-8";let t=[];for(let o=0;o<r.length;o++){let i=r.charAt(o);if(i==="%"&&/^[a-f0-9]{2}/i.test(r.substr(o+1,2))){let l=r.substr(o+1,2);o+=2,t.push(parseInt(l,16))}else if(i.charCodeAt(0)>126){i=Nr.encode(i);for(let l=0;l<i.length;l++)t.push(i[l])}else t.push(i.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let o=0,i=t.length;o<i;o++)s.setUint8(o,t[o]);return Qr(e).decode(n)}function Ga(r){let e=new Map;Object.keys(r.params).forEach(t=>{let n=t.match(/\*((\d+)\*?)?$/);if(!n)return;let s=t.substr(0,n.index).toLowerCase(),o=Number(n[2])||0,i;e.has(s)?i=e.get(s):(i={charset:!1,values:[]},e.set(s,i));let l=r.params[t];o===0&&n[0].charAt(n[0].length-1)==="*"&&(n=l.match(/^([^']*)'[^']*'(.*)$/))&&(i.charset=n[1]||"utf-8",l=n[2]),i.values.push({nr:o,value:l}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=Wa(t.values.sort((s,o)=>s.nr-o.nr).map(s=>s.value).join(""),t.charset)})}class Ka{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
+ `)}finalize(){return is(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Va{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let n=Math.floor(this.remainder.length/4)*4,s;n===this.remainder.length?(s=this.remainder,this.remainder=""):(s=this.remainder.substr(0,n),this.remainder=this.remainder.substr(n)),s.length&&this.chunks.push($s(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push($s(this.remainder)),is(new Blob(this.chunks,{type:"application/octet-stream"}))}}const Ui=/^=[a-f0-9]{2}$/i,Ha=/(?==[a-f0-9]{2})/i,Ja=/=\r?\n/g,Qa=/=[a-fA-F0-9]?$/;class Ya{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),n=new DataView(t);for(let s=0,o=e.length;s<o;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(Ja,"");let t=e.split(Ha),n=[];for(let s of t){if(s.charAt(0)!=="="){n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s);continue}if(s.length===3){Ui.test(s)?n.push(s.substr(1)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s));continue}if(s.length>3){const o=s.substr(0,3);Ui.test(o)?(n.push(s.substr(1,2)),this.chunks.push(this.decodeQPBytes(n)),n=[],s=s.substr(3),this.chunks.push(s)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s))}}n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[])}update(e){let t=this.decoder.decode(e)+`
3
+ `;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let n=t.match(Qa);if(n){if(n.index===0){this.remainder=t;return}this.remainder=t.substr(n.index),t=t.substr(0,n.index)}this.decodeChunks(t)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),is(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Wi{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new Va:/quoted-printable/i.test(e)?this.contentDecoder=new Ya({decoder:Qr(this.contentType.parsed.params.charset)}):this.contentDecoder=new Ka}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},n=!1,s="",o="value",i=!1,l=!1,a;for(let u=0,c=e.length;u<c;u++)switch(a=e.charAt(u),o){case"key":if(a==="="){n=s.trim().toLowerCase(),o="value",s="";break}s+=a;break;case"value":if(l)s+=a;else if(a==="\\"){l=!0;continue}else i&&a===i?i=!1:!i&&a==='"'?i=a:!i&&a===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),o="key",s=""):s+=a;l=!1;break}return s=s.trim(),o==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),Ga(t),t}decodeFlowedText(e,t){return e.split(/\r?\n/).reduce((n,s)=>/ $/.test(n)&&!/(^|\n)-- $/.test(n)?t?n.slice(0,-1)+s:n+s:n+`
4
4
  `+s).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=Qr(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let t=this.headerLines[e];if(e&&/^\s/.test(t))this.headerLines[e-1]+=`
5
- `+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let n=t.indexOf(":"),s=n<0?t.trim():t.substr(0,n).trim(),o=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:o}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:o,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:o,parsed:{}};break;case"content-disposition":this.contentDisposition={value:o,parsed:{}};break;case"content-id":this.contentId=o;break;case"content-description":this.contentDescription=o;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Br.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(Qr().decode(e));break;case"body":this.contentDecoder.update(e)}}}const Wi={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
6
- `,"&Nfr;":"𝔑","&NoBreak;":"⁠","&NonBreakingSpace;":" ","&Nopf;":"ℕ","&Not;":"⫬","&NotCongruent;":"≢","&NotCupCap;":"≭","&NotDoubleVerticalBar;":"∦","&NotElement;":"∉","&NotEqual;":"≠","&NotEqualTilde;":"≂̸","&NotExists;":"∄","&NotGreater;":"≯","&NotGreaterEqual;":"≱","&NotGreaterFullEqual;":"≧̸","&NotGreaterGreater;":"≫̸","&NotGreaterLess;":"≹","&NotGreaterSlantEqual;":"⩾̸","&NotGreaterTilde;":"≵","&NotHumpDownHump;":"≎̸","&NotHumpEqual;":"≏̸","&NotLeftTriangle;":"⋪","&NotLeftTriangleBar;":"⧏̸","&NotLeftTriangleEqual;":"⋬","&NotLess;":"≮","&NotLessEqual;":"≰","&NotLessGreater;":"≸","&NotLessLess;":"≪̸","&NotLessSlantEqual;":"⩽̸","&NotLessTilde;":"≴","&NotNestedGreaterGreater;":"⪢̸","&NotNestedLessLess;":"⪡̸","&NotPrecedes;":"⊀","&NotPrecedesEqual;":"⪯̸","&NotPrecedesSlantEqual;":"⋠","&NotReverseElement;":"∌","&NotRightTriangle;":"⋫","&NotRightTriangleBar;":"⧐̸","&NotRightTriangleEqual;":"⋭","&NotSquareSubset;":"⊏̸","&NotSquareSubsetEqual;":"⋢","&NotSquareSuperset;":"⊐̸","&NotSquareSupersetEqual;":"⋣","&NotSubset;":"⊂⃒","&NotSubsetEqual;":"⊈","&NotSucceeds;":"⊁","&NotSucceedsEqual;":"⪰̸","&NotSucceedsSlantEqual;":"⋡","&NotSucceedsTilde;":"≿̸","&NotSuperset;":"⊃⃒","&NotSupersetEqual;":"⊉","&NotTilde;":"≁","&NotTildeEqual;":"≄","&NotTildeFullEqual;":"≇","&NotTildeTilde;":"≉","&NotVerticalBar;":"∤","&Nscr;":"𝒩","&Ntilde":"Ñ","&Ntilde;":"Ñ","&Nu;":"Ν","&OElig;":"Œ","&Oacute":"Ó","&Oacute;":"Ó","&Ocirc":"Ô","&Ocirc;":"Ô","&Ocy;":"О","&Odblac;":"Ő","&Ofr;":"𝔒","&Ograve":"Ò","&Ograve;":"Ò","&Omacr;":"Ō","&Omega;":"Ω","&Omicron;":"Ο","&Oopf;":"𝕆","&OpenCurlyDoubleQuote;":"“","&OpenCurlyQuote;":"‘","&Or;":"⩔","&Oscr;":"𝒪","&Oslash":"Ø","&Oslash;":"Ø","&Otilde":"Õ","&Otilde;":"Õ","&Otimes;":"⨷","&Ouml":"Ö","&Ouml;":"Ö","&OverBar;":"‾","&OverBrace;":"⏞","&OverBracket;":"⎴","&OverParenthesis;":"⏜","&PartialD;":"∂","&Pcy;":"П","&Pfr;":"𝔓","&Phi;":"Φ","&Pi;":"Π","&PlusMinus;":"±","&Poincareplane;":"ℌ","&Popf;":"ℙ","&Pr;":"⪻","&Precedes;":"≺","&PrecedesEqual;":"⪯","&PrecedesSlantEqual;":"≼","&PrecedesTilde;":"≾","&Prime;":"″","&Product;":"∏","&Proportion;":"∷","&Proportional;":"∝","&Pscr;":"𝒫","&Psi;":"Ψ","&QUOT":'"',"&QUOT;":'"',"&Qfr;":"𝔔","&Qopf;":"ℚ","&Qscr;":"𝒬","&RBarr;":"⤐","&REG":"®","&REG;":"®","&Racute;":"Ŕ","&Rang;":"⟫","&Rarr;":"↠","&Rarrtl;":"⤖","&Rcaron;":"Ř","&Rcedil;":"Ŗ","&Rcy;":"Р","&Re;":"ℜ","&ReverseElement;":"∋","&ReverseEquilibrium;":"⇋","&ReverseUpEquilibrium;":"⥯","&Rfr;":"ℜ","&Rho;":"Ρ","&RightAngleBracket;":"⟩","&RightArrow;":"→","&RightArrowBar;":"⇥","&RightArrowLeftArrow;":"⇄","&RightCeiling;":"⌉","&RightDoubleBracket;":"⟧","&RightDownTeeVector;":"⥝","&RightDownVector;":"⇂","&RightDownVectorBar;":"⥕","&RightFloor;":"⌋","&RightTee;":"⊢","&RightTeeArrow;":"↦","&RightTeeVector;":"⥛","&RightTriangle;":"⊳","&RightTriangleBar;":"⧐","&RightTriangleEqual;":"⊵","&RightUpDownVector;":"⥏","&RightUpTeeVector;":"⥜","&RightUpVector;":"↾","&RightUpVectorBar;":"⥔","&RightVector;":"⇀","&RightVectorBar;":"⥓","&Rightarrow;":"⇒","&Ropf;":"ℝ","&RoundImplies;":"⥰","&Rrightarrow;":"⇛","&Rscr;":"ℛ","&Rsh;":"↱","&RuleDelayed;":"⧴","&SHCHcy;":"Щ","&SHcy;":"Ш","&SOFTcy;":"Ь","&Sacute;":"Ś","&Sc;":"⪼","&Scaron;":"Š","&Scedil;":"Ş","&Scirc;":"Ŝ","&Scy;":"С","&Sfr;":"𝔖","&ShortDownArrow;":"↓","&ShortLeftArrow;":"←","&ShortRightArrow;":"→","&ShortUpArrow;":"↑","&Sigma;":"Σ","&SmallCircle;":"∘","&Sopf;":"𝕊","&Sqrt;":"√","&Square;":"□","&SquareIntersection;":"⊓","&SquareSubset;":"⊏","&SquareSubsetEqual;":"⊑","&SquareSuperset;":"⊐","&SquareSupersetEqual;":"⊒","&SquareUnion;":"⊔","&Sscr;":"𝒮","&Star;":"⋆","&Sub;":"⋐","&Subset;":"⋐","&SubsetEqual;":"⊆","&Succeeds;":"≻","&SucceedsEqual;":"⪰","&SucceedsSlantEqual;":"≽","&SucceedsTilde;":"≿","&SuchThat;":"∋","&Sum;":"∑","&Sup;":"⋑","&Superset;":"⊃","&SupersetEqual;":"⊇","&Supset;":"⋑","&THORN":"Þ","&THORN;":"Þ","&TRADE;":"™","&TSHcy;":"Ћ","&TScy;":"Ц","&Tab;":" ","&Tau;":"Τ","&Tcaron;":"Ť","&Tcedil;":"Ţ","&Tcy;":"Т","&Tfr;":"𝔗","&Therefore;":"∴","&Theta;":"Θ","&ThickSpace;":"  ","&ThinSpace;":" ","&Tilde;":"∼","&TildeEqual;":"≃","&TildeFullEqual;":"≅","&TildeTilde;":"≈","&Topf;":"𝕋","&TripleDot;":"⃛","&Tscr;":"𝒯","&Tstrok;":"Ŧ","&Uacute":"Ú","&Uacute;":"Ú","&Uarr;":"↟","&Uarrocir;":"⥉","&Ubrcy;":"Ў","&Ubreve;":"Ŭ","&Ucirc":"Û","&Ucirc;":"Û","&Ucy;":"У","&Udblac;":"Ű","&Ufr;":"𝔘","&Ugrave":"Ù","&Ugrave;":"Ù","&Umacr;":"Ū","&UnderBar;":"_","&UnderBrace;":"⏟","&UnderBracket;":"⎵","&UnderParenthesis;":"⏝","&Union;":"⋃","&UnionPlus;":"⊎","&Uogon;":"Ų","&Uopf;":"𝕌","&UpArrow;":"↑","&UpArrowBar;":"⤒","&UpArrowDownArrow;":"⇅","&UpDownArrow;":"↕","&UpEquilibrium;":"⥮","&UpTee;":"⊥","&UpTeeArrow;":"↥","&Uparrow;":"⇑","&Updownarrow;":"⇕","&UpperLeftArrow;":"↖","&UpperRightArrow;":"↗","&Upsi;":"ϒ","&Upsilon;":"Υ","&Uring;":"Ů","&Uscr;":"𝒰","&Utilde;":"Ũ","&Uuml":"Ü","&Uuml;":"Ü","&VDash;":"⊫","&Vbar;":"⫫","&Vcy;":"В","&Vdash;":"⊩","&Vdashl;":"⫦","&Vee;":"⋁","&Verbar;":"‖","&Vert;":"‖","&VerticalBar;":"∣","&VerticalLine;":"|","&VerticalSeparator;":"❘","&VerticalTilde;":"≀","&VeryThinSpace;":" ","&Vfr;":"𝔙","&Vopf;":"𝕍","&Vscr;":"𝒱","&Vvdash;":"⊪","&Wcirc;":"Ŵ","&Wedge;":"⋀","&Wfr;":"𝔚","&Wopf;":"𝕎","&Wscr;":"𝒲","&Xfr;":"𝔛","&Xi;":"Ξ","&Xopf;":"𝕏","&Xscr;":"𝒳","&YAcy;":"Я","&YIcy;":"Ї","&YUcy;":"Ю","&Yacute":"Ý","&Yacute;":"Ý","&Ycirc;":"Ŷ","&Ycy;":"Ы","&Yfr;":"𝔜","&Yopf;":"𝕐","&Yscr;":"𝒴","&Yuml;":"Ÿ","&ZHcy;":"Ж","&Zacute;":"Ź","&Zcaron;":"Ž","&Zcy;":"З","&Zdot;":"Ż","&ZeroWidthSpace;":"​","&Zeta;":"Ζ","&Zfr;":"ℨ","&Zopf;":"ℤ","&Zscr;":"𝒵","&aacute":"á","&aacute;":"á","&abreve;":"ă","&ac;":"∾","&acE;":"∾̳","&acd;":"∿","&acirc":"â","&acirc;":"â","&acute":"´","&acute;":"´","&acy;":"а","&aelig":"æ","&aelig;":"æ","&af;":"⁡","&afr;":"𝔞","&agrave":"à","&agrave;":"à","&alefsym;":"ℵ","&aleph;":"ℵ","&alpha;":"α","&amacr;":"ā","&amalg;":"⨿","&amp":"&","&amp;":"&","&and;":"∧","&andand;":"⩕","&andd;":"⩜","&andslope;":"⩘","&andv;":"⩚","&ang;":"∠","&ange;":"⦤","&angle;":"∠","&angmsd;":"∡","&angmsdaa;":"⦨","&angmsdab;":"⦩","&angmsdac;":"⦪","&angmsdad;":"⦫","&angmsdae;":"⦬","&angmsdaf;":"⦭","&angmsdag;":"⦮","&angmsdah;":"⦯","&angrt;":"∟","&angrtvb;":"⊾","&angrtvbd;":"⦝","&angsph;":"∢","&angst;":"Å","&angzarr;":"⍼","&aogon;":"ą","&aopf;":"𝕒","&ap;":"≈","&apE;":"⩰","&apacir;":"⩯","&ape;":"≊","&apid;":"≋","&apos;":"'","&approx;":"≈","&approxeq;":"≊","&aring":"å","&aring;":"å","&ascr;":"𝒶","&ast;":"*","&asymp;":"≈","&asympeq;":"≍","&atilde":"ã","&atilde;":"ã","&auml":"ä","&auml;":"ä","&awconint;":"∳","&awint;":"⨑","&bNot;":"⫭","&backcong;":"≌","&backepsilon;":"϶","&backprime;":"‵","&backsim;":"∽","&backsimeq;":"⋍","&barvee;":"⊽","&barwed;":"⌅","&barwedge;":"⌅","&bbrk;":"⎵","&bbrktbrk;":"⎶","&bcong;":"≌","&bcy;":"б","&bdquo;":"„","&becaus;":"∵","&because;":"∵","&bemptyv;":"⦰","&bepsi;":"϶","&bernou;":"ℬ","&beta;":"β","&beth;":"ℶ","&between;":"≬","&bfr;":"𝔟","&bigcap;":"⋂","&bigcirc;":"◯","&bigcup;":"⋃","&bigodot;":"⨀","&bigoplus;":"⨁","&bigotimes;":"⨂","&bigsqcup;":"⨆","&bigstar;":"★","&bigtriangledown;":"▽","&bigtriangleup;":"△","&biguplus;":"⨄","&bigvee;":"⋁","&bigwedge;":"⋀","&bkarow;":"⤍","&blacklozenge;":"⧫","&blacksquare;":"▪","&blacktriangle;":"▴","&blacktriangledown;":"▾","&blacktriangleleft;":"◂","&blacktriangleright;":"▸","&blank;":"␣","&blk12;":"▒","&blk14;":"░","&blk34;":"▓","&block;":"█","&bne;":"=⃥","&bnequiv;":"≡⃥","&bnot;":"⌐","&bopf;":"𝕓","&bot;":"⊥","&bottom;":"⊥","&bowtie;":"⋈","&boxDL;":"╗","&boxDR;":"╔","&boxDl;":"╖","&boxDr;":"╓","&boxH;":"═","&boxHD;":"╦","&boxHU;":"╩","&boxHd;":"╤","&boxHu;":"╧","&boxUL;":"╝","&boxUR;":"╚","&boxUl;":"╜","&boxUr;":"╙","&boxV;":"║","&boxVH;":"╬","&boxVL;":"╣","&boxVR;":"╠","&boxVh;":"╫","&boxVl;":"╢","&boxVr;":"╟","&boxbox;":"⧉","&boxdL;":"╕","&boxdR;":"╒","&boxdl;":"┐","&boxdr;":"┌","&boxh;":"─","&boxhD;":"╥","&boxhU;":"╨","&boxhd;":"┬","&boxhu;":"┴","&boxminus;":"⊟","&boxplus;":"⊞","&boxtimes;":"⊠","&boxuL;":"╛","&boxuR;":"╘","&boxul;":"┘","&boxur;":"└","&boxv;":"│","&boxvH;":"╪","&boxvL;":"╡","&boxvR;":"╞","&boxvh;":"┼","&boxvl;":"┤","&boxvr;":"├","&bprime;":"‵","&breve;":"˘","&brvbar":"¦","&brvbar;":"¦","&bscr;":"𝒷","&bsemi;":"⁏","&bsim;":"∽","&bsime;":"⋍","&bsol;":"\\","&bsolb;":"⧅","&bsolhsub;":"⟈","&bull;":"•","&bullet;":"•","&bump;":"≎","&bumpE;":"⪮","&bumpe;":"≏","&bumpeq;":"≏","&cacute;":"ć","&cap;":"∩","&capand;":"⩄","&capbrcup;":"⩉","&capcap;":"⩋","&capcup;":"⩇","&capdot;":"⩀","&caps;":"∩︀","&caret;":"⁁","&caron;":"ˇ","&ccaps;":"⩍","&ccaron;":"č","&ccedil":"ç","&ccedil;":"ç","&ccirc;":"ĉ","&ccups;":"⩌","&ccupssm;":"⩐","&cdot;":"ċ","&cedil":"¸","&cedil;":"¸","&cemptyv;":"⦲","&cent":"¢","&cent;":"¢","&centerdot;":"·","&cfr;":"𝔠","&chcy;":"ч","&check;":"✓","&checkmark;":"✓","&chi;":"χ","&cir;":"○","&cirE;":"⧃","&circ;":"ˆ","&circeq;":"≗","&circlearrowleft;":"↺","&circlearrowright;":"↻","&circledR;":"®","&circledS;":"Ⓢ","&circledast;":"⊛","&circledcirc;":"⊚","&circleddash;":"⊝","&cire;":"≗","&cirfnint;":"⨐","&cirmid;":"⫯","&cirscir;":"⧂","&clubs;":"♣","&clubsuit;":"♣","&colon;":":","&colone;":"≔","&coloneq;":"≔","&comma;":",","&commat;":"@","&comp;":"∁","&compfn;":"∘","&complement;":"∁","&complexes;":"ℂ","&cong;":"≅","&congdot;":"⩭","&conint;":"∮","&copf;":"𝕔","&coprod;":"∐","&copy":"©","&copy;":"©","&copysr;":"℗","&crarr;":"↵","&cross;":"✗","&cscr;":"𝒸","&csub;":"⫏","&csube;":"⫑","&csup;":"⫐","&csupe;":"⫒","&ctdot;":"⋯","&cudarrl;":"⤸","&cudarrr;":"⤵","&cuepr;":"⋞","&cuesc;":"⋟","&cularr;":"↶","&cularrp;":"⤽","&cup;":"∪","&cupbrcap;":"⩈","&cupcap;":"⩆","&cupcup;":"⩊","&cupdot;":"⊍","&cupor;":"⩅","&cups;":"∪︀","&curarr;":"↷","&curarrm;":"⤼","&curlyeqprec;":"⋞","&curlyeqsucc;":"⋟","&curlyvee;":"⋎","&curlywedge;":"⋏","&curren":"¤","&curren;":"¤","&curvearrowleft;":"↶","&curvearrowright;":"↷","&cuvee;":"⋎","&cuwed;":"⋏","&cwconint;":"∲","&cwint;":"∱","&cylcty;":"⌭","&dArr;":"⇓","&dHar;":"⥥","&dagger;":"†","&daleth;":"ℸ","&darr;":"↓","&dash;":"‐","&dashv;":"⊣","&dbkarow;":"⤏","&dblac;":"˝","&dcaron;":"ď","&dcy;":"д","&dd;":"ⅆ","&ddagger;":"‡","&ddarr;":"⇊","&ddotseq;":"⩷","&deg":"°","&deg;":"°","&delta;":"δ","&demptyv;":"⦱","&dfisht;":"⥿","&dfr;":"𝔡","&dharl;":"⇃","&dharr;":"⇂","&diam;":"⋄","&diamond;":"⋄","&diamondsuit;":"♦","&diams;":"♦","&die;":"¨","&digamma;":"ϝ","&disin;":"⋲","&div;":"÷","&divide":"÷","&divide;":"÷","&divideontimes;":"⋇","&divonx;":"⋇","&djcy;":"ђ","&dlcorn;":"⌞","&dlcrop;":"⌍","&dollar;":"$","&dopf;":"𝕕","&dot;":"˙","&doteq;":"≐","&doteqdot;":"≑","&dotminus;":"∸","&dotplus;":"∔","&dotsquare;":"⊡","&doublebarwedge;":"⌆","&downarrow;":"↓","&downdownarrows;":"⇊","&downharpoonleft;":"⇃","&downharpoonright;":"⇂","&drbkarow;":"⤐","&drcorn;":"⌟","&drcrop;":"⌌","&dscr;":"𝒹","&dscy;":"ѕ","&dsol;":"⧶","&dstrok;":"đ","&dtdot;":"⋱","&dtri;":"▿","&dtrif;":"▾","&duarr;":"⇵","&duhar;":"⥯","&dwangle;":"⦦","&dzcy;":"џ","&dzigrarr;":"⟿","&eDDot;":"⩷","&eDot;":"≑","&eacute":"é","&eacute;":"é","&easter;":"⩮","&ecaron;":"ě","&ecir;":"≖","&ecirc":"ê","&ecirc;":"ê","&ecolon;":"≕","&ecy;":"э","&edot;":"ė","&ee;":"ⅇ","&efDot;":"≒","&efr;":"𝔢","&eg;":"⪚","&egrave":"è","&egrave;":"è","&egs;":"⪖","&egsdot;":"⪘","&el;":"⪙","&elinters;":"⏧","&ell;":"ℓ","&els;":"⪕","&elsdot;":"⪗","&emacr;":"ē","&empty;":"∅","&emptyset;":"∅","&emptyv;":"∅","&emsp13;":" ","&emsp14;":" ","&emsp;":" ","&eng;":"ŋ","&ensp;":" ","&eogon;":"ę","&eopf;":"𝕖","&epar;":"⋕","&eparsl;":"⧣","&eplus;":"⩱","&epsi;":"ε","&epsilon;":"ε","&epsiv;":"ϵ","&eqcirc;":"≖","&eqcolon;":"≕","&eqsim;":"≂","&eqslantgtr;":"⪖","&eqslantless;":"⪕","&equals;":"=","&equest;":"≟","&equiv;":"≡","&equivDD;":"⩸","&eqvparsl;":"⧥","&erDot;":"≓","&erarr;":"⥱","&escr;":"ℯ","&esdot;":"≐","&esim;":"≂","&eta;":"η","&eth":"ð","&eth;":"ð","&euml":"ë","&euml;":"ë","&euro;":"€","&excl;":"!","&exist;":"∃","&expectation;":"ℰ","&exponentiale;":"ⅇ","&fallingdotseq;":"≒","&fcy;":"ф","&female;":"♀","&ffilig;":"ffi","&fflig;":"ff","&ffllig;":"ffl","&ffr;":"𝔣","&filig;":"fi","&fjlig;":"fj","&flat;":"♭","&fllig;":"fl","&fltns;":"▱","&fnof;":"ƒ","&fopf;":"𝕗","&forall;":"∀","&fork;":"⋔","&forkv;":"⫙","&fpartint;":"⨍","&frac12":"½","&frac12;":"½","&frac13;":"⅓","&frac14":"¼","&frac14;":"¼","&frac15;":"⅕","&frac16;":"⅙","&frac18;":"⅛","&frac23;":"⅔","&frac25;":"⅖","&frac34":"¾","&frac34;":"¾","&frac35;":"⅗","&frac38;":"⅜","&frac45;":"⅘","&frac56;":"⅚","&frac58;":"⅝","&frac78;":"⅞","&frasl;":"⁄","&frown;":"⌢","&fscr;":"𝒻","&gE;":"≧","&gEl;":"⪌","&gacute;":"ǵ","&gamma;":"γ","&gammad;":"ϝ","&gap;":"⪆","&gbreve;":"ğ","&gcirc;":"ĝ","&gcy;":"г","&gdot;":"ġ","&ge;":"≥","&gel;":"⋛","&geq;":"≥","&geqq;":"≧","&geqslant;":"⩾","&ges;":"⩾","&gescc;":"⪩","&gesdot;":"⪀","&gesdoto;":"⪂","&gesdotol;":"⪄","&gesl;":"⋛︀","&gesles;":"⪔","&gfr;":"𝔤","&gg;":"≫","&ggg;":"⋙","&gimel;":"ℷ","&gjcy;":"ѓ","&gl;":"≷","&glE;":"⪒","&gla;":"⪥","&glj;":"⪤","&gnE;":"≩","&gnap;":"⪊","&gnapprox;":"⪊","&gne;":"⪈","&gneq;":"⪈","&gneqq;":"≩","&gnsim;":"⋧","&gopf;":"𝕘","&grave;":"`","&gscr;":"ℊ","&gsim;":"≳","&gsime;":"⪎","&gsiml;":"⪐","&gt":">","&gt;":">","&gtcc;":"⪧","&gtcir;":"⩺","&gtdot;":"⋗","&gtlPar;":"⦕","&gtquest;":"⩼","&gtrapprox;":"⪆","&gtrarr;":"⥸","&gtrdot;":"⋗","&gtreqless;":"⋛","&gtreqqless;":"⪌","&gtrless;":"≷","&gtrsim;":"≳","&gvertneqq;":"≩︀","&gvnE;":"≩︀","&hArr;":"⇔","&hairsp;":" ","&half;":"½","&hamilt;":"ℋ","&hardcy;":"ъ","&harr;":"↔","&harrcir;":"⥈","&harrw;":"↭","&hbar;":"ℏ","&hcirc;":"ĥ","&hearts;":"♥","&heartsuit;":"♥","&hellip;":"…","&hercon;":"⊹","&hfr;":"𝔥","&hksearow;":"⤥","&hkswarow;":"⤦","&hoarr;":"⇿","&homtht;":"∻","&hookleftarrow;":"↩","&hookrightarrow;":"↪","&hopf;":"𝕙","&horbar;":"―","&hscr;":"𝒽","&hslash;":"ℏ","&hstrok;":"ħ","&hybull;":"⁃","&hyphen;":"‐","&iacute":"í","&iacute;":"í","&ic;":"⁣","&icirc":"î","&icirc;":"î","&icy;":"и","&iecy;":"е","&iexcl":"¡","&iexcl;":"¡","&iff;":"⇔","&ifr;":"𝔦","&igrave":"ì","&igrave;":"ì","&ii;":"ⅈ","&iiiint;":"⨌","&iiint;":"∭","&iinfin;":"⧜","&iiota;":"℩","&ijlig;":"ij","&imacr;":"ī","&image;":"ℑ","&imagline;":"ℐ","&imagpart;":"ℑ","&imath;":"ı","&imof;":"⊷","&imped;":"Ƶ","&in;":"∈","&incare;":"℅","&infin;":"∞","&infintie;":"⧝","&inodot;":"ı","&int;":"∫","&intcal;":"⊺","&integers;":"ℤ","&intercal;":"⊺","&intlarhk;":"⨗","&intprod;":"⨼","&iocy;":"ё","&iogon;":"į","&iopf;":"𝕚","&iota;":"ι","&iprod;":"⨼","&iquest":"¿","&iquest;":"¿","&iscr;":"𝒾","&isin;":"∈","&isinE;":"⋹","&isindot;":"⋵","&isins;":"⋴","&isinsv;":"⋳","&isinv;":"∈","&it;":"⁢","&itilde;":"ĩ","&iukcy;":"і","&iuml":"ï","&iuml;":"ï","&jcirc;":"ĵ","&jcy;":"й","&jfr;":"𝔧","&jmath;":"ȷ","&jopf;":"𝕛","&jscr;":"𝒿","&jsercy;":"ј","&jukcy;":"є","&kappa;":"κ","&kappav;":"ϰ","&kcedil;":"ķ","&kcy;":"к","&kfr;":"𝔨","&kgreen;":"ĸ","&khcy;":"х","&kjcy;":"ќ","&kopf;":"𝕜","&kscr;":"𝓀","&lAarr;":"⇚","&lArr;":"⇐","&lAtail;":"⤛","&lBarr;":"⤎","&lE;":"≦","&lEg;":"⪋","&lHar;":"⥢","&lacute;":"ĺ","&laemptyv;":"⦴","&lagran;":"ℒ","&lambda;":"λ","&lang;":"⟨","&langd;":"⦑","&langle;":"⟨","&lap;":"⪅","&laquo":"«","&laquo;":"«","&larr;":"←","&larrb;":"⇤","&larrbfs;":"⤟","&larrfs;":"⤝","&larrhk;":"↩","&larrlp;":"↫","&larrpl;":"⤹","&larrsim;":"⥳","&larrtl;":"↢","&lat;":"⪫","&latail;":"⤙","&late;":"⪭","&lates;":"⪭︀","&lbarr;":"⤌","&lbbrk;":"❲","&lbrace;":"{","&lbrack;":"[","&lbrke;":"⦋","&lbrksld;":"⦏","&lbrkslu;":"⦍","&lcaron;":"ľ","&lcedil;":"ļ","&lceil;":"⌈","&lcub;":"{","&lcy;":"л","&ldca;":"⤶","&ldquo;":"“","&ldquor;":"„","&ldrdhar;":"⥧","&ldrushar;":"⥋","&ldsh;":"↲","&le;":"≤","&leftarrow;":"←","&leftarrowtail;":"↢","&leftharpoondown;":"↽","&leftharpoonup;":"↼","&leftleftarrows;":"⇇","&leftrightarrow;":"↔","&leftrightarrows;":"⇆","&leftrightharpoons;":"⇋","&leftrightsquigarrow;":"↭","&leftthreetimes;":"⋋","&leg;":"⋚","&leq;":"≤","&leqq;":"≦","&leqslant;":"⩽","&les;":"⩽","&lescc;":"⪨","&lesdot;":"⩿","&lesdoto;":"⪁","&lesdotor;":"⪃","&lesg;":"⋚︀","&lesges;":"⪓","&lessapprox;":"⪅","&lessdot;":"⋖","&lesseqgtr;":"⋚","&lesseqqgtr;":"⪋","&lessgtr;":"≶","&lesssim;":"≲","&lfisht;":"⥼","&lfloor;":"⌊","&lfr;":"𝔩","&lg;":"≶","&lgE;":"⪑","&lhard;":"↽","&lharu;":"↼","&lharul;":"⥪","&lhblk;":"▄","&ljcy;":"љ","&ll;":"≪","&llarr;":"⇇","&llcorner;":"⌞","&llhard;":"⥫","&lltri;":"◺","&lmidot;":"ŀ","&lmoust;":"⎰","&lmoustache;":"⎰","&lnE;":"≨","&lnap;":"⪉","&lnapprox;":"⪉","&lne;":"⪇","&lneq;":"⪇","&lneqq;":"≨","&lnsim;":"⋦","&loang;":"⟬","&loarr;":"⇽","&lobrk;":"⟦","&longleftarrow;":"⟵","&longleftrightarrow;":"⟷","&longmapsto;":"⟼","&longrightarrow;":"⟶","&looparrowleft;":"↫","&looparrowright;":"↬","&lopar;":"⦅","&lopf;":"𝕝","&loplus;":"⨭","&lotimes;":"⨴","&lowast;":"∗","&lowbar;":"_","&loz;":"◊","&lozenge;":"◊","&lozf;":"⧫","&lpar;":"(","&lparlt;":"⦓","&lrarr;":"⇆","&lrcorner;":"⌟","&lrhar;":"⇋","&lrhard;":"⥭","&lrm;":"‎","&lrtri;":"⊿","&lsaquo;":"‹","&lscr;":"𝓁","&lsh;":"↰","&lsim;":"≲","&lsime;":"⪍","&lsimg;":"⪏","&lsqb;":"[","&lsquo;":"‘","&lsquor;":"‚","&lstrok;":"ł","&lt":"<","&lt;":"<","&ltcc;":"⪦","&ltcir;":"⩹","&ltdot;":"⋖","&lthree;":"⋋","&ltimes;":"⋉","&ltlarr;":"⥶","&ltquest;":"⩻","&ltrPar;":"⦖","&ltri;":"◃","&ltrie;":"⊴","&ltrif;":"◂","&lurdshar;":"⥊","&luruhar;":"⥦","&lvertneqq;":"≨︀","&lvnE;":"≨︀","&mDDot;":"∺","&macr":"¯","&macr;":"¯","&male;":"♂","&malt;":"✠","&maltese;":"✠","&map;":"↦","&mapsto;":"↦","&mapstodown;":"↧","&mapstoleft;":"↤","&mapstoup;":"↥","&marker;":"▮","&mcomma;":"⨩","&mcy;":"м","&mdash;":"—","&measuredangle;":"∡","&mfr;":"𝔪","&mho;":"℧","&micro":"µ","&micro;":"µ","&mid;":"∣","&midast;":"*","&midcir;":"⫰","&middot":"·","&middot;":"·","&minus;":"−","&minusb;":"⊟","&minusd;":"∸","&minusdu;":"⨪","&mlcp;":"⫛","&mldr;":"…","&mnplus;":"∓","&models;":"⊧","&mopf;":"𝕞","&mp;":"∓","&mscr;":"𝓂","&mstpos;":"∾","&mu;":"μ","&multimap;":"⊸","&mumap;":"⊸","&nGg;":"⋙̸","&nGt;":"≫⃒","&nGtv;":"≫̸","&nLeftarrow;":"⇍","&nLeftrightarrow;":"⇎","&nLl;":"⋘̸","&nLt;":"≪⃒","&nLtv;":"≪̸","&nRightarrow;":"⇏","&nVDash;":"⊯","&nVdash;":"⊮","&nabla;":"∇","&nacute;":"ń","&nang;":"∠⃒","&nap;":"≉","&napE;":"⩰̸","&napid;":"≋̸","&napos;":"ʼn","&napprox;":"≉","&natur;":"♮","&natural;":"♮","&naturals;":"ℕ","&nbsp":" ","&nbsp;":" ","&nbump;":"≎̸","&nbumpe;":"≏̸","&ncap;":"⩃","&ncaron;":"ň","&ncedil;":"ņ","&ncong;":"≇","&ncongdot;":"⩭̸","&ncup;":"⩂","&ncy;":"н","&ndash;":"–","&ne;":"≠","&neArr;":"⇗","&nearhk;":"⤤","&nearr;":"↗","&nearrow;":"↗","&nedot;":"≐̸","&nequiv;":"≢","&nesear;":"⤨","&nesim;":"≂̸","&nexist;":"∄","&nexists;":"∄","&nfr;":"𝔫","&ngE;":"≧̸","&nge;":"≱","&ngeq;":"≱","&ngeqq;":"≧̸","&ngeqslant;":"⩾̸","&nges;":"⩾̸","&ngsim;":"≵","&ngt;":"≯","&ngtr;":"≯","&nhArr;":"⇎","&nharr;":"↮","&nhpar;":"⫲","&ni;":"∋","&nis;":"⋼","&nisd;":"⋺","&niv;":"∋","&njcy;":"њ","&nlArr;":"⇍","&nlE;":"≦̸","&nlarr;":"↚","&nldr;":"‥","&nle;":"≰","&nleftarrow;":"↚","&nleftrightarrow;":"↮","&nleq;":"≰","&nleqq;":"≦̸","&nleqslant;":"⩽̸","&nles;":"⩽̸","&nless;":"≮","&nlsim;":"≴","&nlt;":"≮","&nltri;":"⋪","&nltrie;":"⋬","&nmid;":"∤","&nopf;":"𝕟","&not":"¬","&not;":"¬","&notin;":"∉","&notinE;":"⋹̸","&notindot;":"⋵̸","&notinva;":"∉","&notinvb;":"⋷","&notinvc;":"⋶","&notni;":"∌","&notniva;":"∌","&notnivb;":"⋾","&notnivc;":"⋽","&npar;":"∦","&nparallel;":"∦","&nparsl;":"⫽⃥","&npart;":"∂̸","&npolint;":"⨔","&npr;":"⊀","&nprcue;":"⋠","&npre;":"⪯̸","&nprec;":"⊀","&npreceq;":"⪯̸","&nrArr;":"⇏","&nrarr;":"↛","&nrarrc;":"⤳̸","&nrarrw;":"↝̸","&nrightarrow;":"↛","&nrtri;":"⋫","&nrtrie;":"⋭","&nsc;":"⊁","&nsccue;":"⋡","&nsce;":"⪰̸","&nscr;":"𝓃","&nshortmid;":"∤","&nshortparallel;":"∦","&nsim;":"≁","&nsime;":"≄","&nsimeq;":"≄","&nsmid;":"∤","&nspar;":"∦","&nsqsube;":"⋢","&nsqsupe;":"⋣","&nsub;":"⊄","&nsubE;":"⫅̸","&nsube;":"⊈","&nsubset;":"⊂⃒","&nsubseteq;":"⊈","&nsubseteqq;":"⫅̸","&nsucc;":"⊁","&nsucceq;":"⪰̸","&nsup;":"⊅","&nsupE;":"⫆̸","&nsupe;":"⊉","&nsupset;":"⊃⃒","&nsupseteq;":"⊉","&nsupseteqq;":"⫆̸","&ntgl;":"≹","&ntilde":"ñ","&ntilde;":"ñ","&ntlg;":"≸","&ntriangleleft;":"⋪","&ntrianglelefteq;":"⋬","&ntriangleright;":"⋫","&ntrianglerighteq;":"⋭","&nu;":"ν","&num;":"#","&numero;":"№","&numsp;":" ","&nvDash;":"⊭","&nvHarr;":"⤄","&nvap;":"≍⃒","&nvdash;":"⊬","&nvge;":"≥⃒","&nvgt;":">⃒","&nvinfin;":"⧞","&nvlArr;":"⤂","&nvle;":"≤⃒","&nvlt;":"<⃒","&nvltrie;":"⊴⃒","&nvrArr;":"⤃","&nvrtrie;":"⊵⃒","&nvsim;":"∼⃒","&nwArr;":"⇖","&nwarhk;":"⤣","&nwarr;":"↖","&nwarrow;":"↖","&nwnear;":"⤧","&oS;":"Ⓢ","&oacute":"ó","&oacute;":"ó","&oast;":"⊛","&ocir;":"⊚","&ocirc":"ô","&ocirc;":"ô","&ocy;":"о","&odash;":"⊝","&odblac;":"ő","&odiv;":"⨸","&odot;":"⊙","&odsold;":"⦼","&oelig;":"œ","&ofcir;":"⦿","&ofr;":"𝔬","&ogon;":"˛","&ograve":"ò","&ograve;":"ò","&ogt;":"⧁","&ohbar;":"⦵","&ohm;":"Ω","&oint;":"∮","&olarr;":"↺","&olcir;":"⦾","&olcross;":"⦻","&oline;":"‾","&olt;":"⧀","&omacr;":"ō","&omega;":"ω","&omicron;":"ο","&omid;":"⦶","&ominus;":"⊖","&oopf;":"𝕠","&opar;":"⦷","&operp;":"⦹","&oplus;":"⊕","&or;":"∨","&orarr;":"↻","&ord;":"⩝","&order;":"ℴ","&orderof;":"ℴ","&ordf":"ª","&ordf;":"ª","&ordm":"º","&ordm;":"º","&origof;":"⊶","&oror;":"⩖","&orslope;":"⩗","&orv;":"⩛","&oscr;":"ℴ","&oslash":"ø","&oslash;":"ø","&osol;":"⊘","&otilde":"õ","&otilde;":"õ","&otimes;":"⊗","&otimesas;":"⨶","&ouml":"ö","&ouml;":"ö","&ovbar;":"⌽","&par;":"∥","&para":"¶","&para;":"¶","&parallel;":"∥","&parsim;":"⫳","&parsl;":"⫽","&part;":"∂","&pcy;":"п","&percnt;":"%","&period;":".","&permil;":"‰","&perp;":"⊥","&pertenk;":"‱","&pfr;":"𝔭","&phi;":"φ","&phiv;":"ϕ","&phmmat;":"ℳ","&phone;":"☎","&pi;":"π","&pitchfork;":"⋔","&piv;":"ϖ","&planck;":"ℏ","&planckh;":"ℎ","&plankv;":"ℏ","&plus;":"+","&plusacir;":"⨣","&plusb;":"⊞","&pluscir;":"⨢","&plusdo;":"∔","&plusdu;":"⨥","&pluse;":"⩲","&plusmn":"±","&plusmn;":"±","&plussim;":"⨦","&plustwo;":"⨧","&pm;":"±","&pointint;":"⨕","&popf;":"𝕡","&pound":"£","&pound;":"£","&pr;":"≺","&prE;":"⪳","&prap;":"⪷","&prcue;":"≼","&pre;":"⪯","&prec;":"≺","&precapprox;":"⪷","&preccurlyeq;":"≼","&preceq;":"⪯","&precnapprox;":"⪹","&precneqq;":"⪵","&precnsim;":"⋨","&precsim;":"≾","&prime;":"′","&primes;":"ℙ","&prnE;":"⪵","&prnap;":"⪹","&prnsim;":"⋨","&prod;":"∏","&profalar;":"⌮","&profline;":"⌒","&profsurf;":"⌓","&prop;":"∝","&propto;":"∝","&prsim;":"≾","&prurel;":"⊰","&pscr;":"𝓅","&psi;":"ψ","&puncsp;":" ","&qfr;":"𝔮","&qint;":"⨌","&qopf;":"𝕢","&qprime;":"⁗","&qscr;":"𝓆","&quaternions;":"ℍ","&quatint;":"⨖","&quest;":"?","&questeq;":"≟","&quot":'"',"&quot;":'"',"&rAarr;":"⇛","&rArr;":"⇒","&rAtail;":"⤜","&rBarr;":"⤏","&rHar;":"⥤","&race;":"∽̱","&racute;":"ŕ","&radic;":"√","&raemptyv;":"⦳","&rang;":"⟩","&rangd;":"⦒","&range;":"⦥","&rangle;":"⟩","&raquo":"»","&raquo;":"»","&rarr;":"→","&rarrap;":"⥵","&rarrb;":"⇥","&rarrbfs;":"⤠","&rarrc;":"⤳","&rarrfs;":"⤞","&rarrhk;":"↪","&rarrlp;":"↬","&rarrpl;":"⥅","&rarrsim;":"⥴","&rarrtl;":"↣","&rarrw;":"↝","&ratail;":"⤚","&ratio;":"∶","&rationals;":"ℚ","&rbarr;":"⤍","&rbbrk;":"❳","&rbrace;":"}","&rbrack;":"]","&rbrke;":"⦌","&rbrksld;":"⦎","&rbrkslu;":"⦐","&rcaron;":"ř","&rcedil;":"ŗ","&rceil;":"⌉","&rcub;":"}","&rcy;":"р","&rdca;":"⤷","&rdldhar;":"⥩","&rdquo;":"”","&rdquor;":"”","&rdsh;":"↳","&real;":"ℜ","&realine;":"ℛ","&realpart;":"ℜ","&reals;":"ℝ","&rect;":"▭","&reg":"®","&reg;":"®","&rfisht;":"⥽","&rfloor;":"⌋","&rfr;":"𝔯","&rhard;":"⇁","&rharu;":"⇀","&rharul;":"⥬","&rho;":"ρ","&rhov;":"ϱ","&rightarrow;":"→","&rightarrowtail;":"↣","&rightharpoondown;":"⇁","&rightharpoonup;":"⇀","&rightleftarrows;":"⇄","&rightleftharpoons;":"⇌","&rightrightarrows;":"⇉","&rightsquigarrow;":"↝","&rightthreetimes;":"⋌","&ring;":"˚","&risingdotseq;":"≓","&rlarr;":"⇄","&rlhar;":"⇌","&rlm;":"‏","&rmoust;":"⎱","&rmoustache;":"⎱","&rnmid;":"⫮","&roang;":"⟭","&roarr;":"⇾","&robrk;":"⟧","&ropar;":"⦆","&ropf;":"𝕣","&roplus;":"⨮","&rotimes;":"⨵","&rpar;":")","&rpargt;":"⦔","&rppolint;":"⨒","&rrarr;":"⇉","&rsaquo;":"›","&rscr;":"𝓇","&rsh;":"↱","&rsqb;":"]","&rsquo;":"’","&rsquor;":"’","&rthree;":"⋌","&rtimes;":"⋊","&rtri;":"▹","&rtrie;":"⊵","&rtrif;":"▸","&rtriltri;":"⧎","&ruluhar;":"⥨","&rx;":"℞","&sacute;":"ś","&sbquo;":"‚","&sc;":"≻","&scE;":"⪴","&scap;":"⪸","&scaron;":"š","&sccue;":"≽","&sce;":"⪰","&scedil;":"ş","&scirc;":"ŝ","&scnE;":"⪶","&scnap;":"⪺","&scnsim;":"⋩","&scpolint;":"⨓","&scsim;":"≿","&scy;":"с","&sdot;":"⋅","&sdotb;":"⊡","&sdote;":"⩦","&seArr;":"⇘","&searhk;":"⤥","&searr;":"↘","&searrow;":"↘","&sect":"§","&sect;":"§","&semi;":";","&seswar;":"⤩","&setminus;":"∖","&setmn;":"∖","&sext;":"✶","&sfr;":"𝔰","&sfrown;":"⌢","&sharp;":"♯","&shchcy;":"щ","&shcy;":"ш","&shortmid;":"∣","&shortparallel;":"∥","&shy":"­","&shy;":"­","&sigma;":"σ","&sigmaf;":"ς","&sigmav;":"ς","&sim;":"∼","&simdot;":"⩪","&sime;":"≃","&simeq;":"≃","&simg;":"⪞","&simgE;":"⪠","&siml;":"⪝","&simlE;":"⪟","&simne;":"≆","&simplus;":"⨤","&simrarr;":"⥲","&slarr;":"←","&smallsetminus;":"∖","&smashp;":"⨳","&smeparsl;":"⧤","&smid;":"∣","&smile;":"⌣","&smt;":"⪪","&smte;":"⪬","&smtes;":"⪬︀","&softcy;":"ь","&sol;":"/","&solb;":"⧄","&solbar;":"⌿","&sopf;":"𝕤","&spades;":"♠","&spadesuit;":"♠","&spar;":"∥","&sqcap;":"⊓","&sqcaps;":"⊓︀","&sqcup;":"⊔","&sqcups;":"⊔︀","&sqsub;":"⊏","&sqsube;":"⊑","&sqsubset;":"⊏","&sqsubseteq;":"⊑","&sqsup;":"⊐","&sqsupe;":"⊒","&sqsupset;":"⊐","&sqsupseteq;":"⊒","&squ;":"□","&square;":"□","&squarf;":"▪","&squf;":"▪","&srarr;":"→","&sscr;":"𝓈","&ssetmn;":"∖","&ssmile;":"⌣","&sstarf;":"⋆","&star;":"☆","&starf;":"★","&straightepsilon;":"ϵ","&straightphi;":"ϕ","&strns;":"¯","&sub;":"⊂","&subE;":"⫅","&subdot;":"⪽","&sube;":"⊆","&subedot;":"⫃","&submult;":"⫁","&subnE;":"⫋","&subne;":"⊊","&subplus;":"⪿","&subrarr;":"⥹","&subset;":"⊂","&subseteq;":"⊆","&subseteqq;":"⫅","&subsetneq;":"⊊","&subsetneqq;":"⫋","&subsim;":"⫇","&subsub;":"⫕","&subsup;":"⫓","&succ;":"≻","&succapprox;":"⪸","&succcurlyeq;":"≽","&succeq;":"⪰","&succnapprox;":"⪺","&succneqq;":"⪶","&succnsim;":"⋩","&succsim;":"≿","&sum;":"∑","&sung;":"♪","&sup1":"¹","&sup1;":"¹","&sup2":"²","&sup2;":"²","&sup3":"³","&sup3;":"³","&sup;":"⊃","&supE;":"⫆","&supdot;":"⪾","&supdsub;":"⫘","&supe;":"⊇","&supedot;":"⫄","&suphsol;":"⟉","&suphsub;":"⫗","&suplarr;":"⥻","&supmult;":"⫂","&supnE;":"⫌","&supne;":"⊋","&supplus;":"⫀","&supset;":"⊃","&supseteq;":"⊇","&supseteqq;":"⫆","&supsetneq;":"⊋","&supsetneqq;":"⫌","&supsim;":"⫈","&supsub;":"⫔","&supsup;":"⫖","&swArr;":"⇙","&swarhk;":"⤦","&swarr;":"↙","&swarrow;":"↙","&swnwar;":"⤪","&szlig":"ß","&szlig;":"ß","&target;":"⌖","&tau;":"τ","&tbrk;":"⎴","&tcaron;":"ť","&tcedil;":"ţ","&tcy;":"т","&tdot;":"⃛","&telrec;":"⌕","&tfr;":"𝔱","&there4;":"∴","&therefore;":"∴","&theta;":"θ","&thetasym;":"ϑ","&thetav;":"ϑ","&thickapprox;":"≈","&thicksim;":"∼","&thinsp;":" ","&thkap;":"≈","&thksim;":"∼","&thorn":"þ","&thorn;":"þ","&tilde;":"˜","&times":"×","&times;":"×","&timesb;":"⊠","&timesbar;":"⨱","&timesd;":"⨰","&tint;":"∭","&toea;":"⤨","&top;":"⊤","&topbot;":"⌶","&topcir;":"⫱","&topf;":"𝕥","&topfork;":"⫚","&tosa;":"⤩","&tprime;":"‴","&trade;":"™","&triangle;":"▵","&triangledown;":"▿","&triangleleft;":"◃","&trianglelefteq;":"⊴","&triangleq;":"≜","&triangleright;":"▹","&trianglerighteq;":"⊵","&tridot;":"◬","&trie;":"≜","&triminus;":"⨺","&triplus;":"⨹","&trisb;":"⧍","&tritime;":"⨻","&trpezium;":"⏢","&tscr;":"𝓉","&tscy;":"ц","&tshcy;":"ћ","&tstrok;":"ŧ","&twixt;":"≬","&twoheadleftarrow;":"↞","&twoheadrightarrow;":"↠","&uArr;":"⇑","&uHar;":"⥣","&uacute":"ú","&uacute;":"ú","&uarr;":"↑","&ubrcy;":"ў","&ubreve;":"ŭ","&ucirc":"û","&ucirc;":"û","&ucy;":"у","&udarr;":"⇅","&udblac;":"ű","&udhar;":"⥮","&ufisht;":"⥾","&ufr;":"𝔲","&ugrave":"ù","&ugrave;":"ù","&uharl;":"↿","&uharr;":"↾","&uhblk;":"▀","&ulcorn;":"⌜","&ulcorner;":"⌜","&ulcrop;":"⌏","&ultri;":"◸","&umacr;":"ū","&uml":"¨","&uml;":"¨","&uogon;":"ų","&uopf;":"𝕦","&uparrow;":"↑","&updownarrow;":"↕","&upharpoonleft;":"↿","&upharpoonright;":"↾","&uplus;":"⊎","&upsi;":"υ","&upsih;":"ϒ","&upsilon;":"υ","&upuparrows;":"⇈","&urcorn;":"⌝","&urcorner;":"⌝","&urcrop;":"⌎","&uring;":"ů","&urtri;":"◹","&uscr;":"𝓊","&utdot;":"⋰","&utilde;":"ũ","&utri;":"▵","&utrif;":"▴","&uuarr;":"⇈","&uuml":"ü","&uuml;":"ü","&uwangle;":"⦧","&vArr;":"⇕","&vBar;":"⫨","&vBarv;":"⫩","&vDash;":"⊨","&vangrt;":"⦜","&varepsilon;":"ϵ","&varkappa;":"ϰ","&varnothing;":"∅","&varphi;":"ϕ","&varpi;":"ϖ","&varpropto;":"∝","&varr;":"↕","&varrho;":"ϱ","&varsigma;":"ς","&varsubsetneq;":"⊊︀","&varsubsetneqq;":"⫋︀","&varsupsetneq;":"⊋︀","&varsupsetneqq;":"⫌︀","&vartheta;":"ϑ","&vartriangleleft;":"⊲","&vartriangleright;":"⊳","&vcy;":"в","&vdash;":"⊢","&vee;":"∨","&veebar;":"⊻","&veeeq;":"≚","&vellip;":"⋮","&verbar;":"|","&vert;":"|","&vfr;":"𝔳","&vltri;":"⊲","&vnsub;":"⊂⃒","&vnsup;":"⊃⃒","&vopf;":"𝕧","&vprop;":"∝","&vrtri;":"⊳","&vscr;":"𝓋","&vsubnE;":"⫋︀","&vsubne;":"⊊︀","&vsupnE;":"⫌︀","&vsupne;":"⊋︀","&vzigzag;":"⦚","&wcirc;":"ŵ","&wedbar;":"⩟","&wedge;":"∧","&wedgeq;":"≙","&weierp;":"℘","&wfr;":"𝔴","&wopf;":"𝕨","&wp;":"℘","&wr;":"≀","&wreath;":"≀","&wscr;":"𝓌","&xcap;":"⋂","&xcirc;":"◯","&xcup;":"⋃","&xdtri;":"▽","&xfr;":"𝔵","&xhArr;":"⟺","&xharr;":"⟷","&xi;":"ξ","&xlArr;":"⟸","&xlarr;":"⟵","&xmap;":"⟼","&xnis;":"⋻","&xodot;":"⨀","&xopf;":"𝕩","&xoplus;":"⨁","&xotime;":"⨂","&xrArr;":"⟹","&xrarr;":"⟶","&xscr;":"𝓍","&xsqcup;":"⨆","&xuplus;":"⨄","&xutri;":"△","&xvee;":"⋁","&xwedge;":"⋀","&yacute":"ý","&yacute;":"ý","&yacy;":"я","&ycirc;":"ŷ","&ycy;":"ы","&yen":"¥","&yen;":"¥","&yfr;":"𝔶","&yicy;":"ї","&yopf;":"𝕪","&yscr;":"𝓎","&yucy;":"ю","&yuml":"ÿ","&yuml;":"ÿ","&zacute;":"ź","&zcaron;":"ž","&zcy;":"з","&zdot;":"ż","&zeetrf;":"ℨ","&zeta;":"ζ","&zfr;":"𝔷","&zhcy;":"ж","&zigrarr;":"⇝","&zopf;":"𝕫","&zscr;":"𝓏","&zwj;":"‍","&zwnj;":"‌"};function Ja(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof Wi[e]=="string")return Wi[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;t.charAt(1)==="x"?n=parseInt(t.substr(2),16):n=parseInt(t.substr(1),10);var s="";return n>=55296&&n<=57343||n>1114111?"�":(n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}function ar(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}function Qa(r){return"<div>"+ar(r).replace(/\n/g,"<br />")+"</div>"}function Ya(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
5
+ `+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let n=t.indexOf(":"),s=n<0?t.trim():t.substr(0,n).trim(),o=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:o}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:o,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:o,parsed:{}};break;case"content-disposition":this.contentDisposition={value:o,parsed:{}};break;case"content-id":this.contentId=o;break;case"content-description":this.contentDescription=o;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Nr.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(Qr().decode(e));break;case"body":this.contentDecoder.update(e)}}}const Gi={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
6
+ `,"&Nfr;":"𝔑","&NoBreak;":"⁠","&NonBreakingSpace;":" ","&Nopf;":"ℕ","&Not;":"⫬","&NotCongruent;":"≢","&NotCupCap;":"≭","&NotDoubleVerticalBar;":"∦","&NotElement;":"∉","&NotEqual;":"≠","&NotEqualTilde;":"≂̸","&NotExists;":"∄","&NotGreater;":"≯","&NotGreaterEqual;":"≱","&NotGreaterFullEqual;":"≧̸","&NotGreaterGreater;":"≫̸","&NotGreaterLess;":"≹","&NotGreaterSlantEqual;":"⩾̸","&NotGreaterTilde;":"≵","&NotHumpDownHump;":"≎̸","&NotHumpEqual;":"≏̸","&NotLeftTriangle;":"⋪","&NotLeftTriangleBar;":"⧏̸","&NotLeftTriangleEqual;":"⋬","&NotLess;":"≮","&NotLessEqual;":"≰","&NotLessGreater;":"≸","&NotLessLess;":"≪̸","&NotLessSlantEqual;":"⩽̸","&NotLessTilde;":"≴","&NotNestedGreaterGreater;":"⪢̸","&NotNestedLessLess;":"⪡̸","&NotPrecedes;":"⊀","&NotPrecedesEqual;":"⪯̸","&NotPrecedesSlantEqual;":"⋠","&NotReverseElement;":"∌","&NotRightTriangle;":"⋫","&NotRightTriangleBar;":"⧐̸","&NotRightTriangleEqual;":"⋭","&NotSquareSubset;":"⊏̸","&NotSquareSubsetEqual;":"⋢","&NotSquareSuperset;":"⊐̸","&NotSquareSupersetEqual;":"⋣","&NotSubset;":"⊂⃒","&NotSubsetEqual;":"⊈","&NotSucceeds;":"⊁","&NotSucceedsEqual;":"⪰̸","&NotSucceedsSlantEqual;":"⋡","&NotSucceedsTilde;":"≿̸","&NotSuperset;":"⊃⃒","&NotSupersetEqual;":"⊉","&NotTilde;":"≁","&NotTildeEqual;":"≄","&NotTildeFullEqual;":"≇","&NotTildeTilde;":"≉","&NotVerticalBar;":"∤","&Nscr;":"𝒩","&Ntilde":"Ñ","&Ntilde;":"Ñ","&Nu;":"Ν","&OElig;":"Œ","&Oacute":"Ó","&Oacute;":"Ó","&Ocirc":"Ô","&Ocirc;":"Ô","&Ocy;":"О","&Odblac;":"Ő","&Ofr;":"𝔒","&Ograve":"Ò","&Ograve;":"Ò","&Omacr;":"Ō","&Omega;":"Ω","&Omicron;":"Ο","&Oopf;":"𝕆","&OpenCurlyDoubleQuote;":"“","&OpenCurlyQuote;":"‘","&Or;":"⩔","&Oscr;":"𝒪","&Oslash":"Ø","&Oslash;":"Ø","&Otilde":"Õ","&Otilde;":"Õ","&Otimes;":"⨷","&Ouml":"Ö","&Ouml;":"Ö","&OverBar;":"‾","&OverBrace;":"⏞","&OverBracket;":"⎴","&OverParenthesis;":"⏜","&PartialD;":"∂","&Pcy;":"П","&Pfr;":"𝔓","&Phi;":"Φ","&Pi;":"Π","&PlusMinus;":"±","&Poincareplane;":"ℌ","&Popf;":"ℙ","&Pr;":"⪻","&Precedes;":"≺","&PrecedesEqual;":"⪯","&PrecedesSlantEqual;":"≼","&PrecedesTilde;":"≾","&Prime;":"″","&Product;":"∏","&Proportion;":"∷","&Proportional;":"∝","&Pscr;":"𝒫","&Psi;":"Ψ","&QUOT":'"',"&QUOT;":'"',"&Qfr;":"𝔔","&Qopf;":"ℚ","&Qscr;":"𝒬","&RBarr;":"⤐","&REG":"®","&REG;":"®","&Racute;":"Ŕ","&Rang;":"⟫","&Rarr;":"↠","&Rarrtl;":"⤖","&Rcaron;":"Ř","&Rcedil;":"Ŗ","&Rcy;":"Р","&Re;":"ℜ","&ReverseElement;":"∋","&ReverseEquilibrium;":"⇋","&ReverseUpEquilibrium;":"⥯","&Rfr;":"ℜ","&Rho;":"Ρ","&RightAngleBracket;":"⟩","&RightArrow;":"→","&RightArrowBar;":"⇥","&RightArrowLeftArrow;":"⇄","&RightCeiling;":"⌉","&RightDoubleBracket;":"⟧","&RightDownTeeVector;":"⥝","&RightDownVector;":"⇂","&RightDownVectorBar;":"⥕","&RightFloor;":"⌋","&RightTee;":"⊢","&RightTeeArrow;":"↦","&RightTeeVector;":"⥛","&RightTriangle;":"⊳","&RightTriangleBar;":"⧐","&RightTriangleEqual;":"⊵","&RightUpDownVector;":"⥏","&RightUpTeeVector;":"⥜","&RightUpVector;":"↾","&RightUpVectorBar;":"⥔","&RightVector;":"⇀","&RightVectorBar;":"⥓","&Rightarrow;":"⇒","&Ropf;":"ℝ","&RoundImplies;":"⥰","&Rrightarrow;":"⇛","&Rscr;":"ℛ","&Rsh;":"↱","&RuleDelayed;":"⧴","&SHCHcy;":"Щ","&SHcy;":"Ш","&SOFTcy;":"Ь","&Sacute;":"Ś","&Sc;":"⪼","&Scaron;":"Š","&Scedil;":"Ş","&Scirc;":"Ŝ","&Scy;":"С","&Sfr;":"𝔖","&ShortDownArrow;":"↓","&ShortLeftArrow;":"←","&ShortRightArrow;":"→","&ShortUpArrow;":"↑","&Sigma;":"Σ","&SmallCircle;":"∘","&Sopf;":"𝕊","&Sqrt;":"√","&Square;":"□","&SquareIntersection;":"⊓","&SquareSubset;":"⊏","&SquareSubsetEqual;":"⊑","&SquareSuperset;":"⊐","&SquareSupersetEqual;":"⊒","&SquareUnion;":"⊔","&Sscr;":"𝒮","&Star;":"⋆","&Sub;":"⋐","&Subset;":"⋐","&SubsetEqual;":"⊆","&Succeeds;":"≻","&SucceedsEqual;":"⪰","&SucceedsSlantEqual;":"≽","&SucceedsTilde;":"≿","&SuchThat;":"∋","&Sum;":"∑","&Sup;":"⋑","&Superset;":"⊃","&SupersetEqual;":"⊇","&Supset;":"⋑","&THORN":"Þ","&THORN;":"Þ","&TRADE;":"™","&TSHcy;":"Ћ","&TScy;":"Ц","&Tab;":" ","&Tau;":"Τ","&Tcaron;":"Ť","&Tcedil;":"Ţ","&Tcy;":"Т","&Tfr;":"𝔗","&Therefore;":"∴","&Theta;":"Θ","&ThickSpace;":"  ","&ThinSpace;":" ","&Tilde;":"∼","&TildeEqual;":"≃","&TildeFullEqual;":"≅","&TildeTilde;":"≈","&Topf;":"𝕋","&TripleDot;":"⃛","&Tscr;":"𝒯","&Tstrok;":"Ŧ","&Uacute":"Ú","&Uacute;":"Ú","&Uarr;":"↟","&Uarrocir;":"⥉","&Ubrcy;":"Ў","&Ubreve;":"Ŭ","&Ucirc":"Û","&Ucirc;":"Û","&Ucy;":"У","&Udblac;":"Ű","&Ufr;":"𝔘","&Ugrave":"Ù","&Ugrave;":"Ù","&Umacr;":"Ū","&UnderBar;":"_","&UnderBrace;":"⏟","&UnderBracket;":"⎵","&UnderParenthesis;":"⏝","&Union;":"⋃","&UnionPlus;":"⊎","&Uogon;":"Ų","&Uopf;":"𝕌","&UpArrow;":"↑","&UpArrowBar;":"⤒","&UpArrowDownArrow;":"⇅","&UpDownArrow;":"↕","&UpEquilibrium;":"⥮","&UpTee;":"⊥","&UpTeeArrow;":"↥","&Uparrow;":"⇑","&Updownarrow;":"⇕","&UpperLeftArrow;":"↖","&UpperRightArrow;":"↗","&Upsi;":"ϒ","&Upsilon;":"Υ","&Uring;":"Ů","&Uscr;":"𝒰","&Utilde;":"Ũ","&Uuml":"Ü","&Uuml;":"Ü","&VDash;":"⊫","&Vbar;":"⫫","&Vcy;":"В","&Vdash;":"⊩","&Vdashl;":"⫦","&Vee;":"⋁","&Verbar;":"‖","&Vert;":"‖","&VerticalBar;":"∣","&VerticalLine;":"|","&VerticalSeparator;":"❘","&VerticalTilde;":"≀","&VeryThinSpace;":" ","&Vfr;":"𝔙","&Vopf;":"𝕍","&Vscr;":"𝒱","&Vvdash;":"⊪","&Wcirc;":"Ŵ","&Wedge;":"⋀","&Wfr;":"𝔚","&Wopf;":"𝕎","&Wscr;":"𝒲","&Xfr;":"𝔛","&Xi;":"Ξ","&Xopf;":"𝕏","&Xscr;":"𝒳","&YAcy;":"Я","&YIcy;":"Ї","&YUcy;":"Ю","&Yacute":"Ý","&Yacute;":"Ý","&Ycirc;":"Ŷ","&Ycy;":"Ы","&Yfr;":"𝔜","&Yopf;":"𝕐","&Yscr;":"𝒴","&Yuml;":"Ÿ","&ZHcy;":"Ж","&Zacute;":"Ź","&Zcaron;":"Ž","&Zcy;":"З","&Zdot;":"Ż","&ZeroWidthSpace;":"​","&Zeta;":"Ζ","&Zfr;":"ℨ","&Zopf;":"ℤ","&Zscr;":"𝒵","&aacute":"á","&aacute;":"á","&abreve;":"ă","&ac;":"∾","&acE;":"∾̳","&acd;":"∿","&acirc":"â","&acirc;":"â","&acute":"´","&acute;":"´","&acy;":"а","&aelig":"æ","&aelig;":"æ","&af;":"⁡","&afr;":"𝔞","&agrave":"à","&agrave;":"à","&alefsym;":"ℵ","&aleph;":"ℵ","&alpha;":"α","&amacr;":"ā","&amalg;":"⨿","&amp":"&","&amp;":"&","&and;":"∧","&andand;":"⩕","&andd;":"⩜","&andslope;":"⩘","&andv;":"⩚","&ang;":"∠","&ange;":"⦤","&angle;":"∠","&angmsd;":"∡","&angmsdaa;":"⦨","&angmsdab;":"⦩","&angmsdac;":"⦪","&angmsdad;":"⦫","&angmsdae;":"⦬","&angmsdaf;":"⦭","&angmsdag;":"⦮","&angmsdah;":"⦯","&angrt;":"∟","&angrtvb;":"⊾","&angrtvbd;":"⦝","&angsph;":"∢","&angst;":"Å","&angzarr;":"⍼","&aogon;":"ą","&aopf;":"𝕒","&ap;":"≈","&apE;":"⩰","&apacir;":"⩯","&ape;":"≊","&apid;":"≋","&apos;":"'","&approx;":"≈","&approxeq;":"≊","&aring":"å","&aring;":"å","&ascr;":"𝒶","&ast;":"*","&asymp;":"≈","&asympeq;":"≍","&atilde":"ã","&atilde;":"ã","&auml":"ä","&auml;":"ä","&awconint;":"∳","&awint;":"⨑","&bNot;":"⫭","&backcong;":"≌","&backepsilon;":"϶","&backprime;":"‵","&backsim;":"∽","&backsimeq;":"⋍","&barvee;":"⊽","&barwed;":"⌅","&barwedge;":"⌅","&bbrk;":"⎵","&bbrktbrk;":"⎶","&bcong;":"≌","&bcy;":"б","&bdquo;":"„","&becaus;":"∵","&because;":"∵","&bemptyv;":"⦰","&bepsi;":"϶","&bernou;":"ℬ","&beta;":"β","&beth;":"ℶ","&between;":"≬","&bfr;":"𝔟","&bigcap;":"⋂","&bigcirc;":"◯","&bigcup;":"⋃","&bigodot;":"⨀","&bigoplus;":"⨁","&bigotimes;":"⨂","&bigsqcup;":"⨆","&bigstar;":"★","&bigtriangledown;":"▽","&bigtriangleup;":"△","&biguplus;":"⨄","&bigvee;":"⋁","&bigwedge;":"⋀","&bkarow;":"⤍","&blacklozenge;":"⧫","&blacksquare;":"▪","&blacktriangle;":"▴","&blacktriangledown;":"▾","&blacktriangleleft;":"◂","&blacktriangleright;":"▸","&blank;":"␣","&blk12;":"▒","&blk14;":"░","&blk34;":"▓","&block;":"█","&bne;":"=⃥","&bnequiv;":"≡⃥","&bnot;":"⌐","&bopf;":"𝕓","&bot;":"⊥","&bottom;":"⊥","&bowtie;":"⋈","&boxDL;":"╗","&boxDR;":"╔","&boxDl;":"╖","&boxDr;":"╓","&boxH;":"═","&boxHD;":"╦","&boxHU;":"╩","&boxHd;":"╤","&boxHu;":"╧","&boxUL;":"╝","&boxUR;":"╚","&boxUl;":"╜","&boxUr;":"╙","&boxV;":"║","&boxVH;":"╬","&boxVL;":"╣","&boxVR;":"╠","&boxVh;":"╫","&boxVl;":"╢","&boxVr;":"╟","&boxbox;":"⧉","&boxdL;":"╕","&boxdR;":"╒","&boxdl;":"┐","&boxdr;":"┌","&boxh;":"─","&boxhD;":"╥","&boxhU;":"╨","&boxhd;":"┬","&boxhu;":"┴","&boxminus;":"⊟","&boxplus;":"⊞","&boxtimes;":"⊠","&boxuL;":"╛","&boxuR;":"╘","&boxul;":"┘","&boxur;":"└","&boxv;":"│","&boxvH;":"╪","&boxvL;":"╡","&boxvR;":"╞","&boxvh;":"┼","&boxvl;":"┤","&boxvr;":"├","&bprime;":"‵","&breve;":"˘","&brvbar":"¦","&brvbar;":"¦","&bscr;":"𝒷","&bsemi;":"⁏","&bsim;":"∽","&bsime;":"⋍","&bsol;":"\\","&bsolb;":"⧅","&bsolhsub;":"⟈","&bull;":"•","&bullet;":"•","&bump;":"≎","&bumpE;":"⪮","&bumpe;":"≏","&bumpeq;":"≏","&cacute;":"ć","&cap;":"∩","&capand;":"⩄","&capbrcup;":"⩉","&capcap;":"⩋","&capcup;":"⩇","&capdot;":"⩀","&caps;":"∩︀","&caret;":"⁁","&caron;":"ˇ","&ccaps;":"⩍","&ccaron;":"č","&ccedil":"ç","&ccedil;":"ç","&ccirc;":"ĉ","&ccups;":"⩌","&ccupssm;":"⩐","&cdot;":"ċ","&cedil":"¸","&cedil;":"¸","&cemptyv;":"⦲","&cent":"¢","&cent;":"¢","&centerdot;":"·","&cfr;":"𝔠","&chcy;":"ч","&check;":"✓","&checkmark;":"✓","&chi;":"χ","&cir;":"○","&cirE;":"⧃","&circ;":"ˆ","&circeq;":"≗","&circlearrowleft;":"↺","&circlearrowright;":"↻","&circledR;":"®","&circledS;":"Ⓢ","&circledast;":"⊛","&circledcirc;":"⊚","&circleddash;":"⊝","&cire;":"≗","&cirfnint;":"⨐","&cirmid;":"⫯","&cirscir;":"⧂","&clubs;":"♣","&clubsuit;":"♣","&colon;":":","&colone;":"≔","&coloneq;":"≔","&comma;":",","&commat;":"@","&comp;":"∁","&compfn;":"∘","&complement;":"∁","&complexes;":"ℂ","&cong;":"≅","&congdot;":"⩭","&conint;":"∮","&copf;":"𝕔","&coprod;":"∐","&copy":"©","&copy;":"©","&copysr;":"℗","&crarr;":"↵","&cross;":"✗","&cscr;":"𝒸","&csub;":"⫏","&csube;":"⫑","&csup;":"⫐","&csupe;":"⫒","&ctdot;":"⋯","&cudarrl;":"⤸","&cudarrr;":"⤵","&cuepr;":"⋞","&cuesc;":"⋟","&cularr;":"↶","&cularrp;":"⤽","&cup;":"∪","&cupbrcap;":"⩈","&cupcap;":"⩆","&cupcup;":"⩊","&cupdot;":"⊍","&cupor;":"⩅","&cups;":"∪︀","&curarr;":"↷","&curarrm;":"⤼","&curlyeqprec;":"⋞","&curlyeqsucc;":"⋟","&curlyvee;":"⋎","&curlywedge;":"⋏","&curren":"¤","&curren;":"¤","&curvearrowleft;":"↶","&curvearrowright;":"↷","&cuvee;":"⋎","&cuwed;":"⋏","&cwconint;":"∲","&cwint;":"∱","&cylcty;":"⌭","&dArr;":"⇓","&dHar;":"⥥","&dagger;":"†","&daleth;":"ℸ","&darr;":"↓","&dash;":"‐","&dashv;":"⊣","&dbkarow;":"⤏","&dblac;":"˝","&dcaron;":"ď","&dcy;":"д","&dd;":"ⅆ","&ddagger;":"‡","&ddarr;":"⇊","&ddotseq;":"⩷","&deg":"°","&deg;":"°","&delta;":"δ","&demptyv;":"⦱","&dfisht;":"⥿","&dfr;":"𝔡","&dharl;":"⇃","&dharr;":"⇂","&diam;":"⋄","&diamond;":"⋄","&diamondsuit;":"♦","&diams;":"♦","&die;":"¨","&digamma;":"ϝ","&disin;":"⋲","&div;":"÷","&divide":"÷","&divide;":"÷","&divideontimes;":"⋇","&divonx;":"⋇","&djcy;":"ђ","&dlcorn;":"⌞","&dlcrop;":"⌍","&dollar;":"$","&dopf;":"𝕕","&dot;":"˙","&doteq;":"≐","&doteqdot;":"≑","&dotminus;":"∸","&dotplus;":"∔","&dotsquare;":"⊡","&doublebarwedge;":"⌆","&downarrow;":"↓","&downdownarrows;":"⇊","&downharpoonleft;":"⇃","&downharpoonright;":"⇂","&drbkarow;":"⤐","&drcorn;":"⌟","&drcrop;":"⌌","&dscr;":"𝒹","&dscy;":"ѕ","&dsol;":"⧶","&dstrok;":"đ","&dtdot;":"⋱","&dtri;":"▿","&dtrif;":"▾","&duarr;":"⇵","&duhar;":"⥯","&dwangle;":"⦦","&dzcy;":"џ","&dzigrarr;":"⟿","&eDDot;":"⩷","&eDot;":"≑","&eacute":"é","&eacute;":"é","&easter;":"⩮","&ecaron;":"ě","&ecir;":"≖","&ecirc":"ê","&ecirc;":"ê","&ecolon;":"≕","&ecy;":"э","&edot;":"ė","&ee;":"ⅇ","&efDot;":"≒","&efr;":"𝔢","&eg;":"⪚","&egrave":"è","&egrave;":"è","&egs;":"⪖","&egsdot;":"⪘","&el;":"⪙","&elinters;":"⏧","&ell;":"ℓ","&els;":"⪕","&elsdot;":"⪗","&emacr;":"ē","&empty;":"∅","&emptyset;":"∅","&emptyv;":"∅","&emsp13;":" ","&emsp14;":" ","&emsp;":" ","&eng;":"ŋ","&ensp;":" ","&eogon;":"ę","&eopf;":"𝕖","&epar;":"⋕","&eparsl;":"⧣","&eplus;":"⩱","&epsi;":"ε","&epsilon;":"ε","&epsiv;":"ϵ","&eqcirc;":"≖","&eqcolon;":"≕","&eqsim;":"≂","&eqslantgtr;":"⪖","&eqslantless;":"⪕","&equals;":"=","&equest;":"≟","&equiv;":"≡","&equivDD;":"⩸","&eqvparsl;":"⧥","&erDot;":"≓","&erarr;":"⥱","&escr;":"ℯ","&esdot;":"≐","&esim;":"≂","&eta;":"η","&eth":"ð","&eth;":"ð","&euml":"ë","&euml;":"ë","&euro;":"€","&excl;":"!","&exist;":"∃","&expectation;":"ℰ","&exponentiale;":"ⅇ","&fallingdotseq;":"≒","&fcy;":"ф","&female;":"♀","&ffilig;":"ffi","&fflig;":"ff","&ffllig;":"ffl","&ffr;":"𝔣","&filig;":"fi","&fjlig;":"fj","&flat;":"♭","&fllig;":"fl","&fltns;":"▱","&fnof;":"ƒ","&fopf;":"𝕗","&forall;":"∀","&fork;":"⋔","&forkv;":"⫙","&fpartint;":"⨍","&frac12":"½","&frac12;":"½","&frac13;":"⅓","&frac14":"¼","&frac14;":"¼","&frac15;":"⅕","&frac16;":"⅙","&frac18;":"⅛","&frac23;":"⅔","&frac25;":"⅖","&frac34":"¾","&frac34;":"¾","&frac35;":"⅗","&frac38;":"⅜","&frac45;":"⅘","&frac56;":"⅚","&frac58;":"⅝","&frac78;":"⅞","&frasl;":"⁄","&frown;":"⌢","&fscr;":"𝒻","&gE;":"≧","&gEl;":"⪌","&gacute;":"ǵ","&gamma;":"γ","&gammad;":"ϝ","&gap;":"⪆","&gbreve;":"ğ","&gcirc;":"ĝ","&gcy;":"г","&gdot;":"ġ","&ge;":"≥","&gel;":"⋛","&geq;":"≥","&geqq;":"≧","&geqslant;":"⩾","&ges;":"⩾","&gescc;":"⪩","&gesdot;":"⪀","&gesdoto;":"⪂","&gesdotol;":"⪄","&gesl;":"⋛︀","&gesles;":"⪔","&gfr;":"𝔤","&gg;":"≫","&ggg;":"⋙","&gimel;":"ℷ","&gjcy;":"ѓ","&gl;":"≷","&glE;":"⪒","&gla;":"⪥","&glj;":"⪤","&gnE;":"≩","&gnap;":"⪊","&gnapprox;":"⪊","&gne;":"⪈","&gneq;":"⪈","&gneqq;":"≩","&gnsim;":"⋧","&gopf;":"𝕘","&grave;":"`","&gscr;":"ℊ","&gsim;":"≳","&gsime;":"⪎","&gsiml;":"⪐","&gt":">","&gt;":">","&gtcc;":"⪧","&gtcir;":"⩺","&gtdot;":"⋗","&gtlPar;":"⦕","&gtquest;":"⩼","&gtrapprox;":"⪆","&gtrarr;":"⥸","&gtrdot;":"⋗","&gtreqless;":"⋛","&gtreqqless;":"⪌","&gtrless;":"≷","&gtrsim;":"≳","&gvertneqq;":"≩︀","&gvnE;":"≩︀","&hArr;":"⇔","&hairsp;":" ","&half;":"½","&hamilt;":"ℋ","&hardcy;":"ъ","&harr;":"↔","&harrcir;":"⥈","&harrw;":"↭","&hbar;":"ℏ","&hcirc;":"ĥ","&hearts;":"♥","&heartsuit;":"♥","&hellip;":"…","&hercon;":"⊹","&hfr;":"𝔥","&hksearow;":"⤥","&hkswarow;":"⤦","&hoarr;":"⇿","&homtht;":"∻","&hookleftarrow;":"↩","&hookrightarrow;":"↪","&hopf;":"𝕙","&horbar;":"―","&hscr;":"𝒽","&hslash;":"ℏ","&hstrok;":"ħ","&hybull;":"⁃","&hyphen;":"‐","&iacute":"í","&iacute;":"í","&ic;":"⁣","&icirc":"î","&icirc;":"î","&icy;":"и","&iecy;":"е","&iexcl":"¡","&iexcl;":"¡","&iff;":"⇔","&ifr;":"𝔦","&igrave":"ì","&igrave;":"ì","&ii;":"ⅈ","&iiiint;":"⨌","&iiint;":"∭","&iinfin;":"⧜","&iiota;":"℩","&ijlig;":"ij","&imacr;":"ī","&image;":"ℑ","&imagline;":"ℐ","&imagpart;":"ℑ","&imath;":"ı","&imof;":"⊷","&imped;":"Ƶ","&in;":"∈","&incare;":"℅","&infin;":"∞","&infintie;":"⧝","&inodot;":"ı","&int;":"∫","&intcal;":"⊺","&integers;":"ℤ","&intercal;":"⊺","&intlarhk;":"⨗","&intprod;":"⨼","&iocy;":"ё","&iogon;":"į","&iopf;":"𝕚","&iota;":"ι","&iprod;":"⨼","&iquest":"¿","&iquest;":"¿","&iscr;":"𝒾","&isin;":"∈","&isinE;":"⋹","&isindot;":"⋵","&isins;":"⋴","&isinsv;":"⋳","&isinv;":"∈","&it;":"⁢","&itilde;":"ĩ","&iukcy;":"і","&iuml":"ï","&iuml;":"ï","&jcirc;":"ĵ","&jcy;":"й","&jfr;":"𝔧","&jmath;":"ȷ","&jopf;":"𝕛","&jscr;":"𝒿","&jsercy;":"ј","&jukcy;":"є","&kappa;":"κ","&kappav;":"ϰ","&kcedil;":"ķ","&kcy;":"к","&kfr;":"𝔨","&kgreen;":"ĸ","&khcy;":"х","&kjcy;":"ќ","&kopf;":"𝕜","&kscr;":"𝓀","&lAarr;":"⇚","&lArr;":"⇐","&lAtail;":"⤛","&lBarr;":"⤎","&lE;":"≦","&lEg;":"⪋","&lHar;":"⥢","&lacute;":"ĺ","&laemptyv;":"⦴","&lagran;":"ℒ","&lambda;":"λ","&lang;":"⟨","&langd;":"⦑","&langle;":"⟨","&lap;":"⪅","&laquo":"«","&laquo;":"«","&larr;":"←","&larrb;":"⇤","&larrbfs;":"⤟","&larrfs;":"⤝","&larrhk;":"↩","&larrlp;":"↫","&larrpl;":"⤹","&larrsim;":"⥳","&larrtl;":"↢","&lat;":"⪫","&latail;":"⤙","&late;":"⪭","&lates;":"⪭︀","&lbarr;":"⤌","&lbbrk;":"❲","&lbrace;":"{","&lbrack;":"[","&lbrke;":"⦋","&lbrksld;":"⦏","&lbrkslu;":"⦍","&lcaron;":"ľ","&lcedil;":"ļ","&lceil;":"⌈","&lcub;":"{","&lcy;":"л","&ldca;":"⤶","&ldquo;":"“","&ldquor;":"„","&ldrdhar;":"⥧","&ldrushar;":"⥋","&ldsh;":"↲","&le;":"≤","&leftarrow;":"←","&leftarrowtail;":"↢","&leftharpoondown;":"↽","&leftharpoonup;":"↼","&leftleftarrows;":"⇇","&leftrightarrow;":"↔","&leftrightarrows;":"⇆","&leftrightharpoons;":"⇋","&leftrightsquigarrow;":"↭","&leftthreetimes;":"⋋","&leg;":"⋚","&leq;":"≤","&leqq;":"≦","&leqslant;":"⩽","&les;":"⩽","&lescc;":"⪨","&lesdot;":"⩿","&lesdoto;":"⪁","&lesdotor;":"⪃","&lesg;":"⋚︀","&lesges;":"⪓","&lessapprox;":"⪅","&lessdot;":"⋖","&lesseqgtr;":"⋚","&lesseqqgtr;":"⪋","&lessgtr;":"≶","&lesssim;":"≲","&lfisht;":"⥼","&lfloor;":"⌊","&lfr;":"𝔩","&lg;":"≶","&lgE;":"⪑","&lhard;":"↽","&lharu;":"↼","&lharul;":"⥪","&lhblk;":"▄","&ljcy;":"љ","&ll;":"≪","&llarr;":"⇇","&llcorner;":"⌞","&llhard;":"⥫","&lltri;":"◺","&lmidot;":"ŀ","&lmoust;":"⎰","&lmoustache;":"⎰","&lnE;":"≨","&lnap;":"⪉","&lnapprox;":"⪉","&lne;":"⪇","&lneq;":"⪇","&lneqq;":"≨","&lnsim;":"⋦","&loang;":"⟬","&loarr;":"⇽","&lobrk;":"⟦","&longleftarrow;":"⟵","&longleftrightarrow;":"⟷","&longmapsto;":"⟼","&longrightarrow;":"⟶","&looparrowleft;":"↫","&looparrowright;":"↬","&lopar;":"⦅","&lopf;":"𝕝","&loplus;":"⨭","&lotimes;":"⨴","&lowast;":"∗","&lowbar;":"_","&loz;":"◊","&lozenge;":"◊","&lozf;":"⧫","&lpar;":"(","&lparlt;":"⦓","&lrarr;":"⇆","&lrcorner;":"⌟","&lrhar;":"⇋","&lrhard;":"⥭","&lrm;":"‎","&lrtri;":"⊿","&lsaquo;":"‹","&lscr;":"𝓁","&lsh;":"↰","&lsim;":"≲","&lsime;":"⪍","&lsimg;":"⪏","&lsqb;":"[","&lsquo;":"‘","&lsquor;":"‚","&lstrok;":"ł","&lt":"<","&lt;":"<","&ltcc;":"⪦","&ltcir;":"⩹","&ltdot;":"⋖","&lthree;":"⋋","&ltimes;":"⋉","&ltlarr;":"⥶","&ltquest;":"⩻","&ltrPar;":"⦖","&ltri;":"◃","&ltrie;":"⊴","&ltrif;":"◂","&lurdshar;":"⥊","&luruhar;":"⥦","&lvertneqq;":"≨︀","&lvnE;":"≨︀","&mDDot;":"∺","&macr":"¯","&macr;":"¯","&male;":"♂","&malt;":"✠","&maltese;":"✠","&map;":"↦","&mapsto;":"↦","&mapstodown;":"↧","&mapstoleft;":"↤","&mapstoup;":"↥","&marker;":"▮","&mcomma;":"⨩","&mcy;":"м","&mdash;":"—","&measuredangle;":"∡","&mfr;":"𝔪","&mho;":"℧","&micro":"µ","&micro;":"µ","&mid;":"∣","&midast;":"*","&midcir;":"⫰","&middot":"·","&middot;":"·","&minus;":"−","&minusb;":"⊟","&minusd;":"∸","&minusdu;":"⨪","&mlcp;":"⫛","&mldr;":"…","&mnplus;":"∓","&models;":"⊧","&mopf;":"𝕞","&mp;":"∓","&mscr;":"𝓂","&mstpos;":"∾","&mu;":"μ","&multimap;":"⊸","&mumap;":"⊸","&nGg;":"⋙̸","&nGt;":"≫⃒","&nGtv;":"≫̸","&nLeftarrow;":"⇍","&nLeftrightarrow;":"⇎","&nLl;":"⋘̸","&nLt;":"≪⃒","&nLtv;":"≪̸","&nRightarrow;":"⇏","&nVDash;":"⊯","&nVdash;":"⊮","&nabla;":"∇","&nacute;":"ń","&nang;":"∠⃒","&nap;":"≉","&napE;":"⩰̸","&napid;":"≋̸","&napos;":"ʼn","&napprox;":"≉","&natur;":"♮","&natural;":"♮","&naturals;":"ℕ","&nbsp":" ","&nbsp;":" ","&nbump;":"≎̸","&nbumpe;":"≏̸","&ncap;":"⩃","&ncaron;":"ň","&ncedil;":"ņ","&ncong;":"≇","&ncongdot;":"⩭̸","&ncup;":"⩂","&ncy;":"н","&ndash;":"–","&ne;":"≠","&neArr;":"⇗","&nearhk;":"⤤","&nearr;":"↗","&nearrow;":"↗","&nedot;":"≐̸","&nequiv;":"≢","&nesear;":"⤨","&nesim;":"≂̸","&nexist;":"∄","&nexists;":"∄","&nfr;":"𝔫","&ngE;":"≧̸","&nge;":"≱","&ngeq;":"≱","&ngeqq;":"≧̸","&ngeqslant;":"⩾̸","&nges;":"⩾̸","&ngsim;":"≵","&ngt;":"≯","&ngtr;":"≯","&nhArr;":"⇎","&nharr;":"↮","&nhpar;":"⫲","&ni;":"∋","&nis;":"⋼","&nisd;":"⋺","&niv;":"∋","&njcy;":"њ","&nlArr;":"⇍","&nlE;":"≦̸","&nlarr;":"↚","&nldr;":"‥","&nle;":"≰","&nleftarrow;":"↚","&nleftrightarrow;":"↮","&nleq;":"≰","&nleqq;":"≦̸","&nleqslant;":"⩽̸","&nles;":"⩽̸","&nless;":"≮","&nlsim;":"≴","&nlt;":"≮","&nltri;":"⋪","&nltrie;":"⋬","&nmid;":"∤","&nopf;":"𝕟","&not":"¬","&not;":"¬","&notin;":"∉","&notinE;":"⋹̸","&notindot;":"⋵̸","&notinva;":"∉","&notinvb;":"⋷","&notinvc;":"⋶","&notni;":"∌","&notniva;":"∌","&notnivb;":"⋾","&notnivc;":"⋽","&npar;":"∦","&nparallel;":"∦","&nparsl;":"⫽⃥","&npart;":"∂̸","&npolint;":"⨔","&npr;":"⊀","&nprcue;":"⋠","&npre;":"⪯̸","&nprec;":"⊀","&npreceq;":"⪯̸","&nrArr;":"⇏","&nrarr;":"↛","&nrarrc;":"⤳̸","&nrarrw;":"↝̸","&nrightarrow;":"↛","&nrtri;":"⋫","&nrtrie;":"⋭","&nsc;":"⊁","&nsccue;":"⋡","&nsce;":"⪰̸","&nscr;":"𝓃","&nshortmid;":"∤","&nshortparallel;":"∦","&nsim;":"≁","&nsime;":"≄","&nsimeq;":"≄","&nsmid;":"∤","&nspar;":"∦","&nsqsube;":"⋢","&nsqsupe;":"⋣","&nsub;":"⊄","&nsubE;":"⫅̸","&nsube;":"⊈","&nsubset;":"⊂⃒","&nsubseteq;":"⊈","&nsubseteqq;":"⫅̸","&nsucc;":"⊁","&nsucceq;":"⪰̸","&nsup;":"⊅","&nsupE;":"⫆̸","&nsupe;":"⊉","&nsupset;":"⊃⃒","&nsupseteq;":"⊉","&nsupseteqq;":"⫆̸","&ntgl;":"≹","&ntilde":"ñ","&ntilde;":"ñ","&ntlg;":"≸","&ntriangleleft;":"⋪","&ntrianglelefteq;":"⋬","&ntriangleright;":"⋫","&ntrianglerighteq;":"⋭","&nu;":"ν","&num;":"#","&numero;":"№","&numsp;":" ","&nvDash;":"⊭","&nvHarr;":"⤄","&nvap;":"≍⃒","&nvdash;":"⊬","&nvge;":"≥⃒","&nvgt;":">⃒","&nvinfin;":"⧞","&nvlArr;":"⤂","&nvle;":"≤⃒","&nvlt;":"<⃒","&nvltrie;":"⊴⃒","&nvrArr;":"⤃","&nvrtrie;":"⊵⃒","&nvsim;":"∼⃒","&nwArr;":"⇖","&nwarhk;":"⤣","&nwarr;":"↖","&nwarrow;":"↖","&nwnear;":"⤧","&oS;":"Ⓢ","&oacute":"ó","&oacute;":"ó","&oast;":"⊛","&ocir;":"⊚","&ocirc":"ô","&ocirc;":"ô","&ocy;":"о","&odash;":"⊝","&odblac;":"ő","&odiv;":"⨸","&odot;":"⊙","&odsold;":"⦼","&oelig;":"œ","&ofcir;":"⦿","&ofr;":"𝔬","&ogon;":"˛","&ograve":"ò","&ograve;":"ò","&ogt;":"⧁","&ohbar;":"⦵","&ohm;":"Ω","&oint;":"∮","&olarr;":"↺","&olcir;":"⦾","&olcross;":"⦻","&oline;":"‾","&olt;":"⧀","&omacr;":"ō","&omega;":"ω","&omicron;":"ο","&omid;":"⦶","&ominus;":"⊖","&oopf;":"𝕠","&opar;":"⦷","&operp;":"⦹","&oplus;":"⊕","&or;":"∨","&orarr;":"↻","&ord;":"⩝","&order;":"ℴ","&orderof;":"ℴ","&ordf":"ª","&ordf;":"ª","&ordm":"º","&ordm;":"º","&origof;":"⊶","&oror;":"⩖","&orslope;":"⩗","&orv;":"⩛","&oscr;":"ℴ","&oslash":"ø","&oslash;":"ø","&osol;":"⊘","&otilde":"õ","&otilde;":"õ","&otimes;":"⊗","&otimesas;":"⨶","&ouml":"ö","&ouml;":"ö","&ovbar;":"⌽","&par;":"∥","&para":"¶","&para;":"¶","&parallel;":"∥","&parsim;":"⫳","&parsl;":"⫽","&part;":"∂","&pcy;":"п","&percnt;":"%","&period;":".","&permil;":"‰","&perp;":"⊥","&pertenk;":"‱","&pfr;":"𝔭","&phi;":"φ","&phiv;":"ϕ","&phmmat;":"ℳ","&phone;":"☎","&pi;":"π","&pitchfork;":"⋔","&piv;":"ϖ","&planck;":"ℏ","&planckh;":"ℎ","&plankv;":"ℏ","&plus;":"+","&plusacir;":"⨣","&plusb;":"⊞","&pluscir;":"⨢","&plusdo;":"∔","&plusdu;":"⨥","&pluse;":"⩲","&plusmn":"±","&plusmn;":"±","&plussim;":"⨦","&plustwo;":"⨧","&pm;":"±","&pointint;":"⨕","&popf;":"𝕡","&pound":"£","&pound;":"£","&pr;":"≺","&prE;":"⪳","&prap;":"⪷","&prcue;":"≼","&pre;":"⪯","&prec;":"≺","&precapprox;":"⪷","&preccurlyeq;":"≼","&preceq;":"⪯","&precnapprox;":"⪹","&precneqq;":"⪵","&precnsim;":"⋨","&precsim;":"≾","&prime;":"′","&primes;":"ℙ","&prnE;":"⪵","&prnap;":"⪹","&prnsim;":"⋨","&prod;":"∏","&profalar;":"⌮","&profline;":"⌒","&profsurf;":"⌓","&prop;":"∝","&propto;":"∝","&prsim;":"≾","&prurel;":"⊰","&pscr;":"𝓅","&psi;":"ψ","&puncsp;":" ","&qfr;":"𝔮","&qint;":"⨌","&qopf;":"𝕢","&qprime;":"⁗","&qscr;":"𝓆","&quaternions;":"ℍ","&quatint;":"⨖","&quest;":"?","&questeq;":"≟","&quot":'"',"&quot;":'"',"&rAarr;":"⇛","&rArr;":"⇒","&rAtail;":"⤜","&rBarr;":"⤏","&rHar;":"⥤","&race;":"∽̱","&racute;":"ŕ","&radic;":"√","&raemptyv;":"⦳","&rang;":"⟩","&rangd;":"⦒","&range;":"⦥","&rangle;":"⟩","&raquo":"»","&raquo;":"»","&rarr;":"→","&rarrap;":"⥵","&rarrb;":"⇥","&rarrbfs;":"⤠","&rarrc;":"⤳","&rarrfs;":"⤞","&rarrhk;":"↪","&rarrlp;":"↬","&rarrpl;":"⥅","&rarrsim;":"⥴","&rarrtl;":"↣","&rarrw;":"↝","&ratail;":"⤚","&ratio;":"∶","&rationals;":"ℚ","&rbarr;":"⤍","&rbbrk;":"❳","&rbrace;":"}","&rbrack;":"]","&rbrke;":"⦌","&rbrksld;":"⦎","&rbrkslu;":"⦐","&rcaron;":"ř","&rcedil;":"ŗ","&rceil;":"⌉","&rcub;":"}","&rcy;":"р","&rdca;":"⤷","&rdldhar;":"⥩","&rdquo;":"”","&rdquor;":"”","&rdsh;":"↳","&real;":"ℜ","&realine;":"ℛ","&realpart;":"ℜ","&reals;":"ℝ","&rect;":"▭","&reg":"®","&reg;":"®","&rfisht;":"⥽","&rfloor;":"⌋","&rfr;":"𝔯","&rhard;":"⇁","&rharu;":"⇀","&rharul;":"⥬","&rho;":"ρ","&rhov;":"ϱ","&rightarrow;":"→","&rightarrowtail;":"↣","&rightharpoondown;":"⇁","&rightharpoonup;":"⇀","&rightleftarrows;":"⇄","&rightleftharpoons;":"⇌","&rightrightarrows;":"⇉","&rightsquigarrow;":"↝","&rightthreetimes;":"⋌","&ring;":"˚","&risingdotseq;":"≓","&rlarr;":"⇄","&rlhar;":"⇌","&rlm;":"‏","&rmoust;":"⎱","&rmoustache;":"⎱","&rnmid;":"⫮","&roang;":"⟭","&roarr;":"⇾","&robrk;":"⟧","&ropar;":"⦆","&ropf;":"𝕣","&roplus;":"⨮","&rotimes;":"⨵","&rpar;":")","&rpargt;":"⦔","&rppolint;":"⨒","&rrarr;":"⇉","&rsaquo;":"›","&rscr;":"𝓇","&rsh;":"↱","&rsqb;":"]","&rsquo;":"’","&rsquor;":"’","&rthree;":"⋌","&rtimes;":"⋊","&rtri;":"▹","&rtrie;":"⊵","&rtrif;":"▸","&rtriltri;":"⧎","&ruluhar;":"⥨","&rx;":"℞","&sacute;":"ś","&sbquo;":"‚","&sc;":"≻","&scE;":"⪴","&scap;":"⪸","&scaron;":"š","&sccue;":"≽","&sce;":"⪰","&scedil;":"ş","&scirc;":"ŝ","&scnE;":"⪶","&scnap;":"⪺","&scnsim;":"⋩","&scpolint;":"⨓","&scsim;":"≿","&scy;":"с","&sdot;":"⋅","&sdotb;":"⊡","&sdote;":"⩦","&seArr;":"⇘","&searhk;":"⤥","&searr;":"↘","&searrow;":"↘","&sect":"§","&sect;":"§","&semi;":";","&seswar;":"⤩","&setminus;":"∖","&setmn;":"∖","&sext;":"✶","&sfr;":"𝔰","&sfrown;":"⌢","&sharp;":"♯","&shchcy;":"щ","&shcy;":"ш","&shortmid;":"∣","&shortparallel;":"∥","&shy":"­","&shy;":"­","&sigma;":"σ","&sigmaf;":"ς","&sigmav;":"ς","&sim;":"∼","&simdot;":"⩪","&sime;":"≃","&simeq;":"≃","&simg;":"⪞","&simgE;":"⪠","&siml;":"⪝","&simlE;":"⪟","&simne;":"≆","&simplus;":"⨤","&simrarr;":"⥲","&slarr;":"←","&smallsetminus;":"∖","&smashp;":"⨳","&smeparsl;":"⧤","&smid;":"∣","&smile;":"⌣","&smt;":"⪪","&smte;":"⪬","&smtes;":"⪬︀","&softcy;":"ь","&sol;":"/","&solb;":"⧄","&solbar;":"⌿","&sopf;":"𝕤","&spades;":"♠","&spadesuit;":"♠","&spar;":"∥","&sqcap;":"⊓","&sqcaps;":"⊓︀","&sqcup;":"⊔","&sqcups;":"⊔︀","&sqsub;":"⊏","&sqsube;":"⊑","&sqsubset;":"⊏","&sqsubseteq;":"⊑","&sqsup;":"⊐","&sqsupe;":"⊒","&sqsupset;":"⊐","&sqsupseteq;":"⊒","&squ;":"□","&square;":"□","&squarf;":"▪","&squf;":"▪","&srarr;":"→","&sscr;":"𝓈","&ssetmn;":"∖","&ssmile;":"⌣","&sstarf;":"⋆","&star;":"☆","&starf;":"★","&straightepsilon;":"ϵ","&straightphi;":"ϕ","&strns;":"¯","&sub;":"⊂","&subE;":"⫅","&subdot;":"⪽","&sube;":"⊆","&subedot;":"⫃","&submult;":"⫁","&subnE;":"⫋","&subne;":"⊊","&subplus;":"⪿","&subrarr;":"⥹","&subset;":"⊂","&subseteq;":"⊆","&subseteqq;":"⫅","&subsetneq;":"⊊","&subsetneqq;":"⫋","&subsim;":"⫇","&subsub;":"⫕","&subsup;":"⫓","&succ;":"≻","&succapprox;":"⪸","&succcurlyeq;":"≽","&succeq;":"⪰","&succnapprox;":"⪺","&succneqq;":"⪶","&succnsim;":"⋩","&succsim;":"≿","&sum;":"∑","&sung;":"♪","&sup1":"¹","&sup1;":"¹","&sup2":"²","&sup2;":"²","&sup3":"³","&sup3;":"³","&sup;":"⊃","&supE;":"⫆","&supdot;":"⪾","&supdsub;":"⫘","&supe;":"⊇","&supedot;":"⫄","&suphsol;":"⟉","&suphsub;":"⫗","&suplarr;":"⥻","&supmult;":"⫂","&supnE;":"⫌","&supne;":"⊋","&supplus;":"⫀","&supset;":"⊃","&supseteq;":"⊇","&supseteqq;":"⫆","&supsetneq;":"⊋","&supsetneqq;":"⫌","&supsim;":"⫈","&supsub;":"⫔","&supsup;":"⫖","&swArr;":"⇙","&swarhk;":"⤦","&swarr;":"↙","&swarrow;":"↙","&swnwar;":"⤪","&szlig":"ß","&szlig;":"ß","&target;":"⌖","&tau;":"τ","&tbrk;":"⎴","&tcaron;":"ť","&tcedil;":"ţ","&tcy;":"т","&tdot;":"⃛","&telrec;":"⌕","&tfr;":"𝔱","&there4;":"∴","&therefore;":"∴","&theta;":"θ","&thetasym;":"ϑ","&thetav;":"ϑ","&thickapprox;":"≈","&thicksim;":"∼","&thinsp;":" ","&thkap;":"≈","&thksim;":"∼","&thorn":"þ","&thorn;":"þ","&tilde;":"˜","&times":"×","&times;":"×","&timesb;":"⊠","&timesbar;":"⨱","&timesd;":"⨰","&tint;":"∭","&toea;":"⤨","&top;":"⊤","&topbot;":"⌶","&topcir;":"⫱","&topf;":"𝕥","&topfork;":"⫚","&tosa;":"⤩","&tprime;":"‴","&trade;":"™","&triangle;":"▵","&triangledown;":"▿","&triangleleft;":"◃","&trianglelefteq;":"⊴","&triangleq;":"≜","&triangleright;":"▹","&trianglerighteq;":"⊵","&tridot;":"◬","&trie;":"≜","&triminus;":"⨺","&triplus;":"⨹","&trisb;":"⧍","&tritime;":"⨻","&trpezium;":"⏢","&tscr;":"𝓉","&tscy;":"ц","&tshcy;":"ћ","&tstrok;":"ŧ","&twixt;":"≬","&twoheadleftarrow;":"↞","&twoheadrightarrow;":"↠","&uArr;":"⇑","&uHar;":"⥣","&uacute":"ú","&uacute;":"ú","&uarr;":"↑","&ubrcy;":"ў","&ubreve;":"ŭ","&ucirc":"û","&ucirc;":"û","&ucy;":"у","&udarr;":"⇅","&udblac;":"ű","&udhar;":"⥮","&ufisht;":"⥾","&ufr;":"𝔲","&ugrave":"ù","&ugrave;":"ù","&uharl;":"↿","&uharr;":"↾","&uhblk;":"▀","&ulcorn;":"⌜","&ulcorner;":"⌜","&ulcrop;":"⌏","&ultri;":"◸","&umacr;":"ū","&uml":"¨","&uml;":"¨","&uogon;":"ų","&uopf;":"𝕦","&uparrow;":"↑","&updownarrow;":"↕","&upharpoonleft;":"↿","&upharpoonright;":"↾","&uplus;":"⊎","&upsi;":"υ","&upsih;":"ϒ","&upsilon;":"υ","&upuparrows;":"⇈","&urcorn;":"⌝","&urcorner;":"⌝","&urcrop;":"⌎","&uring;":"ů","&urtri;":"◹","&uscr;":"𝓊","&utdot;":"⋰","&utilde;":"ũ","&utri;":"▵","&utrif;":"▴","&uuarr;":"⇈","&uuml":"ü","&uuml;":"ü","&uwangle;":"⦧","&vArr;":"⇕","&vBar;":"⫨","&vBarv;":"⫩","&vDash;":"⊨","&vangrt;":"⦜","&varepsilon;":"ϵ","&varkappa;":"ϰ","&varnothing;":"∅","&varphi;":"ϕ","&varpi;":"ϖ","&varpropto;":"∝","&varr;":"↕","&varrho;":"ϱ","&varsigma;":"ς","&varsubsetneq;":"⊊︀","&varsubsetneqq;":"⫋︀","&varsupsetneq;":"⊋︀","&varsupsetneqq;":"⫌︀","&vartheta;":"ϑ","&vartriangleleft;":"⊲","&vartriangleright;":"⊳","&vcy;":"в","&vdash;":"⊢","&vee;":"∨","&veebar;":"⊻","&veeeq;":"≚","&vellip;":"⋮","&verbar;":"|","&vert;":"|","&vfr;":"𝔳","&vltri;":"⊲","&vnsub;":"⊂⃒","&vnsup;":"⊃⃒","&vopf;":"𝕧","&vprop;":"∝","&vrtri;":"⊳","&vscr;":"𝓋","&vsubnE;":"⫋︀","&vsubne;":"⊊︀","&vsupnE;":"⫌︀","&vsupne;":"⊋︀","&vzigzag;":"⦚","&wcirc;":"ŵ","&wedbar;":"⩟","&wedge;":"∧","&wedgeq;":"≙","&weierp;":"℘","&wfr;":"𝔴","&wopf;":"𝕨","&wp;":"℘","&wr;":"≀","&wreath;":"≀","&wscr;":"𝓌","&xcap;":"⋂","&xcirc;":"◯","&xcup;":"⋃","&xdtri;":"▽","&xfr;":"𝔵","&xhArr;":"⟺","&xharr;":"⟷","&xi;":"ξ","&xlArr;":"⟸","&xlarr;":"⟵","&xmap;":"⟼","&xnis;":"⋻","&xodot;":"⨀","&xopf;":"𝕩","&xoplus;":"⨁","&xotime;":"⨂","&xrArr;":"⟹","&xrarr;":"⟶","&xscr;":"𝓍","&xsqcup;":"⨆","&xuplus;":"⨄","&xutri;":"△","&xvee;":"⋁","&xwedge;":"⋀","&yacute":"ý","&yacute;":"ý","&yacy;":"я","&ycirc;":"ŷ","&ycy;":"ы","&yen":"¥","&yen;":"¥","&yfr;":"𝔶","&yicy;":"ї","&yopf;":"𝕪","&yscr;":"𝓎","&yucy;":"ю","&yuml":"ÿ","&yuml;":"ÿ","&zacute;":"ź","&zcaron;":"ž","&zcy;":"з","&zdot;":"ż","&zeetrf;":"ℨ","&zeta;":"ζ","&zfr;":"𝔷","&zhcy;":"ж","&zigrarr;":"⇝","&zopf;":"𝕫","&zscr;":"𝓏","&zwj;":"‍","&zwnj;":"‌"};function Xa(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof Gi[e]=="string")return Gi[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;t.charAt(1)==="x"?n=parseInt(t.substr(2),16):n=parseInt(t.substr(1),10);var s="";return n>=55296&&n<=57343||n>1114111?"�":(n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}function ur(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}function Za(r){return"<div>"+ur(r).replace(/\n/g,"<br />")+"</div>"}function eu(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
7
7
  `).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
8
8
 
9
9
  `).replace(/<script\b[^>]*>.*?<\/script\b[^>]*>/gi," ").replace(/^.*<body\b[^>]*>/i,"").replace(/^.*<\/head\b[^>]*>/i,"").replace(/^.*<\!doctype\b[^>]*>/i,"").replace(/<\/body\b[^>]*>.*$/i,"").replace(/<\/html\b[^>]*>.*$/i,"").replace(/<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi," ($1) ").replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,"").replace(/<li\b[^>]*>[\n\u0001\s]*/gi,"* ").replace(/<hr\b[^>]*>/g,`
@@ -13,19 +13,19 @@
13
13
 
14
14
  `).replace(/^\n+/,`
15
15
  `).replace(/\n+$/,`
16
- `),r=Ja(r),r}function ll(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function Ds(r){let e=[],t=(n,s)=>{if(s&&e.push(", "),n.group){let o=`${n.name}:`,i=";";e.push(o),n.group.forEach(t),e.push(i)}else e.push(ll(n))};return r.forEach(t),e.join("")}function al(r){return`<a href="mailto:${ar(r.address)}" class="postal-email-address">${ar(r.name||`<${r.address}>`)}</a>`}function Ss(r){let e=[],t=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let o=`<span class="postal-email-address-group">${ar(n.name)}:</span>`,i='<span class="postal-email-address-group">;</span>';e.push(o),n.group.forEach(t),e.push(i)}else e.push(al(n))};return r.forEach(t),e.join(" ")}function Xa(r,e,t){r=(r||"").toString(),e=e||76;let n=0,s=r.length,o="",i,l;for(;n<s;){if(i=r.substr(n,e),i.length<e){o+=i;break}if(l=i.match(/^[^\n\r]*(\r?\n|\r)/)){i=l[0],o+=i,n+=i.length;continue}else(l=i.match(/(\s+)[^\s]*$/))&&l[0].length-(l[1]||"").length<i.length?i=i.substr(0,i.length-(l[0].length-(l[1]||"").length)):(l=r.substr(n+i.length).match(/^[^\s]+(\s*)/))&&(i=i+l[0].substr(0,l[0].length-0));o+=i,n+=i.length,n<s&&(o+=`\r
17
- `)}return o}function Gi(r){let e=[];if(r.from&&e.push({key:"From",val:ll(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let i={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},l=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",i).format(new Date(r.date));e.push({key:"Date",val:l})}r.to&&r.to.length&&e.push({key:"To",val:Ds(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:Ds(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:Ds(r.bcc)});let t=e.map(i=>i.key.length).reduce((i,l)=>l>i?l:i,0);e=e.flatMap(i=>{let l=t-i.key.length,a=`${i.key}: ${" ".repeat(l)}`,u=`${" ".repeat(i.key.length+1)} ${" ".repeat(l)}`;return Xa(i.val,80).split(/\r?\n/).map(d=>d.trim()).map((d,f)=>`${f?u:a}${d}`)});let n=e.map(i=>i.length).reduce((i,l)=>l>i?l:i,0),s="-".repeat(n);return`
16
+ `),r=Xa(r),r}function al(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function Ss(r){let e=[],t=(n,s)=>{if(s&&e.push(", "),n.group){let o=`${n.name}:`,i=";";e.push(o),n.group.forEach(t),e.push(i)}else e.push(al(n))};return r.forEach(t),e.join("")}function ul(r){return`<a href="mailto:${ur(r.address)}" class="postal-email-address">${ur(r.name||`<${r.address}>`)}</a>`}function Es(r){let e=[],t=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let o=`<span class="postal-email-address-group">${ur(n.name)}:</span>`,i='<span class="postal-email-address-group">;</span>';e.push(o),n.group.forEach(t),e.push(i)}else e.push(ul(n))};return r.forEach(t),e.join(" ")}function tu(r,e,t){r=(r||"").toString(),e=e||76;let n=0,s=r.length,o="",i,l;for(;n<s;){if(i=r.substr(n,e),i.length<e){o+=i;break}if(l=i.match(/^[^\n\r]*(\r?\n|\r)/)){i=l[0],o+=i,n+=i.length;continue}else(l=i.match(/(\s+)[^\s]*$/))&&l[0].length-(l[1]||"").length<i.length?i=i.substr(0,i.length-(l[0].length-(l[1]||"").length)):(l=r.substr(n+i.length).match(/^[^\s]+(\s*)/))&&(i=i+l[0].substr(0,l[0].length-0));o+=i,n+=i.length,n<s&&(o+=`\r
17
+ `)}return o}function Ki(r){let e=[];if(r.from&&e.push({key:"From",val:al(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let i={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},l=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",i).format(new Date(r.date));e.push({key:"Date",val:l})}r.to&&r.to.length&&e.push({key:"To",val:Ss(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:Ss(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:Ss(r.bcc)});let t=e.map(i=>i.key.length).reduce((i,l)=>l>i?l:i,0);e=e.flatMap(i=>{let l=t-i.key.length,a=`${i.key}: ${" ".repeat(l)}`,u=`${" ".repeat(i.key.length+1)} ${" ".repeat(l)}`;return tu(i.val,80).split(/\r?\n/).map(d=>d.trim()).map((d,f)=>`${f?u:a}${d}`)});let n=e.map(i=>i.length).reduce((i,l)=>l>i?l:i,0),s="-".repeat(n);return`
18
18
  ${s}
19
19
  ${e.join(`
20
20
  `)}
21
21
  ${s}
22
- `}function Ki(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${al(r.from)}</div>`),r.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${ar(r.subject)}</div>`),r.date){let n={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},s=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",n).format(new Date(r.date));e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${ar(r.date)}">${ar(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Ss(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Ss(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Ss(r.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
23
- <div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function Za(r,e){let t=!1,n="text",s,o=[],i={address:[],comment:[],group:[],text:[],textWasQuoted:[]},l,a,u=!1;for(l=0,a=r.length;l<a;l++){let c=r[l],d=l?r[l-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",u=!1;break;case"(":n="comment",u=!1;break;case":":n="group",t=!0,u=!1;break;case'"':u=!u,n="text";break;default:n="text",u=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),d&&d.noBreak&&i[n].length?(i[n][i[n].length-1]+=c.value,n==="text"&&u&&(i.textWasQuoted[i.textWasQuoted.length-1]=!0)):(i[n].push(c.value),n==="text"&&i.textWasQuoted.push(u)))}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),t){i.text=i.text.join(" ");let c=[];i.group.length&&Xr(i.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),o.push({name:Yr(i.text||s&&s.name),group:c})}else{if(!i.address.length&&i.text.length){for(l=i.text.length-1;l>=0;l--)if(!i.textWasQuoted[l]&&i.text[l].match(/^[^@\s]+@[^@\s]+$/)){i.address=i.text.splice(l,1),i.textWasQuoted.splice(l,1);break}let c=function(d){return i.address.length?d:(i.address=[d.trim()]," ")};if(!i.address.length)for(l=i.text.length-1;l>=0&&!(!i.textWasQuoted[l]&&(i.text[l]=i.text[l].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),i.address.length));l--);}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),i.address.length>1&&(i.text=i.text.concat(i.address.splice(1))),i.text=i.text.join(" "),i.address=i.address.join(" "),!i.address&&/^=\?[^=]+?=$/.test(i.text.trim())){const c=Xr(Yr(i.text));if(c&&c.length)return c}if(!i.address&&t)return[];s={address:i.address||i.text||"",name:Yr(i.text||i.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),o.push(s)}return o}class eu{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let t=0,n=this.str.length;t<n;t++){let s=this.str.charAt(t),o=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,o)}return this.list.forEach(t=>{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},t&&![" "," ","\r",`
22
+ `}function Vi(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${ul(r.from)}</div>`),r.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${ur(r.subject)}</div>`),r.date){let n={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},s=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",n).format(new Date(r.date));e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${ur(r.date)}">${ur(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Es(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Es(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Es(r.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
23
+ <div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function ru(r,e){let t=!1,n="text",s,o=[],i={address:[],comment:[],group:[],text:[],textWasQuoted:[]},l,a,u=!1;for(l=0,a=r.length;l<a;l++){let c=r[l],d=l?r[l-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",u=!1;break;case"(":n="comment",u=!1;break;case":":n="group",t=!0,u=!1;break;case'"':u=!u,n="text";break;default:n="text",u=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),d&&d.noBreak&&i[n].length?(i[n][i[n].length-1]+=c.value,n==="text"&&u&&(i.textWasQuoted[i.textWasQuoted.length-1]=!0)):(i[n].push(c.value),n==="text"&&i.textWasQuoted.push(u)))}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),t){i.text=i.text.join(" ");let c=[];i.group.length&&Xr(i.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),o.push({name:Yr(i.text||s&&s.name),group:c})}else{if(!i.address.length&&i.text.length){for(l=i.text.length-1;l>=0;l--)if(!i.textWasQuoted[l]&&i.text[l].match(/^[^@\s]+@[^@\s]+$/)){i.address=i.text.splice(l,1),i.textWasQuoted.splice(l,1);break}let c=function(d){return i.address.length?d:(i.address=[d.trim()]," ")};if(!i.address.length)for(l=i.text.length-1;l>=0&&!(!i.textWasQuoted[l]&&(i.text[l]=i.text[l].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),i.address.length));l--);}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),i.address.length>1&&(i.text=i.text.concat(i.address.splice(1))),i.text=i.text.join(" "),i.address=i.address.join(" "),!i.address&&/^=\?[^=]+?=$/.test(i.text.trim())){const c=Xr(Yr(i.text));if(c&&c.length)return c}if(!i.address&&t)return[];s={address:i.address||i.text||"",name:Yr(i.text||i.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),o.push(s)}return o}class nu{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let t=0,n=this.str.length;t<n;t++){let s=this.str.charAt(t),o=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,o)}return this.list.forEach(t=>{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},t&&![" "," ","\r",`
24
24
  `,",",";"].includes(t)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&e in this.operators){this.node={type:"operator",value:e},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[e],this.escaped=!1;return}else if(['"',"'"].includes(this.operatorExpecting)&&e==="\\"){this.escaped=!0;return}}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),e===`
25
- `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const tu=50;function Xr(r,e){e=e||{};let t=e._depth||0;if(t>tu)return[];let s=new eu(r).tokenize(),o=[],i=[],l=[];if(s.forEach(a=>{a.type==="operator"&&(a.value===","||a.value===";")?(i.length&&o.push(i),i=[]):i.push(a)}),i.length&&o.push(i),o.forEach(a=>{a=Za(a,t),a.length&&(l=l.concat(a))}),e.flatten){let a=[],u=c=>{c.forEach(d=>{if(d.group)return u(d.group);a.push(d)})};return u(l),a}return l}function ru(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,o=s%3,i=s-o,l,a,u,c,d,f=0;f<i;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],l=(d&16515072)>>18,a=(d&258048)>>12,u=(d&4032)>>6,c=d&63,e+=t[l]+t[a]+t[u]+t[c];return o==1?(d=n[i],l=(d&252)>>2,a=(d&3)<<4,e+=t[l]+t[a]+"=="):o==2&&(d=n[i]<<8|n[i+1],l=(d&64512)>>10,a=(d&1008)>>4,u=(d&15)<<2,e+=t[l]+t[a]+t[u]+"="),e}const nu=256,su=2*1024*1024;class Mn{static parse(e,t){return new Mn(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||nu,maxHeadersSize:this.options.maxHeadersSize||su},this.root=this.currentNode=new Ui({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let n=this.boundaries;if(n.length&&e.length>2&&e[0]===45&&e[1]===45)for(let s=n.length-1;s>=0;s--){let o=n[s];if(e.length!==o.value.length+2&&e.length!==o.value.length+4)continue;let i=e.length===o.value.length+4;if(i&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let l=!0;for(let a=0;a<o.value.length;a++)if(e[a+2]!==o.value[a]){l=!1;break}if(l)return i?(await o.node.finalize(),this.currentNode=o.node.parentNode||this.root):(await o.node.finalizeChildNodes(),this.currentNode=new Ui({postalMime:this,parentNode:o.node,...this.mimeOptions})),t?this.finalize():void 0}if(this.currentNode.feed(e),t)return this.finalize()}readLine(){let e=this.readPos,t=this.readPos,n=()=>({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length});for(;this.readPos<this.av.length;){const s=this.av[this.readPos++];if(s!==13&&s!==10&&(t=this.readPos),s===10)return n()}return n()}async processNodeTree(){let e={},t=new Set,n=this.textMap=new Map,s=this.forceRfc822Attachments(),o=async(i,l,a)=>{if(l=l||!1,a=a||!1,i.contentType.multipart)i.contentType.multipart==="alternative"?l=i:i.contentType.multipart==="related"&&(a=i);else if(this.isInlineMessageRfc822(i)&&!s){const u=new Mn;i.subMessage=await u.parse(i.content),n.has(i)||n.set(i,{});let c=n.get(i);(i.subMessage.text||!i.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:i.subMessage}),t.add("plain")),i.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:i.subMessage}),t.add("html")),u.textMap&&u.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of i.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(i)){let u=i.contentType.parsed.value.substr(i.contentType.parsed.value.indexOf("/")+1),c=l||i;n.has(c)||n.set(c,{});let d=n.get(c);d[u]=d[u]||[],d[u].push({type:"text",value:i.getTextContent()}),t.add(u)}else if(i.content){const u=i.contentDisposition.parsed.params.filename||i.contentType.parsed.params.name||null,c={filename:u?Yr(u):null,mimeType:i.contentType.parsed.value,disposition:i.contentDisposition.parsed.value||null};switch(a&&i.contentId&&(c.related=!0),i.contentDescription&&(c.description=i.contentDescription),i.contentId&&(c.contentId=i.contentId),i.contentType.parsed.value){case"text/calendar":case"application/ics":{i.contentType.parsed.params.method&&(c.method=i.contentType.parsed.params.method.toString().toUpperCase().trim());const d=i.getTextContent().replace(/\r?\n/g,`
25
+ `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const su=50;function Xr(r,e){e=e||{};let t=e._depth||0;if(t>su)return[];let s=new nu(r).tokenize(),o=[],i=[],l=[];if(s.forEach(a=>{a.type==="operator"&&(a.value===","||a.value===";")?(i.length&&o.push(i),i=[]):i.push(a)}),i.length&&o.push(i),o.forEach(a=>{a=ru(a,t),a.length&&(l=l.concat(a))}),e.flatten){let a=[],u=c=>{c.forEach(d=>{if(d.group)return u(d.group);a.push(d)})};return u(l),a}return l}function iu(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,o=s%3,i=s-o,l,a,u,c,d,f=0;f<i;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],l=(d&16515072)>>18,a=(d&258048)>>12,u=(d&4032)>>6,c=d&63,e+=t[l]+t[a]+t[u]+t[c];return o==1?(d=n[i],l=(d&252)>>2,a=(d&3)<<4,e+=t[l]+t[a]+"=="):o==2&&(d=n[i]<<8|n[i+1],l=(d&64512)>>10,a=(d&1008)>>4,u=(d&15)<<2,e+=t[l]+t[a]+t[u]+"="),e}const ou=256,lu=2*1024*1024;class Mn{static parse(e,t){return new Mn(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||ou,maxHeadersSize:this.options.maxHeadersSize||lu},this.root=this.currentNode=new Wi({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let n=this.boundaries;if(n.length&&e.length>2&&e[0]===45&&e[1]===45)for(let s=n.length-1;s>=0;s--){let o=n[s];if(e.length!==o.value.length+2&&e.length!==o.value.length+4)continue;let i=e.length===o.value.length+4;if(i&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let l=!0;for(let a=0;a<o.value.length;a++)if(e[a+2]!==o.value[a]){l=!1;break}if(l)return i?(await o.node.finalize(),this.currentNode=o.node.parentNode||this.root):(await o.node.finalizeChildNodes(),this.currentNode=new Wi({postalMime:this,parentNode:o.node,...this.mimeOptions})),t?this.finalize():void 0}if(this.currentNode.feed(e),t)return this.finalize()}readLine(){let e=this.readPos,t=this.readPos,n=()=>({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length});for(;this.readPos<this.av.length;){const s=this.av[this.readPos++];if(s!==13&&s!==10&&(t=this.readPos),s===10)return n()}return n()}async processNodeTree(){let e={},t=new Set,n=this.textMap=new Map,s=this.forceRfc822Attachments(),o=async(i,l,a)=>{if(l=l||!1,a=a||!1,i.contentType.multipart)i.contentType.multipart==="alternative"?l=i:i.contentType.multipart==="related"&&(a=i);else if(this.isInlineMessageRfc822(i)&&!s){const u=new Mn;i.subMessage=await u.parse(i.content),n.has(i)||n.set(i,{});let c=n.get(i);(i.subMessage.text||!i.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:i.subMessage}),t.add("plain")),i.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:i.subMessage}),t.add("html")),u.textMap&&u.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of i.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(i)){let u=i.contentType.parsed.value.substr(i.contentType.parsed.value.indexOf("/")+1),c=l||i;n.has(c)||n.set(c,{});let d=n.get(c);d[u]=d[u]||[],d[u].push({type:"text",value:i.getTextContent()}),t.add(u)}else if(i.content){const u=i.contentDisposition.parsed.params.filename||i.contentType.parsed.params.name||null,c={filename:u?Yr(u):null,mimeType:i.contentType.parsed.value,disposition:i.contentDisposition.parsed.value||null};switch(a&&i.contentId&&(c.related=!0),i.contentDescription&&(c.description=i.contentDescription),i.contentId&&(c.contentId=i.contentId),i.contentType.parsed.value){case"text/calendar":case"application/ics":{i.contentType.parsed.params.method&&(c.method=i.contentType.parsed.params.method.toString().toUpperCase().trim());const d=i.getTextContent().replace(/\r?\n/g,`
26
26
  `).replace(/\n*$/,`
27
- `);c.content=Br.encode(d);break}default:c.content=i.content}this.attachments.push(c)}for(let u of i.childNodes)await o(u,l,a)};await o(this.root,!1,[]),n.forEach(i=>{t.forEach(l=>{if(e[l]||(e[l]=[]),i[l])i[l].forEach(a=>{switch(a.type){case"text":e[l].push(a.value);break;case"subMessage":switch(l){case"html":e[l].push(Ki(a.value));break;case"plain":e[l].push(Gi(a.value));break}break}});else{let a;switch(l){case"html":a="plain";break;case"plain":a="html";break}(i[a]||[]).forEach(u=>{switch(u.type){case"text":switch(l){case"html":e[l].push(Qa(u.value));break;case"plain":e[l].push(Ya(u.value));break}break;case"subMessage":switch(l){case"html":e[l].push(Ki(u.value));break;case"plain":e[l].push(Gi(u.value));break}break}})}})}),Object.keys(e).forEach(i=>{e[i]=e[i].join(`
28
- `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)t(s)};return t(this.root),e}async resolveStream(e){let t=0,n=[];const s=e.getReader();for(;;){const{done:l,value:a}=await s.read();if(l)break;n.push(a),t+=a.length}const o=new Uint8Array(t);let i=0;for(let l of n)o.set(l,i),i+=l.length;return o}async parse(e){var s,o;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Br.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await is(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const i=this.readLine();await this.processLine(i.bytes,i.done)}await this.processNodeTree();const t={headers:this.root.headers.map(i=>({key:i.key,value:i.value})).reverse()};for(const i of["from","sender"]){const l=this.root.headers.find(a=>a.key===i);if(l&&l.value){const a=Xr(l.value);a&&a.length&&(t[i]=a[0])}}for(const i of["delivered-to","return-path"]){const l=this.root.headers.find(a=>a.key===i);if(l&&l.value){const a=Xr(l.value);if(a&&a.length&&a[0].address){const u=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=a[0].address}}}for(const i of["to","cc","bcc","reply-to"]){const l=this.root.headers.filter(u=>u.key===i);let a=[];if(l.filter(u=>u&&u.value).map(u=>Xr(u.value)).forEach(u=>a=a.concat(u||[])),a&&a.length){const u=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=a}}for(const i of["subject","message-id","in-reply-to","references"]){const l=this.root.headers.find(a=>a.key===i);if(l&&l.value){const a=i.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[a]=Yr(l.value)}}let n=this.root.headers.find(i=>i.key==="date");if(n){let i=new Date(n.value);!i||i.toString()==="Invalid Date"?i=n.value:i=i.toISOString(),t.date=i}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(o=this.textContent)!=null&&o.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let l of t.attachments||[])l!=null&&l.content&&(l.content=ru(l.content),l.encoding="base64");break;case"utf8":let i=new TextDecoder("utf8");for(let l of t.attachments||[])l!=null&&l.content&&(l.content=i.decode(l.content),l.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class ul{constructor(e){Mr(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const o=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`API error (${o.status}): ${l}`)}const i=await o.json();if(!i.success&&i.error)throw new Error(i.error);return i.result}catch(o){throw console.error("API call failed:",o),o}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const o of s){const i=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${o}"`)],a=(await this.imapExec(e,i)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(a>0)return{success:!0,moved:a}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(l=>`UID STORE ${l} +FLAGS (\\Deleted)`),"EXPUNGE"],i=(await this.imapExec(e,s)).responses.filter(l=>l.ok&&l.command==="UID STORE").length;return{success:i>0,archived:i}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),o=s.responses.find(h=>h.command==="SELECT");if(!(o!=null&&o.ok))throw new Error(`Failed to select folder: ${(o==null?void 0:o.error)||"Unknown error"}`);const i=s.responses.find(h=>h.command==="FETCH");if(!(i!=null&&i.ok)||!i.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const a=[...i.messages].sort((h,g)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(g.internalDate?new Date(g.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(a.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${a.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=a.map(h=>{var E,D,k,y,_;const g=d.get(h);if(!g)return null;const m=((E=g.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,b=((k=(D=g.envelope)==null?void 0:D.from)==null?void 0:k.email)||"Unknown",C=((y=g.envelope)==null?void 0:y.subject)||"(No subject)",v=((_=g.envelope)==null?void 0:_.date)||"";return{uid:h,from:b,subject:C,date:v,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var g,m,b,C,v,E;const o=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(o!=null&&o.ok)||!((g=o.messages)!=null&&g[0]))return console.error("Failed to fetch raw email:",o==null?void 0:o.error),null;const i=o.messages[0],l=i.body||i.raw;if(!l)return console.error("No raw email content in response"),null;const u=await new Mn().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(b=u.attachments)==null?void 0:b.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of u.attachments||[])if(D.contentId){const k=this.contentToBase64(D.content),y=`data:${D.mimeType};base64,${k}`,_=D.contentId.replace(/^<|>$/g,"");c.set(_,y),c.set(`<${_}>`,y)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,k)=>{const y=c.get(k)||c.get(`<${k}>`);return y?`src="${y}"`:D}));const f=((C=i.flags)==null?void 0:C.some(D=>D.toLowerCase().includes("seen")))||!1,h=((v=u.from)==null?void 0:v.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(D=>({filename:D.filename||"attachment",mimeType:D.mimeType||"application/octet-stream",size:this.getContentSize(D.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const o=await this.getSettings(),i=((n=o.accounts)==null?void 0:n.find(u=>u.id===e))||((s=o.accounts)==null?void 0:s[0]);if(!(i!=null&&i.smtp))return{success:!1,error:"No SMTP configuration found for account"};const l={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:i.email,smtp_config:{host:i.smtp.host,port:parseInt(i.smtp.port,10)||587,username:i.smtp.user,password:i.smtp.password}};t.in_reply_to&&(l.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(l.attachments=t.attachments);const a=await this.callEmail("send",l);return{success:(a==null?void 0:a.sent)??!1,message_id:a==null?void 0:a.message_id,error:a==null?void 0:a.error}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}}const Es="qwanyx_auth_token",ks="qwanyx_refresh_token";class cl{static setToken(e){typeof window<"u"&&localStorage.setItem(Es,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Es):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Es),localStorage.removeItem(ks))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(ks,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(ks):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class dl{constructor(e){Mr(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const t=new URLSearchParams;Object.entries(e).forEach(([s,o])=>{o!=null&&t.append(s,String(o))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:o,params:i}=t,l=`${this.config.baseUrl}/${e}${this.buildQueryString(i)}`,a={...this.config.headers,...cl.getAuthHeader(),...s},u={method:n,headers:a};o&&n!=="GET"&&(u.body=JSON.stringify(o));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(l,{...u,signal:c.signal});if(clearTimeout(d),!f.ok){const h=await f.json().catch(()=>({message:f.statusText}));throw new Error(h.message||`HTTP ${f.status}`)}return await f.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,t){return this.request(e,{method:"GET",params:t})}async post(e,t,n){return this.request(e,{method:"POST",body:t,params:n})}async put(e,t,n){return this.request(e,{method:"PUT",body:t,params:n})}async patch(e,t,n){return this.request(e,{method:"PATCH",body:t,params:n})}async delete(e,t){return this.request(e,{method:"DELETE",params:t})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let In=null;function iu(r){return In=new dl(r),In}function ui(){if(!In)throw new Error("API client not initialized. Call initializeApiClient() first.");return In}function fl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:o,onError:i}=t,[l,a]=w.useState(null),[u,c]=w.useState(n),[d,f]=w.useState(null),h=w.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await ui().get(r,e);a(m),o==null||o(m)}catch(g){const m=g instanceof Error?g:new Error("Unknown error");f(m),i==null||i(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,o,i]);return w.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:u,error:d,refetch:h}}function ou(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[o,i]=w.useState(null),[l,a]=w.useState(!1),[u,c]=w.useState(null),d=w.useCallback(async h=>{a(!0),c(null);try{const g=ui();let m;switch(e){case"POST":m=await g.post(r,h);break;case"PUT":m=await g.put(r,h);break;case"PATCH":m=await g.patch(r,h);break;case"DELETE":m=await g.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return i(m),n==null||n(m,h),m}catch(g){const m=g instanceof Error?g:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{a(!1)}},[r,e,n,s]),f=w.useCallback(()=>{i(null),c(null),a(!1)},[]);return{data:o,loading:l,error:u,mutate:d,reset:f}}var $s={exports:{}},Ir={};/**
27
+ `);c.content=Nr.encode(d);break}default:c.content=i.content}this.attachments.push(c)}for(let u of i.childNodes)await o(u,l,a)};await o(this.root,!1,[]),n.forEach(i=>{t.forEach(l=>{if(e[l]||(e[l]=[]),i[l])i[l].forEach(a=>{switch(a.type){case"text":e[l].push(a.value);break;case"subMessage":switch(l){case"html":e[l].push(Vi(a.value));break;case"plain":e[l].push(Ki(a.value));break}break}});else{let a;switch(l){case"html":a="plain";break;case"plain":a="html";break}(i[a]||[]).forEach(u=>{switch(u.type){case"text":switch(l){case"html":e[l].push(Za(u.value));break;case"plain":e[l].push(eu(u.value));break}break;case"subMessage":switch(l){case"html":e[l].push(Vi(u.value));break;case"plain":e[l].push(Ki(u.value));break}break}})}})}),Object.keys(e).forEach(i=>{e[i]=e[i].join(`
28
+ `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)t(s)};return t(this.root),e}async resolveStream(e){let t=0,n=[];const s=e.getReader();for(;;){const{done:l,value:a}=await s.read();if(l)break;n.push(a),t+=a.length}const o=new Uint8Array(t);let i=0;for(let l of n)o.set(l,i),i+=l.length;return o}async parse(e){var s,o;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Nr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await is(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const i=this.readLine();await this.processLine(i.bytes,i.done)}await this.processNodeTree();const t={headers:this.root.headers.map(i=>({key:i.key,value:i.value})).reverse()};for(const i of["from","sender"]){const l=this.root.headers.find(a=>a.key===i);if(l&&l.value){const a=Xr(l.value);a&&a.length&&(t[i]=a[0])}}for(const i of["delivered-to","return-path"]){const l=this.root.headers.find(a=>a.key===i);if(l&&l.value){const a=Xr(l.value);if(a&&a.length&&a[0].address){const u=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=a[0].address}}}for(const i of["to","cc","bcc","reply-to"]){const l=this.root.headers.filter(u=>u.key===i);let a=[];if(l.filter(u=>u&&u.value).map(u=>Xr(u.value)).forEach(u=>a=a.concat(u||[])),a&&a.length){const u=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=a}}for(const i of["subject","message-id","in-reply-to","references"]){const l=this.root.headers.find(a=>a.key===i);if(l&&l.value){const a=i.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[a]=Yr(l.value)}}let n=this.root.headers.find(i=>i.key==="date");if(n){let i=new Date(n.value);!i||i.toString()==="Invalid Date"?i=n.value:i=i.toISOString(),t.date=i}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(o=this.textContent)!=null&&o.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let l of t.attachments||[])l!=null&&l.content&&(l.content=iu(l.content),l.encoding="base64");break;case"utf8":let i=new TextDecoder("utf8");for(let l of t.attachments||[])l!=null&&l.content&&(l.content=i.decode(l.content),l.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class cl{constructor(e){qt(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const o=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`API error (${o.status}): ${l}`)}const i=await o.json();if(!i.success&&i.error)throw new Error(i.error);return i.result}catch(o){throw console.error("API call failed:",o),o}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const o of s){const i=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${o}"`)],a=(await this.imapExec(e,i)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(a>0)return{success:!0,moved:a}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(l=>`UID STORE ${l} +FLAGS (\\Deleted)`),"EXPUNGE"],i=(await this.imapExec(e,s)).responses.filter(l=>l.ok&&l.command==="UID STORE").length;return{success:i>0,archived:i}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),o=s.responses.find(h=>h.command==="SELECT");if(!(o!=null&&o.ok))throw new Error(`Failed to select folder: ${(o==null?void 0:o.error)||"Unknown error"}`);const i=s.responses.find(h=>h.command==="FETCH");if(!(i!=null&&i.ok)||!i.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const a=[...i.messages].sort((h,g)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(g.internalDate?new Date(g.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(a.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${a.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=a.map(h=>{var E,D,k,y,_;const g=d.get(h);if(!g)return null;const m=((E=g.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,b=((k=(D=g.envelope)==null?void 0:D.from)==null?void 0:k.email)||"Unknown",C=((y=g.envelope)==null?void 0:y.subject)||"(No subject)",v=((_=g.envelope)==null?void 0:_.date)||"";return{uid:h,from:b,subject:C,date:v,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var g,m,b,C,v,E;const o=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(o!=null&&o.ok)||!((g=o.messages)!=null&&g[0]))return console.error("Failed to fetch raw email:",o==null?void 0:o.error),null;const i=o.messages[0],l=i.body||i.raw;if(!l)return console.error("No raw email content in response"),null;const u=await new Mn().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(b=u.attachments)==null?void 0:b.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of u.attachments||[])if(D.contentId){const k=this.contentToBase64(D.content),y=`data:${D.mimeType};base64,${k}`,_=D.contentId.replace(/^<|>$/g,"");c.set(_,y),c.set(`<${_}>`,y)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,k)=>{const y=c.get(k)||c.get(`<${k}>`);return y?`src="${y}"`:D}));const f=((C=i.flags)==null?void 0:C.some(D=>D.toLowerCase().includes("seen")))||!1,h=((v=u.from)==null?void 0:v.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(D=>({filename:D.filename||"attachment",mimeType:D.mimeType||"application/octet-stream",size:this.getContentSize(D.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const o=await this.getSettings(),i=((n=o.accounts)==null?void 0:n.find(u=>u.id===e))||((s=o.accounts)==null?void 0:s[0]);if(!(i!=null&&i.smtp))return{success:!1,error:"No SMTP configuration found for account"};const l={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:i.email,smtp_config:{host:i.smtp.host,port:parseInt(i.smtp.port,10)||587,username:i.smtp.user,password:i.smtp.password}};t.in_reply_to&&(l.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(l.attachments=t.attachments);const a=await this.callEmail("send",l);return{success:(a==null?void 0:a.sent)??!1,message_id:a==null?void 0:a.message_id,error:a==null?void 0:a.error}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}}const ks="qwanyx_auth_token",As="qwanyx_refresh_token";class dl{static setToken(e){typeof window<"u"&&localStorage.setItem(ks,e)}static getToken(){return typeof window<"u"?localStorage.getItem(ks):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(ks),localStorage.removeItem(As))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(As,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(As):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class fl{constructor(e){qt(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const t=new URLSearchParams;Object.entries(e).forEach(([s,o])=>{o!=null&&t.append(s,String(o))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:o,params:i}=t,l=`${this.config.baseUrl}/${e}${this.buildQueryString(i)}`,a={...this.config.headers,...dl.getAuthHeader(),...s},u={method:n,headers:a};o&&n!=="GET"&&(u.body=JSON.stringify(o));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(l,{...u,signal:c.signal});if(clearTimeout(d),!f.ok){const h=await f.json().catch(()=>({message:f.statusText}));throw new Error(h.message||`HTTP ${f.status}`)}return await f.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,t){return this.request(e,{method:"GET",params:t})}async post(e,t,n){return this.request(e,{method:"POST",body:t,params:n})}async put(e,t,n){return this.request(e,{method:"PUT",body:t,params:n})}async patch(e,t,n){return this.request(e,{method:"PATCH",body:t,params:n})}async delete(e,t){return this.request(e,{method:"DELETE",params:t})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let In=null;function au(r){return In=new fl(r),In}function ci(){if(!In)throw new Error("API client not initialized. Call initializeApiClient() first.");return In}function hl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:o,onError:i}=t,[l,a]=w.useState(null),[u,c]=w.useState(n),[d,f]=w.useState(null),h=w.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await ci().get(r,e);a(m),o==null||o(m)}catch(g){const m=g instanceof Error?g:new Error("Unknown error");f(m),i==null||i(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,o,i]);return w.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:u,error:d,refetch:h}}function uu(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[o,i]=w.useState(null),[l,a]=w.useState(!1),[u,c]=w.useState(null),d=w.useCallback(async h=>{a(!0),c(null);try{const g=ci();let m;switch(e){case"POST":m=await g.post(r,h);break;case"PUT":m=await g.put(r,h);break;case"PATCH":m=await g.patch(r,h);break;case"DELETE":m=await g.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return i(m),n==null||n(m,h),m}catch(g){const m=g instanceof Error?g:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{a(!1)}},[r,e,n,s]),f=w.useCallback(()=>{i(null),c(null),a(!1)},[]);return{data:o,loading:l,error:u,mutate:d,reset:f}}var zs={exports:{}},Ir={};/**
29
29
  * @license React
30
30
  * react-jsx-runtime.production.min.js
31
31
  *
@@ -33,7 +33,7 @@ ${s}
33
33
  *
34
34
  * This source code is licensed under the MIT license found in the
35
35
  * LICENSE file in the root directory of this source tree.
36
- */var Vi;function lu(){if(Vi)return Ir;Vi=1;var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(h=a.ref);for(c in a)n.call(a,c)&&!o.hasOwnProperty(c)&&(d[c]=a[c]);if(l&&l.defaultProps)for(c in a=l.defaultProps,a)d[c]===void 0&&(d[c]=a[c]);return{$$typeof:e,type:l,key:f,ref:h,props:d,_owner:s.current}}return Ir.Fragment=t,Ir.jsx=i,Ir.jsxs=i,Ir}var $r={};/**
36
+ */var Hi;function cu(){if(Hi)return Ir;Hi=1;var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(h=a.ref);for(c in a)n.call(a,c)&&!o.hasOwnProperty(c)&&(d[c]=a[c]);if(l&&l.defaultProps)for(c in a=l.defaultProps,a)d[c]===void 0&&(d[c]=a[c]);return{$$typeof:e,type:l,key:f,ref:h,props:d,_owner:s.current}}return Ir.Fragment=t,Ir.jsx=i,Ir.jsxs=i,Ir}var $r={};/**
37
37
  * @license React
38
38
  * react-jsx-runtime.development.js
39
39
  *
@@ -41,41 +41,41 @@ ${s}
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var Hi;function au(){return Hi||(Hi=1,process.env.NODE_ENV!=="production"&&function(){var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,m="@@iterator";function b(x){if(x===null||typeof x!="object")return null;var R=g&&x[g]||x[m];return typeof R=="function"?R:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(x){{for(var R=arguments.length,U=new Array(R>1?R-1:0),Y=1;Y<R;Y++)U[Y-1]=arguments[Y];E("error",x,U)}}function E(x,R,U){{var Y=C.ReactDebugCurrentFrame,oe=Y.getStackAddendum();oe!==""&&(R+="%s",U=U.concat([oe]));var ge=U.map(function(se){return String(se)});ge.unshift("Warning: "+R),Function.prototype.apply.call(console[x],console,ge)}}var D=!1,k=!1,y=!1,_=!1,S=!1,A;A=Symbol.for("react.module.reference");function I(x){return!!(typeof x=="string"||typeof x=="function"||x===n||x===o||S||x===s||x===u||x===c||_||x===h||D||k||y||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===i||x.$$typeof===l||x.$$typeof===a||x.$$typeof===A||x.getModuleId!==void 0))}function B(x,R,U){var Y=x.displayName;if(Y)return Y;var oe=R.displayName||R.name||"";return oe!==""?U+"("+oe+")":U}function N(x){return x.displayName||"Context"}function j(x){if(x==null)return null;if(typeof x.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var R=x;return N(R)+".Consumer";case i:var U=x;return N(U._context)+".Provider";case a:return B(x,x.render,"ForwardRef");case d:var Y=x.displayName||null;return Y!==null?Y:j(x.type)||"Memo";case f:{var oe=x,ge=oe._payload,se=oe._init;try{return j(se(ge))}catch{return null}}}return null}var L=Object.assign,$=0,X,ce,ve,le,Le,me,he;function ye(){}ye.__reactDisabledLog=!0;function xe(){{if($===0){X=console.log,ce=console.info,ve=console.warn,le=console.error,Le=console.group,me=console.groupCollapsed,he=console.groupEnd;var x={configurable:!0,enumerable:!0,value:ye,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}$++}}function Se(){{if($--,$===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},x,{value:X}),info:L({},x,{value:ce}),warn:L({},x,{value:ve}),error:L({},x,{value:le}),group:L({},x,{value:Le}),groupCollapsed:L({},x,{value:me}),groupEnd:L({},x,{value:he})})}$<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=C.ReactCurrentDispatcher,Ce;function Ne(x,R,U){{if(Ce===void 0)try{throw Error()}catch(oe){var Y=oe.stack.trim().match(/\n( *(at )?)/);Ce=Y&&Y[1]||""}return`
44
+ */var Ji;function du(){return Ji||(Ji=1,process.env.NODE_ENV!=="production"&&function(){var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,m="@@iterator";function b(x){if(x===null||typeof x!="object")return null;var R=g&&x[g]||x[m];return typeof R=="function"?R:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(x){{for(var R=arguments.length,U=new Array(R>1?R-1:0),Y=1;Y<R;Y++)U[Y-1]=arguments[Y];E("error",x,U)}}function E(x,R,U){{var Y=C.ReactDebugCurrentFrame,oe=Y.getStackAddendum();oe!==""&&(R+="%s",U=U.concat([oe]));var ge=U.map(function(se){return String(se)});ge.unshift("Warning: "+R),Function.prototype.apply.call(console[x],console,ge)}}var D=!1,k=!1,y=!1,_=!1,S=!1,A;A=Symbol.for("react.module.reference");function I(x){return!!(typeof x=="string"||typeof x=="function"||x===n||x===o||S||x===s||x===u||x===c||_||x===h||D||k||y||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===i||x.$$typeof===l||x.$$typeof===a||x.$$typeof===A||x.getModuleId!==void 0))}function B(x,R,U){var Y=x.displayName;if(Y)return Y;var oe=R.displayName||R.name||"";return oe!==""?U+"("+oe+")":U}function N(x){return x.displayName||"Context"}function j(x){if(x==null)return null;if(typeof x.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var R=x;return N(R)+".Consumer";case i:var U=x;return N(U._context)+".Provider";case a:return B(x,x.render,"ForwardRef");case d:var Y=x.displayName||null;return Y!==null?Y:j(x.type)||"Memo";case f:{var oe=x,ge=oe._payload,se=oe._init;try{return j(se(ge))}catch{return null}}}return null}var L=Object.assign,$=0,X,ce,ve,le,Le,me,he;function ye(){}ye.__reactDisabledLog=!0;function xe(){{if($===0){X=console.log,ce=console.info,ve=console.warn,le=console.error,Le=console.group,me=console.groupCollapsed,he=console.groupEnd;var x={configurable:!0,enumerable:!0,value:ye,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}$++}}function Se(){{if($--,$===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},x,{value:X}),info:L({},x,{value:ce}),warn:L({},x,{value:ve}),error:L({},x,{value:le}),group:L({},x,{value:Le}),groupCollapsed:L({},x,{value:me}),groupEnd:L({},x,{value:he})})}$<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=C.ReactCurrentDispatcher,Ce;function Ne(x,R,U){{if(Ce===void 0)try{throw Error()}catch(oe){var Y=oe.stack.trim().match(/\n( *(at )?)/);Ce=Y&&Y[1]||""}return`
45
45
  `+Ce+x}}var ae=!1,Re;{var ot=typeof WeakMap=="function"?WeakMap:Map;Re=new ot}function St(x,R){if(!x||ae)return"";{var U=Re.get(x);if(U!==void 0)return U}var Y;ae=!0;var oe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=pe.current,pe.current=null,xe();try{if(R){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(rt){Y=rt}Reflect.construct(x,[],se)}else{try{se.call()}catch(rt){Y=rt}x.call(se.prototype)}}else{try{throw Error()}catch(rt){Y=rt}x()}}catch(rt){if(rt&&Y&&typeof rt.stack=="string"){for(var ie=rt.stack.split(`
46
46
  `),Ye=Y.stack.split(`
47
47
  `),Me=ie.length-1,$e=Ye.length-1;Me>=1&&$e>=0&&ie[Me]!==Ye[$e];)$e--;for(;Me>=1&&$e>=0;Me--,$e--)if(ie[Me]!==Ye[$e]){if(Me!==1||$e!==1)do if(Me--,$e--,$e<0||ie[Me]!==Ye[$e]){var ft=`
48
- `+ie[Me].replace(" at new "," at ");return x.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",x.displayName)),typeof x=="function"&&Re.set(x,ft),ft}while(Me>=1&&$e>=0);break}}}finally{ae=!1,pe.current=ge,Se(),Error.prepareStackTrace=oe}var _r=x?x.displayName||x.name:"",ir=_r?Ne(_r):"";return typeof x=="function"&&Re.set(x,ir),ir}function Mt(x,R,U){return St(x,!1)}function tt(x){var R=x.prototype;return!!(R&&R.isReactComponent)}function pt(x,R,U){if(x==null)return"";if(typeof x=="function")return St(x,tt(x));if(typeof x=="string")return Ne(x);switch(x){case u:return Ne("Suspense");case c:return Ne("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case a:return Mt(x.render);case d:return pt(x.type,R,U);case f:{var Y=x,oe=Y._payload,ge=Y._init;try{return pt(ge(oe),R,U)}catch{}}}return""}var ct=Object.prototype.hasOwnProperty,Ht={},It=C.ReactDebugCurrentFrame;function Et(x){if(x){var R=x._owner,U=pt(x.type,x._source,R?R.type:null);It.setExtraStackFrame(U)}else It.setExtraStackFrame(null)}function kt(x,R,U,Y,oe){{var ge=Function.call.bind(ct);for(var se in x)if(ge(x,se)){var ie=void 0;try{if(typeof x[se]!="function"){var Ye=Error((Y||"React class")+": "+U+" type `"+se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ye.name="Invariant Violation",Ye}ie=x[se](R,se,Y,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Me){ie=Me}ie&&!(ie instanceof Error)&&(Et(oe),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",U,se,typeof ie),Et(null)),ie instanceof Error&&!(ie.message in Ht)&&(Ht[ie.message]=!0,Et(oe),v("Failed %s type: %s",U,ie.message),Et(null))}}}var lt=Array.isArray;function gt(x){return lt(x)}function W(x){{var R=typeof Symbol=="function"&&Symbol.toStringTag,U=R&&x[Symbol.toStringTag]||x.constructor.name||"Object";return U}}function we(x){try{return ke(x),!1}catch{return!0}}function ke(x){return""+x}function Ee(x){if(we(x))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",W(x)),ke(x)}var At=C.ReactCurrentOwner,Tt={key:!0,ref:!0,__self:!0,__source:!0},$t,K;function J(x){if(ct.call(x,"ref")){var R=Object.getOwnPropertyDescriptor(x,"ref").get;if(R&&R.isReactWarning)return!1}return x.ref!==void 0}function Ae(x){if(ct.call(x,"key")){var R=Object.getOwnPropertyDescriptor(x,"key").get;if(R&&R.isReactWarning)return!1}return x.key!==void 0}function Pe(x,R){typeof x.ref=="string"&&At.current}function Oe(x,R){{var U=function(){$t||($t=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};U.isReactWarning=!0,Object.defineProperty(x,"key",{get:U,configurable:!0})}}function mt(x,R){{var U=function(){K||(K=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};U.isReactWarning=!0,Object.defineProperty(x,"ref",{get:U,configurable:!0})}}var q=function(x,R,U,Y,oe,ge,se){var ie={$$typeof:e,type:x,key:R,ref:U,props:se,_owner:ge};return ie._store={},Object.defineProperty(ie._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ie,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(ie,"_source",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.freeze&&(Object.freeze(ie.props),Object.freeze(ie)),ie};function T(x,R,U,Y,oe){{var ge,se={},ie=null,Ye=null;U!==void 0&&(Ee(U),ie=""+U),Ae(R)&&(Ee(R.key),ie=""+R.key),J(R)&&(Ye=R.ref,Pe(R,oe));for(ge in R)ct.call(R,ge)&&!Tt.hasOwnProperty(ge)&&(se[ge]=R[ge]);if(x&&x.defaultProps){var Me=x.defaultProps;for(ge in Me)se[ge]===void 0&&(se[ge]=Me[ge])}if(ie||Ye){var $e=typeof x=="function"?x.displayName||x.name||"Unknown":x;ie&&Oe(se,$e),Ye&&mt(se,$e)}return q(x,ie,Ye,oe,Y,At.current,se)}}var H=C.ReactCurrentOwner,Q=C.ReactDebugCurrentFrame;function O(x){if(x){var R=x._owner,U=pt(x.type,x._source,R?R.type:null);Q.setExtraStackFrame(U)}else Q.setExtraStackFrame(null)}var re;re=!1;function Z(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function ee(){{if(H.current){var x=j(H.current.type);if(x)return`
48
+ `+ie[Me].replace(" at new "," at ");return x.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",x.displayName)),typeof x=="function"&&Re.set(x,ft),ft}while(Me>=1&&$e>=0);break}}}finally{ae=!1,pe.current=ge,Se(),Error.prepareStackTrace=oe}var vr=x?x.displayName||x.name:"",or=vr?Ne(vr):"";return typeof x=="function"&&Re.set(x,or),or}function Mt(x,R,U){return St(x,!1)}function tt(x){var R=x.prototype;return!!(R&&R.isReactComponent)}function pt(x,R,U){if(x==null)return"";if(typeof x=="function")return St(x,tt(x));if(typeof x=="string")return Ne(x);switch(x){case u:return Ne("Suspense");case c:return Ne("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case a:return Mt(x.render);case d:return pt(x.type,R,U);case f:{var Y=x,oe=Y._payload,ge=Y._init;try{return pt(ge(oe),R,U)}catch{}}}return""}var ct=Object.prototype.hasOwnProperty,Jt={},It=C.ReactDebugCurrentFrame;function Et(x){if(x){var R=x._owner,U=pt(x.type,x._source,R?R.type:null);It.setExtraStackFrame(U)}else It.setExtraStackFrame(null)}function kt(x,R,U,Y,oe){{var ge=Function.call.bind(ct);for(var se in x)if(ge(x,se)){var ie=void 0;try{if(typeof x[se]!="function"){var Ye=Error((Y||"React class")+": "+U+" type `"+se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ye.name="Invariant Violation",Ye}ie=x[se](R,se,Y,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Me){ie=Me}ie&&!(ie instanceof Error)&&(Et(oe),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",U,se,typeof ie),Et(null)),ie instanceof Error&&!(ie.message in Jt)&&(Jt[ie.message]=!0,Et(oe),v("Failed %s type: %s",U,ie.message),Et(null))}}}var lt=Array.isArray;function gt(x){return lt(x)}function W(x){{var R=typeof Symbol=="function"&&Symbol.toStringTag,U=R&&x[Symbol.toStringTag]||x.constructor.name||"Object";return U}}function we(x){try{return ke(x),!1}catch{return!0}}function ke(x){return""+x}function Ee(x){if(we(x))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",W(x)),ke(x)}var At=C.ReactCurrentOwner,Tt={key:!0,ref:!0,__self:!0,__source:!0},$t,K;function J(x){if(ct.call(x,"ref")){var R=Object.getOwnPropertyDescriptor(x,"ref").get;if(R&&R.isReactWarning)return!1}return x.ref!==void 0}function Ae(x){if(ct.call(x,"key")){var R=Object.getOwnPropertyDescriptor(x,"key").get;if(R&&R.isReactWarning)return!1}return x.key!==void 0}function Pe(x,R){typeof x.ref=="string"&&At.current}function Oe(x,R){{var U=function(){$t||($t=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};U.isReactWarning=!0,Object.defineProperty(x,"key",{get:U,configurable:!0})}}function mt(x,R){{var U=function(){K||(K=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};U.isReactWarning=!0,Object.defineProperty(x,"ref",{get:U,configurable:!0})}}var q=function(x,R,U,Y,oe,ge,se){var ie={$$typeof:e,type:x,key:R,ref:U,props:se,_owner:ge};return ie._store={},Object.defineProperty(ie._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ie,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(ie,"_source",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.freeze&&(Object.freeze(ie.props),Object.freeze(ie)),ie};function T(x,R,U,Y,oe){{var ge,se={},ie=null,Ye=null;U!==void 0&&(Ee(U),ie=""+U),Ae(R)&&(Ee(R.key),ie=""+R.key),J(R)&&(Ye=R.ref,Pe(R,oe));for(ge in R)ct.call(R,ge)&&!Tt.hasOwnProperty(ge)&&(se[ge]=R[ge]);if(x&&x.defaultProps){var Me=x.defaultProps;for(ge in Me)se[ge]===void 0&&(se[ge]=Me[ge])}if(ie||Ye){var $e=typeof x=="function"?x.displayName||x.name||"Unknown":x;ie&&Oe(se,$e),Ye&&mt(se,$e)}return q(x,ie,Ye,oe,Y,At.current,se)}}var H=C.ReactCurrentOwner,Q=C.ReactDebugCurrentFrame;function O(x){if(x){var R=x._owner,U=pt(x.type,x._source,R?R.type:null);Q.setExtraStackFrame(U)}else Q.setExtraStackFrame(null)}var re;re=!1;function Z(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function ee(){{if(H.current){var x=j(H.current.type);if(x)return`
49
49
 
50
50
  Check the render method of \``+x+"`."}return""}}function de(x){return""}var De={};function te(x){{var R=ee();if(!R){var U=typeof x=="string"?x:x.displayName||x.name;U&&(R=`
51
51
 
52
- Check the top-level render call using <`+U+">.")}return R}}function ne(x,R){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var U=te(R);if(De[U])return;De[U]=!0;var Y="";x&&x._owner&&x._owner!==H.current&&(Y=" It was passed a child from "+j(x._owner.type)+"."),O(x),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,Y),O(null)}}function Ie(x,R){{if(typeof x!="object")return;if(gt(x))for(var U=0;U<x.length;U++){var Y=x[U];Z(Y)&&ne(Y,R)}else if(Z(x))x._store&&(x._store.validated=!0);else if(x){var oe=b(x);if(typeof oe=="function"&&oe!==x.entries)for(var ge=oe.call(x),se;!(se=ge.next()).done;)Z(se.value)&&ne(se.value,R)}}}function qe(x){{var R=x.type;if(R==null||typeof R=="string")return;var U;if(typeof R=="function")U=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===a||R.$$typeof===d))U=R.propTypes;else return;if(U){var Y=j(R);kt(U,x.props,"prop",Y,x)}else if(R.PropTypes!==void 0&&!re){re=!0;var oe=j(R);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Te(x){{for(var R=Object.keys(x.props),U=0;U<R.length;U++){var Y=R[U];if(Y!=="children"&&Y!=="key"){O(x),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),O(null);break}}x.ref!==null&&(O(x),v("Invalid attribute `ref` supplied to `React.Fragment`."),O(null))}}var be={};function He(x,R,U,Y,oe,ge){{var se=I(x);if(!se){var ie="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(ie+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ye=de();Ye?ie+=Ye:ie+=ee();var Me;x===null?Me="null":gt(x)?Me="array":x!==void 0&&x.$$typeof===e?(Me="<"+(j(x.type)||"Unknown")+" />",ie=" Did you accidentally export a JSX literal instead of a component?"):Me=typeof x,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Me,ie)}var $e=T(x,R,U,oe,ge);if($e==null)return $e;if(se){var ft=R.children;if(ft!==void 0)if(Y)if(gt(ft)){for(var _r=0;_r<ft.length;_r++)Ie(ft[_r],x);Object.freeze&&Object.freeze(ft)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ie(ft,x)}if(ct.call(R,"key")){var ir=j(x),rt=Object.keys(R).filter(function(Ra){return Ra!=="key"}),Cs=rt.length>0?"{key: someKey, "+rt.join(": ..., ")+": ...}":"{key: someKey}";if(!be[ir+Cs]){var La=rt.length>0?"{"+rt.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
52
+ Check the top-level render call using <`+U+">.")}return R}}function ne(x,R){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var U=te(R);if(De[U])return;De[U]=!0;var Y="";x&&x._owner&&x._owner!==H.current&&(Y=" It was passed a child from "+j(x._owner.type)+"."),O(x),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,Y),O(null)}}function Ie(x,R){{if(typeof x!="object")return;if(gt(x))for(var U=0;U<x.length;U++){var Y=x[U];Z(Y)&&ne(Y,R)}else if(Z(x))x._store&&(x._store.validated=!0);else if(x){var oe=b(x);if(typeof oe=="function"&&oe!==x.entries)for(var ge=oe.call(x),se;!(se=ge.next()).done;)Z(se.value)&&ne(se.value,R)}}}function qe(x){{var R=x.type;if(R==null||typeof R=="string")return;var U;if(typeof R=="function")U=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===a||R.$$typeof===d))U=R.propTypes;else return;if(U){var Y=j(R);kt(U,x.props,"prop",Y,x)}else if(R.PropTypes!==void 0&&!re){re=!0;var oe=j(R);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Te(x){{for(var R=Object.keys(x.props),U=0;U<R.length;U++){var Y=R[U];if(Y!=="children"&&Y!=="key"){O(x),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),O(null);break}}x.ref!==null&&(O(x),v("Invalid attribute `ref` supplied to `React.Fragment`."),O(null))}}var be={};function He(x,R,U,Y,oe,ge){{var se=I(x);if(!se){var ie="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(ie+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ye=de();Ye?ie+=Ye:ie+=ee();var Me;x===null?Me="null":gt(x)?Me="array":x!==void 0&&x.$$typeof===e?(Me="<"+(j(x.type)||"Unknown")+" />",ie=" Did you accidentally export a JSX literal instead of a component?"):Me=typeof x,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Me,ie)}var $e=T(x,R,U,oe,ge);if($e==null)return $e;if(se){var ft=R.children;if(ft!==void 0)if(Y)if(gt(ft)){for(var vr=0;vr<ft.length;vr++)Ie(ft[vr],x);Object.freeze&&Object.freeze(ft)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ie(ft,x)}if(ct.call(R,"key")){var or=j(x),rt=Object.keys(R).filter(function(Ma){return Ma!=="key"}),ws=rt.length>0?"{key: someKey, "+rt.join(": ..., ")+": ...}":"{key: someKey}";if(!be[or+ws]){var Oa=rt.length>0?"{"+rt.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
53
53
  let props = %s;
54
54
  <%s {...props} />
55
55
  React keys must be passed directly to JSX without using spread:
56
56
  let props = %s;
57
- <%s key={someKey} {...props} />`,Cs,ir,La,ir),be[ir+Cs]=!0}}return x===n?Te($e):qe($e),$e}}function Je(x,R,U){return He(x,R,U,!0)}function dt(x,R,U){return He(x,R,U,!1)}var zt=dt,yt=Je;$r.Fragment=n,$r.jsx=zt,$r.jsxs=yt}()),$r}process.env.NODE_ENV==="production"?$s.exports=lu():$s.exports=au();var p=$s.exports;class Rn{static filter(e,t){return e.filter(t)}static filterBy(e,t,n){return e.filter(s=>s[t]===n)}static filterByFields(e,t){return e.filter(n=>Object.entries(t).every(([s,o])=>n[s]===o))}static sort(e,t,n="asc"){return[...e].sort((s,o)=>{const i=s[t],l=o[t];if(i===l)return 0;let a=0;return i>l&&(a=1),i<l&&(a=-1),n==="asc"?a:-a})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(o=>n.some(i=>{const l=o[i];return l==null?!1:String(l).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,o=s+n;return{data:e.slice(s,o),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const o=String(s[t]);return n[o]||(n[o]=[]),n[o].push(s),n},{})}static unique(e,t){const n=e.map(s=>s[t]);return[...new Set(n)]}static countBy(e,t){return e.reduce((n,s)=>{const o=String(s[t]);return n[o]=(n[o]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function uu({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:o,keyExtractor:i=(m,b)=>m.id||m._id||String(b),searchable:l=!1,searchFields:a=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:g={}}){const{data:m,loading:b,error:C,refetch:v}=fl(r,e),[E,D]=w.useState(""),[k,y]=w.useState({}),[_,S]=w.useState(1),A=w.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let L=m;return l&&E&&a.length>0&&(L=Rn.search(L,E,a)),Object.keys(k).length>0&&(L=Rn.filterByFields(L,k)),Rn.paginate(L,_,d)},[m,E,k,_,d,l,a]);w.useEffect(()=>{S(1)},[E,k]);const I=()=>{D(""),y({}),S(1),v(),h==null||h()},B={background:g.background||"#ffffff",cardBackground:g.cardBackground||"#f9fafb",text:g.text||"#111827",textSecondary:g.textSecondary||"#6b7280",border:g.border||"#e5e7eb",primary:g.primary||"#3b82f6"},j=o||(L=>p.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:B.text},children:L.title||L.name||L.label||"Untitled"}),L.description&&p.jsx("div",{style:{fontSize:"13px",color:B.textSecondary,marginTop:"4px"},children:L.description})]}));return b&&!m?p.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:B.textSecondary},children:"Loading..."}):C?p.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[p.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),p.jsx("div",{style:{fontSize:"14px"},children:C.message}),p.jsx("button",{onClick:I,style:{marginTop:"16px",padding:"8px 16px",background:B.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):p.jsxs("div",{style:{background:B.background,borderRadius:"12px",overflow:"hidden"},children:[(n||l||c.length>0)&&p.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${B.border}`},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:l||c.length>0?"12px":"0"},children:[n&&p.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:B.text},children:n}),p.jsx("button",{onClick:I,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${B.border}`,borderRadius:"6px",color:B.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),l&&p.jsx("input",{type:"text",placeholder:u,value:E,onChange:L=>D(L.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${B.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),p.jsx("div",{style:{display:t==="grid"?"grid":"flex",flexDirection:t==="list"?"column":void 0,gridTemplateColumns:t==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:t==="list"?"0":"16px",padding:t==="list"?"0":"16px"},children:A.data.length===0?p.jsx("div",{style:{padding:"48px",textAlign:"center",color:B.textSecondary},children:s}):A.data.map((L,$)=>p.jsx("div",{onClick:()=>f==null?void 0:f(L),style:{background:B.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${B.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:X=>{f&&(X.currentTarget.style.background=B.border)},onMouseLeave:X=>{X.currentTarget.style.background=B.cardBackground},children:j(L,$)},i(L,$)))}),A.totalPages>1&&p.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${B.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{fontSize:"13px",color:B.textSecondary},children:["Page ",_," of ",A.totalPages]}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("button",{onClick:()=>S(L=>Math.max(1,L-1)),disabled:_===1,style:{padding:"6px 12px",border:`1px solid ${B.border}`,borderRadius:"6px",background:"white",cursor:_===1?"not-allowed":"pointer",opacity:_===1?.5:1},children:"Previous"}),p.jsx("button",{onClick:()=>S(L=>Math.min(A.totalPages,L+1)),disabled:_===A.totalPages,style:{padding:"6px 12px",border:`1px solid ${B.border}`,borderRadius:"6px",background:"white",cursor:_===A.totalPages?"not-allowed":"pointer",opacity:_===A.totalPages?.5:1},children:"Next"})]})]})]})}function cu({item:r,onClick:e,title:t=i=>i.title||i.name||i.label||"Untitled",subtitle:n=i=>i.description||i.subtitle||"",image:s=i=>i.image||i.thumbnail||i.photo,badge:o=i=>i.badge||i.tag||i.type}){const i=t(r),l=n(r),a=s(r),u=o(r);return p.jsxs("div",{onClick:e,className:`
57
+ <%s key={someKey} {...props} />`,ws,or,Oa,or),be[or+ws]=!0}}return x===n?Te($e):qe($e),$e}}function Je(x,R,U){return He(x,R,U,!0)}function dt(x,R,U){return He(x,R,U,!1)}var zt=dt,yt=Je;$r.Fragment=n,$r.jsx=zt,$r.jsxs=yt}()),$r}process.env.NODE_ENV==="production"?zs.exports=cu():zs.exports=du();var p=zs.exports;class Rn{static filter(e,t){return e.filter(t)}static filterBy(e,t,n){return e.filter(s=>s[t]===n)}static filterByFields(e,t){return e.filter(n=>Object.entries(t).every(([s,o])=>n[s]===o))}static sort(e,t,n="asc"){return[...e].sort((s,o)=>{const i=s[t],l=o[t];if(i===l)return 0;let a=0;return i>l&&(a=1),i<l&&(a=-1),n==="asc"?a:-a})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(o=>n.some(i=>{const l=o[i];return l==null?!1:String(l).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,o=s+n;return{data:e.slice(s,o),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const o=String(s[t]);return n[o]||(n[o]=[]),n[o].push(s),n},{})}static unique(e,t){const n=e.map(s=>s[t]);return[...new Set(n)]}static countBy(e,t){return e.reduce((n,s)=>{const o=String(s[t]);return n[o]=(n[o]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function fu({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:o,keyExtractor:i=(m,b)=>m.id||m._id||String(b),searchable:l=!1,searchFields:a=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:g={}}){const{data:m,loading:b,error:C,refetch:v}=hl(r,e),[E,D]=w.useState(""),[k,y]=w.useState({}),[_,S]=w.useState(1),A=w.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let L=m;return l&&E&&a.length>0&&(L=Rn.search(L,E,a)),Object.keys(k).length>0&&(L=Rn.filterByFields(L,k)),Rn.paginate(L,_,d)},[m,E,k,_,d,l,a]);w.useEffect(()=>{S(1)},[E,k]);const I=()=>{D(""),y({}),S(1),v(),h==null||h()},B={background:g.background||"#ffffff",cardBackground:g.cardBackground||"#f9fafb",text:g.text||"#111827",textSecondary:g.textSecondary||"#6b7280",border:g.border||"#e5e7eb",primary:g.primary||"#3b82f6"},j=o||(L=>p.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:B.text},children:L.title||L.name||L.label||"Untitled"}),L.description&&p.jsx("div",{style:{fontSize:"13px",color:B.textSecondary,marginTop:"4px"},children:L.description})]}));return b&&!m?p.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:B.textSecondary},children:"Loading..."}):C?p.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[p.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),p.jsx("div",{style:{fontSize:"14px"},children:C.message}),p.jsx("button",{onClick:I,style:{marginTop:"16px",padding:"8px 16px",background:B.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):p.jsxs("div",{style:{background:B.background,borderRadius:"12px",overflow:"hidden"},children:[(n||l||c.length>0)&&p.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${B.border}`},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:l||c.length>0?"12px":"0"},children:[n&&p.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:B.text},children:n}),p.jsx("button",{onClick:I,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${B.border}`,borderRadius:"6px",color:B.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),l&&p.jsx("input",{type:"text",placeholder:u,value:E,onChange:L=>D(L.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${B.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),p.jsx("div",{style:{display:t==="grid"?"grid":"flex",flexDirection:t==="list"?"column":void 0,gridTemplateColumns:t==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:t==="list"?"0":"16px",padding:t==="list"?"0":"16px"},children:A.data.length===0?p.jsx("div",{style:{padding:"48px",textAlign:"center",color:B.textSecondary},children:s}):A.data.map((L,$)=>p.jsx("div",{onClick:()=>f==null?void 0:f(L),style:{background:B.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${B.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:X=>{f&&(X.currentTarget.style.background=B.border)},onMouseLeave:X=>{X.currentTarget.style.background=B.cardBackground},children:j(L,$)},i(L,$)))}),A.totalPages>1&&p.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${B.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{fontSize:"13px",color:B.textSecondary},children:["Page ",_," of ",A.totalPages]}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("button",{onClick:()=>S(L=>Math.max(1,L-1)),disabled:_===1,style:{padding:"6px 12px",border:`1px solid ${B.border}`,borderRadius:"6px",background:"white",cursor:_===1?"not-allowed":"pointer",opacity:_===1?.5:1},children:"Previous"}),p.jsx("button",{onClick:()=>S(L=>Math.min(A.totalPages,L+1)),disabled:_===A.totalPages,style:{padding:"6px 12px",border:`1px solid ${B.border}`,borderRadius:"6px",background:"white",cursor:_===A.totalPages?"not-allowed":"pointer",opacity:_===A.totalPages?.5:1},children:"Next"})]})]})]})}function hu({item:r,onClick:e,title:t=i=>i.title||i.name||i.label||"Untitled",subtitle:n=i=>i.description||i.subtitle||"",image:s=i=>i.image||i.thumbnail||i.photo,badge:o=i=>i.badge||i.tag||i.type}){const i=t(r),l=n(r),a=s(r),u=o(r);return p.jsxs("div",{onClick:e,className:`
58
58
  flex items-center gap-4 p-4 border-b border-gray-200
59
59
  hover:bg-gray-50 transition-colors
60
60
  ${e?"cursor-pointer":""}
61
- `,children:[a&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:a,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),u&&p.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&p.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&p.jsx("div",{className:"flex-shrink-0 text-gray-400",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function du({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&p.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),p.jsxs("div",{className:"p-6",children:[i&&p.jsx("div",{className:"mb-6",children:p.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&p.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),p.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&p.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:p.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const fu={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function hu({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const l=Math.min(Math.max(e,1),5),[a,u]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState(Array(l).fill(!1)),[g,m]=w.useState(Array(l).fill(!1)),b=w.useRef([]),C=w.useCallback(y=>{const _=r.filter(A=>!y.includes(A._id));if(_.length===0)return null;const S=Math.floor(Math.random()*_.length);return _[S]},[r]),v=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const y=[],_=[],S=[];for(let A=0;A<l&&A<r.length;A++){const I=C(S);I&&(y.push(I),S.push(I._id))}for(let A=0;A<y.length;A++){const I=[y[A]._id,...y.filter((N,j)=>j!==A).map(N=>N._id)],B=C(I);B?_.push(B):_.push(y[A])}u(y),d(_)},[r,l,C]);const E=w.useCallback(y=>{const _=v(),S=setTimeout(()=>{h(A=>{const I=[...A];return I[y]=!I[y],I}),setTimeout(()=>{m(A=>{const I=[...A];return I[y]=!I[y],I}),setTimeout(()=>{const A=!g[y];A&&u(I=>{const B=[...I];return B[y]=c[y],B}),d(I=>{const B=[...I],j=[(A?c[y]:a[y])._id,...a.filter(($,X)=>X!==y).map($=>$._id),...I.filter(($,X)=>X!==y).map($=>$._id)],L=C(j);return L&&(B[y]=L),B}),setTimeout(()=>{E(y)},150)},200)},150)},_);b.current[y]=S},[v,C,a,c,g]),D=w.useRef(!1);w.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!D.current){D.current=!0;for(let y=0;y<a.length;y++)E(y);return()=>{b.current.forEach(y=>clearTimeout(y)),b.current=[],D.current=!1}}},[a.length,r.length]);const k=y=>{s&&s(y)};return r.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"Loading..."})}):p.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:a.map((y,_)=>{const S=c[_],A=g[_];return p.jsx("div",{className:`relative ${fu[o]}`,style:{perspective:"1000px"},onClick:()=>k(A?S:y),children:p.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[_]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?0:1},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:y.data.image,alt:y.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:y.title})})]})}),S&&p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?1:0},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${_}`)})})}function vr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,a)=>String.fromCharCode(parseInt(a,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const pu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function gu({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:a,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:g,onError:m,onLoad:b,renderItem:C,renderDetail:v,renderActions:E,renderEmpty:D,renderLoading:k,theme:y={}}){const _={...pu,...y},[S,A]=w.useState([]),[I,B]=w.useState(!1),[N,j]=w.useState(null),[L,$]=w.useState(new Set),[X,ce]=w.useState(null),[ve,le]=w.useState(null),[Le,me]=w.useState(null),[he,ye]=w.useState(!1),[xe,Se]=w.useState(""),pe=a!==void 0?a:xe,Ce=K=>{u?u(K):Se(K)},Ne=w.useMemo(()=>{if(!pe.trim())return S;const K=pe.toLowerCase();return S.filter(J=>vr(J.from).toLowerCase().includes(K)||vr(J.subject).toLowerCase().includes(K))},[S,pe]),ae=w.useMemo(()=>e?new ul({baseUrl:r,system_id:e}):null,[r,e]),Re=w.useCallback(async()=>{if(ae){B(!0),j(null);try{const K=await ae.listEmails(t,n,s);K!=null&&K.messages&&(A(K.messages),b==null||b(K.messages))}catch(K){const J=K instanceof Error?K:new Error("Failed to fetch emails");j(J.message),m==null||m(J)}B(!1)}},[ae,t,n,s,m,b]);w.useEffect(()=>{A([]),$(new Set),le(null),j(null),a===void 0&&Se(""),d&&Re()},[s,d]);const ot=w.useCallback(async K=>{if(ae){le(K),me(null),ye(!0);try{const J=await ae.getEmailParsed(t,K.uid,s||"INBOX");J!=null&&J.body&&me(J.body)}catch(J){console.error("Failed to fetch email body:",J)}ye(!1)}},[ae,t,s]),St=w.useCallback(K=>{f==null||f(K),i&&ot(K)},[f,i,ot]),Mt=w.useCallback((K,J,Ae)=>{if(!o){f==null||f(K),i&&ot(K);return}const Pe=K.uid;if(Ae.shiftKey&&X!==null){const Oe=Math.min(X,J),mt=Math.max(X,J),q=S.slice(Oe,mt+1).map(H=>H.uid),T=new Set(q);$(T),h==null||h(Array.from(T))}else if(Ae.ctrlKey||Ae.metaKey)$(Oe=>{const mt=new Set(Oe);return mt.has(Pe)?mt.delete(Pe):mt.add(Pe),h==null||h(Array.from(mt)),mt}),ce(J);else{const Oe=new Set([Pe]);$(Oe),ce(J),h==null||h(Array.from(Oe))}},[o,X,S,L,f,h,i]),tt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.trashEmails(t,Array.from(L),K);if(console.log("Trash result:",J),J.success&&J.moved>0){A(Pe=>Pe.filter(Oe=>!L.has(Oe.uid)));const Ae=Array.from(L);$(new Set),g==null||g(Ae)}else j("Failed to move emails to trash")}catch(J){const Ae=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),pt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.archiveEmails(t,Array.from(L),K);if(console.log("Archive result:",J),J.success&&J.archived>0){A(Pe=>Pe.filter(Oe=>!L.has(Oe.uid)));const Ae=Array.from(L);$(new Set),g==null||g(Ae)}else j("Failed to archive emails")}catch(J){const Ae=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),ct=w.useCallback(()=>{if(L.size===S.length)$(new Set),h==null||h([]);else{const K=new Set(S.map(J=>J.uid));$(K),h==null||h(Array.from(K))}},[S,L.size,h]),Ht=w.useCallback(()=>{$(new Set),h==null||h([])},[h]),It={delete:tt,archive:pt,refresh:Re,selectAll:ct,clearSelection:Ht},Et=K=>{if(!K)return"";const J=new Date(K),Ae=new Date;return J.toDateString()===Ae.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},kt=(K,J)=>p.jsx("div",{style:{padding:"12px 16px",background:J?_.selectedBackground:K.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:vr(K.from).split("@")[0]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:500,color:K.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:vr(K.subject)||"(No subject)"})]}),p.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:Et(K.date)})]})}),lt=K=>p.jsxs("div",{style:{padding:"24px"},children:[p.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:vr(K.subject)||"(No subject)"}),p.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",vr(K.from)," • ",new Date(K.date).toLocaleString()]}),he?p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"Loading..."}):Le?p.jsx("div",{style:{fontSize:"14px",color:_.text},dangerouslySetInnerHTML:{__html:Le}}):p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"No content available"})]}),gt=(K,J)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[p.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:K.length===S.length?"Deselect All":"Select All"}),K.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[K.length," selected"]}),p.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),p.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:c}),we=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),ke=C||kt,Ee=v||lt,At=E||gt,Tt=D||W,$t=k||we;return I&&S.length===0?p.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:$t()}):p.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[p.jsxs("div",{style:{flex:i&&ve?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&ve?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[o&&At(Array.from(L),It),l&&p.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${_.border}`,background:_.background},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:[p.jsx("circle",{cx:"11",cy:"11",r:"8"}),p.jsx("path",{d:"M21 21l-4.35-4.35"})]}),p.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:pe,onChange:K=>Ce(K.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:_.text}}),pe&&p.jsx("button",{onClick:()=>Ce(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:p.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:N}),p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ne.length===0?Tt():Ne.map((K,J)=>p.jsx("div",{onClick:Ae=>Mt(K,J,Ae),onDoubleClick:()=>St(K),children:ke(K,L.has(K.uid))},K.uid))})]}),i&&ve&&p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ee(ve)})]})}function mu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:a=""}){const[u,c]=w.useState(new Set),[d,f]=w.useState(-1),h=r.filter(D=>u.has(D.id)),g=d>=0&&d<h.length?h[d]:null,m=w.useCallback(D=>{c(k=>{const y=new Set(k);return y.has(D)?y.delete(D):y.add(D),t==null||t(Array.from(y)),y})},[t]),b=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,u.size,t,n]),C=w.useCallback(()=>{if(h.length===0)return;const D=d<=0?h.length-1:d-1;f(D),n==null||n(h[D],D)},[h,d,n]),v=w.useCallback(()=>{if(h.length===0)return;const D=d>=h.length-1?0:d+1;f(D),n==null||n(h[D],D)},[h,d,n]),E=w.useCallback(D=>{s==null||s(D,h,g)},[s,h,g]);return w.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?p.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:i}):p.jsxs("div",{className:`space-y-2 ${a}`,children:[p.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsxs("button",{onClick:b,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[p.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),p.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&p.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:C,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),p.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),p.jsx("button",{onClick:v,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),p.jsx("div",{className:"space-y-1",children:r.map(D=>{const k=u.has(D.id),y=(g==null?void 0:g.id)===D.id;return p.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${y?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[p.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),p.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,y)})]},D.id)})}),o.length>0&&u.size>0&&p.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var y;const k=((y=D.disabled)==null?void 0:y.call(D,h))??!1;return p.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&p.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function yu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xu=yu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const hl=w.createContext(null);function bu(r,e){return{getTheme:function(){return e??null}}}function wt(){const r=w.useContext(hl);return r==null&&xu(8),r}function hn(r){return{}}const ci={},_u={},pl={},ur={},kr={},on={},Ar={},os={},zs={},ln={},an={},vt={},di={},fi={},vu={},gl={},Cu={},ml={},wu={},yl={},xl={},$n={},Du={},bl={},_l={},vl={},Su={},Eu={},ku={},Ji={},Cl={},Au={},wl={},Dl={},Tu={},ls={},hi={},qs={},Bu={},Nu={},kn={},An={},Fu={},ju={},Lu={},Dt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ru=Dt&&"documentMode"in document?document.documentMode:null,xt=Dt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),tr=Dt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zn=!(!Dt||!("InputEvent"in window)||Ru)&&"getTargetRanges"in new window.InputEvent("input"),as=Dt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pn=Dt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pu=Dt&&/Android/.test(navigator.userAgent),Sl=Dt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ou=Dt&&Pu&&Sl,pi=Dt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Sl,gn=1,nr=3,fr=0,El=1,Nr=2,Mu=0,Iu=1,$u=2,qn=4,Un=8,gi=128,zu=112|(3|qn|Un)|gi,mi=1,yi=2,xi=3,bi=4,_i=5,vi=6,us=as||pn||pi?" ":"​",Wt=`
61
+ `,children:[a&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:a,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),u&&p.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&p.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&p.jsx("div",{className:"flex-shrink-0 text-gray-400",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function pu({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&p.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),p.jsxs("div",{className:"p-6",children:[i&&p.jsx("div",{className:"mb-6",children:p.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&p.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),p.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&p.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:p.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const gu={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function mu({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const l=Math.min(Math.max(e,1),5),[a,u]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState(Array(l).fill(!1)),[g,m]=w.useState(Array(l).fill(!1)),b=w.useRef([]),C=w.useCallback(y=>{const _=r.filter(A=>!y.includes(A._id));if(_.length===0)return null;const S=Math.floor(Math.random()*_.length);return _[S]},[r]),v=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const y=[],_=[],S=[];for(let A=0;A<l&&A<r.length;A++){const I=C(S);I&&(y.push(I),S.push(I._id))}for(let A=0;A<y.length;A++){const I=[y[A]._id,...y.filter((N,j)=>j!==A).map(N=>N._id)],B=C(I);B?_.push(B):_.push(y[A])}u(y),d(_)},[r,l,C]);const E=w.useCallback(y=>{const _=v(),S=setTimeout(()=>{h(A=>{const I=[...A];return I[y]=!I[y],I}),setTimeout(()=>{m(A=>{const I=[...A];return I[y]=!I[y],I}),setTimeout(()=>{const A=!g[y];A&&u(I=>{const B=[...I];return B[y]=c[y],B}),d(I=>{const B=[...I],j=[(A?c[y]:a[y])._id,...a.filter(($,X)=>X!==y).map($=>$._id),...I.filter(($,X)=>X!==y).map($=>$._id)],L=C(j);return L&&(B[y]=L),B}),setTimeout(()=>{E(y)},150)},200)},150)},_);b.current[y]=S},[v,C,a,c,g]),D=w.useRef(!1);w.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!D.current){D.current=!0;for(let y=0;y<a.length;y++)E(y);return()=>{b.current.forEach(y=>clearTimeout(y)),b.current=[],D.current=!1}}},[a.length,r.length]);const k=y=>{s&&s(y)};return r.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"Loading..."})}):p.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:a.map((y,_)=>{const S=c[_],A=g[_];return p.jsx("div",{className:`relative ${gu[o]}`,style:{perspective:"1000px"},onClick:()=>k(A?S:y),children:p.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[_]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?0:1},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:y.data.image,alt:y.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:y.title})})]})}),S&&p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?1:0},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${_}`)})})}function Cr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,a)=>String.fromCharCode(parseInt(a,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const yu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function xu({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:a,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:g,onError:m,onLoad:b,renderItem:C,renderDetail:v,renderActions:E,renderEmpty:D,renderLoading:k,theme:y={}}){const _={...yu,...y},[S,A]=w.useState([]),[I,B]=w.useState(!1),[N,j]=w.useState(null),[L,$]=w.useState(new Set),[X,ce]=w.useState(null),[ve,le]=w.useState(null),[Le,me]=w.useState(null),[he,ye]=w.useState(!1),[xe,Se]=w.useState(""),pe=a!==void 0?a:xe,Ce=K=>{u?u(K):Se(K)},Ne=w.useMemo(()=>{if(!pe.trim())return S;const K=pe.toLowerCase();return S.filter(J=>Cr(J.from).toLowerCase().includes(K)||Cr(J.subject).toLowerCase().includes(K))},[S,pe]),ae=w.useMemo(()=>e?new cl({baseUrl:r,system_id:e}):null,[r,e]),Re=w.useCallback(async()=>{if(ae){B(!0),j(null);try{const K=await ae.listEmails(t,n,s);K!=null&&K.messages&&(A(K.messages),b==null||b(K.messages))}catch(K){const J=K instanceof Error?K:new Error("Failed to fetch emails");j(J.message),m==null||m(J)}B(!1)}},[ae,t,n,s,m,b]);w.useEffect(()=>{A([]),$(new Set),le(null),j(null),a===void 0&&Se(""),d&&Re()},[s,d]);const ot=w.useCallback(async K=>{if(ae){le(K),me(null),ye(!0);try{const J=await ae.getEmailParsed(t,K.uid,s||"INBOX");J!=null&&J.body&&me(J.body)}catch(J){console.error("Failed to fetch email body:",J)}ye(!1)}},[ae,t,s]),St=w.useCallback(K=>{f==null||f(K),i&&ot(K)},[f,i,ot]),Mt=w.useCallback((K,J,Ae)=>{if(!o){f==null||f(K),i&&ot(K);return}const Pe=K.uid;if(Ae.shiftKey&&X!==null){const Oe=Math.min(X,J),mt=Math.max(X,J),q=S.slice(Oe,mt+1).map(H=>H.uid),T=new Set(q);$(T),h==null||h(Array.from(T))}else if(Ae.ctrlKey||Ae.metaKey)$(Oe=>{const mt=new Set(Oe);return mt.has(Pe)?mt.delete(Pe):mt.add(Pe),h==null||h(Array.from(mt)),mt}),ce(J);else{const Oe=new Set([Pe]);$(Oe),ce(J),h==null||h(Array.from(Oe))}},[o,X,S,L,f,h,i]),tt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.trashEmails(t,Array.from(L),K);if(console.log("Trash result:",J),J.success&&J.moved>0){A(Pe=>Pe.filter(Oe=>!L.has(Oe.uid)));const Ae=Array.from(L);$(new Set),g==null||g(Ae)}else j("Failed to move emails to trash")}catch(J){const Ae=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),pt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.archiveEmails(t,Array.from(L),K);if(console.log("Archive result:",J),J.success&&J.archived>0){A(Pe=>Pe.filter(Oe=>!L.has(Oe.uid)));const Ae=Array.from(L);$(new Set),g==null||g(Ae)}else j("Failed to archive emails")}catch(J){const Ae=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),ct=w.useCallback(()=>{if(L.size===S.length)$(new Set),h==null||h([]);else{const K=new Set(S.map(J=>J.uid));$(K),h==null||h(Array.from(K))}},[S,L.size,h]),Jt=w.useCallback(()=>{$(new Set),h==null||h([])},[h]),It={delete:tt,archive:pt,refresh:Re,selectAll:ct,clearSelection:Jt},Et=K=>{if(!K)return"";const J=new Date(K),Ae=new Date;return J.toDateString()===Ae.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},kt=(K,J)=>p.jsx("div",{style:{padding:"12px 16px",background:J?_.selectedBackground:K.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Cr(K.from).split("@")[0]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:500,color:K.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Cr(K.subject)||"(No subject)"})]}),p.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:Et(K.date)})]})}),lt=K=>p.jsxs("div",{style:{padding:"24px"},children:[p.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:Cr(K.subject)||"(No subject)"}),p.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",Cr(K.from)," • ",new Date(K.date).toLocaleString()]}),he?p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"Loading..."}):Le?p.jsx("div",{style:{fontSize:"14px",color:_.text},dangerouslySetInnerHTML:{__html:Le}}):p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"No content available"})]}),gt=(K,J)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[p.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:K.length===S.length?"Deselect All":"Select All"}),K.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[K.length," selected"]}),p.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),p.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:c}),we=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),ke=C||kt,Ee=v||lt,At=E||gt,Tt=D||W,$t=k||we;return I&&S.length===0?p.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:$t()}):p.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[p.jsxs("div",{style:{flex:i&&ve?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&ve?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[o&&At(Array.from(L),It),l&&p.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${_.border}`,background:_.background},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:[p.jsx("circle",{cx:"11",cy:"11",r:"8"}),p.jsx("path",{d:"M21 21l-4.35-4.35"})]}),p.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:pe,onChange:K=>Ce(K.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:_.text}}),pe&&p.jsx("button",{onClick:()=>Ce(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:p.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:N}),p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ne.length===0?Tt():Ne.map((K,J)=>p.jsx("div",{onClick:Ae=>Mt(K,J,Ae),onDoubleClick:()=>St(K),children:ke(K,L.has(K.uid))},K.uid))})]}),i&&ve&&p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ee(ve)})]})}function bu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:a=""}){const[u,c]=w.useState(new Set),[d,f]=w.useState(-1),h=r.filter(D=>u.has(D.id)),g=d>=0&&d<h.length?h[d]:null,m=w.useCallback(D=>{c(k=>{const y=new Set(k);return y.has(D)?y.delete(D):y.add(D),t==null||t(Array.from(y)),y})},[t]),b=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,u.size,t,n]),C=w.useCallback(()=>{if(h.length===0)return;const D=d<=0?h.length-1:d-1;f(D),n==null||n(h[D],D)},[h,d,n]),v=w.useCallback(()=>{if(h.length===0)return;const D=d>=h.length-1?0:d+1;f(D),n==null||n(h[D],D)},[h,d,n]),E=w.useCallback(D=>{s==null||s(D,h,g)},[s,h,g]);return w.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?p.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:i}):p.jsxs("div",{className:`space-y-2 ${a}`,children:[p.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsxs("button",{onClick:b,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[p.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),p.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&p.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:C,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),p.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),p.jsx("button",{onClick:v,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),p.jsx("div",{className:"space-y-1",children:r.map(D=>{const k=u.has(D.id),y=(g==null?void 0:g.id)===D.id;return p.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${y?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[p.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),p.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,y)})]},D.id)})}),o.length>0&&u.size>0&&p.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var y;const k=((y=D.disabled)==null?void 0:y.call(D,h))??!1;return p.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&p.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function _u(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var vu=_u(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const pl=w.createContext(null);function Cu(r,e){return{getTheme:function(){return e??null}}}function wt(){const r=w.useContext(pl);return r==null&&vu(8),r}function hn(r){return{}}const di={},wu={},gl={},cr={},Ar={},on={},Tr={},os={},qs={},ln={},an={},vt={},fi={},hi={},Du={},ml={},Su={},yl={},Eu={},xl={},bl={},$n={},ku={},_l={},vl={},Cl={},Au={},Tu={},Bu={},Qi={},wl={},Nu={},Dl={},Sl={},Fu={},ls={},pi={},Us={},ju={},Lu={},kn={},An={},Ru={},Pu={},Ou={},Dt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Mu=Dt&&"documentMode"in document?document.documentMode:null,xt=Dt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),rr=Dt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zn=!(!Dt||!("InputEvent"in window)||Mu)&&"getTargetRanges"in new window.InputEvent("input"),as=Dt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pn=Dt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Iu=Dt&&/Android/.test(navigator.userAgent),El=Dt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$u=Dt&&Iu&&El,gi=Dt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!El,gn=1,sr=3,hr=0,kl=1,Fr=2,zu=0,qu=1,Uu=2,qn=4,Un=8,mi=128,Wu=112|(3|qn|Un)|mi,yi=1,xi=2,bi=3,_i=4,vi=5,Ci=6,us=as||pn||gi?" ":"​",Gt=`
62
62
 
63
- `,qu=tr?" ":us,kl="֑-߿יִ-﷽ﹰ-ﻼ",Al="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Uu=new RegExp("^[^"+Al+"]*["+kl+"]"),Wu=new RegExp("^[^"+kl+"]*["+Al+"]"),hr={bold:1,code:16,highlight:gi,italic:2,strikethrough:qn,subscript:32,superscript:64,underline:Un},Gu={directionless:1,unmergeable:2},Qi={center:yi,end:vi,justify:bi,left:mi,right:xi,start:_i},Ku={[yi]:"center",[vi]:"end",[bi]:"justify",[mi]:"left",[xi]:"right",[_i]:"start"},Vu={normal:0,segmented:2,token:1},Hu={[Mu]:"normal",[$u]:"segmented",[Iu]:"token"};function Ju(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var M=Ju(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Wn(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const Qu=100;let Us=!1,Ci=0;function Yu(r){Ci=r.timeStamp}function As(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ds(r,t)!==void 0}function Xu(r,e,t){const n=ht(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&ki(e,i,s,o,!1)}function Zu(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===nr&&t.isAttached()}function ec(r,e,t,n){for(let s=r;s&&!hc(s);s=yn(s)){const o=ds(s,e);if(o!==void 0){const i=Qe(o,t);if(i)return _e(i)?void 0:[s,i]}else if(s===n)return[n,Ol(t)]}}function Tl(r,e,t){Us=!0;const n=performance.now()-Ci>Qu;try{at(r,()=>{const s=V()||function(f){return f.getEditorState().read(()=>{const h=V();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,a=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,m=h.target,b=ec(m,r,l,i);if(!b)continue;const[C,v]=b;if(g==="characterData")n&&z(v)&&Zu(s,m,v)&&Xu(m,v,r);else if(g==="childList"){u=!0;const E=h.addedNodes;for(let y=0;y<E.length;y++){const _=E[y],S=Rl(_),A=_.parentNode;if(A!=null&&_!==a&&S===null&&!As(_,A,r)){if(tr){const I=_.innerText||_.nodeValue;I&&(c+=I)}A.removeChild(_)}}const D=h.removedNodes,k=D.length;if(k>0){let y=0;for(let _=0;_<k;_++){const S=D[_];(As(S,m,r)||a===S)&&(m.appendChild(S),y++)}k!==y&&o.set(C,v)}}}if(o.size>0)for(const[f,h]of o)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,m=h.target;for(let b=0;b<g.length;b++){const C=g[b],v=C.parentNode;v==null||C.nodeName!=="BR"||As(C,m,r)||v.removeChild(C)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,Lt(s)),tr&&zl(r)&&s.insertRawText(c))})}finally{Us=!1}}function Bl(r){const e=r._observer;e!==null&&Tl(r,e.takeRecords(),e)}function Nl(r){(function(e){Ci===0&&hs(e).addEventListener("textInput",Yu,!0)})(r),r._observer=new MutationObserver((e,t)=>{Tl(r,e,t)})}function Yi(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==l)}function Xi(r,e){const t=r.mergeWithSibling(e),n=je()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Zi(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Yi(e,n)){n=Xi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Yi(n,t)){n=Xi(n,t);break}break}t.remove()}}else n.remove()}function Fl(r){return eo(r.anchor),eo(r.focus),r}function eo(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let tc=1;const rc=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function wi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return _e(Fr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&cs(e)==null)}function mn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!wi(e)&&jl(e)===r}catch{return!1}}function Di(r){return r instanceof xs}function jl(r){let e=r;for(;e!=null;){const t=cs(e);if(Di(t))return t;e=yn(e)}return null}function cs(r){return r?r.__lexicalEditor:null}function lr(r){return r.isToken()||r.isSegmented()}function nc(r){return r.nodeType===nr}function Gn(r){let e=r;for(;e!=null;){if(nc(e))return e;e=e.firstChild}return null}function Kn(r,e,t){const n=hr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Ll(r){return z(r)||dr(r)||_e(r)}function sc(r,e){if(e!=null)return void(r.__key=e);nt(),aa();const t=je(),n=Kt(),s=""+tc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=El,r.__key=s}function cr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Vn(r){aa();const e=r.getLatest(),t=e.__parent,n=Kt(),s=je(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(a,u,c){let d=a;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,o,i);const l=e.__key;s._dirtyType=El,F(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function Ve(r){nt();const e=je(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Qe(t);n!==null&&n.getWritable()}if(r!==null){const n=Qe(r);n!==null&&n.getWritable()}}}function Xt(){return Cn()?null:je()._compositionKey}function Qe(r,e){const t=(e||Kt())._nodeMap.get(r);return t===void 0?null:t}function Rl(r,e){const t=ds(r,je());return t!==void 0?Qe(t,e):null}function ds(r,e){return r[`__lexicalKey_${e._key}`]}function Fr(r,e){let t=r;for(;t!=null;){const n=Rl(t,e);if(n!==null)return n;t=yn(t)}return null}function Pl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function to(r){return r.read(()=>Be().getTextContent())}function Be(){return Ol(Kt())}function Ol(r){return r._nodeMap.get("root")}function Lt(r){nt();const e=Kt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Sr(r){const e=je(),t=function(n,s){let o=n;for(;o!=null;){const i=ds(o,s);if(i!==void 0)return i;o=yn(o)}return null}(r,e);return t===null?r===e.getRootElement()?Qe("root"):null:Qe(t)}function ro(r,e){return e?r.getTextContentSize():0}function Ml(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Si(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Il(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function $l(r){return r.nodeType===nr?r.nodeValue:null}function Ei(r,e,t){const n=ht(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=$l(s);const a=Fr(s);if(l!==null&&z(a)){if(l===us&&t){const u=t.length;l=t,o=u,i=u}l!==null&&ki(a,l,o,i,r)}}}function ki(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let l=e;(i||s)&&e[e.length-1]===us&&(l=e.slice(0,-1));const a=o.getTextContent();if(s||l!==a){if(l===""){if(Ve(null),as||pn||pi)o.remove();else{const m=je();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const u=o.getParent(),c=vn(),d=o.getTextContentSize(),f=Xt(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||P(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===d&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const g=V();if(!P(g)||t===null||n===null)return void o.setTextContent(l);if(g.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=Ue(o.getTextContent());o.replace(m),o=m}o.setTextContent(l)}}}function ic(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(o){const i=o.getPreviousSibling();return(z(i)||F(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function no(r){return r==="ArrowLeft"}function so(r){return r==="ArrowRight"}function Vr(r,e){return xt?r:e}function io(r){return r==="Enter"}function zr(r){return r==="Backspace"}function qr(r){return r==="Delete"}function oo(r,e,t){return r.toLowerCase()==="a"&&Vr(e,t)}function oc(){const r=Be();Lt(Fl(r.select(0,r.getChildrenSize())))}function Zr(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const o=Wn(s);return t[e]=o,o}return s}function Ai(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&M(33,o);const a=l.klass;let u=r.get(a);u===void 0&&(u=new Map,r.set(a,u));const c=u.get(i),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(i,d?"updated":s)}function lo(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function un(r,e){const t=r.offset;if(r.type==="element")return lo(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?lo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function zl(r){const e=hs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return da(r,e,t)}function fs(r){return!Ze(r)&&!r.isLastChild()&&!r.isInline()}function Hn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&M(75,e),t}function yn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function en(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function hs(r){const e=r._window;return e===null&&M(78),e}function lc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Rt(e))return e;e=e.getParentOrThrow()}return e}function Rt(r){return Ze(r)||F(r)&&r.isShadowRoot()}function Ot(r){const e=je(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&M(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),l=i.constructor;return o!==null?i instanceof o||M(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||M(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&M(203,r.constructor.name,t,l.name,l.getType()),i}return r}function Ts(r,e){!Ze(r.getParent())||F(e)||_e(e)||M(99)}function Bs(r){return(_e(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Ti(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function ac(r,e,t){let n=r._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let l=!1,a=null;if(i===o.getChildrenSize())Bs(o.getChildAtIndex(i-1))&&(l=!0);else{const u=o.getChildAtIndex(i);if(u!==null&&Bs(u)){const c=u.getPreviousSibling();(c===null||Bs(c))&&(l=!0,a=r.getElementByKey(u.__key))}}if(l){const u=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Wn(h);h=d.blockCursor=g}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(a===null?u.appendChild(n):u.insertBefore(n,a))}}n!==null&&Ti(n,r,e)}function ht(r){return Dt?(r||window).getSelection():null}function uc(r){return Gt(r)&&r.tagName==="A"}function Gt(r){return r.nodeType===1}function ao(r){return r.nodeType===11}function Ws(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function Jn(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Qt(r){if(_e(r)&&!r.isInline())return!0;if(!F(r)||Rt(r))return!1;const e=r.getFirstChild(),t=e===null||dr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Ur(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function cc(){return je()}const uo=new WeakMap,dc=new Map;function fc(r){if(!r._readOnly&&r.isEmpty())return dc;r._readOnly||M(192);let e=uo.get(r);if(!e){e=new Map,uo.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function Bi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function Ni(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function hc(r){return r.__lexicalUnmanaged===!0}function ql(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(F(i)&&ql(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let rr,et,cn,ps,Gs,Ks,pr,Ct,Vs,dn,We="",Xe="",Bt=null,bt="",Ut="",Ul=!1,fn=!1,Pn=null;function Qn(r,e){const t=pr.get(r);if(e!==null){const n=Qs(r);n.parentNode===e&&e.removeChild(n)}if(Ct.has(r)||et._keyToDOMMap.delete(r),F(t)){const n=Xn(t,pr);Hs(n,0,n.length-1,null)}t!==void 0&&Ai(dn,cn,ps,t,"destroyed")}function Hs(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Qn(o,n)}}function or(r,e){r.setProperty("text-align",e)}const pc="40px";function Wl(r,e){const t=rr.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||pc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Gl(r,e){const t=r.style;e===0?or(t,""):e===mi?or(t,"left"):e===yi?or(t,"center"):e===xi?or(t,"right"):e===bi?or(t,"justify"):e===_i?or(t,"start"):e===vi&&or(t,"end")}function Yn(r,e){const t=Ct.get(r);t===void 0&&M(60);const n=t.createDOM(rr,et);if(function(s,o,i){const l=i._keyToDOMMap;(function(a,u,c){a[`__lexicalKey_${u._key}`]=c})(o,i,s),l.set(s,o)}(r,n,et),z(t)?n.setAttribute("data-lexical-text","true"):_e(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,o=t.__size;if(s!==0&&Wl(n,s),o!==0){const l=o-1;(function(a,u,c,d){const f=Xe;Xe="",Js(a,c,0,u,c.getDOMSlot(d)),Vl(c,d),Xe=f})(Xn(t,Ct),l,t,n)}const i=t.__format;i!==0&&Gl(n,i),t.isInline()||Kl(null,t,n),fs(t)&&(We+=Wt,Ut+=Wt)}else{const s=t.getTextContent();if(_e(t)){const o=t.decorate(et,rr);o!==null&&Hl(r,o),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(Xe+=s));We+=s,Ut+=s}return e!==null&&e.insertChild(n),Ai(dn,cn,ps,t,"created"),n}function Js(r,e,t,n,s){const o=We;We="";let i=t;for(;i<=n;++i){Yn(r[i],s);const l=Ct.get(r[i]);l!==null&&z(l)&&(Bt===null&&(Bt=l.getFormat()),bt===""&&(bt=l.getStyle()))}fs(e)&&(We+=Wt),s.element.__lexicalTextContent=We,We=o+We}function co(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return dr(n)?"line-break":_e(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Kl(r,e,t){const n=co(r,pr),s=co(e,Ct);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Vl(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==Xe||n!==Pn){const o=Xe==="",i=o?Pn:(s=Xe,Uu.test(s)?"rtl":Wu.test(s)?"ltr":null);if(i!==n){const l=e.classList,a=rr.theme;let u=n!==null?a[n]:void 0,c=i!==null?a[i]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Wn(u);u=a[n]=d}l.remove(...u)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Wn(c);c=a[i]=d}c!==void 0&&l.add(...c)}e.dir=i}fn||(r.getWritable().__dir=i)}Pn=i,e.__lexicalDirTextContent=Xe,e.__lexicalDir=i}var s}function gc(r,e,t){const n=Xe;var s;Xe="",Bt=null,bt="",function(o,i,l){const a=We,u=o.__size,c=i.__size;We="";const d=l.element;if(u===1&&c===1){const f=o.__first,h=i.__first;if(f===h)Hr(f,d);else{const m=Qs(f),b=Yn(h,null);try{d.replaceChild(b,m)}catch(C){if(typeof C=="object"&&C!=null){const v=`${C.toString()} Parent: ${d.tagName}, new child: {tag: ${b.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(v)}throw C}Qn(f,null)}const g=Ct.get(h);z(g)&&(Bt===null&&(Bt=g.getFormat()),bt===""&&(bt=g.getStyle()))}else{const f=Xn(o,pr),h=Xn(i,Ct);if(f.length!==u&&M(227),h.length!==c&&M(228),u===0)c!==0&&Js(h,i,0,c-1,l);else if(c===0){if(u!==0){const g=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Hs(f,0,u-1,g?null:d),g&&(d.textContent="")}}else(function(g,m,b,C,v,E){const D=C-1,k=v-1;let y,_,S=E.getFirstChild(),A=0,I=0;for(;A<=D&&I<=k;){const j=m[A],L=b[I];if(j===L)S=Ns(Hr(L,E.element)),A++,I++;else{y===void 0&&(y=new Set(m)),_===void 0&&(_=new Set(b));const X=_.has(j),ce=y.has(L);if(X)if(ce){const ve=Hn(et,L);ve===S?S=Ns(Hr(L,E.element)):(E.withBefore(S).insertChild(ve),Hr(L,E.element)),A++,I++}else Yn(L,E.withBefore(S)),I++;else S=Ns(Qs(j)),Qn(j,E.element),A++}const $=Ct.get(L);$!==null&&z($)&&(Bt===null&&(Bt=$.getFormat()),bt===""&&(bt=$.getStyle()))}const B=A>D,N=I>k;if(B&&!N){const j=b[k+1],L=j===void 0?null:et.getElementByKey(j);Js(b,g,I,k,E.withBefore(L))}else N&&!B&&Hs(m,A,D,E.element)})(i,f,h,u,c,l)}fs(i)&&(We+=Wt),d.__lexicalTextContent=We,We=a+We}(r,e,e.getDOMSlot(t)),Vl(e,t),jr(s=e)&&Bt!=null&&Bt!==s.__textFormat&&!fn&&(s.setTextFormat(Bt),s.setTextStyle(bt)),function(o){jr(o)&&bt!==""&&bt!==o.__textStyle&&!fn&&o.setTextStyle(bt)}(e),Xe=n}function Xn(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&M(101),t.push(n),n=s.__next}return t}function Hr(r,e){const t=pr.get(r);let n=Ct.get(r);t!==void 0&&n!==void 0||M(61);const s=Ul||Ks.has(r)||Gs.has(r),o=Hn(et,r);if(t===n&&!s){if(F(t)){const i=o.__lexicalTextContent;i!==void 0&&(We+=i,Ut+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(Xe+=l)}else{const i=t.getTextContent();z(t)&&!t.isDirectionless()&&(Xe+=i),Ut+=i,We+=i}return o}if(t!==n&&s&&Ai(dn,cn,ps,n,"updated"),n.updateDOM(t,o,rr)){const i=Yn(r,null);return e===null&&M(62),e.replaceChild(i,o),Qn(r,null),i}if(F(t)&&F(n)){const i=n.__indent;i!==t.__indent&&Wl(o,i);const l=n.__format;l!==t.__format&&Gl(o,l),s&&(gc(t,n,o),Ze(n)||n.isInline()||Kl(t,n,o)),fs(n)&&(We+=Wt,Ut+=Wt)}else{const i=n.getTextContent();if(_e(n)){const l=n.decorate(et,rr);l!==null&&Hl(r,l)}else z(n)&&!n.isDirectionless()&&(Xe+=i);We+=i,Ut+=i}if(!fn&&Ze(n)&&n.__cachedText!==Ut){const i=n.getWritable();i.__cachedText=Ut,n=i}return o}function Hl(r,e){let t=et._pendingDecorators;const n=et._decorators;if(t===null){if(n[r]===e)return;t=Pl(et)}t[r]=e}function Ns(r){let e=r.nextSibling;return e!==null&&e===et._blockCursorElement&&(e=e.nextSibling),e}function mc(r,e,t,n,s,o){We="",Ut="",Xe="",Ul=n===Nr,Pn=null,et=t,rr=t._config,cn=t._nodes,ps=et._listeners.mutation,Gs=s,Ks=o,pr=r._nodeMap,Ct=e._nodeMap,fn=e._readOnly,Vs=new Map(t._keyToDOMMap);const i=new Map;return dn=i,Hr("root",null),et=void 0,cn=void 0,Gs=void 0,Ks=void 0,pr=void 0,Ct=void 0,rr=void 0,Vs=void 0,dn=void 0,i}function Qs(r){const e=Vs.get(r);return e===void 0&&M(75,r),e}const qt=Object.freeze({}),Ys=30,Xs=[["keydown",function(r,e){if(tn=r.timeStamp,Jl=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!G(e,vu,r)&&t!=null){if(function(l,a,u,c){return so(l)&&!a&&!c&&!u}(t,s,i,o))G(e,gl,r);else if(function(l,a,u,c,d){return so(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,Cu,r);else if(function(l,a,u,c){return no(l)&&!a&&!c&&!u}(t,s,i,o))G(e,ml,r);else if(function(l,a,u,c,d){return no(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,wu,r);else if(function(l,a,u){return function(c){return c==="ArrowUp"}(l)&&!a&&!u}(t,s,o))G(e,yl,r);else if(function(l,a,u){return function(c){return c==="ArrowDown"}(l)&&!a&&!u}(t,s,o))G(e,xl,r);else if(function(l,a){return io(l)&&a}(t,n))rn=!0,G(e,$n,r);else if(function(l){return l===" "}(t))G(e,Du,r);else if(function(l,a){return xt&&a&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),rn=!0,G(e,kr,!0);else if(function(l,a){return io(l)&&!a}(t,n))rn=!1,G(e,$n,r);else if(function(l,a,u,c){return xt?!a&&!u&&(zr(l)||l.toLowerCase()==="h"&&c):!(c||a||u)&&zr(l)}(t,i,o,s))zr(t)?G(e,bl,r):(r.preventDefault(),G(e,ur,!0));else if(function(l){return l==="Escape"}(t))G(e,_l,r);else if(function(l,a,u,c,d){return xt?!(u||c||d)&&(qr(l)||l.toLowerCase()==="d"&&a):!(a||c||d)&&qr(l)}(t,s,n,i,o))qr(t)?G(e,vl,r):(r.preventDefault(),G(e,ur,!1));else if(function(l,a,u){return zr(l)&&(xt?a:u)}(t,i,s))r.preventDefault(),G(e,ln,!0);else if(function(l,a,u){return qr(l)&&(xt?a:u)}(t,i,s))r.preventDefault(),G(e,ln,!1);else if(function(l,a){return xt&&a&&zr(l)}(t,o))r.preventDefault(),G(e,an,!0);else if(function(l,a){return xt&&a&&qr(l)}(t,o))r.preventDefault(),G(e,an,!1);else if(function(l,a,u,c){return l.toLowerCase()==="b"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),G(e,vt,"bold");else if(function(l,a,u,c){return l.toLowerCase()==="u"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),G(e,vt,"underline");else if(function(l,a,u,c){return l.toLowerCase()==="i"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),G(e,vt,"italic");else if(function(l,a,u,c){return l==="Tab"&&!a&&!u&&!c}(t,i,s,o))G(e,Su,r);else if(function(l,a,u,c){return l.toLowerCase()==="z"&&!a&&Vr(u,c)}(t,n,o,s))r.preventDefault(),G(e,di,void 0);else if(function(l,a,u,c){return xt?l.toLowerCase()==="z"&&u&&a:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&a}(t,n,o,s))r.preventDefault(),G(e,fi,void 0);else{const l=e._editorState._selection;l===null||P(l)?!tr&&oo(t,o,s)&&(r.preventDefault(),G(e,qs,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="c"&&(xt?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,ls,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="x"&&(xt?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,hi,r)):oo(t,o,s)&&(r.preventDefault(),G(e,qs,r))}(function(l,a,u,c){return l||a||u||c})(s,n,i,o)&&G(e,Lu,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&at(e,()=>{_e(Fr(t))||(ei=!0)})}],["compositionstart",function(r,e){at(e,()=>{const t=V();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Ve(n.key),(r.timeStamp<tn+Ys||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Ar,qu)}})}],["compositionend",function(r,e){tr?Wr=!0:at(e,()=>{Fs(e,r.data)})}],["input",function(r,e){r.stopPropagation(),at(e,()=>{const t=V(),n=r.data,s=Zl(r);if(n!=null&&P(t)&&Xl(t,s,n,r.timeStamp,!1)){Wr&&(Fs(e,n),Wr=!1);const o=t.anchor.getNode(),i=ht(e._window);if(i===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,u=l?t.focus.offset:t.anchor.offset;zn&&!t.isCollapsed()&&z(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,a)+n+o.getTextContent().slice(a+u)===$l(i.anchorNode)||G(e,Ar,n);const c=n.length;tr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),as||pn||pi||!e.isComposing()||(tn=0,Ve(null))}else Ei(!1,e,n!==null?n:void 0),Wr&&(Fs(e,n||void 0),Wr=!1);nt(),Bl(je())}),Dr=null}],["click",function(r,e){at(e,()=>{const t=V(),n=ht(e._window),s=vn();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ze(i)&&Be().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(F(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===gn||i===nr)&&Lt(ji(s,n,e,r))}}}G(e,pl,r)})}],["cut",qt],["copy",qt],["dragstart",qt],["dragover",qt],["dragend",qt],["paste",qt],["focus",qt],["blur",qt],["drop",qt]];zn&&Xs.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=Zl(t);s==="deleteCompositionText"||tr&&zl(n)||s!=="insertCompositionText"&&at(n,()=>{const i=V();if(s==="deleteContentBackward"){if(i===null){const h=vn();if(!P(h))return;Lt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Jl==="MediaLast"&&l<tn+Ys&&n.isComposing()&&h){if(Ve(null),tn=0,setTimeout(()=>{at(n,()=>{Ve(null)})},Ys),P(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),z(g)||M(142),i.style=g.getStyle()}}else{Ve(null),t.preventDefault();const g=i.anchor.getNode(),m=g.getTextContent(),b=g.canInsertTextAfter(),C=i.anchor.offset===0&&i.focus.offset===m.length;Ou&&h&&!C&&b||G(n,ur,!0)}return}}var l;if(!P(i))return;const a=t.data;Dr!==null&&Ei(!1,n,Dr),i.dirty&&Dr===null||!i.isCollapsed()||Ze(i.anchor.getNode())||o===null||i.applyDOMRange(o),Dr=null;const u=i.anchor,c=i.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Ar,t);break;case"insertFromComposition":Ve(null),G(n,Ar,t);break;case"insertLineBreak":Ve(null),G(n,kr,!1);break;case"insertParagraph":Ve(null),rn&&!pn?(rn=!1,G(n,kr,!1)):G(n,on,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,os,t);break;case"deleteByComposition":(function(h,g){return h!==g||F(h)||F(g)||!h.isToken()||!g.isToken()})(d,f)&&G(n,zs,t);break;case"deleteByDrag":case"deleteByCut":G(n,zs,t);break;case"deleteContent":G(n,ur,!1);break;case"deleteWordBackward":G(n,ln,!0);break;case"deleteWordForward":G(n,ln,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,an,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,an,!1);break;case"formatStrikeThrough":G(n,vt,"strikethrough");break;case"formatBold":G(n,vt,"bold");break;case"formatItalic":G(n,vt,"italic");break;case"formatUnderline":G(n,vt,"underline");break;case"historyUndo":G(n,di,void 0);break;case"historyRedo":G(n,fi,void 0)}else{if(a===`
64
- `)t.preventDefault(),G(n,kr,!1);else if(a===Wt)t.preventDefault(),G(n,on,void 0);else if(a==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else a!=null&&Xl(i,o,a,t.timeStamp,!0)?(t.preventDefault(),G(n,Ar,a)):Dr=a;Ql=t.timeStamp}})}(r,e)]);let tn=0,Jl=null,Ql=0,Dr=null;const Zn=new WeakMap;let Zs=!1,ei=!1,rn=!1,Wr=!1,Yl=[0,"",0,"root",0];function Xl(r,e,t,n,s){const o=r.anchor,i=r.focus,l=o.getNode(),a=je(),u=ht(a._window),c=u!==null?u.anchorNode:null,d=o.key,f=a.getElementByKey(d),h=t.length;return d!==i.key||!z(l)||(!s&&(!zn||Ql<n+50)||l.isDirty()&&h<2||Ml(t))&&o.offset!==i.offset&&!l.isComposing()||lr(l)||l.isDirty()&&h>1||(s||!zn)&&f!==null&&!l.isComposing()&&c!==Gn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||l.getFormat()!==r.format||l.getStyle()!==r.style||ic(r,l)}function fo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===nr&&e!==0&&e!==r.nodeValue.length}function ho(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;Zs&&(Zs=!1,fo(n,s)&&fo(o,i))||at(e,()=>{if(!t)return void Lt(null);if(!mn(e,n,o))return;const l=V();if(P(l)){const a=l.anchor,u=a.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=hs(e).event,d=c?c.timeStamp:performance.now(),[f,h,g,m,b]=Yl,C=Be(),v=e.isComposing()===!1&&C.getTextContent()==="";if(d<b+200&&a.offset===g&&a.key===m)l.format=f,l.style=h;else if(a.type==="text")z(u)||M(141),l.format=u.getFormat(),l.style=u.getStyle();else if(a.type==="element"&&!v){const E=a.getNode();l.style="",E instanceof Rr&&E.getChildrenSize()===0?(l.format=E.getTextFormat(),l.style=E.getTextStyle()):l.format=0}}else{const c=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),m=g?i:s,b=g?s:i,C=g?d:c,v=g?c:d;let E=zu,D=!1;for(let k=0;k<h;k++){const y=f[k],_=y.getTextContentSize();if(z(y)&&_!==0&&!(k===0&&y.__key===C&&m===_||k===h-1&&y.__key===v&&b===0)&&(D=!0,E&=y.getFormat(),E===0))break}l.format=D?E:0}}G(e,ci,void 0)})}function Zl(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function Fs(r,e){const t=r._compositionKey;if(Ve(null),t!==null&&e!=null){if(e===""){const n=Qe(t),s=Gn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&z(n)&&ki(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
- `){const n=V();if(P(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,$n,null)}}}Ei(!0,r,e)}function ea(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Tr=new Map;function ta(r){const e=r.target,t=ht(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=jl(t.anchorNode);if(n===null)return;ei&&(ei=!1,at(n,()=>{const u=vn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==gn&&d!==nr||Lt(ji(u,t,n,r))}));const s=Si(n),o=s[s.length-1],i=o._key,l=Tr.get(i),a=l||o;a!==n&&ho(t,a,!1),ho(t,n,!0),n!==o?Tr.set(i,n):l&&Tr.delete(i)}function po(r){r._lexicalHandled=!0}function go(r){return r._lexicalHandled===!0}function yc(r){const e=r.ownerDocument,t=Zn.get(e);t===void 0&&M(162);const n=t-1;n>=0||M(164),Zn.set(e,n),n===0&&e.removeEventListener("selectionchange",ta);const s=cs(r);Di(s)?(function(i){if(i._parentEditor!==null){const l=Si(i),a=l[l.length-1]._key;Tr.get(a)===i&&Tr.delete(a)}else Tr.delete(i._key)}(s),r.__lexicalEditor=null):s&&M(198);const o=ea(r);for(let i=0;i<o.length;i++)o[i]();r.__lexicalEventHandles=[]}function ti(r,e,t){nt();const n=r.__key,s=r.getParent();if(s===null)return;const o=function(l){const a=V();if(!P(a)||!F(l))return a;const{anchor:u,focus:c}=a,d=u.getNode(),f=c.getNode();return en(d,l)&&u.set(l.__key,0,"element"),en(f,l)&&c.set(l.__key,0,"element"),a}(r);let i=!1;if(P(o)&&e){const l=o.anchor,a=o.focus;l.key===n&&(ts(l,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0),a.key===n&&(ts(a,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0)}else Nt(o)&&e&&r.isSelected()&&r.selectPrevious();if(P(o)&&e&&!i){const l=r.getIndexWithinParent();cr(r),es(o,s,l,-1)}else cr(r);t||Rt(s)||s.canBeEmpty()||!s.isEmpty()||ti(s,e),e&&Ze(s)&&s.isEmpty()&&s.selectEnd()}class gs{static getType(){M(64,this.name)}static clone(e){M(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,sc(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Qe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||V();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(z(this))return n;if(P(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(_e(this)&&this.isInline()&&s){const o=t.isBackward()?t.focus:t.anchor,i=o.getNode();if(o.offset===i.getChildrenSize()&&i.is(s)&&i.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Qe(e)}getParentOrThrow(){const e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Rt(t))return F(e)||e===this&&_e(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&M(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Qe(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Qe(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();F(this)&&t.unshift(this),F(e)&&n.unshift(e);const s=t.length,o=n.length;if(s===0||o===0||t[s-1]!==n[o-1])return null;const i=new Set(n);for(let l=0;l<s;l++){const a=t[l];if(i.has(a))return a}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,o=this;for(;;){const i=o.getParentOrThrow();if(i===t){n=o.getIndexWithinParent();break}o=i}for(o=e;;){const i=o.getParentOrThrow();if(i===t){s=o.getIndexWithinParent();break}o=i}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let o=this;for(;o!==null;){const i=o.__key;if(s.has(i)||(s.add(i),n.push(o)),o===e)break;const l=F(o)?t?o.getFirstChild():o.getLastChild():null;if(l!==null){o=l;continue}const a=t?o.getNextSibling():o.getPreviousSibling();if(a!==null){o=a;continue}const u=o.getParentOrThrow();if(s.has(u.__key)||n.push(u),u===e)break;let c=null,d=u;do{if(d===null&&M(68),c=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||s.has(d.__key)||n.push(d)}while(c===null);o=c}return t||n.reverse(),n}isDirty(){const e=je()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=Qe(this.__key);return e===null&&M(113),e}getWritable(){nt();const e=Kt(),t=je(),n=e._nodeMap,s=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,l=V();if(l!==null&&l.setCachedNodes(null),i.has(s))return Vn(o),o;const a=Bi(o);return i.add(s),Vn(a),n.set(s,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){M(72)}static importJSON(e){M(18,this.name)}static transform(){return null}remove(e){ti(this,!0,e)}replace(e,t){nt();let n=V();n!==null&&(n=n.clone()),Ts(this,e);const s=this.getLatest(),o=this.__key,i=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),u=a.__size;cr(l);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,g=s.__parent;if(ti(s,!1,!0),c===null?a.__first=i:c.getWritable().__next=i,l.__prev=f,d===null?a.__last=i:d.getWritable().__prev=i,l.__next=h,l.__parent=g,a.__size=u,t&&(F(this)&&F(l)||M(139),this.getChildren().forEach(m=>{l.append(m)})),P(n)){Lt(n);const m=n.anchor,b=n.focus;m.key===o&&bo(m,l),b.key===o&&bo(b,l)}return Xt()===o&&Ve(i),l}insertAfter(e,t=!0){nt(),Ts(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.getParent(),i=V();let l=!1,a=!1;if(o!==null){const h=e.getIndexWithinParent();if(cr(s),P(i)){const g=o.__key,m=i.anchor,b=i.focus;l=m.type==="element"&&m.key===g&&m.offset===h+1,a=b.type==="element"&&b.key===g&&b.offset===h+1}}const u=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(u===null?c.__last=d:u.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&P(i)){const h=this.getIndexWithinParent();es(i,c,h+1);const g=c.__key;l&&i.anchor.set(g,h+2,"element"),a&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){nt(),Ts(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.__key;cr(s);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=n.__prev,u=this.getIndexWithinParent();i===null?l.__first=o:i.getWritable().__next=o,l.__size++,n.__prev=o,s.__prev=a,s.__next=n.__key,s.__parent=n.__parent;const c=V();return t&&P(c)&&es(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return ze()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){nt();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!z(n)){const o=n.getIndexWithinParent()+1;return s.select(o,o)}return n.select(e,t)}selectNext(e,t){nt();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!z(n)){const o=n.getIndexWithinParent();return s.select(o,o)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class xn extends gs{static getType(){return"linebreak"}static clone(e){return new xn(e.__key)}constructor(e){super(e)}getTextContent(){return`
66
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&Jn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Tn(s)){const o=n.lastChild;if(o===t||o.previousSibling===t&&Tn(o))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&Jn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Tn(s))return!1;const o=n.lastChild;if(o===t||o.previousSibling===t&&Tn(o))return!0}return!1}(e)?null:{conversion:xc,priority:0}}}static importJSON(e){return gr()}exportJSON(){return{type:"linebreak",version:1}}}function xc(r){return{node:gr()}}function gr(){return Ot(new xn)}function dr(r){return r instanceof xn}function Tn(r){return r.nodeType===nr&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function js(r,e){return 16&e?"code":e&gi?"mark":32&e?"sub":64&e?"sup":null}function Ls(r,e){return 1&e?"strong":2&e?"em":"span"}function ra(r,e,t,n,s){const o=n.classList;let i=Zr(s,"base");i!==void 0&&o.add(...i),i=Zr(s,"underlineStrikethrough");let l=!1;const a=e&Un&&e&qn;i!==void 0&&(t&Un&&t&qn?(l=!0,a||o.add(...i)):a&&o.remove(...i));for(const u in hr){const c=hr[u];if(i=Zr(s,u),i!==void 0)if(t&c){if(l&&(u==="underline"||u==="strikethrough")){e&c&&o.remove(...i);continue}e&c&&(!a||u!=="underline")&&u!=="strikethrough"||o.add(...i)}else e&c&&o.remove(...i)}}function na(r,e,t){const n=e.firstChild,s=t.isComposing(),o=r+(s?us:"");if(n==null)e.textContent=o;else{const i=n.nodeValue;if(i!==o)if(s||tr){const[l,a,u]=function(c,d){const f=c.length,h=d.length;let g=0,m=0;for(;g<f&&g<h&&c[g]===d[g];)g++;for(;m+g<f&&m+g<h&&c[f-m-1]===d[h-m-1];)m++;return[g,f-g-m,d.slice(g,h-m)]}(i,o);a!==0&&n.deleteData(l,a),n.insertData(l,u)}else n.nodeValue=o}}function mo(r,e,t,n,s,o){na(s,r,e);const i=o.theme.text;i!==void 0&&ra(0,0,n,r,i)}function Bn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Lr extends gs{static getType(){return"text"}static clone(e){return new Lr(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Hu[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Xt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=hr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Kn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=js(0,n),o=Ls(0,n),i=s===null?o:s,l=document.createElement(i);let a=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),s!==null&&(a=document.createElement(o),l.appendChild(a)),mo(a,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(l.style.cssText=u),l}updateDOM(e,t,n){const s=this.__text,o=e.__format,i=this.__format,l=js(0,o),a=js(0,i),u=Ls(0,o),c=Ls(0,i);if((l===null?u:l)!==(a===null?c:a))return!0;if(l===a&&u!==c){const m=t.firstChild;m==null&&M(48);const b=document.createElement(c);return mo(b,this,0,i,s,n),t.replaceChild(b,m),!1}let d=t;a!==null&&l!==null&&(d=t.firstChild,d==null&&M(49)),na(s,d,this);const f=n.theme.text;f!==void 0&&o!==i&&ra(0,o,i,d,f);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Cc,priority:0}),b:()=>({conversion:_c,priority:0}),code:()=>({conversion:Jt,priority:0}),em:()=>({conversion:Jt,priority:0}),i:()=>({conversion:Jt,priority:0}),s:()=>({conversion:Jt,priority:0}),span:()=>({conversion:bc,priority:0}),strong:()=>({conversion:Jt,priority:0}),sub:()=>({conversion:Jt,priority:0}),sup:()=>({conversion:Jt,priority:0}),u:()=>({conversion:Jt,priority:0})}}static importJSON(e){const t=Ue(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Gt(t)||M(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Bn(t,"b")),this.hasFormat("italic")&&(t=Bn(t,"i")),this.hasFormat("strikethrough")&&(t=Bn(t,"s")),this.hasFormat("underline")&&(t=Bn(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?hr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Gu[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Kn(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Vu[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){nt();let n=e,s=t;const o=V(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const a=i.length;n===void 0&&(n=a),s===void 0&&(s=a)}else n=0,s=0;if(!P(o))return oa(l,n,l,s,"text","text");{const a=Xt();a!==o.anchor.key&&a!==o.focus.key||Ve(l),o.setTextNodeRange(this,n,this,s)}return o}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const o=this.getWritable(),i=o.__text,l=n.length;let a=e;a<0&&(a=l+a,a<0&&(a=0));const u=V();if(s&&P(u)){const d=e+l;u.setTextNodeRange(o,d,o,d)}const c=i.slice(0,a)+n+i.slice(a+t);return o.__text=c,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){nt();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,o=Xt(),i=new Set(e),l=[],a=n.length;let u="";for(let k=0;k<a;k++)u!==""&&i.has(k)&&(l.push(u),u=""),u+=n[k];u!==""&&l.push(u);const c=l.length;if(c===0)return[];if(l[0]===n)return[t];const d=l[0],f=t.getParent();let h;const g=t.getFormat(),m=t.getStyle(),b=t.__detail;let C=!1;t.isSegmented()?(h=Ue(d),h.__format=g,h.__style=m,h.__detail=b,C=!0):(h=t.getWritable(),h.__text=d);const v=V(),E=[h];let D=d.length;for(let k=1;k<c;k++){const y=l[k],_=y.length,S=Ue(y).getWritable();S.__format=g,S.__style=m,S.__detail=b;const A=S.__key,I=D+_;if(P(v)){const B=v.anchor,N=v.focus;B.key===s&&B.type==="text"&&B.offset>D&&B.offset<=I&&(B.key=A,B.offset-=D,v.dirty=!0),N.key===s&&N.type==="text"&&N.offset>D&&N.offset<=I&&(N.key=A,N.offset-=D,v.dirty=!0)}o===s&&Ve(A),D=I,E.push(S)}if(f!==null){(function(_){const S=_.getPreviousSibling(),A=_.getNextSibling();S!==null&&Vn(S),A!==null&&Vn(A)})(this);const k=f.getWritable(),y=this.getIndexWithinParent();C?(k.splice(y,0,E),this.remove()):k.splice(y,1,E),P(v)&&es(v,f,y,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);const n=this.__key,s=e.__key,o=this.__text,i=o.length;Xt()===s&&Ve(n);const l=V();if(P(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===s&&(Eo(d,t,n,e,i),l.dirty=!0),f!==null&&f.key===s&&(Eo(f,t,n,e,i),l.dirty=!0)}const a=e.__text,u=t?a+o:o+a;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function bc(r){return{forChild:Fi(r.style),node:null}}function _c(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:Fi(e.style,t?void 0:"bold"),node:null}}const yo=new WeakMap;function vc(r){return r.nodeName==="PRE"||r.nodeType===gn&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Cc(r){const e=r;r.parentElement===null&&M(129);let t=e.textContent||"";if(function(n){let s,o=n.parentNode;const i=[n];for(;o!==null&&(s=yo.get(o))===void 0&&!vc(o);)i.push(o),o=o.parentNode;const l=s===void 0?o:s;for(let a=0;a<i.length;a++)yo.set(i[a],l);return l}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],o=n.length;for(let i=0;i<o;i++){const l=n[i];l===`
63
+ `,Gu=rr?" ":us,Al="֑-߿יִ-﷽ﹰ-ﻼ",Tl="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Ku=new RegExp("^[^"+Tl+"]*["+Al+"]"),Vu=new RegExp("^[^"+Al+"]*["+Tl+"]"),pr={bold:1,code:16,highlight:mi,italic:2,strikethrough:qn,subscript:32,superscript:64,underline:Un},Hu={directionless:1,unmergeable:2},Yi={center:xi,end:Ci,justify:_i,left:yi,right:bi,start:vi},Ju={[xi]:"center",[Ci]:"end",[_i]:"justify",[yi]:"left",[bi]:"right",[vi]:"start"},Qu={normal:0,segmented:2,token:1},Yu={[zu]:"normal",[Uu]:"segmented",[qu]:"token"};function Xu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var M=Xu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Wn(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const Zu=100;let Ws=!1,wi=0;function ec(r){wi=r.timeStamp}function Ts(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ds(r,t)!==void 0}function tc(r,e,t){const n=ht(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&Ai(e,i,s,o,!1)}function rc(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===sr&&t.isAttached()}function nc(r,e,t,n){for(let s=r;s&&!mc(s);s=yn(s)){const o=ds(s,e);if(o!==void 0){const i=Qe(o,t);if(i)return _e(i)?void 0:[s,i]}else if(s===n)return[n,Ml(t)]}}function Bl(r,e,t){Ws=!0;const n=performance.now()-wi>Zu;try{at(r,()=>{const s=V()||function(f){return f.getEditorState().read(()=>{const h=V();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,a=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,m=h.target,b=nc(m,r,l,i);if(!b)continue;const[C,v]=b;if(g==="characterData")n&&z(v)&&rc(s,m,v)&&tc(m,v,r);else if(g==="childList"){u=!0;const E=h.addedNodes;for(let y=0;y<E.length;y++){const _=E[y],S=Pl(_),A=_.parentNode;if(A!=null&&_!==a&&S===null&&!Ts(_,A,r)){if(rr){const I=_.innerText||_.nodeValue;I&&(c+=I)}A.removeChild(_)}}const D=h.removedNodes,k=D.length;if(k>0){let y=0;for(let _=0;_<k;_++){const S=D[_];(Ts(S,m,r)||a===S)&&(m.appendChild(S),y++)}k!==y&&o.set(C,v)}}}if(o.size>0)for(const[f,h]of o)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,m=h.target;for(let b=0;b<g.length;b++){const C=g[b],v=C.parentNode;v==null||C.nodeName!=="BR"||Ts(C,m,r)||v.removeChild(C)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,Lt(s)),rr&&ql(r)&&s.insertRawText(c))})}finally{Ws=!1}}function Nl(r){const e=r._observer;e!==null&&Bl(r,e.takeRecords(),e)}function Fl(r){(function(e){wi===0&&hs(e).addEventListener("textInput",ec,!0)})(r),r._observer=new MutationObserver((e,t)=>{Bl(r,e,t)})}function Xi(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==l)}function Zi(r,e){const t=r.mergeWithSibling(e),n=je()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function eo(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Xi(e,n)){n=Zi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Xi(n,t)){n=Zi(n,t);break}break}t.remove()}}else n.remove()}function jl(r){return to(r.anchor),to(r.focus),r}function to(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let sc=1;const ic=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Di(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return _e(jr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&cs(e)==null)}function mn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Di(e)&&Ll(e)===r}catch{return!1}}function Si(r){return r instanceof xs}function Ll(r){let e=r;for(;e!=null;){const t=cs(e);if(Si(t))return t;e=yn(e)}return null}function cs(r){return r?r.__lexicalEditor:null}function ar(r){return r.isToken()||r.isSegmented()}function oc(r){return r.nodeType===sr}function Gn(r){let e=r;for(;e!=null;){if(oc(e))return e;e=e.firstChild}return null}function Kn(r,e,t){const n=pr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Rl(r){return z(r)||fr(r)||_e(r)}function lc(r,e){if(e!=null)return void(r.__key=e);nt(),ua();const t=je(),n=Vt(),s=""+sc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=kl,r.__key=s}function dr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Vn(r){ua();const e=r.getLatest(),t=e.__parent,n=Vt(),s=je(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(a,u,c){let d=a;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,o,i);const l=e.__key;s._dirtyType=kl,F(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function Ve(r){nt();const e=je(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Qe(t);n!==null&&n.getWritable()}if(r!==null){const n=Qe(r);n!==null&&n.getWritable()}}}function Zt(){return Cn()?null:je()._compositionKey}function Qe(r,e){const t=(e||Vt())._nodeMap.get(r);return t===void 0?null:t}function Pl(r,e){const t=ds(r,je());return t!==void 0?Qe(t,e):null}function ds(r,e){return r[`__lexicalKey_${e._key}`]}function jr(r,e){let t=r;for(;t!=null;){const n=Pl(t,e);if(n!==null)return n;t=yn(t)}return null}function Ol(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function ro(r){return r.read(()=>Be().getTextContent())}function Be(){return Ml(Vt())}function Ml(r){return r._nodeMap.get("root")}function Lt(r){nt();const e=Vt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Er(r){const e=je(),t=function(n,s){let o=n;for(;o!=null;){const i=ds(o,s);if(i!==void 0)return i;o=yn(o)}return null}(r,e);return t===null?r===e.getRootElement()?Qe("root"):null:Qe(t)}function no(r,e){return e?r.getTextContentSize():0}function Il(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Ei(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function $l(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function zl(r){return r.nodeType===sr?r.nodeValue:null}function ki(r,e,t){const n=ht(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=zl(s);const a=jr(s);if(l!==null&&z(a)){if(l===us&&t){const u=t.length;l=t,o=u,i=u}l!==null&&Ai(a,l,o,i,r)}}}function Ai(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let l=e;(i||s)&&e[e.length-1]===us&&(l=e.slice(0,-1));const a=o.getTextContent();if(s||l!==a){if(l===""){if(Ve(null),as||pn||gi)o.remove();else{const m=je();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const u=o.getParent(),c=vn(),d=o.getTextContentSize(),f=Zt(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||P(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===d&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const g=V();if(!P(g)||t===null||n===null)return void o.setTextContent(l);if(g.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=Ue(o.getTextContent());o.replace(m),o=m}o.setTextContent(l)}}}function ac(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(o){const i=o.getPreviousSibling();return(z(i)||F(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function so(r){return r==="ArrowLeft"}function io(r){return r==="ArrowRight"}function Vr(r,e){return xt?r:e}function oo(r){return r==="Enter"}function zr(r){return r==="Backspace"}function qr(r){return r==="Delete"}function lo(r,e,t){return r.toLowerCase()==="a"&&Vr(e,t)}function uc(){const r=Be();Lt(jl(r.select(0,r.getChildrenSize())))}function Zr(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const o=Wn(s);return t[e]=o,o}return s}function Ti(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&M(33,o);const a=l.klass;let u=r.get(a);u===void 0&&(u=new Map,r.set(a,u));const c=u.get(i),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(i,d?"updated":s)}function ao(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function un(r,e){const t=r.offset;if(r.type==="element")return ao(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?ao(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function ql(r){const e=hs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return fa(r,e,t)}function fs(r){return!Ze(r)&&!r.isLastChild()&&!r.isInline()}function Hn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&M(75,e),t}function yn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function en(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function hs(r){const e=r._window;return e===null&&M(78),e}function cc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Rt(e))return e;e=e.getParentOrThrow()}return e}function Rt(r){return Ze(r)||F(r)&&r.isShadowRoot()}function Ot(r){const e=je(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&M(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),l=i.constructor;return o!==null?i instanceof o||M(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||M(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&M(203,r.constructor.name,t,l.name,l.getType()),i}return r}function Bs(r,e){!Ze(r.getParent())||F(e)||_e(e)||M(99)}function Ns(r){return(_e(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Bi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function dc(r,e,t){let n=r._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let l=!1,a=null;if(i===o.getChildrenSize())Ns(o.getChildAtIndex(i-1))&&(l=!0);else{const u=o.getChildAtIndex(i);if(u!==null&&Ns(u)){const c=u.getPreviousSibling();(c===null||Ns(c))&&(l=!0,a=r.getElementByKey(u.__key))}}if(l){const u=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Wn(h);h=d.blockCursor=g}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(a===null?u.appendChild(n):u.insertBefore(n,a))}}n!==null&&Bi(n,r,e)}function ht(r){return Dt?(r||window).getSelection():null}function fc(r){return Kt(r)&&r.tagName==="A"}function Kt(r){return r.nodeType===1}function uo(r){return r.nodeType===11}function Gs(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function Jn(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Yt(r){if(_e(r)&&!r.isInline())return!0;if(!F(r)||Rt(r))return!1;const e=r.getFirstChild(),t=e===null||fr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Ur(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function hc(){return je()}const co=new WeakMap,pc=new Map;function gc(r){if(!r._readOnly&&r.isEmpty())return pc;r._readOnly||M(192);let e=co.get(r);if(!e){e=new Map,co.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function Ni(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function Fi(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function mc(r){return r.__lexicalUnmanaged===!0}function Ul(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(F(i)&&Ul(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let nr,et,cn,ps,Ks,Vs,gr,Ct,Hs,dn,We="",Xe="",Bt=null,bt="",Wt="",Wl=!1,fn=!1,Pn=null;function Qn(r,e){const t=gr.get(r);if(e!==null){const n=Ys(r);n.parentNode===e&&e.removeChild(n)}if(Ct.has(r)||et._keyToDOMMap.delete(r),F(t)){const n=Xn(t,gr);Js(n,0,n.length-1,null)}t!==void 0&&Ti(dn,cn,ps,t,"destroyed")}function Js(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Qn(o,n)}}function lr(r,e){r.setProperty("text-align",e)}const yc="40px";function Gl(r,e){const t=nr.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||yc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Kl(r,e){const t=r.style;e===0?lr(t,""):e===yi?lr(t,"left"):e===xi?lr(t,"center"):e===bi?lr(t,"right"):e===_i?lr(t,"justify"):e===vi?lr(t,"start"):e===Ci&&lr(t,"end")}function Yn(r,e){const t=Ct.get(r);t===void 0&&M(60);const n=t.createDOM(nr,et);if(function(s,o,i){const l=i._keyToDOMMap;(function(a,u,c){a[`__lexicalKey_${u._key}`]=c})(o,i,s),l.set(s,o)}(r,n,et),z(t)?n.setAttribute("data-lexical-text","true"):_e(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,o=t.__size;if(s!==0&&Gl(n,s),o!==0){const l=o-1;(function(a,u,c,d){const f=Xe;Xe="",Qs(a,c,0,u,c.getDOMSlot(d)),Hl(c,d),Xe=f})(Xn(t,Ct),l,t,n)}const i=t.__format;i!==0&&Kl(n,i),t.isInline()||Vl(null,t,n),fs(t)&&(We+=Gt,Wt+=Gt)}else{const s=t.getTextContent();if(_e(t)){const o=t.decorate(et,nr);o!==null&&Jl(r,o),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(Xe+=s));We+=s,Wt+=s}return e!==null&&e.insertChild(n),Ti(dn,cn,ps,t,"created"),n}function Qs(r,e,t,n,s){const o=We;We="";let i=t;for(;i<=n;++i){Yn(r[i],s);const l=Ct.get(r[i]);l!==null&&z(l)&&(Bt===null&&(Bt=l.getFormat()),bt===""&&(bt=l.getStyle()))}fs(e)&&(We+=Gt),s.element.__lexicalTextContent=We,We=o+We}function fo(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return fr(n)?"line-break":_e(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Vl(r,e,t){const n=fo(r,gr),s=fo(e,Ct);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Hl(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==Xe||n!==Pn){const o=Xe==="",i=o?Pn:(s=Xe,Ku.test(s)?"rtl":Vu.test(s)?"ltr":null);if(i!==n){const l=e.classList,a=nr.theme;let u=n!==null?a[n]:void 0,c=i!==null?a[i]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Wn(u);u=a[n]=d}l.remove(...u)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Wn(c);c=a[i]=d}c!==void 0&&l.add(...c)}e.dir=i}fn||(r.getWritable().__dir=i)}Pn=i,e.__lexicalDirTextContent=Xe,e.__lexicalDir=i}var s}function xc(r,e,t){const n=Xe;var s;Xe="",Bt=null,bt="",function(o,i,l){const a=We,u=o.__size,c=i.__size;We="";const d=l.element;if(u===1&&c===1){const f=o.__first,h=i.__first;if(f===h)Hr(f,d);else{const m=Ys(f),b=Yn(h,null);try{d.replaceChild(b,m)}catch(C){if(typeof C=="object"&&C!=null){const v=`${C.toString()} Parent: ${d.tagName}, new child: {tag: ${b.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(v)}throw C}Qn(f,null)}const g=Ct.get(h);z(g)&&(Bt===null&&(Bt=g.getFormat()),bt===""&&(bt=g.getStyle()))}else{const f=Xn(o,gr),h=Xn(i,Ct);if(f.length!==u&&M(227),h.length!==c&&M(228),u===0)c!==0&&Qs(h,i,0,c-1,l);else if(c===0){if(u!==0){const g=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Js(f,0,u-1,g?null:d),g&&(d.textContent="")}}else(function(g,m,b,C,v,E){const D=C-1,k=v-1;let y,_,S=E.getFirstChild(),A=0,I=0;for(;A<=D&&I<=k;){const j=m[A],L=b[I];if(j===L)S=Fs(Hr(L,E.element)),A++,I++;else{y===void 0&&(y=new Set(m)),_===void 0&&(_=new Set(b));const X=_.has(j),ce=y.has(L);if(X)if(ce){const ve=Hn(et,L);ve===S?S=Fs(Hr(L,E.element)):(E.withBefore(S).insertChild(ve),Hr(L,E.element)),A++,I++}else Yn(L,E.withBefore(S)),I++;else S=Fs(Ys(j)),Qn(j,E.element),A++}const $=Ct.get(L);$!==null&&z($)&&(Bt===null&&(Bt=$.getFormat()),bt===""&&(bt=$.getStyle()))}const B=A>D,N=I>k;if(B&&!N){const j=b[k+1],L=j===void 0?null:et.getElementByKey(j);Qs(b,g,I,k,E.withBefore(L))}else N&&!B&&Js(m,A,D,E.element)})(i,f,h,u,c,l)}fs(i)&&(We+=Gt),d.__lexicalTextContent=We,We=a+We}(r,e,e.getDOMSlot(t)),Hl(e,t),Lr(s=e)&&Bt!=null&&Bt!==s.__textFormat&&!fn&&(s.setTextFormat(Bt),s.setTextStyle(bt)),function(o){Lr(o)&&bt!==""&&bt!==o.__textStyle&&!fn&&o.setTextStyle(bt)}(e),Xe=n}function Xn(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&M(101),t.push(n),n=s.__next}return t}function Hr(r,e){const t=gr.get(r);let n=Ct.get(r);t!==void 0&&n!==void 0||M(61);const s=Wl||Vs.has(r)||Ks.has(r),o=Hn(et,r);if(t===n&&!s){if(F(t)){const i=o.__lexicalTextContent;i!==void 0&&(We+=i,Wt+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(Xe+=l)}else{const i=t.getTextContent();z(t)&&!t.isDirectionless()&&(Xe+=i),Wt+=i,We+=i}return o}if(t!==n&&s&&Ti(dn,cn,ps,n,"updated"),n.updateDOM(t,o,nr)){const i=Yn(r,null);return e===null&&M(62),e.replaceChild(i,o),Qn(r,null),i}if(F(t)&&F(n)){const i=n.__indent;i!==t.__indent&&Gl(o,i);const l=n.__format;l!==t.__format&&Kl(o,l),s&&(xc(t,n,o),Ze(n)||n.isInline()||Vl(t,n,o)),fs(n)&&(We+=Gt,Wt+=Gt)}else{const i=n.getTextContent();if(_e(n)){const l=n.decorate(et,nr);l!==null&&Jl(r,l)}else z(n)&&!n.isDirectionless()&&(Xe+=i);We+=i,Wt+=i}if(!fn&&Ze(n)&&n.__cachedText!==Wt){const i=n.getWritable();i.__cachedText=Wt,n=i}return o}function Jl(r,e){let t=et._pendingDecorators;const n=et._decorators;if(t===null){if(n[r]===e)return;t=Ol(et)}t[r]=e}function Fs(r){let e=r.nextSibling;return e!==null&&e===et._blockCursorElement&&(e=e.nextSibling),e}function bc(r,e,t,n,s,o){We="",Wt="",Xe="",Wl=n===Fr,Pn=null,et=t,nr=t._config,cn=t._nodes,ps=et._listeners.mutation,Ks=s,Vs=o,gr=r._nodeMap,Ct=e._nodeMap,fn=e._readOnly,Hs=new Map(t._keyToDOMMap);const i=new Map;return dn=i,Hr("root",null),et=void 0,cn=void 0,Ks=void 0,Vs=void 0,gr=void 0,Ct=void 0,nr=void 0,Hs=void 0,dn=void 0,i}function Ys(r){const e=Hs.get(r);return e===void 0&&M(75,r),e}const Ut=Object.freeze({}),Xs=30,Zs=[["keydown",function(r,e){if(tn=r.timeStamp,Ql=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!G(e,Du,r)&&t!=null){if(function(l,a,u,c){return io(l)&&!a&&!c&&!u}(t,s,i,o))G(e,ml,r);else if(function(l,a,u,c,d){return io(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,Su,r);else if(function(l,a,u,c){return so(l)&&!a&&!c&&!u}(t,s,i,o))G(e,yl,r);else if(function(l,a,u,c,d){return so(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,Eu,r);else if(function(l,a,u){return function(c){return c==="ArrowUp"}(l)&&!a&&!u}(t,s,o))G(e,xl,r);else if(function(l,a,u){return function(c){return c==="ArrowDown"}(l)&&!a&&!u}(t,s,o))G(e,bl,r);else if(function(l,a){return oo(l)&&a}(t,n))rn=!0,G(e,$n,r);else if(function(l){return l===" "}(t))G(e,ku,r);else if(function(l,a){return xt&&a&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),rn=!0,G(e,Ar,!0);else if(function(l,a){return oo(l)&&!a}(t,n))rn=!1,G(e,$n,r);else if(function(l,a,u,c){return xt?!a&&!u&&(zr(l)||l.toLowerCase()==="h"&&c):!(c||a||u)&&zr(l)}(t,i,o,s))zr(t)?G(e,_l,r):(r.preventDefault(),G(e,cr,!0));else if(function(l){return l==="Escape"}(t))G(e,vl,r);else if(function(l,a,u,c,d){return xt?!(u||c||d)&&(qr(l)||l.toLowerCase()==="d"&&a):!(a||c||d)&&qr(l)}(t,s,n,i,o))qr(t)?G(e,Cl,r):(r.preventDefault(),G(e,cr,!1));else if(function(l,a,u){return zr(l)&&(xt?a:u)}(t,i,s))r.preventDefault(),G(e,ln,!0);else if(function(l,a,u){return qr(l)&&(xt?a:u)}(t,i,s))r.preventDefault(),G(e,ln,!1);else if(function(l,a){return xt&&a&&zr(l)}(t,o))r.preventDefault(),G(e,an,!0);else if(function(l,a){return xt&&a&&qr(l)}(t,o))r.preventDefault(),G(e,an,!1);else if(function(l,a,u,c){return l.toLowerCase()==="b"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),G(e,vt,"bold");else if(function(l,a,u,c){return l.toLowerCase()==="u"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),G(e,vt,"underline");else if(function(l,a,u,c){return l.toLowerCase()==="i"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),G(e,vt,"italic");else if(function(l,a,u,c){return l==="Tab"&&!a&&!u&&!c}(t,i,s,o))G(e,Au,r);else if(function(l,a,u,c){return l.toLowerCase()==="z"&&!a&&Vr(u,c)}(t,n,o,s))r.preventDefault(),G(e,fi,void 0);else if(function(l,a,u,c){return xt?l.toLowerCase()==="z"&&u&&a:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&a}(t,n,o,s))r.preventDefault(),G(e,hi,void 0);else{const l=e._editorState._selection;l===null||P(l)?!rr&&lo(t,o,s)&&(r.preventDefault(),G(e,Us,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="c"&&(xt?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,ls,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="x"&&(xt?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,pi,r)):lo(t,o,s)&&(r.preventDefault(),G(e,Us,r))}(function(l,a,u,c){return l||a||u||c})(s,n,i,o)&&G(e,Ou,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&at(e,()=>{_e(jr(t))||(ti=!0)})}],["compositionstart",function(r,e){at(e,()=>{const t=V();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Ve(n.key),(r.timeStamp<tn+Xs||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Tr,Gu)}})}],["compositionend",function(r,e){rr?Wr=!0:at(e,()=>{js(e,r.data)})}],["input",function(r,e){r.stopPropagation(),at(e,()=>{const t=V(),n=r.data,s=ea(r);if(n!=null&&P(t)&&Zl(t,s,n,r.timeStamp,!1)){Wr&&(js(e,n),Wr=!1);const o=t.anchor.getNode(),i=ht(e._window);if(i===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,u=l?t.focus.offset:t.anchor.offset;zn&&!t.isCollapsed()&&z(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,a)+n+o.getTextContent().slice(a+u)===zl(i.anchorNode)||G(e,Tr,n);const c=n.length;rr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),as||pn||gi||!e.isComposing()||(tn=0,Ve(null))}else ki(!1,e,n!==null?n:void 0),Wr&&(js(e,n||void 0),Wr=!1);nt(),Nl(je())}),Sr=null}],["click",function(r,e){at(e,()=>{const t=V(),n=ht(e._window),s=vn();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ze(i)&&Be().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(F(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===gn||i===sr)&&Lt(Li(s,n,e,r))}}}G(e,gl,r)})}],["cut",Ut],["copy",Ut],["dragstart",Ut],["dragover",Ut],["dragend",Ut],["paste",Ut],["focus",Ut],["blur",Ut],["drop",Ut]];zn&&Zs.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=ea(t);s==="deleteCompositionText"||rr&&ql(n)||s!=="insertCompositionText"&&at(n,()=>{const i=V();if(s==="deleteContentBackward"){if(i===null){const h=vn();if(!P(h))return;Lt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Ql==="MediaLast"&&l<tn+Xs&&n.isComposing()&&h){if(Ve(null),tn=0,setTimeout(()=>{at(n,()=>{Ve(null)})},Xs),P(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),z(g)||M(142),i.style=g.getStyle()}}else{Ve(null),t.preventDefault();const g=i.anchor.getNode(),m=g.getTextContent(),b=g.canInsertTextAfter(),C=i.anchor.offset===0&&i.focus.offset===m.length;$u&&h&&!C&&b||G(n,cr,!0)}return}}var l;if(!P(i))return;const a=t.data;Sr!==null&&ki(!1,n,Sr),i.dirty&&Sr===null||!i.isCollapsed()||Ze(i.anchor.getNode())||o===null||i.applyDOMRange(o),Sr=null;const u=i.anchor,c=i.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Tr,t);break;case"insertFromComposition":Ve(null),G(n,Tr,t);break;case"insertLineBreak":Ve(null),G(n,Ar,!1);break;case"insertParagraph":Ve(null),rn&&!pn?(rn=!1,G(n,Ar,!1)):G(n,on,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,os,t);break;case"deleteByComposition":(function(h,g){return h!==g||F(h)||F(g)||!h.isToken()||!g.isToken()})(d,f)&&G(n,qs,t);break;case"deleteByDrag":case"deleteByCut":G(n,qs,t);break;case"deleteContent":G(n,cr,!1);break;case"deleteWordBackward":G(n,ln,!0);break;case"deleteWordForward":G(n,ln,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,an,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,an,!1);break;case"formatStrikeThrough":G(n,vt,"strikethrough");break;case"formatBold":G(n,vt,"bold");break;case"formatItalic":G(n,vt,"italic");break;case"formatUnderline":G(n,vt,"underline");break;case"historyUndo":G(n,fi,void 0);break;case"historyRedo":G(n,hi,void 0)}else{if(a===`
64
+ `)t.preventDefault(),G(n,Ar,!1);else if(a===Gt)t.preventDefault(),G(n,on,void 0);else if(a==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else a!=null&&Zl(i,o,a,t.timeStamp,!0)?(t.preventDefault(),G(n,Tr,a)):Sr=a;Yl=t.timeStamp}})}(r,e)]);let tn=0,Ql=null,Yl=0,Sr=null;const Zn=new WeakMap;let ei=!1,ti=!1,rn=!1,Wr=!1,Xl=[0,"",0,"root",0];function Zl(r,e,t,n,s){const o=r.anchor,i=r.focus,l=o.getNode(),a=je(),u=ht(a._window),c=u!==null?u.anchorNode:null,d=o.key,f=a.getElementByKey(d),h=t.length;return d!==i.key||!z(l)||(!s&&(!zn||Yl<n+50)||l.isDirty()&&h<2||Il(t))&&o.offset!==i.offset&&!l.isComposing()||ar(l)||l.isDirty()&&h>1||(s||!zn)&&f!==null&&!l.isComposing()&&c!==Gn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||l.getFormat()!==r.format||l.getStyle()!==r.style||ac(r,l)}function ho(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===sr&&e!==0&&e!==r.nodeValue.length}function po(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;ei&&(ei=!1,ho(n,s)&&ho(o,i))||at(e,()=>{if(!t)return void Lt(null);if(!mn(e,n,o))return;const l=V();if(P(l)){const a=l.anchor,u=a.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=hs(e).event,d=c?c.timeStamp:performance.now(),[f,h,g,m,b]=Xl,C=Be(),v=e.isComposing()===!1&&C.getTextContent()==="";if(d<b+200&&a.offset===g&&a.key===m)l.format=f,l.style=h;else if(a.type==="text")z(u)||M(141),l.format=u.getFormat(),l.style=u.getStyle();else if(a.type==="element"&&!v){const E=a.getNode();l.style="",E instanceof Pr&&E.getChildrenSize()===0?(l.format=E.getTextFormat(),l.style=E.getTextStyle()):l.format=0}}else{const c=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),m=g?i:s,b=g?s:i,C=g?d:c,v=g?c:d;let E=Wu,D=!1;for(let k=0;k<h;k++){const y=f[k],_=y.getTextContentSize();if(z(y)&&_!==0&&!(k===0&&y.__key===C&&m===_||k===h-1&&y.__key===v&&b===0)&&(D=!0,E&=y.getFormat(),E===0))break}l.format=D?E:0}}G(e,di,void 0)})}function ea(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function js(r,e){const t=r._compositionKey;if(Ve(null),t!==null&&e!=null){if(e===""){const n=Qe(t),s=Gn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&z(n)&&Ai(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
+ `){const n=V();if(P(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,$n,null)}}}ki(!0,r,e)}function ta(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Br=new Map;function ra(r){const e=r.target,t=ht(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=Ll(t.anchorNode);if(n===null)return;ti&&(ti=!1,at(n,()=>{const u=vn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==gn&&d!==sr||Lt(Li(u,t,n,r))}));const s=Ei(n),o=s[s.length-1],i=o._key,l=Br.get(i),a=l||o;a!==n&&po(t,a,!1),po(t,n,!0),n!==o?Br.set(i,n):l&&Br.delete(i)}function go(r){r._lexicalHandled=!0}function mo(r){return r._lexicalHandled===!0}function _c(r){const e=r.ownerDocument,t=Zn.get(e);t===void 0&&M(162);const n=t-1;n>=0||M(164),Zn.set(e,n),n===0&&e.removeEventListener("selectionchange",ra);const s=cs(r);Si(s)?(function(i){if(i._parentEditor!==null){const l=Ei(i),a=l[l.length-1]._key;Br.get(a)===i&&Br.delete(a)}else Br.delete(i._key)}(s),r.__lexicalEditor=null):s&&M(198);const o=ta(r);for(let i=0;i<o.length;i++)o[i]();r.__lexicalEventHandles=[]}function ri(r,e,t){nt();const n=r.__key,s=r.getParent();if(s===null)return;const o=function(l){const a=V();if(!P(a)||!F(l))return a;const{anchor:u,focus:c}=a,d=u.getNode(),f=c.getNode();return en(d,l)&&u.set(l.__key,0,"element"),en(f,l)&&c.set(l.__key,0,"element"),a}(r);let i=!1;if(P(o)&&e){const l=o.anchor,a=o.focus;l.key===n&&(ts(l,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0),a.key===n&&(ts(a,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0)}else Nt(o)&&e&&r.isSelected()&&r.selectPrevious();if(P(o)&&e&&!i){const l=r.getIndexWithinParent();dr(r),es(o,s,l,-1)}else dr(r);t||Rt(s)||s.canBeEmpty()||!s.isEmpty()||ri(s,e),e&&Ze(s)&&s.isEmpty()&&s.selectEnd()}class gs{static getType(){M(64,this.name)}static clone(e){M(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,lc(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Qe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||V();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(z(this))return n;if(P(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(_e(this)&&this.isInline()&&s){const o=t.isBackward()?t.focus:t.anchor,i=o.getNode();if(o.offset===i.getChildrenSize()&&i.is(s)&&i.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Qe(e)}getParentOrThrow(){const e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Rt(t))return F(e)||e===this&&_e(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&M(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Qe(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Qe(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();F(this)&&t.unshift(this),F(e)&&n.unshift(e);const s=t.length,o=n.length;if(s===0||o===0||t[s-1]!==n[o-1])return null;const i=new Set(n);for(let l=0;l<s;l++){const a=t[l];if(i.has(a))return a}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,o=this;for(;;){const i=o.getParentOrThrow();if(i===t){n=o.getIndexWithinParent();break}o=i}for(o=e;;){const i=o.getParentOrThrow();if(i===t){s=o.getIndexWithinParent();break}o=i}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let o=this;for(;o!==null;){const i=o.__key;if(s.has(i)||(s.add(i),n.push(o)),o===e)break;const l=F(o)?t?o.getFirstChild():o.getLastChild():null;if(l!==null){o=l;continue}const a=t?o.getNextSibling():o.getPreviousSibling();if(a!==null){o=a;continue}const u=o.getParentOrThrow();if(s.has(u.__key)||n.push(u),u===e)break;let c=null,d=u;do{if(d===null&&M(68),c=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||s.has(d.__key)||n.push(d)}while(c===null);o=c}return t||n.reverse(),n}isDirty(){const e=je()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=Qe(this.__key);return e===null&&M(113),e}getWritable(){nt();const e=Vt(),t=je(),n=e._nodeMap,s=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,l=V();if(l!==null&&l.setCachedNodes(null),i.has(s))return Vn(o),o;const a=Ni(o);return i.add(s),Vn(a),n.set(s,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){M(72)}static importJSON(e){M(18,this.name)}static transform(){return null}remove(e){ri(this,!0,e)}replace(e,t){nt();let n=V();n!==null&&(n=n.clone()),Bs(this,e);const s=this.getLatest(),o=this.__key,i=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),u=a.__size;dr(l);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,g=s.__parent;if(ri(s,!1,!0),c===null?a.__first=i:c.getWritable().__next=i,l.__prev=f,d===null?a.__last=i:d.getWritable().__prev=i,l.__next=h,l.__parent=g,a.__size=u,t&&(F(this)&&F(l)||M(139),this.getChildren().forEach(m=>{l.append(m)})),P(n)){Lt(n);const m=n.anchor,b=n.focus;m.key===o&&_o(m,l),b.key===o&&_o(b,l)}return Zt()===o&&Ve(i),l}insertAfter(e,t=!0){nt(),Bs(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.getParent(),i=V();let l=!1,a=!1;if(o!==null){const h=e.getIndexWithinParent();if(dr(s),P(i)){const g=o.__key,m=i.anchor,b=i.focus;l=m.type==="element"&&m.key===g&&m.offset===h+1,a=b.type==="element"&&b.key===g&&b.offset===h+1}}const u=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(u===null?c.__last=d:u.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&P(i)){const h=this.getIndexWithinParent();es(i,c,h+1);const g=c.__key;l&&i.anchor.set(g,h+2,"element"),a&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){nt(),Bs(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.__key;dr(s);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=n.__prev,u=this.getIndexWithinParent();i===null?l.__first=o:i.getWritable().__next=o,l.__size++,n.__prev=o,s.__prev=a,s.__next=n.__key,s.__parent=n.__parent;const c=V();return t&&P(c)&&es(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return ze()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){nt();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!z(n)){const o=n.getIndexWithinParent()+1;return s.select(o,o)}return n.select(e,t)}selectNext(e,t){nt();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!z(n)){const o=n.getIndexWithinParent();return s.select(o,o)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class xn extends gs{static getType(){return"linebreak"}static clone(e){return new xn(e.__key)}constructor(e){super(e)}getTextContent(){return`
66
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&Jn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Tn(s)){const o=n.lastChild;if(o===t||o.previousSibling===t&&Tn(o))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&Jn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Tn(s))return!1;const o=n.lastChild;if(o===t||o.previousSibling===t&&Tn(o))return!0}return!1}(e)?null:{conversion:vc,priority:0}}}static importJSON(e){return mr()}exportJSON(){return{type:"linebreak",version:1}}}function vc(r){return{node:mr()}}function mr(){return Ot(new xn)}function fr(r){return r instanceof xn}function Tn(r){return r.nodeType===sr&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function Ls(r,e){return 16&e?"code":e&mi?"mark":32&e?"sub":64&e?"sup":null}function Rs(r,e){return 1&e?"strong":2&e?"em":"span"}function na(r,e,t,n,s){const o=n.classList;let i=Zr(s,"base");i!==void 0&&o.add(...i),i=Zr(s,"underlineStrikethrough");let l=!1;const a=e&Un&&e&qn;i!==void 0&&(t&Un&&t&qn?(l=!0,a||o.add(...i)):a&&o.remove(...i));for(const u in pr){const c=pr[u];if(i=Zr(s,u),i!==void 0)if(t&c){if(l&&(u==="underline"||u==="strikethrough")){e&c&&o.remove(...i);continue}e&c&&(!a||u!=="underline")&&u!=="strikethrough"||o.add(...i)}else e&c&&o.remove(...i)}}function sa(r,e,t){const n=e.firstChild,s=t.isComposing(),o=r+(s?us:"");if(n==null)e.textContent=o;else{const i=n.nodeValue;if(i!==o)if(s||rr){const[l,a,u]=function(c,d){const f=c.length,h=d.length;let g=0,m=0;for(;g<f&&g<h&&c[g]===d[g];)g++;for(;m+g<f&&m+g<h&&c[f-m-1]===d[h-m-1];)m++;return[g,f-g-m,d.slice(g,h-m)]}(i,o);a!==0&&n.deleteData(l,a),n.insertData(l,u)}else n.nodeValue=o}}function yo(r,e,t,n,s,o){sa(s,r,e);const i=o.theme.text;i!==void 0&&na(0,0,n,r,i)}function Bn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Rr extends gs{static getType(){return"text"}static clone(e){return new Rr(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Yu[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Zt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=pr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Kn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=Ls(0,n),o=Rs(0,n),i=s===null?o:s,l=document.createElement(i);let a=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),s!==null&&(a=document.createElement(o),l.appendChild(a)),yo(a,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(l.style.cssText=u),l}updateDOM(e,t,n){const s=this.__text,o=e.__format,i=this.__format,l=Ls(0,o),a=Ls(0,i),u=Rs(0,o),c=Rs(0,i);if((l===null?u:l)!==(a===null?c:a))return!0;if(l===a&&u!==c){const m=t.firstChild;m==null&&M(48);const b=document.createElement(c);return yo(b,this,0,i,s,n),t.replaceChild(b,m),!1}let d=t;a!==null&&l!==null&&(d=t.firstChild,d==null&&M(49)),sa(s,d,this);const f=n.theme.text;f!==void 0&&o!==i&&na(0,o,i,d,f);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Sc,priority:0}),b:()=>({conversion:wc,priority:0}),code:()=>({conversion:Qt,priority:0}),em:()=>({conversion:Qt,priority:0}),i:()=>({conversion:Qt,priority:0}),s:()=>({conversion:Qt,priority:0}),span:()=>({conversion:Cc,priority:0}),strong:()=>({conversion:Qt,priority:0}),sub:()=>({conversion:Qt,priority:0}),sup:()=>({conversion:Qt,priority:0}),u:()=>({conversion:Qt,priority:0})}}static importJSON(e){const t=Ue(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Kt(t)||M(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Bn(t,"b")),this.hasFormat("italic")&&(t=Bn(t,"i")),this.hasFormat("strikethrough")&&(t=Bn(t,"s")),this.hasFormat("underline")&&(t=Bn(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?pr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Hu[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Kn(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Qu[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){nt();let n=e,s=t;const o=V(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const a=i.length;n===void 0&&(n=a),s===void 0&&(s=a)}else n=0,s=0;if(!P(o))return la(l,n,l,s,"text","text");{const a=Zt();a!==o.anchor.key&&a!==o.focus.key||Ve(l),o.setTextNodeRange(this,n,this,s)}return o}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const o=this.getWritable(),i=o.__text,l=n.length;let a=e;a<0&&(a=l+a,a<0&&(a=0));const u=V();if(s&&P(u)){const d=e+l;u.setTextNodeRange(o,d,o,d)}const c=i.slice(0,a)+n+i.slice(a+t);return o.__text=c,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){nt();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,o=Zt(),i=new Set(e),l=[],a=n.length;let u="";for(let k=0;k<a;k++)u!==""&&i.has(k)&&(l.push(u),u=""),u+=n[k];u!==""&&l.push(u);const c=l.length;if(c===0)return[];if(l[0]===n)return[t];const d=l[0],f=t.getParent();let h;const g=t.getFormat(),m=t.getStyle(),b=t.__detail;let C=!1;t.isSegmented()?(h=Ue(d),h.__format=g,h.__style=m,h.__detail=b,C=!0):(h=t.getWritable(),h.__text=d);const v=V(),E=[h];let D=d.length;for(let k=1;k<c;k++){const y=l[k],_=y.length,S=Ue(y).getWritable();S.__format=g,S.__style=m,S.__detail=b;const A=S.__key,I=D+_;if(P(v)){const B=v.anchor,N=v.focus;B.key===s&&B.type==="text"&&B.offset>D&&B.offset<=I&&(B.key=A,B.offset-=D,v.dirty=!0),N.key===s&&N.type==="text"&&N.offset>D&&N.offset<=I&&(N.key=A,N.offset-=D,v.dirty=!0)}o===s&&Ve(A),D=I,E.push(S)}if(f!==null){(function(_){const S=_.getPreviousSibling(),A=_.getNextSibling();S!==null&&Vn(S),A!==null&&Vn(A)})(this);const k=f.getWritable(),y=this.getIndexWithinParent();C?(k.splice(y,0,E),this.remove()):k.splice(y,1,E),P(v)&&es(v,f,y,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);const n=this.__key,s=e.__key,o=this.__text,i=o.length;Zt()===s&&Ve(n);const l=V();if(P(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===s&&(ko(d,t,n,e,i),l.dirty=!0),f!==null&&f.key===s&&(ko(f,t,n,e,i),l.dirty=!0)}const a=e.__text,u=t?a+o:o+a;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Cc(r){return{forChild:ji(r.style),node:null}}function wc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:ji(e.style,t?void 0:"bold"),node:null}}const xo=new WeakMap;function Dc(r){return r.nodeName==="PRE"||r.nodeType===gn&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Sc(r){const e=r;r.parentElement===null&&M(129);let t=e.textContent||"";if(function(n){let s,o=n.parentNode;const i=[n];for(;o!==null&&(s=xo.get(o))===void 0&&!Dc(o);)i.push(o),o=o.parentNode;const l=s===void 0?o:s;for(let a=0;a<i.length;a++)xo.set(i[a],l);return l}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],o=n.length;for(let i=0;i<o;i++){const l=n[i];l===`
67
67
  `||l===`\r
68
- `?s.push(gr()):l===" "?s.push(_n()):l!==""&&s.push(Ue(l))}return{node:s}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let n=e,s=!0;for(;n!==null&&(n=xo(n,!1))!==null;){const o=n.textContent||"";if(o.length>0){/[ \t\n]$/.test(o)&&(t=t.slice(1)),s=!1;break}}s&&(t=t.slice(1))}if(t[t.length-1]===" "){let n=e,s=!0;for(;n!==null&&(n=xo(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ue(t)}}function xo(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const o=t.parentElement;if(o===null)return null;t=o}if(t=n,t.nodeType===gn){const o=t.style.display;if(o===""&&!Ws(t)||o!==""&&!o.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===nr)return t;if(t.nodeName==="BR")return null}}const wc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Jt(r){const e=wc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Fi(r.style,e),node:null}}function Ue(r=""){return Ot(new Lr(r))}function z(r){return r instanceof Lr}function Fi(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",o=n.includes("line-through"),i=r.fontStyle==="italic",l=n.includes("underline"),a=r.verticalAlign;return u=>(z(u)&&(s&&!u.hasFormat("bold")&&u.toggleFormat("bold"),o&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),i&&!u.hasFormat("italic")&&u.toggleFormat("italic"),l&&!u.hasFormat("underline")&&u.toggleFormat("underline"),a!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),a!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class bn extends Lr{static getType(){return"tab"}static clone(e){return new bn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=_n();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){M(126)}setDetail(e){M(127)}setMode(e){M(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function _n(){return Ot(new bn)}function Dc(r){return r instanceof bn}class Sc{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const s=this.offset,o=e.offset;if(F(t)){const i=t.getDescendantByIndex(s);t=i??t}if(F(n)){const i=n.getDescendantByIndex(o);n=i??n}return t===n?s<o:t.isBefore(n)}getNode(){const e=Qe(this.key);return e===null&&M(20),e}set(e,t,n){const s=this._selection,o=this.key;this.key=e,this.offset=t,this.type=n,Cn()||(Xt()===o&&Ve(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function Pt(r,e,t){return new Sc(r,e,t)}function Rs(r,e){let t=e.__key,n=r.offset,s="element";if(z(e)){s="text";const o=e.getTextContentSize();n>o&&(n=o)}else if(!F(e)){const o=e.getNextSibling();if(z(o))t=o.__key,n=0,s="text";else{const i=e.getParent();i&&(t=i.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function bo(r,e){if(F(e)){const t=e.getLastDescendant();F(t)||z(t)?Rs(r,t):Rs(r,e)}else Rs(r,e)}function Yt(r,e,t,n){r.key=e,r.offset=t,r.type=n}class ms{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Nt(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(s=>n.has(s))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new ms(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,s=t[n-1];let o;if(z(s))o=s.select();else{const i=s.getIndexWithinParent()+1;o=s.getParentOrThrow().select(i,i)}o.insertNodes(e);for(let i=0;i<n;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const o=Qe(s);o!==null&&n.push(o)}return Cn()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function P(r){return r instanceof sr}class sr{constructor(e,t,n,s){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=s,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!P(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,n=this.focus,s=t.isBefore(n),o=s?t:n,i=s?n:t;let l=o.getNode(),a=i.getNode();const u=o.offset,c=i.offset;if(F(l)){const f=l.getDescendantByIndex(u);l=f??l}if(F(a)){let f=a.getDescendantByIndex(c);f!==null&&f!==l&&a.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),a=f??a}let d;return d=l.is(a)?F(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(a),Cn()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){Yt(this.anchor,e.__key,t,"text"),Yt(this.focus,n.__key,s,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],n=e[e.length-1],s=this.anchor,o=this.focus,i=s.isBefore(o),[l,a]=ri(this);let u="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(F(f)&&!f.isInline())c||(u+=`
69
- `),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&o.type==="element"&&o.offset!==s.offset||(h=l<a?h.slice(l,a):h.slice(a,l)):h=i?h.slice(l):h.slice(a):f===n&&(h=i?h.slice(0,a):h.slice(0,l)),u+=h}else!_e(f)&&!dr(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=je(),n=t.getEditorState()._selection,s=ia(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[o,i]=s;Yt(this.anchor,o.key,o.offset,o.type),Yt(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new sr(Pt(e.key,e.offset,e.type),Pt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Kn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=hr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let o=0;o<s;o++){const i=t[o];i===`
68
+ `?s.push(mr()):l===" "?s.push(_n()):l!==""&&s.push(Ue(l))}return{node:s}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let n=e,s=!0;for(;n!==null&&(n=bo(n,!1))!==null;){const o=n.textContent||"";if(o.length>0){/[ \t\n]$/.test(o)&&(t=t.slice(1)),s=!1;break}}s&&(t=t.slice(1))}if(t[t.length-1]===" "){let n=e,s=!0;for(;n!==null&&(n=bo(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ue(t)}}function bo(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const o=t.parentElement;if(o===null)return null;t=o}if(t=n,t.nodeType===gn){const o=t.style.display;if(o===""&&!Gs(t)||o!==""&&!o.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===sr)return t;if(t.nodeName==="BR")return null}}const Ec={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Qt(r){const e=Ec[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:ji(r.style,e),node:null}}function Ue(r=""){return Ot(new Rr(r))}function z(r){return r instanceof Rr}function ji(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",o=n.includes("line-through"),i=r.fontStyle==="italic",l=n.includes("underline"),a=r.verticalAlign;return u=>(z(u)&&(s&&!u.hasFormat("bold")&&u.toggleFormat("bold"),o&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),i&&!u.hasFormat("italic")&&u.toggleFormat("italic"),l&&!u.hasFormat("underline")&&u.toggleFormat("underline"),a!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),a!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class bn extends Rr{static getType(){return"tab"}static clone(e){return new bn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=_n();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){M(126)}setDetail(e){M(127)}setMode(e){M(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function _n(){return Ot(new bn)}function kc(r){return r instanceof bn}class Ac{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const s=this.offset,o=e.offset;if(F(t)){const i=t.getDescendantByIndex(s);t=i??t}if(F(n)){const i=n.getDescendantByIndex(o);n=i??n}return t===n?s<o:t.isBefore(n)}getNode(){const e=Qe(this.key);return e===null&&M(20),e}set(e,t,n){const s=this._selection,o=this.key;this.key=e,this.offset=t,this.type=n,Cn()||(Zt()===o&&Ve(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function Pt(r,e,t){return new Ac(r,e,t)}function Ps(r,e){let t=e.__key,n=r.offset,s="element";if(z(e)){s="text";const o=e.getTextContentSize();n>o&&(n=o)}else if(!F(e)){const o=e.getNextSibling();if(z(o))t=o.__key,n=0,s="text";else{const i=e.getParent();i&&(t=i.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function _o(r,e){if(F(e)){const t=e.getLastDescendant();F(t)||z(t)?Ps(r,t):Ps(r,e)}else Ps(r,e)}function Xt(r,e,t,n){r.key=e,r.offset=t,r.type=n}class ms{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Nt(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(s=>n.has(s))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new ms(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,s=t[n-1];let o;if(z(s))o=s.select();else{const i=s.getIndexWithinParent()+1;o=s.getParentOrThrow().select(i,i)}o.insertNodes(e);for(let i=0;i<n;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const o=Qe(s);o!==null&&n.push(o)}return Cn()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function P(r){return r instanceof ir}class ir{constructor(e,t,n,s){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=s,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!P(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,n=this.focus,s=t.isBefore(n),o=s?t:n,i=s?n:t;let l=o.getNode(),a=i.getNode();const u=o.offset,c=i.offset;if(F(l)){const f=l.getDescendantByIndex(u);l=f??l}if(F(a)){let f=a.getDescendantByIndex(c);f!==null&&f!==l&&a.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),a=f??a}let d;return d=l.is(a)?F(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(a),Cn()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){Xt(this.anchor,e.__key,t,"text"),Xt(this.focus,n.__key,s,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],n=e[e.length-1],s=this.anchor,o=this.focus,i=s.isBefore(o),[l,a]=ni(this);let u="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(F(f)&&!f.isInline())c||(u+=`
69
+ `),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&o.type==="element"&&o.offset!==s.offset||(h=l<a?h.slice(l,a):h.slice(a,l)):h=i?h.slice(l):h.slice(a):f===n&&(h=i?h.slice(0,a):h.slice(0,l)),u+=h}else!_e(f)&&!fr(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=je(),n=t.getEditorState()._selection,s=oa(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[o,i]=s;Xt(this.anchor,o.key,o.offset,o.type),Xt(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new ir(Pt(e.key,e.offset,e.type),Pt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Kn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=pr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let o=0;o<s;o++){const i=t[o];i===`
70
70
  `||i===`\r
71
- `?n.push(gr()):i===" "?n.push(_n()):n.push(Ue(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,l=t),i.type==="element"&&function(b,C,v,E){const D=b.getNode(),k=D.getChildAtIndex(b.offset),y=Ue(),_=Ze(D)?ze().append(y):y;y.setFormat(v),y.setStyle(E),k===null?D.append(_):k.insertBefore(_),b.is(C)&&C.set(y.__key,0,"text"),b.set(y.__key,0,"text")}(i,l,s,o);const a=i.offset;let u=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||M(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(u=h,l.set(i.key,u,"text")),this.isCollapsed()&&a===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let b=f.getNextSibling();if(z(b)&&b.canInsertTextBefore()&&!lr(b)||(b=Ue(),b.setFormat(s),b.setStyle(o),g.canInsertTextAfter()?f.insertAfter(b):g.insertAfter(b)),b.select(0,0),f=b,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let b=f.getPreviousSibling();if(z(b)&&!lr(b)||(b=Ue(),b.setFormat(s),g.canInsertTextBefore()?f.insertBefore(b):g.insertBefore(b)),b.select(),f=b,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const b=Ue(f.getTextContent());b.setFormat(s),f.replace(b),f=b}else if(!this.isCollapsed()&&e!==""){const b=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||F(b)&&(!b.canInsertTextBefore()||!b.canInsertTextAfter()))return this.insertText(""),sa(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ue(e);return E.select(),void f.replace(E)}const b=f.getFormat(),C=f.getStyle();if(a!==u||b===s&&C===o){if(Dc(f)){const E=Ue(e);return E.setFormat(s),E.setStyle(o),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ue(e);if(E.setFormat(s),E.setStyle(o),E.select(),a===0)f.insertBefore(E,!1);else{const[D]=f.splitText(a);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const v=u-a;f=f.spliceText(a,v,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=b,this.style=C))}else{const b=new Set([...f.getParentKeys(),...m.getParentKeys()]),C=F(f)?f:f.getParentOrThrow();let v=F(m)?m:m.getParentOrThrow(),E=m;if(!C.is(v)&&v.isInline())do E=v,v=v.getParentOrThrow();while(v.isInline());if(l.type==="text"&&(u!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ue(m.getTextContent());m.replace(S),m=S}Ze(l.getNode())||l.type!=="text"||(m=m.spliceText(0,u,"")),b.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else b.add(m.__key);const D=v.getChildren(),k=new Set(c),y=C.is(v),_=C.isInline()&&f.getNextSibling()===null?C:f;for(let S=D.length-1;S>=0;S--){const A=D[S];if(A.is(f)||F(A)&&A.isParentOf(f))break;A.isAttached()&&(!k.has(A)||A.is(E)?y||_.insertAfter(A,!1):A.remove())}if(!y){let S=v,A=null;for(;S!==null;){const I=S.getChildren(),B=I.length;(B===0||I[B-1].is(A))&&(b.delete(S.__key),A=S),S=S.getParent()}}if(f.isToken())if(a===h)f.select();else{const S=Ue(e);S.select(),f.replace(S)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const A=c[S],I=A.__key;b.has(I)||A.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,o=this.isBackward()?e:t;let i=s.getNode(),l=o.getNode();const a=Ur(i,Qt),u=Ur(l,Qt);z(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&z(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{en(i,d)||en(l,d)||d.getKey()===i.getKey()||d.getKey()===l.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&lr(d)){const h=Ue(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&z(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(z(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}z(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&z(i)?i.selectEnd():l.isAttached()&&z(l)&&l.selectStart(),F(a)&&F(u)&&a!==u&&(a.append(...u.getChildren()),u.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Ve(null);const n=this.getNodes(),s=[];for(const D of n)z(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(jr(k)){const y=k.getFormatFlags(e,D);k.setTextFormat(y)}})},i=s.length;if(i===0)return this.toggleFormat(e),Ve(null),void o(t);const l=this.anchor,a=this.focus,u=this.isBackward(),c=u?a:l,d=u?l:a;let f=0,h=s[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===h.getTextContentSize()&&(f=1,h=s[1],g=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const b=i-1;let C=s[b];const v=d.type==="text"?d.offset:C.getTextContentSize();if(h.is(C)){if(g===v)return;if(lr(h)||g===0&&v===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(g,v),k=g===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),d.type==="text"&&d.set(k.__key,v-g,"text")}return void(this.format=m)}g===0||lr(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);const E=C.getFormatFlags(e,m);v>0&&(v===C.getTextContentSize()||lr(C)||([C]=C.splitText(v)),C.setFormat(E));for(let D=f+1;D<b;D++){const k=s[D],y=k.getFormatFlags(e,E);k.setFormat(y)}c.type==="text"&&c.set(h.__key,g,"text"),d.type==="text"&&d.set(C.__key,v,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const g=V();return P(g)||M(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Ur(t,Qt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=Ps(this);n.splice(g,0,e),s.selectEnd()}return}if(!e.some(g=>(F(g)||_e(g))&&!g.isInline())){F(n)||M(211,t.constructor.name,t.getType());const g=Ps(this);return n.splice(g,0,e),void s.selectEnd()}const o=function(g){const m=ze();let b=null;for(let C=0;C<g.length;C++){const v=g[C],E=dr(v);if(E||_e(v)&&v.isInline()||F(v)&&v.isInline()||z(v)||v.isParentRequired()){if(b===null&&(b=v.createParentElementNode(),m.append(b),E))continue;b!==null&&b.append(v)}else m.append(v),b=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),a=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=l[l.length-1];let c=l[0];var d;F(d=c)&&Qt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||M(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&M(212,t.constructor.name,t.getType()),function(g,m,b){const C=m.getParentOrThrow().getLastChild();let v=m;const E=[m];for(;v!==C;)v.getNextSibling()||M(140),v=v.getNextSibling(),E.push(v);let D=g;for(const k of E)D=D.insertAfter(k)}(n,c));const f=Ur(i,Qt);a&&F(f)&&(a.canMergeWhenEmpty()||Qt(u))&&(f.append(...a.getChildren()),a.remove()),F(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=F(n)?n.getLastChild():null;dr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ze();return Be().splice(this.anchor.offset,0,[i]),i.select(),i}const e=Ps(this),t=Ur(this.anchor.getNode(),Qt);F(t)||M(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...s),o.selectStart(),o):null}insertLineBreak(e){const t=gr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,o=this.focus;let i=e[0],l=e[n];const[a,u]=ri(this);if(t===0)return[];if(t===1){if(z(i)&&!this.isCollapsed()){const d=a>u?u:a,f=a>u?a:u,h=i.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const c=s.isBefore(o);if(z(i)){const d=c?a:u;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(z(l)){const d=l.getTextContent().length,f=c?u:a;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[n]=l)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",l=un(s,t);if(_e(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=Do();return h.add(l.__key),void Lt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(z(f)){const h=f.__key,g=t?f.getTextContent().length:0;return s.set(h,g,"text"),void(i&&o.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,m;return F(f)?(m=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),m=h.__key,t||g++),s.set(m,g,"element"),void(i&&o.set(m,g,"element"))}}const a=je(),u=ht(a._window);if(!u)return;const c=a._blockCursorElement,d=a._rootElement;if(d===null||c===null||!F(l)||l.isInline()||l.canBeEmpty()||Ti(c,a,d),function(f,h,g,m){f.modify(h,g,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),g=Ze(h)?h:lc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),b=[];let C=!1;for(let v=0;v<m.length;v++){const E=m[v];en(E,g)?b.push(E):C=!0}if(C&&b.length>0)if(t){const v=b[0];F(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{const v=b[b.length-1];F(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(v){const E=v.focus,D=v.anchor,k=D.key,y=D.offset,_=D.type;Yt(D,E.key,E.offset,E.type),Yt(E,k,y,_),v._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),o=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(o)&&o.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const o=this.focus,i=un(o,e);if(_e(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const l=Do();l.add(i.__key),Lt(l)}else i.remove(),je().dispatchCommand(ci,void 0);return}if(!e&&F(i)&&F(s)&&s.isEmpty())return s.remove(),void i.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,u=l.getTextContentSize();if(l.is(s)||e&&a!==u||!e&&a!==0)return void vo(l,e,a)}else if(s!==null&&s.isSegmented()){const a=n.offset,u=s.getTextContentSize();if(s.is(l)||e&&a!==0||!e&&a!==u)return void vo(s,e,a)}(function(a,u){const c=a.anchor,d=a.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const g=c.offset,m=d.offset,b=g<m,C=b?g:m,v=b?m:g,E=v-1;C!==E&&(Ml(f.getTextContent().slice(C,v))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&Ze(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Nt(r){return r instanceof ms}function _o(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ri(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[_o(t),_o(n)]}function vo(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,l=0;for(let u=0;u<o;u++){const c=u===o-1;if(l=i,i+=s[u].length,e&&i===t||i>t||c){s.splice(u,1),c&&(l=void 0);break}}const a=s.join("").trim();a===""?n.remove():(n.setTextContent(a),n.select(l,l))}function Co(r,e,t,n){let s,o=e;if(r.nodeType===gn){let i=!1;const l=r.childNodes,a=l.length,u=n._blockCursorElement;o===a&&(i=!0,o=a-1);let c=l[o],d=!1;if(c===u)c=l[o+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&o--}if(s=Sr(c),z(s))o=ro(s,i);else{let f=Sr(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&M(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||M(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(F(m)&&function(b,C,v){const E=b.getParent();return v===null||E===null||!E.canBeEmpty()||E!==v.getNode()}(m,0,t)){const b=i?m.getLastDescendant():m.getFirstDescendant();b===null?f=m:(m=b,f=F(m)?m:m.getParentOrThrow()),o=0}z(m)?(s=m,f=null,o=ro(m,i)):m!==f&&i&&!d&&(F(f)||M(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&_e(f)&&Sr(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return Pt(f.__key,o,"element")}}else s=Sr(r);return z(s)?Pt(s.__key,o,"text"):null}function wo(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const o=s.getPreviousSibling(),i=s.getParent();if(e){if((t||!e)&&o===null&&F(i)&&i.isInline()){const l=i.getPreviousSibling();z(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else F(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):z(o)&&(r.key=o.__key,r.offset=o.getTextContent().length)}else if(n===s.getTextContent().length){const o=s.getNextSibling(),i=s.getParent();if(e&&F(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&F(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();z(l)&&(r.key=l.__key,r.offset=0)}}}function sa(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);wo(r,n,s),wo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=je();if(o.isComposing()&&o._compositionKey!==r.key&&P(t)){const i=t.anchor,l=t.focus;Yt(r,i.key,i.offset,i.type),Yt(e,l.key,l.offset,l.type)}}}function ia(r,e,t,n,s,o){if(r===null||t===null||!mn(s,r,t))return null;const i=Co(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=Co(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const a=Sr(r),u=Sr(t);if(_e(a)&&_e(u))return null}return sa(i,l,o),[i,l]}function ni(r){return F(r)&&!r.isInline()}function oa(r,e,t,n,s,o){const i=Kt(),l=new sr(Pt(r,e,s),Pt(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Ec(){const r=Pt("root",0,"element"),e=Pt("root",0,"element");return new sr(r,e,0,"")}function Do(){return new ms(new Set)}function ji(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,l=i==="selectionchange",a=!Us&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let u,c,d,f;if(P(r)&&!a)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&P(r)&&!mn(t,u,c))return r.clone();const h=ia(u,d,c,f,t,r);if(h===null)return null;const[g,m]=h;return new sr(g,m,P(r)?r.format:0,P(r)?r.style:"")}function V(){return Kt()._selection}function vn(){return je()._editorState._selection}function es(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),l=o.getNode();if(!e.is(i)&&!e.is(l))return;const a=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(a,c,"element"),o.set(a,c,"element"),So(r)}}else{const u=r.isBackward(),c=u?o:s,d=c.getNode(),f=u?s:o,h=f.getNode();if(e.is(d)){const g=c.offset;(t<=g&&n>0||t<g&&n<0)&&c.set(a,Math.max(0,g+n),"element")}if(e.is(h)){const g=f.offset;(t<=g&&n>0||t<g&&n<0)&&f.set(a,Math.max(0,g+n),"element")}}So(r)}function So(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!F(o))return;const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(o)){const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(i)){const l=i.getChildrenSize(),a=s>=l,u=a?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function ts(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,z(n)?(i=n.getTextContentSize(),l="text"):F(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,z(s)?l="text":F(s)&&(l="element")),o!==null&&l!==null?r.set(o,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function Eo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function kc(r,e,t,n,s,o,i){const l=n.anchorNode,a=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==o||d!==null&&wi(d))return;if(!P(e))return void(r!==null&&mn(t,l,a)&&n.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,m=h.key,b=Hn(t,g),C=Hn(t,m),v=f.offset,E=h.offset,D=e.format,k=e.style,y=e.isCollapsed();let _=b,S=C,A=!1;if(f.type==="text"){_=Gn(b);const $=f.getNode();A=$.getFormat()!==D||$.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(A=!0);var I,B,N,j,L;if(h.type==="text"&&(S=Gn(C)),_!==null&&S!==null&&(y&&(r===null||A||P(r)&&(r.format!==D||r.style!==k))&&(I=D,B=k,N=v,j=g,L=performance.now(),Yl=[I,B,N,j,L]),u!==v||c!==E||l!==_||a!==S||n.type==="Range"&&y||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(_,v,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const $=e instanceof sr&&e.anchor.type==="element"?_.childNodes[v]||null:n.rangeCount>0?n.getRangeAt(0):null;if($!==null){let X;if($ instanceof Text){const ce=document.createRange();ce.selectNode($),X=ce.getBoundingClientRect()}else X=$.getBoundingClientRect();(function(ce,ve,le){const Le=le.ownerDocument,me=Le.defaultView;if(me===null)return;let{top:he,bottom:ye}=ve,xe=0,Se=0,pe=le;for(;pe!==null;){const Ce=pe===Le.body;if(Ce)xe=0,Se=hs(ce).innerHeight;else{const ae=pe.getBoundingClientRect();xe=ae.top,Se=ae.bottom}let Ne=0;if(he<xe?Ne=-(xe-he):ye>Se&&(Ne=ye-Se),Ne!==0)if(Ce)me.scrollBy(0,Ne);else{const ae=pe.scrollTop;pe.scrollTop+=Ne;const Re=pe.scrollTop-ae;he-=Re,ye-=Re}if(Ce)break;pe=yn(pe)}})(t,X,o)}}Zs=!0}}function la(r){let e=V()||vn();e===null&&(e=Be().selectEnd()),e.insertNodes(r)}function Ps(r){let e=r;r.isCollapsed()||e.removeText();const t=V();P(t)&&(e=t),P(e)||M(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!Qt(s);)[s,o]=Ac(s,o);return o}function Ac(r,e){const t=r.getParent();if(!t){const s=ze();return Be().append(s),s.select(),[Be(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const o=e===0?0:1;return[t,s[0].getIndexWithinParent()+o]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new sr(Pt(r.__key,e,"element"),Pt(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ge=null,Ke=null,st=!1,Os=!1,On=0;const ko={characterData:!0,childList:!0,subtree:!0};function Cn(){return st||Ge!==null&&Ge._readOnly}function nt(){st&&M(13)}function aa(){On>99&&M(14)}function Kt(){return Ge===null&&M(195,ua()),Ge}function je(){return Ke===null&&M(196,ua()),Ke}function ua(){let r=0;const e=new Set,t=xs.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=cs(s);if(Di(o))r++;else if(o){let i=String(o.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function Tc(){return Ke}function Ao(r,e,t){const n=e.__type,s=function(l,a){const u=l._nodes.get(a);return u===void 0&&M(30,a),u}(r,n);let o=t.get(n);o===void 0&&(o=Array.from(s.transforms),t.set(n,o));const i=o.length;for(let l=0;l<i&&(o[l](e),e.isAttached());l++);}function To(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function ca(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function Bc(r){return Li(r,je()._nodes)}function Li(r,e){const t=r.type,n=e.get(t);n===void 0&&M(17,t);const s=n.klass;r.type!==s.getType()&&M(18,s.name);const o=s.importJSON(r),i=r.children;if(F(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const a=Li(i[l],e);o.append(a)}return o}function Bo(r,e,t){const n=Ge,s=st,o=Ke;Ge=e,st=!0,Ke=r;try{return t()}finally{Ge=n,st=s,Ke=o}}function Zt(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const o=r._editorState,i=o._selection,l=t._selection,a=r._dirtyType!==fr,u=Ge,c=st,d=Ke,f=r._updating,h=r._observer;let g=null;if(r._pendingEditorState=null,r._editorState=t,!s&&a&&h!==null){Ke=r,Ge=t,st=!1,r._updating=!0;try{const y=r._dirtyType,_=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),g=mc(o,t,r,y,_,S)}catch(y){if(y instanceof Error&&r._onError(y),Os)throw y;return ga(r,null,n,t),Nl(r),r._dirtyType=Nr,Os=!0,Zt(r,o),void(Os=!1)}finally{h.observe(n,ko),r._updating=f,Ge=u,st=c,Ke=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,b=r._dirtyElements,C=r._normalizedNodes,v=r._updateTags,E=r._deferred;a&&(r._dirtyType=fr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(y,_){const S=y._decorators;let A=y._pendingDecorators||S;const I=_._nodeMap;let B;for(B in A)I.has(B)||(A===S&&(A=Pl(y)),delete A[B])}(r,t);const D=s?null:ht(r._window);if(r._editable&&D!==null&&(a||l===null||l.dirty)){Ke=r,Ge=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const y=r._blockCursorElement;y!==null&&Ti(y,r,n),kc(i,l,r,D,v,n)}ac(r,n,l),h!==null&&h.observe(n,ko)}finally{Ke=d,Ge=u}}g!==null&&function(y,_,S,A,I){const B=Array.from(y._listeners.mutation),N=B.length;for(let j=0;j<N;j++){const[L,$]=B[j],X=_.get($);X!==void 0&&L(X,{dirtyLeaves:A,prevEditorState:I,updateTags:S})}}(r,g,v,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(ci,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,nn("decorator",r,!0,k)),function(y,_,S){const A=to(_),I=to(S);A!==I&&nn("textcontent",y,!0,I)}(r,e||o,t),nn("update",r,!0,{dirtyElements:b,dirtyLeaves:m,editorState:t,normalizedNodes:C,prevEditorState:e||o,tags:v}),function(y,_){if(y._deferred=[],_.length!==0){const S=y._updating;y._updating=!0;try{for(let A=0;A<_.length;A++)_[A]()}finally{y._updating=S}}}(r,E),function(y){const _=y._updates;if(_.length!==0){const S=_.shift();if(S){const[A,I]=S;fa(y,A,I)}}}(r)}function nn(r,e,t,...n){const s=e._updating;e._updating=t;try{const o=Array.from(e._listeners[r]);for(let i=0;i<o.length;i++)o[i].apply(null,n)}finally{e._updating=s}}function da(r,e,t){if(r._updating===!1||Ke!==r){let s=!1;return r.update(()=>{s=da(r,e,t)}),s}const n=Si(r);for(let s=4;s>=0;s--)for(let o=0;o<n.length;o++){const i=n[o]._commands.get(e);if(i!==void 0){const l=i[s];if(l!==void 0){const a=Array.from(l),u=a.length;for(let c=0;c<u;c++)if(a[c](t,r)===!0)return!0}}}return!1}function No(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[o,i]=s;let l;if(i!==void 0){if(l=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const a=r._pendingEditorState;a===null&&M(191),a._flushSync=!0}l&&r._deferred.push(l),ca(r,i.tag)}o()}}return n}function fa(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,ca(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let a=r._pendingEditorState,u=!1;(a===null||a._readOnly)&&(a=r._pendingEditorState=ha(a||l),u=!0),a._flushSync=i;const c=Ge,d=st,f=Ke,h=r._updating;Ge=a,st=!1,r._updating=!0,Ke=r;try{u&&(r._headless?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(C){const v=C.getEditorState()._selection,E=ht(C._window);return P(v)||v==null?ji(v,E,C,null):v.clone()}(r));const m=r._compositionKey;e(),o=No(r,o),function(C,v){const E=v.getEditorState()._selection,D=C._selection;if(P(D)){const k=D.anchor,y=D.focus;let _;if(k.type==="text"&&(_=k.getNode(),_.selectionTransform(E,D)),y.type==="text"){const S=y.getNode();_!==S&&S.selectionTransform(E,D)}}}(a,r),r._dirtyType!==fr&&(o?function(C,v){const E=v._dirtyLeaves,D=C._nodeMap;for(const k of E){const y=D.get(k);z(y)&&y.isAttached()&&y.isSimpleText()&&!y.isUnmergeable()&&Zi(y)}}(a,r):function(C,v){const E=v._dirtyLeaves,D=v._dirtyElements,k=C._nodeMap,y=Xt(),_=new Map;let S=E,A=S.size,I=D,B=I.size;for(;A>0||B>0;){if(A>0){v._dirtyLeaves=new Set;for(const N of S){const j=k.get(N);z(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&Zi(j),j!==void 0&&To(j,y)&&Ao(v,j,_),E.add(N)}if(S=v._dirtyLeaves,A=S.size,A>0){On++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const N of I){const j=N[0],L=N[1];if(j!=="root"&&!L)continue;const $=k.get(j);$!==void 0&&To($,y)&&Ao(v,$,_),D.set(j,L)}S=v._dirtyLeaves,A=S.size,I=v._dirtyElements,B=I.size,On++}v._dirtyLeaves=E,v._dirtyElements=D}(a,r),No(r),function(C,v,E,D){const k=C._nodeMap,y=v._nodeMap,_=[];for(const[S]of D){const A=y.get(S);A!==void 0&&(A.isAttached()||(F(A)&&ql(A,S,k,y,_,D),k.has(S)||D.delete(S),_.push(S)))}for(const S of _)y.delete(S);for(const S of E){const A=y.get(S);A===void 0||A.isAttached()||(k.has(S)||E.delete(S),y.delete(S))}}(l,a,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(a._flushSync=!0);const b=a._selection;if(P(b)){const C=a._nodeMap,v=b.anchor.key,E=b.focus.key;C.get(v)!==void 0&&C.get(E)!==void 0||M(19)}else Nt(b)&&b._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=Nr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void Zt(r)}finally{Ge=c,st=d,Ke=f,r._updating=h,On=0}r._dirtyType!==fr||function(m,b){const C=b.getEditorState()._selection,v=m._selection;if(v!==null){if(v.dirty||!v.is(C))return!0}else if(C!==null)return!0;return!1}(a,r)?a._flushSync?(a._flushSync=!1,Zt(r)):u&&rc(()=>{Zt(r)}):(a._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function at(r,e,t){r._updating?r._updates.push([e,t]):fa(r,e,t)}class sn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new sn(this.element,e,this.after)}withAfter(e){return new sn(this.element,this.before,e)}withElement(e){return new sn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&M(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(pn||as);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,o=document.createElement("br");if(n.insertBefore(o,s),e){const i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",n.insertBefore(i,o),n.__lexicalLineBreak=i}else n.__lexicalLineBreak=o}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,s))]}const o=Fo(t,n);o.push(s);const i=Fo(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<i.length;a++){const u=o[a],c=i[a];if(u===void 0||u<c)break;if(u>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function Fo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let o=n.previousSibling;o!==null;o=n.previousSibling)s++;t.push(s)}return n!==r&&M(225),t.reverse()}class Vt extends gs{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ku[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=je()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const o=t[n-1];return F(o)&&o.getLastDescendant()||o||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Qe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Qe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContent(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Wt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContentSize(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Wt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Qi[e];return!!(this.getFormat()&t)}return!1}select(e,t){nt();const n=V();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(z(a)||F(a))return a.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const a=this.getLastChild();if(z(a)||F(a))return a.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return P(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):oa(l,s,l,o,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Qi[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,o=this.getChildrenSize(),i=this.getWritable();e+t<=o||M(226,String(e),String(t),String(o));const l=i.__key,a=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=o-t+s;if(e!==0)if(e===o)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){g===null&&M(100);const b=g.getNextSibling(),C=g.__key;cr(g.getWritable()),u.push(C),g=b}}let h=d;for(let g=0;g<s;g++){const m=n[g];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const b=m.getWritable();b.__parent===l&&f--,cr(b);const C=m.__key;if(h===null)i.__first=C,b.__prev=null;else{const v=h.getWritable();v.__next=C,b.__prev=v.__key}m.__key===l&&M(76),b.__parent=l,a.push(C),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const g=c.getWritable();if(h!==null){const m=h.getWritable();g.__prev=h.__key,m.__next=c.__key}else g.__prev=null}if(i.__size=f,u.length){const g=V();if(P(g)){const m=new Set(u),b=new Set(a),{anchor:C,focus:v}=g;jo(C,m,b)&&ts(C,C.getNode(),this,d,c),jo(v,m,b)&&ts(v,v.getNode(),this,d,c),f!==0||this.canBeEmpty()||Rt(this)||this.remove()}}return i}getDOMSlot(e){return new sn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Gt(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let o=this.getFirstChild();o;o=o.getNextSibling()){const i=t.getElementByKey(o.getKey());i!==null&&(s==null?(n.insertChild(i),s=i):s!==i&&n.replaceChild(i,s),s=s.nextSibling)}}}function F(r){return r instanceof Vt}function jo(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class Nc extends gs{constructor(e){super(e)}decorate(e,t){M(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function _e(r){return r instanceof Nc}class wn extends Vt{static getType(){return"root"}static clone(){return new wn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){const e=this.__cachedText;return!Cn()&&je()._dirtyType!==fr||e===null?super.getTextContent():e}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||_e(n)||M(56)}return super.append(...e)}static importJSON(e){const t=Be();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Ze(r){return r instanceof wn}function ha(r){return new ys(new Map(r._nodeMap))}function Ri(){return new ys(new Map([["root",new wn]]))}function pa(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&M(130,t.name),F(r)){const n=e.children;Array.isArray(n)||M(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=pa(s[o]);n.push(i)}}return e}class ys{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Bo(t&&t.editor||null,this,e)}clone(e){const t=new ys(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Bo(null,this,()=>({root:pa(Be())}))}}class Pi extends Vt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Rr extends Vt{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=hr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Kn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new Rr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Zr(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Fc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Gt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=ze();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=ze();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Fc(r){const e=ze();return r.style&&(e.setFormat(r.style.textAlign),Ni(r,e)),{node:e}}function ze(){return Ot(new Rr)}function jr(r){return r instanceof Rr}const fe=0,Er=1,jc=4;function ga(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Ri(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=fr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const o=r._observer;o!==null&&(o.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function Lc(r){const e=r||{},t=Tc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=Ri(),l=e.namespace||(s!==null?s._config.namespace:Il()),a=e.editorState,u=[wn,Lr,xn,bn,Rr,Pi,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let b=u[m],C=null,v=null;if(typeof b!="function"){const y=b;b=y.replace,C=y.with,v=y.withKlass||null}const E=b.getType(),D=b.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(b):void 0,klass:b,replace:C,replaceWithKlass:v,transforms:k})}}const g=new xs(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,b){const C=new Map,v=new Set,E=D=>{Object.keys(D).forEach(k=>{let y=C.get(k);y===void 0&&(y=[],C.set(k,y)),y.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||v.has(k))return;v.add(k);const y=k.call(D.klass);y!==null&&E(y)}),b&&E(b),C}(h,d?d.import:void 0),f);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=Nr),g}class xs{constructor(e,t,n,s,o,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=fr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Il(),this._onError=o,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&M(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=s.get(e);o===void 0&&M(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(l=>l.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;o.set(t,s);const i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(t,s),()=>{o.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=fc(n).get(t.getType());if(!s)return;const o=new Map;for(const i of s.keys())o.set(i,"created");o.size>0&&e(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],o=n.replaceWithKlass;if(o!=null){const a=this.registerNodeTransformToKlass(o,t);s.push(a)}var i,l;return i=this,l=e.getType(),at(i,()=>{const a=Kt();if(a.isEmpty())return;if(l==="root")return void Be().markDirty();const u=a._nodeMap;for(const[,c]of u)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(a=>a.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=Zr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,ga(this,t,e,s),t!==null&&(this._config.disableEvents||yc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=Nr,Nl(this),this._updateTags.add("history-merge"),Zt(this),this._config.disableEvents||function(l,a){const u=l.ownerDocument,c=Zn.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ta),Zn.set(u,(c||0)+1),l.__lexicalEditor=a;const d=ea(l);for(let f=0;f<Xs.length;f++){const[h,g]=Xs[f],m=typeof g=="function"?b=>{go(b)||(po(b),(a.isEditable()||h==="click")&&g(b,a))}:b=>{if(go(b))return;po(b);const C=a.isEditable();switch(h){case"cut":return C&&G(a,hi,b);case"copy":return G(a,ls,b);case"paste":return C&&G(a,os,b);case"dragstart":return C&&G(a,wl,b);case"dragover":return C&&G(a,Dl,b);case"dragend":return C&&G(a,Tu,b);case"focus":return C&&G(a,Fu,b);case"blur":return C&&G(a,ju,b);case"drop":return C&&G(a,Cl,b)}};l.addEventListener(h,m),d.push(()=>{l.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;nn("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&M(38);let n=e;n._readOnly&&(n=ha(e),n._selection=e._selection?e._selection.clone():null),Bl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),Zt(this)),this._pendingEditorState=n,this._dirtyType=Nr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||Zt(this)}parseEditorState(e,t){return function(n,s,o){const i=Ri(),l=Ge,a=st,u=Ke,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ge=i,st=!1,Ke=s;try{const g=s._nodes;Li(n.root,g),o&&o(),i._readOnly=!0}catch(g){g instanceof Error&&s._onError(g)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ge=l,st=a,Ke=u}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return Zt(this),this.getEditorState().read(e,{editor:this})}update(e,t){at(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),at(this,()=>{const s=V(),o=Be();s!==null?s.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=ht(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,nn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}xs.version="0.21.0+prod.esm";const ma=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Rc=ma?w.useLayoutEffect:w.useEffect,Nn={tag:"history-merge"};function Pc({initialConfig:r,children:e}){const t=w.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:a}=r,u=bu(null,n),c=Lc({editable:r.editable,html:a,namespace:s,nodes:o,onError:d=>i(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Be();if(h.isEmpty()){const g=ze();h.append(g);const m=ma?document.activeElement:null;(V()!==null||m!==null&&m===d.getRootElement())&&g.select()}},Nn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Nn);break}case"object":d.setEditorState(f,Nn);break;case"function":d.update(()=>{Be().isEmpty()&&f(d)},Nn)}}}(c,l),[c,u]},[]);return Rc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),p.jsx(hl.Provider,{value:t,children:e})}const Oc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Mc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function Ic(){return function(r){const[e]=wt(),t=w.useMemo(()=>r(e),[e,r]),[n,s]=w.useState(()=>t.initialValueFn()),o=w.useRef(n);return Oc(()=>{const{initialValueFn:i,subscribe:l}=t,a=i();return o.current!==a&&(o.current=a,s(a)),l(u=>{o.current=u,s(u)})},[t,r]),n}(Mc)}function $c(){return Be().getTextContent()}function zc(r,e=!0){if(r)return!1;let t=$c();return e&&(t=t.trim()),t===""}function qc(r){if(!zc(r,!1))return!1;const e=Be().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(_e(s))return!1;if(F(s)){if(!jr(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const a=o[n];if(!z(a))return!1}}}return!0}function ya(r){return()=>qc(r)}function Uc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Uc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Wc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Gc=Wc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Kc=new Map;function Vc(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,o]=n.split(/:([^]+)/);s&&o&&(e[s.trim()]=o.trim())}return e}function xa(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,o=r.isBackward(),i=n.getNode(),l=s.getNode(),a=e.is(i),u=e.is(l);if(a||u){const[c,d]=ri(r),f=i.is(l),h=e.is(o?l:i),g=e.is(o?i:l);let m,b=0;return f?(b=c>d?d:c,m=c>d?c:d):h?(b=o?d:c,m=void 0):g&&(b=0,m=o?c:d),e.__text=e.__text.slice(b,m),e}}return e}function Hc(r){const e=r.getStyle(),t=Vc(e);Kc.set(e,t)}function Jc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),l=Be(),a=l.getFirstChild();return void(a?a.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let a=i;for(;a!==null&&a.getParent()!==null&&!l(a);)a=a.getParentOrThrow();return l(a)?a:null}(n.getNode(),Po);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!Po(l))continue;F(l)||Gc(178);const a=e();a.setFormat(l.getFormatType()),a.setIndent(l.getIndent()),l.replace(a,!0)}}function Lo(r,e){const t=un(r.focus,e);return _e(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function Qc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Yc(r){const e=r.anchor.getNode();return(Ze(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Ro(r,e,t){const n=Yc(r);Qc(r,e,t?!n:n,"character")}function Po(r){if(_e(r)||!F(r)||Rt(r))return!1;const e=r.getFirstChild(),t=e===null||dr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Xc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zc=Xc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ed=ba&&"documentMode"in document?document.documentMode:null;!(!ba||!("InputEvent"in window)||ed)&&"getTargetRanges"in new window.InputEvent("input");function _a(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function yr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Dn(r,...e){const t=_a(...e);t.length>0&&r.classList.add(...t)}function va(r,...e){const t=_a(...e);t.length>0&&r.classList.remove(...t)}function td(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function rd(r){const e=bs(r,t=>F(t)&&!t.isInline());return F(e)||Zc(4,r.__key),e}const bs=(r,e)=>{let t=r;for(;t!==Be()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function er(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function nd(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const o=n.data;if(typeof o=="string"){let i;try{i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[u,c,d,f,h,g]=a;r.update(()=>{const m=V();if(P(m)){const b=m.anchor;let C=b.getNode(),v=0,E=0;if(z(C)&&u>=0&&c>=0&&(v=u,E=u+c,m.setTextNodeRange(C,v,C,E)),v===E&&d===""||(m.insertRawText(d),C=b.getNode()),z(C)){v=f,E=f+h;const D=C.getTextContentSize();v=v>D?D:v,E=E>D?D:E,m.setTextNodeRange(C,v,C,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Ca(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let o=0;o<t.length;o++){const i=t[o];if(!Sa.has(i.nodeName)){const l=Ea(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof Pi&&i.insertAfter(gr());for(const i of o){const l=i.getChildren();for(const a of l)i.insertBefore(a);i.remove()}}(s),n}function wa(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Be().getChildren();for(let s=0;s<n.length;s++)Da(r,n[s],t,e);return t.innerHTML}function Da(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=F(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=Bi(e);h=z(h)&&n!==null?xa(n,h):h,i=h}const l=F(i)?i.getChildren():[],a=r._nodes.get(i.getType());let u;u=a&&a.exportDOM!==void 0?a.exportDOM(r,i):i.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],m=Da(r,g,f,n);!s&&F(e)&&m&&e.extractWithChild(g,n,"html")&&(s=!0)}if(s&&!o){if((Gt(c)||ao(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(ao(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const Sa=new Set(["STYLE","SCRIPT"]);function Ea(r,e,t,n,s=new Map,o){let i=[];if(Sa.has(r.nodeName))return i;let l=null;const a=function(g,m){const{nodeName:b}=g,C=m._htmlConversions.get(b.toLowerCase());let v=null;if(C!==void 0)for(const E of C){const D=E(g);D!==null&&(v===null||(v.priority||0)<=(D.priority||0))&&(v=D)}return v!==null?v.conversion:null}(r,e),u=a?a(r):null;let c=null;if(u!==null){c=u.after;const g=u.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!Rt(l))&&(l!=null&&ni(l)||n);for(let g=0;g<d.length;g++)f.push(...Ea(d[g],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Jn(r)&&(f=sd(r,f,h?()=>{const g=new Pi;return t.push(g),g}:ze)),l==null?f.length>0?i=i.concat(f):Jn(r)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Ws(g.nextSibling)&&Ws(g.previousSibling)}(r)&&(i=i.concat(gr())):F(l)&&l.append(...f),i}function sd(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(ni(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&ni(e[i+1])){const a=t();a.setFormat(n),a.append(...o),s.push(a),o=[]}}return s}function id(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var rs=id(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function od(r,e=V()){return e==null&&rs(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":wa(r,e)}function ld(r,e=V()){return e==null&&rs(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ad(r,e))}function Oo(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const i=JSON.parse(n);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return Mo(t,ud(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:a=>a}).createHTML(l):l}(s),"text/html");return Mo(t,Ca(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(P(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const a=V();if(P(a)){const u=i[l];u===`
71
+ `?n.push(mr()):i===" "?n.push(_n()):n.push(Ue(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,l=t),i.type==="element"&&function(b,C,v,E){const D=b.getNode(),k=D.getChildAtIndex(b.offset),y=Ue(),_=Ze(D)?ze().append(y):y;y.setFormat(v),y.setStyle(E),k===null?D.append(_):k.insertBefore(_),b.is(C)&&C.set(y.__key,0,"text"),b.set(y.__key,0,"text")}(i,l,s,o);const a=i.offset;let u=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||M(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(u=h,l.set(i.key,u,"text")),this.isCollapsed()&&a===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let b=f.getNextSibling();if(z(b)&&b.canInsertTextBefore()&&!ar(b)||(b=Ue(),b.setFormat(s),b.setStyle(o),g.canInsertTextAfter()?f.insertAfter(b):g.insertAfter(b)),b.select(0,0),f=b,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let b=f.getPreviousSibling();if(z(b)&&!ar(b)||(b=Ue(),b.setFormat(s),g.canInsertTextBefore()?f.insertBefore(b):g.insertBefore(b)),b.select(),f=b,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const b=Ue(f.getTextContent());b.setFormat(s),f.replace(b),f=b}else if(!this.isCollapsed()&&e!==""){const b=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||F(b)&&(!b.canInsertTextBefore()||!b.canInsertTextAfter()))return this.insertText(""),ia(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ue(e);return E.select(),void f.replace(E)}const b=f.getFormat(),C=f.getStyle();if(a!==u||b===s&&C===o){if(kc(f)){const E=Ue(e);return E.setFormat(s),E.setStyle(o),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ue(e);if(E.setFormat(s),E.setStyle(o),E.select(),a===0)f.insertBefore(E,!1);else{const[D]=f.splitText(a);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const v=u-a;f=f.spliceText(a,v,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=b,this.style=C))}else{const b=new Set([...f.getParentKeys(),...m.getParentKeys()]),C=F(f)?f:f.getParentOrThrow();let v=F(m)?m:m.getParentOrThrow(),E=m;if(!C.is(v)&&v.isInline())do E=v,v=v.getParentOrThrow();while(v.isInline());if(l.type==="text"&&(u!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ue(m.getTextContent());m.replace(S),m=S}Ze(l.getNode())||l.type!=="text"||(m=m.spliceText(0,u,"")),b.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else b.add(m.__key);const D=v.getChildren(),k=new Set(c),y=C.is(v),_=C.isInline()&&f.getNextSibling()===null?C:f;for(let S=D.length-1;S>=0;S--){const A=D[S];if(A.is(f)||F(A)&&A.isParentOf(f))break;A.isAttached()&&(!k.has(A)||A.is(E)?y||_.insertAfter(A,!1):A.remove())}if(!y){let S=v,A=null;for(;S!==null;){const I=S.getChildren(),B=I.length;(B===0||I[B-1].is(A))&&(b.delete(S.__key),A=S),S=S.getParent()}}if(f.isToken())if(a===h)f.select();else{const S=Ue(e);S.select(),f.replace(S)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const A=c[S],I=A.__key;b.has(I)||A.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,o=this.isBackward()?e:t;let i=s.getNode(),l=o.getNode();const a=Ur(i,Yt),u=Ur(l,Yt);z(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&z(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{en(i,d)||en(l,d)||d.getKey()===i.getKey()||d.getKey()===l.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&ar(d)){const h=Ue(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&z(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(z(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}z(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&z(i)?i.selectEnd():l.isAttached()&&z(l)&&l.selectStart(),F(a)&&F(u)&&a!==u&&(a.append(...u.getChildren()),u.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Ve(null);const n=this.getNodes(),s=[];for(const D of n)z(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(Lr(k)){const y=k.getFormatFlags(e,D);k.setTextFormat(y)}})},i=s.length;if(i===0)return this.toggleFormat(e),Ve(null),void o(t);const l=this.anchor,a=this.focus,u=this.isBackward(),c=u?a:l,d=u?l:a;let f=0,h=s[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===h.getTextContentSize()&&(f=1,h=s[1],g=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const b=i-1;let C=s[b];const v=d.type==="text"?d.offset:C.getTextContentSize();if(h.is(C)){if(g===v)return;if(ar(h)||g===0&&v===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(g,v),k=g===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),d.type==="text"&&d.set(k.__key,v-g,"text")}return void(this.format=m)}g===0||ar(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);const E=C.getFormatFlags(e,m);v>0&&(v===C.getTextContentSize()||ar(C)||([C]=C.splitText(v)),C.setFormat(E));for(let D=f+1;D<b;D++){const k=s[D],y=k.getFormatFlags(e,E);k.setFormat(y)}c.type==="text"&&c.set(h.__key,g,"text"),d.type==="text"&&d.set(C.__key,v,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const g=V();return P(g)||M(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Ur(t,Yt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=Os(this);n.splice(g,0,e),s.selectEnd()}return}if(!e.some(g=>(F(g)||_e(g))&&!g.isInline())){F(n)||M(211,t.constructor.name,t.getType());const g=Os(this);return n.splice(g,0,e),void s.selectEnd()}const o=function(g){const m=ze();let b=null;for(let C=0;C<g.length;C++){const v=g[C],E=fr(v);if(E||_e(v)&&v.isInline()||F(v)&&v.isInline()||z(v)||v.isParentRequired()){if(b===null&&(b=v.createParentElementNode(),m.append(b),E))continue;b!==null&&b.append(v)}else m.append(v),b=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),a=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=l[l.length-1];let c=l[0];var d;F(d=c)&&Yt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||M(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&M(212,t.constructor.name,t.getType()),function(g,m,b){const C=m.getParentOrThrow().getLastChild();let v=m;const E=[m];for(;v!==C;)v.getNextSibling()||M(140),v=v.getNextSibling(),E.push(v);let D=g;for(const k of E)D=D.insertAfter(k)}(n,c));const f=Ur(i,Yt);a&&F(f)&&(a.canMergeWhenEmpty()||Yt(u))&&(f.append(...a.getChildren()),a.remove()),F(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=F(n)?n.getLastChild():null;fr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ze();return Be().splice(this.anchor.offset,0,[i]),i.select(),i}const e=Os(this),t=Ur(this.anchor.getNode(),Yt);F(t)||M(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...s),o.selectStart(),o):null}insertLineBreak(e){const t=mr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,o=this.focus;let i=e[0],l=e[n];const[a,u]=ni(this);if(t===0)return[];if(t===1){if(z(i)&&!this.isCollapsed()){const d=a>u?u:a,f=a>u?a:u,h=i.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const c=s.isBefore(o);if(z(i)){const d=c?a:u;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(z(l)){const d=l.getTextContent().length,f=c?u:a;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[n]=l)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",l=un(s,t);if(_e(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=So();return h.add(l.__key),void Lt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(z(f)){const h=f.__key,g=t?f.getTextContent().length:0;return s.set(h,g,"text"),void(i&&o.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,m;return F(f)?(m=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),m=h.__key,t||g++),s.set(m,g,"element"),void(i&&o.set(m,g,"element"))}}const a=je(),u=ht(a._window);if(!u)return;const c=a._blockCursorElement,d=a._rootElement;if(d===null||c===null||!F(l)||l.isInline()||l.canBeEmpty()||Bi(c,a,d),function(f,h,g,m){f.modify(h,g,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),g=Ze(h)?h:cc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),b=[];let C=!1;for(let v=0;v<m.length;v++){const E=m[v];en(E,g)?b.push(E):C=!0}if(C&&b.length>0)if(t){const v=b[0];F(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{const v=b[b.length-1];F(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(v){const E=v.focus,D=v.anchor,k=D.key,y=D.offset,_=D.type;Xt(D,E.key,E.offset,E.type),Xt(E,k,y,_),v._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),o=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(o)&&o.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const o=this.focus,i=un(o,e);if(_e(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const l=So();l.add(i.__key),Lt(l)}else i.remove(),je().dispatchCommand(di,void 0);return}if(!e&&F(i)&&F(s)&&s.isEmpty())return s.remove(),void i.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,u=l.getTextContentSize();if(l.is(s)||e&&a!==u||!e&&a!==0)return void Co(l,e,a)}else if(s!==null&&s.isSegmented()){const a=n.offset,u=s.getTextContentSize();if(s.is(l)||e&&a!==0||!e&&a!==u)return void Co(s,e,a)}(function(a,u){const c=a.anchor,d=a.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const g=c.offset,m=d.offset,b=g<m,C=b?g:m,v=b?m:g,E=v-1;C!==E&&(Il(f.getTextContent().slice(C,v))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&Ze(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Nt(r){return r instanceof ms}function vo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ni(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[vo(t),vo(n)]}function Co(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,l=0;for(let u=0;u<o;u++){const c=u===o-1;if(l=i,i+=s[u].length,e&&i===t||i>t||c){s.splice(u,1),c&&(l=void 0);break}}const a=s.join("").trim();a===""?n.remove():(n.setTextContent(a),n.select(l,l))}function wo(r,e,t,n){let s,o=e;if(r.nodeType===gn){let i=!1;const l=r.childNodes,a=l.length,u=n._blockCursorElement;o===a&&(i=!0,o=a-1);let c=l[o],d=!1;if(c===u)c=l[o+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&o--}if(s=Er(c),z(s))o=no(s,i);else{let f=Er(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&M(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||M(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(F(m)&&function(b,C,v){const E=b.getParent();return v===null||E===null||!E.canBeEmpty()||E!==v.getNode()}(m,0,t)){const b=i?m.getLastDescendant():m.getFirstDescendant();b===null?f=m:(m=b,f=F(m)?m:m.getParentOrThrow()),o=0}z(m)?(s=m,f=null,o=no(m,i)):m!==f&&i&&!d&&(F(f)||M(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&_e(f)&&Er(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return Pt(f.__key,o,"element")}}else s=Er(r);return z(s)?Pt(s.__key,o,"text"):null}function Do(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const o=s.getPreviousSibling(),i=s.getParent();if(e){if((t||!e)&&o===null&&F(i)&&i.isInline()){const l=i.getPreviousSibling();z(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else F(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):z(o)&&(r.key=o.__key,r.offset=o.getTextContent().length)}else if(n===s.getTextContent().length){const o=s.getNextSibling(),i=s.getParent();if(e&&F(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&F(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();z(l)&&(r.key=l.__key,r.offset=0)}}}function ia(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Do(r,n,s),Do(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=je();if(o.isComposing()&&o._compositionKey!==r.key&&P(t)){const i=t.anchor,l=t.focus;Xt(r,i.key,i.offset,i.type),Xt(e,l.key,l.offset,l.type)}}}function oa(r,e,t,n,s,o){if(r===null||t===null||!mn(s,r,t))return null;const i=wo(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=wo(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const a=Er(r),u=Er(t);if(_e(a)&&_e(u))return null}return ia(i,l,o),[i,l]}function si(r){return F(r)&&!r.isInline()}function la(r,e,t,n,s,o){const i=Vt(),l=new ir(Pt(r,e,s),Pt(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Tc(){const r=Pt("root",0,"element"),e=Pt("root",0,"element");return new ir(r,e,0,"")}function So(){return new ms(new Set)}function Li(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,l=i==="selectionchange",a=!Ws&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let u,c,d,f;if(P(r)&&!a)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&P(r)&&!mn(t,u,c))return r.clone();const h=oa(u,d,c,f,t,r);if(h===null)return null;const[g,m]=h;return new ir(g,m,P(r)?r.format:0,P(r)?r.style:"")}function V(){return Vt()._selection}function vn(){return je()._editorState._selection}function es(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),l=o.getNode();if(!e.is(i)&&!e.is(l))return;const a=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(a,c,"element"),o.set(a,c,"element"),Eo(r)}}else{const u=r.isBackward(),c=u?o:s,d=c.getNode(),f=u?s:o,h=f.getNode();if(e.is(d)){const g=c.offset;(t<=g&&n>0||t<g&&n<0)&&c.set(a,Math.max(0,g+n),"element")}if(e.is(h)){const g=f.offset;(t<=g&&n>0||t<g&&n<0)&&f.set(a,Math.max(0,g+n),"element")}}Eo(r)}function Eo(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!F(o))return;const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(o)){const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(i)){const l=i.getChildrenSize(),a=s>=l,u=a?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function ts(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,z(n)?(i=n.getTextContentSize(),l="text"):F(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,z(s)?l="text":F(s)&&(l="element")),o!==null&&l!==null?r.set(o,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function ko(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Bc(r,e,t,n,s,o,i){const l=n.anchorNode,a=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==o||d!==null&&Di(d))return;if(!P(e))return void(r!==null&&mn(t,l,a)&&n.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,m=h.key,b=Hn(t,g),C=Hn(t,m),v=f.offset,E=h.offset,D=e.format,k=e.style,y=e.isCollapsed();let _=b,S=C,A=!1;if(f.type==="text"){_=Gn(b);const $=f.getNode();A=$.getFormat()!==D||$.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(A=!0);var I,B,N,j,L;if(h.type==="text"&&(S=Gn(C)),_!==null&&S!==null&&(y&&(r===null||A||P(r)&&(r.format!==D||r.style!==k))&&(I=D,B=k,N=v,j=g,L=performance.now(),Xl=[I,B,N,j,L]),u!==v||c!==E||l!==_||a!==S||n.type==="Range"&&y||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(_,v,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const $=e instanceof ir&&e.anchor.type==="element"?_.childNodes[v]||null:n.rangeCount>0?n.getRangeAt(0):null;if($!==null){let X;if($ instanceof Text){const ce=document.createRange();ce.selectNode($),X=ce.getBoundingClientRect()}else X=$.getBoundingClientRect();(function(ce,ve,le){const Le=le.ownerDocument,me=Le.defaultView;if(me===null)return;let{top:he,bottom:ye}=ve,xe=0,Se=0,pe=le;for(;pe!==null;){const Ce=pe===Le.body;if(Ce)xe=0,Se=hs(ce).innerHeight;else{const ae=pe.getBoundingClientRect();xe=ae.top,Se=ae.bottom}let Ne=0;if(he<xe?Ne=-(xe-he):ye>Se&&(Ne=ye-Se),Ne!==0)if(Ce)me.scrollBy(0,Ne);else{const ae=pe.scrollTop;pe.scrollTop+=Ne;const Re=pe.scrollTop-ae;he-=Re,ye-=Re}if(Ce)break;pe=yn(pe)}})(t,X,o)}}ei=!0}}function aa(r){let e=V()||vn();e===null&&(e=Be().selectEnd()),e.insertNodes(r)}function Os(r){let e=r;r.isCollapsed()||e.removeText();const t=V();P(t)&&(e=t),P(e)||M(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!Yt(s);)[s,o]=Nc(s,o);return o}function Nc(r,e){const t=r.getParent();if(!t){const s=ze();return Be().append(s),s.select(),[Be(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const o=e===0?0:1;return[t,s[0].getIndexWithinParent()+o]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new ir(Pt(r.__key,e,"element"),Pt(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ge=null,Ke=null,st=!1,Ms=!1,On=0;const Ao={characterData:!0,childList:!0,subtree:!0};function Cn(){return st||Ge!==null&&Ge._readOnly}function nt(){st&&M(13)}function ua(){On>99&&M(14)}function Vt(){return Ge===null&&M(195,ca()),Ge}function je(){return Ke===null&&M(196,ca()),Ke}function ca(){let r=0;const e=new Set,t=xs.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=cs(s);if(Si(o))r++;else if(o){let i=String(o.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function Fc(){return Ke}function To(r,e,t){const n=e.__type,s=function(l,a){const u=l._nodes.get(a);return u===void 0&&M(30,a),u}(r,n);let o=t.get(n);o===void 0&&(o=Array.from(s.transforms),t.set(n,o));const i=o.length;for(let l=0;l<i&&(o[l](e),e.isAttached());l++);}function Bo(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function da(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function jc(r){return Ri(r,je()._nodes)}function Ri(r,e){const t=r.type,n=e.get(t);n===void 0&&M(17,t);const s=n.klass;r.type!==s.getType()&&M(18,s.name);const o=s.importJSON(r),i=r.children;if(F(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const a=Ri(i[l],e);o.append(a)}return o}function No(r,e,t){const n=Ge,s=st,o=Ke;Ge=e,st=!0,Ke=r;try{return t()}finally{Ge=n,st=s,Ke=o}}function er(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const o=r._editorState,i=o._selection,l=t._selection,a=r._dirtyType!==hr,u=Ge,c=st,d=Ke,f=r._updating,h=r._observer;let g=null;if(r._pendingEditorState=null,r._editorState=t,!s&&a&&h!==null){Ke=r,Ge=t,st=!1,r._updating=!0;try{const y=r._dirtyType,_=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),g=bc(o,t,r,y,_,S)}catch(y){if(y instanceof Error&&r._onError(y),Ms)throw y;return ya(r,null,n,t),Fl(r),r._dirtyType=Fr,Ms=!0,er(r,o),void(Ms=!1)}finally{h.observe(n,Ao),r._updating=f,Ge=u,st=c,Ke=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,b=r._dirtyElements,C=r._normalizedNodes,v=r._updateTags,E=r._deferred;a&&(r._dirtyType=hr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(y,_){const S=y._decorators;let A=y._pendingDecorators||S;const I=_._nodeMap;let B;for(B in A)I.has(B)||(A===S&&(A=Ol(y)),delete A[B])}(r,t);const D=s?null:ht(r._window);if(r._editable&&D!==null&&(a||l===null||l.dirty)){Ke=r,Ge=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const y=r._blockCursorElement;y!==null&&Bi(y,r,n),Bc(i,l,r,D,v,n)}dc(r,n,l),h!==null&&h.observe(n,Ao)}finally{Ke=d,Ge=u}}g!==null&&function(y,_,S,A,I){const B=Array.from(y._listeners.mutation),N=B.length;for(let j=0;j<N;j++){const[L,$]=B[j],X=_.get($);X!==void 0&&L(X,{dirtyLeaves:A,prevEditorState:I,updateTags:S})}}(r,g,v,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(di,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,nn("decorator",r,!0,k)),function(y,_,S){const A=ro(_),I=ro(S);A!==I&&nn("textcontent",y,!0,I)}(r,e||o,t),nn("update",r,!0,{dirtyElements:b,dirtyLeaves:m,editorState:t,normalizedNodes:C,prevEditorState:e||o,tags:v}),function(y,_){if(y._deferred=[],_.length!==0){const S=y._updating;y._updating=!0;try{for(let A=0;A<_.length;A++)_[A]()}finally{y._updating=S}}}(r,E),function(y){const _=y._updates;if(_.length!==0){const S=_.shift();if(S){const[A,I]=S;ha(y,A,I)}}}(r)}function nn(r,e,t,...n){const s=e._updating;e._updating=t;try{const o=Array.from(e._listeners[r]);for(let i=0;i<o.length;i++)o[i].apply(null,n)}finally{e._updating=s}}function fa(r,e,t){if(r._updating===!1||Ke!==r){let s=!1;return r.update(()=>{s=fa(r,e,t)}),s}const n=Ei(r);for(let s=4;s>=0;s--)for(let o=0;o<n.length;o++){const i=n[o]._commands.get(e);if(i!==void 0){const l=i[s];if(l!==void 0){const a=Array.from(l),u=a.length;for(let c=0;c<u;c++)if(a[c](t,r)===!0)return!0}}}return!1}function Fo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[o,i]=s;let l;if(i!==void 0){if(l=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const a=r._pendingEditorState;a===null&&M(191),a._flushSync=!0}l&&r._deferred.push(l),da(r,i.tag)}o()}}return n}function ha(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,da(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let a=r._pendingEditorState,u=!1;(a===null||a._readOnly)&&(a=r._pendingEditorState=ga(a||l),u=!0),a._flushSync=i;const c=Ge,d=st,f=Ke,h=r._updating;Ge=a,st=!1,r._updating=!0,Ke=r;try{u&&(r._headless?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(C){const v=C.getEditorState()._selection,E=ht(C._window);return P(v)||v==null?Li(v,E,C,null):v.clone()}(r));const m=r._compositionKey;e(),o=Fo(r,o),function(C,v){const E=v.getEditorState()._selection,D=C._selection;if(P(D)){const k=D.anchor,y=D.focus;let _;if(k.type==="text"&&(_=k.getNode(),_.selectionTransform(E,D)),y.type==="text"){const S=y.getNode();_!==S&&S.selectionTransform(E,D)}}}(a,r),r._dirtyType!==hr&&(o?function(C,v){const E=v._dirtyLeaves,D=C._nodeMap;for(const k of E){const y=D.get(k);z(y)&&y.isAttached()&&y.isSimpleText()&&!y.isUnmergeable()&&eo(y)}}(a,r):function(C,v){const E=v._dirtyLeaves,D=v._dirtyElements,k=C._nodeMap,y=Zt(),_=new Map;let S=E,A=S.size,I=D,B=I.size;for(;A>0||B>0;){if(A>0){v._dirtyLeaves=new Set;for(const N of S){const j=k.get(N);z(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&eo(j),j!==void 0&&Bo(j,y)&&To(v,j,_),E.add(N)}if(S=v._dirtyLeaves,A=S.size,A>0){On++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const N of I){const j=N[0],L=N[1];if(j!=="root"&&!L)continue;const $=k.get(j);$!==void 0&&Bo($,y)&&To(v,$,_),D.set(j,L)}S=v._dirtyLeaves,A=S.size,I=v._dirtyElements,B=I.size,On++}v._dirtyLeaves=E,v._dirtyElements=D}(a,r),Fo(r),function(C,v,E,D){const k=C._nodeMap,y=v._nodeMap,_=[];for(const[S]of D){const A=y.get(S);A!==void 0&&(A.isAttached()||(F(A)&&Ul(A,S,k,y,_,D),k.has(S)||D.delete(S),_.push(S)))}for(const S of _)y.delete(S);for(const S of E){const A=y.get(S);A===void 0||A.isAttached()||(k.has(S)||E.delete(S),y.delete(S))}}(l,a,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(a._flushSync=!0);const b=a._selection;if(P(b)){const C=a._nodeMap,v=b.anchor.key,E=b.focus.key;C.get(v)!==void 0&&C.get(E)!==void 0||M(19)}else Nt(b)&&b._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=Fr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void er(r)}finally{Ge=c,st=d,Ke=f,r._updating=h,On=0}r._dirtyType!==hr||function(m,b){const C=b.getEditorState()._selection,v=m._selection;if(v!==null){if(v.dirty||!v.is(C))return!0}else if(C!==null)return!0;return!1}(a,r)?a._flushSync?(a._flushSync=!1,er(r)):u&&ic(()=>{er(r)}):(a._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function at(r,e,t){r._updating?r._updates.push([e,t]):ha(r,e,t)}class sn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new sn(this.element,e,this.after)}withAfter(e){return new sn(this.element,this.before,e)}withElement(e){return new sn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&M(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(pn||as);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,o=document.createElement("br");if(n.insertBefore(o,s),e){const i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",n.insertBefore(i,o),n.__lexicalLineBreak=i}else n.__lexicalLineBreak=o}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,s))]}const o=jo(t,n);o.push(s);const i=jo(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<i.length;a++){const u=o[a],c=i[a];if(u===void 0||u<c)break;if(u>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function jo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let o=n.previousSibling;o!==null;o=n.previousSibling)s++;t.push(s)}return n!==r&&M(225),t.reverse()}class Ht extends gs{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ju[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=je()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const o=t[n-1];return F(o)&&o.getLastDescendant()||o||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Qe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Qe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContent(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Gt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContentSize(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Gt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Yi[e];return!!(this.getFormat()&t)}return!1}select(e,t){nt();const n=V();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(z(a)||F(a))return a.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const a=this.getLastChild();if(z(a)||F(a))return a.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return P(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):la(l,s,l,o,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Yi[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,o=this.getChildrenSize(),i=this.getWritable();e+t<=o||M(226,String(e),String(t),String(o));const l=i.__key,a=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=o-t+s;if(e!==0)if(e===o)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){g===null&&M(100);const b=g.getNextSibling(),C=g.__key;dr(g.getWritable()),u.push(C),g=b}}let h=d;for(let g=0;g<s;g++){const m=n[g];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const b=m.getWritable();b.__parent===l&&f--,dr(b);const C=m.__key;if(h===null)i.__first=C,b.__prev=null;else{const v=h.getWritable();v.__next=C,b.__prev=v.__key}m.__key===l&&M(76),b.__parent=l,a.push(C),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const g=c.getWritable();if(h!==null){const m=h.getWritable();g.__prev=h.__key,m.__next=c.__key}else g.__prev=null}if(i.__size=f,u.length){const g=V();if(P(g)){const m=new Set(u),b=new Set(a),{anchor:C,focus:v}=g;Lo(C,m,b)&&ts(C,C.getNode(),this,d,c),Lo(v,m,b)&&ts(v,v.getNode(),this,d,c),f!==0||this.canBeEmpty()||Rt(this)||this.remove()}}return i}getDOMSlot(e){return new sn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let o=this.getFirstChild();o;o=o.getNextSibling()){const i=t.getElementByKey(o.getKey());i!==null&&(s==null?(n.insertChild(i),s=i):s!==i&&n.replaceChild(i,s),s=s.nextSibling)}}}function F(r){return r instanceof Ht}function Lo(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class pa extends gs{constructor(e){super(e)}decorate(e,t){M(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function _e(r){return r instanceof pa}class wn extends Ht{static getType(){return"root"}static clone(){return new wn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){const e=this.__cachedText;return!Cn()&&je()._dirtyType!==hr||e===null?super.getTextContent():e}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||_e(n)||M(56)}return super.append(...e)}static importJSON(e){const t=Be();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Ze(r){return r instanceof wn}function ga(r){return new ys(new Map(r._nodeMap))}function Pi(){return new ys(new Map([["root",new wn]]))}function ma(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&M(130,t.name),F(r)){const n=e.children;Array.isArray(n)||M(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=ma(s[o]);n.push(i)}}return e}class ys{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return No(t&&t.editor||null,this,e)}clone(e){const t=new ys(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return No(null,this,()=>({root:ma(Be())}))}}class Oi extends Ht{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Pr extends Ht{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=pr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Kn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new Pr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Zr(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Lc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=ze();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=ze();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Lc(r){const e=ze();return r.style&&(e.setFormat(r.style.textAlign),Fi(r,e)),{node:e}}function ze(){return Ot(new Pr)}function Lr(r){return r instanceof Pr}const fe=0,kr=1,Rc=4;function ya(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Pi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=hr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const o=r._observer;o!==null&&(o.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function Pc(r){const e=r||{},t=Fc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=Pi(),l=e.namespace||(s!==null?s._config.namespace:$l()),a=e.editorState,u=[wn,Rr,xn,bn,Pr,Oi,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let b=u[m],C=null,v=null;if(typeof b!="function"){const y=b;b=y.replace,C=y.with,v=y.withKlass||null}const E=b.getType(),D=b.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(b):void 0,klass:b,replace:C,replaceWithKlass:v,transforms:k})}}const g=new xs(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,b){const C=new Map,v=new Set,E=D=>{Object.keys(D).forEach(k=>{let y=C.get(k);y===void 0&&(y=[],C.set(k,y)),y.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||v.has(k))return;v.add(k);const y=k.call(D.klass);y!==null&&E(y)}),b&&E(b),C}(h,d?d.import:void 0),f);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=Fr),g}class xs{constructor(e,t,n,s,o,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=hr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=$l(),this._onError=o,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&M(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=s.get(e);o===void 0&&M(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(l=>l.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;o.set(t,s);const i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(t,s),()=>{o.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=gc(n).get(t.getType());if(!s)return;const o=new Map;for(const i of s.keys())o.set(i,"created");o.size>0&&e(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],o=n.replaceWithKlass;if(o!=null){const a=this.registerNodeTransformToKlass(o,t);s.push(a)}var i,l;return i=this,l=e.getType(),at(i,()=>{const a=Vt();if(a.isEmpty())return;if(l==="root")return void Be().markDirty();const u=a._nodeMap;for(const[,c]of u)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(a=>a.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=Zr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,ya(this,t,e,s),t!==null&&(this._config.disableEvents||_c(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=Fr,Fl(this),this._updateTags.add("history-merge"),er(this),this._config.disableEvents||function(l,a){const u=l.ownerDocument,c=Zn.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ra),Zn.set(u,(c||0)+1),l.__lexicalEditor=a;const d=ta(l);for(let f=0;f<Zs.length;f++){const[h,g]=Zs[f],m=typeof g=="function"?b=>{mo(b)||(go(b),(a.isEditable()||h==="click")&&g(b,a))}:b=>{if(mo(b))return;go(b);const C=a.isEditable();switch(h){case"cut":return C&&G(a,pi,b);case"copy":return G(a,ls,b);case"paste":return C&&G(a,os,b);case"dragstart":return C&&G(a,Dl,b);case"dragover":return C&&G(a,Sl,b);case"dragend":return C&&G(a,Fu,b);case"focus":return C&&G(a,Ru,b);case"blur":return C&&G(a,Pu,b);case"drop":return C&&G(a,wl,b)}};l.addEventListener(h,m),d.push(()=>{l.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;nn("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&M(38);let n=e;n._readOnly&&(n=ga(e),n._selection=e._selection?e._selection.clone():null),Nl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),er(this)),this._pendingEditorState=n,this._dirtyType=Fr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||er(this)}parseEditorState(e,t){return function(n,s,o){const i=Pi(),l=Ge,a=st,u=Ke,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ge=i,st=!1,Ke=s;try{const g=s._nodes;Ri(n.root,g),o&&o(),i._readOnly=!0}catch(g){g instanceof Error&&s._onError(g)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ge=l,st=a,Ke=u}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return er(this),this.getEditorState().read(e,{editor:this})}update(e,t){at(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),at(this,()=>{const s=V(),o=Be();s!==null?s.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=ht(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,nn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}xs.version="0.21.0+prod.esm";const xa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Oc=xa?w.useLayoutEffect:w.useEffect,Nn={tag:"history-merge"};function Mc({initialConfig:r,children:e}){const t=w.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:a}=r,u=Cu(null,n),c=Pc({editable:r.editable,html:a,namespace:s,nodes:o,onError:d=>i(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Be();if(h.isEmpty()){const g=ze();h.append(g);const m=xa?document.activeElement:null;(V()!==null||m!==null&&m===d.getRootElement())&&g.select()}},Nn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Nn);break}case"object":d.setEditorState(f,Nn);break;case"function":d.update(()=>{Be().isEmpty()&&f(d)},Nn)}}}(c,l),[c,u]},[]);return Oc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),p.jsx(pl.Provider,{value:t,children:e})}const Ic=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function $c(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function zc(){return function(r){const[e]=wt(),t=w.useMemo(()=>r(e),[e,r]),[n,s]=w.useState(()=>t.initialValueFn()),o=w.useRef(n);return Ic(()=>{const{initialValueFn:i,subscribe:l}=t,a=i();return o.current!==a&&(o.current=a,s(a)),l(u=>{o.current=u,s(u)})},[t,r]),n}($c)}function qc(){return Be().getTextContent()}function Uc(r,e=!0){if(r)return!1;let t=qc();return e&&(t=t.trim()),t===""}function Wc(r){if(!Uc(r,!1))return!1;const e=Be().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(_e(s))return!1;if(F(s)){if(!Lr(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const a=o[n];if(!z(a))return!1}}}return!0}function ba(r){return()=>Wc(r)}function Gc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Gc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Kc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vc=Kc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Hc=new Map;function Jc(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,o]=n.split(/:([^]+)/);s&&o&&(e[s.trim()]=o.trim())}return e}function _a(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,o=r.isBackward(),i=n.getNode(),l=s.getNode(),a=e.is(i),u=e.is(l);if(a||u){const[c,d]=ni(r),f=i.is(l),h=e.is(o?l:i),g=e.is(o?i:l);let m,b=0;return f?(b=c>d?d:c,m=c>d?c:d):h?(b=o?d:c,m=void 0):g&&(b=0,m=o?c:d),e.__text=e.__text.slice(b,m),e}}return e}function Qc(r){const e=r.getStyle(),t=Jc(e);Hc.set(e,t)}function Yc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),l=Be(),a=l.getFirstChild();return void(a?a.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let a=i;for(;a!==null&&a.getParent()!==null&&!l(a);)a=a.getParentOrThrow();return l(a)?a:null}(n.getNode(),Oo);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!Oo(l))continue;F(l)||Vc(178);const a=e();a.setFormat(l.getFormatType()),a.setIndent(l.getIndent()),l.replace(a,!0)}}function Ro(r,e){const t=un(r.focus,e);return _e(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function Xc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Zc(r){const e=r.anchor.getNode();return(Ze(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Po(r,e,t){const n=Zc(r);Xc(r,e,t?!n:n,"character")}function Oo(r){if(_e(r)||!F(r)||Rt(r))return!1;const e=r.getFirstChild(),t=e===null||fr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function ed(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var td=ed(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const va=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,rd=va&&"documentMode"in document?document.documentMode:null;!(!va||!("InputEvent"in window)||rd)&&"getTargetRanges"in new window.InputEvent("input");function Ca(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function xr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Dn(r,...e){const t=Ca(...e);t.length>0&&r.classList.add(...t)}function wa(r,...e){const t=Ca(...e);t.length>0&&r.classList.remove(...t)}function nd(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function sd(r){const e=bs(r,t=>F(t)&&!t.isInline());return F(e)||td(4,r.__key),e}const bs=(r,e)=>{let t=r;for(;t!==Be()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function tr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function id(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const o=n.data;if(typeof o=="string"){let i;try{i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[u,c,d,f,h,g]=a;r.update(()=>{const m=V();if(P(m)){const b=m.anchor;let C=b.getNode(),v=0,E=0;if(z(C)&&u>=0&&c>=0&&(v=u,E=u+c,m.setTextNodeRange(C,v,C,E)),v===E&&d===""||(m.insertRawText(d),C=b.getNode()),z(C)){v=f,E=f+h;const D=C.getTextContentSize();v=v>D?D:v,E=E>D?D:E,m.setTextNodeRange(C,v,C,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Da(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let o=0;o<t.length;o++){const i=t[o];if(!ka.has(i.nodeName)){const l=Aa(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof Oi&&i.insertAfter(mr());for(const i of o){const l=i.getChildren();for(const a of l)i.insertBefore(a);i.remove()}}(s),n}function Sa(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Be().getChildren();for(let s=0;s<n.length;s++)Ea(r,n[s],t,e);return t.innerHTML}function Ea(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=F(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=Ni(e);h=z(h)&&n!==null?_a(n,h):h,i=h}const l=F(i)?i.getChildren():[],a=r._nodes.get(i.getType());let u;u=a&&a.exportDOM!==void 0?a.exportDOM(r,i):i.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],m=Ea(r,g,f,n);!s&&F(e)&&m&&e.extractWithChild(g,n,"html")&&(s=!0)}if(s&&!o){if((Kt(c)||uo(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(uo(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const ka=new Set(["STYLE","SCRIPT"]);function Aa(r,e,t,n,s=new Map,o){let i=[];if(ka.has(r.nodeName))return i;let l=null;const a=function(g,m){const{nodeName:b}=g,C=m._htmlConversions.get(b.toLowerCase());let v=null;if(C!==void 0)for(const E of C){const D=E(g);D!==null&&(v===null||(v.priority||0)<=(D.priority||0))&&(v=D)}return v!==null?v.conversion:null}(r,e),u=a?a(r):null;let c=null;if(u!==null){c=u.after;const g=u.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!Rt(l))&&(l!=null&&si(l)||n);for(let g=0;g<d.length;g++)f.push(...Aa(d[g],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Jn(r)&&(f=od(r,f,h?()=>{const g=new Oi;return t.push(g),g}:ze)),l==null?f.length>0?i=i.concat(f):Jn(r)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Gs(g.nextSibling)&&Gs(g.previousSibling)}(r)&&(i=i.concat(mr())):F(l)&&l.append(...f),i}function od(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(si(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&si(e[i+1])){const a=t();a.setFormat(n),a.append(...o),s.push(a),o=[]}}return s}function ld(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var rs=ld(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function ad(r,e=V()){return e==null&&rs(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":Sa(r,e)}function ud(r,e=V()){return e==null&&rs(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(cd(r,e))}function Mo(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const i=JSON.parse(n);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return Io(t,dd(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:a=>a}).createHTML(l):l}(s),"text/html");return Io(t,Da(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(P(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const a=V();if(P(a)){const u=i[l];u===`
72
72
  `||u===`\r
73
- `?a.insertParagraph():u===" "?a.insertNodes([_n()]):a.insertText(u)}}}else e.insertRawText(o)}function Mo(r,e,t){r.dispatchCommand(_u,{nodes:e,selection:t})||t.insertNodes(e)}function ka(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=F(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let u=Bi(t);u=z(u)&&e!==null?xa(e,u):u,i=u}const l=F(i)?i.getChildren():[],a=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&rs(58,d.name),F(u)){const f=c.children;Array.isArray(f)||rs(59,d.name)}return c}(i);if(z(i)){const u=i.__text;u.length>0?a.text=u:s=!1}for(let u=0;u<l.length;u++){const c=l[u],d=ka(r,e,c,a.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(a);else if(Array.isArray(a.children))for(let u=0;u<a.children.length;u++){const c=a.children[u];n.push(c)}return s}function ad(r,e){const t=[],n=Be().getChildren();for(let s=0;s<n.length;s++)ka(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function ud(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Bc(n);z(s)&&Hc(s),e.push(s)}return e}let Cr=null;async function Io(r,e,t){if(Cr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a($o(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=ht(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((a,u)=>{const c=r.registerCommand(ls,d=>(er(d,ClipboardEvent)&&(c(),Cr!==null&&(window.clearTimeout(Cr),Cr=null),a($o(r,d,t))),!0),jc);Cr=window.setTimeout(()=>{c(),Cr=null,a(!1)},50),s.execCommand("copy"),i.remove()})}function $o(r,e,t){if(t===void 0){const s=ht(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!mn(r,o,i))return!1;const l=V();if(l===null)return!1;t=dd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(fd(n,t),!0)}const cd=[["text/html",od],["application/x-lexical-editor",ld]];function dd(r=V()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=cc();for(const[n,s]of cd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function fd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function zo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Pr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hd=Pr&&"documentMode"in document?document.documentMode:null,pd=!(!Pr||!("InputEvent"in window)||hd)&&"getTargetRanges"in new window.InputEvent("input"),gd=Pr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),qo=Pr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,md=Pr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yd=Pr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!md,Uo=hn();class _s extends Vt{static getType(){return"quote"}static clone(e){return new _s(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Dn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:xd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Gt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Oi();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=ze(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ze();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Oi(){return Ot(new _s)}class vs extends Vt{static getType(){return"heading"}static clone(e){return new vs(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const o=s[t];Dn(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:wr,priority:0}),h2:e=>({conversion:wr,priority:0}),h3:e=>({conversion:wr,priority:0}),h4:e=>({conversion:wr,priority:0}),h5:e=>({conversion:wr,priority:0}),h6:e=>({conversion:wr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Wo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Wo(e)?{conversion:t=>({node:Jr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Gt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Jr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ze():Jr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ze();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ze():Jr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Wo(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function wr(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Jr(e),r.style!==null&&(Ni(r,t),t.setFormat(r.style.textAlign))),{node:t}}function xd(r){const e=Oi();return r.style!==null&&(e.setFormat(r.style.textAlign),Ni(r,e)),{node:e}}function Jr(r){return Ot(new vs(r))}function Fn(r){let e=null;if(er(r,DragEvent)?e=r.dataTransfer:er(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function Go(r){const e=V();if(!P(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const o=n[s],i=o.getKey();if(t.has(i))continue;const l=bs(o,u=>F(u)&&!u.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),r(l))}return t.size>0}function jn(r){const e=Fr(r);return _e(e)}function bd(r){return yr(r.registerCommand(pl,e=>{const t=V();return!!Nt(t)&&(t.clear(),!0)},0),r.registerCommand(ur,e=>{const t=V();return!!P(t)&&(t.deleteCharacter(e),!0)},fe),r.registerCommand(ln,e=>{const t=V();return!!P(t)&&(t.deleteWord(e),!0)},fe),r.registerCommand(an,e=>{const t=V();return!!P(t)&&(t.deleteLine(e),!0)},fe),r.registerCommand(Ar,e=>{const t=V();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Oo(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},fe),r.registerCommand(zs,()=>{const e=V();return!!P(e)&&(e.removeText(),!0)},fe),r.registerCommand(vt,e=>{const t=V();return!!P(t)&&(t.formatText(e),!0)},fe),r.registerCommand(Au,e=>{const t=V();if(!P(t)&&!Nt(t))return!1;const n=t.getNodes();for(const s of n){const o=bs(s,i=>F(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},fe),r.registerCommand(kr,e=>{const t=V();return!!P(t)&&(t.insertLineBreak(e),!0)},fe),r.registerCommand(on,()=>{const e=V();return!!P(e)&&(e.insertParagraph(),!0)},fe),r.registerCommand(Eu,()=>(la([_n()]),!0),fe),r.registerCommand(ku,()=>Go(e=>{const t=e.getIndent();e.setIndent(t+1)}),fe),r.registerCommand(Ji,()=>Go(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),fe),r.registerCommand(yl,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=un(t.focus,!0);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},fe),r.registerCommand(xl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===Be().getChildrenSize()}(t))return e.preventDefault(),!0;const n=un(t.focus,!1);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},fe),r.registerCommand(ml,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Lo(t,!0)){const n=e.shiftKey;return e.preventDefault(),Ro(t,n,!0),!0}return!1},fe),r.registerCommand(gl,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!P(t))return!1;const n=e.shiftKey;return!!Lo(t,!1)&&(e.preventDefault(),Ro(t,n,!1),!0)},fe),r.registerCommand(bl,e=>{if(jn(e.target))return!1;const t=V();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ze(s)&&rd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Ji,void 0)):(!qo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(ur,!0))},fe),r.registerCommand(vl,e=>{if(jn(e.target))return!1;const t=V();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(ur,!1))},fe),r.registerCommand($n,e=>{const t=V();if(!P(t))return!1;if(e!==null){if((qo||gd||yd)&&pd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(kr,!1)}return r.dispatchCommand(on,void 0)},fe),r.registerCommand(_l,()=>{const e=V();return!!P(e)&&(r.blur(),!0)},fe),r.registerCommand(Cl,e=>{const[,t]=Fn(e);if(t.length>0){const s=zo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=Fr(i);if(l!==null){const a=Ec();if(z(l))a.anchor.set(l.getKey(),o,"text"),a.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(c,d,"element"),a.focus.set(c,d,"element")}const u=Fl(a);Lt(u)}r.dispatchCommand(Uo,t)}return e.preventDefault(),!0}const n=V();return!!P(n)},fe),r.registerCommand(wl,e=>{const[t]=Fn(e),n=V();return!(t&&!P(n))},fe),r.registerCommand(Dl,e=>{const[t]=Fn(e),n=V();if(t&&!P(n))return!1;const s=zo(e.clientX,e.clientY);if(s!==null){const o=Fr(s.node);_e(o)&&e.preventDefault()}return!0},fe),r.registerCommand(qs,()=>(oc(),!0),fe),r.registerCommand(ls,e=>(Io(r,er(e,ClipboardEvent)?e:null),!0),fe),r.registerCommand(hi,e=>(async function(t,n){await Io(n,er(t,ClipboardEvent)?t:null),n.update(()=>{const s=V();P(s)?s.removeText():Nt(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),fe),r.registerCommand(os,e=>{const[,t,n]=Fn(e);return t.length>0&&!n?(r.dispatchCommand(Uo,t),!0):wi(e.target)?!1:V()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=V(),l=er(s,InputEvent)||er(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&Oo(l,i,o)},{tag:"paste"})}(e,r),!0)},fe))}const si=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Ko(r){return r.getEditorState().read(ya(r.isComposing()))}function _d({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=wt(),s=function(o,i){const[l,a]=w.useState(()=>o.getDecorators());return si(()=>o.registerDecoratorListener(u=>{Ii.flushSync(()=>{a(u)})}),[o]),w.useEffect(()=>{a(o.getDecorators())},[o]),w.useMemo(()=>{const u=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=p.jsx(i,{onError:m=>o._onError(m),children:p.jsx(w.Suspense,{fallback:null,children:l[f]})}),g=o.getElementByKey(f);g!==null&&u.push(Ii.createPortal(h,g,f))}return u},[i,l,o])}(n,t);return function(o){si(()=>yr(bd(o),nd(o)),[o])}(n),p.jsxs(p.Fragment,{children:[r,p.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=wt(),t=function(s){const[o,i]=w.useState(()=>Ko(s));return si(()=>{function l(){const a=Ko(s);i(a)}return l(),yr(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=Ic();return t?typeof r=="function"?r(n):r:null}const Aa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Cd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:g,id:m,role:b="textbox",spellCheck:C=!0,style:v,tabIndex:E,"data-testid":D,...k},y){const[_,S]=w.useState(r.isEditable()),A=w.useCallback(B=>{B&&B.ownerDocument&&B.ownerDocument.defaultView?r.setRootElement(B):r.setRootElement(null)},[r]),I=w.useMemo(()=>function(...B){return N=>{B.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(y,A),[A,y]);return Aa(()=>(S(r.isEditable()),r.registerEditableListener(B=>{S(B)})),[r]),p.jsx("div",{"aria-activedescendant":_?e:void 0,"aria-autocomplete":_?t:"none","aria-controls":_?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":_&&b==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":f,autoCapitalize:h,className:g,contentEditable:_,"data-testid":D,id:m,ref:I,role:_?b:void 0,spellCheck:C,style:v,tabIndex:E,...k})}const wd=w.forwardRef(Cd);function Vo(r){return r.getEditorState().read(ya(r.isComposing()))}const Dd=w.forwardRef(Sd);function Sd(r,e){const{placeholder:t,...n}=r,[s]=wt();return p.jsxs(p.Fragment,{children:[p.jsx(wd,{editor:s,...n,ref:e}),t!=null&&p.jsx(Ed,{editor:s,content:t})]})}function Ed({content:r,editor:e}){const t=function(i){const[l,a]=w.useState(()=>Vo(i));return Aa(()=>{function u(){const c=Vo(i);a(c)}return u(),yr(i.registerUpdateListener(()=>{u()}),i.registerEditableListener(()=>{u()}))},[i]),l}(e),[n,s]=w.useState(e.isEditable());if(w.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:p.jsx("div",{"aria-hidden":!0,children:o})}const Ln=0,ii=1,oi=2,_t=0,kd=1,Ho=2,Ad=3,Td=4;function Bd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return _t;const o=e._selection,i=r._selection;if(s)return kd;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return _t;const l=function(C,v,E){const D=C._nodeMap,k=[];for(const y of v){const _=D.get(y);_!==void 0&&k.push(_)}for(const[y,_]of E){if(!_)continue;const S=D.get(y);S===void 0||Ze(S)||k.push(S)}return k}(e,t,n);if(l.length===0)return _t;if(l.length>1){const C=e._nodeMap,v=C.get(o.anchor.key),E=C.get(i.anchor.key);return v&&E&&!r._nodeMap.has(v.__key)&&z(v)&&v.__text.length===1&&o.anchor.offset===1?Ho:_t}const a=l[0],u=r._nodeMap.get(a.__key);if(!z(u)||!z(a)||u.__mode!==a.__mode)return _t;const c=u.__text,d=a.__text;if(c===d)return _t;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return _t;const g=f.offset,m=h.offset,b=d.length-c.length;return b===1&&m===g-1?Ho:b===-1&&m===g+1?Ad:b===-1&&m===g?Td:_t}function Nd(r,e){let t=Date.now(),n=_t;return(s,o,i,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=_t,t=c,oi;const d=Bd(s,o,l,a,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return Ln;if(s===null)return ii;const m=o._selection;return l.size>0||a.size>0?g===!1&&d!==_t&&d===n&&c<t+e&&h||l.size===1&&function(b,C,v){const E=C._nodeMap.get(b),D=v._nodeMap.get(b),k=C._selection,y=v._selection;return!(P(k)&&P(y)&&k.anchor.type==="element"&&k.focus.type==="element"&&y.anchor.type==="text"&&y.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(v.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?Ln:ii:m!==null?Ln:oi})();return t=c,n=d,f}}function Jo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Fd(r,e,t){const n=Nd(r,t);return yr(r.registerCommand(di,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(a.length!==0){const u=i.current,c=a.pop();u!==null&&(l.push(u),o.dispatchCommand(kn,!0)),a.length===0&&o.dispatchCommand(An,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(fi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(l.length!==0){const u=i.current;u!==null&&(a.push(u),o.dispatchCommand(An,!0));const c=l.pop();l.length===0&&o.dispatchCommand(kn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(Bu,()=>(Jo(e),!1),fe),r.registerCommand(Nu,()=>(Jo(e),r.dispatchCommand(kn,!1),r.dispatchCommand(An,!1),!0),fe),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:a,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const g=n(i,o,c,l,a,u);if(g===ii)d.length!==0&&(e.redoStack=[],r.dispatchCommand(kn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(An,!0));else if(g===oi)return;e.current={editor:r,editorState:o}}))}function jd(){return{current:null,redoStack:[],undoStack:[]}}function Ld({delay:r,externalHistoryState:e}){const[t]=wt();return function(n,s,o=1e3){const i=w.useMemo(()=>s||jd(),[s]);w.useEffect(()=>Fd(n,i,o),[o,n,i])}(t,e,r),null}const Rd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Pd({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=wt();return Rd(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:a})=>{e&&o.size===0&&i.size===0||r&&a.has("history-merge")||l.isEmpty()||t(s,n,a)})},[n,r,e,t]),null}function li(r,e){return li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},li(r,e)}var Qo={error:null},Od=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),a=0;a<i;a++)l[a]=arguments[a];return(o=r.call.apply(r,[this].concat(l))||this).state=Qo,o.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];o.props.onReset==null||(u=o.props).onReset.apply(u,d),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,li(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Qo)},s.componentDidCatch=function(o,i){var l,a;(l=(a=this.props).onError)==null||l.call(a,o,i)},s.componentDidUpdate=function(o,i){var l,a,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((u=o.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,g){return!Object.is(h,c[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,a=i.FallbackComponent,u=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(ws.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return ws.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(ws.Component);function Md({children:r,onError:e}){return p.jsx(Od,{fallback:p.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function Id(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ft=Id(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function $d(r){let e=1,t=r.getParent();for(;t!=null;){if(Fe(t)){const n=t.getParent();if(ue(n)){e++,t=n.getParent();continue}Ft(40)}return e}return e}function ai(r){let e=r.getParent();ue(e)||Ft(40);let t=e;for(;t!==null;)t=t.getParent(),ue(t)&&(e=t);return e}function Ta(r){let e=[];const t=r.getChildren().filter(Fe);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();ue(o)?e=e.concat(Ta(o)):e.push(s)}return e}function jt(r){return Fe(r)&&ue(r.getFirstChild())}function Yo(r){return ut().append(r)}function Ba(r,e){return Fe(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Xo(r,e){r.update(()=>{const t=V();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&Ft(143);const[i]=o,l=i.getNode(),a=l.getParent();if(Ba(l,n)){const u=it(e);if(Rt(a)){l.replace(u);const c=ut();F(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(Fe(l)){const c=l.getParentOrThrow();mr(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!F(i)||!i.isEmpty()||Fe(i)||s.has(i.getKey())){if(Ll(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(ue(l)){if(!s.has(a)){const u=it(e);mr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(Rt(u)&&!s.has(a)){s.add(a),Zo(l,e);break}l=u}}}}else Zo(i,e)}}})}function mr(r,e){r.splice(r.getChildrenSize(),0,e)}function Zo(r,e){if(ue(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=ut();let o;if(mr(s,r.getChildren()),ue(t)&&e===t.getListType())t.append(s),ue(n)&&e===n.getListType()&&(mr(t,n.getChildren()),n.remove()),o=t;else if(ue(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=it(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Mi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&jt(t)&&jt(n)&&(Mi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function zd(r){r.update(()=>{const e=V();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Ba(s,n))t.add(ai(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Ll(i)){const l=td(i,xr);l!=null&&t.add(ai(l))}}for(const o of t){let i=o;const l=Ta(o);for(const a of l){const u=ze();mr(u,a.getChildren()),i.insertAfter(u),i=u,a.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),a.remove()}o.remove()}}})}function qd(r){const e=new Set;if(jt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(jt(n)&&jt(s)){const o=s.getFirstChild();if(ue(o)){o.append(r);const i=n.getFirstChild();ue(i)&&(mr(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(jt(n)){const o=n.getFirstChild();if(ue(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(jt(s)){const o=s.getFirstChild();ue(o)&&o.append(r)}else if(ue(t)){const o=ut(),i=it(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Ud(r){if(jt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(ue(t?t.getParent():void 0)&&Fe(t)&&ue(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const o=e.getListType(),i=ut(),l=it(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=ut(),u=it(o);a.append(u),mr(u,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(a),t.replace(r)}}}function Wd(){const r=V();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Fe(e)||e.getChildrenSize()!==0)return!1;const t=ai(e),n=e.getParent();ue(n)||Ft(40);const s=n.getParent();let o;if(Rt(s))o=ze(),t.insertAfter(o);else{if(!Fe(s))return!1;o=ut(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=it(n.getListType());if(jr(o))o.insertAfter(l);else{const a=ut();a.append(l),o.insertAfter(a)}i.forEach(a=>{a.remove(),l.append(a)})}return function(l){let a=l;for(;a.getNextSibling()==null&&a.getPreviousSibling()==null;){const u=a.getParent();if(u==null||!Fe(a)&&!ue(a))break;a=u}a.remove()}(e),!0}function ns(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class xr extends Vt{static getType(){return"listitem"}static clone(e){return new xr(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return ue(n)&&n.getListType()==="check"&&tl(t,this,null),t.value=this.__value,el(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return ue(s)&&s.getListType()==="check"&&tl(t,this,e),t.value=this.__value,el(t,n.theme,this),!1}static transform(){return e=>{if(Fe(e)||Ft(144),e.__checked==null)return;const t=e.getParent();ue(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Gd,priority:0})}}static importJSON(e){const t=ut();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Fe(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ue(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=it(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Ft(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(ue(n)||Ft(39),Fe(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=it(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&jt(t)&&jt(n)&&(Mi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=ut(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ze();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Fe(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,a=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(a,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return ue(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Fe(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Ft(117),(e=Math.floor(e))>=0||Ft(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(Ud(this),t--);return this}canInsertAfter(e){return Fe(e)}canReplaceWith(e){return Fe(e)}canMergeWith(e){return jr(e)||Fe(e)}extractWithChild(e,t){if(!P(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return it("bullet")}canMergeWhenEmpty(){return!0}}function el(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),i!==void 0&&n.push(...ns(i)),o){const a=t.getParent(),u=ue(a)&&a.getListType()==="check",c=t.getChecked();u&&!c||s.push(o.listitemUnchecked),u&&c||s.push(o.listitemChecked),u&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const a=ns(l);t.getChildren().some(u=>ue(u))?n.push(...a):s.push(...a)}s.length>0&&va(r,...s),n.length>0&&Dn(r,...n)}function tl(r,e,t,n){ue(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Gd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Kd(t)}const e=r.getAttribute("aria-checked");return{node:ut(e==="true"||e!=="false"&&void 0)}}function Kd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:ut(r.hasAttribute("checked"))}}function ut(r){return Ot(new xr(void 0,r))}function Fe(r){return r instanceof xr}class Or extends Vt{static getType(){return"list"}static clone(e){const t=e.__listType||sl[e.__tag];return new Or(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=sl[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,rl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(rl(t,n.theme,this),!1)}static transform(){return e=>{ue(e)||Ft(163),function(t){const n=t.getNextSibling();ue(n)&&t.getListType()===n.getListType()&&Mi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Fe(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),ue(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:nl,priority:0}),ul:()=>({conversion:nl,priority:0})}}static importJSON(e){const t=it(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Gt(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Fe(n))super.append(n);else{const s=ut();if(ue(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const o=Ue(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Fe(e)}}function rl(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=$d(t)-1,a=l%i.length,u=i[a],c=o[t.__tag];let d;const f=o.nested,h=o.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...ns(u));for(let g=0;g<i.length;g++)g!==a&&s.push(t.__tag+g)}if(d!==void 0){const g=ns(d);l>1?n.push(...g):s.push(...g)}}s.length>0&&va(r,...s),n.length>0&&Dn(r,...n)}function Vd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Fe(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{ue(o)&&e.push(Yo(o))})}else e.push(Yo(n))}return e}function nl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=it("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Gt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?it("check"):it("bullet")),{after:Vd,node:t}}const sl={ol:"number",ul:"bullet"};function it(r,e=1){return Ot(new Or(r,e))}function ue(r){return r instanceof Or}const Na=hn(),Fa=hn(),Hd=hn();function Jd(r){return yr(r.registerCommand(Fa,()=>(Xo(r,"number"),!0),Er),r.registerCommand(Na,()=>(Xo(r,"bullet"),!0),Er),r.registerCommand(Hd,()=>(zd(r),!0),Er),r.registerCommand(on,()=>!!Wd(),Er))}function Qd(){const[r]=wt();return w.useEffect(()=>{if(!r.hasNodes([Or,xr]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){w.useEffect(()=>Jd(e),[e])}(r),null}const Yd=new Set(["http:","https:","mailto:","sms:","tel:"]);class br extends Vt{static getType(){return"link"}static clone(e){return new br(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Dn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),o!==e.__target&&(o?t.target=o:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:Xd,priority:1})}}static importJSON(e){const t=ss(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Yd.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const n=ss(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!P(t))return!1;const s=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Xd(r){let e=null;if(uc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=ss(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function ss(r,e){return Ot(new br(r,e))}function Gr(r){return r instanceof br}class Sn extends br{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Sn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=il(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=il(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function il(r,e){return Ot(new Sn(r,e))}function Zd(r){return r instanceof Sn}const ol=hn();function Ms(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=V();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const a=bs(l,u=>!Zd(u)&&Gr(u));if(a){const u=a.getChildren();for(let c=0;c<u.length;c++)a.insertBefore(u[c]);a.remove()}});else{if(i.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(i[0],Gr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let l=null,a=null;i.forEach(u=>{const c=u.getParent();if(c!==a&&c!==null&&(!F(u)||u.isInline())){if(Gr(c))return a=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n));if(c.is(l)||(l=c,a=ss(r,{rel:s,target:t,title:n}),Gr(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),Gr(u)){if(u.is(a))return;if(a!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)a.append(d[f])}u.remove()}else a!==null&&a.append(u)}})}}function ef({validateUrl:r,attributes:e}){const[t]=wt();return w.useEffect(()=>{if(!t.hasNodes([br]))throw new Error("LinkPlugin: LinkNode not registered on editor");return yr(t.registerCommand(ol,n=>{if(n===null)return Ms(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Ms(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Ms(s,{...e,rel:i,target:o,title:l}),!0}},Er),r!==void 0?t.registerCommand(os,n=>{const s=V();if(!P(s)||s.isCollapsed()||!er(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>F(l))&&(t.dispatchCommand(ol,{...e,url:i}),n.preventDefault(),!0)},Er):()=>{})},[t,r,e]),null}const tf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},rf={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function nf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:o,aiProcessingAction:i,onAiAction:l,hasContent:a}){const[u]=wt(),[c,d]=w.useState(!1),f=w.useRef(null),h=t||n||s,g=w.useCallback(()=>{u.dispatchCommand(vt,"bold")},[u]),m=w.useCallback(()=>{u.dispatchCommand(vt,"italic")},[u]),b=w.useCallback(()=>{u.dispatchCommand(vt,"underline")},[u]),C=w.useCallback(()=>{u.dispatchCommand(Na,void 0)},[u]),v=w.useCallback(()=>{u.dispatchCommand(Fa,void 0)},[u]),E=w.useCallback(()=>{u.update(()=>{const _=V();P(_)&&Jc(_,()=>Oi())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},k=`
73
+ `?a.insertParagraph():u===" "?a.insertNodes([_n()]):a.insertText(u)}}}else e.insertRawText(o)}function Io(r,e,t){r.dispatchCommand(wu,{nodes:e,selection:t})||t.insertNodes(e)}function Ta(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=F(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let u=Ni(t);u=z(u)&&e!==null?_a(e,u):u,i=u}const l=F(i)?i.getChildren():[],a=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&rs(58,d.name),F(u)){const f=c.children;Array.isArray(f)||rs(59,d.name)}return c}(i);if(z(i)){const u=i.__text;u.length>0?a.text=u:s=!1}for(let u=0;u<l.length;u++){const c=l[u],d=Ta(r,e,c,a.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(a);else if(Array.isArray(a.children))for(let u=0;u<a.children.length;u++){const c=a.children[u];n.push(c)}return s}function cd(r,e){const t=[],n=Be().getChildren();for(let s=0;s<n.length;s++)Ta(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function dd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=jc(n);z(s)&&Qc(s),e.push(s)}return e}let wr=null;async function $o(r,e,t){if(wr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a(zo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=ht(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((a,u)=>{const c=r.registerCommand(ls,d=>(tr(d,ClipboardEvent)&&(c(),wr!==null&&(window.clearTimeout(wr),wr=null),a(zo(r,d,t))),!0),Rc);wr=window.setTimeout(()=>{c(),wr=null,a(!1)},50),s.execCommand("copy"),i.remove()})}function zo(r,e,t){if(t===void 0){const s=ht(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!mn(r,o,i))return!1;const l=V();if(l===null)return!1;t=hd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(pd(n,t),!0)}const fd=[["text/html",ad],["application/x-lexical-editor",ud]];function hd(r=V()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=hc();for(const[n,s]of fd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function pd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function qo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,gd=Or&&"documentMode"in document?document.documentMode:null,md=!(!Or||!("InputEvent"in window)||gd)&&"getTargetRanges"in new window.InputEvent("input"),yd=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Uo=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xd=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bd=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xd,Wo=hn();class _s extends Ht{static getType(){return"quote"}static clone(e){return new _s(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Dn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:_d,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Mi();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=ze(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ze();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Mi(){return Ot(new _s)}class vs extends Ht{static getType(){return"heading"}static clone(e){return new vs(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const o=s[t];Dn(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Dr,priority:0}),h2:e=>({conversion:Dr,priority:0}),h3:e=>({conversion:Dr,priority:0}),h4:e=>({conversion:Dr,priority:0}),h5:e=>({conversion:Dr,priority:0}),h6:e=>({conversion:Dr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Go(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Go(e)?{conversion:t=>({node:Jr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Jr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ze():Jr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ze();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ze():Jr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Go(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Dr(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Jr(e),r.style!==null&&(Fi(r,t),t.setFormat(r.style.textAlign))),{node:t}}function _d(r){const e=Mi();return r.style!==null&&(e.setFormat(r.style.textAlign),Fi(r,e)),{node:e}}function Jr(r){return Ot(new vs(r))}function Fn(r){let e=null;if(tr(r,DragEvent)?e=r.dataTransfer:tr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function Ko(r){const e=V();if(!P(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const o=n[s],i=o.getKey();if(t.has(i))continue;const l=bs(o,u=>F(u)&&!u.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),r(l))}return t.size>0}function jn(r){const e=jr(r);return _e(e)}function vd(r){return xr(r.registerCommand(gl,e=>{const t=V();return!!Nt(t)&&(t.clear(),!0)},0),r.registerCommand(cr,e=>{const t=V();return!!P(t)&&(t.deleteCharacter(e),!0)},fe),r.registerCommand(ln,e=>{const t=V();return!!P(t)&&(t.deleteWord(e),!0)},fe),r.registerCommand(an,e=>{const t=V();return!!P(t)&&(t.deleteLine(e),!0)},fe),r.registerCommand(Tr,e=>{const t=V();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Mo(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},fe),r.registerCommand(qs,()=>{const e=V();return!!P(e)&&(e.removeText(),!0)},fe),r.registerCommand(vt,e=>{const t=V();return!!P(t)&&(t.formatText(e),!0)},fe),r.registerCommand(Nu,e=>{const t=V();if(!P(t)&&!Nt(t))return!1;const n=t.getNodes();for(const s of n){const o=bs(s,i=>F(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},fe),r.registerCommand(Ar,e=>{const t=V();return!!P(t)&&(t.insertLineBreak(e),!0)},fe),r.registerCommand(on,()=>{const e=V();return!!P(e)&&(e.insertParagraph(),!0)},fe),r.registerCommand(Tu,()=>(aa([_n()]),!0),fe),r.registerCommand(Bu,()=>Ko(e=>{const t=e.getIndent();e.setIndent(t+1)}),fe),r.registerCommand(Qi,()=>Ko(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),fe),r.registerCommand(xl,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=un(t.focus,!0);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},fe),r.registerCommand(bl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===Be().getChildrenSize()}(t))return e.preventDefault(),!0;const n=un(t.focus,!1);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},fe),r.registerCommand(yl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Ro(t,!0)){const n=e.shiftKey;return e.preventDefault(),Po(t,n,!0),!0}return!1},fe),r.registerCommand(ml,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!P(t))return!1;const n=e.shiftKey;return!!Ro(t,!1)&&(e.preventDefault(),Po(t,n,!1),!0)},fe),r.registerCommand(_l,e=>{if(jn(e.target))return!1;const t=V();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ze(s)&&sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Qi,void 0)):(!Uo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(cr,!0))},fe),r.registerCommand(Cl,e=>{if(jn(e.target))return!1;const t=V();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(cr,!1))},fe),r.registerCommand($n,e=>{const t=V();if(!P(t))return!1;if(e!==null){if((Uo||yd||bd)&&md)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Ar,!1)}return r.dispatchCommand(on,void 0)},fe),r.registerCommand(vl,()=>{const e=V();return!!P(e)&&(r.blur(),!0)},fe),r.registerCommand(wl,e=>{const[,t]=Fn(e);if(t.length>0){const s=qo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=jr(i);if(l!==null){const a=Tc();if(z(l))a.anchor.set(l.getKey(),o,"text"),a.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(c,d,"element"),a.focus.set(c,d,"element")}const u=jl(a);Lt(u)}r.dispatchCommand(Wo,t)}return e.preventDefault(),!0}const n=V();return!!P(n)},fe),r.registerCommand(Dl,e=>{const[t]=Fn(e),n=V();return!(t&&!P(n))},fe),r.registerCommand(Sl,e=>{const[t]=Fn(e),n=V();if(t&&!P(n))return!1;const s=qo(e.clientX,e.clientY);if(s!==null){const o=jr(s.node);_e(o)&&e.preventDefault()}return!0},fe),r.registerCommand(Us,()=>(uc(),!0),fe),r.registerCommand(ls,e=>($o(r,tr(e,ClipboardEvent)?e:null),!0),fe),r.registerCommand(pi,e=>(async function(t,n){await $o(n,tr(t,ClipboardEvent)?t:null),n.update(()=>{const s=V();P(s)?s.removeText():Nt(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),fe),r.registerCommand(os,e=>{const[,t,n]=Fn(e);return t.length>0&&!n?(r.dispatchCommand(Wo,t),!0):Di(e.target)?!1:V()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=V(),l=tr(s,InputEvent)||tr(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&Mo(l,i,o)},{tag:"paste"})}(e,r),!0)},fe))}const ii=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Vo(r){return r.getEditorState().read(ba(r.isComposing()))}function Cd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=wt(),s=function(o,i){const[l,a]=w.useState(()=>o.getDecorators());return ii(()=>o.registerDecoratorListener(u=>{$i.flushSync(()=>{a(u)})}),[o]),w.useEffect(()=>{a(o.getDecorators())},[o]),w.useMemo(()=>{const u=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=p.jsx(i,{onError:m=>o._onError(m),children:p.jsx(w.Suspense,{fallback:null,children:l[f]})}),g=o.getElementByKey(f);g!==null&&u.push($i.createPortal(h,g,f))}return u},[i,l,o])}(n,t);return function(o){ii(()=>xr(vd(o),id(o)),[o])}(n),p.jsxs(p.Fragment,{children:[r,p.jsx(wd,{content:e}),s]})}function wd({content:r}){const[e]=wt(),t=function(s){const[o,i]=w.useState(()=>Vo(s));return ii(()=>{function l(){const a=Vo(s);i(a)}return l(),xr(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=zc();return t?typeof r=="function"?r(n):r:null}const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Dd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:g,id:m,role:b="textbox",spellCheck:C=!0,style:v,tabIndex:E,"data-testid":D,...k},y){const[_,S]=w.useState(r.isEditable()),A=w.useCallback(B=>{B&&B.ownerDocument&&B.ownerDocument.defaultView?r.setRootElement(B):r.setRootElement(null)},[r]),I=w.useMemo(()=>function(...B){return N=>{B.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(y,A),[A,y]);return Ba(()=>(S(r.isEditable()),r.registerEditableListener(B=>{S(B)})),[r]),p.jsx("div",{"aria-activedescendant":_?e:void 0,"aria-autocomplete":_?t:"none","aria-controls":_?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":_&&b==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":f,autoCapitalize:h,className:g,contentEditable:_,"data-testid":D,id:m,ref:I,role:_?b:void 0,spellCheck:C,style:v,tabIndex:E,...k})}const Sd=w.forwardRef(Dd);function Ho(r){return r.getEditorState().read(ba(r.isComposing()))}const Ed=w.forwardRef(kd);function kd(r,e){const{placeholder:t,...n}=r,[s]=wt();return p.jsxs(p.Fragment,{children:[p.jsx(Sd,{editor:s,...n,ref:e}),t!=null&&p.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[l,a]=w.useState(()=>Ho(i));return Ba(()=>{function u(){const c=Ho(i);a(c)}return u(),xr(i.registerUpdateListener(()=>{u()}),i.registerEditableListener(()=>{u()}))},[i]),l}(e),[n,s]=w.useState(e.isEditable());if(w.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:p.jsx("div",{"aria-hidden":!0,children:o})}const Ln=0,oi=1,li=2,_t=0,Td=1,Jo=2,Bd=3,Nd=4;function Fd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return _t;const o=e._selection,i=r._selection;if(s)return Td;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return _t;const l=function(C,v,E){const D=C._nodeMap,k=[];for(const y of v){const _=D.get(y);_!==void 0&&k.push(_)}for(const[y,_]of E){if(!_)continue;const S=D.get(y);S===void 0||Ze(S)||k.push(S)}return k}(e,t,n);if(l.length===0)return _t;if(l.length>1){const C=e._nodeMap,v=C.get(o.anchor.key),E=C.get(i.anchor.key);return v&&E&&!r._nodeMap.has(v.__key)&&z(v)&&v.__text.length===1&&o.anchor.offset===1?Jo:_t}const a=l[0],u=r._nodeMap.get(a.__key);if(!z(u)||!z(a)||u.__mode!==a.__mode)return _t;const c=u.__text,d=a.__text;if(c===d)return _t;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return _t;const g=f.offset,m=h.offset,b=d.length-c.length;return b===1&&m===g-1?Jo:b===-1&&m===g+1?Bd:b===-1&&m===g?Nd:_t}function jd(r,e){let t=Date.now(),n=_t;return(s,o,i,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=_t,t=c,li;const d=Fd(s,o,l,a,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return Ln;if(s===null)return oi;const m=o._selection;return l.size>0||a.size>0?g===!1&&d!==_t&&d===n&&c<t+e&&h||l.size===1&&function(b,C,v){const E=C._nodeMap.get(b),D=v._nodeMap.get(b),k=C._selection,y=v._selection;return!(P(k)&&P(y)&&k.anchor.type==="element"&&k.focus.type==="element"&&y.anchor.type==="text"&&y.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(v.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?Ln:oi:m!==null?Ln:li})();return t=c,n=d,f}}function Qo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Ld(r,e,t){const n=jd(r,t);return xr(r.registerCommand(fi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(a.length!==0){const u=i.current,c=a.pop();u!==null&&(l.push(u),o.dispatchCommand(kn,!0)),a.length===0&&o.dispatchCommand(An,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(hi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(l.length!==0){const u=i.current;u!==null&&(a.push(u),o.dispatchCommand(An,!0));const c=l.pop();l.length===0&&o.dispatchCommand(kn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(ju,()=>(Qo(e),!1),fe),r.registerCommand(Lu,()=>(Qo(e),r.dispatchCommand(kn,!1),r.dispatchCommand(An,!1),!0),fe),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:a,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const g=n(i,o,c,l,a,u);if(g===oi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(kn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(An,!0));else if(g===li)return;e.current={editor:r,editorState:o}}))}function Rd(){return{current:null,redoStack:[],undoStack:[]}}function Pd({delay:r,externalHistoryState:e}){const[t]=wt();return function(n,s,o=1e3){const i=w.useMemo(()=>s||Rd(),[s]);w.useEffect(()=>Ld(n,i,o),[o,n,i])}(t,e,r),null}const Od=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Md({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=wt();return Od(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:a})=>{e&&o.size===0&&i.size===0||r&&a.has("history-merge")||l.isEmpty()||t(s,n,a)})},[n,r,e,t]),null}function ai(r,e){return ai=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ai(r,e)}var Yo={error:null},Id=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),a=0;a<i;a++)l[a]=arguments[a];return(o=r.call.apply(r,[this].concat(l))||this).state=Yo,o.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];o.props.onReset==null||(u=o.props).onReset.apply(u,d),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,ai(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Yo)},s.componentDidCatch=function(o,i){var l,a;(l=(a=this.props).onError)==null||l.call(a,o,i)},s.componentDidUpdate=function(o,i){var l,a,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((u=o.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,g){return!Object.is(h,c[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,a=i.FallbackComponent,u=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(Ds.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return Ds.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ds.Component);function $d({children:r,onError:e}){return p.jsx(Id,{fallback:p.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function zd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ft=zd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function qd(r){let e=1,t=r.getParent();for(;t!=null;){if(Fe(t)){const n=t.getParent();if(ue(n)){e++,t=n.getParent();continue}Ft(40)}return e}return e}function ui(r){let e=r.getParent();ue(e)||Ft(40);let t=e;for(;t!==null;)t=t.getParent(),ue(t)&&(e=t);return e}function Na(r){let e=[];const t=r.getChildren().filter(Fe);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();ue(o)?e=e.concat(Na(o)):e.push(s)}return e}function jt(r){return Fe(r)&&ue(r.getFirstChild())}function Xo(r){return ut().append(r)}function Fa(r,e){return Fe(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Zo(r,e){r.update(()=>{const t=V();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&Ft(143);const[i]=o,l=i.getNode(),a=l.getParent();if(Fa(l,n)){const u=it(e);if(Rt(a)){l.replace(u);const c=ut();F(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(Fe(l)){const c=l.getParentOrThrow();yr(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!F(i)||!i.isEmpty()||Fe(i)||s.has(i.getKey())){if(Rl(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(ue(l)){if(!s.has(a)){const u=it(e);yr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(Rt(u)&&!s.has(a)){s.add(a),el(l,e);break}l=u}}}}else el(i,e)}}})}function yr(r,e){r.splice(r.getChildrenSize(),0,e)}function el(r,e){if(ue(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=ut();let o;if(yr(s,r.getChildren()),ue(t)&&e===t.getListType())t.append(s),ue(n)&&e===n.getListType()&&(yr(t,n.getChildren()),n.remove()),o=t;else if(ue(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=it(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ii(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&jt(t)&&jt(n)&&(Ii(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function Ud(r){r.update(()=>{const e=V();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Fa(s,n))t.add(ui(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Rl(i)){const l=nd(i,br);l!=null&&t.add(ui(l))}}for(const o of t){let i=o;const l=Na(o);for(const a of l){const u=ze();yr(u,a.getChildren()),i.insertAfter(u),i=u,a.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),a.remove()}o.remove()}}})}function Wd(r){const e=new Set;if(jt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(jt(n)&&jt(s)){const o=s.getFirstChild();if(ue(o)){o.append(r);const i=n.getFirstChild();ue(i)&&(yr(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(jt(n)){const o=n.getFirstChild();if(ue(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(jt(s)){const o=s.getFirstChild();ue(o)&&o.append(r)}else if(ue(t)){const o=ut(),i=it(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Gd(r){if(jt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(ue(t?t.getParent():void 0)&&Fe(t)&&ue(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const o=e.getListType(),i=ut(),l=it(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=ut(),u=it(o);a.append(u),yr(u,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(a),t.replace(r)}}}function Kd(){const r=V();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Fe(e)||e.getChildrenSize()!==0)return!1;const t=ui(e),n=e.getParent();ue(n)||Ft(40);const s=n.getParent();let o;if(Rt(s))o=ze(),t.insertAfter(o);else{if(!Fe(s))return!1;o=ut(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=it(n.getListType());if(Lr(o))o.insertAfter(l);else{const a=ut();a.append(l),o.insertAfter(a)}i.forEach(a=>{a.remove(),l.append(a)})}return function(l){let a=l;for(;a.getNextSibling()==null&&a.getPreviousSibling()==null;){const u=a.getParent();if(u==null||!Fe(a)&&!ue(a))break;a=u}a.remove()}(e),!0}function ns(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class br extends Ht{static getType(){return"listitem"}static clone(e){return new br(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return ue(n)&&n.getListType()==="check"&&rl(t,this,null),t.value=this.__value,tl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return ue(s)&&s.getListType()==="check"&&rl(t,this,e),t.value=this.__value,tl(t,n.theme,this),!1}static transform(){return e=>{if(Fe(e)||Ft(144),e.__checked==null)return;const t=e.getParent();ue(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Vd,priority:0})}}static importJSON(e){const t=ut();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Fe(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ue(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=it(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Ft(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(ue(n)||Ft(39),Fe(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=it(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&jt(t)&&jt(n)&&(Ii(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=ut(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ze();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Fe(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,a=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(a,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return ue(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Fe(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Ft(117),(e=Math.floor(e))>=0||Ft(199);let t=this.getIndent();for(;t!==e;)t<e?(Wd(this),t++):(Gd(this),t--);return this}canInsertAfter(e){return Fe(e)}canReplaceWith(e){return Fe(e)}canMergeWith(e){return Lr(e)||Fe(e)}extractWithChild(e,t){if(!P(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return it("bullet")}canMergeWhenEmpty(){return!0}}function tl(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),i!==void 0&&n.push(...ns(i)),o){const a=t.getParent(),u=ue(a)&&a.getListType()==="check",c=t.getChecked();u&&!c||s.push(o.listitemUnchecked),u&&c||s.push(o.listitemChecked),u&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const a=ns(l);t.getChildren().some(u=>ue(u))?n.push(...a):s.push(...a)}s.length>0&&wa(r,...s),n.length>0&&Dn(r,...n)}function rl(r,e,t,n){ue(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Vd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Hd(t)}const e=r.getAttribute("aria-checked");return{node:ut(e==="true"||e!=="false"&&void 0)}}function Hd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:ut(r.hasAttribute("checked"))}}function ut(r){return Ot(new br(void 0,r))}function Fe(r){return r instanceof br}class Mr extends Ht{static getType(){return"list"}static clone(e){const t=e.__listType||il[e.__tag];return new Mr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=il[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,nl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(nl(t,n.theme,this),!1)}static transform(){return e=>{ue(e)||Ft(163),function(t){const n=t.getNextSibling();ue(n)&&t.getListType()===n.getListType()&&Ii(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Fe(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),ue(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:sl,priority:0}),ul:()=>({conversion:sl,priority:0})}}static importJSON(e){const t=it(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Kt(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Fe(n))super.append(n);else{const s=ut();if(ue(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const o=Ue(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Fe(e)}}function nl(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=qd(t)-1,a=l%i.length,u=i[a],c=o[t.__tag];let d;const f=o.nested,h=o.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...ns(u));for(let g=0;g<i.length;g++)g!==a&&s.push(t.__tag+g)}if(d!==void 0){const g=ns(d);l>1?n.push(...g):s.push(...g)}}s.length>0&&wa(r,...s),n.length>0&&Dn(r,...n)}function Jd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Fe(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{ue(o)&&e.push(Xo(o))})}else e.push(Xo(n))}return e}function sl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=it("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Kt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?it("check"):it("bullet")),{after:Jd,node:t}}const il={ol:"number",ul:"bullet"};function it(r,e=1){return Ot(new Mr(r,e))}function ue(r){return r instanceof Mr}const ja=hn(),La=hn(),Qd=hn();function Yd(r){return xr(r.registerCommand(La,()=>(Zo(r,"number"),!0),kr),r.registerCommand(ja,()=>(Zo(r,"bullet"),!0),kr),r.registerCommand(Qd,()=>(Ud(r),!0),kr),r.registerCommand(on,()=>!!Kd(),kr))}function Xd(){const[r]=wt();return w.useEffect(()=>{if(!r.hasNodes([Mr,br]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){w.useEffect(()=>Yd(e),[e])}(r),null}const Zd=new Set(["http:","https:","mailto:","sms:","tel:"]);class _r extends Ht{static getType(){return"link"}static clone(e){return new _r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Dn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),o!==e.__target&&(o?t.target=o:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:ef,priority:1})}}static importJSON(e){const t=ss(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Zd.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const n=ss(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!P(t))return!1;const s=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function ef(r){let e=null;if(fc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=ss(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function ss(r,e){return Ot(new _r(r,e))}function Gr(r){return r instanceof _r}class Sn extends _r{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Sn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ol(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=ol(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ol(r,e){return Ot(new Sn(r,e))}function tf(r){return r instanceof Sn}const ll=hn();function Is(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=V();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const a=bs(l,u=>!tf(u)&&Gr(u));if(a){const u=a.getChildren();for(let c=0;c<u.length;c++)a.insertBefore(u[c]);a.remove()}});else{if(i.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(i[0],Gr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let l=null,a=null;i.forEach(u=>{const c=u.getParent();if(c!==a&&c!==null&&(!F(u)||u.isInline())){if(Gr(c))return a=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n));if(c.is(l)||(l=c,a=ss(r,{rel:s,target:t,title:n}),Gr(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),Gr(u)){if(u.is(a))return;if(a!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)a.append(d[f])}u.remove()}else a!==null&&a.append(u)}})}}function rf({validateUrl:r,attributes:e}){const[t]=wt();return w.useEffect(()=>{if(!t.hasNodes([_r]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xr(t.registerCommand(ll,n=>{if(n===null)return Is(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Is(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Is(s,{...e,rel:i,target:o,title:l}),!0}},kr),r!==void 0?t.registerCommand(os,n=>{const s=V();if(!P(s)||s.isCollapsed()||!tr(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>F(l))&&(t.dispatchCommand(ll,{...e,url:i}),n.preventDefault(),!0)},kr):()=>{})},[t,r,e]),null}function nf(r){if(r instanceof HTMLImageElement){const{src:e,alt:t,width:n,height:s}=r;return{node:Ra({src:e,altText:t,width:n||void 0,height:s||void 0})}}return null}class Cs extends pa{constructor(t,n,s,o,i){super(i);qt(this,"__src");qt(this,"__altText");qt(this,"__width");qt(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=o}static getType(){return"image"}static clone(t){return new Cs(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:o,height:i}=t;return Ra({src:n,altText:s,width:o,height:i})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:nf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return p.jsx("img",{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}}function Ra(r){return new Cs(r.src,r.altText,r.width,r.height)}const sf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},of={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function lf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:o,aiProcessingAction:i,onAiAction:l,hasContent:a}){const[u]=wt(),[c,d]=w.useState(!1),f=w.useRef(null),h=t||n||s,g=w.useCallback(()=>{u.dispatchCommand(vt,"bold")},[u]),m=w.useCallback(()=>{u.dispatchCommand(vt,"italic")},[u]),b=w.useCallback(()=>{u.dispatchCommand(vt,"underline")},[u]),C=w.useCallback(()=>{u.dispatchCommand(ja,void 0)},[u]),v=w.useCallback(()=>{u.dispatchCommand(La,void 0)},[u]),E=w.useCallback(()=>{u.update(()=>{const _=V();P(_)&&Yc(_,()=>Mi())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},k=`
74
74
  .mail-editor-toolbar-btn:hover:not(:disabled) {
75
75
  background: ${r.border};
76
76
  }
77
- `,y=()=>{setTimeout(()=>{var _;(_=f.current)!=null&&_.contains(document.activeElement)||d(!1)},150)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[p.jsx("style",{children:k}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:g,disabled:e,style:D,title:"Bold (Ctrl+B)",children:"B"}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{...D,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:b,disabled:e,style:{...D,textDecoration:"underline"},title:"Underline (Ctrl+U)",children:"U"}),p.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:C,disabled:e,style:D,title:"Bullet List",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("circle",{cx:"4",cy:"6",r:"2"}),p.jsx("circle",{cx:"4",cy:"12",r:"2"}),p.jsx("circle",{cx:"4",cy:"18",r:"2"}),p.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:v,disabled:e,style:D,title:"Numbered List",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),p.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),p.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),p.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),p.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:E,disabled:e,style:D,title:"Quote",children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]}),h&&p.jsxs("div",{style:{position:"relative"},ref:f,children:[p.jsx("button",{type:"button",onClick:()=>d(!c),disabled:o||!a||e,onBlur:y,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:o||!a?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:o||!a||e?"not-allowed":"pointer",opacity:o||!a?.5:1},children:o?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),i==="restructure"&&"Restructuring...",i==="proofread"&&"Proofreading...",i==="rewrite"&&"Rewriting..."]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",p.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!o&&p.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:_=>_.currentTarget.style.background="#f3f4f6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Restructure"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:_=>_.currentTarget.style.background="#f3f4f6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Proofread"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:_=>_.currentTarget.style.background="#f3f4f6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function sf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=wt(),s=w.useRef(!1);return w.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const o=Be();o.clear();const i=ze();o.append(i),i.select();const a=new DOMParser().parseFromString(r,"text/html"),c=Ca(n,a).filter(d=>d.getParent()===null);c.length>0&&la(c),i.getTextContent()===""&&o.getChildrenSize()>1&&i.remove(),o.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function of({text:r,trigger:e}){const[t]=wt(),n=w.useRef(void 0);return w.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const o=V();if(P(o))o.insertText(s);else{const i=Be(),l=i.getLastChild();if(l){l.selectEnd();const a=V();P(a)&&a.insertText(s)}else{const a=ze(),u=Ue(s);a.append(u),i.append(a)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function lf({replyTo:r,theme:e}){const t=n=>{try{return new Date(n).toLocaleString()}catch{return n}};return p.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[p.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),p.jsx("blockquote",{style:{margin:0,padding:"12px 16px",borderLeft:`3px solid ${e.quoteBorder}`,background:e.quoteBackground,fontSize:"14px",color:e.textSecondary,maxHeight:"200px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:r.body}})]})}function ja({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:o=!1,className:i="",minHeight:l="200px",externalUpdate:a,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:g,aiProcessingAction:m,renderAboveToolbar:b}){const C={...tf,...s},[v,E]=w.useState(!1),D=w.useRef(void 0),[k,y]=w.useState(r),[_,S]=w.useState(!1),[A,I]=w.useState(null),B=g??_,N=m??A;w.useEffect(()=>{a!==void 0&&a!==D.current&&(D.current=a,E(!0))},[a]);const j=w.useCallback(()=>{E(!1)},[]),L=me=>me.replace(/<[^>]*>/g,"").trim(),$=me=>me.split(`
78
- `).map(he=>`<p>${he||"<br>"}</p>`).join(""),X=async me=>{const he=L(k);if(!he)return;const ye=me==="restructure"?d:me==="proofread"?f:h;if(ye){S(!0),I(me);try{const xe=await ye(he),Se=$(xe);y(Se),e==null||e(Se),D.current=Date.now(),E(!0)}catch(xe){console.error(`AI ${me} failed:`,xe)}finally{S(!1),I(null)}}},ce=L(k).length>0,ve={namespace:"MailEditor",theme:rf,onError:me=>{console.error("Lexical error:",me)},nodes:[Or,xr,br,Sn,vs,_s],editable:!o},le=w.useCallback((me,he)=>{me.read(()=>{const ye=wa(he,null);y(ye),e==null||e(ye)})},[e]),Le=`
77
+ `,y=()=>{setTimeout(()=>{var _;(_=f.current)!=null&&_.contains(document.activeElement)||d(!1)},150)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[p.jsx("style",{children:k}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:g,disabled:e,style:D,title:"Bold (Ctrl+B)",children:"B"}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{...D,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:b,disabled:e,style:{...D,textDecoration:"underline"},title:"Underline (Ctrl+U)",children:"U"}),p.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:C,disabled:e,style:D,title:"Bullet List",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("circle",{cx:"4",cy:"6",r:"2"}),p.jsx("circle",{cx:"4",cy:"12",r:"2"}),p.jsx("circle",{cx:"4",cy:"18",r:"2"}),p.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:v,disabled:e,style:D,title:"Numbered List",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),p.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),p.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),p.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),p.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:E,disabled:e,style:D,title:"Quote",children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]}),h&&p.jsxs("div",{style:{position:"relative"},ref:f,children:[p.jsx("button",{type:"button",onClick:()=>d(!c),disabled:o||!a||e,onBlur:y,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:o||!a?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:o||!a||e?"not-allowed":"pointer",opacity:o||!a?.5:1},children:o?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),i==="restructure"&&"Restructuring...",i==="proofread"&&"Proofreading...",i==="rewrite"&&"Rewriting..."]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",p.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!o&&p.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:_=>_.currentTarget.style.background="#f3f4f6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Restructure"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:_=>_.currentTarget.style.background="#f3f4f6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Proofread"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:_=>_.currentTarget.style.background="#f3f4f6",onMouseLeave:_=>_.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function af({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=wt(),s=w.useRef(!1);return w.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const o=Be();o.clear();const i=ze();o.append(i),i.select();const a=new DOMParser().parseFromString(r,"text/html"),c=Da(n,a).filter(d=>d.getParent()===null);c.length>0&&aa(c),i.getTextContent()===""&&o.getChildrenSize()>1&&i.remove(),o.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function uf({text:r,trigger:e}){const[t]=wt(),n=w.useRef(void 0);return w.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const o=V();if(P(o))o.insertText(s);else{const i=Be(),l=i.getLastChild();if(l){l.selectEnd();const a=V();P(a)&&a.insertText(s)}else{const a=ze(),u=Ue(s);a.append(u),i.append(a)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function cf({replyTo:r,theme:e}){const t=n=>{try{return new Date(n).toLocaleString()}catch{return n}};return p.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[p.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),p.jsx("blockquote",{style:{margin:0,padding:"12px 16px",borderLeft:`3px solid ${e.quoteBorder}`,background:e.quoteBackground,fontSize:"14px",color:e.textSecondary,maxHeight:"200px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:r.body}})]})}function Pa({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:o=!1,className:i="",minHeight:l="200px",externalUpdate:a,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:g,aiProcessingAction:m,renderAboveToolbar:b}){const C={...sf,...s},[v,E]=w.useState(!1),D=w.useRef(void 0),[k,y]=w.useState(r),[_,S]=w.useState(!1),[A,I]=w.useState(null),B=g??_,N=m??A;w.useEffect(()=>{a!==void 0&&a!==D.current&&(D.current=a,E(!0))},[a]);const j=w.useCallback(()=>{E(!1)},[]),L=me=>me.replace(/<[^>]*>/g,"").trim(),$=me=>me.split(`
78
+ `).map(he=>`<p>${he||"<br>"}</p>`).join(""),X=async me=>{const he=L(k);if(!he)return;const ye=me==="restructure"?d:me==="proofread"?f:h;if(ye){S(!0),I(me);try{const xe=await ye(he),Se=$(xe);y(Se),e==null||e(Se),D.current=Date.now(),E(!0)}catch(xe){console.error(`AI ${me} failed:`,xe)}finally{S(!1),I(null)}}},ce=L(k).length>0,ve={namespace:"MailEditor",theme:of,onError:me=>{console.error("Lexical error:",me)},nodes:[Mr,br,_r,Sn,vs,_s,Cs],editable:!o},le=w.useCallback((me,he)=>{me.read(()=>{const ye=Sa(he,null);y(ye),e==null||e(ye)})},[e]),Le=`
79
79
  .mail-editor-paragraph {
80
80
  margin: 0 0 8px 0;
81
81
  line-height: 1.5;
@@ -145,9 +145,9 @@ React keys must be passed directly to JSX without using spread:
145
145
  from { transform: rotate(0deg); }
146
146
  to { transform: rotate(360deg); }
147
147
  }
148
- `;return p.jsxs("div",{className:i,style:{border:`1px solid ${C.border}`,borderRadius:"8px",background:C.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[p.jsx("style",{children:Le}),b,p.jsxs(Pc,{initialConfig:ve,children:[p.jsx(nf,{theme:C,disabled:o,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:B,aiProcessingAction:N,onAiAction:X,hasContent:ce}),p.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:p.jsx(_d,{contentEditable:p.jsx(Dd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:C.text}}),placeholder:p.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:Md})}),p.jsx(Qd,{}),p.jsx(ef,{}),p.jsx(Ld,{}),p.jsx(Pd,{onChange:le}),p.jsx(sf,{html:v?k:r,isExternalUpdate:v,onImportComplete:j}),p.jsx(of,{text:u,trigger:c})]}),n&&p.jsx(lf,{replyTo:n,theme:C})]})}const af={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function uf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:o,onBodyChange:i,externalUpdate:l,insertText:a,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:g="",minHeight:m="200px",sendButtonText:b="Send",hideCancelButton:C=!1,onAiRestructure:v,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:k}){const y={...af,...c},[_,S]=w.useState(r),[A,I]=w.useState(""),[B,N]=w.useState(""),[j,L]=w.useState(e),[$,X]=w.useState(t),[ce,ve]=w.useState([]),[le,Le]=w.useState(!1),[me,he]=w.useState(""),[ye,xe]=w.useState(f),[Se,pe]=w.useState(!1),Ce=w.useRef(void 0);w.useEffect(()=>{l!==void 0&&l!==Ce.current&&(Ce.current=l,X(t),pe(!0))},[l,t]);const Ne=W=>{X(W),pe(!1),i==null||i(W)},ae=w.useRef(null),[Re,ot]=w.useState(!1),St=W=>{const we=W.target.files;if(we){const ke=Array.from(we);console.log("[MailComposer] Files selected:",ke.map(Ee=>({name:Ee.name,size:Ee.size,type:Ee.type}))),ve(Ee=>[...Ee,...ke])}ae.current&&(ae.current.value="")},Mt=W=>{W.preventDefault(),W.stopPropagation(),ot(!0)},tt=W=>{W.preventDefault(),W.stopPropagation(),ot(!1)},pt=W=>{if(W.preventDefault(),W.stopPropagation(),ot(!1),W.dataTransfer.files&&W.dataTransfer.files.length>0){const we=Array.from(W.dataTransfer.files);console.log("[MailComposer] Files dropped:",we.map(ke=>({name:ke.name,size:ke.size,type:ke.type}))),ve(ke=>[...ke,...we])}else console.log("[MailComposer] Drop event but no files:",W.dataTransfer.types)},ct=W=>W.type.startsWith("image/")?"image":W.type==="application/pdf"?"picture_as_pdf":W.type.includes("spreadsheet")||W.type.includes("excel")?"table_chart":W.type.includes("document")||W.type.includes("word")?"description":"attach_file",Ht=W=>{ve(we=>we.filter((ke,Ee)=>Ee!==W))},It=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,Et=async()=>{if(!_.trim()){he("Recipient email is required");return}if(!j.trim()){he("Subject is required");return}Le(!0),he("");try{const W=await Promise.all(ce.map(async Ee=>{const At=await Ee.arrayBuffer(),Tt=btoa(new Uint8Array(At).reduce(($t,K)=>$t+String.fromCharCode(K),""));return{filename:Ee.name,content_type:Ee.type||"application/octet-stream",data:Tt,size:Ee.size}})),we=$.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),ke={to:_.trim(),cc:A.trim()||void 0,bcc:B.trim()||void 0,subject:j.trim(),html:we,attachments:W,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",ke.to,"subject:",ke.subject,"attachmentsCount:",ke.attachments.length),ke.attachments.length>0&&ke.attachments.forEach((Ee,At)=>{var Tt;console.log(`[MailComposer] Attachment ${At+1}:`,Ee.filename,"size:",Ee.size,"type:",Ee.content_type,"data length:",((Tt=Ee.data)==null?void 0:Tt.length)||0)}),await s(ke),S(""),I(""),N(""),L(""),X(""),ve([])}catch(W){he(W instanceof Error?W.message:"Failed to send email")}finally{Le(!1)}},kt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${y.inputBorder}`,borderRadius:"6px",background:y.inputBackground,color:y.text,outline:"none"},lt={display:"block",fontSize:"12px",fontWeight:500,color:y.textSecondary,marginBottom:"4px",textTransform:"uppercase"},gt=(W,we=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:we?"not-allowed":"pointer",opacity:we?.6:1,background:W?y.buttonPrimary:y.buttonSecondary,color:W?"#ffffff":y.text,display:"flex",alignItems:"center",gap:"8px"});return p.jsxs("div",{className:g,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:y.background},children:[me&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:me}),p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"To"}),p.jsx("input",{type:"email",value:_,onChange:W=>S(W.target.value),placeholder:"recipient@example.com",disabled:d||le,style:kt})]}),!ye&&p.jsx("button",{type:"button",onClick:()=>xe(!0),disabled:d||le,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:y.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),ye&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"CC"}),p.jsx("input",{type:"email",value:A,onChange:W=>I(W.target.value),placeholder:"cc@example.com",disabled:d||le,style:kt})]}),p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"BCC"}),p.jsx("input",{type:"email",value:B,onChange:W=>N(W.target.value),placeholder:"bcc@example.com",disabled:d||le,style:kt})]})]}),p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"Subject"}),p.jsx("input",{type:"text",value:j,onChange:W=>L(W.target.value),placeholder:"Email subject",disabled:d||le,style:kt})]}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:p.jsx(ja,{value:$,onChange:Ne,placeholder:h,replyTo:n,theme:y,disabled:d||le,minHeight:m,externalUpdate:Se?l:void 0,insertText:a,insertTextTrigger:u,onAiRestructure:v,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:k})})}),p.jsxs("div",{children:[p.jsx("label",{style:{...lt,marginBottom:"8px"},children:"Attachments"}),p.jsx("input",{ref:ae,type:"file",multiple:!0,onChange:St,style:{display:"none"}}),p.jsxs("div",{onClick:()=>{var W;return(W=ae.current)==null?void 0:W.click()},onDragOver:Mt,onDragLeave:tt,onDrop:pt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${Re?y.primary:y.border}`,borderRadius:"8px",background:Re?`${y.primary}10`:"transparent",color:Re?y.primary:y.textSecondary,cursor:d||le?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:ce.length>0?"12px":0},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:Re?"file_download":"attach_file"}),p.jsx("span",{style:{fontSize:"14px"},children:Re?"Drop files here":"Drop files or click to add"})]}),ce.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:ce.map((W,we)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:y.attachmentBackground,borderRadius:"8px"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y.textSecondary},children:ct(W)}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),p.jsx("div",{style:{fontSize:"12px",color:y.textSecondary},children:It(W.size)})]}),p.jsx("button",{type:"button",onClick:()=>Ht(we),disabled:d||le,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:y.textSecondary,display:"flex",borderRadius:"4px"},children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${we}`))})]}),p.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!C&&o&&p.jsx("button",{type:"button",onClick:o,disabled:d||le,style:gt(!1,d||le),children:"Cancel"}),p.jsxs("button",{type:"button",onClick:Et,disabled:d||le||!_.trim()||!j.trim(),style:gt(!0,d||le||!_.trim()||!j.trim()),children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:le?"spin 1s linear infinite":"none"},children:le?"sync":"send"}),le?"Sending...":b]})]}),p.jsx("style",{children:`
148
+ `;return p.jsxs("div",{className:i,style:{border:`1px solid ${C.border}`,borderRadius:"8px",background:C.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[p.jsx("style",{children:Le}),b,p.jsxs(Mc,{initialConfig:ve,children:[p.jsx(lf,{theme:C,disabled:o,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:B,aiProcessingAction:N,onAiAction:X,hasContent:ce}),p.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:p.jsx(Cd,{contentEditable:p.jsx(Ed,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:C.text}}),placeholder:p.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:$d})}),p.jsx(Xd,{}),p.jsx(rf,{}),p.jsx(Pd,{}),p.jsx(Md,{onChange:le}),p.jsx(af,{html:v?k:r,isExternalUpdate:v,onImportComplete:j}),p.jsx(uf,{text:u,trigger:c})]}),n&&p.jsx(cf,{replyTo:n,theme:C})]})}const df={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function ff({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:o,onBodyChange:i,externalUpdate:l,insertText:a,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:g="",minHeight:m="200px",sendButtonText:b="Send",hideCancelButton:C=!1,onAiRestructure:v,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:k}){const y={...df,...c},[_,S]=w.useState(r),[A,I]=w.useState(""),[B,N]=w.useState(""),[j,L]=w.useState(e),[$,X]=w.useState(t),[ce,ve]=w.useState([]),[le,Le]=w.useState(!1),[me,he]=w.useState(""),[ye,xe]=w.useState(f),[Se,pe]=w.useState(!1),Ce=w.useRef(void 0);w.useEffect(()=>{l!==void 0&&l!==Ce.current&&(Ce.current=l,X(t),pe(!0))},[l,t]);const Ne=W=>{X(W),pe(!1),i==null||i(W)},ae=w.useRef(null),[Re,ot]=w.useState(!1),St=W=>{const we=W.target.files;if(we){const ke=Array.from(we);console.log("[MailComposer] Files selected:",ke.map(Ee=>({name:Ee.name,size:Ee.size,type:Ee.type}))),ve(Ee=>[...Ee,...ke])}ae.current&&(ae.current.value="")},Mt=W=>{W.preventDefault(),W.stopPropagation(),ot(!0)},tt=W=>{W.preventDefault(),W.stopPropagation(),ot(!1)},pt=W=>{if(W.preventDefault(),W.stopPropagation(),ot(!1),W.dataTransfer.files&&W.dataTransfer.files.length>0){const we=Array.from(W.dataTransfer.files);console.log("[MailComposer] Files dropped:",we.map(ke=>({name:ke.name,size:ke.size,type:ke.type}))),ve(ke=>[...ke,...we])}else console.log("[MailComposer] Drop event but no files:",W.dataTransfer.types)},ct=W=>W.type.startsWith("image/")?"image":W.type==="application/pdf"?"picture_as_pdf":W.type.includes("spreadsheet")||W.type.includes("excel")?"table_chart":W.type.includes("document")||W.type.includes("word")?"description":"attach_file",Jt=W=>{ve(we=>we.filter((ke,Ee)=>Ee!==W))},It=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,Et=async()=>{if(!_.trim()){he("Recipient email is required");return}if(!j.trim()){he("Subject is required");return}Le(!0),he("");try{const W=await Promise.all(ce.map(async Ee=>{const At=await Ee.arrayBuffer(),Tt=btoa(new Uint8Array(At).reduce(($t,K)=>$t+String.fromCharCode(K),""));return{filename:Ee.name,content_type:Ee.type||"application/octet-stream",data:Tt,size:Ee.size}})),we=$.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),ke={to:_.trim(),cc:A.trim()||void 0,bcc:B.trim()||void 0,subject:j.trim(),html:we,attachments:W,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",ke.to,"subject:",ke.subject,"attachmentsCount:",ke.attachments.length),ke.attachments.length>0&&ke.attachments.forEach((Ee,At)=>{var Tt;console.log(`[MailComposer] Attachment ${At+1}:`,Ee.filename,"size:",Ee.size,"type:",Ee.content_type,"data length:",((Tt=Ee.data)==null?void 0:Tt.length)||0)}),await s(ke),S(""),I(""),N(""),L(""),X(""),ve([])}catch(W){he(W instanceof Error?W.message:"Failed to send email")}finally{Le(!1)}},kt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${y.inputBorder}`,borderRadius:"6px",background:y.inputBackground,color:y.text,outline:"none"},lt={display:"block",fontSize:"12px",fontWeight:500,color:y.textSecondary,marginBottom:"4px",textTransform:"uppercase"},gt=(W,we=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:we?"not-allowed":"pointer",opacity:we?.6:1,background:W?y.buttonPrimary:y.buttonSecondary,color:W?"#ffffff":y.text,display:"flex",alignItems:"center",gap:"8px"});return p.jsxs("div",{className:g,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:y.background},children:[me&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:me}),p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"To"}),p.jsx("input",{type:"email",value:_,onChange:W=>S(W.target.value),placeholder:"recipient@example.com",disabled:d||le,style:kt})]}),!ye&&p.jsx("button",{type:"button",onClick:()=>xe(!0),disabled:d||le,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:y.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),ye&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"CC"}),p.jsx("input",{type:"email",value:A,onChange:W=>I(W.target.value),placeholder:"cc@example.com",disabled:d||le,style:kt})]}),p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"BCC"}),p.jsx("input",{type:"email",value:B,onChange:W=>N(W.target.value),placeholder:"bcc@example.com",disabled:d||le,style:kt})]})]}),p.jsxs("div",{children:[p.jsx("label",{style:lt,children:"Subject"}),p.jsx("input",{type:"text",value:j,onChange:W=>L(W.target.value),placeholder:"Email subject",disabled:d||le,style:kt})]}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:p.jsx(Pa,{value:$,onChange:Ne,placeholder:h,replyTo:n,theme:y,disabled:d||le,minHeight:m,externalUpdate:Se?l:void 0,insertText:a,insertTextTrigger:u,onAiRestructure:v,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:k})})}),p.jsxs("div",{children:[p.jsx("label",{style:{...lt,marginBottom:"8px"},children:"Attachments"}),p.jsx("input",{ref:ae,type:"file",multiple:!0,onChange:St,style:{display:"none"}}),p.jsxs("div",{onClick:()=>{var W;return(W=ae.current)==null?void 0:W.click()},onDragOver:Mt,onDragLeave:tt,onDrop:pt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${Re?y.primary:y.border}`,borderRadius:"8px",background:Re?`${y.primary}10`:"transparent",color:Re?y.primary:y.textSecondary,cursor:d||le?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:ce.length>0?"12px":0},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:Re?"file_download":"attach_file"}),p.jsx("span",{style:{fontSize:"14px"},children:Re?"Drop files here":"Drop files or click to add"})]}),ce.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:ce.map((W,we)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:y.attachmentBackground,borderRadius:"8px"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y.textSecondary},children:ct(W)}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),p.jsx("div",{style:{fontSize:"12px",color:y.textSecondary},children:It(W.size)})]}),p.jsx("button",{type:"button",onClick:()=>Jt(we),disabled:d||le,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:y.textSecondary,display:"flex",borderRadius:"4px"},children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${we}`))})]}),p.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!C&&o&&p.jsx("button",{type:"button",onClick:o,disabled:d||le,style:gt(!1,d||le),children:"Cancel"}),p.jsxs("button",{type:"button",onClick:Et,disabled:d||le||!_.trim()||!j.trim(),style:gt(!0,d||le||!_.trim()||!j.trim()),children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:le?"spin 1s linear infinite":"none"},children:le?"sync":"send"}),le?"Sending...":b]})]}),p.jsx("style",{children:`
149
149
  @keyframes spin {
150
150
  from { transform: rotate(0deg); }
151
151
  to { transform: rotate(360deg); }
152
152
  }
153
- `})]})}const cf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function df({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:o,allowDelete:i=!1,onDelete:l,label:a,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...cf,...d},[g,m]=w.useState(!1),[b,C]=w.useState(""),v=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function B(N){v.current&&!v.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const D=r.filter(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase().includes(b.toLowerCase()))&&!e.includes(B.id)}),k=s&&b.trim()&&!r.some(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase())===b.toLowerCase()}),y=e.map(B=>r.find(N=>N.id===B)).filter(Boolean),_=w.useCallback(B=>{var N;c>0&&e.length>=c||(t([...e,B]),C(""),c===1?m(!1):(N=E.current)==null||N.focus())},[e,t,c]),S=w.useCallback(B=>{t(e.filter(N=>N!==B))},[e,t]),A=w.useCallback(async()=>{if(!k)return;const B=await(o==null?void 0:o(b.trim()));B&&_(B.id),C("")},[k,b,o,_]),I=w.useCallback(B=>{B.key==="Enter"?(B.preventDefault(),k?A():D.length>0&&_(D[0].id)):B.key==="Backspace"&&!b&&e.length>0?S(e[e.length-1]):B.key==="Escape"&&(m(!1),C(""))},[k,D,b,e,A,_,S]);return p.jsxs("div",{ref:v,className:f,style:{position:"relative"},children:[a&&p.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),p.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${g?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[y.map(B=>p.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:B.color||h.chipBackground,color:B.color?"#fff":h.chipText},children:[B.label,!u&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),S(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},B.id)),p.jsx("input",{ref:E,type:"text",value:b,onChange:B=>{C(B.target.value),g||m(!0)},onFocus:()=>m(!0),onKeyDown:I,placeholder:y.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),g&&!u&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:D.length===0&&!k?p.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:b?"No matches":"No options available"}):p.jsxs(p.Fragment,{children:[D.map(B=>p.jsxs("div",{onClick:()=>_(B.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[B.label,i&&l&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},B.id)),k&&p.jsxs("div",{onClick:A,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:['+ Create "',b.trim(),'"']})]})})]})}function ff({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:a,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[g,m]=w.useState(null),[b,C]=w.useState(null),[v,E]=w.useState(null),D=w.useRef(null),k=e.reduce((N,j)=>{let L=r.filter($=>n($)===j.id);return s&&(L=L.sort(($,X)=>s($)-s(X))),N[j.id]=L,N},{}),y=w.useCallback((N,j)=>{const L=t(j),$=n(j);m(L),D.current=$,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const X=N.target;X.style.opacity="0.5"})},[t,n]),_=w.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),S=w.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(j),E(L)},[]),A=w.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(C(null),E(null))},[]),I=w.useCallback((N,j,L)=>{if(N.preventDefault(),!g)return;const $=D.current;$===j?l==null||l(g,j,L):$&&i(g,$,j,L),m(null),C(null),E(null),D.current=null},[g,i,l]),B=(N,j)=>p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),p.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),p.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return p.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=k[N.id]||[],L=b===N.id;return p.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:$=>{$.preventDefault(),g&&!L&&C(N.id)},onDragLeave:A,onDrop:$=>I($,N.id,v??j.length),children:[p.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(N,j.length):B(N,j.length)}),p.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${L?"bg-blue-50":""}`,children:[j.map(($,X)=>{const ce=t($),ve=g===ce,le=L&&v===X&&!ve;return p.jsxs("div",{children:[le&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),p.jsx("div",{draggable:!0,onDragStart:Le=>y(Le,$),onDragEnd:_,onDragOver:Le=>S(Le,N.id,X),onClick:()=>a==null?void 0:a($),className:`cursor-grab active:cursor-grabbing transition-all ${ve?"opacity-50 scale-95":""} ${h}`,children:o($,ve)})]},ce)}),p.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:$=>{$.preventDefault(),S($,N.id,j.length)},children:L&&v===j.length&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&p.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:p.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&p.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(N)})]},N.id)})})}const hf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function pf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function gf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function mf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function yf({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:a,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:g={}}){const m={...hf,...g},{allDayItems:b,timedItems:C}=w.useMemo(()=>{const _=[],S=[];for(const A of r)l(A)?_.push(A):S.push(A);return{allDayItems:_,timedItems:S}},[r,l]),v=w.useMemo(()=>{const _=[];for(let S=t;S<=n;S++)_.push(S);return _},[t,n]),E=(n-t+1)*s,D=w.useCallback(_=>{const S=o(_);if(!S)return null;const A=pf(S);if(!A)return null;const{hours:I,minutes:B}=A,N=Math.max(t,Math.min(n,I)),j=I<t?0:B,L=(N-t)*s+j/60*s,$=i(_),X=Math.max(20,$/60*s);return{top:L,height:X}},[o,i,t,n,s]),k=w.useMemo(()=>{if(!f||!mf(e))return null;const _=new Date,S=_.getHours(),A=_.getMinutes();return S<t||S>n?null:(S-t)*s+A/60*s},[e,f,t,n,s]),y=w.useCallback(_=>{if(!d)return;const S=_.currentTarget.getBoundingClientRect(),I=(_.clientY-S.top)/s*60,B=Math.floor(I/60)+t,N=Math.round(I%60/15)*15,j=Math.min(n,Math.max(t,B)),L=N>=60?0:N,$=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d($)},[d,s,t,n]);return p.jsxs("div",{className:h,style:{background:m.background},children:[b.length>0&&p.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[p.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:b.map(_=>p.jsx("div",{onClick:()=>c==null?void 0:c(_),style:{cursor:c?"pointer":"default"},children:u(_)},a(_)))})]}),p.jsxs("div",{style:{position:"relative",height:E},children:[v.map((_,S)=>p.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[p.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:gf(_)}),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<v.length-1&&p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},_)),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:y}),k!==null&&p.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,zIndex:20,pointerEvents:"none"},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),p.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),C.map(_=>{const S=D(_);return S?p.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:A=>{A.stopPropagation(),c==null||c(_)},children:u(_)},a(_)):null})]})]})}function xf({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:o=!1,maxDuration:i=180}){const l=s==="widget",[a,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[g,m]=w.useState(!1),[b,C]=w.useState(0),[v,E]=w.useState(null),[D,k]=w.useState(!1),[y,_]=w.useState(null),[S,A]=w.useState(!0),[I,B]=w.useState([]),[N,j]=w.useState({completed:0,total:0}),L=w.useRef(!1),$=w.useRef(!0);w.useEffect(()=>{$.current=S},[S]);const X=w.useRef(null),ce=w.useRef(null),ve=w.useRef(null),le=w.useRef(null),Le=w.useRef(null),me=w.useRef([]),he=w.useRef(null),ye=w.useRef(null),xe=w.useRef(null),Se=w.useRef(null),pe=w.useRef(!1),Ce=w.useRef([]),Ne=w.useRef(null),ae=w.useRef(null),Re=w.useRef([]),ot=w.useRef([]),St=w.useRef("insert"),Mt=w.useRef(!1),tt=w.useRef(0),pt=w.useRef(0),ct=w.useRef(0),Ht=q=>{const T=Math.floor(q/60),H=Math.floor(q%60);return`${T.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},It=async q=>{const T=await q.arrayBuffer(),H=new AudioContext,Q=await H.decodeAudioData(T);return await H.close(),Q},Et=q=>{const T=q.numberOfChannels,H=q.sampleRate,Q=1,O=16,re=O/8,Z=T*re,ee=H*Z,de=q.length*Z,De=new ArrayBuffer(44+de),te=new DataView(De),ne=(Te,be)=>{for(let He=0;He<be.length;He++)te.setUint8(Te+He,be.charCodeAt(He))};ne(0,"RIFF"),te.setUint32(4,36+de,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Q,!0),te.setUint16(22,T,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,O,!0),ne(36,"data"),te.setUint32(40,de,!0);const Ie=[];for(let Te=0;Te<T;Te++)Ie.push(q.getChannelData(Te));let qe=44;for(let Te=0;Te<q.length;Te++)for(let be=0;be<T;be++){const He=Math.max(-1,Math.min(1,Ie[be][Te])),Je=He<0?He*32768:He*32767;te.setInt16(qe,Je,!0),qe+=2}return new Blob([De],{type:"audio/wav"})},kt=async(q,T,H,Q)=>{const O=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,T.numberOfChannels),ee=Math.min(H,q.length),de=Math.max(0,q.length-H),De=Q==="insert"?ee+T.length+de:ee+T.length,te=O.createBuffer(Z,De,re);for(let ne=0;ne<Z;ne++){const Ie=te.getChannelData(ne),qe=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let be=0;be<ee;be++)Ie[be]=qe[be];const Te=ne<T.numberOfChannels?T.getChannelData(ne):T.getChannelData(0);for(let be=0;be<T.length;be++)Ie[ee+be]=Te[be];if(Q==="insert")for(let be=0;be<de;be++)Ie[ee+T.length+be]=qe[H+be]}return await O.close(),te},lt=w.useCallback(()=>{const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height,re=Ce.current,Z=f||c||1,ee=a==="recording"?c:b;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const de=8,De="rgba(0, 0, 0, 0.4)",te=T.createLinearGradient(0,0,0,de);te.addColorStop(0,De),te.addColorStop(1,"transparent"),T.fillStyle=te,T.fillRect(0,0,Q,de);const ne=T.createLinearGradient(0,O-de,0,O);ne.addColorStop(0,"transparent"),ne.addColorStop(1,De),T.fillStyle=ne,T.fillRect(0,O-de,Q,de);const Ie=T.createLinearGradient(0,0,de,0);Ie.addColorStop(0,De),Ie.addColorStop(1,"transparent"),T.fillStyle=Ie,T.fillRect(0,0,de,O);const qe=T.createLinearGradient(Q-de,0,Q,0);qe.addColorStop(0,"transparent"),qe.addColorStop(1,De),T.fillStyle=qe,T.fillRect(Q-de,0,de,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const Te=Q/2;if(re.length>0)if(a==="recording")for(let Je=0;Je<re.length;Je++){const dt=re.length-1-Je,zt=Te-dt*4;if(zt<-3||zt>Q)continue;const yt=re[Je]*(O/2-12),x=O/2-yt;T.fillStyle="#10b981",T.fillRect(zt,x,3,yt*2)}else{const Je=Z>0?ee/Z*re.length:0;for(let dt=0;dt<re.length;dt++){const zt=Je-dt,yt=Te-zt*4;if(yt<-3||yt>Q)continue;const x=re[dt]*(O/2-12),R=O/2-x;T.fillStyle=dt<=Je?"#10b981":"#4b5563",T.fillRect(yt,R,3,x*2)}}T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(Te,0),T.lineTo(Te,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText(Ht(ee),Te,O-6),a==="recording"&&(T.fillStyle="#ef4444",T.beginPath(),T.arc(20,20,8,0,Math.PI*2),T.fill(),T.fillStyle="#fff",T.font="10px sans-serif",T.textAlign="left",T.fillText("REC",34,24)),T.textAlign="left"},[a,b,c,f]),gt=()=>{const q=Le.current;if(!q||!pe.current)return;const T=q.frequencyBinCount,H=new Uint8Array(T);q.getByteTimeDomainData(H);let Q=0;for(let Z=0;Z<T;Z++){const ee=(H[Z]-128)/128;Q+=ee*ee}const O=Math.sqrt(Q/T),re=Math.min(1,O*3);Ce.current.push(re),lt(),pe.current&&(ye.current=requestAnimationFrame(gt))},W=async()=>{try{E(null),k(!1),Ne.current===null&&(Ce.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});ve.current=q;const T=new AudioContext;le.current=T;const H=T.createAnalyser();H.fftSize=2048,Le.current=H,T.createMediaStreamSource(q).connect(H);const O=new MediaRecorder(q);ce.current=O,me.current=[],O.ondataavailable=re=>{re.data.size>0&&me.current.push(re.data)},O.onstop=async()=>{try{if(pe.current=!1,me.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(me.current,{type:"audio/webm"});let Z,ee;if(Ne.current!==null&&ae.current)try{const te=await It(re),ne=ae.current.sampleRate,Ie=Math.floor(Ne.current*ne),qe=await kt(ae.current,te,Ie,St.current);Z=Et(qe),ee=qe.length/qe.sampleRate,St.current==="insert"&&(Ce.current=[...Ce.current,...ot.current]),Ne.current=null,ae.current=null,Re.current=[],ot.current=[]}catch{Z=re,ee=tt.current>0?tt.current:1}else Z=re,ee=tt.current>0?tt.current:1;if(Se.current=Z,q.getTracks().forEach(te=>te.stop()),$.current&&t){B(te=>[...te,Z]),j(te=>({...te,total:te.total+1})),Se.current=null,Ce.current=[],C(0),h(0),d(0),u("idle");return}const de=URL.createObjectURL(Z),De=new Audio(de);De.ontimeupdate=()=>{C(De.currentTime)},De.onended=()=>{m(!1)},xe.current=De,h(ee),C(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},O.start(100),pe.current=!0,u("recording"),d(0),tt.current=0,he.current=setInterval(()=>{tt.current+=1,d(tt.current),tt.current>=i&&(ce.current&&ce.current.state!=="inactive"&&ce.current.stop(),pe.current=!1,_(null),he.current&&(clearInterval(he.current),he.current=null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(i/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},we=()=>{pe.current=!1,k(!1),_(null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),he.current&&(clearInterval(he.current),he.current=null),ce.current&&ce.current.state!=="inactive"&&ce.current.stop()},ke=q=>{const T=X.current;if(!T)return;const H=f||c;if(H<=0)return;const Q=Ce.current;if(Q.length===0)return;const O=T.getBoundingClientRect(),re=q-pt.current,Z=4,ee=O.width/T.width,de=Q.length/H*Z,De=-re/(de*ee),te=ct.current+De,ne=Math.max(0,Math.min(te,H));xe.current&&(xe.current.currentTime=ne),C(ne)},Ee=()=>{xe.current&&(xe.current.currentTime=0),C(0)},At=()=>{const q=f||c;xe.current&&(xe.current.currentTime=q),C(q)},Tt=()=>{const q=xe.current;q&&(g?(q.pause(),C(q.currentTime),m(!1)):(q.currentTime=b,q.play().catch(()=>{}),m(!0)))},$t=async q=>{if(!Se.current){W();return}try{xe.current&&(xe.current.pause(),m(!1)),St.current=q,ae.current=await It(Se.current);const T=f||c;Ne.current=b;const H=T>0?b/T:0,Q=Math.floor(H*Ce.current.length);Re.current=Ce.current.slice(0,Q),ot.current=Ce.current.slice(Q),Ce.current=[...Re.current],W()}catch{E("Failed to prepare recording. Please try again.")}},K=()=>{xe.current&&(xe.current.pause(),xe.current=null),Se.current=null,ae.current=null,Ne.current=null,Re.current=[],m(!1),C(0),h(0),d(0),W()},J=()=>{Se.current?r(Se.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{a==="recording"&&X.current&&Le.current&&pe.current&&(ye.current=requestAnimationFrame(gt))},[a]),w.useEffect(()=>{const q=X.current;if(!q)return;const T=()=>{const H=window.devicePixelRatio||1,Q=q.getBoundingClientRect();q.width=Q.width*H,q.height=Q.height*H;const O=q.getContext("2d");O&&O.scale(H,H)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),w.useEffect(()=>{if(a==="idle"){const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=T.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),T.fillStyle=ee,T.fillRect(0,0,Q,re);const de=T.createLinearGradient(0,O-re,0,O);de.addColorStop(0,"transparent"),de.addColorStop(1,Z),T.fillStyle=de,T.fillRect(0,O-re,Q,re);const De=T.createLinearGradient(0,0,re,0);De.addColorStop(0,Z),De.addColorStop(1,"transparent"),T.fillStyle=De,T.fillRect(0,0,re,O);const te=T.createLinearGradient(Q-re,0,Q,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),T.fillStyle=te,T.fillRect(Q-re,0,re,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const ne=Q/2;T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(ne,0),T.lineTo(ne,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText("00:00",ne,O-6)}},[a]);const Ae=w.useCallback(q=>{B(T=>[...T,q]),j(T=>({...T,total:T.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(L.current||I.length===0||!t)return;L.current=!0;const T=I[0];try{const H=await t(T);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{B(H=>H.slice(1)),j(H=>({...H,completed:H.completed+1})),L.current=!1}})()},[I,t,n]),w.useEffect(()=>()=>{pe.current=!1,he.current&&clearInterval(he.current),ye.current&&cancelAnimationFrame(ye.current),ve.current&&ve.current.getTracks().forEach(q=>q.stop()),le.current&&le.current.state!=="closed"&&le.current.close()},[]),w.useEffect(()=>{if(a==="editing"&&g){let q;const T=()=>{const H=xe.current;if(H&&g){const Q=X.current;if(Q){const O=Q.getContext("2d");if(O){const re=Q.getBoundingClientRect(),Z=re.width,ee=re.height,de=Ce.current,De=f||c||1,te=H.currentTime;O.fillStyle="#2d3b35",O.fillRect(0,0,Z,ee);const ne=8,Ie="rgba(0, 0, 0, 0.4)",qe=O.createLinearGradient(0,0,0,ne);qe.addColorStop(0,Ie),qe.addColorStop(1,"transparent"),O.fillStyle=qe,O.fillRect(0,0,Z,ne);const Te=O.createLinearGradient(0,ee-ne,0,ee);Te.addColorStop(0,"transparent"),Te.addColorStop(1,Ie),O.fillStyle=Te,O.fillRect(0,ee-ne,Z,ne);const be=O.createLinearGradient(0,0,ne,0);be.addColorStop(0,Ie),be.addColorStop(1,"transparent"),O.fillStyle=be,O.fillRect(0,0,ne,ee);const He=O.createLinearGradient(Z-ne,0,Z,0);He.addColorStop(0,"transparent"),He.addColorStop(1,Ie),O.fillStyle=He,O.fillRect(Z-ne,0,ne,ee),O.strokeStyle="#5a6b62",O.lineWidth=1,O.beginPath(),O.moveTo(0,ee/2),O.lineTo(Z,ee/2),O.stroke();const Je=Z/2,dt=3,zt=4,yt=De>0?te/De*de.length:0;for(let U=0;U<de.length;U++){const Y=yt-U,oe=Je-Y*zt;if(oe<-dt||oe>Z)continue;const ge=de[U]*(ee/2-12),se=ee/2-ge;O.fillStyle=U<=yt?"#10b981":"#4b5563",O.fillRect(oe,se,dt,ge*2)}O.strokeStyle="#ef4444",O.lineWidth=1,O.beginPath(),O.moveTo(Je,0),O.lineTo(Je,ee),O.stroke(),O.fillStyle="#fff",O.font="bold 18px monospace",O.textAlign="center";const x=Math.floor(te/60),R=Math.floor(te%60);O.fillText(`${x.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`,Je,ee-6),O.textAlign="left"}}q=requestAnimationFrame(T)}};return q=requestAnimationFrame(T),()=>cancelAnimationFrame(q)}},[a,g,f,c]),w.useEffect(()=>{a==="editing"&&!g&&lt()},[a,b,g,lt]),v)return p.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[p.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:v}),p.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Pe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Oe={...Pe,opacity:.3,cursor:"not-allowed"},mt=l?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return p.jsxs("div",{style:mt,children:[p.jsx("canvas",{ref:X,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(a==="editing"){Mt.current=!0,pt.current=q.clientX,ct.current=b;const T=Q=>{Mt.current&&ke(Q.clientX)},H=()=>{Mt.current=!1,window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",H)}}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("button",{onClick:Ee,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to start",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),p.jsx("button",{onClick:()=>{if(a==="recording"){const q=ce.current;q&&(q.state==="recording"?(q.pause(),k(!0)):q.state==="paused"&&(q.resume(),k(!1)))}else Tt()},disabled:a==="idle",style:a==="idle"?Oe:Pe,title:g||a==="recording"&&!D?"Pause":"Play",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:g||a==="recording"&&!D?"pause":"play_arrow"})}),p.jsx("button",{onClick:At,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to end",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),p.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),p.jsx("button",{onClick:()=>{y==="insert"?we():a==="idle"?(_("insert"),W()):a==="editing"&&(_("insert"),$t("insert"))},disabled:a==="recording"&&y!=="insert"||g,style:a==="recording"&&y!=="insert"||g?Oe:Pe,title:y==="insert"?"Stop recording":"Insert recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="insert"?"#ef4444":"#171717"},children:"add"})}),p.jsx("button",{onClick:()=>{$.current||(y==="mic"?we():a==="idle"?(_("mic"),W()):a==="editing"&&(_("mic"),$t("replace")))},onMouseDown:()=>{$.current&&a==="idle"&&!g&&(_("mic"),W())},onMouseUp:()=>{$.current&&a==="recording"&&y==="mic"&&we()},onMouseLeave:()=>{$.current&&a==="recording"&&y==="mic"&&we()},onTouchStart:()=>{$.current&&a==="idle"&&!g&&(_("mic"),W())},onTouchEnd:()=>{$.current&&a==="recording"&&y==="mic"&&we()},disabled:a==="recording"&&y!=="mic"||g,style:a==="recording"&&y!=="mic"||g?Oe:Pe,title:S?"Hold to record (walkie-talkie)":y==="mic"?"Stop recording":"Record",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="mic"?"#ef4444":"#171717"},children:"mic"})}),p.jsx("button",{onClick:()=>{y==="startover"?we():a==="editing"&&(_("startover"),K())},disabled:a==="idle"||a==="recording"&&y!=="startover"||g,style:a==="idle"||a==="recording"&&y!=="startover"||g?Oe:Pe,title:y==="startover"?"Stop recording":"Start over",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[N.total>0&&N.completed<N.total&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),N.completed,"/",N.total]}),t&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[p.jsx("button",{onClick:()=>A(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:p.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),p.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),p.jsx("button",{onClick:()=>{a==="editing"&&Se.current&&Ae(Se.current)},disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Transcribe audio",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!o&&p.jsx("button",{onClick:J,disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Save recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),N.total>0&&N.completed<N.total&&p.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",background:"#10b981",width:`${N.completed/N.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.AnimatedCardFlip=hu;exports.ApiClient=dl;exports.AudioEditor=xf;exports.AuthManager=cl;exports.Card=cu;exports.ComboBox=df;exports.DataOperations=Rn;exports.Detail=du;exports.GraphClient=Ia;exports.KanbanBoard=ff;exports.Mail=gu;exports.MailClient=ul;exports.MailComposer=uf;exports.MailEditor=ja;exports.SelectableList=mu;exports.Stack=uu;exports.Timeline=yf;exports.getApiClient=ui;exports.initializeApiClient=iu;exports.useMutation=ou;exports.useQuery=fl;
153
+ `})]})}const hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function pf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:o,allowDelete:i=!1,onDelete:l,label:a,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...hf,...d},[g,m]=w.useState(!1),[b,C]=w.useState(""),v=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function B(N){v.current&&!v.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const D=r.filter(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase().includes(b.toLowerCase()))&&!e.includes(B.id)}),k=s&&b.trim()&&!r.some(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase())===b.toLowerCase()}),y=e.map(B=>r.find(N=>N.id===B)).filter(Boolean),_=w.useCallback(B=>{var N;c>0&&e.length>=c||(t([...e,B]),C(""),c===1?m(!1):(N=E.current)==null||N.focus())},[e,t,c]),S=w.useCallback(B=>{t(e.filter(N=>N!==B))},[e,t]),A=w.useCallback(async()=>{if(!k)return;const B=await(o==null?void 0:o(b.trim()));B&&_(B.id),C("")},[k,b,o,_]),I=w.useCallback(B=>{B.key==="Enter"?(B.preventDefault(),k?A():D.length>0&&_(D[0].id)):B.key==="Backspace"&&!b&&e.length>0?S(e[e.length-1]):B.key==="Escape"&&(m(!1),C(""))},[k,D,b,e,A,_,S]);return p.jsxs("div",{ref:v,className:f,style:{position:"relative"},children:[a&&p.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),p.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${g?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[y.map(B=>p.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:B.color||h.chipBackground,color:B.color?"#fff":h.chipText},children:[B.label,!u&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),S(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},B.id)),p.jsx("input",{ref:E,type:"text",value:b,onChange:B=>{C(B.target.value),g||m(!0)},onFocus:()=>m(!0),onKeyDown:I,placeholder:y.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),g&&!u&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:D.length===0&&!k?p.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:b?"No matches":"No options available"}):p.jsxs(p.Fragment,{children:[D.map(B=>p.jsxs("div",{onClick:()=>_(B.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[B.label,i&&l&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},B.id)),k&&p.jsxs("div",{onClick:A,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:['+ Create "',b.trim(),'"']})]})})]})}function gf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:a,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[g,m]=w.useState(null),[b,C]=w.useState(null),[v,E]=w.useState(null),D=w.useRef(null),k=e.reduce((N,j)=>{let L=r.filter($=>n($)===j.id);return s&&(L=L.sort(($,X)=>s($)-s(X))),N[j.id]=L,N},{}),y=w.useCallback((N,j)=>{const L=t(j),$=n(j);m(L),D.current=$,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const X=N.target;X.style.opacity="0.5"})},[t,n]),_=w.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),S=w.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(j),E(L)},[]),A=w.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(C(null),E(null))},[]),I=w.useCallback((N,j,L)=>{if(N.preventDefault(),!g)return;const $=D.current;$===j?l==null||l(g,j,L):$&&i(g,$,j,L),m(null),C(null),E(null),D.current=null},[g,i,l]),B=(N,j)=>p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),p.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),p.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return p.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=k[N.id]||[],L=b===N.id;return p.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:$=>{$.preventDefault(),g&&!L&&C(N.id)},onDragLeave:A,onDrop:$=>I($,N.id,v??j.length),children:[p.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(N,j.length):B(N,j.length)}),p.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${L?"bg-blue-50":""}`,children:[j.map(($,X)=>{const ce=t($),ve=g===ce,le=L&&v===X&&!ve;return p.jsxs("div",{children:[le&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),p.jsx("div",{draggable:!0,onDragStart:Le=>y(Le,$),onDragEnd:_,onDragOver:Le=>S(Le,N.id,X),onClick:()=>a==null?void 0:a($),className:`cursor-grab active:cursor-grabbing transition-all ${ve?"opacity-50 scale-95":""} ${h}`,children:o($,ve)})]},ce)}),p.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:$=>{$.preventDefault(),S($,N.id,j.length)},children:L&&v===j.length&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&p.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:p.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&p.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(N)})]},N.id)})})}const mf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function yf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function xf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function bf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function _f({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:a,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:g={}}){const m={...mf,...g},{allDayItems:b,timedItems:C}=w.useMemo(()=>{const _=[],S=[];for(const A of r)l(A)?_.push(A):S.push(A);return{allDayItems:_,timedItems:S}},[r,l]),v=w.useMemo(()=>{const _=[];for(let S=t;S<=n;S++)_.push(S);return _},[t,n]),E=(n-t+1)*s,D=w.useCallback(_=>{const S=o(_);if(!S)return null;const A=yf(S);if(!A)return null;const{hours:I,minutes:B}=A,N=Math.max(t,Math.min(n,I)),j=I<t?0:B,L=(N-t)*s+j/60*s,$=i(_),X=Math.max(20,$/60*s);return{top:L,height:X}},[o,i,t,n,s]),k=w.useMemo(()=>{if(!f||!bf(e))return null;const _=new Date,S=_.getHours(),A=_.getMinutes();return S<t||S>n?null:(S-t)*s+A/60*s},[e,f,t,n,s]),y=w.useCallback(_=>{if(!d)return;const S=_.currentTarget.getBoundingClientRect(),I=(_.clientY-S.top)/s*60,B=Math.floor(I/60)+t,N=Math.round(I%60/15)*15,j=Math.min(n,Math.max(t,B)),L=N>=60?0:N,$=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d($)},[d,s,t,n]);return p.jsxs("div",{className:h,style:{background:m.background},children:[b.length>0&&p.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[p.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:b.map(_=>p.jsx("div",{onClick:()=>c==null?void 0:c(_),style:{cursor:c?"pointer":"default"},children:u(_)},a(_)))})]}),p.jsxs("div",{style:{position:"relative",height:E},children:[v.map((_,S)=>p.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[p.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:xf(_)}),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<v.length-1&&p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},_)),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:y}),k!==null&&p.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,zIndex:20,pointerEvents:"none"},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),p.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),C.map(_=>{const S=D(_);return S?p.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:A=>{A.stopPropagation(),c==null||c(_)},children:u(_)},a(_)):null})]})]})}function vf({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:o=!1,maxDuration:i=180}){const l=s==="widget",[a,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[g,m]=w.useState(!1),[b,C]=w.useState(0),[v,E]=w.useState(null),[D,k]=w.useState(!1),[y,_]=w.useState(null),[S,A]=w.useState(!0),[I,B]=w.useState([]),[N,j]=w.useState({completed:0,total:0}),L=w.useRef(!1),$=w.useRef(!0);w.useEffect(()=>{$.current=S},[S]);const X=w.useRef(null),ce=w.useRef(null),ve=w.useRef(null),le=w.useRef(null),Le=w.useRef(null),me=w.useRef([]),he=w.useRef(null),ye=w.useRef(null),xe=w.useRef(null),Se=w.useRef(null),pe=w.useRef(!1),Ce=w.useRef([]),Ne=w.useRef(null),ae=w.useRef(null),Re=w.useRef([]),ot=w.useRef([]),St=w.useRef("insert"),Mt=w.useRef(!1),tt=w.useRef(0),pt=w.useRef(0),ct=w.useRef(0),Jt=q=>{const T=Math.floor(q/60),H=Math.floor(q%60);return`${T.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},It=async q=>{const T=await q.arrayBuffer(),H=new AudioContext,Q=await H.decodeAudioData(T);return await H.close(),Q},Et=q=>{const T=q.numberOfChannels,H=q.sampleRate,Q=1,O=16,re=O/8,Z=T*re,ee=H*Z,de=q.length*Z,De=new ArrayBuffer(44+de),te=new DataView(De),ne=(Te,be)=>{for(let He=0;He<be.length;He++)te.setUint8(Te+He,be.charCodeAt(He))};ne(0,"RIFF"),te.setUint32(4,36+de,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Q,!0),te.setUint16(22,T,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,O,!0),ne(36,"data"),te.setUint32(40,de,!0);const Ie=[];for(let Te=0;Te<T;Te++)Ie.push(q.getChannelData(Te));let qe=44;for(let Te=0;Te<q.length;Te++)for(let be=0;be<T;be++){const He=Math.max(-1,Math.min(1,Ie[be][Te])),Je=He<0?He*32768:He*32767;te.setInt16(qe,Je,!0),qe+=2}return new Blob([De],{type:"audio/wav"})},kt=async(q,T,H,Q)=>{const O=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,T.numberOfChannels),ee=Math.min(H,q.length),de=Math.max(0,q.length-H),De=Q==="insert"?ee+T.length+de:ee+T.length,te=O.createBuffer(Z,De,re);for(let ne=0;ne<Z;ne++){const Ie=te.getChannelData(ne),qe=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let be=0;be<ee;be++)Ie[be]=qe[be];const Te=ne<T.numberOfChannels?T.getChannelData(ne):T.getChannelData(0);for(let be=0;be<T.length;be++)Ie[ee+be]=Te[be];if(Q==="insert")for(let be=0;be<de;be++)Ie[ee+T.length+be]=qe[H+be]}return await O.close(),te},lt=w.useCallback(()=>{const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height,re=Ce.current,Z=f||c||1,ee=a==="recording"?c:b;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const de=8,De="rgba(0, 0, 0, 0.4)",te=T.createLinearGradient(0,0,0,de);te.addColorStop(0,De),te.addColorStop(1,"transparent"),T.fillStyle=te,T.fillRect(0,0,Q,de);const ne=T.createLinearGradient(0,O-de,0,O);ne.addColorStop(0,"transparent"),ne.addColorStop(1,De),T.fillStyle=ne,T.fillRect(0,O-de,Q,de);const Ie=T.createLinearGradient(0,0,de,0);Ie.addColorStop(0,De),Ie.addColorStop(1,"transparent"),T.fillStyle=Ie,T.fillRect(0,0,de,O);const qe=T.createLinearGradient(Q-de,0,Q,0);qe.addColorStop(0,"transparent"),qe.addColorStop(1,De),T.fillStyle=qe,T.fillRect(Q-de,0,de,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const Te=Q/2;if(re.length>0)if(a==="recording")for(let Je=0;Je<re.length;Je++){const dt=re.length-1-Je,zt=Te-dt*4;if(zt<-3||zt>Q)continue;const yt=re[Je]*(O/2-12),x=O/2-yt;T.fillStyle="#10b981",T.fillRect(zt,x,3,yt*2)}else{const Je=Z>0?ee/Z*re.length:0;for(let dt=0;dt<re.length;dt++){const zt=Je-dt,yt=Te-zt*4;if(yt<-3||yt>Q)continue;const x=re[dt]*(O/2-12),R=O/2-x;T.fillStyle=dt<=Je?"#10b981":"#4b5563",T.fillRect(yt,R,3,x*2)}}T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(Te,0),T.lineTo(Te,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText(Jt(ee),Te,O-6),a==="recording"&&(T.fillStyle="#ef4444",T.beginPath(),T.arc(20,20,8,0,Math.PI*2),T.fill(),T.fillStyle="#fff",T.font="10px sans-serif",T.textAlign="left",T.fillText("REC",34,24)),T.textAlign="left"},[a,b,c,f]),gt=()=>{const q=Le.current;if(!q||!pe.current)return;const T=q.frequencyBinCount,H=new Uint8Array(T);q.getByteTimeDomainData(H);let Q=0;for(let Z=0;Z<T;Z++){const ee=(H[Z]-128)/128;Q+=ee*ee}const O=Math.sqrt(Q/T),re=Math.min(1,O*3);Ce.current.push(re),lt(),pe.current&&(ye.current=requestAnimationFrame(gt))},W=async()=>{try{E(null),k(!1),Ne.current===null&&(Ce.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});ve.current=q;const T=new AudioContext;le.current=T;const H=T.createAnalyser();H.fftSize=2048,Le.current=H,T.createMediaStreamSource(q).connect(H);const O=new MediaRecorder(q);ce.current=O,me.current=[],O.ondataavailable=re=>{re.data.size>0&&me.current.push(re.data)},O.onstop=async()=>{try{if(pe.current=!1,me.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(me.current,{type:"audio/webm"});let Z,ee;if(Ne.current!==null&&ae.current)try{const te=await It(re),ne=ae.current.sampleRate,Ie=Math.floor(Ne.current*ne),qe=await kt(ae.current,te,Ie,St.current);Z=Et(qe),ee=qe.length/qe.sampleRate,St.current==="insert"&&(Ce.current=[...Ce.current,...ot.current]),Ne.current=null,ae.current=null,Re.current=[],ot.current=[]}catch{Z=re,ee=tt.current>0?tt.current:1}else Z=re,ee=tt.current>0?tt.current:1;if(Se.current=Z,q.getTracks().forEach(te=>te.stop()),$.current&&t){B(te=>[...te,Z]),j(te=>({...te,total:te.total+1})),Se.current=null,Ce.current=[],C(0),h(0),d(0),u("idle");return}const de=URL.createObjectURL(Z),De=new Audio(de);De.ontimeupdate=()=>{C(De.currentTime)},De.onended=()=>{m(!1)},xe.current=De,h(ee),C(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},O.start(100),pe.current=!0,u("recording"),d(0),tt.current=0,he.current=setInterval(()=>{tt.current+=1,d(tt.current),tt.current>=i&&(ce.current&&ce.current.state!=="inactive"&&ce.current.stop(),pe.current=!1,_(null),he.current&&(clearInterval(he.current),he.current=null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(i/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},we=()=>{pe.current=!1,k(!1),_(null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),he.current&&(clearInterval(he.current),he.current=null),ce.current&&ce.current.state!=="inactive"&&ce.current.stop()},ke=q=>{const T=X.current;if(!T)return;const H=f||c;if(H<=0)return;const Q=Ce.current;if(Q.length===0)return;const O=T.getBoundingClientRect(),re=q-pt.current,Z=4,ee=O.width/T.width,de=Q.length/H*Z,De=-re/(de*ee),te=ct.current+De,ne=Math.max(0,Math.min(te,H));xe.current&&(xe.current.currentTime=ne),C(ne)},Ee=()=>{xe.current&&(xe.current.currentTime=0),C(0)},At=()=>{const q=f||c;xe.current&&(xe.current.currentTime=q),C(q)},Tt=()=>{const q=xe.current;q&&(g?(q.pause(),C(q.currentTime),m(!1)):(q.currentTime=b,q.play().catch(()=>{}),m(!0)))},$t=async q=>{if(!Se.current){W();return}try{xe.current&&(xe.current.pause(),m(!1)),St.current=q,ae.current=await It(Se.current);const T=f||c;Ne.current=b;const H=T>0?b/T:0,Q=Math.floor(H*Ce.current.length);Re.current=Ce.current.slice(0,Q),ot.current=Ce.current.slice(Q),Ce.current=[...Re.current],W()}catch{E("Failed to prepare recording. Please try again.")}},K=()=>{xe.current&&(xe.current.pause(),xe.current=null),Se.current=null,ae.current=null,Ne.current=null,Re.current=[],m(!1),C(0),h(0),d(0),W()},J=()=>{Se.current?r(Se.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{a==="recording"&&X.current&&Le.current&&pe.current&&(ye.current=requestAnimationFrame(gt))},[a]),w.useEffect(()=>{const q=X.current;if(!q)return;const T=()=>{const H=window.devicePixelRatio||1,Q=q.getBoundingClientRect();q.width=Q.width*H,q.height=Q.height*H;const O=q.getContext("2d");O&&O.scale(H,H)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),w.useEffect(()=>{if(a==="idle"){const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=T.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),T.fillStyle=ee,T.fillRect(0,0,Q,re);const de=T.createLinearGradient(0,O-re,0,O);de.addColorStop(0,"transparent"),de.addColorStop(1,Z),T.fillStyle=de,T.fillRect(0,O-re,Q,re);const De=T.createLinearGradient(0,0,re,0);De.addColorStop(0,Z),De.addColorStop(1,"transparent"),T.fillStyle=De,T.fillRect(0,0,re,O);const te=T.createLinearGradient(Q-re,0,Q,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),T.fillStyle=te,T.fillRect(Q-re,0,re,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const ne=Q/2;T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(ne,0),T.lineTo(ne,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText("00:00",ne,O-6)}},[a]);const Ae=w.useCallback(q=>{B(T=>[...T,q]),j(T=>({...T,total:T.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(L.current||I.length===0||!t)return;L.current=!0;const T=I[0];try{const H=await t(T);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{B(H=>H.slice(1)),j(H=>({...H,completed:H.completed+1})),L.current=!1}})()},[I,t,n]),w.useEffect(()=>()=>{pe.current=!1,he.current&&clearInterval(he.current),ye.current&&cancelAnimationFrame(ye.current),ve.current&&ve.current.getTracks().forEach(q=>q.stop()),le.current&&le.current.state!=="closed"&&le.current.close()},[]),w.useEffect(()=>{if(a==="editing"&&g){let q;const T=()=>{const H=xe.current;if(H&&g){const Q=X.current;if(Q){const O=Q.getContext("2d");if(O){const re=Q.getBoundingClientRect(),Z=re.width,ee=re.height,de=Ce.current,De=f||c||1,te=H.currentTime;O.fillStyle="#2d3b35",O.fillRect(0,0,Z,ee);const ne=8,Ie="rgba(0, 0, 0, 0.4)",qe=O.createLinearGradient(0,0,0,ne);qe.addColorStop(0,Ie),qe.addColorStop(1,"transparent"),O.fillStyle=qe,O.fillRect(0,0,Z,ne);const Te=O.createLinearGradient(0,ee-ne,0,ee);Te.addColorStop(0,"transparent"),Te.addColorStop(1,Ie),O.fillStyle=Te,O.fillRect(0,ee-ne,Z,ne);const be=O.createLinearGradient(0,0,ne,0);be.addColorStop(0,Ie),be.addColorStop(1,"transparent"),O.fillStyle=be,O.fillRect(0,0,ne,ee);const He=O.createLinearGradient(Z-ne,0,Z,0);He.addColorStop(0,"transparent"),He.addColorStop(1,Ie),O.fillStyle=He,O.fillRect(Z-ne,0,ne,ee),O.strokeStyle="#5a6b62",O.lineWidth=1,O.beginPath(),O.moveTo(0,ee/2),O.lineTo(Z,ee/2),O.stroke();const Je=Z/2,dt=3,zt=4,yt=De>0?te/De*de.length:0;for(let U=0;U<de.length;U++){const Y=yt-U,oe=Je-Y*zt;if(oe<-dt||oe>Z)continue;const ge=de[U]*(ee/2-12),se=ee/2-ge;O.fillStyle=U<=yt?"#10b981":"#4b5563",O.fillRect(oe,se,dt,ge*2)}O.strokeStyle="#ef4444",O.lineWidth=1,O.beginPath(),O.moveTo(Je,0),O.lineTo(Je,ee),O.stroke(),O.fillStyle="#fff",O.font="bold 18px monospace",O.textAlign="center";const x=Math.floor(te/60),R=Math.floor(te%60);O.fillText(`${x.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`,Je,ee-6),O.textAlign="left"}}q=requestAnimationFrame(T)}};return q=requestAnimationFrame(T),()=>cancelAnimationFrame(q)}},[a,g,f,c]),w.useEffect(()=>{a==="editing"&&!g&&lt()},[a,b,g,lt]),v)return p.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[p.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:v}),p.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Pe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Oe={...Pe,opacity:.3,cursor:"not-allowed"},mt=l?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return p.jsxs("div",{style:mt,children:[p.jsx("canvas",{ref:X,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(a==="editing"){Mt.current=!0,pt.current=q.clientX,ct.current=b;const T=Q=>{Mt.current&&ke(Q.clientX)},H=()=>{Mt.current=!1,window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",H)}}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("button",{onClick:Ee,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to start",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),p.jsx("button",{onClick:()=>{if(a==="recording"){const q=ce.current;q&&(q.state==="recording"?(q.pause(),k(!0)):q.state==="paused"&&(q.resume(),k(!1)))}else Tt()},disabled:a==="idle",style:a==="idle"?Oe:Pe,title:g||a==="recording"&&!D?"Pause":"Play",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:g||a==="recording"&&!D?"pause":"play_arrow"})}),p.jsx("button",{onClick:At,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to end",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),p.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),p.jsx("button",{onClick:()=>{y==="insert"?we():a==="idle"?(_("insert"),W()):a==="editing"&&(_("insert"),$t("insert"))},disabled:a==="recording"&&y!=="insert"||g,style:a==="recording"&&y!=="insert"||g?Oe:Pe,title:y==="insert"?"Stop recording":"Insert recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="insert"?"#ef4444":"#171717"},children:"add"})}),p.jsx("button",{onClick:()=>{$.current||(y==="mic"?we():a==="idle"?(_("mic"),W()):a==="editing"&&(_("mic"),$t("replace")))},onMouseDown:()=>{$.current&&a==="idle"&&!g&&(_("mic"),W())},onMouseUp:()=>{$.current&&a==="recording"&&y==="mic"&&we()},onMouseLeave:()=>{$.current&&a==="recording"&&y==="mic"&&we()},onTouchStart:()=>{$.current&&a==="idle"&&!g&&(_("mic"),W())},onTouchEnd:()=>{$.current&&a==="recording"&&y==="mic"&&we()},disabled:a==="recording"&&y!=="mic"||g,style:a==="recording"&&y!=="mic"||g?Oe:Pe,title:S?"Hold to record (walkie-talkie)":y==="mic"?"Stop recording":"Record",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="mic"?"#ef4444":"#171717"},children:"mic"})}),p.jsx("button",{onClick:()=>{y==="startover"?we():a==="editing"&&(_("startover"),K())},disabled:a==="idle"||a==="recording"&&y!=="startover"||g,style:a==="idle"||a==="recording"&&y!=="startover"||g?Oe:Pe,title:y==="startover"?"Stop recording":"Start over",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[N.total>0&&N.completed<N.total&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),N.completed,"/",N.total]}),t&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[p.jsx("button",{onClick:()=>A(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:p.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),p.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),p.jsx("button",{onClick:()=>{a==="editing"&&Se.current&&Ae(Se.current)},disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Transcribe audio",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!o&&p.jsx("button",{onClick:J,disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Save recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),N.total>0&&N.completed<N.total&&p.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",background:"#10b981",width:`${N.completed/N.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.AnimatedCardFlip=mu;exports.ApiClient=fl;exports.AudioEditor=vf;exports.AuthManager=dl;exports.Card=hu;exports.ComboBox=pf;exports.DataOperations=Rn;exports.Detail=pu;exports.GraphClient=qa;exports.KanbanBoard=gf;exports.Mail=xu;exports.MailClient=cl;exports.MailComposer=ff;exports.MailEditor=Pa;exports.SelectableList=bu;exports.Stack=fu;exports.Timeline=_f;exports.getApiClient=ci;exports.initializeApiClient=au;exports.useMutation=uu;exports.useQuery=hl;