@qwanyx/stack 0.2.30 → 0.2.31
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/components/AudioEditor.d.ts +15 -0
- package/dist/index.cjs.js +36 -36
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +3731 -3320
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}finalize(){return
|
|
3
|
-
`;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let n=t.match(
|
|
4
|
-
`+s).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=
|
|
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:
|
|
6
|
-
`,"𝔑":"𝔑","⁠":""," ":" ","ℕ":"ℕ","⫬":"⫬","≢":"≢","≭":"≭","∦":"∦","∉":"∉","≠":"≠","≂̸":"≂̸","∄":"∄","≯":"≯","≱":"≱","≧̸":"≧̸","≫̸":"≫̸","≹":"≹","⩾̸":"⩾̸","≵":"≵","≎̸":"≎̸","≏̸":"≏̸","⋪":"⋪","⧏̸":"⧏̸","⋬":"⋬","≮":"≮","≰":"≰","≸":"≸","≪̸":"≪̸","⩽̸":"⩽̸","≴":"≴","⪢̸":"⪢̸","⪡̸":"⪡̸","⊀":"⊀","⪯̸":"⪯̸","⋠":"⋠","∌":"∌","⋫":"⋫","⧐̸":"⧐̸","⋭":"⋭","⊏̸":"⊏̸","⋢":"⋢","⊐̸":"⊐̸","⋣":"⋣","⊂⃒":"⊂⃒","⊈":"⊈","⊁":"⊁","⪰̸":"⪰̸","⋡":"⋡","≿̸":"≿̸","⊃⃒":"⊃⃒","⊉":"⊉","≁":"≁","≄":"≄","≇":"≇","≉":"≉","∤":"∤","𝒩":"𝒩","Ñ":"Ñ","Ñ":"Ñ","Ν":"Ν","Œ":"Œ","Ó":"Ó","Ó":"Ó","Ô":"Ô","Ô":"Ô","О":"О","Ő":"Ő","𝔒":"𝔒","Ò":"Ò","Ò":"Ò","Ō":"Ō","Ω":"Ω","Ο":"Ο","𝕆":"𝕆","“":"“","‘":"‘","⩔":"⩔","𝒪":"𝒪","Ø":"Ø","Ø":"Ø","Õ":"Õ","Õ":"Õ","⨷":"⨷","Ö":"Ö","Ö":"Ö","‾":"‾","⏞":"⏞","⎴":"⎴","⏜":"⏜","∂":"∂","П":"П","𝔓":"𝔓","Φ":"Φ","Π":"Π","±":"±","ℌ":"ℌ","ℙ":"ℙ","⪻":"⪻","≺":"≺","⪯":"⪯","≼":"≼","≾":"≾","″":"″","∏":"∏","∷":"∷","∝":"∝","𝒫":"𝒫","Ψ":"Ψ",""":'"',""":'"',"𝔔":"𝔔","ℚ":"ℚ","𝒬":"𝒬","⤐":"⤐","®":"®","®":"®","Ŕ":"Ŕ","⟫":"⟫","↠":"↠","⤖":"⤖","Ř":"Ř","Ŗ":"Ŗ","Р":"Р","ℜ":"ℜ","∋":"∋","⇋":"⇋","⥯":"⥯","ℜ":"ℜ","Ρ":"Ρ","⟩":"⟩","→":"→","⇥":"⇥","⇄":"⇄","⌉":"⌉","⟧":"⟧","⥝":"⥝","⇂":"⇂","⥕":"⥕","⌋":"⌋","⊢":"⊢","↦":"↦","⥛":"⥛","⊳":"⊳","⧐":"⧐","⊵":"⊵","⥏":"⥏","⥜":"⥜","↾":"↾","⥔":"⥔","⇀":"⇀","⥓":"⥓","⇒":"⇒","ℝ":"ℝ","⥰":"⥰","⇛":"⇛","ℛ":"ℛ","↱":"↱","⧴":"⧴","Щ":"Щ","Ш":"Ш","Ь":"Ь","Ś":"Ś","⪼":"⪼","Š":"Š","Ş":"Ş","Ŝ":"Ŝ","С":"С","𝔖":"𝔖","↓":"↓","←":"←","→":"→","↑":"↑","Σ":"Σ","∘":"∘","𝕊":"𝕊","√":"√","□":"□","⊓":"⊓","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊔":"⊔","𝒮":"𝒮","⋆":"⋆","⋐":"⋐","⋐":"⋐","⊆":"⊆","≻":"≻","⪰":"⪰","≽":"≽","≿":"≿","∋":"∋","∑":"∑","⋑":"⋑","⊃":"⊃","⊇":"⊇","⋑":"⋑","Þ":"Þ","Þ":"Þ","™":"™","Ћ":"Ћ","Ц":"Ц","	":" ","Τ":"Τ","Ť":"Ť","Ţ":"Ţ","Т":"Т","𝔗":"𝔗","∴":"∴","Θ":"Θ","  ":" "," ":" ","∼":"∼","≃":"≃","≅":"≅","≈":"≈","𝕋":"𝕋","⃛":"⃛","𝒯":"𝒯","Ŧ":"Ŧ","Ú":"Ú","Ú":"Ú","↟":"↟","⥉":"⥉","Ў":"Ў","Ŭ":"Ŭ","Û":"Û","Û":"Û","У":"У","Ű":"Ű","𝔘":"𝔘","Ù":"Ù","Ù":"Ù","Ū":"Ū","_":"_","⏟":"⏟","⎵":"⎵","⏝":"⏝","⋃":"⋃","⊎":"⊎","Ų":"Ų","𝕌":"𝕌","↑":"↑","⤒":"⤒","⇅":"⇅","↕":"↕","⥮":"⥮","⊥":"⊥","↥":"↥","⇑":"⇑","⇕":"⇕","↖":"↖","↗":"↗","ϒ":"ϒ","Υ":"Υ","Ů":"Ů","𝒰":"𝒰","Ũ":"Ũ","Ü":"Ü","Ü":"Ü","⊫":"⊫","⫫":"⫫","В":"В","⊩":"⊩","⫦":"⫦","⋁":"⋁","‖":"‖","‖":"‖","∣":"∣","|":"|","❘":"❘","≀":"≀"," ":" ","𝔙":"𝔙","𝕍":"𝕍","𝒱":"𝒱","⊪":"⊪","Ŵ":"Ŵ","⋀":"⋀","𝔚":"𝔚","𝕎":"𝕎","𝒲":"𝒲","𝔛":"𝔛","Ξ":"Ξ","𝕏":"𝕏","𝒳":"𝒳","Я":"Я","Ї":"Ї","Ю":"Ю","Ý":"Ý","Ý":"Ý","Ŷ":"Ŷ","Ы":"Ы","𝔜":"𝔜","𝕐":"𝕐","𝒴":"𝒴","Ÿ":"Ÿ","Ж":"Ж","Ź":"Ź","Ž":"Ž","З":"З","Ż":"Ż","​":"","Ζ":"Ζ","ℨ":"ℨ","ℤ":"ℤ","𝒵":"𝒵","á":"á","á":"á","ă":"ă","∾":"∾","∾̳":"∾̳","∿":"∿","â":"â","â":"â","´":"´","´":"´","а":"а","æ":"æ","æ":"æ","⁡":"","𝔞":"𝔞","à":"à","à":"à","ℵ":"ℵ","ℵ":"ℵ","α":"α","ā":"ā","⨿":"⨿","&":"&","&":"&","∧":"∧","⩕":"⩕","⩜":"⩜","⩘":"⩘","⩚":"⩚","∠":"∠","⦤":"⦤","∠":"∠","∡":"∡","⦨":"⦨","⦩":"⦩","⦪":"⦪","⦫":"⦫","⦬":"⦬","⦭":"⦭","⦮":"⦮","⦯":"⦯","∟":"∟","⊾":"⊾","⦝":"⦝","∢":"∢","Å":"Å","⍼":"⍼","ą":"ą","𝕒":"𝕒","≈":"≈","⩰":"⩰","⩯":"⩯","≊":"≊","≋":"≋","'":"'","≈":"≈","≊":"≊","å":"å","å":"å","𝒶":"𝒶","*":"*","≈":"≈","≍":"≍","ã":"ã","ã":"ã","ä":"ä","ä":"ä","∳":"∳","⨑":"⨑","⫭":"⫭","≌":"≌","϶":"϶","‵":"‵","∽":"∽","⋍":"⋍","⊽":"⊽","⌅":"⌅","⌅":"⌅","⎵":"⎵","⎶":"⎶","≌":"≌","б":"б","„":"„","∵":"∵","∵":"∵","⦰":"⦰","϶":"϶","ℬ":"ℬ","β":"β","ℶ":"ℶ","≬":"≬","𝔟":"𝔟","⋂":"⋂","◯":"◯","⋃":"⋃","⨀":"⨀","⨁":"⨁","⨂":"⨂","⨆":"⨆","★":"★","▽":"▽","△":"△","⨄":"⨄","⋁":"⋁","⋀":"⋀","⤍":"⤍","⧫":"⧫","▪":"▪","▴":"▴","▾":"▾","◂":"◂","▸":"▸","␣":"␣","▒":"▒","░":"░","▓":"▓","█":"█","=⃥":"=⃥","≡⃥":"≡⃥","⌐":"⌐","𝕓":"𝕓","⊥":"⊥","⊥":"⊥","⋈":"⋈","╗":"╗","╔":"╔","╖":"╖","╓":"╓","═":"═","╦":"╦","╩":"╩","╤":"╤","╧":"╧","╝":"╝","╚":"╚","╜":"╜","╙":"╙","║":"║","╬":"╬","╣":"╣","╠":"╠","╫":"╫","╢":"╢","╟":"╟","⧉":"⧉","╕":"╕","╒":"╒","┐":"┐","┌":"┌","─":"─","╥":"╥","╨":"╨","┬":"┬","┴":"┴","⊟":"⊟","⊞":"⊞","⊠":"⊠","╛":"╛","╘":"╘","┘":"┘","└":"└","│":"│","╪":"╪","╡":"╡","╞":"╞","┼":"┼","┤":"┤","├":"├","‵":"‵","˘":"˘","¦":"¦","¦":"¦","𝒷":"𝒷","⁏":"⁏","∽":"∽","⋍":"⋍","\":"\\","⧅":"⧅","⟈":"⟈","•":"•","•":"•","≎":"≎","⪮":"⪮","≏":"≏","≏":"≏","ć":"ć","∩":"∩","⩄":"⩄","⩉":"⩉","⩋":"⩋","⩇":"⩇","⩀":"⩀","∩︀":"∩︀","⁁":"⁁","ˇ":"ˇ","⩍":"⩍","č":"č","ç":"ç","ç":"ç","ĉ":"ĉ","⩌":"⩌","⩐":"⩐","ċ":"ċ","¸":"¸","¸":"¸","⦲":"⦲","¢":"¢","¢":"¢","·":"·","𝔠":"𝔠","ч":"ч","✓":"✓","✓":"✓","χ":"χ","○":"○","⧃":"⧃","ˆ":"ˆ","≗":"≗","↺":"↺","↻":"↻","®":"®","Ⓢ":"Ⓢ","⊛":"⊛","⊚":"⊚","⊝":"⊝","≗":"≗","⨐":"⨐","⫯":"⫯","⧂":"⧂","♣":"♣","♣":"♣",":":":","≔":"≔","≔":"≔",",":",","@":"@","∁":"∁","∘":"∘","∁":"∁","ℂ":"ℂ","≅":"≅","⩭":"⩭","∮":"∮","𝕔":"𝕔","∐":"∐","©":"©","©":"©","℗":"℗","↵":"↵","✗":"✗","𝒸":"𝒸","⫏":"⫏","⫑":"⫑","⫐":"⫐","⫒":"⫒","⋯":"⋯","⤸":"⤸","⤵":"⤵","⋞":"⋞","⋟":"⋟","↶":"↶","⤽":"⤽","∪":"∪","⩈":"⩈","⩆":"⩆","⩊":"⩊","⊍":"⊍","⩅":"⩅","∪︀":"∪︀","↷":"↷","⤼":"⤼","⋞":"⋞","⋟":"⋟","⋎":"⋎","⋏":"⋏","¤":"¤","¤":"¤","↶":"↶","↷":"↷","⋎":"⋎","⋏":"⋏","∲":"∲","∱":"∱","⌭":"⌭","⇓":"⇓","⥥":"⥥","†":"†","ℸ":"ℸ","↓":"↓","‐":"‐","⊣":"⊣","⤏":"⤏","˝":"˝","ď":"ď","д":"д","ⅆ":"ⅆ","‡":"‡","⇊":"⇊","⩷":"⩷","°":"°","°":"°","δ":"δ","⦱":"⦱","⥿":"⥿","𝔡":"𝔡","⇃":"⇃","⇂":"⇂","⋄":"⋄","⋄":"⋄","♦":"♦","♦":"♦","¨":"¨","ϝ":"ϝ","⋲":"⋲","÷":"÷","÷":"÷","÷":"÷","⋇":"⋇","⋇":"⋇","ђ":"ђ","⌞":"⌞","⌍":"⌍","$":"$","𝕕":"𝕕","˙":"˙","≐":"≐","≑":"≑","∸":"∸","∔":"∔","⊡":"⊡","⌆":"⌆","↓":"↓","⇊":"⇊","⇃":"⇃","⇂":"⇂","⤐":"⤐","⌟":"⌟","⌌":"⌌","𝒹":"𝒹","ѕ":"ѕ","⧶":"⧶","đ":"đ","⋱":"⋱","▿":"▿","▾":"▾","⇵":"⇵","⥯":"⥯","⦦":"⦦","џ":"џ","⟿":"⟿","⩷":"⩷","≑":"≑","é":"é","é":"é","⩮":"⩮","ě":"ě","≖":"≖","ê":"ê","ê":"ê","≕":"≕","э":"э","ė":"ė","ⅇ":"ⅇ","≒":"≒","𝔢":"𝔢","⪚":"⪚","è":"è","è":"è","⪖":"⪖","⪘":"⪘","⪙":"⪙","⏧":"⏧","ℓ":"ℓ","⪕":"⪕","⪗":"⪗","ē":"ē","∅":"∅","∅":"∅","∅":"∅"," ":" "," ":" "," ":" ","ŋ":"ŋ"," ":" ","ę":"ę","𝕖":"𝕖","⋕":"⋕","⧣":"⧣","⩱":"⩱","ε":"ε","ε":"ε","ϵ":"ϵ","≖":"≖","≕":"≕","≂":"≂","⪖":"⪖","⪕":"⪕","=":"=","≟":"≟","≡":"≡","⩸":"⩸","⧥":"⧥","≓":"≓","⥱":"⥱","ℯ":"ℯ","≐":"≐","≂":"≂","η":"η","ð":"ð","ð":"ð","ë":"ë","ë":"ë","€":"€","!":"!","∃":"∃","ℰ":"ℰ","ⅇ":"ⅇ","≒":"≒","ф":"ф","♀":"♀","ffi":"ffi","ff":"ff","ffl":"ffl","𝔣":"𝔣","fi":"fi","fj":"fj","♭":"♭","fl":"fl","▱":"▱","ƒ":"ƒ","𝕗":"𝕗","∀":"∀","⋔":"⋔","⫙":"⫙","⨍":"⨍","½":"½","½":"½","⅓":"⅓","¼":"¼","¼":"¼","⅕":"⅕","⅙":"⅙","⅛":"⅛","⅔":"⅔","⅖":"⅖","¾":"¾","¾":"¾","⅗":"⅗","⅜":"⅜","⅘":"⅘","⅚":"⅚","⅝":"⅝","⅞":"⅞","⁄":"⁄","⌢":"⌢","𝒻":"𝒻","≧":"≧","⪌":"⪌","ǵ":"ǵ","γ":"γ","ϝ":"ϝ","⪆":"⪆","ğ":"ğ","ĝ":"ĝ","г":"г","ġ":"ġ","≥":"≥","⋛":"⋛","≥":"≥","≧":"≧","⩾":"⩾","⩾":"⩾","⪩":"⪩","⪀":"⪀","⪂":"⪂","⪄":"⪄","⋛︀":"⋛︀","⪔":"⪔","𝔤":"𝔤","≫":"≫","⋙":"⋙","ℷ":"ℷ","ѓ":"ѓ","≷":"≷","⪒":"⪒","⪥":"⪥","⪤":"⪤","≩":"≩","⪊":"⪊","⪊":"⪊","⪈":"⪈","⪈":"⪈","≩":"≩","⋧":"⋧","𝕘":"𝕘","`":"`","ℊ":"ℊ","≳":"≳","⪎":"⪎","⪐":"⪐",">":">",">":">","⪧":"⪧","⩺":"⩺","⋗":"⋗","⦕":"⦕","⩼":"⩼","⪆":"⪆","⥸":"⥸","⋗":"⋗","⋛":"⋛","⪌":"⪌","≷":"≷","≳":"≳","≩︀":"≩︀","≩︀":"≩︀","⇔":"⇔"," ":" ","½":"½","ℋ":"ℋ","ъ":"ъ","↔":"↔","⥈":"⥈","↭":"↭","ℏ":"ℏ","ĥ":"ĥ","♥":"♥","♥":"♥","…":"…","⊹":"⊹","𝔥":"𝔥","⤥":"⤥","⤦":"⤦","⇿":"⇿","∻":"∻","↩":"↩","↪":"↪","𝕙":"𝕙","―":"―","𝒽":"𝒽","ℏ":"ℏ","ħ":"ħ","⁃":"⁃","‐":"‐","í":"í","í":"í","⁣":"","î":"î","î":"î","и":"и","е":"е","¡":"¡","¡":"¡","⇔":"⇔","𝔦":"𝔦","ì":"ì","ì":"ì","ⅈ":"ⅈ","⨌":"⨌","∭":"∭","⧜":"⧜","℩":"℩","ij":"ij","ī":"ī","ℑ":"ℑ","ℐ":"ℐ","ℑ":"ℑ","ı":"ı","⊷":"⊷","Ƶ":"Ƶ","∈":"∈","℅":"℅","∞":"∞","⧝":"⧝","ı":"ı","∫":"∫","⊺":"⊺","ℤ":"ℤ","⊺":"⊺","⨗":"⨗","⨼":"⨼","ё":"ё","į":"į","𝕚":"𝕚","ι":"ι","⨼":"⨼","¿":"¿","¿":"¿","𝒾":"𝒾","∈":"∈","⋹":"⋹","⋵":"⋵","⋴":"⋴","⋳":"⋳","∈":"∈","⁢":"","ĩ":"ĩ","і":"і","ï":"ï","ï":"ï","ĵ":"ĵ","й":"й","𝔧":"𝔧","ȷ":"ȷ","𝕛":"𝕛","𝒿":"𝒿","ј":"ј","є":"є","κ":"κ","ϰ":"ϰ","ķ":"ķ","к":"к","𝔨":"𝔨","ĸ":"ĸ","х":"х","ќ":"ќ","𝕜":"𝕜","𝓀":"𝓀","⇚":"⇚","⇐":"⇐","⤛":"⤛","⤎":"⤎","≦":"≦","⪋":"⪋","⥢":"⥢","ĺ":"ĺ","⦴":"⦴","ℒ":"ℒ","λ":"λ","⟨":"⟨","⦑":"⦑","⟨":"⟨","⪅":"⪅","«":"«","«":"«","←":"←","⇤":"⇤","⤟":"⤟","⤝":"⤝","↩":"↩","↫":"↫","⤹":"⤹","⥳":"⥳","↢":"↢","⪫":"⪫","⤙":"⤙","⪭":"⪭","⪭︀":"⪭︀","⤌":"⤌","❲":"❲","{":"{","[":"[","⦋":"⦋","⦏":"⦏","⦍":"⦍","ľ":"ľ","ļ":"ļ","⌈":"⌈","{":"{","л":"л","⤶":"⤶","“":"“","„":"„","⥧":"⥧","⥋":"⥋","↲":"↲","≤":"≤","←":"←","↢":"↢","↽":"↽","↼":"↼","⇇":"⇇","↔":"↔","⇆":"⇆","⇋":"⇋","↭":"↭","⋋":"⋋","⋚":"⋚","≤":"≤","≦":"≦","⩽":"⩽","⩽":"⩽","⪨":"⪨","⩿":"⩿","⪁":"⪁","⪃":"⪃","⋚︀":"⋚︀","⪓":"⪓","⪅":"⪅","⋖":"⋖","⋚":"⋚","⪋":"⪋","≶":"≶","≲":"≲","⥼":"⥼","⌊":"⌊","𝔩":"𝔩","≶":"≶","⪑":"⪑","↽":"↽","↼":"↼","⥪":"⥪","▄":"▄","љ":"љ","≪":"≪","⇇":"⇇","⌞":"⌞","⥫":"⥫","◺":"◺","ŀ":"ŀ","⎰":"⎰","⎰":"⎰","≨":"≨","⪉":"⪉","⪉":"⪉","⪇":"⪇","⪇":"⪇","≨":"≨","⋦":"⋦","⟬":"⟬","⇽":"⇽","⟦":"⟦","⟵":"⟵","⟷":"⟷","⟼":"⟼","⟶":"⟶","↫":"↫","↬":"↬","⦅":"⦅","𝕝":"𝕝","⨭":"⨭","⨴":"⨴","∗":"∗","_":"_","◊":"◊","◊":"◊","⧫":"⧫","(":"(","⦓":"⦓","⇆":"⇆","⌟":"⌟","⇋":"⇋","⥭":"⥭","‎":"","⊿":"⊿","‹":"‹","𝓁":"𝓁","↰":"↰","≲":"≲","⪍":"⪍","⪏":"⪏","[":"[","‘":"‘","‚":"‚","ł":"ł","<":"<","<":"<","⪦":"⪦","⩹":"⩹","⋖":"⋖","⋋":"⋋","⋉":"⋉","⥶":"⥶","⩻":"⩻","⦖":"⦖","◃":"◃","⊴":"⊴","◂":"◂","⥊":"⥊","⥦":"⥦","≨︀":"≨︀","≨︀":"≨︀","∺":"∺","¯":"¯","¯":"¯","♂":"♂","✠":"✠","✠":"✠","↦":"↦","↦":"↦","↧":"↧","↤":"↤","↥":"↥","▮":"▮","⨩":"⨩","м":"м","—":"—","∡":"∡","𝔪":"𝔪","℧":"℧","µ":"µ","µ":"µ","∣":"∣","*":"*","⫰":"⫰","·":"·","·":"·","−":"−","⊟":"⊟","∸":"∸","⨪":"⨪","⫛":"⫛","…":"…","∓":"∓","⊧":"⊧","𝕞":"𝕞","∓":"∓","𝓂":"𝓂","∾":"∾","μ":"μ","⊸":"⊸","⊸":"⊸","⋙̸":"⋙̸","≫⃒":"≫⃒","≫̸":"≫̸","⇍":"⇍","⇎":"⇎","⋘̸":"⋘̸","≪⃒":"≪⃒","≪̸":"≪̸","⇏":"⇏","⊯":"⊯","⊮":"⊮","∇":"∇","ń":"ń","∠⃒":"∠⃒","≉":"≉","⩰̸":"⩰̸","≋̸":"≋̸","ʼn":"ʼn","≉":"≉","♮":"♮","♮":"♮","ℕ":"ℕ"," ":" "," ":" ","≎̸":"≎̸","≏̸":"≏̸","⩃":"⩃","ň":"ň","ņ":"ņ","≇":"≇","⩭̸":"⩭̸","⩂":"⩂","н":"н","–":"–","≠":"≠","⇗":"⇗","⤤":"⤤","↗":"↗","↗":"↗","≐̸":"≐̸","≢":"≢","⤨":"⤨","≂̸":"≂̸","∄":"∄","∄":"∄","𝔫":"𝔫","≧̸":"≧̸","≱":"≱","≱":"≱","≧̸":"≧̸","⩾̸":"⩾̸","⩾̸":"⩾̸","≵":"≵","≯":"≯","≯":"≯","⇎":"⇎","↮":"↮","⫲":"⫲","∋":"∋","⋼":"⋼","⋺":"⋺","∋":"∋","њ":"њ","⇍":"⇍","≦̸":"≦̸","↚":"↚","‥":"‥","≰":"≰","↚":"↚","↮":"↮","≰":"≰","≦̸":"≦̸","⩽̸":"⩽̸","⩽̸":"⩽̸","≮":"≮","≴":"≴","≮":"≮","⋪":"⋪","⋬":"⋬","∤":"∤","𝕟":"𝕟","¬":"¬","¬":"¬","∉":"∉","⋹̸":"⋹̸","⋵̸":"⋵̸","∉":"∉","⋷":"⋷","⋶":"⋶","∌":"∌","∌":"∌","⋾":"⋾","⋽":"⋽","∦":"∦","∦":"∦","⫽⃥":"⫽⃥","∂̸":"∂̸","⨔":"⨔","⊀":"⊀","⋠":"⋠","⪯̸":"⪯̸","⊀":"⊀","⪯̸":"⪯̸","⇏":"⇏","↛":"↛","⤳̸":"⤳̸","↝̸":"↝̸","↛":"↛","⋫":"⋫","⋭":"⋭","⊁":"⊁","⋡":"⋡","⪰̸":"⪰̸","𝓃":"𝓃","∤":"∤","∦":"∦","≁":"≁","≄":"≄","≄":"≄","∤":"∤","∦":"∦","⋢":"⋢","⋣":"⋣","⊄":"⊄","⫅̸":"⫅̸","⊈":"⊈","⊂⃒":"⊂⃒","⊈":"⊈","⫅̸":"⫅̸","⊁":"⊁","⪰̸":"⪰̸","⊅":"⊅","⫆̸":"⫆̸","⊉":"⊉","⊃⃒":"⊃⃒","⊉":"⊉","⫆̸":"⫆̸","≹":"≹","ñ":"ñ","ñ":"ñ","≸":"≸","⋪":"⋪","⋬":"⋬","⋫":"⋫","⋭":"⋭","ν":"ν","#":"#","№":"№"," ":" ","⊭":"⊭","⤄":"⤄","≍⃒":"≍⃒","⊬":"⊬","≥⃒":"≥⃒",">⃒":">⃒","⧞":"⧞","⤂":"⤂","≤⃒":"≤⃒","<⃒":"<⃒","⊴⃒":"⊴⃒","⤃":"⤃","⊵⃒":"⊵⃒","∼⃒":"∼⃒","⇖":"⇖","⤣":"⤣","↖":"↖","↖":"↖","⤧":"⤧","Ⓢ":"Ⓢ","ó":"ó","ó":"ó","⊛":"⊛","⊚":"⊚","ô":"ô","ô":"ô","о":"о","⊝":"⊝","ő":"ő","⨸":"⨸","⊙":"⊙","⦼":"⦼","œ":"œ","⦿":"⦿","𝔬":"𝔬","˛":"˛","ò":"ò","ò":"ò","⧁":"⧁","⦵":"⦵","Ω":"Ω","∮":"∮","↺":"↺","⦾":"⦾","⦻":"⦻","‾":"‾","⧀":"⧀","ō":"ō","ω":"ω","ο":"ο","⦶":"⦶","⊖":"⊖","𝕠":"𝕠","⦷":"⦷","⦹":"⦹","⊕":"⊕","∨":"∨","↻":"↻","⩝":"⩝","ℴ":"ℴ","ℴ":"ℴ","ª":"ª","ª":"ª","º":"º","º":"º","⊶":"⊶","⩖":"⩖","⩗":"⩗","⩛":"⩛","ℴ":"ℴ","ø":"ø","ø":"ø","⊘":"⊘","õ":"õ","õ":"õ","⊗":"⊗","⨶":"⨶","ö":"ö","ö":"ö","⌽":"⌽","∥":"∥","¶":"¶","¶":"¶","∥":"∥","⫳":"⫳","⫽":"⫽","∂":"∂","п":"п","%":"%",".":".","‰":"‰","⊥":"⊥","‱":"‱","𝔭":"𝔭","φ":"φ","ϕ":"ϕ","ℳ":"ℳ","☎":"☎","π":"π","⋔":"⋔","ϖ":"ϖ","ℏ":"ℏ","ℎ":"ℎ","ℏ":"ℏ","+":"+","⨣":"⨣","⊞":"⊞","⨢":"⨢","∔":"∔","⨥":"⨥","⩲":"⩲","±":"±","±":"±","⨦":"⨦","⨧":"⨧","±":"±","⨕":"⨕","𝕡":"𝕡","£":"£","£":"£","≺":"≺","⪳":"⪳","⪷":"⪷","≼":"≼","⪯":"⪯","≺":"≺","⪷":"⪷","≼":"≼","⪯":"⪯","⪹":"⪹","⪵":"⪵","⋨":"⋨","≾":"≾","′":"′","ℙ":"ℙ","⪵":"⪵","⪹":"⪹","⋨":"⋨","∏":"∏","⌮":"⌮","⌒":"⌒","⌓":"⌓","∝":"∝","∝":"∝","≾":"≾","⊰":"⊰","𝓅":"𝓅","ψ":"ψ"," ":" ","𝔮":"𝔮","⨌":"⨌","𝕢":"𝕢","⁗":"⁗","𝓆":"𝓆","ℍ":"ℍ","⨖":"⨖","?":"?","≟":"≟",""":'"',""":'"',"⇛":"⇛","⇒":"⇒","⤜":"⤜","⤏":"⤏","⥤":"⥤","∽̱":"∽̱","ŕ":"ŕ","√":"√","⦳":"⦳","⟩":"⟩","⦒":"⦒","⦥":"⦥","⟩":"⟩","»":"»","»":"»","→":"→","⥵":"⥵","⇥":"⇥","⤠":"⤠","⤳":"⤳","⤞":"⤞","↪":"↪","↬":"↬","⥅":"⥅","⥴":"⥴","↣":"↣","↝":"↝","⤚":"⤚","∶":"∶","ℚ":"ℚ","⤍":"⤍","❳":"❳","}":"}","]":"]","⦌":"⦌","⦎":"⦎","⦐":"⦐","ř":"ř","ŗ":"ŗ","⌉":"⌉","}":"}","р":"р","⤷":"⤷","⥩":"⥩","”":"”","”":"”","↳":"↳","ℜ":"ℜ","ℛ":"ℛ","ℜ":"ℜ","ℝ":"ℝ","▭":"▭","®":"®","®":"®","⥽":"⥽","⌋":"⌋","𝔯":"𝔯","⇁":"⇁","⇀":"⇀","⥬":"⥬","ρ":"ρ","ϱ":"ϱ","→":"→","↣":"↣","⇁":"⇁","⇀":"⇀","⇄":"⇄","⇌":"⇌","⇉":"⇉","↝":"↝","⋌":"⋌","˚":"˚","≓":"≓","⇄":"⇄","⇌":"⇌","‏":"","⎱":"⎱","⎱":"⎱","⫮":"⫮","⟭":"⟭","⇾":"⇾","⟧":"⟧","⦆":"⦆","𝕣":"𝕣","⨮":"⨮","⨵":"⨵",")":")","⦔":"⦔","⨒":"⨒","⇉":"⇉","›":"›","𝓇":"𝓇","↱":"↱","]":"]","’":"’","’":"’","⋌":"⋌","⋊":"⋊","▹":"▹","⊵":"⊵","▸":"▸","⧎":"⧎","⥨":"⥨","℞":"℞","ś":"ś","‚":"‚","≻":"≻","⪴":"⪴","⪸":"⪸","š":"š","≽":"≽","⪰":"⪰","ş":"ş","ŝ":"ŝ","⪶":"⪶","⪺":"⪺","⋩":"⋩","⨓":"⨓","≿":"≿","с":"с","⋅":"⋅","⊡":"⊡","⩦":"⩦","⇘":"⇘","⤥":"⤥","↘":"↘","↘":"↘","§":"§","§":"§",";":";","⤩":"⤩","∖":"∖","∖":"∖","✶":"✶","𝔰":"𝔰","⌢":"⌢","♯":"♯","щ":"щ","ш":"ш","∣":"∣","∥":"∥","­":"","­":"","σ":"σ","ς":"ς","ς":"ς","∼":"∼","⩪":"⩪","≃":"≃","≃":"≃","⪞":"⪞","⪠":"⪠","⪝":"⪝","⪟":"⪟","≆":"≆","⨤":"⨤","⥲":"⥲","←":"←","∖":"∖","⨳":"⨳","⧤":"⧤","∣":"∣","⌣":"⌣","⪪":"⪪","⪬":"⪬","⪬︀":"⪬︀","ь":"ь","/":"/","⧄":"⧄","⌿":"⌿","𝕤":"𝕤","♠":"♠","♠":"♠","∥":"∥","⊓":"⊓","⊓︀":"⊓︀","⊔":"⊔","⊔︀":"⊔︀","⊏":"⊏","⊑":"⊑","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊐":"⊐","⊒":"⊒","□":"□","□":"□","▪":"▪","▪":"▪","→":"→","𝓈":"𝓈","∖":"∖","⌣":"⌣","⋆":"⋆","☆":"☆","★":"★","ϵ":"ϵ","ϕ":"ϕ","¯":"¯","⊂":"⊂","⫅":"⫅","⪽":"⪽","⊆":"⊆","⫃":"⫃","⫁":"⫁","⫋":"⫋","⊊":"⊊","⪿":"⪿","⥹":"⥹","⊂":"⊂","⊆":"⊆","⫅":"⫅","⊊":"⊊","⫋":"⫋","⫇":"⫇","⫕":"⫕","⫓":"⫓","≻":"≻","⪸":"⪸","≽":"≽","⪰":"⪰","⪺":"⪺","⪶":"⪶","⋩":"⋩","≿":"≿","∑":"∑","♪":"♪","¹":"¹","¹":"¹","²":"²","²":"²","³":"³","³":"³","⊃":"⊃","⫆":"⫆","⪾":"⪾","⫘":"⫘","⊇":"⊇","⫄":"⫄","⟉":"⟉","⫗":"⫗","⥻":"⥻","⫂":"⫂","⫌":"⫌","⊋":"⊋","⫀":"⫀","⊃":"⊃","⊇":"⊇","⫆":"⫆","⊋":"⊋","⫌":"⫌","⫈":"⫈","⫔":"⫔","⫖":"⫖","⇙":"⇙","⤦":"⤦","↙":"↙","↙":"↙","⤪":"⤪","ß":"ß","ß":"ß","⌖":"⌖","τ":"τ","⎴":"⎴","ť":"ť","ţ":"ţ","т":"т","⃛":"⃛","⌕":"⌕","𝔱":"𝔱","∴":"∴","∴":"∴","θ":"θ","ϑ":"ϑ","ϑ":"ϑ","≈":"≈","∼":"∼"," ":" ","≈":"≈","∼":"∼","þ":"þ","þ":"þ","˜":"˜","×":"×","×":"×","⊠":"⊠","⨱":"⨱","⨰":"⨰","∭":"∭","⤨":"⤨","⊤":"⊤","⌶":"⌶","⫱":"⫱","𝕥":"𝕥","⫚":"⫚","⤩":"⤩","‴":"‴","™":"™","▵":"▵","▿":"▿","◃":"◃","⊴":"⊴","≜":"≜","▹":"▹","⊵":"⊵","◬":"◬","≜":"≜","⨺":"⨺","⨹":"⨹","⧍":"⧍","⨻":"⨻","⏢":"⏢","𝓉":"𝓉","ц":"ц","ћ":"ћ","ŧ":"ŧ","≬":"≬","↞":"↞","↠":"↠","⇑":"⇑","⥣":"⥣","ú":"ú","ú":"ú","↑":"↑","ў":"ў","ŭ":"ŭ","û":"û","û":"û","у":"у","⇅":"⇅","ű":"ű","⥮":"⥮","⥾":"⥾","𝔲":"𝔲","ù":"ù","ù":"ù","↿":"↿","↾":"↾","▀":"▀","⌜":"⌜","⌜":"⌜","⌏":"⌏","◸":"◸","ū":"ū","¨":"¨","¨":"¨","ų":"ų","𝕦":"𝕦","↑":"↑","↕":"↕","↿":"↿","↾":"↾","⊎":"⊎","υ":"υ","ϒ":"ϒ","υ":"υ","⇈":"⇈","⌝":"⌝","⌝":"⌝","⌎":"⌎","ů":"ů","◹":"◹","𝓊":"𝓊","⋰":"⋰","ũ":"ũ","▵":"▵","▴":"▴","⇈":"⇈","ü":"ü","ü":"ü","⦧":"⦧","⇕":"⇕","⫨":"⫨","⫩":"⫩","⊨":"⊨","⦜":"⦜","ϵ":"ϵ","ϰ":"ϰ","∅":"∅","ϕ":"ϕ","ϖ":"ϖ","∝":"∝","↕":"↕","ϱ":"ϱ","ς":"ς","⊊︀":"⊊︀","⫋︀":"⫋︀","⊋︀":"⊋︀","⫌︀":"⫌︀","ϑ":"ϑ","⊲":"⊲","⊳":"⊳","в":"в","⊢":"⊢","∨":"∨","⊻":"⊻","≚":"≚","⋮":"⋮","|":"|","|":"|","𝔳":"𝔳","⊲":"⊲","⊂⃒":"⊂⃒","⊃⃒":"⊃⃒","𝕧":"𝕧","∝":"∝","⊳":"⊳","𝓋":"𝓋","⫋︀":"⫋︀","⊊︀":"⊊︀","⫌︀":"⫌︀","⊋︀":"⊋︀","⦚":"⦚","ŵ":"ŵ","⩟":"⩟","∧":"∧","≙":"≙","℘":"℘","𝔴":"𝔴","𝕨":"𝕨","℘":"℘","≀":"≀","≀":"≀","𝓌":"𝓌","⋂":"⋂","◯":"◯","⋃":"⋃","▽":"▽","𝔵":"𝔵","⟺":"⟺","⟷":"⟷","ξ":"ξ","⟸":"⟸","⟵":"⟵","⟼":"⟼","⋻":"⋻","⨀":"⨀","𝕩":"𝕩","⨁":"⨁","⨂":"⨂","⟹":"⟹","⟶":"⟶","𝓍":"𝓍","⨆":"⨆","⨄":"⨄","△":"△","⋁":"⋁","⋀":"⋀","ý":"ý","ý":"ý","я":"я","ŷ":"ŷ","ы":"ы","¥":"¥","¥":"¥","𝔶":"𝔶","ї":"ї","𝕪":"𝕪","𝓎":"𝓎","ю":"ю","ÿ":"ÿ","ÿ":"ÿ","ź":"ź","ž":"ž","з":"з","ż":"ż","ℨ":"ℨ","ζ":"ζ","𝔷":"𝔷","ж":"ж","⇝":"⇝","𝕫":"𝕫","𝓏":"𝓏","‍":"","‌":""};function Ju(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof Oi[e]=="string")return Oi[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 Nt(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 Qu(r){return"<div>"+Nt(r).replace(/\n/g,"<br />")+"</div>"}function Yu(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
|
|
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 Tr=(r,e,t)=>Oa(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),ji=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 ms=Ma(w);class $a{constructor(e){Tr(this,"config");Tr(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,Ri="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Or=new Uint8Array(256);for(var yn=0;yn<Ri.length;yn++)Or[Ri.charCodeAt(yn)]=yn;function Fs(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=Or[r.charCodeAt(i)],a=Or[r.charCodeAt(i+1)],u=Or[r.charCodeAt(i+2)],c=Or[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 zr(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function Qn(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 Pi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function Ia(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=Pi(o[a+1]),f=Pi(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=Fs(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=br.encode(t);return zr(r).decode(s)}function qr(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)=>Ia(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 zr(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 Qn(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(Fs(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Fs(this.remainder)),Qn(new Blob(this.chunks,{type:"application/octet-stream"}))}}const Oi=/^=[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){Oi.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);Oi.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=""),Qn(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Mi{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:zr(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+`
|
|
4
|
+
`+s).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=zr(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(zr().decode(e));break;case"body":this.contentDecoder.update(e)}}}const $i={"Æ":"Æ","Æ":"Æ","&":"&","&":"&","Á":"Á","Á":"Á","Ă":"Ă","Â":"Â","Â":"Â","А":"А","𝔄":"𝔄","À":"À","À":"À","Α":"Α","Ā":"Ā","⩓":"⩓","Ą":"Ą","𝔸":"𝔸","⁡":"","Å":"Å","Å":"Å","𝒜":"𝒜","≔":"≔","Ã":"Ã","Ã":"Ã","Ä":"Ä","Ä":"Ä","∖":"∖","⫧":"⫧","⌆":"⌆","Б":"Б","∵":"∵","ℬ":"ℬ","Β":"Β","𝔅":"𝔅","𝔹":"𝔹","˘":"˘","ℬ":"ℬ","≎":"≎","Ч":"Ч","©":"©","©":"©","Ć":"Ć","⋒":"⋒","ⅅ":"ⅅ","ℭ":"ℭ","Č":"Č","Ç":"Ç","Ç":"Ç","Ĉ":"Ĉ","∰":"∰","Ċ":"Ċ","¸":"¸","·":"·","ℭ":"ℭ","Χ":"Χ","⊙":"⊙","⊖":"⊖","⊕":"⊕","⊗":"⊗","∲":"∲","”":"”","’":"’","∷":"∷","⩴":"⩴","≡":"≡","∯":"∯","∮":"∮","ℂ":"ℂ","∐":"∐","∳":"∳","⨯":"⨯","𝒞":"𝒞","⋓":"⋓","≍":"≍","ⅅ":"ⅅ","⤑":"⤑","Ђ":"Ђ","Ѕ":"Ѕ","Џ":"Џ","‡":"‡","↡":"↡","⫤":"⫤","Ď":"Ď","Д":"Д","∇":"∇","Δ":"Δ","𝔇":"𝔇","´":"´","˙":"˙","˝":"˝","`":"`","˜":"˜","⋄":"⋄","ⅆ":"ⅆ","𝔻":"𝔻","¨":"¨","⃜":"⃜","≐":"≐","∯":"∯","¨":"¨","⇓":"⇓","⇐":"⇐","⇔":"⇔","⫤":"⫤","⟸":"⟸","⟺":"⟺","⟹":"⟹","⇒":"⇒","⊨":"⊨","⇑":"⇑","⇕":"⇕","∥":"∥","↓":"↓","⤓":"⤓","⇵":"⇵","̑":"̑","⥐":"⥐","⥞":"⥞","↽":"↽","⥖":"⥖","⥟":"⥟","⇁":"⇁","⥗":"⥗","⊤":"⊤","↧":"↧","⇓":"⇓","𝒟":"𝒟","Đ":"Đ","Ŋ":"Ŋ","Ð":"Ð","Ð":"Ð","É":"É","É":"É","Ě":"Ě","Ê":"Ê","Ê":"Ê","Э":"Э","Ė":"Ė","𝔈":"𝔈","È":"È","È":"È","∈":"∈","Ē":"Ē","◻":"◻","▫":"▫","Ę":"Ę","𝔼":"𝔼","Ε":"Ε","⩵":"⩵","≂":"≂","⇌":"⇌","ℰ":"ℰ","⩳":"⩳","Η":"Η","Ë":"Ë","Ë":"Ë","∃":"∃","ⅇ":"ⅇ","Ф":"Ф","𝔉":"𝔉","◼":"◼","▪":"▪","𝔽":"𝔽","∀":"∀","ℱ":"ℱ","ℱ":"ℱ","Ѓ":"Ѓ",">":">",">":">","Γ":"Γ","Ϝ":"Ϝ","Ğ":"Ğ","Ģ":"Ģ","Ĝ":"Ĝ","Г":"Г","Ġ":"Ġ","𝔊":"𝔊","⋙":"⋙","𝔾":"𝔾","≥":"≥","⋛":"⋛","≧":"≧","⪢":"⪢","≷":"≷","⩾":"⩾","≳":"≳","𝒢":"𝒢","≫":"≫","Ъ":"Ъ","ˇ":"ˇ","^":"^","Ĥ":"Ĥ","ℌ":"ℌ","ℋ":"ℋ","ℍ":"ℍ","─":"─","ℋ":"ℋ","Ħ":"Ħ","≎":"≎","≏":"≏","Е":"Е","IJ":"IJ","Ё":"Ё","Í":"Í","Í":"Í","Î":"Î","Î":"Î","И":"И","İ":"İ","ℑ":"ℑ","Ì":"Ì","Ì":"Ì","ℑ":"ℑ","Ī":"Ī","ⅈ":"ⅈ","⇒":"⇒","∬":"∬","∫":"∫","⋂":"⋂","⁣":"","⁢":"","Į":"Į","𝕀":"𝕀","Ι":"Ι","ℐ":"ℐ","Ĩ":"Ĩ","І":"І","Ï":"Ï","Ï":"Ï","Ĵ":"Ĵ","Й":"Й","𝔍":"𝔍","𝕁":"𝕁","𝒥":"𝒥","Ј":"Ј","Є":"Є","Х":"Х","Ќ":"Ќ","Κ":"Κ","Ķ":"Ķ","К":"К","𝔎":"𝔎","𝕂":"𝕂","𝒦":"𝒦","Љ":"Љ","<":"<","<":"<","Ĺ":"Ĺ","Λ":"Λ","⟪":"⟪","ℒ":"ℒ","↞":"↞","Ľ":"Ľ","Ļ":"Ļ","Л":"Л","⟨":"⟨","←":"←","⇤":"⇤","⇆":"⇆","⌈":"⌈","⟦":"⟦","⥡":"⥡","⇃":"⇃","⥙":"⥙","⌊":"⌊","↔":"↔","⥎":"⥎","⊣":"⊣","↤":"↤","⥚":"⥚","⊲":"⊲","⧏":"⧏","⊴":"⊴","⥑":"⥑","⥠":"⥠","↿":"↿","⥘":"⥘","↼":"↼","⥒":"⥒","⇐":"⇐","⇔":"⇔","⋚":"⋚","≦":"≦","≶":"≶","⪡":"⪡","⩽":"⩽","≲":"≲","𝔏":"𝔏","⋘":"⋘","⇚":"⇚","Ŀ":"Ŀ","⟵":"⟵","⟷":"⟷","⟶":"⟶","⟸":"⟸","⟺":"⟺","⟹":"⟹","𝕃":"𝕃","↙":"↙","↘":"↘","ℒ":"ℒ","↰":"↰","Ł":"Ł","≪":"≪","⤅":"⤅","М":"М"," ":" ","ℳ":"ℳ","𝔐":"𝔐","∓":"∓","𝕄":"𝕄","ℳ":"ℳ","Μ":"Μ","Њ":"Њ","Ń":"Ń","Ň":"Ň","Ņ":"Ņ","Н":"Н","​":"","​":"","​":"","​":"","≫":"≫","≪":"≪","
":`
|
|
6
|
+
`,"𝔑":"𝔑","⁠":""," ":" ","ℕ":"ℕ","⫬":"⫬","≢":"≢","≭":"≭","∦":"∦","∉":"∉","≠":"≠","≂̸":"≂̸","∄":"∄","≯":"≯","≱":"≱","≧̸":"≧̸","≫̸":"≫̸","≹":"≹","⩾̸":"⩾̸","≵":"≵","≎̸":"≎̸","≏̸":"≏̸","⋪":"⋪","⧏̸":"⧏̸","⋬":"⋬","≮":"≮","≰":"≰","≸":"≸","≪̸":"≪̸","⩽̸":"⩽̸","≴":"≴","⪢̸":"⪢̸","⪡̸":"⪡̸","⊀":"⊀","⪯̸":"⪯̸","⋠":"⋠","∌":"∌","⋫":"⋫","⧐̸":"⧐̸","⋭":"⋭","⊏̸":"⊏̸","⋢":"⋢","⊐̸":"⊐̸","⋣":"⋣","⊂⃒":"⊂⃒","⊈":"⊈","⊁":"⊁","⪰̸":"⪰̸","⋡":"⋡","≿̸":"≿̸","⊃⃒":"⊃⃒","⊉":"⊉","≁":"≁","≄":"≄","≇":"≇","≉":"≉","∤":"∤","𝒩":"𝒩","Ñ":"Ñ","Ñ":"Ñ","Ν":"Ν","Œ":"Œ","Ó":"Ó","Ó":"Ó","Ô":"Ô","Ô":"Ô","О":"О","Ő":"Ő","𝔒":"𝔒","Ò":"Ò","Ò":"Ò","Ō":"Ō","Ω":"Ω","Ο":"Ο","𝕆":"𝕆","“":"“","‘":"‘","⩔":"⩔","𝒪":"𝒪","Ø":"Ø","Ø":"Ø","Õ":"Õ","Õ":"Õ","⨷":"⨷","Ö":"Ö","Ö":"Ö","‾":"‾","⏞":"⏞","⎴":"⎴","⏜":"⏜","∂":"∂","П":"П","𝔓":"𝔓","Φ":"Φ","Π":"Π","±":"±","ℌ":"ℌ","ℙ":"ℙ","⪻":"⪻","≺":"≺","⪯":"⪯","≼":"≼","≾":"≾","″":"″","∏":"∏","∷":"∷","∝":"∝","𝒫":"𝒫","Ψ":"Ψ",""":'"',""":'"',"𝔔":"𝔔","ℚ":"ℚ","𝒬":"𝒬","⤐":"⤐","®":"®","®":"®","Ŕ":"Ŕ","⟫":"⟫","↠":"↠","⤖":"⤖","Ř":"Ř","Ŗ":"Ŗ","Р":"Р","ℜ":"ℜ","∋":"∋","⇋":"⇋","⥯":"⥯","ℜ":"ℜ","Ρ":"Ρ","⟩":"⟩","→":"→","⇥":"⇥","⇄":"⇄","⌉":"⌉","⟧":"⟧","⥝":"⥝","⇂":"⇂","⥕":"⥕","⌋":"⌋","⊢":"⊢","↦":"↦","⥛":"⥛","⊳":"⊳","⧐":"⧐","⊵":"⊵","⥏":"⥏","⥜":"⥜","↾":"↾","⥔":"⥔","⇀":"⇀","⥓":"⥓","⇒":"⇒","ℝ":"ℝ","⥰":"⥰","⇛":"⇛","ℛ":"ℛ","↱":"↱","⧴":"⧴","Щ":"Щ","Ш":"Ш","Ь":"Ь","Ś":"Ś","⪼":"⪼","Š":"Š","Ş":"Ş","Ŝ":"Ŝ","С":"С","𝔖":"𝔖","↓":"↓","←":"←","→":"→","↑":"↑","Σ":"Σ","∘":"∘","𝕊":"𝕊","√":"√","□":"□","⊓":"⊓","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊔":"⊔","𝒮":"𝒮","⋆":"⋆","⋐":"⋐","⋐":"⋐","⊆":"⊆","≻":"≻","⪰":"⪰","≽":"≽","≿":"≿","∋":"∋","∑":"∑","⋑":"⋑","⊃":"⊃","⊇":"⊇","⋑":"⋑","Þ":"Þ","Þ":"Þ","™":"™","Ћ":"Ћ","Ц":"Ц","	":" ","Τ":"Τ","Ť":"Ť","Ţ":"Ţ","Т":"Т","𝔗":"𝔗","∴":"∴","Θ":"Θ","  ":" "," ":" ","∼":"∼","≃":"≃","≅":"≅","≈":"≈","𝕋":"𝕋","⃛":"⃛","𝒯":"𝒯","Ŧ":"Ŧ","Ú":"Ú","Ú":"Ú","↟":"↟","⥉":"⥉","Ў":"Ў","Ŭ":"Ŭ","Û":"Û","Û":"Û","У":"У","Ű":"Ű","𝔘":"𝔘","Ù":"Ù","Ù":"Ù","Ū":"Ū","_":"_","⏟":"⏟","⎵":"⎵","⏝":"⏝","⋃":"⋃","⊎":"⊎","Ų":"Ų","𝕌":"𝕌","↑":"↑","⤒":"⤒","⇅":"⇅","↕":"↕","⥮":"⥮","⊥":"⊥","↥":"↥","⇑":"⇑","⇕":"⇕","↖":"↖","↗":"↗","ϒ":"ϒ","Υ":"Υ","Ů":"Ů","𝒰":"𝒰","Ũ":"Ũ","Ü":"Ü","Ü":"Ü","⊫":"⊫","⫫":"⫫","В":"В","⊩":"⊩","⫦":"⫦","⋁":"⋁","‖":"‖","‖":"‖","∣":"∣","|":"|","❘":"❘","≀":"≀"," ":" ","𝔙":"𝔙","𝕍":"𝕍","𝒱":"𝒱","⊪":"⊪","Ŵ":"Ŵ","⋀":"⋀","𝔚":"𝔚","𝕎":"𝕎","𝒲":"𝒲","𝔛":"𝔛","Ξ":"Ξ","𝕏":"𝕏","𝒳":"𝒳","Я":"Я","Ї":"Ї","Ю":"Ю","Ý":"Ý","Ý":"Ý","Ŷ":"Ŷ","Ы":"Ы","𝔜":"𝔜","𝕐":"𝕐","𝒴":"𝒴","Ÿ":"Ÿ","Ж":"Ж","Ź":"Ź","Ž":"Ž","З":"З","Ż":"Ż","​":"","Ζ":"Ζ","ℨ":"ℨ","ℤ":"ℤ","𝒵":"𝒵","á":"á","á":"á","ă":"ă","∾":"∾","∾̳":"∾̳","∿":"∿","â":"â","â":"â","´":"´","´":"´","а":"а","æ":"æ","æ":"æ","⁡":"","𝔞":"𝔞","à":"à","à":"à","ℵ":"ℵ","ℵ":"ℵ","α":"α","ā":"ā","⨿":"⨿","&":"&","&":"&","∧":"∧","⩕":"⩕","⩜":"⩜","⩘":"⩘","⩚":"⩚","∠":"∠","⦤":"⦤","∠":"∠","∡":"∡","⦨":"⦨","⦩":"⦩","⦪":"⦪","⦫":"⦫","⦬":"⦬","⦭":"⦭","⦮":"⦮","⦯":"⦯","∟":"∟","⊾":"⊾","⦝":"⦝","∢":"∢","Å":"Å","⍼":"⍼","ą":"ą","𝕒":"𝕒","≈":"≈","⩰":"⩰","⩯":"⩯","≊":"≊","≋":"≋","'":"'","≈":"≈","≊":"≊","å":"å","å":"å","𝒶":"𝒶","*":"*","≈":"≈","≍":"≍","ã":"ã","ã":"ã","ä":"ä","ä":"ä","∳":"∳","⨑":"⨑","⫭":"⫭","≌":"≌","϶":"϶","‵":"‵","∽":"∽","⋍":"⋍","⊽":"⊽","⌅":"⌅","⌅":"⌅","⎵":"⎵","⎶":"⎶","≌":"≌","б":"б","„":"„","∵":"∵","∵":"∵","⦰":"⦰","϶":"϶","ℬ":"ℬ","β":"β","ℶ":"ℶ","≬":"≬","𝔟":"𝔟","⋂":"⋂","◯":"◯","⋃":"⋃","⨀":"⨀","⨁":"⨁","⨂":"⨂","⨆":"⨆","★":"★","▽":"▽","△":"△","⨄":"⨄","⋁":"⋁","⋀":"⋀","⤍":"⤍","⧫":"⧫","▪":"▪","▴":"▴","▾":"▾","◂":"◂","▸":"▸","␣":"␣","▒":"▒","░":"░","▓":"▓","█":"█","=⃥":"=⃥","≡⃥":"≡⃥","⌐":"⌐","𝕓":"𝕓","⊥":"⊥","⊥":"⊥","⋈":"⋈","╗":"╗","╔":"╔","╖":"╖","╓":"╓","═":"═","╦":"╦","╩":"╩","╤":"╤","╧":"╧","╝":"╝","╚":"╚","╜":"╜","╙":"╙","║":"║","╬":"╬","╣":"╣","╠":"╠","╫":"╫","╢":"╢","╟":"╟","⧉":"⧉","╕":"╕","╒":"╒","┐":"┐","┌":"┌","─":"─","╥":"╥","╨":"╨","┬":"┬","┴":"┴","⊟":"⊟","⊞":"⊞","⊠":"⊠","╛":"╛","╘":"╘","┘":"┘","└":"└","│":"│","╪":"╪","╡":"╡","╞":"╞","┼":"┼","┤":"┤","├":"├","‵":"‵","˘":"˘","¦":"¦","¦":"¦","𝒷":"𝒷","⁏":"⁏","∽":"∽","⋍":"⋍","\":"\\","⧅":"⧅","⟈":"⟈","•":"•","•":"•","≎":"≎","⪮":"⪮","≏":"≏","≏":"≏","ć":"ć","∩":"∩","⩄":"⩄","⩉":"⩉","⩋":"⩋","⩇":"⩇","⩀":"⩀","∩︀":"∩︀","⁁":"⁁","ˇ":"ˇ","⩍":"⩍","č":"č","ç":"ç","ç":"ç","ĉ":"ĉ","⩌":"⩌","⩐":"⩐","ċ":"ċ","¸":"¸","¸":"¸","⦲":"⦲","¢":"¢","¢":"¢","·":"·","𝔠":"𝔠","ч":"ч","✓":"✓","✓":"✓","χ":"χ","○":"○","⧃":"⧃","ˆ":"ˆ","≗":"≗","↺":"↺","↻":"↻","®":"®","Ⓢ":"Ⓢ","⊛":"⊛","⊚":"⊚","⊝":"⊝","≗":"≗","⨐":"⨐","⫯":"⫯","⧂":"⧂","♣":"♣","♣":"♣",":":":","≔":"≔","≔":"≔",",":",","@":"@","∁":"∁","∘":"∘","∁":"∁","ℂ":"ℂ","≅":"≅","⩭":"⩭","∮":"∮","𝕔":"𝕔","∐":"∐","©":"©","©":"©","℗":"℗","↵":"↵","✗":"✗","𝒸":"𝒸","⫏":"⫏","⫑":"⫑","⫐":"⫐","⫒":"⫒","⋯":"⋯","⤸":"⤸","⤵":"⤵","⋞":"⋞","⋟":"⋟","↶":"↶","⤽":"⤽","∪":"∪","⩈":"⩈","⩆":"⩆","⩊":"⩊","⊍":"⊍","⩅":"⩅","∪︀":"∪︀","↷":"↷","⤼":"⤼","⋞":"⋞","⋟":"⋟","⋎":"⋎","⋏":"⋏","¤":"¤","¤":"¤","↶":"↶","↷":"↷","⋎":"⋎","⋏":"⋏","∲":"∲","∱":"∱","⌭":"⌭","⇓":"⇓","⥥":"⥥","†":"†","ℸ":"ℸ","↓":"↓","‐":"‐","⊣":"⊣","⤏":"⤏","˝":"˝","ď":"ď","д":"д","ⅆ":"ⅆ","‡":"‡","⇊":"⇊","⩷":"⩷","°":"°","°":"°","δ":"δ","⦱":"⦱","⥿":"⥿","𝔡":"𝔡","⇃":"⇃","⇂":"⇂","⋄":"⋄","⋄":"⋄","♦":"♦","♦":"♦","¨":"¨","ϝ":"ϝ","⋲":"⋲","÷":"÷","÷":"÷","÷":"÷","⋇":"⋇","⋇":"⋇","ђ":"ђ","⌞":"⌞","⌍":"⌍","$":"$","𝕕":"𝕕","˙":"˙","≐":"≐","≑":"≑","∸":"∸","∔":"∔","⊡":"⊡","⌆":"⌆","↓":"↓","⇊":"⇊","⇃":"⇃","⇂":"⇂","⤐":"⤐","⌟":"⌟","⌌":"⌌","𝒹":"𝒹","ѕ":"ѕ","⧶":"⧶","đ":"đ","⋱":"⋱","▿":"▿","▾":"▾","⇵":"⇵","⥯":"⥯","⦦":"⦦","џ":"џ","⟿":"⟿","⩷":"⩷","≑":"≑","é":"é","é":"é","⩮":"⩮","ě":"ě","≖":"≖","ê":"ê","ê":"ê","≕":"≕","э":"э","ė":"ė","ⅇ":"ⅇ","≒":"≒","𝔢":"𝔢","⪚":"⪚","è":"è","è":"è","⪖":"⪖","⪘":"⪘","⪙":"⪙","⏧":"⏧","ℓ":"ℓ","⪕":"⪕","⪗":"⪗","ē":"ē","∅":"∅","∅":"∅","∅":"∅"," ":" "," ":" "," ":" ","ŋ":"ŋ"," ":" ","ę":"ę","𝕖":"𝕖","⋕":"⋕","⧣":"⧣","⩱":"⩱","ε":"ε","ε":"ε","ϵ":"ϵ","≖":"≖","≕":"≕","≂":"≂","⪖":"⪖","⪕":"⪕","=":"=","≟":"≟","≡":"≡","⩸":"⩸","⧥":"⧥","≓":"≓","⥱":"⥱","ℯ":"ℯ","≐":"≐","≂":"≂","η":"η","ð":"ð","ð":"ð","ë":"ë","ë":"ë","€":"€","!":"!","∃":"∃","ℰ":"ℰ","ⅇ":"ⅇ","≒":"≒","ф":"ф","♀":"♀","ffi":"ffi","ff":"ff","ffl":"ffl","𝔣":"𝔣","fi":"fi","fj":"fj","♭":"♭","fl":"fl","▱":"▱","ƒ":"ƒ","𝕗":"𝕗","∀":"∀","⋔":"⋔","⫙":"⫙","⨍":"⨍","½":"½","½":"½","⅓":"⅓","¼":"¼","¼":"¼","⅕":"⅕","⅙":"⅙","⅛":"⅛","⅔":"⅔","⅖":"⅖","¾":"¾","¾":"¾","⅗":"⅗","⅜":"⅜","⅘":"⅘","⅚":"⅚","⅝":"⅝","⅞":"⅞","⁄":"⁄","⌢":"⌢","𝒻":"𝒻","≧":"≧","⪌":"⪌","ǵ":"ǵ","γ":"γ","ϝ":"ϝ","⪆":"⪆","ğ":"ğ","ĝ":"ĝ","г":"г","ġ":"ġ","≥":"≥","⋛":"⋛","≥":"≥","≧":"≧","⩾":"⩾","⩾":"⩾","⪩":"⪩","⪀":"⪀","⪂":"⪂","⪄":"⪄","⋛︀":"⋛︀","⪔":"⪔","𝔤":"𝔤","≫":"≫","⋙":"⋙","ℷ":"ℷ","ѓ":"ѓ","≷":"≷","⪒":"⪒","⪥":"⪥","⪤":"⪤","≩":"≩","⪊":"⪊","⪊":"⪊","⪈":"⪈","⪈":"⪈","≩":"≩","⋧":"⋧","𝕘":"𝕘","`":"`","ℊ":"ℊ","≳":"≳","⪎":"⪎","⪐":"⪐",">":">",">":">","⪧":"⪧","⩺":"⩺","⋗":"⋗","⦕":"⦕","⩼":"⩼","⪆":"⪆","⥸":"⥸","⋗":"⋗","⋛":"⋛","⪌":"⪌","≷":"≷","≳":"≳","≩︀":"≩︀","≩︀":"≩︀","⇔":"⇔"," ":" ","½":"½","ℋ":"ℋ","ъ":"ъ","↔":"↔","⥈":"⥈","↭":"↭","ℏ":"ℏ","ĥ":"ĥ","♥":"♥","♥":"♥","…":"…","⊹":"⊹","𝔥":"𝔥","⤥":"⤥","⤦":"⤦","⇿":"⇿","∻":"∻","↩":"↩","↪":"↪","𝕙":"𝕙","―":"―","𝒽":"𝒽","ℏ":"ℏ","ħ":"ħ","⁃":"⁃","‐":"‐","í":"í","í":"í","⁣":"","î":"î","î":"î","и":"и","е":"е","¡":"¡","¡":"¡","⇔":"⇔","𝔦":"𝔦","ì":"ì","ì":"ì","ⅈ":"ⅈ","⨌":"⨌","∭":"∭","⧜":"⧜","℩":"℩","ij":"ij","ī":"ī","ℑ":"ℑ","ℐ":"ℐ","ℑ":"ℑ","ı":"ı","⊷":"⊷","Ƶ":"Ƶ","∈":"∈","℅":"℅","∞":"∞","⧝":"⧝","ı":"ı","∫":"∫","⊺":"⊺","ℤ":"ℤ","⊺":"⊺","⨗":"⨗","⨼":"⨼","ё":"ё","į":"į","𝕚":"𝕚","ι":"ι","⨼":"⨼","¿":"¿","¿":"¿","𝒾":"𝒾","∈":"∈","⋹":"⋹","⋵":"⋵","⋴":"⋴","⋳":"⋳","∈":"∈","⁢":"","ĩ":"ĩ","і":"і","ï":"ï","ï":"ï","ĵ":"ĵ","й":"й","𝔧":"𝔧","ȷ":"ȷ","𝕛":"𝕛","𝒿":"𝒿","ј":"ј","є":"є","κ":"κ","ϰ":"ϰ","ķ":"ķ","к":"к","𝔨":"𝔨","ĸ":"ĸ","х":"х","ќ":"ќ","𝕜":"𝕜","𝓀":"𝓀","⇚":"⇚","⇐":"⇐","⤛":"⤛","⤎":"⤎","≦":"≦","⪋":"⪋","⥢":"⥢","ĺ":"ĺ","⦴":"⦴","ℒ":"ℒ","λ":"λ","⟨":"⟨","⦑":"⦑","⟨":"⟨","⪅":"⪅","«":"«","«":"«","←":"←","⇤":"⇤","⤟":"⤟","⤝":"⤝","↩":"↩","↫":"↫","⤹":"⤹","⥳":"⥳","↢":"↢","⪫":"⪫","⤙":"⤙","⪭":"⪭","⪭︀":"⪭︀","⤌":"⤌","❲":"❲","{":"{","[":"[","⦋":"⦋","⦏":"⦏","⦍":"⦍","ľ":"ľ","ļ":"ļ","⌈":"⌈","{":"{","л":"л","⤶":"⤶","“":"“","„":"„","⥧":"⥧","⥋":"⥋","↲":"↲","≤":"≤","←":"←","↢":"↢","↽":"↽","↼":"↼","⇇":"⇇","↔":"↔","⇆":"⇆","⇋":"⇋","↭":"↭","⋋":"⋋","⋚":"⋚","≤":"≤","≦":"≦","⩽":"⩽","⩽":"⩽","⪨":"⪨","⩿":"⩿","⪁":"⪁","⪃":"⪃","⋚︀":"⋚︀","⪓":"⪓","⪅":"⪅","⋖":"⋖","⋚":"⋚","⪋":"⪋","≶":"≶","≲":"≲","⥼":"⥼","⌊":"⌊","𝔩":"𝔩","≶":"≶","⪑":"⪑","↽":"↽","↼":"↼","⥪":"⥪","▄":"▄","љ":"љ","≪":"≪","⇇":"⇇","⌞":"⌞","⥫":"⥫","◺":"◺","ŀ":"ŀ","⎰":"⎰","⎰":"⎰","≨":"≨","⪉":"⪉","⪉":"⪉","⪇":"⪇","⪇":"⪇","≨":"≨","⋦":"⋦","⟬":"⟬","⇽":"⇽","⟦":"⟦","⟵":"⟵","⟷":"⟷","⟼":"⟼","⟶":"⟶","↫":"↫","↬":"↬","⦅":"⦅","𝕝":"𝕝","⨭":"⨭","⨴":"⨴","∗":"∗","_":"_","◊":"◊","◊":"◊","⧫":"⧫","(":"(","⦓":"⦓","⇆":"⇆","⌟":"⌟","⇋":"⇋","⥭":"⥭","‎":"","⊿":"⊿","‹":"‹","𝓁":"𝓁","↰":"↰","≲":"≲","⪍":"⪍","⪏":"⪏","[":"[","‘":"‘","‚":"‚","ł":"ł","<":"<","<":"<","⪦":"⪦","⩹":"⩹","⋖":"⋖","⋋":"⋋","⋉":"⋉","⥶":"⥶","⩻":"⩻","⦖":"⦖","◃":"◃","⊴":"⊴","◂":"◂","⥊":"⥊","⥦":"⥦","≨︀":"≨︀","≨︀":"≨︀","∺":"∺","¯":"¯","¯":"¯","♂":"♂","✠":"✠","✠":"✠","↦":"↦","↦":"↦","↧":"↧","↤":"↤","↥":"↥","▮":"▮","⨩":"⨩","м":"м","—":"—","∡":"∡","𝔪":"𝔪","℧":"℧","µ":"µ","µ":"µ","∣":"∣","*":"*","⫰":"⫰","·":"·","·":"·","−":"−","⊟":"⊟","∸":"∸","⨪":"⨪","⫛":"⫛","…":"…","∓":"∓","⊧":"⊧","𝕞":"𝕞","∓":"∓","𝓂":"𝓂","∾":"∾","μ":"μ","⊸":"⊸","⊸":"⊸","⋙̸":"⋙̸","≫⃒":"≫⃒","≫̸":"≫̸","⇍":"⇍","⇎":"⇎","⋘̸":"⋘̸","≪⃒":"≪⃒","≪̸":"≪̸","⇏":"⇏","⊯":"⊯","⊮":"⊮","∇":"∇","ń":"ń","∠⃒":"∠⃒","≉":"≉","⩰̸":"⩰̸","≋̸":"≋̸","ʼn":"ʼn","≉":"≉","♮":"♮","♮":"♮","ℕ":"ℕ"," ":" "," ":" ","≎̸":"≎̸","≏̸":"≏̸","⩃":"⩃","ň":"ň","ņ":"ņ","≇":"≇","⩭̸":"⩭̸","⩂":"⩂","н":"н","–":"–","≠":"≠","⇗":"⇗","⤤":"⤤","↗":"↗","↗":"↗","≐̸":"≐̸","≢":"≢","⤨":"⤨","≂̸":"≂̸","∄":"∄","∄":"∄","𝔫":"𝔫","≧̸":"≧̸","≱":"≱","≱":"≱","≧̸":"≧̸","⩾̸":"⩾̸","⩾̸":"⩾̸","≵":"≵","≯":"≯","≯":"≯","⇎":"⇎","↮":"↮","⫲":"⫲","∋":"∋","⋼":"⋼","⋺":"⋺","∋":"∋","њ":"њ","⇍":"⇍","≦̸":"≦̸","↚":"↚","‥":"‥","≰":"≰","↚":"↚","↮":"↮","≰":"≰","≦̸":"≦̸","⩽̸":"⩽̸","⩽̸":"⩽̸","≮":"≮","≴":"≴","≮":"≮","⋪":"⋪","⋬":"⋬","∤":"∤","𝕟":"𝕟","¬":"¬","¬":"¬","∉":"∉","⋹̸":"⋹̸","⋵̸":"⋵̸","∉":"∉","⋷":"⋷","⋶":"⋶","∌":"∌","∌":"∌","⋾":"⋾","⋽":"⋽","∦":"∦","∦":"∦","⫽⃥":"⫽⃥","∂̸":"∂̸","⨔":"⨔","⊀":"⊀","⋠":"⋠","⪯̸":"⪯̸","⊀":"⊀","⪯̸":"⪯̸","⇏":"⇏","↛":"↛","⤳̸":"⤳̸","↝̸":"↝̸","↛":"↛","⋫":"⋫","⋭":"⋭","⊁":"⊁","⋡":"⋡","⪰̸":"⪰̸","𝓃":"𝓃","∤":"∤","∦":"∦","≁":"≁","≄":"≄","≄":"≄","∤":"∤","∦":"∦","⋢":"⋢","⋣":"⋣","⊄":"⊄","⫅̸":"⫅̸","⊈":"⊈","⊂⃒":"⊂⃒","⊈":"⊈","⫅̸":"⫅̸","⊁":"⊁","⪰̸":"⪰̸","⊅":"⊅","⫆̸":"⫆̸","⊉":"⊉","⊃⃒":"⊃⃒","⊉":"⊉","⫆̸":"⫆̸","≹":"≹","ñ":"ñ","ñ":"ñ","≸":"≸","⋪":"⋪","⋬":"⋬","⋫":"⋫","⋭":"⋭","ν":"ν","#":"#","№":"№"," ":" ","⊭":"⊭","⤄":"⤄","≍⃒":"≍⃒","⊬":"⊬","≥⃒":"≥⃒",">⃒":">⃒","⧞":"⧞","⤂":"⤂","≤⃒":"≤⃒","<⃒":"<⃒","⊴⃒":"⊴⃒","⤃":"⤃","⊵⃒":"⊵⃒","∼⃒":"∼⃒","⇖":"⇖","⤣":"⤣","↖":"↖","↖":"↖","⤧":"⤧","Ⓢ":"Ⓢ","ó":"ó","ó":"ó","⊛":"⊛","⊚":"⊚","ô":"ô","ô":"ô","о":"о","⊝":"⊝","ő":"ő","⨸":"⨸","⊙":"⊙","⦼":"⦼","œ":"œ","⦿":"⦿","𝔬":"𝔬","˛":"˛","ò":"ò","ò":"ò","⧁":"⧁","⦵":"⦵","Ω":"Ω","∮":"∮","↺":"↺","⦾":"⦾","⦻":"⦻","‾":"‾","⧀":"⧀","ō":"ō","ω":"ω","ο":"ο","⦶":"⦶","⊖":"⊖","𝕠":"𝕠","⦷":"⦷","⦹":"⦹","⊕":"⊕","∨":"∨","↻":"↻","⩝":"⩝","ℴ":"ℴ","ℴ":"ℴ","ª":"ª","ª":"ª","º":"º","º":"º","⊶":"⊶","⩖":"⩖","⩗":"⩗","⩛":"⩛","ℴ":"ℴ","ø":"ø","ø":"ø","⊘":"⊘","õ":"õ","õ":"õ","⊗":"⊗","⨶":"⨶","ö":"ö","ö":"ö","⌽":"⌽","∥":"∥","¶":"¶","¶":"¶","∥":"∥","⫳":"⫳","⫽":"⫽","∂":"∂","п":"п","%":"%",".":".","‰":"‰","⊥":"⊥","‱":"‱","𝔭":"𝔭","φ":"φ","ϕ":"ϕ","ℳ":"ℳ","☎":"☎","π":"π","⋔":"⋔","ϖ":"ϖ","ℏ":"ℏ","ℎ":"ℎ","ℏ":"ℏ","+":"+","⨣":"⨣","⊞":"⊞","⨢":"⨢","∔":"∔","⨥":"⨥","⩲":"⩲","±":"±","±":"±","⨦":"⨦","⨧":"⨧","±":"±","⨕":"⨕","𝕡":"𝕡","£":"£","£":"£","≺":"≺","⪳":"⪳","⪷":"⪷","≼":"≼","⪯":"⪯","≺":"≺","⪷":"⪷","≼":"≼","⪯":"⪯","⪹":"⪹","⪵":"⪵","⋨":"⋨","≾":"≾","′":"′","ℙ":"ℙ","⪵":"⪵","⪹":"⪹","⋨":"⋨","∏":"∏","⌮":"⌮","⌒":"⌒","⌓":"⌓","∝":"∝","∝":"∝","≾":"≾","⊰":"⊰","𝓅":"𝓅","ψ":"ψ"," ":" ","𝔮":"𝔮","⨌":"⨌","𝕢":"𝕢","⁗":"⁗","𝓆":"𝓆","ℍ":"ℍ","⨖":"⨖","?":"?","≟":"≟",""":'"',""":'"',"⇛":"⇛","⇒":"⇒","⤜":"⤜","⤏":"⤏","⥤":"⥤","∽̱":"∽̱","ŕ":"ŕ","√":"√","⦳":"⦳","⟩":"⟩","⦒":"⦒","⦥":"⦥","⟩":"⟩","»":"»","»":"»","→":"→","⥵":"⥵","⇥":"⇥","⤠":"⤠","⤳":"⤳","⤞":"⤞","↪":"↪","↬":"↬","⥅":"⥅","⥴":"⥴","↣":"↣","↝":"↝","⤚":"⤚","∶":"∶","ℚ":"ℚ","⤍":"⤍","❳":"❳","}":"}","]":"]","⦌":"⦌","⦎":"⦎","⦐":"⦐","ř":"ř","ŗ":"ŗ","⌉":"⌉","}":"}","р":"р","⤷":"⤷","⥩":"⥩","”":"”","”":"”","↳":"↳","ℜ":"ℜ","ℛ":"ℛ","ℜ":"ℜ","ℝ":"ℝ","▭":"▭","®":"®","®":"®","⥽":"⥽","⌋":"⌋","𝔯":"𝔯","⇁":"⇁","⇀":"⇀","⥬":"⥬","ρ":"ρ","ϱ":"ϱ","→":"→","↣":"↣","⇁":"⇁","⇀":"⇀","⇄":"⇄","⇌":"⇌","⇉":"⇉","↝":"↝","⋌":"⋌","˚":"˚","≓":"≓","⇄":"⇄","⇌":"⇌","‏":"","⎱":"⎱","⎱":"⎱","⫮":"⫮","⟭":"⟭","⇾":"⇾","⟧":"⟧","⦆":"⦆","𝕣":"𝕣","⨮":"⨮","⨵":"⨵",")":")","⦔":"⦔","⨒":"⨒","⇉":"⇉","›":"›","𝓇":"𝓇","↱":"↱","]":"]","’":"’","’":"’","⋌":"⋌","⋊":"⋊","▹":"▹","⊵":"⊵","▸":"▸","⧎":"⧎","⥨":"⥨","℞":"℞","ś":"ś","‚":"‚","≻":"≻","⪴":"⪴","⪸":"⪸","š":"š","≽":"≽","⪰":"⪰","ş":"ş","ŝ":"ŝ","⪶":"⪶","⪺":"⪺","⋩":"⋩","⨓":"⨓","≿":"≿","с":"с","⋅":"⋅","⊡":"⊡","⩦":"⩦","⇘":"⇘","⤥":"⤥","↘":"↘","↘":"↘","§":"§","§":"§",";":";","⤩":"⤩","∖":"∖","∖":"∖","✶":"✶","𝔰":"𝔰","⌢":"⌢","♯":"♯","щ":"щ","ш":"ш","∣":"∣","∥":"∥","­":"","­":"","σ":"σ","ς":"ς","ς":"ς","∼":"∼","⩪":"⩪","≃":"≃","≃":"≃","⪞":"⪞","⪠":"⪠","⪝":"⪝","⪟":"⪟","≆":"≆","⨤":"⨤","⥲":"⥲","←":"←","∖":"∖","⨳":"⨳","⧤":"⧤","∣":"∣","⌣":"⌣","⪪":"⪪","⪬":"⪬","⪬︀":"⪬︀","ь":"ь","/":"/","⧄":"⧄","⌿":"⌿","𝕤":"𝕤","♠":"♠","♠":"♠","∥":"∥","⊓":"⊓","⊓︀":"⊓︀","⊔":"⊔","⊔︀":"⊔︀","⊏":"⊏","⊑":"⊑","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊐":"⊐","⊒":"⊒","□":"□","□":"□","▪":"▪","▪":"▪","→":"→","𝓈":"𝓈","∖":"∖","⌣":"⌣","⋆":"⋆","☆":"☆","★":"★","ϵ":"ϵ","ϕ":"ϕ","¯":"¯","⊂":"⊂","⫅":"⫅","⪽":"⪽","⊆":"⊆","⫃":"⫃","⫁":"⫁","⫋":"⫋","⊊":"⊊","⪿":"⪿","⥹":"⥹","⊂":"⊂","⊆":"⊆","⫅":"⫅","⊊":"⊊","⫋":"⫋","⫇":"⫇","⫕":"⫕","⫓":"⫓","≻":"≻","⪸":"⪸","≽":"≽","⪰":"⪰","⪺":"⪺","⪶":"⪶","⋩":"⋩","≿":"≿","∑":"∑","♪":"♪","¹":"¹","¹":"¹","²":"²","²":"²","³":"³","³":"³","⊃":"⊃","⫆":"⫆","⪾":"⪾","⫘":"⫘","⊇":"⊇","⫄":"⫄","⟉":"⟉","⫗":"⫗","⥻":"⥻","⫂":"⫂","⫌":"⫌","⊋":"⊋","⫀":"⫀","⊃":"⊃","⊇":"⊇","⫆":"⫆","⊋":"⊋","⫌":"⫌","⫈":"⫈","⫔":"⫔","⫖":"⫖","⇙":"⇙","⤦":"⤦","↙":"↙","↙":"↙","⤪":"⤪","ß":"ß","ß":"ß","⌖":"⌖","τ":"τ","⎴":"⎴","ť":"ť","ţ":"ţ","т":"т","⃛":"⃛","⌕":"⌕","𝔱":"𝔱","∴":"∴","∴":"∴","θ":"θ","ϑ":"ϑ","ϑ":"ϑ","≈":"≈","∼":"∼"," ":" ","≈":"≈","∼":"∼","þ":"þ","þ":"þ","˜":"˜","×":"×","×":"×","⊠":"⊠","⨱":"⨱","⨰":"⨰","∭":"∭","⤨":"⤨","⊤":"⊤","⌶":"⌶","⫱":"⫱","𝕥":"𝕥","⫚":"⫚","⤩":"⤩","‴":"‴","™":"™","▵":"▵","▿":"▿","◃":"◃","⊴":"⊴","≜":"≜","▹":"▹","⊵":"⊵","◬":"◬","≜":"≜","⨺":"⨺","⨹":"⨹","⧍":"⧍","⨻":"⨻","⏢":"⏢","𝓉":"𝓉","ц":"ц","ћ":"ћ","ŧ":"ŧ","≬":"≬","↞":"↞","↠":"↠","⇑":"⇑","⥣":"⥣","ú":"ú","ú":"ú","↑":"↑","ў":"ў","ŭ":"ŭ","û":"û","û":"û","у":"у","⇅":"⇅","ű":"ű","⥮":"⥮","⥾":"⥾","𝔲":"𝔲","ù":"ù","ù":"ù","↿":"↿","↾":"↾","▀":"▀","⌜":"⌜","⌜":"⌜","⌏":"⌏","◸":"◸","ū":"ū","¨":"¨","¨":"¨","ų":"ų","𝕦":"𝕦","↑":"↑","↕":"↕","↿":"↿","↾":"↾","⊎":"⊎","υ":"υ","ϒ":"ϒ","υ":"υ","⇈":"⇈","⌝":"⌝","⌝":"⌝","⌎":"⌎","ů":"ů","◹":"◹","𝓊":"𝓊","⋰":"⋰","ũ":"ũ","▵":"▵","▴":"▴","⇈":"⇈","ü":"ü","ü":"ü","⦧":"⦧","⇕":"⇕","⫨":"⫨","⫩":"⫩","⊨":"⊨","⦜":"⦜","ϵ":"ϵ","ϰ":"ϰ","∅":"∅","ϕ":"ϕ","ϖ":"ϖ","∝":"∝","↕":"↕","ϱ":"ϱ","ς":"ς","⊊︀":"⊊︀","⫋︀":"⫋︀","⊋︀":"⊋︀","⫌︀":"⫌︀","ϑ":"ϑ","⊲":"⊲","⊳":"⊳","в":"в","⊢":"⊢","∨":"∨","⊻":"⊻","≚":"≚","⋮":"⋮","|":"|","|":"|","𝔳":"𝔳","⊲":"⊲","⊂⃒":"⊂⃒","⊃⃒":"⊃⃒","𝕧":"𝕧","∝":"∝","⊳":"⊳","𝓋":"𝓋","⫋︀":"⫋︀","⊊︀":"⊊︀","⫌︀":"⫌︀","⊋︀":"⊋︀","⦚":"⦚","ŵ":"ŵ","⩟":"⩟","∧":"∧","≙":"≙","℘":"℘","𝔴":"𝔴","𝕨":"𝕨","℘":"℘","≀":"≀","≀":"≀","𝓌":"𝓌","⋂":"⋂","◯":"◯","⋃":"⋃","▽":"▽","𝔵":"𝔵","⟺":"⟺","⟷":"⟷","ξ":"ξ","⟸":"⟸","⟵":"⟵","⟼":"⟼","⋻":"⋻","⨀":"⨀","𝕩":"𝕩","⨁":"⨁","⨂":"⨂","⟹":"⟹","⟶":"⟶","𝓍":"𝓍","⨆":"⨆","⨄":"⨄","△":"△","⋁":"⋁","⋀":"⋀","ý":"ý","ý":"ý","я":"я","ŷ":"ŷ","ы":"ы","¥":"¥","¥":"¥","𝔶":"𝔶","ї":"ї","𝕪":"𝕪","𝓎":"𝓎","ю":"ю","ÿ":"ÿ","ÿ":"ÿ","ź":"ź","ž":"ž","з":"з","ż":"ż","ℨ":"ℨ","ζ":"ζ","𝔷":"𝔷","ж":"ж","⇝":"⇝","𝕫":"𝕫","𝓏":"𝓏","‍":"","‌":""};function Ja(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof $i[e]=="string")return $i[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 Qt(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>"+Qt(r).replace(/\n/g,"<br />")+"</div>"}function Ya(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=
|
|
17
|
-
`)}return o}function
|
|
16
|
+
`),r=Ja(r),r}function rl(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function ys(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(rl(n))};return r.forEach(t),e.join("")}function nl(r){return`<a href="mailto:${Qt(r.address)}" class="postal-email-address">${Qt(r.name||`<${r.address}>`)}</a>`}function xs(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">${Qt(n.name)}:</span>`,i='<span class="postal-email-address-group">;</span>';e.push(o),n.group.forEach(t),e.push(i)}else e.push(nl(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 Ii(r){let e=[];if(r.from&&e.push({key:"From",val:rl(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:ys(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:ys(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:ys(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`
|
|
18
18
|
${s}
|
|
19
19
|
${e.join(`
|
|
20
20
|
`)}
|
|
21
21
|
${s}
|
|
22
|
-
`}function
|
|
23
|
-
<div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function
|
|
22
|
+
`}function zi(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${nl(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">${Qt(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="${Qt(r.date)}">${Qt(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${xs(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${xs(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${xs(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&&Ur(i.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),o.push({name:qr(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=Ur(qr(i.text));if(c&&c.length)return c}if(!i.address&&t)return[];s={address:i.address||i.text||"",name:qr(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",`
|
|
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
|
|
25
|
+
`&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const tu=50;function Ur(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 Tn{static parse(e,t){return new Tn(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 Mi({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 Mi({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 Tn;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?qr(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=
|
|
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:u}=await s.read();if(l)break;n.push(u),t+=u.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=rr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await In(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(u=>u.key===i);if(l&&l.value){const u=Tr(l.value);u&&u.length&&(t[i]=u[0])}}for(const i of["delivered-to","return-path"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=Tr(l.value);if(u&&u.length&&u[0].address){const a=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[a]=u[0].address}}}for(const i of["to","cc","bcc","reply-to"]){const l=this.root.headers.filter(a=>a.key===i);let u=[];if(l.filter(a=>a&&a.value).map(a=>Tr(a.value)).forEach(a=>u=u.concat(a||[])),u&&u.length){const a=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[a]=u}}for(const i of["subject","message-id","in-reply-to","references"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=i.replace(/\-(.)/g,(a,c)=>c.toUpperCase());t[u]=Sr(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=ra(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 tl{constructor(e){gr(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(a=>`UID MOVE ${a} "${o}"`)],u=(await this.imapExec(e,i)).responses.filter(a=>a.ok&&a.command==="UID MOVE").length;if(u>0)return{success:!0,moved:u}}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 u=[...i.messages].sort((h,p)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(p.internalDate?new Date(p.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(u.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 ${u.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=u.map(h=>{var E,D,k,v,b;const p=d.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(w=>w.includes("Seen")))||!1,_=((k=(D=p.envelope)==null?void 0:D.from)==null?void 0:k.email)||"Unknown",C=((v=p.envelope)==null?void 0:v.subject)||"(No subject)",y=((b=p.envelope)==null?void 0:b.date)||"";return{uid:h,from:_,subject:C,date:y,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 p,m,_,C,y,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)||!((p=o.messages)!=null&&p[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 a=await new _n().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=a.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(_=a.attachments)==null?void 0:_.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of a.attachments||[])if(D.contentId){const k=this.contentToBase64(D.content),v=`data:${D.mimeType};base64,${k}`,b=D.contentId.replace(/^<|>$/g,"");c.set(b,v),c.set(`<${b}>`,v)}let d=a.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,k)=>{const v=c.get(k)||c.get(`<${k}>`);return v?`src="${v}"`:D}));const f=((C=i.flags)==null?void 0:C.some(D=>D.toLowerCase().includes("seen")))||!1,h=((y=a.from)==null?void 0:y.address)||((E=a.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:a.subject||"(No subject)",date:a.date||"",body:d||a.text||"",html:d,text:a.text||"",seen:f,attachments:(a.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(a=>a.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 u=await this.callEmail("send",l);return{success:(u==null?void 0:u.sent)??!1,message_id:u==null?void 0:u.message_id,error:u==null?void 0:u.error}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}}const ds="qwanyx_auth_token",fs="qwanyx_refresh_token";class rl{static setToken(e){typeof window<"u"&&localStorage.setItem(ds,e)}static getToken(){return typeof window<"u"?localStorage.getItem(ds):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(ds),localStorage.removeItem(fs))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(fs,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(fs):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class nl{constructor(e){gr(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)}`,u={...this.config.headers,...rl.getAuthHeader(),...s},a={method:n,headers:u};o&&n!=="GET"&&(a.body=JSON.stringify(o));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(l,{...a,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 bn=null;function ia(r){return bn=new nl(r),bn}function Hs(){if(!bn)throw new Error("API client not initialized. Call initializeApiClient() first.");return bn}function sl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:o,onError:i}=t,[l,u]=A.useState(null),[a,c]=A.useState(n),[d,f]=A.useState(null),h=A.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await Hs().get(r,e);u(m),o==null||o(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");f(m),i==null||i(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,o,i]);return A.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:a,error:d,refetch:h}}function oa(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[o,i]=A.useState(null),[l,u]=A.useState(!1),[a,c]=A.useState(null),d=A.useCallback(async h=>{u(!0),c(null);try{const p=Hs();let m;switch(e){case"POST":m=await p.post(r,h);break;case"PUT":m=await p.put(r,h);break;case"PATCH":m=await p.patch(r,h);break;case"DELETE":m=await p.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return i(m),n==null||n(m,h),m}catch(p){const m=p instanceof Error?p:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{u(!1)}},[r,e,n,s]),f=A.useCallback(()=>{i(null),c(null),u(!1)},[]);return{data:o,loading:l,error:a,mutate:d,reset:f}}var Es={exports:{}},mr={};/**
|
|
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(zi(a.value));break;case"plain":e[l].push(Ii(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(zi(u.value));break;case"plain":e[l].push(Ii(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 Qn(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=Ur(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=Ur(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=>Ur(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]=qr(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 sl{constructor(e){Tr(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,p)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(p.internalDate?new Date(p.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 A,v,S,C,_;const p=d.get(h);if(!p)return null;const m=((A=p.flags)==null?void 0:A.some(E=>E.includes("Seen")))||!1,b=((S=(v=p.envelope)==null?void 0:v.from)==null?void 0:S.email)||"Unknown",D=((C=p.envelope)==null?void 0:C.subject)||"(No subject)",y=((_=p.envelope)==null?void 0:_.date)||"";return{uid:h,from:b,subject:D,date:y,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 p,m,b,D,y,A;const o=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(v=>v.command==="UID FETCH");if(!(o!=null&&o.ok)||!((p=o.messages)!=null&&p[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 Tn().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(v=>({filename:v.filename,mimeType:v.mimeType,contentId:v.contentId})));const c=new Map;for(const v of u.attachments||[])if(v.contentId){const S=this.contentToBase64(v.content),C=`data:${v.mimeType};base64,${S}`,_=v.contentId.replace(/^<|>$/g,"");c.set(_,C),c.set(`<${_}>`,C)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(v,S)=>{const C=c.get(S)||c.get(`<${S}>`);return C?`src="${C}"`:v}));const f=((D=i.flags)==null?void 0:D.some(v=>v.toLowerCase().includes("seen")))||!1,h=((y=u.from)==null?void 0:y.address)||((A=u.from)==null?void 0:A.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(v=>({filename:v.filename||"attachment",mimeType:v.mimeType||"application/octet-stream",size:this.getContentSize(v.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 bs="qwanyx_auth_token",_s="qwanyx_refresh_token";class il{static setToken(e){typeof window<"u"&&localStorage.setItem(bs,e)}static getToken(){return typeof window<"u"?localStorage.getItem(bs):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(bs),localStorage.removeItem(_s))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(_s,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(_s):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class ol{constructor(e){Tr(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,...il.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 Bn=null;function iu(r){return Bn=new ol(r),Bn}function ri(){if(!Bn)throw new Error("API client not initialized. Call initializeApiClient() first.");return Bn}function ll(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 ri().get(r,e);a(m),o==null||o(m)}catch(p){const m=p instanceof Error?p: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 p=ri();let m;switch(e){case"POST":m=await p.post(r,h);break;case"PUT":m=await p.put(r,h);break;case"PATCH":m=await p.patch(r,h);break;case"DELETE":m=await p.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return i(m),n==null||n(m,h),m}catch(p){const m=p instanceof Error?p: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 Ls={exports:{}},Br={};/**
|
|
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
|
|
36
|
+
*/var qi;function lu(){if(qi)return Br;qi=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 Br.Fragment=t,Br.jsx=i,Br.jsxs=i,Br}var Nr={};/**
|
|
37
37
|
* @license React
|
|
38
38
|
* react-jsx-runtime.development.js
|
|
39
39
|
*
|
|
@@ -41,42 +41,42 @@ ${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
|
|
45
|
-
`+
|
|
46
|
-
`),
|
|
47
|
-
`),
|
|
48
|
-
`+
|
|
44
|
+
*/var Ui;function au(){return Ui||(Ui=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"),p=Symbol.iterator,m="@@iterator";function b(x){if(x===null||typeof x!="object")return null;var P=p&&x[p]||x[m];return typeof P=="function"?P:null}var D=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(x){{for(var P=arguments.length,K=new Array(P>1?P-1:0),Z=1;Z<P;Z++)K[Z-1]=arguments[Z];A("error",x,K)}}function A(x,P,K){{var Z=D.ReactDebugCurrentFrame,ce=Z.getStackAddendum();ce!==""&&(P+="%s",K=K.concat([ce]));var ge=K.map(function(ie){return String(ie)});ge.unshift("Warning: "+P),Function.prototype.apply.call(console[x],console,ge)}}var v=!1,S=!1,C=!1,_=!1,E=!1,k;k=Symbol.for("react.module.reference");function I(x){return!!(typeof x=="string"||typeof x=="function"||x===n||x===o||E||x===s||x===u||x===c||_||x===h||v||S||C||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===i||x.$$typeof===l||x.$$typeof===a||x.$$typeof===k||x.getModuleId!==void 0))}function B(x,P,K){var Z=x.displayName;if(Z)return Z;var ce=P.displayName||P.name||"";return ce!==""?K+"("+ce+")":K}function N(x){return x.displayName||"Context"}function j(x){if(x==null)return null;if(typeof x.tag=="number"&&y("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 P=x;return N(P)+".Consumer";case i:var K=x;return N(K._context)+".Provider";case a:return B(x,x.render,"ForwardRef");case d:var Z=x.displayName||null;return Z!==null?Z:j(x.type)||"Memo";case f:{var ce=x,ge=ce._payload,ie=ce._init;try{return j(ie(ge))}catch{return null}}}return null}var L=Object.assign,R=0,ee,ye,me,je,Ne,He,Se;function qe(){}qe.__reactDisabledLog=!0;function rt(){{if(R===0){ee=console.log,ye=console.info,me=console.warn,je=console.error,Ne=console.group,He=console.groupCollapsed,Se=console.groupEnd;var x={configurable:!0,enumerable:!0,value:qe,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}R++}}function $e(){{if(R--,R===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},x,{value:ee}),info:L({},x,{value:ye}),warn:L({},x,{value:me}),error:L({},x,{value:je}),group:L({},x,{value:Ne}),groupCollapsed:L({},x,{value:He}),groupEnd:L({},x,{value:Se})})}R<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=D.ReactCurrentDispatcher,Ie;function Re(x,P,K){{if(Ie===void 0)try{throw Error()}catch(ce){var Z=ce.stack.trim().match(/\n( *(at )?)/);Ie=Z&&Z[1]||""}return`
|
|
45
|
+
`+Ie+x}}var he=!1,Ue;{var Je=typeof WeakMap=="function"?WeakMap:Map;Ue=new Je}function mt(x,P){if(!x||he)return"";{var K=Ue.get(x);if(K!==void 0)return K}var Z;he=!0;var ce=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=fe.current,fe.current=null,rt();try{if(P){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Xe){Z=Xe}Reflect.construct(x,[],ie)}else{try{ie.call()}catch(Xe){Z=Xe}x.call(ie.prototype)}}else{try{throw Error()}catch(Xe){Z=Xe}x()}}catch(Xe){if(Xe&&Z&&typeof Xe.stack=="string"){for(var se=Xe.stack.split(`
|
|
46
|
+
`),We=Z.stack.split(`
|
|
47
|
+
`),we=se.length-1,Ae=We.length-1;we>=1&&Ae>=0&&se[we]!==We[Ae];)Ae--;for(;we>=1&&Ae>=0;we--,Ae--)if(se[we]!==We[Ae]){if(we!==1||Ae!==1)do if(we--,Ae--,Ae<0||se[we]!==We[Ae]){var ot=`
|
|
48
|
+
`+se[we].replace(" at new "," at ");return x.displayName&&ot.includes("<anonymous>")&&(ot=ot.replace("<anonymous>",x.displayName)),typeof x=="function"&&Ue.set(x,ot),ot}while(we>=1&&Ae>=0);break}}}finally{he=!1,fe.current=ge,$e(),Error.prepareStackTrace=ce}var ur=x?x.displayName||x.name:"",Vt=ur?Re(ur):"";return typeof x=="function"&&Ue.set(x,Vt),Vt}function Gt(x,P,K){return mt(x,!1)}function Kt(x){var P=x.prototype;return!!(P&&P.isReactComponent)}function yt(x,P,K){if(x==null)return"";if(typeof x=="function")return mt(x,Kt(x));if(typeof x=="string")return Re(x);switch(x){case u:return Re("Suspense");case c:return Re("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case a:return Gt(x.render);case d:return yt(x.type,P,K);case f:{var Z=x,ce=Z._payload,ge=Z._init;try{return yt(ge(ce),P,K)}catch{}}}return""}var Qe=Object.prototype.hasOwnProperty,Ye={},Et=D.ReactDebugCurrentFrame;function H(x){if(x){var P=x._owner,K=yt(x.type,x._source,P?P.type:null);Et.setExtraStackFrame(K)}else Et.setExtraStackFrame(null)}function xe(x,P,K,Z,ce){{var ge=Function.call.bind(Qe);for(var ie in x)if(ge(x,ie)){var se=void 0;try{if(typeof x[ie]!="function"){var We=Error((Z||"React class")+": "+K+" type `"+ie+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[ie]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw We.name="Invariant Violation",We}se=x[ie](P,ie,Z,K,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(we){se=we}se&&!(se instanceof Error)&&(H(ce),y("%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).",Z||"React class",K,ie,typeof se),H(null)),se instanceof Error&&!(se.message in Ye)&&(Ye[se.message]=!0,H(ce),y("Failed %s type: %s",K,se.message),H(null))}}}var De=Array.isArray;function U(x){return De(x)}function T(x){{var P=typeof Symbol=="function"&&Symbol.toStringTag,K=P&&x[Symbol.toStringTag]||x.constructor.name||"Object";return K}}function X(x){try{return Q(x),!1}catch{return!0}}function Q(x){return""+x}function z(x){if(X(x))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",T(x)),Q(x)}var re=D.ReactCurrentOwner,ne={key:!0,ref:!0,__self:!0,__source:!0},te,O;function W(x){if(Qe.call(x,"ref")){var P=Object.getOwnPropertyDescriptor(x,"ref").get;if(P&&P.isReactWarning)return!1}return x.ref!==void 0}function J(x){if(Qe.call(x,"key")){var P=Object.getOwnPropertyDescriptor(x,"key").get;if(P&&P.isReactWarning)return!1}return x.key!==void 0}function Y(x,P){typeof x.ref=="string"&&re.current}function ue(x,P){{var K=function(){te||(te=!0,y("%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)",P))};K.isReactWarning=!0,Object.defineProperty(x,"key",{get:K,configurable:!0})}}function pe(x,P){{var K=function(){O||(O=!0,y("%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)",P))};K.isReactWarning=!0,Object.defineProperty(x,"ref",{get:K,configurable:!0})}}var be=function(x,P,K,Z,ce,ge,ie){var se={$$typeof:e,type:x,key:P,ref:K,props:ie,_owner:ge};return se._store={},Object.defineProperty(se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.defineProperty(se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ce}),Object.freeze&&(Object.freeze(se.props),Object.freeze(se)),se};function le(x,P,K,Z,ce){{var ge,ie={},se=null,We=null;K!==void 0&&(z(K),se=""+K),J(P)&&(z(P.key),se=""+P.key),W(P)&&(We=P.ref,Y(P,ce));for(ge in P)Qe.call(P,ge)&&!ne.hasOwnProperty(ge)&&(ie[ge]=P[ge]);if(x&&x.defaultProps){var we=x.defaultProps;for(ge in we)ie[ge]===void 0&&(ie[ge]=we[ge])}if(se||We){var Ae=typeof x=="function"?x.displayName||x.name||"Unknown":x;se&&ue(ie,Ae),We&&pe(ie,Ae)}return be(x,se,We,ce,Z,re.current,ie)}}var ke=D.ReactCurrentOwner,Pe=D.ReactDebugCurrentFrame;function Oe(x){if(x){var P=x._owner,K=yt(x.type,x._source,P?P.type:null);Pe.setExtraStackFrame(K)}else Pe.setExtraStackFrame(null)}var at;at=!1;function nt(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function St(){{if(ke.current){var x=j(ke.current.type);if(x)return`
|
|
49
49
|
|
|
50
|
-
Check the render method of \``+x+"`."}return""}}function
|
|
50
|
+
Check the render method of \``+x+"`."}return""}}function Sr(x){return""}var jt={};function hs(x){{var P=St();if(!P){var K=typeof x=="string"?x:x.displayName||x.name;K&&(P=`
|
|
51
51
|
|
|
52
|
-
Check the top-level render call using <`+
|
|
52
|
+
Check the top-level render call using <`+K+">.")}return P}}function ar(x,P){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var K=hs(P);if(jt[K])return;jt[K]=!0;var Z="";x&&x._owner&&x._owner!==ke.current&&(Z=" It was passed a child from "+j(x._owner.type)+"."),Oe(x),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',K,Z),Oe(null)}}function kr(x,P){{if(typeof x!="object")return;if(U(x))for(var K=0;K<x.length;K++){var Z=x[K];nt(Z)&&ar(Z,P)}else if(nt(x))x._store&&(x._store.validated=!0);else if(x){var ce=b(x);if(typeof ce=="function"&&ce!==x.entries)for(var ge=ce.call(x),ie;!(ie=ge.next()).done;)nt(ie.value)&&ar(ie.value,P)}}}function ps(x){{var P=x.type;if(P==null||typeof P=="string")return;var K;if(typeof P=="function")K=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===a||P.$$typeof===d))K=P.propTypes;else return;if(K){var Z=j(P);xe(K,x.props,"prop",Z,x)}else if(P.PropTypes!==void 0&&!at){at=!0;var ce=j(P);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ce||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ta(x){{for(var P=Object.keys(x.props),K=0;K<P.length;K++){var Z=P[K];if(Z!=="children"&&Z!=="key"){Oe(x),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Z),Oe(null);break}}x.ref!==null&&(Oe(x),y("Invalid attribute `ref` supplied to `React.Fragment`."),Oe(null))}}var Fi={};function Li(x,P,K,Z,ce,ge){{var ie=I(x);if(!ie){var se="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(se+=" 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 We=Sr();We?se+=We:se+=St();var we;x===null?we="null":U(x)?we="array":x!==void 0&&x.$$typeof===e?(we="<"+(j(x.type)||"Unknown")+" />",se=" Did you accidentally export a JSX literal instead of a component?"):we=typeof x,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",we,se)}var Ae=le(x,P,K,ce,ge);if(Ae==null)return Ae;if(ie){var ot=P.children;if(ot!==void 0)if(Z)if(U(ot)){for(var ur=0;ur<ot.length;ur++)kr(ot[ur],x);Object.freeze&&Object.freeze(ot)}else y("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 kr(ot,x)}if(Qe.call(P,"key")){var Vt=j(x),Xe=Object.keys(P).filter(function(Ra){return Ra!=="key"}),gs=Xe.length>0?"{key: someKey, "+Xe.join(": ..., ")+": ...}":"{key: someKey}";if(!Fi[Vt+gs]){var ja=Xe.length>0?"{"+Xe.join(": ..., ")+": ...}":"{}";y(`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} />`,
|
|
57
|
+
<%s key={someKey} {...props} />`,gs,Vt,ja,Vt),Fi[Vt+gs]=!0}}return x===n?Ta(Ae):ps(Ae),Ae}}function Ba(x,P,K){return Li(x,P,K,!0)}function Na(x,P,K){return Li(x,P,K,!1)}var Fa=Na,La=Ba;Nr.Fragment=n,Nr.jsx=Fa,Nr.jsxs=La}()),Nr}process.env.NODE_ENV==="production"?Ls.exports=lu():Ls.exports=au();var g=Ls.exports;class En{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:p={}}){const{data:m,loading:b,error:D,refetch:y}=ll(r,e),[A,v]=w.useState(""),[S,C]=w.useState({}),[_,E]=w.useState(1),k=w.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let L=m;return l&&A&&a.length>0&&(L=En.search(L,A,a)),Object.keys(S).length>0&&(L=En.filterByFields(L,S)),En.paginate(L,_,d)},[m,A,S,_,d,l,a]);w.useEffect(()=>{E(1)},[A,S]);const I=()=>{v(""),C({}),E(1),y(),h==null||h()},B={background:p.background||"#ffffff",cardBackground:p.cardBackground||"#f9fafb",text:p.text||"#111827",textSecondary:p.textSecondary||"#6b7280",border:p.border||"#e5e7eb",primary:p.primary||"#3b82f6"},j=o||(L=>g.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:B.text},children:L.title||L.name||L.label||"Untitled"}),L.description&&g.jsx("div",{style:{fontSize:"13px",color:B.textSecondary,marginTop:"4px"},children:L.description})]}));return b&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:B.textSecondary},children:"Loading..."}):D?g.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[g.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),g.jsx("div",{style:{fontSize:"14px"},children:D.message}),g.jsx("button",{onClick:I,style:{marginTop:"16px",padding:"8px 16px",background:B.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):g.jsxs("div",{style:{background:B.background,borderRadius:"12px",overflow:"hidden"},children:[(n||l||c.length>0)&&g.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${B.border}`},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:l||c.length>0?"12px":"0"},children:[n&&g.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:B.text},children:n}),g.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&&g.jsx("input",{type:"text",placeholder:u,value:A,onChange:L=>v(L.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${B.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),g.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:k.data.length===0?g.jsx("div",{style:{padding:"48px",textAlign:"center",color:B.textSecondary},children:s}):k.data.map((L,R)=>g.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:ee=>{f&&(ee.currentTarget.style.background=B.border)},onMouseLeave:ee=>{ee.currentTarget.style.background=B.cardBackground},children:j(L,R)},i(L,R)))}),k.totalPages>1&&g.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${B.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsxs("div",{style:{fontSize:"13px",color:B.textSecondary},children:["Page ",_," of ",k.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>E(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"}),g.jsx("button",{onClick:()=>E(L=>Math.min(k.totalPages,L+1)),disabled:_===k.totalPages,style:{padding:"6px 12px",border:`1px solid ${B.border}`,borderRadius:"6px",background:"white",cursor:_===k.totalPages?"not-allowed":"pointer",opacity:_===k.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 g.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:[u&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:u,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),a&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:a})]}),l&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&g.jsx("div",{className:"flex-shrink-0 text-gray-400",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function da({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 g.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:g.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[g.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[g.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&g.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g.jsxs("div",{className:"p-6",children:[i&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((l,u)=>{const a=l.value(r);return a==null||a===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof a=="object"?JSON.stringify(a,null,2):String(a)})]},u)})}),s.length===0&&g.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&g.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:g.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 fa={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function ha({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),[u,a]=A.useState([]),[c,d]=A.useState([]),[f,h]=A.useState(Array(l).fill(!1)),[p,m]=A.useState(Array(l).fill(!1)),_=A.useRef([]),C=A.useCallback(v=>{const b=r.filter(S=>!v.includes(S._id));if(b.length===0)return null;const w=Math.floor(Math.random()*b.length);return b[w]},[r]),y=A.useCallback(()=>Math.random()*(n-t)+t,[t,n]);A.useEffect(()=>{if(r.length===0){a([]),d([]);return}const v=[],b=[],w=[];for(let S=0;S<l&&S<r.length;S++){const $=C(w);$&&(v.push($),w.push($._id))}for(let S=0;S<v.length;S++){const $=[v[S]._id,...v.filter((N,j)=>j!==S).map(N=>N._id)],T=C($);T?b.push(T):b.push(v[S])}a(v),d(b)},[r,l,C]);const E=A.useCallback(v=>{const b=y(),w=setTimeout(()=>{h(S=>{const $=[...S];return $[v]=!$[v],$}),setTimeout(()=>{m(S=>{const $=[...S];return $[v]=!$[v],$}),setTimeout(()=>{const S=!p[v];S&&a($=>{const T=[...$];return T[v]=c[v],T}),d($=>{const T=[...$],j=[(S?c[v]:u[v])._id,...u.filter((O,G)=>G!==v).map(O=>O._id),...$.filter((O,G)=>G!==v).map(O=>O._id)],L=C(j);return L&&(T[v]=L),T}),setTimeout(()=>{E(v)},150)},200)},150)},b);_.current[v]=w},[y,C,u,c,p]),D=A.useRef(!1);A.useEffect(()=>{if(!(u.length===0||r.length<=1)&&!D.current){D.current=!0;for(let v=0;v<u.length;v++)E(v);return()=>{_.current.forEach(v=>clearTimeout(v)),_.current=[],D.current=!1}}},[u.length,r.length]);const k=v=>{s&&s(v)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):u.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:u.map((v,b)=>{const w=c[b],S=p[b];return g.jsx("div",{className:`relative ${fa[o]}`,style:{perspective:"1000px"},onClick:()=>k(S?w:v),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[b]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?0:1},children:g.jsxs("div",{style:{transform:f[b]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:v.data.image,alt:v.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:v.title})})]})}),w&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?1:0},children:g.jsxs("div",{style:{transform:f[b]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:w.data.image,alt:w.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:w.title})})]})})]})},`slot-${b}`)})})}function Gt(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,u)=>String.fromCharCode(parseInt(u,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const pa={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function ga({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:u,onSearchChange:a,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:p,onError:m,onLoad:_,renderItem:C,renderDetail:y,renderActions:E,renderEmpty:D,renderLoading:k,theme:v={}}){const b={...pa,...v},[w,S]=A.useState([]),[$,T]=A.useState(!1),[N,j]=A.useState(null),[L,O]=A.useState(new Set),[G,he]=A.useState(null),[oe,Ne]=A.useState(null),[we,Ye]=A.useState(null),[Ie,je]=A.useState(!1),[Xe,Ee]=A.useState(""),te=u!==void 0?u:Xe,Ae=W=>{a?a(W):Ee(W)},xe=A.useMemo(()=>{if(!te.trim())return w;const W=te.toLowerCase();return w.filter(K=>Gt(K.from).toLowerCase().includes(W)||Gt(K.subject).toLowerCase().includes(W))},[w,te]),re=A.useMemo(()=>e?new tl({baseUrl:r,system_id:e}):null,[r,e]),Pe=A.useCallback(async()=>{if(re){T(!0),j(null);try{const W=await re.listEmails(t,n,s);W!=null&&W.messages&&(S(W.messages),_==null||_(W.messages))}catch(W){const K=W instanceof Error?W:new Error("Failed to fetch emails");j(K.message),m==null||m(K)}T(!1)}},[re,t,n,s,m,_]);A.useEffect(()=>{S([]),O(new Set),Ne(null),j(null),u===void 0&&Ee(""),d&&Pe()},[s,d]);const At=A.useCallback(async W=>{if(re){Ne(W),Ye(null),je(!0);try{const K=await re.getEmailParsed(t,W.uid,s||"INBOX");K!=null&&K.body&&Ye(K.body)}catch(K){console.error("Failed to fetch email body:",K)}je(!1)}},[re,t,s]),Ut=A.useCallback(W=>{f==null||f(W),i&&At(W)},[f,i,At]),cr=A.useCallback((W,K,le)=>{if(!o){f==null||f(W),i&&At(W);return}const Ue=W.uid;if(le.shiftKey&&G!==null){const Me=Math.min(G,K),ut=Math.max(G,K),ss=w.slice(Me,ut+1).map(pr=>pr.uid),on=new Set(ss);O(on),h==null||h(Array.from(on))}else if(le.ctrlKey||le.metaKey)O(Me=>{const ut=new Set(Me);return ut.has(Ue)?ut.delete(Ue):ut.add(Ue),h==null||h(Array.from(ut)),ut}),he(K);else{const Me=new Set([Ue]);O(Me),he(K),h==null||h(Array.from(Me))}},[o,G,w,L,f,h,i]),dr=A.useCallback(async()=>{if(!re||L.size===0)return;const W=s||"INBOX";try{const K=await re.trashEmails(t,Array.from(L),W);if(console.log("Trash result:",K),K.success&&K.moved>0){S(Ue=>Ue.filter(Me=>!L.has(Me.uid)));const le=Array.from(L);O(new Set),p==null||p(le)}else j("Failed to move emails to trash")}catch(K){const le=K instanceof Error?K:new Error("Trash failed");console.error("Trash error:",le),j(le.message),m==null||m(le)}},[re,t,L,s,p,m]),gt=A.useCallback(async()=>{if(!re||L.size===0)return;const W=s||"INBOX";try{const K=await re.archiveEmails(t,Array.from(L),W);if(console.log("Archive result:",K),K.success&&K.archived>0){S(Ue=>Ue.filter(Me=>!L.has(Me.uid)));const le=Array.from(L);O(new Set),p==null||p(le)}else j("Failed to archive emails")}catch(K){const le=K instanceof Error?K:new Error("Archive failed");console.error("Archive error:",le),j(le.message),m==null||m(le)}},[re,t,L,s,p,m]),Oe=A.useCallback(()=>{if(L.size===w.length)O(new Set),h==null||h([]);else{const W=new Set(w.map(K=>K.uid));O(W),h==null||h(Array.from(W))}},[w,L.size,h]),ze=A.useCallback(()=>{O(new Set),h==null||h([])},[h]),kt={delete:dr,archive:gt,refresh:Pe,selectAll:Oe,clearSelection:ze},U=W=>{if(!W)return"";const K=new Date(W),le=new Date;return K.toDateString()===le.toDateString()?K.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):K.toLocaleDateString([],{month:"short",day:"numeric"})},_e=(W,K)=>g.jsx("div",{style:{padding:"12px 16px",background:K?b.selectedBackground:W.seen?b.cardBackground:b.unreadBackground,borderBottom:`1px solid ${b.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:W.seen?400:600,color:b.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gt(W.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:W.seen?400:500,color:W.seen?b.textSecondary:b.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gt(W.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary,flexShrink:0},children:U(W.date)})]})}),qe=W=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:b.text},children:Gt(W.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:b.textSecondary,marginBottom:"16px"},children:["From: ",Gt(W.from)," • ",new Date(W.date).toLocaleString()]}),Ie?g.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"Loading..."}):we?g.jsx("div",{style:{fontSize:"14px",color:b.text},dangerouslySetInnerHTML:{__html:we}}):g.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"No content available"})]}),lt=(W,K)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:b.cardBackground,borderBottom:`1px solid ${b.border}`},children:[g.jsx("button",{onClick:K.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:b.text},children:W.length===w.length?"Deselect All":"Select All"}),W.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:b.textSecondary},children:[W.length," selected"]}),g.jsx("button",{onClick:K.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:K.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:K.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),fr=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:c}),hr=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:"Loading..."}),Wt=C||_e,rn=y||qe,nn=E||lt,ns=D||fr,sn=k||hr;return $&&w.length===0?g.jsx("div",{style:{background:b.background,width:"100%",height:"100%"},children:sn()}):g.jsxs("div",{style:{display:"flex",background:b.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:i&&oe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&oe?`1px solid ${b.border}`:"none",overflow:"hidden"},children:[o&&nn(Array.from(L),kt),l&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${b.border}`,background:b.background},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:b.textSecondary,strokeWidth:"2",children:[g.jsx("circle",{cx:"11",cy:"11",r:"8"}),g.jsx("path",{d:"M21 21l-4.35-4.35"})]}),g.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:te,onChange:W=>Ae(W.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:b.text}}),te&&g.jsx("button",{onClick:()=>Ae(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:b.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:b.danger,fontSize:"14px",borderBottom:`1px solid ${b.border}`},children:N}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:xe.length===0?ns():xe.map((W,K)=>g.jsx("div",{onClick:le=>cr(W,K,le),onDoubleClick:()=>Ut(W),children:Wt(W,L.has(W.uid))},W.uid))})]}),i&&oe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:rn(oe)})]})}function ma({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:u=""}){const[a,c]=A.useState(new Set),[d,f]=A.useState(-1),h=r.filter(D=>a.has(D.id)),p=d>=0&&d<h.length?h[d]:null,m=A.useCallback(D=>{c(k=>{const v=new Set(k);return v.has(D)?v.delete(D):v.add(D),t==null||t(Array.from(v)),v})},[t]),_=A.useCallback(()=>{if(a.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,a.size,t,n]),C=A.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]),y=A.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=A.useCallback(D=>{s==null||s(D,h,p)},[s,h,p]);return A.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?g.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${u}`,children:i}):g.jsxs("div",{className:`space-y-2 ${u}`,children:[g.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[l&&g.jsxs("button",{onClick:_,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[g.jsx("span",{className:"material-icons text-sm",children:a.size===r.length?"check_box":a.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:a.size===r.length?"Deselect all":"Select all"})]}),a.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",a.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:C,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),g.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),g.jsx("button",{onClick:y,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),g.jsx("div",{className:"space-y-1",children:r.map(D=>{const k=a.has(D.id),v=(p==null?void 0:p.id)===D.id;return g.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${v?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[g.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,v)})]},D.id)})}),o.length>0&&a.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var v;const k=((v=D.disabled)==null?void 0:v.call(D,h))??!1;return g.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&&g.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function ya(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xa=ya(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 il=A.createContext(null);function _a(r,e){return{getTheme:function(){return e??null}}}function Je(){const r=A.useContext(il);return r==null&&xa(8),r}function Ur(r){return{}}const Js={},ba={},ol={},Ft={},Zt={},Or={},er={},zn={},As={},Mr={},Rr={},Ge={},Qs={},Ys={},va={},ll={},Da={},ul={},Ca={},al={},cl={},vn={},wa={},dl={},fl={},hl={},Ea={},Aa={},ka={},zi={},pl={},Sa={},gl={},ml={},Ta={},qn={},Xs={},ks={},Ba={},Na={},un={},an={},Fa={},La={},ja={},Qe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pa=Qe&&"documentMode"in document?document.documentMode:null,We=Qe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Dt=Qe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Dn=!(!Qe||!("InputEvent"in window)||Pa)&&"getTargetRanges"in new window.InputEvent("input"),Un=Qe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wr=Qe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Oa=Qe&&/Android/.test(navigator.userAgent),yl=Qe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ma=Qe&&Oa&&yl,Zs=Qe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!yl,Kr=1,wt=3,Pt=0,xl=1,nr=2,Ra=0,$a=1,Ia=2,Cn=4,wn=8,ei=128,za=112|(3|Cn|wn)|ei,ti=1,ri=2,ni=3,si=4,ii=5,oi=6,Wn=Un||Wr||Zs?" ":"",dt=`
|
|
61
|
+
`,children:[a&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:a,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),u&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&g.jsx("div",{className:"flex-shrink-0 text-gray-400",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.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 g.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:g.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[g.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[g.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&g.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g.jsxs("div",{className:"p-6",children:[i&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&g.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&g.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:g.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)),[p,m]=w.useState(Array(l).fill(!1)),b=w.useRef([]),D=w.useCallback(C=>{const _=r.filter(k=>!C.includes(k._id));if(_.length===0)return null;const E=Math.floor(Math.random()*_.length);return _[E]},[r]),y=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const C=[],_=[],E=[];for(let k=0;k<l&&k<r.length;k++){const I=D(E);I&&(C.push(I),E.push(I._id))}for(let k=0;k<C.length;k++){const I=[C[k]._id,...C.filter((N,j)=>j!==k).map(N=>N._id)],B=D(I);B?_.push(B):_.push(C[k])}u(C),d(_)},[r,l,D]);const A=w.useCallback(C=>{const _=y(),E=setTimeout(()=>{h(k=>{const I=[...k];return I[C]=!I[C],I}),setTimeout(()=>{m(k=>{const I=[...k];return I[C]=!I[C],I}),setTimeout(()=>{const k=!p[C];k&&u(I=>{const B=[...I];return B[C]=c[C],B}),d(I=>{const B=[...I],j=[(k?c[C]:a[C])._id,...a.filter((R,ee)=>ee!==C).map(R=>R._id),...I.filter((R,ee)=>ee!==C).map(R=>R._id)],L=D(j);return L&&(B[C]=L),B}),setTimeout(()=>{A(C)},150)},200)},150)},_);b.current[C]=E},[y,D,a,c,p]),v=w.useRef(!1);w.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!v.current){v.current=!0;for(let C=0;C<a.length;C++)A(C);return()=>{b.current.forEach(C=>clearTimeout(C)),b.current=[],v.current=!1}}},[a.length,r.length]);const S=C=>{s&&s(C)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:a.map((C,_)=>{const E=c[_],k=p[_];return g.jsx("div",{className:`relative ${fu[o]}`,style:{perspective:"1000px"},onClick:()=>S(k?E:C),children:g.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:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?0:1},children:g.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:C.data.image,alt:C.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:C.title})})]})}),E&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?1:0},children:g.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:E.data.image,alt:E.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:E.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 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:p,onError:m,onLoad:b,renderItem:D,renderDetail:y,renderActions:A,renderEmpty:v,renderLoading:S,theme:C={}}){const _={...pu,...C},[E,k]=w.useState([]),[I,B]=w.useState(!1),[N,j]=w.useState(null),[L,R]=w.useState(new Set),[ee,ye]=w.useState(null),[me,je]=w.useState(null),[Ne,He]=w.useState(null),[Se,qe]=w.useState(!1),[rt,$e]=w.useState(""),fe=a!==void 0?a:rt,Ie=O=>{u?u(O):$e(O)},Re=w.useMemo(()=>{if(!fe.trim())return E;const O=fe.toLowerCase();return E.filter(W=>cr(W.from).toLowerCase().includes(O)||cr(W.subject).toLowerCase().includes(O))},[E,fe]),he=w.useMemo(()=>e?new sl({baseUrl:r,system_id:e}):null,[r,e]),Ue=w.useCallback(async()=>{if(he){B(!0),j(null);try{const O=await he.listEmails(t,n,s);O!=null&&O.messages&&(k(O.messages),b==null||b(O.messages))}catch(O){const W=O instanceof Error?O:new Error("Failed to fetch emails");j(W.message),m==null||m(W)}B(!1)}},[he,t,n,s,m,b]);w.useEffect(()=>{k([]),R(new Set),je(null),j(null),a===void 0&&$e(""),d&&Ue()},[s,d]);const Je=w.useCallback(async O=>{if(he){je(O),He(null),qe(!0);try{const W=await he.getEmailParsed(t,O.uid,s||"INBOX");W!=null&&W.body&&He(W.body)}catch(W){console.error("Failed to fetch email body:",W)}qe(!1)}},[he,t,s]),mt=w.useCallback(O=>{f==null||f(O),i&&Je(O)},[f,i,Je]),Gt=w.useCallback((O,W,J)=>{if(!o){f==null||f(O),i&&Je(O);return}const Y=O.uid;if(J.shiftKey&&ee!==null){const ue=Math.min(ee,W),pe=Math.max(ee,W),be=E.slice(ue,pe+1).map(ke=>ke.uid),le=new Set(be);R(le),h==null||h(Array.from(le))}else if(J.ctrlKey||J.metaKey)R(ue=>{const pe=new Set(ue);return pe.has(Y)?pe.delete(Y):pe.add(Y),h==null||h(Array.from(pe)),pe}),ye(W);else{const ue=new Set([Y]);R(ue),ye(W),h==null||h(Array.from(ue))}},[o,ee,E,L,f,h,i]),Kt=w.useCallback(async()=>{if(!he||L.size===0)return;const O=s||"INBOX";try{const W=await he.trashEmails(t,Array.from(L),O);if(console.log("Trash result:",W),W.success&&W.moved>0){k(Y=>Y.filter(ue=>!L.has(ue.uid)));const J=Array.from(L);R(new Set),p==null||p(J)}else j("Failed to move emails to trash")}catch(W){const J=W instanceof Error?W:new Error("Trash failed");console.error("Trash error:",J),j(J.message),m==null||m(J)}},[he,t,L,s,p,m]),yt=w.useCallback(async()=>{if(!he||L.size===0)return;const O=s||"INBOX";try{const W=await he.archiveEmails(t,Array.from(L),O);if(console.log("Archive result:",W),W.success&&W.archived>0){k(Y=>Y.filter(ue=>!L.has(ue.uid)));const J=Array.from(L);R(new Set),p==null||p(J)}else j("Failed to archive emails")}catch(W){const J=W instanceof Error?W:new Error("Archive failed");console.error("Archive error:",J),j(J.message),m==null||m(J)}},[he,t,L,s,p,m]),Qe=w.useCallback(()=>{if(L.size===E.length)R(new Set),h==null||h([]);else{const O=new Set(E.map(W=>W.uid));R(O),h==null||h(Array.from(O))}},[E,L.size,h]),Ye=w.useCallback(()=>{R(new Set),h==null||h([])},[h]),Et={delete:Kt,archive:yt,refresh:Ue,selectAll:Qe,clearSelection:Ye},H=O=>{if(!O)return"";const W=new Date(O),J=new Date;return W.toDateString()===J.toDateString()?W.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):W.toLocaleDateString([],{month:"short",day:"numeric"})},xe=(O,W)=>g.jsx("div",{style:{padding:"12px 16px",background:W?_.selectedBackground:O.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:O.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:cr(O.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:O.seen?400:500,color:O.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:cr(O.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:H(O.date)})]})}),De=O=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:cr(O.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",cr(O.from)," • ",new Date(O.date).toLocaleString()]}),Se?g.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"Loading..."}):Ne?g.jsx("div",{style:{fontSize:"14px",color:_.text},dangerouslySetInnerHTML:{__html:Ne}}):g.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"No content available"})]}),U=(O,W)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[g.jsx("button",{onClick:W.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:O.length===E.length?"Deselect All":"Select All"}),O.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[O.length," selected"]}),g.jsx("button",{onClick:W.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:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:W.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:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:W.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:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),T=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:c}),X=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),Q=D||xe,z=y||De,re=A||U,ne=v||T,te=S||X;return I&&E.length===0?g.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:te()}):g.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:i&&me?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&me?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[o&&re(Array.from(L),Et),l&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${_.border}`,background:_.background},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:[g.jsx("circle",{cx:"11",cy:"11",r:"8"}),g.jsx("path",{d:"M21 21l-4.35-4.35"})]}),g.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:fe,onChange:O=>Ie(O.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:_.text}}),fe&&g.jsx("button",{onClick:()=>Ie(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:N}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:Re.length===0?ne():Re.map((O,W)=>g.jsx("div",{onClick:J=>Gt(O,W,J),onDoubleClick:()=>mt(O),children:Q(O,L.has(O.uid))},O.uid))})]}),i&&me&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:z(me)})]})}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(v=>u.has(v.id)),p=d>=0&&d<h.length?h[d]:null,m=w.useCallback(v=>{c(S=>{const C=new Set(S);return C.has(v)?C.delete(v):C.add(v),t==null||t(Array.from(C)),C})},[t]),b=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const v=new Set(r.map(S=>S.id));c(v),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(S=>S.id))}},[r,u.size,t,n]),D=w.useCallback(()=>{if(h.length===0)return;const v=d<=0?h.length-1:d-1;f(v),n==null||n(h[v],v)},[h,d,n]),y=w.useCallback(()=>{if(h.length===0)return;const v=d>=h.length-1?0:d+1;f(v),n==null||n(h[v],v)},[h,d,n]),A=w.useCallback(v=>{s==null||s(v,h,p)},[s,h,p]);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?g.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:i}):g.jsxs("div",{className:`space-y-2 ${a}`,children:[g.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[l&&g.jsxs("button",{onClick:b,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[g.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:D,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),g.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),g.jsx("button",{onClick:y,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),g.jsx("div",{className:"space-y-1",children:r.map(v=>{const S=u.has(v.id),C=(p==null?void 0:p.id)===v.id;return g.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${C?"bg-blue-50 ring-1 ring-blue-200":S?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(v.id),children:[g.jsx("span",{className:`material-icons text-lg ${S?"text-blue-500":"text-neutral-300"}`,children:S?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(v,S,C)})]},v.id)})}),o.length>0&&u.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(v=>{var C;const S=((C=v.disabled)==null?void 0:C.call(v,h))??!1;return g.jsxs("button",{onClick:()=>A(v.id),disabled:S,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${S?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[v.icon&&g.jsx("span",{className:"material-icons text-sm",children:v.icon}),v.label]},v.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 al=w.createContext(null);function bu(r,e){return{getTheme:function(){return e??null}}}function pt(){const r=w.useContext(al);return r==null&&xu(8),r}function nn(r){return{}}const ni={},_u={},ul={},Yt={},mr={},Qr={},yr={},Yn={},js={},Yr={},Xr={},ft={},si={},ii={},vu={},cl={},Cu={},dl={},wu={},fl={},hl={},Nn={},Du={},pl={},gl={},ml={},Au={},Eu={},Su={},Wi={},yl={},ku={},xl={},bl={},Tu={},Xn={},oi={},Rs={},Bu={},Nu={},xn={},bn={},Fu={},Lu={},ju={},gt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ru=gt&&"documentMode"in document?document.documentMode:null,ut=gt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),zt=gt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fn=!(!gt||!("InputEvent"in window)||Ru)&&"getTargetRanges"in new window.InputEvent("input"),Zn=gt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),sn=gt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pu=gt&&/Android/.test(navigator.userAgent),_l=gt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ou=gt&&Pu&&_l,li=gt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!_l,on=1,Ut=3,er=0,vl=1,_r=2,Mu=0,$u=1,Iu=2,Ln=4,jn=8,ai=128,zu=112|(3|Ln|jn)|ai,ui=1,ci=2,di=3,fi=4,hi=5,pi=6,es=Zn||sn||li?" ":"",Bt=`
|
|
62
62
|
|
|
63
|
-
`,qa=Dt?" ":Wn,_l="֑-߿יִ-﷽ﹰ-ﻼ",bl="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Ua=new RegExp("^[^"+bl+"]*["+_l+"]"),Wa=new RegExp("^[^"+_l+"]*["+bl+"]"),Ot={bold:1,code:16,highlight:ei,italic:2,strikethrough:Cn,subscript:32,superscript:64,underline:wn},Ka={directionless:1,unmergeable:2},qi={center:ri,end:oi,justify:si,left:ti,right:ni,start:ii},Va={[ri]:"center",[oi]:"end",[si]:"justify",[ti]:"left",[ni]:"right",[ii]:"start"},Ga={normal:0,segmented:2,token:1},Ha={[Ra]:"normal",[Ia]:"segmented",[$a]:"token"};function Ja(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var M=Ja(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 En(...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 Qa=100;let Ss=!1,li=0;function Ya(r){li=r.timeStamp}function hs(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&Vn(r,t)!==void 0}function Xa(r,e,t){const n=$e(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&fi(e,i,s,o,!1)}function Za(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===wt&&t.isAttached()}function ec(r,e,t,n){for(let s=r;s&&!hc(s);s=Gr(s)){const o=Vn(s,e);if(o!==void 0){const i=ye(o,t);if(i)return Z(i)?void 0:[s,i]}else if(s===n)return[n,Tl(t)]}}function vl(r,e,t){Ss=!0;const n=performance.now()-li>Qa;try{Fe(r,()=>{const s=q()||function(f){return f.getEditorState().read(()=>{const h=q();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,u=r._blockCursorElement;let a=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],p=h.type,m=h.target,_=ec(m,r,l,i);if(!_)continue;const[C,y]=_;if(p==="characterData")n&&R(y)&&Za(s,m,y)&&Xa(m,y,r);else if(p==="childList"){a=!0;const E=h.addedNodes;for(let v=0;v<E.length;v++){const b=E[v],w=kl(b),S=b.parentNode;if(S!=null&&b!==u&&w===null&&!hs(b,S,r)){if(Dt){const $=b.innerText||b.nodeValue;$&&(c+=$)}S.removeChild(b)}}const D=h.removedNodes,k=D.length;if(k>0){let v=0;for(let b=0;b<k;b++){const w=D[b];(hs(w,m,r)||u===w)&&(m.appendChild(w),v++)}k!==v&&o.set(C,y)}}}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],p=h.addedNodes,m=h.target;for(let _=0;_<p.length;_++){const C=p[_],y=C.parentNode;y==null||C.nodeName!=="BR"||hs(C,m,r)||y.removeChild(C)}}t.takeRecords()}s!==null&&(a&&(s.dirty=!0,nt(s)),Dt&&Ll(r)&&s.insertRawText(c))})}finally{Ss=!1}}function Dl(r){const e=r._observer;e!==null&&vl(r,e.takeRecords(),e)}function Cl(r){(function(e){li===0&&Hn(e).addEventListener("textInput",Ya,!0)})(r),r._observer=new MutationObserver((e,t)=>{vl(r,e,t)})}function Ui(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 Wi(r,e){const t=r.mergeWithSibling(e),n=ie()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Ki(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&R(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ui(e,n)){n=Wi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ui(n,t)){n=Wi(n,t);break}break}t.remove()}}else n.remove()}function wl(r){return Vi(r.anchor),Vi(r.focus),r}function Vi(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),R(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!B(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 ui(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Z(sr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Kn(e)==null)}function Vr(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!ui(e)&&El(e)===r}catch{return!1}}function ai(r){return r instanceof Zn}function El(r){let e=r;for(;e!=null;){const t=Kn(e);if(ai(t))return t;e=Gr(e)}return null}function Kn(r){return r?r.__lexicalEditor:null}function Bt(r){return r.isToken()||r.isSegmented()}function nc(r){return r.nodeType===wt}function An(r){let e=r;for(;e!=null;){if(nc(e))return e;e=e.firstChild}return null}function kn(r,e,t){const n=Ot[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 Al(r){return R(r)||jt(r)||Z(r)}function sc(r,e){if(e!=null)return void(r.__key=e);Se(),eu();const t=ie(),n=ht(),s=""+tc++;n._nodeMap.set(s,r),B(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=xl,r.__key=s}function Lt(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 Sn(r){eu();const e=r.getLatest(),t=e.__parent,n=ht(),s=ie(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(u,a,c){let d=u;for(;d!==null;){if(c.has(d))return;const f=a.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,o,i);const l=e.__key;s._dirtyType=xl,B(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function me(r){Se();const e=ie(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=ye(t);n!==null&&n.getWritable()}if(r!==null){const n=ye(r);n!==null&&n.getWritable()}}}function _t(){return Xr()?null:ie()._compositionKey}function ye(r,e){const t=(e||ht())._nodeMap.get(r);return t===void 0?null:t}function kl(r,e){const t=Vn(r,ie());return t!==void 0?ye(t,e):null}function Vn(r,e){return r[`__lexicalKey_${e._key}`]}function sr(r,e){let t=r;for(;t!=null;){const n=kl(t,e);if(n!==null)return n;t=Gr(t)}return null}function Sl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function Gi(r){return r.read(()=>ne().getTextContent())}function ne(){return Tl(ht())}function Tl(r){return r._nodeMap.get("root")}function nt(r){Se();const e=ht();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Yt(r){const e=ie(),t=function(n,s){let o=n;for(;o!=null;){const i=Vn(o,s);if(i!==void 0)return i;o=Gr(o)}return null}(r,e);return t===null?r===e.getRootElement()?ye("root"):null:ye(t)}function Hi(r,e){return e?r.getTextContentSize():0}function Bl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function ci(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Nl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Fl(r){return r.nodeType===wt?r.nodeValue:null}function di(r,e,t){const n=$e(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=Fl(s);const u=sr(s);if(l!==null&&R(u)){if(l===Wn&&t){const a=t.length;l=t,o=a,i=a}l!==null&&fi(u,l,o,i,r)}}}function fi(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]===Wn&&(l=e.slice(0,-1));const u=o.getTextContent();if(s||l!==u){if(l===""){if(me(null),Un||Wr||Zs)o.remove();else{const m=ie();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const a=o.getParent(),c=Yr(),d=o.getTextContentSize(),f=_t(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||P(c)&&(a!==null&&!a.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 p=q();if(!P(p)||t===null||n===null)return void o.setTextContent(l);if(p.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=de(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(R(i)||B(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function Ji(r){return r==="ArrowLeft"}function Qi(r){return r==="ArrowRight"}function wr(r,e){return We?r:e}function Yi(r){return r==="Enter"}function xr(r){return r==="Backspace"}function _r(r){return r==="Delete"}function Xi(r,e,t){return r.toLowerCase()==="a"&&wr(e,t)}function oc(){const r=ne();nt(wl(r.select(0,r.getChildrenSize())))}function Br(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=En(s);return t[e]=o,o}return s}function hi(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 u=l.klass;let a=r.get(u);a===void 0&&(a=new Map,r.set(u,a));const c=a.get(i),d=c==="destroyed"&&s==="created";(c===void 0||d)&&a.set(i,d?"updated":s)}function Zi(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 $r(r,e){const t=r.offset;if(r.type==="element")return Zi(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?Zi(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Ll(r){const e=Hn(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function I(r,e,t){return nu(r,e,t)}function Gn(r){return!De(r)&&!r.isLastChild()&&!r.isInline()}function Tn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&M(75,e),t}function Gr(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Nr(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Hn(r){const e=r._window;return e===null&&M(78),e}function lc(r){let e=r.getParentOrThrow();for(;e!==null;){if(st(e))return e;e=e.getParentOrThrow()}return e}function st(r){return De(r)||B(r)&&r.isShadowRoot()}function ot(r){const e=ie(),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 ps(r,e){!De(r.getParent())||B(e)||Z(e)||M(99)}function gs(r){return(Z(r)||B(r)&&!r.canBeEmpty())&&!r.isInline()}function pi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function uc(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,u=null;if(i===o.getChildrenSize())gs(o.getChildAtIndex(i-1))&&(l=!0);else{const a=o.getChildAtIndex(i);if(a!==null&&gs(a)){const c=a.getPreviousSibling();(c===null||gs(c))&&(l=!0,u=r.getElementByKey(a.__key))}}if(l){const a=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 p=En(h);h=d.blockCursor=p}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(u===null?a.appendChild(n):a.insertBefore(n,u))}}n!==null&&pi(n,r,e)}function $e(r){return Qe?(r||window).getSelection():null}function ac(r){return ft(r)&&r.tagName==="A"}function ft(r){return r.nodeType===1}function eo(r){return r.nodeType===11}function Ts(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 Bn(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(Z(r)&&!r.isInline())return!0;if(!B(r)||st(r))return!1;const e=r.getFirstChild(),t=e===null||jt(e)||R(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function br(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function cc(){return ie()}const to=new WeakMap,dc=new Map;function fc(r){if(!r._readOnly&&r.isEmpty())return dc;r._readOnly||M(192);let e=to.get(r);if(!e){e=new Map,to.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 gi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function mi(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function hc(r){return r.__lexicalUnmanaged===!0}function jl(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(B(i)&&jl(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let Ct,Ce,Ir,Jn,Bs,Ns,Mt,He,Fs,zr,fe="",ve="",Ze=null,Ke="",ct="",Pl=!1,qr=!1,yn=null;function Nn(r,e){const t=Mt.get(r);if(e!==null){const n=Ps(r);n.parentNode===e&&e.removeChild(n)}if(He.has(r)||Ce._keyToDOMMap.delete(r),B(t)){const n=Ln(t,Mt);Ls(n,0,n.length-1,null)}t!==void 0&&hi(zr,Ir,Jn,t,"destroyed")}function Ls(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Nn(o,n)}}function Tt(r,e){r.setProperty("text-align",e)}const pc="40px";function Ol(r,e){const t=Ct.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 Ml(r,e){const t=r.style;e===0?Tt(t,""):e===ti?Tt(t,"left"):e===ri?Tt(t,"center"):e===ni?Tt(t,"right"):e===si?Tt(t,"justify"):e===ii?Tt(t,"start"):e===oi&&Tt(t,"end")}function Fn(r,e){const t=He.get(r);t===void 0&&M(60);const n=t.createDOM(Ct,Ce);if(function(s,o,i){const l=i._keyToDOMMap;(function(u,a,c){u[`__lexicalKey_${a._key}`]=c})(o,i,s),l.set(s,o)}(r,n,Ce),R(t)?n.setAttribute("data-lexical-text","true"):Z(t)&&n.setAttribute("data-lexical-decorator","true"),B(t)){const s=t.__indent,o=t.__size;if(s!==0&&Ol(n,s),o!==0){const l=o-1;(function(u,a,c,d){const f=ve;ve="",js(u,c,0,a,c.getDOMSlot(d)),$l(c,d),ve=f})(Ln(t,He),l,t,n)}const i=t.__format;i!==0&&Ml(n,i),t.isInline()||Rl(null,t,n),Gn(t)&&(fe+=dt,ct+=dt)}else{const s=t.getTextContent();if(Z(t)){const o=t.decorate(Ce,Ct);o!==null&&Il(r,o),n.contentEditable="false"}else R(t)&&(t.isDirectionless()||(ve+=s));fe+=s,ct+=s}return e!==null&&e.insertChild(n),hi(zr,Ir,Jn,t,"created"),n}function js(r,e,t,n,s){const o=fe;fe="";let i=t;for(;i<=n;++i){Fn(r[i],s);const l=He.get(r[i]);l!==null&&R(l)&&(Ze===null&&(Ze=l.getFormat()),Ke===""&&(Ke=l.getStyle()))}Gn(e)&&(fe+=dt),s.element.__lexicalTextContent=fe,fe=o+fe}function ro(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return jt(n)?"line-break":Z(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Rl(r,e,t){const n=ro(r,Mt),s=ro(e,He);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function $l(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==ve||n!==yn){const o=ve==="",i=o?yn:(s=ve,Ua.test(s)?"rtl":Wa.test(s)?"ltr":null);if(i!==n){const l=e.classList,u=Ct.theme;let a=n!==null?u[n]:void 0,c=i!==null?u[i]:void 0;if(a!==void 0){if(typeof a=="string"){const d=En(a);a=u[n]=d}l.remove(...a)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=En(c);c=u[i]=d}c!==void 0&&l.add(...c)}e.dir=i}qr||(r.getWritable().__dir=i)}yn=i,e.__lexicalDirTextContent=ve,e.__lexicalDir=i}var s}function gc(r,e,t){const n=ve;var s;ve="",Ze=null,Ke="",function(o,i,l){const u=fe,a=o.__size,c=i.__size;fe="";const d=l.element;if(a===1&&c===1){const f=o.__first,h=i.__first;if(f===h)Er(f,d);else{const m=Ps(f),_=Fn(h,null);try{d.replaceChild(_,m)}catch(C){if(typeof C=="object"&&C!=null){const y=`${C.toString()} Parent: ${d.tagName}, new child: {tag: ${_.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(y)}throw C}Nn(f,null)}const p=He.get(h);R(p)&&(Ze===null&&(Ze=p.getFormat()),Ke===""&&(Ke=p.getStyle()))}else{const f=Ln(o,Mt),h=Ln(i,He);if(f.length!==a&&M(227),h.length!==c&&M(228),a===0)c!==0&&js(h,i,0,c-1,l);else if(c===0){if(a!==0){const p=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Ls(f,0,a-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,_,C,y,E){const D=C-1,k=y-1;let v,b,w=E.getFirstChild(),S=0,$=0;for(;S<=D&&$<=k;){const j=m[S],L=_[$];if(j===L)w=ms(Er(L,E.element)),S++,$++;else{v===void 0&&(v=new Set(m)),b===void 0&&(b=new Set(_));const G=b.has(j),he=v.has(L);if(G)if(he){const oe=Tn(Ce,L);oe===w?w=ms(Er(L,E.element)):(E.withBefore(w).insertChild(oe),Er(L,E.element)),S++,$++}else Fn(L,E.withBefore(w)),$++;else w=ms(Ps(j)),Nn(j,E.element),S++}const O=He.get(L);O!==null&&R(O)&&(Ze===null&&(Ze=O.getFormat()),Ke===""&&(Ke=O.getStyle()))}const T=S>D,N=$>k;if(T&&!N){const j=_[k+1],L=j===void 0?null:Ce.getElementByKey(j);js(_,p,$,k,E.withBefore(L))}else N&&!T&&Ls(m,S,D,E.element)})(i,f,h,a,c,l)}Gn(i)&&(fe+=dt),d.__lexicalTextContent=fe,fe=u+fe}(r,e,e.getDOMSlot(t)),$l(e,t),ir(s=e)&&Ze!=null&&Ze!==s.__textFormat&&!qr&&(s.setTextFormat(Ze),s.setTextStyle(Ke)),function(o){ir(o)&&Ke!==""&&Ke!==o.__textStyle&&!qr&&o.setTextStyle(Ke)}(e),ve=n}function Ln(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 Er(r,e){const t=Mt.get(r);let n=He.get(r);t!==void 0&&n!==void 0||M(61);const s=Pl||Ns.has(r)||Bs.has(r),o=Tn(Ce,r);if(t===n&&!s){if(B(t)){const i=o.__lexicalTextContent;i!==void 0&&(fe+=i,ct+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(ve+=l)}else{const i=t.getTextContent();R(t)&&!t.isDirectionless()&&(ve+=i),ct+=i,fe+=i}return o}if(t!==n&&s&&hi(zr,Ir,Jn,n,"updated"),n.updateDOM(t,o,Ct)){const i=Fn(r,null);return e===null&&M(62),e.replaceChild(i,o),Nn(r,null),i}if(B(t)&&B(n)){const i=n.__indent;i!==t.__indent&&Ol(o,i);const l=n.__format;l!==t.__format&&Ml(o,l),s&&(gc(t,n,o),De(n)||n.isInline()||Rl(t,n,o)),Gn(n)&&(fe+=dt,ct+=dt)}else{const i=n.getTextContent();if(Z(n)){const l=n.decorate(Ce,Ct);l!==null&&Il(r,l)}else R(n)&&!n.isDirectionless()&&(ve+=i);fe+=i,ct+=i}if(!qr&&De(n)&&n.__cachedText!==ct){const i=n.getWritable();i.__cachedText=ct,n=i}return o}function Il(r,e){let t=Ce._pendingDecorators;const n=Ce._decorators;if(t===null){if(n[r]===e)return;t=Sl(Ce)}t[r]=e}function ms(r){let e=r.nextSibling;return e!==null&&e===Ce._blockCursorElement&&(e=e.nextSibling),e}function mc(r,e,t,n,s,o){fe="",ct="",ve="",Pl=n===nr,yn=null,Ce=t,Ct=t._config,Ir=t._nodes,Jn=Ce._listeners.mutation,Bs=s,Ns=o,Mt=r._nodeMap,He=e._nodeMap,qr=e._readOnly,Fs=new Map(t._keyToDOMMap);const i=new Map;return zr=i,Er("root",null),Ce=void 0,Ir=void 0,Bs=void 0,Ns=void 0,Mt=void 0,He=void 0,Ct=void 0,Fs=void 0,zr=void 0,i}function Ps(r){const e=Fs.get(r);return e===void 0&&M(75,r),e}const at=Object.freeze({}),Os=30,Ms=[["keydown",function(r,e){if(Fr=r.timeStamp,zl=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!I(e,va,r)&&t!=null){if(function(l,u,a,c){return Qi(l)&&!u&&!c&&!a}(t,s,i,o))I(e,ll,r);else if(function(l,u,a,c,d){return Qi(l)&&!c&&!a&&(u||d)}(t,s,n,i,o))I(e,Da,r);else if(function(l,u,a,c){return Ji(l)&&!u&&!c&&!a}(t,s,i,o))I(e,ul,r);else if(function(l,u,a,c,d){return Ji(l)&&!c&&!a&&(u||d)}(t,s,n,i,o))I(e,Ca,r);else if(function(l,u,a){return function(c){return c==="ArrowUp"}(l)&&!u&&!a}(t,s,o))I(e,al,r);else if(function(l,u,a){return function(c){return c==="ArrowDown"}(l)&&!u&&!a}(t,s,o))I(e,cl,r);else if(function(l,u){return Yi(l)&&u}(t,n))Lr=!0,I(e,vn,r);else if(function(l){return l===" "}(t))I(e,wa,r);else if(function(l,u){return We&&u&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),Lr=!0,I(e,Zt,!0);else if(function(l,u){return Yi(l)&&!u}(t,n))Lr=!1,I(e,vn,r);else if(function(l,u,a,c){return We?!u&&!a&&(xr(l)||l.toLowerCase()==="h"&&c):!(c||u||a)&&xr(l)}(t,i,o,s))xr(t)?I(e,dl,r):(r.preventDefault(),I(e,Ft,!0));else if(function(l){return l==="Escape"}(t))I(e,fl,r);else if(function(l,u,a,c,d){return We?!(a||c||d)&&(_r(l)||l.toLowerCase()==="d"&&u):!(u||c||d)&&_r(l)}(t,s,n,i,o))_r(t)?I(e,hl,r):(r.preventDefault(),I(e,Ft,!1));else if(function(l,u,a){return xr(l)&&(We?u:a)}(t,i,s))r.preventDefault(),I(e,Mr,!0);else if(function(l,u,a){return _r(l)&&(We?u:a)}(t,i,s))r.preventDefault(),I(e,Mr,!1);else if(function(l,u){return We&&u&&xr(l)}(t,o))r.preventDefault(),I(e,Rr,!0);else if(function(l,u){return We&&u&&_r(l)}(t,o))r.preventDefault(),I(e,Rr,!1);else if(function(l,u,a,c){return l.toLowerCase()==="b"&&!u&&wr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"bold");else if(function(l,u,a,c){return l.toLowerCase()==="u"&&!u&&wr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"underline");else if(function(l,u,a,c){return l.toLowerCase()==="i"&&!u&&wr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"italic");else if(function(l,u,a,c){return l==="Tab"&&!u&&!a&&!c}(t,i,s,o))I(e,Ea,r);else if(function(l,u,a,c){return l.toLowerCase()==="z"&&!u&&wr(a,c)}(t,n,o,s))r.preventDefault(),I(e,Qs,void 0);else if(function(l,u,a,c){return We?l.toLowerCase()==="z"&&a&&u:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&u}(t,n,o,s))r.preventDefault(),I(e,Ys,void 0);else{const l=e._editorState._selection;l===null||P(l)?!Dt&&Xi(t,o,s)&&(r.preventDefault(),I(e,ks,r)):function(u,a,c,d){return!a&&u.toLowerCase()==="c"&&(We?c:d)}(t,n,o,s)?(r.preventDefault(),I(e,qn,r)):function(u,a,c,d){return!a&&u.toLowerCase()==="x"&&(We?c:d)}(t,n,o,s)?(r.preventDefault(),I(e,Xs,r)):Xi(t,o,s)&&(r.preventDefault(),I(e,ks,r))}(function(l,u,a,c){return l||u||a||c})(s,n,i,o)&&I(e,ja,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&Fe(e,()=>{Z(sr(t))||($s=!0)})}],["compositionstart",function(r,e){Fe(e,()=>{const t=q();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();me(n.key),(r.timeStamp<Fr+Os||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||R(s)&&s.getStyle()!==t.style)&&I(e,er,qa)}})}],["compositionend",function(r,e){Dt?vr=!0:Fe(e,()=>{ys(e,r.data)})}],["input",function(r,e){r.stopPropagation(),Fe(e,()=>{const t=q(),n=r.data,s=Kl(r);if(n!=null&&P(t)&&Wl(t,s,n,r.timeStamp,!1)){vr&&(ys(e,n),vr=!1);const o=t.anchor.getNode(),i=$e(e._window);if(i===null)return;const l=t.isBackward(),u=l?t.anchor.offset:t.focus.offset,a=l?t.focus.offset:t.anchor.offset;Dn&&!t.isCollapsed()&&R(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,u)+n+o.getTextContent().slice(u+a)===Fl(i.anchorNode)||I(e,er,n);const c=n.length;Dt&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),Un||Wr||Zs||!e.isComposing()||(Fr=0,me(null))}else di(!1,e,n!==null?n:void 0),vr&&(ys(e,n||void 0),vr=!1);Se(),Dl(ie())}),Qt=null}],["click",function(r,e){Fe(e,()=>{const t=q(),n=$e(e._window),s=Yr();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!De(i)&&ne().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(B(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===Kr||i===wt)&&nt(xi(s,n,e,r))}}}I(e,ol,r)})}],["cut",at],["copy",at],["dragstart",at],["dragover",at],["dragend",at],["paste",at],["focus",at],["blur",at],["drop",at]];Dn&&Ms.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=Kl(t);s==="deleteCompositionText"||Dt&&Ll(n)||s!=="insertCompositionText"&&Fe(n,()=>{const i=q();if(s==="deleteContentBackward"){if(i===null){const h=Yr();if(!P(h))return;nt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,zl==="MediaLast"&&l<Fr+Os&&n.isComposing()&&h){if(me(null),Fr=0,setTimeout(()=>{Fe(n,()=>{me(null)})},Os),P(i)){const p=i.anchor.getNode();p.markDirty(),i.format=p.getFormat(),R(p)||M(142),i.style=p.getStyle()}}else{me(null),t.preventDefault();const p=i.anchor.getNode(),m=p.getTextContent(),_=p.canInsertTextAfter(),C=i.anchor.offset===0&&i.focus.offset===m.length;Ma&&h&&!C&&_||I(n,Ft,!0)}return}}var l;if(!P(i))return;const u=t.data;Qt!==null&&di(!1,n,Qt),i.dirty&&Qt===null||!i.isCollapsed()||De(i.anchor.getNode())||o===null||i.applyDOMRange(o),Qt=null;const a=i.anchor,c=i.focus,d=a.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":I(n,er,t);break;case"insertFromComposition":me(null),I(n,er,t);break;case"insertLineBreak":me(null),I(n,Zt,!1);break;case"insertParagraph":me(null),Lr&&!Wr?(Lr=!1,I(n,Zt,!1)):I(n,Or,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":I(n,zn,t);break;case"deleteByComposition":(function(h,p){return h!==p||B(h)||B(p)||!h.isToken()||!p.isToken()})(d,f)&&I(n,As,t);break;case"deleteByDrag":case"deleteByCut":I(n,As,t);break;case"deleteContent":I(n,Ft,!1);break;case"deleteWordBackward":I(n,Mr,!0);break;case"deleteWordForward":I(n,Mr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":I(n,Rr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":I(n,Rr,!1);break;case"formatStrikeThrough":I(n,Ge,"strikethrough");break;case"formatBold":I(n,Ge,"bold");break;case"formatItalic":I(n,Ge,"italic");break;case"formatUnderline":I(n,Ge,"underline");break;case"historyUndo":I(n,Qs,void 0);break;case"historyRedo":I(n,Ys,void 0)}else{if(u===`
|
|
64
|
-
`)t.preventDefault(),
|
|
65
|
-
`){const n=
|
|
66
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&
|
|
63
|
+
`,qu=zt?" ":es,Cl="֑-߿יִ-﷽ﹰ-ﻼ",wl="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Uu=new RegExp("^[^"+wl+"]*["+Cl+"]"),Wu=new RegExp("^[^"+Cl+"]*["+wl+"]"),tr={bold:1,code:16,highlight:ai,italic:2,strikethrough:Ln,subscript:32,superscript:64,underline:jn},Gu={directionless:1,unmergeable:2},Gi={center:ci,end:pi,justify:fi,left:ui,right:di,start:hi},Ku={[ci]:"center",[pi]:"end",[fi]:"justify",[ui]:"left",[di]:"right",[hi]:"start"},Vu={normal:0,segmented:2,token:1},Hu={[Mu]:"normal",[Iu]:"segmented",[$u]:"token"};function Ju(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $=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 Rn(...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 Ps=!1,gi=0;function Yu(r){gi=r.timeStamp}function vs(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&rs(r,t)!==void 0}function Xu(r,e,t){const n=lt(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&_i(e,i,s,o,!1)}function Zu(r,e,t){if(M(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===Ut&&t.isAttached()}function ec(r,e,t,n){for(let s=r;s&&!hc(s);s=an(s)){const o=rs(s,e);if(o!==void 0){const i=ze(o,t);if(i)return de(i)?void 0:[s,i]}else if(s===n)return[n,Fl(t)]}}function Dl(r,e,t){Ps=!0;const n=performance.now()-gi>Qu;try{st(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],p=h.type,m=h.target,b=ec(m,r,l,i);if(!b)continue;const[D,y]=b;if(p==="characterData")n&&q(y)&&Zu(s,m,y)&&Xu(m,y,r);else if(p==="childList"){u=!0;const A=h.addedNodes;for(let C=0;C<A.length;C++){const _=A[C],E=Bl(_),k=_.parentNode;if(k!=null&&_!==a&&E===null&&!vs(_,k,r)){if(zt){const I=_.innerText||_.nodeValue;I&&(c+=I)}k.removeChild(_)}}const v=h.removedNodes,S=v.length;if(S>0){let C=0;for(let _=0;_<S;_++){const E=v[_];(vs(E,m,r)||a===E)&&(m.appendChild(E),C++)}S!==C&&o.set(D,y)}}}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],p=h.addedNodes,m=h.target;for(let b=0;b<p.length;b++){const D=p[b],y=D.parentNode;y==null||D.nodeName!=="BR"||vs(D,m,r)||y.removeChild(D)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,Ct(s)),zt&&Pl(r)&&s.insertRawText(c))})}finally{Ps=!1}}function Al(r){const e=r._observer;e!==null&&Dl(r,e.takeRecords(),e)}function El(r){(function(e){gi===0&&ss(e).addEventListener("textInput",Yu,!0)})(r),r._observer=new MutationObserver((e,t)=>{Dl(r,e,t)})}function Ki(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 Vi(r,e){const t=r.mergeWithSibling(e),n=Ce()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Hi(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&q(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ki(e,n)){n=Vi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&q(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ki(n,t)){n=Vi(n,t);break}break}t.remove()}}else n.remove()}function Sl(r){return Ji(r.anchor),Ji(r.focus),r}function Ji(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),q(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 mi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return de(vr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ts(e)==null)}function ln(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!mi(e)&&kl(e)===r}catch{return!1}}function yi(r){return r instanceof us}function kl(r){let e=r;for(;e!=null;){const t=ts(e);if(yi(t))return t;e=an(e)}return null}function ts(r){return r?r.__lexicalEditor:null}function Jt(r){return r.isToken()||r.isSegmented()}function nc(r){return r.nodeType===Ut}function Pn(r){let e=r;for(;e!=null;){if(nc(e))return e;e=e.firstChild}return null}function On(r,e,t){const n=tr[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 Tl(r){return q(r)||Zt(r)||de(r)}function sc(r,e){if(e!=null)return void(r.__key=e);Ze(),na();const t=Ce(),n=Ft(),s=""+tc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=vl,r.__key=s}function Xt(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 Mn(r){na();const e=r.getLatest(),t=e.__parent,n=Ft(),s=Ce(),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=vl,F(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function Me(r){Ze();const e=Ce(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=ze(t);n!==null&&n.getWritable()}if(r!==null){const n=ze(r);n!==null&&n.getWritable()}}}function Mt(){return hn()?null:Ce()._compositionKey}function ze(r,e){const t=(e||Ft())._nodeMap.get(r);return t===void 0?null:t}function Bl(r,e){const t=rs(r,Ce());return t!==void 0?ze(t,e):null}function rs(r,e){return r[`__lexicalKey_${e._key}`]}function vr(r,e){let t=r;for(;t!=null;){const n=Bl(t,e);if(n!==null)return n;t=an(t)}return null}function Nl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function Qi(r){return r.read(()=>_e().getTextContent())}function _e(){return Fl(Ft())}function Fl(r){return r._nodeMap.get("root")}function Ct(r){Ze();const e=Ft();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function pr(r){const e=Ce(),t=function(n,s){let o=n;for(;o!=null;){const i=rs(o,s);if(i!==void 0)return i;o=an(o)}return null}(r,e);return t===null?r===e.getRootElement()?ze("root"):null:ze(t)}function Yi(r,e){return e?r.getTextContentSize():0}function Ll(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function xi(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function jl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Rl(r){return r.nodeType===Ut?r.nodeValue:null}function bi(r,e,t){const n=lt(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=Rl(s);const a=vr(s);if(l!==null&&q(a)){if(l===es&&t){const u=t.length;l=t,o=u,i=u}l!==null&&_i(a,l,o,i,r)}}}function _i(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]===es&&(l=e.slice(0,-1));const a=o.getTextContent();if(s||l!==a){if(l===""){if(Me(null),Zn||sn||li)o.remove();else{const m=Ce();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const u=o.getParent(),c=fn(),d=o.getTextContentSize(),f=Mt(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||M(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 p=V();if(!M(p)||t===null||n===null)return void o.setTextContent(l);if(p.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=Te(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(q(i)||F(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function Xi(r){return r==="ArrowLeft"}function Zi(r){return r==="ArrowRight"}function Mr(r,e){return ut?r:e}function eo(r){return r==="Enter"}function Fr(r){return r==="Backspace"}function Lr(r){return r==="Delete"}function to(r,e,t){return r.toLowerCase()==="a"&&Mr(e,t)}function oc(){const r=_e();Ct(Sl(r.select(0,r.getChildrenSize())))}function Wr(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=Rn(s);return t[e]=o,o}return s}function vi(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&$(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 ro(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 Zr(r,e){const t=r.offset;if(r.type==="element")return ro(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?ro(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Pl(r){const e=ss(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return oa(r,e,t)}function ns(r){return!Ke(r)&&!r.isLastChild()&&!r.isInline()}function $n(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&$(75,e),t}function an(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Gr(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function ss(r){const e=r._window;return e===null&&$(78),e}function lc(r){let e=r.getParentOrThrow();for(;e!==null;){if(wt(e))return e;e=e.getParentOrThrow()}return e}function wt(r){return Ke(r)||F(r)&&r.isShadowRoot()}function At(r){const e=Ce(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&$(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||$(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||$(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&$(203,r.constructor.name,t,l.name,l.getType()),i}return r}function Cs(r,e){!Ke(r.getParent())||F(e)||de(e)||$(99)}function ws(r){return(de(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Ci(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(M(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())ws(o.getChildAtIndex(i-1))&&(l=!0);else{const u=o.getChildAtIndex(i);if(u!==null&&ws(u)){const c=u.getPreviousSibling();(c===null||ws(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 p=Rn(h);h=d.blockCursor=p}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&&Ci(n,r,e)}function lt(r){return gt?(r||window).getSelection():null}function uc(r){return Nt(r)&&r.tagName==="A"}function Nt(r){return r.nodeType===1}function no(r){return r.nodeType===11}function Os(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 In(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 Pt(r){if(de(r)&&!r.isInline())return!0;if(!F(r)||wt(r))return!1;const e=r.getFirstChild(),t=e===null||Zt(e)||q(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function jr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function cc(){return Ce()}const so=new WeakMap,dc=new Map;function fc(r){if(!r._readOnly&&r.isEmpty())return dc;r._readOnly||$(192);let e=so.get(r);if(!e){e=new Map,so.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 wi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function Di(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function hc(r){return r.__lexicalUnmanaged===!0}function Ol(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(F(i)&&Ol(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let qt,Ve,en,is,Ms,$s,rr,ht,Is,tn,Be="",Ge="",xt=null,ct="",Tt="",Ml=!1,rn=!1,Sn=null;function zn(r,e){const t=rr.get(r);if(e!==null){const n=Us(r);n.parentNode===e&&e.removeChild(n)}if(ht.has(r)||Ve._keyToDOMMap.delete(r),F(t)){const n=Un(t,rr);zs(n,0,n.length-1,null)}t!==void 0&&vi(tn,en,is,t,"destroyed")}function zs(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&zn(o,n)}}function Ht(r,e){r.setProperty("text-align",e)}const pc="40px";function $l(r,e){const t=qt.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 Il(r,e){const t=r.style;e===0?Ht(t,""):e===ui?Ht(t,"left"):e===ci?Ht(t,"center"):e===di?Ht(t,"right"):e===fi?Ht(t,"justify"):e===hi?Ht(t,"start"):e===pi&&Ht(t,"end")}function qn(r,e){const t=ht.get(r);t===void 0&&$(60);const n=t.createDOM(qt,Ve);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,Ve),q(t)?n.setAttribute("data-lexical-text","true"):de(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,o=t.__size;if(s!==0&&$l(n,s),o!==0){const l=o-1;(function(a,u,c,d){const f=Ge;Ge="",qs(a,c,0,u,c.getDOMSlot(d)),ql(c,d),Ge=f})(Un(t,ht),l,t,n)}const i=t.__format;i!==0&&Il(n,i),t.isInline()||zl(null,t,n),ns(t)&&(Be+=Bt,Tt+=Bt)}else{const s=t.getTextContent();if(de(t)){const o=t.decorate(Ve,qt);o!==null&&Ul(r,o),n.contentEditable="false"}else q(t)&&(t.isDirectionless()||(Ge+=s));Be+=s,Tt+=s}return e!==null&&e.insertChild(n),vi(tn,en,is,t,"created"),n}function qs(r,e,t,n,s){const o=Be;Be="";let i=t;for(;i<=n;++i){qn(r[i],s);const l=ht.get(r[i]);l!==null&&q(l)&&(xt===null&&(xt=l.getFormat()),ct===""&&(ct=l.getStyle()))}ns(e)&&(Be+=Bt),s.element.__lexicalTextContent=Be,Be=o+Be}function io(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return Zt(n)?"line-break":de(n)&&n.isInline()?"decorator":null}return"empty"}return null}function zl(r,e,t){const n=io(r,rr),s=io(e,ht);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function ql(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==Ge||n!==Sn){const o=Ge==="",i=o?Sn:(s=Ge,Uu.test(s)?"rtl":Wu.test(s)?"ltr":null);if(i!==n){const l=e.classList,a=qt.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=Rn(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=Rn(c);c=a[i]=d}c!==void 0&&l.add(...c)}e.dir=i}rn||(r.getWritable().__dir=i)}Sn=i,e.__lexicalDirTextContent=Ge,e.__lexicalDir=i}var s}function gc(r,e,t){const n=Ge;var s;Ge="",xt=null,ct="",function(o,i,l){const a=Be,u=o.__size,c=i.__size;Be="";const d=l.element;if(u===1&&c===1){const f=o.__first,h=i.__first;if(f===h)$r(f,d);else{const m=Us(f),b=qn(h,null);try{d.replaceChild(b,m)}catch(D){if(typeof D=="object"&&D!=null){const y=`${D.toString()} Parent: ${d.tagName}, new child: {tag: ${b.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(y)}throw D}zn(f,null)}const p=ht.get(h);q(p)&&(xt===null&&(xt=p.getFormat()),ct===""&&(ct=p.getStyle()))}else{const f=Un(o,rr),h=Un(i,ht);if(f.length!==u&&$(227),h.length!==c&&$(228),u===0)c!==0&&qs(h,i,0,c-1,l);else if(c===0){if(u!==0){const p=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;zs(f,0,u-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,b,D,y,A){const v=D-1,S=y-1;let C,_,E=A.getFirstChild(),k=0,I=0;for(;k<=v&&I<=S;){const j=m[k],L=b[I];if(j===L)E=Ds($r(L,A.element)),k++,I++;else{C===void 0&&(C=new Set(m)),_===void 0&&(_=new Set(b));const ee=_.has(j),ye=C.has(L);if(ee)if(ye){const me=$n(Ve,L);me===E?E=Ds($r(L,A.element)):(A.withBefore(E).insertChild(me),$r(L,A.element)),k++,I++}else qn(L,A.withBefore(E)),I++;else E=Ds(Us(j)),zn(j,A.element),k++}const R=ht.get(L);R!==null&&q(R)&&(xt===null&&(xt=R.getFormat()),ct===""&&(ct=R.getStyle()))}const B=k>v,N=I>S;if(B&&!N){const j=b[S+1],L=j===void 0?null:Ve.getElementByKey(j);qs(b,p,I,S,A.withBefore(L))}else N&&!B&&zs(m,k,v,A.element)})(i,f,h,u,c,l)}ns(i)&&(Be+=Bt),d.__lexicalTextContent=Be,Be=a+Be}(r,e,e.getDOMSlot(t)),ql(e,t),Cr(s=e)&&xt!=null&&xt!==s.__textFormat&&!rn&&(s.setTextFormat(xt),s.setTextStyle(ct)),function(o){Cr(o)&&ct!==""&&ct!==o.__textStyle&&!rn&&o.setTextStyle(ct)}(e),Ge=n}function Un(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&$(101),t.push(n),n=s.__next}return t}function $r(r,e){const t=rr.get(r);let n=ht.get(r);t!==void 0&&n!==void 0||$(61);const s=Ml||$s.has(r)||Ms.has(r),o=$n(Ve,r);if(t===n&&!s){if(F(t)){const i=o.__lexicalTextContent;i!==void 0&&(Be+=i,Tt+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(Ge+=l)}else{const i=t.getTextContent();q(t)&&!t.isDirectionless()&&(Ge+=i),Tt+=i,Be+=i}return o}if(t!==n&&s&&vi(tn,en,is,n,"updated"),n.updateDOM(t,o,qt)){const i=qn(r,null);return e===null&&$(62),e.replaceChild(i,o),zn(r,null),i}if(F(t)&&F(n)){const i=n.__indent;i!==t.__indent&&$l(o,i);const l=n.__format;l!==t.__format&&Il(o,l),s&&(gc(t,n,o),Ke(n)||n.isInline()||zl(t,n,o)),ns(n)&&(Be+=Bt,Tt+=Bt)}else{const i=n.getTextContent();if(de(n)){const l=n.decorate(Ve,qt);l!==null&&Ul(r,l)}else q(n)&&!n.isDirectionless()&&(Ge+=i);Be+=i,Tt+=i}if(!rn&&Ke(n)&&n.__cachedText!==Tt){const i=n.getWritable();i.__cachedText=Tt,n=i}return o}function Ul(r,e){let t=Ve._pendingDecorators;const n=Ve._decorators;if(t===null){if(n[r]===e)return;t=Nl(Ve)}t[r]=e}function Ds(r){let e=r.nextSibling;return e!==null&&e===Ve._blockCursorElement&&(e=e.nextSibling),e}function mc(r,e,t,n,s,o){Be="",Tt="",Ge="",Ml=n===_r,Sn=null,Ve=t,qt=t._config,en=t._nodes,is=Ve._listeners.mutation,Ms=s,$s=o,rr=r._nodeMap,ht=e._nodeMap,rn=e._readOnly,Is=new Map(t._keyToDOMMap);const i=new Map;return tn=i,$r("root",null),Ve=void 0,en=void 0,Ms=void 0,$s=void 0,rr=void 0,ht=void 0,qt=void 0,Is=void 0,tn=void 0,i}function Us(r){const e=Is.get(r);return e===void 0&&$(75,r),e}const kt=Object.freeze({}),Ws=30,Gs=[["keydown",function(r,e){if(Kr=r.timeStamp,Wl=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 Zi(l)&&!a&&!c&&!u}(t,s,i,o))G(e,cl,r);else if(function(l,a,u,c,d){return Zi(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,Cu,r);else if(function(l,a,u,c){return Xi(l)&&!a&&!c&&!u}(t,s,i,o))G(e,dl,r);else if(function(l,a,u,c,d){return Xi(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,fl,r);else if(function(l,a,u){return function(c){return c==="ArrowDown"}(l)&&!a&&!u}(t,s,o))G(e,hl,r);else if(function(l,a){return eo(l)&&a}(t,n))Vr=!0,G(e,Nn,r);else if(function(l){return l===" "}(t))G(e,Du,r);else if(function(l,a){return ut&&a&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),Vr=!0,G(e,mr,!0);else if(function(l,a){return eo(l)&&!a}(t,n))Vr=!1,G(e,Nn,r);else if(function(l,a,u,c){return ut?!a&&!u&&(Fr(l)||l.toLowerCase()==="h"&&c):!(c||a||u)&&Fr(l)}(t,i,o,s))Fr(t)?G(e,pl,r):(r.preventDefault(),G(e,Yt,!0));else if(function(l){return l==="Escape"}(t))G(e,gl,r);else if(function(l,a,u,c,d){return ut?!(u||c||d)&&(Lr(l)||l.toLowerCase()==="d"&&a):!(a||c||d)&&Lr(l)}(t,s,n,i,o))Lr(t)?G(e,ml,r):(r.preventDefault(),G(e,Yt,!1));else if(function(l,a,u){return Fr(l)&&(ut?a:u)}(t,i,s))r.preventDefault(),G(e,Yr,!0);else if(function(l,a,u){return Lr(l)&&(ut?a:u)}(t,i,s))r.preventDefault(),G(e,Yr,!1);else if(function(l,a){return ut&&a&&Fr(l)}(t,o))r.preventDefault(),G(e,Xr,!0);else if(function(l,a){return ut&&a&&Lr(l)}(t,o))r.preventDefault(),G(e,Xr,!1);else if(function(l,a,u,c){return l.toLowerCase()==="b"&&!a&&Mr(u,c)}(t,i,o,s))r.preventDefault(),G(e,ft,"bold");else if(function(l,a,u,c){return l.toLowerCase()==="u"&&!a&&Mr(u,c)}(t,i,o,s))r.preventDefault(),G(e,ft,"underline");else if(function(l,a,u,c){return l.toLowerCase()==="i"&&!a&&Mr(u,c)}(t,i,o,s))r.preventDefault(),G(e,ft,"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&&Mr(u,c)}(t,n,o,s))r.preventDefault(),G(e,si,void 0);else if(function(l,a,u,c){return ut?l.toLowerCase()==="z"&&u&&a:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&a}(t,n,o,s))r.preventDefault(),G(e,ii,void 0);else{const l=e._editorState._selection;l===null||M(l)?!zt&&to(t,o,s)&&(r.preventDefault(),G(e,Rs,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="c"&&(ut?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,Xn,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="x"&&(ut?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,oi,r)):to(t,o,s)&&(r.preventDefault(),G(e,Rs,r))}(function(l,a,u,c){return l||a||u||c})(s,n,i,o)&&G(e,ju,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&st(e,()=>{de(vr(t))||(Vs=!0)})}],["compositionstart",function(r,e){st(e,()=>{const t=V();if(M(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Me(n.key),(r.timeStamp<Kr+Ws||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||q(s)&&s.getStyle()!==t.style)&&G(e,yr,qu)}})}],["compositionend",function(r,e){zt?Rr=!0:st(e,()=>{As(e,r.data)})}],["input",function(r,e){r.stopPropagation(),st(e,()=>{const t=V(),n=r.data,s=Hl(r);if(n!=null&&M(t)&&Vl(t,s,n,r.timeStamp,!1)){Rr&&(As(e,n),Rr=!1);const o=t.anchor.getNode(),i=lt(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;Fn&&!t.isCollapsed()&&q(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,a)+n+o.getTextContent().slice(a+u)===Rl(i.anchorNode)||G(e,yr,n);const c=n.length;zt&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),Zn||sn||li||!e.isComposing()||(Kr=0,Me(null))}else bi(!1,e,n!==null?n:void 0),Rr&&(As(e,n||void 0),Rr=!1);Ze(),Al(Ce())}),hr=null}],["click",function(r,e){st(e,()=>{const t=V(),n=lt(e._window),s=fn();if(n){if(M(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ke(i)&&_e().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===on||i===Ut)&&Ct(Ei(s,n,e,r))}}}G(e,ul,r)})}],["cut",kt],["copy",kt],["dragstart",kt],["dragover",kt],["dragend",kt],["paste",kt],["focus",kt],["blur",kt],["drop",kt]];Fn&&Gs.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=Hl(t);s==="deleteCompositionText"||zt&&Pl(n)||s!=="insertCompositionText"&&st(n,()=>{const i=V();if(s==="deleteContentBackward"){if(i===null){const h=fn();if(!M(h))return;Ct(h.clone())}if(M(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Wl==="MediaLast"&&l<Kr+Ws&&n.isComposing()&&h){if(Me(null),Kr=0,setTimeout(()=>{st(n,()=>{Me(null)})},Ws),M(i)){const p=i.anchor.getNode();p.markDirty(),i.format=p.getFormat(),q(p)||$(142),i.style=p.getStyle()}}else{Me(null),t.preventDefault();const p=i.anchor.getNode(),m=p.getTextContent(),b=p.canInsertTextAfter(),D=i.anchor.offset===0&&i.focus.offset===m.length;Ou&&h&&!D&&b||G(n,Yt,!0)}return}}var l;if(!M(i))return;const a=t.data;hr!==null&&bi(!1,n,hr),i.dirty&&hr===null||!i.isCollapsed()||Ke(i.anchor.getNode())||o===null||i.applyDOMRange(o),hr=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,yr,t);break;case"insertFromComposition":Me(null),G(n,yr,t);break;case"insertLineBreak":Me(null),G(n,mr,!1);break;case"insertParagraph":Me(null),Vr&&!sn?(Vr=!1,G(n,mr,!1)):G(n,Qr,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,Yn,t);break;case"deleteByComposition":(function(h,p){return h!==p||F(h)||F(p)||!h.isToken()||!p.isToken()})(d,f)&&G(n,js,t);break;case"deleteByDrag":case"deleteByCut":G(n,js,t);break;case"deleteContent":G(n,Yt,!1);break;case"deleteWordBackward":G(n,Yr,!0);break;case"deleteWordForward":G(n,Yr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,Xr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,Xr,!1);break;case"formatStrikeThrough":G(n,ft,"strikethrough");break;case"formatBold":G(n,ft,"bold");break;case"formatItalic":G(n,ft,"italic");break;case"formatUnderline":G(n,ft,"underline");break;case"historyUndo":G(n,si,void 0);break;case"historyRedo":G(n,ii,void 0)}else{if(a===`
|
|
64
|
+
`)t.preventDefault(),G(n,mr,!1);else if(a===Bt)t.preventDefault(),G(n,Qr,void 0);else if(a==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else a!=null&&Vl(i,o,a,t.timeStamp,!0)?(t.preventDefault(),G(n,yr,a)):hr=a;Gl=t.timeStamp}})}(r,e)]);let Kr=0,Wl=null,Gl=0,hr=null;const Wn=new WeakMap;let Ks=!1,Vs=!1,Vr=!1,Rr=!1,Kl=[0,"",0,"root",0];function Vl(r,e,t,n,s){const o=r.anchor,i=r.focus,l=o.getNode(),a=Ce(),u=lt(a._window),c=u!==null?u.anchorNode:null,d=o.key,f=a.getElementByKey(d),h=t.length;return d!==i.key||!q(l)||(!s&&(!Fn||Gl<n+50)||l.isDirty()&&h<2||Ll(t))&&o.offset!==i.offset&&!l.isComposing()||Jt(l)||l.isDirty()&&h>1||(s||!Fn)&&f!==null&&!l.isComposing()&&c!==Pn(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 oo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===Ut&&e!==0&&e!==r.nodeValue.length}function lo(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;Ks&&(Ks=!1,oo(n,s)&&oo(o,i))||st(e,()=>{if(!t)return void Ct(null);if(!ln(e,n,o))return;const l=V();if(M(l)){const a=l.anchor,u=a.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=ss(e).event,d=c?c.timeStamp:performance.now(),[f,h,p,m,b]=Kl,D=_e(),y=e.isComposing()===!1&&D.getTextContent()==="";if(d<b+200&&a.offset===p&&a.key===m)l.format=f,l.style=h;else if(a.type==="text")q(u)||$(141),l.format=u.getFormat(),l.style=u.getStyle();else if(a.type==="element"&&!y){const A=a.getNode();l.style="",A instanceof Dr&&A.getChildrenSize()===0?(l.format=A.getTextFormat(),l.style=A.getTextStyle()):l.format=0}}else{const c=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,p=l.isBackward(),m=p?i:s,b=p?s:i,D=p?d:c,y=p?c:d;let A=zu,v=!1;for(let S=0;S<h;S++){const C=f[S],_=C.getTextContentSize();if(q(C)&&_!==0&&!(S===0&&C.__key===D&&m===_||S===h-1&&C.__key===y&&b===0)&&(v=!0,A&=C.getFormat(),A===0))break}l.format=v?A:0}}G(e,ni,void 0)})}function Hl(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function As(r,e){const t=r._compositionKey;if(Me(null),t!==null&&e!=null){if(e===""){const n=ze(t),s=Pn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&q(n)&&_i(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
65
|
+
`){const n=V();if(M(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,Nn,null)}}}bi(!0,r,e)}function Jl(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const xr=new Map;function Ql(r){const e=r.target,t=lt(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=kl(t.anchorNode);if(n===null)return;Vs&&(Vs=!1,st(n,()=>{const u=fn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==on&&d!==Ut||Ct(Ei(u,t,n,r))}));const s=xi(n),o=s[s.length-1],i=o._key,l=xr.get(i),a=l||o;a!==n&&lo(t,a,!1),lo(t,n,!0),n!==o?xr.set(i,n):l&&xr.delete(i)}function ao(r){r._lexicalHandled=!0}function uo(r){return r._lexicalHandled===!0}function yc(r){const e=r.ownerDocument,t=Wn.get(e);t===void 0&&$(162);const n=t-1;n>=0||$(164),Wn.set(e,n),n===0&&e.removeEventListener("selectionchange",Ql);const s=ts(r);yi(s)?(function(i){if(i._parentEditor!==null){const l=xi(i),a=l[l.length-1]._key;xr.get(a)===i&&xr.delete(a)}else xr.delete(i._key)}(s),r.__lexicalEditor=null):s&&$(198);const o=Jl(r);for(let i=0;i<o.length;i++)o[i]();r.__lexicalEventHandles=[]}function Hs(r,e,t){Ze();const n=r.__key,s=r.getParent();if(s===null)return;const o=function(l){const a=V();if(!M(a)||!F(l))return a;const{anchor:u,focus:c}=a,d=u.getNode(),f=c.getNode();return Gr(d,l)&&u.set(l.__key,0,"element"),Gr(f,l)&&c.set(l.__key,0,"element"),a}(r);let i=!1;if(M(o)&&e){const l=o.anchor,a=o.focus;l.key===n&&(Kn(l,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0),a.key===n&&(Kn(a,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0)}else bt(o)&&e&&r.isSelected()&&r.selectPrevious();if(M(o)&&e&&!i){const l=r.getIndexWithinParent();Xt(r),Gn(o,s,l,-1)}else Xt(r);t||wt(s)||s.canBeEmpty()||!s.isEmpty()||Hs(s,e),e&&Ke(s)&&s.isEmpty()&&s.selectEnd()}class os{static getType(){$(64,this.name)}static clone(e){$(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(){$(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=ze(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(q(this))return n;if(M(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(de(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:ze(e)}getParentOrThrow(){const e=this.getParent();return e===null&&$(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(wt(t))return F(e)||e===this&&de(e)||$(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&$(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:ze(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:ze(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&&$(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=Ce()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=ze(this.__key);return e===null&&$(113),e}getWritable(){Ze();const e=Ft(),t=Ce(),n=e._nodeMap,s=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,l=V();if(l!==null&&l.setCachedNodes(null),i.has(s))return Mn(o),o;const a=wi(o);return i.add(s),Mn(a),n.set(s,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){$(70)}updateDOM(e,t,n){$(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){$(72)}static importJSON(e){$(18,this.name)}static transform(){return null}remove(e){Hs(this,!0,e)}replace(e,t){Ze();let n=V();n!==null&&(n=n.clone()),Cs(this,e);const s=this.getLatest(),o=this.__key,i=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),u=a.__size;Xt(l);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,p=s.__parent;if(Hs(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=p,a.__size=u,t&&(F(this)&&F(l)||$(139),this.getChildren().forEach(m=>{l.append(m)})),M(n)){Ct(n);const m=n.anchor,b=n.focus;m.key===o&&po(m,l),b.key===o&&po(b,l)}return Mt()===o&&Me(i),l}insertAfter(e,t=!0){Ze(),Cs(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(Xt(s),M(i)){const p=o.__key,m=i.anchor,b=i.focus;l=m.type==="element"&&m.key===p&&m.offset===h+1,a=b.type==="element"&&b.key===p&&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&&M(i)){const h=this.getIndexWithinParent();Gn(i,c,h+1);const p=c.__key;l&&i.anchor.set(p,h+2,"element"),a&&i.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){Ze(),Cs(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.__key;Xt(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&&M(c)&&Gn(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return Ee()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Ze();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!q(n)){const o=n.getIndexWithinParent()+1;return s.select(o,o)}return n.select(e,t)}selectNext(e,t){Ze();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!q(n)){const o=n.getIndexWithinParent();return s.select(o,o)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class un extends os{static getType(){return"linebreak"}static clone(e){return new un(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&&In(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&_n(s)){const o=n.lastChild;if(o===t||o.previousSibling===t&&_n(o))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&In(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&_n(s))return!1;const o=n.lastChild;if(o===t||o.previousSibling===t&&_n(o))return!0}return!1}(e)?null:{conversion:xc,priority:0}}}static importJSON(e){return nr()}exportJSON(){return{type:"linebreak",version:1}}}function xc(r){return{node:nr()}}function nr(){return At(new un)}function Zt(r){return r instanceof un}function _n(r){return r.nodeType===Ut&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function Es(r,e){return 16&e?"code":e&ai?"mark":32&e?"sub":64&e?"sup":null}function Ss(r,e){return 1&e?"strong":2&e?"em":"span"}function Yl(r,e,t,n,s){const o=n.classList;let i=Wr(s,"base");i!==void 0&&o.add(...i),i=Wr(s,"underlineStrikethrough");let l=!1;const a=e&jn&&e&Ln;i!==void 0&&(t&jn&&t&Ln?(l=!0,a||o.add(...i)):a&&o.remove(...i));for(const u in tr){const c=tr[u];if(i=Wr(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 Xl(r,e,t){const n=e.firstChild,s=t.isComposing(),o=r+(s?es:"");if(n==null)e.textContent=o;else{const i=n.nodeValue;if(i!==o)if(s||zt){const[l,a,u]=function(c,d){const f=c.length,h=d.length;let p=0,m=0;for(;p<f&&p<h&&c[p]===d[p];)p++;for(;m+p<f&&m+p<h&&c[f-m-1]===d[h-m-1];)m++;return[p,f-p-m,d.slice(p,h-m)]}(i,o);a!==0&&n.deleteData(l,a),n.insertData(l,u)}else n.nodeValue=o}}function co(r,e,t,n,s,o){Xl(s,r,e);const i=o.theme.text;i!==void 0&&Yl(0,0,n,r,i)}function vn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class wr extends os{static getType(){return"text"}static clone(e){return new wr(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===Mt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=tr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return On(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=Es(0,n),o=Ss(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)),co(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=Es(0,o),a=Es(0,i),u=Ss(0,o),c=Ss(0,i);if((l===null?u:l)!==(a===null?c:a))return!0;if(l===a&&u!==c){const m=t.firstChild;m==null&&$(48);const b=document.createElement(c);return co(b,this,0,i,s,n),t.replaceChild(b,m),!1}let d=t;a!==null&&l!==null&&(d=t.firstChild,d==null&&$(49)),Xl(s,d,this);const f=n.theme.text;f!==void 0&&o!==i&&Yl(0,o,i,d,f);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Cc,priority:0}),b:()=>({conversion:_c,priority:0}),code:()=>({conversion:Rt,priority:0}),em:()=>({conversion:Rt,priority:0}),i:()=>({conversion:Rt,priority:0}),s:()=>({conversion:Rt,priority:0}),span:()=>({conversion:bc,priority:0}),strong:()=>({conversion:Rt,priority:0}),sub:()=>({conversion:Rt,priority:0}),sup:()=>({conversion:Rt,priority:0}),u:()=>({conversion:Rt,priority:0})}}static importJSON(e){const t=Te(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&&Nt(t)||$(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=vn(t,"b")),this.hasFormat("italic")&&(t=vn(t,"i")),this.hasFormat("strikethrough")&&(t=vn(t,"s")),this.hasFormat("underline")&&(t=vn(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"?tr[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=On(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){Ze();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(!M(o))return ta(l,n,l,s,"text","text");{const a=Mt();a!==o.anchor.key&&a!==o.focus.key||Me(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&&M(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){Ze();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,o=Mt(),i=new Set(e),l=[],a=n.length;let u="";for(let S=0;S<a;S++)u!==""&&i.has(S)&&(l.push(u),u=""),u+=n[S];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 p=t.getFormat(),m=t.getStyle(),b=t.__detail;let D=!1;t.isSegmented()?(h=Te(d),h.__format=p,h.__style=m,h.__detail=b,D=!0):(h=t.getWritable(),h.__text=d);const y=V(),A=[h];let v=d.length;for(let S=1;S<c;S++){const C=l[S],_=C.length,E=Te(C).getWritable();E.__format=p,E.__style=m,E.__detail=b;const k=E.__key,I=v+_;if(M(y)){const B=y.anchor,N=y.focus;B.key===s&&B.type==="text"&&B.offset>v&&B.offset<=I&&(B.key=k,B.offset-=v,y.dirty=!0),N.key===s&&N.type==="text"&&N.offset>v&&N.offset<=I&&(N.key=k,N.offset-=v,y.dirty=!0)}o===s&&Me(k),v=I,A.push(E)}if(f!==null){(function(_){const E=_.getPreviousSibling(),k=_.getNextSibling();E!==null&&Mn(E),k!==null&&Mn(k)})(this);const S=f.getWritable(),C=this.getIndexWithinParent();D?(S.splice(C,0,A),this.remove()):S.splice(C,1,A),M(y)&&Gn(y,f,C,c-1)}return A}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||$(50);const n=this.__key,s=e.__key,o=this.__text,i=o.length;Mt()===s&&Me(n);const l=V();if(M(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===s&&(vo(d,t,n,e,i),l.dirty=!0),f!==null&&f.key===s&&(vo(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:Ai(r.style),node:null}}function _c(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:Ai(e.style,t?void 0:"bold"),node:null}}const fo=new WeakMap;function vc(r){return r.nodeName==="PRE"||r.nodeType===on&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Cc(r){const e=r;r.parentElement===null&&$(129);let t=e.textContent||"";if(function(n){let s,o=n.parentNode;const i=[n];for(;o!==null&&(s=fo.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++)fo.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(
|
|
69
|
-
`),c=!f.isEmpty();else if(c=!1,
|
|
68
|
+
`?s.push(nr()):l===" "?s.push(dn()):l!==""&&s.push(Te(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=ho(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=ho(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:Te(t)}}function ho(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===on){const o=t.style.display;if(o===""&&!Os(t)||o!==""&&!o.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===Ut)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 Rt(r){const e=wc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Ai(r.style,e),node:null}}function Te(r=""){return At(new wr(r))}function q(r){return r instanceof wr}function Ai(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=>(q(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 cn extends wr{static getType(){return"tab"}static clone(e){return new cn(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=dn();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){$(126)}setDetail(e){$(127)}setMode(e){$(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function dn(){return At(new cn)}function Dc(r){return r instanceof cn}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=ze(this.key);return e===null&&$(20),e}set(e,t,n){const s=this._selection,o=this.key;this.key=e,this.offset=t,this.type=n,hn()||(Mt()===o&&Me(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function Dt(r,e,t){return new Ac(r,e,t)}function ks(r,e){let t=e.__key,n=r.offset,s="element";if(q(e)){s="text";const o=e.getTextContentSize();n>o&&(n=o)}else if(!F(e)){const o=e.getNextSibling();if(q(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 po(r,e){if(F(e)){const t=e.getLastDescendant();F(t)||q(t)?ks(r,t):ks(r,e)}else ks(r,e)}function Ot(r,e,t,n){r.key=e,r.offset=t,r.type=n}class ls{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!bt(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 ls(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(q(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=ze(s);o!==null&&n.push(o)}return hn()||(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 M(r){return r instanceof Wt}class Wt{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!!M(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),hn()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){Ot(this.anchor,e.__key,t,"text"),Ot(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]=Js(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,q(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!de(f)&&!Zt(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=Ce(),n=t.getEditorState()._selection,s=ea(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[o,i]=s;Ot(this.anchor,o.key,o.offset,o.type),Ot(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new Wt(Dt(e.key,e.offset,e.type),Dt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=On(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=tr[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(Rt()):i===" "?n.push(Qr()):n.push(de(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(_,C,y,E){const D=_.getNode(),k=D.getChildAtIndex(_.offset),v=de(),b=De(D)?ce().append(v):v;v.setFormat(y),v.setStyle(E),k===null?D.append(b):k.insertBefore(b),_.is(C)&&C.set(v.__key,0,"text"),_.set(v.__key,0,"text")}(i,l,s,o);const u=i.offset;let a=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];R(f)||M(26);const h=f.getTextContent().length,p=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(a=h,l.set(i.key,a,"text")),this.isCollapsed()&&u===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let _=f.getNextSibling();if(R(_)&&_.canInsertTextBefore()&&!Bt(_)||(_=de(),_.setFormat(s),_.setStyle(o),p.canInsertTextAfter()?f.insertAfter(_):p.insertAfter(_)),_.select(0,0),f=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&u===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let _=f.getPreviousSibling();if(R(_)&&!Bt(_)||(_=de(),_.setFormat(s),p.canInsertTextBefore()?f.insertBefore(_):p.insertBefore(_)),_.select(),f=_,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&u!==h){const _=de(f.getTextContent());_.setFormat(s),f.replace(_),f=_}else if(!this.isCollapsed()&&e!==""){const _=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||B(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Ql(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=de(e);return E.select(),void f.replace(E)}const _=f.getFormat(),C=f.getStyle();if(u!==a||_===s&&C===o){if(wc(f)){const E=de(e);return E.setFormat(s),E.setStyle(o),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=de(e);if(E.setFormat(s),E.setStyle(o),E.select(),u===0)f.insertBefore(E,!1);else{const[D]=f.splitText(u);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const y=a-u;f=f.spliceText(u,y,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=C))}else{const _=new Set([...f.getParentKeys(),...m.getParentKeys()]),C=B(f)?f:f.getParentOrThrow();let y=B(m)?m:m.getParentOrThrow(),E=m;if(!C.is(y)&&y.isInline())do E=y,y=y.getParentOrThrow();while(y.isInline());if(l.type==="text"&&(a!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<a)if(R(m)&&!m.isToken()&&a!==m.getTextContentSize()){if(m.isSegmented()){const w=de(m.getTextContent());m.replace(w),m=w}De(l.getNode())||l.type!=="text"||(m=m.spliceText(0,a,"")),_.add(m.__key)}else{const w=m.getParentOrThrow();w.canBeEmpty()||w.getChildrenSize()!==1?m.remove():w.remove()}else _.add(m.__key);const D=y.getChildren(),k=new Set(c),v=C.is(y),b=C.isInline()&&f.getNextSibling()===null?C:f;for(let w=D.length-1;w>=0;w--){const S=D[w];if(S.is(f)||B(S)&&S.isParentOf(f))break;S.isAttached()&&(!k.has(S)||S.is(E)?v||b.insertAfter(S,!1):S.remove())}if(!v){let w=y,S=null;for(;w!==null;){const $=w.getChildren(),T=$.length;(T===0||$[T-1].is(S))&&(_.delete(w.__key),S=w),w=w.getParent()}}if(f.isToken())if(u===h)f.select();else{const w=de(e);w.select(),f.replace(w)}else f=f.spliceText(u,h-u,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let w=1;w<d;w++){const S=c[w],$=S.__key;_.has($)||S.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 u=br(i,yt),a=br(l,yt);R(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&R(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{Nr(i,d)||Nr(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&&Bt(d)){const h=de(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&R(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(R(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}R(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&R(i)?i.selectEnd():l.isAttached()&&R(l)&&l.selectStart(),B(u)&&B(a)&&u!==a&&(u.append(...a.getChildren()),a.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void me(null);const n=this.getNodes(),s=[];for(const D of n)R(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(ir(k)){const v=k.getFormatFlags(e,D);k.setTextFormat(v)}})},i=s.length;if(i===0)return this.toggleFormat(e),me(null),void o(t);const l=this.anchor,u=this.focus,a=this.isBackward(),c=a?u:l,d=a?l:u;let f=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(f=1,h=s[1],p=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const _=i-1;let C=s[_];const y=d.type==="text"?d.offset:C.getTextContentSize();if(h.is(C)){if(p===y)return;if(Bt(h)||p===0&&y===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(p,y),k=p===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),d.type==="text"&&d.set(k.__key,y-p,"text")}return void(this.format=m)}p===0||Bt(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=C.getFormatFlags(e,m);y>0&&(y===C.getTextContentSize()||Bt(C)||([C]=C.splitText(y)),C.setFormat(E));for(let D=f+1;D<_;D++){const k=s[D],v=k.getFormatFlags(e,E);k.setFormat(v)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(C.__key,y,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=q();return P(p)||M(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=br(t,yt),s=e[e.length-1];if(B(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=vs(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(B(p)||Z(p))&&!p.isInline())){B(n)||M(211,t.constructor.name,t.getType());const p=vs(this);return n.splice(p,0,e),void s.selectEnd()}const o=function(p){const m=ce();let _=null;for(let C=0;C<p.length;C++){const y=p[C],E=jt(y);if(E||Z(y)&&y.isInline()||B(y)&&y.isInline()||R(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),m.append(_),E))continue;_!==null&&_.append(y)}else m.append(y),_=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),u=!B(n)||!n.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let c=l[0];var d;B(d=c)&&yt(d)&&!d.isEmpty()&&B(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(B(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(p,m,_){const C=m.getParentOrThrow().getLastChild();let y=m;const E=[m];for(;y!==C;)y.getNextSibling()||M(140),y=y.getNextSibling(),E.push(y);let D=p;for(const k of E)D=D.insertAfter(k)}(n,c));const f=br(i,yt);u&&B(f)&&(u.canMergeWhenEmpty()||yt(a))&&(f.append(...u.getChildren()),u.remove()),B(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=B(n)?n.getLastChild():null;jt(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ce();return ne().splice(this.anchor.offset,0,[i]),i.select(),i}const e=vs(this),t=br(this.anchor.getNode(),yt);B(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=Rt();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[u,a]=zs(this);if(t===0)return[];if(t===1){if(R(i)&&!this.isCollapsed()){const d=u>a?a:u,f=u>a?u:a,h=i.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[i]}const c=s.isBefore(o);if(R(i)){const d=c?u:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(R(l)){const d=l.getTextContent().length,f=c?a:u;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=$r(s,t);if(Z(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=mo();return h.add(l.__key),void nt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(R(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(i&&o.set(h,p,"text"))}{const h=l.getParentOrThrow();let p,m;return B(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=l.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(i&&o.set(m,p,"element"))}}const u=ie(),a=$e(u._window);if(!a)return;const c=u._blockCursorElement,d=u._rootElement;if(d===null||c===null||!B(l)||l.isInline()||l.canBeEmpty()||pi(c,u,d),function(f,h,p,m){f.modify(h,p,m)}(a,e,t?"backward":"forward",n),a.rangeCount>0){const f=a.getRangeAt(0),h=this.anchor.getNode(),p=De(h)?h:lc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),_=[];let C=!1;for(let y=0;y<m.length;y++){const E=m[y];Nr(E,p)?_.push(E):C=!0}if(C&&_.length>0)if(t){const y=_[0];B(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{const y=_[_.length-1];B(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}a.anchorNode===f.startContainer&&a.anchorOffset===f.startOffset||function(y){const E=y.focus,D=y.anchor,k=D.key,v=D.offset,b=D.type;xt(D,E.key,E.offset,E.type),xt(E,k,v,b),y._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&B(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(B(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=$r(o,e);if(Z(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&B(s)&&s.getChildrenSize()===0){s.remove();const l=mo();l.add(i.__key),nt(l)}else i.remove(),ie().dispatchCommand(Js,void 0);return}if(!e&&B(i)&&B(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 u=o.offset,a=l.getTextContentSize();if(l.is(s)||e&&u!==a||!e&&u!==0)return void ho(l,e,u)}else if(s!==null&&s.isSegmented()){const u=n.offset,a=s.getTextContentSize();if(s.is(l)||e&&u!==0||!e&&u!==a)return void ho(s,e,u)}(function(u,a){const c=u.anchor,d=u.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const p=c.offset,m=d.offset,_=p<m,C=_?p:m,y=_?m:p,E=y-1;C!==E&&(Bl(f.getTextContent().slice(C,y))||(a?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()&&De(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 et(r){return r instanceof Yn}function fo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function zs(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]:[fo(t),fo(n)]}function ho(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,l=0;for(let a=0;a<o;a++){const c=a===o-1;if(l=i,i+=s[a].length,e&&i===t||i>t||c){s.splice(a,1),c&&(l=void 0);break}}const u=s.join("").trim();u===""?n.remove():(n.setTextContent(u),n.select(l,l))}function po(r,e,t,n){let s,o=e;if(r.nodeType===Kr){let i=!1;const l=r.childNodes,u=l.length,a=n._blockCursorElement;o===u&&(i=!0,o=u-1);let c=l[o],d=!1;if(c===a)c=l[o+1],d=!0;else if(a!==null){const f=a.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,a)&&o--}if(s=Yt(c),R(s))o=Hi(s,i);else{let f=Yt(r);if(f===null)return null;if(B(f)){const h=n.getElementByKey(f.getKey());h===null&&M(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),B(f)||M(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(B(m)&&function(_,C,y){const E=_.getParent();return y===null||E===null||!E.canBeEmpty()||E!==y.getNode()}(m,0,t)){const _=i?m.getLastDescendant():m.getFirstDescendant();_===null?f=m:(m=_,f=B(m)?m:m.getParentOrThrow()),o=0}R(m)?(s=m,f=null,o=Hi(m,i)):m!==f&&i&&!d&&(B(f)||M(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&Z(f)&&Yt(r)===f?h:h+1,f=f.getParentOrThrow()}if(B(f))return it(f.__key,o,"element")}}else s=Yt(r);return R(s)?it(s.__key,o,"text"):null}function go(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&&B(i)&&i.isInline()){const l=i.getPreviousSibling();R(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else B(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):R(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&&B(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&B(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();R(l)&&(r.key=l.__key,r.offset=0)}}}function Ql(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);go(r,n,s),go(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=ie();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 Yl(r,e,t,n,s,o){if(r===null||t===null||!Vr(s,r,t))return null;const i=po(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=po(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const u=Yt(r),a=Yt(t);if(Z(u)&&Z(a))return null}return Ql(i,l,o),[i,l]}function qs(r){return B(r)&&!r.isInline()}function Xl(r,e,t,n,s,o){const i=ht(),l=new Et(it(r,e,s),it(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Ac(){const r=it("root",0,"element"),e=it("root",0,"element");return new Et(r,e,0,"")}function mo(){return new Yn(new Set)}function xi(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",u=!Ss&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let a,c,d,f;if(P(r)&&!u)return r.clone();if(e===null)return null;if(a=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&P(r)&&!Vr(t,a,c))return r.clone();const h=Yl(a,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new Et(p,m,P(r)?r.format:0,P(r)?r.style:"")}function q(){return ht()._selection}function Yr(){return ie()._editorState._selection}function Pn(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 u=e.__key;if(r.isCollapsed()){const a=s.offset;if(t<=a&&n>0||t<a&&n<0){const c=Math.max(0,a+n);s.set(u,c,"element"),o.set(u,c,"element"),yo(r)}}else{const a=r.isBackward(),c=a?o:s,d=c.getNode(),f=a?s:o,h=f.getNode();if(e.is(d)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(u,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(u,Math.max(0,p+n),"element")}}yo(r)}function yo(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!B(o))return;const l=o.getChildrenSize(),u=t>=l,a=u?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(R(a)){let c=0;u&&(c=a.getTextContentSize()),e.set(a.__key,c,"text"),n.set(a.__key,c,"text")}}else{if(B(o)){const l=o.getChildrenSize(),u=t>=l,a=u?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(R(a)){let c=0;u&&(c=a.getTextContentSize()),e.set(a.__key,c,"text")}}if(B(i)){const l=i.getChildrenSize(),u=s>=l,a=u?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(R(a)){let c=0;u&&(c=a.getTextContentSize()),n.set(a.__key,c,"text")}}}}function On(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,R(n)?(i=n.getTextContentSize(),l="text"):B(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,R(s)?l="text":B(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 xo(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,u=n.focusNode,a=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==o||d!==null&&ui(d))return;if(!P(e))return void(r!==null&&Vr(t,l,u)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,_=Tn(t,p),C=Tn(t,m),y=f.offset,E=h.offset,D=e.format,k=e.style,v=e.isCollapsed();let b=_,w=C,S=!1;if(f.type==="text"){b=An(_);const O=f.getNode();S=O.getFormat()!==D||O.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(S=!0);var $,T,N,j,L;if(h.type==="text"&&(w=An(C)),b!==null&&w!==null&&(v&&(r===null||S||P(r)&&(r.format!==D||r.style!==k))&&($=D,T=k,N=y,j=p,L=performance.now(),Ul=[$,T,N,j,L]),a!==y||c!==E||l!==b||u!==w||n.type==="Range"&&v||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(b,y,w,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const O=e instanceof Et&&e.anchor.type==="element"?b.childNodes[y]||null:n.rangeCount>0?n.getRangeAt(0):null;if(O!==null){let G;if(O instanceof Text){const he=document.createRange();he.selectNode(O),G=he.getBoundingClientRect()}else G=O.getBoundingClientRect();(function(he,oe,Ne){const we=Ne.ownerDocument,Ye=we.defaultView;if(Ye===null)return;let{top:Ie,bottom:je}=oe,Xe=0,Ee=0,te=Ne;for(;te!==null;){const Ae=te===we.body;if(Ae)Xe=0,Ee=Hn(he).innerHeight;else{const re=te.getBoundingClientRect();Xe=re.top,Ee=re.bottom}let xe=0;if(Ie<Xe?xe=-(Xe-Ie):je>Ee&&(xe=je-Ee),xe!==0)if(Ae)Ye.scrollBy(0,xe);else{const re=te.scrollTop;te.scrollTop+=xe;const Pe=te.scrollTop-re;Ie-=Pe,je-=Pe}if(Ae)break;te=Gr(te)}})(t,G,o)}}Rs=!0}}function Zl(r){let e=q()||Yr();e===null&&(e=ne().selectEnd()),e.insertNodes(r)}function vs(r){let e=r;r.isCollapsed()||e.removeText();const t=q();P(t)&&(e=t),P(e)||M(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!yt(s);)[s,o]=Sc(s,o);return o}function Sc(r,e){const t=r.getParent();if(!t){const s=ce();return ne().append(s),s.select(),[ne(),0]}if(R(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(!B(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new Et(it(r.__key,e,"element"),it(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let pe=null,ge=null,Te=!1,Ds=!1,xn=0;const _o={characterData:!0,childList:!0,subtree:!0};function Xr(){return Te||pe!==null&&pe._readOnly}function Se(){Te&&M(13)}function eu(){xn>99&&M(14)}function ht(){return pe===null&&M(195,tu()),pe}function ie(){return ge===null&&M(196,tu()),ge}function tu(){let r=0;const e=new Set,t=Zn.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=Kn(s);if(ai(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 ge}function bo(r,e,t){const n=e.__type,s=function(l,u){const a=l._nodes.get(u);return a===void 0&&M(30,u),a}(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 vo(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function ru(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 _i(r,ie()._nodes)}function _i(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(B(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const u=_i(i[l],e);o.append(u)}return o}function Do(r,e,t){const n=pe,s=Te,o=ge;pe=e,Te=!0,ge=r;try{return t()}finally{pe=n,Te=s,ge=o}}function bt(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,u=r._dirtyType!==Pt,a=pe,c=Te,d=ge,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&u&&h!==null){ge=r,pe=t,Te=!1,r._updating=!0;try{const v=r._dirtyType,b=r._dirtyElements,w=r._dirtyLeaves;h.disconnect(),p=mc(o,t,r,v,b,w)}catch(v){if(v instanceof Error&&r._onError(v),Ds)throw v;return lu(r,null,n,t),Cl(r),r._dirtyType=nr,Ds=!0,bt(r,o),void(Ds=!1)}finally{h.observe(n,_o),r._updating=f,pe=a,Te=c,ge=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,_=r._dirtyElements,C=r._normalizedNodes,y=r._updateTags,E=r._deferred;u&&(r._dirtyType=Pt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(v,b){const w=v._decorators;let S=v._pendingDecorators||w;const $=b._nodeMap;let T;for(T in S)$.has(T)||(S===w&&(S=Sl(v)),delete S[T])}(r,t);const D=s?null:$e(r._window);if(r._editable&&D!==null&&(u||l===null||l.dirty)){ge=r,pe=t;try{if(h!==null&&h.disconnect(),u||l===null||l.dirty){const v=r._blockCursorElement;v!==null&&pi(v,r,n),kc(i,l,r,D,y,n)}uc(r,n,l),h!==null&&h.observe(n,_o)}finally{ge=d,pe=a}}p!==null&&function(v,b,w,S,$){const T=Array.from(v._listeners.mutation),N=T.length;for(let j=0;j<N;j++){const[L,O]=T[j],G=b.get(O);G!==void 0&&L(G,{dirtyLeaves:S,prevEditorState:$,updateTags:w})}}(r,p,y,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(Js,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,jr("decorator",r,!0,k)),function(v,b,w){const S=Gi(b),$=Gi(w);S!==$&&jr("textcontent",v,!0,$)}(r,e||o,t),jr("update",r,!0,{dirtyElements:_,dirtyLeaves:m,editorState:t,normalizedNodes:C,prevEditorState:e||o,tags:y}),function(v,b){if(v._deferred=[],b.length!==0){const w=v._updating;v._updating=!0;try{for(let S=0;S<b.length;S++)b[S]()}finally{v._updating=w}}}(r,E),function(v){const b=v._updates;if(b.length!==0){const w=b.shift();if(w){const[S,$]=w;su(v,S,$)}}}(r)}function jr(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 nu(r,e,t){if(r._updating===!1||ge!==r){let s=!1;return r.update(()=>{s=nu(r,e,t)}),s}const n=ci(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 u=Array.from(l),a=u.length;for(let c=0;c<a;c++)if(u[c](t,r)===!0)return!0}}}return!1}function Co(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 u=r._pendingEditorState;u===null&&M(191),u._flushSync=!0}l&&r._deferred.push(l),ru(r,i.tag)}o()}}return n}function su(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,ru(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let u=r._pendingEditorState,a=!1;(u===null||u._readOnly)&&(u=r._pendingEditorState=iu(u||l),a=!0),u._flushSync=i;const c=pe,d=Te,f=ge,h=r._updating;pe=u,Te=!1,r._updating=!0,ge=r;try{a&&(r._headless?l._selection!==null&&(u._selection=l._selection.clone()):u._selection=function(C){const y=C.getEditorState()._selection,E=$e(C._window);return P(y)||y==null?xi(y,E,C,null):y.clone()}(r));const m=r._compositionKey;e(),o=Co(r,o),function(C,y){const E=y.getEditorState()._selection,D=C._selection;if(P(D)){const k=D.anchor,v=D.focus;let b;if(k.type==="text"&&(b=k.getNode(),b.selectionTransform(E,D)),v.type==="text"){const w=v.getNode();b!==w&&w.selectionTransform(E,D)}}}(u,r),r._dirtyType!==Pt&&(o?function(C,y){const E=y._dirtyLeaves,D=C._nodeMap;for(const k of E){const v=D.get(k);R(v)&&v.isAttached()&&v.isSimpleText()&&!v.isUnmergeable()&&Ki(v)}}(u,r):function(C,y){const E=y._dirtyLeaves,D=y._dirtyElements,k=C._nodeMap,v=_t(),b=new Map;let w=E,S=w.size,$=D,T=$.size;for(;S>0||T>0;){if(S>0){y._dirtyLeaves=new Set;for(const N of w){const j=k.get(N);R(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&Ki(j),j!==void 0&&vo(j,v)&&bo(y,j,b),E.add(N)}if(w=y._dirtyLeaves,S=w.size,S>0){xn++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map;for(const N of $){const j=N[0],L=N[1];if(j!=="root"&&!L)continue;const O=k.get(j);O!==void 0&&vo(O,v)&&bo(y,O,b),D.set(j,L)}w=y._dirtyLeaves,S=w.size,$=y._dirtyElements,T=$.size,xn++}y._dirtyLeaves=E,y._dirtyElements=D}(u,r),Co(r),function(C,y,E,D){const k=C._nodeMap,v=y._nodeMap,b=[];for(const[w]of D){const S=v.get(w);S!==void 0&&(S.isAttached()||(B(S)&&jl(S,w,k,v,b,D),k.has(w)||D.delete(w),b.push(w)))}for(const w of b)v.delete(w);for(const w of E){const S=v.get(w);S===void 0||S.isAttached()||(k.has(w)||E.delete(w),v.delete(w))}}(l,u,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(u._flushSync=!0);const _=u._selection;if(P(_)){const C=u._nodeMap,y=_.anchor.key,E=_.focus.key;C.get(y)!==void 0&&C.get(E)!==void 0||M(19)}else et(_)&&_._nodes.size===0&&(u._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 bt(r)}finally{pe=c,Te=d,ge=f,r._updating=h,xn=0}r._dirtyType!==Pt||function(m,_){const C=_.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(C))return!0}else if(C!==null)return!0;return!1}(u,r)?u._flushSync?(u._flushSync=!1,bt(r)):a&&rc(()=>{bt(r)}):(u._flushSync=!1,a&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function Fe(r,e,t){r._updating?r._updates.push([e,t]):su(r,e,t)}class Pr{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Pr(this.element,e,this.after)}withAfter(e){return new Pr(this.element,this.before,e)}withElement(e){return new Pr(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"&&(Wr||Un);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 u=this.getFirstChildOffset();return[e,Math.min(u+e.getChildrenSize(),Math.max(u,s))]}const o=wo(t,n);o.push(s);const i=wo(t,this.element);let l=e.getIndexWithinParent();for(let u=0;u<i.length;u++){const a=o[u],c=i[u];if(a===void 0||a<c)break;if(a>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function wo(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 pt extends Qn{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 Va[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=ie()._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(R(t)&&e.push(t),B(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;B(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;B(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 B(o)&&o.getLastDescendant()||o||null}const s=t[e];return B(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:ye(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:ye(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(),B(o)&&s!==n-1&&!o.isInline()&&(e+=dt)}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(),B(o)&&s!==n-1&&!o.isInline()&&(e+=dt.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){Se();const n=q();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const u=this.getFirstChild();if(R(u)||B(u))return u.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const u=this.getLastChild();if(R(u)||B(u))return u.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):Xl(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,u=[],a=[],c=this.getChildAtIndex(e+t);let d=null,f=o-t+s;if(e!==0)if(e===o)d=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(d=p.getPreviousSibling())}if(t>0){let p=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){p===null&&M(100);const _=p.getNextSibling(),C=p.__key;Lt(p.getWritable()),a.push(C),p=_}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const _=m.getWritable();_.__parent===l&&f--,Lt(_);const C=m.__key;if(h===null)i.__first=C,_.__prev=null;else{const y=h.getWritable();y.__next=C,_.__prev=y.__key}m.__key===l&&M(76),_.__parent=l,u.push(C),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const m=h.getWritable();p.__prev=h.__key,m.__next=c.__key}else p.__prev=null}if(i.__size=f,a.length){const p=q();if(P(p)){const m=new Set(a),_=new Set(u),{anchor:C,focus:y}=p;Eo(C,m,_)&&On(C,C.getNode(),this,d,c),Eo(y,m,_)&&On(y,y.getNode(),this,d,c),f!==0||this.canBeEmpty()||st(this)||this.remove()}}return i}getDOMSlot(e){return new Pr(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ft(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 B(r){return r instanceof pt}function Eo(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 Qn{constructor(e){super(e)}decorate(e,t){M(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Z(r){return r instanceof Nc}class Zr extends pt{static getType(){return"root"}static clone(){return new Zr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){const e=this.__cachedText;return!Xr()&&ie()._dirtyType!==Pt||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];B(n)||Z(n)||M(56)}return super.append(...e)}static importJSON(e){const t=ne();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 De(r){return r instanceof Zr}function iu(r){return new Xn(new Map(r._nodeMap))}function bi(){return new Xn(new Map([["root",new Zr]]))}function ou(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&M(130,t.name),B(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=ou(s[o]);n.push(i)}}return e}class Xn{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 Do(t&&t.editor||null,this,e)}clone(e){const t=new Xn(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Do(null,this,()=>({root:ou(ne())}))}}class vi extends pt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class lr extends pt{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=Ot[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 lr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Br(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&&ft(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=ce();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=ce();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||R(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=ce();return r.style&&(e.setFormat(r.style.textAlign),mi(r,e)),{node:e}}function ce(){return ot(new lr)}function ir(r){return r instanceof lr}const Y=0,Xt=1,Lc=4;function lu(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=bi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=Pt,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 jc(r){const e=r||{},t=Tc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=bi(),l=e.namespace||(s!==null?s._config.namespace:Nl()),u=e.editorState,a=[Zr,or,Hr,Jr,lr,vi,...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<a.length;m++){let _=a[m],C=null,y=null;if(typeof _!="function"){const v=_;_=v.replace,C=v.with,y=v.withKlass||null}const E=_.getType(),D=_.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:C,replaceWithKlass:y,transforms:k})}}const p=new Zn(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,_){const C=new Map,y=new Set,E=D=>{Object.keys(D).forEach(k=>{let v=C.get(k);v===void 0&&(v=[],C.set(k,v)),v.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||y.has(k))return;y.add(k);const v=k.call(D.klass);v!==null&&E(v)}),_&&E(_),C}(h,d?d.import:void 0),f);return u!==void 0&&(p._pendingEditorState=u,p._dirtyType=nr),p}class Zn{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=Pt,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=Nl(),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 u=this.registerNodeTransformToKlass(o,t);s.push(u)}var i,l;return i=this,l=e.getType(),Fe(i,()=>{const u=ht();if(u.isEmpty())return;if(l==="root")return void ne().markDirty();const a=u._nodeMap;for(const[,c]of a)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(u=>u.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return I(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=Br(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,lu(this,t,e,s),t!==null&&(this._config.disableEvents||yc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const u=l.ownerDocument;return u&&u.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,Cl(this),this._updateTags.add("history-merge"),bt(this),this._config.disableEvents||function(l,u){const a=l.ownerDocument,c=jn.get(a);(c===void 0||c<1)&&a.addEventListener("selectionchange",Gl),jn.set(a,(c||0)+1),l.__lexicalEditor=u;const d=Vl(l);for(let f=0;f<Ms.length;f++){const[h,p]=Ms[f],m=typeof p=="function"?_=>{oo(_)||(io(_),(u.isEditable()||h==="click")&&p(_,u))}:_=>{if(oo(_))return;io(_);const C=u.isEditable();switch(h){case"cut":return C&&I(u,Xs,_);case"copy":return I(u,qn,_);case"paste":return C&&I(u,zn,_);case"dragstart":return C&&I(u,gl,_);case"dragover":return C&&I(u,ml,_);case"dragend":return C&&I(u,Ta,_);case"focus":return C&&I(u,Fa,_);case"blur":return C&&I(u,La,_);case"drop":return C&&I(u,pl,_)}};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;jr("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=iu(e),n._selection=e._selection?e._selection.clone():null),Dl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),bt(this)),this._pendingEditorState=n,this._dirtyType=nr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||bt(this)}parseEditorState(e,t){return function(n,s,o){const i=bi(),l=pe,u=Te,a=ge,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,pe=i,Te=!1,ge=s;try{const p=s._nodes;_i(n.root,p),o&&o(),i._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,pe=l,Te=u,ge=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return bt(this),this.getEditorState().read(e,{editor:this})}update(e,t){Fe(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),Fe(this,()=>{const s=q(),o=ne();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=$e(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,jr("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Zn.version="0.21.0+prod.esm";const uu=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pc=uu?A.useLayoutEffect:A.useEffect,fn={tag:"history-merge"};function Oc({initialConfig:r,children:e}){const t=A.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:u}=r,a=_a(null,n),c=jc({editable:r.editable,html:u,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=ne();if(h.isEmpty()){const p=ce();h.append(p);const m=uu?document.activeElement:null;(q()!==null||m!==null&&m===d.getRootElement())&&p.select()}},fn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,fn);break}case"object":d.setEditorState(f,fn);break;case"function":d.update(()=>{ne().isEmpty()&&f(d)},fn)}}}(c,l),[c,a]},[]);return Pc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(il.Provider,{value:t,children:e})}const Mc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Rc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function $c(){return function(r){const[e]=Je(),t=A.useMemo(()=>r(e),[e,r]),[n,s]=A.useState(()=>t.initialValueFn()),o=A.useRef(n);return Mc(()=>{const{initialValueFn:i,subscribe:l}=t,u=i();return o.current!==u&&(o.current=u,s(u)),l(a=>{o.current=a,s(a)})},[t,r]),n}(Rc)}function Ic(){return ne().getTextContent()}function zc(r,e=!0){if(r)return!1;let t=Ic();return e&&(t=t.trim()),t===""}function qc(r){if(!zc(r,!1))return!1;const e=ne().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Z(s))return!1;if(B(s)){if(!ir(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const u=o[n];if(!R(u))return!1}}}return!0}function au(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 Kc=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 Vc=new Map;function Gc(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 cu(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(),u=e.is(i),a=e.is(l);if(u||a){const[c,d]=zs(r),f=i.is(l),h=e.is(o?l:i),p=e.is(o?i:l);let m,_=0;return f?(_=c>d?d:c,m=c>d?c:d):h?(_=o?d:c,m=void 0):p&&(_=0,m=o?c:d),e.__text=e.__text.slice(_,m),e}}return e}function Hc(r){const e=r.getStyle(),t=Gc(e);Vc.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=ne(),u=l.getFirstChild();return void(u?u.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let u=i;for(;u!==null&&u.getParent()!==null&&!l(u);)u=u.getParentOrThrow();return l(u)?u:null}(n.getNode(),So);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!So(l))continue;B(l)||Kc(178);const u=e();u.setFormat(l.getFormatType()),u.setIndent(l.getIndent()),l.replace(u,!0)}}function Ao(r,e){const t=$r(r.focus,e);return Z(t)&&!t.isIsolated()||B(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(De(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function ko(r,e,t){const n=Yc(r);Qc(r,e,t?!n:n,"character")}function So(r){if(Z(r)||!B(r)||st(r))return!1;const e=r.getFirstChild(),t=e===null||jt(e)||R(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 du=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ed=du&&"documentMode"in document?document.documentMode:null;!(!du||!("InputEvent"in window)||ed)&&"getTargetRanges"in new window.InputEvent("input");function fu(...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 It(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function en(r,...e){const t=fu(...e);t.length>0&&r.classList.add(...t)}function hu(r,...e){const t=fu(...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=es(r,t=>B(t)&&!t.isInline());return B(e)||Zc(4,r.__key),e}const es=(r,e)=>{let t=r;for(;t!==ne()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function vt(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 u=l.args;if(u){const[a,c,d,f,h,p]=u;r.update(()=>{const m=q();if(P(m)){const _=m.anchor;let C=_.getNode(),y=0,E=0;if(R(C)&&a>=0&&c>=0&&(y=a,E=a+c,m.setTextNodeRange(C,y,C,E)),y===E&&d===""||(m.insertRawText(d),C=_.getNode()),R(C)){y=f,E=f+h;const D=C.getTextContentSize();y=y>D?D:y,E=E>D?D:E,m.setTextNodeRange(C,y,C,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function pu(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(!yu.has(i.nodeName)){const l=xu(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof vi&&i.insertAfter(Rt());for(const i of o){const l=i.getChildren();for(const u of l)i.insertBefore(u);i.remove()}}(s),n}function gu(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=ne().getChildren();for(let s=0;s<n.length;s++)mu(r,n[s],t,e);return t.innerHTML}function mu(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=B(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=gi(e);h=R(h)&&n!==null?cu(n,h):h,i=h}const l=B(i)?i.getChildren():[],u=r._nodes.get(i.getType());let a;a=u&&u.exportDOM!==void 0?u.exportDOM(r,i):i.exportDOM(r);const{element:c,after:d}=a;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const p=l[h],m=mu(r,p,f,n);!s&&B(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!o){if((ft(c)||eo(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(eo(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const yu=new Set(["STYLE","SCRIPT"]);function xu(r,e,t,n,s=new Map,o){let i=[];if(yu.has(r.nodeName))return i;let l=null;const u=function(p,m){const{nodeName:_}=p,C=m._htmlConversions.get(_.toLowerCase());let y=null;if(C!==void 0)for(const E of C){const D=E(p);D!==null&&(y===null||(y.priority||0)<=(D.priority||0))&&(y=D)}return y!==null?y.conversion:null}(r,e),a=u?u(r):null;let c=null;if(a!==null){c=a.after;const p=a.node;if(l=Array.isArray(p)?p[p.length-1]:p,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(p)?p:[l])}a.forChild!=null&&s.set(r.nodeName,a.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!st(l))&&(l!=null&&qs(l)||n);for(let p=0;p<d.length;p++)f.push(...xu(d[p],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Bn(r)&&(f=sd(r,f,h?()=>{const p=new vi;return t.push(p),p}:ce)),l==null?f.length>0?i=i.concat(f):Bn(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ts(p.nextSibling)&&Ts(p.previousSibling)}(r)&&(i=i.concat(Rt())):B(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(qs(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&qs(e[i+1])){const u=t();u.setFormat(n),u.append(...o),s.push(u),o=[]}}return s}function id(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mn=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=q()){return e==null&&Mn(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":gu(r,e)}function ld(r,e=q()){return e==null&&Mn(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ud(r,e))}function To(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 Bo(t,ad(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:u=>u}).createHTML(l):l}(s),"text/html");return Bo(t,pu(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 u=q();if(P(u)){const a=i[l];a===`
|
|
72
|
-
`||
|
|
73
|
-
`?u.insertParagraph():a===" "?u.insertNodes([Qr()]):u.insertText(a)}}}else e.insertRawText(o)}function Bo(r,e,t){r.dispatchCommand(ba,{nodes:e,selection:t})||t.insertNodes(e)}function _u(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=B(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=gi(t);a=R(a)&&e!==null?cu(e,a):a,i=a}const l=B(i)?i.getChildren():[],u=function(a){const c=a.exportJSON(),d=a.constructor;if(c.type!==d.getType()&&Mn(58,d.name),B(a)){const f=c.children;Array.isArray(f)||Mn(59,d.name)}return c}(i);if(R(i)){const a=i.__text;a.length>0?u.text=a:s=!1}for(let a=0;a<l.length;a++){const c=l[a],d=_u(r,e,c,u.children);!s&&B(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(u);else if(Array.isArray(u.children))for(let a=0;a<u.children.length;a++){const c=u.children[a];n.push(c)}return s}function ud(r,e){const t=[],n=ne().getChildren();for(let s=0;s<n.length;s++)_u(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function ad(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Bc(n);R(s)&&Hc(s),e.push(s)}return e}let Ht=null;async function No(r,e,t){if(Ht!==null)return!1;if(e!==null)return new Promise((u,a)=>{r.update(()=>{u(Fo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=$e(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((u,a)=>{const c=r.registerCommand(qn,d=>(vt(d,ClipboardEvent)&&(c(),Ht!==null&&(window.clearTimeout(Ht),Ht=null),u(Fo(r,d,t))),!0),Lc);Ht=window.setTimeout(()=>{c(),Ht=null,u(!1)},50),s.execCommand("copy"),i.remove()})}function Fo(r,e,t){if(t===void 0){const s=$e(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!Vr(r,o,i))return!1;const l=q();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=q()){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 Lo(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 ur=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hd=ur&&"documentMode"in document?document.documentMode:null,pd=!(!ur||!("InputEvent"in window)||hd)&&"getTargetRanges"in new window.InputEvent("input"),gd=ur&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),jo=ur&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,md=ur&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yd=ur&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!md,Po=Ur();class ts extends pt{static getType(){return"quote"}static clone(e){return new ts(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return en(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&&ft(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=Di();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=ce(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ce();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Di(){return ot(new ts)}class rs extends pt{static getType(){return"heading"}static clone(e){return new rs(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];en(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Jt,priority:0}),h2:e=>({conversion:Jt,priority:0}),h3:e=>({conversion:Jt,priority:0}),h4:e=>({conversion:Jt,priority:0}),h5:e=>({conversion:Jt,priority:0}),h6:e=>({conversion:Jt,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Oo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Oo(e)?{conversion:t=>({node:Ar("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ft(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=Ar(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?ce():Ar(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ce();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ce():Ar(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Oo(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Jt(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Ar(e),r.style!==null&&(mi(r,t),t.setFormat(r.style.textAlign))),{node:t}}function xd(r){const e=Di();return r.style!==null&&(e.setFormat(r.style.textAlign),mi(r,e)),{node:e}}function Ar(r){return ot(new rs(r))}function hn(r){let e=null;if(vt(r,DragEvent)?e=r.dataTransfer:vt(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 Mo(r){const e=q();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=es(o,a=>B(a)&&!a.isInline());if(l===null)continue;const u=l.getKey();l.canIndent()&&!t.has(u)&&(t.add(u),r(l))}return t.size>0}function pn(r){const e=sr(r);return Z(e)}function _d(r){return It(r.registerCommand(ol,e=>{const t=q();return!!et(t)&&(t.clear(),!0)},0),r.registerCommand(Ft,e=>{const t=q();return!!P(t)&&(t.deleteCharacter(e),!0)},Y),r.registerCommand(Mr,e=>{const t=q();return!!P(t)&&(t.deleteWord(e),!0)},Y),r.registerCommand(Rr,e=>{const t=q();return!!P(t)&&(t.deleteLine(e),!0)},Y),r.registerCommand(er,e=>{const t=q();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)To(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},Y),r.registerCommand(As,()=>{const e=q();return!!P(e)&&(e.removeText(),!0)},Y),r.registerCommand(Ge,e=>{const t=q();return!!P(t)&&(t.formatText(e),!0)},Y),r.registerCommand(Sa,e=>{const t=q();if(!P(t)&&!et(t))return!1;const n=t.getNodes();for(const s of n){const o=es(s,i=>B(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},Y),r.registerCommand(Zt,e=>{const t=q();return!!P(t)&&(t.insertLineBreak(e),!0)},Y),r.registerCommand(Or,()=>{const e=q();return!!P(e)&&(e.insertParagraph(),!0)},Y),r.registerCommand(Aa,()=>(Zl([Qr()]),!0),Y),r.registerCommand(ka,()=>Mo(e=>{const t=e.getIndent();e.setIndent(t+1)}),Y),r.registerCommand(zi,()=>Mo(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),Y),r.registerCommand(al,e=>{const t=q();if(et(t)&&!pn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=$r(t.focus,!0);if(!e.shiftKey&&Z(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},Y),r.registerCommand(cl,e=>{const t=q();if(et(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===ne().getChildrenSize()}(t))return e.preventDefault(),!0;const n=$r(t.focus,!1);if(!e.shiftKey&&Z(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},Y),r.registerCommand(ul,e=>{const t=q();if(et(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Ao(t,!0)){const n=e.shiftKey;return e.preventDefault(),ko(t,n,!0),!0}return!1},Y),r.registerCommand(ll,e=>{const t=q();if(et(t)&&!pn(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!!Ao(t,!1)&&(e.preventDefault(),ko(t,n,!1),!0)},Y),r.registerCommand(dl,e=>{if(pn(e.target))return!1;const t=q();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!De(s)&&rd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(zi,void 0)):(!jo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(Ft,!0))},Y),r.registerCommand(hl,e=>{if(pn(e.target))return!1;const t=q();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(Ft,!1))},Y),r.registerCommand(vn,e=>{const t=q();if(!P(t))return!1;if(e!==null){if((jo||gd||yd)&&pd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Zt,!1)}return r.dispatchCommand(Or,void 0)},Y),r.registerCommand(fl,()=>{const e=q();return!!P(e)&&(r.blur(),!0)},Y),r.registerCommand(pl,e=>{const[,t]=hn(e);if(t.length>0){const s=Lo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=sr(i);if(l!==null){const u=Ac();if(R(l))u.anchor.set(l.getKey(),o,"text"),u.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;u.anchor.set(c,d,"element"),u.focus.set(c,d,"element")}const a=wl(u);nt(a)}r.dispatchCommand(Po,t)}return e.preventDefault(),!0}const n=q();return!!P(n)},Y),r.registerCommand(gl,e=>{const[t]=hn(e),n=q();return!(t&&!P(n))},Y),r.registerCommand(ml,e=>{const[t]=hn(e),n=q();if(t&&!P(n))return!1;const s=Lo(e.clientX,e.clientY);if(s!==null){const o=sr(s.node);Z(o)&&e.preventDefault()}return!0},Y),r.registerCommand(ks,()=>(oc(),!0),Y),r.registerCommand(qn,e=>(No(r,vt(e,ClipboardEvent)?e:null),!0),Y),r.registerCommand(Xs,e=>(async function(t,n){await No(n,vt(t,ClipboardEvent)?t:null),n.update(()=>{const s=q();P(s)?s.removeText():et(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),Y),r.registerCommand(zn,e=>{const[,t,n]=hn(e);return t.length>0&&!n?(r.dispatchCommand(Po,t),!0):ui(e.target)?!1:q()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=q(),l=vt(s,InputEvent)||vt(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&To(l,i,o)},{tag:"paste"})}(e,r),!0)},Y))}const Us=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Ro(r){return r.getEditorState().read(au(r.isComposing()))}function bd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=Je(),s=function(o,i){const[l,u]=A.useState(()=>o.getDecorators());return Us(()=>o.registerDecoratorListener(a=>{Ni.flushSync(()=>{u(a)})}),[o]),A.useEffect(()=>{u(o.getDecorators())},[o]),A.useMemo(()=>{const a=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=g.jsx(i,{onError:m=>o._onError(m),children:g.jsx(A.Suspense,{fallback:null,children:l[f]})}),p=o.getElementByKey(f);p!==null&&a.push(Ni.createPortal(h,p,f))}return a},[i,l,o])}(n,t);return function(o){Us(()=>It(_d(o),nd(o)),[o])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=Je(),t=function(s){const[o,i]=A.useState(()=>Ro(s));return Us(()=>{function l(){const u=Ro(s);i(u)}return l(),It(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=$c();return t?typeof r=="function"?r(n):r:null}const bu=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Dd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:u,ariaLabelledBy:a,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:p,id:m,role:_="textbox",spellCheck:C=!0,style:y,tabIndex:E,"data-testid":D,...k},v){const[b,w]=A.useState(r.isEditable()),S=A.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),$=A.useMemo(()=>function(...T){return N=>{T.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(v,S),[S,v]);return bu(()=>(w(r.isEditable()),r.registerEditableListener(T=>{w(T)})),[r]),g.jsx("div",{"aria-activedescendant":b?e:void 0,"aria-autocomplete":b?t:"none","aria-controls":b?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":u,"aria-labelledby":a,"aria-multiline":c,"aria-owns":b?d:void 0,"aria-readonly":!b||void 0,"aria-required":f,autoCapitalize:h,className:p,contentEditable:b,"data-testid":D,id:m,ref:$,role:b?_:void 0,spellCheck:C,style:y,tabIndex:E,...k})}const Cd=A.forwardRef(Dd);function $o(r){return r.getEditorState().read(au(r.isComposing()))}const wd=A.forwardRef(Ed);function Ed(r,e){const{placeholder:t,...n}=r,[s]=Je();return g.jsxs(g.Fragment,{children:[g.jsx(Cd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[l,u]=A.useState(()=>$o(i));return bu(()=>{function a(){const c=$o(i);u(c)}return a(),It(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),l}(e),[n,s]=A.useState(e.isEditable());if(A.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:g.jsx("div",{"aria-hidden":!0,children:o})}const gn=0,Ws=1,Ks=2,Ve=0,kd=1,Io=2,Sd=3,Td=4;function Bd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return Ve;const o=e._selection,i=r._selection;if(s)return kd;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return Ve;const l=function(C,y,E){const D=C._nodeMap,k=[];for(const v of y){const b=D.get(v);b!==void 0&&k.push(b)}for(const[v,b]of E){if(!b)continue;const w=D.get(v);w===void 0||De(w)||k.push(w)}return k}(e,t,n);if(l.length===0)return Ve;if(l.length>1){const C=e._nodeMap,y=C.get(o.anchor.key),E=C.get(i.anchor.key);return y&&E&&!r._nodeMap.has(y.__key)&&R(y)&&y.__text.length===1&&o.anchor.offset===1?Io:Ve}const u=l[0],a=r._nodeMap.get(u.__key);if(!R(a)||!R(u)||a.__mode!==u.__mode)return Ve;const c=a.__text,d=u.__text;if(c===d)return Ve;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return Ve;const p=f.offset,m=h.offset,_=d.length-c.length;return _===1&&m===p-1?Io:_===-1&&m===p+1?Sd:_===-1&&m===p?Td:Ve}function Nd(r,e){let t=Date.now(),n=Ve;return(s,o,i,l,u,a)=>{const c=Date.now();if(a.has("historic"))return n=Ve,t=c,Ks;const d=Bd(s,o,l,u,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,p=a.has("history-push");if(!p&&h&&a.has("history-merge"))return gn;if(s===null)return Ws;const m=o._selection;return l.size>0||u.size>0?p===!1&&d!==Ve&&d===n&&c<t+e&&h||l.size===1&&function(_,C,y){const E=C._nodeMap.get(_),D=y._nodeMap.get(_),k=C._selection,v=y._selection;return!(P(k)&&P(v)&&k.anchor.type==="element"&&k.focus.type==="element"&&v.anchor.type==="text"&&v.focus.type==="text"||!R(E)||!R(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(y.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?gn:Ws:m!==null?gn:Ks})();return t=c,n=d,f}}function zo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Fd(r,e,t){const n=Nd(r,t);return It(r.registerCommand(Qs,()=>(function(o,i){const l=i.redoStack,u=i.undoStack;if(u.length!==0){const a=i.current,c=u.pop();a!==null&&(l.push(a),o.dispatchCommand(un,!0)),u.length===0&&o.dispatchCommand(an,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Y),r.registerCommand(Ys,()=>(function(o,i){const l=i.redoStack,u=i.undoStack;if(l.length!==0){const a=i.current;a!==null&&(u.push(a),o.dispatchCommand(an,!0));const c=l.pop();l.length===0&&o.dispatchCommand(un,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Y),r.registerCommand(Ba,()=>(zo(e),!1),Y),r.registerCommand(Na,()=>(zo(e),r.dispatchCommand(un,!1),r.dispatchCommand(an,!1),!0),Y),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:u,tags:a})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const p=n(i,o,c,l,u,a);if(p===Ws)d.length!==0&&(e.redoStack=[],r.dispatchCommand(un,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(an,!0));else if(p===Ks)return;e.current={editor:r,editorState:o}}))}function Ld(){return{current:null,redoStack:[],undoStack:[]}}function jd({delay:r,externalHistoryState:e}){const[t]=Je();return function(n,s,o=1e3){const i=A.useMemo(()=>s||Ld(),[s]);A.useEffect(()=>Fd(n,i,o),[o,n,i])}(t,e,r),null}const Pd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Od({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=Je();return Pd(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:u})=>{e&&o.size===0&&i.size===0||r&&u.has("history-merge")||l.isEmpty()||t(s,n,u)})},[n,r,e,t]),null}function Vs(r,e){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Vs(r,e)}var qo={error:null},Md=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),u=0;u<i;u++)l[u]=arguments[u];return(o=r.call.apply(r,[this].concat(l))||this).state=qo,o.resetErrorBoundary=function(){for(var a,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];o.props.onReset==null||(a=o.props).onReset.apply(a,d),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,Vs(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,u;(l=(u=this.props).onError)==null||l.call(u,o,i)},s.componentDidUpdate=function(o,i){var l,u,a,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((a=o.resetKeys)===void 0&&(a=[]),(c=f)===void 0&&(c=[]),a.length!==c.length||a.some(function(h,p){return!Object.is(h,c[p])}))&&((l=(u=this.props).onResetKeysChange)==null||l.call(u,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,u=i.FallbackComponent,a=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(us.isValidElement(a))return a;if(typeof l=="function")return l(c);if(u)return us.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(us.Component);function Rd({children:r,onError:e}){return g.jsx(Md,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function $d(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var tt=$d(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 Id(r){let e=1,t=r.getParent();for(;t!=null;){if(se(t)){const n=t.getParent();if(Q(n)){e++,t=n.getParent();continue}tt(40)}return e}return e}function Gs(r){let e=r.getParent();Q(e)||tt(40);let t=e;for(;t!==null;)t=t.getParent(),Q(t)&&(e=t);return e}function vu(r){let e=[];const t=r.getChildren().filter(se);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();Q(o)?e=e.concat(vu(o)):e.push(s)}return e}function rt(r){return se(r)&&Q(r.getFirstChild())}function Uo(r){return Le().append(r)}function Du(r,e){return se(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Wo(r,e){r.update(()=>{const t=q();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&tt(143);const[i]=o,l=i.getNode(),u=l.getParent();if(Du(l,n)){const a=Be(e);if(st(u)){l.replace(a);const c=Le();B(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),a.append(c)}else if(se(l)){const c=l.getParentOrThrow();$t(a,c.getChildren()),c.replace(a)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!B(i)||!i.isEmpty()||se(i)||s.has(i.getKey())){if(Al(i)){let l=i.getParent();for(;l!=null;){const u=l.getKey();if(Q(l)){if(!s.has(u)){const a=Be(e);$t(a,l.getChildren()),l.replace(a),s.add(u)}break}{const a=l.getParent();if(st(a)&&!s.has(u)){s.add(u),Ko(l,e);break}l=a}}}}else Ko(i,e)}}})}function $t(r,e){r.splice(r.getChildrenSize(),0,e)}function Ko(r,e){if(Q(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=Le();let o;if($t(s,r.getChildren()),Q(t)&&e===t.getListType())t.append(s),Q(n)&&e===n.getListType()&&($t(t,n.getChildren()),n.remove()),o=t;else if(Q(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=Be(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ci(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&rt(t)&&rt(n)&&(Ci(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=q();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Du(s,n))t.add(Gs(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Al(i)){const l=td(i,zt);l!=null&&t.add(Gs(l))}}for(const o of t){let i=o;const l=vu(o);for(const u of l){const a=ce();$t(a,u.getChildren()),i.insertAfter(a),i=a,u.__key===e.anchor.key&&e.anchor.set(a.getKey(),0,"element"),u.__key===e.focus.key&&e.focus.set(a.getKey(),0,"element"),u.remove()}o.remove()}}})}function qd(r){const e=new Set;if(rt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(rt(n)&&rt(s)){const o=s.getFirstChild();if(Q(o)){o.append(r);const i=n.getFirstChild();Q(i)&&($t(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(rt(n)){const o=n.getFirstChild();if(Q(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(rt(s)){const o=s.getFirstChild();Q(o)&&o.append(r)}else if(Q(t)){const o=Le(),i=Be(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Ud(r){if(rt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(Q(t?t.getParent():void 0)&&se(t)&&Q(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=Le(),l=Be(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const u=Le(),a=Be(o);u.append(a),$t(a,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(u),t.replace(r)}}}function Wd(){const r=q();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!se(e)||e.getChildrenSize()!==0)return!1;const t=Gs(e),n=e.getParent();Q(n)||tt(40);const s=n.getParent();let o;if(st(s))o=ce(),t.insertAfter(o);else{if(!se(s))return!1;o=Le(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=Be(n.getListType());if(ir(o))o.insertAfter(l);else{const u=Le();u.append(l),o.insertAfter(u)}i.forEach(u=>{u.remove(),l.append(u)})}return function(l){let u=l;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const a=u.getParent();if(a==null||!se(u)&&!Q(u))break;u=a}u.remove()}(e),!0}function Rn(...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 zt extends pt{static getType(){return"listitem"}static clone(e){return new zt(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 Q(n)&&n.getListType()==="check"&&Go(t,this,null),t.value=this.__value,Vo(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return Q(s)&&s.getListType()==="check"&&Go(t,this,e),t.value=this.__value,Vo(t,n.theme,this),!1}static transform(){return e=>{if(se(e)||tt(144),e.__checked==null)return;const t=e.getParent();Q(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Kd,priority:0})}}static importJSON(e){const t=Le();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(B(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(se(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Q(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=Be(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&&(B(e)||tt(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(Q(n)||tt(39),se(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=Be(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&&rt(t)&&rt(n)&&(Ci(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Le(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ce();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=se(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,u=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(u,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(u,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 Q(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(;se(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&tt(117),(e=Math.floor(e))>=0||tt(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(Ud(this),t--);return this}canInsertAfter(e){return se(e)}canReplaceWith(e){return se(e)}canMergeWith(e){return ir(e)||se(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 Be("bullet")}canMergeWhenEmpty(){return!0}}function Vo(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(...Rn(i)),o){const u=t.getParent(),a=Q(u)&&u.getListType()==="check",c=t.getChecked();a&&!c||s.push(o.listitemUnchecked),a&&c||s.push(o.listitemChecked),a&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const u=Rn(l);t.getChildren().some(a=>Q(a))?n.push(...u):s.push(...u)}s.length>0&&hu(r,...s),n.length>0&&en(r,...n)}function Go(r,e,t,n){Q(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 Kd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Vd(t)}const e=r.getAttribute("aria-checked");return{node:Le(e==="true"||e!=="false"&&void 0)}}function Vd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:Le(r.hasAttribute("checked"))}}function Le(r){return ot(new zt(void 0,r))}function se(r){return r instanceof zt}class ar extends pt{static getType(){return"list"}static clone(e){const t=e.__listType||Qo[e.__tag];return new ar(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Qo[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,Ho(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(Ho(t,n.theme,this),!1)}static transform(){return e=>{Q(e)||tt(163),function(t){const n=t.getNextSibling();Q(n)&&t.getListType()===n.getListType()&&Ci(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())se(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),Q(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:Jo,priority:0}),ul:()=>({conversion:Jo,priority:0})}}static importJSON(e){const t=Be(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&&ft(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(se(n))super.append(n);else{const s=Le();if(Q(n))s.append(n);else if(B(n))if(n.isInline())s.append(n);else{const o=de(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return se(e)}}function Ho(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=Id(t)-1,u=l%i.length,a=i[u],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),a!==void 0){n.push(...Rn(a));for(let p=0;p<i.length;p++)p!==u&&s.push(t.__tag+p)}if(d!==void 0){const p=Rn(d);l>1?n.push(...p):s.push(...p)}}s.length>0&&hu(r,...s),n.length>0&&en(r,...n)}function Gd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(se(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{Q(o)&&e.push(Uo(o))})}else e.push(Uo(n))}return e}function Jo(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=Be("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(ft(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?Be("check"):Be("bullet")),{after:Gd,node:t}}const Qo={ol:"number",ul:"bullet"};function Be(r,e=1){return ot(new ar(r,e))}function Q(r){return r instanceof ar}const Cu=Ur(),wu=Ur(),Hd=Ur();function Jd(r){return It(r.registerCommand(wu,()=>(Wo(r,"number"),!0),Xt),r.registerCommand(Cu,()=>(Wo(r,"bullet"),!0),Xt),r.registerCommand(Hd,()=>(zd(r),!0),Xt),r.registerCommand(Or,()=>!!Wd(),Xt))}function Qd(){const[r]=Je();return A.useEffect(()=>{if(!r.hasNodes([ar,zt]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){A.useEffect(()=>Jd(e),[e])}(r),null}const Yd=new Set(["http:","https:","mailto:","sms:","tel:"]);class qt extends pt{static getType(){return"link"}static clone(e){return new qt(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),en(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=$n(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=$n(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(ac(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=$n(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function $n(r,e){return ot(new qt(r,e))}function Dr(r){return r instanceof qt}class tn extends qt{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 tn(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=Yo(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(B(n)){const s=Yo(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function Yo(r,e){return ot(new tn(r,e))}function Zd(r){return r instanceof tn}const Xo=Ur();function Cs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=q();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const u=es(l,a=>!Zd(a)&&Dr(a));if(u){const a=u.getChildren();for(let c=0;c<a.length;c++)u.insertBefore(a[c]);u.remove()}});else{if(i.length===1){const a=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(i[0],Dr);if(a!==null)return a.setURL(r),t!==void 0&&a.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n))}let l=null,u=null;i.forEach(a=>{const c=a.getParent();if(c!==u&&c!==null&&(!B(a)||a.isInline())){if(Dr(c))return u=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n));if(c.is(l)||(l=c,u=$n(r,{rel:s,target:t,title:n}),Dr(c)?a.getPreviousSibling()===null?c.insertBefore(u):c.insertAfter(u):a.insertBefore(u)),Dr(a)){if(a.is(u))return;if(u!==null){const d=a.getChildren();for(let f=0;f<d.length;f++)u.append(d[f])}a.remove()}else u!==null&&u.append(a)}})}}function ef({validateUrl:r,attributes:e}){const[t]=Je();return A.useEffect(()=>{if(!t.hasNodes([qt]))throw new Error("LinkPlugin: LinkNode not registered on editor");return It(t.registerCommand(Xo,n=>{if(n===null)return Cs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Cs(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Cs(s,{...e,rel:i,target:o,title:l}),!0}},Xt),r!==void 0?t.registerCommand(zn,n=>{const s=q();if(!P(s)||s.isCollapsed()||!vt(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=>B(l))&&(t.dispatchCommand(Xo,{...e,url:i}),n.preventDefault(),!0)},Xt):()=>{})},[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}){const[t]=Je(),n=A.useCallback(()=>{t.dispatchCommand(Ge,"bold")},[t]),s=A.useCallback(()=>{t.dispatchCommand(Ge,"italic")},[t]),o=A.useCallback(()=>{t.dispatchCommand(Ge,"underline")},[t]),i=A.useCallback(()=>{t.dispatchCommand(Cu,void 0)},[t]),l=A.useCallback(()=>{t.dispatchCommand(wu,void 0)},[t]),u=A.useCallback(()=>{t.update(()=>{const d=q();P(d)&&Jc(d,()=>Di())})},[t]),a={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},c=`
|
|
71
|
+
`?n.push(nr()):i===" "?n.push(dn()):n.push(Te(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,D,y,A){const v=b.getNode(),S=v.getChildAtIndex(b.offset),C=Te(),_=Ke(v)?Ee().append(C):C;C.setFormat(y),C.setStyle(A),S===null?v.append(_):S.insertBefore(_),b.is(D)&&D.set(C.__key,0,"text"),b.set(C.__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];q(f)||$(26);const h=f.getTextContent().length,p=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()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let b=f.getNextSibling();if(q(b)&&b.canInsertTextBefore()&&!Jt(b)||(b=Te(),b.setFormat(s),b.setStyle(o),p.canInsertTextAfter()?f.insertAfter(b):p.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()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let b=f.getPreviousSibling();if(q(b)&&!Jt(b)||(b=Te(),b.setFormat(s),p.canInsertTextBefore()?f.insertBefore(b):p.insertBefore(b)),b.select(),f=b,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const b=Te(f.getTextContent());b.setFormat(s),f.replace(b),f=b}else if(!this.isCollapsed()&&e!==""){const b=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||F(b)&&(!b.canInsertTextBefore()||!b.canInsertTextAfter()))return this.insertText(""),Zl(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const A=Te(e);return A.select(),void f.replace(A)}const b=f.getFormat(),D=f.getStyle();if(a!==u||b===s&&D===o){if(Dc(f)){const A=Te(e);return A.setFormat(s),A.setStyle(o),A.select(),void f.replace(A)}}else{if(f.getTextContent()!==""){const A=Te(e);if(A.setFormat(s),A.setStyle(o),A.select(),a===0)f.insertBefore(A,!1);else{const[v]=f.splitText(a);v.insertAfter(A,!1)}return void(A.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const y=u-a;f=f.spliceText(a,y,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=b,this.style=D))}else{const b=new Set([...f.getParentKeys(),...m.getParentKeys()]),D=F(f)?f:f.getParentOrThrow();let y=F(m)?m:m.getParentOrThrow(),A=m;if(!D.is(y)&&y.isInline())do A=y,y=y.getParentOrThrow();while(y.isInline());if(l.type==="text"&&(u!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<u)if(q(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const E=Te(m.getTextContent());m.replace(E),m=E}Ke(l.getNode())||l.type!=="text"||(m=m.spliceText(0,u,"")),b.add(m.__key)}else{const E=m.getParentOrThrow();E.canBeEmpty()||E.getChildrenSize()!==1?m.remove():E.remove()}else b.add(m.__key);const v=y.getChildren(),S=new Set(c),C=D.is(y),_=D.isInline()&&f.getNextSibling()===null?D:f;for(let E=v.length-1;E>=0;E--){const k=v[E];if(k.is(f)||F(k)&&k.isParentOf(f))break;k.isAttached()&&(!S.has(k)||k.is(A)?C||_.insertAfter(k,!1):k.remove())}if(!C){let E=y,k=null;for(;E!==null;){const I=E.getChildren(),B=I.length;(B===0||I[B-1].is(k))&&(b.delete(E.__key),k=E),E=E.getParent()}}if(f.isToken())if(a===h)f.select();else{const E=Te(e);E.select(),f.replace(E)}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 E=1;E<d;E++){const k=c[E],I=k.__key;b.has(I)||k.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=jr(i,Pt),u=jr(l,Pt);q(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&q(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{Gr(i,d)||Gr(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&&Jt(d)){const h=Te(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&q(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(q(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}q(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&q(i)?i.selectEnd():l.isAttached()&&q(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 Me(null);const n=this.getNodes(),s=[];for(const v of n)q(v)&&s.push(v);const o=v=>{n.forEach(S=>{if(Cr(S)){const C=S.getFormatFlags(e,v);S.setTextFormat(C)}})},i=s.length;if(i===0)return this.toggleFormat(e),Me(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],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(f=1,h=s[1],p=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const b=i-1;let D=s[b];const y=d.type==="text"?d.offset:D.getTextContentSize();if(h.is(D)){if(p===y)return;if(Jt(h)||p===0&&y===h.getTextContentSize())h.setFormat(m);else{const v=h.splitText(p,y),S=p===0?v[0]:v[1];S.setFormat(m),c.type==="text"&&c.set(S.__key,0,"text"),d.type==="text"&&d.set(S.__key,y-p,"text")}return void(this.format=m)}p===0||Jt(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const A=D.getFormatFlags(e,m);y>0&&(y===D.getTextContentSize()||Jt(D)||([D]=D.splitText(y)),D.setFormat(A));for(let v=f+1;v<b;v++){const S=s[v],C=S.getFormatFlags(e,A);S.setFormat(C)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(D.__key,y,"text"),this.format=m|A}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=V();return M(p)||$(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=jr(t,Pt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=Ts(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(F(p)||de(p))&&!p.isInline())){F(n)||$(211,t.constructor.name,t.getType());const p=Ts(this);return n.splice(p,0,e),void s.selectEnd()}const o=function(p){const m=Ee();let b=null;for(let D=0;D<p.length;D++){const y=p[D],A=Zt(y);if(A||de(y)&&y.isInline()||F(y)&&y.isInline()||q(y)||y.isParentRequired()){if(b===null&&(b=y.createParentElementNode(),m.append(b),A))continue;b!==null&&b.append(y)}else m.append(y),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)&&Pt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||$(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&$(212,t.constructor.name,t.getType()),function(p,m,b){const D=m.getParentOrThrow().getLastChild();let y=m;const A=[m];for(;y!==D;)y.getNextSibling()||$(140),y=y.getNextSibling(),A.push(y);let v=p;for(const S of A)v=v.insertAfter(S)}(n,c));const f=jr(i,Pt);a&&F(f)&&(a.canMergeWhenEmpty()||Pt(u))&&(f.append(...a.getChildren()),a.remove()),F(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=F(n)?n.getLastChild():null;Zt(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=Ee();return _e().splice(this.anchor.offset,0,[i]),i.select(),i}const e=Ts(this),t=jr(this.anchor.getNode(),Pt);F(t)||$(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=nr();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]=Js(this);if(t===0)return[];if(t===1){if(q(i)&&!this.isCollapsed()){const d=a>u?u:a,f=a>u?a:u,h=i.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[i]}const c=s.isBefore(o);if(q(i)){const d=c?a:u;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(q(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=Zr(s,t);if(de(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=bo();return h.add(l.__key),void Ct(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(q(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(i&&o.set(h,p,"text"))}{const h=l.getParentOrThrow();let p,m;return F(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=l.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(i&&o.set(m,p,"element"))}}const a=Ce(),u=lt(a._window);if(!u)return;const c=a._blockCursorElement,d=a._rootElement;if(d===null||c===null||!F(l)||l.isInline()||l.canBeEmpty()||Ci(c,a,d),function(f,h,p,m){f.modify(h,p,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),p=Ke(h)?h:lc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),b=[];let D=!1;for(let y=0;y<m.length;y++){const A=m[y];Gr(A,p)?b.push(A):D=!0}if(D&&b.length>0)if(t){const y=b[0];F(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{const y=b[b.length-1];F(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(y){const A=y.focus,v=y.anchor,S=v.key,C=v.offset,_=v.type;Ot(v,A.key,A.offset,A.type),Ot(A,S,C,_),y._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=Zr(o,e);if(de(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const l=bo();l.add(i.__key),Ct(l)}else i.remove(),Ce().dispatchCommand(ni,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 mo(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 mo(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 p=c.offset,m=d.offset,b=p<m,D=b?p:m,y=b?m:p,A=y-1;D!==A&&(Ll(f.getTextContent().slice(D,y))||(u?d.offset=A:c.offset=A))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&Ke(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 bt(r){return r instanceof ls}function go(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function Js(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]:[go(t),go(n)]}function mo(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 yo(r,e,t,n){let s,o=e;if(r.nodeType===on){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=pr(c),q(s))o=Yi(s,i);else{let f=pr(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&$(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||$(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(F(m)&&function(b,D,y){const A=b.getParent();return y===null||A===null||!A.canBeEmpty()||A!==y.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}q(m)?(s=m,f=null,o=Yi(m,i)):m!==f&&i&&!d&&(F(f)||$(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&de(f)&&pr(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return Dt(f.__key,o,"element")}}else s=pr(r);return q(s)?Dt(s.__key,o,"text"):null}function xo(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();q(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"):q(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();q(l)&&(r.key=l.__key,r.offset=0)}}}function Zl(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);xo(r,n,s),xo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=Ce();if(o.isComposing()&&o._compositionKey!==r.key&&M(t)){const i=t.anchor,l=t.focus;Ot(r,i.key,i.offset,i.type),Ot(e,l.key,l.offset,l.type)}}}function ea(r,e,t,n,s,o){if(r===null||t===null||!ln(s,r,t))return null;const i=yo(r,e,M(o)?o.anchor:null,s);if(i===null)return null;const l=yo(t,n,M(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const a=pr(r),u=pr(t);if(de(a)&&de(u))return null}return Zl(i,l,o),[i,l]}function Qs(r){return F(r)&&!r.isInline()}function ta(r,e,t,n,s,o){const i=Ft(),l=new Wt(Dt(r,e,s),Dt(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Ec(){const r=Dt("root",0,"element"),e=Dt("root",0,"element");return new Wt(r,e,0,"")}function bo(){return new ls(new Set)}function Ei(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=!Ps&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let u,c,d,f;if(M(r)&&!a)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&M(r)&&!ln(t,u,c))return r.clone();const h=ea(u,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new Wt(p,m,M(r)?r.format:0,M(r)?r.style:"")}function V(){return Ft()._selection}function fn(){return Ce()._editorState._selection}function Gn(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"),_o(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 p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(a,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(a,Math.max(0,p+n),"element")}}_o(r)}function _o(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(q(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(q(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(q(u)){let c=0;a&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function Kn(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,q(n)?(i=n.getTextContentSize(),l="text"):F(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,q(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 vo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Sc(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&&mi(d))return;if(!M(e))return void(r!==null&&ln(t,l,a)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,b=$n(t,p),D=$n(t,m),y=f.offset,A=h.offset,v=e.format,S=e.style,C=e.isCollapsed();let _=b,E=D,k=!1;if(f.type==="text"){_=Pn(b);const R=f.getNode();k=R.getFormat()!==v||R.getStyle()!==S}else M(r)&&r.anchor.type==="text"&&(k=!0);var I,B,N,j,L;if(h.type==="text"&&(E=Pn(D)),_!==null&&E!==null&&(C&&(r===null||k||M(r)&&(r.format!==v||r.style!==S))&&(I=v,B=S,N=y,j=p,L=performance.now(),Kl=[I,B,N,j,L]),u!==y||c!==A||l!==_||a!==E||n.type==="Range"&&C||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(_,y,E,A)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const R=e instanceof Wt&&e.anchor.type==="element"?_.childNodes[y]||null:n.rangeCount>0?n.getRangeAt(0):null;if(R!==null){let ee;if(R instanceof Text){const ye=document.createRange();ye.selectNode(R),ee=ye.getBoundingClientRect()}else ee=R.getBoundingClientRect();(function(ye,me,je){const Ne=je.ownerDocument,He=Ne.defaultView;if(He===null)return;let{top:Se,bottom:qe}=me,rt=0,$e=0,fe=je;for(;fe!==null;){const Ie=fe===Ne.body;if(Ie)rt=0,$e=ss(ye).innerHeight;else{const he=fe.getBoundingClientRect();rt=he.top,$e=he.bottom}let Re=0;if(Se<rt?Re=-(rt-Se):qe>$e&&(Re=qe-$e),Re!==0)if(Ie)He.scrollBy(0,Re);else{const he=fe.scrollTop;fe.scrollTop+=Re;const Ue=fe.scrollTop-he;Se-=Ue,qe-=Ue}if(Ie)break;fe=an(fe)}})(t,ee,o)}}Ks=!0}}function ra(r){let e=V()||fn();e===null&&(e=_e().selectEnd()),e.insertNodes(r)}function Ts(r){let e=r;r.isCollapsed()||e.removeText();const t=V();M(t)&&(e=t),M(e)||$(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!Pt(s);)[s,o]=kc(s,o);return o}function kc(r,e){const t=r.getParent();if(!t){const s=Ee();return _e().append(s),s.select(),[_e(),0]}if(q(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 Wt(Dt(r.__key,e,"element"),Dt(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Fe=null,Le=null,et=!1,Bs=!1,kn=0;const Co={characterData:!0,childList:!0,subtree:!0};function hn(){return et||Fe!==null&&Fe._readOnly}function Ze(){et&&$(13)}function na(){kn>99&&$(14)}function Ft(){return Fe===null&&$(195,sa()),Fe}function Ce(){return Le===null&&$(196,sa()),Le}function sa(){let r=0;const e=new Set,t=us.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=ts(s);if(yi(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 Le}function wo(r,e,t){const n=e.__type,s=function(l,a){const u=l._nodes.get(a);return u===void 0&&$(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 Do(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function ia(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 Si(r,Ce()._nodes)}function Si(r,e){const t=r.type,n=e.get(t);n===void 0&&$(17,t);const s=n.klass;r.type!==s.getType()&&$(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=Si(i[l],e);o.append(a)}return o}function Ao(r,e,t){const n=Fe,s=et,o=Le;Fe=e,et=!0,Le=r;try{return t()}finally{Fe=n,et=s,Le=o}}function $t(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!==er,u=Fe,c=et,d=Le,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&a&&h!==null){Le=r,Fe=t,et=!1,r._updating=!0;try{const C=r._dirtyType,_=r._dirtyElements,E=r._dirtyLeaves;h.disconnect(),p=mc(o,t,r,C,_,E)}catch(C){if(C instanceof Error&&r._onError(C),Bs)throw C;return ca(r,null,n,t),El(r),r._dirtyType=_r,Bs=!0,$t(r,o),void(Bs=!1)}finally{h.observe(n,Co),r._updating=f,Fe=u,et=c,Le=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,b=r._dirtyElements,D=r._normalizedNodes,y=r._updateTags,A=r._deferred;a&&(r._dirtyType=er,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(C,_){const E=C._decorators;let k=C._pendingDecorators||E;const I=_._nodeMap;let B;for(B in k)I.has(B)||(k===E&&(k=Nl(C)),delete k[B])}(r,t);const v=s?null:lt(r._window);if(r._editable&&v!==null&&(a||l===null||l.dirty)){Le=r,Fe=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const C=r._blockCursorElement;C!==null&&Ci(C,r,n),Sc(i,l,r,v,y,n)}ac(r,n,l),h!==null&&h.observe(n,Co)}finally{Le=d,Fe=u}}p!==null&&function(C,_,E,k,I){const B=Array.from(C._listeners.mutation),N=B.length;for(let j=0;j<N;j++){const[L,R]=B[j],ee=_.get(R);ee!==void 0&&L(ee,{dirtyLeaves:k,prevEditorState:I,updateTags:E})}}(r,p,y,m,o),M(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(ni,void 0);const S=r._pendingDecorators;S!==null&&(r._decorators=S,r._pendingDecorators=null,Hr("decorator",r,!0,S)),function(C,_,E){const k=Qi(_),I=Qi(E);k!==I&&Hr("textcontent",C,!0,I)}(r,e||o,t),Hr("update",r,!0,{dirtyElements:b,dirtyLeaves:m,editorState:t,normalizedNodes:D,prevEditorState:e||o,tags:y}),function(C,_){if(C._deferred=[],_.length!==0){const E=C._updating;C._updating=!0;try{for(let k=0;k<_.length;k++)_[k]()}finally{C._updating=E}}}(r,A),function(C){const _=C._updates;if(_.length!==0){const E=_.shift();if(E){const[k,I]=E;la(C,k,I)}}}(r)}function Hr(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 oa(r,e,t){if(r._updating===!1||Le!==r){let s=!1;return r.update(()=>{s=oa(r,e,t)}),s}const n=xi(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 Eo(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&&$(191),a._flushSync=!0}l&&r._deferred.push(l),ia(r,i.tag)}o()}}return n}function la(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,ia(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=aa(a||l),u=!0),a._flushSync=i;const c=Fe,d=et,f=Le,h=r._updating;Fe=a,et=!1,r._updating=!0,Le=r;try{u&&(r._headless?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(D){const y=D.getEditorState()._selection,A=lt(D._window);return M(y)||y==null?Ei(y,A,D,null):y.clone()}(r));const m=r._compositionKey;e(),o=Eo(r,o),function(D,y){const A=y.getEditorState()._selection,v=D._selection;if(M(v)){const S=v.anchor,C=v.focus;let _;if(S.type==="text"&&(_=S.getNode(),_.selectionTransform(A,v)),C.type==="text"){const E=C.getNode();_!==E&&E.selectionTransform(A,v)}}}(a,r),r._dirtyType!==er&&(o?function(D,y){const A=y._dirtyLeaves,v=D._nodeMap;for(const S of A){const C=v.get(S);q(C)&&C.isAttached()&&C.isSimpleText()&&!C.isUnmergeable()&&Hi(C)}}(a,r):function(D,y){const A=y._dirtyLeaves,v=y._dirtyElements,S=D._nodeMap,C=Mt(),_=new Map;let E=A,k=E.size,I=v,B=I.size;for(;k>0||B>0;){if(k>0){y._dirtyLeaves=new Set;for(const N of E){const j=S.get(N);q(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&Hi(j),j!==void 0&&Do(j,C)&&wo(y,j,_),A.add(N)}if(E=y._dirtyLeaves,k=E.size,k>0){kn++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map;for(const N of I){const j=N[0],L=N[1];if(j!=="root"&&!L)continue;const R=S.get(j);R!==void 0&&Do(R,C)&&wo(y,R,_),v.set(j,L)}E=y._dirtyLeaves,k=E.size,I=y._dirtyElements,B=I.size,kn++}y._dirtyLeaves=A,y._dirtyElements=v}(a,r),Eo(r),function(D,y,A,v){const S=D._nodeMap,C=y._nodeMap,_=[];for(const[E]of v){const k=C.get(E);k!==void 0&&(k.isAttached()||(F(k)&&Ol(k,E,S,C,_,v),S.has(E)||v.delete(E),_.push(E)))}for(const E of _)C.delete(E);for(const E of A){const k=C.get(E);k===void 0||k.isAttached()||(S.has(E)||A.delete(E),C.delete(E))}}(l,a,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(a._flushSync=!0);const b=a._selection;if(M(b)){const D=a._nodeMap,y=b.anchor.key,A=b.focus.key;D.get(y)!==void 0&&D.get(A)!==void 0||$(19)}else bt(b)&&b._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=_r,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void $t(r)}finally{Fe=c,et=d,Le=f,r._updating=h,kn=0}r._dirtyType!==er||function(m,b){const D=b.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(D))return!0}else if(D!==null)return!0;return!1}(a,r)?a._flushSync?(a._flushSync=!1,$t(r)):u&&rc(()=>{$t(r)}):(a._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function st(r,e,t){r._updating?r._updates.push([e,t]):la(r,e,t)}class Jr{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Jr(this.element,e,this.after)}withAfter(e){return new Jr(this.element,this.before,e)}withElement(e){return new Jr(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&$(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(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"&&(sn||Zn);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=So(t,n);o.push(s);const i=So(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 So(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&&$(225),t.reverse()}class Lt extends os{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=Ce()._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(q(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:ze(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&$(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:ze(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&$(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+=Bt)}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+=Bt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Gi[e];return!!(this.getFormat()&t)}return!1}select(e,t){Ze();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(q(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(q(a)||F(a))return a.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return M(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):ta(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!==""?Gi[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||$(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 p=this.getChildAtIndex(e);p!==null&&(d=p.getPreviousSibling())}if(t>0){let p=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){p===null&&$(100);const b=p.getNextSibling(),D=p.__key;Xt(p.getWritable()),u.push(D),p=b}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const b=m.getWritable();b.__parent===l&&f--,Xt(b);const D=m.__key;if(h===null)i.__first=D,b.__prev=null;else{const y=h.getWritable();y.__next=D,b.__prev=y.__key}m.__key===l&&$(76),b.__parent=l,a.push(D),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const m=h.getWritable();p.__prev=h.__key,m.__next=c.__key}else p.__prev=null}if(i.__size=f,u.length){const p=V();if(M(p)){const m=new Set(u),b=new Set(a),{anchor:D,focus:y}=p;ko(D,m,b)&&Kn(D,D.getNode(),this,d,c),ko(y,m,b)&&Kn(y,y.getNode(),this,d,c),f!==0||this.canBeEmpty()||wt(this)||this.remove()}}return i}getDOMSlot(e){return new Jr(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Nt(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 Lt}function ko(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 os{constructor(e){super(e)}decorate(e,t){$(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function de(r){return r instanceof Nc}class pn extends Lt{static getType(){return"root"}static clone(){return new pn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const e=this.__cachedText;return!hn()&&Ce()._dirtyType!==er||e===null?super.getTextContent():e}remove(){$(52)}replace(e){$(53)}insertBefore(e){$(54)}insertAfter(e){$(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||de(n)||$(56)}return super.append(...e)}static importJSON(e){const t=_e();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 Ke(r){return r instanceof pn}function aa(r){return new as(new Map(r._nodeMap))}function ki(){return new as(new Map([["root",new pn]]))}function ua(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&$(130,t.name),F(r)){const n=e.children;Array.isArray(n)||$(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=ua(s[o]);n.push(i)}}return e}class as{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 Ao(t&&t.editor||null,this,e)}clone(e){const t=new as(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Ao(null,this,()=>({root:ua(_e())}))}}class Ti extends Lt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Dr extends Lt{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=tr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return On(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 Dr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Wr(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&&Nt(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=Ee();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=Ee();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||q(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=Ee();return r.style&&(e.setFormat(r.style.textAlign),Di(r,e)),{node:e}}function Ee(){return At(new Dr)}function Cr(r){return r instanceof Dr}const ae=0,gr=1,Lc=4;function ca(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=ki(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=er,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 jc(r){const e=r||{},t=Tc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=ki(),l=e.namespace||(s!==null?s._config.namespace:jl()),a=e.editorState,u=[pn,wr,un,cn,Dr,Ti,...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],D=null,y=null;if(typeof b!="function"){const C=b;b=C.replace,D=C.with,y=C.withKlass||null}const A=b.getType(),v=b.transform(),S=new Set;v!==null&&S.add(v),h.set(A,{exportDOM:d&&d.export?d.export.get(b):void 0,klass:b,replace:D,replaceWithKlass:y,transforms:S})}}const p=new us(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,b){const D=new Map,y=new Set,A=v=>{Object.keys(v).forEach(S=>{let C=D.get(S);C===void 0&&(C=[],D.set(S,C)),C.push(v[S])})};return m.forEach(v=>{const S=v.klass.importDOM;if(S==null||y.has(S))return;y.add(S);const C=S.call(v.klass);C!==null&&A(C)}),b&&A(b),D}(h,d?d.import:void 0),f);return a!==void 0&&(p._pendingEditorState=a,p._dirtyType=_r),p}class us{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=er,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=jl(),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&&$(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&&$(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&&$(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(),st(i,()=>{const a=Ft();if(a.isEmpty())return;if(l==="root")return void _e().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=Wr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,ca(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=_r,El(this),this._updateTags.add("history-merge"),$t(this),this._config.disableEvents||function(l,a){const u=l.ownerDocument,c=Wn.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",Ql),Wn.set(u,(c||0)+1),l.__lexicalEditor=a;const d=Jl(l);for(let f=0;f<Gs.length;f++){const[h,p]=Gs[f],m=typeof p=="function"?b=>{uo(b)||(ao(b),(a.isEditable()||h==="click")&&p(b,a))}:b=>{if(uo(b))return;ao(b);const D=a.isEditable();switch(h){case"cut":return D&&G(a,oi,b);case"copy":return G(a,Xn,b);case"paste":return D&&G(a,Yn,b);case"dragstart":return D&&G(a,xl,b);case"dragover":return D&&G(a,bl,b);case"dragend":return D&&G(a,Tu,b);case"focus":return D&&G(a,Fu,b);case"blur":return D&&G(a,Lu,b);case"drop":return D&&G(a,yl,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;Hr("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&$(38);let n=e;n._readOnly&&(n=aa(e),n._selection=e._selection?e._selection.clone():null),Al(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),$t(this)),this._pendingEditorState=n,this._dirtyType=_r,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||$t(this)}parseEditorState(e,t){return function(n,s,o){const i=ki(),l=Fe,a=et,u=Le,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,Fe=i,et=!1,Le=s;try{const p=s._nodes;Si(n.root,p),o&&o(),i._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Fe=l,et=a,Le=u}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return $t(this),this.getEditorState().read(e,{editor:this})}update(e,t){st(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),st(this,()=>{const s=V(),o=_e();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=lt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Hr("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}us.version="0.21.0+prod.esm";const da=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Rc=da?w.useLayoutEffect:w.useEffect,Cn={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=jc({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=_e();if(h.isEmpty()){const p=Ee();h.append(p);const m=da?document.activeElement:null;(V()!==null||m!==null&&m===d.getRootElement())&&p.select()}},Cn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Cn);break}case"object":d.setEditorState(f,Cn);break;case"function":d.update(()=>{_e().isEmpty()&&f(d)},Cn)}}}(c,l),[c,u]},[]);return Rc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(al.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 $c(){return function(r){const[e]=pt(),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 Ic(){return _e().getTextContent()}function zc(r,e=!0){if(r)return!1;let t=Ic();return e&&(t=t.trim()),t===""}function qc(r){if(!zc(r,!1))return!1;const e=_e().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(de(s))return!1;if(F(s)){if(!Cr(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(!q(a))return!1}}}return!0}function fa(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 ha(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]=Js(r),f=i.is(l),h=e.is(o?l:i),p=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):p&&(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=_e(),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(),No);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!No(l))continue;F(l)||Gc(178);const a=e();a.setFormat(l.getFormatType()),a.setIndent(l.getIndent()),l.replace(a,!0)}}function To(r,e){const t=Zr(r.focus,e);return de(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(Ke(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Bo(r,e,t){const n=Yc(r);Qc(r,e,t?!n:n,"character")}function No(r){if(de(r)||!F(r)||wt(r))return!1;const e=r.getFirstChild(),t=e===null||Zt(e)||q(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 pa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ed=pa&&"documentMode"in document?document.documentMode:null;!(!pa||!("InputEvent"in window)||ed)&&"getTargetRanges"in new window.InputEvent("input");function ga(...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 ir(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function gn(r,...e){const t=ga(...e);t.length>0&&r.classList.add(...t)}function ma(r,...e){const t=ga(...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=cs(r,t=>F(t)&&!t.isInline());return F(e)||Zc(4,r.__key),e}const cs=(r,e)=>{let t=r;for(;t!==_e()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function It(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,p]=a;r.update(()=>{const m=V();if(M(m)){const b=m.anchor;let D=b.getNode(),y=0,A=0;if(q(D)&&u>=0&&c>=0&&(y=u,A=u+c,m.setTextNodeRange(D,y,D,A)),y===A&&d===""||(m.insertRawText(d),D=b.getNode()),q(D)){y=f,A=f+h;const v=D.getTextContentSize();y=y>v?v:y,A=A>v?v:A,m.setTextNodeRange(D,y,D,A)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function ya(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(!_a.has(i.nodeName)){const l=va(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof Ti&&i.insertAfter(nr());for(const i of o){const l=i.getChildren();for(const a of l)i.insertBefore(a);i.remove()}}(s),n}function xa(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=_e().getChildren();for(let s=0;s<n.length;s++)ba(r,n[s],t,e);return t.innerHTML}function ba(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=wi(e);h=q(h)&&n!==null?ha(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 p=l[h],m=ba(r,p,f,n);!s&&F(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!o){if((Nt(c)||no(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(no(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const _a=new Set(["STYLE","SCRIPT"]);function va(r,e,t,n,s=new Map,o){let i=[];if(_a.has(r.nodeName))return i;let l=null;const a=function(p,m){const{nodeName:b}=p,D=m._htmlConversions.get(b.toLowerCase());let y=null;if(D!==void 0)for(const A of D){const v=A(p);v!==null&&(y===null||(y.priority||0)<=(v.priority||0))&&(y=v)}return y!==null?y.conversion:null}(r,e),u=a?a(r):null;let c=null;if(u!==null){c=u.after;const p=u.node;if(l=Array.isArray(p)?p[p.length-1]:p,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(p)?p:[l])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!wt(l))&&(l!=null&&Qs(l)||n);for(let p=0;p<d.length;p++)f.push(...va(d[p],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),In(r)&&(f=sd(r,f,h?()=>{const p=new Ti;return t.push(p),p}:Ee)),l==null?f.length>0?i=i.concat(f):In(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Os(p.nextSibling)&&Os(p.previousSibling)}(r)&&(i=i.concat(nr())):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(Qs(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&Qs(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 Vn=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&&Vn(166),M(e)&&e.isCollapsed()||e.getNodes().length===0?"":xa(r,e)}function ld(r,e=V()){return e==null&&Vn(166),M(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ad(r,e))}function Fo(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 Lo(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 Lo(t,ya(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(M(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(M(a)){const u=i[l];u===`
|
|
72
|
+
`||u===`\r
|
|
73
|
+
`?a.insertParagraph():u===" "?a.insertNodes([dn()]):a.insertText(u)}}}else e.insertRawText(o)}function Lo(r,e,t){r.dispatchCommand(_u,{nodes:e,selection:t})||t.insertNodes(e)}function Ca(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=wi(t);u=q(u)&&e!==null?ha(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()&&Vn(58,d.name),F(u)){const f=c.children;Array.isArray(f)||Vn(59,d.name)}return c}(i);if(q(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=Ca(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=_e().getChildren();for(let s=0;s<n.length;s++)Ca(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);q(s)&&Hc(s),e.push(s)}return e}let dr=null;async function jo(r,e,t){if(dr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a(Ro(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=lt(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(Xn,d=>(It(d,ClipboardEvent)&&(c(),dr!==null&&(window.clearTimeout(dr),dr=null),a(Ro(r,d,t))),!0),Lc);dr=window.setTimeout(()=>{c(),dr=null,a(!1)},50),s.execCommand("copy"),i.remove()})}function Ro(r,e,t){if(t===void 0){const s=lt(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!ln(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 Po(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 Ar=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hd=Ar&&"documentMode"in document?document.documentMode:null,pd=!(!Ar||!("InputEvent"in window)||hd)&&"getTargetRanges"in new window.InputEvent("input"),gd=Ar&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Oo=Ar&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,md=Ar&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yd=Ar&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!md,Mo=nn();class ds extends Lt{static getType(){return"quote"}static clone(e){return new ds(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return gn(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&&Nt(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=Bi();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=Ee(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=Ee();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Bi(){return At(new ds)}class fs extends Lt{static getType(){return"heading"}static clone(e){return new fs(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];gn(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:fr,priority:0}),h2:e=>({conversion:fr,priority:0}),h3:e=>({conversion:fr,priority:0}),h4:e=>({conversion:fr,priority:0}),h5:e=>({conversion:fr,priority:0}),h6:e=>({conversion:fr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&$o(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>$o(e)?{conversion:t=>({node:Ir("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Nt(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=Ir(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?Ee():Ir(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=Ee();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?Ee():Ir(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function $o(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function fr(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Ir(e),r.style!==null&&(Di(r,t),t.setFormat(r.style.textAlign))),{node:t}}function xd(r){const e=Bi();return r.style!==null&&(e.setFormat(r.style.textAlign),Di(r,e)),{node:e}}function Ir(r){return At(new fs(r))}function wn(r){let e=null;if(It(r,DragEvent)?e=r.dataTransfer:It(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 Io(r){const e=V();if(!M(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=cs(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 Dn(r){const e=vr(r);return de(e)}function bd(r){return ir(r.registerCommand(ul,e=>{const t=V();return!!bt(t)&&(t.clear(),!0)},0),r.registerCommand(Yt,e=>{const t=V();return!!M(t)&&(t.deleteCharacter(e),!0)},ae),r.registerCommand(Yr,e=>{const t=V();return!!M(t)&&(t.deleteWord(e),!0)},ae),r.registerCommand(Xr,e=>{const t=V();return!!M(t)&&(t.deleteLine(e),!0)},ae),r.registerCommand(yr,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)Fo(n,t,r);else if(M(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},ae),r.registerCommand(js,()=>{const e=V();return!!M(e)&&(e.removeText(),!0)},ae),r.registerCommand(ft,e=>{const t=V();return!!M(t)&&(t.formatText(e),!0)},ae),r.registerCommand(ku,e=>{const t=V();if(!M(t)&&!bt(t))return!1;const n=t.getNodes();for(const s of n){const o=cs(s,i=>F(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},ae),r.registerCommand(mr,e=>{const t=V();return!!M(t)&&(t.insertLineBreak(e),!0)},ae),r.registerCommand(Qr,()=>{const e=V();return!!M(e)&&(e.insertParagraph(),!0)},ae),r.registerCommand(Eu,()=>(ra([dn()]),!0),ae),r.registerCommand(Su,()=>Io(e=>{const t=e.getIndent();e.setIndent(t+1)}),ae),r.registerCommand(Wi,()=>Io(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ae),r.registerCommand(fl,e=>{const t=V();if(bt(t)&&!Dn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(M(t)){const n=Zr(t.focus,!0);if(!e.shiftKey&&de(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},ae),r.registerCommand(hl,e=>{const t=V();if(bt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(M(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===_e().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Zr(t.focus,!1);if(!e.shiftKey&&de(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},ae),r.registerCommand(dl,e=>{const t=V();if(bt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!M(t))return!1;if(To(t,!0)){const n=e.shiftKey;return e.preventDefault(),Bo(t,n,!0),!0}return!1},ae),r.registerCommand(cl,e=>{const t=V();if(bt(t)&&!Dn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!M(t))return!1;const n=e.shiftKey;return!!To(t,!1)&&(e.preventDefault(),Bo(t,n,!1),!0)},ae),r.registerCommand(pl,e=>{if(Dn(e.target))return!1;const t=V();if(!M(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ke(s)&&rd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Wi,void 0)):(!Oo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(Yt,!0))},ae),r.registerCommand(ml,e=>{if(Dn(e.target))return!1;const t=V();return!!M(t)&&(e.preventDefault(),r.dispatchCommand(Yt,!1))},ae),r.registerCommand(Nn,e=>{const t=V();if(!M(t))return!1;if(e!==null){if((Oo||gd||yd)&&pd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(mr,!1)}return r.dispatchCommand(Qr,void 0)},ae),r.registerCommand(gl,()=>{const e=V();return!!M(e)&&(r.blur(),!0)},ae),r.registerCommand(yl,e=>{const[,t]=wn(e);if(t.length>0){const s=Po(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=vr(i);if(l!==null){const a=Ec();if(q(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=Sl(a);Ct(u)}r.dispatchCommand(Mo,t)}return e.preventDefault(),!0}const n=V();return!!M(n)},ae),r.registerCommand(xl,e=>{const[t]=wn(e),n=V();return!(t&&!M(n))},ae),r.registerCommand(bl,e=>{const[t]=wn(e),n=V();if(t&&!M(n))return!1;const s=Po(e.clientX,e.clientY);if(s!==null){const o=vr(s.node);de(o)&&e.preventDefault()}return!0},ae),r.registerCommand(Rs,()=>(oc(),!0),ae),r.registerCommand(Xn,e=>(jo(r,It(e,ClipboardEvent)?e:null),!0),ae),r.registerCommand(oi,e=>(async function(t,n){await jo(n,It(t,ClipboardEvent)?t:null),n.update(()=>{const s=V();M(s)?s.removeText():bt(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),ae),r.registerCommand(Yn,e=>{const[,t,n]=wn(e);return t.length>0&&!n?(r.dispatchCommand(Mo,t),!0):mi(e.target)?!1:V()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=V(),l=It(s,InputEvent)||It(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&Fo(l,i,o)},{tag:"paste"})}(e,r),!0)},ae))}const Ys=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function zo(r){return r.getEditorState().read(fa(r.isComposing()))}function _d({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=pt(),s=function(o,i){const[l,a]=w.useState(()=>o.getDecorators());return Ys(()=>o.registerDecoratorListener(u=>{ji.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=g.jsx(i,{onError:m=>o._onError(m),children:g.jsx(w.Suspense,{fallback:null,children:l[f]})}),p=o.getElementByKey(f);p!==null&&u.push(ji.createPortal(h,p,f))}return u},[i,l,o])}(n,t);return function(o){Ys(()=>ir(bd(o),nd(o)),[o])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=pt(),t=function(s){const[o,i]=w.useState(()=>zo(s));return Ys(()=>{function l(){const a=zo(s);i(a)}return l(),ir(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=$c();return t?typeof r=="function"?r(n):r:null}const wa=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:p,id:m,role:b="textbox",spellCheck:D=!0,style:y,tabIndex:A,"data-testid":v,...S},C){const[_,E]=w.useState(r.isEditable()),k=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)})}}(C,k),[k,C]);return wa(()=>(E(r.isEditable()),r.registerEditableListener(B=>{E(B)})),[r]),g.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:p,contentEditable:_,"data-testid":v,id:m,ref:I,role:_?b:void 0,spellCheck:D,style:y,tabIndex:A,...S})}const wd=w.forwardRef(Cd);function qo(r){return r.getEditorState().read(fa(r.isComposing()))}const Dd=w.forwardRef(Ad);function Ad(r,e){const{placeholder:t,...n}=r,[s]=pt();return g.jsxs(g.Fragment,{children:[g.jsx(wd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Ed,{editor:s,content:t})]})}function Ed({content:r,editor:e}){const t=function(i){const[l,a]=w.useState(()=>qo(i));return wa(()=>{function u(){const c=qo(i);a(c)}return u(),ir(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:g.jsx("div",{"aria-hidden":!0,children:o})}const An=0,Xs=1,Zs=2,dt=0,Sd=1,Uo=2,kd=3,Td=4;function Bd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return dt;const o=e._selection,i=r._selection;if(s)return Sd;if(!(M(o)&&M(i)&&i.isCollapsed()&&o.isCollapsed()))return dt;const l=function(D,y,A){const v=D._nodeMap,S=[];for(const C of y){const _=v.get(C);_!==void 0&&S.push(_)}for(const[C,_]of A){if(!_)continue;const E=v.get(C);E===void 0||Ke(E)||S.push(E)}return S}(e,t,n);if(l.length===0)return dt;if(l.length>1){const D=e._nodeMap,y=D.get(o.anchor.key),A=D.get(i.anchor.key);return y&&A&&!r._nodeMap.has(y.__key)&&q(y)&&y.__text.length===1&&o.anchor.offset===1?Uo:dt}const a=l[0],u=r._nodeMap.get(a.__key);if(!q(u)||!q(a)||u.__mode!==a.__mode)return dt;const c=u.__text,d=a.__text;if(c===d)return dt;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return dt;const p=f.offset,m=h.offset,b=d.length-c.length;return b===1&&m===p-1?Uo:b===-1&&m===p+1?kd:b===-1&&m===p?Td:dt}function Nd(r,e){let t=Date.now(),n=dt;return(s,o,i,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=dt,t=c,Zs;const d=Bd(s,o,l,a,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,p=u.has("history-push");if(!p&&h&&u.has("history-merge"))return An;if(s===null)return Xs;const m=o._selection;return l.size>0||a.size>0?p===!1&&d!==dt&&d===n&&c<t+e&&h||l.size===1&&function(b,D,y){const A=D._nodeMap.get(b),v=y._nodeMap.get(b),S=D._selection,C=y._selection;return!(M(S)&&M(C)&&S.anchor.type==="element"&&S.focus.type==="element"&&C.anchor.type==="text"&&C.focus.type==="text"||!q(A)||!q(v)||A.__parent!==v.__parent)&&JSON.stringify(D.read(()=>A.exportJSON()))===JSON.stringify(y.read(()=>v.exportJSON()))}(Array.from(l)[0],s,o)?An:Xs:m!==null?An:Zs})();return t=c,n=d,f}}function Wo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Fd(r,e,t){const n=Nd(r,t);return ir(r.registerCommand(si,()=>(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(xn,!0)),a.length===0&&o.dispatchCommand(bn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ae),r.registerCommand(ii,()=>(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(bn,!0));const c=l.pop();l.length===0&&o.dispatchCommand(xn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ae),r.registerCommand(Bu,()=>(Wo(e),!1),ae),r.registerCommand(Nu,()=>(Wo(e),r.dispatchCommand(xn,!1),r.dispatchCommand(bn,!1),!0),ae),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 p=n(i,o,c,l,a,u);if(p===Xs)d.length!==0&&(e.redoStack=[],r.dispatchCommand(xn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(bn,!0));else if(p===Zs)return;e.current={editor:r,editorState:o}}))}function Ld(){return{current:null,redoStack:[],undoStack:[]}}function jd({delay:r,externalHistoryState:e}){const[t]=pt();return function(n,s,o=1e3){const i=w.useMemo(()=>s||Ld(),[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]=pt();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 ei(r,e){return ei=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ei(r,e)}var Go={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=Go,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,ei(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Go)},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,p){return!Object.is(h,c[p])}))&&((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(ms.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return ms.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(ms.Component);function Md({children:r,onError:e}){return g.jsx(Od,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function $d(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var _t=$d(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 Id(r){let e=1,t=r.getParent();for(;t!=null;){if(ve(t)){const n=t.getParent();if(oe(n)){e++,t=n.getParent();continue}_t(40)}return e}return e}function ti(r){let e=r.getParent();oe(e)||_t(40);let t=e;for(;t!==null;)t=t.getParent(),oe(t)&&(e=t);return e}function Da(r){let e=[];const t=r.getChildren().filter(ve);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();oe(o)?e=e.concat(Da(o)):e.push(s)}return e}function vt(r){return ve(r)&&oe(r.getFirstChild())}function Ko(r){return it().append(r)}function Aa(r,e){return ve(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Vo(r,e){r.update(()=>{const t=V();if(t!==null){const n=t.getNodes();if(M(t)){const o=t.getStartEndPoints();o===null&&_t(143);const[i]=o,l=i.getNode(),a=l.getParent();if(Aa(l,n)){const u=tt(e);if(wt(a)){l.replace(u);const c=it();F(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(ve(l)){const c=l.getParentOrThrow();sr(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()||ve(i)||s.has(i.getKey())){if(Tl(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(oe(l)){if(!s.has(a)){const u=tt(e);sr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(wt(u)&&!s.has(a)){s.add(a),Ho(l,e);break}l=u}}}}else Ho(i,e)}}})}function sr(r,e){r.splice(r.getChildrenSize(),0,e)}function Ho(r,e){if(oe(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=it();let o;if(sr(s,r.getChildren()),oe(t)&&e===t.getListType())t.append(s),oe(n)&&e===n.getListType()&&(sr(t,n.getChildren()),n.remove()),o=t;else if(oe(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=tt(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ni(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&vt(t)&&vt(n)&&(Ni(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(M(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Aa(s,n))t.add(ti(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Tl(i)){const l=td(i,or);l!=null&&t.add(ti(l))}}for(const o of t){let i=o;const l=Da(o);for(const a of l){const u=Ee();sr(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(vt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(vt(n)&&vt(s)){const o=s.getFirstChild();if(oe(o)){o.append(r);const i=n.getFirstChild();oe(i)&&(sr(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(vt(n)){const o=n.getFirstChild();if(oe(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(vt(s)){const o=s.getFirstChild();oe(o)&&o.append(r)}else if(oe(t)){const o=it(),i=tt(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Ud(r){if(vt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(oe(t?t.getParent():void 0)&&ve(t)&&oe(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=it(),l=tt(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=it(),u=tt(o);a.append(u),sr(u,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(a),t.replace(r)}}}function Wd(){const r=V();if(!M(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!ve(e)||e.getChildrenSize()!==0)return!1;const t=ti(e),n=e.getParent();oe(n)||_t(40);const s=n.getParent();let o;if(wt(s))o=Ee(),t.insertAfter(o);else{if(!ve(s))return!1;o=it(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=tt(n.getListType());if(Cr(o))o.insertAfter(l);else{const a=it();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||!ve(a)&&!oe(a))break;a=u}a.remove()}(e),!0}function Hn(...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 or extends Lt{static getType(){return"listitem"}static clone(e){return new or(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 oe(n)&&n.getListType()==="check"&&Qo(t,this,null),t.value=this.__value,Jo(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return oe(s)&&s.getListType()==="check"&&Qo(t,this,e),t.value=this.__value,Jo(t,n.theme,this),!1}static transform(){return e=>{if(ve(e)||_t(144),e.__checked==null)return;const t=e.getParent();oe(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Gd,priority:0})}}static importJSON(e){const t=it();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(ve(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!oe(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=tt(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)||_t(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(oe(n)||_t(39),ve(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=tt(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&&vt(t)&&vt(n)&&(Ni(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=it(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Ee();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=ve(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 oe(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(;ve(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&_t(117),(e=Math.floor(e))>=0||_t(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(Ud(this),t--);return this}canInsertAfter(e){return ve(e)}canReplaceWith(e){return ve(e)}canMergeWith(e){return Cr(e)||ve(e)}extractWithChild(e,t){if(!M(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 tt("bullet")}canMergeWhenEmpty(){return!0}}function Jo(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(...Hn(i)),o){const a=t.getParent(),u=oe(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=Hn(l);t.getChildren().some(u=>oe(u))?n.push(...a):s.push(...a)}s.length>0&&ma(r,...s),n.length>0&&gn(r,...n)}function Qo(r,e,t,n){oe(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:it(e==="true"||e!=="false"&&void 0)}}function Kd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:it(r.hasAttribute("checked"))}}function it(r){return At(new or(void 0,r))}function ve(r){return r instanceof or}class Er extends Lt{static getType(){return"list"}static clone(e){const t=e.__listType||Zo[e.__tag];return new Er(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Zo[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,Yo(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(Yo(t,n.theme,this),!1)}static transform(){return e=>{oe(e)||_t(163),function(t){const n=t.getNextSibling();oe(n)&&t.getListType()===n.getListType()&&Ni(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())ve(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),oe(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:Xo,priority:0}),ul:()=>({conversion:Xo,priority:0})}}static importJSON(e){const t=tt(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&&Nt(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(ve(n))super.append(n);else{const s=it();if(oe(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const o=Te(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return ve(e)}}function Yo(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=Id(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(...Hn(u));for(let p=0;p<i.length;p++)p!==a&&s.push(t.__tag+p)}if(d!==void 0){const p=Hn(d);l>1?n.push(...p):s.push(...p)}}s.length>0&&ma(r,...s),n.length>0&&gn(r,...n)}function Vd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(ve(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{oe(o)&&e.push(Ko(o))})}else e.push(Ko(n))}return e}function Xo(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=tt("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(Nt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?tt("check"):tt("bullet")),{after:Vd,node:t}}const Zo={ol:"number",ul:"bullet"};function tt(r,e=1){return At(new Er(r,e))}function oe(r){return r instanceof Er}const Ea=nn(),Sa=nn(),Hd=nn();function Jd(r){return ir(r.registerCommand(Sa,()=>(Vo(r,"number"),!0),gr),r.registerCommand(Ea,()=>(Vo(r,"bullet"),!0),gr),r.registerCommand(Hd,()=>(zd(r),!0),gr),r.registerCommand(Qr,()=>!!Wd(),gr))}function Qd(){const[r]=pt();return w.useEffect(()=>{if(!r.hasNodes([Er,or]))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 lr extends Lt{static getType(){return"link"}static clone(e){return new lr(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),gn(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=Jn(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=Jn(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(!M(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=Jn(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function Jn(r,e){return At(new lr(r,e))}function Pr(r){return r instanceof lr}class mn extends lr{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 mn(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=el(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=el(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function el(r,e){return At(new mn(r,e))}function Zd(r){return r instanceof mn}const tl=nn();function Ns(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=V();if(!M(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const a=cs(l,u=>!Zd(u)&&Pr(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],Pr);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(Pr(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=Jn(r,{rel:s,target:t,title:n}),Pr(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),Pr(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]=pt();return w.useEffect(()=>{if(!t.hasNodes([lr]))throw new Error("LinkPlugin: LinkNode not registered on editor");return ir(t.registerCommand(tl,n=>{if(n===null)return Ns(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Ns(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Ns(s,{...e,rel:i,target:o,title:l}),!0}},gr),r!==void 0?t.registerCommand(Yn,n=>{const s=V();if(!M(s)||s.isCollapsed()||!It(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(tl,{...e,url:i}),n.preventDefault(),!0)},gr):()=>{})},[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}){const[t]=pt(),n=w.useCallback(()=>{t.dispatchCommand(ft,"bold")},[t]),s=w.useCallback(()=>{t.dispatchCommand(ft,"italic")},[t]),o=w.useCallback(()=>{t.dispatchCommand(ft,"underline")},[t]),i=w.useCallback(()=>{t.dispatchCommand(Ea,void 0)},[t]),l=w.useCallback(()=>{t.dispatchCommand(Sa,void 0)},[t]),a=w.useCallback(()=>{t.update(()=>{const d=V();M(d)&&Jc(d,()=>Bi())})},[t]),u={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},c=`
|
|
74
74
|
.mail-editor-toolbar-btn:hover:not(:disabled) {
|
|
75
75
|
background: ${r.border};
|
|
76
76
|
}
|
|
77
|
-
`;return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:c}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:n,disabled:e,style:
|
|
77
|
+
`;return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:c}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:n,disabled:e,style:u,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:s,disabled:e,style:{...u,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:o,disabled:e,style:{...u,textDecoration:"underline"},title:"Underline (Ctrl+U)",children:"U"}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:i,disabled:e,style:u,title:"Bullet List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("circle",{cx:"4",cy:"6",r:"2"}),g.jsx("circle",{cx:"4",cy:"12",r:"2"}),g.jsx("circle",{cx:"4",cy:"18",r:"2"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:l,disabled:e,style:u,title:"Numbered List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),g.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),g.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:a,disabled:e,style:u,title:"Quote",children:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]})}function sf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=pt(),s=w.useRef(!1);return w.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const o=_e();o.clear();const i=Ee();o.append(i),i.select();const a=new DOMParser().parseFromString(r,"text/html"),c=ya(n,a).filter(d=>d.getParent()===null);c.length>0&&ra(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]=pt(),n=w.useRef(void 0);return w.useEffect(()=>{e===void 0||e===n.current||!r||(n.current=e,t.update(()=>{const s=V();if(M(s))s.insertText(r);else{const o=_e(),i=o.getLastChild();if(i){i.selectEnd();const l=V();M(l)&&(o.getTextContent().trim()&&l.insertText(`
|
|
78
78
|
|
|
79
|
-
`),l.insertText(r))}else{const l=
|
|
79
|
+
`),l.insertText(r))}else{const l=Ee(),a=Te(r);l.append(a),o.append(l)}}}),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 g.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[g.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),g.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 ka({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}){const d={...tf,...s},[f,h]=w.useState(!1),p=w.useRef(void 0);w.useEffect(()=>{a!==void 0&&a!==p.current&&(p.current=a,h(!0))},[a]);const m=w.useCallback(()=>{h(!1)},[]),b={namespace:"MailEditor",theme:rf,onError:A=>{console.error("Lexical error:",A)},nodes:[Er,or,lr,mn,fs,ds],editable:!o},D=w.useCallback((A,v)=>{A.read(()=>{const S=xa(v,null);e==null||e(S)})},[e]),y=`
|
|
80
80
|
.mail-editor-paragraph {
|
|
81
81
|
margin: 0 0 8px 0;
|
|
82
82
|
line-height: 1.5;
|
|
@@ -142,9 +142,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
142
142
|
pointer-events: none;
|
|
143
143
|
font-size: 14px;
|
|
144
144
|
}
|
|
145
|
-
`;return g.jsxs("div",{className:i,style:{border:`1px solid ${d.border}`,borderRadius:"8px",background:d.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[g.jsx("style",{children:y}),g.jsxs(
|
|
145
|
+
`;return g.jsxs("div",{className:i,style:{border:`1px solid ${d.border}`,borderRadius:"8px",background:d.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[g.jsx("style",{children:y}),g.jsxs(Pc,{initialConfig:b,children:[g.jsx(nf,{theme:d,disabled:o}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(_d,{contentEditable:g.jsx(Dd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:d.text}}),placeholder:g.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:Md})}),g.jsx(Qd,{}),g.jsx(ef,{}),g.jsx(jd,{}),g.jsx(Pd,{onChange:D}),g.jsx(sf,{html:r,isExternalUpdate:f,onImportComplete:m}),g.jsx(of,{text:u,trigger:c})]}),n&&g.jsx(lf,{replyTo:n,theme:d})]})}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:p="",minHeight:m="200px",sendButtonText:b="Send",hideCancelButton:D=!1}){const y={...af,...c},[A,v]=w.useState(r),[S,C]=w.useState(""),[_,E]=w.useState(""),[k,I]=w.useState(e),[B,N]=w.useState(t),[j,L]=w.useState([]),[R,ee]=w.useState(!1),[ye,me]=w.useState(""),[je,Ne]=w.useState(f),[He,Se]=w.useState(!1),qe=w.useRef(void 0);w.useEffect(()=>{l!==void 0&&l!==qe.current&&(qe.current=l,N(t),Se(!0))},[l,t]);const rt=H=>{N(H),Se(!1),i==null||i(H)},$e=w.useRef(null),[fe,Ie]=w.useState(!1),Re=H=>{const xe=H.target.files;xe&&L(De=>[...De,...Array.from(xe)]),$e.current&&($e.current.value="")},he=H=>{H.preventDefault(),H.stopPropagation(),Ie(!0)},Ue=H=>{H.preventDefault(),H.stopPropagation(),Ie(!1)},Je=H=>{H.preventDefault(),H.stopPropagation(),Ie(!1),H.dataTransfer.files&&L(xe=>[...xe,...Array.from(H.dataTransfer.files)])},mt=H=>H.type.startsWith("image/")?"image":H.type==="application/pdf"?"picture_as_pdf":H.type.includes("spreadsheet")||H.type.includes("excel")?"table_chart":H.type.includes("document")||H.type.includes("word")?"description":"attach_file",Gt=H=>{L(xe=>xe.filter((De,U)=>U!==H))},Kt=H=>H<1024?`${H} B`:H<1024*1024?`${(H/1024).toFixed(1)} KB`:`${(H/(1024*1024)).toFixed(1)} MB`,yt=async()=>{if(!A.trim()){me("Recipient email is required");return}if(!k.trim()){me("Subject is required");return}ee(!0),me("");try{const H=await Promise.all(j.map(async De=>{const U=await De.arrayBuffer(),T=btoa(new Uint8Array(U).reduce((X,Q)=>X+String.fromCharCode(Q),""));return{filename:De.name,content_type:De.type||"application/octet-stream",data:T,size:De.size}})),xe=B.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim();await s({to:A.trim(),cc:S.trim()||void 0,bcc:_.trim()||void 0,subject:k.trim(),html:xe,attachments:H,inReplyTo:n==null?void 0:n.messageId}),v(""),C(""),E(""),I(""),N(""),L([])}catch(H){me(H instanceof Error?H.message:"Failed to send email")}finally{ee(!1)}},Qe={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${y.inputBorder}`,borderRadius:"6px",background:y.inputBackground,color:y.text,outline:"none"},Ye={display:"block",fontSize:"12px",fontWeight:500,color:y.textSecondary,marginBottom:"4px",textTransform:"uppercase"},Et=H=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:d||R?"not-allowed":"pointer",opacity:d||R?.6:1,background:H?y.buttonPrimary:y.buttonSecondary,color:H?"#ffffff":y.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:p,style:{display:"flex",flexDirection:"column",gap:"16px",background:y.background},children:[ye&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:ye}),g.jsxs("div",{children:[g.jsx("label",{style:Ye,children:"To"}),g.jsx("input",{type:"email",value:A,onChange:H=>v(H.target.value),placeholder:"recipient@example.com",disabled:d||R,style:Qe})]}),!je&&g.jsx("button",{type:"button",onClick:()=>Ne(!0),disabled:d||R,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:y.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),je&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:Ye,children:"CC"}),g.jsx("input",{type:"email",value:S,onChange:H=>C(H.target.value),placeholder:"cc@example.com",disabled:d||R,style:Qe})]}),g.jsxs("div",{children:[g.jsx("label",{style:Ye,children:"BCC"}),g.jsx("input",{type:"email",value:_,onChange:H=>E(H.target.value),placeholder:"bcc@example.com",disabled:d||R,style:Qe})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:Ye,children:"Subject"}),g.jsx("input",{type:"text",value:k,onChange:H=>I(H.target.value),placeholder:"Email subject",disabled:d||R,style:Qe})]}),g.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[g.jsx("label",{style:Ye,children:"Message"}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(ka,{value:B,onChange:rt,placeholder:h,replyTo:n,theme:y,disabled:d||R,minHeight:m,externalUpdate:He?l:void 0,insertText:a,insertTextTrigger:u})})]}),g.jsxs("div",{children:[g.jsx("label",{style:{...Ye,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:$e,type:"file",multiple:!0,onChange:Re,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var H;return(H=$e.current)==null?void 0:H.click()},onDragOver:he,onDragLeave:Ue,onDrop:Je,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${fe?y.primary:y.border}`,borderRadius:"8px",background:fe?`${y.primary}10`:"transparent",color:fe?y.primary:y.textSecondary,cursor:d||R?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:j.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:fe?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:fe?"Drop files here":"Drop files or click to add"})]}),j.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:j.map((H,xe)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:y.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y.textSecondary},children:mt(H)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H.name}),g.jsx("div",{style:{fontSize:"12px",color:y.textSecondary},children:Kt(H.size)})]}),g.jsx("button",{type:"button",onClick:()=>Gt(xe),disabled:d||R,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:y.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${H.name}-${xe}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!D&&o&&g.jsx("button",{type:"button",onClick:o,disabled:d||R,style:Et(!1),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:yt,disabled:d||R||!A.trim()||!k.trim(),style:Et(!0),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:R?"spin 1s linear infinite":"none"},children:R?"sync":"send"}),R?"Sending...":b]})]}),g.jsx("style",{children:`
|
|
146
146
|
@keyframes spin {
|
|
147
147
|
from { transform: rotate(0deg); }
|
|
148
148
|
to { transform: rotate(360deg); }
|
|
149
149
|
}
|
|
150
|
-
`})]})}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:u,disabled:a=!1,max:c=0,theme:d={},className:f=""}){const h={...cf,...d},[p,m]=A.useState(!1),[_,C]=A.useState(""),y=A.useRef(null),E=A.useRef(null);A.useEffect(()=>{function T(N){y.current&&!y.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const D=r.filter(T=>{var N;return((N=T.label)==null?void 0:N.toLowerCase().includes(_.toLowerCase()))&&!e.includes(T.id)}),k=s&&_.trim()&&!r.some(T=>{var N;return((N=T.label)==null?void 0:N.toLowerCase())===_.toLowerCase()}),v=e.map(T=>r.find(N=>N.id===T)).filter(Boolean),b=A.useCallback(T=>{var N;c>0&&e.length>=c||(t([...e,T]),C(""),(N=E.current)==null||N.focus())},[e,t,c]),w=A.useCallback(T=>{t(e.filter(N=>N!==T))},[e,t]),S=A.useCallback(async()=>{if(!k)return;const T=await(o==null?void 0:o(_.trim()));T&&b(T.id),C("")},[k,_,o,b]),$=A.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),k?S():D.length>0&&b(D[0].id)):T.key==="Backspace"&&!_&&e.length>0?w(e[e.length-1]):T.key==="Escape"&&(m(!1),C(""))},[k,D,_,e,S,b,w]);return g.jsxs("div",{ref:y,className:f,style:{position:"relative"},children:[u&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:u}),g.jsxs("div",{onClick:()=>!a&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:a?h.hoverBackground:h.background,cursor:a?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[v.map(T=>g.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!a&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),w(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),g.jsx("input",{ref:E,type:"text",value:_,onChange:T=>{C(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:$,placeholder:v.length===0?n:"",disabled:a||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!a&&g.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?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:_?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[D.map(T=>g.jsxs("div",{onClick:()=>b(T.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:[T.label,i&&l&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(T.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:"×"})]},T.id)),k&&g.jsxs("div",{onClick:S,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:T=>{T.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:T=>{T.currentTarget.style.background=""},children:['+ Create "',_.trim(),'"']})]})})]})}function ff({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:u,renderColumnHeader:a,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=A.useState(null),[_,C]=A.useState(null),[y,E]=A.useState(null),D=A.useRef(null),k=e.reduce((N,j)=>{let L=r.filter(O=>n(O)===j.id);return s&&(L=L.sort((O,G)=>s(O)-s(G))),N[j.id]=L,N},{}),v=A.useCallback((N,j)=>{const L=t(j),O=n(j);m(L),D.current=O,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const G=N.target;G.style.opacity="0.5"})},[t,n]),b=A.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),w=A.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(j),E(L)},[]),S=A.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(C(null),E(null))},[]),$=A.useCallback((N,j,L)=>{if(N.preventDefault(),!p)return;const O=D.current;O===j?l==null||l(p,j,L):O&&i(p,O,j,L),m(null),C(null),E(null),D.current=null},[p,i,l]),T=(N,j)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return g.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=_===N.id;return g.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:O=>{O.preventDefault(),p&&!L&&C(N.id)},onDragLeave:S,onDrop:O=>$(O,N.id,y??j.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:a?a(N,j.length):T(N,j.length)}),g.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((O,G)=>{const he=t(O),oe=p===he,Ne=L&&y===G&&!oe;return g.jsxs("div",{children:[Ne&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:we=>v(we,O),onDragEnd:b,onDragOver:we=>w(we,N.id,G),onClick:()=>u==null?void 0:u(O),className:`cursor-grab active:cursor-grabbing transition-all ${oe?"opacity-50 scale-95":""} ${h}`,children:o(O,oe)})]},he)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:O=>{O.preventDefault(),w(O,N.id,j.length)},children:L&&y===j.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.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:u,renderItem:a,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...hf,...p},{allDayItems:_,timedItems:C}=A.useMemo(()=>{const b=[],w=[];for(const S of r)l(S)?b.push(S):w.push(S);return{allDayItems:b,timedItems:w}},[r,l]),y=A.useMemo(()=>{const b=[];for(let w=t;w<=n;w++)b.push(w);return b},[t,n]),E=(n-t+1)*s,D=A.useCallback(b=>{const w=o(b);if(!w)return null;const S=pf(w);if(!S)return null;const{hours:$,minutes:T}=S,N=Math.max(t,Math.min(n,$)),j=$<t?0:T,L=(N-t)*s+j/60*s,O=i(b),G=Math.max(20,O/60*s);return{top:L,height:G}},[o,i,t,n,s]),k=A.useMemo(()=>{if(!f||!mf(e))return null;const b=new Date,w=b.getHours(),S=b.getMinutes();return w<t||w>n?null:(w-t)*s+S/60*s},[e,f,t,n,s]),v=A.useCallback(b=>{if(!d)return;const w=b.currentTarget.getBoundingClientRect(),$=(b.clientY-w.top)/s*60,T=Math.floor($/60)+t,N=Math.round($%60/15)*15,j=Math.min(n,Math.max(t,T)),L=N>=60?0:N,O=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d(O)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[_.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:_.map(b=>g.jsx("div",{onClick:()=>c==null?void 0:c(b),style:{cursor:c?"pointer":"default"},children:a(b)},u(b)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[y.map((b,w)=>g.jsxs("div",{style:{position:"absolute",top:w*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:gf(b)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),w<y.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},b)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:v}),k!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),C.map(b=>{const w=D(b);return w?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:w.top,height:w.height,zIndex:10,cursor:c?"pointer":"default"},onClick:S=>{S.stopPropagation(),c==null||c(b)},children:a(b)},u(b)):null})]})]})}exports.AnimatedCardFlip=ha;exports.ApiClient=nl;exports.AuthManager=rl;exports.Card=ca;exports.ComboBox=df;exports.DataOperations=mn;exports.Detail=da;exports.GraphClient=$u;exports.KanbanBoard=ff;exports.Mail=ga;exports.MailClient=tl;exports.MailComposer=af;exports.MailEditor=Eu;exports.SelectableList=ma;exports.Stack=aa;exports.Timeline=yf;exports.getApiClient=Hs;exports.initializeApiClient=ia;exports.useMutation=oa;exports.useQuery=sl;
|
|
150
|
+
`})]})}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},[p,m]=w.useState(!1),[b,D]=w.useState(""),y=w.useRef(null),A=w.useRef(null);w.useEffect(()=>{function B(N){y.current&&!y.current.contains(N.target)&&(m(!1),D(""))}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const v=r.filter(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase().includes(b.toLowerCase()))&&!e.includes(B.id)}),S=s&&b.trim()&&!r.some(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase())===b.toLowerCase()}),C=e.map(B=>r.find(N=>N.id===B)).filter(Boolean),_=w.useCallback(B=>{var N;c>0&&e.length>=c||(t([...e,B]),D(""),(N=A.current)==null||N.focus())},[e,t,c]),E=w.useCallback(B=>{t(e.filter(N=>N!==B))},[e,t]),k=w.useCallback(async()=>{if(!S)return;const B=await(o==null?void 0:o(b.trim()));B&&_(B.id),D("")},[S,b,o,_]),I=w.useCallback(B=>{B.key==="Enter"?(B.preventDefault(),S?k():v.length>0&&_(v[0].id)):B.key==="Backspace"&&!b&&e.length>0?E(e[e.length-1]):B.key==="Escape"&&(m(!1),D(""))},[S,v,b,e,k,_,E]);return g.jsxs("div",{ref:y,className:f,style:{position:"relative"},children:[a&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),g.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[C.map(B=>g.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&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),E(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},B.id)),g.jsx("input",{ref:A,type:"text",value:b,onChange:B=>{D(B.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:I,placeholder:C.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}})]}),p&&!u&&g.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:v.length===0&&!S?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:b?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[v.map(B=>g.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&&g.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)),S&&g.jsxs("div",{onClick:k,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:v.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[p,m]=w.useState(null),[b,D]=w.useState(null),[y,A]=w.useState(null),v=w.useRef(null),S=e.reduce((N,j)=>{let L=r.filter(R=>n(R)===j.id);return s&&(L=L.sort((R,ee)=>s(R)-s(ee))),N[j.id]=L,N},{}),C=w.useCallback((N,j)=>{const L=t(j),R=n(j);m(L),v.current=R,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const ee=N.target;ee.style.opacity="0.5"})},[t,n]),_=w.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),D(null),A(null),v.current=null},[]),E=w.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",D(j),A(L)},[]),k=w.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(D(null),A(null))},[]),I=w.useCallback((N,j,L)=>{if(N.preventDefault(),!p)return;const R=v.current;R===j?l==null||l(p,j,L):R&&i(p,R,j,L),m(null),D(null),A(null),v.current=null},[p,i,l]),B=(N,j)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=S[N.id]||[],L=b===N.id;return g.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:R=>{R.preventDefault(),p&&!L&&D(N.id)},onDragLeave:k,onDrop:R=>I(R,N.id,y??j.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(N,j.length):B(N,j.length)}),g.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((R,ee)=>{const ye=t(R),me=p===ye,je=L&&y===ee&&!me;return g.jsxs("div",{children:[je&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Ne=>C(Ne,R),onDragEnd:_,onDragOver:Ne=>E(Ne,N.id,ee),onClick:()=>a==null?void 0:a(R),className:`cursor-grab active:cursor-grabbing transition-all ${me?"opacity-50 scale-95":""} ${h}`,children:o(R,me)})]},ye)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:R=>{R.preventDefault(),E(R,N.id,j.length)},children:L&&y===j.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.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:p={}}){const m={...hf,...p},{allDayItems:b,timedItems:D}=w.useMemo(()=>{const _=[],E=[];for(const k of r)l(k)?_.push(k):E.push(k);return{allDayItems:_,timedItems:E}},[r,l]),y=w.useMemo(()=>{const _=[];for(let E=t;E<=n;E++)_.push(E);return _},[t,n]),A=(n-t+1)*s,v=w.useCallback(_=>{const E=o(_);if(!E)return null;const k=pf(E);if(!k)return null;const{hours:I,minutes:B}=k,N=Math.max(t,Math.min(n,I)),j=I<t?0:B,L=(N-t)*s+j/60*s,R=i(_),ee=Math.max(20,R/60*s);return{top:L,height:ee}},[o,i,t,n,s]),S=w.useMemo(()=>{if(!f||!mf(e))return null;const _=new Date,E=_.getHours(),k=_.getMinutes();return E<t||E>n?null:(E-t)*s+k/60*s},[e,f,t,n,s]),C=w.useCallback(_=>{if(!d)return;const E=_.currentTarget.getBoundingClientRect(),I=(_.clientY-E.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,R=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d(R)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[b.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:b.map(_=>g.jsx("div",{onClick:()=>c==null?void 0:c(_),style:{cursor:c?"pointer":"default"},children:u(_)},a(_)))})]}),g.jsxs("div",{style:{position:"relative",height:A},children:[y.map((_,E)=>g.jsxs("div",{style:{position:"absolute",top:E*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:gf(_)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),E<y.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},_)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:C}),S!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:S,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),D.map(_=>{const E=v(_);return E?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:E.top,height:E.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(_)},children:u(_)},a(_)):null})]})]})}function xf({onComplete:r,onCancel:e,onTranscribe:t,transcribing:n}){const[s,o]=w.useState("idle"),[i,l]=w.useState(0),[a,u]=w.useState(0),[c,d]=w.useState(!1),[f,h]=w.useState(0),[p,m]=w.useState(null),[b,D]=w.useState(!1),[y,A]=w.useState(null),v=w.useRef(null),S=w.useRef(null),C=w.useRef(null),_=w.useRef(null),E=w.useRef(null),k=w.useRef([]),I=w.useRef(null),B=w.useRef(null),N=w.useRef(null),j=w.useRef(null),L=w.useRef(!1),R=w.useRef([]),ee=w.useRef(null),ye=w.useRef(null),me=w.useRef([]),je=w.useRef([]),Ne=w.useRef("insert"),He=w.useRef(!1),Se=w.useRef(0),qe=w.useRef(0),rt=w.useRef(0),$e=U=>{const T=Math.floor(U/60),X=Math.floor(U%60);return`${T.toString().padStart(2,"0")}:${X.toString().padStart(2,"0")}`},fe=async U=>{const T=await U.arrayBuffer(),X=new AudioContext,Q=await X.decodeAudioData(T);return await X.close(),Q},Ie=U=>{const T=U.numberOfChannels,X=U.sampleRate,Q=1,z=16,re=z/8,ne=T*re,te=X*ne,O=U.length*ne,W=new ArrayBuffer(44+O),J=new DataView(W),Y=(be,le)=>{for(let ke=0;ke<le.length;ke++)J.setUint8(be+ke,le.charCodeAt(ke))};Y(0,"RIFF"),J.setUint32(4,36+O,!0),Y(8,"WAVE"),Y(12,"fmt "),J.setUint32(16,16,!0),J.setUint16(20,Q,!0),J.setUint16(22,T,!0),J.setUint32(24,X,!0),J.setUint32(28,te,!0),J.setUint16(32,ne,!0),J.setUint16(34,z,!0),Y(36,"data"),J.setUint32(40,O,!0);const ue=[];for(let be=0;be<T;be++)ue.push(U.getChannelData(be));let pe=44;for(let be=0;be<U.length;be++)for(let le=0;le<T;le++){const ke=Math.max(-1,Math.min(1,ue[le][be])),Pe=ke<0?ke*32768:ke*32767;J.setInt16(pe,Pe,!0),pe+=2}return new Blob([W],{type:"audio/wav"})},Re=async(U,T,X,Q)=>{const z=new AudioContext,re=U.sampleRate,ne=Math.max(U.numberOfChannels,T.numberOfChannels),te=Math.min(X,U.length),O=Math.max(0,U.length-X),W=Q==="insert"?te+T.length+O:te+T.length,J=z.createBuffer(ne,W,re);for(let Y=0;Y<ne;Y++){const ue=J.getChannelData(Y),pe=Y<U.numberOfChannels?U.getChannelData(Y):U.getChannelData(0);for(let le=0;le<te;le++)ue[le]=pe[le];const be=Y<T.numberOfChannels?T.getChannelData(Y):T.getChannelData(0);for(let le=0;le<T.length;le++)ue[te+le]=be[le];if(Q==="insert")for(let le=0;le<O;le++)ue[te+T.length+le]=pe[X+le]}return await z.close(),J},he=w.useCallback(()=>{const U=v.current;if(!U)return;const T=U.getContext("2d");if(!T)return;const X=U.getBoundingClientRect(),Q=X.width,z=X.height,re=R.current,ne=a||i||1,te=s==="recording"?i:f;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,z);const O=8,W="rgba(0, 0, 0, 0.4)",J=T.createLinearGradient(0,0,0,O);J.addColorStop(0,W),J.addColorStop(1,"transparent"),T.fillStyle=J,T.fillRect(0,0,Q,O);const Y=T.createLinearGradient(0,z-O,0,z);Y.addColorStop(0,"transparent"),Y.addColorStop(1,W),T.fillStyle=Y,T.fillRect(0,z-O,Q,O);const ue=T.createLinearGradient(0,0,O,0);ue.addColorStop(0,W),ue.addColorStop(1,"transparent"),T.fillStyle=ue,T.fillRect(0,0,O,z);const pe=T.createLinearGradient(Q-O,0,Q,0);pe.addColorStop(0,"transparent"),pe.addColorStop(1,W),T.fillStyle=pe,T.fillRect(Q-O,0,O,z),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,z/2),T.lineTo(Q,z/2),T.stroke();const be=Q/2;if(re.length>0)if(s==="recording")for(let Pe=0;Pe<re.length;Pe++){const Oe=re.length-1-Pe,at=be-Oe*4;if(at<-3||at>Q)continue;const nt=re[Pe]*(z/2-12),St=z/2-nt;T.fillStyle="#10b981",T.fillRect(at,St,3,nt*2)}else{const Pe=ne>0?te/ne*re.length:0;for(let Oe=0;Oe<re.length;Oe++){const at=Pe-Oe,nt=be-at*4;if(nt<-3||nt>Q)continue;const St=re[Oe]*(z/2-12),Sr=z/2-St;T.fillStyle=Oe<=Pe?"#10b981":"#4b5563",T.fillRect(nt,Sr,3,St*2)}}T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(be,0),T.lineTo(be,z),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText($e(te),be,z-6),s==="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"},[s,f,i,a]),Ue=()=>{const U=E.current;if(!U||!L.current)return;const T=U.frequencyBinCount,X=new Uint8Array(T);U.getByteTimeDomainData(X);let Q=0;for(let ne=0;ne<T;ne++){const te=(X[ne]-128)/128;Q+=te*te}const z=Math.sqrt(Q/T),re=Math.min(1,z*3);R.current.push(re),he(),L.current&&(B.current=requestAnimationFrame(Ue))},Je=async()=>{try{m(null),D(!1),ee.current===null&&(R.current=[]);const U=await navigator.mediaDevices.getUserMedia({audio:!0});C.current=U;const T=new AudioContext;_.current=T;const X=T.createAnalyser();X.fftSize=2048,E.current=X,T.createMediaStreamSource(U).connect(X);const z=new MediaRecorder(U);S.current=z,k.current=[],z.ondataavailable=re=>{re.data.size>0&&k.current.push(re.data)},z.onstop=async()=>{try{if(L.current=!1,k.current.length===0){m("No audio was recorded. Please try again."),o("idle"),U.getTracks().forEach(J=>J.stop());return}const re=new Blob(k.current,{type:"audio/webm"});let ne,te;if(ee.current!==null&&ye.current)try{const J=await fe(re),Y=ye.current.sampleRate,ue=Math.floor(ee.current*Y),pe=await Re(ye.current,J,ue,Ne.current);ne=Ie(pe),te=pe.length/pe.sampleRate,Ne.current==="insert"&&(R.current=[...R.current,...je.current]),ee.current=null,ye.current=null,me.current=[],je.current=[]}catch{ne=re,te=Se.current>0?Se.current:1}else ne=re,te=Se.current>0?Se.current:1;j.current=ne;const O=URL.createObjectURL(ne),W=new Audio(O);W.ontimeupdate=()=>{h(W.currentTime)},W.onended=()=>{d(!1)},N.current=W,u(te),h(te),o("editing"),U.getTracks().forEach(J=>J.stop())}catch{m("Failed to process recording"),o("idle")}},z.start(100),L.current=!0,o("recording"),l(0),Se.current=0,I.current=setInterval(()=>{Se.current+=1,l(Se.current)},1e3)}catch{m("Could not access microphone. Please allow microphone access.")}},mt=()=>{L.current=!1,D(!1),A(null),B.current&&(cancelAnimationFrame(B.current),B.current=null),I.current&&(clearInterval(I.current),I.current=null),S.current&&S.current.state!=="inactive"&&S.current.stop()},Gt=U=>{const T=v.current;if(!T)return;const X=a||i;if(X<=0)return;const Q=R.current;if(Q.length===0)return;const z=T.getBoundingClientRect(),re=U-qe.current,ne=4,te=z.width/T.width,O=Q.length/X*ne,W=-re/(O*te),J=rt.current+W,Y=Math.max(0,Math.min(J,X));N.current&&(N.current.currentTime=Y),h(Y)},Kt=()=>{N.current&&(N.current.currentTime=0),h(0)},yt=()=>{const U=a||i;N.current&&(N.current.currentTime=U),h(U)},Qe=()=>{const U=N.current;U&&(c?(U.pause(),h(U.currentTime),d(!1)):(U.currentTime=f,U.play().catch(()=>{}),d(!0)))},Ye=async U=>{if(!j.current){Je();return}try{N.current&&(N.current.pause(),d(!1)),Ne.current=U,ye.current=await fe(j.current);const T=a||i;ee.current=f;const X=T>0?f/T:0,Q=Math.floor(X*R.current.length);me.current=R.current.slice(0,Q),je.current=R.current.slice(Q),R.current=[...me.current],Je()}catch{m("Failed to prepare recording. Please try again.")}},Et=()=>{N.current&&(N.current.pause(),N.current=null),j.current=null,ye.current=null,ee.current=null,me.current=[],d(!1),h(0),u(0),l(0),Je()},H=()=>{j.current?r(j.current,a||i):alert("No audio recorded yet!")};if(w.useEffect(()=>{s==="recording"&&v.current&&E.current&&L.current&&(B.current=requestAnimationFrame(Ue))},[s]),w.useEffect(()=>{const U=v.current;if(!U)return;const T=()=>{const X=window.devicePixelRatio||1,Q=U.getBoundingClientRect();U.width=Q.width*X,U.height=Q.height*X;const z=U.getContext("2d");z&&z.scale(X,X)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),w.useEffect(()=>{if(s==="idle"){const U=v.current;if(!U)return;const T=U.getContext("2d");if(!T)return;const X=U.getBoundingClientRect(),Q=X.width,z=X.height;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,z);const re=8,ne="rgba(0, 0, 0, 0.4)",te=T.createLinearGradient(0,0,0,re);te.addColorStop(0,ne),te.addColorStop(1,"transparent"),T.fillStyle=te,T.fillRect(0,0,Q,re);const O=T.createLinearGradient(0,z-re,0,z);O.addColorStop(0,"transparent"),O.addColorStop(1,ne),T.fillStyle=O,T.fillRect(0,z-re,Q,re);const W=T.createLinearGradient(0,0,re,0);W.addColorStop(0,ne),W.addColorStop(1,"transparent"),T.fillStyle=W,T.fillRect(0,0,re,z);const J=T.createLinearGradient(Q-re,0,Q,0);J.addColorStop(0,"transparent"),J.addColorStop(1,ne),T.fillStyle=J,T.fillRect(Q-re,0,re,z),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,z/2),T.lineTo(Q,z/2),T.stroke();const Y=Q/2;T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(Y,0),T.lineTo(Y,z),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText("00:00",Y,z-6)}},[s]),w.useEffect(()=>()=>{L.current=!1,I.current&&clearInterval(I.current),B.current&&cancelAnimationFrame(B.current),C.current&&C.current.getTracks().forEach(U=>U.stop()),_.current&&_.current.state!=="closed"&&_.current.close()},[]),w.useEffect(()=>{if(s==="editing"&&c){let U;const T=()=>{const X=N.current;if(X&&c){const Q=v.current;if(Q){const z=Q.getContext("2d");if(z){const re=Q.getBoundingClientRect(),ne=re.width,te=re.height,O=R.current,W=a||i||1,J=X.currentTime;z.fillStyle="#2d3b35",z.fillRect(0,0,ne,te);const Y=8,ue="rgba(0, 0, 0, 0.4)",pe=z.createLinearGradient(0,0,0,Y);pe.addColorStop(0,ue),pe.addColorStop(1,"transparent"),z.fillStyle=pe,z.fillRect(0,0,ne,Y);const be=z.createLinearGradient(0,te-Y,0,te);be.addColorStop(0,"transparent"),be.addColorStop(1,ue),z.fillStyle=be,z.fillRect(0,te-Y,ne,Y);const le=z.createLinearGradient(0,0,Y,0);le.addColorStop(0,ue),le.addColorStop(1,"transparent"),z.fillStyle=le,z.fillRect(0,0,Y,te);const ke=z.createLinearGradient(ne-Y,0,ne,0);ke.addColorStop(0,"transparent"),ke.addColorStop(1,ue),z.fillStyle=ke,z.fillRect(ne-Y,0,Y,te),z.strokeStyle="#5a6b62",z.lineWidth=1,z.beginPath(),z.moveTo(0,te/2),z.lineTo(ne,te/2),z.stroke();const Pe=ne/2,Oe=3,at=4,nt=W>0?J/W*O.length:0;for(let jt=0;jt<O.length;jt++){const hs=nt-jt,ar=Pe-hs*at;if(ar<-Oe||ar>ne)continue;const kr=O[jt]*(te/2-12),ps=te/2-kr;z.fillStyle=jt<=nt?"#10b981":"#4b5563",z.fillRect(ar,ps,Oe,kr*2)}z.strokeStyle="#ef4444",z.lineWidth=1,z.beginPath(),z.moveTo(Pe,0),z.lineTo(Pe,te),z.stroke(),z.fillStyle="#fff",z.font="bold 18px monospace",z.textAlign="center";const St=Math.floor(J/60),Sr=Math.floor(J%60);z.fillText(`${St.toString().padStart(2,"0")}:${Sr.toString().padStart(2,"0")}`,Pe,te-6),z.textAlign="left"}}U=requestAnimationFrame(T)}};return U=requestAnimationFrame(T),()=>cancelAnimationFrame(U)}},[s,c,a,i]),w.useEffect(()=>{s==="editing"&&!c&&he()},[s,f,c,he]),p)return g.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[g.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:p}),g.jsx("button",{onClick:()=>{m(null),Je()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const xe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},De={...xe,opacity:.3,cursor:"not-allowed"};return g.jsxs("div",{style:{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"},children:[g.jsx("canvas",{ref:v,style:{width:"100%",height:"80px",cursor:"pointer"},onMouseDown:U=>{if(s==="editing"){He.current=!0,qe.current=U.clientX,rt.current=f;const T=Q=>{He.current&&Gt(Q.clientX)},X=()=>{He.current=!1,window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",X)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",X)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",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)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:Kt,disabled:s==="idle"||s==="recording",style:s==="idle"||s==="recording"?De:xe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(s==="recording"){const U=S.current;U&&(U.state==="recording"?(U.pause(),D(!0)):U.state==="paused"&&(U.resume(),D(!1)))}else Qe()},disabled:s==="idle",style:s==="idle"?De:xe,title:c||s==="recording"&&!b?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:c||s==="recording"&&!b?"pause":"play_arrow"})}),g.jsx("button",{onClick:yt,disabled:s==="idle"||s==="recording",style:s==="idle"||s==="recording"?De:xe,title:"Go to end",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),g.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))"}}),g.jsx("button",{onClick:()=>{y==="insert"?mt():s==="idle"?(A("insert"),Je()):s==="editing"&&(A("insert"),Ye("insert"))},disabled:s==="recording"&&y!=="insert"||c,style:s==="recording"&&y!=="insert"||c?De:xe,title:y==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{y==="mic"?mt():s==="idle"?(A("mic"),Je()):s==="editing"&&(A("mic"),Ye("replace"))},disabled:s==="recording"&&y!=="mic"||c,style:s==="recording"&&y!=="mic"||c?De:xe,title:y==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{y==="startover"?mt():s==="editing"&&(A("startover"),Et())},disabled:s==="idle"||s==="recording"&&y!=="startover"||c,style:s==="idle"||s==="recording"&&y!=="startover"||c?De:xe,title:y==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[t&&g.jsx("button",{onClick:()=>j.current&&t(j.current),disabled:s!=="editing"||n,style:s!=="editing"||n?De:xe,title:n?"Transcribing...":"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:n?"hourglass_empty":"subtitles"})}),g.jsx("button",{onClick:H,disabled:s!=="editing",style:s!=="editing"?De:xe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]})]})}exports.AnimatedCardFlip=hu;exports.ApiClient=ol;exports.AudioEditor=xf;exports.AuthManager=il;exports.Card=cu;exports.ComboBox=df;exports.DataOperations=En;exports.Detail=du;exports.GraphClient=$a;exports.KanbanBoard=ff;exports.Mail=gu;exports.MailClient=sl;exports.MailComposer=uf;exports.MailEditor=ka;exports.SelectableList=mu;exports.Stack=uu;exports.Timeline=yf;exports.getApiClient=ri;exports.initializeApiClient=iu;exports.useMutation=ou;exports.useQuery=ll;
|