@qwanyx/stack 0.2.62 → 0.2.64
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/ComboStack.d.ts +39 -0
- package/dist/components/QRCodeNode.d.ts +0 -1
- package/dist/index.cjs.js +46 -38
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +5879 -4931
- package/package.json +3 -2
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(),
|
|
6
|
-
`,"𝔑":"𝔑","⁠":""," ":" ","ℕ":"ℕ","⫬":"⫬","≢":"≢","≭":"≭","∦":"∦","∉":"∉","≠":"≠","≂̸":"≂̸","∄":"∄","≯":"≯","≱":"≱","≧̸":"≧̸","≫̸":"≫̸","≹":"≹","⩾̸":"⩾̸","≵":"≵","≎̸":"≎̸","≏̸":"≏̸","⋪":"⋪","⧏̸":"⧏̸","⋬":"⋬","≮":"≮","≰":"≰","≸":"≸","≪̸":"≪̸","⩽̸":"⩽̸","≴":"≴","⪢̸":"⪢̸","⪡̸":"⪡̸","⊀":"⊀","⪯̸":"⪯̸","⋠":"⋠","∌":"∌","⋫":"⋫","⧐̸":"⧐̸","⋭":"⋭","⊏̸":"⊏̸","⋢":"⋢","⊐̸":"⊐̸","⋣":"⋣","⊂⃒":"⊂⃒","⊈":"⊈","⊁":"⊁","⪰̸":"⪰̸","⋡":"⋡","≿̸":"≿̸","⊃⃒":"⊃⃒","⊉":"⊉","≁":"≁","≄":"≄","≇":"≇","≉":"≉","∤":"∤","𝒩":"𝒩","Ñ":"Ñ","Ñ":"Ñ","Ν":"Ν","Œ":"Œ","Ó":"Ó","Ó":"Ó","Ô":"Ô","Ô":"Ô","О":"О","Ő":"Ő","𝔒":"𝔒","Ò":"Ò","Ò":"Ò","Ō":"Ō","Ω":"Ω","Ο":"Ο","𝕆":"𝕆","“":"“","‘":"‘","⩔":"⩔","𝒪":"𝒪","Ø":"Ø","Ø":"Ø","Õ":"Õ","Õ":"Õ","⨷":"⨷","Ö":"Ö","Ö":"Ö","‾":"‾","⏞":"⏞","⎴":"⎴","⏜":"⏜","∂":"∂","П":"П","𝔓":"𝔓","Φ":"Φ","Π":"Π","±":"±","ℌ":"ℌ","ℙ":"ℙ","⪻":"⪻","≺":"≺","⪯":"⪯","≼":"≼","≾":"≾","″":"″","∏":"∏","∷":"∷","∝":"∝","𝒫":"𝒫","Ψ":"Ψ",""":'"',""":'"',"𝔔":"𝔔","ℚ":"ℚ","𝒬":"𝒬","⤐":"⤐","®":"®","®":"®","Ŕ":"Ŕ","⟫":"⟫","↠":"↠","⤖":"⤖","Ř":"Ř","Ŗ":"Ŗ","Р":"Р","ℜ":"ℜ","∋":"∋","⇋":"⇋","⥯":"⥯","ℜ":"ℜ","Ρ":"Ρ","⟩":"⟩","→":"→","⇥":"⇥","⇄":"⇄","⌉":"⌉","⟧":"⟧","⥝":"⥝","⇂":"⇂","⥕":"⥕","⌋":"⌋","⊢":"⊢","↦":"↦","⥛":"⥛","⊳":"⊳","⧐":"⧐","⊵":"⊵","⥏":"⥏","⥜":"⥜","↾":"↾","⥔":"⥔","⇀":"⇀","⥓":"⥓","⇒":"⇒","ℝ":"ℝ","⥰":"⥰","⇛":"⇛","ℛ":"ℛ","↱":"↱","⧴":"⧴","Щ":"Щ","Ш":"Ш","Ь":"Ь","Ś":"Ś","⪼":"⪼","Š":"Š","Ş":"Ş","Ŝ":"Ŝ","С":"С","𝔖":"𝔖","↓":"↓","←":"←","→":"→","↑":"↑","Σ":"Σ","∘":"∘","𝕊":"𝕊","√":"√","□":"□","⊓":"⊓","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊔":"⊔","𝒮":"𝒮","⋆":"⋆","⋐":"⋐","⋐":"⋐","⊆":"⊆","≻":"≻","⪰":"⪰","≽":"≽","≿":"≿","∋":"∋","∑":"∑","⋑":"⋑","⊃":"⊃","⊇":"⊇","⋑":"⋑","Þ":"Þ","Þ":"Þ","™":"™","Ћ":"Ћ","Ц":"Ц","	":" ","Τ":"Τ","Ť":"Ť","Ţ":"Ţ","Т":"Т","𝔗":"𝔗","∴":"∴","Θ":"Θ","  ":" "," ":" ","∼":"∼","≃":"≃","≅":"≅","≈":"≈","𝕋":"𝕋","⃛":"⃛","𝒯":"𝒯","Ŧ":"Ŧ","Ú":"Ú","Ú":"Ú","↟":"↟","⥉":"⥉","Ў":"Ў","Ŭ":"Ŭ","Û":"Û","Û":"Û","У":"У","Ű":"Ű","𝔘":"𝔘","Ù":"Ù","Ù":"Ù","Ū":"Ū","_":"_","⏟":"⏟","⎵":"⎵","⏝":"⏝","⋃":"⋃","⊎":"⊎","Ų":"Ų","𝕌":"𝕌","↑":"↑","⤒":"⤒","⇅":"⇅","↕":"↕","⥮":"⥮","⊥":"⊥","↥":"↥","⇑":"⇑","⇕":"⇕","↖":"↖","↗":"↗","ϒ":"ϒ","Υ":"Υ","Ů":"Ů","𝒰":"𝒰","Ũ":"Ũ","Ü":"Ü","Ü":"Ü","⊫":"⊫","⫫":"⫫","В":"В","⊩":"⊩","⫦":"⫦","⋁":"⋁","‖":"‖","‖":"‖","∣":"∣","|":"|","❘":"❘","≀":"≀"," ":" ","𝔙":"𝔙","𝕍":"𝕍","𝒱":"𝒱","⊪":"⊪","Ŵ":"Ŵ","⋀":"⋀","𝔚":"𝔚","𝕎":"𝕎","𝒲":"𝒲","𝔛":"𝔛","Ξ":"Ξ","𝕏":"𝕏","𝒳":"𝒳","Я":"Я","Ї":"Ї","Ю":"Ю","Ý":"Ý","Ý":"Ý","Ŷ":"Ŷ","Ы":"Ы","𝔜":"𝔜","𝕐":"𝕐","𝒴":"𝒴","Ÿ":"Ÿ","Ж":"Ж","Ź":"Ź","Ž":"Ž","З":"З","Ż":"Ż","​":"","Ζ":"Ζ","ℨ":"ℨ","ℤ":"ℤ","𝒵":"𝒵","á":"á","á":"á","ă":"ă","∾":"∾","∾̳":"∾̳","∿":"∿","â":"â","â":"â","´":"´","´":"´","а":"а","æ":"æ","æ":"æ","⁡":"","𝔞":"𝔞","à":"à","à":"à","ℵ":"ℵ","ℵ":"ℵ","α":"α","ā":"ā","⨿":"⨿","&":"&","&":"&","∧":"∧","⩕":"⩕","⩜":"⩜","⩘":"⩘","⩚":"⩚","∠":"∠","⦤":"⦤","∠":"∠","∡":"∡","⦨":"⦨","⦩":"⦩","⦪":"⦪","⦫":"⦫","⦬":"⦬","⦭":"⦭","⦮":"⦮","⦯":"⦯","∟":"∟","⊾":"⊾","⦝":"⦝","∢":"∢","Å":"Å","⍼":"⍼","ą":"ą","𝕒":"𝕒","≈":"≈","⩰":"⩰","⩯":"⩯","≊":"≊","≋":"≋","'":"'","≈":"≈","≊":"≊","å":"å","å":"å","𝒶":"𝒶","*":"*","≈":"≈","≍":"≍","ã":"ã","ã":"ã","ä":"ä","ä":"ä","∳":"∳","⨑":"⨑","⫭":"⫭","≌":"≌","϶":"϶","‵":"‵","∽":"∽","⋍":"⋍","⊽":"⊽","⌅":"⌅","⌅":"⌅","⎵":"⎵","⎶":"⎶","≌":"≌","б":"б","„":"„","∵":"∵","∵":"∵","⦰":"⦰","϶":"϶","ℬ":"ℬ","β":"β","ℶ":"ℶ","≬":"≬","𝔟":"𝔟","⋂":"⋂","◯":"◯","⋃":"⋃","⨀":"⨀","⨁":"⨁","⨂":"⨂","⨆":"⨆","★":"★","▽":"▽","△":"△","⨄":"⨄","⋁":"⋁","⋀":"⋀","⤍":"⤍","⧫":"⧫","▪":"▪","▴":"▴","▾":"▾","◂":"◂","▸":"▸","␣":"␣","▒":"▒","░":"░","▓":"▓","█":"█","=⃥":"=⃥","≡⃥":"≡⃥","⌐":"⌐","𝕓":"𝕓","⊥":"⊥","⊥":"⊥","⋈":"⋈","╗":"╗","╔":"╔","╖":"╖","╓":"╓","═":"═","╦":"╦","╩":"╩","╤":"╤","╧":"╧","╝":"╝","╚":"╚","╜":"╜","╙":"╙","║":"║","╬":"╬","╣":"╣","╠":"╠","╫":"╫","╢":"╢","╟":"╟","⧉":"⧉","╕":"╕","╒":"╒","┐":"┐","┌":"┌","─":"─","╥":"╥","╨":"╨","┬":"┬","┴":"┴","⊟":"⊟","⊞":"⊞","⊠":"⊠","╛":"╛","╘":"╘","┘":"┘","└":"└","│":"│","╪":"╪","╡":"╡","╞":"╞","┼":"┼","┤":"┤","├":"├","‵":"‵","˘":"˘","¦":"¦","¦":"¦","𝒷":"𝒷","⁏":"⁏","∽":"∽","⋍":"⋍","\":"\\","⧅":"⧅","⟈":"⟈","•":"•","•":"•","≎":"≎","⪮":"⪮","≏":"≏","≏":"≏","ć":"ć","∩":"∩","⩄":"⩄","⩉":"⩉","⩋":"⩋","⩇":"⩇","⩀":"⩀","∩︀":"∩︀","⁁":"⁁","ˇ":"ˇ","⩍":"⩍","č":"č","ç":"ç","ç":"ç","ĉ":"ĉ","⩌":"⩌","⩐":"⩐","ċ":"ċ","¸":"¸","¸":"¸","⦲":"⦲","¢":"¢","¢":"¢","·":"·","𝔠":"𝔠","ч":"ч","✓":"✓","✓":"✓","χ":"χ","○":"○","⧃":"⧃","ˆ":"ˆ","≗":"≗","↺":"↺","↻":"↻","®":"®","Ⓢ":"Ⓢ","⊛":"⊛","⊚":"⊚","⊝":"⊝","≗":"≗","⨐":"⨐","⫯":"⫯","⧂":"⧂","♣":"♣","♣":"♣",":":":","≔":"≔","≔":"≔",",":",","@":"@","∁":"∁","∘":"∘","∁":"∁","ℂ":"ℂ","≅":"≅","⩭":"⩭","∮":"∮","𝕔":"𝕔","∐":"∐","©":"©","©":"©","℗":"℗","↵":"↵","✗":"✗","𝒸":"𝒸","⫏":"⫏","⫑":"⫑","⫐":"⫐","⫒":"⫒","⋯":"⋯","⤸":"⤸","⤵":"⤵","⋞":"⋞","⋟":"⋟","↶":"↶","⤽":"⤽","∪":"∪","⩈":"⩈","⩆":"⩆","⩊":"⩊","⊍":"⊍","⩅":"⩅","∪︀":"∪︀","↷":"↷","⤼":"⤼","⋞":"⋞","⋟":"⋟","⋎":"⋎","⋏":"⋏","¤":"¤","¤":"¤","↶":"↶","↷":"↷","⋎":"⋎","⋏":"⋏","∲":"∲","∱":"∱","⌭":"⌭","⇓":"⇓","⥥":"⥥","†":"†","ℸ":"ℸ","↓":"↓","‐":"‐","⊣":"⊣","⤏":"⤏","˝":"˝","ď":"ď","д":"д","ⅆ":"ⅆ","‡":"‡","⇊":"⇊","⩷":"⩷","°":"°","°":"°","δ":"δ","⦱":"⦱","⥿":"⥿","𝔡":"𝔡","⇃":"⇃","⇂":"⇂","⋄":"⋄","⋄":"⋄","♦":"♦","♦":"♦","¨":"¨","ϝ":"ϝ","⋲":"⋲","÷":"÷","÷":"÷","÷":"÷","⋇":"⋇","⋇":"⋇","ђ":"ђ","⌞":"⌞","⌍":"⌍","$":"$","𝕕":"𝕕","˙":"˙","≐":"≐","≑":"≑","∸":"∸","∔":"∔","⊡":"⊡","⌆":"⌆","↓":"↓","⇊":"⇊","⇃":"⇃","⇂":"⇂","⤐":"⤐","⌟":"⌟","⌌":"⌌","𝒹":"𝒹","ѕ":"ѕ","⧶":"⧶","đ":"đ","⋱":"⋱","▿":"▿","▾":"▾","⇵":"⇵","⥯":"⥯","⦦":"⦦","џ":"џ","⟿":"⟿","⩷":"⩷","≑":"≑","é":"é","é":"é","⩮":"⩮","ě":"ě","≖":"≖","ê":"ê","ê":"ê","≕":"≕","э":"э","ė":"ė","ⅇ":"ⅇ","≒":"≒","𝔢":"𝔢","⪚":"⪚","è":"è","è":"è","⪖":"⪖","⪘":"⪘","⪙":"⪙","⏧":"⏧","ℓ":"ℓ","⪕":"⪕","⪗":"⪗","ē":"ē","∅":"∅","∅":"∅","∅":"∅"," ":" "," ":" "," ":" ","ŋ":"ŋ"," ":" ","ę":"ę","𝕖":"𝕖","⋕":"⋕","⧣":"⧣","⩱":"⩱","ε":"ε","ε":"ε","ϵ":"ϵ","≖":"≖","≕":"≕","≂":"≂","⪖":"⪖","⪕":"⪕","=":"=","≟":"≟","≡":"≡","⩸":"⩸","⧥":"⧥","≓":"≓","⥱":"⥱","ℯ":"ℯ","≐":"≐","≂":"≂","η":"η","ð":"ð","ð":"ð","ë":"ë","ë":"ë","€":"€","!":"!","∃":"∃","ℰ":"ℰ","ⅇ":"ⅇ","≒":"≒","ф":"ф","♀":"♀","ffi":"ffi","ff":"ff","ffl":"ffl","𝔣":"𝔣","fi":"fi","fj":"fj","♭":"♭","fl":"fl","▱":"▱","ƒ":"ƒ","𝕗":"𝕗","∀":"∀","⋔":"⋔","⫙":"⫙","⨍":"⨍","½":"½","½":"½","⅓":"⅓","¼":"¼","¼":"¼","⅕":"⅕","⅙":"⅙","⅛":"⅛","⅔":"⅔","⅖":"⅖","¾":"¾","¾":"¾","⅗":"⅗","⅜":"⅜","⅘":"⅘","⅚":"⅚","⅝":"⅝","⅞":"⅞","⁄":"⁄","⌢":"⌢","𝒻":"𝒻","≧":"≧","⪌":"⪌","ǵ":"ǵ","γ":"γ","ϝ":"ϝ","⪆":"⪆","ğ":"ğ","ĝ":"ĝ","г":"г","ġ":"ġ","≥":"≥","⋛":"⋛","≥":"≥","≧":"≧","⩾":"⩾","⩾":"⩾","⪩":"⪩","⪀":"⪀","⪂":"⪂","⪄":"⪄","⋛︀":"⋛︀","⪔":"⪔","𝔤":"𝔤","≫":"≫","⋙":"⋙","ℷ":"ℷ","ѓ":"ѓ","≷":"≷","⪒":"⪒","⪥":"⪥","⪤":"⪤","≩":"≩","⪊":"⪊","⪊":"⪊","⪈":"⪈","⪈":"⪈","≩":"≩","⋧":"⋧","𝕘":"𝕘","`":"`","ℊ":"ℊ","≳":"≳","⪎":"⪎","⪐":"⪐",">":">",">":">","⪧":"⪧","⩺":"⩺","⋗":"⋗","⦕":"⦕","⩼":"⩼","⪆":"⪆","⥸":"⥸","⋗":"⋗","⋛":"⋛","⪌":"⪌","≷":"≷","≳":"≳","≩︀":"≩︀","≩︀":"≩︀","⇔":"⇔"," ":" ","½":"½","ℋ":"ℋ","ъ":"ъ","↔":"↔","⥈":"⥈","↭":"↭","ℏ":"ℏ","ĥ":"ĥ","♥":"♥","♥":"♥","…":"…","⊹":"⊹","𝔥":"𝔥","⤥":"⤥","⤦":"⤦","⇿":"⇿","∻":"∻","↩":"↩","↪":"↪","𝕙":"𝕙","―":"―","𝒽":"𝒽","ℏ":"ℏ","ħ":"ħ","⁃":"⁃","‐":"‐","í":"í","í":"í","⁣":"","î":"î","î":"î","и":"и","е":"е","¡":"¡","¡":"¡","⇔":"⇔","𝔦":"𝔦","ì":"ì","ì":"ì","ⅈ":"ⅈ","⨌":"⨌","∭":"∭","⧜":"⧜","℩":"℩","ij":"ij","ī":"ī","ℑ":"ℑ","ℐ":"ℐ","ℑ":"ℑ","ı":"ı","⊷":"⊷","Ƶ":"Ƶ","∈":"∈","℅":"℅","∞":"∞","⧝":"⧝","ı":"ı","∫":"∫","⊺":"⊺","ℤ":"ℤ","⊺":"⊺","⨗":"⨗","⨼":"⨼","ё":"ё","į":"į","𝕚":"𝕚","ι":"ι","⨼":"⨼","¿":"¿","¿":"¿","𝒾":"𝒾","∈":"∈","⋹":"⋹","⋵":"⋵","⋴":"⋴","⋳":"⋳","∈":"∈","⁢":"","ĩ":"ĩ","і":"і","ï":"ï","ï":"ï","ĵ":"ĵ","й":"й","𝔧":"𝔧","ȷ":"ȷ","𝕛":"𝕛","𝒿":"𝒿","ј":"ј","є":"є","κ":"κ","ϰ":"ϰ","ķ":"ķ","к":"к","𝔨":"𝔨","ĸ":"ĸ","х":"х","ќ":"ќ","𝕜":"𝕜","𝓀":"𝓀","⇚":"⇚","⇐":"⇐","⤛":"⤛","⤎":"⤎","≦":"≦","⪋":"⪋","⥢":"⥢","ĺ":"ĺ","⦴":"⦴","ℒ":"ℒ","λ":"λ","⟨":"⟨","⦑":"⦑","⟨":"⟨","⪅":"⪅","«":"«","«":"«","←":"←","⇤":"⇤","⤟":"⤟","⤝":"⤝","↩":"↩","↫":"↫","⤹":"⤹","⥳":"⥳","↢":"↢","⪫":"⪫","⤙":"⤙","⪭":"⪭","⪭︀":"⪭︀","⤌":"⤌","❲":"❲","{":"{","[":"[","⦋":"⦋","⦏":"⦏","⦍":"⦍","ľ":"ľ","ļ":"ļ","⌈":"⌈","{":"{","л":"л","⤶":"⤶","“":"“","„":"„","⥧":"⥧","⥋":"⥋","↲":"↲","≤":"≤","←":"←","↢":"↢","↽":"↽","↼":"↼","⇇":"⇇","↔":"↔","⇆":"⇆","⇋":"⇋","↭":"↭","⋋":"⋋","⋚":"⋚","≤":"≤","≦":"≦","⩽":"⩽","⩽":"⩽","⪨":"⪨","⩿":"⩿","⪁":"⪁","⪃":"⪃","⋚︀":"⋚︀","⪓":"⪓","⪅":"⪅","⋖":"⋖","⋚":"⋚","⪋":"⪋","≶":"≶","≲":"≲","⥼":"⥼","⌊":"⌊","𝔩":"𝔩","≶":"≶","⪑":"⪑","↽":"↽","↼":"↼","⥪":"⥪","▄":"▄","љ":"љ","≪":"≪","⇇":"⇇","⌞":"⌞","⥫":"⥫","◺":"◺","ŀ":"ŀ","⎰":"⎰","⎰":"⎰","≨":"≨","⪉":"⪉","⪉":"⪉","⪇":"⪇","⪇":"⪇","≨":"≨","⋦":"⋦","⟬":"⟬","⇽":"⇽","⟦":"⟦","⟵":"⟵","⟷":"⟷","⟼":"⟼","⟶":"⟶","↫":"↫","↬":"↬","⦅":"⦅","𝕝":"𝕝","⨭":"⨭","⨴":"⨴","∗":"∗","_":"_","◊":"◊","◊":"◊","⧫":"⧫","(":"(","⦓":"⦓","⇆":"⇆","⌟":"⌟","⇋":"⇋","⥭":"⥭","‎":"","⊿":"⊿","‹":"‹","𝓁":"𝓁","↰":"↰","≲":"≲","⪍":"⪍","⪏":"⪏","[":"[","‘":"‘","‚":"‚","ł":"ł","<":"<","<":"<","⪦":"⪦","⩹":"⩹","⋖":"⋖","⋋":"⋋","⋉":"⋉","⥶":"⥶","⩻":"⩻","⦖":"⦖","◃":"◃","⊴":"⊴","◂":"◂","⥊":"⥊","⥦":"⥦","≨︀":"≨︀","≨︀":"≨︀","∺":"∺","¯":"¯","¯":"¯","♂":"♂","✠":"✠","✠":"✠","↦":"↦","↦":"↦","↧":"↧","↤":"↤","↥":"↥","▮":"▮","⨩":"⨩","м":"м","—":"—","∡":"∡","𝔪":"𝔪","℧":"℧","µ":"µ","µ":"µ","∣":"∣","*":"*","⫰":"⫰","·":"·","·":"·","−":"−","⊟":"⊟","∸":"∸","⨪":"⨪","⫛":"⫛","…":"…","∓":"∓","⊧":"⊧","𝕞":"𝕞","∓":"∓","𝓂":"𝓂","∾":"∾","μ":"μ","⊸":"⊸","⊸":"⊸","⋙̸":"⋙̸","≫⃒":"≫⃒","≫̸":"≫̸","⇍":"⇍","⇎":"⇎","⋘̸":"⋘̸","≪⃒":"≪⃒","≪̸":"≪̸","⇏":"⇏","⊯":"⊯","⊮":"⊮","∇":"∇","ń":"ń","∠⃒":"∠⃒","≉":"≉","⩰̸":"⩰̸","≋̸":"≋̸","ʼn":"ʼn","≉":"≉","♮":"♮","♮":"♮","ℕ":"ℕ"," ":" "," ":" ","≎̸":"≎̸","≏̸":"≏̸","⩃":"⩃","ň":"ň","ņ":"ņ","≇":"≇","⩭̸":"⩭̸","⩂":"⩂","н":"н","–":"–","≠":"≠","⇗":"⇗","⤤":"⤤","↗":"↗","↗":"↗","≐̸":"≐̸","≢":"≢","⤨":"⤨","≂̸":"≂̸","∄":"∄","∄":"∄","𝔫":"𝔫","≧̸":"≧̸","≱":"≱","≱":"≱","≧̸":"≧̸","⩾̸":"⩾̸","⩾̸":"⩾̸","≵":"≵","≯":"≯","≯":"≯","⇎":"⇎","↮":"↮","⫲":"⫲","∋":"∋","⋼":"⋼","⋺":"⋺","∋":"∋","њ":"њ","⇍":"⇍","≦̸":"≦̸","↚":"↚","‥":"‥","≰":"≰","↚":"↚","↮":"↮","≰":"≰","≦̸":"≦̸","⩽̸":"⩽̸","⩽̸":"⩽̸","≮":"≮","≴":"≴","≮":"≮","⋪":"⋪","⋬":"⋬","∤":"∤","𝕟":"𝕟","¬":"¬","¬":"¬","∉":"∉","⋹̸":"⋹̸","⋵̸":"⋵̸","∉":"∉","⋷":"⋷","⋶":"⋶","∌":"∌","∌":"∌","⋾":"⋾","⋽":"⋽","∦":"∦","∦":"∦","⫽⃥":"⫽⃥","∂̸":"∂̸","⨔":"⨔","⊀":"⊀","⋠":"⋠","⪯̸":"⪯̸","⊀":"⊀","⪯̸":"⪯̸","⇏":"⇏","↛":"↛","⤳̸":"⤳̸","↝̸":"↝̸","↛":"↛","⋫":"⋫","⋭":"⋭","⊁":"⊁","⋡":"⋡","⪰̸":"⪰̸","𝓃":"𝓃","∤":"∤","∦":"∦","≁":"≁","≄":"≄","≄":"≄","∤":"∤","∦":"∦","⋢":"⋢","⋣":"⋣","⊄":"⊄","⫅̸":"⫅̸","⊈":"⊈","⊂⃒":"⊂⃒","⊈":"⊈","⫅̸":"⫅̸","⊁":"⊁","⪰̸":"⪰̸","⊅":"⊅","⫆̸":"⫆̸","⊉":"⊉","⊃⃒":"⊃⃒","⊉":"⊉","⫆̸":"⫆̸","≹":"≹","ñ":"ñ","ñ":"ñ","≸":"≸","⋪":"⋪","⋬":"⋬","⋫":"⋫","⋭":"⋭","ν":"ν","#":"#","№":"№"," ":" ","⊭":"⊭","⤄":"⤄","≍⃒":"≍⃒","⊬":"⊬","≥⃒":"≥⃒",">⃒":">⃒","⧞":"⧞","⤂":"⤂","≤⃒":"≤⃒","<⃒":"<⃒","⊴⃒":"⊴⃒","⤃":"⤃","⊵⃒":"⊵⃒","∼⃒":"∼⃒","⇖":"⇖","⤣":"⤣","↖":"↖","↖":"↖","⤧":"⤧","Ⓢ":"Ⓢ","ó":"ó","ó":"ó","⊛":"⊛","⊚":"⊚","ô":"ô","ô":"ô","о":"о","⊝":"⊝","ő":"ő","⨸":"⨸","⊙":"⊙","⦼":"⦼","œ":"œ","⦿":"⦿","𝔬":"𝔬","˛":"˛","ò":"ò","ò":"ò","⧁":"⧁","⦵":"⦵","Ω":"Ω","∮":"∮","↺":"↺","⦾":"⦾","⦻":"⦻","‾":"‾","⧀":"⧀","ō":"ō","ω":"ω","ο":"ο","⦶":"⦶","⊖":"⊖","𝕠":"𝕠","⦷":"⦷","⦹":"⦹","⊕":"⊕","∨":"∨","↻":"↻","⩝":"⩝","ℴ":"ℴ","ℴ":"ℴ","ª":"ª","ª":"ª","º":"º","º":"º","⊶":"⊶","⩖":"⩖","⩗":"⩗","⩛":"⩛","ℴ":"ℴ","ø":"ø","ø":"ø","⊘":"⊘","õ":"õ","õ":"õ","⊗":"⊗","⨶":"⨶","ö":"ö","ö":"ö","⌽":"⌽","∥":"∥","¶":"¶","¶":"¶","∥":"∥","⫳":"⫳","⫽":"⫽","∂":"∂","п":"п","%":"%",".":".","‰":"‰","⊥":"⊥","‱":"‱","𝔭":"𝔭","φ":"φ","ϕ":"ϕ","ℳ":"ℳ","☎":"☎","π":"π","⋔":"⋔","ϖ":"ϖ","ℏ":"ℏ","ℎ":"ℎ","ℏ":"ℏ","+":"+","⨣":"⨣","⊞":"⊞","⨢":"⨢","∔":"∔","⨥":"⨥","⩲":"⩲","±":"±","±":"±","⨦":"⨦","⨧":"⨧","±":"±","⨕":"⨕","𝕡":"𝕡","£":"£","£":"£","≺":"≺","⪳":"⪳","⪷":"⪷","≼":"≼","⪯":"⪯","≺":"≺","⪷":"⪷","≼":"≼","⪯":"⪯","⪹":"⪹","⪵":"⪵","⋨":"⋨","≾":"≾","′":"′","ℙ":"ℙ","⪵":"⪵","⪹":"⪹","⋨":"⋨","∏":"∏","⌮":"⌮","⌒":"⌒","⌓":"⌓","∝":"∝","∝":"∝","≾":"≾","⊰":"⊰","𝓅":"𝓅","ψ":"ψ"," ":" ","𝔮":"𝔮","⨌":"⨌","𝕢":"𝕢","⁗":"⁗","𝓆":"𝓆","ℍ":"ℍ","⨖":"⨖","?":"?","≟":"≟",""":'"',""":'"',"⇛":"⇛","⇒":"⇒","⤜":"⤜","⤏":"⤏","⥤":"⥤","∽̱":"∽̱","ŕ":"ŕ","√":"√","⦳":"⦳","⟩":"⟩","⦒":"⦒","⦥":"⦥","⟩":"⟩","»":"»","»":"»","→":"→","⥵":"⥵","⇥":"⇥","⤠":"⤠","⤳":"⤳","⤞":"⤞","↪":"↪","↬":"↬","⥅":"⥅","⥴":"⥴","↣":"↣","↝":"↝","⤚":"⤚","∶":"∶","ℚ":"ℚ","⤍":"⤍","❳":"❳","}":"}","]":"]","⦌":"⦌","⦎":"⦎","⦐":"⦐","ř":"ř","ŗ":"ŗ","⌉":"⌉","}":"}","р":"р","⤷":"⤷","⥩":"⥩","”":"”","”":"”","↳":"↳","ℜ":"ℜ","ℛ":"ℛ","ℜ":"ℜ","ℝ":"ℝ","▭":"▭","®":"®","®":"®","⥽":"⥽","⌋":"⌋","𝔯":"𝔯","⇁":"⇁","⇀":"⇀","⥬":"⥬","ρ":"ρ","ϱ":"ϱ","→":"→","↣":"↣","⇁":"⇁","⇀":"⇀","⇄":"⇄","⇌":"⇌","⇉":"⇉","↝":"↝","⋌":"⋌","˚":"˚","≓":"≓","⇄":"⇄","⇌":"⇌","‏":"","⎱":"⎱","⎱":"⎱","⫮":"⫮","⟭":"⟭","⇾":"⇾","⟧":"⟧","⦆":"⦆","𝕣":"𝕣","⨮":"⨮","⨵":"⨵",")":")","⦔":"⦔","⨒":"⨒","⇉":"⇉","›":"›","𝓇":"𝓇","↱":"↱","]":"]","’":"’","’":"’","⋌":"⋌","⋊":"⋊","▹":"▹","⊵":"⊵","▸":"▸","⧎":"⧎","⥨":"⥨","℞":"℞","ś":"ś","‚":"‚","≻":"≻","⪴":"⪴","⪸":"⪸","š":"š","≽":"≽","⪰":"⪰","ş":"ş","ŝ":"ŝ","⪶":"⪶","⪺":"⪺","⋩":"⋩","⨓":"⨓","≿":"≿","с":"с","⋅":"⋅","⊡":"⊡","⩦":"⩦","⇘":"⇘","⤥":"⤥","↘":"↘","↘":"↘","§":"§","§":"§",";":";","⤩":"⤩","∖":"∖","∖":"∖","✶":"✶","𝔰":"𝔰","⌢":"⌢","♯":"♯","щ":"щ","ш":"ш","∣":"∣","∥":"∥","­":"","­":"","σ":"σ","ς":"ς","ς":"ς","∼":"∼","⩪":"⩪","≃":"≃","≃":"≃","⪞":"⪞","⪠":"⪠","⪝":"⪝","⪟":"⪟","≆":"≆","⨤":"⨤","⥲":"⥲","←":"←","∖":"∖","⨳":"⨳","⧤":"⧤","∣":"∣","⌣":"⌣","⪪":"⪪","⪬":"⪬","⪬︀":"⪬︀","ь":"ь","/":"/","⧄":"⧄","⌿":"⌿","𝕤":"𝕤","♠":"♠","♠":"♠","∥":"∥","⊓":"⊓","⊓︀":"⊓︀","⊔":"⊔","⊔︀":"⊔︀","⊏":"⊏","⊑":"⊑","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊐":"⊐","⊒":"⊒","□":"□","□":"□","▪":"▪","▪":"▪","→":"→","𝓈":"𝓈","∖":"∖","⌣":"⌣","⋆":"⋆","☆":"☆","★":"★","ϵ":"ϵ","ϕ":"ϕ","¯":"¯","⊂":"⊂","⫅":"⫅","⪽":"⪽","⊆":"⊆","⫃":"⫃","⫁":"⫁","⫋":"⫋","⊊":"⊊","⪿":"⪿","⥹":"⥹","⊂":"⊂","⊆":"⊆","⫅":"⫅","⊊":"⊊","⫋":"⫋","⫇":"⫇","⫕":"⫕","⫓":"⫓","≻":"≻","⪸":"⪸","≽":"≽","⪰":"⪰","⪺":"⪺","⪶":"⪶","⋩":"⋩","≿":"≿","∑":"∑","♪":"♪","¹":"¹","¹":"¹","²":"²","²":"²","³":"³","³":"³","⊃":"⊃","⫆":"⫆","⪾":"⪾","⫘":"⫘","⊇":"⊇","⫄":"⫄","⟉":"⟉","⫗":"⫗","⥻":"⥻","⫂":"⫂","⫌":"⫌","⊋":"⊋","⫀":"⫀","⊃":"⊃","⊇":"⊇","⫆":"⫆","⊋":"⊋","⫌":"⫌","⫈":"⫈","⫔":"⫔","⫖":"⫖","⇙":"⇙","⤦":"⤦","↙":"↙","↙":"↙","⤪":"⤪","ß":"ß","ß":"ß","⌖":"⌖","τ":"τ","⎴":"⎴","ť":"ť","ţ":"ţ","т":"т","⃛":"⃛","⌕":"⌕","𝔱":"𝔱","∴":"∴","∴":"∴","θ":"θ","ϑ":"ϑ","ϑ":"ϑ","≈":"≈","∼":"∼"," ":" ","≈":"≈","∼":"∼","þ":"þ","þ":"þ","˜":"˜","×":"×","×":"×","⊠":"⊠","⨱":"⨱","⨰":"⨰","∭":"∭","⤨":"⤨","⊤":"⊤","⌶":"⌶","⫱":"⫱","𝕥":"𝕥","⫚":"⫚","⤩":"⤩","‴":"‴","™":"™","▵":"▵","▿":"▿","◃":"◃","⊴":"⊴","≜":"≜","▹":"▹","⊵":"⊵","◬":"◬","≜":"≜","⨺":"⨺","⨹":"⨹","⧍":"⧍","⨻":"⨻","⏢":"⏢","𝓉":"𝓉","ц":"ц","ћ":"ћ","ŧ":"ŧ","≬":"≬","↞":"↞","↠":"↠","⇑":"⇑","⥣":"⥣","ú":"ú","ú":"ú","↑":"↑","ў":"ў","ŭ":"ŭ","û":"û","û":"û","у":"у","⇅":"⇅","ű":"ű","⥮":"⥮","⥾":"⥾","𝔲":"𝔲","ù":"ù","ù":"ù","↿":"↿","↾":"↾","▀":"▀","⌜":"⌜","⌜":"⌜","⌏":"⌏","◸":"◸","ū":"ū","¨":"¨","¨":"¨","ų":"ų","𝕦":"𝕦","↑":"↑","↕":"↕","↿":"↿","↾":"↾","⊎":"⊎","υ":"υ","ϒ":"ϒ","υ":"υ","⇈":"⇈","⌝":"⌝","⌝":"⌝","⌎":"⌎","ů":"ů","◹":"◹","𝓊":"𝓊","⋰":"⋰","ũ":"ũ","▵":"▵","▴":"▴","⇈":"⇈","ü":"ü","ü":"ü","⦧":"⦧","⇕":"⇕","⫨":"⫨","⫩":"⫩","⊨":"⊨","⦜":"⦜","ϵ":"ϵ","ϰ":"ϰ","∅":"∅","ϕ":"ϕ","ϖ":"ϖ","∝":"∝","↕":"↕","ϱ":"ϱ","ς":"ς","⊊︀":"⊊︀","⫋︀":"⫋︀","⊋︀":"⊋︀","⫌︀":"⫌︀","ϑ":"ϑ","⊲":"⊲","⊳":"⊳","в":"в","⊢":"⊢","∨":"∨","⊻":"⊻","≚":"≚","⋮":"⋮","|":"|","|":"|","𝔳":"𝔳","⊲":"⊲","⊂⃒":"⊂⃒","⊃⃒":"⊃⃒","𝕧":"𝕧","∝":"∝","⊳":"⊳","𝓋":"𝓋","⫋︀":"⫋︀","⊊︀":"⊊︀","⫌︀":"⫌︀","⊋︀":"⊋︀","⦚":"⦚","ŵ":"ŵ","⩟":"⩟","∧":"∧","≙":"≙","℘":"℘","𝔴":"𝔴","𝕨":"𝕨","℘":"℘","≀":"≀","≀":"≀","𝓌":"𝓌","⋂":"⋂","◯":"◯","⋃":"⋃","▽":"▽","𝔵":"𝔵","⟺":"⟺","⟷":"⟷","ξ":"ξ","⟸":"⟸","⟵":"⟵","⟼":"⟼","⋻":"⋻","⨀":"⨀","𝕩":"𝕩","⨁":"⨁","⨂":"⨂","⟹":"⟹","⟶":"⟶","𝓍":"𝓍","⨆":"⨆","⨄":"⨄","△":"△","⋁":"⋁","⋀":"⋀","ý":"ý","ý":"ý","я":"я","ŷ":"ŷ","ы":"ы","¥":"¥","¥":"¥","𝔶":"𝔶","ї":"ї","𝕪":"𝕪","𝓎":"𝓎","ю":"ю","ÿ":"ÿ","ÿ":"ÿ","ź":"ź","ž":"ž","з":"з","ż":"ż","ℨ":"ℨ","ζ":"ζ","𝔷":"𝔷","ж":"ж","⇝":"⇝","𝕫":"𝕫","𝓏":"𝓏","‍":"","‌":""};function eu(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof Hi[e]=="string")return Hi[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;t.charAt(1)==="x"?n=parseInt(t.substr(2),16):n=parseInt(t.substr(1),10);var s="";return n>=55296&&n<=57343||n>1114111?"�":(n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}function ur(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}function tu(r){return"<div>"+ur(r).replace(/\n/g,"<br />")+"</div>"}function ru(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
|
|
1
|
+
"use strict";var lu=Object.defineProperty;var au=(r,e,t)=>e in r?lu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e,t)=>au(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),Ji=require("react-dom");function uu(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 Ns=uu(C);class cu{constructor(e){_t(this,"config");_t(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 o=await s.text();throw new Error(`API error (${s.status}): ${o}`)}const i=await s.json();if(!i.success&&i.error)throw new Error(i.error);return i}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 o=s.result.split(",")[1];t(o)},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 i=new Image,o=URL.createObjectURL(e);i.onload=()=>{if(URL.revokeObjectURL(o),i.width<=t&&i.height<=t){s(e);return}let a,l;i.width>i.height?(a=t,l=Math.round(i.height/i.width*t)):(l=t,a=Math.round(i.width/i.height*t));const u=document.createElement("canvas");u.width=a,u.height=l;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(i,0,0,a,l);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)},i.onerror=()=>{URL.revokeObjectURL(o),s(e)},i.src=o}):e}async uploadFile(e,t,n,s={}){const i={...this.defaultUploadOptions,...s};try{let o=n;i.maxImageDimension>0&&n.type.startsWith("image/")&&(o=await this.resizeImage(n,i.maxImageDimension,i.imageQuality));const a=i.maxSizeMB*1024*1024;if(o.size>a)return{success:!1,error:`File too large (${(o.size/1024/1024).toFixed(1)} MB). Max: ${i.maxSizeMB} MB`};const l=await this.fileToBase64(o),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:l});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(o){return{success:!1,error:o instanceof Error?o.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(i=>({filename:i.name,path:i.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 Mr=new TextEncoder,Yi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yr=new Uint8Array(256);for(var Bn=0;Bn<Yi.length;Bn++)Yr[Yi.charCodeAt(Bn)]=Bn;function Vs(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),i=new Uint8Array(s);for(let o=0;o<t;o+=4){let a=Yr[r.charCodeAt(o)],l=Yr[r.charCodeAt(o+1)],u=Yr[r.charCodeAt(o+2)],c=Yr[r.charCodeAt(o+3)];i[n++]=a<<2|l>>4,i[n++]=(l&15)<<4|u>>2,i[n++]=(u&3)<<6|c&63}return s}function tn(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function ds(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 Xi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function du(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 i=Mr.encode(t),o=[];for(let l=0,u=i.length;l<u;l++){let c=i[l];if(l<=u-2&&c===61){let d=Xi(i[l+1]),f=Xi(i[l+2]);if(d&&f){let h=parseInt(d+f,16);o.push(h),l+=2;continue}}o.push(c)}s=new ArrayBuffer(o.length);let a=new DataView(s);for(let l=0,u=o.length;l<u;l++)a.setUint8(l,o[l])}else e==="B"?s=Vs(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Mr.encode(t);return tn(r).decode(s)}function rn(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,i,o,a)=>e&&i===a&&o.length%4===0&&!/=$/.test(o)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,i,o)=>e&&i===o?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,i,o)=>du(s,i,o));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function fu(r,e){e=e||"utf-8";let t=[];for(let i=0;i<r.length;i++){let o=r.charAt(i);if(o==="%"&&/^[a-f0-9]{2}/i.test(r.substr(i+1,2))){let a=r.substr(i+1,2);i+=2,t.push(parseInt(a,16))}else if(o.charCodeAt(0)>126){o=Mr.encode(o);for(let a=0;a<o.length;a++)t.push(o[a])}else t.push(o.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let i=0,o=t.length;i<o;i++)s.setUint8(i,t[i]);return tn(e).decode(n)}function hu(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(),i=Number(n[2])||0,o;e.has(s)?o=e.get(s):(o={charset:!1,values:[]},e.set(s,o));let a=r.params[t];i===0&&n[0].charAt(n[0].length-1)==="*"&&(n=a.match(/^([^']*)'[^']*'(.*)$/))&&(o.charset=n[1]||"utf-8",a=n[2]),o.values.push({nr:i,value:a}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=fu(t.values.sort((s,i)=>s.nr-i.nr).map(s=>s.value).join(""),t.charset)})}class pu{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
|
|
2
|
+
`)}finalize(){return ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}class gu{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(Vs(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Vs(this.remainder)),ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}const Zi=/^=[a-f0-9]{2}$/i,mu=/(?==[a-f0-9]{2})/i,yu=/=\r?\n/g,xu=/=[a-fA-F0-9]?$/;class bu{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,i=e.length;s<i;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(yu,"");let t=e.split(mu),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){Zi.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 i=s.substr(0,3);Zi.test(i)?(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(xu);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=""),ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}class eo{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 gu:/quoted-printable/i.test(e)?this.contentDecoder=new bu({decoder:tn(this.contentType.parsed.params.charset)}):this.contentDecoder=new pu}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="",i="value",o=!1,a=!1,l;for(let u=0,c=e.length;u<c;u++)switch(l=e.charAt(u),i){case"key":if(l==="="){n=s.trim().toLowerCase(),i="value",s="";break}s+=l;break;case"value":if(a)s+=l;else if(l==="\\"){a=!0;continue}else o&&l===o?o=!1:!o&&l==='"'?o=l:!o&&l===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),i="key",s=""):s+=l;a=!1;break}return s=s.trim(),i==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),hu(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=tn(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(),i=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:i}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;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:Mr.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(tn().decode(e));break;case"body":this.contentDecoder.update(e)}}}const to={"Æ":"Æ","Æ":"Æ","&":"&","&":"&","Á":"Á","Á":"Á","Ă":"Ă","Â":"Â","Â":"Â","А":"А","𝔄":"𝔄","À":"À","À":"À","Α":"Α","Ā":"Ā","⩓":"⩓","Ą":"Ą","𝔸":"𝔸","⁡":"","Å":"Å","Å":"Å","𝒜":"𝒜","≔":"≔","Ã":"Ã","Ã":"Ã","Ä":"Ä","Ä":"Ä","∖":"∖","⫧":"⫧","⌆":"⌆","Б":"Б","∵":"∵","ℬ":"ℬ","Β":"Β","𝔅":"𝔅","𝔹":"𝔹","˘":"˘","ℬ":"ℬ","≎":"≎","Ч":"Ч","©":"©","©":"©","Ć":"Ć","⋒":"⋒","ⅅ":"ⅅ","ℭ":"ℭ","Č":"Č","Ç":"Ç","Ç":"Ç","Ĉ":"Ĉ","∰":"∰","Ċ":"Ċ","¸":"¸","·":"·","ℭ":"ℭ","Χ":"Χ","⊙":"⊙","⊖":"⊖","⊕":"⊕","⊗":"⊗","∲":"∲","”":"”","’":"’","∷":"∷","⩴":"⩴","≡":"≡","∯":"∯","∮":"∮","ℂ":"ℂ","∐":"∐","∳":"∳","⨯":"⨯","𝒞":"𝒞","⋓":"⋓","≍":"≍","ⅅ":"ⅅ","⤑":"⤑","Ђ":"Ђ","Ѕ":"Ѕ","Џ":"Џ","‡":"‡","↡":"↡","⫤":"⫤","Ď":"Ď","Д":"Д","∇":"∇","Δ":"Δ","𝔇":"𝔇","´":"´","˙":"˙","˝":"˝","`":"`","˜":"˜","⋄":"⋄","ⅆ":"ⅆ","𝔻":"𝔻","¨":"¨","⃜":"⃜","≐":"≐","∯":"∯","¨":"¨","⇓":"⇓","⇐":"⇐","⇔":"⇔","⫤":"⫤","⟸":"⟸","⟺":"⟺","⟹":"⟹","⇒":"⇒","⊨":"⊨","⇑":"⇑","⇕":"⇕","∥":"∥","↓":"↓","⤓":"⤓","⇵":"⇵","̑":"̑","⥐":"⥐","⥞":"⥞","↽":"↽","⥖":"⥖","⥟":"⥟","⇁":"⇁","⥗":"⥗","⊤":"⊤","↧":"↧","⇓":"⇓","𝒟":"𝒟","Đ":"Đ","Ŋ":"Ŋ","Ð":"Ð","Ð":"Ð","É":"É","É":"É","Ě":"Ě","Ê":"Ê","Ê":"Ê","Э":"Э","Ė":"Ė","𝔈":"𝔈","È":"È","È":"È","∈":"∈","Ē":"Ē","◻":"◻","▫":"▫","Ę":"Ę","𝔼":"𝔼","Ε":"Ε","⩵":"⩵","≂":"≂","⇌":"⇌","ℰ":"ℰ","⩳":"⩳","Η":"Η","Ë":"Ë","Ë":"Ë","∃":"∃","ⅇ":"ⅇ","Ф":"Ф","𝔉":"𝔉","◼":"◼","▪":"▪","𝔽":"𝔽","∀":"∀","ℱ":"ℱ","ℱ":"ℱ","Ѓ":"Ѓ",">":">",">":">","Γ":"Γ","Ϝ":"Ϝ","Ğ":"Ğ","Ģ":"Ģ","Ĝ":"Ĝ","Г":"Г","Ġ":"Ġ","𝔊":"𝔊","⋙":"⋙","𝔾":"𝔾","≥":"≥","⋛":"⋛","≧":"≧","⪢":"⪢","≷":"≷","⩾":"⩾","≳":"≳","𝒢":"𝒢","≫":"≫","Ъ":"Ъ","ˇ":"ˇ","^":"^","Ĥ":"Ĥ","ℌ":"ℌ","ℋ":"ℋ","ℍ":"ℍ","─":"─","ℋ":"ℋ","Ħ":"Ħ","≎":"≎","≏":"≏","Е":"Е","IJ":"IJ","Ё":"Ё","Í":"Í","Í":"Í","Î":"Î","Î":"Î","И":"И","İ":"İ","ℑ":"ℑ","Ì":"Ì","Ì":"Ì","ℑ":"ℑ","Ī":"Ī","ⅈ":"ⅈ","⇒":"⇒","∬":"∬","∫":"∫","⋂":"⋂","⁣":"","⁢":"","Į":"Į","𝕀":"𝕀","Ι":"Ι","ℐ":"ℐ","Ĩ":"Ĩ","І":"І","Ï":"Ï","Ï":"Ï","Ĵ":"Ĵ","Й":"Й","𝔍":"𝔍","𝕁":"𝕁","𝒥":"𝒥","Ј":"Ј","Є":"Є","Х":"Х","Ќ":"Ќ","Κ":"Κ","Ķ":"Ķ","К":"К","𝔎":"𝔎","𝕂":"𝕂","𝒦":"𝒦","Љ":"Љ","<":"<","<":"<","Ĺ":"Ĺ","Λ":"Λ","⟪":"⟪","ℒ":"ℒ","↞":"↞","Ľ":"Ľ","Ļ":"Ļ","Л":"Л","⟨":"⟨","←":"←","⇤":"⇤","⇆":"⇆","⌈":"⌈","⟦":"⟦","⥡":"⥡","⇃":"⇃","⥙":"⥙","⌊":"⌊","↔":"↔","⥎":"⥎","⊣":"⊣","↤":"↤","⥚":"⥚","⊲":"⊲","⧏":"⧏","⊴":"⊴","⥑":"⥑","⥠":"⥠","↿":"↿","⥘":"⥘","↼":"↼","⥒":"⥒","⇐":"⇐","⇔":"⇔","⋚":"⋚","≦":"≦","≶":"≶","⪡":"⪡","⩽":"⩽","≲":"≲","𝔏":"𝔏","⋘":"⋘","⇚":"⇚","Ŀ":"Ŀ","⟵":"⟵","⟷":"⟷","⟶":"⟶","⟸":"⟸","⟺":"⟺","⟹":"⟹","𝕃":"𝕃","↙":"↙","↘":"↘","ℒ":"ℒ","↰":"↰","Ł":"Ł","≪":"≪","⤅":"⤅","М":"М"," ":" ","ℳ":"ℳ","𝔐":"𝔐","∓":"∓","𝕄":"𝕄","ℳ":"ℳ","Μ":"Μ","Њ":"Њ","Ń":"Ń","Ň":"Ň","Ņ":"Ņ","Н":"Н","​":"","​":"","​":"","​":"","≫":"≫","≪":"≪","
":`
|
|
6
|
+
`,"𝔑":"𝔑","⁠":""," ":" ","ℕ":"ℕ","⫬":"⫬","≢":"≢","≭":"≭","∦":"∦","∉":"∉","≠":"≠","≂̸":"≂̸","∄":"∄","≯":"≯","≱":"≱","≧̸":"≧̸","≫̸":"≫̸","≹":"≹","⩾̸":"⩾̸","≵":"≵","≎̸":"≎̸","≏̸":"≏̸","⋪":"⋪","⧏̸":"⧏̸","⋬":"⋬","≮":"≮","≰":"≰","≸":"≸","≪̸":"≪̸","⩽̸":"⩽̸","≴":"≴","⪢̸":"⪢̸","⪡̸":"⪡̸","⊀":"⊀","⪯̸":"⪯̸","⋠":"⋠","∌":"∌","⋫":"⋫","⧐̸":"⧐̸","⋭":"⋭","⊏̸":"⊏̸","⋢":"⋢","⊐̸":"⊐̸","⋣":"⋣","⊂⃒":"⊂⃒","⊈":"⊈","⊁":"⊁","⪰̸":"⪰̸","⋡":"⋡","≿̸":"≿̸","⊃⃒":"⊃⃒","⊉":"⊉","≁":"≁","≄":"≄","≇":"≇","≉":"≉","∤":"∤","𝒩":"𝒩","Ñ":"Ñ","Ñ":"Ñ","Ν":"Ν","Œ":"Œ","Ó":"Ó","Ó":"Ó","Ô":"Ô","Ô":"Ô","О":"О","Ő":"Ő","𝔒":"𝔒","Ò":"Ò","Ò":"Ò","Ō":"Ō","Ω":"Ω","Ο":"Ο","𝕆":"𝕆","“":"“","‘":"‘","⩔":"⩔","𝒪":"𝒪","Ø":"Ø","Ø":"Ø","Õ":"Õ","Õ":"Õ","⨷":"⨷","Ö":"Ö","Ö":"Ö","‾":"‾","⏞":"⏞","⎴":"⎴","⏜":"⏜","∂":"∂","П":"П","𝔓":"𝔓","Φ":"Φ","Π":"Π","±":"±","ℌ":"ℌ","ℙ":"ℙ","⪻":"⪻","≺":"≺","⪯":"⪯","≼":"≼","≾":"≾","″":"″","∏":"∏","∷":"∷","∝":"∝","𝒫":"𝒫","Ψ":"Ψ",""":'"',""":'"',"𝔔":"𝔔","ℚ":"ℚ","𝒬":"𝒬","⤐":"⤐","®":"®","®":"®","Ŕ":"Ŕ","⟫":"⟫","↠":"↠","⤖":"⤖","Ř":"Ř","Ŗ":"Ŗ","Р":"Р","ℜ":"ℜ","∋":"∋","⇋":"⇋","⥯":"⥯","ℜ":"ℜ","Ρ":"Ρ","⟩":"⟩","→":"→","⇥":"⇥","⇄":"⇄","⌉":"⌉","⟧":"⟧","⥝":"⥝","⇂":"⇂","⥕":"⥕","⌋":"⌋","⊢":"⊢","↦":"↦","⥛":"⥛","⊳":"⊳","⧐":"⧐","⊵":"⊵","⥏":"⥏","⥜":"⥜","↾":"↾","⥔":"⥔","⇀":"⇀","⥓":"⥓","⇒":"⇒","ℝ":"ℝ","⥰":"⥰","⇛":"⇛","ℛ":"ℛ","↱":"↱","⧴":"⧴","Щ":"Щ","Ш":"Ш","Ь":"Ь","Ś":"Ś","⪼":"⪼","Š":"Š","Ş":"Ş","Ŝ":"Ŝ","С":"С","𝔖":"𝔖","↓":"↓","←":"←","→":"→","↑":"↑","Σ":"Σ","∘":"∘","𝕊":"𝕊","√":"√","□":"□","⊓":"⊓","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊔":"⊔","𝒮":"𝒮","⋆":"⋆","⋐":"⋐","⋐":"⋐","⊆":"⊆","≻":"≻","⪰":"⪰","≽":"≽","≿":"≿","∋":"∋","∑":"∑","⋑":"⋑","⊃":"⊃","⊇":"⊇","⋑":"⋑","Þ":"Þ","Þ":"Þ","™":"™","Ћ":"Ћ","Ц":"Ц","	":" ","Τ":"Τ","Ť":"Ť","Ţ":"Ţ","Т":"Т","𝔗":"𝔗","∴":"∴","Θ":"Θ","  ":" "," ":" ","∼":"∼","≃":"≃","≅":"≅","≈":"≈","𝕋":"𝕋","⃛":"⃛","𝒯":"𝒯","Ŧ":"Ŧ","Ú":"Ú","Ú":"Ú","↟":"↟","⥉":"⥉","Ў":"Ў","Ŭ":"Ŭ","Û":"Û","Û":"Û","У":"У","Ű":"Ű","𝔘":"𝔘","Ù":"Ù","Ù":"Ù","Ū":"Ū","_":"_","⏟":"⏟","⎵":"⎵","⏝":"⏝","⋃":"⋃","⊎":"⊎","Ų":"Ų","𝕌":"𝕌","↑":"↑","⤒":"⤒","⇅":"⇅","↕":"↕","⥮":"⥮","⊥":"⊥","↥":"↥","⇑":"⇑","⇕":"⇕","↖":"↖","↗":"↗","ϒ":"ϒ","Υ":"Υ","Ů":"Ů","𝒰":"𝒰","Ũ":"Ũ","Ü":"Ü","Ü":"Ü","⊫":"⊫","⫫":"⫫","В":"В","⊩":"⊩","⫦":"⫦","⋁":"⋁","‖":"‖","‖":"‖","∣":"∣","|":"|","❘":"❘","≀":"≀"," ":" ","𝔙":"𝔙","𝕍":"𝕍","𝒱":"𝒱","⊪":"⊪","Ŵ":"Ŵ","⋀":"⋀","𝔚":"𝔚","𝕎":"𝕎","𝒲":"𝒲","𝔛":"𝔛","Ξ":"Ξ","𝕏":"𝕏","𝒳":"𝒳","Я":"Я","Ї":"Ї","Ю":"Ю","Ý":"Ý","Ý":"Ý","Ŷ":"Ŷ","Ы":"Ы","𝔜":"𝔜","𝕐":"𝕐","𝒴":"𝒴","Ÿ":"Ÿ","Ж":"Ж","Ź":"Ź","Ž":"Ž","З":"З","Ż":"Ż","​":"","Ζ":"Ζ","ℨ":"ℨ","ℤ":"ℤ","𝒵":"𝒵","á":"á","á":"á","ă":"ă","∾":"∾","∾̳":"∾̳","∿":"∿","â":"â","â":"â","´":"´","´":"´","а":"а","æ":"æ","æ":"æ","⁡":"","𝔞":"𝔞","à":"à","à":"à","ℵ":"ℵ","ℵ":"ℵ","α":"α","ā":"ā","⨿":"⨿","&":"&","&":"&","∧":"∧","⩕":"⩕","⩜":"⩜","⩘":"⩘","⩚":"⩚","∠":"∠","⦤":"⦤","∠":"∠","∡":"∡","⦨":"⦨","⦩":"⦩","⦪":"⦪","⦫":"⦫","⦬":"⦬","⦭":"⦭","⦮":"⦮","⦯":"⦯","∟":"∟","⊾":"⊾","⦝":"⦝","∢":"∢","Å":"Å","⍼":"⍼","ą":"ą","𝕒":"𝕒","≈":"≈","⩰":"⩰","⩯":"⩯","≊":"≊","≋":"≋","'":"'","≈":"≈","≊":"≊","å":"å","å":"å","𝒶":"𝒶","*":"*","≈":"≈","≍":"≍","ã":"ã","ã":"ã","ä":"ä","ä":"ä","∳":"∳","⨑":"⨑","⫭":"⫭","≌":"≌","϶":"϶","‵":"‵","∽":"∽","⋍":"⋍","⊽":"⊽","⌅":"⌅","⌅":"⌅","⎵":"⎵","⎶":"⎶","≌":"≌","б":"б","„":"„","∵":"∵","∵":"∵","⦰":"⦰","϶":"϶","ℬ":"ℬ","β":"β","ℶ":"ℶ","≬":"≬","𝔟":"𝔟","⋂":"⋂","◯":"◯","⋃":"⋃","⨀":"⨀","⨁":"⨁","⨂":"⨂","⨆":"⨆","★":"★","▽":"▽","△":"△","⨄":"⨄","⋁":"⋁","⋀":"⋀","⤍":"⤍","⧫":"⧫","▪":"▪","▴":"▴","▾":"▾","◂":"◂","▸":"▸","␣":"␣","▒":"▒","░":"░","▓":"▓","█":"█","=⃥":"=⃥","≡⃥":"≡⃥","⌐":"⌐","𝕓":"𝕓","⊥":"⊥","⊥":"⊥","⋈":"⋈","╗":"╗","╔":"╔","╖":"╖","╓":"╓","═":"═","╦":"╦","╩":"╩","╤":"╤","╧":"╧","╝":"╝","╚":"╚","╜":"╜","╙":"╙","║":"║","╬":"╬","╣":"╣","╠":"╠","╫":"╫","╢":"╢","╟":"╟","⧉":"⧉","╕":"╕","╒":"╒","┐":"┐","┌":"┌","─":"─","╥":"╥","╨":"╨","┬":"┬","┴":"┴","⊟":"⊟","⊞":"⊞","⊠":"⊠","╛":"╛","╘":"╘","┘":"┘","└":"└","│":"│","╪":"╪","╡":"╡","╞":"╞","┼":"┼","┤":"┤","├":"├","‵":"‵","˘":"˘","¦":"¦","¦":"¦","𝒷":"𝒷","⁏":"⁏","∽":"∽","⋍":"⋍","\":"\\","⧅":"⧅","⟈":"⟈","•":"•","•":"•","≎":"≎","⪮":"⪮","≏":"≏","≏":"≏","ć":"ć","∩":"∩","⩄":"⩄","⩉":"⩉","⩋":"⩋","⩇":"⩇","⩀":"⩀","∩︀":"∩︀","⁁":"⁁","ˇ":"ˇ","⩍":"⩍","č":"č","ç":"ç","ç":"ç","ĉ":"ĉ","⩌":"⩌","⩐":"⩐","ċ":"ċ","¸":"¸","¸":"¸","⦲":"⦲","¢":"¢","¢":"¢","·":"·","𝔠":"𝔠","ч":"ч","✓":"✓","✓":"✓","χ":"χ","○":"○","⧃":"⧃","ˆ":"ˆ","≗":"≗","↺":"↺","↻":"↻","®":"®","Ⓢ":"Ⓢ","⊛":"⊛","⊚":"⊚","⊝":"⊝","≗":"≗","⨐":"⨐","⫯":"⫯","⧂":"⧂","♣":"♣","♣":"♣",":":":","≔":"≔","≔":"≔",",":",","@":"@","∁":"∁","∘":"∘","∁":"∁","ℂ":"ℂ","≅":"≅","⩭":"⩭","∮":"∮","𝕔":"𝕔","∐":"∐","©":"©","©":"©","℗":"℗","↵":"↵","✗":"✗","𝒸":"𝒸","⫏":"⫏","⫑":"⫑","⫐":"⫐","⫒":"⫒","⋯":"⋯","⤸":"⤸","⤵":"⤵","⋞":"⋞","⋟":"⋟","↶":"↶","⤽":"⤽","∪":"∪","⩈":"⩈","⩆":"⩆","⩊":"⩊","⊍":"⊍","⩅":"⩅","∪︀":"∪︀","↷":"↷","⤼":"⤼","⋞":"⋞","⋟":"⋟","⋎":"⋎","⋏":"⋏","¤":"¤","¤":"¤","↶":"↶","↷":"↷","⋎":"⋎","⋏":"⋏","∲":"∲","∱":"∱","⌭":"⌭","⇓":"⇓","⥥":"⥥","†":"†","ℸ":"ℸ","↓":"↓","‐":"‐","⊣":"⊣","⤏":"⤏","˝":"˝","ď":"ď","д":"д","ⅆ":"ⅆ","‡":"‡","⇊":"⇊","⩷":"⩷","°":"°","°":"°","δ":"δ","⦱":"⦱","⥿":"⥿","𝔡":"𝔡","⇃":"⇃","⇂":"⇂","⋄":"⋄","⋄":"⋄","♦":"♦","♦":"♦","¨":"¨","ϝ":"ϝ","⋲":"⋲","÷":"÷","÷":"÷","÷":"÷","⋇":"⋇","⋇":"⋇","ђ":"ђ","⌞":"⌞","⌍":"⌍","$":"$","𝕕":"𝕕","˙":"˙","≐":"≐","≑":"≑","∸":"∸","∔":"∔","⊡":"⊡","⌆":"⌆","↓":"↓","⇊":"⇊","⇃":"⇃","⇂":"⇂","⤐":"⤐","⌟":"⌟","⌌":"⌌","𝒹":"𝒹","ѕ":"ѕ","⧶":"⧶","đ":"đ","⋱":"⋱","▿":"▿","▾":"▾","⇵":"⇵","⥯":"⥯","⦦":"⦦","џ":"џ","⟿":"⟿","⩷":"⩷","≑":"≑","é":"é","é":"é","⩮":"⩮","ě":"ě","≖":"≖","ê":"ê","ê":"ê","≕":"≕","э":"э","ė":"ė","ⅇ":"ⅇ","≒":"≒","𝔢":"𝔢","⪚":"⪚","è":"è","è":"è","⪖":"⪖","⪘":"⪘","⪙":"⪙","⏧":"⏧","ℓ":"ℓ","⪕":"⪕","⪗":"⪗","ē":"ē","∅":"∅","∅":"∅","∅":"∅"," ":" "," ":" "," ":" ","ŋ":"ŋ"," ":" ","ę":"ę","𝕖":"𝕖","⋕":"⋕","⧣":"⧣","⩱":"⩱","ε":"ε","ε":"ε","ϵ":"ϵ","≖":"≖","≕":"≕","≂":"≂","⪖":"⪖","⪕":"⪕","=":"=","≟":"≟","≡":"≡","⩸":"⩸","⧥":"⧥","≓":"≓","⥱":"⥱","ℯ":"ℯ","≐":"≐","≂":"≂","η":"η","ð":"ð","ð":"ð","ë":"ë","ë":"ë","€":"€","!":"!","∃":"∃","ℰ":"ℰ","ⅇ":"ⅇ","≒":"≒","ф":"ф","♀":"♀","ffi":"ffi","ff":"ff","ffl":"ffl","𝔣":"𝔣","fi":"fi","fj":"fj","♭":"♭","fl":"fl","▱":"▱","ƒ":"ƒ","𝕗":"𝕗","∀":"∀","⋔":"⋔","⫙":"⫙","⨍":"⨍","½":"½","½":"½","⅓":"⅓","¼":"¼","¼":"¼","⅕":"⅕","⅙":"⅙","⅛":"⅛","⅔":"⅔","⅖":"⅖","¾":"¾","¾":"¾","⅗":"⅗","⅜":"⅜","⅘":"⅘","⅚":"⅚","⅝":"⅝","⅞":"⅞","⁄":"⁄","⌢":"⌢","𝒻":"𝒻","≧":"≧","⪌":"⪌","ǵ":"ǵ","γ":"γ","ϝ":"ϝ","⪆":"⪆","ğ":"ğ","ĝ":"ĝ","г":"г","ġ":"ġ","≥":"≥","⋛":"⋛","≥":"≥","≧":"≧","⩾":"⩾","⩾":"⩾","⪩":"⪩","⪀":"⪀","⪂":"⪂","⪄":"⪄","⋛︀":"⋛︀","⪔":"⪔","𝔤":"𝔤","≫":"≫","⋙":"⋙","ℷ":"ℷ","ѓ":"ѓ","≷":"≷","⪒":"⪒","⪥":"⪥","⪤":"⪤","≩":"≩","⪊":"⪊","⪊":"⪊","⪈":"⪈","⪈":"⪈","≩":"≩","⋧":"⋧","𝕘":"𝕘","`":"`","ℊ":"ℊ","≳":"≳","⪎":"⪎","⪐":"⪐",">":">",">":">","⪧":"⪧","⩺":"⩺","⋗":"⋗","⦕":"⦕","⩼":"⩼","⪆":"⪆","⥸":"⥸","⋗":"⋗","⋛":"⋛","⪌":"⪌","≷":"≷","≳":"≳","≩︀":"≩︀","≩︀":"≩︀","⇔":"⇔"," ":" ","½":"½","ℋ":"ℋ","ъ":"ъ","↔":"↔","⥈":"⥈","↭":"↭","ℏ":"ℏ","ĥ":"ĥ","♥":"♥","♥":"♥","…":"…","⊹":"⊹","𝔥":"𝔥","⤥":"⤥","⤦":"⤦","⇿":"⇿","∻":"∻","↩":"↩","↪":"↪","𝕙":"𝕙","―":"―","𝒽":"𝒽","ℏ":"ℏ","ħ":"ħ","⁃":"⁃","‐":"‐","í":"í","í":"í","⁣":"","î":"î","î":"î","и":"и","е":"е","¡":"¡","¡":"¡","⇔":"⇔","𝔦":"𝔦","ì":"ì","ì":"ì","ⅈ":"ⅈ","⨌":"⨌","∭":"∭","⧜":"⧜","℩":"℩","ij":"ij","ī":"ī","ℑ":"ℑ","ℐ":"ℐ","ℑ":"ℑ","ı":"ı","⊷":"⊷","Ƶ":"Ƶ","∈":"∈","℅":"℅","∞":"∞","⧝":"⧝","ı":"ı","∫":"∫","⊺":"⊺","ℤ":"ℤ","⊺":"⊺","⨗":"⨗","⨼":"⨼","ё":"ё","į":"į","𝕚":"𝕚","ι":"ι","⨼":"⨼","¿":"¿","¿":"¿","𝒾":"𝒾","∈":"∈","⋹":"⋹","⋵":"⋵","⋴":"⋴","⋳":"⋳","∈":"∈","⁢":"","ĩ":"ĩ","і":"і","ï":"ï","ï":"ï","ĵ":"ĵ","й":"й","𝔧":"𝔧","ȷ":"ȷ","𝕛":"𝕛","𝒿":"𝒿","ј":"ј","є":"є","κ":"κ","ϰ":"ϰ","ķ":"ķ","к":"к","𝔨":"𝔨","ĸ":"ĸ","х":"х","ќ":"ќ","𝕜":"𝕜","𝓀":"𝓀","⇚":"⇚","⇐":"⇐","⤛":"⤛","⤎":"⤎","≦":"≦","⪋":"⪋","⥢":"⥢","ĺ":"ĺ","⦴":"⦴","ℒ":"ℒ","λ":"λ","⟨":"⟨","⦑":"⦑","⟨":"⟨","⪅":"⪅","«":"«","«":"«","←":"←","⇤":"⇤","⤟":"⤟","⤝":"⤝","↩":"↩","↫":"↫","⤹":"⤹","⥳":"⥳","↢":"↢","⪫":"⪫","⤙":"⤙","⪭":"⪭","⪭︀":"⪭︀","⤌":"⤌","❲":"❲","{":"{","[":"[","⦋":"⦋","⦏":"⦏","⦍":"⦍","ľ":"ľ","ļ":"ļ","⌈":"⌈","{":"{","л":"л","⤶":"⤶","“":"“","„":"„","⥧":"⥧","⥋":"⥋","↲":"↲","≤":"≤","←":"←","↢":"↢","↽":"↽","↼":"↼","⇇":"⇇","↔":"↔","⇆":"⇆","⇋":"⇋","↭":"↭","⋋":"⋋","⋚":"⋚","≤":"≤","≦":"≦","⩽":"⩽","⩽":"⩽","⪨":"⪨","⩿":"⩿","⪁":"⪁","⪃":"⪃","⋚︀":"⋚︀","⪓":"⪓","⪅":"⪅","⋖":"⋖","⋚":"⋚","⪋":"⪋","≶":"≶","≲":"≲","⥼":"⥼","⌊":"⌊","𝔩":"𝔩","≶":"≶","⪑":"⪑","↽":"↽","↼":"↼","⥪":"⥪","▄":"▄","љ":"љ","≪":"≪","⇇":"⇇","⌞":"⌞","⥫":"⥫","◺":"◺","ŀ":"ŀ","⎰":"⎰","⎰":"⎰","≨":"≨","⪉":"⪉","⪉":"⪉","⪇":"⪇","⪇":"⪇","≨":"≨","⋦":"⋦","⟬":"⟬","⇽":"⇽","⟦":"⟦","⟵":"⟵","⟷":"⟷","⟼":"⟼","⟶":"⟶","↫":"↫","↬":"↬","⦅":"⦅","𝕝":"𝕝","⨭":"⨭","⨴":"⨴","∗":"∗","_":"_","◊":"◊","◊":"◊","⧫":"⧫","(":"(","⦓":"⦓","⇆":"⇆","⌟":"⌟","⇋":"⇋","⥭":"⥭","‎":"","⊿":"⊿","‹":"‹","𝓁":"𝓁","↰":"↰","≲":"≲","⪍":"⪍","⪏":"⪏","[":"[","‘":"‘","‚":"‚","ł":"ł","<":"<","<":"<","⪦":"⪦","⩹":"⩹","⋖":"⋖","⋋":"⋋","⋉":"⋉","⥶":"⥶","⩻":"⩻","⦖":"⦖","◃":"◃","⊴":"⊴","◂":"◂","⥊":"⥊","⥦":"⥦","≨︀":"≨︀","≨︀":"≨︀","∺":"∺","¯":"¯","¯":"¯","♂":"♂","✠":"✠","✠":"✠","↦":"↦","↦":"↦","↧":"↧","↤":"↤","↥":"↥","▮":"▮","⨩":"⨩","м":"м","—":"—","∡":"∡","𝔪":"𝔪","℧":"℧","µ":"µ","µ":"µ","∣":"∣","*":"*","⫰":"⫰","·":"·","·":"·","−":"−","⊟":"⊟","∸":"∸","⨪":"⨪","⫛":"⫛","…":"…","∓":"∓","⊧":"⊧","𝕞":"𝕞","∓":"∓","𝓂":"𝓂","∾":"∾","μ":"μ","⊸":"⊸","⊸":"⊸","⋙̸":"⋙̸","≫⃒":"≫⃒","≫̸":"≫̸","⇍":"⇍","⇎":"⇎","⋘̸":"⋘̸","≪⃒":"≪⃒","≪̸":"≪̸","⇏":"⇏","⊯":"⊯","⊮":"⊮","∇":"∇","ń":"ń","∠⃒":"∠⃒","≉":"≉","⩰̸":"⩰̸","≋̸":"≋̸","ʼn":"ʼn","≉":"≉","♮":"♮","♮":"♮","ℕ":"ℕ"," ":" "," ":" ","≎̸":"≎̸","≏̸":"≏̸","⩃":"⩃","ň":"ň","ņ":"ņ","≇":"≇","⩭̸":"⩭̸","⩂":"⩂","н":"н","–":"–","≠":"≠","⇗":"⇗","⤤":"⤤","↗":"↗","↗":"↗","≐̸":"≐̸","≢":"≢","⤨":"⤨","≂̸":"≂̸","∄":"∄","∄":"∄","𝔫":"𝔫","≧̸":"≧̸","≱":"≱","≱":"≱","≧̸":"≧̸","⩾̸":"⩾̸","⩾̸":"⩾̸","≵":"≵","≯":"≯","≯":"≯","⇎":"⇎","↮":"↮","⫲":"⫲","∋":"∋","⋼":"⋼","⋺":"⋺","∋":"∋","њ":"њ","⇍":"⇍","≦̸":"≦̸","↚":"↚","‥":"‥","≰":"≰","↚":"↚","↮":"↮","≰":"≰","≦̸":"≦̸","⩽̸":"⩽̸","⩽̸":"⩽̸","≮":"≮","≴":"≴","≮":"≮","⋪":"⋪","⋬":"⋬","∤":"∤","𝕟":"𝕟","¬":"¬","¬":"¬","∉":"∉","⋹̸":"⋹̸","⋵̸":"⋵̸","∉":"∉","⋷":"⋷","⋶":"⋶","∌":"∌","∌":"∌","⋾":"⋾","⋽":"⋽","∦":"∦","∦":"∦","⫽⃥":"⫽⃥","∂̸":"∂̸","⨔":"⨔","⊀":"⊀","⋠":"⋠","⪯̸":"⪯̸","⊀":"⊀","⪯̸":"⪯̸","⇏":"⇏","↛":"↛","⤳̸":"⤳̸","↝̸":"↝̸","↛":"↛","⋫":"⋫","⋭":"⋭","⊁":"⊁","⋡":"⋡","⪰̸":"⪰̸","𝓃":"𝓃","∤":"∤","∦":"∦","≁":"≁","≄":"≄","≄":"≄","∤":"∤","∦":"∦","⋢":"⋢","⋣":"⋣","⊄":"⊄","⫅̸":"⫅̸","⊈":"⊈","⊂⃒":"⊂⃒","⊈":"⊈","⫅̸":"⫅̸","⊁":"⊁","⪰̸":"⪰̸","⊅":"⊅","⫆̸":"⫆̸","⊉":"⊉","⊃⃒":"⊃⃒","⊉":"⊉","⫆̸":"⫆̸","≹":"≹","ñ":"ñ","ñ":"ñ","≸":"≸","⋪":"⋪","⋬":"⋬","⋫":"⋫","⋭":"⋭","ν":"ν","#":"#","№":"№"," ":" ","⊭":"⊭","⤄":"⤄","≍⃒":"≍⃒","⊬":"⊬","≥⃒":"≥⃒",">⃒":">⃒","⧞":"⧞","⤂":"⤂","≤⃒":"≤⃒","<⃒":"<⃒","⊴⃒":"⊴⃒","⤃":"⤃","⊵⃒":"⊵⃒","∼⃒":"∼⃒","⇖":"⇖","⤣":"⤣","↖":"↖","↖":"↖","⤧":"⤧","Ⓢ":"Ⓢ","ó":"ó","ó":"ó","⊛":"⊛","⊚":"⊚","ô":"ô","ô":"ô","о":"о","⊝":"⊝","ő":"ő","⨸":"⨸","⊙":"⊙","⦼":"⦼","œ":"œ","⦿":"⦿","𝔬":"𝔬","˛":"˛","ò":"ò","ò":"ò","⧁":"⧁","⦵":"⦵","Ω":"Ω","∮":"∮","↺":"↺","⦾":"⦾","⦻":"⦻","‾":"‾","⧀":"⧀","ō":"ō","ω":"ω","ο":"ο","⦶":"⦶","⊖":"⊖","𝕠":"𝕠","⦷":"⦷","⦹":"⦹","⊕":"⊕","∨":"∨","↻":"↻","⩝":"⩝","ℴ":"ℴ","ℴ":"ℴ","ª":"ª","ª":"ª","º":"º","º":"º","⊶":"⊶","⩖":"⩖","⩗":"⩗","⩛":"⩛","ℴ":"ℴ","ø":"ø","ø":"ø","⊘":"⊘","õ":"õ","õ":"õ","⊗":"⊗","⨶":"⨶","ö":"ö","ö":"ö","⌽":"⌽","∥":"∥","¶":"¶","¶":"¶","∥":"∥","⫳":"⫳","⫽":"⫽","∂":"∂","п":"п","%":"%",".":".","‰":"‰","⊥":"⊥","‱":"‱","𝔭":"𝔭","φ":"φ","ϕ":"ϕ","ℳ":"ℳ","☎":"☎","π":"π","⋔":"⋔","ϖ":"ϖ","ℏ":"ℏ","ℎ":"ℎ","ℏ":"ℏ","+":"+","⨣":"⨣","⊞":"⊞","⨢":"⨢","∔":"∔","⨥":"⨥","⩲":"⩲","±":"±","±":"±","⨦":"⨦","⨧":"⨧","±":"±","⨕":"⨕","𝕡":"𝕡","£":"£","£":"£","≺":"≺","⪳":"⪳","⪷":"⪷","≼":"≼","⪯":"⪯","≺":"≺","⪷":"⪷","≼":"≼","⪯":"⪯","⪹":"⪹","⪵":"⪵","⋨":"⋨","≾":"≾","′":"′","ℙ":"ℙ","⪵":"⪵","⪹":"⪹","⋨":"⋨","∏":"∏","⌮":"⌮","⌒":"⌒","⌓":"⌓","∝":"∝","∝":"∝","≾":"≾","⊰":"⊰","𝓅":"𝓅","ψ":"ψ"," ":" ","𝔮":"𝔮","⨌":"⨌","𝕢":"𝕢","⁗":"⁗","𝓆":"𝓆","ℍ":"ℍ","⨖":"⨖","?":"?","≟":"≟",""":'"',""":'"',"⇛":"⇛","⇒":"⇒","⤜":"⤜","⤏":"⤏","⥤":"⥤","∽̱":"∽̱","ŕ":"ŕ","√":"√","⦳":"⦳","⟩":"⟩","⦒":"⦒","⦥":"⦥","⟩":"⟩","»":"»","»":"»","→":"→","⥵":"⥵","⇥":"⇥","⤠":"⤠","⤳":"⤳","⤞":"⤞","↪":"↪","↬":"↬","⥅":"⥅","⥴":"⥴","↣":"↣","↝":"↝","⤚":"⤚","∶":"∶","ℚ":"ℚ","⤍":"⤍","❳":"❳","}":"}","]":"]","⦌":"⦌","⦎":"⦎","⦐":"⦐","ř":"ř","ŗ":"ŗ","⌉":"⌉","}":"}","р":"р","⤷":"⤷","⥩":"⥩","”":"”","”":"”","↳":"↳","ℜ":"ℜ","ℛ":"ℛ","ℜ":"ℜ","ℝ":"ℝ","▭":"▭","®":"®","®":"®","⥽":"⥽","⌋":"⌋","𝔯":"𝔯","⇁":"⇁","⇀":"⇀","⥬":"⥬","ρ":"ρ","ϱ":"ϱ","→":"→","↣":"↣","⇁":"⇁","⇀":"⇀","⇄":"⇄","⇌":"⇌","⇉":"⇉","↝":"↝","⋌":"⋌","˚":"˚","≓":"≓","⇄":"⇄","⇌":"⇌","‏":"","⎱":"⎱","⎱":"⎱","⫮":"⫮","⟭":"⟭","⇾":"⇾","⟧":"⟧","⦆":"⦆","𝕣":"𝕣","⨮":"⨮","⨵":"⨵",")":")","⦔":"⦔","⨒":"⨒","⇉":"⇉","›":"›","𝓇":"𝓇","↱":"↱","]":"]","’":"’","’":"’","⋌":"⋌","⋊":"⋊","▹":"▹","⊵":"⊵","▸":"▸","⧎":"⧎","⥨":"⥨","℞":"℞","ś":"ś","‚":"‚","≻":"≻","⪴":"⪴","⪸":"⪸","š":"š","≽":"≽","⪰":"⪰","ş":"ş","ŝ":"ŝ","⪶":"⪶","⪺":"⪺","⋩":"⋩","⨓":"⨓","≿":"≿","с":"с","⋅":"⋅","⊡":"⊡","⩦":"⩦","⇘":"⇘","⤥":"⤥","↘":"↘","↘":"↘","§":"§","§":"§",";":";","⤩":"⤩","∖":"∖","∖":"∖","✶":"✶","𝔰":"𝔰","⌢":"⌢","♯":"♯","щ":"щ","ш":"ш","∣":"∣","∥":"∥","­":"","­":"","σ":"σ","ς":"ς","ς":"ς","∼":"∼","⩪":"⩪","≃":"≃","≃":"≃","⪞":"⪞","⪠":"⪠","⪝":"⪝","⪟":"⪟","≆":"≆","⨤":"⨤","⥲":"⥲","←":"←","∖":"∖","⨳":"⨳","⧤":"⧤","∣":"∣","⌣":"⌣","⪪":"⪪","⪬":"⪬","⪬︀":"⪬︀","ь":"ь","/":"/","⧄":"⧄","⌿":"⌿","𝕤":"𝕤","♠":"♠","♠":"♠","∥":"∥","⊓":"⊓","⊓︀":"⊓︀","⊔":"⊔","⊔︀":"⊔︀","⊏":"⊏","⊑":"⊑","⊏":"⊏","⊑":"⊑","⊐":"⊐","⊒":"⊒","⊐":"⊐","⊒":"⊒","□":"□","□":"□","▪":"▪","▪":"▪","→":"→","𝓈":"𝓈","∖":"∖","⌣":"⌣","⋆":"⋆","☆":"☆","★":"★","ϵ":"ϵ","ϕ":"ϕ","¯":"¯","⊂":"⊂","⫅":"⫅","⪽":"⪽","⊆":"⊆","⫃":"⫃","⫁":"⫁","⫋":"⫋","⊊":"⊊","⪿":"⪿","⥹":"⥹","⊂":"⊂","⊆":"⊆","⫅":"⫅","⊊":"⊊","⫋":"⫋","⫇":"⫇","⫕":"⫕","⫓":"⫓","≻":"≻","⪸":"⪸","≽":"≽","⪰":"⪰","⪺":"⪺","⪶":"⪶","⋩":"⋩","≿":"≿","∑":"∑","♪":"♪","¹":"¹","¹":"¹","²":"²","²":"²","³":"³","³":"³","⊃":"⊃","⫆":"⫆","⪾":"⪾","⫘":"⫘","⊇":"⊇","⫄":"⫄","⟉":"⟉","⫗":"⫗","⥻":"⥻","⫂":"⫂","⫌":"⫌","⊋":"⊋","⫀":"⫀","⊃":"⊃","⊇":"⊇","⫆":"⫆","⊋":"⊋","⫌":"⫌","⫈":"⫈","⫔":"⫔","⫖":"⫖","⇙":"⇙","⤦":"⤦","↙":"↙","↙":"↙","⤪":"⤪","ß":"ß","ß":"ß","⌖":"⌖","τ":"τ","⎴":"⎴","ť":"ť","ţ":"ţ","т":"т","⃛":"⃛","⌕":"⌕","𝔱":"𝔱","∴":"∴","∴":"∴","θ":"θ","ϑ":"ϑ","ϑ":"ϑ","≈":"≈","∼":"∼"," ":" ","≈":"≈","∼":"∼","þ":"þ","þ":"þ","˜":"˜","×":"×","×":"×","⊠":"⊠","⨱":"⨱","⨰":"⨰","∭":"∭","⤨":"⤨","⊤":"⊤","⌶":"⌶","⫱":"⫱","𝕥":"𝕥","⫚":"⫚","⤩":"⤩","‴":"‴","™":"™","▵":"▵","▿":"▿","◃":"◃","⊴":"⊴","≜":"≜","▹":"▹","⊵":"⊵","◬":"◬","≜":"≜","⨺":"⨺","⨹":"⨹","⧍":"⧍","⨻":"⨻","⏢":"⏢","𝓉":"𝓉","ц":"ц","ћ":"ћ","ŧ":"ŧ","≬":"≬","↞":"↞","↠":"↠","⇑":"⇑","⥣":"⥣","ú":"ú","ú":"ú","↑":"↑","ў":"ў","ŭ":"ŭ","û":"û","û":"û","у":"у","⇅":"⇅","ű":"ű","⥮":"⥮","⥾":"⥾","𝔲":"𝔲","ù":"ù","ù":"ù","↿":"↿","↾":"↾","▀":"▀","⌜":"⌜","⌜":"⌜","⌏":"⌏","◸":"◸","ū":"ū","¨":"¨","¨":"¨","ų":"ų","𝕦":"𝕦","↑":"↑","↕":"↕","↿":"↿","↾":"↾","⊎":"⊎","υ":"υ","ϒ":"ϒ","υ":"υ","⇈":"⇈","⌝":"⌝","⌝":"⌝","⌎":"⌎","ů":"ů","◹":"◹","𝓊":"𝓊","⋰":"⋰","ũ":"ũ","▵":"▵","▴":"▴","⇈":"⇈","ü":"ü","ü":"ü","⦧":"⦧","⇕":"⇕","⫨":"⫨","⫩":"⫩","⊨":"⊨","⦜":"⦜","ϵ":"ϵ","ϰ":"ϰ","∅":"∅","ϕ":"ϕ","ϖ":"ϖ","∝":"∝","↕":"↕","ϱ":"ϱ","ς":"ς","⊊︀":"⊊︀","⫋︀":"⫋︀","⊋︀":"⊋︀","⫌︀":"⫌︀","ϑ":"ϑ","⊲":"⊲","⊳":"⊳","в":"в","⊢":"⊢","∨":"∨","⊻":"⊻","≚":"≚","⋮":"⋮","|":"|","|":"|","𝔳":"𝔳","⊲":"⊲","⊂⃒":"⊂⃒","⊃⃒":"⊃⃒","𝕧":"𝕧","∝":"∝","⊳":"⊳","𝓋":"𝓋","⫋︀":"⫋︀","⊊︀":"⊊︀","⫌︀":"⫌︀","⊋︀":"⊋︀","⦚":"⦚","ŵ":"ŵ","⩟":"⩟","∧":"∧","≙":"≙","℘":"℘","𝔴":"𝔴","𝕨":"𝕨","℘":"℘","≀":"≀","≀":"≀","𝓌":"𝓌","⋂":"⋂","◯":"◯","⋃":"⋃","▽":"▽","𝔵":"𝔵","⟺":"⟺","⟷":"⟷","ξ":"ξ","⟸":"⟸","⟵":"⟵","⟼":"⟼","⋻":"⋻","⨀":"⨀","𝕩":"𝕩","⨁":"⨁","⨂":"⨂","⟹":"⟹","⟶":"⟶","𝓍":"𝓍","⨆":"⨆","⨄":"⨄","△":"△","⋁":"⋁","⋀":"⋀","ý":"ý","ý":"ý","я":"я","ŷ":"ŷ","ы":"ы","¥":"¥","¥":"¥","𝔶":"𝔶","ї":"ї","𝕪":"𝕪","𝓎":"𝓎","ю":"ю","ÿ":"ÿ","ÿ":"ÿ","ź":"ź","ž":"ž","з":"з","ż":"ż","ℨ":"ℨ","ζ":"ζ","𝔷":"𝔷","ж":"ж","⇝":"⇝","𝕫":"𝕫","𝓏":"𝓏","‍":"","‌":""};function _u(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof to[e]=="string")return to[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 dr(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 vu(r){return"<div>"+dr(r).replace(/\n/g,"<br />")+"</div>"}function Cu(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
|
|
16
|
+
`),r=_u(r),r}function bl(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function Bs(r){let e=[],t=(n,s)=>{if(s&&e.push(", "),n.group){let i=`${n.name}:`,o=";";e.push(i),n.group.forEach(t),e.push(o)}else e.push(bl(n))};return r.forEach(t),e.join("")}function _l(r){return`<a href="mailto:${dr(r.address)}" class="postal-email-address">${dr(r.name||`<${r.address}>`)}</a>`}function Fs(r){let e=[],t=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let i=`<span class="postal-email-address-group">${dr(n.name)}:</span>`,o='<span class="postal-email-address-group">;</span>';e.push(i),n.group.forEach(t),e.push(o)}else e.push(_l(n))};return r.forEach(t),e.join(" ")}function wu(r,e,t){r=(r||"").toString(),e=e||76;let n=0,s=r.length,i="",o,a;for(;n<s;){if(o=r.substr(n,e),o.length<e){i+=o;break}if(a=o.match(/^[^\n\r]*(\r?\n|\r)/)){o=a[0],i+=o,n+=o.length;continue}else(a=o.match(/(\s+)[^\s]*$/))&&a[0].length-(a[1]||"").length<o.length?o=o.substr(0,o.length-(a[0].length-(a[1]||"").length)):(a=r.substr(n+o.length).match(/^[^\s]+(\s*)/))&&(o=o+a[0].substr(0,a[0].length-0));i+=o,n+=o.length,n<s&&(i+=`\r
|
|
17
|
+
`)}return i}function ro(r){let e=[];if(r.from&&e.push({key:"From",val:bl(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let o={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},a=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",o).format(new Date(r.date));e.push({key:"Date",val:a})}r.to&&r.to.length&&e.push({key:"To",val:Bs(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:Bs(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:Bs(r.bcc)});let t=e.map(o=>o.key.length).reduce((o,a)=>a>o?a:o,0);e=e.flatMap(o=>{let a=t-o.key.length,l=`${o.key}: ${" ".repeat(a)}`,u=`${" ".repeat(o.key.length+1)} ${" ".repeat(a)}`;return wu(o.val,80).split(/\r?\n/).map(d=>d.trim()).map((d,f)=>`${f?u:l}${d}`)});let n=e.map(o=>o.length).reduce((o,a)=>a>o?a:o,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 no(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${_l(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">${dr(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="${dr(r.date)}">${dr(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Fs(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Fs(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Fs(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 Du(r,e){let t=!1,n="text",s,i=[],o={address:[],comment:[],group:[],text:[],textWasQuoted:[]},a,l,u=!1;for(a=0,l=r.length;a<l;a++){let c=r[a],d=a?r[a-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&&o[n].length?(o[n][o[n].length-1]+=c.value,n==="text"&&u&&(o.textWasQuoted[o.textWasQuoted.length-1]=!0)):(o[n].push(c.value),n==="text"&&o.textWasQuoted.push(u)))}if(!o.text.length&&o.comment.length&&(o.text=o.comment,o.comment=[]),t){o.text=o.text.join(" ");let c=[];o.group.length&&nn(o.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),i.push({name:rn(o.text||s&&s.name),group:c})}else{if(!o.address.length&&o.text.length){for(a=o.text.length-1;a>=0;a--)if(!o.textWasQuoted[a]&&o.text[a].match(/^[^@\s]+@[^@\s]+$/)){o.address=o.text.splice(a,1),o.textWasQuoted.splice(a,1);break}let c=function(d){return o.address.length?d:(o.address=[d.trim()]," ")};if(!o.address.length)for(a=o.text.length-1;a>=0&&!(!o.textWasQuoted[a]&&(o.text[a]=o.text[a].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),o.address.length));a--);}if(!o.text.length&&o.comment.length&&(o.text=o.comment,o.comment=[]),o.address.length>1&&(o.text=o.text.concat(o.address.splice(1))),o.text=o.text.join(" "),o.address=o.address.join(" "),!o.address&&/^=\?[^=]+?=$/.test(o.text.trim())){const c=nn(rn(o.text));if(c&&c.length)return c}if(!o.address&&t)return[];s={address:o.address||o.text||"",name:rn(o.text||o.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),i.push(s)}return i}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),i=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,i)}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 Su=50;function nn(r,e){e=e||{};let t=e._depth||0;if(t>Su)return[];let s=new Eu(r).tokenize(),i=[],o=[],a=[];if(s.forEach(l=>{l.type==="operator"&&(l.value===","||l.value===";")?(o.length&&i.push(o),o=[]):o.push(l)}),o.length&&i.push(o),i.forEach(l=>{l=Du(l,t),l.length&&(a=a.concat(l))}),e.flatten){let l=[],u=c=>{c.forEach(d=>{if(d.group)return u(d.group);l.push(d)})};return u(a),l}return a}function Au(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,i=s%3,o=s-i,a,l,u,c,d,f=0;f<o;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],a=(d&16515072)>>18,l=(d&258048)>>12,u=(d&4032)>>6,c=d&63,e+=t[a]+t[l]+t[u]+t[c];return i==1?(d=n[o],a=(d&252)>>2,l=(d&3)<<4,e+=t[a]+t[l]+"=="):i==2&&(d=n[o]<<8|n[o+1],a=(d&64512)>>10,l=(d&1008)>>4,u=(d&15)<<2,e+=t[a]+t[l]+t[u]+"="),e}const ku=256,Tu=2*1024*1024;class Un{static parse(e,t){return new Un(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||ku,maxHeadersSize:this.options.maxHeadersSize||Tu},this.root=this.currentNode=new eo({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 i=n[s];if(e.length!==i.value.length+2&&e.length!==i.value.length+4)continue;let o=e.length===i.value.length+4;if(o&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let a=!0;for(let l=0;l<i.value.length;l++)if(e[l+2]!==i.value[l]){a=!1;break}if(a)return o?(await i.node.finalize(),this.currentNode=i.node.parentNode||this.root):(await i.node.finalizeChildNodes(),this.currentNode=new eo({postalMime:this,parentNode:i.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(),i=async(o,a,l)=>{if(a=a||!1,l=l||!1,o.contentType.multipart)o.contentType.multipart==="alternative"?a=o:o.contentType.multipart==="related"&&(l=o);else if(this.isInlineMessageRfc822(o)&&!s){const u=new Un;o.subMessage=await u.parse(o.content),n.has(o)||n.set(o,{});let c=n.get(o);(o.subMessage.text||!o.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:o.subMessage}),t.add("plain")),o.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:o.subMessage}),t.add("html")),u.textMap&&u.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of o.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(o)){let u=o.contentType.parsed.value.substr(o.contentType.parsed.value.indexOf("/")+1),c=a||o;n.has(c)||n.set(c,{});let d=n.get(c);d[u]=d[u]||[],d[u].push({type:"text",value:o.getTextContent()}),t.add(u)}else if(o.content){const u=o.contentDisposition.parsed.params.filename||o.contentType.parsed.params.name||null,c={filename:u?rn(u):null,mimeType:o.contentType.parsed.value,disposition:o.contentDisposition.parsed.value||null};switch(l&&o.contentId&&(c.related=!0),o.contentDescription&&(c.description=o.contentDescription),o.contentId&&(c.contentId=o.contentId),o.contentType.parsed.value){case"text/calendar":case"application/ics":{o.contentType.parsed.params.method&&(c.method=o.contentType.parsed.params.method.toString().toUpperCase().trim());const d=o.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:a}=await s.read();if(l)break;n.push(a),t+=a.length}const o=new Uint8Array(t);let i=0;for(let l of n)o.set(l,i),i+=l.length;return o}async parse(e){var s,o;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Nr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await os(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=Zr(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=Zr(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=>Zr(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]=Xr(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=lu(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 hl{constructor(e){xt(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const o=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`API error (${o.status}): ${l}`)}const i=await o.json();if(!i.success&&i.error)throw new Error(i.error);return i.result}catch(o){throw console.error("API call failed:",o),o}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const o of s){const i=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${o}"`)],a=(await this.imapExec(e,i)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(a>0)return{success:!0,moved:a}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(l=>`UID STORE ${l} +FLAGS (\\Deleted)`),"EXPUNGE"],i=(await this.imapExec(e,s)).responses.filter(l=>l.ok&&l.command==="UID STORE").length;return{success:i>0,archived:i}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),o=s.responses.find(h=>h.command==="SELECT");if(!(o!=null&&o.ok))throw new Error(`Failed to select folder: ${(o==null?void 0:o.error)||"Unknown error"}`);const i=s.responses.find(h=>h.command==="FETCH");if(!(i!=null&&i.ok)||!i.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const a=[...i.messages].sort((h,g)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(g.internalDate?new Date(g.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(a.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${a.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=a.map(h=>{var E,D,k,y,_;const g=d.get(h);if(!g)return null;const m=((E=g.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,b=((k=(D=g.envelope)==null?void 0:D.from)==null?void 0:k.email)||"Unknown",w=((y=g.envelope)==null?void 0:y.subject)||"(No subject)",v=((_=g.envelope)==null?void 0:_.date)||"";return{uid:h,from:b,subject:w,date:v,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var g,m,b,w,v,E;const o=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(o!=null&&o.ok)||!((g=o.messages)!=null&&g[0]))return console.error("Failed to fetch raw email:",o==null?void 0:o.error),null;const i=o.messages[0],l=i.body||i.raw;if(!l)return console.error("No raw email content in response"),null;const u=await new In().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(b=u.attachments)==null?void 0:b.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of u.attachments||[])if(D.contentId){const k=this.contentToBase64(D.content),y=`data:${D.mimeType};base64,${k}`,_=D.contentId.replace(/^<|>$/g,"");c.set(_,y),c.set(`<${_}>`,y)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,k)=>{const y=c.get(k)||c.get(`<${k}>`);return y?`src="${y}"`:D}));const f=((w=i.flags)==null?void 0:w.some(D=>D.toLowerCase().includes("seen")))||!1,h=((v=u.from)==null?void 0:v.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(D=>({filename:D.filename||"attachment",mimeType:D.mimeType||"application/octet-stream",size:this.getContentSize(D.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const o=await this.getSettings(),i=((n=o.accounts)==null?void 0:n.find(u=>u.id===e))||((s=o.accounts)==null?void 0:s[0]);if(!(i!=null&&i.smtp))return{success:!1,error:"No SMTP configuration found for account"};const l={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:i.email,smtp_config:{host:i.smtp.host,port:parseInt(i.smtp.port,10)||587,username:i.smtp.user,password:i.smtp.password}};t.in_reply_to&&(l.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(l.attachments=t.attachments);const a=await this.callEmail("send",l);return{success:(a==null?void 0:a.sent)??!1,message_id:a==null?void 0:a.message_id,error:a==null?void 0:a.error}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}}const As="qwanyx_auth_token",Ts="qwanyx_refresh_token";class pl{static setToken(e){typeof window<"u"&&localStorage.setItem(As,e)}static getToken(){return typeof window<"u"?localStorage.getItem(As):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(As),localStorage.removeItem(Ts))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ts,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ts):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class gl{constructor(e){xt(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,...pl.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 $n=null;function cu(r){return $n=new gl(r),$n}function di(){if(!$n)throw new Error("API client not initialized. Call initializeApiClient() first.");return $n}function ml(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:o,onError:i}=t,[l,a]=C.useState(null),[u,c]=C.useState(n),[d,f]=C.useState(null),h=C.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await di().get(r,e);a(m),o==null||o(m)}catch(g){const m=g instanceof Error?g:new Error("Unknown error");f(m),i==null||i(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,o,i]);return C.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:u,error:d,refetch:h}}function du(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[o,i]=C.useState(null),[l,a]=C.useState(!1),[u,c]=C.useState(null),d=C.useCallback(async h=>{a(!0),c(null);try{const g=di();let m;switch(e){case"POST":m=await g.post(r,h);break;case"PUT":m=await g.put(r,h);break;case"PATCH":m=await g.patch(r,h);break;case"DELETE":m=await g.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return i(m),n==null||n(m,h),m}catch(g){const m=g instanceof Error?g:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{a(!1)}},[r,e,n,s]),f=C.useCallback(()=>{i(null),c(null),a(!1)},[]);return{data:o,loading:l,error:u,mutate:d,reset:f}}var qs={exports:{}},$r={};/**
|
|
27
|
+
`);c.content=Mr.encode(d);break}default:c.content=o.content}this.attachments.push(c)}for(let u of o.childNodes)await i(u,a,l)};await i(this.root,!1,[]),n.forEach(o=>{t.forEach(a=>{if(e[a]||(e[a]=[]),o[a])o[a].forEach(l=>{switch(l.type){case"text":e[a].push(l.value);break;case"subMessage":switch(a){case"html":e[a].push(no(l.value));break;case"plain":e[a].push(ro(l.value));break}break}});else{let l;switch(a){case"html":l="plain";break;case"plain":l="html";break}(o[l]||[]).forEach(u=>{switch(u.type){case"text":switch(a){case"html":e[a].push(vu(u.value));break;case"plain":e[a].push(Cu(u.value));break}break;case"subMessage":switch(a){case"html":e[a].push(no(u.value));break;case"plain":e[a].push(ro(u.value));break}break}})}})}),Object.keys(e).forEach(o=>{e[o]=e[o].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:a,value:l}=await s.read();if(a)break;n.push(l),t+=l.length}const i=new Uint8Array(t);let o=0;for(let a of n)i.set(a,o),o+=a.length;return i}async parse(e){var s,i;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=Mr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await ds(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 o=this.readLine();await this.processLine(o.bytes,o.done)}await this.processNodeTree();const t={headers:this.root.headers.map(o=>({key:o.key,value:o.value})).reverse()};for(const o of["from","sender"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);l&&l.length&&(t[o]=l[0])}}for(const o of["delivered-to","return-path"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);if(l&&l.length&&l[0].address){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l[0].address}}}for(const o of["to","cc","bcc","reply-to"]){const a=this.root.headers.filter(u=>u.key===o);let l=[];if(a.filter(u=>u&&u.value).map(u=>nn(u.value)).forEach(u=>l=l.concat(u||[])),l&&l.length){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l}}for(const o of["subject","message-id","in-reply-to","references"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=o.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[l]=rn(a.value)}}let n=this.root.headers.find(o=>o.key==="date");if(n){let o=new Date(n.value);!o||o.toString()==="Invalid Date"?o=n.value:o=o.toISOString(),t.date=o}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(i=this.textContent)!=null&&i.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let a of t.attachments||[])a!=null&&a.content&&(a.content=Au(a.content),a.encoding="base64");break;case"utf8":let o=new TextDecoder("utf8");for(let a of t.attachments||[])a!=null&&a.content&&(a.content=o.decode(a.content),a.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class vl{constructor(e){_t(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 i=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!i.ok){const a=await i.text();throw new Error(`API error (${i.status}): ${a}`)}const o=await i.json();if(!o.success&&o.error)throw new Error(o.error);return o.result}catch(i){throw console.error("API call failed:",i),i}}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 i of s){const o=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${i}"`)],l=(await this.imapExec(e,o)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(l>0)return{success:!0,moved:l}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(a=>`UID STORE ${a} +FLAGS (\\Deleted)`),"EXPUNGE"],o=(await this.imapExec(e,s)).responses.filter(a=>a.ok&&a.command==="UID STORE").length;return{success:o>0,archived:o}}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)"]),i=s.responses.find(h=>h.command==="SELECT");if(!(i!=null&&i.ok))throw new Error(`Failed to select folder: ${(i==null?void 0:i.error)||"Unknown error"}`);const o=s.responses.find(h=>h.command==="FETCH");if(!(o!=null&&o.ok)||!o.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const l=[...o.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(l.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${l.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=l.map(h=>{var E,D,A,b,v;const p=d.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,y=((A=(D=p.envelope)==null?void 0:D.from)==null?void 0:A.email)||"Unknown",w=((b=p.envelope)==null?void 0:b.subject)||"(No subject)",x=((v=p.envelope)==null?void 0:v.date)||"";return{uid:h,from:y,subject:w,date:x,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.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,y,w,x,E;const i=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(i!=null&&i.ok)||!((p=i.messages)!=null&&p[0]))return console.error("Failed to fetch raw email:",i==null?void 0:i.error),null;const o=i.messages[0],a=o.body||o.raw;if(!a)return console.error("No raw email content in response"),null;const u=await new Un().parse(a);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(y=u.attachments)==null?void 0:y.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of u.attachments||[])if(D.contentId){const A=this.contentToBase64(D.content),b=`data:${D.mimeType};base64,${A}`,v=D.contentId.replace(/^<|>$/g,"");c.set(v,b),c.set(`<${v}>`,b)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,A)=>{const b=c.get(A)||c.get(`<${A}>`);return b?`src="${b}"`:D}));const f=((w=o.flags)==null?void 0:w.some(D=>D.toLowerCase().includes("seen")))||!1,h=((x=u.from)==null?void 0:x.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(D=>({filename:D.filename||"attachment",mimeType:D.mimeType||"application/octet-stream",size:this.getContentSize(D.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const i=await this.getSettings(),o=((n=i.accounts)==null?void 0:n.find(u=>u.id===e))||((s=i.accounts)==null?void 0:s[0]);if(!(o!=null&&o.smtp))return{success:!1,error:"No SMTP configuration found for account"};const a={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:o.email,smtp_config:{host:o.smtp.host,port:parseInt(o.smtp.port,10)||587,username:o.smtp.user,password:o.smtp.password}};t.in_reply_to&&(a.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(a.attachments=t.attachments);const l=await this.callEmail("send",a);return{success:(l==null?void 0:l.sent)??!1,message_id:l==null?void 0:l.message_id,error:l==null?void 0:l.error}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}}const Rs="qwanyx_auth_token",Ls="qwanyx_refresh_token";class Cl{static setToken(e){typeof window<"u"&&localStorage.setItem(Rs,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Rs):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Rs),localStorage.removeItem(Ls))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ls,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ls):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class wl{constructor(e){_t(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,i])=>{i!=null&&t.append(s,String(i))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:i,params:o}=t,a=`${this.config.baseUrl}/${e}${this.buildQueryString(o)}`,l={...this.config.headers,...Cl.getAuthHeader(),...s},u={method:n,headers:l};i&&n!=="GET"&&(u.body=JSON.stringify(i));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(a,{...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 Wn=null;function Nu(r){return Wn=new wl(r),Wn}function xi(){if(!Wn)throw new Error("API client not initialized. Call initializeApiClient() first.");return Wn}function Dl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:i,onError:o}=t,[a,l]=C.useState(null),[u,c]=C.useState(n),[d,f]=C.useState(null),h=C.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await xi().get(r,e);l(m),i==null||i(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");f(m),o==null||o(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,i,o]);return C.useEffect(()=>{s&&h()},[h,s]),{data:a,loading:u,error:d,refetch:h}}function Bu(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[i,o]=C.useState(null),[a,l]=C.useState(!1),[u,c]=C.useState(null),d=C.useCallback(async h=>{l(!0),c(null);try{const p=xi();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 o(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{l(!1)}},[r,e,n,s]),f=C.useCallback(()=>{o(null),c(null),l(!1)},[]);return{data:i,loading:a,error:u,mutate:d,reset:f}}var Ks={exports:{}},Wr={};/**
|
|
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 so;function Fu(){if(so)return Wr;so=1;var r=C,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,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(h=l.ref);for(c in l)n.call(l,c)&&!i.hasOwnProperty(c)&&(d[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)d[c]===void 0&&(d[c]=l[c]);return{$$typeof:e,type:a,key:f,ref:h,props:d,_owner:s.current}}return Wr.Fragment=t,Wr.jsx=o,Wr.jsxs=o,Wr}var Gr={};/**
|
|
37
37
|
* @license React
|
|
38
38
|
* react-jsx-runtime.development.js
|
|
39
39
|
*
|
|
@@ -41,41 +41,49 @@ ${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 io;function Ru(){return io||(io=1,process.env.NODE_ENV!=="production"&&function(){var r=C,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=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 y(_){if(_===null||typeof _!="object")return null;var M=p&&_[p]||_[m];return typeof M=="function"?M:null}var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(_){{for(var M=arguments.length,U=new Array(M>1?M-1:0),X=1;X<M;X++)U[X-1]=arguments[X];E("error",_,U)}}function E(_,M,U){{var X=w.ReactDebugCurrentFrame,ue=X.getStackAddendum();ue!==""&&(M+="%s",U=U.concat([ue]));var _e=U.map(function(le){return String(le)});_e.unshift("Warning: "+M),Function.prototype.apply.call(console[_],console,_e)}}var D=!1,A=!1,b=!1,v=!1,S=!1,k;k=Symbol.for("react.module.reference");function j(_){return!!(typeof _=="string"||typeof _=="function"||_===n||_===i||S||_===s||_===u||_===c||v||_===h||D||A||b||typeof _=="object"&&_!==null&&(_.$$typeof===f||_.$$typeof===d||_.$$typeof===o||_.$$typeof===a||_.$$typeof===l||_.$$typeof===k||_.getModuleId!==void 0))}function T(_,M,U){var X=_.displayName;if(X)return X;var ue=M.displayName||M.name||"";return ue!==""?U+"("+ue+")":U}function B(_){return _.displayName||"Context"}function L(_){if(_==null)return null;if(typeof _.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case n:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case a:var M=_;return B(M)+".Consumer";case o:var U=_;return B(U._context)+".Provider";case l:return T(_,_.render,"ForwardRef");case d:var X=_.displayName||null;return X!==null?X:L(_.type)||"Memo";case f:{var ue=_,_e=ue._payload,le=ue._init;try{return L(le(_e))}catch{return null}}}return null}var R=Object.assign,P=0,Q,se,xe,oe,Se,he,fe;function pe(){}pe.__reactDisabledLog=!0;function ge(){{if(P===0){Q=console.log,se=console.info,xe=console.warn,oe=console.error,Se=console.group,he=console.groupCollapsed,fe=console.groupEnd;var _={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:_,log:_,warn:_,error:_,group:_,groupCollapsed:_,groupEnd:_})}P++}}function Ae(){{if(P--,P===0){var _={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},_,{value:Q}),info:R({},_,{value:se}),warn:R({},_,{value:xe}),error:R({},_,{value:oe}),group:R({},_,{value:Se}),groupCollapsed:R({},_,{value:he}),groupEnd:R({},_,{value:fe})})}P<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var be=w.ReactCurrentDispatcher,we;function Re(_,M,U){{if(we===void 0)try{throw Error()}catch(ue){var X=ue.stack.trim().match(/\n( *(at )?)/);we=X&&X[1]||""}return`
|
|
45
|
+
`+we+_}}var ce=!1,je;{var at=typeof WeakMap=="function"?WeakMap:Map;je=new at}function kt(_,M){if(!_||ce)return"";{var U=je.get(_);if(U!==void 0)return U}var X;ce=!0;var ue=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _e;_e=be.current,be.current=null,ge();try{if(M){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(st){X=st}Reflect.construct(_,[],le)}else{try{le.call()}catch(st){X=st}_.call(le.prototype)}}else{try{throw Error()}catch(st){X=st}_()}}catch(st){if(st&&X&&typeof st.stack=="string"){for(var ae=st.stack.split(`
|
|
46
|
+
`),Ze=X.stack.split(`
|
|
47
|
+
`),$e=ae.length-1,qe=Ze.length-1;$e>=1&&qe>=0&&ae[$e]!==Ze[qe];)qe--;for(;$e>=1&&qe>=0;$e--,qe--)if(ae[$e]!==Ze[qe]){if($e!==1||qe!==1)do if($e--,qe--,qe<0||ae[$e]!==Ze[qe]){var pt=`
|
|
48
|
+
`+ae[$e].replace(" at new "," at ");return _.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",_.displayName)),typeof _=="function"&&je.set(_,pt),pt}while($e>=1&&qe>=0);break}}}finally{ce=!1,be.current=_e,Ae(),Error.prepareStackTrace=ue}var Dr=_?_.displayName||_.name:"",ar=Dr?Re(Dr):"";return typeof _=="function"&&je.set(_,ar),ar}function zt(_,M,U){return kt(_,!1)}function nt(_){var M=_.prototype;return!!(M&&M.isReactComponent)}function mt(_,M,U){if(_==null)return"";if(typeof _=="function")return kt(_,nt(_));if(typeof _=="string")return Re(_);switch(_){case u:return Re("Suspense");case c:return Re("SuspenseList")}if(typeof _=="object")switch(_.$$typeof){case l:return zt(_.render);case d:return mt(_.type,M,U);case f:{var X=_,ue=X._payload,_e=X._init;try{return mt(_e(ue),M,U)}catch{}}}return""}var ft=Object.prototype.hasOwnProperty,Yt={},qt=w.ReactDebugCurrentFrame;function Tt(_){if(_){var M=_._owner,U=mt(_.type,_._source,M?M.type:null);qt.setExtraStackFrame(U)}else qt.setExtraStackFrame(null)}function Nt(_,M,U,X,ue){{var _e=Function.call.bind(ft);for(var le in _)if(_e(_,le)){var ae=void 0;try{if(typeof _[le]!="function"){var Ze=Error((X||"React class")+": "+U+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof _[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ze.name="Invariant Violation",Ze}ae=_[le](M,le,X,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($e){ae=$e}ae&&!(ae instanceof Error)&&(Tt(ue),x("%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).",X||"React class",U,le,typeof ae),Tt(null)),ae instanceof Error&&!(ae.message in Yt)&&(Yt[ae.message]=!0,Tt(ue),x("Failed %s type: %s",U,ae.message),Tt(null))}}}var ut=Array.isArray;function yt(_){return ut(_)}function W(_){{var M=typeof Symbol=="function"&&Symbol.toStringTag,U=M&&_[Symbol.toStringTag]||_.constructor.name||"Object";return U}}function De(_){try{return Te(_),!1}catch{return!0}}function Te(_){return""+_}function ke(_){if(De(_))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",W(_)),Te(_)}var Bt=w.ReactCurrentOwner,Ft={key:!0,ref:!0,__self:!0,__source:!0},Ut,V;function J(_){if(ft.call(_,"ref")){var M=Object.getOwnPropertyDescriptor(_,"ref").get;if(M&&M.isReactWarning)return!1}return _.ref!==void 0}function Ne(_){if(ft.call(_,"key")){var M=Object.getOwnPropertyDescriptor(_,"key").get;if(M&&M.isReactWarning)return!1}return _.key!==void 0}function Oe(_,M){typeof _.ref=="string"&&Bt.current}function Ie(_,M){{var U=function(){Ut||(Ut=!0,x("%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)",M))};U.isReactWarning=!0,Object.defineProperty(_,"key",{get:U,configurable:!0})}}function xt(_,M){{var U=function(){V||(V=!0,x("%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)",M))};U.isReactWarning=!0,Object.defineProperty(_,"ref",{get:U,configurable:!0})}}var q=function(_,M,U,X,ue,_e,le){var ae={$$typeof:e,type:_,key:M,ref:U,props:le,_owner:_e};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ue}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function N(_,M,U,X,ue){{var _e,le={},ae=null,Ze=null;U!==void 0&&(ke(U),ae=""+U),Ne(M)&&(ke(M.key),ae=""+M.key),J(M)&&(Ze=M.ref,Oe(M,ue));for(_e in M)ft.call(M,_e)&&!Ft.hasOwnProperty(_e)&&(le[_e]=M[_e]);if(_&&_.defaultProps){var $e=_.defaultProps;for(_e in $e)le[_e]===void 0&&(le[_e]=$e[_e])}if(ae||Ze){var qe=typeof _=="function"?_.displayName||_.name||"Unknown":_;ae&&Ie(le,qe),Ze&&xt(le,qe)}return q(_,ae,Ze,ue,X,Bt.current,le)}}var H=w.ReactCurrentOwner,Y=w.ReactDebugCurrentFrame;function I(_){if(_){var M=_._owner,U=mt(_.type,_._source,M?M.type:null);Y.setExtraStackFrame(U)}else Y.setExtraStackFrame(null)}var re;re=!1;function Z(_){return typeof _=="object"&&_!==null&&_.$$typeof===e}function ee(){{if(H.current){var _=L(H.current.type);if(_)return`
|
|
49
49
|
|
|
50
|
-
Check the render method of \``+
|
|
50
|
+
Check the render method of \``+_+"`."}return""}}function me(_){return""}var Ee={};function te(_){{var M=ee();if(!M){var U=typeof _=="string"?_:_.displayName||_.name;U&&(M=`
|
|
51
51
|
|
|
52
|
-
Check the top-level render call using <`+U+">.")}return
|
|
52
|
+
Check the top-level render call using <`+U+">.")}return M}}function ne(_,M){{if(!_._store||_._store.validated||_.key!=null)return;_._store.validated=!0;var U=te(M);if(Ee[U])return;Ee[U]=!0;var X="";_&&_._owner&&_._owner!==H.current&&(X=" It was passed a child from "+L(_._owner.type)+"."),I(_),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,X),I(null)}}function ze(_,M){{if(typeof _!="object")return;if(yt(_))for(var U=0;U<_.length;U++){var X=_[U];Z(X)&&ne(X,M)}else if(Z(_))_._store&&(_._store.validated=!0);else if(_){var ue=y(_);if(typeof ue=="function"&&ue!==_.entries)for(var _e=ue.call(_),le;!(le=_e.next()).done;)Z(le.value)&&ne(le.value,M)}}}function We(_){{var M=_.type;if(M==null||typeof M=="string")return;var U;if(typeof M=="function")U=M.propTypes;else if(typeof M=="object"&&(M.$$typeof===l||M.$$typeof===d))U=M.propTypes;else return;if(U){var X=L(M);Nt(U,_.props,"prop",X,_)}else if(M.PropTypes!==void 0&&!re){re=!0;var ue=L(M);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ue||"Unknown")}typeof M.getDefaultProps=="function"&&!M.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Be(_){{for(var M=Object.keys(_.props),U=0;U<M.length;U++){var X=M[U];if(X!=="children"&&X!=="key"){I(_),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),I(null);break}}_.ref!==null&&(I(_),x("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var ve={};function Je(_,M,U,X,ue,_e){{var le=j(_);if(!le){var ae="";(_===void 0||typeof _=="object"&&_!==null&&Object.keys(_).length===0)&&(ae+=" 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 Ze=me();Ze?ae+=Ze:ae+=ee();var $e;_===null?$e="null":yt(_)?$e="array":_!==void 0&&_.$$typeof===e?($e="<"+(L(_.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):$e=typeof _,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$e,ae)}var qe=N(_,M,U,ue,_e);if(qe==null)return qe;if(le){var pt=M.children;if(pt!==void 0)if(X)if(yt(pt)){for(var Dr=0;Dr<pt.length;Dr++)ze(pt[Dr],_);Object.freeze&&Object.freeze(pt)}else x("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 ze(pt,_)}if(ft.call(M,"key")){var ar=L(_),st=Object.keys(M).filter(function(ou){return ou!=="key"}),Ts=st.length>0?"{key: someKey, "+st.join(": ..., ")+": ...}":"{key: someKey}";if(!ve[ar+Ts]){var iu=st.length>0?"{"+st.join(": ..., ")+": ...}":"{}";x(`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} />`,Ts,ar,iu,ar),ve[ar+Ts]=!0}}return _===n?Be(qe):We(qe),qe}}function Ye(_,M,U){return Je(_,M,U,!0)}function ht(_,M,U){return Je(_,M,U,!1)}var Wt=ht,bt=Ye;Gr.Fragment=n,Gr.jsx=Wt,Gr.jsxs=bt}()),Gr}process.env.NODE_ENV==="production"?Ks.exports=Fu():Ks.exports=Ru();var g=Ks.exports;class $n{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,i])=>n[s]===i))}static sort(e,t,n="asc"){return[...e].sort((s,i)=>{const o=s[t],a=i[t];if(o===a)return 0;let l=0;return o>a&&(l=1),o<a&&(l=-1),n==="asc"?l:-l})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(i=>n.some(o=>{const a=i[o];return a==null?!1:String(a).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,i=s+n;return{data:e.slice(s,i),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]||(n[i]=[]),n[i].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 i=String(s[t]);return n[i]=(n[i]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function Lu({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:i,keyExtractor:o=(m,y)=>m.id||m._id||String(y),searchable:a=!1,searchFields:l=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:p={}}){const{data:m,loading:y,error:w,refetch:x}=Dl(r,e),[E,D]=C.useState(""),[A,b]=C.useState({}),[v,S]=C.useState(1),k=C.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let R=m;return a&&E&&l.length>0&&(R=$n.search(R,E,l)),Object.keys(A).length>0&&(R=$n.filterByFields(R,A)),$n.paginate(R,v,d)},[m,E,A,v,d,a,l]);C.useEffect(()=>{S(1)},[E,A]);const j=()=>{D(""),b({}),S(1),x(),h==null||h()},T={background:p.background||"#ffffff",cardBackground:p.cardBackground||"#f9fafb",text:p.text||"#111827",textSecondary:p.textSecondary||"#6b7280",border:p.border||"#e5e7eb",primary:p.primary||"#3b82f6"},L=i||(R=>g.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:R.title||R.name||R.label||"Untitled"}),R.description&&g.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:R.description})]}));return y&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):w?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:w.message}),g.jsx("button",{onClick:j,style:{marginTop:"16px",padding:"8px 16px",background:T.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):g.jsxs("div",{style:{background:T.background,borderRadius:"12px",overflow:"hidden"},children:[(n||a||c.length>0)&&g.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${T.border}`},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:a||c.length>0?"12px":"0"},children:[n&&g.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:T.text},children:n}),g.jsx("button",{onClick:j,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),a&&g.jsx("input",{type:"text",placeholder:u,value:E,onChange:R=>D(R.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${T.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:T.textSecondary},children:s}):k.data.map((R,P)=>g.jsx("div",{onClick:()=>f==null?void 0:f(R),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:Q=>{f&&(Q.currentTarget.style.background=T.border)},onMouseLeave:Q=>{Q.currentTarget.style.background=T.cardBackground},children:L(R,P)},o(R,P)))}),k.totalPages>1&&g.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${T.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsxs("div",{style:{fontSize:"13px",color:T.textSecondary},children:["Page ",v," of ",k.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>S(R=>Math.max(1,R-1)),disabled:v===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===1?"not-allowed":"pointer",opacity:v===1?.5:1},children:"Previous"}),g.jsx("button",{onClick:()=>S(R=>Math.min(k.totalPages,R+1)),disabled:v===k.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===k.totalPages?"not-allowed":"pointer",opacity:v===k.totalPages?.5:1},children:"Next"})]})]})]})}function Mu({item:r,onClick:e,title:t=o=>o.title||o.name||o.label||"Untitled",subtitle:n=o=>o.description||o.subtitle||"",image:s=o=>o.image||o.thumbnail||o.photo,badge:i=o=>o.badge||o.tag||o.type}){const o=t(r),a=n(r),l=s(r),u=i(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:[a&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:a,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),u&&p.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&p.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&p.jsx("div",{className:"flex-shrink-0 text-gray-400",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function mu({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&p.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),p.jsxs("div",{className:"p-6",children:[i&&p.jsx("div",{className:"mb-6",children:p.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&p.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),p.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&p.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:p.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const yu={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function xu({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]=C.useState([]),[c,d]=C.useState([]),[f,h]=C.useState(Array(l).fill(!1)),[g,m]=C.useState(Array(l).fill(!1)),b=C.useRef([]),w=C.useCallback(y=>{const _=r.filter(A=>!y.includes(A._id));if(_.length===0)return null;const S=Math.floor(Math.random()*_.length);return _[S]},[r]),v=C.useCallback(()=>Math.random()*(n-t)+t,[t,n]);C.useEffect(()=>{if(r.length===0){u([]),d([]);return}const y=[],_=[],S=[];for(let A=0;A<l&&A<r.length;A++){const I=w(S);I&&(y.push(I),S.push(I._id))}for(let A=0;A<y.length;A++){const I=[y[A]._id,...y.filter((N,j)=>j!==A).map(N=>N._id)],B=w(I);B?_.push(B):_.push(y[A])}u(y),d(_)},[r,l,w]);const E=C.useCallback(y=>{const _=v(),S=setTimeout(()=>{h(A=>{const I=[...A];return I[y]=!I[y],I}),setTimeout(()=>{m(A=>{const I=[...A];return I[y]=!I[y],I}),setTimeout(()=>{const A=!g[y];A&&u(I=>{const B=[...I];return B[y]=c[y],B}),d(I=>{const B=[...I],j=[(A?c[y]:a[y])._id,...a.filter(($,X)=>X!==y).map($=>$._id),...I.filter(($,X)=>X!==y).map($=>$._id)],R=w(j);return R&&(B[y]=R),B}),setTimeout(()=>{E(y)},150)},200)},150)},_);b.current[y]=S},[v,w,a,c,g]),D=C.useRef(!1);C.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!D.current){D.current=!0;for(let y=0;y<a.length;y++)E(y);return()=>{b.current.forEach(y=>clearTimeout(y)),b.current=[],D.current=!1}}},[a.length,r.length]);const k=y=>{s&&s(y)};return r.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"Loading..."})}):p.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:a.map((y,_)=>{const S=c[_],A=g[_];return p.jsx("div",{className:`relative ${yu[o]}`,style:{perspective:"1000px"},onClick:()=>k(A?S:y),children:p.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[_]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?0:1},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:y.data.image,alt:y.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:y.title})})]})}),S&&p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?1:0},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${_}`)})})}function Cr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,a)=>String.fromCharCode(parseInt(a,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const bu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function _u({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:a,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:g,onError:m,onLoad:b,renderItem:w,renderDetail:v,renderActions:E,renderEmpty:D,renderLoading:k,theme:y={}}){const _={...bu,...y},[S,A]=C.useState([]),[I,B]=C.useState(!1),[N,j]=C.useState(null),[R,$]=C.useState(new Set),[X,ce]=C.useState(null),[ve,le]=C.useState(null),[Re,me]=C.useState(null),[he,ye]=C.useState(!1),[xe,Se]=C.useState(""),pe=a!==void 0?a:xe,Ce=V=>{u?u(V):Se(V)},Ne=C.useMemo(()=>{if(!pe.trim())return S;const V=pe.toLowerCase();return S.filter(J=>Cr(J.from).toLowerCase().includes(V)||Cr(J.subject).toLowerCase().includes(V))},[S,pe]),ae=C.useMemo(()=>e?new hl({baseUrl:r,system_id:e}):null,[r,e]),Le=C.useCallback(async()=>{if(ae){B(!0),j(null);try{const V=await ae.listEmails(t,n,s);V!=null&&V.messages&&(A(V.messages),b==null||b(V.messages))}catch(V){const J=V instanceof Error?V:new Error("Failed to fetch emails");j(J.message),m==null||m(J)}B(!1)}},[ae,t,n,s,m,b]);C.useEffect(()=>{A([]),$(new Set),le(null),j(null),a===void 0&&Se(""),d&&Le()},[s,d]);const ot=C.useCallback(async V=>{if(ae){le(V),me(null),ye(!0);try{const J=await ae.getEmailParsed(t,V.uid,s||"INBOX");J!=null&&J.body&&me(J.body)}catch(J){console.error("Failed to fetch email body:",J)}ye(!1)}},[ae,t,s]),Et=C.useCallback(V=>{f==null||f(V),i&&ot(V)},[f,i,ot]),It=C.useCallback((V,J,Ae)=>{if(!o){f==null||f(V),i&&ot(V);return}const Pe=V.uid;if(Ae.shiftKey&&X!==null){const Oe=Math.min(X,J),mt=Math.max(X,J),q=S.slice(Oe,mt+1).map(H=>H.uid),T=new Set(q);$(T),h==null||h(Array.from(T))}else if(Ae.ctrlKey||Ae.metaKey)$(Oe=>{const mt=new Set(Oe);return mt.has(Pe)?mt.delete(Pe):mt.add(Pe),h==null||h(Array.from(mt)),mt}),ce(J);else{const Oe=new Set([Pe]);$(Oe),ce(J),h==null||h(Array.from(Oe))}},[o,X,S,R,f,h,i]),tt=C.useCallback(async()=>{if(!ae||R.size===0)return;const V=s||"INBOX";try{const J=await ae.trashEmails(t,Array.from(R),V);if(console.log("Trash result:",J),J.success&&J.moved>0){A(Pe=>Pe.filter(Oe=>!R.has(Oe.uid)));const Ae=Array.from(R);$(new Set),g==null||g(Ae)}else j("Failed to move emails to trash")}catch(J){const Ae=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,R,s,g,m]),pt=C.useCallback(async()=>{if(!ae||R.size===0)return;const V=s||"INBOX";try{const J=await ae.archiveEmails(t,Array.from(R),V);if(console.log("Archive result:",J),J.success&&J.archived>0){A(Pe=>Pe.filter(Oe=>!R.has(Oe.uid)));const Ae=Array.from(R);$(new Set),g==null||g(Ae)}else j("Failed to archive emails")}catch(J){const Ae=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,R,s,g,m]),ct=C.useCallback(()=>{if(R.size===S.length)$(new Set),h==null||h([]);else{const V=new Set(S.map(J=>J.uid));$(V),h==null||h(Array.from(V))}},[S,R.size,h]),Jt=C.useCallback(()=>{$(new Set),h==null||h([])},[h]),$t={delete:tt,archive:pt,refresh:Le,selectAll:ct,clearSelection:Jt},kt=V=>{if(!V)return"";const J=new Date(V),Ae=new Date;return J.toDateString()===Ae.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},At=(V,J)=>p.jsx("div",{style:{padding:"12px 16px",background:J?_.selectedBackground:V.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Cr(V.from).split("@")[0]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:500,color:V.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Cr(V.subject)||"(No subject)"})]}),p.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:kt(V.date)})]})}),lt=V=>p.jsxs("div",{style:{padding:"24px"},children:[p.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:Cr(V.subject)||"(No subject)"}),p.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",Cr(V.from)," • ",new Date(V.date).toLocaleString()]}),he?p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"Loading..."}):Re?p.jsx("div",{style:{fontSize:"14px",color:_.text},dangerouslySetInnerHTML:{__html:Re}}):p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"No content available"})]}),gt=(V,J)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[p.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:V.length===S.length?"Deselect All":"Select All"}),V.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[V.length," selected"]}),p.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),p.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:c}),we=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),ke=w||At,Ee=v||lt,Tt=E||gt,Bt=D||W,zt=k||we;return I&&S.length===0?p.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:zt()}):p.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[p.jsxs("div",{style:{flex:i&&ve?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&ve?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[o&&Tt(Array.from(R),$t),l&&p.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${_.border}`,background:_.background},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:[p.jsx("circle",{cx:"11",cy:"11",r:"8"}),p.jsx("path",{d:"M21 21l-4.35-4.35"})]}),p.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:pe,onChange:V=>Ce(V.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:_.text}}),pe&&p.jsx("button",{onClick:()=>Ce(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:p.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:N}),p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ne.length===0?Bt():Ne.map((V,J)=>p.jsx("div",{onClick:Ae=>It(V,J,Ae),onDoubleClick:()=>Et(V),children:ke(V,R.has(V.uid))},V.uid))})]}),i&&ve&&p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ee(ve)})]})}function vu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:a=""}){const[u,c]=C.useState(new Set),[d,f]=C.useState(-1),h=r.filter(D=>u.has(D.id)),g=d>=0&&d<h.length?h[d]:null,m=C.useCallback(D=>{c(k=>{const y=new Set(k);return y.has(D)?y.delete(D):y.add(D),t==null||t(Array.from(y)),y})},[t]),b=C.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,u.size,t,n]),w=C.useCallback(()=>{if(h.length===0)return;const D=d<=0?h.length-1:d-1;f(D),n==null||n(h[D],D)},[h,d,n]),v=C.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=C.useCallback(D=>{s==null||s(D,h,g)},[s,h,g]);return C.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?p.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:i}):p.jsxs("div",{className:`space-y-2 ${a}`,children:[p.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsxs("button",{onClick:b,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[p.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),p.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&p.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:w,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),p.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),p.jsx("button",{onClick:v,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),p.jsx("div",{className:"space-y-1",children:r.map(D=>{const k=u.has(D.id),y=(g==null?void 0:g.id)===D.id;return p.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${y?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[p.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),p.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,y)})]},D.id)})}),o.length>0&&u.size>0&&p.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var y;const k=((y=D.disabled)==null?void 0:y.call(D,h))??!1;return p.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&p.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function Cu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wu=Cu(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 yl=C.createContext(null);function Du(r,e){return{getTheme:function(){return e??null}}}function Dt(){const r=C.useContext(yl);return r==null&&wu(8),r}function pn(r){return{}}const fi={},Su={},xl={},cr={},Ar={},ln={},Tr={},ls={},Us={},an={},un={},Ct={},hi={},pi={},Eu={},bl={},ku={},_l={},Au={},vl={},Cl={},zn={},Tu={},wl={},Dl={},Sl={},Bu={},Nu={},Fu={},Zi={},El={},ju={},kl={},Al={},Ru={},as={},gi={},Ws={},Lu={},Pu={},An={},Tn={},Ou={},Mu={},Iu={},St=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,$u=St&&"documentMode"in document?document.documentMode:null,bt=St&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),rr=St&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),qn=!(!St||!("InputEvent"in window)||$u)&&"getTargetRanges"in new window.InputEvent("input"),us=St&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),gn=St&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zu=St&&/Android/.test(navigator.userAgent),Tl=St&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qu=St&&zu&&Tl,mi=St&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Tl,mn=1,sr=3,hr=0,Bl=1,Fr=2,Uu=0,Wu=1,Gu=2,Un=4,Wn=8,yi=128,Vu=112|(3|Un|Wn)|yi,xi=1,bi=2,_i=3,vi=4,Ci=5,wi=6,cs=us||gn||mi?" ":"",Gt=`
|
|
61
|
+
`,children:[l&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:l,alt:o,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:o}),u&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),a&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:a})]}),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 Pu({item:r,onClose:e,title:t=i=>i.title||i.name||i.label||"Detail",image:n=i=>i.image||i.thumbnail||i.photo,fields:s=[]}){if(!r)return null;const i=t(r),o=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:i}),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:[o&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:o,alt:i,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((a,l)=>{const u=a.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:a.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},l)})}),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 ju={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Ou({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:i="medium",className:o=""}){const a=Math.min(Math.max(e,1),5),[l,u]=C.useState([]),[c,d]=C.useState([]),[f,h]=C.useState(Array(a).fill(!1)),[p,m]=C.useState(Array(a).fill(!1)),y=C.useRef([]),w=C.useCallback(b=>{const v=r.filter(k=>!b.includes(k._id));if(v.length===0)return null;const S=Math.floor(Math.random()*v.length);return v[S]},[r]),x=C.useCallback(()=>Math.random()*(n-t)+t,[t,n]);C.useEffect(()=>{if(r.length===0){u([]),d([]);return}const b=[],v=[],S=[];for(let k=0;k<a&&k<r.length;k++){const j=w(S);j&&(b.push(j),S.push(j._id))}for(let k=0;k<b.length;k++){const j=[b[k]._id,...b.filter((B,L)=>L!==k).map(B=>B._id)],T=w(j);T?v.push(T):v.push(b[k])}u(b),d(v)},[r,a,w]);const E=C.useCallback(b=>{const v=x(),S=setTimeout(()=>{h(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{m(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{const k=!p[b];k&&u(j=>{const T=[...j];return T[b]=c[b],T}),d(j=>{const T=[...j],L=[(k?c[b]:l[b])._id,...l.filter((P,Q)=>Q!==b).map(P=>P._id),...j.filter((P,Q)=>Q!==b).map(P=>P._id)],R=w(L);return R&&(T[b]=R),T}),setTimeout(()=>{E(b)},150)},200)},150)},v);y.current[b]=S},[x,w,l,c,p]),D=C.useRef(!1);C.useEffect(()=>{if(!(l.length===0||r.length<=1)&&!D.current){D.current=!0;for(let b=0;b<l.length;b++)E(b);return()=>{y.current.forEach(b=>clearTimeout(b)),y.current=[],D.current=!1}}},[l.length,r.length]);const A=b=>{s&&s(b)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${o}`,children:l.map((b,v)=>{const S=c[v],k=p[v];return g.jsx("div",{className:`relative ${ju[i]}`,style:{perspective:"1000px"},onClick:()=>A(k?S:b),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[v]?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[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:b.data.image,alt:b.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:b.title})})]})}),S&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?1:0},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:S.data.image,alt:S.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:S.title})})]})})]})},`slot-${v}`)})})}function Er(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,i)=>{try{if(s.toUpperCase()==="B"){const o=atob(i);return decodeURIComponent(escape(o))}else if(s.toUpperCase()==="Q"){const o=i.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(o))}}catch(o){console.warn("MIME decode error:",o)}return t}).replace(/\s+/g," ").trim()}const Iu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $u({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:i=!0,showDetail:o=!1,showSearch:a=!0,searchQuery:l,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:p,onError:m,onLoad:y,renderItem:w,renderDetail:x,renderActions:E,renderEmpty:D,renderLoading:A,theme:b={}}){const v={...Iu,...b},[S,k]=C.useState([]),[j,T]=C.useState(!1),[B,L]=C.useState(null),[R,P]=C.useState(new Set),[Q,se]=C.useState(null),[xe,oe]=C.useState(null),[Se,he]=C.useState(null),[fe,pe]=C.useState(!1),[ge,Ae]=C.useState(""),be=l!==void 0?l:ge,we=V=>{u?u(V):Ae(V)},Re=C.useMemo(()=>{if(!be.trim())return S;const V=be.toLowerCase();return S.filter(J=>Er(J.from).toLowerCase().includes(V)||Er(J.subject).toLowerCase().includes(V))},[S,be]),ce=C.useMemo(()=>e?new vl({baseUrl:r,system_id:e}):null,[r,e]),je=C.useCallback(async()=>{if(ce){T(!0),L(null);try{const V=await ce.listEmails(t,n,s);V!=null&&V.messages&&(k(V.messages),y==null||y(V.messages))}catch(V){const J=V instanceof Error?V:new Error("Failed to fetch emails");L(J.message),m==null||m(J)}T(!1)}},[ce,t,n,s,m,y]);C.useEffect(()=>{k([]),P(new Set),oe(null),L(null),l===void 0&&Ae(""),d&&je()},[s,d]);const at=C.useCallback(async V=>{if(ce){oe(V),he(null),pe(!0);try{const J=await ce.getEmailParsed(t,V.uid,s||"INBOX");J!=null&&J.body&&he(J.body)}catch(J){console.error("Failed to fetch email body:",J)}pe(!1)}},[ce,t,s]),kt=C.useCallback(V=>{f==null||f(V),o&&at(V)},[f,o,at]),zt=C.useCallback((V,J,Ne)=>{if(!i){f==null||f(V),o&&at(V);return}const Oe=V.uid;if(Ne.shiftKey&&Q!==null){const Ie=Math.min(Q,J),xt=Math.max(Q,J),q=S.slice(Ie,xt+1).map(H=>H.uid),N=new Set(q);P(N),h==null||h(Array.from(N))}else if(Ne.ctrlKey||Ne.metaKey)P(Ie=>{const xt=new Set(Ie);return xt.has(Oe)?xt.delete(Oe):xt.add(Oe),h==null||h(Array.from(xt)),xt}),se(J);else{const Ie=new Set([Oe]);P(Ie),se(J),h==null||h(Array.from(Ie))}},[i,Q,S,R,f,h,o]),nt=C.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.trashEmails(t,Array.from(R),V);if(console.log("Trash result:",J),J.success&&J.moved>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);P(new Set),p==null||p(Ne)}else L("Failed to move emails to trash")}catch(J){const Ne=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),mt=C.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.archiveEmails(t,Array.from(R),V);if(console.log("Archive result:",J),J.success&&J.archived>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);P(new Set),p==null||p(Ne)}else L("Failed to archive emails")}catch(J){const Ne=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),ft=C.useCallback(()=>{if(R.size===S.length)P(new Set),h==null||h([]);else{const V=new Set(S.map(J=>J.uid));P(V),h==null||h(Array.from(V))}},[S,R.size,h]),Yt=C.useCallback(()=>{P(new Set),h==null||h([])},[h]),qt={delete:nt,archive:mt,refresh:je,selectAll:ft,clearSelection:Yt},Tt=V=>{if(!V)return"";const J=new Date(V),Ne=new Date;return J.toDateString()===Ne.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},Nt=(V,J)=>g.jsx("div",{style:{padding:"12px 16px",background:J?v.selectedBackground:V.seen?v.cardBackground:v.unreadBackground,borderBottom:`1px solid ${v.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:V.seen?400:600,color:v.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:500,color:V.seen?v.textSecondary:v.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:v.textSecondary,flexShrink:0},children:Tt(V.date)})]})}),ut=V=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:v.text},children:Er(V.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:v.textSecondary,marginBottom:"16px"},children:["From: ",Er(V.from)," • ",new Date(V.date).toLocaleString()]}),fe?g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"Loading..."}):Se?g.jsx("div",{style:{fontSize:"14px",color:v.text},dangerouslySetInnerHTML:{__html:Se}}):g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"No content available"})]}),yt=(V,J)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:v.cardBackground,borderBottom:`1px solid ${v.border}`},children:[g.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:v.text},children:V.length===S.length?"Deselect All":"Select All"}),V.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:v.textSecondary},children:[V.length," selected"]}),g.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:c}),De=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:"Loading..."}),Te=w||Nt,ke=x||ut,Bt=E||yt,Ft=D||W,Ut=A||De;return j&&S.length===0?g.jsx("div",{style:{background:v.background,width:"100%",height:"100%"},children:Ut()}):g.jsxs("div",{style:{display:"flex",background:v.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:o&&xe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:o&&xe?`1px solid ${v.border}`:"none",overflow:"hidden"},children:[i&&Bt(Array.from(R),qt),a&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${v.border}`,background:v.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:v.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:be,onChange:V=>we(V.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:v.text}}),be&&g.jsx("button",{onClick:()=>we(""),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:v.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),B&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:v.danger,fontSize:"14px",borderBottom:`1px solid ${v.border}`},children:B}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:Re.length===0?Ft():Re.map((V,J)=>g.jsx("div",{onClick:Ne=>zt(V,J,Ne),onDoubleClick:()=>kt(V),children:Te(V,R.has(V.uid))},V.uid))})]}),o&&xe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:ke(xe)})]})}function zu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:i=[],emptyMessage:o="No items",showSelectAll:a=!0,className:l=""}){const[u,c]=C.useState(new Set),[d,f]=C.useState(-1),h=r.filter(D=>u.has(D.id)),p=d>=0&&d<h.length?h[d]:null,m=C.useCallback(D=>{c(A=>{const b=new Set(A);return b.has(D)?b.delete(D):b.add(D),t==null||t(Array.from(b)),b})},[t]),y=C.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(A=>A.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(A=>A.id))}},[r,u.size,t,n]),w=C.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]),x=C.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=C.useCallback(D=>{s==null||s(D,h,p)},[s,h,p]);return C.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 ${l}`,children:o}):g.jsxs("div",{className:`space-y-2 ${l}`,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:[a&&g.jsxs("button",{onClick:y,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:w,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:x,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 A=u.has(D.id),b=(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 ${b?"bg-blue-50 ring-1 ring-blue-200":A?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[g.jsx("span",{className:`material-icons text-lg ${A?"text-blue-500":"text-neutral-300"}`,children:A?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(D,A,b)})]},D.id)})}),i.length>0&&u.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:i.map(D=>{var b;const A=((b=D.disabled)==null?void 0:b.call(D,h))??!1;return g.jsxs("button",{onClick:()=>E(D.id),disabled:A,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${A?"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 qu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Uu=qu(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 El=C.createContext(null);function Wu(r,e){return{getTheme:function(){return e??null}}}function St(){const r=C.useContext(El);return r==null&&Uu(8),r}function xn(r){return{}}const bi={},Gu={},Sl={},fr={},Fr={},dn={},Rr={},fs={},Hs={},fn={},hn={},Dt={},_i={},vi={},Vu={},Al={},Ku={},kl={},Hu={},Tl={},Nl={},Gn={},Qu={},Bl={},Fl={},Rl={},Ju={},Yu={},Xu={},oo={},Ll={},Zu={},Ml={},Pl={},ec={},hs={},Ci={},Qs={},tc={},rc={},Fn={},Rn={},nc={},sc={},ic={},At=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,oc=At&&"documentMode"in document?document.documentMode:null,vt=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sr=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Vn=!(!At||!("InputEvent"in window)||oc)&&"getTargetRanges"in new window.InputEvent("input"),ps=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),bn=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lc=At&&/Android/.test(navigator.userAgent),jl=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ac=At&&lc&&jl,wi=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jl,_n=1,or=3,gr=0,Ol=1,Pr=2,uc=0,cc=1,dc=2,Kn=4,Hn=8,Di=128,fc=112|(3|Kn|Hn)|Di,Ei=1,Si=2,Ai=3,ki=4,Ti=5,Ni=6,gs=ps||bn||wi?" ":"",Kt=`
|
|
62
62
|
|
|
63
|
-
`,Ku=rr?" ":cs,Nl="֑-߿יִ-﷽ﹰ-ﻼ",Fl="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Hu=new RegExp("^[^"+Fl+"]*["+Nl+"]"),Ju=new RegExp("^[^"+Nl+"]*["+Fl+"]"),pr={bold:1,code:16,highlight:yi,italic:2,strikethrough:Un,subscript:32,superscript:64,underline:Wn},Qu={directionless:1,unmergeable:2},eo={center:bi,end:wi,justify:vi,left:xi,right:_i,start:Ci},Yu={[bi]:"center",[wi]:"end",[vi]:"justify",[xi]:"left",[_i]:"right",[Ci]:"start"},Xu={normal:0,segmented:2,token:1},Zu={[Uu]:"normal",[Gu]:"segmented",[Wu]:"token"};function ec(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var M=ec(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 Gn(...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 tc=100;let Gs=!1,Di=0;function rc(r){Di=r.timeStamp}function Bs(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&fs(r,t)!==void 0}function nc(r,e,t){const n=ht(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&Ti(e,i,s,o,!1)}function sc(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===sr&&t.isAttached()}function ic(r,e,t,n){for(let s=r;s&&!xc(s);s=xn(s)){const o=fs(s,e);if(o!==void 0){const i=Qe(o,t);if(i)return _e(i)?void 0:[s,i]}else if(s===n)return[n,zl(t)]}}function jl(r,e,t){Gs=!0;const n=performance.now()-Di>tc;try{at(r,()=>{const s=K()||function(f){return f.getEditorState().read(()=>{const h=K();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,a=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,m=h.target,b=ic(m,r,l,i);if(!b)continue;const[w,v]=b;if(g==="characterData")n&&z(v)&&sc(s,m,v)&&nc(m,v,r);else if(g==="childList"){u=!0;const E=h.addedNodes;for(let y=0;y<E.length;y++){const _=E[y],S=Il(_),A=_.parentNode;if(A!=null&&_!==a&&S===null&&!Bs(_,A,r)){if(rr){const I=_.innerText||_.nodeValue;I&&(c+=I)}A.removeChild(_)}}const D=h.removedNodes,k=D.length;if(k>0){let y=0;for(let _=0;_<k;_++){const S=D[_];(Bs(S,m,r)||a===S)&&(m.appendChild(S),y++)}k!==y&&o.set(w,v)}}}if(o.size>0)for(const[f,h]of o)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,m=h.target;for(let b=0;b<g.length;b++){const w=g[b],v=w.parentNode;v==null||w.nodeName!=="BR"||Bs(w,m,r)||v.removeChild(w)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,Lt(s)),rr&&Gl(r)&&s.insertRawText(c))})}finally{Gs=!1}}function Rl(r){const e=r._observer;e!==null&&jl(r,e.takeRecords(),e)}function Ll(r){(function(e){Di===0&&ps(e).addEventListener("textInput",rc,!0)})(r),r._observer=new MutationObserver((e,t)=>{jl(r,e,t)})}function to(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 ro(r,e){const t=r.mergeWithSibling(e),n=je()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function no(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(to(e,n)){n=ro(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(to(n,t)){n=ro(n,t);break}break}t.remove()}}else n.remove()}function Pl(r){return so(r.anchor),so(r.focus),r}function so(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let oc=1;const lc=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Si(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return _e(jr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ds(e)==null)}function yn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Si(e)&&Ol(e)===r}catch{return!1}}function Ei(r){return r instanceof bs}function Ol(r){let e=r;for(;e!=null;){const t=ds(e);if(Ei(t))return t;e=xn(e)}return null}function ds(r){return r?r.__lexicalEditor:null}function ar(r){return r.isToken()||r.isSegmented()}function ac(r){return r.nodeType===sr}function Vn(r){let e=r;for(;e!=null;){if(ac(e))return e;e=e.firstChild}return null}function Kn(r,e,t){const n=pr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Ml(r){return z(r)||fr(r)||_e(r)}function uc(r,e){if(e!=null)return void(r.__key=e);nt(),fa();const t=je(),n=Kt(),s=""+oc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=Bl,r.__key=s}function dr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Hn(r){fa();const e=r.getLatest(),t=e.__parent,n=Kt(),s=je(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(a,u,c){let d=a;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,o,i);const l=e.__key;s._dirtyType=Bl,F(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function Ke(r){nt();const e=je(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Qe(t);n!==null&&n.getWritable()}if(r!==null){const n=Qe(r);n!==null&&n.getWritable()}}}function Zt(){return wn()?null:je()._compositionKey}function Qe(r,e){const t=(e||Kt())._nodeMap.get(r);return t===void 0?null:t}function Il(r,e){const t=fs(r,je());return t!==void 0?Qe(t,e):null}function fs(r,e){return r[`__lexicalKey_${e._key}`]}function jr(r,e){let t=r;for(;t!=null;){const n=Il(t,e);if(n!==null)return n;t=xn(t)}return null}function $l(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function io(r){return r.read(()=>Be().getTextContent())}function Be(){return zl(Kt())}function zl(r){return r._nodeMap.get("root")}function Lt(r){nt();const e=Kt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Er(r){const e=je(),t=function(n,s){let o=n;for(;o!=null;){const i=fs(o,s);if(i!==void 0)return i;o=xn(o)}return null}(r,e);return t===null?r===e.getRootElement()?Qe("root"):null:Qe(t)}function oo(r,e){return e?r.getTextContentSize():0}function ql(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function ki(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Ul(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Wl(r){return r.nodeType===sr?r.nodeValue:null}function Ai(r,e,t){const n=ht(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=Wl(s);const a=jr(s);if(l!==null&&z(a)){if(l===cs&&t){const u=t.length;l=t,o=u,i=u}l!==null&&Ti(a,l,o,i,r)}}}function Ti(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]===cs&&(l=e.slice(0,-1));const a=o.getTextContent();if(s||l!==a){if(l===""){if(Ke(null),us||gn||mi)o.remove();else{const m=je();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const u=o.getParent(),c=Cn(),d=o.getTextContentSize(),f=Zt(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||P(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===d&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const g=K();if(!P(g)||t===null||n===null)return void o.setTextContent(l);if(g.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=Ue(o.getTextContent());o.replace(m),o=m}o.setTextContent(l)}}}function cc(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(o){const i=o.getPreviousSibling();return(z(i)||F(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function lo(r){return r==="ArrowLeft"}function ao(r){return r==="ArrowRight"}function Hr(r,e){return bt?r:e}function uo(r){return r==="Enter"}function qr(r){return r==="Backspace"}function Ur(r){return r==="Delete"}function co(r,e,t){return r.toLowerCase()==="a"&&Hr(e,t)}function dc(){const r=Be();Lt(Pl(r.select(0,r.getChildrenSize())))}function en(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=Gn(s);return t[e]=o,o}return s}function Bi(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&M(33,o);const a=l.klass;let u=r.get(a);u===void 0&&(u=new Map,r.set(a,u));const c=u.get(i),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(i,d?"updated":s)}function fo(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 cn(r,e){const t=r.offset;if(r.type==="element")return fo(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?fo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Gl(r){const e=ps(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return ga(r,e,t)}function hs(r){return!Ze(r)&&!r.isLastChild()&&!r.isInline()}function Jn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&M(75,e),t}function xn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function tn(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function ps(r){const e=r._window;return e===null&&M(78),e}function fc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Pt(e))return e;e=e.getParentOrThrow()}return e}function Pt(r){return Ze(r)||F(r)&&r.isShadowRoot()}function Mt(r){const e=je(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&M(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),l=i.constructor;return o!==null?i instanceof o||M(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||M(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&M(203,r.constructor.name,t,l.name,l.getType()),i}return r}function Ns(r,e){!Ze(r.getParent())||F(e)||_e(e)||M(99)}function Fs(r){return(_e(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Ni(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function hc(r,e,t){let n=r._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let l=!1,a=null;if(i===o.getChildrenSize())Fs(o.getChildAtIndex(i-1))&&(l=!0);else{const u=o.getChildAtIndex(i);if(u!==null&&Fs(u)){const c=u.getPreviousSibling();(c===null||Fs(c))&&(l=!0,a=r.getElementByKey(u.__key))}}if(l){const u=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Gn(h);h=d.blockCursor=g}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(a===null?u.appendChild(n):u.insertBefore(n,a))}}n!==null&&Ni(n,r,e)}function ht(r){return St?(r||window).getSelection():null}function pc(r){return Vt(r)&&r.tagName==="A"}function Vt(r){return r.nodeType===1}function ho(r){return r.nodeType===11}function Vs(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 Qn(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Yt(r){if(_e(r)&&!r.isInline())return!0;if(!F(r)||Pt(r))return!1;const e=r.getFirstChild(),t=e===null||fr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Wr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function gc(){return je()}const po=new WeakMap,mc=new Map;function yc(r){if(!r._readOnly&&r.isEmpty())return mc;r._readOnly||M(192);let e=po.get(r);if(!e){e=new Map,po.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 Fi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function ji(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function xc(r){return r.__lexicalUnmanaged===!0}function Vl(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(F(i)&&Vl(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let nr,et,dn,gs,Ks,Hs,gr,wt,Js,fn,We="",Xe="",Nt=null,_t="",Wt="",Kl=!1,hn=!1,On=null;function Yn(r,e){const t=gr.get(r);if(e!==null){const n=Xs(r);n.parentNode===e&&e.removeChild(n)}if(wt.has(r)||et._keyToDOMMap.delete(r),F(t)){const n=Zn(t,gr);Qs(n,0,n.length-1,null)}t!==void 0&&Bi(fn,dn,gs,t,"destroyed")}function Qs(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Yn(o,n)}}function lr(r,e){r.setProperty("text-align",e)}const bc="40px";function Hl(r,e){const t=nr.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||bc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Jl(r,e){const t=r.style;e===0?lr(t,""):e===xi?lr(t,"left"):e===bi?lr(t,"center"):e===_i?lr(t,"right"):e===vi?lr(t,"justify"):e===Ci?lr(t,"start"):e===wi&&lr(t,"end")}function Xn(r,e){const t=wt.get(r);t===void 0&&M(60);const n=t.createDOM(nr,et);if(function(s,o,i){const l=i._keyToDOMMap;(function(a,u,c){a[`__lexicalKey_${u._key}`]=c})(o,i,s),l.set(s,o)}(r,n,et),z(t)?n.setAttribute("data-lexical-text","true"):_e(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,o=t.__size;if(s!==0&&Hl(n,s),o!==0){const l=o-1;(function(a,u,c,d){const f=Xe;Xe="",Ys(a,c,0,u,c.getDOMSlot(d)),Yl(c,d),Xe=f})(Zn(t,wt),l,t,n)}const i=t.__format;i!==0&&Jl(n,i),t.isInline()||Ql(null,t,n),hs(t)&&(We+=Gt,Wt+=Gt)}else{const s=t.getTextContent();if(_e(t)){const o=t.decorate(et,nr);o!==null&&Xl(r,o),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(Xe+=s));We+=s,Wt+=s}return e!==null&&e.insertChild(n),Bi(fn,dn,gs,t,"created"),n}function Ys(r,e,t,n,s){const o=We;We="";let i=t;for(;i<=n;++i){Xn(r[i],s);const l=wt.get(r[i]);l!==null&&z(l)&&(Nt===null&&(Nt=l.getFormat()),_t===""&&(_t=l.getStyle()))}hs(e)&&(We+=Gt),s.element.__lexicalTextContent=We,We=o+We}function go(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return fr(n)?"line-break":_e(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Ql(r,e,t){const n=go(r,gr),s=go(e,wt);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Yl(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==Xe||n!==On){const o=Xe==="",i=o?On:(s=Xe,Hu.test(s)?"rtl":Ju.test(s)?"ltr":null);if(i!==n){const l=e.classList,a=nr.theme;let u=n!==null?a[n]:void 0,c=i!==null?a[i]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Gn(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=Gn(c);c=a[i]=d}c!==void 0&&l.add(...c)}e.dir=i}hn||(r.getWritable().__dir=i)}On=i,e.__lexicalDirTextContent=Xe,e.__lexicalDir=i}var s}function _c(r,e,t){const n=Xe;var s;Xe="",Nt=null,_t="",function(o,i,l){const a=We,u=o.__size,c=i.__size;We="";const d=l.element;if(u===1&&c===1){const f=o.__first,h=i.__first;if(f===h)Jr(f,d);else{const m=Xs(f),b=Xn(h,null);try{d.replaceChild(b,m)}catch(w){if(typeof w=="object"&&w!=null){const v=`${w.toString()} Parent: ${d.tagName}, new child: {tag: ${b.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(v)}throw w}Yn(f,null)}const g=wt.get(h);z(g)&&(Nt===null&&(Nt=g.getFormat()),_t===""&&(_t=g.getStyle()))}else{const f=Zn(o,gr),h=Zn(i,wt);if(f.length!==u&&M(227),h.length!==c&&M(228),u===0)c!==0&&Ys(h,i,0,c-1,l);else if(c===0){if(u!==0){const g=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Qs(f,0,u-1,g?null:d),g&&(d.textContent="")}}else(function(g,m,b,w,v,E){const D=w-1,k=v-1;let y,_,S=E.getFirstChild(),A=0,I=0;for(;A<=D&&I<=k;){const j=m[A],R=b[I];if(j===R)S=js(Jr(R,E.element)),A++,I++;else{y===void 0&&(y=new Set(m)),_===void 0&&(_=new Set(b));const X=_.has(j),ce=y.has(R);if(X)if(ce){const ve=Jn(et,R);ve===S?S=js(Jr(R,E.element)):(E.withBefore(S).insertChild(ve),Jr(R,E.element)),A++,I++}else Xn(R,E.withBefore(S)),I++;else S=js(Xs(j)),Yn(j,E.element),A++}const $=wt.get(R);$!==null&&z($)&&(Nt===null&&(Nt=$.getFormat()),_t===""&&(_t=$.getStyle()))}const B=A>D,N=I>k;if(B&&!N){const j=b[k+1],R=j===void 0?null:et.getElementByKey(j);Ys(b,g,I,k,E.withBefore(R))}else N&&!B&&Qs(m,A,D,E.element)})(i,f,h,u,c,l)}hs(i)&&(We+=Gt),d.__lexicalTextContent=We,We=a+We}(r,e,e.getDOMSlot(t)),Yl(e,t),Rr(s=e)&&Nt!=null&&Nt!==s.__textFormat&&!hn&&(s.setTextFormat(Nt),s.setTextStyle(_t)),function(o){Rr(o)&&_t!==""&&_t!==o.__textStyle&&!hn&&o.setTextStyle(_t)}(e),Xe=n}function Zn(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 Jr(r,e){const t=gr.get(r);let n=wt.get(r);t!==void 0&&n!==void 0||M(61);const s=Kl||Hs.has(r)||Ks.has(r),o=Jn(et,r);if(t===n&&!s){if(F(t)){const i=o.__lexicalTextContent;i!==void 0&&(We+=i,Wt+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(Xe+=l)}else{const i=t.getTextContent();z(t)&&!t.isDirectionless()&&(Xe+=i),Wt+=i,We+=i}return o}if(t!==n&&s&&Bi(fn,dn,gs,n,"updated"),n.updateDOM(t,o,nr)){const i=Xn(r,null);return e===null&&M(62),e.replaceChild(i,o),Yn(r,null),i}if(F(t)&&F(n)){const i=n.__indent;i!==t.__indent&&Hl(o,i);const l=n.__format;l!==t.__format&&Jl(o,l),s&&(_c(t,n,o),Ze(n)||n.isInline()||Ql(t,n,o)),hs(n)&&(We+=Gt,Wt+=Gt)}else{const i=n.getTextContent();if(_e(n)){const l=n.decorate(et,nr);l!==null&&Xl(r,l)}else z(n)&&!n.isDirectionless()&&(Xe+=i);We+=i,Wt+=i}if(!hn&&Ze(n)&&n.__cachedText!==Wt){const i=n.getWritable();i.__cachedText=Wt,n=i}return o}function Xl(r,e){let t=et._pendingDecorators;const n=et._decorators;if(t===null){if(n[r]===e)return;t=$l(et)}t[r]=e}function js(r){let e=r.nextSibling;return e!==null&&e===et._blockCursorElement&&(e=e.nextSibling),e}function vc(r,e,t,n,s,o){We="",Wt="",Xe="",Kl=n===Fr,On=null,et=t,nr=t._config,dn=t._nodes,gs=et._listeners.mutation,Ks=s,Hs=o,gr=r._nodeMap,wt=e._nodeMap,hn=e._readOnly,Js=new Map(t._keyToDOMMap);const i=new Map;return fn=i,Jr("root",null),et=void 0,dn=void 0,Ks=void 0,Hs=void 0,gr=void 0,wt=void 0,nr=void 0,Js=void 0,fn=void 0,i}function Xs(r){const e=Js.get(r);return e===void 0&&M(75,r),e}const Ut=Object.freeze({}),Zs=30,ei=[["keydown",function(r,e){if(rn=r.timeStamp,Zl=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!G(e,Eu,r)&&t!=null){if(function(l,a,u,c){return ao(l)&&!a&&!c&&!u}(t,s,i,o))G(e,bl,r);else if(function(l,a,u,c,d){return ao(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,ku,r);else if(function(l,a,u,c){return lo(l)&&!a&&!c&&!u}(t,s,i,o))G(e,_l,r);else if(function(l,a,u,c,d){return lo(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))G(e,Au,r);else if(function(l,a,u){return function(c){return c==="ArrowUp"}(l)&&!a&&!u}(t,s,o))G(e,vl,r);else if(function(l,a,u){return function(c){return c==="ArrowDown"}(l)&&!a&&!u}(t,s,o))G(e,Cl,r);else if(function(l,a){return uo(l)&&a}(t,n))nn=!0,G(e,zn,r);else if(function(l){return l===" "}(t))G(e,Tu,r);else if(function(l,a){return bt&&a&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),nn=!0,G(e,Ar,!0);else if(function(l,a){return uo(l)&&!a}(t,n))nn=!1,G(e,zn,r);else if(function(l,a,u,c){return bt?!a&&!u&&(qr(l)||l.toLowerCase()==="h"&&c):!(c||a||u)&&qr(l)}(t,i,o,s))qr(t)?G(e,wl,r):(r.preventDefault(),G(e,cr,!0));else if(function(l){return l==="Escape"}(t))G(e,Dl,r);else if(function(l,a,u,c,d){return bt?!(u||c||d)&&(Ur(l)||l.toLowerCase()==="d"&&a):!(a||c||d)&&Ur(l)}(t,s,n,i,o))Ur(t)?G(e,Sl,r):(r.preventDefault(),G(e,cr,!1));else if(function(l,a,u){return qr(l)&&(bt?a:u)}(t,i,s))r.preventDefault(),G(e,an,!0);else if(function(l,a,u){return Ur(l)&&(bt?a:u)}(t,i,s))r.preventDefault(),G(e,an,!1);else if(function(l,a){return bt&&a&&qr(l)}(t,o))r.preventDefault(),G(e,un,!0);else if(function(l,a){return bt&&a&&Ur(l)}(t,o))r.preventDefault(),G(e,un,!1);else if(function(l,a,u,c){return l.toLowerCase()==="b"&&!a&&Hr(u,c)}(t,i,o,s))r.preventDefault(),G(e,Ct,"bold");else if(function(l,a,u,c){return l.toLowerCase()==="u"&&!a&&Hr(u,c)}(t,i,o,s))r.preventDefault(),G(e,Ct,"underline");else if(function(l,a,u,c){return l.toLowerCase()==="i"&&!a&&Hr(u,c)}(t,i,o,s))r.preventDefault(),G(e,Ct,"italic");else if(function(l,a,u,c){return l==="Tab"&&!a&&!u&&!c}(t,i,s,o))G(e,Bu,r);else if(function(l,a,u,c){return l.toLowerCase()==="z"&&!a&&Hr(u,c)}(t,n,o,s))r.preventDefault(),G(e,hi,void 0);else if(function(l,a,u,c){return bt?l.toLowerCase()==="z"&&u&&a:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&a}(t,n,o,s))r.preventDefault(),G(e,pi,void 0);else{const l=e._editorState._selection;l===null||P(l)?!rr&&co(t,o,s)&&(r.preventDefault(),G(e,Ws,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="c"&&(bt?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,as,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="x"&&(bt?c:d)}(t,n,o,s)?(r.preventDefault(),G(e,gi,r)):co(t,o,s)&&(r.preventDefault(),G(e,Ws,r))}(function(l,a,u,c){return l||a||u||c})(s,n,i,o)&&G(e,Iu,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&at(e,()=>{_e(jr(t))||(ri=!0)})}],["compositionstart",function(r,e){at(e,()=>{const t=K();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Ke(n.key),(r.timeStamp<rn+Zs||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Tr,Ku)}})}],["compositionend",function(r,e){rr?Gr=!0:at(e,()=>{Rs(e,r.data)})}],["input",function(r,e){r.stopPropagation(),at(e,()=>{const t=K(),n=r.data,s=na(r);if(n!=null&&P(t)&&ra(t,s,n,r.timeStamp,!1)){Gr&&(Rs(e,n),Gr=!1);const o=t.anchor.getNode(),i=ht(e._window);if(i===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,u=l?t.focus.offset:t.anchor.offset;qn&&!t.isCollapsed()&&z(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,a)+n+o.getTextContent().slice(a+u)===Wl(i.anchorNode)||G(e,Tr,n);const c=n.length;rr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),us||gn||mi||!e.isComposing()||(rn=0,Ke(null))}else Ai(!1,e,n!==null?n:void 0),Gr&&(Rs(e,n||void 0),Gr=!1);nt(),Rl(je())}),Sr=null}],["click",function(r,e){at(e,()=>{const t=K(),n=ht(e._window),s=Cn();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ze(i)&&Be().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(F(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===mn||i===sr)&&Lt(Li(s,n,e,r))}}}G(e,xl,r)})}],["cut",Ut],["copy",Ut],["dragstart",Ut],["dragover",Ut],["dragend",Ut],["paste",Ut],["focus",Ut],["blur",Ut],["drop",Ut]];qn&&ei.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=na(t);s==="deleteCompositionText"||rr&&Gl(n)||s!=="insertCompositionText"&&at(n,()=>{const i=K();if(s==="deleteContentBackward"){if(i===null){const h=Cn();if(!P(h))return;Lt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Zl==="MediaLast"&&l<rn+Zs&&n.isComposing()&&h){if(Ke(null),rn=0,setTimeout(()=>{at(n,()=>{Ke(null)})},Zs),P(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),z(g)||M(142),i.style=g.getStyle()}}else{Ke(null),t.preventDefault();const g=i.anchor.getNode(),m=g.getTextContent(),b=g.canInsertTextAfter(),w=i.anchor.offset===0&&i.focus.offset===m.length;qu&&h&&!w&&b||G(n,cr,!0)}return}}var l;if(!P(i))return;const a=t.data;Sr!==null&&Ai(!1,n,Sr),i.dirty&&Sr===null||!i.isCollapsed()||Ze(i.anchor.getNode())||o===null||i.applyDOMRange(o),Sr=null;const u=i.anchor,c=i.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Tr,t);break;case"insertFromComposition":Ke(null),G(n,Tr,t);break;case"insertLineBreak":Ke(null),G(n,Ar,!1);break;case"insertParagraph":Ke(null),nn&&!gn?(nn=!1,G(n,Ar,!1)):G(n,ln,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,ls,t);break;case"deleteByComposition":(function(h,g){return h!==g||F(h)||F(g)||!h.isToken()||!g.isToken()})(d,f)&&G(n,Us,t);break;case"deleteByDrag":case"deleteByCut":G(n,Us,t);break;case"deleteContent":G(n,cr,!1);break;case"deleteWordBackward":G(n,an,!0);break;case"deleteWordForward":G(n,an,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,un,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,un,!1);break;case"formatStrikeThrough":G(n,Ct,"strikethrough");break;case"formatBold":G(n,Ct,"bold");break;case"formatItalic":G(n,Ct,"italic");break;case"formatUnderline":G(n,Ct,"underline");break;case"historyUndo":G(n,hi,void 0);break;case"historyRedo":G(n,pi,void 0)}else{if(a===`
|
|
64
|
-
`)t.preventDefault(),G(n,
|
|
65
|
-
`){const n=K();if(
|
|
66
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&
|
|
67
|
-
`||
|
|
68
|
-
`?s.push(
|
|
69
|
-
`),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&
|
|
70
|
-
`||
|
|
71
|
-
`?n.push(mr()):i===" "?n.push(vn()):n.push(Ue(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,l=t),i.type==="element"&&function(b,w,v,E){const D=b.getNode(),k=D.getChildAtIndex(b.offset),y=Ue(),_=Ze(D)?ze().append(y):y;y.setFormat(v),y.setStyle(E),k===null?D.append(_):k.insertBefore(_),b.is(w)&&w.set(y.__key,0,"text"),b.set(y.__key,0,"text")}(i,l,s,o);const a=i.offset;let u=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||M(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(u=h,l.set(i.key,u,"text")),this.isCollapsed()&&a===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let b=f.getNextSibling();if(z(b)&&b.canInsertTextBefore()&&!ar(b)||(b=Ue(),b.setFormat(s),b.setStyle(o),g.canInsertTextAfter()?f.insertAfter(b):g.insertAfter(b)),b.select(0,0),f=b,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let b=f.getPreviousSibling();if(z(b)&&!ar(b)||(b=Ue(),b.setFormat(s),g.canInsertTextBefore()?f.insertBefore(b):g.insertBefore(b)),b.select(),f=b,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const b=Ue(f.getTextContent());b.setFormat(s),f.replace(b),f=b}else if(!this.isCollapsed()&&e!==""){const b=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||F(b)&&(!b.canInsertTextBefore()||!b.canInsertTextAfter()))return this.insertText(""),aa(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ue(e);return E.select(),void f.replace(E)}const b=f.getFormat(),w=f.getStyle();if(a!==u||b===s&&w===o){if(Tc(f)){const E=Ue(e);return E.setFormat(s),E.setStyle(o),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ue(e);if(E.setFormat(s),E.setStyle(o),E.select(),a===0)f.insertBefore(E,!1);else{const[D]=f.splitText(a);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const v=u-a;f=f.spliceText(a,v,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=b,this.style=w))}else{const b=new Set([...f.getParentKeys(),...m.getParentKeys()]),w=F(f)?f:f.getParentOrThrow();let v=F(m)?m:m.getParentOrThrow(),E=m;if(!w.is(v)&&v.isInline())do E=v,v=v.getParentOrThrow();while(v.isInline());if(l.type==="text"&&(u!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ue(m.getTextContent());m.replace(S),m=S}Ze(l.getNode())||l.type!=="text"||(m=m.spliceText(0,u,"")),b.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else b.add(m.__key);const D=v.getChildren(),k=new Set(c),y=w.is(v),_=w.isInline()&&f.getNextSibling()===null?w:f;for(let S=D.length-1;S>=0;S--){const A=D[S];if(A.is(f)||F(A)&&A.isParentOf(f))break;A.isAttached()&&(!k.has(A)||A.is(E)?y||_.insertAfter(A,!1):A.remove())}if(!y){let S=v,A=null;for(;S!==null;){const I=S.getChildren(),B=I.length;(B===0||I[B-1].is(A))&&(b.delete(S.__key),A=S),S=S.getParent()}}if(f.isToken())if(a===h)f.select();else{const S=Ue(e);S.select(),f.replace(S)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const A=c[S],I=A.__key;b.has(I)||A.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,o=this.isBackward()?e:t;let i=s.getNode(),l=o.getNode();const a=Wr(i,Yt),u=Wr(l,Yt);z(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&z(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{tn(i,d)||tn(l,d)||d.getKey()===i.getKey()||d.getKey()===l.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&ar(d)){const h=Ue(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&z(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(z(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}z(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&z(i)?i.selectEnd():l.isAttached()&&z(l)&&l.selectStart(),F(a)&&F(u)&&a!==u&&(a.append(...u.getChildren()),u.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Ke(null);const n=this.getNodes(),s=[];for(const D of n)z(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(Rr(k)){const y=k.getFormatFlags(e,D);k.setTextFormat(y)}})},i=s.length;if(i===0)return this.toggleFormat(e),Ke(null),void o(t);const l=this.anchor,a=this.focus,u=this.isBackward(),c=u?a:l,d=u?l:a;let f=0,h=s[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===h.getTextContentSize()&&(f=1,h=s[1],g=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const b=i-1;let w=s[b];const v=d.type==="text"?d.offset:w.getTextContentSize();if(h.is(w)){if(g===v)return;if(ar(h)||g===0&&v===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(g,v),k=g===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),d.type==="text"&&d.set(k.__key,v-g,"text")}return void(this.format=m)}g===0||ar(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);const E=w.getFormatFlags(e,m);v>0&&(v===w.getTextContentSize()||ar(w)||([w]=w.splitText(v)),w.setFormat(E));for(let D=f+1;D<b;D++){const k=s[D],y=k.getFormatFlags(e,E);k.setFormat(y)}c.type==="text"&&c.set(h.__key,g,"text"),d.type==="text"&&d.set(w.__key,v,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const g=K();return P(g)||M(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Wr(t,Yt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=Ms(this);n.splice(g,0,e),s.selectEnd()}return}if(!e.some(g=>(F(g)||_e(g))&&!g.isInline())){F(n)||M(211,t.constructor.name,t.getType());const g=Ms(this);return n.splice(g,0,e),void s.selectEnd()}const o=function(g){const m=ze();let b=null;for(let w=0;w<g.length;w++){const v=g[w],E=fr(v);if(E||_e(v)&&v.isInline()||F(v)&&v.isInline()||z(v)||v.isParentRequired()){if(b===null&&(b=v.createParentElementNode(),m.append(b),E))continue;b!==null&&b.append(v)}else m.append(v),b=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),a=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=l[l.length-1];let c=l[0];var d;F(d=c)&&Yt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||M(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&M(212,t.constructor.name,t.getType()),function(g,m,b){const w=m.getParentOrThrow().getLastChild();let v=m;const E=[m];for(;v!==w;)v.getNextSibling()||M(140),v=v.getNextSibling(),E.push(v);let D=g;for(const k of E)D=D.insertAfter(k)}(n,c));const f=Wr(i,Yt);a&&F(f)&&(a.canMergeWhenEmpty()||Yt(u))&&(f.append(...a.getChildren()),a.remove()),F(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=F(n)?n.getLastChild():null;fr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ze();return Be().splice(this.anchor.offset,0,[i]),i.select(),i}const e=Ms(this),t=Wr(this.anchor.getNode(),Yt);F(t)||M(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...s),o.selectStart(),o):null}insertLineBreak(e){const t=mr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,o=this.focus;let i=e[0],l=e[n];const[a,u]=si(this);if(t===0)return[];if(t===1){if(z(i)&&!this.isCollapsed()){const d=a>u?u:a,f=a>u?a:u,h=i.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const c=s.isBefore(o);if(z(i)){const d=c?a:u;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(z(l)){const d=l.getTextContent().length,f=c?u:a;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[n]=l)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",l=cn(s,t);if(_e(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=Ao();return h.add(l.__key),void Lt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(z(f)){const h=f.__key,g=t?f.getTextContent().length:0;return s.set(h,g,"text"),void(i&&o.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,m;return F(f)?(m=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),m=h.__key,t||g++),s.set(m,g,"element"),void(i&&o.set(m,g,"element"))}}const a=je(),u=ht(a._window);if(!u)return;const c=a._blockCursorElement,d=a._rootElement;if(d===null||c===null||!F(l)||l.isInline()||l.canBeEmpty()||Ni(c,a,d),function(f,h,g,m){f.modify(h,g,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),g=Ze(h)?h:fc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),b=[];let w=!1;for(let v=0;v<m.length;v++){const E=m[v];tn(E,g)?b.push(E):w=!0}if(w&&b.length>0)if(t){const v=b[0];F(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{const v=b[b.length-1];F(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(v){const E=v.focus,D=v.anchor,k=D.key,y=D.offset,_=D.type;Xt(D,E.key,E.offset,E.type),Xt(E,k,y,_),v._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),o=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(o)&&o.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const o=this.focus,i=cn(o,e);if(_e(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const l=Ao();l.add(i.__key),Lt(l)}else i.remove(),je().dispatchCommand(fi,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 So(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 So(s,e,a)}(function(a,u){const c=a.anchor,d=a.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const g=c.offset,m=d.offset,b=g<m,w=b?g:m,v=b?m:g,E=v-1;w!==E&&(ql(f.getTextContent().slice(w,v))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&Ze(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Ft(r){return r instanceof ys}function Do(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function si(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]:[Do(t),Do(n)]}function So(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 Eo(r,e,t,n){let s,o=e;if(r.nodeType===mn){let i=!1;const l=r.childNodes,a=l.length,u=n._blockCursorElement;o===a&&(i=!0,o=a-1);let c=l[o],d=!1;if(c===u)c=l[o+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&o--}if(s=Er(c),z(s))o=oo(s,i);else{let f=Er(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&M(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||M(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(F(m)&&function(b,w,v){const E=b.getParent();return v===null||E===null||!E.canBeEmpty()||E!==v.getNode()}(m,0,t)){const b=i?m.getLastDescendant():m.getFirstDescendant();b===null?f=m:(m=b,f=F(m)?m:m.getParentOrThrow()),o=0}z(m)?(s=m,f=null,o=oo(m,i)):m!==f&&i&&!d&&(F(f)||M(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&_e(f)&&Er(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return Ot(f.__key,o,"element")}}else s=Er(r);return z(s)?Ot(s.__key,o,"text"):null}function ko(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const o=s.getPreviousSibling(),i=s.getParent();if(e){if((t||!e)&&o===null&&F(i)&&i.isInline()){const l=i.getPreviousSibling();z(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else F(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):z(o)&&(r.key=o.__key,r.offset=o.getTextContent().length)}else if(n===s.getTextContent().length){const o=s.getNextSibling(),i=s.getParent();if(e&&F(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&F(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();z(l)&&(r.key=l.__key,r.offset=0)}}}function aa(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);ko(r,n,s),ko(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=je();if(o.isComposing()&&o._compositionKey!==r.key&&P(t)){const i=t.anchor,l=t.focus;Xt(r,i.key,i.offset,i.type),Xt(e,l.key,l.offset,l.type)}}}function ua(r,e,t,n,s,o){if(r===null||t===null||!yn(s,r,t))return null;const i=Eo(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=Eo(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const a=Er(r),u=Er(t);if(_e(a)&&_e(u))return null}return aa(i,l,o),[i,l]}function ii(r){return F(r)&&!r.isInline()}function ca(r,e,t,n,s,o){const i=Kt(),l=new ir(Ot(r,e,s),Ot(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Nc(){const r=Ot("root",0,"element"),e=Ot("root",0,"element");return new ir(r,e,0,"")}function Ao(){return new ys(new Set)}function Li(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,l=i==="selectionchange",a=!Gs&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let u,c,d,f;if(P(r)&&!a)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&P(r)&&!yn(t,u,c))return r.clone();const h=ua(u,d,c,f,t,r);if(h===null)return null;const[g,m]=h;return new ir(g,m,P(r)?r.format:0,P(r)?r.style:"")}function K(){return Kt()._selection}function Cn(){return je()._editorState._selection}function ts(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"),To(r)}}else{const u=r.isBackward(),c=u?o:s,d=c.getNode(),f=u?s:o,h=f.getNode();if(e.is(d)){const g=c.offset;(t<=g&&n>0||t<g&&n<0)&&c.set(a,Math.max(0,g+n),"element")}if(e.is(h)){const g=f.offset;(t<=g&&n>0||t<g&&n<0)&&f.set(a,Math.max(0,g+n),"element")}}To(r)}function To(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!F(o))return;const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(o)){const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(i)){const l=i.getChildrenSize(),a=s>=l,u=a?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function rs(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,z(n)?(i=n.getTextContentSize(),l="text"):F(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,z(s)?l="text":F(s)&&(l="element")),o!==null&&l!==null?r.set(o,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function Bo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Fc(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&&Si(d))return;if(!P(e))return void(r!==null&&yn(t,l,a)&&n.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,m=h.key,b=Jn(t,g),w=Jn(t,m),v=f.offset,E=h.offset,D=e.format,k=e.style,y=e.isCollapsed();let _=b,S=w,A=!1;if(f.type==="text"){_=Vn(b);const $=f.getNode();A=$.getFormat()!==D||$.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(A=!0);var I,B,N,j,R;if(h.type==="text"&&(S=Vn(w)),_!==null&&S!==null&&(y&&(r===null||A||P(r)&&(r.format!==D||r.style!==k))&&(I=D,B=k,N=v,j=g,R=performance.now(),ta=[I,B,N,j,R]),u!==v||c!==E||l!==_||a!==S||n.type==="Range"&&y||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(_,v,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const $=e instanceof ir&&e.anchor.type==="element"?_.childNodes[v]||null:n.rangeCount>0?n.getRangeAt(0):null;if($!==null){let X;if($ instanceof Text){const ce=document.createRange();ce.selectNode($),X=ce.getBoundingClientRect()}else X=$.getBoundingClientRect();(function(ce,ve,le){const Re=le.ownerDocument,me=Re.defaultView;if(me===null)return;let{top:he,bottom:ye}=ve,xe=0,Se=0,pe=le;for(;pe!==null;){const Ce=pe===Re.body;if(Ce)xe=0,Se=ps(ce).innerHeight;else{const ae=pe.getBoundingClientRect();xe=ae.top,Se=ae.bottom}let Ne=0;if(he<xe?Ne=-(xe-he):ye>Se&&(Ne=ye-Se),Ne!==0)if(Ce)me.scrollBy(0,Ne);else{const ae=pe.scrollTop;pe.scrollTop+=Ne;const Le=pe.scrollTop-ae;he-=Le,ye-=Le}if(Ce)break;pe=xn(pe)}})(t,X,o)}}ti=!0}}function da(r){let e=K()||Cn();e===null&&(e=Be().selectEnd()),e.insertNodes(r)}function Ms(r){let e=r;r.isCollapsed()||e.removeText();const t=K();P(t)&&(e=t),P(e)||M(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!Yt(s);)[s,o]=jc(s,o);return o}function jc(r,e){const t=r.getParent();if(!t){const s=ze();return Be().append(s),s.select(),[Be(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const o=e===0?0:1;return[t,s[0].getIndexWithinParent()+o]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new ir(Ot(r.__key,e,"element"),Ot(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ge=null,Ve=null,st=!1,Is=!1,Mn=0;const No={characterData:!0,childList:!0,subtree:!0};function wn(){return st||Ge!==null&&Ge._readOnly}function nt(){st&&M(13)}function fa(){Mn>99&&M(14)}function Kt(){return Ge===null&&M(195,ha()),Ge}function je(){return Ve===null&&M(196,ha()),Ve}function ha(){let r=0;const e=new Set,t=bs.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=ds(s);if(Ei(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 Rc(){return Ve}function Fo(r,e,t){const n=e.__type,s=function(l,a){const u=l._nodes.get(a);return u===void 0&&M(30,a),u}(r,n);let o=t.get(n);o===void 0&&(o=Array.from(s.transforms),t.set(n,o));const i=o.length;for(let l=0;l<i&&(o[l](e),e.isAttached());l++);}function jo(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function pa(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 Lc(r){return Pi(r,je()._nodes)}function Pi(r,e){const t=r.type,n=e.get(t);n===void 0&&M(17,t);const s=n.klass;r.type!==s.getType()&&M(18,s.name);const o=s.importJSON(r),i=r.children;if(F(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const a=Pi(i[l],e);o.append(a)}return o}function Ro(r,e,t){const n=Ge,s=st,o=Ve;Ge=e,st=!0,Ve=r;try{return t()}finally{Ge=n,st=s,Ve=o}}function er(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const o=r._editorState,i=o._selection,l=t._selection,a=r._dirtyType!==hr,u=Ge,c=st,d=Ve,f=r._updating,h=r._observer;let g=null;if(r._pendingEditorState=null,r._editorState=t,!s&&a&&h!==null){Ve=r,Ge=t,st=!1,r._updating=!0;try{const y=r._dirtyType,_=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),g=vc(o,t,r,y,_,S)}catch(y){if(y instanceof Error&&r._onError(y),Is)throw y;return ba(r,null,n,t),Ll(r),r._dirtyType=Fr,Is=!0,er(r,o),void(Is=!1)}finally{h.observe(n,No),r._updating=f,Ge=u,st=c,Ve=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,b=r._dirtyElements,w=r._normalizedNodes,v=r._updateTags,E=r._deferred;a&&(r._dirtyType=hr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(y,_){const S=y._decorators;let A=y._pendingDecorators||S;const I=_._nodeMap;let B;for(B in A)I.has(B)||(A===S&&(A=$l(y)),delete A[B])}(r,t);const D=s?null:ht(r._window);if(r._editable&&D!==null&&(a||l===null||l.dirty)){Ve=r,Ge=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const y=r._blockCursorElement;y!==null&&Ni(y,r,n),Fc(i,l,r,D,v,n)}hc(r,n,l),h!==null&&h.observe(n,No)}finally{Ve=d,Ge=u}}g!==null&&function(y,_,S,A,I){const B=Array.from(y._listeners.mutation),N=B.length;for(let j=0;j<N;j++){const[R,$]=B[j],X=_.get($);X!==void 0&&R(X,{dirtyLeaves:A,prevEditorState:I,updateTags:S})}}(r,g,v,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(fi,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,sn("decorator",r,!0,k)),function(y,_,S){const A=io(_),I=io(S);A!==I&&sn("textcontent",y,!0,I)}(r,e||o,t),sn("update",r,!0,{dirtyElements:b,dirtyLeaves:m,editorState:t,normalizedNodes:w,prevEditorState:e||o,tags:v}),function(y,_){if(y._deferred=[],_.length!==0){const S=y._updating;y._updating=!0;try{for(let A=0;A<_.length;A++)_[A]()}finally{y._updating=S}}}(r,E),function(y){const _=y._updates;if(_.length!==0){const S=_.shift();if(S){const[A,I]=S;ma(y,A,I)}}}(r)}function sn(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 ga(r,e,t){if(r._updating===!1||Ve!==r){let s=!1;return r.update(()=>{s=ga(r,e,t)}),s}const n=ki(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 Lo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[o,i]=s;let l;if(i!==void 0){if(l=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const a=r._pendingEditorState;a===null&&M(191),a._flushSync=!0}l&&r._deferred.push(l),pa(r,i.tag)}o()}}return n}function ma(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,pa(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=ya(a||l),u=!0),a._flushSync=i;const c=Ge,d=st,f=Ve,h=r._updating;Ge=a,st=!1,r._updating=!0,Ve=r;try{u&&(r._headless?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(w){const v=w.getEditorState()._selection,E=ht(w._window);return P(v)||v==null?Li(v,E,w,null):v.clone()}(r));const m=r._compositionKey;e(),o=Lo(r,o),function(w,v){const E=v.getEditorState()._selection,D=w._selection;if(P(D)){const k=D.anchor,y=D.focus;let _;if(k.type==="text"&&(_=k.getNode(),_.selectionTransform(E,D)),y.type==="text"){const S=y.getNode();_!==S&&S.selectionTransform(E,D)}}}(a,r),r._dirtyType!==hr&&(o?function(w,v){const E=v._dirtyLeaves,D=w._nodeMap;for(const k of E){const y=D.get(k);z(y)&&y.isAttached()&&y.isSimpleText()&&!y.isUnmergeable()&&no(y)}}(a,r):function(w,v){const E=v._dirtyLeaves,D=v._dirtyElements,k=w._nodeMap,y=Zt(),_=new Map;let S=E,A=S.size,I=D,B=I.size;for(;A>0||B>0;){if(A>0){v._dirtyLeaves=new Set;for(const N of S){const j=k.get(N);z(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&no(j),j!==void 0&&jo(j,y)&&Fo(v,j,_),E.add(N)}if(S=v._dirtyLeaves,A=S.size,A>0){Mn++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const N of I){const j=N[0],R=N[1];if(j!=="root"&&!R)continue;const $=k.get(j);$!==void 0&&jo($,y)&&Fo(v,$,_),D.set(j,R)}S=v._dirtyLeaves,A=S.size,I=v._dirtyElements,B=I.size,Mn++}v._dirtyLeaves=E,v._dirtyElements=D}(a,r),Lo(r),function(w,v,E,D){const k=w._nodeMap,y=v._nodeMap,_=[];for(const[S]of D){const A=y.get(S);A!==void 0&&(A.isAttached()||(F(A)&&Vl(A,S,k,y,_,D),k.has(S)||D.delete(S),_.push(S)))}for(const S of _)y.delete(S);for(const S of E){const A=y.get(S);A===void 0||A.isAttached()||(k.has(S)||E.delete(S),y.delete(S))}}(l,a,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(a._flushSync=!0);const b=a._selection;if(P(b)){const w=a._nodeMap,v=b.anchor.key,E=b.focus.key;w.get(v)!==void 0&&w.get(E)!==void 0||M(19)}else Ft(b)&&b._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=Fr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void er(r)}finally{Ge=c,st=d,Ve=f,r._updating=h,Mn=0}r._dirtyType!==hr||function(m,b){const w=b.getEditorState()._selection,v=m._selection;if(v!==null){if(v.dirty||!v.is(w))return!0}else if(w!==null)return!0;return!1}(a,r)?a._flushSync?(a._flushSync=!1,er(r)):u&&lc(()=>{er(r)}):(a._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function at(r,e,t){r._updating?r._updates.push([e,t]):ma(r,e,t)}class on{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new on(this.element,e,this.after)}withAfter(e){return new on(this.element,this.before,e)}withElement(e){return new on(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"&&(gn||us);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=Po(t,n);o.push(s);const i=Po(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 Po(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let o=n.previousSibling;o!==null;o=n.previousSibling)s++;t.push(s)}return n!==r&&M(225),t.reverse()}class Ht extends ms{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 Yu[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=je()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const o=t[n-1];return F(o)&&o.getLastDescendant()||o||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Qe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Qe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContent(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Gt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContentSize(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Gt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=eo[e];return!!(this.getFormat()&t)}return!1}select(e,t){nt();const n=K();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(z(a)||F(a))return a.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const a=this.getLastChild();if(z(a)||F(a))return a.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return P(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):ca(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!==""?eo[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,o=this.getChildrenSize(),i=this.getWritable();e+t<=o||M(226,String(e),String(t),String(o));const l=i.__key,a=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=o-t+s;if(e!==0)if(e===o)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){g===null&&M(100);const b=g.getNextSibling(),w=g.__key;dr(g.getWritable()),u.push(w),g=b}}let h=d;for(let g=0;g<s;g++){const m=n[g];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const b=m.getWritable();b.__parent===l&&f--,dr(b);const w=m.__key;if(h===null)i.__first=w,b.__prev=null;else{const v=h.getWritable();v.__next=w,b.__prev=v.__key}m.__key===l&&M(76),b.__parent=l,a.push(w),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const g=c.getWritable();if(h!==null){const m=h.getWritable();g.__prev=h.__key,m.__next=c.__key}else g.__prev=null}if(i.__size=f,u.length){const g=K();if(P(g)){const m=new Set(u),b=new Set(a),{anchor:w,focus:v}=g;Oo(w,m,b)&&rs(w,w.getNode(),this,d,c),Oo(v,m,b)&&rs(v,v.getNode(),this,d,c),f!==0||this.canBeEmpty()||Pt(this)||this.remove()}}return i}getDOMSlot(e){return new on(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Vt(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let o=this.getFirstChild();o;o=o.getNextSibling()){const i=t.getElementByKey(o.getKey());i!==null&&(s==null?(n.insertChild(i),s=i):s!==i&&n.replaceChild(i,s),s=s.nextSibling)}}}function F(r){return r instanceof Ht}function Oo(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 Oi extends ms{constructor(e){super(e)}decorate(e,t){M(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function _e(r){return r instanceof Oi}class Dn extends Ht{static getType(){return"root"}static clone(){return new Dn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){const e=this.__cachedText;return!wn()&&je()._dirtyType!==hr||e===null?super.getTextContent():e}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||_e(n)||M(56)}return super.append(...e)}static importJSON(e){const t=Be();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Ze(r){return r instanceof Dn}function ya(r){return new xs(new Map(r._nodeMap))}function Mi(){return new xs(new Map([["root",new Dn]]))}function xa(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&M(130,t.name),F(r)){const n=e.children;Array.isArray(n)||M(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=xa(s[o]);n.push(i)}}return e}class xs{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 Ro(t&&t.editor||null,this,e)}clone(e){const t=new xs(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Ro(null,this,()=>({root:xa(Be())}))}}class Ii extends Ht{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Pr extends Ht{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=pr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Kn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new Pr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=en(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Pc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Vt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=ze();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=ze();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Pc(r){const e=ze();return r.style&&(e.setFormat(r.style.textAlign),ji(r,e)),{node:e}}function ze(){return Mt(new Pr)}function Rr(r){return r instanceof Pr}const fe=0,kr=1,Oc=4;function ba(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Mi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=hr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const o=r._observer;o!==null&&(o.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function Mc(r){const e=r||{},t=Rc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=Mi(),l=e.namespace||(s!==null?s._config.namespace:Ul()),a=e.editorState,u=[Dn,Lr,bn,_n,Pr,Ii,...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],w=null,v=null;if(typeof b!="function"){const y=b;b=y.replace,w=y.with,v=y.withKlass||null}const E=b.getType(),D=b.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(b):void 0,klass:b,replace:w,replaceWithKlass:v,transforms:k})}}const g=new bs(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,b){const w=new Map,v=new Set,E=D=>{Object.keys(D).forEach(k=>{let y=w.get(k);y===void 0&&(y=[],w.set(k,y)),y.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||v.has(k))return;v.add(k);const y=k.call(D.klass);y!==null&&E(y)}),b&&E(b),w}(h,d?d.import:void 0),f);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=Fr),g}class bs{constructor(e,t,n,s,o,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=hr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ul(),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=yc(n).get(t.getType());if(!s)return;const o=new Map;for(const i of s.keys())o.set(i,"created");o.size>0&&e(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],o=n.replaceWithKlass;if(o!=null){const a=this.registerNodeTransformToKlass(o,t);s.push(a)}var i,l;return i=this,l=e.getType(),at(i,()=>{const a=Kt();if(a.isEmpty())return;if(l==="root")return void Be().markDirty();const u=a._nodeMap;for(const[,c]of u)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(a=>a.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=en(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,ba(this,t,e,s),t!==null&&(this._config.disableEvents||Cc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=Fr,Ll(this),this._updateTags.add("history-merge"),er(this),this._config.disableEvents||function(l,a){const u=l.ownerDocument,c=es.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ia),es.set(u,(c||0)+1),l.__lexicalEditor=a;const d=sa(l);for(let f=0;f<ei.length;f++){const[h,g]=ei[f],m=typeof g=="function"?b=>{bo(b)||(xo(b),(a.isEditable()||h==="click")&&g(b,a))}:b=>{if(bo(b))return;xo(b);const w=a.isEditable();switch(h){case"cut":return w&&G(a,gi,b);case"copy":return G(a,as,b);case"paste":return w&&G(a,ls,b);case"dragstart":return w&&G(a,kl,b);case"dragover":return w&&G(a,Al,b);case"dragend":return w&&G(a,Ru,b);case"focus":return w&&G(a,Ou,b);case"blur":return w&&G(a,Mu,b);case"drop":return w&&G(a,El,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;sn("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=ya(e),n._selection=e._selection?e._selection.clone():null),Rl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),er(this)),this._pendingEditorState=n,this._dirtyType=Fr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||er(this)}parseEditorState(e,t){return function(n,s,o){const i=Mi(),l=Ge,a=st,u=Ve,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ge=i,st=!1,Ve=s;try{const g=s._nodes;Pi(n.root,g),o&&o(),i._readOnly=!0}catch(g){g instanceof Error&&s._onError(g)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ge=l,st=a,Ve=u}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return er(this),this.getEditorState().read(e,{editor:this})}update(e,t){at(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),at(this,()=>{const s=K(),o=Be();s!==null?s.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=ht(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,sn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}bs.version="0.21.0+prod.esm";const _a=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ic=_a?C.useLayoutEffect:C.useEffect,Fn={tag:"history-merge"};function $c({initialConfig:r,children:e}){const t=C.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:a}=r,u=Du(null,n),c=Mc({editable:r.editable,html:a,namespace:s,nodes:o,onError:d=>i(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Be();if(h.isEmpty()){const g=ze();h.append(g);const m=_a?document.activeElement:null;(K()!==null||m!==null&&m===d.getRootElement())&&g.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(()=>{Be().isEmpty()&&f(d)},Fn)}}}(c,l),[c,u]},[]);return Ic(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),p.jsx(yl.Provider,{value:t,children:e})}const zc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function qc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function Uc(){return function(r){const[e]=Dt(),t=C.useMemo(()=>r(e),[e,r]),[n,s]=C.useState(()=>t.initialValueFn()),o=C.useRef(n);return zc(()=>{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}(qc)}function Wc(){return Be().getTextContent()}function Gc(r,e=!0){if(r)return!1;let t=Wc();return e&&(t=t.trim()),t===""}function Vc(r){if(!Gc(r,!1))return!1;const e=Be().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(_e(s))return!1;if(F(s)){if(!Rr(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const a=o[n];if(!z(a))return!1}}}return!0}function va(r){return()=>Vc(r)}function Kc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Kc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Hc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Jc=Hc(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 Qc=new Map;function Yc(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 Ca(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]=si(r),f=i.is(l),h=e.is(o?l:i),g=e.is(o?i:l);let m,b=0;return f?(b=c>d?d:c,m=c>d?c:d):h?(b=o?d:c,m=void 0):g&&(b=0,m=o?c:d),e.__text=e.__text.slice(b,m),e}}return e}function Xc(r){const e=r.getStyle(),t=Yc(e);Qc.set(e,t)}function Zc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),l=Be(),a=l.getFirstChild();return void(a?a.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let a=i;for(;a!==null&&a.getParent()!==null&&!l(a);)a=a.getParentOrThrow();return l(a)?a:null}(n.getNode(),$o);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!$o(l))continue;F(l)||Jc(178);const a=e();a.setFormat(l.getFormatType()),a.setIndent(l.getIndent()),l.replace(a,!0)}}function Mo(r,e){const t=cn(r.focus,e);return _e(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function ed(r,e,t,n){r.modify(e?"extend":"move",t,n)}function td(r){const e=r.anchor.getNode();return(Ze(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Io(r,e,t){const n=td(r);ed(r,e,t?!n:n,"character")}function $o(r){if(_e(r)||!F(r)||Pt(r))return!1;const e=r.getFirstChild(),t=e===null||fr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function rd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var nd=rd(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 wa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,sd=wa&&"documentMode"in document?document.documentMode:null;!(!wa||!("InputEvent"in window)||sd)&&"getTargetRanges"in new window.InputEvent("input");function Da(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function xr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Sn(r,...e){const t=Da(...e);t.length>0&&r.classList.add(...t)}function Sa(r,...e){const t=Da(...e);t.length>0&&r.classList.remove(...t)}function id(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function od(r){const e=_s(r,t=>F(t)&&!t.isInline());return F(e)||nd(4,r.__key),e}const _s=(r,e)=>{let t=r;for(;t!==Be()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function tr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function ld(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const o=n.data;if(typeof o=="string"){let i;try{i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[u,c,d,f,h,g]=a;r.update(()=>{const m=K();if(P(m)){const b=m.anchor;let w=b.getNode(),v=0,E=0;if(z(w)&&u>=0&&c>=0&&(v=u,E=u+c,m.setTextNodeRange(w,v,w,E)),v===E&&d===""||(m.insertRawText(d),w=b.getNode()),z(w)){v=f,E=f+h;const D=w.getTextContentSize();v=v>D?D:v,E=E>D?D:E,m.setTextNodeRange(w,v,w,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Ea(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(!Ta.has(i.nodeName)){const l=Ba(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof Ii&&i.insertAfter(mr());for(const i of o){const l=i.getChildren();for(const a of l)i.insertBefore(a);i.remove()}}(s),n}function ka(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Be().getChildren();for(let s=0;s<n.length;s++)Aa(r,n[s],t,e);return t.innerHTML}function Aa(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=Fi(e);h=z(h)&&n!==null?Ca(n,h):h,i=h}const l=F(i)?i.getChildren():[],a=r._nodes.get(i.getType());let u;u=a&&a.exportDOM!==void 0?a.exportDOM(r,i):i.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],m=Aa(r,g,f,n);!s&&F(e)&&m&&e.extractWithChild(g,n,"html")&&(s=!0)}if(s&&!o){if((Vt(c)||ho(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(ho(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const Ta=new Set(["STYLE","SCRIPT"]);function Ba(r,e,t,n,s=new Map,o){let i=[];if(Ta.has(r.nodeName))return i;let l=null;const a=function(g,m){const{nodeName:b}=g,w=m._htmlConversions.get(b.toLowerCase());let v=null;if(w!==void 0)for(const E of w){const D=E(g);D!==null&&(v===null||(v.priority||0)<=(D.priority||0))&&(v=D)}return v!==null?v.conversion:null}(r,e),u=a?a(r):null;let c=null;if(u!==null){c=u.after;const g=u.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!Pt(l))&&(l!=null&&ii(l)||n);for(let g=0;g<d.length;g++)f.push(...Ba(d[g],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Qn(r)&&(f=ad(r,f,h?()=>{const g=new Ii;return t.push(g),g}:ze)),l==null?f.length>0?i=i.concat(f):Qn(r)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Vs(g.nextSibling)&&Vs(g.previousSibling)}(r)&&(i=i.concat(mr())):F(l)&&l.append(...f),i}function ad(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(ii(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&ii(e[i+1])){const a=t();a.setFormat(n),a.append(...o),s.push(a),o=[]}}return s}function ud(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ns=ud(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 cd(r,e=K()){return e==null&&ns(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":ka(r,e)}function dd(r,e=K()){return e==null&&ns(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(fd(r,e))}function zo(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 qo(t,hd(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 qo(t,Ea(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(P(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const a=K();if(P(a)){const u=i[l];u===`
|
|
63
|
+
`,hc=sr?" ":gs,Il="֑-߿יִ-﷽ﹰ-ﻼ",$l="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",pc=new RegExp("^[^"+$l+"]*["+Il+"]"),gc=new RegExp("^[^"+Il+"]*["+$l+"]"),mr={bold:1,code:16,highlight:Di,italic:2,strikethrough:Kn,subscript:32,superscript:64,underline:Hn},mc={directionless:1,unmergeable:2},lo={center:Si,end:Ni,justify:ki,left:Ei,right:Ai,start:Ti},yc={[Si]:"center",[Ni]:"end",[ki]:"justify",[Ei]:"left",[Ai]:"right",[Ti]:"start"},xc={normal:0,segmented:2,token:1},bc={[uc]:"normal",[dc]:"segmented",[cc]:"token"};function _c(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $=_c(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 Qn(...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 vc=100;let Js=!1,Bi=0;function Cc(r){Bi=r.timeStamp}function Ms(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ys(r,t)!==void 0}function wc(r,e,t){const n=gt(t._window);let s=null,i=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,i=n.focusOffset);const o=r.nodeValue;o!==null&&Pi(e,o,s,i,!1)}function Dc(r,e,t){if(O(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===or&&t.isAttached()}function Ec(r,e,t,n){for(let s=r;s&&!Oc(s);s=Cn(s)){const i=ys(s,e);if(i!==void 0){const o=Xe(i,t);if(o)return Ce(o)?void 0:[s,o]}else if(s===n)return[n,Ql(t)]}}function zl(r,e,t){Js=!0;const n=performance.now()-Bi>vc;try{ct(r,()=>{const s=K()||function(f){return f.getEditorState().read(()=>{const h=K();return h!==null?h.clone():null})}(r),i=new Map,o=r.getRootElement(),a=r._editorState,l=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],p=h.type,m=h.target,y=Ec(m,r,a,o);if(!y)continue;const[w,x]=y;if(p==="characterData")n&&z(x)&&Dc(s,m,x)&&wc(m,x,r);else if(p==="childList"){u=!0;const E=h.addedNodes;for(let b=0;b<E.length;b++){const v=E[b],S=Kl(v),k=v.parentNode;if(k!=null&&v!==l&&S===null&&!Ms(v,k,r)){if(sr){const j=v.innerText||v.nodeValue;j&&(c+=j)}k.removeChild(v)}}const D=h.removedNodes,A=D.length;if(A>0){let b=0;for(let v=0;v<A;v++){const S=D[v];(Ms(S,m,r)||l===S)&&(m.appendChild(S),b++)}A!==b&&i.set(w,x)}}}if(i.size>0)for(const[f,h]of i)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 y=0;y<p.length;y++){const w=p[y],x=w.parentNode;x==null||w.nodeName!=="BR"||Ms(w,m,r)||x.removeChild(w)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,jt(s)),sr&&Zl(r)&&s.insertRawText(c))})}finally{Js=!1}}function ql(r){const e=r._observer;e!==null&&zl(r,e.takeRecords(),e)}function Ul(r){(function(e){Bi===0&&bs(e).addEventListener("textInput",Cc,!0)})(r),r._observer=new MutationObserver((e,t)=>{zl(r,e,t)})}function ao(r,e){const t=r.__mode,n=r.__format,s=r.__style,i=e.__mode,o=e.__format,a=e.__style;return!(t!==null&&t!==i||n!==null&&n!==o||s!==null&&s!==a)}function uo(r,e){const t=r.mergeWithSibling(e),n=Pe()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function co(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(ao(e,n)){n=uo(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(ao(n,t)){n=uo(n,t);break}break}t.remove()}}else n.remove()}function Wl(r){return fo(r.anchor),fo(r.focus),r}function fo(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let Sc=1;const Ac=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Fi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Ce(jr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ms(e)==null)}function vn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Fi(e)&&Gl(e)===r}catch{return!1}}function Ri(r){return r instanceof Ds}function Gl(r){let e=r;for(;e!=null;){const t=ms(e);if(Ri(t))return t;e=Cn(e)}return null}function ms(r){return r?r.__lexicalEditor:null}function cr(r){return r.isToken()||r.isSegmented()}function kc(r){return r.nodeType===or}function Jn(r){let e=r;for(;e!=null;){if(kc(e))return e;e=e.firstChild}return null}function Yn(r,e,t){const n=mr[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 Vl(r){return z(r)||pr(r)||Ce(r)}function Tc(r,e){if(e!=null)return void(r.__key=e);it(),_a();const t=Pe(),n=Qt(),s=""+Sc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=Ol,r.__key=s}function hr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),i=r.getNextSibling();if(s===null)if(i!==null){const o=i.getWritable();n.__first=i.__key,o.__prev=null}else n.__first=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(i===null)if(s!==null){const o=s.getWritable();n.__last=s.__key,o.__next=null}else n.__last=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Xn(r){_a();const e=r.getLatest(),t=e.__parent,n=Qt(),s=Pe(),i=n._nodeMap,o=s._dirtyElements;t!==null&&function(l,u,c){let d=l;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,i,o);const a=e.__key;s._dirtyType=Ol,F(r)?o.set(a,!0):s._dirtyLeaves.add(a)}function Qe(r){it();const e=Pe(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Xe(t);n!==null&&n.getWritable()}if(r!==null){const n=Xe(r);n!==null&&n.getWritable()}}}function tr(){return An()?null:Pe()._compositionKey}function Xe(r,e){const t=(e||Qt())._nodeMap.get(r);return t===void 0?null:t}function Kl(r,e){const t=ys(r,Pe());return t!==void 0?Xe(t,e):null}function ys(r,e){return r[`__lexicalKey_${e._key}`]}function jr(r,e){let t=r;for(;t!=null;){const n=Kl(t,e);if(n!==null)return n;t=Cn(t)}return null}function Hl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function ho(r){return r.read(()=>Fe().getTextContent())}function Fe(){return Ql(Qt())}function Ql(r){return r._nodeMap.get("root")}function jt(r){it();const e=Qt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Tr(r){const e=Pe(),t=function(n,s){let i=n;for(;i!=null;){const o=ys(i,s);if(o!==void 0)return o;i=Cn(i)}return null}(r,e);return t===null?r===e.getRootElement()?Xe("root"):null:Xe(t)}function po(r,e){return e?r.getTextContentSize():0}function Jl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Li(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Yl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Xl(r){return r.nodeType===or?r.nodeValue:null}function Mi(r,e,t){const n=gt(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:i,focusOffset:o}=n;if(s!==null){let a=Xl(s);const l=jr(s);if(a!==null&&z(l)){if(a===gs&&t){const u=t.length;a=t,i=u,o=u}a!==null&&Pi(l,a,i,o,r)}}}function Pi(r,e,t,n,s){let i=r;if(i.isAttached()&&(s||!i.isDirty())){const o=i.isComposing();let a=e;(o||s)&&e[e.length-1]===gs&&(a=e.slice(0,-1));const l=i.getTextContent();if(s||a!==l){if(a===""){if(Qe(null),ps||bn||wi)i.remove();else{const m=Pe();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const u=i.getParent(),c=Sn(),d=i.getTextContentSize(),f=tr(),h=i.getKey();if(i.isToken()||f!==null&&h===f&&!o||O(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!o||c.focus.key===r.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!o))return void i.markDirty();const p=K();if(!O(p)||t===null||n===null)return void i.setTextContent(a);if(p.setTextNodeRange(i,t,i,n),i.isSegmented()){const m=Ge(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function Nc(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(i){const o=i.getPreviousSibling();return(z(o)||F(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function go(r){return r==="ArrowLeft"}function mo(r){return r==="ArrowRight"}function Xr(r,e){return vt?r:e}function yo(r){return r==="Enter"}function Vr(r){return r==="Backspace"}function Kr(r){return r==="Delete"}function xo(r,e,t){return r.toLowerCase()==="a"&&Xr(e,t)}function Bc(){const r=Fe();jt(Wl(r.select(0,r.getChildrenSize())))}function sn(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 i=Qn(s);return t[e]=i,i}return s}function ji(r,e,t,n,s){if(t.size===0)return;const i=n.__type,o=n.__key,a=e.get(i);a===void 0&&$(33,i);const l=a.klass;let u=r.get(l);u===void 0&&(u=new Map,r.set(l,u));const c=u.get(o),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(o,d?"updated":s)}function bo(r,e,t){const n=r.getParent();let s=t,i=r;return n!==null&&(e&&t===0?(s=i.getIndexWithinParent(),i=n):e||t!==i.getChildrenSize()||(s=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?s-1:s)}function pn(r,e){const t=r.offset;if(r.type==="element")return bo(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?bo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Zl(r){const e=bs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return wa(r,e,t)}function xs(r){return!tt(r)&&!r.isLastChild()&&!r.isInline()}function Zn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&$(75,e),t}function Cn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function on(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function bs(r){const e=r._window;return e===null&&$(78),e}function Fc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Ot(e))return e;e=e.getParentOrThrow()}return e}function Ot(r){return tt(r)||F(r)&&r.isShadowRoot()}function $t(r){const e=Pe(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&$(200,r.constructor.name,t);const{replace:s,replaceWithKlass:i}=n;if(s!==null){const o=s(r),a=o.constructor;return i!==null?o instanceof i||$(201,i.name,i.getType(),a.name,a.getType(),r.constructor.name,t):o instanceof r.constructor&&a!==r.constructor||$(202,a.name,a.getType(),r.constructor.name,t),o.__key===r.__key&&$(203,r.constructor.name,t,a.name,a.getType()),o}return r}function Ps(r,e){!tt(r.getParent())||F(e)||Ce(e)||$(99)}function js(r){return(Ce(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Oi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function Rc(r,e,t){let n=r._blockCursorElement;if(O(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,i=s.getNode(),o=s.offset;let a=!1,l=null;if(o===i.getChildrenSize())js(i.getChildAtIndex(o-1))&&(a=!0);else{const u=i.getChildAtIndex(o);if(u!==null&&js(u)){const c=u.getPreviousSibling();(c===null||js(c))&&(a=!0,l=r.getElementByKey(u.__key))}}if(a){const u=r.getElementByKey(i.__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=Qn(h);h=d.blockCursor=p}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(l===null?u.appendChild(n):u.insertBefore(n,l))}}n!==null&&Oi(n,r,e)}function gt(r){return At?(r||window).getSelection():null}function Lc(r){return Ht(r)&&r.tagName==="A"}function Ht(r){return r.nodeType===1}function _o(r){return r.nodeType===11}function Ys(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 es(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 Zt(r){if(Ce(r)&&!r.isInline())return!0;if(!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Hr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Mc(){return Pe()}const vo=new WeakMap,Pc=new Map;function jc(r){if(!r._readOnly&&r.isEmpty())return Pc;r._readOnly||$(192);let e=vo.get(r);if(!e){e=new Map,vo.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let i=e.get(s);i||(i=new Map,e.set(s,i)),i.set(t,n)}}return e}function Ii(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function $i(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function Oc(r){return r.__lexicalUnmanaged===!0}function ea(r,e,t,n,s,i){let o=r.getFirstChild();for(;o!==null;){const a=o.__key;o.__parent===e&&(F(o)&&ea(o,a,t,n,s,i),t.has(a)||i.delete(a),s.push(a)),o=o.getNextSibling()}}let ir,rt,gn,_s,Xs,Zs,yr,Et,ei,mn,Ve="",et="",Rt=null,Ct="",Vt="",ta=!1,yn=!1,zn=null;function ts(r,e){const t=yr.get(r);if(e!==null){const n=ni(r);n.parentNode===e&&e.removeChild(n)}if(Et.has(r)||rt._keyToDOMMap.delete(r),F(t)){const n=ns(t,yr);ti(n,0,n.length-1,null)}t!==void 0&&ji(mn,gn,_s,t,"destroyed")}function ti(r,e,t,n){let s=e;for(;s<=t;++s){const i=r[s];i!==void 0&&ts(i,n)}}function ur(r,e){r.setProperty("text-align",e)}const Ic="40px";function ra(r,e){const t=ir.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")||Ic;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function na(r,e){const t=r.style;e===0?ur(t,""):e===Ei?ur(t,"left"):e===Si?ur(t,"center"):e===Ai?ur(t,"right"):e===ki?ur(t,"justify"):e===Ti?ur(t,"start"):e===Ni&&ur(t,"end")}function rs(r,e){const t=Et.get(r);t===void 0&&$(60);const n=t.createDOM(ir,rt);if(function(s,i,o){const a=o._keyToDOMMap;(function(l,u,c){l[`__lexicalKey_${u._key}`]=c})(i,o,s),a.set(s,i)}(r,n,rt),z(t)?n.setAttribute("data-lexical-text","true"):Ce(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,i=t.__size;if(s!==0&&ra(n,s),i!==0){const a=i-1;(function(l,u,c,d){const f=et;et="",ri(l,c,0,u,c.getDOMSlot(d)),ia(c,d),et=f})(ns(t,Et),a,t,n)}const o=t.__format;o!==0&&na(n,o),t.isInline()||sa(null,t,n),xs(t)&&(Ve+=Kt,Vt+=Kt)}else{const s=t.getTextContent();if(Ce(t)){const i=t.decorate(rt,ir);i!==null&&oa(r,i),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(et+=s));Ve+=s,Vt+=s}return e!==null&&e.insertChild(n),ji(mn,gn,_s,t,"created"),n}function ri(r,e,t,n,s){const i=Ve;Ve="";let o=t;for(;o<=n;++o){rs(r[o],s);const a=Et.get(r[o]);a!==null&&z(a)&&(Rt===null&&(Rt=a.getFormat()),Ct===""&&(Ct=a.getStyle()))}xs(e)&&(Ve+=Kt),s.element.__lexicalTextContent=Ve,Ve=i+Ve}function Co(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return pr(n)?"line-break":Ce(n)&&n.isInline()?"decorator":null}return"empty"}return null}function sa(r,e,t){const n=Co(r,yr),s=Co(e,Et);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function ia(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==et||n!==zn){const i=et==="",o=i?zn:(s=et,pc.test(s)?"rtl":gc.test(s)?"ltr":null);if(o!==n){const a=e.classList,l=ir.theme;let u=n!==null?l[n]:void 0,c=o!==null?l[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Qn(u);u=l[n]=d}a.remove(...u)}if(o===null||i&&o==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Qn(c);c=l[o]=d}c!==void 0&&a.add(...c)}e.dir=o}yn||(r.getWritable().__dir=o)}zn=o,e.__lexicalDirTextContent=et,e.__lexicalDir=o}var s}function $c(r,e,t){const n=et;var s;et="",Rt=null,Ct="",function(i,o,a){const l=Ve,u=i.__size,c=o.__size;Ve="";const d=a.element;if(u===1&&c===1){const f=i.__first,h=o.__first;if(f===h)Zr(f,d);else{const m=ni(f),y=rs(h,null);try{d.replaceChild(y,m)}catch(w){if(typeof w=="object"&&w!=null){const x=`${w.toString()} Parent: ${d.tagName}, new child: {tag: ${y.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(x)}throw w}ts(f,null)}const p=Et.get(h);z(p)&&(Rt===null&&(Rt=p.getFormat()),Ct===""&&(Ct=p.getStyle()))}else{const f=ns(i,yr),h=ns(o,Et);if(f.length!==u&&$(227),h.length!==c&&$(228),u===0)c!==0&&ri(h,o,0,c-1,a);else if(c===0){if(u!==0){const p=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;ti(f,0,u-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,y,w,x,E){const D=w-1,A=x-1;let b,v,S=E.getFirstChild(),k=0,j=0;for(;k<=D&&j<=A;){const L=m[k],R=y[j];if(L===R)S=Os(Zr(R,E.element)),k++,j++;else{b===void 0&&(b=new Set(m)),v===void 0&&(v=new Set(y));const Q=v.has(L),se=b.has(R);if(Q)if(se){const xe=Zn(rt,R);xe===S?S=Os(Zr(R,E.element)):(E.withBefore(S).insertChild(xe),Zr(R,E.element)),k++,j++}else rs(R,E.withBefore(S)),j++;else S=Os(ni(L)),ts(L,E.element),k++}const P=Et.get(R);P!==null&&z(P)&&(Rt===null&&(Rt=P.getFormat()),Ct===""&&(Ct=P.getStyle()))}const T=k>D,B=j>A;if(T&&!B){const L=y[A+1],R=L===void 0?null:rt.getElementByKey(L);ri(y,p,j,A,E.withBefore(R))}else B&&!T&&ti(m,k,D,E.element)})(o,f,h,u,c,a)}xs(o)&&(Ve+=Kt),d.__lexicalTextContent=Ve,Ve=l+Ve}(r,e,e.getDOMSlot(t)),ia(e,t),Or(s=e)&&Rt!=null&&Rt!==s.__textFormat&&!yn&&(s.setTextFormat(Rt),s.setTextStyle(Ct)),function(i){Or(i)&&Ct!==""&&Ct!==i.__textStyle&&!yn&&i.setTextStyle(Ct)}(e),et=n}function ns(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 Zr(r,e){const t=yr.get(r);let n=Et.get(r);t!==void 0&&n!==void 0||$(61);const s=ta||Zs.has(r)||Xs.has(r),i=Zn(rt,r);if(t===n&&!s){if(F(t)){const o=i.__lexicalTextContent;o!==void 0&&(Ve+=o,Vt+=o);const a=i.__lexicalDirTextContent;a!==void 0&&(et+=a)}else{const o=t.getTextContent();z(t)&&!t.isDirectionless()&&(et+=o),Vt+=o,Ve+=o}return i}if(t!==n&&s&&ji(mn,gn,_s,n,"updated"),n.updateDOM(t,i,ir)){const o=rs(r,null);return e===null&&$(62),e.replaceChild(o,i),ts(r,null),o}if(F(t)&&F(n)){const o=n.__indent;o!==t.__indent&&ra(i,o);const a=n.__format;a!==t.__format&&na(i,a),s&&($c(t,n,i),tt(n)||n.isInline()||sa(t,n,i)),xs(n)&&(Ve+=Kt,Vt+=Kt)}else{const o=n.getTextContent();if(Ce(n)){const a=n.decorate(rt,ir);a!==null&&oa(r,a)}else z(n)&&!n.isDirectionless()&&(et+=o);Ve+=o,Vt+=o}if(!yn&&tt(n)&&n.__cachedText!==Vt){const o=n.getWritable();o.__cachedText=Vt,n=o}return i}function oa(r,e){let t=rt._pendingDecorators;const n=rt._decorators;if(t===null){if(n[r]===e)return;t=Hl(rt)}t[r]=e}function Os(r){let e=r.nextSibling;return e!==null&&e===rt._blockCursorElement&&(e=e.nextSibling),e}function zc(r,e,t,n,s,i){Ve="",Vt="",et="",ta=n===Pr,zn=null,rt=t,ir=t._config,gn=t._nodes,_s=rt._listeners.mutation,Xs=s,Zs=i,yr=r._nodeMap,Et=e._nodeMap,yn=e._readOnly,ei=new Map(t._keyToDOMMap);const o=new Map;return mn=o,Zr("root",null),rt=void 0,gn=void 0,Xs=void 0,Zs=void 0,yr=void 0,Et=void 0,ir=void 0,ei=void 0,mn=void 0,o}function ni(r){const e=ei.get(r);return e===void 0&&$(75,r),e}const Gt=Object.freeze({}),si=30,ii=[["keydown",function(r,e){if(ln=r.timeStamp,la=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:i,altKey:o}=r;if(!G(e,Vu,r)&&t!=null){if(function(a,l,u,c){return mo(a)&&!l&&!c&&!u}(t,s,o,i))G(e,Al,r);else if(function(a,l,u,c,d){return mo(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Ku,r);else if(function(a,l,u,c){return go(a)&&!l&&!c&&!u}(t,s,o,i))G(e,kl,r);else if(function(a,l,u,c,d){return go(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Hu,r);else if(function(a,l,u){return function(c){return c==="ArrowUp"}(a)&&!l&&!u}(t,s,i))G(e,Tl,r);else if(function(a,l,u){return function(c){return c==="ArrowDown"}(a)&&!l&&!u}(t,s,i))G(e,Nl,r);else if(function(a,l){return yo(a)&&l}(t,n))an=!0,G(e,Gn,r);else if(function(a){return a===" "}(t))G(e,Qu,r);else if(function(a,l){return vt&&l&&a.toLowerCase()==="o"}(t,s))r.preventDefault(),an=!0,G(e,Fr,!0);else if(function(a,l){return yo(a)&&!l}(t,n))an=!1,G(e,Gn,r);else if(function(a,l,u,c){return vt?!l&&!u&&(Vr(a)||a.toLowerCase()==="h"&&c):!(c||l||u)&&Vr(a)}(t,o,i,s))Vr(t)?G(e,Bl,r):(r.preventDefault(),G(e,fr,!0));else if(function(a){return a==="Escape"}(t))G(e,Fl,r);else if(function(a,l,u,c,d){return vt?!(u||c||d)&&(Kr(a)||a.toLowerCase()==="d"&&l):!(l||c||d)&&Kr(a)}(t,s,n,o,i))Kr(t)?G(e,Rl,r):(r.preventDefault(),G(e,fr,!1));else if(function(a,l,u){return Vr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!0);else if(function(a,l,u){return Kr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!1);else if(function(a,l){return vt&&l&&Vr(a)}(t,i))r.preventDefault(),G(e,hn,!0);else if(function(a,l){return vt&&l&&Kr(a)}(t,i))r.preventDefault(),G(e,hn,!1);else if(function(a,l,u,c){return a.toLowerCase()==="b"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"bold");else if(function(a,l,u,c){return a.toLowerCase()==="u"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"underline");else if(function(a,l,u,c){return a.toLowerCase()==="i"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"italic");else if(function(a,l,u,c){return a==="Tab"&&!l&&!u&&!c}(t,o,s,i))G(e,Ju,r);else if(function(a,l,u,c){return a.toLowerCase()==="z"&&!l&&Xr(u,c)}(t,n,i,s))r.preventDefault(),G(e,_i,void 0);else if(function(a,l,u,c){return vt?a.toLowerCase()==="z"&&u&&l:a.toLowerCase()==="y"&&c||a.toLowerCase()==="z"&&c&&l}(t,n,i,s))r.preventDefault(),G(e,vi,void 0);else{const a=e._editorState._selection;a===null||O(a)?!sr&&xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="c"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,hs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="x"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,Ci,r)):xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r))}(function(a,l,u,c){return a||l||u||c})(s,n,o,i)&&G(e,ic,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&ct(e,()=>{Ce(jr(t))||(li=!0)})}],["compositionstart",function(r,e){ct(e,()=>{const t=K();if(O(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Qe(n.key),(r.timeStamp<ln+si||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Rr,hc)}})}],["compositionend",function(r,e){sr?Qr=!0:ct(e,()=>{Is(e,r.data)})}],["input",function(r,e){r.stopPropagation(),ct(e,()=>{const t=K(),n=r.data,s=da(r);if(n!=null&&O(t)&&ca(t,s,n,r.timeStamp,!1)){Qr&&(Is(e,n),Qr=!1);const i=t.anchor.getNode(),o=gt(e._window);if(o===null)return;const a=t.isBackward(),l=a?t.anchor.offset:t.focus.offset,u=a?t.focus.offset:t.anchor.offset;Vn&&!t.isCollapsed()&&z(i)&&o.anchorNode!==null&&i.getTextContent().slice(0,l)+n+i.getTextContent().slice(l+u)===Xl(o.anchorNode)||G(e,Rr,n);const c=n.length;sr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),ps||bn||wi||!e.isComposing()||(ln=0,Qe(null))}else Mi(!1,e,n!==null?n:void 0),Qr&&(Is(e,n||void 0),Qr=!1);it(),ql(Pe())}),kr=null}],["click",function(r,e){ct(e,()=>{const t=K(),n=gt(e._window),s=Sn();if(n){if(O(t)){const i=t.anchor,o=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!tt(o)&&Fe().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(F(o)?o.select(0):o.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const i=n.anchorNode;if(i!==null){const o=i.nodeType;(o===_n||o===or)&&jt(qi(s,n,e,r))}}}G(e,Sl,r)})}],["cut",Gt],["copy",Gt],["dragstart",Gt],["dragover",Gt],["dragend",Gt],["paste",Gt],["focus",Gt],["blur",Gt],["drop",Gt]];Vn&&ii.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,i=da(t);s==="deleteCompositionText"||sr&&Zl(n)||s!=="insertCompositionText"&&ct(n,()=>{const o=K();if(s==="deleteContentBackward"){if(o===null){const h=Sn();if(!O(h))return;jt(h.clone())}if(O(o)){const h=o.anchor.key===o.focus.key;if(a=t.timeStamp,la==="MediaLast"&&a<ln+si&&n.isComposing()&&h){if(Qe(null),ln=0,setTimeout(()=>{ct(n,()=>{Qe(null)})},si),O(o)){const p=o.anchor.getNode();p.markDirty(),o.format=p.getFormat(),z(p)||$(142),o.style=p.getStyle()}}else{Qe(null),t.preventDefault();const p=o.anchor.getNode(),m=p.getTextContent(),y=p.canInsertTextAfter(),w=o.anchor.offset===0&&o.focus.offset===m.length;ac&&h&&!w&&y||G(n,fr,!0)}return}}var a;if(!O(o))return;const l=t.data;kr!==null&&Mi(!1,n,kr),o.dirty&&kr===null||!o.isCollapsed()||tt(o.anchor.getNode())||i===null||o.applyDOMRange(i),kr=null;const u=o.anchor,c=o.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Rr,t);break;case"insertFromComposition":Qe(null),G(n,Rr,t);break;case"insertLineBreak":Qe(null),G(n,Fr,!1);break;case"insertParagraph":Qe(null),an&&!bn?(an=!1,G(n,Fr,!1)):G(n,dn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,fs,t);break;case"deleteByComposition":(function(h,p){return h!==p||F(h)||F(p)||!h.isToken()||!p.isToken()})(d,f)&&G(n,Hs,t);break;case"deleteByDrag":case"deleteByCut":G(n,Hs,t);break;case"deleteContent":G(n,fr,!1);break;case"deleteWordBackward":G(n,fn,!0);break;case"deleteWordForward":G(n,fn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,hn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,hn,!1);break;case"formatStrikeThrough":G(n,Dt,"strikethrough");break;case"formatBold":G(n,Dt,"bold");break;case"formatItalic":G(n,Dt,"italic");break;case"formatUnderline":G(n,Dt,"underline");break;case"historyUndo":G(n,_i,void 0);break;case"historyRedo":G(n,vi,void 0)}else{if(l===`
|
|
64
|
+
`)t.preventDefault(),G(n,Fr,!1);else if(l===Kt)t.preventDefault(),G(n,dn,void 0);else if(l==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(h)}else l!=null&&ca(o,i,l,t.timeStamp,!0)?(t.preventDefault(),G(n,Rr,l)):kr=l;aa=t.timeStamp}})}(r,e)]);let ln=0,la=null,aa=0,kr=null;const ss=new WeakMap;let oi=!1,li=!1,an=!1,Qr=!1,ua=[0,"",0,"root",0];function ca(r,e,t,n,s){const i=r.anchor,o=r.focus,a=i.getNode(),l=Pe(),u=gt(l._window),c=u!==null?u.anchorNode:null,d=i.key,f=l.getElementByKey(d),h=t.length;return d!==o.key||!z(a)||(!s&&(!Vn||aa<n+50)||a.isDirty()&&h<2||Jl(t))&&i.offset!==o.offset&&!a.isComposing()||cr(a)||a.isDirty()&&h>1||(s||!Vn)&&f!==null&&!a.isComposing()&&c!==Jn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||a.getFormat()!==r.format||a.getStyle()!==r.style||Nc(r,a)}function wo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===or&&e!==0&&e!==r.nodeValue.length}function Do(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r;oi&&(oi=!1,wo(n,s)&&wo(i,o))||ct(e,()=>{if(!t)return void jt(null);if(!vn(e,n,i))return;const a=K();if(O(a)){const l=a.anchor,u=l.getNode();if(a.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(a.dirty=!0);const c=bs(e).event,d=c?c.timeStamp:performance.now(),[f,h,p,m,y]=ua,w=Fe(),x=e.isComposing()===!1&&w.getTextContent()==="";if(d<y+200&&l.offset===p&&l.key===m)a.format=f,a.style=h;else if(l.type==="text")z(u)||$(141),a.format=u.getFormat(),a.style=u.getStyle();else if(l.type==="element"&&!x){const E=l.getNode();a.style="",E instanceof $r&&E.getChildrenSize()===0?(a.format=E.getTextFormat(),a.style=E.getTextStyle()):a.format=0}}else{const c=l.key,d=a.focus.key,f=a.getNodes(),h=f.length,p=a.isBackward(),m=p?o:s,y=p?s:o,w=p?d:c,x=p?c:d;let E=fc,D=!1;for(let A=0;A<h;A++){const b=f[A],v=b.getTextContentSize();if(z(b)&&v!==0&&!(A===0&&b.__key===w&&m===v||A===h-1&&b.__key===x&&y===0)&&(D=!0,E&=b.getFormat(),E===0))break}a.format=D?E:0}}G(e,bi,void 0)})}function da(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function Is(r,e){const t=r._compositionKey;if(Qe(null),t!==null&&e!=null){if(e===""){const n=Xe(t),s=Jn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&z(n)&&Pi(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
65
|
+
`){const n=K();if(O(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,Gn,null)}}}Mi(!0,r,e)}function fa(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Lr=new Map;function ha(r){const e=r.target,t=gt(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=Gl(t.anchorNode);if(n===null)return;li&&(li=!1,ct(n,()=>{const u=Sn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==_n&&d!==or||jt(qi(u,t,n,r))}));const s=Li(n),i=s[s.length-1],o=i._key,a=Lr.get(o),l=a||i;l!==n&&Do(t,l,!1),Do(t,n,!0),n!==i?Lr.set(o,n):a&&Lr.delete(o)}function Eo(r){r._lexicalHandled=!0}function So(r){return r._lexicalHandled===!0}function qc(r){const e=r.ownerDocument,t=ss.get(e);t===void 0&&$(162);const n=t-1;n>=0||$(164),ss.set(e,n),n===0&&e.removeEventListener("selectionchange",ha);const s=ms(r);Ri(s)?(function(o){if(o._parentEditor!==null){const a=Li(o),l=a[a.length-1]._key;Lr.get(l)===o&&Lr.delete(l)}else Lr.delete(o._key)}(s),r.__lexicalEditor=null):s&&$(198);const i=fa(r);for(let o=0;o<i.length;o++)i[o]();r.__lexicalEventHandles=[]}function ai(r,e,t){it();const n=r.__key,s=r.getParent();if(s===null)return;const i=function(a){const l=K();if(!O(l)||!F(a))return l;const{anchor:u,focus:c}=l,d=u.getNode(),f=c.getNode();return on(d,a)&&u.set(a.__key,0,"element"),on(f,a)&&c.set(a.__key,0,"element"),l}(r);let o=!1;if(O(i)&&e){const a=i.anchor,l=i.focus;a.key===n&&(os(a,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0),l.key===n&&(os(l,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0)}else Lt(i)&&e&&r.isSelected()&&r.selectPrevious();if(O(i)&&e&&!o){const a=r.getIndexWithinParent();hr(r),is(i,s,a,-1)}else hr(r);t||Ot(s)||s.canBeEmpty()||!s.isEmpty()||ai(s,e),e&&tt(s)&&s.isEmpty()&&s.selectEnd()}class vs{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,Tc(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=Xe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||K();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(z(this))return n;if(O(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Ce(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,o=i.getNode();if(i.offset===o.getChildrenSize()&&o.is(s)&&o.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:Xe(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(Ot(t))return F(e)||e===this&&Ce(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:Xe(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:Xe(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,i=n.length;if(s===0||i===0||t[s-1]!==n[i-1])return null;const o=new Set(n);for(let a=0;a<s;a++){const l=t[a];if(o.has(l))return l}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,i=this;for(;;){const o=i.getParentOrThrow();if(o===t){n=i.getIndexWithinParent();break}i=o}for(i=e;;){const o=i.getParentOrThrow();if(o===t){s=i.getIndexWithinParent();break}i=o}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 i=this;for(;i!==null;){const o=i.__key;if(s.has(o)||(s.add(o),n.push(i)),i===e)break;const a=F(i)?t?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}const u=i.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);i=c}return t||n.reverse(),n}isDirty(){const e=Pe()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=Xe(this.__key);return e===null&&$(113),e}getWritable(){it();const e=Qt(),t=Pe(),n=e._nodeMap,s=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,a=K();if(a!==null&&a.setCachedNodes(null),o.has(s))return Xn(i),i;const l=Ii(i);return o.add(s),Xn(l),n.set(s,l),l}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){ai(this,!0,e)}replace(e,t){it();let n=K();n!==null&&(n=n.clone()),Ps(this,e);const s=this.getLatest(),i=this.__key,o=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),u=l.__size;hr(a);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,p=s.__parent;if(ai(s,!1,!0),c===null?l.__first=o:c.getWritable().__next=o,a.__prev=f,d===null?l.__last=o:d.getWritable().__prev=o,a.__next=h,a.__parent=p,l.__size=u,t&&(F(this)&&F(a)||$(139),this.getChildren().forEach(m=>{a.append(m)})),O(n)){jt(n);const m=n.anchor,y=n.focus;m.key===i&&No(m,a),y.key===i&&No(y,a)}return tr()===i&&Qe(o),a}insertAfter(e,t=!0){it(),Ps(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.getParent(),o=K();let a=!1,l=!1;if(i!==null){const h=e.getIndexWithinParent();if(hr(s),O(o)){const p=i.__key,m=o.anchor,y=o.focus;a=m.type==="element"&&m.key===p&&m.offset===h+1,l=y.type==="element"&&y.key===p&&y.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&&O(o)){const h=this.getIndexWithinParent();is(o,c,h+1);const p=c.__key;a&&o.anchor.set(p,h+2,"element"),l&&o.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){it(),Ps(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.__key;hr(s);const o=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=n.__prev,u=this.getIndexWithinParent();o===null?a.__first=i:o.getWritable().__next=i,a.__size++,n.__prev=i,s.__prev=l,s.__next=n.__key,s.__parent=n.__parent;const c=K();return t&&O(c)&&is(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return Ue()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){it();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!z(n)){const i=n.getIndexWithinParent()+1;return s.select(i,i)}return n.select(e,t)}selectNext(e,t){it();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!z(n)){const i=n.getIndexWithinParent();return s.select(i,i)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class wn extends vs{static getType(){return"linebreak"}static clone(e){return new wn(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&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s)){const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s))return!1;const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}return!1}(e)?null:{conversion:Uc,priority:0}}}static importJSON(e){return xr()}exportJSON(){return{type:"linebreak",version:1}}}function Uc(r){return{node:xr()}}function xr(){return $t(new wn)}function pr(r){return r instanceof wn}function Ln(r){return r.nodeType===or&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function $s(r,e){return 16&e?"code":e&Di?"mark":32&e?"sub":64&e?"sup":null}function zs(r,e){return 1&e?"strong":2&e?"em":"span"}function pa(r,e,t,n,s){const i=n.classList;let o=sn(s,"base");o!==void 0&&i.add(...o),o=sn(s,"underlineStrikethrough");let a=!1;const l=e&Hn&&e&Kn;o!==void 0&&(t&Hn&&t&Kn?(a=!0,l||i.add(...o)):l&&i.remove(...o));for(const u in mr){const c=mr[u];if(o=sn(s,u),o!==void 0)if(t&c){if(a&&(u==="underline"||u==="strikethrough")){e&c&&i.remove(...o);continue}e&c&&(!l||u!=="underline")&&u!=="strikethrough"||i.add(...o)}else e&c&&i.remove(...o)}}function ga(r,e,t){const n=e.firstChild,s=t.isComposing(),i=r+(s?gs:"");if(n==null)e.textContent=i;else{const o=n.nodeValue;if(o!==i)if(s||sr){const[a,l,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)]}(o,i);l!==0&&n.deleteData(a,l),n.insertData(a,u)}else n.nodeValue=i}}function Ao(r,e,t,n,s,i){ga(s,r,e);const o=i.theme.text;o!==void 0&&pa(0,0,n,r,o)}function Mn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Ir extends vs{static getType(){return"text"}static clone(e){return new Ir(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 bc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===tr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=mr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Yn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=$s(0,n),i=zs(0,n),o=s===null?i:s,a=document.createElement(o);let l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),s!==null&&(l=document.createElement(i),a.appendChild(l)),Ao(l,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,t,n){const s=this.__text,i=e.__format,o=this.__format,a=$s(0,i),l=$s(0,o),u=zs(0,i),c=zs(0,o);if((a===null?u:a)!==(l===null?c:l))return!0;if(a===l&&u!==c){const m=t.firstChild;m==null&&$(48);const y=document.createElement(c);return Ao(y,this,0,o,s,n),t.replaceChild(y,m),!1}let d=t;l!==null&&a!==null&&(d=t.firstChild,d==null&&$(49)),ga(s,d,this);const f=n.theme.text;f!==void 0&&i!==o&&pa(0,i,o,d,f);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Kc,priority:0}),b:()=>({conversion:Gc,priority:0}),code:()=>({conversion:Xt,priority:0}),em:()=>({conversion:Xt,priority:0}),i:()=>({conversion:Xt,priority:0}),s:()=>({conversion:Xt,priority:0}),span:()=>({conversion:Wc,priority:0}),strong:()=>({conversion:Xt,priority:0}),sub:()=>({conversion:Xt,priority:0}),sup:()=>({conversion:Xt,priority:0}),u:()=>({conversion:Xt,priority:0})}}static importJSON(e){const t=Ge(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&&Ht(t)||$(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Mn(t,"b")),this.hasFormat("italic")&&(t=Mn(t,"i")),this.hasFormat("strikethrough")&&(t=Mn(t,"s")),this.hasFormat("underline")&&(t=Mn(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"?mr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?mc[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Yn(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=xc[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){it();let n=e,s=t;const i=K(),o=this.getTextContent(),a=this.__key;if(typeof o=="string"){const l=o.length;n===void 0&&(n=l),s===void 0&&(s=l)}else n=0,s=0;if(!O(i))return xa(a,n,a,s,"text","text");{const l=tr();l!==i.anchor.key&&l!==i.focus.key||Qe(a),i.setTextNodeRange(this,n,this,s)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const i=this.getWritable(),o=i.__text,a=n.length;let l=e;l<0&&(l=a+l,l<0&&(l=0));const u=K();if(s&&O(u)){const d=e+a;u.setTextNodeRange(i,d,i,d)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){it();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,i=tr(),o=new Set(e),a=[],l=n.length;let u="";for(let A=0;A<l;A++)u!==""&&o.has(A)&&(a.push(u),u=""),u+=n[A];u!==""&&a.push(u);const c=a.length;if(c===0)return[];if(a[0]===n)return[t];const d=a[0],f=t.getParent();let h;const p=t.getFormat(),m=t.getStyle(),y=t.__detail;let w=!1;t.isSegmented()?(h=Ge(d),h.__format=p,h.__style=m,h.__detail=y,w=!0):(h=t.getWritable(),h.__text=d);const x=K(),E=[h];let D=d.length;for(let A=1;A<c;A++){const b=a[A],v=b.length,S=Ge(b).getWritable();S.__format=p,S.__style=m,S.__detail=y;const k=S.__key,j=D+v;if(O(x)){const T=x.anchor,B=x.focus;T.key===s&&T.type==="text"&&T.offset>D&&T.offset<=j&&(T.key=k,T.offset-=D,x.dirty=!0),B.key===s&&B.type==="text"&&B.offset>D&&B.offset<=j&&(B.key=k,B.offset-=D,x.dirty=!0)}i===s&&Qe(k),D=j,E.push(S)}if(f!==null){(function(v){const S=v.getPreviousSibling(),k=v.getNextSibling();S!==null&&Xn(S),k!==null&&Xn(k)})(this);const A=f.getWritable(),b=this.getIndexWithinParent();w?(A.splice(b,0,E),this.remove()):A.splice(b,1,E),O(x)&&is(x,f,b,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||$(50);const n=this.__key,s=e.__key,i=this.__text,o=i.length;tr()===s&&Qe(n);const a=K();if(O(a)){const d=a.anchor,f=a.focus;d!==null&&d.key===s&&(jo(d,t,n,e,o),a.dirty=!0),f!==null&&f.key===s&&(jo(f,t,n,e,o),a.dirty=!0)}const l=e.__text,u=t?l+i:i+l;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Wc(r){return{forChild:zi(r.style),node:null}}function Gc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:zi(e.style,t?void 0:"bold"),node:null}}const ko=new WeakMap;function Vc(r){return r.nodeName==="PRE"||r.nodeType===_n&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Kc(r){const e=r;r.parentElement===null&&$(129);let t=e.textContent||"";if(function(n){let s,i=n.parentNode;const o=[n];for(;i!==null&&(s=ko.get(i))===void 0&&!Vc(i);)o.push(i),i=i.parentNode;const a=s===void 0?i:s;for(let l=0;l<o.length;l++)ko.set(o[l],a);return a}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],i=n.length;for(let o=0;o<i;o++){const a=n[o];a===`
|
|
67
|
+
`||a===`\r
|
|
68
|
+
`?s.push(xr()):a===" "?s.push(En()):a!==""&&s.push(Ge(a))}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=To(n,!1))!==null;){const i=n.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(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=To(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:Ge(t)}}function To(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=n,t.nodeType===_n){const i=t.style.display;if(i===""&&!Ys(t)||i!==""&&!i.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===or)return t;if(t.nodeName==="BR")return null}}const Hc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Xt(r){const e=Hc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:zi(r.style,e),node:null}}function Ge(r=""){return $t(new Ir(r))}function z(r){return r instanceof Ir}function zi(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",i=n.includes("line-through"),o=r.fontStyle==="italic",a=n.includes("underline"),l=r.verticalAlign;return u=>(z(u)&&(s&&!u.hasFormat("bold")&&u.toggleFormat("bold"),i&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),o&&!u.hasFormat("italic")&&u.toggleFormat("italic"),a&&!u.hasFormat("underline")&&u.toggleFormat("underline"),l!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),l!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class Dn extends Ir{static getType(){return"tab"}static clone(e){return new Dn(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=En();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 En(){return $t(new Dn)}function Qc(r){return r instanceof Dn}class Jc{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,i=e.offset;if(F(t)){const o=t.getDescendantByIndex(s);t=o??t}if(F(n)){const o=n.getDescendantByIndex(i);n=o??n}return t===n?s<i:t.isBefore(n)}getNode(){const e=Xe(this.key);return e===null&&$(20),e}set(e,t,n){const s=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,An()||(tr()===i&&Qe(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function It(r,e,t){return new Jc(r,e,t)}function qs(r,e){let t=e.__key,n=r.offset,s="element";if(z(e)){s="text";const i=e.getTextContentSize();n>i&&(n=i)}else if(!F(e)){const i=e.getNextSibling();if(z(i))t=i.__key,n=0,s="text";else{const o=e.getParent();o&&(t=o.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function No(r,e){if(F(e)){const t=e.getLastDescendant();F(t)||z(t)?qs(r,t):qs(r,e)}else qs(r,e)}function er(r,e,t,n){r.key=e,r.offset=t,r.type=n}class Cs{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Lt(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 Cs(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 i;if(z(s))i=s.select();else{const o=s.getIndexWithinParent()+1;i=s.getParentOrThrow().select(o,o)}i.insertNodes(e);for(let o=0;o<n;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const i=Xe(s);i!==null&&n.push(i)}return An()||(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 O(r){return r instanceof lr}class lr{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!!O(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),i=s?t:n,o=s?n:t;let a=i.getNode(),l=o.getNode();const u=i.offset,c=o.offset;if(F(a)){const f=a.getDescendantByIndex(u);a=f??a}if(F(l)){let f=l.getDescendantByIndex(c);f!==null&&f!==a&&l.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),l=f??l}let d;return d=a.is(l)?F(a)&&a.getChildrenSize()>0?[]:[a]:a.getNodesBetween(l),An()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){er(this.anchor,e.__key,t,"text"),er(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,i=this.focus,o=s.isBefore(i),[a,l]=ui(this);let u="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(F(f)&&!f.isInline())c||(u+=`
|
|
69
|
+
`),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&i.type==="element"&&i.offset!==s.offset||(h=a<l?h.slice(a,l):h.slice(l,a)):h=o?h.slice(a):h.slice(l):f===n&&(h=o?h.slice(0,l):h.slice(0,a)),u+=h}else!Ce(f)&&!pr(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=Pe(),n=t.getEditorState()._selection,s=ya(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[i,o]=s;er(this.anchor,i.key,i.offset,i.type),er(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new lr(It(e.key,e.offset,e.type),It(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Yn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=mr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let i=0;i<s;i++){const o=t[i];o===`
|
|
70
|
+
`||o===`\r
|
|
71
|
+
`?n.push(xr()):o===" "?n.push(En()):n.push(Ge(o))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,i=this.style;let o=t,a=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,a=t),o.type==="element"&&function(y,w,x,E){const D=y.getNode(),A=D.getChildAtIndex(y.offset),b=Ge(),v=tt(D)?Ue().append(b):b;b.setFormat(x),b.setStyle(E),A===null?D.append(v):A.insertBefore(v),y.is(w)&&w.set(b.__key,0,"text"),y.set(b.__key,0,"text")}(o,a,s,i);const l=o.offset;let u=a.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||$(26);const h=f.getTextContent().length,p=f.getParentOrThrow();let m=c[d-1];if(d===1&&a.type==="element"&&(u=h,a.set(o.key,u,"text")),this.isCollapsed()&&l===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(z(y)&&y.canInsertTextBefore()&&!cr(y)||(y=Ge(),y.setFormat(s),y.setStyle(i),p.canInsertTextAfter()?f.insertAfter(y):p.insertAfter(y)),y.select(0,0),f=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(z(y)&&!cr(y)||(y=Ge(),y.setFormat(s),p.canInsertTextBefore()?f.insertBefore(y):p.insertBefore(y)),y.select(),f=y,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&l!==h){const y=Ge(f.getTextContent());y.setFormat(s),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){const y=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||F(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),ma(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ge(e);return E.select(),void f.replace(E)}const y=f.getFormat(),w=f.getStyle();if(l!==u||y===s&&w===i){if(Qc(f)){const E=Ge(e);return E.setFormat(s),E.setStyle(i),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ge(e);if(E.setFormat(s),E.setStyle(i),E.select(),l===0)f.insertBefore(E,!1);else{const[D]=f.splitText(l);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(i)}const x=u-l;f=f.spliceText(l,x,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=w))}else{const y=new Set([...f.getParentKeys(),...m.getParentKeys()]),w=F(f)?f:f.getParentOrThrow();let x=F(m)?m:m.getParentOrThrow(),E=m;if(!w.is(x)&&x.isInline())do E=x,x=x.getParentOrThrow();while(x.isInline());if(a.type==="text"&&(u!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ge(m.getTextContent());m.replace(S),m=S}tt(a.getNode())||a.type!=="text"||(m=m.spliceText(0,u,"")),y.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else y.add(m.__key);const D=x.getChildren(),A=new Set(c),b=w.is(x),v=w.isInline()&&f.getNextSibling()===null?w:f;for(let S=D.length-1;S>=0;S--){const k=D[S];if(k.is(f)||F(k)&&k.isParentOf(f))break;k.isAttached()&&(!A.has(k)||k.is(E)?b||v.insertAfter(k,!1):k.remove())}if(!b){let S=x,k=null;for(;S!==null;){const j=S.getChildren(),T=j.length;(T===0||j[T-1].is(k))&&(y.delete(S.__key),k=S),S=S.getParent()}}if(f.isToken())if(l===h)f.select();else{const S=Ge(e);S.select(),f.replace(S)}else f=f.spliceText(l,h-l,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const k=c[S],j=k.__key;y.has(j)||k.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,i=this.isBackward()?e:t;let o=s.getNode(),a=i.getNode();const l=Hr(o,Zt),u=Hr(a,Zt);z(o)&&o.isToken()&&s.offset<o.getTextContentSize()&&(s.offset=0),i.offset>0&&z(a)&&a.isToken()&&(i.offset=a.getTextContentSize()),n.forEach(d=>{on(o,d)||on(a,d)||d.getKey()===o.getKey()||d.getKey()===a.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&cr(d)){const h=Ge(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(o===a&&z(o)){const d=Math.abs(t.offset-e.offset);return o.spliceText(s.offset,d,"",!0),void c(o,d)}if(z(o)){const d=o.getTextContentSize()-s.offset;o.spliceText(s.offset,d,""),o=c(o,d)||o}z(a)&&(a.spliceText(0,i.offset,""),a=c(a,i.offset)||a),o.isAttached()&&z(o)?o.selectEnd():a.isAttached()&&z(a)&&a.selectStart(),F(l)&&F(u)&&l!==u&&(l.append(...u.getChildren()),u.remove(),i.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Qe(null);const n=this.getNodes(),s=[];for(const D of n)z(D)&&s.push(D);const i=D=>{n.forEach(A=>{if(Or(A)){const b=A.getFormatFlags(e,D);A.setTextFormat(b)}})},o=s.length;if(o===0)return this.toggleFormat(e),Qe(null),void i(t);const a=this.anchor,l=this.focus,u=this.isBackward(),c=u?l:a,d=u?a:l;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);i(m);const y=o-1;let w=s[y];const x=d.type==="text"?d.offset:w.getTextContentSize();if(h.is(w)){if(p===x)return;if(cr(h)||p===0&&x===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(p,x),A=p===0?D[0]:D[1];A.setFormat(m),c.type==="text"&&c.set(A.__key,0,"text"),d.type==="text"&&d.set(A.__key,x-p,"text")}return void(this.format=m)}p===0||cr(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=w.getFormatFlags(e,m);x>0&&(x===w.getTextContentSize()||cr(w)||([w]=w.splitText(x)),w.setFormat(E));for(let D=f+1;D<y;D++){const A=s[D],b=A.getFormatFlags(e,E);A.setFormat(b)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(w.__key,x,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=K();return O(p)||$(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Hr(t,Zt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=Us(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(F(p)||Ce(p))&&!p.isInline())){F(n)||$(211,t.constructor.name,t.getType());const p=Us(this);return n.splice(p,0,e),void s.selectEnd()}const i=function(p){const m=Ue();let y=null;for(let w=0;w<p.length;w++){const x=p[w],E=pr(x);if(E||Ce(x)&&x.isInline()||F(x)&&x.isInline()||z(x)||x.isParentRequired()){if(y===null&&(y=x.createParentElementNode(),m.append(y),E))continue;y!==null&&y.append(x)}else m.append(x),y=null}return m}(e),o=i.getLastDescendant(),a=i.getChildren(),l=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=a[a.length-1];let c=a[0];var d;F(d=c)&&Zt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||$(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=a[1]),c&&(n===null&&$(212,t.constructor.name,t.getType()),function(p,m,y){const w=m.getParentOrThrow().getLastChild();let x=m;const E=[m];for(;x!==w;)x.getNextSibling()||$(140),x=x.getNextSibling(),E.push(x);let D=p;for(const A of E)D=D.insertAfter(A)}(n,c));const f=Hr(o,Zt);l&&F(f)&&(l.canMergeWhenEmpty()||Zt(u))&&(f.append(...l.getChildren()),l.remove()),F(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=F(n)?n.getLastChild():null;pr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=Ue();return Fe().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Us(this),t=Hr(this.anchor.getNode(),Zt);F(t)||$(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...s),i.selectStart(),i):null}insertLineBreak(e){const t=xr();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,i=this.focus;let o=e[0],a=e[n];const[l,u]=ui(this);if(t===0)return[];if(t===1){if(z(o)&&!this.isCollapsed()){const d=l>u?u:l,f=l>u?l:u,h=o.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[o]}const c=s.isBefore(i);if(z(o)){const d=c?l:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(z(a)){const d=a.getTextContent().length,f=c?u:l;f===0?e.pop():f!==d&&([a]=a.splitText(f),e[n]=a)}return e}modify(e,t,n){const s=this.focus,i=this.anchor,o=e==="move",a=pn(s,t);if(Ce(a)&&!a.isIsolated()){if(o&&a.isKeyboardSelectable()){const h=Mo();return h.add(a.__key),void jt(h)}const f=t?a.getPreviousSibling():a.getNextSibling();if(z(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(o&&i.set(h,p,"text"))}{const h=a.getParentOrThrow();let p,m;return F(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=a.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(o&&i.set(m,p,"element"))}}const l=Pe(),u=gt(l._window);if(!u)return;const c=l._blockCursorElement,d=l._rootElement;if(d===null||c===null||!F(a)||a.isInline()||a.canBeEmpty()||Oi(c,l,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=tt(h)?h:Fc(h);if(this.applyDOMRange(f),this.dirty=!0,!o){const m=this.getNodes(),y=[];let w=!1;for(let x=0;x<m.length;x++){const E=m[x];on(E,p)?y.push(E):w=!0}if(w&&y.length>0)if(t){const x=y[0];F(x)?x.selectStart():x.getParentOrThrow().selectStart()}else{const x=y[y.length-1];F(x)?x.selectEnd():x.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(x){const E=x.focus,D=x.anchor,A=D.key,b=D.offset,v=D.type;er(D,E.key,E.offset,E.type),er(E,A,b,v),x._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(),i=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(i)&&i.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 i=this.focus,o=pn(i,e);if(Ce(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const a=Mo();a.add(o.__key),jt(a)}else o.remove(),Pe().dispatchCommand(bi,void 0);return}if(!e&&F(o)&&F(s)&&s.isEmpty())return s.remove(),void o.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 a=i.type==="text"?i.getNode():null;if(s=n.type==="text"?n.getNode():null,a!==null&&a.isSegmented()){const l=i.offset,u=a.getTextContentSize();if(a.is(s)||e&&l!==u||!e&&l!==0)return void Fo(a,e,l)}else if(s!==null&&s.isSegmented()){const l=n.offset,u=s.getTextContentSize();if(s.is(a)||e&&l!==0||!e&&l!==u)return void Fo(s,e,l)}(function(l,u){const c=l.anchor,d=l.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const p=c.offset,m=d.offset,y=p<m,w=y?p:m,x=y?m:p,E=x-1;w!==E&&(Jl(f.getTextContent().slice(w,x))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&tt(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 Lt(r){return r instanceof Cs}function Bo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ui(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]:[Bo(t),Bo(n)]}function Fo(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),i=s.length;let o=0,a=0;for(let u=0;u<i;u++){const c=u===i-1;if(a=o,o+=s[u].length,e&&o===t||o>t||c){s.splice(u,1),c&&(a=void 0);break}}const l=s.join("").trim();l===""?n.remove():(n.setTextContent(l),n.select(a,a))}function Ro(r,e,t,n){let s,i=e;if(r.nodeType===_n){let o=!1;const a=r.childNodes,l=a.length,u=n._blockCursorElement;i===l&&(o=!0,i=l-1);let c=a[i],d=!1;if(c===u)c=a[i+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&i--}if(s=Tr(c),z(s))i=po(s,o);else{let f=Tr(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&$(214),[f,i]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||$(215),o&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(i);if(F(m)&&function(y,w,x){const E=y.getParent();return x===null||E===null||!E.canBeEmpty()||E!==x.getNode()}(m,0,t)){const y=o?m.getLastDescendant():m.getFirstDescendant();y===null?f=m:(m=y,f=F(m)?m:m.getParentOrThrow()),i=0}z(m)?(s=m,f=null,i=po(m,o)):m!==f&&o&&!d&&(F(f)||$(216),i=Math.min(f.getChildrenSize(),i+1))}else{const h=f.getIndexWithinParent();i=e===0&&Ce(f)&&Tr(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return It(f.__key,i,"element")}}else s=Tr(r);return z(s)?It(s.__key,i,"text"):null}function Lo(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const i=s.getPreviousSibling(),o=s.getParent();if(e){if((t||!e)&&i===null&&F(o)&&o.isInline()){const a=o.getPreviousSibling();z(a)&&(r.key=a.__key,r.offset=a.getTextContent().length)}}else F(i)&&!t&&i.isInline()?(r.key=i.__key,r.offset=i.getChildrenSize(),r.type="element"):z(i)&&(r.key=i.__key,r.offset=i.getTextContent().length)}else if(n===s.getTextContent().length){const i=s.getNextSibling(),o=s.getParent();if(e&&F(i)&&i.isInline())r.key=i.__key,r.offset=0,r.type="element";else if((t||e)&&i===null&&F(o)&&o.isInline()&&!o.canInsertTextAfter()){const a=o.getNextSibling();z(a)&&(r.key=a.__key,r.offset=0)}}}function ma(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Lo(r,n,s),Lo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const i=Pe();if(i.isComposing()&&i._compositionKey!==r.key&&O(t)){const o=t.anchor,a=t.focus;er(r,o.key,o.offset,o.type),er(e,a.key,a.offset,a.type)}}}function ya(r,e,t,n,s,i){if(r===null||t===null||!vn(s,r,t))return null;const o=Ro(r,e,O(i)?i.anchor:null,s);if(o===null)return null;const a=Ro(t,n,O(i)?i.focus:null,s);if(a===null)return null;if(o.type==="element"&&a.type==="element"){const l=Tr(r),u=Tr(t);if(Ce(l)&&Ce(u))return null}return ma(o,a,i),[o,a]}function ci(r){return F(r)&&!r.isInline()}function xa(r,e,t,n,s,i){const o=Qt(),a=new lr(It(r,e,s),It(t,n,i),0,"");return a.dirty=!0,o._selection=a,a}function Yc(){const r=It("root",0,"element"),e=It("root",0,"element");return new lr(r,e,0,"")}function Mo(){return new Cs(new Set)}function qi(r,e,t,n){const s=t._window;if(s===null)return null;const i=n||s.event,o=i?i.type:void 0,a=o==="selectionchange",l=!Js&&(a||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o==="drop"||o===void 0);let u,c,d,f;if(O(r)&&!l)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,a&&O(r)&&!vn(t,u,c))return r.clone();const h=ya(u,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new lr(p,m,O(r)?r.format:0,O(r)?r.style:"")}function K(){return Qt()._selection}function Sn(){return Pe()._editorState._selection}function is(r,e,t,n=1){const s=r.anchor,i=r.focus,o=s.getNode(),a=i.getNode();if(!e.is(o)&&!e.is(a))return;const l=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(l,c,"element"),i.set(l,c,"element"),Po(r)}}else{const u=r.isBackward(),c=u?i:s,d=c.getNode(),f=u?s:i,h=f.getNode();if(e.is(d)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(l,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(l,Math.max(0,p+n),"element")}}Po(r)}function Po(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,i=e.getNode(),o=n.getNode();if(r.isCollapsed()){if(!F(i))return;const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(i)){const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(o)){const a=o.getChildrenSize(),l=s>=a,u=l?o.getChildAtIndex(a-1):o.getChildAtIndex(s);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function os(r,e,t,n,s){let i=null,o=0,a=null;n!==null?(i=n.__key,z(n)?(o=n.getTextContentSize(),a="text"):F(n)&&(o=n.getChildrenSize(),a="element")):s!==null&&(i=s.__key,z(s)?a="text":F(s)&&(a="element")),i!==null&&a!==null?r.set(i,o,a):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),r.set(t.__key,o,"element"))}function jo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Xc(r,e,t,n,s,i,o){const a=n.anchorNode,l=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==i||d!==null&&Fi(d))return;if(!O(e))return void(r!==null&&vn(t,a,l)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,y=Zn(t,p),w=Zn(t,m),x=f.offset,E=h.offset,D=e.format,A=e.style,b=e.isCollapsed();let v=y,S=w,k=!1;if(f.type==="text"){v=Jn(y);const P=f.getNode();k=P.getFormat()!==D||P.getStyle()!==A}else O(r)&&r.anchor.type==="text"&&(k=!0);var j,T,B,L,R;if(h.type==="text"&&(S=Jn(w)),v!==null&&S!==null&&(b&&(r===null||k||O(r)&&(r.format!==D||r.style!==A))&&(j=D,T=A,B=x,L=p,R=performance.now(),ua=[j,T,B,L,R]),u!==x||c!==E||a!==v||l!==S||n.type==="Range"&&b||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(v,x,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){const P=e instanceof lr&&e.anchor.type==="element"?v.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(P!==null){let Q;if(P instanceof Text){const se=document.createRange();se.selectNode(P),Q=se.getBoundingClientRect()}else Q=P.getBoundingClientRect();(function(se,xe,oe){const Se=oe.ownerDocument,he=Se.defaultView;if(he===null)return;let{top:fe,bottom:pe}=xe,ge=0,Ae=0,be=oe;for(;be!==null;){const we=be===Se.body;if(we)ge=0,Ae=bs(se).innerHeight;else{const ce=be.getBoundingClientRect();ge=ce.top,Ae=ce.bottom}let Re=0;if(fe<ge?Re=-(ge-fe):pe>Ae&&(Re=pe-Ae),Re!==0)if(we)he.scrollBy(0,Re);else{const ce=be.scrollTop;be.scrollTop+=Re;const je=be.scrollTop-ce;fe-=je,pe-=je}if(we)break;be=Cn(be)}})(t,Q,i)}}oi=!0}}function ba(r){let e=K()||Sn();e===null&&(e=Fe().selectEnd()),e.insertNodes(r)}function Us(r){let e=r;r.isCollapsed()||e.removeText();const t=K();O(t)&&(e=t),O(e)||$(161);const n=e.anchor;let s=n.getNode(),i=n.offset;for(;!Zt(s);)[s,i]=Zc(s,i);return i}function Zc(r,e){const t=r.getParent();if(!t){const s=Ue();return Fe().append(s),s.select(),[Fe(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const i=e===0?0:1;return[t,s[0].getIndexWithinParent()+i]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new lr(It(r.__key,e,"element"),It(r.__key,e,"element"),0,""),i=r.insertNewAfter(s);i&&i.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ke=null,He=null,ot=!1,Ws=!1,qn=0;const Oo={characterData:!0,childList:!0,subtree:!0};function An(){return ot||Ke!==null&&Ke._readOnly}function it(){ot&&$(13)}function _a(){qn>99&&$(14)}function Qt(){return Ke===null&&$(195,va()),Ke}function Pe(){return He===null&&$(196,va()),He}function va(){let r=0;const e=new Set,t=Ds.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const i=ms(s);if(Ri(i))r++;else if(i){let o=String(i.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}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 ed(){return He}function Io(r,e,t){const n=e.__type,s=function(a,l){const u=a._nodes.get(l);return u===void 0&&$(30,l),u}(r,n);let i=t.get(n);i===void 0&&(i=Array.from(s.transforms),t.set(n,i));const o=i.length;for(let a=0;a<o&&(i[a](e),e.isAttached());a++);}function $o(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function Ca(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function td(r){return Ui(r,Pe()._nodes)}function Ui(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 i=s.importJSON(r),o=r.children;if(F(i)&&Array.isArray(o))for(let a=0;a<o.length;a++){const l=Ui(o[a],e);i.append(l)}return i}function zo(r,e,t){const n=Ke,s=ot,i=He;Ke=e,ot=!0,He=r;try{return t()}finally{Ke=n,ot=s,He=i}}function rr(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const i=r._editorState,o=i._selection,a=t._selection,l=r._dirtyType!==gr,u=Ke,c=ot,d=He,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&l&&h!==null){He=r,Ke=t,ot=!1,r._updating=!0;try{const b=r._dirtyType,v=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),p=zc(i,t,r,b,v,S)}catch(b){if(b instanceof Error&&r._onError(b),Ws)throw b;return Aa(r,null,n,t),Ul(r),r._dirtyType=Pr,Ws=!0,rr(r,i),void(Ws=!1)}finally{h.observe(n,Oo),r._updating=f,Ke=u,ot=c,He=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,y=r._dirtyElements,w=r._normalizedNodes,x=r._updateTags,E=r._deferred;l&&(r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(b,v){const S=b._decorators;let k=b._pendingDecorators||S;const j=v._nodeMap;let T;for(T in k)j.has(T)||(k===S&&(k=Hl(b)),delete k[T])}(r,t);const D=s?null:gt(r._window);if(r._editable&&D!==null&&(l||a===null||a.dirty)){He=r,Ke=t;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){const b=r._blockCursorElement;b!==null&&Oi(b,r,n),Xc(o,a,r,D,x,n)}Rc(r,n,a),h!==null&&h.observe(n,Oo)}finally{He=d,Ke=u}}p!==null&&function(b,v,S,k,j){const T=Array.from(b._listeners.mutation),B=T.length;for(let L=0;L<B;L++){const[R,P]=T[L],Q=v.get(P);Q!==void 0&&R(Q,{dirtyLeaves:k,prevEditorState:j,updateTags:S})}}(r,p,x,m,i),O(a)||a===null||o!==null&&o.is(a)||r.dispatchCommand(bi,void 0);const A=r._pendingDecorators;A!==null&&(r._decorators=A,r._pendingDecorators=null,un("decorator",r,!0,A)),function(b,v,S){const k=ho(v),j=ho(S);k!==j&&un("textcontent",b,!0,j)}(r,e||i,t),un("update",r,!0,{dirtyElements:y,dirtyLeaves:m,editorState:t,normalizedNodes:w,prevEditorState:e||i,tags:x}),function(b,v){if(b._deferred=[],v.length!==0){const S=b._updating;b._updating=!0;try{for(let k=0;k<v.length;k++)v[k]()}finally{b._updating=S}}}(r,E),function(b){const v=b._updates;if(v.length!==0){const S=v.shift();if(S){const[k,j]=S;Da(b,k,j)}}}(r)}function un(r,e,t,...n){const s=e._updating;e._updating=t;try{const i=Array.from(e._listeners[r]);for(let o=0;o<i.length;o++)i[o].apply(null,n)}finally{e._updating=s}}function wa(r,e,t){if(r._updating===!1||He!==r){let s=!1;return r.update(()=>{s=wa(r,e,t)}),s}const n=Li(r);for(let s=4;s>=0;s--)for(let i=0;i<n.length;i++){const o=n[i]._commands.get(e);if(o!==void 0){const a=o[s];if(a!==void 0){const l=Array.from(a),u=l.length;for(let c=0;c<u;c++)if(l[c](t,r)===!0)return!0}}}return!1}function qo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[i,o]=s;let a;if(o!==void 0){if(a=o.onUpdate,o.skipTransforms&&(n=!0),o.discrete){const l=r._pendingEditorState;l===null&&$(191),l._flushSync=!0}a&&r._deferred.push(a),Ca(r,o.tag)}i()}}return n}function Da(r,e,t){const n=r._updateTags;let s,i=!1,o=!1;t!==void 0&&(s=t.onUpdate,Ca(r,t.tag),i=t.skipTransforms||!1,o=t.discrete||!1),s&&r._deferred.push(s);const a=r._editorState;let l=r._pendingEditorState,u=!1;(l===null||l._readOnly)&&(l=r._pendingEditorState=Ea(l||a),u=!0),l._flushSync=o;const c=Ke,d=ot,f=He,h=r._updating;Ke=l,ot=!1,r._updating=!0,He=r;try{u&&(r._headless?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=function(w){const x=w.getEditorState()._selection,E=gt(w._window);return O(x)||x==null?qi(x,E,w,null):x.clone()}(r));const m=r._compositionKey;e(),i=qo(r,i),function(w,x){const E=x.getEditorState()._selection,D=w._selection;if(O(D)){const A=D.anchor,b=D.focus;let v;if(A.type==="text"&&(v=A.getNode(),v.selectionTransform(E,D)),b.type==="text"){const S=b.getNode();v!==S&&S.selectionTransform(E,D)}}}(l,r),r._dirtyType!==gr&&(i?function(w,x){const E=x._dirtyLeaves,D=w._nodeMap;for(const A of E){const b=D.get(A);z(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&co(b)}}(l,r):function(w,x){const E=x._dirtyLeaves,D=x._dirtyElements,A=w._nodeMap,b=tr(),v=new Map;let S=E,k=S.size,j=D,T=j.size;for(;k>0||T>0;){if(k>0){x._dirtyLeaves=new Set;for(const B of S){const L=A.get(B);z(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&co(L),L!==void 0&&$o(L,b)&&Io(x,L,v),E.add(B)}if(S=x._dirtyLeaves,k=S.size,k>0){qn++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map;for(const B of j){const L=B[0],R=B[1];if(L!=="root"&&!R)continue;const P=A.get(L);P!==void 0&&$o(P,b)&&Io(x,P,v),D.set(L,R)}S=x._dirtyLeaves,k=S.size,j=x._dirtyElements,T=j.size,qn++}x._dirtyLeaves=E,x._dirtyElements=D}(l,r),qo(r),function(w,x,E,D){const A=w._nodeMap,b=x._nodeMap,v=[];for(const[S]of D){const k=b.get(S);k!==void 0&&(k.isAttached()||(F(k)&&ea(k,S,A,b,v,D),A.has(S)||D.delete(S),v.push(S)))}for(const S of v)b.delete(S);for(const S of E){const k=b.get(S);k===void 0||k.isAttached()||(A.has(S)||E.delete(S),b.delete(S))}}(a,l,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(l._flushSync=!0);const y=l._selection;if(O(y)){const w=l._nodeMap,x=y.anchor.key,E=y.focus.key;w.get(x)!==void 0&&w.get(E)!==void 0||$(19)}else Lt(y)&&y._nodes.size===0&&(l._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=a,r._dirtyType=Pr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void rr(r)}finally{Ke=c,ot=d,He=f,r._updating=h,qn=0}r._dirtyType!==gr||function(m,y){const w=y.getEditorState()._selection,x=m._selection;if(x!==null){if(x.dirty||!x.is(w))return!0}else if(w!==null)return!0;return!1}(l,r)?l._flushSync?(l._flushSync=!1,rr(r)):u&&Ac(()=>{rr(r)}):(l._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function ct(r,e,t){r._updating?r._updates.push([e,t]):Da(r,e,t)}class cn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new cn(this.element,e,this.after)}withAfter(e){return new cn(this.element,this.before,e)}withElement(e){return new cn(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"&&(bn||ps);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,i=document.createElement("br");if(n.insertBefore(i,s),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",n.insertBefore(o,i),n.__lexicalLineBreak=o}else n.__lexicalLineBreak=i}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 l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,s))]}const i=Uo(t,n);i.push(s);const o=Uo(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<o.length;l++){const u=i[l],c=o[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}}function Uo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let i=n.previousSibling;i!==null;i=n.previousSibling)s++;t.push(s)}return n!==r&&$(225),t.reverse()}class Jt extends vs{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 yc[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=Pe()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const i=t[n-1];return F(i)&&i.getLastDescendant()||i||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Xe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&$(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Xe(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 i=t[s];e+=i.getTextContent(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContentSize(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=lo[e];return!!(this.getFormat()&t)}return!1}select(e,t){it();const n=K();let s=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(z(l)||F(l))return l.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const l=this.getLastChild();if(z(l)||F(l))return l.select()}}s===void 0&&(s=o),i===void 0&&(i=o);const a=this.__key;return O(n)?(n.anchor.set(a,s,"element"),n.focus.set(a,i,"element"),n.dirty=!0,n):xa(a,s,a,i,"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!==""?lo[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,i=this.getChildrenSize(),o=this.getWritable();e+t<=i||$(226,String(e),String(t),String(i));const a=o.__key,l=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=i-t+s;if(e!==0)if(e===i)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 y=p.getNextSibling(),w=p.__key;hr(p.getWritable()),u.push(w),p=y}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const y=m.getWritable();y.__parent===a&&f--,hr(y);const w=m.__key;if(h===null)o.__first=w,y.__prev=null;else{const x=h.getWritable();x.__next=w,y.__prev=x.__key}m.__key===a&&$(76),y.__parent=a,l.push(w),h=m}if(e+t===i)h!==null&&(h.getWritable().__next=null,o.__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(o.__size=f,u.length){const p=K();if(O(p)){const m=new Set(u),y=new Set(l),{anchor:w,focus:x}=p;Wo(w,m,y)&&os(w,w.getNode(),this,d,c),Wo(x,m,y)&&os(x,x.getNode(),this,d,c),f!==0||this.canBeEmpty()||Ot(this)||this.remove()}}return o}getDOMSlot(e){return new cn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(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 i=this.getFirstChild();i;i=i.getNextSibling()){const o=t.getElementByKey(i.getKey());o!==null&&(s==null?(n.insertChild(o),s=o):s!==o&&n.replaceChild(o,s),s=s.nextSibling)}}}function F(r){return r instanceof Jt}function Wo(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 Wi extends vs{constructor(e){super(e)}decorate(e,t){$(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ce(r){return r instanceof Wi}class kn extends Jt{static getType(){return"root"}static clone(){return new kn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const e=this.__cachedText;return!An()&&Pe()._dirtyType!==gr||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)||Ce(n)||$(56)}return super.append(...e)}static importJSON(e){const t=Fe();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 tt(r){return r instanceof kn}function Ea(r){return new ws(new Map(r._nodeMap))}function Gi(){return new ws(new Map([["root",new kn]]))}function Sa(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 i=0;i<s.length;i++){const o=Sa(s[i]);n.push(o)}}return e}class ws{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 zo(t&&t.editor||null,this,e)}clone(e){const t=new ws(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return zo(null,this,()=>({root:Sa(Fe())}))}}class Vi extends Jt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class $r extends Jt{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=mr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Yn(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 $r(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=sn(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:rd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(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=Ue();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=Ue();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function rd(r){const e=Ue();return r.style&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function Ue(){return $t(new $r)}function Or(r){return r instanceof $r}const ye=0,Nr=1,nd=4;function Aa(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Gi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const i=r._observer;i!==null&&(i.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function sd(r){const e=r||{},t=ed(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,o=Gi(),a=e.namespace||(s!==null?s._config.namespace:Yl()),l=e.editorState,u=[kn,Ir,wn,Dn,$r,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<u.length;m++){let y=u[m],w=null,x=null;if(typeof y!="function"){const b=y;y=b.replace,w=b.with,x=b.withKlass||null}const E=y.getType(),D=y.transform(),A=new Set;D!==null&&A.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:w,replaceWithKlass:x,transforms:A})}}const p=new Ds(o,s,h,{disableEvents:i,namespace:a,theme:n},c||console.error,function(m,y){const w=new Map,x=new Set,E=D=>{Object.keys(D).forEach(A=>{let b=w.get(A);b===void 0&&(b=[],w.set(A,b)),b.push(D[A])})};return m.forEach(D=>{const A=D.klass.importDOM;if(A==null||x.has(A))return;x.add(A);const b=A.call(D.klass);b!==null&&E(b)}),y&&E(y),w}(h,d?d.import:void 0),f);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=Pr),p}class Ds{constructor(e,t,n,s,i,o,a){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=gr,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=Yl(),this._onError=i,this._htmlConversions=o,this._editable=a,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 i=s.get(e);i===void 0&&$(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every(a=>a.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,s);const o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,s),()=>{i.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=jc(n).get(t.getType());if(!s)return;const i=new Map;for(const o of s.keys())i.set(o,"created");i.size>0&&e(i,{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],i=n.replaceWithKlass;if(i!=null){const l=this.registerNodeTransformToKlass(i,t);s.push(l)}var o,a;return o=this,a=e.getType(),ct(o,()=>{const l=Qt();if(l.isEmpty())return;if(a==="root")return void Fe().markDirty();const u=l._nodeMap;for(const[,c]of u)c.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(l=>l.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=sn(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,Aa(this,t,e,s),t!==null&&(this._config.disableEvents||qc(t),n!=null&&t.classList.remove(...n)),e!==null){const i=function(a){const l=a.ownerDocument;return l&&l.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Pr,Ul(this),this._updateTags.add("history-merge"),rr(this),this._config.disableEvents||function(a,l){const u=a.ownerDocument,c=ss.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ha),ss.set(u,(c||0)+1),a.__lexicalEditor=l;const d=fa(a);for(let f=0;f<ii.length;f++){const[h,p]=ii[f],m=typeof p=="function"?y=>{So(y)||(Eo(y),(l.isEditable()||h==="click")&&p(y,l))}:y=>{if(So(y))return;Eo(y);const w=l.isEditable();switch(h){case"cut":return w&&G(l,Ci,y);case"copy":return G(l,hs,y);case"paste":return w&&G(l,fs,y);case"dragstart":return w&&G(l,Ml,y);case"dragover":return w&&G(l,Pl,y);case"dragend":return w&&G(l,ec,y);case"focus":return w&&G(l,nc,y);case"blur":return w&&G(l,sc,y);case"drop":return w&&G(l,Ll,y)}};a.addEventListener(h,m),d.push(()=>{a.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;un("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=Ea(e),n._selection=e._selection?e._selection.clone():null),ql(this);const s=this._pendingEditorState,i=this._updateTags,o=t!==void 0?t.tag:null;s===null||s.isEmpty()||(o!=null&&i.add(o),rr(this)),this._pendingEditorState=n,this._dirtyType=Pr,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&i.add(o),this._updating||rr(this)}parseEditorState(e,t){return function(n,s,i){const o=Gi(),a=Ke,l=ot,u=He,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,Ke=o,ot=!1,He=s;try{const p=s._nodes;Ui(n.root,p),i&&i(),o._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ke=a,ot=l,He=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return rr(this),this.getEditorState().read(e,{editor:this})}update(e,t){ct(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),ct(this,()=>{const s=K(),i=Fe();s!==null?s.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.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=gt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,un("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ds.version="0.21.0+prod.esm";const ka=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,id=ka?C.useLayoutEffect:C.useEffect,Pn={tag:"history-merge"};function od({initialConfig:r,children:e}){const t=C.useMemo(()=>{const{theme:n,namespace:s,nodes:i,onError:o,editorState:a,html:l}=r,u=Wu(null,n),c=sd({editable:r.editable,html:l,namespace:s,nodes:i,onError:d=>o(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Fe();if(h.isEmpty()){const p=Ue();h.append(p);const m=ka?document.activeElement:null;(K()!==null||m!==null&&m===d.getRootElement())&&p.select()}},Pn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Pn);break}case"object":d.setEditorState(f,Pn);break;case"function":d.update(()=>{Fe().isEmpty()&&f(d)},Pn)}}}(c,a),[c,u]},[]);return id(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(El.Provider,{value:t,children:e})}const ld=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function ad(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function ud(){return function(r){const[e]=St(),t=C.useMemo(()=>r(e),[e,r]),[n,s]=C.useState(()=>t.initialValueFn()),i=C.useRef(n);return ld(()=>{const{initialValueFn:o,subscribe:a}=t,l=o();return i.current!==l&&(i.current=l,s(l)),a(u=>{i.current=u,s(u)})},[t,r]),n}(ad)}function cd(){return Fe().getTextContent()}function dd(r,e=!0){if(r)return!1;let t=cd();return e&&(t=t.trim()),t===""}function fd(r){if(!dd(r,!1))return!1;const e=Fe().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Ce(s))return!1;if(F(s)){if(!Or(s)||s.__indent!==0)return!1;const i=s.getChildren(),o=i.length;for(let a=0;a<o;a++){const l=i[n];if(!z(l))return!1}}}return!0}function Ta(r){return()=>fd(r)}function hd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}hd(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 pd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var gd=pd(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 md=new Map;function yd(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,i]=n.split(/:([^]+)/);s&&i&&(e[s.trim()]=i.trim())}return e}function Na(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,i=r.isBackward(),o=n.getNode(),a=s.getNode(),l=e.is(o),u=e.is(a);if(l||u){const[c,d]=ui(r),f=o.is(a),h=e.is(i?a:o),p=e.is(i?o:a);let m,y=0;return f?(y=c>d?d:c,m=c>d?c:d):h?(y=i?d:c,m=void 0):p&&(y=0,m=i?c:d),e.__text=e.__text.slice(y,m),e}}return e}function xd(r){const e=r.getStyle(),t=yd(e);md.set(e,t)}function bd(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const o=e(),a=Fe(),l=a.getFirstChild();return void(l?l.replace(o,!0):a.append(o))}const s=r.getNodes(),i=n!==null&&function(o,a){let l=o;for(;l!==null&&l.getParent()!==null&&!a(l);)l=l.getParentOrThrow();return a(l)?l:null}(n.getNode(),Ko);i&&s.indexOf(i)===-1&&s.push(i);for(let o=0;o<s.length;o++){const a=s[o];if(!Ko(a))continue;F(a)||gd(178);const l=e();l.setFormat(a.getFormatType()),l.setIndent(a.getIndent()),a.replace(l,!0)}}function Go(r,e){const t=pn(r.focus,e);return Ce(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function _d(r,e,t,n){r.modify(e?"extend":"move",t,n)}function vd(r){const e=r.anchor.getNode();return(tt(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Vo(r,e,t){const n=vd(r);_d(r,e,t?!n:n,"character")}function Ko(r){if(Ce(r)||!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Cd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wd=Cd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Dd=Ba&&"documentMode"in document?document.documentMode:null;!(!Ba||!("InputEvent"in window)||Dd)&&"getTargetRanges"in new window.InputEvent("input");function Fa(...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 vr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Tn(r,...e){const t=Fa(...e);t.length>0&&r.classList.add(...t)}function Ra(r,...e){const t=Fa(...e);t.length>0&&r.classList.remove(...t)}function Ed(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function Sd(r){const e=Es(r,t=>F(t)&&!t.isInline());return F(e)||wd(4,r.__key),e}const Es=(r,e)=>{let t=r;for(;t!==Fe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function nr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function Ad(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const i=n.data;if(typeof i=="string"){let o;try{o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[u,c,d,f,h,p]=l;r.update(()=>{const m=K();if(O(m)){const y=m.anchor;let w=y.getNode(),x=0,E=0;if(z(w)&&u>=0&&c>=0&&(x=u,E=u+c,m.setTextNodeRange(w,x,w,E)),x===E&&d===""||(m.insertRawText(d),w=y.getNode()),z(w)){x=f,E=f+h;const D=w.getTextContentSize();x=x>D?D:x,E=E>D?D:E,m.setTextNodeRange(w,x,w,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function La(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let i=0;i<t.length;i++){const o=t[i];if(!ja.has(o.nodeName)){const a=Oa(o,r,s,!1);a!==null&&(n=n.concat(a))}}return function(i){for(const o of i)o.getNextSibling()instanceof Vi&&o.insertAfter(xr());for(const o of i){const a=o.getChildren();for(const l of a)o.insertBefore(l);o.remove()}}(s),n}function Ma(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=Fe().getChildren();for(let s=0;s<n.length;s++)Pa(r,n[s],t,e);return t.innerHTML}function Pa(r,e,t,n=null){let s=n===null||e.isSelected(n);const i=F(e)&&e.excludeFromCopy("html");let o=e;if(n!==null){let h=Ii(e);h=z(h)&&n!==null?Na(n,h):h,o=h}const a=F(o)?o.getChildren():[],l=r._nodes.get(o.getType());let u;u=l&&l.exportDOM!==void 0?l.exportDOM(r,o):o.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<a.length;h++){const p=a[h],m=Pa(r,p,f,n);!s&&F(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!i){if((Ht(c)||_o(c))&&c.append(f),t.append(c),d){const h=d.call(o,c);h&&(_o(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const ja=new Set(["STYLE","SCRIPT"]);function Oa(r,e,t,n,s=new Map,i){let o=[];if(ja.has(r.nodeName))return o;let a=null;const l=function(p,m){const{nodeName:y}=p,w=m._htmlConversions.get(y.toLowerCase());let x=null;if(w!==void 0)for(const E of w){const D=E(p);D!==null&&(x===null||(x.priority||0)<=(D.priority||0))&&(x=D)}return x!==null?x.conversion:null}(r,e),u=l?l(r):null;let c=null;if(u!==null){c=u.after;const p=u.node;if(a=Array.isArray(p)?p[p.length-1]:p,a!==null){for(const[,m]of s)if(a=m(a,i),!a)break;a&&o.push(...Array.isArray(p)?p:[a])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(a==null||!Ot(a))&&(a!=null&&ci(a)||n);for(let p=0;p<d.length;p++)f.push(...Oa(d[p],e,t,h,new Map(s),a));return c!=null&&(f=c(f)),es(r)&&(f=kd(r,f,h?()=>{const p=new Vi;return t.push(p),p}:Ue)),a==null?f.length>0?o=o.concat(f):es(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ys(p.nextSibling)&&Ys(p.previousSibling)}(r)&&(o=o.concat(xr())):F(a)&&a.append(...f),o}function kd(r,e,t){const n=r.style.textAlign,s=[];let i=[];for(let o=0;o<e.length;o++){const a=e[o];if(ci(a))n&&!a.getFormat()&&a.setFormat(n),s.push(a);else if(i.push(a),o===e.length-1||o<e.length-1&&ci(e[o+1])){const l=t();l.setFormat(n),l.append(...i),s.push(l),i=[]}}return s}function Td(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ls=Td(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 Nd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?"":Ma(r,e)}function Bd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Fd(r,e))}function Ho(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const o=JSON.parse(n);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return Qo(t,Rd(o.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(a):a}(s),"text/html");return Qo(t,La(t,o),e)}catch{}const i=r.getData("text/plain")||r.getData("text/uri-list");if(i!=null)if(O(e)){const o=i.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const l=K();if(O(l)){const u=o[a];u===`
|
|
72
72
|
`||u===`\r
|
|
73
|
-
`?a.insertParagraph():u===" "?a.insertNodes([vn()]):a.insertText(u)}}}else e.insertRawText(o)}function qo(r,e,t){r.dispatchCommand(Su,{nodes:e,selection:t})||t.insertNodes(e)}function Na(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=Fi(t);u=z(u)&&e!==null?Ca(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()&&ns(58,d.name),F(u)){const f=c.children;Array.isArray(f)||ns(59,d.name)}return c}(i);if(z(i)){const u=i.__text;u.length>0?a.text=u:s=!1}for(let u=0;u<l.length;u++){const c=l[u],d=Na(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 fd(r,e){const t=[],n=Be().getChildren();for(let s=0;s<n.length;s++)Na(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function hd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Lc(n);z(s)&&Xc(s),e.push(s)}return e}let wr=null;async function Uo(r,e,t){if(wr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a(Wo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=ht(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((a,u)=>{const c=r.registerCommand(as,d=>(tr(d,ClipboardEvent)&&(c(),wr!==null&&(window.clearTimeout(wr),wr=null),a(Wo(r,d,t))),!0),Oc);wr=window.setTimeout(()=>{c(),wr=null,a(!1)},50),s.execCommand("copy"),i.remove()})}function Wo(r,e,t){if(t===void 0){const s=ht(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!yn(r,o,i))return!1;const l=K();if(l===null)return!1;t=gd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(md(n,t),!0)}const pd=[["text/html",cd],["application/x-lexical-editor",dd]];function gd(r=K()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=gc();for(const[n,s]of pd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function md(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Go(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,yd=Or&&"documentMode"in document?document.documentMode:null,xd=!(!Or||!("InputEvent"in window)||yd)&&"getTargetRanges"in new window.InputEvent("input"),bd=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Vo=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_d=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vd=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!_d,Ko=pn();class vs extends Ht{static getType(){return"quote"}static clone(e){return new vs(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Sn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Cd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Vt(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=$i();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=ze(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ze();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function $i(){return Mt(new vs)}class Cs extends Ht{static getType(){return"heading"}static clone(e){return new Cs(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];Sn(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Dr,priority:0}),h2:e=>({conversion:Dr,priority:0}),h3:e=>({conversion:Dr,priority:0}),h4:e=>({conversion:Dr,priority:0}),h5:e=>({conversion:Dr,priority:0}),h6:e=>({conversion:Dr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Ho(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Ho(e)?{conversion:t=>({node:Qr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Vt(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=Qr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ze():Qr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ze();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ze():Qr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Ho(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Dr(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Qr(e),r.style!==null&&(ji(r,t),t.setFormat(r.style.textAlign))),{node:t}}function Cd(r){const e=$i();return r.style!==null&&(e.setFormat(r.style.textAlign),ji(r,e)),{node:e}}function Qr(r){return Mt(new Cs(r))}function jn(r){let e=null;if(tr(r,DragEvent)?e=r.dataTransfer:tr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function Jo(r){const e=K();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=_s(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 Rn(r){const e=jr(r);return _e(e)}function wd(r){return xr(r.registerCommand(xl,e=>{const t=K();return!!Ft(t)&&(t.clear(),!0)},0),r.registerCommand(cr,e=>{const t=K();return!!P(t)&&(t.deleteCharacter(e),!0)},fe),r.registerCommand(an,e=>{const t=K();return!!P(t)&&(t.deleteWord(e),!0)},fe),r.registerCommand(un,e=>{const t=K();return!!P(t)&&(t.deleteLine(e),!0)},fe),r.registerCommand(Tr,e=>{const t=K();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)zo(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},fe),r.registerCommand(Us,()=>{const e=K();return!!P(e)&&(e.removeText(),!0)},fe),r.registerCommand(Ct,e=>{const t=K();return!!P(t)&&(t.formatText(e),!0)},fe),r.registerCommand(ju,e=>{const t=K();if(!P(t)&&!Ft(t))return!1;const n=t.getNodes();for(const s of n){const o=_s(s,i=>F(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},fe),r.registerCommand(Ar,e=>{const t=K();return!!P(t)&&(t.insertLineBreak(e),!0)},fe),r.registerCommand(ln,()=>{const e=K();return!!P(e)&&(e.insertParagraph(),!0)},fe),r.registerCommand(Nu,()=>(da([vn()]),!0),fe),r.registerCommand(Fu,()=>Jo(e=>{const t=e.getIndent();e.setIndent(t+1)}),fe),r.registerCommand(Zi,()=>Jo(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),fe),r.registerCommand(vl,e=>{const t=K();if(Ft(t)&&!Rn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=cn(t.focus,!0);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},fe),r.registerCommand(Cl,e=>{const t=K();if(Ft(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===Be().getChildrenSize()}(t))return e.preventDefault(),!0;const n=cn(t.focus,!1);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},fe),r.registerCommand(_l,e=>{const t=K();if(Ft(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Mo(t,!0)){const n=e.shiftKey;return e.preventDefault(),Io(t,n,!0),!0}return!1},fe),r.registerCommand(bl,e=>{const t=K();if(Ft(t)&&!Rn(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!!Mo(t,!1)&&(e.preventDefault(),Io(t,n,!1),!0)},fe),r.registerCommand(wl,e=>{if(Rn(e.target))return!1;const t=K();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ze(s)&&od(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Zi,void 0)):(!Vo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(cr,!0))},fe),r.registerCommand(Sl,e=>{if(Rn(e.target))return!1;const t=K();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(cr,!1))},fe),r.registerCommand(zn,e=>{const t=K();if(!P(t))return!1;if(e!==null){if((Vo||bd||vd)&&xd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Ar,!1)}return r.dispatchCommand(ln,void 0)},fe),r.registerCommand(Dl,()=>{const e=K();return!!P(e)&&(r.blur(),!0)},fe),r.registerCommand(El,e=>{const[,t]=jn(e);if(t.length>0){const s=Go(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=jr(i);if(l!==null){const a=Nc();if(z(l))a.anchor.set(l.getKey(),o,"text"),a.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(c,d,"element"),a.focus.set(c,d,"element")}const u=Pl(a);Lt(u)}r.dispatchCommand(Ko,t)}return e.preventDefault(),!0}const n=K();return!!P(n)},fe),r.registerCommand(kl,e=>{const[t]=jn(e),n=K();return!(t&&!P(n))},fe),r.registerCommand(Al,e=>{const[t]=jn(e),n=K();if(t&&!P(n))return!1;const s=Go(e.clientX,e.clientY);if(s!==null){const o=jr(s.node);_e(o)&&e.preventDefault()}return!0},fe),r.registerCommand(Ws,()=>(dc(),!0),fe),r.registerCommand(as,e=>(Uo(r,tr(e,ClipboardEvent)?e:null),!0),fe),r.registerCommand(gi,e=>(async function(t,n){await Uo(n,tr(t,ClipboardEvent)?t:null),n.update(()=>{const s=K();P(s)?s.removeText():Ft(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),fe),r.registerCommand(ls,e=>{const[,t,n]=jn(e);return t.length>0&&!n?(r.dispatchCommand(Ko,t),!0):Si(e.target)?!1:K()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=K(),l=tr(s,InputEvent)||tr(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&zo(l,i,o)},{tag:"paste"})}(e,r),!0)},fe))}const oi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function Qo(r){return r.getEditorState().read(va(r.isComposing()))}function Dd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=Dt(),s=function(o,i){const[l,a]=C.useState(()=>o.getDecorators());return oi(()=>o.registerDecoratorListener(u=>{Ui.flushSync(()=>{a(u)})}),[o]),C.useEffect(()=>{a(o.getDecorators())},[o]),C.useMemo(()=>{const u=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=p.jsx(i,{onError:m=>o._onError(m),children:p.jsx(C.Suspense,{fallback:null,children:l[f]})}),g=o.getElementByKey(f);g!==null&&u.push(Ui.createPortal(h,g,f))}return u},[i,l,o])}(n,t);return function(o){oi(()=>xr(wd(o),ld(o)),[o])}(n),p.jsxs(p.Fragment,{children:[r,p.jsx(Sd,{content:e}),s]})}function Sd({content:r}){const[e]=Dt(),t=function(s){const[o,i]=C.useState(()=>Qo(s));return oi(()=>{function l(){const a=Qo(s);i(a)}return l(),xr(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=Uc();return t?typeof r=="function"?r(n):r:null}const Fa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function Ed({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:g,id:m,role:b="textbox",spellCheck:w=!0,style:v,tabIndex:E,"data-testid":D,...k},y){const[_,S]=C.useState(r.isEditable()),A=C.useCallback(B=>{B&&B.ownerDocument&&B.ownerDocument.defaultView?r.setRootElement(B):r.setRootElement(null)},[r]),I=C.useMemo(()=>function(...B){return N=>{B.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(y,A),[A,y]);return Fa(()=>(S(r.isEditable()),r.registerEditableListener(B=>{S(B)})),[r]),p.jsx("div",{"aria-activedescendant":_?e:void 0,"aria-autocomplete":_?t:"none","aria-controls":_?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":_&&b==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":f,autoCapitalize:h,className:g,contentEditable:_,"data-testid":D,id:m,ref:I,role:_?b:void 0,spellCheck:w,style:v,tabIndex:E,...k})}const kd=C.forwardRef(Ed);function Yo(r){return r.getEditorState().read(va(r.isComposing()))}const Ad=C.forwardRef(Td);function Td(r,e){const{placeholder:t,...n}=r,[s]=Dt();return p.jsxs(p.Fragment,{children:[p.jsx(kd,{editor:s,...n,ref:e}),t!=null&&p.jsx(Bd,{editor:s,content:t})]})}function Bd({content:r,editor:e}){const t=function(i){const[l,a]=C.useState(()=>Yo(i));return Fa(()=>{function u(){const c=Yo(i);a(c)}return u(),xr(i.registerUpdateListener(()=>{u()}),i.registerEditableListener(()=>{u()}))},[i]),l}(e),[n,s]=C.useState(e.isEditable());if(C.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:p.jsx("div",{"aria-hidden":!0,children:o})}const Ln=0,li=1,ai=2,vt=0,Nd=1,Xo=2,Fd=3,jd=4;function Rd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return vt;const o=e._selection,i=r._selection;if(s)return Nd;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return vt;const l=function(w,v,E){const D=w._nodeMap,k=[];for(const y of v){const _=D.get(y);_!==void 0&&k.push(_)}for(const[y,_]of E){if(!_)continue;const S=D.get(y);S===void 0||Ze(S)||k.push(S)}return k}(e,t,n);if(l.length===0)return vt;if(l.length>1){const w=e._nodeMap,v=w.get(o.anchor.key),E=w.get(i.anchor.key);return v&&E&&!r._nodeMap.has(v.__key)&&z(v)&&v.__text.length===1&&o.anchor.offset===1?Xo:vt}const a=l[0],u=r._nodeMap.get(a.__key);if(!z(u)||!z(a)||u.__mode!==a.__mode)return vt;const c=u.__text,d=a.__text;if(c===d)return vt;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return vt;const g=f.offset,m=h.offset,b=d.length-c.length;return b===1&&m===g-1?Xo:b===-1&&m===g+1?Fd:b===-1&&m===g?jd:vt}function Ld(r,e){let t=Date.now(),n=vt;return(s,o,i,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=vt,t=c,ai;const d=Rd(s,o,l,a,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return Ln;if(s===null)return li;const m=o._selection;return l.size>0||a.size>0?g===!1&&d!==vt&&d===n&&c<t+e&&h||l.size===1&&function(b,w,v){const E=w._nodeMap.get(b),D=v._nodeMap.get(b),k=w._selection,y=v._selection;return!(P(k)&&P(y)&&k.anchor.type==="element"&&k.focus.type==="element"&&y.anchor.type==="text"&&y.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(w.read(()=>E.exportJSON()))===JSON.stringify(v.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?Ln:li:m!==null?Ln:ai})();return t=c,n=d,f}}function Zo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Pd(r,e,t){const n=Ld(r,t);return xr(r.registerCommand(hi,()=>(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(An,!0)),a.length===0&&o.dispatchCommand(Tn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(pi,()=>(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(Tn,!0));const c=l.pop();l.length===0&&o.dispatchCommand(An,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(Lu,()=>(Zo(e),!1),fe),r.registerCommand(Pu,()=>(Zo(e),r.dispatchCommand(An,!1),r.dispatchCommand(Tn,!1),!0),fe),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:a,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const g=n(i,o,c,l,a,u);if(g===li)d.length!==0&&(e.redoStack=[],r.dispatchCommand(An,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(Tn,!0));else if(g===ai)return;e.current={editor:r,editorState:o}}))}function Od(){return{current:null,redoStack:[],undoStack:[]}}function Md({delay:r,externalHistoryState:e}){const[t]=Dt();return function(n,s,o=1e3){const i=C.useMemo(()=>s||Od(),[s]);C.useEffect(()=>Pd(n,i,o),[o,n,i])}(t,e,r),null}const Id=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function $d({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=Dt();return Id(()=>{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 ui(r,e){return ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ui(r,e)}var el={error:null},zd=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=el,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,ui(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(el)},s.componentDidCatch=function(o,i){var l,a;(l=(a=this.props).onError)==null||l.call(a,o,i)},s.componentDidUpdate=function(o,i){var l,a,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((u=o.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,g){return!Object.is(h,c[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,a=i.FallbackComponent,u=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(Ss.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return Ss.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ss.Component);function qd({children:r,onError:e}){return p.jsx(zd,{fallback:p.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function Ud(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var jt=Ud(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 Wd(r){let e=1,t=r.getParent();for(;t!=null;){if(Fe(t)){const n=t.getParent();if(ue(n)){e++,t=n.getParent();continue}jt(40)}return e}return e}function ci(r){let e=r.getParent();ue(e)||jt(40);let t=e;for(;t!==null;)t=t.getParent(),ue(t)&&(e=t);return e}function ja(r){let e=[];const t=r.getChildren().filter(Fe);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();ue(o)?e=e.concat(ja(o)):e.push(s)}return e}function Rt(r){return Fe(r)&&ue(r.getFirstChild())}function tl(r){return ut().append(r)}function Ra(r,e){return Fe(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function rl(r,e){r.update(()=>{const t=K();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&jt(143);const[i]=o,l=i.getNode(),a=l.getParent();if(Ra(l,n)){const u=it(e);if(Pt(a)){l.replace(u);const c=ut();F(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(Fe(l)){const c=l.getParentOrThrow();yr(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!F(i)||!i.isEmpty()||Fe(i)||s.has(i.getKey())){if(Ml(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(ue(l)){if(!s.has(a)){const u=it(e);yr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(Pt(u)&&!s.has(a)){s.add(a),nl(l,e);break}l=u}}}}else nl(i,e)}}})}function yr(r,e){r.splice(r.getChildrenSize(),0,e)}function nl(r,e){if(ue(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=ut();let o;if(yr(s,r.getChildren()),ue(t)&&e===t.getListType())t.append(s),ue(n)&&e===n.getListType()&&(yr(t,n.getChildren()),n.remove()),o=t;else if(ue(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=it(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function zi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Rt(t)&&Rt(n)&&(zi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function Gd(r){r.update(()=>{const e=K();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Ra(s,n))t.add(ci(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Ml(i)){const l=id(i,br);l!=null&&t.add(ci(l))}}for(const o of t){let i=o;const l=ja(o);for(const a of l){const u=ze();yr(u,a.getChildren()),i.insertAfter(u),i=u,a.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),a.remove()}o.remove()}}})}function Vd(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(ue(o)){o.append(r);const i=n.getFirstChild();ue(i)&&(yr(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Rt(n)){const o=n.getFirstChild();if(ue(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(Rt(s)){const o=s.getFirstChild();ue(o)&&o.append(r)}else if(ue(t)){const o=ut(),i=it(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Kd(r){if(Rt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(ue(t?t.getParent():void 0)&&Fe(t)&&ue(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const o=e.getListType(),i=ut(),l=it(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=ut(),u=it(o);a.append(u),yr(u,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(a),t.replace(r)}}}function Hd(){const r=K();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Fe(e)||e.getChildrenSize()!==0)return!1;const t=ci(e),n=e.getParent();ue(n)||jt(40);const s=n.getParent();let o;if(Pt(s))o=ze(),t.insertAfter(o);else{if(!Fe(s))return!1;o=ut(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=it(n.getListType());if(Rr(o))o.insertAfter(l);else{const a=ut();a.append(l),o.insertAfter(a)}i.forEach(a=>{a.remove(),l.append(a)})}return function(l){let a=l;for(;a.getNextSibling()==null&&a.getPreviousSibling()==null;){const u=a.getParent();if(u==null||!Fe(a)&&!ue(a))break;a=u}a.remove()}(e),!0}function ss(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class br extends Ht{static getType(){return"listitem"}static clone(e){return new br(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return ue(n)&&n.getListType()==="check"&&il(t,this,null),t.value=this.__value,sl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return ue(s)&&s.getListType()==="check"&&il(t,this,e),t.value=this.__value,sl(t,n.theme,this),!1}static transform(){return e=>{if(Fe(e)||jt(144),e.__checked==null)return;const t=e.getParent();ue(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Jd,priority:0})}}static importJSON(e){const t=ut();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Fe(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ue(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=it(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||jt(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(ue(n)||jt(39),Fe(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=it(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Rt(t)&&Rt(n)&&(zi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=ut(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ze();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Fe(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,a=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(a,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return ue(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Fe(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&jt(117),(e=Math.floor(e))>=0||jt(199);let t=this.getIndent();for(;t!==e;)t<e?(Vd(this),t++):(Kd(this),t--);return this}canInsertAfter(e){return Fe(e)}canReplaceWith(e){return Fe(e)}canMergeWith(e){return Rr(e)||Fe(e)}extractWithChild(e,t){if(!P(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return it("bullet")}canMergeWhenEmpty(){return!0}}function sl(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(...ss(i)),o){const a=t.getParent(),u=ue(a)&&a.getListType()==="check",c=t.getChecked();u&&!c||s.push(o.listitemUnchecked),u&&c||s.push(o.listitemChecked),u&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const a=ss(l);t.getChildren().some(u=>ue(u))?n.push(...a):s.push(...a)}s.length>0&&Sa(r,...s),n.length>0&&Sn(r,...n)}function il(r,e,t,n){ue(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Jd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Qd(t)}const e=r.getAttribute("aria-checked");return{node:ut(e==="true"||e!=="false"&&void 0)}}function Qd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:ut(r.hasAttribute("checked"))}}function ut(r){return Mt(new br(void 0,r))}function Fe(r){return r instanceof br}class Mr extends Ht{static getType(){return"list"}static clone(e){const t=e.__listType||al[e.__tag];return new Mr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=al[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,ol(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(ol(t,n.theme,this),!1)}static transform(){return e=>{ue(e)||jt(163),function(t){const n=t.getNextSibling();ue(n)&&t.getListType()===n.getListType()&&zi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Fe(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),ue(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:ll,priority:0}),ul:()=>({conversion:ll,priority:0})}}static importJSON(e){const t=it(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Vt(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Fe(n))super.append(n);else{const s=ut();if(ue(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const o=Ue(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Fe(e)}}function ol(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=Wd(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(...ss(u));for(let g=0;g<i.length;g++)g!==a&&s.push(t.__tag+g)}if(d!==void 0){const g=ss(d);l>1?n.push(...g):s.push(...g)}}s.length>0&&Sa(r,...s),n.length>0&&Sn(r,...n)}function Yd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Fe(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{ue(o)&&e.push(tl(o))})}else e.push(tl(n))}return e}function ll(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=it("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Vt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?it("check"):it("bullet")),{after:Yd,node:t}}const al={ol:"number",ul:"bullet"};function it(r,e=1){return Mt(new Mr(r,e))}function ue(r){return r instanceof Mr}const La=pn(),Pa=pn(),Xd=pn();function Zd(r){return xr(r.registerCommand(Pa,()=>(rl(r,"number"),!0),kr),r.registerCommand(La,()=>(rl(r,"bullet"),!0),kr),r.registerCommand(Xd,()=>(Gd(r),!0),kr),r.registerCommand(ln,()=>!!Hd(),kr))}function ef(){const[r]=Dt();return C.useEffect(()=>{if(!r.hasNodes([Mr,br]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){C.useEffect(()=>Zd(e),[e])}(r),null}const tf=new Set(["http:","https:","mailto:","sms:","tel:"]);class _r extends Ht{static getType(){return"link"}static clone(e){return new _r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Sn(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:rf,priority:1})}}static importJSON(e){const t=is(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(!tf.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=is(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 rf(r){let e=null;if(pc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=is(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function is(r,e){return Mt(new _r(r,e))}function Vr(r){return r instanceof _r}class En extends _r{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new En(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=ul(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=ul(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ul(r,e){return Mt(new En(r,e))}function nf(r){return r instanceof En}const cl=pn();function $s(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=K();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const a=_s(l,u=>!nf(u)&&Vr(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],Vr);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(Vr(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=is(r,{rel:s,target:t,title:n}),Vr(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),Vr(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 sf({validateUrl:r,attributes:e}){const[t]=Dt();return C.useEffect(()=>{if(!t.hasNodes([_r]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xr(t.registerCommand(cl,n=>{if(n===null)return $s(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&($s(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return $s(s,{...e,rel:i,target:o,title:l}),!0}},kr),r!==void 0?t.registerCommand(ls,n=>{const s=K();if(!P(s)||s.isCollapsed()||!tr(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>F(l))&&(t.dispatchCommand(cl,{...e,url:i}),n.preventDefault(),!0)},kr):()=>{})},[t,r,e]),null}function of(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return{node:Oa({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}function lf({src:r,alt:e,width:t,height:n}){return p.jsx("img",{src:r,alt:e,width:t,height:n,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}class ws extends Oi{constructor(t,n,s,o,i){super(i);xt(this,"__src");xt(this,"__altText");xt(this,"__width");xt(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=o}static getType(){return"image"}static clone(t){return new ws(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:o,height:i}=t;return Oa({src:n,altText:s,width:o,height:i})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:of,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return p.jsx(lf,{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height})}}function Oa(r){return new ws(r.src,r.altText,r.width,r.height)}function af(r){if(r instanceof HTMLElement&&r.dataset.qrcodeData){const e=r.dataset.qrcodeData,t=r.dataset.qrcodeSize?parseInt(r.dataset.qrcodeSize,10):void 0;return{node:qi({data:e,size:t})}}return null}function uf({data:r,size:e=150}){const[t,n]=C.useState(null),[s,o]=C.useState(!1);return C.useEffect(()=>{let i=!0;return Promise.resolve().then(()=>require("./stack-CDTLCo61.js")).then(l=>{var u;if(!i)return;const a=l.QRCodeSVG||((u=l.default)==null?void 0:u.QRCodeSVG)||l.default;typeof a=="function"?n(()=>a):(console.error("[QRCodeNode] QRCodeSVG is not a function:",typeof a,a),o(!0))}).catch(l=>{console.error("[QRCodeNode] Failed to import qrcode.react:",l),i&&o(!0)}),()=>{i=!1}},[]),s?p.jsx("div",{style:{width:e,height:e,background:"#fee2e2",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px",fontSize:"12px",color:"#991b1b"},children:"QR Error"}):t?p.jsx("div",{style:{display:"inline-block",background:"#f9f9f9",padding:"12px",borderRadius:"8px",margin:"8px 0"},children:p.jsx(t,{value:r,size:e,level:"M"})}):p.jsx("div",{style:{width:e,height:e,background:"#f3f4f6",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px",fontSize:"12px",color:"#6b7280"},children:"Loading..."})}class Ir extends Oi{constructor(t,n=150,s){super(s);xt(this,"__data");xt(this,"__size");this.__data=t,this.__size=n}static getType(){return"qrcode"}static clone(t){return new Ir(t.__data,t.__size,t.__key)}static importJSON(t){const{data:n,size:s}=t;return qi({data:n,size:s})}exportJSON(){return{type:"qrcode",version:1,data:this.__data,size:this.__size}}static importDOM(){return{div:t=>t.dataset.qrcodeData?{conversion:af,priority:1}:null}}exportDOM(){const t=document.createElement("div");return t.dataset.qrcodeData=this.__data,t.dataset.qrcodeSize=String(this.__size),t.style.display="inline-block",t.style.background="#f9f9f9",t.style.padding="12px",t.style.borderRadius="8px",t.textContent="[QR Code]",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return p.jsx(uf,{data:this.__data,size:this.__size})}getData(){return this.__data}getSize(){return this.__size}}function qi(r){return new Ir(r.data,r.size)}function cf(r){return r instanceof Ir}const df={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},ff={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 hf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:o,aiProcessingAction:i,onAiAction:l,hasContent:a}){const[u]=Dt(),[c,d]=C.useState(!1),f=C.useRef(null),h=t||n||s,g=C.useCallback(()=>{u.dispatchCommand(Ct,"bold")},[u]),m=C.useCallback(()=>{u.dispatchCommand(Ct,"italic")},[u]),b=C.useCallback(()=>{u.dispatchCommand(Ct,"underline")},[u]),w=C.useCallback(()=>{u.dispatchCommand(La,void 0)},[u]),v=C.useCallback(()=>{u.dispatchCommand(Pa,void 0)},[u]),E=C.useCallback(()=>{u.update(()=>{const _=K();P(_)&&Zc(_,()=>$i())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},k=`
|
|
73
|
+
`?l.insertParagraph():u===" "?l.insertNodes([En()]):l.insertText(u)}}}else e.insertRawText(i)}function Qo(r,e,t){r.dispatchCommand(Gu,{nodes:e,selection:t})||t.insertNodes(e)}function Ia(r,e,t,n=[]){let s=e===null||t.isSelected(e);const i=F(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Ii(t);u=z(u)&&e!==null?Na(e,u):u,o=u}const a=F(o)?o.getChildren():[],l=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&ls(58,d.name),F(u)){const f=c.children;Array.isArray(f)||ls(59,d.name)}return c}(o);if(z(o)){const u=o.__text;u.length>0?l.text=u:s=!1}for(let u=0;u<a.length;u++){const c=a[u],d=Ia(r,e,c,l.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!i)n.push(l);else if(Array.isArray(l.children))for(let u=0;u<l.children.length;u++){const c=l.children[u];n.push(c)}return s}function Fd(r,e){const t=[],n=Fe().getChildren();for(let s=0;s<n.length;s++)Ia(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function Rd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=td(n);z(s)&&xd(s),e.push(s)}return e}let Sr=null;async function Jo(r,e,t){if(Sr!==null)return!1;if(e!==null)return new Promise((l,u)=>{r.update(()=>{l(Yo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,i=gt(r._window);if(n===null||i===null)return!1;const o=s.createElement("span");o.style.cssText="position: fixed; top: -1000px;",o.append(s.createTextNode("#")),n.append(o);const a=new Range;return a.setStart(o,0),a.setEnd(o,1),i.removeAllRanges(),i.addRange(a),new Promise((l,u)=>{const c=r.registerCommand(hs,d=>(nr(d,ClipboardEvent)&&(c(),Sr!==null&&(window.clearTimeout(Sr),Sr=null),l(Yo(r,d,t))),!0),nd);Sr=window.setTimeout(()=>{c(),Sr=null,l(!1)},50),s.execCommand("copy"),o.remove()})}function Yo(r,e,t){if(t===void 0){const s=gt(r._window);if(!s)return!1;const i=s.anchorNode,o=s.focusNode;if(i!==null&&o!==null&&!vn(r,i,o))return!1;const a=K();if(a===null)return!1;t=Md(a)}e.preventDefault();const n=e.clipboardData;return n!==null&&(Pd(n,t),!0)}const Ld=[["text/html",Nd],["application/x-lexical-editor",Bd]];function Md(r=K()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=Mc();for(const[n,s]of Ld){const i=s(t,r);i!==null&&(e[n]=i)}}return e}function Pd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Xo(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 zr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,jd=zr&&"documentMode"in document?document.documentMode:null,Od=!(!zr||!("InputEvent"in window)||jd)&&"getTargetRanges"in new window.InputEvent("input"),Id=zr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Zo=zr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$d=zr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zd=zr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!$d,el=xn();class Ss extends Jt{static getType(){return"quote"}static clone(e){return new Ss(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Tn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:qd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(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=Ki();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=Ue(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=Ue();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Ki(){return $t(new Ss)}class As extends Jt{static getType(){return"heading"}static clone(e){return new As(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 i=s[t];Tn(n,i)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Ar,priority:0}),h2:e=>({conversion:Ar,priority:0}),h3:e=>({conversion:Ar,priority:0}),h4:e=>({conversion:Ar,priority:0}),h5:e=>({conversion:Ar,priority:0}),h6:e=>({conversion:Ar,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&tl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>tl(e)?{conversion:t=>({node:en("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(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=en(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(),i=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?Ue():en(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){const a=Ue();a.select(),this.replace(a,!0)}return i}collapseAtStart(){const e=this.isEmpty()?Ue():en(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function tl(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Ar(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=en(e),r.style!==null&&($i(r,t),t.setFormat(r.style.textAlign))),{node:t}}function qd(r){const e=Ki();return r.style!==null&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function en(r){return $t(new As(r))}function jn(r){let e=null;if(nr(r,DragEvent)?e=r.dataTransfer:nr(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 rl(r){const e=K();if(!O(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const i=n[s],o=i.getKey();if(t.has(o))continue;const a=Es(i,u=>F(u)&&!u.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!t.has(l)&&(t.add(l),r(a))}return t.size>0}function On(r){const e=jr(r);return Ce(e)}function Ud(r){return vr(r.registerCommand(Sl,e=>{const t=K();return!!Lt(t)&&(t.clear(),!0)},0),r.registerCommand(fr,e=>{const t=K();return!!O(t)&&(t.deleteCharacter(e),!0)},ye),r.registerCommand(fn,e=>{const t=K();return!!O(t)&&(t.deleteWord(e),!0)},ye),r.registerCommand(hn,e=>{const t=K();return!!O(t)&&(t.deleteLine(e),!0)},ye),r.registerCommand(Rr,e=>{const t=K();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Ho(n,t,r);else if(O(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},ye),r.registerCommand(Hs,()=>{const e=K();return!!O(e)&&(e.removeText(),!0)},ye),r.registerCommand(Dt,e=>{const t=K();return!!O(t)&&(t.formatText(e),!0)},ye),r.registerCommand(Zu,e=>{const t=K();if(!O(t)&&!Lt(t))return!1;const n=t.getNodes();for(const s of n){const i=Es(s,o=>F(o)&&!o.isInline());i!==null&&i.setFormat(e)}return!0},ye),r.registerCommand(Fr,e=>{const t=K();return!!O(t)&&(t.insertLineBreak(e),!0)},ye),r.registerCommand(dn,()=>{const e=K();return!!O(e)&&(e.insertParagraph(),!0)},ye),r.registerCommand(Yu,()=>(ba([En()]),!0),ye),r.registerCommand(Xu,()=>rl(e=>{const t=e.getIndent();e.setIndent(t+1)}),ye),r.registerCommand(oo,()=>rl(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ye),r.registerCommand(Tl,e=>{const t=K();if(Lt(t)&&!On(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(O(t)){const n=pn(t.focus,!0);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},ye),r.registerCommand(Nl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(O(t)){if(function(s){const i=s.focus;return i.key==="root"&&i.offset===Fe().getChildrenSize()}(t))return e.preventDefault(),!0;const n=pn(t.focus,!1);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},ye),r.registerCommand(kl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!O(t))return!1;if(Go(t,!0)){const n=e.shiftKey;return e.preventDefault(),Vo(t,n,!0),!0}return!1},ye),r.registerCommand(Al,e=>{const t=K();if(Lt(t)&&!On(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!O(t))return!1;const n=e.shiftKey;return!!Go(t,!1)&&(e.preventDefault(),Vo(t,n,!1),!0)},ye),r.registerCommand(Bl,e=>{if(On(e.target))return!1;const t=K();if(!O(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!tt(s)&&Sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(oo,void 0)):(!Zo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(fr,!0))},ye),r.registerCommand(Rl,e=>{if(On(e.target))return!1;const t=K();return!!O(t)&&(e.preventDefault(),r.dispatchCommand(fr,!1))},ye),r.registerCommand(Gn,e=>{const t=K();if(!O(t))return!1;if(e!==null){if((Zo||Id||zd)&&Od)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Fr,!1)}return r.dispatchCommand(dn,void 0)},ye),r.registerCommand(Fl,()=>{const e=K();return!!O(e)&&(r.blur(),!0)},ye),r.registerCommand(Ll,e=>{const[,t]=jn(e);if(t.length>0){const s=Xo(e.clientX,e.clientY);if(s!==null){const{offset:i,node:o}=s,a=jr(o);if(a!==null){const l=Yc();if(z(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{const c=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;l.anchor.set(c,d,"element"),l.focus.set(c,d,"element")}const u=Wl(l);jt(u)}r.dispatchCommand(el,t)}return e.preventDefault(),!0}const n=K();return!!O(n)},ye),r.registerCommand(Ml,e=>{const[t]=jn(e),n=K();return!(t&&!O(n))},ye),r.registerCommand(Pl,e=>{const[t]=jn(e),n=K();if(t&&!O(n))return!1;const s=Xo(e.clientX,e.clientY);if(s!==null){const i=jr(s.node);Ce(i)&&e.preventDefault()}return!0},ye),r.registerCommand(Qs,()=>(Bc(),!0),ye),r.registerCommand(hs,e=>(Jo(r,nr(e,ClipboardEvent)?e:null),!0),ye),r.registerCommand(Ci,e=>(async function(t,n){await Jo(n,nr(t,ClipboardEvent)?t:null),n.update(()=>{const s=K();O(s)?s.removeText():Lt(s)&&s.getNodes().forEach(i=>i.remove())})}(e,r),!0),ye),r.registerCommand(fs,e=>{const[,t,n]=jn(e);return t.length>0&&!n?(r.dispatchCommand(el,t),!0):Fi(e.target)?!1:K()!==null&&(function(s,i){s.preventDefault(),i.update(()=>{const o=K(),a=nr(s,InputEvent)||nr(s,KeyboardEvent)?null:s.clipboardData;a!=null&&o!==null&&Ho(a,o,i)},{tag:"paste"})}(e,r),!0)},ye))}const di=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function nl(r){return r.getEditorState().read(Ta(r.isComposing()))}function Wd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=St(),s=function(i,o){const[a,l]=C.useState(()=>i.getDecorators());return di(()=>i.registerDecoratorListener(u=>{Ji.flushSync(()=>{l(u)})}),[i]),C.useEffect(()=>{l(i.getDecorators())},[i]),C.useMemo(()=>{const u=[],c=Object.keys(a);for(let d=0;d<c.length;d++){const f=c[d],h=g.jsx(o,{onError:m=>i._onError(m),children:g.jsx(C.Suspense,{fallback:null,children:a[f]})}),p=i.getElementByKey(f);p!==null&&u.push(Ji.createPortal(h,p,f))}return u},[o,a,i])}(n,t);return function(i){di(()=>vr(Ud(i),Ad(i)),[i])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(Gd,{content:e}),s]})}function Gd({content:r}){const[e]=St(),t=function(s){const[i,o]=C.useState(()=>nl(s));return di(()=>{function a(){const l=nl(s);o(l)}return a(),vr(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),i}(e),n=ud();return t?typeof r=="function"?r(n):r:null}const $a=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function Vd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:i,ariaExpanded:o,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:p,id:m,role:y="textbox",spellCheck:w=!0,style:x,tabIndex:E,"data-testid":D,...A},b){const[v,S]=C.useState(r.isEditable()),k=C.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),j=C.useMemo(()=>function(...T){return B=>{T.forEach(L=>{typeof L=="function"?L(B):L!=null&&(L.current=B)})}}(b,k),[k,b]);return $a(()=>(S(r.isEditable()),r.registerEditableListener(T=>{S(T)})),[r]),g.jsx("div",{"aria-activedescendant":v?e:void 0,"aria-autocomplete":v?t:"none","aria-controls":v?n:void 0,"aria-describedby":s,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":v&&y==="combobox"?!!o:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":u,"aria-multiline":c,"aria-owns":v?d:void 0,"aria-readonly":!v||void 0,"aria-required":f,autoCapitalize:h,className:p,contentEditable:v,"data-testid":D,id:m,ref:j,role:v?y:void 0,spellCheck:w,style:x,tabIndex:E,...A})}const Kd=C.forwardRef(Vd);function sl(r){return r.getEditorState().read(Ta(r.isComposing()))}const Hd=C.forwardRef(Qd);function Qd(r,e){const{placeholder:t,...n}=r,[s]=St();return g.jsxs(g.Fragment,{children:[g.jsx(Kd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Jd,{editor:s,content:t})]})}function Jd({content:r,editor:e}){const t=function(o){const[a,l]=C.useState(()=>sl(o));return $a(()=>{function u(){const c=sl(o);l(c)}return u(),vr(o.registerUpdateListener(()=>{u()}),o.registerEditableListener(()=>{u()}))},[o]),a}(e),[n,s]=C.useState(e.isEditable());if(C.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(o=>{s(o)})),[e]),!t)return null;let i=null;return typeof r=="function"?i=r(n):r!==null&&(i=r),i===null?null:g.jsx("div",{"aria-hidden":!0,children:i})}const In=0,fi=1,hi=2,wt=0,Yd=1,il=2,Xd=3,Zd=4;function ef(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return wt;const i=e._selection,o=r._selection;if(s)return Yd;if(!(O(i)&&O(o)&&o.isCollapsed()&&i.isCollapsed()))return wt;const a=function(w,x,E){const D=w._nodeMap,A=[];for(const b of x){const v=D.get(b);v!==void 0&&A.push(v)}for(const[b,v]of E){if(!v)continue;const S=D.get(b);S===void 0||tt(S)||A.push(S)}return A}(e,t,n);if(a.length===0)return wt;if(a.length>1){const w=e._nodeMap,x=w.get(i.anchor.key),E=w.get(o.anchor.key);return x&&E&&!r._nodeMap.has(x.__key)&&z(x)&&x.__text.length===1&&i.anchor.offset===1?il:wt}const l=a[0],u=r._nodeMap.get(l.__key);if(!z(u)||!z(l)||u.__mode!==l.__mode)return wt;const c=u.__text,d=l.__text;if(c===d)return wt;const f=i.anchor,h=o.anchor;if(f.key!==h.key||f.type!=="text")return wt;const p=f.offset,m=h.offset,y=d.length-c.length;return y===1&&m===p-1?il:y===-1&&m===p+1?Xd:y===-1&&m===p?Zd:wt}function tf(r,e){let t=Date.now(),n=wt;return(s,i,o,a,l,u)=>{const c=Date.now();if(u.has("historic"))return n=wt,t=c,hi;const d=ef(s,i,a,l,r.isComposing()),f=(()=>{const h=o===null||o.editor===r,p=u.has("history-push");if(!p&&h&&u.has("history-merge"))return In;if(s===null)return fi;const m=i._selection;return a.size>0||l.size>0?p===!1&&d!==wt&&d===n&&c<t+e&&h||a.size===1&&function(y,w,x){const E=w._nodeMap.get(y),D=x._nodeMap.get(y),A=w._selection,b=x._selection;return!(O(A)&&O(b)&&A.anchor.type==="element"&&A.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(w.read(()=>E.exportJSON()))===JSON.stringify(x.read(()=>D.exportJSON()))}(Array.from(a)[0],s,i)?In:fi:m!==null?In:hi})();return t=c,n=d,f}}function ol(r){r.undoStack=[],r.redoStack=[],r.current=null}function rf(r,e,t){const n=tf(r,t);return vr(r.registerCommand(_i,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(l.length!==0){const u=o.current,c=l.pop();u!==null&&(a.push(u),i.dispatchCommand(Fn,!0)),l.length===0&&i.dispatchCommand(Rn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(vi,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(a.length!==0){const u=o.current;u!==null&&(l.push(u),i.dispatchCommand(Rn,!0));const c=a.pop();a.length===0&&i.dispatchCommand(Fn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(tc,()=>(ol(e),!1),ye),r.registerCommand(rc,()=>(ol(e),r.dispatchCommand(Fn,!1),r.dispatchCommand(Rn,!1),!0),ye),r.registerUpdateListener(({editorState:i,prevEditorState:o,dirtyLeaves:a,dirtyElements:l,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&i===h)return;const p=n(o,i,c,a,l,u);if(p===fi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(Fn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(Rn,!0));else if(p===hi)return;e.current={editor:r,editorState:i}}))}function nf(){return{current:null,redoStack:[],undoStack:[]}}function sf({delay:r,externalHistoryState:e}){const[t]=St();return function(n,s,i=1e3){const o=C.useMemo(()=>s||nf(),[s]);C.useEffect(()=>rf(n,o,i),[i,n,o])}(t,e,r),null}const of=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function lf({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=St();return of(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:i,dirtyLeaves:o,prevEditorState:a,tags:l})=>{e&&i.size===0&&o.size===0||r&&l.has("history-merge")||a.isEmpty()||t(s,n,l)})},[n,r,e,t]),null}function pi(r,e){return pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},pi(r,e)}var ll={error:null},af=function(r){var e,t;function n(){for(var i,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(i=r.call.apply(r,[this].concat(a))||this).state=ll,i.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(u=i.props).onReset.apply(u,d),i.reset()},i}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,pi(e,t),n.getDerivedStateFromError=function(i){return{error:i}};var s=n.prototype;return s.reset=function(){this.setState(ll)},s.componentDidCatch=function(i,o){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,o)},s.componentDidUpdate=function(i,o){var a,l,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=i.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,p){return!Object.is(h,c[p])}))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,f),this.reset())},s.render=function(){var i=this.state.error,o=this.props,a=o.fallbackRender,l=o.FallbackComponent,u=o.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(Ns.isValidElement(u))return u;if(typeof a=="function")return a(c);if(l)return Ns.createElement(l,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ns.Component);function uf({children:r,onError:e}){return g.jsx(af,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function cf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mt=cf(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 df(r){let e=1,t=r.getParent();for(;t!=null;){if(Me(t)){const n=t.getParent();if(de(n)){e++,t=n.getParent();continue}Mt(40)}return e}return e}function gi(r){let e=r.getParent();de(e)||Mt(40);let t=e;for(;t!==null;)t=t.getParent(),de(t)&&(e=t);return e}function za(r){let e=[];const t=r.getChildren().filter(Me);for(let n=0;n<t.length;n++){const s=t[n],i=s.getFirstChild();de(i)?e=e.concat(za(i)):e.push(s)}return e}function Pt(r){return Me(r)&&de(r.getFirstChild())}function al(r){return dt().append(r)}function qa(r,e){return Me(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function ul(r,e){r.update(()=>{const t=K();if(t!==null){const n=t.getNodes();if(O(t)){const i=t.getStartEndPoints();i===null&&Mt(143);const[o]=i,a=o.getNode(),l=a.getParent();if(qa(a,n)){const u=lt(e);if(Ot(l)){a.replace(u);const c=dt();F(a)&&(c.setFormat(a.getFormatType()),c.setIndent(a.getIndent())),u.append(c)}else if(Me(a)){const c=a.getParentOrThrow();br(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let i=0;i<n.length;i++){const o=n[i];if(!F(o)||!o.isEmpty()||Me(o)||s.has(o.getKey())){if(Vl(o)){let a=o.getParent();for(;a!=null;){const l=a.getKey();if(de(a)){if(!s.has(l)){const u=lt(e);br(u,a.getChildren()),a.replace(u),s.add(l)}break}{const u=a.getParent();if(Ot(u)&&!s.has(l)){s.add(l),cl(a,e);break}a=u}}}}else cl(o,e)}}})}function br(r,e){r.splice(r.getChildrenSize(),0,e)}function cl(r,e){if(de(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=dt();let i;if(br(s,r.getChildren()),de(t)&&e===t.getListType())t.append(s),de(n)&&e===n.getListType()&&(br(t,n.getChildren()),n.remove()),i=t;else if(de(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),i=n;else{const o=lt(e);o.append(s),r.replace(o),i=o}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),i}function Hi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Pt(t)&&Pt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function ff(r){r.update(()=>{const e=K();if(O(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(qa(s,n))t.add(gi(s));else for(let i=0;i<n.length;i++){const o=n[i];if(Vl(o)){const a=Ed(o,Cr);a!=null&&t.add(gi(a))}}for(const i of t){let o=i;const a=za(i);for(const l of a){const u=Ue();br(u,l.getChildren()),o.insertAfter(u),o=u,l.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),l.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),l.remove()}i.remove()}}})}function hf(r){const e=new Set;if(Pt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Pt(n)&&Pt(s)){const i=s.getFirstChild();if(de(i)){i.append(r);const o=n.getFirstChild();de(o)&&(br(i,o.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Pt(n)){const i=n.getFirstChild();if(de(i)){const o=i.getFirstChild();o!==null&&o.insertBefore(r)}}else if(Pt(s)){const i=s.getFirstChild();de(i)&&i.append(r)}else if(de(t)){const i=dt(),o=lt(t.getListType());i.append(o),o.append(r),s?s.insertAfter(i):n?n.insertBefore(i):t.append(i)}}function pf(r){if(Pt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(de(t?t.getParent():void 0)&&Me(t)&&de(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 i=e.getListType(),o=dt(),a=lt(i);o.append(a),r.getPreviousSiblings().forEach(c=>a.append(c));const l=dt(),u=lt(i);l.append(u),br(u,r.getNextSiblings()),t.insertBefore(o),t.insertAfter(l),t.replace(r)}}}function gf(){const r=K();if(!O(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Me(e)||e.getChildrenSize()!==0)return!1;const t=gi(e),n=e.getParent();de(n)||Mt(40);const s=n.getParent();let i;if(Ot(s))i=Ue(),t.insertAfter(i);else{if(!Me(s))return!1;i=dt(),s.insertAfter(i)}i.select();const o=e.getNextSiblings();if(o.length>0){const a=lt(n.getListType());if(Or(i))i.insertAfter(a);else{const l=dt();l.append(a),i.insertAfter(l)}o.forEach(l=>{l.remove(),a.append(l)})}return function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const u=l.getParent();if(u==null||!Me(l)&&!de(l))break;l=u}l.remove()}(e),!0}function as(...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 Cr extends Jt{static getType(){return"listitem"}static clone(e){return new Cr(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 de(n)&&n.getListType()==="check"&&fl(t,this,null),t.value=this.__value,dl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return de(s)&&s.getListType()==="check"&&fl(t,this,e),t.value=this.__value,dl(t,n.theme,this),!1}static transform(){return e=>{if(Me(e)||Mt(144),e.__checked==null)return;const t=e.getParent();de(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:mf,priority:0})}}static importJSON(e){const t=dt();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(Me(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!de(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=lt(n.getListType());let i=this.getNextSibling();for(;i;){const o=i;i=i.getNextSibling(),s.append(o)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Mt(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(de(n)||Mt(39),Me(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const i=lt(n.getListType());s.forEach(o=>i.append(o)),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Pt(t)&&Pt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=dt(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Ue();this.getChildren().forEach(o=>t.append(o));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),i=Me(s);if(n.getChildrenSize()===1)if(i)n.remove(),s.select();else{n.insertBefore(t),n.remove();const o=e.anchor,a=e.focus,l=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(l,o.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.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 de(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(;Me(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Mt(117),(e=Math.floor(e))>=0||Mt(199);let t=this.getIndent();for(;t!==e;)t<e?(hf(this),t++):(pf(this),t--);return this}canInsertAfter(e){return Me(e)}canReplaceWith(e){return Me(e)}canMergeWith(e){return Or(e)||Me(e)}extractWithChild(e,t){if(!O(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 lt("bullet")}canMergeWhenEmpty(){return!0}}function dl(r,e,t){const n=[],s=[],i=e.list,o=i?i.listitem:void 0;let a;if(i&&i.nested&&(a=i.nested.listitem),o!==void 0&&n.push(...as(o)),i){const l=t.getParent(),u=de(l)&&l.getListType()==="check",c=t.getChecked();u&&!c||s.push(i.listitemUnchecked),u&&c||s.push(i.listitemChecked),u&&n.push(c?i.listitemChecked:i.listitemUnchecked)}if(a!==void 0){const l=as(a);t.getChildren().some(u=>de(u))?n.push(...l):s.push(...l)}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function fl(r,e,t,n){de(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 mf(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return yf(t)}const e=r.getAttribute("aria-checked");return{node:dt(e==="true"||e!=="false"&&void 0)}}function yf(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:dt(r.hasAttribute("checked"))}}function dt(r){return $t(new Cr(void 0,r))}function Me(r){return r instanceof Cr}class qr extends Jt{static getType(){return"list"}static clone(e){const t=e.__listType||gl[e.__tag];return new qr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=gl[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,hl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(hl(t,n.theme,this),!1)}static transform(){return e=>{de(e)||Mt(163),function(t){const n=t.getNextSibling();de(n)&&t.getListType()===n.getListType()&&Hi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const i of t.getChildren())Me(i)&&(i.getValue()!==s&&i.setValue(s),n&&i.getLatest().__checked!=null&&i.setChecked(void 0),de(i.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:pl,priority:0}),ul:()=>({conversion:pl,priority:0})}}static importJSON(e){const t=lt(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&&Ht(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(Me(n))super.append(n);else{const s=dt();if(de(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const i=Ge(n.getTextContent());s.append(i)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Me(e)}}function hl(r,e,t){const n=[],s=[],i=e.list;if(i!==void 0){const o=i[`${t.__tag}Depth`]||[],a=df(t)-1,l=a%o.length,u=o[l],c=i[t.__tag];let d;const f=i.nested,h=i.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(...as(u));for(let p=0;p<o.length;p++)p!==l&&s.push(t.__tag+p)}if(d!==void 0){const p=as(d);a>1?n.push(...p):s.push(...p)}}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function xf(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Me(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(i=>{de(i)&&e.push(al(i))})}else e.push(al(n))}return e}function pl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=lt("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(Ht(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?lt("check"):lt("bullet")),{after:xf,node:t}}const gl={ol:"number",ul:"bullet"};function lt(r,e=1){return $t(new qr(r,e))}function de(r){return r instanceof qr}const Ua=xn(),Wa=xn(),bf=xn();function _f(r){return vr(r.registerCommand(Wa,()=>(ul(r,"number"),!0),Nr),r.registerCommand(Ua,()=>(ul(r,"bullet"),!0),Nr),r.registerCommand(bf,()=>(ff(r),!0),Nr),r.registerCommand(dn,()=>!!gf(),Nr))}function vf(){const[r]=St();return C.useEffect(()=>{if(!r.hasNodes([qr,Cr]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){C.useEffect(()=>_f(e),[e])}(r),null}const Cf=new Set(["http:","https:","mailto:","sms:","tel:"]);class wr extends Jt{static getType(){return"link"}static clone(e){return new wr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=s,this.__rel=i,this.__title=o}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),Tn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,i=this.__target,o=this.__rel,a=this.__title;s!==e.__url&&(t.href=s),i!==e.__target&&(i?t.target=i:t.removeAttribute("target")),o!==e.__rel&&(o?t.rel=o:t.removeAttribute("rel")),a!==e.__title&&(a?t.title=a:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:wf,priority:1})}}static importJSON(e){const t=us(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(!Cf.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=us(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(!O(t))return!1;const s=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function wf(r){let e=null;if(Lc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=us(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function us(r,e){return $t(new wr(r,e))}function Jr(r){return r instanceof wr}class Nn extends wr{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 Nn(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=ml(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=ml(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ml(r,e){return $t(new Nn(r,e))}function Df(r){return r instanceof Nn}const yl=xn();function Gs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,i=K();if(!O(i))return;const o=i.extract();if(r===null)o.forEach(a=>{const l=Es(a,u=>!Df(u)&&Jr(u));if(l){const u=l.getChildren();for(let c=0;c<u.length;c++)l.insertBefore(u[c]);l.remove()}});else{if(o.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}(o[0],Jr);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 a=null,l=null;o.forEach(u=>{const c=u.getParent();if(c!==l&&c!==null&&(!F(u)||u.isInline())){if(Jr(c))return l=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&l.setRel(s),void(n!==void 0&&l.setTitle(n));if(c.is(a)||(a=c,l=us(r,{rel:s,target:t,title:n}),Jr(c)?u.getPreviousSibling()===null?c.insertBefore(l):c.insertAfter(l):u.insertBefore(l)),Jr(u)){if(u.is(l))return;if(l!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)l.append(d[f])}u.remove()}else l!==null&&l.append(u)}})}}function Ef({validateUrl:r,attributes:e}){const[t]=St();return C.useEffect(()=>{if(!t.hasNodes([wr]))throw new Error("LinkPlugin: LinkNode not registered on editor");return vr(t.registerCommand(yl,n=>{if(n===null)return Gs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Gs(n,e),!0);{const{url:s,target:i,rel:o,title:a}=n;return Gs(s,{...e,rel:o,target:i,title:a}),!0}},Nr),r!==void 0?t.registerCommand(fs,n=>{const s=K();if(!O(s)||s.isCollapsed()||!nr(n,ClipboardEvent))return!1;const i=n;if(i.clipboardData===null)return!1;const o=i.clipboardData.getData("text");return!!r(o)&&!s.getNodes().some(a=>F(a))&&(t.dispatchCommand(yl,{...e,url:o}),n.preventDefault(),!0)},Nr):()=>{})},[t,r,e]),null}function Sf(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return{node:Ga({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}function Af({src:r,alt:e,width:t,height:n}){return g.jsx("img",{src:r,alt:e,width:t,height:n,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}class ks extends Wi{constructor(t,n,s,i,o){super(o);_t(this,"__src");_t(this,"__altText");_t(this,"__width");_t(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=i}static getType(){return"image"}static clone(t){return new ks(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:i,height:o}=t;return Ga({src:n,altText:s,width:i,height:o})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:Sf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Af,{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height})}}function Ga(r){return new ks(r.src,r.altText,r.width,r.height)}var kf=Object.defineProperty,cs=Object.getOwnPropertySymbols,Va=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,xl=(r,e,t)=>e in r?kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mi=(r,e)=>{for(var t in e||(e={}))Va.call(e,t)&&xl(r,t,e[t]);if(cs)for(var t of cs(e))Ka.call(e,t)&&xl(r,t,e[t]);return r},yi=(r,e)=>{var t={};for(var n in r)Va.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&cs)for(var n of cs(r))e.indexOf(n)<0&&Ka.call(r,n)&&(t[n]=r[n]);return t};/**
|
|
74
|
+
* @license QR Code generator library (TypeScript)
|
|
75
|
+
* Copyright (c) Project Nayuki.
|
|
76
|
+
* SPDX-License-Identifier: MIT
|
|
77
|
+
*/var _r;(r=>{const e=class ie{constructor(l,u,c,d){if(this.version=l,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let f=[];for(let p=0;p<this.size;p++)f.push(!1);for(let p=0;p<this.size;p++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(c);if(this.drawCodewords(h),d==-1){let p=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const y=this.getPenaltyScore();y<p&&(d=m,p=y),this.applyMask(m)}}s(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(l,u){const c=r.QrSegment.makeSegments(l);return ie.encodeSegments(c,u)}static encodeBinary(l,u){const c=r.QrSegment.makeBytes(l);return ie.encodeSegments([c],u)}static encodeSegments(l,u,c=1,d=40,f=-1,h=!0){if(!(ie.MIN_VERSION<=c&&c<=d&&d<=ie.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let p,m;for(p=c;;p++){const E=ie.getNumDataCodewords(p,u)*8,D=o.getTotalBits(l,p);if(D<=E){m=D;break}if(p>=d)throw new RangeError("Data too long")}for(const E of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])h&&m<=ie.getNumDataCodewords(p,E)*8&&(u=E);let y=[];for(const E of l){t(E.mode.modeBits,4,y),t(E.numChars,E.mode.numCharCountBits(p),y);for(const D of E.getData())y.push(D)}s(y.length==m);const w=ie.getNumDataCodewords(p,u)*8;s(y.length<=w),t(0,Math.min(4,w-y.length),y),t(0,(8-y.length%8)%8,y),s(y.length%8==0);for(let E=236;y.length<w;E^=253)t(E,8,y);let x=[];for(;x.length*8<y.length;)x.push(0);return y.forEach((E,D)=>x[D>>>3]|=E<<7-(D&7)),new ie(p,u,x,f)}getModule(l,u){return 0<=l&&l<this.size&&0<=u&&u<this.size&&this.modules[u][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),u=l.length;for(let c=0;c<u;c++)for(let d=0;d<u;d++)c==0&&d==0||c==0&&d==u-1||c==u-1&&d==0||this.drawAlignmentPattern(l[c],l[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const u=this.errorCorrectionLevel.formatBits<<3|l;let c=u;for(let f=0;f<10;f++)c=c<<1^(c>>>9)*1335;const d=(u<<10|c)^21522;s(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,n(d,f));this.setFunctionModule(8,7,n(d,6)),this.setFunctionModule(8,8,n(d,7)),this.setFunctionModule(7,8,n(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,n(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,n(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,n(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let c=0;c<12;c++)l=l<<1^(l>>>11)*7973;const u=this.version<<12|l;s(u>>>18==0);for(let c=0;c<18;c++){const d=n(u,c),f=this.size-11+c%3,h=Math.floor(c/3);this.setFunctionModule(f,h,d),this.setFunctionModule(h,f,d)}}drawFinderPattern(l,u){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(c)),h=l+d,p=u+c;0<=h&&h<this.size&&0<=p&&p<this.size&&this.setFunctionModule(h,p,f!=2&&f!=4)}}drawAlignmentPattern(l,u){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(l+d,u+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(l,u,c){this.modules[u][l]=c,this.isFunction[u][l]=!0}addEccAndInterleave(l){const u=this.version,c=this.errorCorrectionLevel;if(l.length!=ie.getNumDataCodewords(u,c))throw new RangeError("Invalid argument");const d=ie.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][u],f=ie.ECC_CODEWORDS_PER_BLOCK[c.ordinal][u],h=Math.floor(ie.getNumRawDataModules(u)/8),p=d-h%d,m=Math.floor(h/d);let y=[];const w=ie.reedSolomonComputeDivisor(f);for(let E=0,D=0;E<d;E++){let A=l.slice(D,D+m-f+(E<p?0:1));D+=A.length;const b=ie.reedSolomonComputeRemainder(A,w);E<p&&A.push(0),y.push(A.concat(b))}let x=[];for(let E=0;E<y[0].length;E++)y.forEach((D,A)=>{(E!=m-f||A>=p)&&x.push(D[E])});return s(x.length==h),x}drawCodewords(l){if(l.length!=Math.floor(ie.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const h=c-f,m=(c+1&2)==0?this.size-1-d:d;!this.isFunction[m][h]&&u<l.length*8&&(this.modules[m][h]=n(l[u>>>3],7-(u&7)),u++)}}s(u==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let c=0;c<this.size;c++){let d;switch(l){case 0:d=(c+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+u)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(u/2))%2==0;break;case 5:d=c*u%2+c*u%3==0;break;case 6:d=(c*u%2+c*u%3)%2==0;break;case 7:d=((c+u)%2+c*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][c]&&d&&(this.modules[u][c]=!this.modules[u][c])}}getPenaltyScore(){let l=0;for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[f][y]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[f][y],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][f]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[y][f],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let h=0;h<this.size-1;h++){const p=this.modules[f][h];p==this.modules[f][h+1]&&p==this.modules[f+1][h]&&p==this.modules[f+1][h+1]&&(l+=ie.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((h,p)=>h+(p?1:0),u);const c=this.size*this.size,d=Math.ceil(Math.abs(u*20-c*10)/c)-1;return s(0<=d&&d<=9),l+=d*ie.PENALTY_N4,s(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let c=[6];for(let d=this.size-7;c.length<l;d-=u)c.splice(1,0,d);return c}}static getNumRawDataModules(l){if(l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*l+128)*l+64;if(l>=2){const c=Math.floor(l/7)+2;u-=(25*c-10)*c-55,l>=7&&(u-=36)}return s(208<=u&&u<=29648),u}static getNumDataCodewords(l,u){return Math.floor(ie.getNumRawDataModules(l)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l]*ie.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<l-1;d++)u.push(0);u.push(1);let c=1;for(let d=0;d<l;d++){for(let f=0;f<u.length;f++)u[f]=ie.reedSolomonMultiply(u[f],c),f+1<u.length&&(u[f]^=u[f+1]);c=ie.reedSolomonMultiply(c,2)}return u}static reedSolomonComputeRemainder(l,u){let c=u.map(d=>0);for(const d of l){const f=d^c.shift();c.push(0),u.forEach((h,p)=>c[p]^=ie.reedSolomonMultiply(h,f))}return c}static reedSolomonMultiply(l,u){if(l>>>8||u>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(u>>>d&1)*l;return s(c>>>8==0),c}finderPenaltyCountPatterns(l){const u=l[1];s(u<=this.size*3);const c=u>0&&l[2]==u&&l[3]==u*3&&l[4]==u&&l[5]==u;return(c&&l[0]>=u*4&&l[6]>=u?1:0)+(c&&l[6]>=u*4&&l[0]>=u?1:0)}finderPenaltyTerminateAndCount(l,u,c){return l&&(this.finderPenaltyAddHistory(u,c),u=0),u+=this.size,this.finderPenaltyAddHistory(u,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(l,u){u[0]==0&&(l+=this.size),u.pop(),u.unshift(l)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],r.QrCode=e;function t(a,l,u){if(l<0||l>31||a>>>l)throw new RangeError("Value out of range");for(let c=l-1;c>=0;c--)u.push(a>>>c&1)}function n(a,l){return(a>>>l&1)!=0}function s(a){if(!a)throw new Error("Assertion error")}const i=class Le{constructor(l,u,c){if(this.mode=l,this.numChars=u,this.bitData=c,u<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(l){let u=[];for(const c of l)t(c,8,u);return new Le(Le.Mode.BYTE,l.length,u)}static makeNumeric(l){if(!Le.isNumeric(l))throw new RangeError("String contains non-numeric characters");let u=[];for(let c=0;c<l.length;){const d=Math.min(l.length-c,3);t(parseInt(l.substring(c,c+d),10),d*3+1,u),c+=d}return new Le(Le.Mode.NUMERIC,l.length,u)}static makeAlphanumeric(l){if(!Le.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],c;for(c=0;c+2<=l.length;c+=2){let d=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c))*45;d+=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c+1)),t(d,11,u)}return c<l.length&&t(Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c)),6,u),new Le(Le.Mode.ALPHANUMERIC,l.length,u)}static makeSegments(l){return l==""?[]:Le.isNumeric(l)?[Le.makeNumeric(l)]:Le.isAlphanumeric(l)?[Le.makeAlphanumeric(l)]:[Le.makeBytes(Le.toUtf8ByteArray(l))]}static makeEci(l){let u=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)t(l,8,u);else if(l<16384)t(2,2,u),t(l,14,u);else if(l<1e6)t(6,3,u),t(l,21,u);else throw new RangeError("ECI assignment value out of range");return new Le(Le.Mode.ECI,0,u)}static isNumeric(l){return Le.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return Le.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,u){let c=0;for(const d of l){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;c+=4+f+d.bitData.length}return c}static toUtf8ByteArray(l){l=encodeURI(l);let u=[];for(let c=0;c<l.length;c++)l.charAt(c)!="%"?u.push(l.charCodeAt(c)):(u.push(parseInt(l.substring(c+1,c+3),16)),c+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=i;r.QrSegment=i})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.ordinal=s,this.formatBits=i}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(r.QrCode||(r.QrCode={}))})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.modeBits=s,this.numBitsCharCount=i}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(r.QrSegment||(r.QrSegment={}))})(_r||(_r={}));var Br=_r;/**
|
|
78
|
+
* @license qrcode.react
|
|
79
|
+
* Copyright (c) Paul O'Shannessy
|
|
80
|
+
* SPDX-License-Identifier: ISC
|
|
81
|
+
*/var Tf={L:Br.QrCode.Ecc.LOW,M:Br.QrCode.Ecc.MEDIUM,Q:Br.QrCode.Ecc.QUARTILE,H:Br.QrCode.Ecc.HIGH},Ha=128,Qa="L",Ja="#FFFFFF",Ya="#000000",Xa=!1,Za=1,Nf=4,Bf=0,Ff=.1;function eu(r,e=0){const t=[];return r.forEach(function(n,s){let i=null;n.forEach(function(o,a){if(!o&&i!==null){t.push(`M${i+e} ${s+e}h${a-i}v1H${i+e}z`),i=null;return}if(a===n.length-1){if(!o)return;i===null?t.push(`M${a+e},${s+e} h1v1H${a+e}z`):t.push(`M${i+e},${s+e} h${a+1-i}v1H${i+e}z`);return}o&&i===null&&(i=a)})}),t.join("")}function tu(r,e){return r.slice().map((t,n)=>n<e.y||n>=e.y+e.h?t:t.map((s,i)=>i<e.x||i>=e.x+e.w?s:!1))}function Rf(r,e,t,n){if(n==null)return null;const s=r.length+t*2,i=Math.floor(e*Ff),o=s/e,a=(n.width||i)*o,l=(n.height||i)*o,u=n.x==null?r.length/2-a/2:n.x*o,c=n.y==null?r.length/2-l/2:n.y*o,d=n.opacity==null?1:n.opacity;let f=null;if(n.excavate){let p=Math.floor(u),m=Math.floor(c),y=Math.ceil(a+u-p),w=Math.ceil(l+c-m);f={x:p,y:m,w:y,h:w}}const h=n.crossOrigin;return{x:u,y:c,h:l,w:a,excavation:f,opacity:d,crossOrigin:h}}function Lf(r,e){return e!=null?Math.max(Math.floor(e),0):r?Nf:Bf}function ru({value:r,level:e,minVersion:t,includeMargin:n,marginSize:s,imageSettings:i,size:o,boostLevel:a}){let l=C.useMemo(()=>{const p=(Array.isArray(r)?r:[r]).reduce((m,y)=>(m.push(...Br.QrSegment.makeSegments(y)),m),[]);return Br.QrCode.encodeSegments(p,Tf[e],t,void 0,void 0,a)},[r,e,t,a]);const{cells:u,margin:c,numCells:d,calculatedImageSettings:f}=C.useMemo(()=>{let h=l.getModules();const p=Lf(n,s),m=h.length+p*2,y=Rf(h,o,p,i);return{cells:h,margin:p,numCells:m,calculatedImageSettings:y}},[l,o,i,n,s]);return{qrcode:l,margin:c,cells:u,numCells:d,calculatedImageSettings:f}}var Mf=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Pf=C.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,marginSize:f,imageSettings:h}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=m,w=yi(m,["style"]),x=h==null?void 0:h.src,E=C.useRef(null),D=C.useRef(null),A=C.useCallback(R=>{E.current=R,typeof t=="function"?t(R):t&&(t.current=R)},[t]),[b,v]=C.useState(!1),{margin:S,cells:k,numCells:j,calculatedImageSettings:T}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:h,size:i});C.useEffect(()=>{if(E.current!=null){const R=E.current,P=R.getContext("2d");if(!P)return;let Q=k;const se=D.current,xe=T!=null&&se!==null&&se.complete&&se.naturalHeight!==0&&se.naturalWidth!==0;xe&&T.excavation!=null&&(Q=tu(k,T.excavation));const oe=window.devicePixelRatio||1;R.height=R.width=i*oe;const Se=i/j*oe;P.scale(Se,Se),P.fillStyle=a,P.fillRect(0,0,j,j),P.fillStyle=l,Mf?P.fill(new Path2D(eu(Q,S))):k.forEach(function(he,fe){he.forEach(function(pe,ge){pe&&P.fillRect(ge+S,fe+S,1,1)})}),T&&(P.globalAlpha=T.opacity),xe&&P.drawImage(se,T.x+S,T.y+S,T.w,T.h)}}),C.useEffect(()=>{v(!1)},[x]);const B=mi({height:i,width:i},y);let L=null;return x!=null&&(L=C.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{v(!0)},ref:D,crossOrigin:T==null?void 0:T.crossOrigin})),C.createElement(C.Fragment,null,C.createElement("canvas",mi({style:B,height:i,width:i,ref:A,role:"img"},w)),L)});Pf.displayName="QRCodeCanvas";var nu=C.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,title:f,marginSize:h,imageSettings:p}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:w,numCells:x,calculatedImageSettings:E}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:h,imageSettings:p,size:i});let D=w,A=null;p!=null&&E!=null&&(E.excavation!=null&&(D=tu(w,E.excavation)),A=C.createElement("image",{href:p.src,height:E.h,width:E.w,x:E.x+y,y:E.y+y,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const b=eu(D,y);return C.createElement("svg",mi({height:i,width:i,viewBox:`0 0 ${x} ${x}`,ref:t,role:"img"},m),!!f&&C.createElement("title",null,f),C.createElement("path",{fill:a,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),C.createElement("path",{fill:l,d:b,shapeRendering:"crispEdges"}),A)});nu.displayName="QRCodeSVG";function jf(r){if(r instanceof HTMLElement&&r.dataset.qrcodeData){const e=r.dataset.qrcodeData,t=r.dataset.qrcodeSize?parseInt(r.dataset.qrcodeSize,10):void 0;return{node:Qi({data:e,size:t})}}return null}function Of({data:r,size:e=150}){return g.jsx("div",{style:{display:"inline-block",background:"#f9f9f9",padding:"12px",borderRadius:"8px",margin:"8px 0"},children:g.jsx(nu,{value:r,size:e,level:"M"})})}class Ur extends Wi{constructor(t,n=150,s){super(s);_t(this,"__data");_t(this,"__size");this.__data=t,this.__size=n}static getType(){return"qrcode"}static clone(t){return new Ur(t.__data,t.__size,t.__key)}static importJSON(t){const{data:n,size:s}=t;return Qi({data:n,size:s})}exportJSON(){return{type:"qrcode",version:1,data:this.__data,size:this.__size}}static importDOM(){return{div:t=>t.dataset.qrcodeData?{conversion:jf,priority:1}:null}}exportDOM(){const t=document.createElement("div");return t.dataset.qrcodeData=this.__data,t.dataset.qrcodeSize=String(this.__size),t.style.display="inline-block",t.style.background="#f9f9f9",t.style.padding="12px",t.style.borderRadius="8px",t.textContent="[QR Code]",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Of,{data:this.__data,size:this.__size})}getData(){return this.__data}getSize(){return this.__size}}function Qi(r){return new Ur(r.data,r.size)}function If(r){return r instanceof Ur}const $f={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},zf={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 qf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:i,aiProcessingAction:o,onAiAction:a,hasContent:l}){const[u]=St(),[c,d]=C.useState(!1),f=C.useRef(null),h=t||n||s,p=C.useCallback(()=>{u.dispatchCommand(Dt,"bold")},[u]),m=C.useCallback(()=>{u.dispatchCommand(Dt,"italic")},[u]),y=C.useCallback(()=>{u.dispatchCommand(Dt,"underline")},[u]),w=C.useCallback(()=>{u.dispatchCommand(Ua,void 0)},[u]),x=C.useCallback(()=>{u.dispatchCommand(Wa,void 0)},[u]),E=C.useCallback(()=>{u.update(()=>{const v=K();O(v)&&bd(v,()=>Ki())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},A=`
|
|
74
82
|
.mail-editor-toolbar-btn:hover:not(:disabled) {
|
|
75
83
|
background: ${r.border};
|
|
76
84
|
}
|
|
77
|
-
`,
|
|
78
|
-
`).map(
|
|
85
|
+
`,b=()=>{setTimeout(()=>{var v;(v=f.current)!=null&&v.contains(document.activeElement)||d(!1)},150)};return g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:A}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:p,disabled:e,style:D,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{...D,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:y,disabled:e,style:{...D,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:w,disabled:e,style:D,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:x,disabled:e,style:D,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:E,disabled:e,style:D,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"})})})]}),h&&g.jsxs("div",{style:{position:"relative"},ref:f,children:[g.jsx("button",{type:"button",onClick:()=>d(!c),disabled:i||!l||e,onBlur:b,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:i||!l?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:i||!l||e?"not-allowed":"pointer",opacity:i||!l?.5:1},children:i?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),o==="restructure"&&"Restructuring...",o==="proofread"&&"Proofreading...",o==="rewrite"&&"Rewriting..."]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",g.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!i&&g.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Restructure"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Proofread"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function Uf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=St(),s=C.useRef(!1);return C.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const i=Fe();i.clear();const o=Ue();i.append(o),o.select();const l=new DOMParser().parseFromString(r,"text/html"),c=La(n,l).filter(d=>d.getParent()===null);c.length>0&&ba(c),o.getTextContent()===""&&i.getChildrenSize()>1&&o.remove(),i.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function Wf({text:r,trigger:e}){const[t]=St(),n=C.useRef(void 0);return C.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const i=K();if(O(i))i.insertText(s);else{const o=Fe(),a=o.getLastChild();if(a){a.selectEnd();const l=K();O(l)&&l.insertText(s)}else{const l=Ue(),u=Ge(s);l.append(u),o.append(l)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function Gf({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 su({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:i=!1,className:o="",minHeight:a="200px",externalUpdate:l,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:p,aiProcessingAction:m,renderAboveToolbar:y}){const w={...$f,...s},[x,E]=C.useState(!1),D=C.useRef(void 0),[A,b]=C.useState(r),[v,S]=C.useState(!1),[k,j]=C.useState(null),T=p??v,B=m??k;C.useEffect(()=>{l!==void 0&&l!==D.current&&(D.current=l,E(!0))},[l]);const L=C.useCallback(()=>{E(!1)},[]),R=he=>he.replace(/<[^>]*>/g,"").trim(),P=he=>he.split(`
|
|
86
|
+
`).map(fe=>`<p>${fe||"<br>"}</p>`).join(""),Q=async he=>{const fe=R(A);if(!fe)return;const pe=he==="restructure"?d:he==="proofread"?f:h;if(pe){S(!0),j(he);try{const ge=await pe(fe),Ae=P(ge);b(Ae),e==null||e(Ae),D.current=Date.now(),E(!0)}catch(ge){console.error(`AI ${he} failed:`,ge)}finally{S(!1),j(null)}}},se=R(A).length>0,xe={namespace:"MailEditor",theme:zf,onError:he=>{console.error("Lexical error:",he)},nodes:[qr,Cr,wr,Nn,As,Ss,ks,Ur],editable:!i},oe=C.useCallback((he,fe)=>{he.read(()=>{const pe=Ma(fe,null);b(pe),e==null||e(pe)})},[e]),Se=`
|
|
79
87
|
.mail-editor-paragraph {
|
|
80
88
|
margin: 0 0 8px 0;
|
|
81
89
|
line-height: 1.5;
|
|
@@ -124,7 +132,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
124
132
|
}
|
|
125
133
|
.mail-editor-content {
|
|
126
134
|
outline: none;
|
|
127
|
-
min-height: ${
|
|
135
|
+
min-height: ${a};
|
|
128
136
|
padding: 16px;
|
|
129
137
|
font-size: 14px;
|
|
130
138
|
line-height: 1.6;
|
|
@@ -145,9 +153,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
145
153
|
from { transform: rotate(0deg); }
|
|
146
154
|
to { transform: rotate(360deg); }
|
|
147
155
|
}
|
|
148
|
-
`;return
|
|
156
|
+
`;return g.jsxs("div",{className:o,style:{border:`1px solid ${w.border}`,borderRadius:"8px",background:w.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:a},children:[g.jsx("style",{children:Se}),y,g.jsxs(od,{initialConfig:xe,children:[g.jsx(qf,{theme:w,disabled:i,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:T,aiProcessingAction:B,onAiAction:Q,hasContent:se}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(Wd,{contentEditable:g.jsx(Hd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:w.text}}),placeholder:g.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:uf})}),g.jsx(vf,{}),g.jsx(Ef,{}),g.jsx(sf,{}),g.jsx(lf,{onChange:oe}),g.jsx(Uf,{html:x?A:r,isExternalUpdate:x,onImportComplete:L}),g.jsx(Wf,{text:u,trigger:c})]}),n&&g.jsx(Gf,{replyTo:n,theme:w})]})}const Vf={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 Kf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:i,onBodyChange:o,externalUpdate:a,insertText:l,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:p="",minHeight:m="200px",sendButtonText:y="Send",hideCancelButton:w=!1,onAiRestructure:x,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:A}){const b={...Vf,...c},[v,S]=C.useState(r),[k,j]=C.useState(""),[T,B]=C.useState(""),[L,R]=C.useState(e),[P,Q]=C.useState(t),[se,xe]=C.useState([]),[oe,Se]=C.useState(!1),[he,fe]=C.useState(""),[pe,ge]=C.useState(f),[Ae,be]=C.useState(!1),we=C.useRef(void 0);C.useEffect(()=>{a!==void 0&&a!==we.current&&(we.current=a,Q(t),be(!0))},[a,t]);const Re=W=>{Q(W),be(!1),o==null||o(W)},ce=C.useRef(null),[je,at]=C.useState(!1),kt=W=>{const De=W.target.files;if(De){const Te=Array.from(De);console.log("[MailComposer] Files selected:",Te.map(ke=>({name:ke.name,size:ke.size,type:ke.type}))),xe(ke=>[...ke,...Te])}ce.current&&(ce.current.value="")},zt=W=>{W.preventDefault(),W.stopPropagation(),at(!0)},nt=W=>{W.preventDefault(),W.stopPropagation(),at(!1)},mt=W=>{if(W.preventDefault(),W.stopPropagation(),at(!1),W.dataTransfer.files&&W.dataTransfer.files.length>0){const De=Array.from(W.dataTransfer.files);console.log("[MailComposer] Files dropped:",De.map(Te=>({name:Te.name,size:Te.size,type:Te.type}))),xe(Te=>[...Te,...De])}else console.log("[MailComposer] Drop event but no files:",W.dataTransfer.types)},ft=W=>W.type.startsWith("image/")?"image":W.type==="application/pdf"?"picture_as_pdf":W.type.includes("spreadsheet")||W.type.includes("excel")?"table_chart":W.type.includes("document")||W.type.includes("word")?"description":"attach_file",Yt=W=>{xe(De=>De.filter((Te,ke)=>ke!==W))},qt=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,Tt=async()=>{if(!v.trim()){fe("Recipient email is required");return}if(!L.trim()){fe("Subject is required");return}Se(!0),fe("");try{const W=await Promise.all(se.map(async ke=>{const Bt=await ke.arrayBuffer(),Ft=btoa(new Uint8Array(Bt).reduce((Ut,V)=>Ut+String.fromCharCode(V),""));return{filename:ke.name,content_type:ke.type||"application/octet-stream",data:Ft,size:ke.size}})),De=P.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),Te={to:v.trim(),cc:k.trim()||void 0,bcc:T.trim()||void 0,subject:L.trim(),html:De,attachments:W,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",Te.to,"subject:",Te.subject,"attachmentsCount:",Te.attachments.length),Te.attachments.length>0&&Te.attachments.forEach((ke,Bt)=>{var Ft;console.log(`[MailComposer] Attachment ${Bt+1}:`,ke.filename,"size:",ke.size,"type:",ke.content_type,"data length:",((Ft=ke.data)==null?void 0:Ft.length)||0)}),await s(Te),S(""),j(""),B(""),R(""),Q(""),xe([])}catch(W){fe(W instanceof Error?W.message:"Failed to send email")}finally{Se(!1)}},Nt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${b.inputBorder}`,borderRadius:"6px",background:b.inputBackground,color:b.text,outline:"none"},ut={display:"block",fontSize:"12px",fontWeight:500,color:b.textSecondary,marginBottom:"4px",textTransform:"uppercase"},yt=(W,De=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:De?"not-allowed":"pointer",opacity:De?.6:1,background:W?b.buttonPrimary:b.buttonSecondary,color:W?"#ffffff":b.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:p,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:b.background},children:[he&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:he}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"To"}),g.jsx("input",{type:"email",value:v,onChange:W=>S(W.target.value),placeholder:"recipient@example.com",disabled:d||oe,style:Nt})]}),!pe&&g.jsx("button",{type:"button",onClick:()=>ge(!0),disabled:d||oe,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:b.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),pe&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"CC"}),g.jsx("input",{type:"email",value:k,onChange:W=>j(W.target.value),placeholder:"cc@example.com",disabled:d||oe,style:Nt})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"BCC"}),g.jsx("input",{type:"email",value:T,onChange:W=>B(W.target.value),placeholder:"bcc@example.com",disabled:d||oe,style:Nt})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"Subject"}),g.jsx("input",{type:"text",value:L,onChange:W=>R(W.target.value),placeholder:"Email subject",disabled:d||oe,style:Nt})]}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(su,{value:P,onChange:Re,placeholder:h,replyTo:n,theme:b,disabled:d||oe,minHeight:m,externalUpdate:Ae?a:void 0,insertText:l,insertTextTrigger:u,onAiRestructure:x,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:A})})}),g.jsxs("div",{children:[g.jsx("label",{style:{...ut,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:kt,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var W;return(W=ce.current)==null?void 0:W.click()},onDragOver:zt,onDragLeave:nt,onDrop:mt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${je?b.primary:b.border}`,borderRadius:"8px",background:je?`${b.primary}10`:"transparent",color:je?b.primary:b.textSecondary,cursor:d||oe?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:se.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:je?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:je?"Drop files here":"Drop files or click to add"})]}),se.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:se.map((W,De)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:b.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b.textSecondary},children:ft(W)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:b.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary},children:qt(W.size)})]}),g.jsx("button",{type:"button",onClick:()=>Yt(De),disabled:d||oe,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:b.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${De}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!w&&i&&g.jsx("button",{type:"button",onClick:i,disabled:d||oe,style:yt(!1,d||oe),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:Tt,disabled:d||oe||!v.trim()||!L.trim(),style:yt(!0,d||oe||!v.trim()||!L.trim()),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:oe?"spin 1s linear infinite":"none"},children:oe?"sync":"send"}),oe?"Sending...":y]})]}),g.jsx("style",{children:`
|
|
149
157
|
@keyframes spin {
|
|
150
158
|
from { transform: rotate(0deg); }
|
|
151
159
|
to { transform: rotate(360deg); }
|
|
152
160
|
}
|
|
153
|
-
`})]})}const bf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function _f({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={...bf,...d},[g,m]=C.useState(!1),[b,w]=C.useState(""),v=C.useRef(null),E=C.useRef(null);C.useEffect(()=>{function B(N){v.current&&!v.current.contains(N.target)&&(m(!1),w(""))}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const D=r.filter(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase().includes(b.toLowerCase()))&&!e.includes(B.id)}),k=s&&b.trim()&&!r.some(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase())===b.toLowerCase()}),y=e.map(B=>r.find(N=>N.id===B)).filter(Boolean),_=C.useCallback(B=>{var N;c>0&&e.length>=c||(t([...e,B]),w(""),c===1?m(!1):(N=E.current)==null||N.focus())},[e,t,c]),S=C.useCallback(B=>{t(e.filter(N=>N!==B))},[e,t]),A=C.useCallback(async()=>{if(!k)return;const B=await(o==null?void 0:o(b.trim()));B&&_(B.id),w("")},[k,b,o,_]),I=C.useCallback(B=>{B.key==="Enter"?(B.preventDefault(),k?A():D.length>0&&_(D[0].id)):B.key==="Backspace"&&!b&&e.length>0?S(e[e.length-1]):B.key==="Escape"&&(m(!1),w(""))},[k,D,b,e,A,_,S]);return p.jsxs("div",{ref:v,className:f,style:{position:"relative"},children:[a&&p.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),p.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${g?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[y.map(B=>p.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:B.color||h.chipBackground,color:B.color?"#fff":h.chipText},children:[B.label,!u&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),S(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},B.id)),p.jsx("input",{ref:E,type:"text",value:b,onChange:B=>{w(B.target.value),g||m(!0)},onFocus:()=>m(!0),onKeyDown:I,placeholder:y.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),g&&!u&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:D.length===0&&!k?p.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:b?"No matches":"No options available"}):p.jsxs(p.Fragment,{children:[D.map(B=>p.jsxs("div",{onClick:()=>_(B.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[B.label,i&&l&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},B.id)),k&&p.jsxs("div",{onClick:A,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:['+ Create "',b.trim(),'"']})]})})]})}function vf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:a,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[g,m]=C.useState(null),[b,w]=C.useState(null),[v,E]=C.useState(null),D=C.useRef(null),k=e.reduce((N,j)=>{let R=r.filter($=>n($)===j.id);return s&&(R=R.sort(($,X)=>s($)-s(X))),N[j.id]=R,N},{}),y=C.useCallback((N,j)=>{const R=t(j),$=n(j);m(R),D.current=$,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const X=N.target;X.style.opacity="0.5"})},[t,n]),_=C.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),w(null),E(null),D.current=null},[]),S=C.useCallback((N,j,R)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",w(j),E(R)},[]),A=C.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(w(null),E(null))},[]),I=C.useCallback((N,j,R)=>{if(N.preventDefault(),!g)return;const $=D.current;$===j?l==null||l(g,j,R):$&&i(g,$,j,R),m(null),w(null),E(null),D.current=null},[g,i,l]),B=(N,j)=>p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),p.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),p.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return p.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=k[N.id]||[],R=b===N.id;return p.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:$=>{$.preventDefault(),g&&!R&&w(N.id)},onDragLeave:A,onDrop:$=>I($,N.id,v??j.length),children:[p.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(N,j.length):B(N,j.length)}),p.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[j.map(($,X)=>{const ce=t($),ve=g===ce,le=R&&v===X&&!ve;return p.jsxs("div",{children:[le&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),p.jsx("div",{draggable:!0,onDragStart:Re=>y(Re,$),onDragEnd:_,onDragOver:Re=>S(Re,N.id,X),onClick:()=>a==null?void 0:a($),className:`cursor-grab active:cursor-grabbing transition-all ${ve?"opacity-50 scale-95":""} ${h}`,children:o($,ve)})]},ce)}),p.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:$=>{$.preventDefault(),S($,N.id,j.length)},children:R&&v===j.length&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&R&&p.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:p.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&p.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(N)})]},N.id)})})}const Cf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function wf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function Df(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function Sf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function Ef({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:a,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:g={}}){const m={...Cf,...g},{allDayItems:b,timedItems:w}=C.useMemo(()=>{const _=[],S=[];for(const A of r)l(A)?_.push(A):S.push(A);return{allDayItems:_,timedItems:S}},[r,l]),v=C.useMemo(()=>{const _=[];for(let S=t;S<=n;S++)_.push(S);return _},[t,n]),E=(n-t+1)*s,D=C.useCallback(_=>{const S=o(_);if(!S)return null;const A=wf(S);if(!A)return null;const{hours:I,minutes:B}=A,N=Math.max(t,Math.min(n,I)),j=I<t?0:B,R=(N-t)*s+j/60*s,$=i(_),X=Math.max(20,$/60*s);return{top:R,height:X}},[o,i,t,n,s]),k=C.useMemo(()=>{if(!f||!Sf(e))return null;const _=new Date,S=_.getHours(),A=_.getMinutes();return S<t||S>n?null:(S-t)*s+A/60*s},[e,f,t,n,s]),y=C.useCallback(_=>{if(!d)return;const S=_.currentTarget.getBoundingClientRect(),I=(_.clientY-S.top)/s*60,B=Math.floor(I/60)+t,N=Math.round(I%60/15)*15,j=Math.min(n,Math.max(t,B)),R=N>=60?0:N,$=`${j.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d($)},[d,s,t,n]);return p.jsxs("div",{className:h,style:{background:m.background},children:[b.length>0&&p.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[p.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:b.map(_=>p.jsx("div",{onClick:()=>c==null?void 0:c(_),style:{cursor:c?"pointer":"default"},children:u(_)},a(_)))})]}),p.jsxs("div",{style:{position:"relative",height:E},children:[v.map((_,S)=>p.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[p.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:Df(_)}),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<v.length-1&&p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},_)),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:y}),k!==null&&p.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,zIndex:20,pointerEvents:"none"},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),p.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),w.map(_=>{const S=D(_);return S?p.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:A=>{A.stopPropagation(),c==null||c(_)},children:u(_)},a(_)):null})]})]})}function kf({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:o=!1,maxDuration:i=180}){const l=s==="widget",[a,u]=C.useState("idle"),[c,d]=C.useState(0),[f,h]=C.useState(0),[g,m]=C.useState(!1),[b,w]=C.useState(0),[v,E]=C.useState(null),[D,k]=C.useState(!1),[y,_]=C.useState(null),[S,A]=C.useState(!0),[I,B]=C.useState([]),[N,j]=C.useState({completed:0,total:0}),R=C.useRef(!1),$=C.useRef(!0);C.useEffect(()=>{$.current=S},[S]);const X=C.useRef(null),ce=C.useRef(null),ve=C.useRef(null),le=C.useRef(null),Re=C.useRef(null),me=C.useRef([]),he=C.useRef(null),ye=C.useRef(null),xe=C.useRef(null),Se=C.useRef(null),pe=C.useRef(!1),Ce=C.useRef([]),Ne=C.useRef(null),ae=C.useRef(null),Le=C.useRef([]),ot=C.useRef([]),Et=C.useRef("insert"),It=C.useRef(!1),tt=C.useRef(0),pt=C.useRef(0),ct=C.useRef(0),Jt=q=>{const T=Math.floor(q/60),H=Math.floor(q%60);return`${T.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},$t=async q=>{const T=await q.arrayBuffer(),H=new AudioContext,Q=await H.decodeAudioData(T);return await H.close(),Q},kt=q=>{const T=q.numberOfChannels,H=q.sampleRate,Q=1,O=16,re=O/8,Z=T*re,ee=H*Z,de=q.length*Z,De=new ArrayBuffer(44+de),te=new DataView(De),ne=(Te,be)=>{for(let He=0;He<be.length;He++)te.setUint8(Te+He,be.charCodeAt(He))};ne(0,"RIFF"),te.setUint32(4,36+de,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Q,!0),te.setUint16(22,T,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,O,!0),ne(36,"data"),te.setUint32(40,de,!0);const Ie=[];for(let Te=0;Te<T;Te++)Ie.push(q.getChannelData(Te));let qe=44;for(let Te=0;Te<q.length;Te++)for(let be=0;be<T;be++){const He=Math.max(-1,Math.min(1,Ie[be][Te])),Je=He<0?He*32768:He*32767;te.setInt16(qe,Je,!0),qe+=2}return new Blob([De],{type:"audio/wav"})},At=async(q,T,H,Q)=>{const O=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,T.numberOfChannels),ee=Math.min(H,q.length),de=Math.max(0,q.length-H),De=Q==="insert"?ee+T.length+de:ee+T.length,te=O.createBuffer(Z,De,re);for(let ne=0;ne<Z;ne++){const Ie=te.getChannelData(ne),qe=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let be=0;be<ee;be++)Ie[be]=qe[be];const Te=ne<T.numberOfChannels?T.getChannelData(ne):T.getChannelData(0);for(let be=0;be<T.length;be++)Ie[ee+be]=Te[be];if(Q==="insert")for(let be=0;be<de;be++)Ie[ee+T.length+be]=qe[H+be]}return await O.close(),te},lt=C.useCallback(()=>{const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height,re=Ce.current,Z=f||c||1,ee=a==="recording"?c:b;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const de=8,De="rgba(0, 0, 0, 0.4)",te=T.createLinearGradient(0,0,0,de);te.addColorStop(0,De),te.addColorStop(1,"transparent"),T.fillStyle=te,T.fillRect(0,0,Q,de);const ne=T.createLinearGradient(0,O-de,0,O);ne.addColorStop(0,"transparent"),ne.addColorStop(1,De),T.fillStyle=ne,T.fillRect(0,O-de,Q,de);const Ie=T.createLinearGradient(0,0,de,0);Ie.addColorStop(0,De),Ie.addColorStop(1,"transparent"),T.fillStyle=Ie,T.fillRect(0,0,de,O);const qe=T.createLinearGradient(Q-de,0,Q,0);qe.addColorStop(0,"transparent"),qe.addColorStop(1,De),T.fillStyle=qe,T.fillRect(Q-de,0,de,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const Te=Q/2;if(re.length>0)if(a==="recording")for(let Je=0;Je<re.length;Je++){const dt=re.length-1-Je,qt=Te-dt*4;if(qt<-3||qt>Q)continue;const yt=re[Je]*(O/2-12),x=O/2-yt;T.fillStyle="#10b981",T.fillRect(qt,x,3,yt*2)}else{const Je=Z>0?ee/Z*re.length:0;for(let dt=0;dt<re.length;dt++){const qt=Je-dt,yt=Te-qt*4;if(yt<-3||yt>Q)continue;const x=re[dt]*(O/2-12),L=O/2-x;T.fillStyle=dt<=Je?"#10b981":"#4b5563",T.fillRect(yt,L,3,x*2)}}T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(Te,0),T.lineTo(Te,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText(Jt(ee),Te,O-6),a==="recording"&&(T.fillStyle="#ef4444",T.beginPath(),T.arc(20,20,8,0,Math.PI*2),T.fill(),T.fillStyle="#fff",T.font="10px sans-serif",T.textAlign="left",T.fillText("REC",34,24)),T.textAlign="left"},[a,b,c,f]),gt=()=>{const q=Re.current;if(!q||!pe.current)return;const T=q.frequencyBinCount,H=new Uint8Array(T);q.getByteTimeDomainData(H);let Q=0;for(let Z=0;Z<T;Z++){const ee=(H[Z]-128)/128;Q+=ee*ee}const O=Math.sqrt(Q/T),re=Math.min(1,O*3);Ce.current.push(re),lt(),pe.current&&(ye.current=requestAnimationFrame(gt))},W=async()=>{try{E(null),k(!1),Ne.current===null&&(Ce.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});ve.current=q;const T=new AudioContext;le.current=T;const H=T.createAnalyser();H.fftSize=2048,Re.current=H,T.createMediaStreamSource(q).connect(H);const O=new MediaRecorder(q);ce.current=O,me.current=[],O.ondataavailable=re=>{re.data.size>0&&me.current.push(re.data)},O.onstop=async()=>{try{if(pe.current=!1,me.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(me.current,{type:"audio/webm"});let Z,ee;if(Ne.current!==null&&ae.current)try{const te=await $t(re),ne=ae.current.sampleRate,Ie=Math.floor(Ne.current*ne),qe=await At(ae.current,te,Ie,Et.current);Z=kt(qe),ee=qe.length/qe.sampleRate,Et.current==="insert"&&(Ce.current=[...Ce.current,...ot.current]),Ne.current=null,ae.current=null,Le.current=[],ot.current=[]}catch{Z=re,ee=tt.current>0?tt.current:1}else Z=re,ee=tt.current>0?tt.current:1;if(Se.current=Z,q.getTracks().forEach(te=>te.stop()),$.current&&t){B(te=>[...te,Z]),j(te=>({...te,total:te.total+1})),Se.current=null,Ce.current=[],w(0),h(0),d(0),u("idle");return}const de=URL.createObjectURL(Z),De=new Audio(de);De.ontimeupdate=()=>{w(De.currentTime)},De.onended=()=>{m(!1)},xe.current=De,h(ee),w(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},O.start(100),pe.current=!0,u("recording"),d(0),tt.current=0,he.current=setInterval(()=>{tt.current+=1,d(tt.current),tt.current>=i&&(ce.current&&ce.current.state!=="inactive"&&ce.current.stop(),pe.current=!1,_(null),he.current&&(clearInterval(he.current),he.current=null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(i/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},we=()=>{pe.current=!1,k(!1),_(null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),he.current&&(clearInterval(he.current),he.current=null),ce.current&&ce.current.state!=="inactive"&&ce.current.stop()},ke=q=>{const T=X.current;if(!T)return;const H=f||c;if(H<=0)return;const Q=Ce.current;if(Q.length===0)return;const O=T.getBoundingClientRect(),re=q-pt.current,Z=4,ee=O.width/T.width,de=Q.length/H*Z,De=-re/(de*ee),te=ct.current+De,ne=Math.max(0,Math.min(te,H));xe.current&&(xe.current.currentTime=ne),w(ne)},Ee=()=>{xe.current&&(xe.current.currentTime=0),w(0)},Tt=()=>{const q=f||c;xe.current&&(xe.current.currentTime=q),w(q)},Bt=()=>{const q=xe.current;q&&(g?(q.pause(),w(q.currentTime),m(!1)):(q.currentTime=b,q.play().catch(()=>{}),m(!0)))},zt=async q=>{if(!Se.current){W();return}try{xe.current&&(xe.current.pause(),m(!1)),Et.current=q,ae.current=await $t(Se.current);const T=f||c;Ne.current=b;const H=T>0?b/T:0,Q=Math.floor(H*Ce.current.length);Le.current=Ce.current.slice(0,Q),ot.current=Ce.current.slice(Q),Ce.current=[...Le.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{xe.current&&(xe.current.pause(),xe.current=null),Se.current=null,ae.current=null,Ne.current=null,Le.current=[],m(!1),w(0),h(0),d(0),W()},J=()=>{Se.current?r(Se.current,f||c):alert("No audio recorded yet!")};C.useEffect(()=>{a==="recording"&&X.current&&Re.current&&pe.current&&(ye.current=requestAnimationFrame(gt))},[a]),C.useEffect(()=>{const q=X.current;if(!q)return;const T=()=>{const H=window.devicePixelRatio||1,Q=q.getBoundingClientRect();q.width=Q.width*H,q.height=Q.height*H;const O=q.getContext("2d");O&&O.scale(H,H)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),C.useEffect(()=>{if(a==="idle"){const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=T.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),T.fillStyle=ee,T.fillRect(0,0,Q,re);const de=T.createLinearGradient(0,O-re,0,O);de.addColorStop(0,"transparent"),de.addColorStop(1,Z),T.fillStyle=de,T.fillRect(0,O-re,Q,re);const De=T.createLinearGradient(0,0,re,0);De.addColorStop(0,Z),De.addColorStop(1,"transparent"),T.fillStyle=De,T.fillRect(0,0,re,O);const te=T.createLinearGradient(Q-re,0,Q,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),T.fillStyle=te,T.fillRect(Q-re,0,re,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const ne=Q/2;T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(ne,0),T.lineTo(ne,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText("00:00",ne,O-6)}},[a]);const Ae=C.useCallback(q=>{B(T=>[...T,q]),j(T=>({...T,total:T.total+1}))},[]);if(C.useEffect(()=>{(async()=>{if(R.current||I.length===0||!t)return;R.current=!0;const T=I[0];try{const H=await t(T);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{B(H=>H.slice(1)),j(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[I,t,n]),C.useEffect(()=>()=>{pe.current=!1,he.current&&clearInterval(he.current),ye.current&&cancelAnimationFrame(ye.current),ve.current&&ve.current.getTracks().forEach(q=>q.stop()),le.current&&le.current.state!=="closed"&&le.current.close()},[]),C.useEffect(()=>{if(a==="editing"&&g){let q;const T=()=>{const H=xe.current;if(H&&g){const Q=X.current;if(Q){const O=Q.getContext("2d");if(O){const re=Q.getBoundingClientRect(),Z=re.width,ee=re.height,de=Ce.current,De=f||c||1,te=H.currentTime;O.fillStyle="#2d3b35",O.fillRect(0,0,Z,ee);const ne=8,Ie="rgba(0, 0, 0, 0.4)",qe=O.createLinearGradient(0,0,0,ne);qe.addColorStop(0,Ie),qe.addColorStop(1,"transparent"),O.fillStyle=qe,O.fillRect(0,0,Z,ne);const Te=O.createLinearGradient(0,ee-ne,0,ee);Te.addColorStop(0,"transparent"),Te.addColorStop(1,Ie),O.fillStyle=Te,O.fillRect(0,ee-ne,Z,ne);const be=O.createLinearGradient(0,0,ne,0);be.addColorStop(0,Ie),be.addColorStop(1,"transparent"),O.fillStyle=be,O.fillRect(0,0,ne,ee);const He=O.createLinearGradient(Z-ne,0,Z,0);He.addColorStop(0,"transparent"),He.addColorStop(1,Ie),O.fillStyle=He,O.fillRect(Z-ne,0,ne,ee),O.strokeStyle="#5a6b62",O.lineWidth=1,O.beginPath(),O.moveTo(0,ee/2),O.lineTo(Z,ee/2),O.stroke();const Je=Z/2,dt=3,qt=4,yt=De>0?te/De*de.length:0;for(let U=0;U<de.length;U++){const Y=yt-U,oe=Je-Y*qt;if(oe<-dt||oe>Z)continue;const ge=de[U]*(ee/2-12),se=ee/2-ge;O.fillStyle=U<=yt?"#10b981":"#4b5563",O.fillRect(oe,se,dt,ge*2)}O.strokeStyle="#ef4444",O.lineWidth=1,O.beginPath(),O.moveTo(Je,0),O.lineTo(Je,ee),O.stroke(),O.fillStyle="#fff",O.font="bold 18px monospace",O.textAlign="center";const x=Math.floor(te/60),L=Math.floor(te%60);O.fillText(`${x.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`,Je,ee-6),O.textAlign="left"}}q=requestAnimationFrame(T)}};return q=requestAnimationFrame(T),()=>cancelAnimationFrame(q)}},[a,g,f,c]),C.useEffect(()=>{a==="editing"&&!g&<()},[a,b,g,lt]),v)return p.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[p.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:v}),p.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Pe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Oe={...Pe,opacity:.3,cursor:"not-allowed"},mt=l?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return p.jsxs("div",{style:mt,children:[p.jsx("canvas",{ref:X,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(a==="editing"){It.current=!0,pt.current=q.clientX,ct.current=b;const T=Q=>{It.current&&ke(Q.clientX)},H=()=>{It.current=!1,window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",H)}}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("button",{onClick:Ee,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to start",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),p.jsx("button",{onClick:()=>{if(a==="recording"){const q=ce.current;q&&(q.state==="recording"?(q.pause(),k(!0)):q.state==="paused"&&(q.resume(),k(!1)))}else Bt()},disabled:a==="idle",style:a==="idle"?Oe:Pe,title:g||a==="recording"&&!D?"Pause":"Play",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:g||a==="recording"&&!D?"pause":"play_arrow"})}),p.jsx("button",{onClick:Tt,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to end",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),p.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),p.jsx("button",{onClick:()=>{y==="insert"?we():a==="idle"?(_("insert"),W()):a==="editing"&&(_("insert"),zt("insert"))},disabled:a==="recording"&&y!=="insert"||g,style:a==="recording"&&y!=="insert"||g?Oe:Pe,title:y==="insert"?"Stop recording":"Insert recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="insert"?"#ef4444":"#171717"},children:"add"})}),p.jsx("button",{onClick:()=>{$.current||(y==="mic"?we():a==="idle"?(_("mic"),W()):a==="editing"&&(_("mic"),zt("replace")))},onMouseDown:()=>{$.current&&a==="idle"&&!g&&(_("mic"),W())},onMouseUp:()=>{$.current&&a==="recording"&&y==="mic"&&we()},onMouseLeave:()=>{$.current&&a==="recording"&&y==="mic"&&we()},onTouchStart:()=>{$.current&&a==="idle"&&!g&&(_("mic"),W())},onTouchEnd:()=>{$.current&&a==="recording"&&y==="mic"&&we()},disabled:a==="recording"&&y!=="mic"||g,style:a==="recording"&&y!=="mic"||g?Oe:Pe,title:S?"Hold to record (walkie-talkie)":y==="mic"?"Stop recording":"Record",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="mic"?"#ef4444":"#171717"},children:"mic"})}),p.jsx("button",{onClick:()=>{y==="startover"?we():a==="editing"&&(_("startover"),V())},disabled:a==="idle"||a==="recording"&&y!=="startover"||g,style:a==="idle"||a==="recording"&&y!=="startover"||g?Oe:Pe,title:y==="startover"?"Stop recording":"Start over",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[N.total>0&&N.completed<N.total&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),N.completed,"/",N.total]}),t&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[p.jsx("button",{onClick:()=>A(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:p.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),p.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),p.jsx("button",{onClick:()=>{a==="editing"&&Se.current&&Ae(Se.current)},disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Transcribe audio",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!o&&p.jsx("button",{onClick:J,disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Save recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),N.total>0&&N.completed<N.total&&p.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",background:"#10b981",width:`${N.completed/N.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=qi;exports.$isQRCodeNode=cf;exports.AnimatedCardFlip=xu;exports.ApiClient=gl;exports.AudioEditor=kf;exports.AuthManager=pl;exports.Card=gu;exports.ComboBox=_f;exports.DataOperations=Pn;exports.Detail=mu;exports.GraphClient=Wa;exports.KanbanBoard=vf;exports.Mail=_u;exports.MailClient=hl;exports.MailComposer=xf;exports.MailEditor=Ma;exports.QRCodeNode=Ir;exports.SelectableList=vu;exports.Stack=pu;exports.Timeline=Ef;exports.getApiClient=di;exports.initializeApiClient=cu;exports.useMutation=du;exports.useQuery=ml;
|
|
161
|
+
`})]})}const Hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function Qf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:a,label:l,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Hf,...d},[p,m]=C.useState(!1),[y,w]=C.useState(""),x=C.useRef(null),E=C.useRef(null);C.useEffect(()=>{function T(B){x.current&&!x.current.contains(B.target)&&(m(!1),w(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const D=r.filter(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),A=s&&y.trim()&&!r.some(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase())===y.toLowerCase()}),b=e.map(T=>r.find(B=>B.id===T)).filter(Boolean),v=C.useCallback(T=>{var B;c>0&&e.length>=c||(t([...e,T]),w(""),c===1?m(!1):(B=E.current)==null||B.focus())},[e,t,c]),S=C.useCallback(T=>{t(e.filter(B=>B!==T))},[e,t]),k=C.useCallback(async()=>{if(!A)return;const T=await(i==null?void 0:i(y.trim()));T&&v(T.id),w("")},[A,y,i,v]),j=C.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),A?k():D.length>0&&v(D[0].id)):T.key==="Backspace"&&!y&&e.length>0?S(e[e.length-1]):T.key==="Escape"&&(m(!1),w(""))},[A,D,y,e,k,v,S]);return g.jsxs("div",{ref:x,className:f,style:{position:"relative"},children:[l&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:l}),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:[b.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,!u&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),S(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:y,onChange:T=>{w(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:j,placeholder:b.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:D.length===0&&!A?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:y?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[D.map(T=>g.jsxs("div",{onClick:()=>v(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:[T.label,o&&a&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),a(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:B=>{B.currentTarget.style.opacity="1",B.currentTarget.style.color="#ef4444"},onMouseLeave:B=>{B.currentTarget.style.opacity="0.5",B.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),A&&g.jsxs("div",{onClick:k,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 "',y.trim(),'"']})]})})]})}const Jf={background:"#ffffff",cardBackground:"#f9fafb",cardHover:"#f3f4f6",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6"};function Yf({options:r,type:e,placeholder:t="Rechercher...",onItemClick:n,onCreate:s,maxHeight:i=400,className:o="",theme:a={}}){const l={...Jf,...a},[u,c]=C.useState(""),d=C.useRef(null),f=C.useMemo(()=>{if(!u.trim())return r;const m=u.toLowerCase();return r.filter(y=>{var w,x;return((w=y.label)==null?void 0:w.toLowerCase().includes(m))||((x=y.notes)==null?void 0:x.toLowerCase().includes(m))})},[r,u]),h=m=>{n&&n(m)},p=()=>{s&&s()};return g.jsxs("div",{className:`combostack ${o}`,style:{width:"100%"},children:[g.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"12px"},children:[g.jsxs("div",{style:{flex:1,position:"relative"},children:[g.jsx("span",{style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:l.textSecondary,fontSize:"16px"},children:"🔍"}),g.jsx("input",{ref:d,type:"text",value:u,onChange:m=>c(m.target.value),placeholder:t,style:{width:"100%",padding:"10px 12px 10px 40px",fontSize:"14px",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,color:l.text,outline:"none",boxSizing:"border-box"}})]}),s&&g.jsx("button",{onClick:p,style:{width:"42px",height:"42px",display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,color:l.primary,cursor:"pointer",fontSize:"20px",fontWeight:"bold",transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:m=>{m.currentTarget.style.background=l.background||"#ffffff"},title:`Créer ${e||"item"}`,children:"+"})]}),g.jsx("div",{style:{maxHeight:typeof i=="number"?`${i}px`:i,overflowY:"auto",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background},children:f.length===0?g.jsx("div",{style:{padding:"24px",textAlign:"center",color:l.textSecondary,fontSize:"14px"},children:u?`Aucun résultat pour "${u}"`:"Aucun élément"}):f.map((m,y)=>g.jsxs("div",{onClick:()=>h(m),style:{padding:"12px 16px",cursor:"pointer",borderBottom:y<f.length-1?`1px solid ${l.border}`:"none",background:l.cardBackground,transition:"background 0.15s"},onMouseEnter:w=>{w.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:w=>{w.currentTarget.style.background=l.cardBackground||"#f9fafb"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:m.color||l.text,marginBottom:m.notes?"4px":0},children:m.label}),m.notes&&g.jsx("div",{style:{fontSize:"13px",color:l.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:m.notes})]},m.id))})]})}function Xf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:a,onItemClick:l,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=C.useState(null),[y,w]=C.useState(null),[x,E]=C.useState(null),D=C.useRef(null),A=e.reduce((B,L)=>{let R=r.filter(P=>n(P)===L.id);return s&&(R=R.sort((P,Q)=>s(P)-s(Q))),B[L.id]=R,B},{}),b=C.useCallback((B,L)=>{const R=t(L),P=n(L);m(R),D.current=P,B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const Q=B.target;Q.style.opacity="0.5"})},[t,n]),v=C.useCallback(B=>{const L=B.target;L.style.opacity="1",m(null),w(null),E(null),D.current=null},[]),S=C.useCallback((B,L,R)=>{B.preventDefault(),B.dataTransfer.dropEffect="move",w(L),E(R)},[]),k=C.useCallback(B=>{const L=B.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(w(null),E(null))},[]),j=C.useCallback((B,L,R)=>{if(B.preventDefault(),!p)return;const P=D.current;P===L?a==null||a(p,L,R):P&&o(p,P,L,R),m(null),w(null),E(null),D.current=null},[p,o,a]),T=(B,L)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[B.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:B.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:B.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(B=>{const L=A[B.id]||[],R=y===B.id;return g.jsxs("div",{"data-kanban-column":B.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:P=>{P.preventDefault(),p&&!R&&w(B.id)},onDragLeave:k,onDrop:P=>j(P,B.id,x??L.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(B,L.length):T(B,L.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[L.map((P,Q)=>{const se=t(P),xe=p===se,oe=R&&x===Q&&!xe;return g.jsxs("div",{children:[oe&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Se=>b(Se,P),onDragEnd:v,onDragOver:Se=>S(Se,B.id,Q),onClick:()=>l==null?void 0:l(P),className:`cursor-grab active:cursor-grabbing transition-all ${xe?"opacity-50 scale-95":""} ${h}`,children:i(P,xe)})]},se)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:P=>{P.preventDefault(),S(P,B.id,L.length)},children:R&&x===L.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&R&&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(B)})]},B.id)})})}const Zf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function eh(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function th(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function rh(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function nh({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:a,getItemId:l,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...Zf,...p},{allDayItems:y,timedItems:w}=C.useMemo(()=>{const v=[],S=[];for(const k of r)a(k)?v.push(k):S.push(k);return{allDayItems:v,timedItems:S}},[r,a]),x=C.useMemo(()=>{const v=[];for(let S=t;S<=n;S++)v.push(S);return v},[t,n]),E=(n-t+1)*s,D=C.useCallback(v=>{const S=i(v);if(!S)return null;const k=eh(S);if(!k)return null;const{hours:j,minutes:T}=k,B=Math.max(t,Math.min(n,j)),L=j<t?0:T,R=(B-t)*s+L/60*s,P=o(v),Q=Math.max(20,P/60*s);return{top:R,height:Q}},[i,o,t,n,s]),A=C.useMemo(()=>{if(!f||!rh(e))return null;const v=new Date,S=v.getHours(),k=v.getMinutes();return S<t||S>n?null:(S-t)*s+k/60*s},[e,f,t,n,s]),b=C.useCallback(v=>{if(!d)return;const S=v.currentTarget.getBoundingClientRect(),j=(v.clientY-S.top)/s*60,T=Math.floor(j/60)+t,B=Math.round(j%60/15)*15,L=Math.min(n,Math.max(t,T)),R=B>=60?0:B,P=`${L.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d(P)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[y.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:y.map(v=>g.jsx("div",{onClick:()=>c==null?void 0:c(v),style:{cursor:c?"pointer":"default"},children:u(v)},l(v)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[x.map((v,S)=>g.jsxs("div",{style:{position:"absolute",top:S*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:th(v)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<x.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},v)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),A!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:A,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}})]}),w.map(v=>{const S=D(v);return S?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(v)},children:u(v)},l(v)):null})]})]})}function sh({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const a=s==="widget",[l,u]=C.useState("idle"),[c,d]=C.useState(0),[f,h]=C.useState(0),[p,m]=C.useState(!1),[y,w]=C.useState(0),[x,E]=C.useState(null),[D,A]=C.useState(!1),[b,v]=C.useState(null),[S,k]=C.useState(!0),[j,T]=C.useState([]),[B,L]=C.useState({completed:0,total:0}),R=C.useRef(!1),P=C.useRef(!0);C.useEffect(()=>{P.current=S},[S]);const Q=C.useRef(null),se=C.useRef(null),xe=C.useRef(null),oe=C.useRef(null),Se=C.useRef(null),he=C.useRef([]),fe=C.useRef(null),pe=C.useRef(null),ge=C.useRef(null),Ae=C.useRef(null),be=C.useRef(!1),we=C.useRef([]),Re=C.useRef(null),ce=C.useRef(null),je=C.useRef([]),at=C.useRef([]),kt=C.useRef("insert"),zt=C.useRef(!1),nt=C.useRef(0),mt=C.useRef(0),ft=C.useRef(0),Yt=q=>{const N=Math.floor(q/60),H=Math.floor(q%60);return`${N.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},qt=async q=>{const N=await q.arrayBuffer(),H=new AudioContext,Y=await H.decodeAudioData(N);return await H.close(),Y},Tt=q=>{const N=q.numberOfChannels,H=q.sampleRate,Y=1,I=16,re=I/8,Z=N*re,ee=H*Z,me=q.length*Z,Ee=new ArrayBuffer(44+me),te=new DataView(Ee),ne=(Be,ve)=>{for(let Je=0;Je<ve.length;Je++)te.setUint8(Be+Je,ve.charCodeAt(Je))};ne(0,"RIFF"),te.setUint32(4,36+me,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Y,!0),te.setUint16(22,N,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,I,!0),ne(36,"data"),te.setUint32(40,me,!0);const ze=[];for(let Be=0;Be<N;Be++)ze.push(q.getChannelData(Be));let We=44;for(let Be=0;Be<q.length;Be++)for(let ve=0;ve<N;ve++){const Je=Math.max(-1,Math.min(1,ze[ve][Be])),Ye=Je<0?Je*32768:Je*32767;te.setInt16(We,Ye,!0),We+=2}return new Blob([Ee],{type:"audio/wav"})},Nt=async(q,N,H,Y)=>{const I=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,N.numberOfChannels),ee=Math.min(H,q.length),me=Math.max(0,q.length-H),Ee=Y==="insert"?ee+N.length+me:ee+N.length,te=I.createBuffer(Z,Ee,re);for(let ne=0;ne<Z;ne++){const ze=te.getChannelData(ne),We=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let ve=0;ve<ee;ve++)ze[ve]=We[ve];const Be=ne<N.numberOfChannels?N.getChannelData(ne):N.getChannelData(0);for(let ve=0;ve<N.length;ve++)ze[ee+ve]=Be[ve];if(Y==="insert")for(let ve=0;ve<me;ve++)ze[ee+N.length+ve]=We[H+ve]}return await I.close(),te},ut=C.useCallback(()=>{const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height,re=we.current,Z=f||c||1,ee=l==="recording"?c:y;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const me=8,Ee="rgba(0, 0, 0, 0.4)",te=N.createLinearGradient(0,0,0,me);te.addColorStop(0,Ee),te.addColorStop(1,"transparent"),N.fillStyle=te,N.fillRect(0,0,Y,me);const ne=N.createLinearGradient(0,I-me,0,I);ne.addColorStop(0,"transparent"),ne.addColorStop(1,Ee),N.fillStyle=ne,N.fillRect(0,I-me,Y,me);const ze=N.createLinearGradient(0,0,me,0);ze.addColorStop(0,Ee),ze.addColorStop(1,"transparent"),N.fillStyle=ze,N.fillRect(0,0,me,I);const We=N.createLinearGradient(Y-me,0,Y,0);We.addColorStop(0,"transparent"),We.addColorStop(1,Ee),N.fillStyle=We,N.fillRect(Y-me,0,me,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const Be=Y/2;if(re.length>0)if(l==="recording")for(let Ye=0;Ye<re.length;Ye++){const ht=re.length-1-Ye,Wt=Be-ht*4;if(Wt<-3||Wt>Y)continue;const bt=re[Ye]*(I/2-12),_=I/2-bt;N.fillStyle="#10b981",N.fillRect(Wt,_,3,bt*2)}else{const Ye=Z>0?ee/Z*re.length:0;for(let ht=0;ht<re.length;ht++){const Wt=Ye-ht,bt=Be-Wt*4;if(bt<-3||bt>Y)continue;const _=re[ht]*(I/2-12),M=I/2-_;N.fillStyle=ht<=Ye?"#10b981":"#4b5563",N.fillRect(bt,M,3,_*2)}}N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(Be,0),N.lineTo(Be,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText(Yt(ee),Be,I-6),l==="recording"&&(N.fillStyle="#ef4444",N.beginPath(),N.arc(20,20,8,0,Math.PI*2),N.fill(),N.fillStyle="#fff",N.font="10px sans-serif",N.textAlign="left",N.fillText("REC",34,24)),N.textAlign="left"},[l,y,c,f]),yt=()=>{const q=Se.current;if(!q||!be.current)return;const N=q.frequencyBinCount,H=new Uint8Array(N);q.getByteTimeDomainData(H);let Y=0;for(let Z=0;Z<N;Z++){const ee=(H[Z]-128)/128;Y+=ee*ee}const I=Math.sqrt(Y/N),re=Math.min(1,I*3);we.current.push(re),ut(),be.current&&(pe.current=requestAnimationFrame(yt))},W=async()=>{try{E(null),A(!1),Re.current===null&&(we.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});xe.current=q;const N=new AudioContext;oe.current=N;const H=N.createAnalyser();H.fftSize=2048,Se.current=H,N.createMediaStreamSource(q).connect(H);const I=new MediaRecorder(q);se.current=I,he.current=[],I.ondataavailable=re=>{re.data.size>0&&he.current.push(re.data)},I.onstop=async()=>{try{if(be.current=!1,he.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(he.current,{type:"audio/webm"});let Z,ee;if(Re.current!==null&&ce.current)try{const te=await qt(re),ne=ce.current.sampleRate,ze=Math.floor(Re.current*ne),We=await Nt(ce.current,te,ze,kt.current);Z=Tt(We),ee=We.length/We.sampleRate,kt.current==="insert"&&(we.current=[...we.current,...at.current]),Re.current=null,ce.current=null,je.current=[],at.current=[]}catch{Z=re,ee=nt.current>0?nt.current:1}else Z=re,ee=nt.current>0?nt.current:1;if(Ae.current=Z,q.getTracks().forEach(te=>te.stop()),P.current&&t){T(te=>[...te,Z]),L(te=>({...te,total:te.total+1})),Ae.current=null,we.current=[],w(0),h(0),d(0),u("idle");return}const me=URL.createObjectURL(Z),Ee=new Audio(me);Ee.ontimeupdate=()=>{w(Ee.currentTime)},Ee.onended=()=>{m(!1)},ge.current=Ee,h(ee),w(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},I.start(100),be.current=!0,u("recording"),d(0),nt.current=0,fe.current=setInterval(()=>{nt.current+=1,d(nt.current),nt.current>=o&&(se.current&&se.current.state!=="inactive"&&se.current.stop(),be.current=!1,v(null),fe.current&&(clearInterval(fe.current),fe.current=null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},De=()=>{be.current=!1,A(!1),v(null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),fe.current&&(clearInterval(fe.current),fe.current=null),se.current&&se.current.state!=="inactive"&&se.current.stop()},Te=q=>{const N=Q.current;if(!N)return;const H=f||c;if(H<=0)return;const Y=we.current;if(Y.length===0)return;const I=N.getBoundingClientRect(),re=q-mt.current,Z=4,ee=I.width/N.width,me=Y.length/H*Z,Ee=-re/(me*ee),te=ft.current+Ee,ne=Math.max(0,Math.min(te,H));ge.current&&(ge.current.currentTime=ne),w(ne)},ke=()=>{ge.current&&(ge.current.currentTime=0),w(0)},Bt=()=>{const q=f||c;ge.current&&(ge.current.currentTime=q),w(q)},Ft=()=>{const q=ge.current;q&&(p?(q.pause(),w(q.currentTime),m(!1)):(q.currentTime=y,q.play().catch(()=>{}),m(!0)))},Ut=async q=>{if(!Ae.current){W();return}try{ge.current&&(ge.current.pause(),m(!1)),kt.current=q,ce.current=await qt(Ae.current);const N=f||c;Re.current=y;const H=N>0?y/N:0,Y=Math.floor(H*we.current.length);je.current=we.current.slice(0,Y),at.current=we.current.slice(Y),we.current=[...je.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{ge.current&&(ge.current.pause(),ge.current=null),Ae.current=null,ce.current=null,Re.current=null,je.current=[],m(!1),w(0),h(0),d(0),W()},J=()=>{Ae.current?r(Ae.current,f||c):alert("No audio recorded yet!")};C.useEffect(()=>{l==="recording"&&Q.current&&Se.current&&be.current&&(pe.current=requestAnimationFrame(yt))},[l]),C.useEffect(()=>{const q=Q.current;if(!q)return;const N=()=>{const H=window.devicePixelRatio||1,Y=q.getBoundingClientRect();q.width=Y.width*H,q.height=Y.height*H;const I=q.getContext("2d");I&&I.scale(H,H)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),C.useEffect(()=>{if(l==="idle"){const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=N.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),N.fillStyle=ee,N.fillRect(0,0,Y,re);const me=N.createLinearGradient(0,I-re,0,I);me.addColorStop(0,"transparent"),me.addColorStop(1,Z),N.fillStyle=me,N.fillRect(0,I-re,Y,re);const Ee=N.createLinearGradient(0,0,re,0);Ee.addColorStop(0,Z),Ee.addColorStop(1,"transparent"),N.fillStyle=Ee,N.fillRect(0,0,re,I);const te=N.createLinearGradient(Y-re,0,Y,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),N.fillStyle=te,N.fillRect(Y-re,0,re,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const ne=Y/2;N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(ne,0),N.lineTo(ne,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText("00:00",ne,I-6)}},[l]);const Ne=C.useCallback(q=>{T(N=>[...N,q]),L(N=>({...N,total:N.total+1}))},[]);if(C.useEffect(()=>{(async()=>{if(R.current||j.length===0||!t)return;R.current=!0;const N=j[0];try{const H=await t(N);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{T(H=>H.slice(1)),L(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[j,t,n]),C.useEffect(()=>()=>{be.current=!1,fe.current&&clearInterval(fe.current),pe.current&&cancelAnimationFrame(pe.current),xe.current&&xe.current.getTracks().forEach(q=>q.stop()),oe.current&&oe.current.state!=="closed"&&oe.current.close()},[]),C.useEffect(()=>{if(l==="editing"&&p){let q;const N=()=>{const H=ge.current;if(H&&p){const Y=Q.current;if(Y){const I=Y.getContext("2d");if(I){const re=Y.getBoundingClientRect(),Z=re.width,ee=re.height,me=we.current,Ee=f||c||1,te=H.currentTime;I.fillStyle="#2d3b35",I.fillRect(0,0,Z,ee);const ne=8,ze="rgba(0, 0, 0, 0.4)",We=I.createLinearGradient(0,0,0,ne);We.addColorStop(0,ze),We.addColorStop(1,"transparent"),I.fillStyle=We,I.fillRect(0,0,Z,ne);const Be=I.createLinearGradient(0,ee-ne,0,ee);Be.addColorStop(0,"transparent"),Be.addColorStop(1,ze),I.fillStyle=Be,I.fillRect(0,ee-ne,Z,ne);const ve=I.createLinearGradient(0,0,ne,0);ve.addColorStop(0,ze),ve.addColorStop(1,"transparent"),I.fillStyle=ve,I.fillRect(0,0,ne,ee);const Je=I.createLinearGradient(Z-ne,0,Z,0);Je.addColorStop(0,"transparent"),Je.addColorStop(1,ze),I.fillStyle=Je,I.fillRect(Z-ne,0,ne,ee),I.strokeStyle="#5a6b62",I.lineWidth=1,I.beginPath(),I.moveTo(0,ee/2),I.lineTo(Z,ee/2),I.stroke();const Ye=Z/2,ht=3,Wt=4,bt=Ee>0?te/Ee*me.length:0;for(let U=0;U<me.length;U++){const X=bt-U,ue=Ye-X*Wt;if(ue<-ht||ue>Z)continue;const _e=me[U]*(ee/2-12),le=ee/2-_e;I.fillStyle=U<=bt?"#10b981":"#4b5563",I.fillRect(ue,le,ht,_e*2)}I.strokeStyle="#ef4444",I.lineWidth=1,I.beginPath(),I.moveTo(Ye,0),I.lineTo(Ye,ee),I.stroke(),I.fillStyle="#fff",I.font="bold 18px monospace",I.textAlign="center";const _=Math.floor(te/60),M=Math.floor(te%60);I.fillText(`${_.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}`,Ye,ee-6),I.textAlign="left"}}q=requestAnimationFrame(N)}};return q=requestAnimationFrame(N),()=>cancelAnimationFrame(q)}},[l,p,f,c]),C.useEffect(()=>{l==="editing"&&!p&&ut()},[l,y,p,ut]),x)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:x}),g.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Oe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Ie={...Oe,opacity:.3,cursor:"not-allowed"},xt=a?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return g.jsxs("div",{style:xt,children:[g.jsx("canvas",{ref:Q,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(l==="editing"){zt.current=!0,mt.current=q.clientX,ft.current=y;const N=Y=>{zt.current&&Te(Y.clientX)},H=()=>{zt.current=!1,window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",H)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:a?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:ke,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(l==="recording"){const q=se.current;q&&(q.state==="recording"?(q.pause(),A(!0)):q.state==="paused"&&(q.resume(),A(!1)))}else Ft()},disabled:l==="idle",style:l==="idle"?Ie:Oe,title:p||l==="recording"&&!D?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:p||l==="recording"&&!D?"pause":"play_arrow"})}),g.jsx("button",{onClick:Bt,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,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:()=>{b==="insert"?De():l==="idle"?(v("insert"),W()):l==="editing"&&(v("insert"),Ut("insert"))},disabled:l==="recording"&&b!=="insert"||p,style:l==="recording"&&b!=="insert"||p?Ie:Oe,title:b==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{P.current||(b==="mic"?De():l==="idle"?(v("mic"),W()):l==="editing"&&(v("mic"),Ut("replace")))},onMouseDown:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onMouseUp:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onMouseLeave:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onTouchStart:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onTouchEnd:()=>{P.current&&l==="recording"&&b==="mic"&&De()},disabled:l==="recording"&&b!=="mic"||p,style:l==="recording"&&b!=="mic"||p?Ie:Oe,title:S?"Hold to record (walkie-talkie)":b==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{b==="startover"?De():l==="editing"&&(v("startover"),V())},disabled:l==="idle"||l==="recording"&&b!=="startover"||p,style:l==="idle"||l==="recording"&&b!=="startover"||p?Ie:Oe,title:b==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[B.total>0&&B.completed<B.total&&g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),B.completed,"/",B.total]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[g.jsx("button",{onClick:()=>k(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),g.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),g.jsx("button",{onClick:()=>{l==="editing"&&Ae.current&&Ne(Ae.current)},disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&g.jsx("button",{onClick:J,disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),B.total>0&&B.completed<B.total&&g.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",background:"#10b981",width:`${B.completed/B.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=Qi;exports.$isQRCodeNode=If;exports.AnimatedCardFlip=Ou;exports.ApiClient=wl;exports.AudioEditor=sh;exports.AuthManager=Cl;exports.Card=Mu;exports.ComboBox=Qf;exports.ComboStack=Yf;exports.DataOperations=$n;exports.Detail=Pu;exports.GraphClient=cu;exports.KanbanBoard=Xf;exports.Mail=$u;exports.MailClient=vl;exports.MailComposer=Kf;exports.MailEditor=su;exports.QRCodeNode=Ur;exports.SelectableList=zu;exports.Stack=Lu;exports.Timeline=nh;exports.getApiClient=xi;exports.initializeApiClient=Nu;exports.useMutation=Bu;exports.useQuery=Dl;
|