@demos-europe/demosplan-ui 0.4.21 → 0.4.22
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/.claude/settings.local.json +4 -19
- package/.idea/demosplan-ui.iml +11 -0
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/material_theme_project_new.xml +13 -0
- package/.idea/modules.xml +8 -0
- package/.idea/sonarlint/issuestore/0/2/02d5146f94659f11c56f0ea1d9c504ff9492b546 +0 -0
- package/.idea/sonarlint/issuestore/0/2/02f4902c3db5247c732bde5aaf0d4fb55363c3b1 +3 -0
- package/.idea/sonarlint/issuestore/0/3/0343acf33ca1b061164f9846ff8ce30429205a2a +0 -0
- package/.idea/sonarlint/issuestore/0/4/04d5869ea32abbf6abf5a3cb9a671637ac2e345b +0 -0
- package/.idea/sonarlint/issuestore/0/9/0918cbb76f2c44f223706cec9d31a32cd1177ce4 +0 -0
- package/.idea/sonarlint/issuestore/0/9/091aff741808a09242f252264b14f4a9adaa5305 +0 -0
- package/.idea/sonarlint/issuestore/0/b/0b63533e07c8b10a8fbfe7f35df1bffec8103e14 +0 -0
- package/.idea/sonarlint/issuestore/0/c/0c0fd6a370cd10350462b46937e98f903bcb1435 +0 -0
- package/.idea/sonarlint/issuestore/0/e/0e600c187f4cf8bd0dd6b678f55067a8300ab570 +0 -0
- package/.idea/sonarlint/issuestore/0/f/0f43007644f06a63afbfbfc129aadd61bf40318a +0 -0
- package/.idea/sonarlint/issuestore/1/4/14148858b7b4a0aa23ddfdc41ef62be2db925c70 +0 -0
- package/.idea/sonarlint/issuestore/1/5/15ff6a89ff653ef3176ddb9c5e0b59c16c2db949 +0 -0
- package/.idea/sonarlint/issuestore/1/6/169d7dbe9a819ce675ee66de130c5a7c92bb763d +0 -0
- package/.idea/sonarlint/issuestore/1/8/18a1ebb3a44ad977a5cfa60b6620a47ba00163a3 +0 -0
- package/.idea/sonarlint/issuestore/1/f/1fd3ecff7dd864e5b00c14a4333d8cde8c9faf11 +0 -0
- package/.idea/sonarlint/issuestore/2/0/204a133d39c4a2c7b86de23f541f342e0a7a3234 +0 -0
- package/.idea/sonarlint/issuestore/2/4/2491406c07bfc2b0f7ed8e010e56d6e468c374d0 +0 -0
- package/.idea/sonarlint/issuestore/2/5/257d0fa8d58da6d96f5a7af9724b2e1c92c62a2d +3 -0
- package/.idea/sonarlint/issuestore/2/8/282dcb1e4436703724dd35bb567086834c3ebdb4 +3 -0
- package/.idea/sonarlint/issuestore/2/a/2aeb7bd71ee8453ff4601a1fc8fcd4fa9c5fe355 +0 -0
- package/.idea/sonarlint/issuestore/2/c/2c25e229323612e7988c659ad7b51c7b1e2b2403 +0 -0
- package/.idea/sonarlint/issuestore/2/f/2fa1946a2afc952506e41d87833ed29401fc29a0 +0 -0
- package/.idea/sonarlint/issuestore/3/4/3463c59843592ad2a00c54f39e2943583bd6fff9 +0 -0
- package/.idea/sonarlint/issuestore/3/9/390f31a969ba7940070bf32aac2a0d1f7b7bd78b +0 -0
- package/.idea/sonarlint/issuestore/3/e/3ebc20bbfa3c33cf20481a2de7591c997c68abb9 +0 -0
- package/.idea/sonarlint/issuestore/4/1/417425bfa2cef1f22539e792dcb0a7f7784f9604 +0 -0
- package/.idea/sonarlint/issuestore/4/1/41ac9772c7dd3fc038485f99106b427a5e28f2e3 +0 -0
- package/.idea/sonarlint/issuestore/4/4/44d3ca69a31c68c4d920b1fbb0083732713d2690 +2 -0
- package/.idea/sonarlint/issuestore/4/8/48a8ec70d252121fbc7df4e8a45044e964b5d6b7 +0 -0
- package/.idea/sonarlint/issuestore/4/9/49e951d8246d0914f9d10b3955a7178866cfcee9 +0 -0
- package/.idea/sonarlint/issuestore/4/d/4def76d1eea91e36f7789929705c032be6df27cd +0 -0
- package/.idea/sonarlint/issuestore/4/f/4f40ac4df99b3f8bbd80db9b729d3b4b401623eb +0 -0
- package/.idea/sonarlint/issuestore/4/f/4f4bba1840f039e57f25bbd19ec0e20c15fc0e1d +0 -0
- package/.idea/sonarlint/issuestore/5/1/51f466e675bcd7ca84bf6287bab7404cde26db22 +0 -0
- package/.idea/sonarlint/issuestore/5/2/5222c3d19fd979fed770b7f3664147b2ed16b230 +0 -0
- package/.idea/sonarlint/issuestore/5/2/52cb9deee3ee8b8add01ec855fc4a45818ac7638 +5 -0
- package/.idea/sonarlint/issuestore/5/3/53585a096fe3a3b96321113856ae62602995a33b +0 -0
- package/.idea/sonarlint/issuestore/5/4/5471e6ec0c0e189560fccc7f474993fc6e1f758a +0 -0
- package/.idea/sonarlint/issuestore/5/7/578f3ebc33c3ca6ab8e66c97f3c2eba2237b40ea +0 -0
- package/.idea/sonarlint/issuestore/5/8/5831775a729fcf9cb12959996af17091f46f440b +0 -0
- package/.idea/sonarlint/issuestore/5/8/5842d31a915855888fd63b1aca8c3a4dd8c95880 +0 -0
- package/.idea/sonarlint/issuestore/5/c/5ce582bce204b2edd80e7602b279b3d64cc737e0 +0 -0
- package/.idea/sonarlint/issuestore/5/f/5f2f0e365ced14f666cef2ac164c93530d4e0c2a +0 -0
- package/.idea/sonarlint/issuestore/6/0/60882ef9544224120d1d72534f44b973f3a57746 +0 -0
- package/.idea/sonarlint/issuestore/6/0/60a7f3adc2729926865b49b02008b2874d65429d +2 -0
- package/.idea/sonarlint/issuestore/6/0/60b89c88214907466f4d004bb8a2e56a468da7f5 +0 -0
- package/.idea/sonarlint/issuestore/6/0/60bb79bf1ee7929bf0f8c20166ae12e49d7af9ea +3 -0
- package/.idea/sonarlint/issuestore/6/1/61ebb9fd6e8cf9082658121d5d81e297791dacd0 +0 -0
- package/.idea/sonarlint/issuestore/6/5/65c98391f12bde62f0955f439128e0f8cb1eac6a +0 -0
- package/.idea/sonarlint/issuestore/6/7/6733e547a8a62f0e2b41358995a67255b967bfeb +0 -0
- package/.idea/sonarlint/issuestore/6/8/68e29ca13d4f4cada132a831a6a1b52c0a0ebfd3 +0 -0
- package/.idea/sonarlint/issuestore/6/9/692f3fce406d97e843fbf744ad689b51e3754dff +0 -0
- package/.idea/sonarlint/issuestore/6/a/6a835d16be742d060f08912c5808bbf862426d3d +0 -0
- package/.idea/sonarlint/issuestore/6/c/6cd35da18772c8847edacba05dd265c15ded5d0b +0 -0
- package/.idea/sonarlint/issuestore/6/e/6e142af7dffa0e82efece3ff58722e96f4283a3f +0 -0
- package/.idea/sonarlint/issuestore/7/0/7030d0b2f71b999ff89a343de08c414af32fc93a +0 -0
- package/.idea/sonarlint/issuestore/7/2/725cc9c146a136cafafef5ffec4cb307badb1d0e +0 -0
- package/.idea/sonarlint/issuestore/7/3/73e399246034aaf963bb1ad4b0a0e2b5228f57cc +0 -0
- package/.idea/sonarlint/issuestore/7/7/7710090cd8b91b750ed58a2f3196d971d7de988b +0 -0
- package/.idea/sonarlint/issuestore/7/8/785055d2374e9ff4841f875174c20cad0c0d9a80 +0 -0
- package/.idea/sonarlint/issuestore/7/8/78a09338d0e7bb67a5d2643580367940bee1e5b2 +0 -0
- package/.idea/sonarlint/issuestore/7/9/793162cb1b4e542cbf5f8db45406f4e91f736c0e +0 -0
- package/.idea/sonarlint/issuestore/7/a/7a6581baac8c66b8e331b8187db03c64201001f1 +0 -0
- package/.idea/sonarlint/issuestore/8/5/852060cc24633564871605ce8d1e59970ef2485c +0 -0
- package/.idea/sonarlint/issuestore/8/5/85e8222943093a270d57ab07964a75d9a15648eb +0 -0
- package/.idea/sonarlint/issuestore/8/6/86abd2602e79b84f352d24c72f079541f41aeb6d +0 -0
- package/.idea/sonarlint/issuestore/8/8/881d5d47bdc17ef8facebef59b68b5fc099a0293 +0 -0
- package/.idea/sonarlint/issuestore/8/8/882c515e635f40a7e1ad419c70c0f2d2c17e2f37 +0 -0
- package/.idea/sonarlint/issuestore/8/9/89d3df066dd0ec67c57e82d68cce94cb72f820b5 +0 -0
- package/.idea/sonarlint/issuestore/8/b/8bff50de15c7d9b1166aa9ad98243d1a04b7e4c4 +0 -0
- package/.idea/sonarlint/issuestore/8/c/8c5bbc0d4ce626bd35d05b960ef906abfd312014 +0 -0
- package/.idea/sonarlint/issuestore/9/0/900448384f6077c203e834650b95017f7a373583 +2 -0
- package/.idea/sonarlint/issuestore/9/1/912f3a935b193eb148539815f9aef4a4252c12ba +0 -0
- package/.idea/sonarlint/issuestore/9/4/94dd0b13f6f12ba5eae129046b1d061ddd546d72 +5 -0
- package/.idea/sonarlint/issuestore/9/5/958a078793035ab0aad2086f7be79b55628402c0 +0 -0
- package/.idea/sonarlint/issuestore/9/6/96dcf27dc8ae3662215096d9e00c194897d29c0b +0 -0
- package/.idea/sonarlint/issuestore/9/7/9730e89df0a4367176020e461c38c37b7ae58b9a +0 -0
- package/.idea/sonarlint/issuestore/9/8/98c4f1f9f94adc9e53100dbf68ce8c5df2a47f01 +0 -0
- package/.idea/sonarlint/issuestore/9/9/9920d82d6cbbfe404d91c79781048e0c0514767e +0 -0
- package/.idea/sonarlint/issuestore/9/c/9cc6b3192a90fe4d986d791c393ab1ac7101ac48 +0 -0
- package/.idea/sonarlint/issuestore/a/1/a1991714da3efb5da4456ee802727afe63035aa5 +0 -0
- package/.idea/sonarlint/issuestore/a/7/a70ff2c42b6ffb69f1686cf6ced65733a75e056f +0 -0
- package/.idea/sonarlint/issuestore/a/8/a8b0d4ad8d44e8bb48b2ca34ddbd84b549ee9105 +3 -0
- package/.idea/sonarlint/issuestore/a/a/aaf524b8c18d54117ff8a4de5b06cdd7f5776d0d +0 -0
- package/.idea/sonarlint/issuestore/a/b/ab09011fa121d0a2bb9fa4ca76094f2482b902b7 +0 -0
- package/.idea/sonarlint/issuestore/b/0/b0a40903f86afa7d5940f95f66995a290b6d4fe2 +0 -0
- package/.idea/sonarlint/issuestore/b/2/b26e3039f1510dfa296fdfb6a1a5f12cdca84371 +0 -0
- package/.idea/sonarlint/issuestore/b/3/b3349079128f17cb6e0cecf3cccfa4fe5188f92f +3 -0
- package/.idea/sonarlint/issuestore/b/4/b4a9acebce4d56aa444e5b857fa140163bcbd47f +0 -0
- package/.idea/sonarlint/issuestore/b/5/b5320db1c0a02ceb68cb70d050f5dc9d420b928b +0 -0
- package/.idea/sonarlint/issuestore/b/7/b7d694611d1aa415d97c7872253457c54d8f1ed7 +0 -0
- package/.idea/sonarlint/issuestore/b/9/b9f0a0a757a4dc7cc57724b3534dfdf189c25ea6 +0 -0
- package/.idea/sonarlint/issuestore/b/b/bb971971f3915fff5703a078f2784df410b7298e +0 -0
- package/.idea/sonarlint/issuestore/b/e/be023cb04cabb819ee6a97d9fc2a088cb4eded97 +0 -0
- package/.idea/sonarlint/issuestore/b/e/be633e1bf05efdb3dec5eae2777f024e1aee5599 +0 -0
- package/.idea/sonarlint/issuestore/c/2/c2b3144db64026759165a569b0f1f5086c6be0d3 +0 -0
- package/.idea/sonarlint/issuestore/c/6/c62bdf361b714427c19bdc47c8c97f90cce4dad3 +0 -0
- package/.idea/sonarlint/issuestore/c/6/c680d0675608db3debbc56eab6dae6478ea3d2db +0 -0
- package/.idea/sonarlint/issuestore/c/b/cb44f758b6159383fc5e20e1b38c4a3781d4e4bc +0 -0
- package/.idea/sonarlint/issuestore/c/c/ccc24fa53ed888a7471d8f2d4afae2e0ae89171d +0 -0
- package/.idea/sonarlint/issuestore/c/e/ced731c009a96db35c13542868ab840aa2ef6de4 +0 -0
- package/.idea/sonarlint/issuestore/d/1/d13af3479d43279b14b3cf9dbac30965ada1dadb +0 -0
- package/.idea/sonarlint/issuestore/d/2/d2b81feb53c8d963c77dbd7e63afdc568883baad +0 -0
- package/.idea/sonarlint/issuestore/d/3/d350eccaa5bdadf800f3540db3f0e94c0417a0f3 +0 -0
- package/.idea/sonarlint/issuestore/d/3/d3f37835937f760d81f9a81b56b898afec37a1e7 +0 -0
- package/.idea/sonarlint/issuestore/d/4/d4e02cf17e1477bc4516d78f557bdcd1b933fafd +0 -0
- package/.idea/sonarlint/issuestore/d/5/d5595158cc48f9bf3e51b06f6e6805a8fd2d6262 +0 -0
- package/.idea/sonarlint/issuestore/d/6/d690bc5bd5193edbd3f7e29b2d1be4d3f991937b +0 -0
- package/.idea/sonarlint/issuestore/d/7/d76f3a535e1a92673864b9fca18992b4f862dbba +2 -0
- package/.idea/sonarlint/issuestore/d/a/dac4ed416fff2cc3bff02b81a88328ec7c19de0e +0 -0
- package/.idea/sonarlint/issuestore/e/0/e00bc8f8672ab358b454ac1d2030d3526a374653 +0 -0
- package/.idea/sonarlint/issuestore/e/0/e017677da38130b31bd766d7a84884050023d597 +0 -0
- package/.idea/sonarlint/issuestore/e/1/e15a6d4820640fb201495dfd5875489fd536ebb3 +0 -0
- package/.idea/sonarlint/issuestore/e/4/e4ba9c2909b6e543ec138e95d86cee25af778d54 +0 -0
- package/.idea/sonarlint/issuestore/e/8/e804956e69c2d0944d08ff64caa3e6286590814b +0 -0
- package/.idea/sonarlint/issuestore/f/0/f039b4d90e01657caf0dbfd31860e93d585b6752 +0 -0
- package/.idea/sonarlint/issuestore/f/0/f096934f71a0918e4829a4f76b3bba64b8d65f1e +0 -0
- package/.idea/sonarlint/issuestore/f/1/f11f7a7b3a7306f994e28b2eba9c69a5b555c017 +0 -0
- package/.idea/sonarlint/issuestore/f/1/f1b96288c62ba6818b30b3d2e7506e30c1b4a742 +3 -0
- package/.idea/sonarlint/issuestore/f/3/f351a44ab2314976174827d1ca2495fd38ea8df8 +0 -0
- package/.idea/sonarlint/issuestore/f/3/f37789881b66dffd7123fa80ee7ad838f3bdafaf +0 -0
- package/.idea/sonarlint/issuestore/f/4/f40b81d4c7242e4401b8ae55bdcab1c38b860071 +0 -0
- package/.idea/sonarlint/issuestore/f/4/f425d43e761ebef46b781334764eb5d3bb913cf8 +3 -0
- package/.idea/sonarlint/issuestore/f/6/f61f9b480b4da03d8ff7d137ce344656354cd190 +0 -0
- package/.idea/sonarlint/issuestore/f/6/f65d6b8cc814626bac7a38f2cd1c930554388594 +0 -0
- package/.idea/sonarlint/issuestore/f/9/f900edc44cb929c2267a16100a32851f6d5b477d +0 -0
- package/.idea/sonarlint/issuestore/f/b/fb8261203d602a51243c9a77b6c1ee63bb7b6966 +0 -0
- package/.idea/sonarlint/issuestore/f/f/ff7918f0784b416c82bb974889323c13506e7d0a +0 -0
- package/.idea/sonarlint/issuestore/index.pb +259 -0
- package/.idea/sonarlint/securityhotspotstore/0/2/0233f8559e74312ed5074ade1be1aea02e6e4f1e +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/2/02d5146f94659f11c56f0ea1d9c504ff9492b546 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/2/02f4902c3db5247c732bde5aaf0d4fb55363c3b1 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/3/0343acf33ca1b061164f9846ff8ce30429205a2a +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/4/04d5869ea32abbf6abf5a3cb9a671637ac2e345b +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/9/0918cbb76f2c44f223706cec9d31a32cd1177ce4 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/9/091aff741808a09242f252264b14f4a9adaa5305 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/b/0b63533e07c8b10a8fbfe7f35df1bffec8103e14 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/c/0c0fd6a370cd10350462b46937e98f903bcb1435 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/e/0e600c187f4cf8bd0dd6b678f55067a8300ab570 +0 -0
- package/.idea/sonarlint/securityhotspotstore/0/f/0f43007644f06a63afbfbfc129aadd61bf40318a +0 -0
- package/.idea/sonarlint/securityhotspotstore/1/4/14148858b7b4a0aa23ddfdc41ef62be2db925c70 +0 -0
- package/.idea/sonarlint/securityhotspotstore/1/5/15ff6a89ff653ef3176ddb9c5e0b59c16c2db949 +0 -0
- package/.idea/sonarlint/securityhotspotstore/1/6/169d7dbe9a819ce675ee66de130c5a7c92bb763d +0 -0
- package/.idea/sonarlint/securityhotspotstore/1/8/18a1ebb3a44ad977a5cfa60b6620a47ba00163a3 +0 -0
- package/.idea/sonarlint/securityhotspotstore/1/f/1fd3ecff7dd864e5b00c14a4333d8cde8c9faf11 +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/0/204a133d39c4a2c7b86de23f541f342e0a7a3234 +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/4/2491406c07bfc2b0f7ed8e010e56d6e468c374d0 +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/5/257d0fa8d58da6d96f5a7af9724b2e1c92c62a2d +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/8/282dcb1e4436703724dd35bb567086834c3ebdb4 +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/a/2aeb7bd71ee8453ff4601a1fc8fcd4fa9c5fe355 +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/c/2c25e229323612e7988c659ad7b51c7b1e2b2403 +0 -0
- package/.idea/sonarlint/securityhotspotstore/2/f/2fa1946a2afc952506e41d87833ed29401fc29a0 +0 -0
- package/.idea/sonarlint/securityhotspotstore/3/4/3463c59843592ad2a00c54f39e2943583bd6fff9 +0 -0
- package/.idea/sonarlint/securityhotspotstore/3/9/390f31a969ba7940070bf32aac2a0d1f7b7bd78b +0 -0
- package/.idea/sonarlint/securityhotspotstore/3/e/3ebc20bbfa3c33cf20481a2de7591c997c68abb9 +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/1/417425bfa2cef1f22539e792dcb0a7f7784f9604 +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/1/41ac9772c7dd3fc038485f99106b427a5e28f2e3 +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/4/44d3ca69a31c68c4d920b1fbb0083732713d2690 +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/8/48a8ec70d252121fbc7df4e8a45044e964b5d6b7 +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/9/49e951d8246d0914f9d10b3955a7178866cfcee9 +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/d/4def76d1eea91e36f7789929705c032be6df27cd +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/f/4f40ac4df99b3f8bbd80db9b729d3b4b401623eb +0 -0
- package/.idea/sonarlint/securityhotspotstore/4/f/4f4bba1840f039e57f25bbd19ec0e20c15fc0e1d +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/1/51f466e675bcd7ca84bf6287bab7404cde26db22 +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/2/5222c3d19fd979fed770b7f3664147b2ed16b230 +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/2/52cb9deee3ee8b8add01ec855fc4a45818ac7638 +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/3/53585a096fe3a3b96321113856ae62602995a33b +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/4/5471e6ec0c0e189560fccc7f474993fc6e1f758a +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/7/578f3ebc33c3ca6ab8e66c97f3c2eba2237b40ea +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/8/5831775a729fcf9cb12959996af17091f46f440b +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/8/5842d31a915855888fd63b1aca8c3a4dd8c95880 +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/c/5ce582bce204b2edd80e7602b279b3d64cc737e0 +0 -0
- package/.idea/sonarlint/securityhotspotstore/5/f/5f2f0e365ced14f666cef2ac164c93530d4e0c2a +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/0/60882ef9544224120d1d72534f44b973f3a57746 +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/0/60a7f3adc2729926865b49b02008b2874d65429d +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/0/60b89c88214907466f4d004bb8a2e56a468da7f5 +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/0/60bb79bf1ee7929bf0f8c20166ae12e49d7af9ea +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/1/61ebb9fd6e8cf9082658121d5d81e297791dacd0 +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/5/65c98391f12bde62f0955f439128e0f8cb1eac6a +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/7/6733e547a8a62f0e2b41358995a67255b967bfeb +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/8/68e29ca13d4f4cada132a831a6a1b52c0a0ebfd3 +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/9/692f3fce406d97e843fbf744ad689b51e3754dff +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/a/6a835d16be742d060f08912c5808bbf862426d3d +0 -0
- package/.idea/sonarlint/securityhotspotstore/6/e/6e142af7dffa0e82efece3ff58722e96f4283a3f +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/0/7030d0b2f71b999ff89a343de08c414af32fc93a +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/2/725cc9c146a136cafafef5ffec4cb307badb1d0e +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/3/73e399246034aaf963bb1ad4b0a0e2b5228f57cc +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/7/7710090cd8b91b750ed58a2f3196d971d7de988b +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/8/785055d2374e9ff4841f875174c20cad0c0d9a80 +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/8/78a09338d0e7bb67a5d2643580367940bee1e5b2 +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/9/793162cb1b4e542cbf5f8db45406f4e91f736c0e +0 -0
- package/.idea/sonarlint/securityhotspotstore/7/a/7a6581baac8c66b8e331b8187db03c64201001f1 +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/5/852060cc24633564871605ce8d1e59970ef2485c +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/5/85e8222943093a270d57ab07964a75d9a15648eb +2 -0
- package/.idea/sonarlint/securityhotspotstore/8/6/86abd2602e79b84f352d24c72f079541f41aeb6d +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/8/881d5d47bdc17ef8facebef59b68b5fc099a0293 +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/8/882c515e635f40a7e1ad419c70c0f2d2c17e2f37 +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/9/89d3df066dd0ec67c57e82d68cce94cb72f820b5 +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/b/8bff50de15c7d9b1166aa9ad98243d1a04b7e4c4 +0 -0
- package/.idea/sonarlint/securityhotspotstore/8/c/8c5bbc0d4ce626bd35d05b960ef906abfd312014 +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/0/900448384f6077c203e834650b95017f7a373583 +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/1/912f3a935b193eb148539815f9aef4a4252c12ba +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/4/94dd0b13f6f12ba5eae129046b1d061ddd546d72 +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/5/958a078793035ab0aad2086f7be79b55628402c0 +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/6/96dcf27dc8ae3662215096d9e00c194897d29c0b +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/7/9730e89df0a4367176020e461c38c37b7ae58b9a +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/8/98c4f1f9f94adc9e53100dbf68ce8c5df2a47f01 +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/9/9920d82d6cbbfe404d91c79781048e0c0514767e +0 -0
- package/.idea/sonarlint/securityhotspotstore/9/c/9cc6b3192a90fe4d986d791c393ab1ac7101ac48 +0 -0
- package/.idea/sonarlint/securityhotspotstore/a/1/a1991714da3efb5da4456ee802727afe63035aa5 +0 -0
- package/.idea/sonarlint/securityhotspotstore/a/7/a70ff2c42b6ffb69f1686cf6ced65733a75e056f +0 -0
- package/.idea/sonarlint/securityhotspotstore/a/8/a8b0d4ad8d44e8bb48b2ca34ddbd84b549ee9105 +0 -0
- package/.idea/sonarlint/securityhotspotstore/a/a/aaf524b8c18d54117ff8a4de5b06cdd7f5776d0d +0 -0
- package/.idea/sonarlint/securityhotspotstore/a/b/ab09011fa121d0a2bb9fa4ca76094f2482b902b7 +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/0/b0a40903f86afa7d5940f95f66995a290b6d4fe2 +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/2/b26e3039f1510dfa296fdfb6a1a5f12cdca84371 +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/3/b3349079128f17cb6e0cecf3cccfa4fe5188f92f +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/4/b4a9acebce4d56aa444e5b857fa140163bcbd47f +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/5/b5320db1c0a02ceb68cb70d050f5dc9d420b928b +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/7/b7d694611d1aa415d97c7872253457c54d8f1ed7 +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/9/b9f0a0a757a4dc7cc57724b3534dfdf189c25ea6 +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/b/bb971971f3915fff5703a078f2784df410b7298e +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/e/be023cb04cabb819ee6a97d9fc2a088cb4eded97 +0 -0
- package/.idea/sonarlint/securityhotspotstore/b/e/be633e1bf05efdb3dec5eae2777f024e1aee5599 +0 -0
- package/.idea/sonarlint/securityhotspotstore/c/2/c2b3144db64026759165a569b0f1f5086c6be0d3 +0 -0
- package/.idea/sonarlint/securityhotspotstore/c/6/c62bdf361b714427c19bdc47c8c97f90cce4dad3 +0 -0
- package/.idea/sonarlint/securityhotspotstore/c/6/c680d0675608db3debbc56eab6dae6478ea3d2db +0 -0
- package/.idea/sonarlint/securityhotspotstore/c/b/cb44f758b6159383fc5e20e1b38c4a3781d4e4bc +0 -0
- package/.idea/sonarlint/securityhotspotstore/c/e/ced731c009a96db35c13542868ab840aa2ef6de4 +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/1/d13af3479d43279b14b3cf9dbac30965ada1dadb +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/2/d2b81feb53c8d963c77dbd7e63afdc568883baad +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/3/d3f37835937f760d81f9a81b56b898afec37a1e7 +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/4/d4e02cf17e1477bc4516d78f557bdcd1b933fafd +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/5/d5595158cc48f9bf3e51b06f6e6805a8fd2d6262 +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/6/d690bc5bd5193edbd3f7e29b2d1be4d3f991937b +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/7/d76f3a535e1a92673864b9fca18992b4f862dbba +0 -0
- package/.idea/sonarlint/securityhotspotstore/d/a/dac4ed416fff2cc3bff02b81a88328ec7c19de0e +0 -0
- package/.idea/sonarlint/securityhotspotstore/e/0/e00bc8f8672ab358b454ac1d2030d3526a374653 +0 -0
- package/.idea/sonarlint/securityhotspotstore/e/1/e15a6d4820640fb201495dfd5875489fd536ebb3 +0 -0
- package/.idea/sonarlint/securityhotspotstore/e/8/e804956e69c2d0944d08ff64caa3e6286590814b +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/0/f039b4d90e01657caf0dbfd31860e93d585b6752 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/0/f096934f71a0918e4829a4f76b3bba64b8d65f1e +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/1/f11f7a7b3a7306f994e28b2eba9c69a5b555c017 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/1/f1b96288c62ba6818b30b3d2e7506e30c1b4a742 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/3/f351a44ab2314976174827d1ca2495fd38ea8df8 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/3/f37789881b66dffd7123fa80ee7ad838f3bdafaf +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/4/f40b81d4c7242e4401b8ae55bdcab1c38b860071 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/4/f425d43e761ebef46b781334764eb5d3bb913cf8 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/6/f61f9b480b4da03d8ff7d137ce344656354cd190 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/6/f65d6b8cc814626bac7a38f2cd1c930554388594 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/9/f900edc44cb929c2267a16100a32851f6d5b477d +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/b/fb8261203d602a51243c9a77b6c1ee63bb7b6966 +0 -0
- package/.idea/sonarlint/securityhotspotstore/f/f/ff7918f0784b416c82bb974889323c13506e7d0a +0 -0
- package/.idea/sonarlint/securityhotspotstore/index.pb +249 -0
- package/.idea/sonarlint-state.xml +6 -0
- package/.idea/sonarlint.xml +8 -0
- package/.idea/vcs.xml +1 -1
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-1.22.22.cjs +148049 -0
- package/CHANGELOG.md +13 -1
- package/dist/demosplan-ui.umd.js +1 -1
- package/moveToClaudeMD.md +65 -0
- package/package.json +1 -1
- package/src/components/DpAutocomplete/DpAutocomplete.vue +65 -29
- package/src/components/DpProgressBar/DpProgressBar.vue +11 -5
- package/tokens/dist/css/theme.css +1 -1
- package/tokens/dist/js/boxShadow.js +1 -1
- package/tokens/dist/js/breakpoints.js +1 -1
- package/tokens/dist/js/color.brand.js +1 -1
- package/tokens/dist/js/color.data.js +1 -1
- package/tokens/dist/js/color.palette.js +1 -1
- package/tokens/dist/js/color.ui-tailwind.js +1899 -0
- package/tokens/dist/js/color.ui.js +1 -1
- package/tokens/dist/js/fontSize.js +1 -1
- package/tokens/dist/js/rounded.js +1 -1
- package/tokens/dist/js/space.js +1 -1
- package/tokens/dist/js/zIndex.js +1 -1
- package/tokens/dist/scss/_boxShadow.scss +1 -1
- package/tokens/dist/scss/_breakpoints.scss +1 -1
- package/tokens/dist/scss/_color.brand.scss +1 -1
- package/tokens/dist/scss/_color.data.scss +1 -1
- package/tokens/dist/scss/_color.palette.scss +1 -1
- package/tokens/dist/scss/_color.ui.scss +1 -1
- package/tokens/dist/scss/_fontSize.scss +1 -1
- package/tokens/dist/scss/_rounded.scss +1 -1
- package/tokens/dist/scss/_space.scss +1 -1
- package/tokens/dist/scss/_zIndex.scss +1 -1
- package/tokens/dist/tailwind/color.brand.js +8 -0
- package/tokens/dist/tailwind/color.data.js +30 -0
- package/tokens/dist/tailwind/color.palette.js +60 -0
- package/tokens/scss/_boxShadow.scss +8 -0
- package/tokens/scss/_color.brand.scss +10 -0
- package/tokens/scss/_color.data.scss +32 -0
- package/tokens/scss/_color.palette.scss +62 -0
- package/tokens/scss/_color.scss +89 -0
- package/tokens/scss/_color.ui.scss +60 -0
- package/tokens/scss/_fontSize.scss +26 -0
- package/tokens/scss/_rounded.scss +9 -0
- package/tokens/scss/_space.scss +13 -0
- package/yarn-error.log +14081 -0
- package/.idea/codeStyles/Project.xml +0 -62
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_11_07_2025_09_56_[Changes]/shelved.patch +0 -175
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_11_07_2025_09_56__Changes_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_15_07_2025_11_55_[Changes]/shelved.patch +0 -18
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_15_07_2025_11_55__Changes_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_15_07_2025_11_56_[Changes]/shelved.patch +0 -18
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_15_07_2025_11_56__Changes_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_16_06_2025_14_40_[Changes]/shelved.patch +0 -58
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_24_06_2025_11_14_[Changes]/shelved.patch +0 -217
- package/.idea/shelf/Uncommitted_changes_before_Update_at_09_05_2025_14_28_[Changes]/shelved.patch +0 -295
- package/.idea/shelf/Uncommitted_changes_before_Update_at_15_07_2025_11_56_[Changes]/shelved.patch +0 -18
- package/.idea/shelf/Uncommitted_changes_before_Update_at_15_07_2025_11_56__Changes_.xml +0 -4
- package/.idea/workspace.xml +0 -981
- package/coverage/clover.xml +0 -6
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/debug-storybook.log +0 -40
- package/storybook-static/assets/CleanHtml-BxfZNGDF.js +0 -48
- package/storybook-static/assets/CleanHtml-CeG3Pc5D.js +0 -2
- package/storybook-static/assets/Color-AVL7NMMY-CrqVLxS7.js +0 -1
- package/storybook-static/assets/DocsRenderer-PQXLIZUC-C94DWaTq.js +0 -2
- package/storybook-static/assets/DpAccordion-BJ0eYoeL.js +0 -9
- package/storybook-static/assets/DpAccordion-CKgNMMg7.js +0 -1
- package/storybook-static/assets/DpAccordion.stories-Bi3-V11T.js +0 -26
- package/storybook-static/assets/DpApi-BU9X0WT6.js +0 -4
- package/storybook-static/assets/DpAutocomplete-BhABAuyz.js +0 -6
- package/storybook-static/assets/DpAutocomplete-Ds8IvIaM.js +0 -1
- package/storybook-static/assets/DpAutocomplete.stories-DGmOfoqI.js +0 -8
- package/storybook-static/assets/DpBadge-BPAWHuN0.js +0 -16
- package/storybook-static/assets/DpBadge-mgPu9WO8.js +0 -1
- package/storybook-static/assets/DpBadge.stories-DEFu_g_d.js +0 -69
- package/storybook-static/assets/DpBulkEditHeader-DYRPNRDA.js +0 -10
- package/storybook-static/assets/DpBulkEditHeader-qNgl3Gdq.js +0 -1
- package/storybook-static/assets/DpBulkEditHeader.stories-CgKeZjbQ.js +0 -50
- package/storybook-static/assets/DpButton-BLywaapW.js +0 -15
- package/storybook-static/assets/DpButton-BX5f5Y08.js +0 -28
- package/storybook-static/assets/DpButton.stories-Bh1aQWo-.js +0 -60
- package/storybook-static/assets/DpButtonIcon-CutRnDpO.js +0 -4
- package/storybook-static/assets/DpButtonRow-CU6rf5xR.js +0 -12
- package/storybook-static/assets/DpButtonRow-DRRw4r4F.js +0 -1
- package/storybook-static/assets/DpButtonRow.stories-BRZ52We0.js +0 -60
- package/storybook-static/assets/DpCard-CNBkliZ1.js +0 -1
- package/storybook-static/assets/DpCard-CqzBHYky.js +0 -5
- package/storybook-static/assets/DpCard.stories-CkAnU1Vf.js +0 -8
- package/storybook-static/assets/DpCheckbox-BdZqABk4.js +0 -1
- package/storybook-static/assets/DpCheckbox-Db9FgQPp.js +0 -25
- package/storybook-static/assets/DpCheckbox.stories-yTBXYgIJ.js +0 -48
- package/storybook-static/assets/DpCheckboxGroup-CE1noRhA.js +0 -10
- package/storybook-static/assets/DpCheckboxGroup-CFaFEzrL.js +0 -1
- package/storybook-static/assets/DpCheckboxGroup.stories-DQ7BzPww.js +0 -15
- package/storybook-static/assets/DpColumnSelector-B0Q0n09i.js +0 -10
- package/storybook-static/assets/DpColumnSelector-BjRvX20u.js +0 -1
- package/storybook-static/assets/DpColumnSelector.stories-Bsxtu-R9.js +0 -17
- package/storybook-static/assets/DpConfirmDialog-B4NQKzL5.js +0 -8
- package/storybook-static/assets/DpConfirmDialog-CQYtFW-3.js +0 -1
- package/storybook-static/assets/DpConfirmDialog.stories-iv2KRiDU.js +0 -73
- package/storybook-static/assets/DpContextualHelp-DnsCCoZB.js +0 -4
- package/storybook-static/assets/DpContextualHelp-cg4NfoZJ.js +0 -12
- package/storybook-static/assets/DpContextualHelp.stories-D5HWdQyH.js +0 -45
- package/storybook-static/assets/DpDataTable-Cr1GA5Cb.js +0 -16
- package/storybook-static/assets/DpDataTable-f7CVMPNi.js +0 -10
- package/storybook-static/assets/DpDataTable.stories-BjXZnrni.js +0 -123
- package/storybook-static/assets/DpDataTableExtended-C-oFpO_I.js +0 -14
- package/storybook-static/assets/DpDataTableExtended-mDxHCvB0.js +0 -2
- package/storybook-static/assets/DpDataTableExtended.stories-I5_PptZr.js +0 -73
- package/storybook-static/assets/DpDateRangePicker-D5652u0C.js +0 -1
- package/storybook-static/assets/DpDateRangePicker-YGJhE-xN.js +0 -10
- package/storybook-static/assets/DpDateRangePicker.stories-CCfSjt7J.js +0 -19
- package/storybook-static/assets/DpDatepicker-BlQqmRXh.js +0 -14
- package/storybook-static/assets/DpDatepicker-CFlgW3DB.js +0 -30
- package/storybook-static/assets/DpDatepicker.stories-QbL7uNPB.js +0 -55
- package/storybook-static/assets/DpDatetimePicker-BNogWwEl.js +0 -17
- package/storybook-static/assets/DpDatetimePicker-DQokm861.js +0 -2
- package/storybook-static/assets/DpDatetimePicker.stories-dJTr_X4a.js +0 -39
- package/storybook-static/assets/DpDetails-Do--n1SK.js +0 -1
- package/storybook-static/assets/DpDetails-qy-zsMYA.js +0 -12
- package/storybook-static/assets/DpDetails.stories-BmFnnpwr.js +0 -89
- package/storybook-static/assets/DpDraggable-CddfZrQg.js +0 -12
- package/storybook-static/assets/DpDraggable-DLTo9Q5K.js +0 -6
- package/storybook-static/assets/DpDraggable.stories-YSsJhbLZ.js +0 -290
- package/storybook-static/assets/DpEditableList-5FqvJbtx.js +0 -8
- package/storybook-static/assets/DpEditableList-CKEmMpmV.js +0 -28
- package/storybook-static/assets/DpEditableList.stories-CunPGVO1.js +0 -48
- package/storybook-static/assets/DpEditor-xJ7bfv4o.js +0 -12
- package/storybook-static/assets/DpEditor.stories-IBm6EtTh.js +0 -90
- package/storybook-static/assets/DpFlyout-DgegOHH0.js +0 -8
- package/storybook-static/assets/DpFlyout-Dsx6KYUl.js +0 -1
- package/storybook-static/assets/DpFlyout.stories-vre_uXPR.js +0 -23
- package/storybook-static/assets/DpFormRow-BsMZgRL2.js +0 -1
- package/storybook-static/assets/DpFormRow-DkKEMIVl.js +0 -9
- package/storybook-static/assets/DpFormRow.stories-ix_fpK9y.js +0 -12
- package/storybook-static/assets/DpIcon-DNUvGdzz.js +0 -9
- package/storybook-static/assets/DpIcon-dOAQoUKG.js +0 -5
- package/storybook-static/assets/DpIcon.stories-DGgU5AFH.js +0 -149
- package/storybook-static/assets/DpInlineNotification-CEzn4Pqd.js +0 -2
- package/storybook-static/assets/DpInlineNotification-wqa943WU.js +0 -13
- package/storybook-static/assets/DpInlineNotification.stories-B0z19u_O.js +0 -17
- package/storybook-static/assets/DpInput-HcmwQIdx.js +0 -33
- package/storybook-static/assets/DpInput-cN-WEvOL.js +0 -16
- package/storybook-static/assets/DpInput.stories-bIIwZ06I.js +0 -131
- package/storybook-static/assets/DpLabel-CIRt98zd.js +0 -30
- package/storybook-static/assets/DpLabel-DFauD5I2.js +0 -1
- package/storybook-static/assets/DpLabel.stories-DOvT5FP0.js +0 -212
- package/storybook-static/assets/DpLoading-CPPK2VdG.js +0 -20
- package/storybook-static/assets/DpLoading-rM7osZHK.js +0 -1
- package/storybook-static/assets/DpLoading.stories-DbGxhEdp.js +0 -43
- package/storybook-static/assets/DpModal-CVn3FCXs.js +0 -26
- package/storybook-static/assets/DpModal-oGkhZvzT.js +0 -1
- package/storybook-static/assets/DpModal.stories-D85oaATj.js +0 -129
- package/storybook-static/assets/DpMultiselect-Bm5hUadB.js +0 -22
- package/storybook-static/assets/DpMultiselect-C43chKj1.js +0 -44
- package/storybook-static/assets/DpMultiselect.stories-CIoTsG-g.js +0 -107
- package/storybook-static/assets/DpMultistepNav-AnSXdU2J.js +0 -1
- package/storybook-static/assets/DpMultistepNav-C2Zadn2N.js +0 -13
- package/storybook-static/assets/DpMultistepNav.stories-BG2cLqfE.js +0 -30
- package/storybook-static/assets/DpNotification-C1QXVdor.js +0 -1
- package/storybook-static/assets/DpNotification-DyJmy8iY.js +0 -29
- package/storybook-static/assets/DpNotification.stories-DfecPPLD.js +0 -105
- package/storybook-static/assets/DpPager-BaoMw4uo.js +0 -1
- package/storybook-static/assets/DpPager-XfqFqQGG.js +0 -12
- package/storybook-static/assets/DpPager.stories-DHEGD-lB.js +0 -24
- package/storybook-static/assets/DpProgressBar-4fw0icXV.js +0 -20
- package/storybook-static/assets/DpProgressBar-C0dbsdgz.js +0 -1
- package/storybook-static/assets/DpProgressBar.stories-BSJKPymL.js +0 -26
- package/storybook-static/assets/DpRadio-9df2JDL9.js +0 -13
- package/storybook-static/assets/DpRadio-D2xw34qI.js +0 -2
- package/storybook-static/assets/DpRadio.stories-BE1cjwtP.js +0 -117
- package/storybook-static/assets/DpResettableInput-BPdfP0Ae.js +0 -8
- package/storybook-static/assets/DpResettableInput-nox0ihQv.js +0 -1
- package/storybook-static/assets/DpResettableInput.stories-Cq1mfxTz.js +0 -41
- package/storybook-static/assets/DpSearchField-CFqegLRV.js +0 -1
- package/storybook-static/assets/DpSearchField-f1Llye-2.js +0 -4
- package/storybook-static/assets/DpSearchField.stories-CdMKRXtW.js +0 -52
- package/storybook-static/assets/DpSelect-BzmpttTu.js +0 -1
- package/storybook-static/assets/DpSelect-J0BVjsqi.js +0 -11
- package/storybook-static/assets/DpSelect.stories-NpI9vCfo.js +0 -129
- package/storybook-static/assets/DpSkeletonBox-CDn0SzQb.js +0 -20
- package/storybook-static/assets/DpSkeletonBox-a5wBcRN-.js +0 -1
- package/storybook-static/assets/DpSkeletonBox.stories-Cb2yeXBb.js +0 -70
- package/storybook-static/assets/DpSlidebar-Bfb2VXSk.js +0 -21
- package/storybook-static/assets/DpSlidebar-DtAyUisB.js +0 -1
- package/storybook-static/assets/DpSlidebar.stories-DKSwFYzN.js +0 -23
- package/storybook-static/assets/DpSlidingPagination-BCXUgS46.js +0 -1
- package/storybook-static/assets/DpSlidingPagination-CfkT9VBg.js +0 -21
- package/storybook-static/assets/DpSlidingPagination.stories-DZ80NUNd.js +0 -35
- package/storybook-static/assets/DpSplitButton-Cft5u7Pe.js +0 -4
- package/storybook-static/assets/DpStickyElement-Biohssqu.js +0 -21
- package/storybook-static/assets/DpStickyElement-ClzY3p1-.js +0 -4
- package/storybook-static/assets/DpStickyElement.stories-RayTMlXk.js +0 -42
- package/storybook-static/assets/DpTabs-BGgWBJ_5.js +0 -23
- package/storybook-static/assets/DpTabs.stories-BNe9rHxl.js +0 -85
- package/storybook-static/assets/DpTextArea-BtrBIQP_.js +0 -49
- package/storybook-static/assets/DpTextArea-DoA63rHr.js +0 -2
- package/storybook-static/assets/DpTextArea.stories-c3BZqrsh.js +0 -155
- package/storybook-static/assets/DpTimePicker-9Qy_qVnW.js +0 -1
- package/storybook-static/assets/DpTimePicker-JnDQtvH1.js +0 -27
- package/storybook-static/assets/DpTimePicker.stories-CMqNipv8.js +0 -92
- package/storybook-static/assets/DpToggle-BNgSF54s.js +0 -10
- package/storybook-static/assets/DpToggle-BPqlzXQH.js +0 -1
- package/storybook-static/assets/DpToggle.stories-D3_9X7aB.js +0 -35
- package/storybook-static/assets/DpTooltip-BwmuQSat.js +0 -27
- package/storybook-static/assets/DpTooltip-D8SOODgR.js +0 -1
- package/storybook-static/assets/DpTooltip.stories-DbfOxsaF.js +0 -248
- package/storybook-static/assets/DpTransitionExpand-C4Amyfxp.js +0 -8
- package/storybook-static/assets/DpTransitionExpand.stories-DX9u7SiJ.js +0 -85
- package/storybook-static/assets/DpTreeList-C68TZVte.js +0 -78
- package/storybook-static/assets/DpTreeList-Cciwf3YU.js +0 -2
- package/storybook-static/assets/DpTreeList.stories-B_u3WNs8.js +0 -673
- package/storybook-static/assets/DpUploadFiles-BPYxTWYH.js +0 -26
- package/storybook-static/assets/DpUploadFiles.stories-CDCSsFQa.js +0 -154
- package/storybook-static/assets/DpVideoPlayer-CnldmoEy.js +0 -162
- package/storybook-static/assets/DpVideoPlayer-b-qaSsV5.css +0 -1
- package/storybook-static/assets/DpVideoPlayer-n_ANjh0q.js +0 -29
- package/storybook-static/assets/DpVideoPlayer.stories-BOR2SEz7.js +0 -294
- package/storybook-static/assets/Notice-FIynXtzj.js +0 -1
- package/storybook-static/assets/Stickier-DyqV0rTn.js +0 -1
- package/storybook-static/assets/Table-DSJ5DLHV.js +0 -1
- package/storybook-static/assets/Tooltip-DzpJJoBp.js +0 -25
- package/storybook-static/assets/Tooltip-flnpMaRO.js +0 -32
- package/storybook-static/assets/_commonjsHelpers-CE1G-McA.js +0 -1
- package/storybook-static/assets/_plugin-vue_export-helper-DlAUqK2U.js +0 -1
- package/storybook-static/assets/blocks-kyJuz3C5.js +0 -697
- package/storybook-static/assets/dayjs.min-C3DHb-Vr.js +0 -1
- package/storybook-static/assets/getScrollTop-CXy7CyEd.js +0 -1
- package/storybook-static/assets/hasOwnProp-B0vmwdLB.js +0 -1
- package/storybook-static/assets/helpers-CdC6mcQu.js +0 -1
- package/storybook-static/assets/iframe-DH2OFsM2.css +0 -1
- package/storybook-static/assets/iframe-KFxwsBtW.js +0 -1113
- package/storybook-static/assets/index-BbC7EF1e.js +0 -1
- package/storybook-static/assets/index-CTxdm8FW.js +0 -1
- package/storybook-static/assets/index-Ccl8MXhV.js +0 -79
- package/storybook-static/assets/lengthHint-zGawKYxB.js +0 -1
- package/storybook-static/assets/prefixClass-BBJiSKc2.js +0 -1
- package/storybook-static/assets/prefixClassMixin-FjEzRm2G.js +0 -1
- package/storybook-static/assets/tokens._overview-DfWYzL-L.js +0 -111
- package/storybook-static/assets/tokens.boxShadow-BRgz_5Oh.js +0 -64
- package/storybook-static/assets/tokens.breakpoints-V5SksMvF.js +0 -66
- package/storybook-static/assets/tokens.color-BpZbPjHk.js +0 -107
- package/storybook-static/assets/tokens.fontSize-rdG7vcZh.js +0 -51
- package/storybook-static/assets/tokens.rounded-CUE0q0vd.js +0 -55
- package/storybook-static/assets/tokens.space-B3MDHCbR.js +0 -48
- package/storybook-static/assets/tokens.zIndex-Be_fxSoV.js +0 -53
- package/storybook-static/assets/translations-DDOZrg-p.js +0 -1
- package/storybook-static/favicon.svg +0 -1
- package/storybook-static/iframe.html +0 -686
- package/storybook-static/index.html +0 -152
- package/storybook-static/index.json +0 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +0 -1
- package/storybook-static/sb-addons/docs-2/manager-bundle.js +0 -151
- package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -188
- package/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +0 -797
- package/storybook-static/sb-manager/globals-runtime.js +0 -69460
- package/storybook-static/sb-manager/globals.js +0 -34
- package/storybook-static/sb-manager/runtime.js +0 -13008
- package/vite.config.mjs +0 -44
- /package/{coverage/lcov.info → .idea/sonarlint/issuestore/0/2/0233f8559e74312ed5074ade1be1aea02e6e4f1e} +0 -0
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import{v as ol,f as Q1,s as Z1,o as ny,a as ek,b as tk,c as nk,h as rk,e as ik,g as sk,T as ry,r as ok,j as ak,k as lk,l as xh}from"./Tooltip-flnpMaRO.js";import{y as Po,x as ro,l as ou,a0 as uk,a2 as Th,a1 as iy,a3 as ck,a4 as Vf,L as dk,a5 as qf,E as hk,G as sy,V as fk,c as V,o as z,F as Lt,i as Rn,n as q,a as ne,t as qe,e as an,j as au,d as je,w as Ue,B as oy,a6 as pk,f as ye,b as sn,g as Le,h as al,p as An,m as mk,r as Hr,s as Sn,v as gk,a7 as yk,z as bk}from"./iframe-KFxwsBtW.js";import{d as W}from"./translations-DDOZrg-p.js";import{_ as vt}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{C as ay}from"./CleanHtml-CeG3Pc5D.js";import{_ as vk}from"./DpIcon-dOAQoUKG.js";import{D as wk}from"./DpButtonRow-DRRw4r4F.js";import{D as kk}from"./DpCheckbox-BdZqABk4.js";import{_ as ly}from"./DpInput-cN-WEvOL.js";import{D as uy}from"./DpModal-oGkhZvzT.js";import"./dayjs.min-C3DHb-Vr.js";import{t as Vr,s as cy,e as Jn,g as dy,a as hy,b as Sk,c as xk}from"./helpers-CdC6mcQu.js";import{h as Ch}from"./hasOwnProp-B0vmwdLB.js";import{v as Tk}from"./DpMultiselect-Bm5hUadB.js";import{p as lu}from"./prefixClassMixin-FjEzRm2G.js";import{s as Ck}from"./DpDataTable-f7CVMPNi.js";import Ek from"./DpLabel-DFauD5I2.js";import"./DpApi-BU9X0WT6.js";import{g as Io,c as jf}from"./_commonjsHelpers-CE1G-McA.js";import{m as Mk}from"./lengthHint-zGawKYxB.js";import{v as Ak}from"./index-CTxdm8FW.js";function Yc(n){let e=!0;return n.value===""?e=!n.hasAttribute("required"):/^\s*(3[01]|[12][0-9]|0?[1-9])\.(1[012]|0?[1-9])\.((?:19|20)\d{2})\s*$/.test(n.value)===!1&&(e=!1),Vr(n,!e),e}function Oa(n){let e=!0;const t=Array.from(n.querySelectorAll('input[type="checkbox"]')),r=Array.from(n.querySelectorAll('input[type="radio"]'));let i=null;return t.length>0?i=t:r.length>0&&(i=r),i===null?!0:(i.some(o=>o.checked===!0)===!1?(e=!1,i.forEach(o=>Vr(o,!0))):i.forEach(o=>Vr(o,!1)),e)}const Ok=/^(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){255,})(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){65,}@)(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E\p{L}\p{N}]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F\p{L}\p{N}]|(?:\x5C[\x00-\x7F]))*\x22))(?:\.(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E\p{L}\p{N}]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F\p{L}\p{N}]|(?:\x5C[\x00-\x7F]))*\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\.){1,126})+(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\]))$/i;function Xc(n){if(cy(n)===!1)return!0;const e=n.getAttribute("data-dp-validate-error")||!1;let t=!0,r=n.getAttribute("pattern"),i=new RegExp(r);if(n.getAttribute("type")==="email"&&(r="email",i=Ok),n.getAttribute("minlength")&&t&&(r=null,t=n.value.length>=parseInt(n.getAttribute("minlength"))),n.getAttribute("maxlength")&&t&&(r=null,t=n.value.length<=parseInt(n.getAttribute("maxlength"))),r&&t&&(t=n.hasAttribute("required")===!1&&n.value===""?!0:i.test(n.value)),n.getAttribute("data-dp-validate-should-equal")&&t&&(t=n.value===document.querySelector(n.getAttribute("data-dp-validate-should-equal")).value),n.hasAttribute("required")&&t&&(n.type==="checkbox"?t=n.checked===!0:t=n.value!==""),t){try{n.setCustomValidity("")}catch{}return n.hasAttribute("aria-invalid")&&n.removeAttribute("aria-invalid"),Vr(n,!1),!0}else{n.setAttribute("aria-invalid",!0),Vr(n,!0);try{if(e)n.setCustomValidity(e);else if(r)switch(r){case"^[0-9]{5}$":n.setCustomValidity(W.validation.error.zipCode);break;case"[A-Za-zÄäÜüÖöß ]+":n.setCustomValidity(W.validation.error.city);break;case"email":n.setCustomValidity(W.validation.error.email);break;default:n.setCustomValidity(W.validation.error.format)}else n.setCustomValidity(W.validation.error.default)}catch{}return!1}}function Qc(n){if(cy(n)===!1)return!0;let e=!0;if(n.classList.contains("is-required")&&n.value===""||n.hasAttribute("data-dp-validate-maxlength")&&n.getAttribute("data-dp-validate-maxlength")!==0&&n.value.length>n.getAttribute("data-dp-validate-maxlength")){e=!1;const t=n.parentNode.querySelector('div[contenteditable="true"]');if(t.classList.contains(Jn)===!1){Vr(t,!0);const r=()=>{Vr(t,!1),t.removeEventListener("focus",r)};t.addEventListener("focus",r)}}return e}function ia(n){dy(n).forEach(t=>{Nk(t)})}function Nk(n){let e,t,r;const i=hy(n),s=(o,a)=>{o.hasAttribute("data-dp-validate-if")&&o.getAttribute("data-dp-validate-if").split(",").forEach(u=>{const c=u.indexOf("!==")>-1?"isNotEqual":"isEqual",d=u.split(c==="isNotEqual"?"!==":"==="),h=o.closest("[data-dp-validate]"),f=h.tagName==="FIELDSET"&&h.form?h.form:h;try{const p=f.querySelector(d[0]);p.type==="radio"?Array.from(f.querySelectorAll(`input[name="${p.name}"]:not([value="${p.value}"]`)).forEach(g=>g.addEventListener("input",a)):(p.addEventListener("input",a),p.addEventListener("change",a),p.addEventListener("select",a))}catch{}})};switch(i){case"tiptap":Sk('div[contenteditable="true"]',n.parentNode).then(()=>{const o=n.parentNode.querySelector('div[contenteditable="true"]');o.addEventListener("blur",()=>Qc(n)),o.addEventListener("focus",()=>{o.classList.contains(Jn)&&o.classList.remove(Jn)}),s(n,()=>Qc(n))});break;case"fieldset":e=Array.from(n.querySelectorAll('input[type="checkbox"]')),t=Array.from(n.querySelectorAll('input[type="radio"]')),e.length>0?r=e:t.length>0?r=t:r=[],r.forEach(o=>o.addEventListener("blur",()=>Oa(n))),r.forEach(o=>o.addEventListener("change",()=>Oa(n))),s(n,()=>Oa(n));break;case"datepicker":n.addEventListener("focus",()=>{n.classList.contains(Jn)&&n.classList.remove(Jn)}),n.addEventListener("blur",()=>Yc(n)),s(n,()=>Yc(n));break;case"input":n.addEventListener("focus",()=>{n.classList.contains(Jn)&&n.classList.remove(Jn)}),n.addEventListener("blur",()=>Xc(n)),s(n,()=>Xc(n));break}}function _k(n){let e=!0;const t=dy(n),r=[];return t.forEach(i=>{const s=hy(i);let o=!0;switch(s){case"multiselect":o=Tk(i);break;case"tiptap":o=Qc(i);break;case"fieldset":o=Oa(i);break;case"datepicker":o=Yc(i);break;case"input":default:o=Xc(i)}o===!1&&(r.push(i),e=!1)}),{valid:e,invalidFields:r}}const Rk={data(){return{dpValidate:{}}},methods:{dpValidateAction(n,e,t=!0){const i=this.$el.hasAttribute("data-dp-validate")&&this.$el.getAttribute("data-dp-validate")===n?this.$el:this.$el.querySelector(`[data-dp-validate=${n}]`),s=_k(i);if(this.dpValidate={...this.dpValidate,[n]:s.valid},Ch(this.dpValidate,"invalidFields")===!1&&(this.dpValidate.invalidFields={}),this.dpValidate.invalidFields[n]=s.invalidFields,this.dpValidate[n]===!1){const o=this.dpValidate.invalidFields[n],a=o.filter(u=>u.hasAttribute("data-dp-validate-error")).map(u=>u.dataset.dpValidateError);if(a.forEach(u=>dplan.notify.notify("error",u)),a.length===0){const u=[];if(o.forEach(c=>{const d=c.getAttribute("data-dp-validate-error-fieldname");if(!d)return;let h=c.closest("[data-dp-validate-topic]"),f=h?h.getAttribute("data-dp-validate-topic"):"";u.findIndex(m=>m.fieldName===d&&m.topicName===f)===-1&&u.push({fieldName:d,topicName:f})}),u.length){const c=u.map(h=>h.topicName?`${h.fieldName} (${h.topicName})`:h.fieldName).join(", "),d=W.error.mandatoryFields.intro+c+W.error.mandatoryFields.outro;dplan.notify.notify("error",d)}else dplan.notify.notify("error",W.error.mandatoryFields.default)}const l=i.querySelector("."+Jn);xk(l)}if(this.dpValidate[n]===!1&&t||this.dpValidate[n])return e()}},mounted(){let n=[];this.$el.hasAttribute("data-dp-validate")?(this.isComponentForm=!0,n.push(this.$el)):(this.isComponentForm=!1,n=Array.from(this.$el.querySelectorAll("[data-dp-validate]"))),this.dpValidateForms=n,this.dpValidateForms.forEach(e=>{const t=e.getAttribute("data-dp-validate");this.dpValidate[t]=!0,ia(e)})},updated(){this.$nextTick(()=>{if(this.isComponentForm===!1){const n=Array.from(this.$el.querySelectorAll("[data-dp-validate]"));n.concat(this.dpValidateForms).forEach(t=>{if(this.dpValidateForms.includes(t)&&n.includes(t)===!1){const r=this.dpValidateForms.findIndex(i=>i===t);delete this.dpValidateForms[r]}else if(this.dpValidateForms.includes(t)===!1&&n.includes(t)){this.dpValidateForms.push(t);const r=t.getAttribute("data-dp-validate");this.dpValidate[r]=!0,ia(t)}else ia(t)})}else this.dpValidateForms.forEach(n=>{ia(n)})})}},Wf={antragx:[".antragx"],pdf:[".pdf"],"pdf-img":[".pdf","image/*"],"pdf-img-zip":[".pdf","image/*",".zip"],"pdf-zip":[".pdf",".zip"],img:["image/*"],import:[".docx"],all:[".jpg",".png",".bmp",".jpeg",".zip",".docx",".pdf",".bin",".txt",".tiff",".tif"],zip:[".zip"],csv:[".csv"],"pdf-video":[".pdf","video/*"],"pdf-zip-video":[".pdf","video/*",".zip"],xls:[".xls",".xlsx",".ods"]},fy=function(n,e){let t;switch(n){case"KB":t=e/1024;break;case"MB":t=e/1048576;break;case"GB":t=e/1073741824;break;case"TB":t=e/1099511627776;break;default:t=e}return Math.round(t)+" "+n},Pk=function(n){return Ch(Wf,n)?Wf[n]:n};function Ke(n){this.content=n}Ke.prototype={constructor:Ke,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new Ke(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ke(t)},addToStart:function(n,e){return new Ke([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ke(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new Ke(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ke.from(n),n.size?new Ke(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ke.from(n),n.size?new Ke(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ke.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ke.from=function(n){if(n instanceof Ke)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ke(e)};function py(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=py(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function my(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let u=0,c=Math.min(o.text.length,a.text.length);for(;u<c&&o.text[o.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let u=my(o.content,a.content,t-1,r-1);if(u)return u}t-=l,r-=l}}class C{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],u=a+l.nodeSize;if(u>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,t-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new C(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new C(r,i)}cutByIndex(e,t){return e==t?C.empty:e==0&&t==this.content.length?this:new C(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new C(i,s)}addToStart(e){return new C([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new C(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return py(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return my(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sa(0,e);if(e==this.size)return sa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?sa(r+1,o):sa(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return C.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new C(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return C.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new C(t||e,r)}static from(e){if(!e)return C.empty;if(e instanceof C)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new C([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}C.empty=new C([],0);const Fu={index:0,offset:0};function sa(n,e){return Fu.index=n,Fu.offset=e,Fu}function ll(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ll(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ll(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ge=class Zc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ll(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Zc.none;if(e instanceof Zc)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};ge.none=[];class qr extends Error{}class M{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=yy(this.content,e+this.openStart,t);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,t){return new M(gy(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return M.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(C.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new M(e,r,i)}}M.empty=new M(C.empty,0,0);function gy(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(gy(s.content,e-i-1,t-i-1)))}function yy(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return n.cut(0,e).append(t).append(n.cut(e));let a=yy(o.content,e-s-1,t);return a&&n.replaceChild(i,o.copy(a))}function Ik(n,e,t){if(t.openStart>n.depth)throw new qr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qr("Inconsistent open depths");return by(n,e,t,0)}function by(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=by(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Fr(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Dk(t,n);return Fr(s,wy(n,o,a,e,r))}else return Fr(s,ul(n,e,r))}function vy(n,e){if(!e.type.compatibleContent(n.type))throw new qr("Cannot join "+e.type.name+" onto "+n.type.name)}function ed(n,e,t){let r=n.node(t);return vy(r,e.node(t)),r}function Lr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function zs(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Lr(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Lr(i.child(a),r);e&&e.depth==t&&e.textOffset&&Lr(e.nodeBefore,r)}function Fr(n,e){return n.type.checkContent(e),n.copy(e)}function wy(n,e,t,r,i){let s=n.depth>i&&ed(n,e,i+1),o=r.depth>i&&ed(t,r,i+1),a=[];return zs(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(vy(s,o),Lr(Fr(s,wy(n,e,t,r,i+1)),a)):(s&&Lr(Fr(s,ul(n,e,i+1)),a),zs(e,t,i,a),o&&Lr(Fr(o,ul(t,r,i+1)),a)),zs(r,null,i,a),new C(a)}function ul(n,e,t){let r=[];if(zs(null,n,t,r),n.depth>t){let i=ed(n,e,t+1);Lr(Fr(i,ul(n,e,t+1)),r)}return zs(e,null,t,r),new C(r)}function Dk(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(C.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class io{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ge.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new cl(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(r.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new io(t,r,s)}static resolveCached(e,t){let r=Jf.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else Jf.set(e,r=new Lk);let i=r.elts[r.i]=io.resolve(e,t);return r.i=(r.i+1)%Fk,i}}class Lk{constructor(){this.elts=[],this.i=0}}const Fk=12,Jf=new WeakMap;class cl{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const $k=Object.create(null);let or=class td{constructor(e,t,r,i=ge.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ll(this.attrs,t||e.defaultAttrs||$k)&&ge.sameSet(this.marks,r||ge.none)}copy(e=null){return e==this.content?this:new td(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new td(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return M.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),u=i.node(o).content.cut(i.pos-a,s.pos-a);return new M(u,i.depth-o,s.depth-o)}replace(e,t,r){return Ik(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return io.resolveCached(this,e)}resolveNoCache(e){return io.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ky(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=C.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ge.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ge.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=C.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};or.prototype.text=void 0;class dl extends or{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ky(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new dl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new dl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ky(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class jr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bk(e,t);if(r.next==null)return jr.empty;let i=Sy(r);r.next&&r.err("Unexpected trailing text");let s=Wk(jk(i));return Jk(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return C.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(c));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
2
|
-
`)}}jr.empty=new jr(!0);class Bk{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Sy(n){let e=[];do e.push(zk(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zk(n){let e=[];do e.push(Uk(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Uk(n){let e=qk(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Hk(n,e);else break;return e}function Kf(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Hk(n,e){let t=Kf(n),r=t;return n.eat(",")&&(n.next!="}"?r=Kf(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Vk(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function qk(n){if(n.eat("(")){let e=Sy(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Vk(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function jk(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u<o.min;u++){let c=t();i(s(o.expr,l),c),l=c}if(o.max==-1)i(s(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let c=t();r(l,c),i(s(o.expr,l),c),l=c}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function xy(n,e){return e-n}function Gf(n,e){let t=[];return r(e),t.sort(xy);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function Wk(n){let e=Object.create(null);return t(Gf(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);Gf(n,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new jr(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(xy);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Jk(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ty(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Cy(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Ey(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function My(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Gk(n,r,e[r]);return t}let Yf=class Ay{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=My(e,r.attrs),this.defaultAttrs=Ty(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==jr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Cy(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new or(this,this.computeAttrs(e),C.from(t),ge.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new or(this,this.computeAttrs(e),t,ge.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(C.empty,!0);return s?new or(this,e,t.append(s),ge.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ey(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:ge.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Ay(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Kk(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class Gk{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Kk(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Vi{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=My(e,i.attrs),this.excluded=null;let s=Ty(this.attrs);this.instance=s?new ge(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ge(this,Cy(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Vi(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ey(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Oy{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ke.from(e.nodes),t.marks=Ke.from(e.marks||{}),this.nodes=Yf.compile(this.spec.nodes,this),this.marks=Vi.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=jr.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Xf(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Xf(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yf){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new dl(r,r.defaultAttrs,e,ge.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return or.fromJSON(this,e)}markFromJSON(e){return ge.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Xf(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Yk(n){return n.tag!=null}function Xk(n){return n.style!=null}let Ti=class nd{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Yk(i))this.tags.push(i);else if(Xk(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Zf(this,t,!1);return r.addAll(e,ge.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Zf(this,t,!0);return r.addAll(e,ge.none,t.from,t.to),M.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(eS(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ep(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ep(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new nd(e,nd.schemaRules(e)))}};const Ny={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Qk={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},_y={ol:!0,ul:!0},so=1,rd=2,Us=4;function Qf(n,e,t){return e!=null?(e?so:0)|(e==="full"?rd:0):n&&n.whitespace=="pre"?so|rd:t&~Us}class oa{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ge.none,this.match=s||(o&Us?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&so)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ny.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Zf{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Qf(null,t.preserveWhitespace,0)|(r?Us:0);i?s=new oa(i.type,i.attrs,ge.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new oa(null,null,ge.none,!0,null,o):s=new oa(e.schema.topNodeType,null,ge.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&rd?"full":this.localPreserveWS||(i.options&so)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
3
|
-
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],a=e.previousSibling;(!o||a&&a.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;_y.hasOwnProperty(o)&&this.parser.normalizeLists&&Zk(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Qk.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(Ny.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),u&&this.sync(s),this.needsBlock=c}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
-
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(u=>!l.clearMark(u)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,s=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ge.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):tp(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Qf(e,s,o.options);o.options&Us&&o.content.length==0&&(a|=Us);let l=ge.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):tp(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new oa(e,t,l,i,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=so)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Zk(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&_y.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function eS(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ep(n){let e={};for(let t in n)e[t]=n[t];return e}function tp(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class ri{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=$u(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],c=this.serializeMark(u,o.isInline,t);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Na($u(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Na($u(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Na(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ri(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=np(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return np(e.marks)}}function np(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function $u(n){return n.document||window.document}const rp=new WeakMap;function tS(n){let e=rp.get(n);return e===void 0&&rp.set(n,e=nS(n)),e}function nS(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Na(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=tS(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=Na(n,h,t,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Ry=65535,Py=Math.pow(2,16);function rS(n,e){return n+e*Py}function ip(n){return n&Ry}function iS(n){return(n-(n&Ry))/Py}const Iy=1,Dy=2,_a=4,Ly=8;let id=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ly)>0}get deletedBefore(){return(this.delInfo&(Iy|_a))>0}get deletedAfter(){return(this.delInfo&(Dy|_a))>0}get deletedAcross(){return(this.delInfo&_a)>0}},Wr=class fi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&fi.empty)return fi.empty}recover(e){let t=0,r=ip(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+iS(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:c);if(r)return f;let p=e==(t<0?l:d)?null:rS(a/3,e-l),m=e==l?Dy:e==d?Iy:_a;return(t<0?e!=l:e!=d)&&(m|=Ly),new id(f,m,p)}i+=c-u}return r?e+i:new id(e+i,0,null)}touches(e,t){let r=0,i=ip(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+r];e(a,a+u,l,l+c),s+=c-u}}invert(){return new fi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?fi.empty:new fi(e<0?[0,-e,0]:[0,0,e])}};Wr.empty=new Wr([]);let Fy=class Ra{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Ra(this.maps,this.mirror,e,t)}copy(){return new Ra(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Ra;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new id(e,i,null)}};const Bu=Object.create(null);let it=class{getMap(){return Wr.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Bu[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Bu)throw new RangeError("Duplicate use of step JSON ID "+e);return Bu[e]=t,t.prototype.jsonID=e,t}},ft=class gs{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new gs(e,null)}static fail(e){return new gs(null,e)}static fromReplace(e,t,r,i){try{return gs.ok(e.replace(t,r,i))}catch(s){if(s instanceof qr)return gs.fail(s.message);throw s}}};function Eh(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Eh(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return C.fromArray(r)}let Mh=class ys extends it{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M(Eh(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ft.fromReplace(e,this.from,this.to,s)}invert(){return new Do(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ys(t.pos,r.pos,this.mark)}merge(e){return e instanceof ys&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ys(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ys(t.from,t.to,e.markFromJSON(t.mark))}};it.jsonID("addMark",Mh);let Do=class bs extends it{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(Eh(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ft.fromReplace(e,this.from,this.to,r)}invert(){return new Mh(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new bs(t.pos,r.pos,this.mark)}merge(e){return e instanceof bs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bs(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bs(t.from,t.to,e.markFromJSON(t.mark))}};it.jsonID("removeMark",Do);let Ah=class vs extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ft.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new vs(this.pos,t.marks[i]);return new vs(this.pos,this.mark)}}return new Oh(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vs(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new vs(t.pos,e.markFromJSON(t.mark))}};it.jsonID("addNodeMark",Ah);let Oh=class sd extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ft.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ah(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new sd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new sd(t.pos,e.markFromJSON(t.mark))}};it.jsonID("removeNodeMark",Oh);let Fn=class kr extends it{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&od(e,this.from,this.to)?ft.fail("Structure replace would overwrite content"):ft.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Wr([this.from,this.to-this.from,this.slice.size])}invert(e){return new kr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new kr(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof kr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new kr(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new kr(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new kr(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}};it.jsonID("replace",Fn);let Yt=class Pa extends it{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(od(e,this.from,this.gapFrom)||od(e,this.gapTo,this.to)))return ft.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ft.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ft.fromReplace(e,this.from,this.to,r):ft.fail("Content does not fit in gap")}getMap(){return new Wr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Pa(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),s=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Pa(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Pa(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}};it.jsonID("replaceAround",Yt);function od(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function sS(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),f=Math.min(u+l.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new Do(h,f,d[m])));a&&a.to==h?a.to=f:s.push(a=new Mh(h,f,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function oS(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Vi){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,t);for(let c=0;c<l.length;c++){let d=l[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=u,h.step=s):i.push({style:d,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>n.step(new Do(o.from,o.to,o.style)))}function aS(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let a=0;a<i.childCount;a++){let l=i.child(a),u=o+l.nodeSize,c=r.matchType(l.type);if(!c)s.push(new Fn(o,u,M.empty));else{r=c;for(let d=0;d<l.marks.length;d++)t.allowsMarkType(l.marks[d].type)||n.step(new Do(o,u,l.marks[d]));if(l.isText&&!t.spec.code){let d,h=/\r?\n|\r/g,f;for(;d=h.exec(l.text);)f||(f=new M(C.from(t.schema.text(" ",t.allowedMarks(l.marks))),0,0)),s.push(new Fn(o+d.index,o+d.index+d[0].length,f))}}o=u}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);n.replace(o,o,new M(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function lS(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function uS(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!lS(i,s,o))break}return null}function cS(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,u=a,c=C.empty,d=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,c=C.from(r.node(p).copy(c)),d++):l--;let h=C.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=C.from(i.node(p).copy(h)),f++):u++;n.step(new Yt(l,u,o,a,new M(c.append(h),d,f),c.size-d,!0))}function dS(n,e,t=null,r=n){let i=hS(n,e),s=i&&fS(r,e);return s?i.map(sp).concat({type:e,attrs:t}).concat(s.map(sp)):null}function sp(n){return{type:n,attrs:null}}function hS(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function fS(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:o}function pS(n,e,t){let r=C.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Yt(i,s,i,s,new M(r,0,0),t.length,!0))}function mS(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&gS(n.doc,n.mapping.slice(s).map(a),r)){n.clearIncompatible(n.mapping.slice(s).map(a,1),r);let l=n.mapping.slice(s),u=l.map(a,1),c=l.map(a+o.nodeSize,1);return n.step(new Yt(u,c,u+1,c-1,new M(C.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function gS(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function yS(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Yt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(C.from(o),0,0),1,!0))}function bS(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let l=i.depth-1,u=t-2;l>s;l--,u--){let c=i.node(l),d=i.index(l);if(c.type.spec.isolating)return!1;let h=c.content.cutByIndex(d,c.childCount),f=c;if(!c.canReplace(d+1,c.childCount)||!f.type.validContent(h))return!1}let a=i.indexAfter(s);return i.node(s).canReplaceWith(a,a,i.node(s+1).type)}function vS(n,e,t=1,r){let i=n.doc.resolve(e),s=C.empty,o=C.empty;for(let a=i.depth,l=i.depth-t,u=t-1;a>l;a--,u--){s=C.from(i.node(a).copy(s));let c=r&&r[u];o=C.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}n.step(new Fn(e,e,new M(s.append(o),t,t),!0))}function wS(n,e){let t=n.resolve(e),r=t.index();return kS(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function kS(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function SS(n,e,t){let r=new Fn(e-t,e+t,M.empty,!0);n.step(r)}function xS(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function $y(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function TS(n,e,t=e,r=M.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return By(i,s,r)?new Fn(e,t,r):new CS(i,s,r).fit()}function By(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let CS=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new M(s,o,a);return e>-1?new Yt(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new Fn(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=zu(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(t==1&&(o?u.matchType(o.type)||(d=u.fillBefore(C.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=zu(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=zu(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new M(ws(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new M(ws(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(zy(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?f:-1)))}let p=u==a.childCount;p||(f=-1),this.placed=ks(this.placed,t,C.from(c)),this.frontier[t].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?M.empty:new M(ws(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new M(ws(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Uu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Uu(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=Uu(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ks(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ks(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=ks(this.placed,this.frontier.length,t))}};function ws(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ws(n.firstChild.content,e-1,t)))}function ks(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ks(n.lastChild.content,e-1,t)))}function zu(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function zy(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,zy(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),n.copy(r)}function Uu(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!ES(t,s.content,o)?a:null}function ES(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function MS(n){return n.spec.defining||n.spec.definingForContent}function AS(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(By(i,s,r))return n.step(new Fn(e,t,r));let o=Hy(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),u=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(u.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=u[h],p=MS(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=u[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let v=i.node(g-1),k=i.index(g-1);if(v.canReplaceWith(k,k,p.type,p.marks))return n.replace(i.before(g),y?s.after(g):t,new M(Uy(r.content,0,r.openStart,f),f,r.openEnd))}}let d=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function Uy(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Uy(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(C.empty,!0))}return n}function OS(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=xS(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new M(C.from(r),0,0))}function NS(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=Hy(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function Hy(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}let Vy=class Ia extends it{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ft.fromReplace(e,this.pos,this.pos+1,new M(C.from(i),0,t.isLeaf?0:1))}getMap(){return Wr.empty}invert(e){return new Ia(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ia(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ia(t.pos,t.attr,t.value)}};it.jsonID("attr",Vy);let qy=class ad extends it{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ft.ok(r)}getMap(){return Wr.empty}invert(e){return new ad(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ad(t.attr,t.value)}};it.jsonID("docAttr",qy);let Ai=class extends Error{};Ai=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ai.prototype=Object.create(Error.prototype);Ai.prototype.constructor=Ai;Ai.prototype.name="TransformError";let _S=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fy}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ai(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=M.empty){let i=TS(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new M(C.from(r),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return AS(this,e,t,r),this}replaceRangeWith(e,t,r){return OS(this,e,t,r),this}deleteRange(e,t){return NS(this,e,t),this}lift(e,t){return cS(this,e,t),this}join(e,t=1){return SS(this,e,t),this}wrap(e,t){return pS(this,e,t),this}setBlockType(e,t=e,r,i=null){return mS(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return yS(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Vy(e,t,r)),this}setDocAttribute(e,t){return this.step(new qy(e,t)),this}addNodeMark(e,t){return this.step(new Ah(e,t)),this}removeNodeMark(e,t){if(!(t instanceof ge)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Oh(e,t)),this}split(e,t=1,r){return vS(this,e,t,r),this}addMark(e,t,r){return sS(this,e,t,r),this}removeMark(e,t,r){return oS(this,e,t,r),this}clearIncompatible(e,t,r){return aS(this,e,t,r),this}};const Hu=Object.create(null);class Z{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new jy(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=M.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:u}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(u.pos),a?M.empty:t),a==0&&lp(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),u=l.map(o.pos),c=l.map(a.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,t),lp(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ee(e):pi(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?pi(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):pi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Nt(e.node(0))}static atStart(e){return pi(e,e,0,0,1)||new Nt(e)}static atEnd(e){return pi(e,e,e.content.size,e.childCount,-1)||new Nt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Hu[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Hu)throw new RangeError("Duplicate use of selection JSON ID "+e);return Hu[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ee.between(this.$anchor,this.$head).getBookmark()}}Z.prototype.visible=!0;class jy{constructor(e,t){this.$from=e,this.$to=t}}let op=!1;function ap(n){!op&&!n.parent.inlineContent&&(op=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ee extends Z{constructor(e,t=e){ap(e),ap(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Z.near(r);let i=e.resolve(t.map(this.anchor));return new ee(i.parent.inlineContent?i:r,r)}replace(e,t=M.empty){if(super.replace(e,t),t==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ee&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new uu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ee(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=Z.findFrom(t,r,!0)||Z.findFrom(t,-r,!0);if(s)t=s.$head;else return Z.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(Z.findFrom(e,-r,!0)||Z.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ee(e,t)}}Z.jsonID("text",ee);class uu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new uu(e.map(this.anchor),e.map(this.head))}resolve(e){return ee.between(e.resolve(this.anchor),e.resolve(this.head))}}class G extends Z{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?Z.near(s):new G(s)}content(){return new M(C.from(this.node),0,0)}eq(e){return e instanceof G&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Nh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new G(e.resolve(t.anchor))}static create(e,t){return new G(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}G.prototype.visible=!1;Z.jsonID("node",G);class Nh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new uu(r,r):new Nh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&G.isSelectable(r)?new G(t):Z.near(t)}}class Nt extends Z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.empty){e.delete(0,e.doc.content.size);let r=Z.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Nt(e)}map(e){return new Nt(e)}eq(e){return e instanceof Nt}getBookmark(){return RS}}Z.jsonID("all",Nt);const RS={map(){return this},resolve(n){return new Nt(n)}};function pi(n,e,t,r,i,s=!1){if(e.inlineContent)return ee.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&G.isSelectable(a))return G.create(n,t-(i<0?a.nodeSize:0))}else{let l=pi(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function lp(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Fn||i instanceof Yt))return;let s=n.mapping.maps[r],o;s.forEach((a,l,u,c)=>{o==null&&(o=c)}),n.setSelection(Z.near(n.doc.resolve(o),t))}const up=1,aa=2,cp=4;class PS extends _S{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|up)&~aa,this.storedMarks=null,this}get selectionSet(){return(this.updated&up)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=aa,this}ensureMarks(e){return ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&aa)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~aa,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(Z.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=cp,this}get scrolledIntoView(){return(this.updated&cp)>0}}function dp(n,e){return!e||!n?n:n.bind(e)}class Ss{constructor(e,t,r){this.name=e,this.init=dp(t.init,r),this.apply=dp(t.apply,r)}}const IS=[new Ss("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ss("selection",{init(n,e){return n.selection||Z.atStart(e.doc)},apply(n){return n.selection}}),new Ss("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ss("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Vu{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=IS.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ss(r.key,r.spec.state,r))})}}class Si{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,u=i?i[o].state:this,c=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:t.length}:{state:this,n:0})}t.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Si(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new PS(this)}static create(e){let t=new Vu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Si(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Vu(this.schema,e.plugins),r=t.fields,i=new Si(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Vu(e.schema,e.plugins),s=new Si(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=or.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Z.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=u.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Wy(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Wy(i,e,{})),t[r]=i}return t}class Ce{constructor(e){this.spec=e,this.props={},e.props&&Wy(e.props,this,this.props),this.key=e.key?e.key.key:Jy("plugin")}getState(e){return e[this.key]}}const qu=Object.create(null);function Jy(n){return n in qu?n+"$"+ ++qu[n]:(qu[n]=0,n+"$")}class Ae{constructor(e="key"){this.key=Jy(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Xe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Oi=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ld=null;const Cn=function(n,e,t){let r=ld||(ld=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},DS=function(){ld=null},Jr=function(n,e,t,r){return t&&(hp(n,e,t,r,-1)||hp(n,e,t,r,1))},LS=/^(img|br|input|textarea|hr)$/i;function hp(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:$t(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Lo(n)||LS.test(n.nodeName)||n.contentEditable=="false")return!1;e=Xe(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?$t(n):0}else return!1}}function $t(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function FS(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=$t(n)}else if(n.parentNode&&!Lo(n))e=Xe(n),n=n.parentNode;else return null}}function $S(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Lo(n))e=Xe(n)+1,n=n.parentNode;else return null}}function BS(n,e,t){for(let r=e==0,i=e==$t(n);r||i;){if(n==t)return!0;let s=Xe(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==$t(n)}}function Lo(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const cu=function(n){return n.focusNode&&Jr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Cr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function zS(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function US(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min($t(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min($t(r.startContainer),r.startOffset)}}}const cn=typeof navigator<"u"?navigator:null,fp=typeof document<"u"?document:null,hr=cn&&cn.userAgent||"",ud=/Edge\/(\d+)/.exec(hr),Ky=/MSIE \d/.exec(hr),cd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hr),kt=!!(Ky||cd||ud),ar=Ky?document.documentMode:cd?+cd[1]:ud?+ud[1]:0,Gt=!kt&&/gecko\/(\d+)/i.test(hr);Gt&&+(/Firefox\/(\d+)/.exec(hr)||[0,0])[1];const dd=!kt&&/Chrome\/(\d+)/.exec(hr),nt=!!dd,Gy=dd?+dd[1]:0,gt=!kt&&!!cn&&/Apple Computer/.test(cn.vendor),Ni=gt&&(/Mobile\/\w+/.test(hr)||!!cn&&cn.maxTouchPoints>2),Ft=Ni||(cn?/Mac/.test(cn.platform):!1),HS=cn?/Win/.test(cn.platform):!1,Pn=/Android \d/.test(hr),Fo=!!fp&&"webkitFontSmoothing"in fp.documentElement.style,VS=Fo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qS(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function gn(n,e){return typeof n=="number"?n:n[e]}function jS(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function pp(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Oi(o);continue}let a=o,l=a==s.body,u=l?qS(s):jS(a),c=0,d=0;if(e.top<u.top+gn(r,"top")?d=-(u.top-e.top+gn(i,"top")):e.bottom>u.bottom-gn(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+gn(i,"top")-u.top:e.bottom-u.bottom+gn(i,"bottom")),e.left<u.left+gn(r,"left")?c=-(u.left-e.left+gn(i,"left")):e.right>u.right-gn(r,"right")&&(c=e.right-u.right+gn(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Oi(o)}}function WS(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Yy(n.dom)}}function Yy(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Oi(r));return e}function JS({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Xy(t,r==0?0:r-e)}function Xy(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let ui=null;function KS(n){if(n.setActive)return n.setActive();if(ui)return n.focus(ui);let e=Yy(n);n.focus(ui==null?{get preventScroll(){return ui={preventScroll:!0},!0}}:void 0),ui||(ui=!1,Xy(e,0))}function Qy(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,l,u;for(let c=n.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=Cn(c).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=c,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=u,r=0),t&&t.nodeType==3?GS(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Qy(t,i)}function GS(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Wn(r,1);if(s.top!=s.bottom&&_h(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function _h(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function YS(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function XS(n,e,t){let{node:r,offset:i}=Qy(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function QS(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Zy(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(_h(e,u))return Zy(o,e,u)}}if((s=(s+1)%r)==i)break}return n}function ZS(n,e){let t=n.dom.ownerDocument,r,i=0,s=US(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=n.dom.getBoundingClientRect();if(!_h(e,u)||(o=Zy(n.dom,e,u),!o))return null}if(gt)for(let u=o;r&&u;u=Oi(u))u.draggable&&(r=void 0);if(o=YS(o,e),r){if(Gt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;Fo&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=QS(n,r,i,e))}a==null&&(a=XS(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function mp(n){return n.top<n.bottom||n.left<n.right}function Wn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(mp(r))return r}return Array.prototype.find.call(t,mp)||n.getBoundingClientRect()}const ex=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function eb(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Fo||Gt;if(r.nodeType==3)if(o&&(ex.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Wn(Cn(r,i,i),t);if(Gt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=Wn(Cn(r,i-1,i-1),-1);if(u.top==l.top){let c=Wn(Cn(r,i,i+1),-1);if(c.top!=l.top)return Qi(c,c.left<u.left)}}return l}else{let l=i,u=i,c=t<0?1:-1;return t<0&&!i?(u++,c=-1):t>=0&&i==r.nodeValue.length?(l--,c=1):t<0?l--:u++,Qi(Wn(Cn(r,l,u),c),c<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==$t(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return ju(l.getBoundingClientRect(),!1)}if(s==null&&i<$t(r)){let l=r.childNodes[i];if(l.nodeType==1)return ju(l.getBoundingClientRect(),!0)}return ju(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==$t(r))){let l=r.childNodes[i-1],u=l.nodeType==3?Cn(l,$t(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Qi(Wn(u,1),!1)}if(s==null&&i<$t(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?Cn(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return Qi(Wn(u,-1),!0)}return Qi(Wn(r.nodeType==3?Cn(r):r,-t),t>=0)}function Qi(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function ju(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function tb(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function tx(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return tb(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=eb(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Cn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(t=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const nx=/[\u0590-\u08ac]/;function rx(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return a?!nx.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:tb(n,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&u==m;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let gp=null,yp=null,bp=!1;function ix(n,e,t){return gp==e&&yp==t?bp:(gp=e,yp=t,bp=t=="up"||t=="down"?tx(n,e,t):rx(n,e,t))}const Bt=0,vp=1,Nr=2,dn=3;class $o{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Bt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Xe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof rb){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof nb&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Xe(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Xe(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],u=o+l.size;if(i==-1&&e<=u){let c=o+l.border;if(e>=c&&t<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,c);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Xe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>t||a==this.children.length-1)){t=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Xe(d.dom);break}t+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Gt||gt)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
|
5
|
-
`),d&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Xe(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Gt&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&>)&&Jr(a.node,a.offset,c.anchorNode,c.anchorOffset)&&Jr(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((u.extend||e==t)&&!d){u.collapse(a.node,a.offset);try{e!=t&&u.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?Nr:vp,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=dn:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Nr:dn}r=o}this.dirty=Nr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Nr:vp;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class nb extends $o{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Bt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class sx extends $o{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Kr extends $o{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=ri.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Kr(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&dn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=dn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Bt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Bt}}slice(e,t,r){let i=Kr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=fd(s,t,o,r)),e>0&&(s=fd(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lr extends $o{constructor(e,t,r,i,s,o,a,l,u){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],l,u=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(t.isText){if(!c)c=document.createTextNode(t.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=ri.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let h=c;return c=ob(c,r,t),u?l=new ox(e,t,r,i,c,d||null,h,u,s,o+1):t.isText?new du(e,t,r,i,c,h,s):new lr(e,t,r,i,c,d||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==Bt&&e.eq(this.node)&&hl(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new lx(this,o&&o.node,e);dx(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?ge.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,i)},(u,c,d,h)=>{l.syncToMarks(u.marks,r,e);let f;l.findNodeMatch(u,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(u,c,d,f,e)||l.updateNextNode(u,c,d,e,h,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Nr)&&(o&&this.protectLocalComposition(e,o),ib(this.contentDOM,this.children,e),Ni&&hx(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ee)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=fx(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new sx(this,s,t,i);e.input.compositionNodes.push(o),this.children=fd(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==dn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Bt}updateOuterDeco(e){if(hl(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=sb(this.dom,this.nodeDOM,hd(this.outerDeco,this.node,t),hd(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function wp(n,e,t,r,i){ob(r,e,n);let s=new lr(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class du extends lr{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==dn||this.dirty!=Bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Bt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Bt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new du(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=dn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class rb extends $o{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ox extends lr{constructor(e,t,r,i,s,o,a,l,u,c){super(e,t,r,i,s,o,a,u,c),this.spec=l}update(e,t,r,i){if(this.dirty==dn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ib(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=kp(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof Kr){let l=r?r.previousSibling:n.lastChild;ib(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=kp(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Hs=function(n){n&&(this.nodeName=n)};Hs.prototype=Object.create(null);const _r=[new Hs];function hd(n,e,t){if(n.length==0)return _r;let r=t?_r[0]:new Hs,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new Hs(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(r=new Hs(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function sb(n,e,t,r){if(t==_r&&r==_r)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=_r[0]),i=l}ax(i,a||_r[0],o)}return i}function ax(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function ob(n,e,t){return sb(n,n,_r,hd(e,t,n.nodeType!=1))}function hl(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function kp(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class lx{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ux(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Bt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Kr.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==dn&&o.dom==o.contentDOM&&(o.dirty=Nr),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof lr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=s)return!1;let c=l.dom,d,h=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=dn&&hl(t,l.outerDeco));if(!h&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Nr,d.updateChildren(i,o+1),d.dirty=Bt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!hl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=lr.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=lr.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new nb(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Kr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof du)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((gt||nt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new rb(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function ux(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let u=t.children[r-1];if(u instanceof Kr)t=u,r=u.children.length;else{a=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function cx(n,e){return n.type.side-e.type.side}function dx(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let u=0;u<n.childCount;u++){let c=n.child(u);r(c,i,e.forChild(s,c),u),s+=c.nodeSize}return}let o=0,a=[],l=null;for(let u=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(cx);for(let g=0;g<d.length;g++)t(d[g],u,!!l)}else t(c,u,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(u<n.childCount)f=u,h=n.child(u++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function hx(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function fx(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let u=n.child(i++);if(s+=u.nodeSize,!u.isText)break;l+=u.text}if(s>=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=t)return a+u;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function fd(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],u=a,c=a+=l.size;u>=t||c<=e?s.push(l):(u<e&&s.push(l.slice(0,e-u,r)),i&&(s.push(i),i=void 0),c>t&&s.push(l.slice(t-u,l.size,r)))}return s}function Rh(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(cu(t)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&G.isSelectable(d)&&i.parent&&!(d.isInline&&BS(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;u=new G(o==h?a:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);d=Math.min(d,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=h==n.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!u){let d=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;u=Ph(n,c,a,d)}return u}function ab(n){return n.editable?n.hasFocus():ub(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ln(n,e=!1){let t=n.state.selection;if(lb(n,t),!!ab(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&nt){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Jr(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)mx(n);else{let{anchor:r,head:i}=t,s,o;Sp&&!(t instanceof ee)&&(t.$from.parent.inlineContent||(s=xp(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=xp(n,t.to))),n.docView.setSelection(r,i,n,e),Sp&&(s&&Tp(s),o&&Tp(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&px(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Sp=gt||nt&&Gy<63;function xp(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(gt&&i&&i.contentEditable=="false")return Wu(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Wu(i);if(s)return Wu(s)}}function Wu(n){return n.contentEditable="true",gt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Tp(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function px(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ab(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function mx(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Xe(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&kt&&ar<=11&&(r.disabled=!0,r.disabled=!1)}function lb(n,e){if(e instanceof G){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Cp(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Cp(n)}function Cp(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ph(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ee.between(e,t,r)}function Ep(n){return n.editable&&!n.hasFocus()?!1:ub(n)}function ub(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function gx(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Jr(e.node,e.offset,t.anchorNode,t.anchorOffset)}function pd(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Z.findFrom(s,e)}function Kn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Mp(n,e,t){let r=n.state.selection;if(r instanceof ee)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Kn(n,new ee(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=pd(n.state,e);return i&&i instanceof G?Kn(n,i):!1}else if(!(Ft&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?G.isSelectable(s)?Kn(n,new G(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Fo?Kn(n,new ee(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof G&&r.node.isInline)return Kn(n,new ee(e>0?r.$to:r.$from));{let i=pd(n.state,e);return i?Kn(n,i):!1}}}function fl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Vs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function ci(n,e){return e<0?yx(n):bx(n)}function yx(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Gt&&t.nodeType==1&&r<fl(t)&&Vs(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Vs(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(cb(t))break;{let a=t.previousSibling;for(;a&&Vs(a,-1);)i=t.parentNode,s=Xe(a),a=a.previousSibling;if(a)t=a,r=fl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?md(n,t,r):i&&md(n,i,s)}function bx(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=fl(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(Vs(a,1))s=t,o=++r;else break}else{if(cb(t))break;{let a=t.nextSibling;for(;a&&Vs(a,1);)s=a.parentNode,o=Xe(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=fl(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&md(n,s,o)}function cb(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function vx(n,e){for(;n&&e==n.childNodes.length&&!Lo(n);)e=Xe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function wx(n,e){for(;n&&!e&&!Lo(n);)e=Xe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function md(n,e,t){if(e.nodeType!=3){let s,o;(o=vx(e,t))?(e=o,t=0):(s=wx(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(cu(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ln(n)},50)}function Ap(n,e){let t=n.state.doc.resolve(e);if(!(nt||HS)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Op(n,e,t){let r=n.state.selection;if(r instanceof ee&&!r.empty||t.indexOf("s")>-1||Ft&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=pd(n.state,e);if(o&&o instanceof G)return Kn(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Nt?Z.near(o,e):Z.findFrom(o,e);return a?Kn(n,a):!1}return!1}function Np(n,e){if(!(n.state.selection instanceof ee))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function _p(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function kx(n){if(!gt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;_p(n,r,"true"),setTimeout(()=>_p(n,r,"false"),20)}return!1}function Sx(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function xx(n,e){let t=e.keyCode,r=Sx(e);if(t==8||Ft&&t==72&&r=="c")return Np(n,-1)||ci(n,-1);if(t==46&&!e.shiftKey||Ft&&t==68&&r=="c")return Np(n,1)||ci(n,1);if(t==13||t==27)return!0;if(t==37||Ft&&t==66&&r=="c"){let i=t==37?Ap(n,n.state.selection.from)=="ltr"?-1:1:-1;return Mp(n,i,r)||ci(n,i)}else if(t==39||Ft&&t==70&&r=="c"){let i=t==39?Ap(n,n.state.selection.from)=="ltr"?1:-1:1;return Mp(n,i,r)||ci(n,i)}else{if(t==38||Ft&&t==80&&r=="c")return Op(n,-1,r)||ci(n,-1);if(t==40||Ft&&t==78&&r=="c")return kx(n)||Op(n,1,r)||ci(n,1);if(r==(Ft?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ih(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=n.someProp("clipboardSerializer")||ri.fromSchema(n.state.schema),a=gb(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=mb[u.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let p=a.createElement(c[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
6
|
-
|
|
7
|
-
`);return{dom:l,text:h,slice:e}}function db(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,s||r,n)}),s)return e?new M(C.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
8
|
-
`))),0,0):M.empty;let d=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(d)a=d;else{let h=i.marks(),{schema:f}=n.state,p=ri.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Mx(t),Fo&&Ax(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||Ti.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Tx.test(h.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Ox(Rp(a,+c[1],+c[2]),c[4]);else if(a=M.maxOpen(Cx(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Rp(a,d,h)}return n.someProp("transformPasted",d=>{a=d(a,n)}),a}const Tx=/^(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)$/i;function Cx(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&fb(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=pb(o[o.length-1],s.length));let c=hb(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return C.from(o)}return n}function hb(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function fb(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=fb(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(C.from(hb(t,n,i+1))))}}function pb(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,pb(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function gd(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=gd(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Rp(n,e,t){return e<n.openStart&&(n=new M(gd(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new M(gd(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const mb={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Pp=null;function gb(){return Pp||(Pp=document.implementation.createHTMLDocument("title"))}let Ju=null;function Ex(n){let e=window.trustedTypes;return e?(Ju||(Ju=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ju.createHTML(n)):n}function Mx(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=gb().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&mb[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Ex(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Ax(n){let e=n.querySelectorAll(nt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Ox(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=C.from(l.create(r[a+1],i)),s++,o++}return new M(i,s,o)}const yt={},bt={},Nx={touchstart:!0,touchmove:!0};class _x{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Rx(n){for(let e in yt){let t=yt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Ix(n,r)&&!Dh(n,r)&&(n.editable||!(r.type in bt))&&t(n,r)},Nx[e]?{passive:!0}:void 0)}gt&&n.dom.addEventListener("input",()=>null),yd(n)}function tr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Px(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function yd(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Dh(n,r))})}function Dh(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Ix(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Dx(n,e){!Dh(n,e)&&yt[e.type]&&(n.editable||!(e.type in bt))&&yt[e.type](n,e)}bt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!bb(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Pn&&nt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ni&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Cr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||xx(n,t)?t.preventDefault():tr(n,"key")};bt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};bt.keypress=(n,e)=>{let t=e;if(bb(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ft&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ee)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function hu(n){return{left:n.clientX,top:n.clientY}}function Lx(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Lh(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Ci(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Fx(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&G.isSelectable(r)?(Ci(n,new G(t)),!0):!1}function $x(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof G&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(G.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Ci(n,G.create(n.state.doc,i)),!0):!1}function Bx(n,e,t,r,i){return Lh(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?$x(n,t):Fx(n,t))}function zx(n,e,t,r){return Lh(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Ux(n,e,t,r){return Lh(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Hx(n,t,r)}function Hx(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ci(n,ee.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Ci(n,ee.create(r,a+1,a+1+o.content.size));else if(G.isSelectable(o))Ci(n,G.create(r,a));else continue;return!0}}function Fh(n){return pl(n)}const yb=Ft?"metaKey":"ctrlKey";yt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Fh(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Lx(t,n.input.lastClick)&&!t[yb]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(hu(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Vx(n,o,t,!!r)):(s=="doubleClick"?zx:Ux)(n,o.pos,o.inside,t)?t.preventDefault():tr(n,"pointer"))};class Vx{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[yb],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let c=e.state.doc.resolve(t.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof G&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Gt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),tr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ln(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(hu(e))),this.updateAllowDefault(e),this.allowDefault||!t?tr(this.view,"pointer"):Bx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||gt&&this.mightDrag&&!this.mightDrag.node.isAtom||nt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ci(this.view,Z.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):tr(this.view,"pointer")}move(e){this.updateAllowDefault(e),tr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}yt.touchstart=n=>{n.input.lastTouch=Date.now(),Fh(n),tr(n,"pointer")};yt.touchmove=n=>{n.input.lastTouch=Date.now(),tr(n,"pointer")};yt.contextmenu=n=>Fh(n);function bb(n,e){return n.composing?!0:gt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const qx=Pn?5e3:-1;bt.compositionstart=bt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ee&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),pl(n,!0),n.markCursor=null;else if(pl(n,!e.selection.empty),Gt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}vb(n,qx)};bt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,vb(n,20))};function vb(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>pl(n),e))}function wb(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Wx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function jx(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=FS(e.focusNode,e.focusOffset),r=$S(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function Wx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function pl(n,e=!1){if(!(Pn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),wb(n),e||n.docView&&n.docView.dirty){let t=Rh(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Jx(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const oo=kt&&ar<15||Ni&&VS<604;yt.copy=bt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=oo?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Ih(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Jx(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Kx(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Gx(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ao(n,r.value,null,i,e):ao(n,r.textContent,r.innerHTML,i,e)},50)}function ao(n,e,t,r,i){let s=db(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||M.empty)))return!0;if(!s)return!1;let o=Kx(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function kb(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}bt.paste=(n,e)=>{let t=e;if(n.composing&&!Pn)return;let r=oo?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ao(n,kb(r),r.getData("text/html"),i,t)?t.preventDefault():Gx(n,t)};class Sb{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Yx=Ft?"altKey":"ctrlKey";function xb(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[Yx]}yt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(hu(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof G?i.to-1:i.to))){if(r&&r.mightDrag)o=G.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(o=G.create(n.state.doc,d.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:u,slice:c}=Ih(n,a);(!t.dataTransfer.files.length||!nt||Gy>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(oo?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",oo||t.dataTransfer.setData("text/plain",u),n.dragging=new Sb(c,xb(n,t),o)};yt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};bt.dragover=bt.dragenter=(n,e)=>e.preventDefault();bt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(hu(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=db(n,kb(t.dataTransfer),oo?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&xb(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||M.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?$y(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let u=n.state.tr;if(a){let{node:p}=r;p?p.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=u.doc;if(d?u.replaceRangeWith(c,c,o.content.firstChild):u.replaceRange(c,c,o),u.doc.eq(h))return;let f=u.doc.resolve(c);if(d&&G.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new G(f));else{let p=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,y,v)=>p=v),u.setSelection(Ph(n,f,u.doc.resolve(p)))}n.focus(),n.dispatch(u.setMeta("uiEvent","drop"))};yt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Ln(n)},20))};yt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};yt.beforeinput=(n,e)=>{if(nt&&Pn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Cr(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in bt)yt[n]=bt[n];function lo(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class ml{constructor(e,t){this.toDOM=e,this.spec=t||$r,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new ze(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ml&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&lo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ur{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ze(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ur&&lo(this.attrs,e.attrs)&&lo(this.spec,e.spec)}static is(e){return e.type instanceof ur}destroy(){}}class $h{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ze(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof $h&&lo(this.attrs,e.attrs)&&lo(this.spec,e.spec)}destroy(){}}class ze{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ze(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ze(e,e,new ml(t,r))}static inline(e,t,r,i){return new ze(e,t,new ur(r,i))}static node(e,t,r,i){return new ze(e,t,new $h(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ur}get widget(){return this.type instanceof ml}}const mi=[],$r={};class Se{constructor(e,t){this.local=e.length?e:mi,this.children=t.length?t:mi}static create(e,t){return t.length?gl(t,e,0,$r):tt}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==tt||e.maps.length==0?this:this.mapInner(e,t,0,0,r||$r)}mapInner(e,t,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Xx(this.children,o||[],e,t,r,i,s):o?new Se(o.sort(Br),mi):tt}add(e,t){return t.length?this==tt?Se.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,l)=>{let u=l+r,c;if(c=Cb(t,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,c,u+1):i.splice(s,0,l,l+a.nodeSize,gl(c,a,u+1,$r)),s+=3}});let o=Tb(s?Eb(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Se(o.length?this.local.concat(o).sort(Br):this.local,i||this.children)}remove(e){return e.length==0||this==tt?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,l=r[s+1]+t;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,a+1);u!=tt?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Se(i,r):tt}forChild(e,t){if(this==tt)return this;if(t.isLeaf)return Se.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof ur){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Se(i.sort(Br),mi);return r?new Xn([a,r]):a}return r||tt}eq(e){if(this==e)return!0;if(!(e instanceof Se)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Bh(this.localsInner(e))}localsInner(e){if(this==tt)return mi;if(e.inlineContent||!this.local.some(ur.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ur||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Se.empty=new Se([],[]);Se.removeOverlap=Bh;const tt=Se.empty;class Xn{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,$r));return Xn.from(r)}forChild(e,t){if(t.isLeaf)return Se.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=tt&&(s instanceof Xn?r=r.concat(s.members):r.push(s))}return Xn.from(r)}eq(e){if(!(e instanceof Xn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Bh(r?t:t.sort(Br)):mi}static from(e){switch(e.length){case 0:return tt;case 1:return e[0];default:return new Xn(e.every(t=>t instanceof Se)?e:e.reduce((t,r)=>t.concat(r instanceof Se?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Xx(n,e,t,r,i,s,o){let a=n.slice();for(let u=0,c=s;u<t.maps.length;u++){let d=0;t.maps[u].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let y=0;y<a.length;y+=3){let v=a[y+1];if(v<0||h>v+c-d)continue;let k=a[y]+c-d;f>=k?a[y+1]=h<=k?-2:-1:h>=c&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),c=t.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=t.map(n[u]+s),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let h=t.map(n[u+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let y=a[u+2].mapInner(t,g,c+1,n[u]+s+1,o);y!=tt?(a[u]=d,a[u+1]=f,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=Qx(a,n,e,t,i,s,o),c=gl(u,r,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let f=c.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Se(e.sort(Br),a)}function Tb(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new ze(i.from+e,i.to+e,i.type))}return t}function Qx(n,e,t,r,i,s,o){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?t.push(d):o.onRemove&&o.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+s+1);return t}function Cb(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function Eb(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function gl(n,e,t,r){let i=[],s=!1;e.forEach((a,l)=>{let u=Cb(n,a,l+t);if(u){s=!0;let c=gl(u,a,t+l+1,r);c!=tt&&i.push(l,l+a.nodeSize,c)}});let o=Tb(s?Eb(n):n,-t).sort(Br);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Se(o,i):tt}function Br(n,e){return n.from-e.from||n.to-e.to}function Bh(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Ip(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Ip(e,i,r.copy(s.from,r.to)));break}}}return e}function Ip(n,e,t){for(;e<n.length&&Br(t,n[e])>0;)e++;n.splice(e,0,t)}function Ku(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=tt&&e.push(r)}),n.cursorWrapper&&e.push(Se.create(n.state.doc,[n.cursorWrapper.deco])),Xn.from(e)}const Zx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},eT=kt&&ar<=11;class tT{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class nT{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new tT,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);kt&&ar<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),eT&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Zx)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ep(this.view)){if(this.suppressingSelectionUpdates)return Ln(this.view);if(kt&&ar<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Jr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Oi(s))t.add(s);for(let s=e.anchorNode;s;s=Oi(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ep(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;c<t.length;c++){let d=this.registerMutation(t[c],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Gt&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||sT(e,d)!=f)&&h.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&cu(r)&&(u=Rh(e))&&u.eq(Z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ln(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),rT(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ln(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(kt&&ar<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Xe(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Xe(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Dp=new WeakMap,Lp=!1;function rT(n){if(!Dp.has(n)&&(Dp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Gt,Lp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Lp=!0}}function Fp(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Jr(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function iT(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Fp(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Fp(n,t):null}function sT(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function oT(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),u,c=l.anchorNode;if(c&&n.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],cu(l)||u.push({node:l.focusNode,offset:l.focusOffset})),nt&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=r.childNodes[g-1],v=y.pmViewDesc;if(y.nodeName=="BR"&&!v){s=g;break}if(!v||v.size)break}let d=n.state.doc,h=n.someProp("domParser")||Ti.fromSchema(n.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:aT,context:f});if(u&&u[0].pos!=null){let g=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function aT(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(gt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||gt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const lT=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function uT(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let _=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,I=Rh(n,_);if(I&&!n.state.selection.eq(I)){if(nt&&Pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Y=>Y(n,Cr(13,"Enter"))))return;let $=n.state.tr.setSelection(I);_=="pointer"?$.setMeta("pointer",!0):_=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),n.dispatch($)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,u=oT(n,e,t),c=n.state.doc,d=c.slice(u.from,u.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=hT(d.content,u.doc.content,u.from,h,f);if(p&&n.input.domChangeCount++,(Ni&&n.input.lastIOSEnter>Date.now()-225||Pn)&&i.some(_=>_.nodeType==1&&!lT.test(_.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",_=>_(n,Cr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof ee&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let _=$p(n,n.state.doc,u.sel);if(_&&!_.eq(n.state.selection)){let I=n.state.tr.setSelection(_);s&&I.setMeta("composition",s),n.dispatch(I)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof ee&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),kt&&ar<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=u.doc.resolveNoCache(p.start-u.from),g=u.doc.resolveNoCache(p.endB-u.from),y=c.resolve(p.start),v=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,k;if((Ni&&n.input.lastIOSEnter>Date.now()-225&&(!v||i.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!v&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"",""))&&(k=Z.findFrom(u.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&n.someProp("handleKeyDown",_=>_(n,Cr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&dT(c,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",_=>_(n,Cr(8,"Backspace")))){Pn&&nt&&n.domObserver.suppressSelectionUpdates();return}nt&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Pn&&!v&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,g=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(_){return _(n,Cr(13,"Enter"))})},20));let b=p.start,x=p.endA,A=_=>{let I=_||n.state.tr.replace(b,x,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let $=$p(n,I.doc,u.sel);$&&!(nt&&n.composing&&$.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&($.head==b||$.head==I.mapping.map(x)-1)||kt&&$.empty&&$.head==b)&&I.setSelection($)}return s&&I.setMeta("composition",s),I.scrollIntoView()},O;if(v){if(m.pos==g.pos){kt&&ar<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ln(n),20));let _=A(n.state.tr.delete(b,x)),I=c.resolve(p.start).marksAcross(c.resolve(p.endA));I&&_.ensureMarks(I),n.dispatch(_)}else if(p.endA==p.endB&&(O=cT(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let _=A(n.state.tr);O.type=="add"?_.addMark(b,x,O.mark):_.removeMark(b,x,O.mark),n.dispatch(_)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let _=m.parent.textBetween(m.parentOffset,g.parentOffset),I=()=>A(n.state.tr.insertText(_,b,x));n.someProp("handleTextInput",$=>$(n,b,x,_,I))||n.dispatch(I())}}else n.dispatch(A())}function $p(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ph(n,e.resolve(t.anchor),e.resolve(t.head))}function cT(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<t.length;c++)s=t[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(C.from(u).eq(n))return{mark:a,type:o}}function dT(n,e,t,r,i){if(t-e<=i.pos-r.pos||Gu(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Gu(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Gu(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Gu(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function hT(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&n.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Bp(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<n.size&&Bp(n.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Bp(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Mb{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _x,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(qp),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Hp(this),Up(this),this.nodeViews=Vp(this),this.docView=wp(this.state.doc,zp(this),Ku(this),this.dom,this),this.domObserver=new nT(this,(r,i,s,o)=>uT(this,r,i,s,o)),this.domObserver.start(),Rx(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&yd(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qp),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(wb(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Vp(this);pT(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&yd(this),this.editable=Hp(this),Up(this);let l=Ku(this),u=zp(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(o=!0);let h=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&WS(this);if(o){this.domObserver.stop();let f=d&&(kt||nt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&fT(i.selection,e.selection);if(d){let p=nt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=jx(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=wp(e.doc,u,l,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gx(this))?Ln(this,f):(lb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&JS(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof G){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&pp(this,t.getBoundingClientRect(),e)}else pp(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Sb(e.slice,e.move,i<0?void 0:G.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(kt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&KS(this.dom),Ln(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ZS(this,e)}coordsAtPos(e,t=1){return eb(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return ix(this,t||this.state,e)}pasteHTML(e,t){return ao(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ao(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ih(this,e)}destroy(){this.docView&&(Px(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ku(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,DS())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Dx(this,e)}domSelectionRange(){let e=this.domSelection();return e?gt&&this.root.nodeType===11&&zS(this.dom.ownerDocument)==this.dom&&iT(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Mb.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function zp(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ze.node(0,n.state.doc.content.size,e)]}function Up(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ze.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Hp(n){return!n.someProp("editable",e=>e(n.state)===!1)}function fT(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Vp(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function pT(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function qp(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var cr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},yl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mT=typeof navigator<"u"&&/Mac/.test(navigator.platform),gT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Qe=0;Qe<10;Qe++)cr[48+Qe]=cr[96+Qe]=String(Qe);for(var Qe=1;Qe<=24;Qe++)cr[Qe+111]="F"+Qe;for(var Qe=65;Qe<=90;Qe++)cr[Qe]=String.fromCharCode(Qe+32),yl[Qe]=String.fromCharCode(Qe);for(var Yu in cr)yl.hasOwnProperty(Yu)||(yl[Yu]=cr[Yu]);function yT(n){var e=mT&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||gT&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?yl:cr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const bT=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function vT(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))bT?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function wT(n){let e=Object.create(null);for(let t in n)e[vT(t)]=n[t];return e}function Xu(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function kT(n){return new Ce({props:{handleKeyDown:zh(n)}})}function zh(n){let e=wT(n);return function(t,r){let i=yT(r),s,o=e[Xu(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Xu(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=cr[r.keyCode])&&s!=i){let a=e[Xu(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const Ab=65535,Ob=Math.pow(2,16);function ST(n,e){return n+e*Ob}function jp(n){return n&Ab}function xT(n){return(n-(n&Ab))/Ob}const Nb=1,_b=2,Da=4,Rb=8;let bd=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Rb)>0}get deletedBefore(){return(this.delInfo&(Nb|Da))>0}get deletedAfter(){return(this.delInfo&(_b|Da))>0}get deletedAcross(){return(this.delInfo&Da)>0}},Gr=class gi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&gi.empty)return gi.empty}recover(e){let t=0,r=jp(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+xT(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:c);if(r)return f;let p=e==(t<0?l:d)?null:ST(a/3,e-l),m=e==l?_b:e==d?Nb:Da;return(t<0?e!=l:e!=d)&&(m|=Rb),new bd(f,m,p)}i+=c-u}return r?e+i:new bd(e+i,0,null)}touches(e,t){let r=0,i=jp(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+r];e(a,a+u,l,l+c),s+=c-u}}invert(){return new gi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gi.empty:new gi(e<0?[0,-e,0]:[0,0,e])}};Gr.empty=new Gr([]);let TT=class vd{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new vd(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new vd;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new bd(e,i,null)}};const Qu=Object.create(null);let st=class{getMap(){return Gr.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Qu[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Qu)throw new RangeError("Duplicate use of step JSON ID "+e);return Qu[e]=t,t.prototype.jsonID=e,t}},pt=class xs{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new xs(e,null)}static fail(e){return new xs(null,e)}static fromReplace(e,t,r,i){try{return xs.ok(e.replace(t,r,i))}catch(s){if(s instanceof qr)return xs.fail(s.message);throw s}}};function Uh(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Uh(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return C.fromArray(r)}let Hh=class Ts extends st{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M(Uh(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return pt.fromReplace(e,this.from,this.to,s)}invert(){return new qi(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ts(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ts&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ts(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ts(t.from,t.to,e.markFromJSON(t.mark))}};st.jsonID("addMark",Hh);let qi=class Cs extends st{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(Uh(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return pt.fromReplace(e,this.from,this.to,r)}invert(){return new Hh(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Cs(t.pos,r.pos,this.mark)}merge(e){return e instanceof Cs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cs(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Cs(t.from,t.to,e.markFromJSON(t.mark))}};st.jsonID("removeMark",qi);let Vh=class Es extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return pt.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Es(this.pos,t.marks[i]);return new Es(this.pos,this.mark)}}return new bl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Es(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Es(t.pos,e.markFromJSON(t.mark))}};st.jsonID("addNodeMark",Vh);let bl=class wd extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return pt.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Vh(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new wd(t.pos,e.markFromJSON(t.mark))}};st.jsonID("removeNodeMark",bl);let $n=class Sr extends st{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&kd(e,this.from,this.to)?pt.fail("Structure replace would overwrite content"):pt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Gr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Sr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Sr(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Sr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Sr(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Sr(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Sr(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}};st.jsonID("replace",$n);let ii=class La extends st{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(kd(e,this.from,this.gapFrom)||kd(e,this.gapTo,this.to)))return pt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return pt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?pt.fromReplace(e,this.from,this.to,r):pt.fail("Content does not fit in gap")}getMap(){return new Gr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new La(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new La(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new La(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}};st.jsonID("replaceAround",ii);function kd(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function CT(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),f=Math.min(u+l.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new qi(h,f,d[m])));a&&a.to==h?a.to=f:s.push(a=new Hh(h,f,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function ET(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Vi){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,t);for(let c=0;c<l.length;c++){let d=l[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=u,h.step=s):i.push({style:d,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>n.step(new qi(o.from,o.to,o.style)))}function qh(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let u=s.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)o.push(new $n(a,c,M.empty));else{r=d;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new qi(a,c,u.marks[h]));if(i&&u.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(u.text);)p||(p=new M(C.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new $n(a+h.index,a+h.index+h[0].length,p))}}a=c}if(!r.validEnd){let l=r.fillBefore(C.empty,!0);n.replace(a,a,new M(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function MT(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function AT(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!MT(i,s,o))break}return null}function OT(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,u=a,c=C.empty,d=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,c=C.from(r.node(p).copy(c)),d++):l--;let h=C.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=C.from(i.node(p).copy(h)),f++):u++;n.step(new ii(l,u,o,a,new M(c.append(h),d,f),c.size-d,!0))}function NT(n,e,t=null,r=n){let i=_T(n,e),s=i&&RT(r,e);return s?i.map(Wp).concat({type:e,attrs:t}).concat(s.map(Wp)):null}function Wp(n){return{type:n,attrs:null}}function _T(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function RT(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:o}function PT(n,e,t){let r=C.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new ii(i,s,i,s,new M(r,0,0),t.length,!0))}function IT(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&DT(n.doc,n.mapping.slice(s).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?u=!1:!f&&p&&(u=!0)}u===!1&&Ib(n,o,a,s),qh(n,n.mapping.slice(s).map(a,1),r,void 0,u===null);let c=n.mapping.slice(s),d=c.map(a,1),h=c.map(a+o.nodeSize,1);return n.step(new ii(d,h,d+1,h-1,new M(C.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&Pb(n,o,a,s),!1}})}function Pb(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Ib(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
9
|
-
`))}})}function DT(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function LT(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ii(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(C.from(o),0,0),1,!0))}function Fa(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=t-2;u>s;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[c+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function FT(n,e,t=1,r){let i=n.doc.resolve(e),s=C.empty,o=C.empty;for(let a=i.depth,l=i.depth-t,u=t-1;a>l;a--,u--){s=C.from(i.node(a).copy(s));let c=r&&r[u];o=C.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}n.step(new $n(e,e,new M(s.append(o),t,t),!0))}function jh(n,e){let t=n.resolve(e),r=t.index();return Db(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function $T(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Db(n,e){return!!(n&&e&&!n.isLeaf&&$T(n,e))}function Lb(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&Db(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function BT(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=n.steps.length;if(r===!1){let c=n.doc.resolve(e+t);Ib(n,c.node(),c.before(),a)}o.inlineContent&&qh(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),u=l.map(e-t);if(n.step(new $n(u,l.map(e+t,-1),M.empty,!0)),r===!0){let c=n.doc.resolve(u);Pb(n,c.node(),c.before(),n.steps.length)}return n}function zT(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function UT(n,e,t=e,r=M.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Fb(i,s,r)?new $n(e,t,r):new HT(i,s,r).fit()}function Fb(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let HT=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new M(s,o,a);return e>-1?new ii(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new $n(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Zu(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(t==1&&(o?u.matchType(o.type)||(d=u.fillBefore(C.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Zu(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Zu(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new M(Ms(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new M(Ms(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push($b(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?f:-1)))}let p=u==a.childCount;p||(f=-1),this.placed=As(this.placed,t,C.from(c)),this.frontier[t].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?M.empty:new M(Ms(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new M(Ms(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ec(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ec(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=ec(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=As(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=As(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=As(this.placed,this.frontier.length,t))}};function Ms(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ms(n.firstChild.content,e-1,t)))}function As(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(As(n.lastChild.content,e-1,t)))}function Zu(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function $b(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,$b(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),n.copy(r)}function ec(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!VT(t,s.content,o)?a:null}function VT(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function qT(n){return n.spec.defining||n.spec.definingForContent}function jT(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Fb(i,s,r))return n.step(new $n(e,t,r));let o=zb(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),u=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(u.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=u[h],p=qT(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=u[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let v=i.node(g-1),k=i.index(g-1);if(v.canReplaceWith(k,k,p.type,p.marks))return n.replace(i.before(g),y?s.after(g):t,new M(Bb(r.content,0,r.openStart,f),f,r.openEnd))}}let d=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function Bb(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Bb(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(C.empty,!0))}return n}function WT(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=zT(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new M(C.from(r),0,0))}function JT(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=zb(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function zb(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}let Ub=class $a extends st{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return pt.fromReplace(e,this.pos,this.pos+1,new M(C.from(i),0,t.isLeaf?0:1))}getMap(){return Gr.empty}invert(e){return new $a(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new $a(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new $a(t.pos,t.attr,t.value)}};st.jsonID("attr",Ub);let Hb=class Sd extends st{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return pt.ok(r)}getMap(){return Gr.empty}invert(e){return new Sd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Sd(t.attr,t.value)}};st.jsonID("docAttr",Hb);let _i=class extends Error{};_i=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};_i.prototype=Object.create(Error.prototype);_i.prototype.constructor=_i;_i.prototype.name="TransformError";let KT=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new TT}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new _i(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=M.empty){let i=UT(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new M(C.from(r),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return jT(this,e,t,r),this}replaceRangeWith(e,t,r){return WT(this,e,t,r),this}deleteRange(e,t){return JT(this,e,t),this}lift(e,t){return OT(this,e,t),this}join(e,t=1){return BT(this,e,t),this}wrap(e,t){return PT(this,e,t),this}setBlockType(e,t=e,r,i=null){return IT(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return LT(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ub(e,t,r)),this}setDocAttribute(e,t){return this.step(new Hb(e,t)),this}addNodeMark(e,t){return this.step(new Vh(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof ge)t.isInSet(r.marks)&&this.step(new bl(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new bl(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return FT(this,e,t,r),this}addMark(e,t,r){return CT(this,e,t,r),this}removeMark(e,t,r){return ET(this,e,t,r),this}clearIncompatible(e,t,r){return qh(this,e,t,r),this}};const Vb=65535,qb=Math.pow(2,16);function GT(n,e){return n+e*qb}function Jp(n){return n&Vb}function YT(n){return(n-(n&Vb))/qb}const jb=1,Wb=2,Ba=4,Jb=8;let Kp=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Jb)>0}get deletedBefore(){return(this.delInfo&(jb|Ba))>0}get deletedAfter(){return(this.delInfo&(Wb|Ba))>0}get deletedAcross(){return(this.delInfo&Ba)>0}},Yr=class yi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&yi.empty)return yi.empty}recover(e){let t=0,r=Jp(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+YT(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:c);if(r)return f;let p=e==(t<0?l:d)?null:GT(a/3,e-l),m=e==l?Wb:e==d?jb:Ba;return(t<0?e!=l:e!=d)&&(m|=Jb),new Kp(f,m,p)}i+=c-u}return r?e+i:new Kp(e+i,0,null)}touches(e,t){let r=0,i=Jp(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+r];e(a,a+u,l,l+c),s+=c-u}}invert(){return new yi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yi.empty:new yi(e<0?[0,-e,0]:[0,0,e])}};Yr.empty=new Yr([]);const tc=Object.create(null);let ot=class{getMap(){return Yr.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=tc[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in tc)throw new RangeError("Duplicate use of step JSON ID "+e);return tc[e]=t,t.prototype.jsonID=e,t}},mt=class Os{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Os(e,null)}static fail(e){return new Os(null,e)}static fromReplace(e,t,r,i){try{return Os.ok(e.replace(t,r,i))}catch(s){if(s instanceof qr)return Os.fail(s.message);throw s}}};function Wh(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Wh(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return C.fromArray(r)}let Kb=class Ns extends ot{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M(Wh(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return mt.fromReplace(e,this.from,this.to,s)}invert(){return new Gb(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ns(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ns&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ns(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ns(t.from,t.to,e.markFromJSON(t.mark))}};ot.jsonID("addMark",Kb);let Gb=class _s extends ot{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(Wh(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return mt.fromReplace(e,this.from,this.to,r)}invert(){return new Kb(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _s(t.pos,r.pos,this.mark)}merge(e){return e instanceof _s&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _s(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _s(t.from,t.to,e.markFromJSON(t.mark))}};ot.jsonID("removeMark",Gb);let Yb=class Rs extends ot{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return mt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return mt.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Rs(this.pos,t.marks[i]);return new Rs(this.pos,this.mark)}}return new Xb(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Rs(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Rs(t.pos,e.markFromJSON(t.mark))}};ot.jsonID("addNodeMark",Yb);let Xb=class xd extends ot{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return mt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return mt.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Yb(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xd(t.pos,e.markFromJSON(t.mark))}};ot.jsonID("removeNodeMark",Xb);let fu=class xr extends ot{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Td(e,this.from,this.to)?mt.fail("Structure replace would overwrite content"):mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Yr([this.from,this.to-this.from,this.slice.size])}invert(e){return new xr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new xr(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof xr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new xr(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new xr(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new xr(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}};ot.jsonID("replace",fu);let vl=class za extends ot{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Td(e,this.from,this.gapFrom)||Td(e,this.gapTo,this.to)))return mt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return mt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?mt.fromReplace(e,this.from,this.to,r):mt.fail("Content does not fit in gap")}getMap(){return new Yr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new za(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new za(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new za(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}};ot.jsonID("replaceAround",vl);function Td(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function XT(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function pu(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!XT(i,s,o))break}return null}function QT(n,e,t=null,r=n){let i=ZT(n,e),s=i&&eC(r,e);return s?i.map(Gp).concat({type:e,attrs:t}).concat(s.map(Gp)):null}function Gp(n){return{type:n,attrs:null}}function ZT(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function eC(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:o}function Ua(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=t-2;u>s;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[c+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function mu(n,e){let t=n.resolve(e),r=t.index();return Qb(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function tC(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Qb(n,e){return!!(n&&e&&!n.isLeaf&&tC(n,e))}function Zb(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&Qb(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Jh(n,e,t=e,r=M.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return nC(i,s,r)?new fu(e,t,r):new rC(i,s,r).fit()}function nC(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let rC=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new M(s,o,a);return e>-1?new vl(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new fu(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=nc(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(t==1&&(o?u.matchType(o.type)||(d=u.fillBefore(C.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=nc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=nc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new M(Ps(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new M(Ps(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(ev(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?f:-1)))}let p=u==a.childCount;p||(f=-1),this.placed=Is(this.placed,t,C.from(c)),this.frontier[t].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?M.empty:new M(Ps(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new M(Ps(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!rc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=rc(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=rc(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Is(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Is(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=Is(this.placed,this.frontier.length,t))}};function Ps(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ps(n.firstChild.content,e-1,t)))}function Is(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Is(n.lastChild.content,e-1,t)))}function nc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ev(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ev(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),n.copy(r)}function rc(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!iC(t,s.content,o)?a:null}function iC(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}let sC=class Ha extends ot{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return mt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return mt.fromReplace(e,this.pos,this.pos+1,new M(C.from(i),0,t.isLeaf?0:1))}getMap(){return Yr.empty}invert(e){return new Ha(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ha(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ha(t.pos,t.attr,t.value)}};ot.jsonID("attr",sC);let oC=class Cd extends ot{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return mt.ok(r)}getMap(){return Yr.empty}invert(e){return new Cd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Cd(t.attr,t.value)}};ot.jsonID("docAttr",oC);let uo=class extends Error{};uo=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};uo.prototype=Object.create(Error.prototype);uo.prototype.constructor=uo;uo.prototype.name="TransformError";const Kh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function tv(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const nv=(n,e,t)=>{let r=tv(n,t);if(!r)return!1;let i=Gh(r);if(!i){let o=r.blockRange(),a=o&&pu(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(dv(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ri(s,"end")||G.isSelectable(s)))for(let o=r.depth;;o--){let a=Jh(n.doc,r.before(o),r.after(o),M.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Ri(s,"end")?Z.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):G.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},aC=(n,e,t)=>{let r=tv(n,t);if(!r)return!1;let i=Gh(r);return i?rv(n,i,e):!1},lC=(n,e,t)=>{let r=sv(n,t);if(!r)return!1;let i=Yh(r);return i?rv(n,i,e):!1};function rv(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=Jh(n.doc,s,l,M.empty);if(!u||u.from!=s||u instanceof fu&&u.slice.size>=l-s)return!1;if(t){let c=n.tr.step(u);c.setSelection(ee.create(c.doc,s)),t(c.scrollIntoView())}return!0}function Ri(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const iv=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Gh(r)}let o=s&&s.nodeBefore;return!o||!G.isSelectable(o)?!1:(e&&e(n.tr.setSelection(G.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Gh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function sv(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const ov=(n,e,t)=>{let r=sv(n,t);if(!r)return!1;let i=Yh(r);if(!i)return!1;let s=i.nodeAfter;if(dv(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ri(s,"start")||G.isSelectable(s))){let o=Jh(n.doc,r.before(),r.after(),M.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Ri(s,"start")?Z.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):G.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},av=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=Yh(r)}let o=s&&s.nodeAfter;return!o||!G.isSelectable(o)?!1:(e&&e(n.tr.setSelection(G.create(n.doc,s.pos)).scrollIntoView()),!0)};function Yh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const uC=(n,e)=>{let t=n.selection,r=t instanceof G,i;if(r){if(t.node.isTextblock||!mu(n.doc,t.from))return!1;i=t.from}else if(i=Zb(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(G.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},cC=(n,e)=>{let t=n.selection,r;if(t instanceof G){if(t.node.isTextblock||!mu(n.doc,t.to))return!1;r=t.to}else if(r=Zb(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},dC=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&pu(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},lv=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
10
|
-
`).scrollIntoView()),!0)};function Xh(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const hC=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Xh(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Z.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},uv=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Nt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Xh(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(ee.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},cv=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ua(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&pu(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function fC(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof G&&e.selection.node.isBlock)return!r.parentOffset||!Ua(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,u=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),u=r.start(f)==r.pos-(r.depth-f),a=Xh(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof ee||e.selection instanceof Nt)&&c.deleteSelection();let d=c.mapping.map(r.pos),h=Ua(c.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=Ua(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!l&&u&&r.node(o).type!=a){let f=c.mapping.map(r.before(o)),p=c.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&c.setNodeMarkup(c.mapping.map(r.before(o)),a)}return t&&t(c.scrollIntoView()),!0}}const pC=fC(),mC=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(G.create(n.doc,i))),!0)};function gC(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||mu(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function dv(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&gC(n,e,t))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,p=C.empty;for(let y=o.length-1;y>=0;y--)p=C.from(o[y].create(null,p));p=C.from(i.copy(p));let m=n.tr.step(new vl(e.pos-1,f,e.pos,f,new M(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&mu(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&l?null:Z.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&pu(d);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(d,h).scrollIntoView()),!0;if(u&&Ri(s,"start",!0)&&Ri(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let y=C.empty;for(let k=p.length-1;k>=0;k--)y=C.from(p[k].copy(y));let v=n.tr.step(new vl(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new M(y,p.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function hv(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(ee.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const yC=hv(-1),bC=hv(1);function vC(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&QT(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Yp(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let c=t.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,n,e)}r(s.scrollIntoView())}return!0}}function Qh(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}Qh(Kh,nv,iv);Qh(Kh,ov,av);Qh(lv,uv,cv,pC);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function wC(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return kC(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function kC(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new cl(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new cl(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=dS(s,t,r,e);return a?(n&&SC(n,e,a,i,t),!0):!1}function SC(n,e,t,r,i){let s=C.empty;for(let c=t.length-1;c>=0;c--)s=C.from(t[c].type.create(t[c].attrs,s));n.step(new Yt(e.start-(r?2:0),e.end,e.start,e.end,new M(s,0,0),t.length,!0));let o=0;for(let c=0;c<t.length;c++)t[c].type==i&&(o=c+1);let a=t.length-o,l=e.start+t.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&bS(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return n}function xC(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?TC(e,t,n,s):CC(e,t,s):!0:!1}}function TC(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Yt(s-1,o,s,o,new M(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new cl(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=uS(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return wS(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function CC(n,e,t){let r=n.tr,i=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?C.empty:C.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new Yt(d-(a?1:0),h+(l?1:0),d+1,h-1,new M((a?C.empty:C.from(i.copy(C.empty))).append(l?C.empty:C.from(i.copy(C.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function EC(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let u=l.lastChild&&l.lastChild.type==a.type,c=C.from(u?n.create():null),d=new M(C.from(n.create(null,C.from(a.type.create(null,c)))),u?3:1,0),h=s.start,f=s.end;t(e.tr.step(new Yt(h-(u?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}var MC=Object.defineProperty,fv=(n,e)=>{for(var t in e)MC(n,t,{get:e[t],enumerable:!0})};function gu(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var yu=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...u)=>{const c=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],a=!!n,l=n||i.tr,u=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(t).map(([d,h])=>[d,(...p)=>{const m=this.buildProps(l,e),g=h(...p)(m);return o.push(g),c}])),run:u};return c}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>l(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:gu({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...u)=>l(...u)(o)]))}};return o}},AC=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function pv(n,e){const t=new KT(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}var mv=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&mv(r)}return n};function la(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return mv(t)}function wl(n,e,t){if(n instanceof or||n instanceof C)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return C.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),wl("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Oy({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Ti.fromSchema(l).parseSlice(la(n),t.parseOptions):Ti.fromSchema(l).parse(la(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Ti.fromSchema(e);return t.slice?s.parseSlice(la(n),t.parseOptions).content:s.parse(la(n),t.parseOptions)}return wl("",e,t)}function Ed(n,e,t={},r={}){return wl(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}function OC(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function NC(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function gv(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function bu(n){return e=>gv(e.$from,n)}function K(n,e,t){return n.config[e]===void 0&&n.parent?K(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?K(n.parent,e,t):null}):n.config[e]}function Zh(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=K(e,"addExtensions",t);return r?[e,...Zh(r())]:e}).flat(10)}function ef(n,e){const t=ri.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function yv(n){return typeof n=="function"}function fe(n,e=void 0,...t){return yv(n)?e?n.bind(e)(...t):n(...t):n}function _C(n={}){return Object.keys(n).length===0&&n.constructor===Object}function co(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function bv(n){const e=[],{nodeExtensions:t,markExtensions:r}=co(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=K(o,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=K(o,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:c,attribute:h})})}),e}function ve(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],u=a.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());u.set(d,h)}),a.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());u.set(d,h)}),r[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function kl(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ve(t,r),{})}function RC(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Xp(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):RC(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Qp(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&_C(t)?!1:t!=null))}function PC(n,e){var t;const r=bv(n),{nodeExtensions:i,markExtensions:s}=co(n),o=(t=i.find(u=>K(u,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((y,v)=>{const k=K(v,"extendNodeSchema",d);return{...y,...k?k(u):{}}},{}),f=Qp({...h,content:fe(K(u,"content",d)),marks:fe(K(u,"marks",d)),group:fe(K(u,"group",d)),inline:fe(K(u,"inline",d)),atom:fe(K(u,"atom",d)),selectable:fe(K(u,"selectable",d)),draggable:fe(K(u,"draggable",d)),code:fe(K(u,"code",d)),whitespace:fe(K(u,"whitespace",d)),linebreakReplacement:fe(K(u,"linebreakReplacement",d)),defining:fe(K(u,"defining",d)),isolating:fe(K(u,"isolating",d)),attrs:Object.fromEntries(c.map(y=>{var v,k;return[y.name,{default:(v=y?.attribute)==null?void 0:v.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),p=fe(K(u,"parseHTML",d));p&&(f.parseDOM=p.map(y=>Xp(y,c)));const m=K(u,"renderHTML",d);m&&(f.toDOM=y=>m({node:y,HTMLAttributes:kl(y,c)}));const g=K(u,"renderText",d);return g&&(f.toText=g),[u.name,f]})),l=Object.fromEntries(s.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=n.reduce((g,y)=>{const v=K(y,"extendMarkSchema",d);return{...g,...v?v(u):{}}},{}),f=Qp({...h,inclusive:fe(K(u,"inclusive",d)),excludes:fe(K(u,"excludes",d)),group:fe(K(u,"group",d)),spanning:fe(K(u,"spanning",d)),code:fe(K(u,"code",d)),attrs:Object.fromEntries(c.map(g=>{var y,v;return[g.name,{default:(y=g?.attribute)==null?void 0:y.default,validate:(v=g?.attribute)==null?void 0:v.validate}]}))}),p=fe(K(u,"parseHTML",d));p&&(f.parseDOM=p.map(g=>Xp(g,c)));const m=K(u,"renderHTML",d);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:kl(g,c)})),[u.name,f]}));return new Oy({topNode:o,nodes:a,marks:l})}function IC(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function tf(n){return n.sort((t,r)=>{const i=K(t,"priority")||100,s=K(r,"priority")||100;return i>s?-1:i<s?1:0})}function vv(n){const e=tf(Zh(n)),t=IC(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function wv(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
11
|
-
|
|
12
|
-
`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(l,u,c,d)=>{var h;l.isBlock&&u>r&&(a+=s);const f=o?.[l.type.name];if(f)return c&&(a+=f({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,u)-u,i-u))}),a}function DC(n,e){const t={from:0,to:n.content.size};return wv(n,t,e)}function kv(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Un(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}function Sv(n,e){const t=Un(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function $e(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function LC(n,e){const t=$e(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function vu(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function xv(n,e){const t=vu(typeof e=="string"?e:e.name,n.schema);return t==="node"?LC(n,e):t==="mark"?Sv(n,e):{}}function FC(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function $C(n){const e=FC(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Tv(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),d=e.invert().map(u,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:u,to:c}})})}),$C(r)}function nf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Sl(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:nf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Cv(n,e,t={}){return n.find(r=>r.type===e&&Sl(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Zp(n,e,t={}){return!!Cv(n,e,t)}function rf(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!Cv([...i.node.marks],e,t)))return;let o=i.index,a=n.start()+i.offset,l=o+1,u=a+i.node.nodeSize;for(;o>0&&Zp([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&Zp([...n.parent.child(l).marks],e,t);)u+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:u}}function sf(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=rf(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var BC=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function ic(n,e){return e.nodes[n]||e.marks[n]||null}function Va(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var zC=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),t};function Md(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?Un(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Sl(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(f,g),v=Math.min(p,g+m.nodeSize),k=v-y;o+=k,a.push(...m.marks.map(b=>({mark:b,from:y,to:v})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Sl(d.mark.attrs,t,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),u=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+u:l)>=o}function dr(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?$e(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const l=i-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Sl(d.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((d,h)=>d+h.to-h.from,0)>=l}function UC(n,e,t={}){if(!e)return dr(n,null,t)||Md(n,null,t);const r=vu(e,n.schema);return r==="node"?dr(n,e,t):r==="mark"?Md(n,e,t):!1}var HC=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=bu(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},VC=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function em(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function tm(n,e){const{nodeExtensions:t}=co(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=fe(K(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function wu(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(wu(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function of(n){return n instanceof ee}function In(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function qC(n,e,t){const i=n.state.doc.content.size,s=In(e,0,i),o=In(t,0,i),a=n.coordsAtPos(s),l=n.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,p=c-u,y={top:u,bottom:c,left:d,right:h,width:f,height:p,x:d,y:u};return{...y,toJSON:()=>y}}function Ev(n,e=null){if(!e)return null;const t=Z.atStart(n),r=Z.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?ee.create(n,In(0,i,s),In(n.content.size,i,s)):ee.create(n,In(e,i,s),In(e,i,s))}function jC(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof $n||i instanceof ii))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,l,u,c)=>{o===0&&(o=c)}),n.setSelection(Z.near(n.doc.resolve(o),t))}var ku=class{constructor(n){this.find=n.find,this.handler=n.handler}},WC=(n,e)=>{if(nf(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function ua(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=zC(u)+s;return o.forEach(h=>{if(c)return;const f=WC(d,h.find);if(!f)return;const p=l.state.tr,m=gu({state:l.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:y,chain:v,can:k}=new yu({editor:t,state:m});h.handler({state:m,range:g,match:f,commands:y,chain:v,can:k})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),c=!0)}),c}function JC(n){const{editor:e,rules:t}=n,r=new Ce({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=ef(C.from(c),o.schema);const{from:d}=l,h=d+c.length;ua({editor:e,from:d,to:h,text:c,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return ua({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&ua({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?ua({editor:e,from:o.pos,to:o.pos,text:`
|
|
13
|
-
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function KC(n){return Object.prototype.toString.call(n).slice(8,-1)}function ca(n){return KC(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Mv(n,e){const t={...n};return ca(n)&&ca(e)&&Object.keys(e).forEach(r=>{ca(e[r])&&ca(n[r])?t[r]=Mv(n[r],e[r]):t[r]=e[r]}),t}var af=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...fe(K(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...fe(K(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Mv(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Vt=class Av extends af{constructor(){super(...arguments),this.type="mark"}static create(e={}){return new Av(e)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>u?.type.name===t.name))return!1;const l=o.find(u=>u?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){return super.extend(e)}};function GC(n){return typeof n=="number"}var YC=class{constructor(n){this.find=n.find,this.handler=n.handler}},XC=(n,e,t)=>{if(nf(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function QC(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:u,can:c}=new yu({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(f,p)=>{if(!f.isTextblock||f.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+f.content.size),y=f.textBetween(m-p,g-p,void 0,"");XC(y,s.find,o).forEach(k=>{if(k.index===void 0)return;const b=m+k.index+1,x=b+k[0].length,A={from:t.tr.mapping.map(b),to:t.tr.mapping.map(x)},O=s.handler({state:t,range:A,match:k,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});d.push(O)})}),d.every(f=>f!==null)}var da=null,ZC=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function eE(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:c,from:d,to:h,rule:f,pasteEvt:p})=>{const m=c.tr,g=gu({state:c,transaction:m});if(!(!QC({editor:e,state:g,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(c=>new Ce({view(d){const h=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(da=e)},f=()=>{da&&(da=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=r===d.dom.parentElement,a=h,!s){const f=da;f&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),v=!!y;if(!m&&!g&&!v)return;if(v){let{text:x}=y;typeof x=="string"?x=x:x=ef(C.from(x),f.schema);const{from:A}=y,O=A+x.length,_=ZC(x);return l({rule:c,state:f,from:A,to:{b:O},pasteEvt:_})}const k=h.doc.content.findDiffStart(f.doc.content),b=h.doc.content.findDiffEnd(f.doc.content);if(!(!GC(k)||!b||k===b.b))return l({rule:c,state:f,from:k,to:b,pasteEvt:o})}}))}var Su=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.extensions=vv(n),this.schema=PC(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ic(e.name,this.schema)},r=K(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this,e=tf([...this.extensions].reverse()),t=[],r=[],i=e.map(s=>{const o={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:n,type:ic(s.name,this.schema)},a=[],l=K(s,"addKeyboardShortcuts",o);let u={};if(s.type==="mark"&&K(s,"exitable",o)&&(u.ArrowRight=()=>Vt.handleExit({editor:n,mark:s})),l){const p=Object.fromEntries(Object.entries(l()).map(([m,g])=>[m,()=>g({editor:n})]));u={...u,...p}}const c=kT(u);a.push(c);const d=K(s,"addInputRules",o);em(s,n.options.enableInputRules)&&d&&t.push(...d());const h=K(s,"addPasteRules",o);em(s,n.options.enablePasteRules)&&h&&r.push(...h());const f=K(s,"addProseMirrorPlugins",o);if(f){const p=f();a.push(...p)}return a}).flat();return[JC({editor:n,rules:t}),...eE({editor:n,rules:r}),...i]}get attributes(){return bv(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=co(this.extensions);return Object.fromEntries(e.filter(t=>!!K(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:$e(t.name,this.schema)},s=K(t,"addNodeView",i);if(!s)return[];const o=(a,l,u,c,d)=>{const h=kl(a,r);return s()({node:a,view:l,getPos:u,decorations:c,innerDecorations:d,editor:n,extension:t,HTMLAttributes:h})};return[t.name,o]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=co(this.extensions);return Object.fromEntries(e.filter(t=>!!K(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Un(t.name,this.schema)},s=K(t,"addMarkView",i);if(!s)return[];const o=(a,l,u)=>{const c=kl(a,r);return s()({mark:a,view:l,inline:u,editor:n,extension:t,HTMLAttributes:c})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ic(e.name,this.schema)};e.type==="mark"&&((t=fe(K(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=K(e,"onBeforeCreate",r),s=K(e,"onCreate",r),o=K(e,"onUpdate",r),a=K(e,"onSelectionUpdate",r),l=K(e,"onTransaction",r),u=K(e,"onFocus",r),c=K(e,"onBlur",r),d=K(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};Su.resolve=vv;Su.sort=tf;Su.flatten=Zh;var tE={};fv(tE,{ClipboardTextSerializer:()=>Nv,Commands:()=>Iv,Delete:()=>Dv,Drop:()=>Lv,Editable:()=>Fv,FocusEvents:()=>Bv,Keymap:()=>zv,Paste:()=>Uv,Tabindex:()=>Hv,focusEventsPluginKey:()=>$v});var Pe=class Ov extends af{constructor(){super(...arguments),this.type="extension"}static create(e={}){return new Ov(e)}configure(e){return super.configure(e)}extend(e){return super.extend(e)}},Nv=Pe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ce({key:new Ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),l=kv(t);return wv(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),_v={};fv(_v,{blur:()=>nE,clearContent:()=>rE,clearNodes:()=>iE,command:()=>sE,createParagraphNear:()=>oE,cut:()=>aE,deleteCurrentNode:()=>lE,deleteNode:()=>uE,deleteRange:()=>cE,deleteSelection:()=>dE,enter:()=>hE,exitCode:()=>fE,extendMarkRange:()=>pE,first:()=>mE,focus:()=>gE,forEach:()=>yE,insertContent:()=>bE,insertContentAt:()=>wE,joinBackward:()=>xE,joinDown:()=>SE,joinForward:()=>TE,joinItemBackward:()=>CE,joinItemForward:()=>EE,joinTextblockBackward:()=>ME,joinTextblockForward:()=>AE,joinUp:()=>kE,keyboardShortcut:()=>NE,lift:()=>_E,liftEmptyBlock:()=>RE,liftListItem:()=>PE,newlineInCode:()=>IE,resetAttributes:()=>DE,scrollIntoView:()=>LE,selectAll:()=>FE,selectNodeBackward:()=>$E,selectNodeForward:()=>BE,selectParentNode:()=>zE,selectTextblockEnd:()=>UE,selectTextblockStart:()=>HE,setContent:()=>VE,setMark:()=>jE,setMeta:()=>WE,setNode:()=>JE,setNodeSelection:()=>KE,setTextSelection:()=>GE,sinkListItem:()=>YE,splitBlock:()=>XE,splitListItem:()=>QE,toggleList:()=>ZE,toggleMark:()=>eM,toggleNode:()=>tM,toggleWrap:()=>nM,undoInputRule:()=>rM,unsetAllMarks:()=>iM,unsetMark:()=>sM,updateAttributes:()=>oM,wrapIn:()=>aM,wrapInList:()=>lM});var nE=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),rE=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),iE=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),h=u.resolve(c.map(l+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=AT(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},sE=n=>e=>n(e),oE=()=>({state:n,dispatch:e})=>uv(n,e),aE=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ee(r.doc.resolve(o-1))),!0},lE=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1},uE=n=>({tr:e,state:t,dispatch:r})=>{const i=$e(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),u=s.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},cE=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},dE=()=>({state:n,dispatch:e})=>Kh(n,e),hE=()=>({commands:n})=>n.keyboardShortcut("Enter"),fE=()=>({state:n,dispatch:e})=>hC(n,e),pE=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=Un(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:u,to:c}=a;if(i){const d=rf(l,s,e);if(d&&d.from<=u&&d.to>=c){const h=ee.create(o,d.from,d.to);t.setSelection(h)}}return!0},mE=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Rv(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function xu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var gE=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(xu()||Rv())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!of(t.state.selection))return o(),!0;const a=Ev(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},yE=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),bE=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),vE=n=>!("type"in n),wE=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const{selection:l}=s.state;try{a=wl(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(m){return s.emit("contentError",{editor:s,error:m,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:u,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},d=!0,h=!0;if((vE(a)?a:[a]).forEach(m=>{m.check(),d=d?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===c&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,c+=1)}let p;if(d){if(Array.isArray(e))p=e.map(m=>m.text||"").join("");else if(e instanceof C){let m="";e.forEach(g=>{g.text&&(m+=g.text)}),p=m}else typeof e=="object"&&e&&e.text?p=e.text:p=e;r.insertText(p,u,c)}else{p=a;const m=l.$from.parentOffset===0,g=l.$from.node().isText||l.$from.node().isTextblock;m&&g&&(u=Math.max(0,u-1)),r.replaceWith(u,c,p)}t.updateSelection&&jC(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:p}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:p})}return!0},kE=()=>({state:n,dispatch:e})=>uC(n,e),SE=()=>({state:n,dispatch:e})=>cC(n,e),xE=()=>({state:n,dispatch:e})=>nv(n,e),TE=()=>({state:n,dispatch:e})=>ov(n,e),CE=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Lb(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},EE=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Lb(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ME=()=>({state:n,dispatch:e})=>aC(n,e),AE=()=>({state:n,dispatch:e})=>lC(n,e);function Pv(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function OE(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))xu()||Pv()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var NE=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=OE(n).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0},_E=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return dr(t,i,e)?dC(t,r):!1},RE=()=>({state:n,dispatch:e})=>cv(n,e),PE=n=>({state:e,dispatch:t})=>{const r=$e(n,e.schema);return xC(r)(e,t)},IE=()=>({state:n,dispatch:e})=>lv(n,e);function nm(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var DE=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=vu(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=$e(n,r.schema)),a==="mark"&&(o=Un(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{s&&s===u.type&&t.setNodeMarkup(c,void 0,nm(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(d=>{o===d.type&&t.addMark(c,c+u.nodeSize,o.create(nm(d.attrs,e)))})})}),!0):!1},LE=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),FE=()=>({tr:n,dispatch:e})=>{if(e){const t=new Nt(n.doc);n.setSelection(t)}return!0},$E=()=>({state:n,dispatch:e})=>iv(n,e),BE=()=>({state:n,dispatch:e})=>av(n,e),zE=()=>({state:n,dispatch:e})=>mC(n,e),UE=()=>({state:n,dispatch:e})=>bC(n,e),HE=()=>({state:n,dispatch:e})=>yC(n,e),VE=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const u=Ed(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function qE(n,e,t){var r;const{selection:i}=e;let s=null;if(of(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(c,d,h)=>{if(u)return!1;if(c.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(t));u=f&&p}return!u}),u})}var jE=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=Un(n,r.schema);if(i)if(o){const u=Sv(r,l);t.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(h,f)=>{const p=Math.max(f,c),m=Math.min(f+h.nodeSize,d);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&t.addMark(p,m,l.create({...y.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return qE(r,t,l)},WE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),JE=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=$e(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Yp(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Yp(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},KE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=In(n,0,r.content.size),s=G.create(r,i);e.setSelection(s)}return!0},GE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=ee.atStart(r).from,a=ee.atEnd(r).to,l=In(i,o,a),u=In(s,o,a),c=ee.create(r,l,u);e.setSelection(c)}return!0},YE=n=>({state:e,dispatch:t})=>{const r=$e(n,e.schema);return EC(r)(e,t)};function rm(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var XE=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=Va(u,a.node().type.name,a.node().attrs);if(s instanceof G&&s.node.isBlock)return!a.parentOffset||!Fa(o,a.pos)?!1:(r&&(n&&rm(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:OC(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:c}]:void 0,p=Fa(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&Fa(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:c}]:void 0),r){if(p&&(s instanceof ee&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&rm(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},QE=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const a=$e(n,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=C.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let _=l.depth-v;_>=l.depth-3;_-=1)y=C.from(l.node(_).copy(y));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,b={...Va(h,l.node().type.name,l.node().attrs),...e},x=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(b))||void 0;y=y.append(C.from(a.createAndFill(null,x)||void 0));const A=l.before(l.depth-(v-1));t.replace(A,l.after(-k),new M(y,4-v,0));let O=-1;t.doc.nodesBetween(A,t.doc.content.size,(_,I)=>{if(O>-1)return!1;_.isTextblock&&_.content.size===0&&(O=I+1)}),O>-1&&t.setSelection(ee.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const f=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Va(h,d.type.name,d.attrs),...e},m={...Va(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,u.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!Fa(t.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:v}=r,{splittableMarks:k}=s.extensionManager,b=v||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!b||!i)return!0;const x=b.filter(A=>k.includes(A.type.name));t.ensureMarks(x)}return!0},sc=(n,e)=>{const t=bu(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&jh(n.doc,t.pos)&&n.join(t.pos),!0},oc=(n,e)=>{const t=bu(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&jh(n.doc,r)&&n.join(r),!0},ZE=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=$e(n,o.schema),p=$e(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:v}=m,k=y.blockRange(v),b=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const x=bu(A=>tm(A.type.name,d))(m);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===f)return u.liftListItem(p);if(tm(x.node.type.name,d)&&f.validContent(x.node.content)&&a)return l().command(()=>(s.setNodeMarkup(x.pos,f),!0)).command(()=>sc(s,f)).command(()=>oc(s,f)).run()}return!t||!b||!a?l().command(()=>c().wrapInList(f,r)?!0:u.clearNodes()).wrapInList(f,r).command(()=>sc(s,f)).command(()=>oc(s,f)).run():l().command(()=>{const A=c().wrapInList(f,r),O=b.filter(_=>h.includes(_.type.name));return s.ensureMarks(O),A?!0:u.clearNodes()}).wrapInList(f,r).command(()=>sc(s,f)).command(()=>oc(s,f)).run()},eM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Un(n,r.schema);return Md(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},tM=(n,e,t={})=>({state:r,commands:i})=>{const s=$e(n,r.schema),o=$e(e,r.schema),a=dr(r,s,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},nM=(n,e={})=>({state:t,commands:r})=>{const i=$e(n,t.schema);return dr(t,i,e)?r.lift(i):r.wrapIn(i,e)},rM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},iM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},sM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=Un(n,r.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:h,to:f}=a;const p=(s=u.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=rf(u,l,p);m&&(h=m.from,f=m.to),t.removeMark(h,f,l)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},oM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=vu(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=$e(n,r.schema)),a==="mark"&&(o=Un(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;let d,h,f,p;t.selection.empty?r.doc.nodesBetween(u,c,(m,g)=>{s&&s===m.type&&(f=Math.max(g,u),p=Math.min(g+m.nodeSize,c),d=g,h=m)}):r.doc.nodesBetween(u,c,(m,g)=>{g<u&&s&&s===m.type&&(f=Math.max(g,u),p=Math.min(g+m.nodeSize,c),d=g,h=m),g>=u&&g<=c&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){const v=Math.max(g,u),k=Math.min(g+m.nodeSize,c);t.addMark(v,k,o.create({...y.attrs,...e}))}}))}),h&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&t.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},aM=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return vC(i,e)(t,r)},lM=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return wC(i,e)(t,r)},Iv=Pe.create({name:"commands",addCommands(){return{..._v}}}),Dv=Pe.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,a,l,u;if((u=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?u:n.getMeta("y-sync$"))return;const c=pv(n.before,[n,...e]);Tv(c).forEach(f=>{c.mapping.mapResult(f.oldRange.from).deletedAfter&&c.mapping.mapResult(f.oldRange.to).deletedBefore&&c.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,y=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:c.mapping.map(m),newTo:c.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:c})})});const h=c.mapping;c.steps.forEach((f,p)=>{var m,g;if(f instanceof qi){const y=h.slice(p).map(f.from,-1),v=h.slice(p).map(f.to),k=h.invert().map(y,-1),b=h.invert().map(v),x=(m=c.doc.nodeAt(y-1))==null?void 0:m.marks.some(O=>O.eq(f.mark)),A=(g=c.doc.nodeAt(v))==null?void 0:g.marks.some(O=>O.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:k,to:b},newRange:{from:y,to:v},partial:!!(A||x),editor:this.editor,transaction:n,combinedTransform:c})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Lv=Pe.create({name:"drop",addProseMirrorPlugins(){return[new Ce({key:new Ae("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Fv=Pe.create({name:"editable",addProseMirrorPlugins(){return[new Ce({key:new Ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$v=new Ae("focusEvents"),Bv=Pe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ce({key:$v,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),zv=Pe.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:Z.atStart(u).from===h;return!c||!f.type.isTextblock||f.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return xu()||Pv()?s:i},addProseMirrorPlugins(){return[new Ce({key:new Ae("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=Z.atStart(e.doc).from,u=Z.atEnd(e.doc).to;if(s||!(o===l&&a===u)||!wu(t.doc))return;const h=t.tr,f=gu({state:t,transaction:h}),{commands:p}=new yu({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),Uv=Pe.create({name:"paste",addProseMirrorPlugins(){return[new Ce({key:new Ae("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Hv=Pe.create({name:"tabindex",addProseMirrorPlugins(){return[new Ce({key:new Ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),uM=class bi{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new bi(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new bi(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new bi(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1),a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new bi(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new bi(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},cM=`.ProseMirror {
|
|
14
|
-
position: relative;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ProseMirror {
|
|
18
|
-
word-wrap: break-word;
|
|
19
|
-
white-space: pre-wrap;
|
|
20
|
-
white-space: break-spaces;
|
|
21
|
-
-webkit-font-variant-ligatures: none;
|
|
22
|
-
font-variant-ligatures: none;
|
|
23
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.ProseMirror [contenteditable="false"] {
|
|
27
|
-
white-space: normal;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
-
white-space: pre-wrap;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ProseMirror pre {
|
|
35
|
-
white-space: pre-wrap;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
img.ProseMirror-separator {
|
|
39
|
-
display: inline !important;
|
|
40
|
-
border: none !important;
|
|
41
|
-
margin: 0 !important;
|
|
42
|
-
width: 0 !important;
|
|
43
|
-
height: 0 !important;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ProseMirror-gapcursor {
|
|
47
|
-
display: none;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
position: absolute;
|
|
50
|
-
margin: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.ProseMirror-gapcursor:after {
|
|
54
|
-
content: "";
|
|
55
|
-
display: block;
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: -2px;
|
|
58
|
-
width: 20px;
|
|
59
|
-
border-top: 1px solid black;
|
|
60
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@keyframes ProseMirror-cursor-blink {
|
|
64
|
-
to {
|
|
65
|
-
visibility: hidden;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ProseMirror-hideselection *::selection {
|
|
70
|
-
background: transparent;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
-
background: transparent;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.ProseMirror-hideselection * {
|
|
78
|
-
caret-color: transparent;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
-
display: block;
|
|
83
|
-
}`;function dM(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var hM=class extends AC{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Ev(t,this.options.autofocus);this.editorState=Si.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){var e;if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}this.editorView=null,this.isInitialized=!1,(e=this.css)==null||e.remove(),this.css=null}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=dM(cM,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.editorState=this.state.apply(e)},composing:!1,dragging:null,editable:!0},{get:(e,t)=>{if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=yv(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=t.filter(a=>!a.key.startsWith(o))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[Fv,Nv.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Iv,Bv,zv,Hv,Lv,Uv,Dv].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Su(i,this)}createCommandManager(){this.commandManager=new yu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ed(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Ed(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Mb(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass(),this.injectCSS();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),s=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=a?.getMeta("focus"),u=a?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:a}),u&&this.emit("blur",{editor:this,event:u.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(c=>c.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return xv(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return UC(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ef(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
84
|
-
|
|
85
|
-
`,textSerializers:r={}}=e||{};return DC(this.state.doc,{blockSeparator:t,textSerializers:{...kv(this.schema),...r}})}get isEmpty(){return wu(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e;return!((e=this.view)!=null&&e.docView)}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new uM(t,this)}get $doc(){return this.$pos(0)}};function Pi(n){return new ku({find:n.find,handler:({state:e,range:t,match:r})=>{const i=fe(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),u=t.from+a.indexOf(o),c=u+o.length;if(sf(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>u).length)return null;c<t.to&&s.delete(c,t.to),u>t.from&&s.delete(t.from+l,u);const h=t.from+l+o.length;s.addMark(t.from+l,h,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function fM(n){return new ku({find:n.find,handler:({state:e,range:t,match:r})=>{const i=fe(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,a,l)}else if(r[0]){const u=n.type.isInline?o:o-1;s.insert(u,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function pM(n){return new ku({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=fe(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function ho(n){return new ku({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=fe(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),u=l&&NT(l,n.type,s);if(!u)return null;if(o.wrap(l,u),n.keepMarks&&n.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(t.from-1).nodeBefore;c&&c.type===n.type&&jh(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&o.join(t.from-1)}})}function mM(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Ze=class Vv extends af{constructor(){super(...arguments),this.type="node"}static create(e={}){return new Vv(e)}configure(e){return super.configure(e)}extend(e){return super.extend(e)}},gM=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,r,i,s,o,a;const{view:l}=this.editor,u=n.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(u)||!c)return;let d=0,h=0;if(this.dom!==c){const g=this.dom.getBoundingClientRect(),y=c.getBoundingClientRect(),v=(i=n.offsetX)!=null?i:(r=n.nativeEvent)==null?void 0:r.offsetX,k=(o=n.offsetY)!=null?o:(s=n.nativeEvent)==null?void 0:s.offsetY;d=y.x-g.x+v,h=y.y-g.y+k}(a=n.dataTransfer)==null||a.setDragImage(this.dom,d,h);const f=this.getPos();if(typeof f!="number")return;const p=G.create(l.state.doc,f),m=l.state.tr.setSelection(p);l.dispatch(m)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=n.type.startsWith("drag"),s=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=G.isSelectable(this.node),d=n.type==="copy",h=n.type==="paste",f=n.type==="cut",p=n.type==="mousedown";if(!u&&c&&i&&n.target===this.dom&&n.preventDefault(),u&&i&&!l&&n.target===this.dom)return n.preventDefault(),!1;if(u&&a&&!l&&p){const m=t.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||h||f||p&&c)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(xu()||Rv())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function Xr(n){return new YC({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=fe(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let u=t.to;if(a){const c=l.search(/\S/),d=t.from+l.indexOf(a),h=d+a.length;if(sf(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;h<t.to&&o.delete(h,t.to),d>t.from&&o.delete(t.from+c,d),u=t.from+c+a.length,o.addMark(t.from+c,u,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}const yM=Vt.create({name:"anonymize",spanning:!1,addAttributes(){return{title:{default:null}}},addOptions(){return{HTMLAttributes:{title:null}}},parseHTML(){return[{tag:"span.anonymize-me"}]},renderHTML:({HTMLAttributes:n,options:e})=>["span",ve(n,{class:"anonymize-me"}),0],addCommands(){return{toggleAnonymize:()=>({commands:n})=>n.toggleMark(this.name)}}});var St="top",Ut="bottom",Ht="right",xt="left",lf="auto",Bo=[St,Ut,Ht,xt],Ii="start",fo="end",bM="clippingParents",qv="viewport",Zi="popper",vM="reference",im=Bo.reduce(function(n,e){return n.concat([e+"-"+Ii,e+"-"+fo])},[]),jv=[].concat(Bo,[lf]).reduce(function(n,e){return n.concat([e,e+"-"+Ii,e+"-"+fo])},[]),wM="beforeRead",kM="read",SM="afterRead",xM="beforeMain",TM="main",CM="afterMain",EM="beforeWrite",MM="write",AM="afterWrite",OM=[wM,kM,SM,xM,TM,CM,EM,MM,AM];function hn(n){return n?(n.nodeName||"").toLowerCase():null}function _t(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Qr(n){var e=_t(n).Element;return n instanceof e||n instanceof Element}function zt(n){var e=_t(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function uf(n){if(typeof ShadowRoot>"u")return!1;var e=_t(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function NM(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!zt(s)||!hn(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function _M(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,u){return l[u]="",l},{});!zt(i)||!hn(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Wv={name:"applyStyles",enabled:!0,phase:"write",fn:NM,effect:_M,requires:["computeStyles"]};function ln(n){return n.split("-")[0]}var zr=Math.max,xl=Math.min,Di=Math.round;function Ad(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Jv(){return!/^((?!chrome|android).)*safari/i.test(Ad())}function Li(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,s=1;e&&zt(n)&&(i=n.offsetWidth>0&&Di(r.width)/n.offsetWidth||1,s=n.offsetHeight>0&&Di(r.height)/n.offsetHeight||1);var o=Qr(n)?_t(n):window,a=o.visualViewport,l=!Jv()&&t,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/i,h=r.height/s;return{width:d,height:h,top:c,right:u+d,bottom:c+h,left:u,x:u,y:c}}function cf(n){var e=Li(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function Kv(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&uf(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Bn(n){return _t(n).getComputedStyle(n)}function RM(n){return["table","td","th"].indexOf(hn(n))>=0}function fr(n){return((Qr(n)?n.ownerDocument:n.document)||window.document).documentElement}function Tu(n){return hn(n)==="html"?n:n.assignedSlot||n.parentNode||(uf(n)?n.host:null)||fr(n)}function sm(n){return!zt(n)||Bn(n).position==="fixed"?null:n.offsetParent}function PM(n){var e=/firefox/i.test(Ad()),t=/Trident/i.test(Ad());if(t&&zt(n)){var r=Bn(n);if(r.position==="fixed")return null}var i=Tu(n);for(uf(i)&&(i=i.host);zt(i)&&["html","body"].indexOf(hn(i))<0;){var s=Bn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function zo(n){for(var e=_t(n),t=sm(n);t&&RM(t)&&Bn(t).position==="static";)t=sm(t);return t&&(hn(t)==="html"||hn(t)==="body"&&Bn(t).position==="static")?e:t||PM(n)||e}function df(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function qs(n,e,t){return zr(n,xl(e,t))}function IM(n,e,t){var r=qs(n,e,t);return r>t?t:r}function Gv(){return{top:0,right:0,bottom:0,left:0}}function Yv(n){return Object.assign({},Gv(),n)}function Xv(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var DM=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Yv(typeof e!="number"?e:Xv(e,Bo))};function LM(n){var e,t=n.state,r=n.name,i=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ln(t.placement),l=df(a),u=[xt,Ht].indexOf(a)>=0,c=u?"height":"width";if(!(!s||!o)){var d=DM(i.padding,t),h=cf(s),f=l==="y"?St:xt,p=l==="y"?Ut:Ht,m=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],g=o[l]-t.rects.reference[l],y=zo(s),v=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,k=m/2-g/2,b=d[f],x=v-h[c]-d[p],A=v/2-h[c]/2+k,O=qs(b,A,x),_=l;t.modifiersData[r]=(e={},e[_]=O,e.centerOffset=O-A,e)}}function FM(n){var e=n.state,t=n.options,r=t.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Kv(e.elements.popper,i)&&(e.elements.arrow=i))}const $M={name:"arrow",enabled:!0,phase:"main",fn:LM,effect:FM,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Fi(n){return n.split("-")[1]}var BM={top:"auto",right:"auto",bottom:"auto",left:"auto"};function zM(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:Di(t*i)/i||0,y:Di(r*i)/i||0}}function om(n){var e,t=n.popper,r=n.popperRect,i=n.placement,s=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,u=n.adaptive,c=n.roundOffsets,d=n.isFixed,h=o.x,f=h===void 0?0:h,p=o.y,m=p===void 0?0:p,g=typeof c=="function"?c({x:f,y:m}):{x:f,y:m};f=g.x,m=g.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),k=xt,b=St,x=window;if(u){var A=zo(t),O="clientHeight",_="clientWidth";if(A===_t(t)&&(A=fr(t),Bn(A).position!=="static"&&a==="absolute"&&(O="scrollHeight",_="scrollWidth")),A=A,i===St||(i===xt||i===Ht)&&s===fo){b=Ut;var I=d&&A===x&&x.visualViewport?x.visualViewport.height:A[O];m-=I-r.height,m*=l?1:-1}if(i===xt||(i===St||i===Ut)&&s===fo){k=Ht;var $=d&&A===x&&x.visualViewport?x.visualViewport.width:A[_];f-=$-r.width,f*=l?1:-1}}var Y=Object.assign({position:a},u&&BM),ie=c===!0?zM({x:f,y:m},_t(t)):{x:f,y:m};if(f=ie.x,m=ie.y,l){var P;return Object.assign({},Y,(P={},P[b]=v?"0":"",P[k]=y?"0":"",P.transform=(x.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",P))}return Object.assign({},Y,(e={},e[b]=v?m+"px":"",e[k]=y?f+"px":"",e.transform="",e))}function UM(n){var e=n.state,t=n.options,r=t.gpuAcceleration,i=r===void 0?!0:r,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,u={placement:ln(e.placement),variation:Fi(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,om(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,om(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const HM={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:UM,data:{}};var ha={passive:!0};function VM(n){var e=n.state,t=n.instance,r=n.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=_t(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&u.forEach(function(c){c.addEventListener("scroll",t.update,ha)}),a&&l.addEventListener("resize",t.update,ha),function(){s&&u.forEach(function(c){c.removeEventListener("scroll",t.update,ha)}),a&&l.removeEventListener("resize",t.update,ha)}}const qM={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:VM,data:{}};var jM={left:"right",right:"left",bottom:"top",top:"bottom"};function qa(n){return n.replace(/left|right|bottom|top/g,function(e){return jM[e]})}var WM={start:"end",end:"start"};function am(n){return n.replace(/start|end/g,function(e){return WM[e]})}function hf(n){var e=_t(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function ff(n){return Li(fr(n)).left+hf(n).scrollLeft}function JM(n,e){var t=_t(n),r=fr(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var u=Jv();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+ff(n),y:l}}function KM(n){var e,t=fr(n),r=hf(n),i=(e=n.ownerDocument)==null?void 0:e.body,s=zr(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=zr(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+ff(n),l=-r.scrollTop;return Bn(i||t).direction==="rtl"&&(a+=zr(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function pf(n){var e=Bn(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function Qv(n){return["html","body","#document"].indexOf(hn(n))>=0?n.ownerDocument.body:zt(n)&&pf(n)?n:Qv(Tu(n))}function js(n,e){var t;e===void 0&&(e=[]);var r=Qv(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=_t(r),o=i?[s].concat(s.visualViewport||[],pf(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(js(Tu(o)))}function Od(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function GM(n,e){var t=Li(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function lm(n,e,t){return e===qv?Od(JM(n,t)):Qr(e)?GM(e,t):Od(KM(fr(n)))}function YM(n){var e=js(Tu(n)),t=["absolute","fixed"].indexOf(Bn(n).position)>=0,r=t&&zt(n)?zo(n):n;return Qr(r)?e.filter(function(i){return Qr(i)&&Kv(i,r)&&hn(i)!=="body"}):[]}function XM(n,e,t,r){var i=e==="clippingParents"?YM(n):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,u){var c=lm(n,u,r);return l.top=zr(c.top,l.top),l.right=xl(c.right,l.right),l.bottom=xl(c.bottom,l.bottom),l.left=zr(c.left,l.left),l},lm(n,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Zv(n){var e=n.reference,t=n.element,r=n.placement,i=r?ln(r):null,s=r?Fi(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case St:l={x:o,y:e.y-t.height};break;case Ut:l={x:o,y:e.y+e.height};break;case Ht:l={x:e.x+e.width,y:a};break;case xt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?df(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(s){case Ii:l[u]=l[u]-(e[c]/2-t[c]/2);break;case fo:l[u]=l[u]+(e[c]/2-t[c]/2);break}}return l}function po(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=r===void 0?n.placement:r,s=t.strategy,o=s===void 0?n.strategy:s,a=t.boundary,l=a===void 0?bM:a,u=t.rootBoundary,c=u===void 0?qv:u,d=t.elementContext,h=d===void 0?Zi:d,f=t.altBoundary,p=f===void 0?!1:f,m=t.padding,g=m===void 0?0:m,y=Yv(typeof g!="number"?g:Xv(g,Bo)),v=h===Zi?vM:Zi,k=n.rects.popper,b=n.elements[p?v:h],x=XM(Qr(b)?b:b.contextElement||fr(n.elements.popper),l,c,o),A=Li(n.elements.reference),O=Zv({reference:A,element:k,placement:i}),_=Od(Object.assign({},k,O)),I=h===Zi?_:A,$={top:x.top-I.top+y.top,bottom:I.bottom-x.bottom+y.bottom,left:x.left-I.left+y.left,right:I.right-x.right+y.right},Y=n.modifiersData.offset;if(h===Zi&&Y){var ie=Y[i];Object.keys($).forEach(function(P){var oe=[Ht,Ut].indexOf(P)>=0?1:-1,ue=[St,Ut].indexOf(P)>=0?"y":"x";$[P]+=ie[ue]*oe})}return $}function QM(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,u=l===void 0?jv:l,c=Fi(r),d=c?a?im:im.filter(function(p){return Fi(p)===c}):Bo,h=d.filter(function(p){return u.indexOf(p)>=0});h.length===0&&(h=d);var f=h.reduce(function(p,m){return p[m]=po(n,{placement:m,boundary:i,rootBoundary:s,padding:o})[ln(m)],p},{});return Object.keys(f).sort(function(p,m){return f[p]-f[m]})}function ZM(n){if(ln(n)===lf)return[];var e=qa(n);return[am(n),e,am(e)]}function eA(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,u=t.padding,c=t.boundary,d=t.rootBoundary,h=t.altBoundary,f=t.flipVariations,p=f===void 0?!0:f,m=t.allowedAutoPlacements,g=e.options.placement,y=ln(g),v=y===g,k=l||(v||!p?[qa(g)]:ZM(g)),b=[g].concat(k).reduce(function(le,we){return le.concat(ln(we)===lf?QM(e,{placement:we,boundary:c,rootBoundary:d,padding:u,flipVariations:p,allowedAutoPlacements:m}):we)},[]),x=e.rects.reference,A=e.rects.popper,O=new Map,_=!0,I=b[0],$=0;$<b.length;$++){var Y=b[$],ie=ln(Y),P=Fi(Y)===Ii,oe=[St,Ut].indexOf(ie)>=0,ue=oe?"width":"height",E=po(e,{placement:Y,boundary:c,rootBoundary:d,altBoundary:h,padding:u}),S=oe?P?Ht:xt:P?Ut:St;x[ue]>A[ue]&&(S=qa(S));var T=qa(S),R=[];if(s&&R.push(E[ie]<=0),a&&R.push(E[S]<=0,E[T]<=0),R.every(function(le){return le})){I=Y,_=!1;break}O.set(Y,R)}if(_)for(var L=p?3:1,D=function(we){var ke=b.find(function(Oe){var pn=O.get(Oe);if(pn)return pn.slice(0,we).every(function(si){return si})});if(ke)return I=ke,"break"},J=L;J>0;J--){var se=D(J);if(se==="break")break}e.placement!==I&&(e.modifiersData[r]._skip=!0,e.placement=I,e.reset=!0)}}const tA={name:"flip",enabled:!0,phase:"main",fn:eA,requiresIfExists:["offset"],data:{_skip:!1}};function um(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function cm(n){return[St,Ht,Ut,xt].some(function(e){return n[e]>=0})}function nA(n){var e=n.state,t=n.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=po(e,{elementContext:"reference"}),a=po(e,{altBoundary:!0}),l=um(o,r),u=um(a,i,s),c=cm(l),d=cm(u);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const rA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:nA};function iA(n,e,t){var r=ln(n),i=[xt,St].indexOf(r)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[xt,Ht].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function sA(n){var e=n.state,t=n.options,r=n.name,i=t.offset,s=i===void 0?[0,0]:i,o=jv.reduce(function(c,d){return c[d]=iA(d,e.rects,s),c},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=o}const oA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:sA};function aA(n){var e=n.state,t=n.name;e.modifiersData[t]=Zv({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const lA={name:"popperOffsets",enabled:!0,phase:"read",fn:aA,data:{}};function uA(n){return n==="x"?"y":"x"}function cA(n){var e=n.state,t=n.options,r=n.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,u=t.rootBoundary,c=t.altBoundary,d=t.padding,h=t.tether,f=h===void 0?!0:h,p=t.tetherOffset,m=p===void 0?0:p,g=po(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=ln(e.placement),v=Fi(e.placement),k=!v,b=df(y),x=uA(b),A=e.modifiersData.popperOffsets,O=e.rects.reference,_=e.rects.popper,I=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,$=typeof I=="number"?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),Y=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(A){if(s){var P,oe=b==="y"?St:xt,ue=b==="y"?Ut:Ht,E=b==="y"?"height":"width",S=A[b],T=S+g[oe],R=S-g[ue],L=f?-_[E]/2:0,D=v===Ii?O[E]:_[E],J=v===Ii?-_[E]:-O[E],se=e.elements.arrow,le=f&&se?cf(se):{width:0,height:0},we=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Gv(),ke=we[oe],Oe=we[ue],pn=qs(0,O[E],le[E]),si=k?O[E]/2-L-pn-ke-$.mainAxis:D-pn-ke-$.mainAxis,Hn=k?-O[E]/2+L+pn+Oe+$.mainAxis:J+pn+Oe+$.mainAxis,oi=e.elements.arrow&&zo(e.elements.arrow),Jo=oi?b==="y"?oi.clientTop||0:oi.clientLeft||0:0,Ji=(P=Y?.[b])!=null?P:0,Ko=S+si-Ji-Jo,Go=S+Hn-Ji,Ki=qs(f?xl(T,Ko):T,S,f?zr(R,Go):R);A[b]=Ki,ie[b]=Ki-S}if(a){var Gi,Yo=b==="x"?St:xt,Xo=b==="x"?Ut:Ht,mn=A[x],Vn=x==="y"?"height":"width",Yi=mn+g[Yo],pr=mn-g[Xo],Xi=[St,xt].indexOf(y)!==-1,Qo=(Gi=Y?.[x])!=null?Gi:0,Zo=Xi?Yi:mn-O[Vn]-_[Vn]-Qo+$.altAxis,ea=Xi?mn+O[Vn]+_[Vn]-Qo-$.altAxis:pr,ta=f&&Xi?IM(Zo,mn,ea):qs(f?Zo:Yi,mn,f?ea:pr);A[x]=ta,ie[x]=ta-mn}e.modifiersData[r]=ie}}const dA={name:"preventOverflow",enabled:!0,phase:"main",fn:cA,requiresIfExists:["offset"]};function hA(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function fA(n){return n===_t(n)||!zt(n)?hf(n):hA(n)}function pA(n){var e=n.getBoundingClientRect(),t=Di(e.width)/n.offsetWidth||1,r=Di(e.height)/n.offsetHeight||1;return t!==1||r!==1}function mA(n,e,t){t===void 0&&(t=!1);var r=zt(e),i=zt(e)&&pA(e),s=fr(e),o=Li(n,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((hn(e)!=="body"||pf(s))&&(a=fA(e)),zt(e)?(l=Li(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=ff(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function gA(n){var e=new Map,t=new Set,r=[];n.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return n.forEach(function(s){t.has(s.name)||i(s)}),r}function yA(n){var e=gA(n);return OM.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function bA(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function vA(n){var e=n.reduce(function(t,r){var i=t[r.name];return t[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var dm={placement:"bottom",modifiers:[],strategy:"absolute"};function hm(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function wA(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,r=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?dm:i;return function(a,l,u){u===void 0&&(u=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},dm,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],h=!1,f={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;m(),c.options=Object.assign({},s,c.options,v),c.scrollParents={reference:Qr(a)?js(a):a.contextElement?js(a.contextElement):[],popper:js(l)};var k=yA(vA([].concat(r,c.options.modifiers)));return c.orderedModifiers=k.filter(function(b){return b.enabled}),p(),f.update()},forceUpdate:function(){if(!h){var y=c.elements,v=y.reference,k=y.popper;if(hm(v,k)){c.rects={reference:mA(v,zo(k),c.options.strategy==="fixed"),popper:cf(k)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function($){return c.modifiersData[$.name]=Object.assign({},$.data)});for(var b=0;b<c.orderedModifiers.length;b++){if(c.reset===!0){c.reset=!1,b=-1;continue}var x=c.orderedModifiers[b],A=x.fn,O=x.options,_=O===void 0?{}:O,I=x.name;typeof A=="function"&&(c=A({state:c,options:_,name:I,instance:f})||c)}}}},update:bA(function(){return new Promise(function(g){f.forceUpdate(),g(c)})}),destroy:function(){m(),h=!0}};if(!hm(a,l))return f;f.setOptions(u).then(function(g){!h&&u.onFirstUpdate&&u.onFirstUpdate(g)});function p(){c.orderedModifiers.forEach(function(g){var y=g.name,v=g.options,k=v===void 0?{}:v,b=g.effect;if(typeof b=="function"){var x=b({state:c,name:y,instance:f,options:k}),A=function(){};d.push(x||A)}})}function m(){d.forEach(function(g){return g()}),d=[]}return f}}var kA=[qM,lA,HM,Wv,oA,tA,dA,$M,rA],SA=wA({defaultModifiers:kA}),xA="tippy-box",e0="tippy-content",TA="tippy-backdrop",t0="tippy-arrow",n0="tippy-svg-arrow",Tr={passive:!0,capture:!0},r0=function(){return document.body};function ac(n,e,t){if(Array.isArray(n)){var r=n[e];return r??(Array.isArray(t)?t[e]:t)}return n}function mf(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function i0(n,e){return typeof n=="function"?n.apply(void 0,e):n}function fm(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function CA(n){return n.split(/\s+/).filter(Boolean)}function vi(n){return[].concat(n)}function pm(n,e){n.indexOf(e)===-1&&n.push(e)}function EA(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function MA(n){return n.split("-")[0]}function Tl(n){return[].slice.call(n)}function mm(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function Ws(){return document.createElement("div")}function Cu(n){return["Element","Fragment"].some(function(e){return mf(n,e)})}function AA(n){return mf(n,"NodeList")}function OA(n){return mf(n,"MouseEvent")}function NA(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function _A(n){return Cu(n)?[n]:AA(n)?Tl(n):Array.isArray(n)?n:Tl(document.querySelectorAll(n))}function lc(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function gm(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function RA(n){var e,t=vi(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function PA(n,e){var t=e.clientX,r=e.clientY;return n.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,u=MA(o.placement),c=o.modifiersData.offset;if(!c)return!0;var d=u==="bottom"?c.top.y:0,h=u==="top"?c.bottom.y:0,f=u==="right"?c.left.x:0,p=u==="left"?c.right.x:0,m=s.top-r+d>l,g=r-s.bottom-h>l,y=s.left-t+f>l,v=t-s.right-p>l;return m||g||y||v})}function uc(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function ym(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var nn={isTouch:!1},bm=0;function IA(){nn.isTouch||(nn.isTouch=!0,window.performance&&document.addEventListener("mousemove",s0))}function s0(){var n=performance.now();n-bm<20&&(nn.isTouch=!1,document.removeEventListener("mousemove",s0)),bm=n}function DA(){var n=document.activeElement;if(NA(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function LA(){document.addEventListener("touchstart",IA,Tr),window.addEventListener("blur",DA)}var FA=typeof window<"u"&&typeof document<"u",$A=FA?!!window.msCrypto:!1,BA={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},zA={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Kt=Object.assign({appendTo:r0,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},BA,zA),UA=Object.keys(Kt),HA=function(e){var t=Object.keys(e);t.forEach(function(r){Kt[r]=e[r]})};function o0(n){var e=n.plugins||[],t=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=n[s]!==void 0?n[s]:(a=Kt[s])!=null?a:o}return r},{});return Object.assign({},n,t)}function VA(n,e){var t=e?Object.keys(o0(Object.assign({},Kt,{plugins:e}))):UA,r=t.reduce(function(i,s){var o=(n.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function vm(n,e){var t=Object.assign({},e,{content:i0(e.content,[n])},e.ignoreAttributes?{}:VA(n,e.plugins));return t.aria=Object.assign({},Kt.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var qA=function(){return"innerHTML"};function Nd(n,e){n[qA()]=e}function wm(n){var e=Ws();return n===!0?e.className=t0:(e.className=n0,Cu(n)?e.appendChild(n):Nd(e,n)),e}function km(n,e){Cu(e.content)?(Nd(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Nd(n,e.content):n.textContent=e.content)}function _d(n){var e=n.firstElementChild,t=Tl(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(e0)}),arrow:t.find(function(r){return r.classList.contains(t0)||r.classList.contains(n0)}),backdrop:t.find(function(r){return r.classList.contains(TA)})}}function a0(n){var e=Ws(),t=Ws();t.className=xA,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Ws();r.className=e0,r.setAttribute("data-state","hidden"),km(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(s,o){var a=_d(e),l=a.box,u=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&km(u,n.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(wm(o.arrow))):l.appendChild(wm(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}a0.$$tippy=!0;var jA=1,fa=[],cc=[];function WA(n,e){var t=vm(n,Object.assign({},Kt,o0(mm(e)))),r,i,s,o=!1,a=!1,l=!1,u=!1,c,d,h,f=[],p=fm(Ko,t.interactiveDebounce),m,g=jA++,y=null,v=EA(t.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:n,popper:Ws(),popperInstance:y,props:t,state:k,plugins:v,clearDelayTimeouts:Zo,setProps:ea,setContent:ta,show:W1,hide:J1,hideWithInteractivity:K1,enable:Xi,disable:Qo,unmount:G1,destroy:Y1};if(!t.render)return b;var x=t.render(b),A=x.popper,O=x.onUpdate;A.setAttribute("data-tippy-root",""),A.id="tippy-"+b.id,b.popper=A,n._tippy=b,A._tippy=b;var _=v.map(function(N){return N.fn(b)}),I=n.hasAttribute("aria-expanded");return oi(),L(),S(),T("onCreate",[b]),t.showOnCreate&&Yi(),A.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),A.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&oe().addEventListener("mousemove",p)}),b;function $(){var N=b.props.touch;return Array.isArray(N)?N:[N,0]}function Y(){return $()[0]==="hold"}function ie(){var N;return!!((N=b.props.render)!=null&&N.$$tippy)}function P(){return m||n}function oe(){var N=P().parentNode;return N?RA(N):document}function ue(){return _d(A)}function E(N){return b.state.isMounted&&!b.state.isVisible||nn.isTouch||c&&c.type==="focus"?0:ac(b.props.delay,N?0:1,Kt.delay)}function S(N){N===void 0&&(N=!1),A.style.pointerEvents=b.props.interactive&&!N?"":"none",A.style.zIndex=""+b.props.zIndex}function T(N,j,re){if(re===void 0&&(re=!0),_.forEach(function(ce){ce[N]&&ce[N].apply(ce,j)}),re){var me;(me=b.props)[N].apply(me,j)}}function R(){var N=b.props.aria;if(N.content){var j="aria-"+N.content,re=A.id,me=vi(b.props.triggerTarget||n);me.forEach(function(ce){var lt=ce.getAttribute(j);if(b.state.isVisible)ce.setAttribute(j,lt?lt+" "+re:re);else{var Rt=lt&<.replace(re,"").trim();Rt?ce.setAttribute(j,Rt):ce.removeAttribute(j)}})}}function L(){if(!(I||!b.props.aria.expanded)){var N=vi(b.props.triggerTarget||n);N.forEach(function(j){b.props.interactive?j.setAttribute("aria-expanded",b.state.isVisible&&j===P()?"true":"false"):j.removeAttribute("aria-expanded")})}}function D(){oe().removeEventListener("mousemove",p),fa=fa.filter(function(N){return N!==p})}function J(N){if(!(nn.isTouch&&(l||N.type==="mousedown"))){var j=N.composedPath&&N.composedPath()[0]||N.target;if(!(b.props.interactive&&ym(A,j))){if(vi(b.props.triggerTarget||n).some(function(re){return ym(re,j)})){if(nn.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else T("onClickOutside",[b,N]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||ke())}}}function se(){l=!0}function le(){l=!1}function we(){var N=oe();N.addEventListener("mousedown",J,!0),N.addEventListener("touchend",J,Tr),N.addEventListener("touchstart",le,Tr),N.addEventListener("touchmove",se,Tr)}function ke(){var N=oe();N.removeEventListener("mousedown",J,!0),N.removeEventListener("touchend",J,Tr),N.removeEventListener("touchstart",le,Tr),N.removeEventListener("touchmove",se,Tr)}function Oe(N,j){si(N,function(){!b.state.isVisible&&A.parentNode&&A.parentNode.contains(A)&&j()})}function pn(N,j){si(N,j)}function si(N,j){var re=ue().box;function me(ce){ce.target===re&&(uc(re,"remove",me),j())}if(N===0)return j();uc(re,"remove",d),uc(re,"add",me),d=me}function Hn(N,j,re){re===void 0&&(re=!1);var me=vi(b.props.triggerTarget||n);me.forEach(function(ce){ce.addEventListener(N,j,re),f.push({node:ce,eventType:N,handler:j,options:re})})}function oi(){Y()&&(Hn("touchstart",Ji,{passive:!0}),Hn("touchend",Go,{passive:!0})),CA(b.props.trigger).forEach(function(N){if(N!=="manual")switch(Hn(N,Ji),N){case"mouseenter":Hn("mouseleave",Go);break;case"focus":Hn($A?"focusout":"blur",Ki);break;case"focusin":Hn("focusout",Ki);break}})}function Jo(){f.forEach(function(N){var j=N.node,re=N.eventType,me=N.handler,ce=N.options;j.removeEventListener(re,me,ce)}),f=[]}function Ji(N){var j,re=!1;if(!(!b.state.isEnabled||Gi(N)||a)){var me=((j=c)==null?void 0:j.type)==="focus";c=N,m=N.currentTarget,L(),!b.state.isVisible&&OA(N)&&fa.forEach(function(ce){return ce(N)}),N.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?re=!0:Yi(N),N.type==="click"&&(o=!re),re&&!me&&pr(N)}}function Ko(N){var j=N.target,re=P().contains(j)||A.contains(j);if(!(N.type==="mousemove"&&re)){var me=Vn().concat(A).map(function(ce){var lt,Rt=ce._tippy,ai=(lt=Rt.popperInstance)==null?void 0:lt.state;return ai?{popperRect:ce.getBoundingClientRect(),popperState:ai,props:t}:null}).filter(Boolean);PA(me,N)&&(D(),pr(N))}}function Go(N){var j=Gi(N)||b.props.trigger.indexOf("click")>=0&&o;if(!j){if(b.props.interactive){b.hideWithInteractivity(N);return}pr(N)}}function Ki(N){b.props.trigger.indexOf("focusin")<0&&N.target!==P()||b.props.interactive&&N.relatedTarget&&A.contains(N.relatedTarget)||pr(N)}function Gi(N){return nn.isTouch?Y()!==N.type.indexOf("touch")>=0:!1}function Yo(){Xo();var N=b.props,j=N.popperOptions,re=N.placement,me=N.offset,ce=N.getReferenceClientRect,lt=N.moveTransition,Rt=ie()?_d(A).arrow:null,ai=ce?{getBoundingClientRect:ce,contextElement:ce.contextElement||P()}:n,Hf={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(na){var li=na.state;if(ie()){var X1=ue(),Lu=X1.box;["placement","reference-hidden","escaped"].forEach(function(ra){ra==="placement"?Lu.setAttribute("data-placement",li.placement):li.attributes.popper["data-popper-"+ra]?Lu.setAttribute("data-"+ra,""):Lu.removeAttribute("data-"+ra)}),li.attributes.popper={}}}},mr=[{name:"offset",options:{offset:me}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!lt}},Hf];ie()&&Rt&&mr.push({name:"arrow",options:{element:Rt,padding:3}}),mr.push.apply(mr,j?.modifiers||[]),b.popperInstance=SA(ai,A,Object.assign({},j,{placement:re,onFirstUpdate:h,modifiers:mr}))}function Xo(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function mn(){var N=b.props.appendTo,j,re=P();b.props.interactive&&N===r0||N==="parent"?j=re.parentNode:j=i0(N,[re]),j.contains(A)||j.appendChild(A),b.state.isMounted=!0,Yo()}function Vn(){return Tl(A.querySelectorAll("[data-tippy-root]"))}function Yi(N){b.clearDelayTimeouts(),N&&T("onTrigger",[b,N]),we();var j=E(!0),re=$(),me=re[0],ce=re[1];nn.isTouch&&me==="hold"&&ce&&(j=ce),j?r=setTimeout(function(){b.show()},j):b.show()}function pr(N){if(b.clearDelayTimeouts(),T("onUntrigger",[b,N]),!b.state.isVisible){ke();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&o)){var j=E(!1);j?i=setTimeout(function(){b.state.isVisible&&b.hide()},j):s=requestAnimationFrame(function(){b.hide()})}}function Xi(){b.state.isEnabled=!0}function Qo(){b.hide(),b.state.isEnabled=!1}function Zo(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function ea(N){if(!b.state.isDestroyed){T("onBeforeUpdate",[b,N]),Jo();var j=b.props,re=vm(n,Object.assign({},j,mm(N),{ignoreAttributes:!0}));b.props=re,oi(),j.interactiveDebounce!==re.interactiveDebounce&&(D(),p=fm(Ko,re.interactiveDebounce)),j.triggerTarget&&!re.triggerTarget?vi(j.triggerTarget).forEach(function(me){me.removeAttribute("aria-expanded")}):re.triggerTarget&&n.removeAttribute("aria-expanded"),L(),S(),O&&O(j,re),b.popperInstance&&(Yo(),Vn().forEach(function(me){requestAnimationFrame(me._tippy.popperInstance.forceUpdate)})),T("onAfterUpdate",[b,N])}}function ta(N){b.setProps({content:N})}function W1(){var N=b.state.isVisible,j=b.state.isDestroyed,re=!b.state.isEnabled,me=nn.isTouch&&!b.props.touch,ce=ac(b.props.duration,0,Kt.duration);if(!(N||j||re||me)&&!P().hasAttribute("disabled")&&(T("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,ie()&&(A.style.visibility="visible"),S(),we(),b.state.isMounted||(A.style.transition="none"),ie()){var lt=ue(),Rt=lt.box,ai=lt.content;lc([Rt,ai],0)}h=function(){var mr;if(!(!b.state.isVisible||u)){if(u=!0,A.offsetHeight,A.style.transition=b.props.moveTransition,ie()&&b.props.animation){var Du=ue(),na=Du.box,li=Du.content;lc([na,li],ce),gm([na,li],"visible")}R(),L(),pm(cc,b),(mr=b.popperInstance)==null||mr.forceUpdate(),T("onMount",[b]),b.props.animation&&ie()&&pn(ce,function(){b.state.isShown=!0,T("onShown",[b])})}},mn()}}function J1(){var N=!b.state.isVisible,j=b.state.isDestroyed,re=!b.state.isEnabled,me=ac(b.props.duration,1,Kt.duration);if(!(N||j||re)&&(T("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,ie()&&(A.style.visibility="hidden"),D(),ke(),S(!0),ie()){var ce=ue(),lt=ce.box,Rt=ce.content;b.props.animation&&(lc([lt,Rt],me),gm([lt,Rt],"hidden"))}R(),L(),b.props.animation?ie()&&Oe(me,b.unmount):b.unmount()}}function K1(N){oe().addEventListener("mousemove",p),pm(fa,p),p(N)}function G1(){b.state.isVisible&&b.hide(),b.state.isMounted&&(Xo(),Vn().forEach(function(N){N._tippy.unmount()}),A.parentNode&&A.parentNode.removeChild(A),cc=cc.filter(function(N){return N!==b}),b.state.isMounted=!1,T("onHidden",[b]))}function Y1(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),Jo(),delete n._tippy,b.state.isDestroyed=!0,T("onDestroy",[b]))}}function Uo(n,e){e===void 0&&(e={});var t=Kt.plugins.concat(e.plugins||[]);LA();var r=Object.assign({},e,{plugins:t}),i=_A(n),s=i.reduce(function(o,a){var l=a&&WA(a,r);return l&&o.push(l),o},[]);return Cu(n)?s[0]:s}Uo.defaultProps=Kt;Uo.setDefaultProps=HA;Uo.currentInput=nn;Object.assign({},Wv,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});var JA={name:"sticky",defaultValue:!1,fn:function(e){var t=e.reference,r=e.popper;function i(){return e.popperInstance?e.popperInstance.state.elements.reference:t}function s(u){return e.props.sticky===!0||e.props.sticky===u}var o=null,a=null;function l(){var u=s("reference")?i().getBoundingClientRect():null,c=s("popper")?r.getBoundingClientRect():null;(u&&Sm(o,u)||c&&Sm(a,c))&&e.popperInstance&&e.popperInstance.update(),o=u,a=c,e.state.isMounted&&requestAnimationFrame(l)}return{onMount:function(){e.props.sticky&&l()}}}};function Sm(n,e){return n&&e?n.top!==e.top||n.right!==e.right||n.bottom!==e.bottom||n.left!==e.left:!0}Uo.setDefaultProps({render:a0});function xm(n){return dk((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var l0=class extends hM{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=xm(this.view.state),this.reactiveExtensionStorage=xm(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),iy(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},u0=Po({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=ou(),t=fk();return uk(()=>{const r=n.editor;r&&r.options.element&&e.value&&hk(()=>{var i;if(!e.value||!((i=r.options.element)!=null&&i.firstChild))return;const s=sy(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),Th(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return ro("div",{ref:n=>{this.rootEl=n}})}}),KA=Po({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return ro(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}}),c0=class{constructor(n,{props:e={},editor:t}){this.editor=t,this.component=iy(n),this.el=document.createElement("div"),this.props=ck(e),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var n,e,t,r;return(e=(n=this.renderedComponent.vNode)==null?void 0:n.component)!=null&&e.exposed?this.renderedComponent.vNode.component.exposed:(r=(t=this.renderedComponent.vNode)==null?void 0:t.component)==null?void 0:r.proxy}renderComponent(){let n=ro(this.component,this.props);return this.editor.appContext&&(n.appContext=this.editor.appContext),typeof document<"u"&&this.el&&Vf(n,this.el),{vNode:n,destroy:()=>{this.el&&Vf(null,this.el),this.el=null,n=null},el:this.el?this.el.firstElementChild:null}}updateProps(n={}){Object.entries(n).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}},GA={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}},YA=class extends gM{mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(r={})=>this.updateAttributes(r),deleteNode:()=>this.deleteNode()},e=this.onDragStart.bind(this);this.decorationClasses=ou(this.getDecorationClasses());const t=Po({extends:{...this.component},props:Object.keys(n),template:this.component.template,setup:r=>{var i,s;return qf("onDragStart",e),qf("decorationClasses",this.decorationClasses),(s=(i=this.component).setup)==null?void 0:s.call(i,r,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new c0(t,{editor:this.editor,props:n})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(n,e,t){const r=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:s,newNode:n,newDecorations:e,oldInnerDecorations:o,innerDecorations:t,updateProps:()=>r({node:n,decorations:e,innerDecorations:t})})}return n.type!==this.node.type?!1:(n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,r({node:n,decorations:e,innerDecorations:t})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(n=>n.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}};function XA(n,e){return t=>{if(!t.editor.contentComponent)return{};const r=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new YA(r,t,e)}}const d0={name:"MentionList",props:{items:{type:Array,required:!0},command:{type:Function,required:!0}},data(){return{selectedIndex:0}},watch:{items:{handler(){this.selectedIndex=0},deep:!0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.command(e)}}},QA={class:"o-list suggestion__popup"},ZA=["onClick"],eO={class:"btn--blank"},tO={key:1,class:"o-list__item suggestion__list-item"};function nO(n,e,t,r,i,s){return z(),V("ul",QA,[t.items.length?(z(!0),V(Lt,{key:0},Rn(t.items,(o,a)=>(z(),V("li",{key:o.id,class:q(["o-list__item suggestion__list-item u-ph-0_5 u-pv-0_25",{"suggestion__list-item--is-active":a===i.selectedIndex}]),onClick:l=>s.selectItem(a)},[ne("button",eO,qe(o.label),1)],10,ZA))),128)):(z(),V("li",tO," No result "))])}const rO=vt(d0,[["render",nO]]);d0.__docgenInfo={displayName:"MentionList",exportName:"default",description:"",tags:{},props:[{name:"items",type:{name:"array"},required:!0},{name:"command",type:{name:"func"},required:!0}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpEditor/MentionList.vue"]};const iO=({suggestions:n,matcher:e})=>({...e,items:({query:t})=>n.filter(r=>r.label.toLowerCase().startsWith(t.toLowerCase())).slice(0,5),render:()=>{let t,r;return{onStart:i=>{t=new c0(rO,{props:i,editor:i.editor}),i.clientRect&&(r=Uo("body",{getReferenceClientRect:i.clientRect,appendTo:()=>document.body,interactive:!0,sticky:!0,plugins:[JA],content:t.element,trigger:"manual",showOnCreate:!0,theme:"dark",placement:"top-start",inertia:!0,duration:[400,200]}))},onUpdate(i){t.updateProps(i),i.clientRect&&r[0].setProps({getReferenceClientRect:i.clientRect})},onKeyDown(i){return i.event.key==="Escape"?(r[0].hide(),!0):t.ref?.onKeyDown(i)},onExit(){r[0].destroy(),t.destroy()}}}}),sO=Vt.create({name:"delete",parseHTML(){return[{tag:"del"}]},renderHTML(){return["del",{title:W.text.deleted},0]},addCommands(){return{setDelete:()=>({commands:n})=>n.setMark(this.name),toggleDelete:()=>({commands:n})=>n.toggleMark(this.name),unsetDelete:()=>({commands:n})=>n.unsetMark(this.name)}}}),h0={name:"DpResizableImage",components:{NodeViewWrapper:KA},props:GA,data(){return{id:ol(),imageTitle:W.image.alt.editHint,observer:null,ratioFactor:1}},methods:{updateImageDimensions(){const n=this.$refs.imagewrapper.$el,e=n.parentElement.clientWidth-40,t=n.clientWidth,r=t<e?t:e;r>0&&this.$nextTick(()=>{this.node.attrs.width=r,this.node.attrs.height=r/this.ratioFactor,this.editor.options.onUpdate()})},setRatio(n=!1){const e=new Image;e.onload=()=>{this.ratioFactor=e.width/e.height,n&&this.updateImageDimensions()},e.src=this.node.attrs.src},initResizeObserver(){this.$refs.imagewrapper.$el?(this.observer=new ResizeObserver(n=>this.updateImageDimensions()),this.observer.observe(this.$refs.imagewrapper.$el)):setTimeout(()=>{this.initResizeObserver()},200)}},mounted(){this.$root.$on("update-image:"+this.id,e=>{Object.keys(e).forEach(t=>{this.node.attrs[t]=e[t]})}),this.initResizeObserver(),this.$refs.imagewrapper.$el.style.width=this.node.attrs.width+"px";const n=this.node.attrs.height<=0||this.node.attrs.height===1/0;this.setRatio(n)},beforeUnmount(){this.observer&&this.observer.disconnect()}},oO=["alt","src","title"];function aO(n,e,t,r,i,s){const o=je("node-view-wrapper");return z(),an(o,{ref:"imagewrapper",as:"span",class:"resizable-image",tabindex:"1"},{default:au(()=>[ne("img",{ref:"image",alt:n.node.attrs.alt,"data-cy":"editor:resizableImage",src:n.node.attrs.src,title:i.imageTitle,onClick:e[0]||(e[0]=Ue(a=>n.$root.$emit("open-image-alt-modal",{event:a,imgId:i.id,editorId:n.editor.options.id}),["ctrl"]))},null,8,oO)]),_:1},512)}const f0=vt(h0,[["render",aO]]);h0.__docgenInfo={displayName:"DpResizableImage",exportName:"default",description:"",tags:{},sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpEditor/DpResizableImage.vue"]};const lO=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,uO=Ze.create({name:"image",inline:!0,addOptions(){return{HTMLAttributes:{style:"width: ",class:null}}},addAttributes(){return{alt:{default:"",keepOnSplit:!1,parseHTML:n=>n.getAttribute("alt"),renderHTML:n=>({alt:n.alt})},height:{default:"",keepOnSplit:!1,parseHTML:n=>n.height||n.style.height,renderHTML:n=>({height:n.height})},src:{default:"",keepOnSplit:!1,parseHTML:n=>n.getAttribute("src"),renderHTML:n=>({src:n.src})},title:{default:"",keepOnSplit:!1,parseHTML:n=>n.getAttribute("title"),renderHTML:n=>({title:n.title})},width:{default:"",keepOnSplit:!1,parseHTML:n=>n.width||n.style.width,renderHTML:n=>({width:n.width})}}},group:"inline",draggable:!0,atom:!0,parseHTML(){return[{tag:`dp-resizable-image[style="width:${this.att}"]`},{tag:"img[src]"}]},renderHTML({HTMLAttributes:n}){return["img",ve(this.options.HTMLAttributes,n,{unselectable:"on"})]},addCommands(){return{insertImage:n=>({state:e,dispatch:t})=>{const{selection:r}=e,i=r.$cursor?r.$cursor.pos:r.$to.pos,s=this.type.create(n),o=e.tr.insert(i,s);t(o)}}},addInputRules(){return[fM({find:lO,type:this.type})]},addNodeView(){return XA(f0)}}),cO=Vt.create({name:"insert",parseHTML(){return[{tag:"ins"}]},renderHTML(){return["ins",{title:W.text.inserted},0]},addCommands(){return{setInsert:()=>({commands:n})=>n.setMark(this.name),toggleInsert:()=>({commands:n})=>n.toggleMark(this.name),unsetInsert:()=>({commands:n})=>n.unsetMark(this.name)}}}),dO="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",hO="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",$i=(n,e)=>{for(const t in e)n[t]=e[t];return n},Rd="numeric",Pd="ascii",Id="alpha",Js="asciinumeric",Ds="alphanumeric",Dd="domain",p0="emoji",fO="scheme",pO="slashscheme",dc="whitespace";function mO(n,e){return n in e||(e[n]=[]),e[n]}function Rr(n,e,t){e[Rd]&&(e[Js]=!0,e[Ds]=!0),e[Pd]&&(e[Js]=!0,e[Id]=!0),e[Js]&&(e[Ds]=!0),e[Id]&&(e[Ds]=!0),e[Ds]&&(e[Dd]=!0),e[p0]&&(e[Dd]=!0);for(const r in e){const i=mO(r,t);i.indexOf(n)<0&&i.push(n)}}function gO(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function wt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}wt.groups={};wt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||wt.groups;let i;return e&&e.j?i=e:(i=new wt(e),t&&r&&Rr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||wt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new wt,$i(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new wt,s){if(r)if(o.t&&typeof o.t=="string"){const l=$i(gO(o.t,r),t);Rr(s,l,r)}else t&&Rr(s,t,r);o.t=s}return i.j[n]=o,o}};const ae=(n,e,t,r,i)=>n.ta(e,t,r,i),Ne=(n,e,t,r,i)=>n.tr(e,t,r,i),Tm=(n,e,t,r,i)=>n.ts(e,t,r,i),F=(n,e,t,r,i)=>n.tt(e,t,r,i),xn="WORD",Ld="UWORD",m0="ASCIINUMERICAL",g0="ALPHANUMERICAL",mo="LOCALHOST",Fd="TLD",$d="UTLD",ja="SCHEME",wi="SLASH_SCHEME",gf="NUM",Bd="WS",yf="NL",Ks="OPENBRACE",Gs="CLOSEBRACE",Cl="OPENBRACKET",El="CLOSEBRACKET",Ml="OPENPAREN",Al="CLOSEPAREN",Ol="OPENANGLEBRACKET",Nl="CLOSEANGLEBRACKET",_l="FULLWIDTHLEFTPAREN",Rl="FULLWIDTHRIGHTPAREN",Pl="LEFTCORNERBRACKET",Il="RIGHTCORNERBRACKET",Dl="LEFTWHITECORNERBRACKET",Ll="RIGHTWHITECORNERBRACKET",Fl="FULLWIDTHLESSTHAN",$l="FULLWIDTHGREATERTHAN",Bl="AMPERSAND",zl="APOSTROPHE",Ul="ASTERISK",Gn="AT",Hl="BACKSLASH",Vl="BACKTICK",ql="CARET",Qn="COLON",bf="COMMA",jl="DOLLAR",Qt="DOT",Wl="EQUALS",vf="EXCLAMATION",It="HYPHEN",Ys="PERCENT",Jl="PIPE",Kl="PLUS",Gl="POUND",Xs="QUERY",wf="QUOTE",y0="FULLWIDTHMIDDLEDOT",kf="SEMI",Zt="SLASH",Qs="TILDE",Yl="UNDERSCORE",b0="EMOJI",Xl="SYM";var v0=Object.freeze({__proto__:null,ALPHANUMERICAL:g0,AMPERSAND:Bl,APOSTROPHE:zl,ASCIINUMERICAL:m0,ASTERISK:Ul,AT:Gn,BACKSLASH:Hl,BACKTICK:Vl,CARET:ql,CLOSEANGLEBRACKET:Nl,CLOSEBRACE:Gs,CLOSEBRACKET:El,CLOSEPAREN:Al,COLON:Qn,COMMA:bf,DOLLAR:jl,DOT:Qt,EMOJI:b0,EQUALS:Wl,EXCLAMATION:vf,FULLWIDTHGREATERTHAN:$l,FULLWIDTHLEFTPAREN:_l,FULLWIDTHLESSTHAN:Fl,FULLWIDTHMIDDLEDOT:y0,FULLWIDTHRIGHTPAREN:Rl,HYPHEN:It,LEFTCORNERBRACKET:Pl,LEFTWHITECORNERBRACKET:Dl,LOCALHOST:mo,NL:yf,NUM:gf,OPENANGLEBRACKET:Ol,OPENBRACE:Ks,OPENBRACKET:Cl,OPENPAREN:Ml,PERCENT:Ys,PIPE:Jl,PLUS:Kl,POUND:Gl,QUERY:Xs,QUOTE:wf,RIGHTCORNERBRACKET:Il,RIGHTWHITECORNERBRACKET:Ll,SCHEME:ja,SEMI:kf,SLASH:Zt,SLASH_SCHEME:wi,SYM:Xl,TILDE:Qs,TLD:Fd,UNDERSCORE:Yl,UTLD:$d,UWORD:Ld,WORD:xn,WS:Bd});const yn=/[a-z]/,es=new RegExp("\\p{L}","u"),hc=new RegExp("\\p{Emoji}","u"),bn=/\d/,fc=/\s/,Cm="\r",pc=`
|
|
86
|
-
`,yO="️",bO="",mc="";let pa=null,ma=null;function vO(n=[]){const e={};wt.groups=e;const t=new wt;pa==null&&(pa=Em(dO)),ma==null&&(ma=Em(hO)),F(t,"'",zl),F(t,"{",Ks),F(t,"}",Gs),F(t,"[",Cl),F(t,"]",El),F(t,"(",Ml),F(t,")",Al),F(t,"<",Ol),F(t,">",Nl),F(t,"(",_l),F(t,")",Rl),F(t,"「",Pl),F(t,"」",Il),F(t,"『",Dl),F(t,"』",Ll),F(t,"<",Fl),F(t,">",$l),F(t,"&",Bl),F(t,"*",Ul),F(t,"@",Gn),F(t,"`",Vl),F(t,"^",ql),F(t,":",Qn),F(t,",",bf),F(t,"$",jl),F(t,".",Qt),F(t,"=",Wl),F(t,"!",vf),F(t,"-",It),F(t,"%",Ys),F(t,"|",Jl),F(t,"+",Kl),F(t,"#",Gl),F(t,"?",Xs),F(t,'"',wf),F(t,"/",Zt),F(t,";",kf),F(t,"~",Qs),F(t,"_",Yl),F(t,"\\",Hl),F(t,"・",y0);const r=Ne(t,bn,gf,{[Rd]:!0});Ne(r,bn,r);const i=Ne(r,yn,m0,{[Js]:!0}),s=Ne(r,es,g0,{[Ds]:!0}),o=Ne(t,yn,xn,{[Pd]:!0});Ne(o,bn,i),Ne(o,yn,o),Ne(i,bn,i),Ne(i,yn,i);const a=Ne(t,es,Ld,{[Id]:!0});Ne(a,yn),Ne(a,bn,s),Ne(a,es,a),Ne(s,bn,s),Ne(s,yn),Ne(s,es,s);const l=F(t,pc,yf,{[dc]:!0}),u=F(t,Cm,Bd,{[dc]:!0}),c=Ne(t,fc,Bd,{[dc]:!0});F(t,mc,c),F(u,pc,l),F(u,mc,c),Ne(u,fc,c),F(c,Cm),F(c,pc),Ne(c,fc,c),F(c,mc,c);const d=Ne(t,hc,b0,{[p0]:!0});F(d,"#"),Ne(d,hc,d),F(d,yO,d);const h=F(d,bO);F(h,"#"),Ne(h,hc,d);const f=[[yn,o],[bn,i]],p=[[yn,null],[es,a],[bn,s]];for(let m=0;m<pa.length;m++)qn(t,pa[m],Fd,xn,f);for(let m=0;m<ma.length;m++)qn(t,ma[m],$d,Ld,p);Rr(Fd,{tld:!0,ascii:!0},e),Rr($d,{utld:!0,alpha:!0},e),qn(t,"file",ja,xn,f),qn(t,"mailto",ja,xn,f),qn(t,"http",wi,xn,f),qn(t,"https",wi,xn,f),qn(t,"ftp",wi,xn,f),qn(t,"ftps",wi,xn,f),Rr(ja,{scheme:!0,ascii:!0},e),Rr(wi,{slashscheme:!0,ascii:!0},e),n=n.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<n.length;m++){const g=n[m][0],v=n[m][1]?{[fO]:!0}:{[pO]:!0};g.indexOf("-")>=0?v[Dd]=!0:yn.test(g)?bn.test(g)?v[Js]=!0:v[Pd]=!0:v[Rd]=!0,Tm(t,g,g,v)}return Tm(t,"localhost",mo,{ascii:!0}),t.jd=new wt(Xl),{start:t,tokens:$i({groups:e},v0)}}function w0(n,e){const t=wO(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,l=null,u=0,c=null,d=-1,h=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(d=0,h=0,c=a):d>=0&&(d+=t[o].length,h++),u+=t[o].length,s+=t[o].length,o++;s-=d,o-=h,u-=d,i.push({t:c.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function wO(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function qn(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?s=n.j[l]:(s=new wt(r),s.jr=i.slice(),n.j[l]=s),n=s}return s=new wt(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function Em(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const go={defaultProtocol:"http",events:null,format:Mm,formatHref:Mm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sf(n,e=null){let t=$i({},go);n&&(t=$i(t,n instanceof Sf?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Sf.prototype={o:go,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:go[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Mm(n){return n}function k0(n,e){this.t="token",this.v=n,this.tk=e}k0.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=go.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),u=n.get("rel",t,e),c=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),u&&(o.rel=u),c&&$i(o,c),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Eu(n,e){class t extends k0{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Am=Eu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Om=Eu("text"),kO=Eu("nl"),ga=Eu("url",{isLink:!0,toHref(n=go.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==mo&&n[1].t===Qn}}),Pt=n=>new wt(n);function SO({groups:n}){const e=n.domain.concat([Bl,Ul,Gn,Hl,Vl,ql,jl,Wl,It,gf,Ys,Jl,Kl,Gl,Zt,Xl,Qs,Yl]),t=[zl,Qn,bf,Qt,vf,Ys,Xs,wf,kf,Ol,Nl,Ks,Gs,El,Cl,Ml,Al,_l,Rl,Pl,Il,Dl,Ll,Fl,$l],r=[Bl,zl,Ul,Hl,Vl,ql,jl,Wl,It,Ks,Gs,Ys,Jl,Kl,Gl,Xs,Zt,Xl,Qs,Yl],i=Pt(),s=F(i,Qs);ae(s,r,s),ae(s,n.domain,s);const o=Pt(),a=Pt(),l=Pt();ae(i,n.domain,o),ae(i,n.scheme,a),ae(i,n.slashscheme,l),ae(o,r,s),ae(o,n.domain,o);const u=F(o,Gn);F(s,Gn,u),F(a,Gn,u),F(l,Gn,u);const c=F(s,Qt);ae(c,r,s),ae(c,n.domain,s);const d=Pt();ae(u,n.domain,d),ae(d,n.domain,d);const h=F(d,Qt);ae(h,n.domain,d);const f=Pt(Am);ae(h,n.tld,f),ae(h,n.utld,f),F(u,mo,f);const p=F(d,It);F(p,It,p),ae(p,n.domain,d),ae(f,n.domain,d),F(f,Qt,h),F(f,It,p);const m=F(f,Qn);ae(m,n.numeric,Am);const g=F(o,It),y=F(o,Qt);F(g,It,g),ae(g,n.domain,o),ae(y,r,s),ae(y,n.domain,o);const v=Pt(ga);ae(y,n.tld,v),ae(y,n.utld,v),ae(v,n.domain,o),ae(v,r,s),F(v,Qt,y),F(v,It,g),F(v,Gn,u);const k=F(v,Qn),b=Pt(ga);ae(k,n.numeric,b);const x=Pt(ga),A=Pt();ae(x,e,x),ae(x,t,A),ae(A,e,x),ae(A,t,A),F(v,Zt,x),F(b,Zt,x);const O=F(a,Qn),_=F(l,Qn),I=F(_,Zt),$=F(I,Zt);ae(a,n.domain,o),F(a,Qt,y),F(a,It,g),ae(l,n.domain,o),F(l,Qt,y),F(l,It,g),ae(O,n.domain,x),F(O,Zt,x),F(O,Xs,x),ae($,n.domain,x),ae($,e,x),F($,Zt,x);const Y=[[Ks,Gs],[Cl,El],[Ml,Al],[Ol,Nl],[_l,Rl],[Pl,Il],[Dl,Ll],[Fl,$l]];for(let ie=0;ie<Y.length;ie++){const[P,oe]=Y[ie],ue=F(x,P);F(A,P,ue),F(ue,oe,x);const E=Pt(ga);ae(ue,e,E);const S=Pt();ae(ue,t),ae(E,e,E),ae(E,t,S),ae(S,e,E),ae(S,t,S),F(E,oe,x),F(S,oe,x)}return F(i,mo,v),F(i,yf,kO),{start:i,tokens:v0}}function xO(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,l=null,u=null,c=0,d=null,h=-1;for(;i<r&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(u=l||a.go(t[i].t));)l=null,a=u,a.accepts()?(h=0,d=a):h>=0&&h++,i++,c++;if(h<0)i-=c,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(gc(Om,e,o)),o=[]),i-=h,c-=h;const f=d.t,p=t.slice(i-c,i);s.push(gc(f,e,p))}}return o.length>0&&s.push(gc(Om,e,o)),s}function gc(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const TO=typeof console<"u"&&console&&console.warn||(()=>{}),CO="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ee={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function EO(){return wt.groups={},Ee.scanner=null,Ee.parser=null,Ee.tokenQueue=[],Ee.pluginQueue=[],Ee.customSchemes=[],Ee.initialized=!1,Ee}function Nm(n,e=!1){if(Ee.initialized&&TO(`linkifyjs: already initialized - will not register custom scheme "${n}" ${CO}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
87
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
88
|
-
2. Cannot start or end with "-"
|
|
89
|
-
3. "-" cannot repeat`);Ee.customSchemes.push([n,e])}function MO(){Ee.scanner=vO(Ee.customSchemes);for(let n=0;n<Ee.tokenQueue.length;n++)Ee.tokenQueue[n][1]({scanner:Ee.scanner});Ee.parser=SO(Ee.scanner.tokens);for(let n=0;n<Ee.pluginQueue.length;n++)Ee.pluginQueue[n][1]({scanner:Ee.scanner,parser:Ee.parser});return Ee.initialized=!0,Ee}function xf(n){return Ee.initialized||MO(),xO(Ee.parser.start,n,w0(Ee.scanner.start,n))}xf.scan=w0;function S0(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Sf(t),i=xf(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}function AO(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function OO(n){return new Ce({key:new Ae("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(u=>u.docChanged)&&!t.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=pv(t.doc,[...e]);if(Tv(a).forEach(({newRange:u})=>{const c=NC(r.doc,u,f=>f.isTextblock);let d,h;if(c.length>1?(d=c[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ")):c.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(d=c[0],h=r.doc.textBetween(d.pos,u.to,void 0," ")),d&&h){const f=h.split(" ").filter(y=>y!=="");if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=xf(p).map(y=>y.toObject(n.defaultProtocol));if(!AO(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{sf(y.from,y.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function NO(n){return new Ce({key:new Ae("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;const l=xv(e.state,n.type.name),u=r.target,c=(i=u?.href)!=null?i:l.href,d=(s=u?.target)!=null?s:l.target;return u&&c?(window.open(c,d),!0):!1}}})}function _O(n){return new Ce({key:new Ae("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=S0(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:n.editor.commands.setMark(n.type,{href:l.href})}}})}var RO=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function gr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(RO,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var x0=Vt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Nm(n);return}Nm(n.scheme,n.optionalSlashes)})},onDestroy(){EO()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!gr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!gr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!gr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ve(this.options.HTMLAttributes,n),0]:["a",ve(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!gr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!gr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Xr({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=S0(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!gr(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(OO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!gr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(NO({type:this.type})),this.options.linkOnPaste&&n.push(_O({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),PO=x0;const IO=x0.extend({name:"customLink",addOptions(){return{...this.parent?.(),openOnClick:!0,HTMLAttributes:{target:null,rel:"noopener noreferrer nofollow"}}},addAttributes(){return{href:{default:null},target:{default:null},class:{default:null}}},inclusive:!1,parseHTML(){return[{tag:"a[href]"}]},renderHTML({HTMLAttributes:n}){return["a",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{setCustomLink:()=>({commands:n})=>n.setMark(this.name),toggleCustomLink:()=>({commands:n})=>n.toggleMark(this.name),unsetCustomLink:()=>({commands:n})=>n.unsetMark(this.name)}}}),DO=Vt.create({name:"markText",parseHTML(){return[{tag:"mark"}]},renderHTML(){return["mark",{title:W.text.marked},0]},addCommands(){return{setMarkText:()=>({commands:n})=>n.setMark(this.name),toggleMarkText:()=>({commands:n})=>n.toggleMark(this.name),unsetMarkText:()=>({commands:n})=>n.unsetMark(this.name)}}}),LO=Ze.create({name:"insertHTML",inline:!1,attrs:{},group:"block",draggable:!0,parseHTML(){return[]},insertHTML:n=>(e,t)=>{const{selection:r}=(void 0).editor.state,i=document.createElement("div");i.innerHTML=n.trim();const s=Ti.fromSchema(e.schema).parseSlice(i),o=e.tr.insert(r.anchor,s.content);t(o)}}),FO=/(?:<o>)([^<o>]+)(?:<o>)$/,$O=/(?:<o>)([^<o>]+)(?:<o>)/g,T0=Vt.create({name:"obscure",parseHTML(){return[{tag:".u-obscure"},{tag:"dp-obscure"}]},renderHTML(){return["span",{class:"u-obscure"},0]},addCommands(){return{setObscure:()=>({commands:n})=>n.setMark(this.name),toggleObscure:()=>({commands:n})=>n.toggleMark(this.name),unsetObscure:()=>({commands:n})=>n.unsetMark(this.name)}},addInputRules(){return[Pi({find:FO,type:this.type})]},addPasteRules(){return[Xr({find:$O,type:this.type})]}}),BO=Vt.create({name:"unanonymize",parseHTML(){return[{tag:"span.unanonymized"}]},renderHTML:()=>["span",{class:"unanonymized"},0],addCommands(){return{toggleUnanonymize:()=>({commands:n})=>n.toggleMark(this.name)}}}),zO=Pe.create({name:"PreventEditing",addProseMirrorPlugins(){return[new Ce({key:new Ae("eventPreventer"),props:{handleClick(){return!0},handlePaste(){return!0},handleKeyDown(){return!0},handleDOMEvents:{drop(n,e){return e.preventDefault(),!0}}}})]}});var _m=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},UO=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,HO=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,VO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,qO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,jO=Vt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return _m("strong",{...ve(this.options.HTMLAttributes,n),children:_m("slot",{})})},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Pi({find:UO,type:this.type}),Pi({find:VO,type:this.type})]},addPasteRules(){return[Xr({find:HO,type:this.type}),Xr({find:qO,type:this.type})]}}),C0=jO,WO=Object.defineProperty,JO=(n,e)=>{for(var t in e)WO(n,t,{get:e[t],enumerable:!0})},KO="listItem",Rm="textStyle",Pm=/^\s*([-+*])\s$/,E0=Ze.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(KO,this.editor.getAttributes(Rm)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=ho({find:Pm,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ho({find:Pm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Rm),editor:this.editor})),[n]}}),M0=Ze.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ve(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),GO={};JO(GO,{findListItemPos:()=>Ho,getNextListDepth:()=>Tf,handleBackspace:()=>zd,handleDelete:()=>Ud,hasListBefore:()=>A0,hasListItemAfter:()=>YO,hasListItemBefore:()=>O0,listItemHasSubList:()=>N0,nextListIsDeeper:()=>_0,nextListIsHigher:()=>R0});var Ho=(n,e)=>{const{$from:t}=e.selection,r=$e(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Tf=(n,e)=>{const t=Ho(n,e);if(!t)return!1;const[,r]=BC(e,n,t.$pos.pos+4);return r},A0=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},O0=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},N0=(n,e,t)=>{if(!t)return!1;const r=$e(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},zd=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!dr(n.state,e)&&A0(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),u=[];l.node().descendants((h,f)=>{h.type.name===e&&u.push({node:h,pos:f})});const c=u.at(-1);if(!c)return!1;const d=n.state.doc.resolve(l.start()+c.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!dr(n.state,e)||!VC(n.state))return!1;const r=Ho(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=N0(e,n.state,s);return O0(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},_0=(n,e)=>{const t=Tf(n,e),r=Ho(n,e);return!r||!t?!1:t>r.depth},R0=(n,e)=>{const t=Tf(n,e),r=Ho(n,e);return!r||!t?!1:t<r.depth},Ud=(n,e)=>{if(!dr(n.state,e)||!HC(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:_0(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():R0(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},YO=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},XO=Pe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ud(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ud(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&zd(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&zd(n,t,r)&&(e=!0)}),e}}}}),QO="listItem",Im="textStyle",Dm=/^(\d+)\.\s$/,P0=Ze.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ve(this.options.HTMLAttributes,t),0]:["ol",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QO,this.editor.getAttributes(Im)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=ho({find:Dm,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ho({find:Dm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Im)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ZO=/^\s*(\[([( |x])?\])\s$/,eN=Ze.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ve(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:c}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const h=t();if(typeof h!="number")return!1;const f=d.doc.nodeAt(h);return d.setNodeMarkup(h,void 0,{...f?.attrs,checked:c}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,c)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,c])=>{i.setAttribute(u,c)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([u,c])=>{i.setAttribute(u,c)}),{dom:i,contentDOM:l,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[ho({find:ZO,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),tN=Ze.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ve(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Pe.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(E0.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(M0.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(XO.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(P0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(eN.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(tN.configure(this.options.taskList)),n}});var I0=E0,nN=Ze.create({name:"doc",topNode:!0,content:"block+"}),D0=nN,rN=Ze.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ve(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
90
|
-
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&o){const d=l.filter(h=>a.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),L0=rN,iN=Ze.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,ve(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>pM({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Hd=iN;function sN(n={}){return new Ce({view(e){return new oN(e,n)}})}class oN{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let u=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(u){let c=u.getBoundingClientRect(),d=a?c.bottom:c.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:c.left,right:c.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let a=i.getBoundingClientRect();s=a.left-i.scrollLeft,o=a.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=$y(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}class _e extends Z{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return _e.valid(r)?new _e(r):Z.near(r)}content(){return M.empty}eq(e){return e instanceof _e&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new _e(e.resolve(t.pos))}getBookmark(){return new Cf(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!aN(e)||!lN(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&_e.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(_e.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!G.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(_e.valid(a))return a}return null}}}_e.prototype.visible=!1;_e.findFrom=_e.findGapCursorFrom;Z.jsonID("gapcursor",_e);class Cf{constructor(e){this.pos=e}map(e){return new Cf(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return _e.valid(t)?new _e(t):Z.near(t)}}function aN(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function lN(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function uN(){return new Ce({props:{decorations:fN,createSelectionBetween(n,e,t){return e.pos==t.pos&&_e.valid(t)?new _e(t):null},handleClick:dN,handleKeyDown:cN,handleDOMEvents:{beforeinput:hN}}})}const cN=zh({ArrowLeft:ya("horiz",-1),ArrowRight:ya("horiz",1),ArrowUp:ya("vert",-1),ArrowDown:ya("vert",1)});function ya(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ee){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=_e.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new _e(u))),!0):!1}}function dN(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!_e.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&G.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new _e(r))),!0)}function hN(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof _e))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=C.empty;for(let o=r.length-1;o>=0;o--)i=C.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new M(i,0,0));return s.setSelection(ee.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function fN(n){if(!(n.selection instanceof _e))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[ze.widget(n.selection.head,e,{key:"gapcursor"})])}var Ql=200,We=function(){};We.prototype.append=function(e){return e.length?(e=We.from(e),!this.length&&e||e.length<Ql&&this.leafAppend(e)||this.length<Ql&&e.leafPrepend(this)||this.appendInner(e)):this};We.prototype.prepend=function(e){return e.length?We.from(e).append(this):this};We.prototype.appendInner=function(e){return new pN(this,e)};We.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?We.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};We.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};We.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};We.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};We.from=function(e){return e instanceof We?e:e&&e.length?new F0(e):We.empty};var F0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ql)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ql)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(We);We.empty=new F0([]);var pN=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(We);const mN=500;class Jt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new en(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],u.push(new en(p,void 0,void 0,u.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Jt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new en(e.mapping.maps[c],d,t),f;(f=l&&l.merge(h))&&(h=f,c?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(o++,t=void 0),i||(l=h)}let u=o-r.depth;return u>yN&&(a=gN(a,u),o-=u),new Jt(a.append(s),o)}remapping(e,t){let r=new Fy;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Jt(this.items.append(e.map(t=>new en(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(l+1,f));g&&a++,r.push(new en(p,m,g))}else r.push(new en(p))},i);let u=[];for(let h=t;h<o;h++)u.push(new en(s.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new Jt(c,a);return d.emptyItemCount()>mN&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),u=l&&l.getMap();if(r--,u&&t.appendMap(u,r),l){let c=o.selection&&o.selection.map(t.slice(r));c&&s++;let d=new en(u.invert(),l,c),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new Jt(We.from(i.reverse()),s)}}Jt.empty=new Jt(We.empty,0);function gN(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class en{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new en(t.getMap().invert(),t,this.selection)}}}class Yn{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const yN=20;function bN(n,e,t,r){let i=t.getMeta(Ur),s;if(i)return i.historyState;t.getMeta(kN)&&(n=new Yn(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Ur))return o.getMeta(Ur).redo?new Yn(n.done.addTransform(t,void 0,r,Wa(e)),n.undone,Lm(t.mapping.maps),n.prevTime,n.prevComposition):new Yn(n.done,n.undone.addTransform(t,void 0,r,Wa(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!vN(t,n.prevRanges)),u=o?yc(n.prevRanges,t.mapping):Lm(t.mapping.maps);return new Yn(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,Wa(e)),Jt.empty,u,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Yn(n.done.rebased(t,s),n.undone.rebased(t,s),yc(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Yn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),yc(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function vN(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Lm(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function yc(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function wN(n,e,t){let r=Wa(e),i=Ur.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Yn(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Ur,{redo:t,historyState:l})}let bc=!1,Fm=null;function Wa(n){let e=n.plugins;if(Fm!=e){bc=!1,Fm=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){bc=!0;break}}return bc}const Ur=new Ae("history"),kN=new Ae("closeHistory");function SN(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ce({key:Ur,state:{init(){return new Yn(Jt.empty,Jt.empty,null,0,-1)},apply(e,t,r){return bN(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?B0:r=="historyRedo"?z0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function $0(n,e){return(t,r)=>{let i=Ur.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=wN(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const B0=$0(!1,!0),z0=$0(!0,!0);Pe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Ce({key:new Ae("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,l);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,u=a-l,c=a;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});Pe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[sN(this.options)]}});Pe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ce({key:new Ae("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return Se.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,u)=>{if(l.isText)return;if(!(i>=u&&i<=u+l.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((l,u)=>{if(l.isText||!(i>=u&&i<=u+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(ze.node(u,u+l.nodeSize,{class:this.options.className}))}),Se.create(n,s)}}})]}});Pe.create({name:"gapCursor",addProseMirrorPlugins(){return[uN()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=fe(K(n,"allowGapCursor",t)))!=null?e:null}}});Pe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ce({key:new Ae("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,u=!o.isLeaf&&wu(o);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const d=ze.node(a,a+o.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Se.create(n,i)}}})]}});Pe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Ce({key:new Ae("selection"),props:{decorations(t){return t.selection.empty||n.isFocused?null:Se.create(t.doc,[ze.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function $m({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}Pe.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new Ae(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new Ce({key:n,appendTransaction:(t,r,i)=>{const{doc:s,tr:o,schema:a}=i,l=n.getState(i),u=s.content.size,c=a.nodes[this.options.node];if(l)return o.insert(u,c.create())},state:{init:(t,r)=>{const i=r.tr.doc.lastChild;return!$m({node:i,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const i=t.doc.lastChild;return!$m({node:i,types:e})}}})]}});var xN=Pe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>B0(n,e),redo:()=>({state:n,dispatch:e})=>z0(n,e)}},addProseMirrorPlugins(){return[SN(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),U0=xN,TN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,CN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,EN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,MN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,AN=Vt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Pi({find:TN,type:this.type}),Pi({find:EN,type:this.type})]},addPasteRules(){return[Xr({find:CN,type:this.type}),Xr({find:MN,type:this.type})]}}),H0=AN,V0=M0;function ON(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:a}=n,l=r&&!i,u=mM(t),c=new RegExp(`\\s${u}$`),d=o?"^":"",h=i?"":u,f=l?new RegExp(`${d}${u}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${d}(?:^)?${u}[^\\s${h}]*`,"gm"),p=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const m=a.pos-p.length,g=Array.from(p.matchAll(f)).pop();if(!g||g.input===void 0||g.index===void 0)return null;const y=g.input.slice(Math.max(0,g.index-1),g.index),v=new RegExp(`^[${s?.join("")}\0]?$`).test(y);if(s!==null&&!v)return null;const k=m+g.index;let b=k+g[0].length;return l&&c.test(p.slice(b-1,b+1))&&(g[0]+=" ",b+=1),k<a.pos&&b>=a.pos?{range:{from:k,to:b},query:g[0].slice(t.length),text:g[0]}:null}var NN=new Ae("suggestion");function _N({pluginKey:n=NN,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:c=()=>[],render:d=()=>({}),allow:h=()=>!0,findSuggestionMatch:f=ON}){let p;const m=d?.(),g=new Ce({key:n,view(){return{update:async(y,v)=>{var k,b,x,A,O,_,I;const $=(k=this.key)==null?void 0:k.getState(v),Y=(b=this.key)==null?void 0:b.getState(y.state),ie=$.active&&Y.active&&$.range.from!==Y.range.from,P=!$.active&&Y.active,oe=$.active&&!Y.active,ue=!P&&!oe&&$.query!==Y.query,E=P||ie&&ue,S=ue||ie,T=oe||ie&&ue;if(!E&&!S&&!T)return;const R=T&&!E?$:Y,L=y.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`);p={editor:e,range:R.range,query:R.query,text:R.text,items:[],command:D=>u({editor:e,range:R.range,props:D}),decorationNode:L,clientRect:L?()=>{var D;const{decorationId:J}=(D=this.key)==null?void 0:D.getState(e.state),se=y.dom.querySelector(`[data-decoration-id="${J}"]`);return se?.getBoundingClientRect()||null}:null},E&&((x=m?.onBeforeStart)==null||x.call(m,p)),S&&((A=m?.onBeforeUpdate)==null||A.call(m,p)),(S||E)&&(p.items=await c({editor:e,query:R.query})),T&&((O=m?.onExit)==null||O.call(m,p)),S&&((_=m?.onUpdate)==null||_.call(m,p)),E&&((I=m?.onStart)==null||I.call(m,p))},destroy:()=>{var y;p&&((y=m?.onExit)==null||y.call(m,p))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,v,k,b){const{isEditable:x}=e,{composing:A}=e.view,{selection:O}=y,{empty:_,from:I}=O,$={...v};if($.composing=A,x&&(_||e.view.composing)){(I<v.range.from||I>v.range.to)&&!A&&!v.composing&&($.active=!1);const Y=f({char:t,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:O.$from}),ie=`id_${Math.floor(Math.random()*4294967295)}`;Y&&h({editor:e,state:b,range:Y.range,isActive:v.active})?($.active=!0,$.decorationId=v.decorationId?v.decorationId:ie,$.range=Y.range,$.query=Y.query,$.text=Y.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(y,v){var k;const{active:b,range:x}=g.getState(y.state);return b&&((k=m?.onKeyDown)==null?void 0:k.call(m,{view:y,event:v,range:x}))||!1},decorations(y){const{active:v,range:k,decorationId:b}=g.getState(y);return v?Se.create(y.doc,[ze.inline(k.from,k.to,{nodeName:a,class:l,"data-decoration-id":b})]):null}}});return g}var RN=_N,PN=new Ae("mention"),Bm=Ze.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:n,node:e}){var t;return`${n.suggestion.char}${(t=e.attrs.label)!=null?t:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e}){var t;return["span",ve(this.HTMLAttributes,n.HTMLAttributes),`${n.suggestion.char}${(t=e.attrs.label)!=null?t:e.attrs.id}`]},suggestion:{char:"@",pluginKey:PN,command:({editor:n,range:e,props:t})=>{var r,i,s;const o=n.view.state.selection.$to.nodeAfter;((r=o?.text)==null?void 0:r.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:this.name,attrs:t},{type:"text",text:" "}]).run(),(s=(i=n.view.dom.ownerDocument.defaultView)==null?void 0:i.getSelection())==null||s.collapseToEnd()},allow:({state:n,range:e})=>{const t=n.doc.resolve(e.from),r=n.schema.nodes[this.name];return!!t.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",ve({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n})];const t={...this.options};t.HTMLAttributes=ve({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:t,node:n});return typeof r=="string"?["span",ve({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:n}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:n})):this.options.renderText({options:this.options,node:n})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:s}=r;return i?(e.doc.nodesBetween(s-1,s,(o,a)=>{if(o.type.name===this.name)return t=!0,n.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+o.nodeSize),!1}),t):!1})}},addProseMirrorPlugins(){return[RN({editor:this.editor,...this.options.suggestion})]}}),q0=P0,IN=Ze.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),j0=IN,DN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,LN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FN=Vt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Pi({find:DN,type:this.type})]},addPasteRules(){return[Xr({find:LN,type:this.type})]}}),$N=FN;const W0=65535,J0=Math.pow(2,16);function BN(n,e){return n+e*J0}function zm(n){return n&W0}function zN(n){return(n-(n&W0))/J0}const K0=1,G0=2,Ja=4,Y0=8;class Vd{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Y0)>0}get deletedBefore(){return(this.delInfo&(K0|Ja))>0}get deletedAfter(){return(this.delInfo&(G0|Ja))>0}get deletedAcross(){return(this.delInfo&Ja)>0}}class At{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&At.empty)return At.empty}recover(e){let t=0,r=zm(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+zN(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:c);if(r)return f;let p=e==(t<0?l:d)?null:BN(a/3,e-l),m=e==l?G0:e==d?K0:Ja;return(t<0?e!=l:e!=d)&&(m|=Y0),new Vd(f,m,p)}i+=c-u}return r?e+i:new Vd(e+i,0,null)}touches(e,t){let r=0,i=zm(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+r];e(a,a+u,l,l+c),s+=c-u}}invert(){return new At(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?At.empty:new At(e<0?[0,-e,0]:[0,0,e])}}At.empty=new At([]);class Zl{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Zl(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Zl;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Vd(e,i,null)}}const vc=Object.create(null);class at{getMap(){return At.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=vc[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in vc)throw new RangeError("Duplicate use of step JSON ID "+e);return vc[e]=t,t.prototype.jsonID=e,t}}class Fe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Fe(e,null)}static fail(e){return new Fe(null,e)}static fromReplace(e,t,r,i){try{return Fe.ok(e.replace(t,r,i))}catch(s){if(s instanceof qr)return Fe.fail(s.message);throw s}}}function Ef(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Ef(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return C.fromArray(r)}class nr extends at{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new M(Ef(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return Fe.fromReplace(e,this.from,this.to,s)}invert(){return new on(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new nr(t.pos,r.pos,this.mark)}merge(e){return e instanceof nr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new nr(t.from,t.to,e.markFromJSON(t.mark))}}at.jsonID("addMark",nr);class on extends at{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new M(Ef(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Fe.fromReplace(e,this.from,this.to,r)}invert(){return new nr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new on(t.pos,r.pos,this.mark)}merge(e){return e instanceof on&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new on(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new on(t.from,t.to,e.markFromJSON(t.mark))}}at.jsonID("removeMark",on);class rr extends at{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Fe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new rr(this.pos,t.marks[i]);return new rr(this.pos,this.mark)}}return new Zr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new rr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new rr(t.pos,e.markFromJSON(t.mark))}}at.jsonID("addNodeMark",rr);class Zr extends at{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Fe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new M(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new rr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Zr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Zr(t.pos,e.markFromJSON(t.mark))}}at.jsonID("removeNodeMark",Zr);class dt extends at{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&qd(e,this.from,this.to)?Fe.fail("Structure replace would overwrite content"):Fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new At([this.from,this.to-this.from,this.slice.size])}invert(e){return new dt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new dt(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof dt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new dt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new dt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new dt(t.from,t.to,M.fromJSON(e,t.slice),!!t.structure)}}at.jsonID("replace",dt);class un extends at{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(qd(e,this.from,this.gapFrom)||qd(e,this.gapTo,this.to)))return Fe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Fe.fromReplace(e,this.from,this.to,r):Fe.fail("Content does not fit in gap")}getMap(){return new At([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new un(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new un(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new un(t.from,t.to,t.gapFrom,t.gapTo,M.fromJSON(e,t.slice),t.insert,!!t.structure)}}at.jsonID("replaceAround",un);function qd(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function UN(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),f=Math.min(u+l.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new on(h,f,d[m])));a&&a.to==h?a.to=f:s.push(a=new nr(h,f,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function HN(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Vi){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,t);for(let c=0;c<l.length;c++){let d=l[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=u,h.step=s):i.push({style:d,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>n.step(new on(o.from,o.to,o.style)))}function Mf(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let u=s.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)o.push(new dt(a,c,M.empty));else{r=d;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new on(a,c,u.marks[h]));if(i&&u.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(u.text);)p||(p=new M(C.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new dt(a+h.index,a+h.index+h[0].length,p))}}a=c}if(!r.validEnd){let l=r.fillBefore(C.empty,!0);n.replace(a,a,new M(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function VN(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,u=a,c=C.empty,d=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,c=C.from(r.node(p).copy(c)),d++):l--;let h=C.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=C.from(i.node(p).copy(h)),f++):u++;n.step(new un(l,u,o,a,new M(c.append(h),d,f),c.size-d,!0))}function qN(n,e,t){let r=C.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new un(i,s,i,s,new M(r,0,0),t.length,!0))}function jN(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&WN(n.doc,n.mapping.slice(s).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?u=!1:!f&&p&&(u=!0)}u===!1&&Q0(n,o,a,s),Mf(n,n.mapping.slice(s).map(a,1),r,void 0,u===null);let c=n.mapping.slice(s),d=c.map(a,1),h=c.map(a+o.nodeSize,1);return n.step(new un(d,h,d+1,h-1,new M(C.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&X0(n,o,a,s),!1}})}function X0(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Q0(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
91
|
-
`))}})}function WN(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function JN(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new un(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(C.from(o),0,0),1,!0))}function KN(n,e,t=1,r){let i=n.doc.resolve(e),s=C.empty,o=C.empty;for(let a=i.depth,l=i.depth-t,u=t-1;a>l;a--,u--){s=C.from(i.node(a).copy(s));let c=r&&r[u];o=C.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}n.step(new dt(e,e,new M(s.append(o),t,t),!0))}function GN(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=n.steps.length;if(r===!1){let c=n.doc.resolve(e+t);Q0(n,c.node(),c.before(),a)}o.inlineContent&&Mf(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),u=l.map(e-t);if(n.step(new dt(u,l.map(e+t,-1),M.empty,!0)),r===!0){let c=n.doc.resolve(u);X0(n,c.node(),c.before(),n.steps.length)}return n}function YN(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function XN(n,e,t=e,r=M.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Z0(i,s,r)?new dt(e,t,r):new QN(i,s,r).fit()}function Z0(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class QN{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new M(s,o,a);return e>-1?new un(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new dt(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=wc(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(t==1&&(o?u.matchType(o.type)||(d=u.fillBefore(C.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=wc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=wc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new M(Ls(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new M(Ls(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(ew(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?f:-1)))}let p=u==a.childCount;p||(f=-1),this.placed=Fs(this.placed,t,C.from(c)),this.frontier[t].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?M.empty:new M(Ls(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new M(Ls(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!kc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=kc(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=kc(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Fs(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Fs(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=Fs(this.placed,this.frontier.length,t))}}function Ls(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ls(n.firstChild.content,e-1,t)))}function Fs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Fs(n.lastChild.content,e-1,t)))}function wc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ew(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ew(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),n.copy(r)}function kc(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!ZN(t,s.content,o)?a:null}function ZN(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function e_(n){return n.spec.defining||n.spec.definingForContent}function t_(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Z0(i,s,r))return n.step(new dt(e,t,r));let o=nw(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),u=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(u.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=u[h],p=e_(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=u[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let v=i.node(g-1),k=i.index(g-1);if(v.canReplaceWith(k,k,p.type,p.marks))return n.replace(i.before(g),y?s.after(g):t,new M(tw(r.content,0,r.openStart,f),f,r.openEnd))}}let d=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function tw(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(tw(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(C.empty,!0))}return n}function n_(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=YN(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new M(C.from(r),0,0))}function r_(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=nw(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function nw(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Ei extends at{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Fe.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Fe.fromReplace(e,this.pos,this.pos+1,new M(C.from(i),0,t.isLeaf?0:1))}getMap(){return At.empty}invert(e){return new Ei(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ei(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ei(t.pos,t.attr,t.value)}}at.jsonID("attr",Ei);class yo extends at{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Fe.ok(r)}getMap(){return At.empty}invert(e){return new yo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yo(t.attr,t.value)}}at.jsonID("docAttr",yo);let Bi=class extends Error{};Bi=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Bi.prototype=Object.create(Error.prototype);Bi.prototype.constructor=Bi;Bi.prototype.name="TransformError";class i_{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Bi(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=M.empty){let i=XN(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new M(C.from(r),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return t_(this,e,t,r),this}replaceRangeWith(e,t,r){return n_(this,e,t,r),this}deleteRange(e,t){return r_(this,e,t),this}lift(e,t){return VN(this,e,t),this}join(e,t=1){return GN(this,e,t),this}wrap(e,t){return qN(this,e,t),this}setBlockType(e,t=e,r,i=null){return jN(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return JN(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ei(e,t,r)),this}setDocAttribute(e,t){return this.step(new yo(e,t)),this}addNodeMark(e,t){return this.step(new rr(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof ge)t.isInSet(r.marks)&&this.step(new Zr(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Zr(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return KN(this,e,t,r),this}addMark(e,t,r){return UN(this,e,t,r),this}removeMark(e,t,r){return HN(this,e,t,r),this}clearIncompatible(e,t,r){return Mf(this,e,t,r),this}}var jd,Wd;if(typeof WeakMap<"u"){let n=new WeakMap;jd=e=>n.get(e),Wd=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;jd=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Wd=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Re=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[s*this.width+(t<0?r-1:i)]:(t<0?s==0:o==this.height)?null:this.map[r+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:s}=this.findCell(n),{left:o,right:a,top:l,bottom:u}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(s,u)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const s=r*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==n.left&&i&&this.map[s-1]==o||r==n.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const s=i+t.child(r).nodeSize;if(r==n){let o=e+n*this.width;const a=(n+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(n){return jd(n)||Wd(n,s_(n))}};function s_(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=o_(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let u=0,c=e*t;u<c;u++)r[u]=0;for(let u=0,c=0;u<t;u++){const d=n.child(u);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:y,colwidth:v}=m.attrs;for(let k=0;k<y;k++){if(k+u>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:y-k});break}const b=i+k*e;for(let x=0;x<g;x++){r[b+x]==0?r[b+x]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:g-x});const A=v&&v[x];if(A){const O=(b+x)%e*2,_=o[O];_==null||_!=A&&o[O+1]==1?(o[O]=A,o[O+1]=1):_==A&&o[O+1]++}}}i+=g,c+=m.nodeSize}const h=(u+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:u,n:f}),c++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Re(e,t,r,s);let l=!1;for(let u=0;!l&&u<o.length;u+=2)o[u]!=null&&o[u+1]<t&&(l=!0);return l&&a_(a,o,n),a}function o_(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const a=n.child(o);for(let l=0;l<a.childCount;l++){const u=a.child(l);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function a_(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let u=0;u<l.colspan;u++){const c=(i+u)%n.width,d=e[c*2];d!=null&&(!l.colwidth||l.colwidth[u]!=d)&&((a||(a=l_(l)))[u]=d)}a&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function l_(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function rt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var Zn=new Ae("selectingCells");function ji(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function u_(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Xt(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Mu(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=ji(e.$head)||c_(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function c_(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Jd(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function d_(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Af(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function rw(n,e,t){const r=n.node(-1),i=Re.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function ei(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function iw(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function h_(n,e,t){const r=rt(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var Te=class Tn extends Z{constructor(e,t=e){const r=e.node(-1),i=Re.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(c=>c!=t.pos-s);l.unshift(t.pos-s);const u=l.map(c=>{const d=r.nodeAt(c);if(!d)throw RangeError(`No cell with offset ${c} found`);const h=s+c+1;return new jy(a.resolve(h),a.resolve(h+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Jd(r)&&Jd(i)&&Af(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Tn.rowSelection(r,i):s&&this.isColSelection()?Tn.colSelection(r,i):new Tn(r,i)}return ee.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=Re.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let l=i.top;l<i.bottom;l++){const u=[];for(let c=l*t.width+i.left,d=i.left;d<i.right;d++,c++){const h=t.map[c];if(s[h])continue;s[h]=!0;const f=t.findCell(h);let p=e.nodeAt(h);if(!p)throw RangeError(`No cell with offset ${h} found`);const m=i.left-f.left,g=f.right-i.right;if(m>0||g>0){let y=p.attrs;if(m>0&&(y=ei(y,0,m)),g>0&&(y=ei(y,y.colspan-g,g)),f.left<i.left){if(p=p.type.createAndFill(y),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(f.top<i.top||f.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}u.push(p)}o.push(e.child(l).copy(C.from(u)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new M(C.from(a),1,1)}replace(e,t=M.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],u=e.mapping.slice(r);e.replace(u.map(a.pos),u.map(l.pos),o?M.empty:t)}const s=Z.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new M(C.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Re.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=Re.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Tn(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Re.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof Tn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=Re.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new Tn(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Tn(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Tn(e.resolve(t),e.resolve(r))}getBookmark(){return new f_(this.$anchorCell.pos,this.$headCell.pos)}};Te.prototype.visible=!1;Z.jsonID("cell",Te);var f_=class sw{constructor(e,t){this.anchor=e,this.head=t}map(e){return new sw(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Af(t,r)?new Te(t,r):Z.near(r,1)}};function p_(n){if(!(n.selection instanceof Te))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(ze.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Se.create(n.doc,e)}function m_({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function g_({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const s=n.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function y_(n,e,t){const r=(e||n).selection,i=(e||n).doc;let s,o;if(r instanceof G&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Te.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=Te.rowSelection(a,a)}else if(!t){const a=Re.get(r.node),l=r.from+1,u=l+a.map[a.width*a.height-1];s=Te.create(i,l+1,u)}}else r instanceof ee&&m_(r)?s=ee.create(i,r.from):r instanceof ee&&g_(r)&&(s=ee.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var b_=new Ae("fix-tables");function ow(n,e,t,r){const i=n.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const l=e.child(o);for(let u=a,c=Math.min(i,o+3);u<c;u++)if(n.child(u)==l){a=u+1,t+=l.nodeSize;continue e}r(l,t),a<i&&n.child(a).sameMarkup(l)?ow(n.child(a),l,t+1,r):l.nodesBetween(0,l.content.size,r,t+1),t+=l.nodeSize}}function aw(n,e){let t;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(t=v_(n,i,s,t))};return e?e.doc!=n.doc&&ow(e.doc,n.doc,0,r):n.doc.descendants(r),t}function v_(n,e,t,r){const i=Re.get(e);if(!i.problems)return r;r||(r=n.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const u=i.problems[l];if(u.type=="collision"){const c=e.nodeAt(u.pos);if(!c)continue;const d=c.attrs;for(let h=0;h<d.rowspan;h++)s[u.row+h]+=u.n;r.setNodeMarkup(r.mapping.map(t+1+u.pos),null,ei(d,d.colspan-u.n,u.n))}else if(u.type=="missing")s[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(t+1+u.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(t+1+u.pos),null,{...c.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const c=r.mapping.map(t);r.delete(c,c+e.nodeSize)}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,u=t+1;l<i.height;l++){const c=e.child(l),d=u+c.nodeSize,h=s[l];if(h>0){let f="cell";c.firstChild&&(f=c.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const y=rt(n.schema)[f].createAndFill();y&&p.push(y)}const m=(l==0||o==l-1)&&a==l?u+1:d-1;r.insert(r.mapping.map(m),p)}u=d}return r.setMeta(b_,{fixTables:!0})}function fn(n){const e=n.selection,t=Mu(n),r=t.node(-1),i=t.start(-1),s=Re.get(r);return{...e instanceof Te?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}function lw(n,{map:e,tableStart:t,table:r},i){let s=i>0?-1:0;h_(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],u=r.nodeAt(l);n.setNodeMarkup(n.mapping.map(t+l),null,iw(u.attrs,i-e.colCount(l))),o+=u.attrs.rowspan-1}else{const l=s==null?rt(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,u=e.positionAt(o,i,r);n.insert(n.mapping.map(t+u),l.createAndFill())}}return n}function w_(n,e){if(!Xt(n))return!1;if(e){const t=fn(n);e(lw(n.tr,t,t.left))}return!0}function k_(n,e){if(!Xt(n))return!1;if(e){const t=fn(n);e(lw(n.tr,t,t.right))}return!0}function S_(n,{map:e,table:t,tableStart:r},i){const s=n.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,l=e.map[a],u=t.nodeAt(l),c=u.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)n.setNodeMarkup(n.mapping.slice(s).map(r+l),null,ei(c,i-e.colCount(l)));else{const d=n.mapping.slice(s).map(r+l);n.delete(d,d+u.nodeSize)}o+=c.rowspan}}function x_(n,e){if(!Xt(n))return!1;if(e){const t=fn(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;S_(r,t,i),i!=t.left;i--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=Re.get(s)}e(r)}return!0}function T_(n,e,t){var r;const i=rt(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(((r=e.nodeAt(n.map[s+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function uw(n,{map:e,tableStart:t,table:r},i){var s;let o=t;for(let u=0;u<i;u++)o+=r.child(u).nodeSize;const a=[];let l=i>0?-1:0;T_(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let u=0,c=e.width*i;u<e.width;u++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],h=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...h,rowspan:h.rowspan+1}),u+=h.colspan-1}else{const d=l==null?rt(r.type.schema).cell:(s=r.nodeAt(e.map[c+l*e.width]))==null?void 0:s.type,h=d?.createAndFill();h&&a.push(h)}return n.insert(o,rt(r.type.schema).row.create(null,a)),n}function C_(n,e){if(!Xt(n))return!1;if(e){const t=fn(n);e(uw(n.tr,t,t.top))}return!0}function E_(n,e){if(!Xt(n))return!1;if(e){const t=fn(n);e(uw(n.tr,t,t.bottom))}return!0}function M_(n,{map:e,table:t,tableStart:r},i){let s=0;for(let u=0;u<i;u++)s+=t.child(u).nodeSize;const o=s+t.child(i).nodeSize,a=n.mapping.maps.length;n.delete(s+r,o+r);const l=new Set;for(let u=0,c=i*e.width;u<e.width;u++,c++){const d=e.map[c];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[c-e.width]){const h=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),u+=h.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const h=t.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),m=e.positionAt(i+1,u,t);n.insert(n.mapping.slice(a).map(r+m),p),u+=f.colspan-1}}}}function A_(n,e){if(!Xt(n))return!1;if(e){const t=fn(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;M_(r,t,i),i!=t.top;i--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=Re.get(t.table)}e(r)}return!0}function Um(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function O_({width:n,height:e,map:t},r){let i=r.top*n+r.left,s=i,o=(r.bottom-1)*n+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&t[s]==t[s-1]||r.right<n&&t[a]==t[a+1])return!0;s+=n,a+=n}for(let l=r.left;l<r.right;l++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[o]==t[o+n])return!0;i++,o++}return!1}function Hm(n,e){const t=n.selection;if(!(t instanceof Te)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=fn(n),{map:i}=r;if(O_(i,r))return!1;if(e){const s=n.tr,o={};let a=C.empty,l,u;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const h=i.map[c*i.width+d],f=r.table.nodeAt(h);if(!(o[h]||!f))if(o[h]=!0,l==null)l=h,u=f;else{Um(f)||(a=a.append(f.content));const p=s.mapping.map(h+r.tableStart);s.delete(p,p+f.nodeSize)}}if(l==null||u==null)return!0;if(s.setNodeMarkup(l+r.tableStart,null,{...iw(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const c=l+1+u.content.size,d=Um(u)?l+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,a)}s.setSelection(new Te(s.doc.resolve(l+r.tableStart))),e(s)}return!0}function Vm(n,e){const t=rt(n.schema);return N_(({node:r})=>t[r.type.spec.tableRole])(n,e)}function N_(n){return(e,t)=>{var r;const i=e.selection;let s,o;if(i instanceof Te){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(s=u_(i.$from),!s)return!1;o=(r=ji(i.$from))==null?void 0:r.pos}if(s==null||o==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let a=s.attrs;const l=[],u=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=fn(e),d=e.tr;for(let f=0;f<c.right-c.left;f++)l.push(u?{...a,colwidth:u&&u[f]?[u[f]]:null}:a);let h;for(let f=c.top;f<c.bottom;f++){let p=c.map.positionAt(f,c.left,c.table);f==c.top&&(p+=s.nodeSize);for(let m=c.left,g=0;m<c.right;m++,g++)m==c.left&&f==c.top||d.insert(h=d.mapping.map(p+c.tableStart,1),n({node:s,row:f,col:m}).createAndFill(l[g]))}d.setNodeMarkup(o,n({node:s,row:c.top,col:c.left}),l[0]),i instanceof Te&&d.setSelection(new Te(d.doc.resolve(i.$anchorCell.pos),h?d.doc.resolve(h):void 0)),t(d)}return!0}}function __(n,e){return function(t,r){if(!Xt(t))return!1;const i=Mu(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const s=t.tr;t.selection instanceof Te?t.selection.forEachCell((o,a)=>{o.attrs[n]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function R_(n){return function(e,t){if(!Xt(e))return!1;if(t){const r=rt(e.schema),i=fn(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[l],r.cell,a[l].attrs);if(s.steps.length==0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],r.header_cell,a[l].attrs);t(s)}return!0}}function qm(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function bo(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?R_(n):function(t,r){if(!Xt(t))return!1;if(r){const i=rt(t.schema),s=fn(t),o=t.tr,a=qm("row",s,i),l=qm("column",s,i),c=(n==="column"?a:n==="row"?l:!1)?1:0,d=n=="column"?{left:0,top:c,right:1,bottom:s.map.height}:n=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,h=n=="column"?l?i.cell:i.header_cell:n=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(d).forEach(f=>{const p=f+s.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,h,m.attrs)}),r(o)}return!0}}bo("row",{useDeprecatedLogic:!0});bo("column",{useDeprecatedLogic:!0});var P_=bo("cell",{useDeprecatedLogic:!0});function I_(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const s=n.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const s=t.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function jm(n){return function(e,t){if(!Xt(e))return!1;const r=I_(Mu(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(ee.between(i,d_(i))).scrollIntoView())}return!0}}function D_(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function ba(n,e){const t=n.selection;if(!(t instanceof Te))return!1;if(e){const r=n.tr,i=rt(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new M(i,0,0))}),r.docChanged&&e(r)}return!0}function L_(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let u=e.child(l).content;const c=l?0:Math.max(0,t-1),d=l<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(u=Kd(rt(o).row,new M(u,c,d)).content),a.push(u)}else if(s=="cell"||s=="header_cell")a.push(t||r?Kd(rt(o).row,new M(e,t,r)).content:e);else return null;return F_(o,a)}function F_(n,e){const t=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let u=i;u<i+a;u++)t[u]=(t[u]||0)+l}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(C.empty),t[i]<r){const s=rt(n).cell.createAndFill(),o=[];for(let a=t[i];a<r;a++)o.push(s);e[i]=e[i].append(C.from(o))}return{height:e.length,width:r,rows:e}}function Kd(n,e){const t=n.createAndFill();return new i_(t).replace(0,t.content.size,e).doc}function $_({width:n,height:e,rows:t},r,i){if(n!=r){const s=[],o=[];for(let a=0;a<t.length;a++){const l=t[a],u=[];for(let c=s[a]||0,d=0;c<r;d++){let h=l.child(d%l.childCount);c+h.attrs.colspan>r&&(h=h.type.createChecked(ei(h.attrs,h.attrs.colspan,c+h.attrs.colspan-r),h.content)),u.push(h),c+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(C.from(u))}t=o,n=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const l=[],u=t[a%e];for(let c=0;c<u.childCount;c++){let d=u.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(C.from(l))}t=s,e=i}return{width:n,height:e,rows:t}}function B_(n,e,t,r,i,s,o){const a=n.doc.type.schema,l=rt(a);let u,c;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=t.child(d);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==l.cell?m=u||(u=l.cell.createAndFill()):m=c||(c=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);n.insert(n.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==l.header_cell;d.push(g?c||(c=l.header_cell.createAndFill()):u||(u=l.cell.createAndFill()))}const h=l.row.create(null,C.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),f)}return!!(u||c)}function Wm(n,e,t,r,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let u=i;u<s;u++){const c=o*e.width+u,d=e.map[c];if(e.map[c-e.width]==d){l=!0;const h=t.nodeAt(d),{top:f,left:p}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-f}),n.insert(n.mapping.slice(a).map(e.positionAt(o,p,t)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),u+=h.attrs.colspan-1}}return l}function Jm(n,e,t,r,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let u=i;u<s;u++){const c=u*e.width+o,d=e.map[c];if(e.map[c-1]==d){l=!0;const h=t.nodeAt(d),f=e.colCount(d),p=n.mapping.slice(a).map(d+r);n.setNodeMarkup(p,null,ei(h.attrs,o-f,h.attrs.colspan-(o-f))),n.insert(p+h.nodeSize,h.type.createAndFill(ei(h.attrs,0,o-f))),u+=h.attrs.rowspan-1}}return l}function Km(n,e,t,r,i){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let o=Re.get(s);const{top:a,left:l}=r,u=l+i.width,c=a+i.height,d=n.tr;let h=0;function f(){if(s=t?d.doc.nodeAt(t-1):d.doc,!s)throw new Error("No table found");o=Re.get(s),h=d.mapping.maps.length}B_(d,o,s,t,u,c,h)&&f(),Wm(d,o,s,t,l,u,a,h)&&f(),Wm(d,o,s,t,l,u,c,h)&&f(),Jm(d,o,s,t,a,c,l,h)&&f(),Jm(d,o,s,t,a,c,u,h)&&f();for(let p=a;p<c;p++){const m=o.positionAt(p,l,s),g=o.positionAt(p,u,s);d.replace(d.mapping.slice(h).map(m+t),d.mapping.slice(h).map(g+t),new M(i.rows[p-a],0,0))}f(),d.setSelection(new Te(d.doc.resolve(t+o.positionAt(a,l,s)),d.doc.resolve(t+o.positionAt(c-1,u-1,s)))),e(d)}var z_=zh({ArrowLeft:va("horiz",-1),ArrowRight:va("horiz",1),ArrowUp:va("vert",-1),ArrowDown:va("vert",1),"Shift-ArrowLeft":wa("horiz",-1),"Shift-ArrowRight":wa("horiz",1),"Shift-ArrowUp":wa("vert",-1),"Shift-ArrowDown":wa("vert",1),Backspace:ba,"Mod-Backspace":ba,Delete:ba,"Mod-Delete":ba});function Ka(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function va(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof Te)return Ka(t,r,Z.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=cw(i,n,e);if(o==null)return!1;if(n=="horiz")return Ka(t,r,Z.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=rw(a,n,e);let u;return l?u=Z.near(l,1):e<0?u=Z.near(t.doc.resolve(a.before(-1)),-1):u=Z.near(t.doc.resolve(a.after(-1)),1),Ka(t,r,u)}}}function wa(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof Te)o=s;else{const l=cw(i,n,e);if(l==null)return!1;o=new Te(t.doc.resolve(l))}const a=rw(o.$headCell,n,e);return a?Ka(t,r,new Te(o.$anchorCell,a)):!1}}function U_(n,e){const t=n.state.doc,r=ji(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new Te(r))),!0):!1}function H_(n,e,t){if(!Xt(n.state))return!1;let r=L_(t);const i=n.state.selection;if(i instanceof Te){r||(r={width:1,height:1,rows:[C.from(Kd(rt(n.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Re.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=$_(r,a.right-a.left,a.bottom-a.top),Km(n.state,n.dispatch,o,a,r),!0}else if(r){const s=Mu(n.state),o=s.start(-1);return Km(n.state,n.dispatch,o,Re.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function V_(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Gm(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof Te)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=ji(n.state.selection.$anchor))!=null&&((t=Sc(n,e))==null?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,u){let c=Sc(n,u);const d=Zn.getState(n.state)==null;if(!c||!Af(l,c))if(d)c=l;else return;const h=new Te(l,c);if(d||!n.state.selection.eq(h)){const f=n.state.tr.setSelection(h);d&&f.setMeta(Zn,l.pos),n.dispatch(f)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",a),Zn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Zn,-1))}function a(l){const u=l,c=Zn.getState(n.state);let d;if(c!=null)d=n.state.doc.resolve(c);else if(Gm(n,u.target)!=r&&(d=Sc(n,e),!d))return o();d&&s(d,u)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",a)}function cw(n,e,t){if(!(n.state.selection instanceof ee))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(i),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function Gm(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Sc(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?ji(n.state.doc.resolve(t.pos)):null}var q_=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Gd(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Gd(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Gd(n,e,t,r,i,s){var o;let a=0,l=!0,u=e.firstChild;const c=n.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let m=0;m<f;m++,h++){const g=i==h?s:p&&p[m],y=g?g+"px":"";if(a+=g||r,g||(l=!1),u)u.style.width!=y&&(u.style.width=y),u=u.nextSibling;else{const v=document.createElement("col");v.style.width=y,e.appendChild(v)}}}for(;u;){const d=u.nextSibling;(o=u.parentNode)==null||o.removeChild(u),u=d}l?(t.style.width=a+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=a+"px")}}var Ot=new Ae("tableColumnResizing");function j_({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=q_,lastColumnResizable:i=!0}={}){const s=new Ce({key:Ot,state:{init(o,a){var l,u;const c=(u=(l=s.spec)==null?void 0:l.props)==null?void 0:u.nodeViews,d=rt(a.schema).table.name;return r&&c&&(c[d]=(h,f)=>new r(h,t,f)),new W_(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=Ot.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{J_(o,a,n,i)},mouseleave:o=>{K_(o)},mousedown:(o,a)=>{G_(o,a,e,t)}},decorations:o=>{const a=Ot.getState(o);if(a&&a.activeHandle>-1)return eR(o,a.activeHandle)},nodeViews:{}}});return s}var W_=class Ga{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ot);if(r&&r.setHandle!=null)return new Ga(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ga(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Jd(e.doc.resolve(i))||(i=-1),new Ga(i,t.dragging)}return t}};function J_(n,e,t,r){if(!n.editable)return;const i=Ot.getState(n.state);if(i&&!i.dragging){const s=X_(e.target);let o=-1;if(s){const{left:a,right:l}=s.getBoundingClientRect();e.clientX-a<=t?o=Ym(n,e,"left",t):l-e.clientX<=t&&(o=Ym(n,e,"right",t))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=n.state.doc.resolve(o),l=a.node(-1),u=Re.get(l),c=a.start(-1);if(u.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==u.width-1)return}dw(n,o)}}}function K_(n){if(!n.editable)return;const e=Ot.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&dw(n,-1)}function G_(n,e,t,r){var i;if(!n.editable)return!1;const s=(i=n.dom.ownerDocument.defaultView)!=null?i:window,o=Ot.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=n.state.doc.nodeAt(o.activeHandle),l=Y_(n,o.activeHandle,a.attrs);n.dispatch(n.state.tr.setMeta(Ot,{setDragging:{startX:e.clientX,startWidth:l}}));function u(d){s.removeEventListener("mouseup",u),s.removeEventListener("mousemove",c);const h=Ot.getState(n.state);h?.dragging&&(Q_(n,h.activeHandle,Xm(h.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Ot,{setDragging:null})))}function c(d){if(!d.which)return u(d);const h=Ot.getState(n.state);if(h&&h.dragging){const f=Xm(h.dragging,d,t);Qm(n,h.activeHandle,f,r)}}return Qm(n,o.activeHandle,l,r),s.addEventListener("mouseup",u),s.addEventListener("mousemove",c),e.preventDefault(),!0}function Y_(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=n.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,l=t;if(r)for(let u=0;u<t;u++)r[u]&&(a-=r[u],l--);return a/l}function X_(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Ym(n,e,t,r){const i=t=="right"?-r:r,s=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=ji(n.state.doc.resolve(o));if(!a)return-1;if(t=="right")return a.pos;const l=Re.get(a.node(-1)),u=a.start(-1),c=l.map.indexOf(a.pos-u);return c%l.width==0?-1:u+l.map[c-1]}function Xm(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function dw(n,e){n.dispatch(n.state.tr.setMeta(Ot,{setHandle:e}))}function Q_(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),s=Re.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=n.state.tr;for(let u=0;u<s.height;u++){const c=u*s.width+a;if(u&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==t)continue;const p=h.colwidth?h.colwidth.slice():Z_(h.colspan);p[f]=t,l.setNodeMarkup(o+d,null,{...h,colwidth:p})}l.docChanged&&n.dispatch(l)}function Qm(n,e,t,r){const i=n.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=Re.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=n.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Gd(s,l.firstChild,l,r,a,t)}function Z_(n){return Array(n).fill(0)}function eR(n,e){var t;const r=[],i=n.doc.resolve(e),s=i.node(-1);if(!s)return Se.empty;const o=Re.get(s),a=i.start(-1),l=o.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let u=0;u<o.height;u++){const c=l+u*o.width;if((l==o.width-1||o.map[c]!=o.map[c+1])&&(u==0||o.map[c]!=o.map[c-o.width])){const d=o.map[c],h=a+d+s.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(t=Ot.getState(n))!=null&&t.dragging&&r.push(ze.node(a+d,a+d+s.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(ze.widget(h,f))}}return Se.create(n.doc,r)}function tR({allowTableNodeSelection:n=!1}={}){return new Ce({key:Zn,state:{init(){return null},apply(e,t){const r=e.getMeta(Zn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:p_,handleDOMEvents:{mousedown:V_},createSelectionBetween(e){return Zn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:U_,handleKeyDown:z_,handlePaste:H_},appendTransaction(e,t,r){return y_(r,aw(r,t),n)}})}var hw=Ze.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",ve(this.options.HTMLAttributes,n),0]}}),fw=Ze.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",ve(this.options.HTMLAttributes,n),0]}}),pw=Ze.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",ve(this.options.HTMLAttributes,n),0]}});function Yd(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Zm(n,e,t,r,i,s){var o;let a=0,l=!0,u=e.firstChild;const c=n.firstChild;if(c!==null)for(let d=0,h=0;d<c.childCount;d+=1){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=i===h?s:p&&p[m],y=g?`${g}px`:"";if(a+=g||r,g||(l=!1),u){if(u.style.width!==y){const[v,k]=Yd(r,g);u.style.setProperty(v,k)}u=u.nextSibling}else{const v=document.createElement("col"),[k,b]=Yd(r,g);v.style.setProperty(k,b),e.appendChild(v)}}}for(;u;){const d=u.nextSibling;(o=u.parentNode)==null||o.removeChild(u),u=d}l?(t.style.width=`${a}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${a}px`)}var nR=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Zm(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,Zm(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){return n.type==="attributes"&&(n.target===this.table||this.colgroup.contains(n.target))}};function rR(n,e,t,r){let i=0,s=!0;const o=[],a=n.firstChild;if(!a)return{};for(let d=0,h=0;d<a.childCount;d+=1){const{colspan:f,colwidth:p}=a.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=t===h?r:p&&p[m];i+=g||e,g||(s=!1);const[y,v]=Yd(e,g);o.push(["col",{style:`${y}: ${v}`}])}}const l=s?`${i}px`:"",u=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:l,tableMinWidth:u}}function eg(n,e){return n.createAndFill()}function iR(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function sR(n,e,t,r,i){const s=iR(n),o=[],a=[];for(let u=0;u<t;u+=1){const c=eg(s.cell);if(c&&a.push(c),r){const d=eg(s.header_cell);d&&o.push(d)}}const l=[];for(let u=0;u<e;u+=1)l.push(s.row.createChecked(null,r&&u===0?o:a));return s.table.createChecked(null,l)}function oR(n){return n instanceof Te}var ka=({editor:n})=>{const{selection:e}=n.state;if(!oR(e))return!1;let t=0;const r=gv(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},mw=Ze.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:nR,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:i}=rR(n,this.options.cellMinWidth);return["table",ve(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=sR(s.schema,n,e,t);if(i){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(ee.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>w_(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>k_(n,e),deleteColumn:()=>({state:n,dispatch:e})=>x_(n,e),addRowBefore:()=>({state:n,dispatch:e})=>C_(n,e),addRowAfter:()=>({state:n,dispatch:e})=>E_(n,e),deleteRow:()=>({state:n,dispatch:e})=>A_(n,e),deleteTable:()=>({state:n,dispatch:e})=>D_(n,e),mergeCells:()=>({state:n,dispatch:e})=>Hm(n,e),splitCell:()=>({state:n,dispatch:e})=>Vm(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>bo("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>bo("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>P_(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Hm(n,e)?!0:Vm(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>__(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>jm(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>jm(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&aw(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=Te.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ka,"Mod-Backspace":ka,Delete:ka,"Mod-Delete":ka}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[j_({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],tR({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:fe(K(n,"tableRole",e))}}});Pe.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(mw.configure(this.options.table)),this.options.tableCell!==!1&&n.push(hw.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(fw.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(pw.configure(this.options.tableRow)),n}});var aR=hw,lR=fw,uR=pw,cR=Ze.create({name:"text",group:"inline"}),gw=cR,dR=Vt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ve(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),yw=dR,hR=class{constructor({editor:n,element:e,view:t,updateDelay:r=250,resizeDelay:i=60,shouldShow:s,options:o}){this.preventHide=!1,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.shouldShow=({view:a,state:l,from:u,to:c})=>{const{doc:d,selection:h}=l,{empty:f}=h,p=!d.textBetween(u,c).length&&of(l.selection),m=this.element.contains(document.activeElement);return!(!(a.hasFocus()||m)||f||p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a?.relatedTarget&&((l=this.element.parentNode)!=null&&l.contains(a.relatedTarget))||a?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(a,l)=>{const u=!l?.selection.eq(a.state.selection),c=!l?.doc.eq(a.state.doc);!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{const{composing:d}=a;if(d||!l&&!u)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.editor=n,this.element=e,this.view=t,this.updateDelay=r,this.resizeDelay=i,this.floatingUIOptions={...this.floatingUIOptions,...o},s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),window.addEventListener("resize",()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)}),this.update(t,t.state),this.getShouldShow()&&this.show()}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Q1(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Z1(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(ny(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(ek(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(tk(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(nk(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(rk(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(ik(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}updatePosition(){const{selection:n}=this.editor.state;sk({getBoundingClientRect:()=>qC(this.view,n.from,n.to)},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:r,strategy:i})=>{this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${t}px`,this.element.style.top=`${r}px`})}update(n,e){const{state:t}=n,r=t.selection.from!==t.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(n,e);return}const i=!e?.selection.eq(n.state.selection),s=!e?.doc.eq(n.state.doc);this.updateHandler(n,i,s,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:s,to:o})}show(){var n;this.element.style.visibility="visible",this.element.style.opacity="1",(n=this.view.dom.parentElement)==null||n.appendChild(this.element)}hide(){this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove()}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},bw=n=>new Ce({key:typeof n.pluginKey=="string"?new Ae(n.pluginKey):n.pluginKey,view:e=>new hR({view:e,...n})});Pe.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[bw({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var fR=Po({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(n,{slots:e}){const t=ou(null);return oy(()=>{const{editor:r,options:i,pluginKey:s,resizeDelay:o,shouldShow:a,updateDelay:l}=n;t.value&&(t.value.style.visibility="hidden",t.value.style.position="absolute",t.value.remove(),r.registerPlugin(bw({editor:r,element:t.value,options:i,pluginKey:s,resizeDelay:o,shouldShow:a,updateDelay:l})))}),Th(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return ro(pk,{to:"body"},ro("div",{ref:t},(r=e.default)==null?void 0:r.call(e)))}}});const vw={name:"DpAnonymizeText",components:{BubbleMenu:fR,EditorContent:u0},props:{value:{type:String,required:!0}},data(){return{editor:null,menuOptions:{middleware:[ny(6)],placement:"top"},translations:{anonymize:W.anonymization.mark,unanonymize:W.anonymization.unmark}}},methods:{setValue(){let n=this.editor.getHTML();const e=/<span[^>]*?title="(.*?)"([^>]*?)class="anonymize-me"([^>]*?)>([^<]*?)<span class="unanonymized">([^<]*?)<\/span>([^<]*?)<\/span>/gm;n=n.replace(e,(i,s)=>s.replaceAll(""",'"'));const t=/<span class="unanonymized">(.*?)<\/span>/gm;n=n.replace(t,"$1");const r=/<span class="anonymize-me">(.*?)<\/span>/gm;n=n.replace(r,(i,s)=>'<span title="'+s.replaceAll('"',""")+'" class="anonymize-me">***</span>'),this.editor.commands.setContent(n),this.$emit("change",n)}},mounted(){this.editor=new l0({content:this.value,editable:!0,enableInputRules:!1,enablePasteRules:!1,extensions:[yM,C0,I0,D0,Hd.configure({levels:[1,2,3]}),L0,U0,H0,PO,V0,T0,q0,j0,zO,gw,BO,yw],onUpdate:()=>{this.setValue()}})}},pR={class:"border"},mR={class:"editor-menububble__wrapper is-active bottom-0"};function gR(n,e,t,r,i,s){const o=je("bubble-menu"),a=je("editor-content");return z(),V("div",pR,[i.editor?(z(),an(o,{key:0,editor:i.editor,options:i.menuOptions},{default:au(()=>[ne("div",mR,[i.editor.isActive("anonymize")?(z(),V("button",{key:0,class:"editor-menububble__button whitespace-nowrap",onClick:e[0]||(e[0]=l=>i.editor.chain().focus().toggleUnanonymize().run())},qe(i.translations.unanonymize),1)):(z(),V("button",{key:1,class:"editor-menububble__button whitespace-nowrap",onClick:e[1]||(e[1]=l=>i.editor.chain().focus().toggleAnonymize().run())},qe(i.translations.anonymize),1))])]),_:1},8,["editor","options"])):ye("",!0),sn(a,{ref:"editorContent",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",class:"editor-content",editor:i.editor},null,8,["editor"])])}const c$=vt(vw,[["render",gR]]);vw.__docgenInfo={displayName:"DpAnonymizeText",exportName:"default",description:"",tags:{},props:[{name:"value",type:{name:"string"},required:!0}],events:[{name:"change",type:{names:["undefined"]}}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpAnonymizeText/DpAnonymizeText.vue"]};const ww={name:"DpButtonIcon",directives:{tooltip:ry},props:{icon:{type:String,required:!0},text:{type:String,required:!0}}},yR={class:"sr-only"};function bR(n,e,t,r,i,s){const o=al("tooltip");return Le((z(),V("button",{class:"btn--icon",onClick:e[0]||(e[0]=a=>n.$emit("click"))},[ne("i",{class:q(`fa ${t.icon}`),"aria-hidden":"true"},null,2),ne("span",yR,qe(t.text),1)])),[[o,{content:t.text,delay:{show:1e3,hide:200}}]])}const d$=vt(ww,[["render",bR]]);ww.__docgenInfo={displayName:"DpButtonIcon",exportName:"default",description:"",tags:{},props:[{name:"icon",type:{name:"string"},required:!0},{name:"text",type:{name:"string"},required:!0}],events:[{name:"click"}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpButtonIcon/DpButtonIcon.vue"]};const kw={name:"DpLinkModal",components:{DpButtonRow:wk,DpCheckbox:kk,DpInput:ly,DpModal:uy},mixins:[Rk],data(){return{initUrl:"",isVisible:!1,newTab:!1,text:"",translations:{insert:W.operations.insert,linkEdit:W.editor.link.edit,linkHint:W.editor.link.hint,linkInsert:W.editor.link.insert,linkText:W.link.text,remove:W.operations.remove,newTab:W.tab.openNew,url:W.url},url:""}},computed:{hasLink(){return this.initUrl!==""}},methods:{emitAndClose(n){this.$emit("insert",n==="insert"?this.url:null,this.newTab,this.text),this.toggleModal()},setVisible(n){this.isVisible=n},toggleModal(n,e,t){this.$refs.linkModal.toggle(),this.isVisible?(this.initUrl=n,this.url=n,this.text=e,this.newTab=t==="_blank"):(this.url="",this.text="",this.newTab=!1)}}},vR={class:"space-stack-m"};function wR(n,e,t,r,i,s){const o=je("dp-input"),a=je("dp-checkbox"),l=je("dp-button-row"),u=je("dp-modal");return z(),an(u,{ref:"linkModal","content-classes":"u-1-of-3","data-dp-validate":"linkModal","onModal:toggled":s.setVisible},{default:au(()=>[ne("h3",null,qe(s.hasLink?i.translations.linkEdit:i.translations.linkInsert),1),ne("div",vR,[sn(o,{id:"link_text",modelValue:i.text,"onUpdate:modelValue":e[0]||(e[0]=c=>i.text=c),label:{text:i.translations.linkText},required:i.isVisible},null,8,["modelValue","label","required"]),sn(o,{id:"link_url",modelValue:i.url,"onUpdate:modelValue":e[1]||(e[1]=c=>i.url=c),label:{hint:i.translations.linkHint,text:i.translations.url},pattern:i.isVisible===!0?"(^https?://.*|^//.*|^mailto:.*)":null,required:i.isVisible,type:"url"},null,8,["modelValue","label","pattern","required"]),sn(a,{id:"newTab",modelValue:i.newTab,"onUpdate:modelValue":e[2]||(e[2]=c=>i.newTab=c),label:{text:i.translations.newTab}},null,8,["modelValue","label"]),sn(l,{class:"u-mt",primary:"","primary-text":i.translations.insert,secondary:"","secondary-text":i.translations.remove,onPrimaryAction:e[3]||(e[3]=c=>n.dpValidateAction("linkModal",()=>s.emitAndClose("insert"),!1)),onSecondaryAction:e[4]||(e[4]=c=>s.emitAndClose("remove"))},null,8,["primary-text","secondary-text"])])]),_:1},8,["onModal:toggled"])}const kR=vt(kw,[["render",wR]]);kw.__docgenInfo={exportName:"default",displayName:"DpLinkModal",description:"",tags:{},events:[{name:"insert",type:{names:["undefined"]},properties:[{type:{names:["undefined"]},name:"<anonymous1>"},{type:{names:["undefined"]},name:"<anonymous2>"}]}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpEditor/DpLinkModal.vue","/home/florian/Dev/demosplan-ui/src/mixins/dpValidateMixin.js"]};const tg=()=>({strings:{dropHereOr:W.upload.select.pdf({browse:"{browse}",maxUploadSize:fy("GB",2)}),errorFileUpload:W.validation.error.fileUpload,failedToUpload:W.upload.failed,browse:W.computer,warningFileType:W.upload.warningFileType}});function Sa(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var SR=0;function Sw(n){return"__private_"+SR+++"_"+n}function xR(n,e,t){const r=[];return n.forEach(i=>typeof i!="string"?r.push(i):e[Symbol.split](i).forEach((s,o,a)=>{s!==""&&r.push(s),o<a.length-1&&r.push(t)})),r}/**
|
|
92
|
-
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
93
|
-
* and replaces it with values from options `{smart_count: 5}`
|
|
94
|
-
*
|
|
95
|
-
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
|
|
96
|
-
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
|
|
97
|
-
*
|
|
98
|
-
* @param phrase that needs interpolation, with placeholders
|
|
99
|
-
* @param options with values that will be used to replace placeholders
|
|
100
|
-
*/function ng(n,e){const t=/\$/g,r="$$$$";let i=[n];if(e==null)return i;for(const s of Object.keys(e))if(s!=="_"){let o=e[s];typeof o=="string"&&(o=t[Symbol.replace](o,r)),i=xR(i,new RegExp(`%\\{${s}\\}`,"g"),o)}return i}const TR=n=>{throw new Error(`missing string: ${n}`)};var ts=Sw("onMissingKey"),ns=Sw("apply");class xw{constructor(e,t){let{onMissingKey:r=TR}=t===void 0?{}:t;Object.defineProperty(this,ns,{value:CR}),Object.defineProperty(this,ts,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(i){return i===1?0:1}},Array.isArray(e)?e.forEach(Sa(this,ns)[ns],this):Sa(this,ns)[ns](e),Sa(this,ts)[ts]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(Sa(this,ts)[ts](e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){const s=this.locale.pluralize(t.smart_count);return ng(r[s],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return ng(r,t)}}function CR(n){if(!(n!=null&&n.strings))return;const e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...n.strings},pluralize:n.pluralize||e.pluralize})}var xc,rg;function ER(){return rg||(rg=1,xc=function(){var e={},t=e._fns={};e.emit=function(o,a,l,u,c,d,h){var f=r(o);f.length&&i(o,f,[a,l,u,c,d,h])},e.on=function(o,a){t[o]||(t[o]=[]),t[o].push(a)},e.once=function(o,a){function l(){a.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,a){var l=[];if(o&&a){var u=this._fns[o],c=0,d=u?u.length:0;for(c;c<d;c++)u[c]!==a&&l.push(u[c])}l.length?this._fns[o]=l:delete this._fns[o]};function r(s){var o=t[s]?t[s]:[],a=s.indexOf(":"),l=a===-1?[s]:[s.substring(0,a),s.substring(a+1)],u=Object.keys(t),c=0,d=u.length;for(c;c<d;c++){var h=u[c];if(h==="*"&&(o=o.concat(t[h])),l.length===2&&l[0]===h){o=o.concat(t[h]);break}}return o}function i(s,o,a){var l=0,u=o.length;for(l;l<u&&o[l];l++)o[l].event=s,o[l].apply(o[l],a)}return e}),xc}var MR=ER();const AR=Io(MR);let OR="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",NR=(n=21)=>{let e="",t=n|0;for(;t--;)e+=OR[Math.random()*64|0];return e};var Tc,ig;function _R(){if(ig)return Tc;ig=1;var n=ok(),e=function(){return n.Date.now()};return Tc=e,Tc}var Cc,sg;function RR(){if(sg)return Cc;sg=1;var n=/\s/;function e(t){for(var r=t.length;r--&&n.test(t.charAt(r)););return r}return Cc=e,Cc}var Ec,og;function PR(){if(og)return Ec;og=1;var n=RR(),e=/^\s+/;function t(r){return r&&r.slice(0,n(r)+1).replace(e,"")}return Ec=t,Ec}var Mc,ag;function IR(){if(ag)return Mc;ag=1;var n=ak(),e=lk(),t="[object Symbol]";function r(i){return typeof i=="symbol"||e(i)&&n(i)==t}return Mc=r,Mc}var Ac,lg;function DR(){if(lg)return Ac;lg=1;var n=PR(),e=xh(),t=IR(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function l(u){if(typeof u=="number")return u;if(t(u))return r;if(e(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=e(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=n(u);var d=s.test(u);return d||o.test(u)?a(u.slice(2),d?2:8):i.test(u)?r:+u}return Ac=l,Ac}var Oc,ug;function LR(){if(ug)return Oc;ug=1;var n=xh(),e=_R(),t=DR(),r="Expected a function",i=Math.max,s=Math.min;function o(a,l,u){var c,d,h,f,p,m,g=0,y=!1,v=!1,k=!0;if(typeof a!="function")throw new TypeError(r);l=t(l)||0,n(u)&&(y=!!u.leading,v="maxWait"in u,h=v?i(t(u.maxWait)||0,l):h,k="trailing"in u?!!u.trailing:k);function b(P){var oe=c,ue=d;return c=d=void 0,g=P,f=a.apply(ue,oe),f}function x(P){return g=P,p=setTimeout(_,l),y?b(P):f}function A(P){var oe=P-m,ue=P-g,E=l-oe;return v?s(E,h-ue):E}function O(P){var oe=P-m,ue=P-g;return m===void 0||oe>=l||oe<0||v&&ue>=h}function _(){var P=e();if(O(P))return I(P);p=setTimeout(_,A(P))}function I(P){return p=void 0,k&&c?b(P):(c=d=void 0,f)}function $(){p!==void 0&&clearTimeout(p),g=0,c=m=d=p=void 0}function Y(){return p===void 0?f:I(e())}function ie(){var P=e(),oe=O(P);if(c=arguments,d=this,m=P,oe){if(p===void 0)return x(m);if(v)return clearTimeout(p),p=setTimeout(_,l),b(m)}return p===void 0&&(p=setTimeout(_,l)),f}return ie.cancel=$,ie.flush=Y,ie}return Oc=o,Oc}var Nc,cg;function FR(){if(cg)return Nc;cg=1;var n=LR(),e=xh(),t="Expected a function";function r(i,s,o){var a=!0,l=!0;if(typeof i!="function")throw new TypeError(t);return e(o)&&(a="leading"in o?!!o.leading:a,l="trailing"in o?!!o.trailing:l),n(i,s,{leading:a,maxWait:s,trailing:l})}return Nc=r,Nc}var $R=FR();const BR=Io($R);function Ya(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var zR=0;function Tw(n){return"__private_"+zR+++"_"+n}const UR={version:"4.2.0"};var Er=Tw("callbacks"),_c=Tw("publish");class Cw{constructor(){Object.defineProperty(this,_c,{value:HR}),this.state={},Object.defineProperty(this,Er,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},r={...this.state,...e};this.state=r,Ya(this,_c)[_c](t,r,e)}subscribe(e){return Ya(this,Er)[Er].add(e),()=>{Ya(this,Er)[Er].delete(e)}}}function HR(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];Ya(this,Er)[Er].forEach(r=>{r(...e)})}Cw.VERSION=UR.version;function Ew(n){const e=n.lastIndexOf(".");return e===-1||e===n.length-1?{name:n,extension:void 0}:{name:n.slice(0,e),extension:n.slice(e+1)}}const dg={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Mw(n){var e;if(n.type)return n.type;const t=n.name?(e=Ew(n.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in dg?dg[t]:"application/octet-stream"}function VR(n){return n.charCodeAt(0).toString(32)}function hg(n){let e="";return n.replace(/[^A-Z0-9]/gi,t=>(e+=`-${VR(t)}`,"/"))+e}function qR(n,e){let t=e||"uppy";return typeof n.name=="string"&&(t+=`-${hg(n.name.toLowerCase())}`),n.type!==void 0&&(t+=`-${n.type}`),n.meta&&typeof n.meta.relativePath=="string"&&(t+=`-${hg(n.meta.relativePath.toLowerCase())}`),n.data.size!==void 0&&(t+=`-${n.data.size}`),n.data.lastModified!==void 0&&(t+=`-${n.data.lastModified}`),t}function jR(n){return!n.isRemote||!n.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(n.remote.provider)}function WR(n,e){if(jR(n))return n.id;const t=Mw(n);return qR({...n,type:t},e)}function JR(n){if(n==null&&typeof navigator<"u"&&(n=navigator.userAgent),!n)return!0;const e=/Edge\/(\d+\.\d+)/.exec(n);if(!e)return!0;const r=e[1].split(".",2),i=parseInt(r[0],10),s=parseInt(r[1],10);return i<15||i===15&&s<15063||i>18||i===18&&s>=18218}function KR(n,e){return e.name?e.name:n.split("/")[0]==="image"?`${n.split("/")[0]}.${n.split("/")[1]}`:"noname"}function Rc(n){return n<10?`0${n}`:n.toString()}function Xa(){const n=new Date,e=Rc(n.getHours()),t=Rc(n.getMinutes()),r=Rc(n.getSeconds());return`${e}:${t}:${r}`}const GR={debug:()=>{},warn:()=>{},error:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Xa()}]`,...e)}},YR={debug:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${Xa()}]`,...e)},warn:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${Xa()}]`,...e)},error:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Xa()}]`,...e)}};var Pc,fg;function XR(){return fg||(fg=1,Pc=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return`${(t?"-":"")+e} B`;const i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/1024**i);const s=r[i];return e>=10||e%1===0?`${(t?"-":"")+e.toFixed(0)} ${s}`:`${(t?"-":"")+e.toFixed(1)} ${s}`}),Pc}var QR=XR();const xa=Io(QR);var Ic,pg;function ZR(){if(pg)return Ic;pg=1;function n(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return n.prototype.match=function(e){var t=!0,r=this.parts,i,s=r.length,o;if(typeof e=="string"||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(o=(e||"").split(this.separator),i=0;t&&i<s;i++)r[i]!=="*"&&(i<o.length?t=r[i]===o[i]:t=!1);t=t&&o}else if(typeof e.splice=="function")for(t=[],i=e.length;i--;)this.match(e[i])&&(t[t.length]=e[i]);else if(typeof e=="object"){t={};for(var a in e)this.match(a)&&(t[a]=e[a])}return t},Ic=function(e,t,r){var i=new n(e,r||/[\/\.]/);return typeof t<"u"?i.match(t):i},Ic}var Dc,mg;function eP(){if(mg)return Dc;mg=1;var n=ZR(),e=/[\/\+\.]/;return Dc=function(t,r){function i(s){var o=n(s,t,e);return o&&o.length>=2}return r?i(r.split(";")[0]):i},Dc}var tP=eP();const nP=Io(tP),rP={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class jt extends Error{constructor(e,t){var r;super(e),this.isRestriction=!0,this.isUserFacing=(r=t?.isUserFacing)!=null?r:!0,t!=null&&t.file&&(this.file=t.file)}}class iP{constructor(e,t){this.getI18n=t,this.getOpts=()=>{var r;const i=e();if(((r=i.restrictions)==null?void 0:r.allowedFileTypes)!=null&&!Array.isArray(i.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return i}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:r,maxNumberOfFiles:i}=this.getOpts().restrictions;if(i&&e.filter(o=>!o.isGhost).length+t.length>i)throw new jt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:i})}`);if(r){const s=[...e,...t].reduce((o,a)=>{var l;return o+((l=a.size)!=null?l:0)},0);if(s>r)throw new jt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:xa(r),size:xa(s)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:r,allowedFileTypes:i}=this.getOpts().restrictions;if(i&&!i.some(a=>a.includes("/")?e.type?nP(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){const a=i.join(", ");throw new jt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t){var s;throw new jt(this.getI18n()("exceedsSize",{size:xa(t),file:(s=e.name)!=null?s:this.getI18n()("unnamed")}),{file:e})}if(r&&e.size!=null&&e.size<r)throw new jt(this.getI18n()("inferiorSize",{size:xa(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new jt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){var t;const r=new jt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:(t=e.name)!=null?t:this.getI18n()("unnamed")})),{requiredMetaFields:i}=this.getOpts().restrictions,s=[];for(const o of i)(!Object.hasOwn(e.meta,o)||e.meta[o]==="")&&s.push(o);return{missingFields:s,error:r}}}const sP={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};function B(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var oP=0;function xe(n){return"__private_"+oP+++"_"+n}const aP={version:"4.4.4"},Ta={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var Je=xe("plugins"),Ge=xe("restricter"),rs=xe("storeUnsubscribe"),vn=xe("emitter"),Mr=xe("preProcessors"),Ar=xe("uploaders"),On=xe("postProcessors"),Mt=xe("informAndEmit"),vo=xe("checkRequiredMetaFieldsOnFile"),Lc=xe("checkRequiredMetaFields"),is=xe("assertNewUploadAllowed"),Xd=xe("transformFile"),ss=xe("startIfAutoProceed"),as=xe("checkAndUpdateFileState"),Zs=xe("getFilesToRetry"),ls=xe("doRetryAll"),Qd=xe("handleUploadProgress"),us=xe("updateTotalProgress"),Nn=xe("updateTotalProgressThrottled"),Zd=xe("calculateTotalProgress"),Fc=xe("addListeners"),Wt=xe("updateOnlineStatus"),cs=xe("requestClientById"),En=xe("createUpload"),$c=xe("getUpload"),Pr=xe("removeUpload"),Mn=xe("runUpload");class Au{constructor(e){Object.defineProperty(this,Mn,{value:xP}),Object.defineProperty(this,Pr,{value:SP}),Object.defineProperty(this,$c,{value:kP}),Object.defineProperty(this,En,{value:wP}),Object.defineProperty(this,Fc,{value:vP}),Object.defineProperty(this,Zd,{value:bP}),Object.defineProperty(this,us,{value:yP}),Object.defineProperty(this,ls,{value:gP}),Object.defineProperty(this,Zs,{value:mP}),Object.defineProperty(this,as,{value:pP}),Object.defineProperty(this,ss,{value:fP}),Object.defineProperty(this,Xd,{value:hP}),Object.defineProperty(this,is,{value:dP}),Object.defineProperty(this,Lc,{value:cP}),Object.defineProperty(this,vo,{value:uP}),Object.defineProperty(this,Mt,{value:lP}),Object.defineProperty(this,Je,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,Ge,{writable:!0,value:void 0}),Object.defineProperty(this,rs,{writable:!0,value:void 0}),Object.defineProperty(this,vn,{writable:!0,value:AR()}),Object.defineProperty(this,Mr,{writable:!0,value:new Set}),Object.defineProperty(this,Ar,{writable:!0,value:new Set}),Object.defineProperty(this,On,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,Object.defineProperty(this,Qd,{writable:!0,value:(i,s)=>{const o=i?this.getFile(i.id):void 0;if(i==null||!o){this.log(`Not setting progress for a file that has been removed: ${i?.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${i.id}`);return}const a={bytesTotal:s.bytesTotal,percentage:s.bytesTotal!=null&&Number.isFinite(s.bytesTotal)&&s.bytesTotal>0?Math.round(s.bytesUploaded/s.bytesTotal*100):void 0};o.progress.uploadStarted!=null?this.setFileState(i.id,{progress:{...o.progress,...a,bytesUploaded:s.bytesUploaded}}):this.setFileState(i.id,{progress:{...o.progress,...a}}),B(this,Nn)[Nn]()}}),Object.defineProperty(this,Nn,{writable:!0,value:BR(()=>B(this,us)[us](),500,{leading:!0,trailing:!0})}),Object.defineProperty(this,Wt,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,cs,{writable:!0,value:new Map}),this.defaultLocale=sP;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:rP,meta:{},onBeforeFileAdded:(i,s)=>!Object.hasOwn(s,i.id),onBeforeUpload:i=>i,store:new Cw,logger:GR,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=YR),this.log(`Using Core v${Au.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Ta,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:JR(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),B(this,Ge)[Ge]=new iP(()=>this.opts,()=>this.i18n),B(this,rs)[rs]=this.store.subscribe((i,s,o)=>{this.emit("state-update",i,s,o),this.updateAll(s)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),B(this,Fc)[Fc]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];B(this,vn)[vn].emit(e,...r)}on(e,t){return B(this,vn)[vn].on(e,t),this}once(e,t){return B(this,vn)[vn].once(e,t),this}off(e,t){return B(this,vn)[vn].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(r=>{let[i,s]=r;return[i,{...t[i],...s}]}))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){const e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new xw([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(i=>{r[i]={...t[i],progress:{...t[i].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Ta})}clear(){const{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Ta,files:{}})}addPreProcessor(e){B(this,Mr)[Mr].add(e)}removePreProcessor(e){return B(this,Mr)[Mr].delete(e)}addPostProcessor(e){B(this,On)[On].add(e)}removePostProcessor(e){return B(this,On)[On].delete(e)}addUploader(e){B(this,Ar)[Ar].add(e)}removeUploader(e){return B(this,Ar)[Ar].delete(e)}setMeta(e){const t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(i=>{r[i]={...r[i],meta:{...r[i].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){const r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}const i={...r[e].meta,...t};r[e]={...r[e],meta:i},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:r}=this.getState(),i=Object.values(e),s=[],o=[],a=[],l=[],u=[],c=[],d=[],h=[],f=[];for(const p of i){const{progress:m}=p;!m.uploadComplete&&m.uploadStarted&&(s.push(p),p.isPaused||h.push(p)),m.uploadStarted||o.push(p),(m.uploadStarted||m.preprocess||m.postprocess)&&a.push(p),m.uploadStarted&&l.push(p),p.isPaused&&u.push(p),m.uploadComplete&&c.push(p),p.error&&d.push(p),(m.preprocess||m.postprocess)&&f.push(p)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:u,completeFiles:c,erroredFiles:d,inProgressFiles:s,inProgressNotPausedFiles:h,processingFiles:f,isUploadStarted:l.length>0,isAllComplete:t===100&&c.length===i.length&&f.length===0,isAllErrored:!!r&&d.length===i.length,isAllPaused:s.length!==0&&u.length===s.length,isUploadInProgress:s.length>0,isSomeGhost:i.some(p=>p.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{B(this,Ge)[Ge].validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{B(this,Ge)[Ge].validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){const t=this.getFiles();try{B(this,Ge)[Ge].validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}addFile(e){B(this,is)[is](e);const{nextFilesState:t,validFilesToAdd:r,errors:i}=B(this,as)[as]([e]),s=i.filter(a=>a.isRestriction);if(B(this,Mt)[Mt](s),i.length>0)throw i[0];this.setState({files:t});const[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),B(this,ss)[ss](),o.id}addFiles(e){B(this,is)[is]();const{nextFilesState:t,validFilesToAdd:r,errors:i}=B(this,as)[as](e),s=i.filter(a=>a.isRestriction);B(this,Mt)[Mt](s);const o=i.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
|
|
101
|
-
`;if(o.forEach(l=>{a+=`
|
|
102
|
-
* ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:a},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,a);{const l=new Error(a);throw l.errors=o,l}}this.setState({files:t}),r.forEach(a=>{this.emit("file-added",a)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(a=>{this.log(`Added file: ${a.name}
|
|
103
|
-
id: ${a.id}
|
|
104
|
-
type: ${a.type}`)}),r.length>0&&B(this,ss)[ss]()}removeFiles(e){const{files:t,currentUploads:r}=this.getState(),i={...t},s={...r},o=Object.create(null);e.forEach(c=>{t[c]&&(o[c]=t[c],delete i[c])});function a(c){return o[c]===void 0}Object.keys(s).forEach(c=>{const d=r[c].fileIDs.filter(a);if(d.length===0){delete s[c];return}const{capabilities:h}=this.getState();if(d.length!==r[c].fileIDs.length&&!h.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");s[c]={...r[c],fileIDs:d}});const l={currentUploads:s,files:i};Object.keys(i).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),B(this,Nn)[Nn]();const u=Object.keys(o);u.forEach(c=>{this.emit("file-removed",o[c])}),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const t=this.getFile(e),i=!(t.isPaused||!1);return this.setFileState(e,{isPaused:i}),this.emit("upload-pause",t,i),i}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{const i={...e[r],isPaused:!0};e[r]=i}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{const i={...e[r],isPaused:!1,error:null};e[r]=i}),this.setState({files:e}),this.emit("resume-all")}async retryAll(){const e=await B(this,ls)[ls]();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Ta)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));const t=B(this,En)[En]([e],{forceAllowNewUpload:!0});return B(this,Mn)[Mn](t)}logout(){this.iteratePlugins(e=>{var t;(t=e.provider)==null||t.logout==null||t.logout()})}[Symbol.for("uppy test: updateTotalProgress")](){return B(this,us)[us]()}updateOnlineStatus(){var e;((e=window.navigator.onLine)!=null?e:!0)?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e){if(typeof e!="function"){const l=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(l)}for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];const s=new e(this,...r),o=s.id;if(!o)throw new Error("Your plugin must have an id");if(!s.type)throw new Error("Your plugin must have a type");const a=this.getPlugin(o);if(a){const l=`Already found a plugin named '${a.id}'. Tried to use: '${o}'.
|
|
105
|
-
Uppy plugins must have unique \`id\` options.`;throw new Error(l)}return e.VERSION&&this.log(`Using ${o} v${e.VERSION}`),s.type in B(this,Je)[Je]?B(this,Je)[Je][s.type].push(s):B(this,Je)[Je][s.type]=[s],s.install(),this.emit("plugin-added",s),this}getPlugin(e){for(const t of Object.values(B(this,Je)[Je])){const r=t.find(i=>i.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return B(this,Je)[Je][e]}iteratePlugins(e){Object.values(B(this,Je)[Je]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=B(this,Je)[Je][e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),B(this,rs)[rs](),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",B(this,Wt)[Wt]),window.removeEventListener("offline",B(this,Wt)[Wt]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,r){t===void 0&&(t="info"),r===void 0&&(r=3e3);const i=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:i?e.message:e,details:i?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){const{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}registerRequestClient(e,t){B(this,cs)[cs].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=B(this,cs)[cs].get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?B(this,Mn)[Mn](e):(B(this,Pr)[Pr](e),Promise.reject(new Error("Nonexistent upload")))}[Symbol.for("uppy test: createUpload")](){return B(this,En)[En](...arguments)}addResultData(e,t){if(!B(this,$c)[$c](e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}const{currentUploads:r}=this.getState(),i={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:i}})}async upload(){var e;(e=B(this,Je)[Je].uploader)!=null&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();if(B(this,Zs)[Zs]().length>0){const s=await B(this,ls)[ls]();if(!(this.getFiles().filter(a=>a.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:t}=this.getState())}const i=this.opts.onBeforeUpload(t);return i===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(i&&typeof i=="object"&&(t=i,this.setState({files:t})),Promise.resolve().then(()=>B(this,Ge)[Ge].validateMinNumberOfFiles(t)).catch(s=>{throw B(this,Mt)[Mt]([s]),s}).then(()=>{if(!B(this,Lc)[Lc](t))throw new jt(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{const{currentUploads:s}=this.getState(),o=Object.values(s).flatMap(c=>c.fileIDs),a=[];Object.keys(t).forEach(c=>{const d=this.getFile(c);!d.progress.uploadStarted&&o.indexOf(c)===-1&&a.push(d.id)});const l=B(this,En)[En](a),u=await B(this,Mn)[Mn](l);return this.emit("complete",u),u}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}}function lP(n){for(const s of n)s.isRestriction?this.emit("restriction-failed",s.file,s):this.emit("error",s,s.file),this.log(s,"warning");const e=n.filter(s=>s.isUserFacing),t=4,r=e.slice(0,t),i=e.slice(t);r.forEach(s=>{let{message:o,details:a=""}=s;this.info({message:o,details:a},"error",this.opts.infoTimeout)}),i.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:i.length})})}function uP(n){const{missingFields:e,error:t}=B(this,Ge)[Ge].getMissingRequiredMetaFields(n);return e.length>0?(this.setFileState(n.id,{missingRequiredMetaFields:e}),this.log(t.message),this.emit("restriction-failed",n,t),!1):!0}function cP(n){let e=!0;for(const t of Object.values(n))B(this,vo)[vo](t)||(e=!1);return e}function dP(n){const{allowNewUpload:e}=this.getState();if(e===!1){const t=new jt(this.i18n("noMoreFilesAllowed"),{file:n});throw B(this,Mt)[Mt]([t]),t}}function hP(n){const e=n instanceof File?{name:n.name,type:n.type,size:n.size,data:n}:n,t=Mw(e),r=KR(t,e),i=Ew(r).extension,s=WR(e,this.getID()),o=e.meta||{};o.name=r,o.type=t;const a=Number.isFinite(e.data.size)?e.data.size:null;return{source:e.source||"",id:s,name:r,extension:i||"",meta:{...this.getState().meta,...o},type:t,data:e.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:a,uploadComplete:!1,uploadStarted:null},size:a,isGhost:!1,isRemote:e.isRemote||!1,remote:e.remote,preview:e.preview}}function fP(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(n=>{n.isRestriction||this.log(n.stack||n.message||n)})},4))}function pP(n){const{files:e}=this.getState(),t={...e},r=[],i=[];for(const a of n)try{var s;let l=B(this,Xd)[Xd](a);const u=(s=e[l.id])==null?void 0:s.isGhost;u&&(l={...e[l.id],isGhost:!1,data:a.data},this.log(`Replaced the blob in the restored ghost file: ${l.name}, ${l.id}`));const c=this.opts.onBeforeFileAdded(l,t);if(!c&&this.checkIfFileAlreadyExists(l.id)){var o;throw new jt(this.i18n("noDuplicates",{fileName:(o=l.name)!=null?o:this.i18n("unnamed")}),{file:a})}if(c===!1&&!u)throw new jt("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:a});typeof c=="object"&&c!==null&&(l=c),B(this,Ge)[Ge].validateSingleFile(l),t[l.id]=l,r.push(l)}catch(l){i.push(l)}try{B(this,Ge)[Ge].validateAggregateRestrictions(Object.values(e),r)}catch(a){return i.push(a),{nextFilesState:e,validFilesToAdd:[],errors:i}}return{nextFilesState:t,validFilesToAdd:r,errors:i}}function mP(){const{files:n}=this.getState();return Object.keys(n).filter(e=>n[e].error)}async function gP(){const n=B(this,Zs)[Zs](),e={...this.getState().files};if(n.forEach(r=>{e[r]={...e[r],isPaused:!1,error:null}}),this.setState({files:e,error:null}),this.emit("retry-all",this.getFilesByIds(n)),n.length===0)return{successful:[],failed:[]};const t=B(this,En)[En](n,{forceAllowNewUpload:!0});return B(this,Mn)[Mn](t)}function yP(){var n,e;const t=B(this,Zd)[Zd]();let r=null;t!=null&&(r=Math.round(t*100),r>100?r=100:r<0&&(r=0)),this.emit("progress",(n=r)!=null?n:0),this.setState({totalProgress:(e=r)!=null?e:0})}function bP(){const e=this.getFiles().filter(a=>a.progress.uploadStarted||a.progress.preprocess||a.progress.postprocess);if(e.length===0)return 0;if(e.every(a=>a.progress.uploadComplete))return 1;const t=a=>a.progress.bytesTotal!=null&&a.progress.bytesTotal!==0,r=e.filter(t),i=e.filter(a=>!t(a));if(r.every(a=>a.progress.uploadComplete)&&i.length>0&&!i.every(a=>a.progress.uploadComplete))return null;const s=r.reduce((a,l)=>{var u;return a+((u=l.progress.bytesTotal)!=null?u:0)},0),o=r.reduce((a,l)=>a+(l.progress.bytesUploaded||0),0);return s===0?0:o/s}function vP(){const n=(r,i,s)=>{let o=r.message||"Unknown error";r.details&&(o+=` ${r.details}`),this.setState({error:o}),i!=null&&i.id in this.getState().files&&this.setFileState(i.id,{error:o,response:s})};this.on("error",n),this.on("upload-error",(r,i,s)=>{if(n(i,r,s),typeof i=="object"&&i.message){var o;this.log(i.message,"error");const a=new Error(this.i18n("failedToUpload",{file:(o=r?.name)!=null?o:""}));a.isUserFacing=!0,a.details=i.message,i.details&&(a.details+=` ${i.details}`),B(this,Mt)[Mt]([a])}else B(this,Mt)[Mt]([i])});let e=null;this.on("upload-stalled",(r,i)=>{const{message:s}=r,o=i.map(a=>a.meta.name).join(", ");e||(this.info({message:s,details:o},"warning",this.opts.infoTimeout),e=setTimeout(()=>{e=null},this.opts.infoTimeout)),this.log(`${s} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const t=r=>{const i=r.filter(o=>{const a=o!=null&&this.getFile(o.id);return a||this.log(`Not setting progress for a file that has been removed: ${o?.id}`),a}),s=Object.fromEntries(i.map(o=>[o.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:o.size}}]));this.patchFilesState(s)};this.on("upload-start",t),this.on("upload-progress",B(this,Qd)[Qd]),this.on("upload-success",(r,i)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}const s=this.getFile(r.id).progress;this.setFileState(r.id,{progress:{...s,postprocess:B(this,On)[On].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:s.bytesTotal},response:i,uploadURL:i.uploadURL,isPaused:!1}),r.size==null&&this.setFileState(r.id,{size:i.bytesUploaded||s.bytesTotal}),B(this,Nn)[Nn]()}),this.on("preprocess-progress",(r,i)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}this.setFileState(r.id,{progress:{...this.getFile(r.id).progress,preprocess:i}})}),this.on("preprocess-complete",r=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}const i={...this.getState().files};i[r.id]={...i[r.id],progress:{...i[r.id].progress}},delete i[r.id].progress.preprocess,this.setState({files:i})}),this.on("postprocess-progress",(r,i)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}this.setFileState(r.id,{progress:{...this.getState().files[r.id].progress,postprocess:i}})}),this.on("postprocess-complete",r=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}const i={...this.getState().files};i[r.id]={...i[r.id],progress:{...i[r.id].progress}},delete i[r.id].progress.postprocess,this.setState({files:i})}),this.on("restored",()=>{B(this,Nn)[Nn]()}),this.on("dashboard:file-edit-complete",r=>{r&&B(this,vo)[vo](r)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",B(this,Wt)[Wt]),window.addEventListener("offline",B(this,Wt)[Wt]),setTimeout(B(this,Wt)[Wt],3e3))}function wP(n,e){e===void 0&&(e={});const{forceAllowNewUpload:t=!1}=e,{allowNewUpload:r,currentUploads:i}=this.getState();if(!r&&!t)throw new Error("Cannot create a new upload: already uploading.");const s=NR();return this.emit("upload",s,this.getFilesByIds(n)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...i,[s]:{fileIDs:n,step:0,result:{}}}}),s}function kP(n){const{currentUploads:e}=this.getState();return e[n]}function SP(n){const e={...this.getState().currentUploads};delete e[n],this.setState({currentUploads:e})}async function xP(n){const e=()=>{const{currentUploads:s}=this.getState();return s[n]};let t=e();const r=[...B(this,Mr)[Mr],...B(this,Ar)[Ar],...B(this,On)[On]];try{for(let s=t.step||0;s<r.length&&t;s++){const o=r[s];this.setState({currentUploads:{...this.getState().currentUploads,[n]:{...t,step:s}}});const{fileIDs:a}=t;await o(a,n),t=e()}}catch(s){throw B(this,Pr)[Pr](n),s}if(t){t.fileIDs.forEach(l=>{const u=this.getFile(l);u&&u.progress.postprocess&&this.emit("postprocess-complete",u)});const s=t.fileIDs.map(l=>this.getFile(l)),o=s.filter(l=>!l.error),a=s.filter(l=>l.error);this.addResultData(n,{successful:o,failed:a,uploadID:n}),t=e()}let i;return t&&(i=t.result,B(this,Pr)[Pr](n)),i==null&&this.log(`Not setting result for an upload that has been removed: ${n}`),i}Au.VERSION=aP.version;var Ou,Me,Aw,Or,gg,Ow,eh,wo={},Nw=[],TP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Of=Array.isArray;function ir(n,e){for(var t in e)n[t]=e[t];return n}function _w(n){var e=n.parentNode;e&&e.removeChild(n)}function Dt(n,e,t){var r,i,s,o={};for(s in e)s=="key"?r=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Ou.call(arguments,2):t),typeof n=="function"&&n.defaultProps!=null)for(s in n.defaultProps)o[s]===void 0&&(o[s]=n.defaultProps[s]);return Qa(n,o,r,i,null)}function Qa(n,e,t,r,i){var s={type:n,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Aw,__i:-1,__u:0};return i==null&&Me.vnode!=null&&Me.vnode(s),s}function Nu(n){return n.children}function Za(n,e){this.props=n,this.context=e}function zi(n,e){if(e==null)return n.__?zi(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?zi(n):null}function Rw(n){var e,t;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,e=0;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null){n.__e=n.__c.base=t.__e;break}return Rw(n)}}function yg(n){(!n.__d&&(n.__d=!0)&&Or.push(n)&&!eu.__r++||gg!==Me.debounceRendering)&&((gg=Me.debounceRendering)||Ow)(eu)}function eu(){var n,e,t,r,i,s,o,a,l;for(Or.sort(eh);n=Or.shift();)n.__d&&(e=Or.length,r=void 0,s=(i=(t=n).__v).__e,a=[],l=[],(o=t.__P)&&((r=ir({},i)).__v=i.__v+1,Me.vnode&&Me.vnode(r),Nf(o,r,i,t.__n,o.ownerSVGElement!==void 0,32&i.__u?[s]:null,a,s??zi(i),!!(32&i.__u),l),r.__.__k[r.__i]=r,Dw(a,r,l),r.__e!=s&&Rw(r)),Or.length>e&&Or.sort(eh));eu.__r=0}function Pw(n,e,t,r,i,s,o,a,l,u,c){var d,h,f,p,m,g=r&&r.__k||Nw,y=e.length;for(t.__d=l,CP(t,e,g),l=t.__d,d=0;d<y;d++)(f=t.__k[d])!=null&&typeof f!="boolean"&&typeof f!="function"&&(h=f.__i===-1?wo:g[f.__i]||wo,f.__i=d,Nf(n,f,h,i,s,o,a,l,u,c),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&_f(h.ref,null,f),c.push(f.ref,f.__c||p,f)),m==null&&p!=null&&(m=p),65536&f.__u||h.__k===f.__k?l=Iw(f,l,n):typeof f.type=="function"&&f.__d!==void 0?l=f.__d:p&&(l=p.nextSibling),f.__d=void 0,f.__u&=-196609);t.__d=l,t.__e=m}function CP(n,e,t){var r,i,s,o,a,l=e.length,u=t.length,c=u,d=0;for(n.__k=[],r=0;r<l;r++)(i=n.__k[r]=(i=e[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?Qa(null,i,null,null,i):Of(i)?Qa(Nu,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?Qa(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=n,i.__b=n.__b+1,a=EP(i,t,o=r+d,c),i.__i=a,s=null,a!==-1&&(c--,(s=t[a])&&(s.__u|=131072)),s==null||s.__v===null?(a==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):a!==o&&(a===o+1?d++:a>o?c>l-o?d+=a-o:d--:d=a<o&&a==o-1?a-o:0,a!==r+d&&(i.__u|=65536))):(s=t[r])&&s.key==null&&s.__e&&(s.__e==n.__d&&(n.__d=zi(s)),th(s,s,!1),t[r]=null,c--);if(c)for(r=0;r<u;r++)(s=t[r])!=null&&(131072&s.__u)==0&&(s.__e==n.__d&&(n.__d=zi(s)),th(s,s))}function Iw(n,e,t){var r,i;if(typeof n.type=="function"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,e=Iw(r[i],e,t));return e}return n.__e!=e&&(t.insertBefore(n.__e,e||null),e=n.__e),e&&e.nextSibling}function EP(n,e,t,r){var i=n.key,s=n.type,o=t-1,a=t+1,l=e[t];if(l===null||l&&i==l.key&&s===l.type)return t;if(r>(l!=null&&(131072&l.__u)==0?1:0))for(;o>=0||a<e.length;){if(o>=0){if((l=e[o])&&(131072&l.__u)==0&&i==l.key&&s===l.type)return o;o--}if(a<e.length){if((l=e[a])&&(131072&l.__u)==0&&i==l.key&&s===l.type)return a;a++}}return-1}function bg(n,e,t){e[0]==="-"?n.setProperty(e,t??""):n[e]=t==null?"":typeof t!="number"||TP.test(e)?t:t+"px"}function Ca(n,e,t,r,i){var s;e:if(e==="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(e in r)t&&e in t||bg(n.style,e,"");if(t)for(e in t)r&&t[e]===r[e]||bg(n.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")s=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in n?e.toLowerCase().slice(2):e.slice(2),n.l||(n.l={}),n.l[e+s]=t,t?r?t.u=r.u:(t.u=Date.now(),n.addEventListener(e,s?wg:vg,s)):n.removeEventListener(e,s?wg:vg,s);else{if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in n)try{n[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?n.removeAttribute(e):n.setAttribute(e,t))}}function vg(n){var e=this.l[n.type+!1];if(n.t){if(n.t<=e.u)return}else n.t=Date.now();return e(Me.event?Me.event(n):n)}function wg(n){return this.l[n.type+!0](Me.event?Me.event(n):n)}function Nf(n,e,t,r,i,s,o,a,l,u){var c,d,h,f,p,m,g,y,v,k,b,x,A,O,_,I=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(c=Me.__b)&&c(e);e:if(typeof I=="function")try{if(y=e.props,v=(c=I.contextType)&&r[c.__c],k=c?v?v.props.value:c.__:r,t.__c?g=(d=e.__c=t.__c).__=d.__E:("prototype"in I&&I.prototype.render?e.__c=d=new I(y,k):(e.__c=d=new Za(y,k),d.constructor=I,d.render=AP),v&&v.sub(d),d.props=y,d.state||(d.state={}),d.context=k,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),d.__s==null&&(d.__s=d.state),I.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ir({},d.__s)),ir(d.__s,I.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,h)I.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(I.getDerivedStateFromProps==null&&y!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(y,k),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(y,d.__s,k)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function($){$&&($.__=e)}),b=0;b<d._sb.length;b++)d.__h.push(d._sb[b]);d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(y,d.__s,k),d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,p,m)})}if(d.context=k,d.props=y,d.__P=n,d.__e=!1,x=Me.__r,A=0,"prototype"in I&&I.prototype.render){for(d.state=d.__s,d.__d=!1,x&&x(e),c=d.render(d.props,d.state,d.context),O=0;O<d._sb.length;O++)d.__h.push(d._sb[O]);d._sb=[]}else do d.__d=!1,x&&x(e),c=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++A<25);d.state=d.__s,d.getChildContext!=null&&(r=ir(ir({},r),d.getChildContext())),h||d.getSnapshotBeforeUpdate==null||(m=d.getSnapshotBeforeUpdate(f,p)),Pw(n,Of(_=c!=null&&c.type===Nu&&c.key==null?c.props.children:c)?_:[_],e,t,r,i,s,o,a,l,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),g&&(d.__E=d.__=null)}catch($){e.__v=null,l||s!=null?(e.__e=a,e.__u|=l?160:32,s[s.indexOf(a)]=null):(e.__e=t.__e,e.__k=t.__k),Me.__e($,e,t)}else s==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=MP(t.__e,e,t,r,i,s,o,l,u);(c=Me.diffed)&&c(e)}function Dw(n,e,t){e.__d=void 0;for(var r=0;r<t.length;r++)_f(t[r],t[++r],t[++r]);Me.__c&&Me.__c(e,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(s){s.call(i)})}catch(s){Me.__e(s,i.__v)}})}function MP(n,e,t,r,i,s,o,a,l){var u,c,d,h,f,p,m,g=t.props,y=e.props,v=e.type;if(v==="svg"&&(i=!0),s!=null){for(u=0;u<s.length;u++)if((f=s[u])&&"setAttribute"in f==!!v&&(v?f.localName===v:f.nodeType===3)){n=f,s[u]=null;break}}if(n==null){if(v===null)return document.createTextNode(y);n=i?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),s=null,a=!1}if(v===null)g===y||a&&n.data===y||(n.data=y);else{if(s=s&&Ou.call(n.childNodes),g=t.props||wo,!a&&s!=null)for(g={},u=0;u<n.attributes.length;u++)g[(f=n.attributes[u]).name]=f.value;for(u in g)f=g[u],u=="children"||(u=="dangerouslySetInnerHTML"?d=f:u==="key"||u in y||Ca(n,u,null,f,i));for(u in y)f=y[u],u=="children"?h=f:u=="dangerouslySetInnerHTML"?c=f:u=="value"?p=f:u=="checked"?m=f:u==="key"||a&&typeof f!="function"||g[u]===f||Ca(n,u,f,g[u],i);if(c)a||d&&(c.__html===d.__html||c.__html===n.innerHTML)||(n.innerHTML=c.__html),e.__k=[];else if(d&&(n.innerHTML=""),Pw(n,Of(h)?h:[h],e,t,r,i&&v!=="foreignObject",s,o,s?s[0]:t.__k&&zi(t,0),a,l),s!=null)for(u=s.length;u--;)s[u]!=null&&_w(s[u]);a||(u="value",p!==void 0&&(p!==n[u]||v==="progress"&&!p||v==="option"&&p!==g[u])&&Ca(n,u,p,g[u],!1),u="checked",m!==void 0&&m!==n[u]&&Ca(n,u,m,g[u],!1))}return n}function _f(n,e,t){try{typeof n=="function"?n(e):n.current=e}catch(r){Me.__e(r,t)}}function th(n,e,t){var r,i;if(Me.unmount&&Me.unmount(n),(r=n.ref)&&(r.current&&r.current!==n.__e||_f(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){Me.__e(s,e)}r.base=r.__P=null,n.__c=void 0}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&th(r[i],e,t||typeof n.type!="function");t||n.__e==null||_w(n.__e),n.__=n.__e=n.__d=void 0}function AP(n,e,t){return this.constructor(n,t)}function kg(n,e,t){var r,i,s,o;Me.__&&Me.__(n,e),i=(r=!1)?null:e.__k,s=[],o=[],Nf(e,n=e.__k=Dt(Nu,null,[n]),i||wo,wo,e.ownerSVGElement!==void 0,i?null:e.firstChild?Ou.call(e.childNodes):null,s,i?i.__e:e.firstChild,r,o),Dw(s,n,o)}Ou=Nw.slice,Me={__e:function(n,e,t,r){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(n)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),o=i.__d),o)return i.__E=i}catch(a){n=a}throw n}},Aw=0,Za.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ir({},this.state),typeof n=="function"&&(n=n(ir({},t),this.props)),n&&ir(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),yg(this))},Za.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),yg(this))},Za.prototype.render=Nu,Or=[],Ow=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,eh=function(n,e){return n.__v.__b-e.__v.__b},eu.__r=0;function OP(n){return typeof n!="object"||n===null||!("nodeType"in n)?!1:n.nodeType===Node.ELEMENT_NODE}function NP(n,e){return e===void 0&&(e=document),typeof n=="string"?e.querySelector(n):OP(n)?n:null}function _P(n){for(var e;n&&!n.dir;)n=n.parentNode;return(e=n)==null?void 0:e.dir}class Lw{constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new xw([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}function Sg(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var RP=0;function PP(n){return"__private_"+RP+++"_"+n}function IP(n){let e=null,t;return function(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return t=i,e||(e=Promise.resolve().then(()=>(e=null,n(...t)))),e}}var ds=PP("updateUI");class ko extends Lw{constructor(){super(...arguments),Object.defineProperty(this,ds,{writable:!0,value:void 0})}getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof ko||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:ko}}));else if(typeof e=="function"){const r=e;this.uppy.iteratePlugins(i=>{i instanceof r&&(t=i)})}return t}mount(e,t){const r=t.id,i=NP(e);if(i){this.isTargetDOMEl=!0;const a=document.createElement("div");return a.classList.add("uppy-Root"),Sg(this,ds)[ds]=IP(l=>{this.uppy.getPlugin(this.id)&&(kg(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(i.innerHTML=""),kg(this.render(this.uppy.getState(),a),a),this.el=a,i.appendChild(a),a.dir=this.opts.direction||_P(a)||"ltr",this.onMount(),this.el}const s=this.getTargetPlugin(e);if(s)return this.uppy.log(`Installing ${r} to ${s.id}`),this.parent=s,this.el=s.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){if(this.el!=null){var t,r;(t=(r=Sg(this,ds))[ds])==null||t.call(r,e)}}unmount(){if(this.isTargetDOMEl){var e;(e=this.el)==null||e.remove()}this.onUnmount()}onMount(){}onUnmount(){}}const Fw=Array.from;function DP(){const n=document.body;return!(!("draggable"in n)||!("ondragstart"in n&&"ondrop"in n)||!("FormData"in window)||!("FileReader"in window))}function $w(n,e,t,r){let{onSuccess:i}=r;n.readEntries(s=>{const o=[...e,...s];s.length?queueMicrotask(()=>{$w(n,o,t,{onSuccess:i})}):i(o)},s=>{t(s),i(e)})}function Bw(n,e){return n==null?n:{kind:n.isFile?"file":n.isDirectory?"directory":void 0,name:n.name,getFile(){return new Promise((t,r)=>n.file(t,r))},async*values(){const t=n.createReader();yield*await new Promise(i=>{$w(t,[],e,{onSuccess:s=>i(s.map(o=>Bw(o,e)))})})},isSameEntry:void 0}}function zw(n,e,t){try{return t===void 0&&(t=void 0),async function*(){const r=()=>`${e}/${n.name}`;if(n.kind==="file"){const i=await n.getFile();i!=null?(i.relativePath=e?r():null,yield i):t!=null&&(yield t)}else if(n.kind==="directory")for await(const i of n.values())yield*zw(i,e?r():n.name);else t!=null&&(yield t)}()}catch(r){return Promise.reject(r)}}async function*LP(n,e){const t=await Promise.all(Array.from(n.items,async r=>{var i;let s;const o=()=>typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry();return(i=s)!=null||(s=Bw(o(),e)),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(const{lastResortFile:r,fileSystemHandle:i}of t)if(i!=null)try{yield*zw(i,"",r)}catch(s){r!=null?yield r:e(s)}else r!=null&&(yield r)}function FP(n){const e=Fw(n.files);return Promise.resolve(e)}async function $P(n,e){var t;const r=(t=e?.logDropError)!=null?t:Function.prototype;try{const i=[];for await(const s of LP(n,r))i.push(s);return i}catch{return FP(n)}}const BP={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}},zP={version:"4.1.2"},UP={inputName:"files[]",width:"100%",height:"100%"};class _u extends ko{constructor(e,t){super(e,{...UP,...t}),this.isDragDropSupported=DP(),this.addFiles=r=>{const i=r.map(s=>({source:this.id,name:s.name,type:s.type,data:s,meta:{relativePath:s.relativePath||null}}));try{this.uppy.addFiles(i)}catch(s){this.uppy.log(s)}},this.onInputChange=r=>{const i=Fw(r.currentTarget.files||[]);i.length>0&&(this.uppy.log("[DragDrop] Files selected through input"),this.addFiles(i)),r.currentTarget.value=""},this.handleDragOver=r=>{var i,s;r.preventDefault(),r.stopPropagation();const{types:o}=r.dataTransfer,a=o.some(u=>u==="Files"),{allowNewUpload:l}=this.uppy.getState();if(!a||!l){r.dataTransfer.dropEffect="none";return}r.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),(i=(s=this.opts).onDragOver)==null||i.call(s,r)},this.handleDragLeave=r=>{var i,s;r.preventDefault(),r.stopPropagation(),this.setPluginState({isDraggingOver:!1}),(i=(s=this.opts).onDragLeave)==null||i.call(s,r)},this.handleDrop=async r=>{var i,s;r.preventDefault(),r.stopPropagation(),this.setPluginState({isDraggingOver:!1});const o=l=>{this.uppy.log(l,"error")},a=await $P(r.dataTransfer,{logDropError:o});a.length>0&&(this.uppy.log("[DragDrop] Files dropped"),this.addFiles(a)),(i=(s=this.opts).onDrop)==null||i.call(s,r)},this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=BP,this.i18nInit()}renderHiddenFileInput(){var e;const{restrictions:t}=this.uppy.opts;return Dt("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:r=>{this.fileInputRef=r},name:this.opts.inputName,multiple:t.maxNumberOfFiles!==1,accept:(e=t.allowedFileTypes)==null?void 0:e.join(", "),onChange:this.onInputChange})}static renderArrowSvg(){return Dt("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16"},Dt("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"}))}renderLabel(){return Dt("div",{className:"uppy-DragDrop-label"},this.i18nArray("dropHereOr",{browse:Dt("span",{className:"uppy-DragDrop-browse"},this.i18n("browse"))}))}renderNote(){return Dt("span",{className:"uppy-DragDrop-note"},this.opts.note)}render(){const e=`uppy-u-reset
|
|
106
|
-
uppy-DragDrop-container
|
|
107
|
-
${this.isDragDropSupported?"uppy-DragDrop--isDragDropSupported":""}
|
|
108
|
-
${this.getPluginState().isDraggingOver?"uppy-DragDrop--isDraggingOver":""}
|
|
109
|
-
`,t={width:this.opts.width,height:this.opts.height};return Dt("button",{type:"button",className:e,style:t,onClick:()=>this.fileInputRef.click(),onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},this.renderHiddenFileInput(),Dt("div",{className:"uppy-DragDrop-inner"},_u.renderArrowSvg(),this.renderLabel(),this.renderNote()))}install(){const{target:e}=this.opts;this.setPluginState({isDraggingOver:!1}),e&&this.mount(e,this)}uninstall(){this.unmount()}}_u.VERSION=zP.version;const HP={version:"4.2.1"},VP={fixed:!1,hideAfterFinish:!0};class Uw extends ko{constructor(e,t){super(e,{...VP,...t}),this.id=this.opts.id||"ProgressBar",this.title="Progress Bar",this.type="progressindicator",this.render=this.render.bind(this)}render(e){const{totalProgress:t}=e,r=(t===0||t===100)&&this.opts.hideAfterFinish;return Dt("div",{className:"uppy uppy-ProgressBar",style:{position:this.opts.fixed?"fixed":"initial"},"aria-hidden":r},Dt("div",{className:"uppy-ProgressBar-inner",style:{width:`${t}%`}}),Dt("div",{className:"uppy-ProgressBar-percentage"},t))}install(){const{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}}Uw.VERSION=HP.version;function nh(n){"@babel/helpers - typeof";return nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nh(n)}function qP(n,e,t){return Object.defineProperty(n,"prototype",{writable:!1}),n}function jP(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function WP(n,e,t){return e=xo(e),JP(n,Rf()?Reflect.construct(e,t||[],xo(n).constructor):e.apply(n,t))}function JP(n,e){if(e&&(nh(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KP(n)}function KP(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function GP(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&So(n,e)}function rh(n){var e=typeof Map=="function"?new Map:void 0;return rh=function(r){if(r===null||!XP(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return YP(r,arguments,xo(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),So(i,r)},rh(n)}function YP(n,e,t){if(Rf())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(n.bind.apply(n,r));return t&&So(i,t.prototype),i}function Rf(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rf=function(){return!!n})()}function XP(n){try{return Function.toString.call(n).indexOf("[native code]")!==-1}catch{return typeof n=="function"}}function So(n,e){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},So(n,e)}function xo(n){return xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xo(n)}var Ea=function(n){function e(t){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(jP(this,e),r=WP(this,e,[t]),r.originalRequest=s,r.originalResponse=o,r.causingError=i,i!=null&&(t+=", caused by ".concat(i.toString())),s!=null){var a=s.getHeader("X-Request-ID")||"n/a",l=s.getMethod(),u=s.getURL(),c=o?o.getStatus():"n/a",d=o?o.getBody()||"":"n/a";t+=", originated from request (method: ".concat(l,", url: ").concat(u,", response code: ").concat(c,", response text: ").concat(d,", request id: ").concat(a,")")}return r.message=t,r}return GP(e,n),qP(e)}(rh(Error));function To(n){"@babel/helpers - typeof";return To=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},To(n)}function QP(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function ZP(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,tI(r.key),r)}}function eI(n,e,t){return e&&ZP(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function tI(n){var e=nI(n,"string");return To(e)=="symbol"?e:e+""}function nI(n,e){if(To(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(To(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var rI=function(){function n(){QP(this,n)}return eI(n,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,r){return Promise.resolve(null)}}])}();const Hw="3.7.5",iI=Hw,sI=typeof atob=="function",oI=typeof btoa=="function",Wi=typeof Buffer=="function",xg=typeof TextDecoder=="function"?new TextDecoder:void 0,Tg=typeof TextEncoder=="function"?new TextEncoder:void 0,aI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",$s=Array.prototype.slice.call(aI),Ma=(n=>{let e={};return n.forEach((t,r)=>e[t]=r),e})($s),lI=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Ye=String.fromCharCode.bind(String),Cg=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):n=>new Uint8Array(Array.prototype.slice.call(n,0)),Vw=n=>n.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),qw=n=>n.replace(/[^A-Za-z0-9\+\/]/g,""),jw=n=>{let e,t,r,i,s="";const o=n.length%3;for(let a=0;a<n.length;){if((t=n.charCodeAt(a++))>255||(r=n.charCodeAt(a++))>255||(i=n.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=t<<16|r<<8|i,s+=$s[e>>18&63]+$s[e>>12&63]+$s[e>>6&63]+$s[e&63]}return o?s.slice(0,o-3)+"===".substring(o):s},Pf=oI?n=>btoa(n):Wi?n=>Buffer.from(n,"binary").toString("base64"):jw,ih=Wi?n=>Buffer.from(n).toString("base64"):n=>{let t=[];for(let r=0,i=n.length;r<i;r+=4096)t.push(Ye.apply(null,n.subarray(r,r+4096)));return Pf(t.join(""))},el=(n,e=!1)=>e?Vw(ih(n)):ih(n),uI=n=>{if(n.length<2){var e=n.charCodeAt(0);return e<128?n:e<2048?Ye(192|e>>>6)+Ye(128|e&63):Ye(224|e>>>12&15)+Ye(128|e>>>6&63)+Ye(128|e&63)}else{var e=65536+(n.charCodeAt(0)-55296)*1024+(n.charCodeAt(1)-56320);return Ye(240|e>>>18&7)+Ye(128|e>>>12&63)+Ye(128|e>>>6&63)+Ye(128|e&63)}},cI=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ww=n=>n.replace(cI,uI),Eg=Wi?n=>Buffer.from(n,"utf8").toString("base64"):Tg?n=>ih(Tg.encode(n)):n=>Pf(Ww(n)),Mi=(n,e=!1)=>e?Vw(Eg(n)):Eg(n),Mg=n=>Mi(n,!0),dI=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,hI=n=>{switch(n.length){case 4:var e=(7&n.charCodeAt(0))<<18|(63&n.charCodeAt(1))<<12|(63&n.charCodeAt(2))<<6|63&n.charCodeAt(3),t=e-65536;return Ye((t>>>10)+55296)+Ye((t&1023)+56320);case 3:return Ye((15&n.charCodeAt(0))<<12|(63&n.charCodeAt(1))<<6|63&n.charCodeAt(2));default:return Ye((31&n.charCodeAt(0))<<6|63&n.charCodeAt(1))}},Jw=n=>n.replace(dI,hI),Kw=n=>{if(n=n.replace(/\s+/g,""),!lI.test(n))throw new TypeError("malformed base64.");n+="==".slice(2-(n.length&3));let e,t="",r,i;for(let s=0;s<n.length;)e=Ma[n.charAt(s++)]<<18|Ma[n.charAt(s++)]<<12|(r=Ma[n.charAt(s++)])<<6|(i=Ma[n.charAt(s++)]),t+=r===64?Ye(e>>16&255):i===64?Ye(e>>16&255,e>>8&255):Ye(e>>16&255,e>>8&255,e&255);return t},If=sI?n=>atob(qw(n)):Wi?n=>Buffer.from(n,"base64").toString("binary"):Kw,Gw=Wi?n=>Cg(Buffer.from(n,"base64")):n=>Cg(If(n).split("").map(e=>e.charCodeAt(0))),Yw=n=>Gw(Xw(n)),fI=Wi?n=>Buffer.from(n,"base64").toString("utf8"):xg?n=>xg.decode(Gw(n)):n=>Jw(If(n)),Xw=n=>qw(n.replace(/[-_]/g,e=>e=="-"?"+":"/")),sh=n=>fI(Xw(n)),pI=n=>{if(typeof n!="string")return!1;const e=n.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},Qw=n=>({value:n,enumerable:!1,writable:!0,configurable:!0}),Zw=function(){const n=(e,t)=>Object.defineProperty(String.prototype,e,Qw(t));n("fromBase64",function(){return sh(this)}),n("toBase64",function(e){return Mi(this,e)}),n("toBase64URI",function(){return Mi(this,!0)}),n("toBase64URL",function(){return Mi(this,!0)}),n("toUint8Array",function(){return Yw(this)})},e1=function(){const n=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Qw(t));n("toBase64",function(e){return el(this,e)}),n("toBase64URI",function(){return el(this,!0)}),n("toBase64URL",function(){return el(this,!0)})},mI=()=>{Zw(),e1()},gI={version:Hw,VERSION:iI,atob:If,atobPolyfill:Kw,btoa:Pf,btoaPolyfill:jw,fromBase64:sh,toBase64:Mi,encode:Mi,encodeURI:Mg,encodeURL:Mg,utob:Ww,btou:Jw,decode:sh,isValid:pI,fromUint8Array:el,toUint8Array:Yw,extendString:Zw,extendUint8Array:e1,extendBuiltins:mI};var Bc,Ag;function yI(){return Ag||(Ag=1,Bc=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}),Bc}var Aa={},Og;function bI(){if(Og)return Aa;Og=1;var n=Object.prototype.hasOwnProperty,e;function t(o){try{return decodeURIComponent(o.replace(/\+/g," "))}catch{return null}}function r(o){try{return encodeURIComponent(o)}catch{return null}}function i(o){for(var a=/([^=?#&]+)=?([^&]*)/g,l={},u;u=a.exec(o);){var c=t(u[1]),d=t(u[2]);c===null||d===null||c in l||(l[c]=d)}return l}function s(o,a){a=a||"";var l=[],u,c;typeof a!="string"&&(a="?");for(c in o)if(n.call(o,c)){if(u=o[c],!u&&(u===null||u===e||isNaN(u))&&(u=""),c=r(c),u=r(u),c===null||u===null)continue;l.push(c+"="+u)}return l.length?a+l.join("&"):""}return Aa.stringify=s,Aa.parse=i,Aa}var zc,Ng;function vI(){if(Ng)return zc;Ng=1;var n=yI(),e=bI(),t=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r=/[\n\r\t]/g,i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/:\d+$/,o=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,a=/^[a-zA-Z]:/;function l(v){return(v||"").toString().replace(t,"")}var u=[["#","hash"],["?","query"],function(k,b){return h(b.protocol)?k.replace(/\\/g,"/"):k},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],c={hash:1,query:1};function d(v){var k;typeof window<"u"?k=window:typeof jf<"u"?k=jf:typeof self<"u"?k=self:k={};var b=k.location||{};v=v||b;var x={},A=typeof v,O;if(v.protocol==="blob:")x=new m(unescape(v.pathname),{});else if(A==="string"){x=new m(v,{});for(O in c)delete x[O]}else if(A==="object"){for(O in v)O in c||(x[O]=v[O]);x.slashes===void 0&&(x.slashes=i.test(v.href))}return x}function h(v){return v==="file:"||v==="ftp:"||v==="http:"||v==="https:"||v==="ws:"||v==="wss:"}function f(v,k){v=l(v),v=v.replace(r,""),k=k||{};var b=o.exec(v),x=b[1]?b[1].toLowerCase():"",A=!!b[2],O=!!b[3],_=0,I;return A?O?(I=b[2]+b[3]+b[4],_=b[2].length+b[3].length):(I=b[2]+b[4],_=b[2].length):O?(I=b[3]+b[4],_=b[3].length):I=b[4],x==="file:"?_>=2&&(I=I.slice(2)):h(x)?I=b[4]:x?A&&(I=I.slice(2)):_>=2&&h(k.protocol)&&(I=b[4]),{protocol:x,slashes:A||h(x),slashesCount:_,rest:I}}function p(v,k){if(v==="")return k;for(var b=(k||"/").split("/").slice(0,-1).concat(v.split("/")),x=b.length,A=b[x-1],O=!1,_=0;x--;)b[x]==="."?b.splice(x,1):b[x]===".."?(b.splice(x,1),_++):_&&(x===0&&(O=!0),b.splice(x,1),_--);return O&&b.unshift(""),(A==="."||A==="..")&&b.push(""),b.join("/")}function m(v,k,b){if(v=l(v),v=v.replace(r,""),!(this instanceof m))return new m(v,k,b);var x,A,O,_,I,$,Y=u.slice(),ie=typeof k,P=this,oe=0;for(ie!=="object"&&ie!=="string"&&(b=k,k=null),b&&typeof b!="function"&&(b=e.parse),k=d(k),A=f(v||"",k),x=!A.protocol&&!A.slashes,P.slashes=A.slashes||x&&k.slashes,P.protocol=A.protocol||k.protocol||"",v=A.rest,(A.protocol==="file:"&&(A.slashesCount!==2||a.test(v))||!A.slashes&&(A.protocol||A.slashesCount<2||!h(P.protocol)))&&(Y[3]=[/(.*)/,"pathname"]);oe<Y.length;oe++){if(_=Y[oe],typeof _=="function"){v=_(v,P);continue}O=_[0],$=_[1],O!==O?P[$]=v:typeof O=="string"?(I=O==="@"?v.lastIndexOf(O):v.indexOf(O),~I&&(typeof _[2]=="number"?(P[$]=v.slice(0,I),v=v.slice(I+_[2])):(P[$]=v.slice(I),v=v.slice(0,I)))):(I=O.exec(v))&&(P[$]=I[1],v=v.slice(0,I.index)),P[$]=P[$]||x&&_[3]&&k[$]||"",_[4]&&(P[$]=P[$].toLowerCase())}b&&(P.query=b(P.query)),x&&k.slashes&&P.pathname.charAt(0)!=="/"&&(P.pathname!==""||k.pathname!=="")&&(P.pathname=p(P.pathname,k.pathname)),P.pathname.charAt(0)!=="/"&&h(P.protocol)&&(P.pathname="/"+P.pathname),n(P.port,P.protocol)||(P.host=P.hostname,P.port=""),P.username=P.password="",P.auth&&(I=P.auth.indexOf(":"),~I?(P.username=P.auth.slice(0,I),P.username=encodeURIComponent(decodeURIComponent(P.username)),P.password=P.auth.slice(I+1),P.password=encodeURIComponent(decodeURIComponent(P.password))):P.username=encodeURIComponent(decodeURIComponent(P.auth)),P.auth=P.password?P.username+":"+P.password:P.username),P.origin=P.protocol!=="file:"&&h(P.protocol)&&P.host?P.protocol+"//"+P.host:"null",P.href=P.toString()}function g(v,k,b){var x=this;switch(v){case"query":typeof k=="string"&&k.length&&(k=(b||e.parse)(k)),x[v]=k;break;case"port":x[v]=k,n(k,x.protocol)?k&&(x.host=x.hostname+":"+k):(x.host=x.hostname,x[v]="");break;case"hostname":x[v]=k,x.port&&(k+=":"+x.port),x.host=k;break;case"host":x[v]=k,s.test(k)?(k=k.split(":"),x.port=k.pop(),x.hostname=k.join(":")):(x.hostname=k,x.port="");break;case"protocol":x.protocol=k.toLowerCase(),x.slashes=!b;break;case"pathname":case"hash":if(k){var A=v==="pathname"?"/":"#";x[v]=k.charAt(0)!==A?A+k:k}else x[v]=k;break;case"username":case"password":x[v]=encodeURIComponent(k);break;case"auth":var O=k.indexOf(":");~O?(x.username=k.slice(0,O),x.username=encodeURIComponent(decodeURIComponent(x.username)),x.password=k.slice(O+1),x.password=encodeURIComponent(decodeURIComponent(x.password))):x.username=encodeURIComponent(decodeURIComponent(k))}for(var _=0;_<u.length;_++){var I=u[_];I[4]&&(x[I[1]]=x[I[1]].toLowerCase())}return x.auth=x.password?x.username+":"+x.password:x.username,x.origin=x.protocol!=="file:"&&h(x.protocol)&&x.host?x.protocol+"//"+x.host:"null",x.href=x.toString(),x}function y(v){(!v||typeof v!="function")&&(v=e.stringify);var k,b=this,x=b.host,A=b.protocol;A&&A.charAt(A.length-1)!==":"&&(A+=":");var O=A+(b.protocol&&b.slashes||h(b.protocol)?"//":"");return b.username?(O+=b.username,b.password&&(O+=":"+b.password),O+="@"):b.password?(O+=":"+b.password,O+="@"):b.protocol!=="file:"&&h(b.protocol)&&!x&&b.pathname!=="/"&&(O+="@"),(x[x.length-1]===":"||s.test(b.hostname)&&!b.port)&&(x+=":"),O+=x+b.pathname,k=typeof b.query=="object"?v(b.query):b.query,k&&(O+=k.charAt(0)!=="?"?"?"+k:k),b.hash&&(O+=b.hash),O}return m.prototype={set:g,toString:y},m.extractProtocol=f,m.location=d,m.trimLeft=l,m.qs=e,zc=m,zc}var wI=vI();const kI=Io(wI);function SI(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var e=Math.random()*16|0,t=n==="x"?e:e&3|8;return t.toString(16)})}function oh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */oh=function(){return e};var n,e={},t=Object.prototype,r=t.hasOwnProperty,i=Object.defineProperty||function(E,S,T){E[S]=T.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(E,S,T){return Object.defineProperty(E,S,{value:T,enumerable:!0,configurable:!0,writable:!0}),E[S]}try{u({},"")}catch{u=function(T,R,L){return T[R]=L}}function c(E,S,T,R){var L=S&&S.prototype instanceof y?S:y,D=Object.create(L.prototype),J=new oe(R||[]);return i(D,"_invoke",{value:$(E,T,J)}),D}function d(E,S,T){try{return{type:"normal",arg:E.call(S,T)}}catch(R){return{type:"throw",arg:R}}}e.wrap=c;var h="suspendedStart",f="suspendedYield",p="executing",m="completed",g={};function y(){}function v(){}function k(){}var b={};u(b,o,function(){return this});var x=Object.getPrototypeOf,A=x&&x(x(ue([])));A&&A!==t&&r.call(A,o)&&(b=A);var O=k.prototype=y.prototype=Object.create(b);function _(E){["next","throw","return"].forEach(function(S){u(E,S,function(T){return this._invoke(S,T)})})}function I(E,S){function T(L,D,J,se){var le=d(E[L],E,D);if(le.type!=="throw"){var we=le.arg,ke=we.value;return ke&&ti(ke)=="object"&&r.call(ke,"__await")?S.resolve(ke.__await).then(function(Oe){T("next",Oe,J,se)},function(Oe){T("throw",Oe,J,se)}):S.resolve(ke).then(function(Oe){we.value=Oe,J(we)},function(Oe){return T("throw",Oe,J,se)})}se(le.arg)}var R;i(this,"_invoke",{value:function(D,J){function se(){return new S(function(le,we){T(D,J,le,we)})}return R=R?R.then(se,se):se()}})}function $(E,S,T){var R=h;return function(L,D){if(R===p)throw Error("Generator is already running");if(R===m){if(L==="throw")throw D;return{value:n,done:!0}}for(T.method=L,T.arg=D;;){var J=T.delegate;if(J){var se=Y(J,T);if(se){if(se===g)continue;return se}}if(T.method==="next")T.sent=T._sent=T.arg;else if(T.method==="throw"){if(R===h)throw R=m,T.arg;T.dispatchException(T.arg)}else T.method==="return"&&T.abrupt("return",T.arg);R=p;var le=d(E,S,T);if(le.type==="normal"){if(R=T.done?m:f,le.arg===g)continue;return{value:le.arg,done:T.done}}le.type==="throw"&&(R=m,T.method="throw",T.arg=le.arg)}}}function Y(E,S){var T=S.method,R=E.iterator[T];if(R===n)return S.delegate=null,T==="throw"&&E.iterator.return&&(S.method="return",S.arg=n,Y(E,S),S.method==="throw")||T!=="return"&&(S.method="throw",S.arg=new TypeError("The iterator does not provide a '"+T+"' method")),g;var L=d(R,E.iterator,S.arg);if(L.type==="throw")return S.method="throw",S.arg=L.arg,S.delegate=null,g;var D=L.arg;return D?D.done?(S[E.resultName]=D.value,S.next=E.nextLoc,S.method!=="return"&&(S.method="next",S.arg=n),S.delegate=null,g):D:(S.method="throw",S.arg=new TypeError("iterator result is not an object"),S.delegate=null,g)}function ie(E){var S={tryLoc:E[0]};1 in E&&(S.catchLoc=E[1]),2 in E&&(S.finallyLoc=E[2],S.afterLoc=E[3]),this.tryEntries.push(S)}function P(E){var S=E.completion||{};S.type="normal",delete S.arg,E.completion=S}function oe(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(ie,this),this.reset(!0)}function ue(E){if(E||E===""){var S=E[o];if(S)return S.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var T=-1,R=function L(){for(;++T<E.length;)if(r.call(E,T))return L.value=E[T],L.done=!1,L;return L.value=n,L.done=!0,L};return R.next=R}}throw new TypeError(ti(E)+" is not iterable")}return v.prototype=k,i(O,"constructor",{value:k,configurable:!0}),i(k,"constructor",{value:v,configurable:!0}),v.displayName=u(k,l,"GeneratorFunction"),e.isGeneratorFunction=function(E){var S=typeof E=="function"&&E.constructor;return!!S&&(S===v||(S.displayName||S.name)==="GeneratorFunction")},e.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,k):(E.__proto__=k,u(E,l,"GeneratorFunction")),E.prototype=Object.create(O),E},e.awrap=function(E){return{__await:E}},_(I.prototype),u(I.prototype,a,function(){return this}),e.AsyncIterator=I,e.async=function(E,S,T,R,L){L===void 0&&(L=Promise);var D=new I(c(E,S,T,R),L);return e.isGeneratorFunction(S)?D:D.next().then(function(J){return J.done?J.value:D.next()})},_(O),u(O,l,"Generator"),u(O,o,function(){return this}),u(O,"toString",function(){return"[object Generator]"}),e.keys=function(E){var S=Object(E),T=[];for(var R in S)T.push(R);return T.reverse(),function L(){for(;T.length;){var D=T.pop();if(D in S)return L.value=D,L.done=!1,L}return L.done=!0,L}},e.values=ue,oe.prototype={constructor:oe,reset:function(S){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(P),!S)for(var T in this)T.charAt(0)==="t"&&r.call(this,T)&&!isNaN(+T.slice(1))&&(this[T]=n)},stop:function(){this.done=!0;var S=this.tryEntries[0].completion;if(S.type==="throw")throw S.arg;return this.rval},dispatchException:function(S){if(this.done)throw S;var T=this;function R(we,ke){return J.type="throw",J.arg=S,T.next=we,ke&&(T.method="next",T.arg=n),!!ke}for(var L=this.tryEntries.length-1;L>=0;--L){var D=this.tryEntries[L],J=D.completion;if(D.tryLoc==="root")return R("end");if(D.tryLoc<=this.prev){var se=r.call(D,"catchLoc"),le=r.call(D,"finallyLoc");if(se&&le){if(this.prev<D.catchLoc)return R(D.catchLoc,!0);if(this.prev<D.finallyLoc)return R(D.finallyLoc)}else if(se){if(this.prev<D.catchLoc)return R(D.catchLoc,!0)}else{if(!le)throw Error("try statement without catch or finally");if(this.prev<D.finallyLoc)return R(D.finallyLoc)}}}},abrupt:function(S,T){for(var R=this.tryEntries.length-1;R>=0;--R){var L=this.tryEntries[R];if(L.tryLoc<=this.prev&&r.call(L,"finallyLoc")&&this.prev<L.finallyLoc){var D=L;break}}D&&(S==="break"||S==="continue")&&D.tryLoc<=T&&T<=D.finallyLoc&&(D=null);var J=D?D.completion:{};return J.type=S,J.arg=T,D?(this.method="next",this.next=D.finallyLoc,g):this.complete(J)},complete:function(S,T){if(S.type==="throw")throw S.arg;return S.type==="break"||S.type==="continue"?this.next=S.arg:S.type==="return"?(this.rval=this.arg=S.arg,this.method="return",this.next="end"):S.type==="normal"&&T&&(this.next=T),g},finish:function(S){for(var T=this.tryEntries.length-1;T>=0;--T){var R=this.tryEntries[T];if(R.finallyLoc===S)return this.complete(R.completion,R.afterLoc),P(R),g}},catch:function(S){for(var T=this.tryEntries.length-1;T>=0;--T){var R=this.tryEntries[T];if(R.tryLoc===S){var L=R.completion;if(L.type==="throw"){var D=L.arg;P(R)}return D}}throw Error("illegal catch attempt")},delegateYield:function(S,T,R){return this.delegate={iterator:ue(S),resultName:T,nextLoc:R},this.method==="next"&&(this.arg=n),g}},e}function _g(n,e,t,r,i,s,o){try{var a=n[s](o),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function xI(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var s=n.apply(e,t);function o(l){_g(s,r,i,o,a,"next",l)}function a(l){_g(s,r,i,o,a,"throw",l)}o(void 0)})}}function t1(n,e){return EI(n)||CI(n,e)||n1(n,e)||TI()}function TI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
110
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CI(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function EI(n){if(Array.isArray(n))return n}function ti(n){"@babel/helpers - typeof";return ti=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ti(n)}function MI(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=n1(n))||e){t&&(n=t);var r=0,i=function(){};return{s:i,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
111
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){t=t.call(n)},n:function(){var u=t.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function n1(n,e){if(n){if(typeof n=="string")return Rg(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Rg(n,e)}}function Rg(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Pg(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function di(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pg(Object(t),!0).forEach(function(r){AI(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pg(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function AI(n,e,t){return e=r1(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function OI(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Ig(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r1(r.key),r)}}function NI(n,e,t){return e&&Ig(n.prototype,e),t&&Ig(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function r1(n){var e=_I(n,"string");return ti(e)=="symbol"?e:e+""}function _I(n,e){if(ti(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ti(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var tl="tus-v1",nl="ietf-draft-03",Bs="ietf-draft-05",RI={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:i1,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:tl},tu=function(){function n(e,t){OI(this,n),"resume"in t&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=t,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return NI(n,[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(r){return t._urlStorage.findUploadsByFingerprint(r)})}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,r=this.file;if(!r){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![tl,nl,Bs].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var i=this.options.retryDelays;if(i!=null&&Object.prototype.toString.call(i)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var a=o[s];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(r,this.options).then(function(l){return t._fingerprint=l,t._source?t._source:t.options.fileReader.openFile(r,t.options.chunkSize)}).then(function(l){if(t._source=l,t.options.uploadLengthDeferred)t._size=null;else if(t.options.uploadSize!=null){if(t._size=Number(t.options.uploadSize),Number.isNaN(t._size)){t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(t._size=t._source.size,t._size==null){t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}t.options.parallelUploads>1||t._parallelUploadUrls!=null?t._startParallelUpload():t._startSingleUpload()}).catch(function(l){t._emitError(l)})}},{key:"_startParallelUpload",value:function(){var t,r=this,i=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:II(this._source.size,o);this._parallelUploadUrls&&a.forEach(function(c,d){c.uploadUrl=r._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(a.length);var l=a.map(function(c,d){var h=0;return r._source.slice(c.start,c.end).then(function(f){var p=f.value;return new Promise(function(m,g){var y=di(di({},r.options),{},{uploadUrl:c.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:r.options.metadataForPartialUploads,headers:di(di({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:m,onError:g,onProgress:function(b){s=s-h+b,h=b,r._emitProgress(s,i)},onUploadUrlAvailable:function(){r._parallelUploadUrls[d]=v.url,r._parallelUploadUrls.filter(function(b){return!!b}).length===a.length&&r._saveUploadInUrlStorage()}}),v=new n(p,y);v.start(),r._parallelUploads.push(v)})})}),u;Promise.all(l).then(function(){u=r._openRequest("POST",r.options.endpoint),u.setHeader("Upload-Concat","final;".concat(r._parallelUploadUrls.join(" ")));var c=Dg(r.options.metadata);return c!==""&&u.setHeader("Upload-Metadata",c),r._sendRequest(u,null)}).then(function(c){if(!ki(c.getStatus(),200)){r._emitHttpError(u,c,"tus: unexpected response while creating upload");return}var d=c.getHeader("Location");if(d==null){r._emitHttpError(u,c,"tus: invalid or missing Location header");return}r.url=Bg(r.options.endpoint,d),"Created upload at ".concat(r.url),r._emitSuccess(c)}).catch(function(c){r._emitError(c)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){"Resuming upload from previous URL: ".concat(this.url),this._resumeUpload();return}if(this.options.uploadUrl!=null){"Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload()}},{key:"abort",value:function(t){var r=this;if(this._parallelUploads!=null){var i=MI(this._parallelUploads),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;o.abort(t)}}catch(a){i.e(a)}finally{i.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!t||this.url==null?Promise.resolve():n.terminate(this.url,this.options).then(function(){return r._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(t,r,i,s){this._emitError(new Ea(i,s,t,r))}},{key:"_emitError",value:function(t){var r=this;if(!this._aborted){if(this.options.retryDelays!=null){var i=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(i&&(this._retryAttempt=0),$g(t,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){r.start()},s);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}}},{key:"_emitSuccess",value:function(t){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:t})}},{key:"_emitProgress",value:function(t,r){typeof this.options.onProgress=="function"&&this.options.onProgress(t,r)}},{key:"_emitChunkComplete",value:function(t,r,i){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,r,i)}},{key:"_createUpload",value:function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var r=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?r.setHeader("Upload-Defer-Length","1"):r.setHeader("Upload-Length","".concat(this._size));var i=Dg(this.options.metadata);i!==""&&r.setHeader("Upload-Metadata",i);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(r)):((this.options.protocol===nl||this.options.protocol===Bs)&&r.setHeader("Upload-Complete","?0"),s=this._sendRequest(r,null)),s.then(function(o){if(!ki(o.getStatus(),200)){t._emitHttpError(r,o,"tus: unexpected response while creating upload");return}var a=o.getHeader("Location");if(a==null){t._emitHttpError(r,o,"tus: invalid or missing Location header");return}if(t.url=Bg(t.options.endpoint,a),"Created upload at ".concat(t.url),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(o),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(r,o):(t._offset=0,t._performUpload())})}).catch(function(o){t._emitHttpError(r,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var t=this,r=this._openRequest("HEAD",this.url),i=this._sendRequest(r,null);i.then(function(s){var o=s.getStatus();if(!ki(o,200)){if(o===423){t._emitHttpError(r,s,"tus: upload is currently locked; retry later");return}if(ki(o,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(r,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var a=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){t._emitHttpError(r,s,"tus: invalid or missing offset value");return}var l=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(l)&&!t.options.uploadLengthDeferred&&t.options.protocol===tl){t._emitHttpError(r,s,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(a===l){t._emitProgress(l,l),t._emitSuccess(s);return}t._offset=a,t._performUpload()})}).catch(function(s){t._emitHttpError(r,null,"tus: failed to resume upload",s)})}},{key:"_performUpload",value:function(){var t=this;if(!this._aborted){var r;this.options.overridePatchMethod?(r=this._openRequest("POST",this.url),r.setHeader("X-HTTP-Method-Override","PATCH")):r=this._openRequest("PATCH",this.url),r.setHeader("Upload-Offset","".concat(this._offset));var i=this._addChunkToRequest(r);i.then(function(s){if(!ki(s.getStatus(),200)){t._emitHttpError(r,s,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(r,s)}).catch(function(s){t._aborted||t._emitHttpError(r,null,"tus: failed to upload chunk at offset ".concat(t._offset),s)})}}},{key:"_addChunkToRequest",value:function(t){var r=this,i=this._offset,s=this._offset+this.options.chunkSize;return t.setProgressHandler(function(o){r._emitProgress(i+o,r._size)}),this.options.protocol===tl?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Bs&&t.setHeader("Content-Type","application/partial-upload"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(i,s).then(function(o){var a=o.value,l=o.done,u=a!=null&&a.size?a.size:0;r.options.uploadLengthDeferred&&l&&(r._size=r._offset+u,t.setHeader("Upload-Length","".concat(r._size)));var c=r._offset+u;return!r.options.uploadLengthDeferred&&l&&c!==r._size?Promise.reject(new Error("upload was configured with a size of ".concat(r._size," bytes, but the source is done after ").concat(c," bytes"))):a===null?r._sendRequest(t):((r.options.protocol===nl||r.options.protocol===Bs)&&t.setHeader("Upload-Complete",l?"?1":"?0"),r._emitProgress(r._offset,r._size),r._sendRequest(t,a))})}},{key:"_handleUploadResponse",value:function(t,r){var i=Number.parseInt(r.getHeader("Upload-Offset"),10);if(Number.isNaN(i)){this._emitHttpError(t,r,"tus: invalid or missing offset value");return}if(this._emitProgress(i,this._size),this._emitChunkComplete(i-this._offset,i,this._size),this._offset=i,i===this._size){this._emitSuccess(r),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(t,r){var i=Lg(t,r,this.options);return this._req=i,i}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(r){t._emitError(r)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var r={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?r.parallelUploadUrls=this._parallelUploadUrls:r.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,r).then(function(i){t._urlStorageKey=i})}},{key:"_sendRequest",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return Fg(t,r,this.options)}}],[{key:"terminate",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=Lg("DELETE",t,r);return Fg(i,null,r).then(function(s){if(s.getStatus()!==204)throw new Ea("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Ea||(s=new Ea("tus: failed to terminate upload",s,i,null)),!$g(s,0,r))throw s;var o=r.retryDelays[0],a=r.retryDelays.slice(1),l=di(di({},r),{},{retryDelays:a});return new Promise(function(u){return setTimeout(u,o)}).then(function(){return n.terminate(t,l)})})}}])}();function Dg(n){return Object.entries(n).map(function(e){var t=t1(e,2),r=t[0],i=t[1];return"".concat(r," ").concat(gI.encode(String(i)))}).join(",")}function ki(n,e){return n>=e&&n<e+100}function Lg(n,e,t){var r=t.httpStack.createRequest(n,e);t.protocol===nl?r.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===Bs?r.setHeader("Upload-Draft-Interop-Version","6"):r.setHeader("Tus-Resumable","1.0.0");for(var i=t.headers||{},s=0,o=Object.entries(i);s<o.length;s++){var a=t1(o[s],2),l=a[0],u=a[1];r.setHeader(l,u)}if(t.addRequestId){var c=SI();r.setHeader("X-Request-ID",c)}return r}function Fg(n,e,t){return ah.apply(this,arguments)}function ah(){return ah=xI(oh().mark(function n(e,t,r){var i;return oh().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof r.onBeforeRequest!="function"){o.next=3;break}return o.next=3,r.onBeforeRequest(e);case 3:return o.next=5,e.send(t);case 5:if(i=o.sent,typeof r.onAfterResponse!="function"){o.next=9;break}return o.next=9,r.onAfterResponse(e,i);case 9:return o.abrupt("return",i);case 10:case"end":return o.stop()}},n)})),ah.apply(this,arguments)}function PI(){var n=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(n=!1),n}function $g(n,e,t){return t.retryDelays==null||e>=t.retryDelays.length||n.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(n,e,t):i1(n)}function i1(n){var e=n.originalResponse?n.originalResponse.getStatus():0;return(!ki(e,400)||e===409||e===423)&&PI()}function Bg(n,e){return new kI(e,n).toString()}function II(n,e){for(var t=Math.floor(n/e),r=[],i=0;i<e;i++)r.push({start:t*i,end:t*(i+1)});return r[e-1].end=n,r}tu.defaultOptions=RI;var s1=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"};function DI(n){return new Promise(function(e,t){var r=new XMLHttpRequest;r.responseType="blob",r.onload=function(){var i=r.response;e(i)},r.onerror=function(i){t(i)},r.open("GET",n),r.send()})}var LI=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")};function FI(n){return new Promise(function(e,t){var r=new FileReader;r.onload=function(){var i=new Uint8Array(r.result);e({value:i})},r.onerror=function(i){t(i)},r.readAsArrayBuffer(n)})}function Co(n){"@babel/helpers - typeof";return Co=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Co(n)}function $I(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function BI(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,UI(r.key),r)}}function zI(n,e,t){return e&&BI(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function UI(n){var e=HI(n,"string");return Co(e)=="symbol"?e:e+""}function HI(n,e){if(Co(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var zg=function(){function n(e){$I(this,n),this._file=e,this.size=e.size}return zI(n,[{key:"slice",value:function(t,r){if(LI())return FI(this._file.slice(t,r));var i=this._file.slice(t,r),s=r>=this.size;return Promise.resolve({value:i,done:s})}},{key:"close",value:function(){}}])}();function Eo(n){"@babel/helpers - typeof";return Eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eo(n)}function VI(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function qI(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,WI(r.key),r)}}function jI(n,e,t){return e&&qI(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function WI(n){var e=JI(n,"string");return Eo(e)=="symbol"?e:e+""}function JI(n,e){if(Eo(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function Ug(n){return n===void 0?0:n.size!==void 0?n.size:n.length}function KI(n,e){if(n.concat)return n.concat(e);if(n instanceof Blob)return new Blob([n,e],{type:n.type});if(n.set){var t=new n.constructor(n.length+e.length);return t.set(n),t.set(e,n.length),t}throw new Error("Unknown data type")}var GI=function(){function n(e){VI(this,n),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return jI(n,[{key:"slice",value:function(t,r){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,r)}},{key:"_readUntilEnoughDataOrDone",value:function(t,r){var i=this,s=r<=this._bufferOffset+Ug(this._buffer);if(this._done||s){var o=this._getDataFromBuffer(t,r),a=o==null?this._done:!1;return Promise.resolve({value:o,done:a})}return this._reader.read().then(function(l){var u=l.value,c=l.done;return c?i._done=!0:i._buffer===void 0?i._buffer=u:i._buffer=KI(i._buffer,u),i._readUntilEnoughDataOrDone(t,r)})}},{key:"_getDataFromBuffer",value:function(t,r){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var i=Ug(this._buffer)===0;return this._done&&i?null:this._buffer.slice(0,r-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])}();function ni(n){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(n)}function lh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */lh=function(){return e};var n,e={},t=Object.prototype,r=t.hasOwnProperty,i=Object.defineProperty||function(E,S,T){E[S]=T.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(E,S,T){return Object.defineProperty(E,S,{value:T,enumerable:!0,configurable:!0,writable:!0}),E[S]}try{u({},"")}catch{u=function(T,R,L){return T[R]=L}}function c(E,S,T,R){var L=S&&S.prototype instanceof y?S:y,D=Object.create(L.prototype),J=new oe(R||[]);return i(D,"_invoke",{value:$(E,T,J)}),D}function d(E,S,T){try{return{type:"normal",arg:E.call(S,T)}}catch(R){return{type:"throw",arg:R}}}e.wrap=c;var h="suspendedStart",f="suspendedYield",p="executing",m="completed",g={};function y(){}function v(){}function k(){}var b={};u(b,o,function(){return this});var x=Object.getPrototypeOf,A=x&&x(x(ue([])));A&&A!==t&&r.call(A,o)&&(b=A);var O=k.prototype=y.prototype=Object.create(b);function _(E){["next","throw","return"].forEach(function(S){u(E,S,function(T){return this._invoke(S,T)})})}function I(E,S){function T(L,D,J,se){var le=d(E[L],E,D);if(le.type!=="throw"){var we=le.arg,ke=we.value;return ke&&ni(ke)=="object"&&r.call(ke,"__await")?S.resolve(ke.__await).then(function(Oe){T("next",Oe,J,se)},function(Oe){T("throw",Oe,J,se)}):S.resolve(ke).then(function(Oe){we.value=Oe,J(we)},function(Oe){return T("throw",Oe,J,se)})}se(le.arg)}var R;i(this,"_invoke",{value:function(D,J){function se(){return new S(function(le,we){T(D,J,le,we)})}return R=R?R.then(se,se):se()}})}function $(E,S,T){var R=h;return function(L,D){if(R===p)throw Error("Generator is already running");if(R===m){if(L==="throw")throw D;return{value:n,done:!0}}for(T.method=L,T.arg=D;;){var J=T.delegate;if(J){var se=Y(J,T);if(se){if(se===g)continue;return se}}if(T.method==="next")T.sent=T._sent=T.arg;else if(T.method==="throw"){if(R===h)throw R=m,T.arg;T.dispatchException(T.arg)}else T.method==="return"&&T.abrupt("return",T.arg);R=p;var le=d(E,S,T);if(le.type==="normal"){if(R=T.done?m:f,le.arg===g)continue;return{value:le.arg,done:T.done}}le.type==="throw"&&(R=m,T.method="throw",T.arg=le.arg)}}}function Y(E,S){var T=S.method,R=E.iterator[T];if(R===n)return S.delegate=null,T==="throw"&&E.iterator.return&&(S.method="return",S.arg=n,Y(E,S),S.method==="throw")||T!=="return"&&(S.method="throw",S.arg=new TypeError("The iterator does not provide a '"+T+"' method")),g;var L=d(R,E.iterator,S.arg);if(L.type==="throw")return S.method="throw",S.arg=L.arg,S.delegate=null,g;var D=L.arg;return D?D.done?(S[E.resultName]=D.value,S.next=E.nextLoc,S.method!=="return"&&(S.method="next",S.arg=n),S.delegate=null,g):D:(S.method="throw",S.arg=new TypeError("iterator result is not an object"),S.delegate=null,g)}function ie(E){var S={tryLoc:E[0]};1 in E&&(S.catchLoc=E[1]),2 in E&&(S.finallyLoc=E[2],S.afterLoc=E[3]),this.tryEntries.push(S)}function P(E){var S=E.completion||{};S.type="normal",delete S.arg,E.completion=S}function oe(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(ie,this),this.reset(!0)}function ue(E){if(E||E===""){var S=E[o];if(S)return S.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var T=-1,R=function L(){for(;++T<E.length;)if(r.call(E,T))return L.value=E[T],L.done=!1,L;return L.value=n,L.done=!0,L};return R.next=R}}throw new TypeError(ni(E)+" is not iterable")}return v.prototype=k,i(O,"constructor",{value:k,configurable:!0}),i(k,"constructor",{value:v,configurable:!0}),v.displayName=u(k,l,"GeneratorFunction"),e.isGeneratorFunction=function(E){var S=typeof E=="function"&&E.constructor;return!!S&&(S===v||(S.displayName||S.name)==="GeneratorFunction")},e.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,k):(E.__proto__=k,u(E,l,"GeneratorFunction")),E.prototype=Object.create(O),E},e.awrap=function(E){return{__await:E}},_(I.prototype),u(I.prototype,a,function(){return this}),e.AsyncIterator=I,e.async=function(E,S,T,R,L){L===void 0&&(L=Promise);var D=new I(c(E,S,T,R),L);return e.isGeneratorFunction(S)?D:D.next().then(function(J){return J.done?J.value:D.next()})},_(O),u(O,l,"Generator"),u(O,o,function(){return this}),u(O,"toString",function(){return"[object Generator]"}),e.keys=function(E){var S=Object(E),T=[];for(var R in S)T.push(R);return T.reverse(),function L(){for(;T.length;){var D=T.pop();if(D in S)return L.value=D,L.done=!1,L}return L.done=!0,L}},e.values=ue,oe.prototype={constructor:oe,reset:function(S){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(P),!S)for(var T in this)T.charAt(0)==="t"&&r.call(this,T)&&!isNaN(+T.slice(1))&&(this[T]=n)},stop:function(){this.done=!0;var S=this.tryEntries[0].completion;if(S.type==="throw")throw S.arg;return this.rval},dispatchException:function(S){if(this.done)throw S;var T=this;function R(we,ke){return J.type="throw",J.arg=S,T.next=we,ke&&(T.method="next",T.arg=n),!!ke}for(var L=this.tryEntries.length-1;L>=0;--L){var D=this.tryEntries[L],J=D.completion;if(D.tryLoc==="root")return R("end");if(D.tryLoc<=this.prev){var se=r.call(D,"catchLoc"),le=r.call(D,"finallyLoc");if(se&&le){if(this.prev<D.catchLoc)return R(D.catchLoc,!0);if(this.prev<D.finallyLoc)return R(D.finallyLoc)}else if(se){if(this.prev<D.catchLoc)return R(D.catchLoc,!0)}else{if(!le)throw Error("try statement without catch or finally");if(this.prev<D.finallyLoc)return R(D.finallyLoc)}}}},abrupt:function(S,T){for(var R=this.tryEntries.length-1;R>=0;--R){var L=this.tryEntries[R];if(L.tryLoc<=this.prev&&r.call(L,"finallyLoc")&&this.prev<L.finallyLoc){var D=L;break}}D&&(S==="break"||S==="continue")&&D.tryLoc<=T&&T<=D.finallyLoc&&(D=null);var J=D?D.completion:{};return J.type=S,J.arg=T,D?(this.method="next",this.next=D.finallyLoc,g):this.complete(J)},complete:function(S,T){if(S.type==="throw")throw S.arg;return S.type==="break"||S.type==="continue"?this.next=S.arg:S.type==="return"?(this.rval=this.arg=S.arg,this.method="return",this.next="end"):S.type==="normal"&&T&&(this.next=T),g},finish:function(S){for(var T=this.tryEntries.length-1;T>=0;--T){var R=this.tryEntries[T];if(R.finallyLoc===S)return this.complete(R.completion,R.afterLoc),P(R),g}},catch:function(S){for(var T=this.tryEntries.length-1;T>=0;--T){var R=this.tryEntries[T];if(R.tryLoc===S){var L=R.completion;if(L.type==="throw"){var D=L.arg;P(R)}return D}}throw Error("illegal catch attempt")},delegateYield:function(S,T,R){return this.delegate={iterator:ue(S),resultName:T,nextLoc:R},this.method==="next"&&(this.arg=n),g}},e}function Hg(n,e,t,r,i,s,o){try{var a=n[s](o),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function YI(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var s=n.apply(e,t);function o(l){Hg(s,r,i,o,a,"next",l)}function a(l){Hg(s,r,i,o,a,"throw",l)}o(void 0)})}}function XI(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function QI(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,eD(r.key),r)}}function ZI(n,e,t){return e&&QI(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function eD(n){var e=tD(n,"string");return ni(e)=="symbol"?e:e+""}function tD(n,e){if(ni(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(ni(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var nD=function(){function n(){XI(this,n)}return ZI(n,[{key:"openFile",value:function(){var e=YI(lh().mark(function r(i,s){var o;return lh().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!(s1()&&i&&typeof i.uri<"u")){l.next=11;break}return l.prev=1,l.next=4,DI(i.uri);case 4:return o=l.sent,l.abrupt("return",new zg(o));case 8:throw l.prev=8,l.t0=l.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(l.t0));case 11:if(!(typeof i.slice=="function"&&typeof i.size<"u")){l.next=13;break}return l.abrupt("return",Promise.resolve(new zg(i)));case 13:if(typeof i.read!="function"){l.next=18;break}if(s=Number(s),Number.isFinite(s)){l.next=17;break}return l.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return l.abrupt("return",Promise.resolve(new GI(i,s)));case 18:return l.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return l.stop()}},r,null,[[1,8]])}));function t(r,i){return e.apply(this,arguments)}return t}()}])}();function rD(n,e){return s1()?Promise.resolve(iD(n,e)):Promise.resolve(["tus-br",n.name,n.type,n.size,n.lastModified,e.endpoint].join("-"))}function iD(n,e){var t=n.exif?sD(JSON.stringify(n.exif)):"noexif";return["tus-rn",n.name||"noname",n.size||"nosize",t,e.endpoint].join("/")}function sD(n){var e=0;if(n.length===0)return e;for(var t=0;t<n.length;t++){var r=n.charCodeAt(t);e=(e<<5)-e+r,e&=e}return e}function Mo(n){"@babel/helpers - typeof";return Mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mo(n)}function Df(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function oD(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,aD(r.key),r)}}function Lf(n,e,t){return e&&oD(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function aD(n){var e=lD(n,"string");return Mo(e)=="symbol"?e:e+""}function lD(n,e){if(Mo(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Mo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var uD=function(){function n(){Df(this,n)}return Lf(n,[{key:"createRequest",value:function(t,r){return new cD(t,r)}},{key:"getName",value:function(){return"XHRHttpStack"}}])}(),cD=function(){function n(e,t){Df(this,n),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return Lf(n,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,r){this._xhr.setRequestHeader(t,r),this._headers[t]=r}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(r){r.lengthComputable&&t(r.loaded)})}},{key:"send",value:function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(i,s){t._xhr.onload=function(){i(new dD(t._xhr))},t._xhr.onerror=function(o){s(o)},t._xhr.send(r)})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),dD=function(){function n(e){Df(this,n),this._xhr=e}return Lf(n,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function Ao(n){"@babel/helpers - typeof";return Ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ao(n)}function hD(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function fD(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,mD(r.key),r)}}function pD(n,e,t){return e&&fD(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function mD(n){var e=gD(n,"string");return Ao(e)=="symbol"?e:e+""}function gD(n,e){if(Ao(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ao(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var uh=!1;try{uh="localStorage"in window;var Uc="tusSupport",Vg=localStorage.getItem(Uc);localStorage.setItem(Uc,Vg),Vg===null&&localStorage.removeItem(Uc)}catch(n){if(n.code===n.SECURITY_ERR||n.code===n.QUOTA_EXCEEDED_ERR)uh=!1;else throw n}var yD=uh,bD=function(){function n(){hD(this,n)}return pD(n,[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){var r=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(r)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,r){var i=Math.round(Math.random()*1e12),s="tus::".concat(t,"::").concat(i);return localStorage.setItem(s,JSON.stringify(r)),Promise.resolve(s)}},{key:"_findEntries",value:function(t){for(var r=[],i=0;i<localStorage.length;i++){var s=localStorage.key(i);if(s.indexOf(t)===0)try{var o=JSON.parse(localStorage.getItem(s));o.urlStorageKey=s,r.push(o)}catch{}}return r}}])}();function Ui(n){"@babel/helpers - typeof";return Ui=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ui(n)}function vD(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function wD(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,a1(r.key),r)}}function kD(n,e,t){return t&&wD(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function SD(n,e,t){return e=nu(e),xD(n,o1()?Reflect.construct(e,t||[],nu(n).constructor):e.apply(n,t))}function xD(n,e){if(e&&(Ui(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TD(n)}function TD(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function o1(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(o1=function(){return!!n})()}function nu(n){return nu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nu(n)}function CD(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&ch(n,e)}function ch(n,e){return ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},ch(n,e)}function qg(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qg(Object(t),!0).forEach(function(r){ED(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qg(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ED(n,e,t){return e=a1(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function a1(n){var e=MD(n,"string");return Ui(e)=="symbol"?e:e+""}function MD(n,e){if(Ui(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Ui(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var dh=xi(xi({},tu.defaultOptions),{},{httpStack:new uD,fileReader:new nD,urlStorage:yD?new bD:new rI,fingerprint:rD}),AD=function(n){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return vD(this,e),r=xi(xi({},dh),r),SD(this,e,[t,r])}return CD(e,n),kD(e,null,[{key:"terminate",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=xi(xi({},dh),i),tu.terminate(r,i)}}])}(tu);function wn(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var OD=0;function l1(n){return"__private_"+OD+++"_"+n}var ut=l1("uppy"),hs=l1("events");class ND{constructor(e){Object.defineProperty(this,ut,{writable:!0,value:void 0}),Object.defineProperty(this,hs,{writable:!0,value:[]}),wn(this,ut)[ut]=e}on(e,t){return wn(this,hs)[hs].push([e,t]),wn(this,ut)[ut].on(e,t)}remove(){for(const[e,t]of wn(this,hs)[hs].splice(0))wn(this,ut)[ut].off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,i)=>{e===r?.id&&t(i)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,i)=>{e===r?.id&&t(i)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{wn(this,ut)[ut].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{wn(this,ut)[ut].getFile(e)&&t()})}onCancelAll(e,t){var r=this;this.on("cancel-all",function(){wn(r,ut)[ut].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{wn(this,ut)[ut].getFile(e)&&t()})}}class _D extends Error{constructor(e,t){t===void 0&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}}function RD(n){return n?n.readyState!==0&&n.readyState!==4||n.status===0:!1}function X(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var PD=0;function Tt(n){return"__private_"+PD+++"_"+n}function ID(n){return new Error("Cancelled",{cause:n})}function jg(n){if(n!=null){var e;const t=()=>this.abort(n.reason);n.addEventListener("abort",t,{once:!0});const r=()=>{n.removeEventListener("abort",t)};(e=this.then)==null||e.call(this,r,r)}return this}var Et=Tt("activeRequests"),ht=Tt("queuedHandlers"),Ct=Tt("paused"),yr=Tt("pauseTimer"),ct=Tt("downLimit"),br=Tt("upperLimit"),kn=Tt("rateLimitingTimer"),eo=Tt("call"),_n=Tt("queueNext"),hh=Tt("next"),Hc=Tt("queue"),fh=Tt("dequeue"),Vc=Tt("resume"),vr=Tt("increaseLimit");class DD{constructor(e){Object.defineProperty(this,fh,{value:zD}),Object.defineProperty(this,Hc,{value:BD}),Object.defineProperty(this,hh,{value:$D}),Object.defineProperty(this,_n,{value:FD}),Object.defineProperty(this,eo,{value:LD}),Object.defineProperty(this,Et,{writable:!0,value:0}),Object.defineProperty(this,ht,{writable:!0,value:[]}),Object.defineProperty(this,Ct,{writable:!0,value:!1}),Object.defineProperty(this,yr,{writable:!0,value:void 0}),Object.defineProperty(this,ct,{writable:!0,value:1}),Object.defineProperty(this,br,{writable:!0,value:void 0}),Object.defineProperty(this,kn,{writable:!0,value:void 0}),Object.defineProperty(this,Vc,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,vr,{writable:!0,value:()=>{if(X(this,Ct)[Ct]){X(this,kn)[kn]=setTimeout(X(this,vr)[vr],0);return}X(this,ct)[ct]=this.limit,this.limit=Math.ceil((X(this,br)[br]+X(this,ct)[ct])/2);for(let t=X(this,ct)[ct];t<=this.limit;t++)X(this,_n)[_n]();X(this,br)[br]-X(this,ct)[ct]>3?X(this,kn)[kn]=setTimeout(X(this,vr)[vr],2e3):X(this,ct)[ct]=Math.floor(X(this,ct)[ct]/2)}}),typeof e!="number"||e===0?this.limit=1/0:this.limit=e}run(e,t){return!X(this,Ct)[Ct]&&X(this,Et)[Et]<this.limit?X(this,eo)[eo](e):X(this,Hc)[Hc](e,t)}wrapSyncFunction(e,t){var r=this;return function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];const a=r.run(()=>(e(...s),queueMicrotask(()=>a.done()),()=>{}),t);return{abortOn:jg,abort(){a.abort()}}}}wrapPromiseFunction(e,t){var r=this;return function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];let a;const l=new Promise((u,c)=>{a=r.run(()=>{let d,h;try{h=Promise.resolve(e(...s))}catch(f){h=Promise.reject(f)}return h.then(f=>{d?c(d):(a.done(),u(f))},f=>{d?c(d):(a.done(),c(f))}),f=>{d=ID(f)}},t)});return l.abort=u=>{a.abort(u)},l.abortOn=jg,l}}resume(){X(this,Ct)[Ct]=!1,clearTimeout(X(this,yr)[yr]);for(let e=0;e<this.limit;e++)X(this,_n)[_n]()}pause(e){e===void 0&&(e=null),X(this,Ct)[Ct]=!0,clearTimeout(X(this,yr)[yr]),e!=null&&(X(this,yr)[yr]=setTimeout(X(this,Vc)[Vc],e))}rateLimit(e){clearTimeout(X(this,kn)[kn]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(X(this,br)[br]=this.limit-1,this.limit=X(this,ct)[ct],X(this,kn)[kn]=setTimeout(X(this,vr)[vr],e))}get isPaused(){return X(this,Ct)[Ct]}}function LD(n){X(this,Et)[Et]+=1;let e=!1,t;try{t=n()}catch(r){throw X(this,Et)[Et]-=1,r}return{abort:r=>{e||(e=!0,X(this,Et)[Et]-=1,t?.(r),X(this,_n)[_n]())},done:()=>{e||(e=!0,X(this,Et)[Et]-=1,X(this,_n)[_n]())}}}function FD(){queueMicrotask(()=>X(this,hh)[hh]())}function $D(){if(X(this,Ct)[Ct]||X(this,Et)[Et]>=this.limit||X(this,ht)[ht].length===0)return;const n=X(this,ht)[ht].shift();if(n==null)throw new Error("Invariant violation: next is null");const e=X(this,eo)[eo](n.fn);n.abort=e.abort,n.done=e.done}function BD(n,e){const t={fn:n,priority:e?.priority||0,abort:()=>{X(this,fh)[fh](t)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},r=X(this,ht)[ht].findIndex(i=>t.priority>i.priority);return r===-1?X(this,ht)[ht].push(t):X(this,ht)[ht].splice(r,0,t),t}function zD(n){const e=X(this,ht)[ht].indexOf(n);e!==-1&&X(this,ht)[ht].splice(e,1)}function qc(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function UD(n){const e=t=>"error"in t&&!!t.error;return n.filter(t=>!e(t))}function HD(n){return n.filter(e=>{var t;return!((t=e.progress)!=null&&t.uploadStarted)||!e.isRestored})}function VD(n,e){return n===!0?Object.keys(e):Array.isArray(n)?n:[]}function qD(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}function jD(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}function WD(n){return(e,t)=>{if(qD()||jD())return dh.fingerprint(e,t);const r=["tus",n.id,t.endpoint].join("-");return Promise.resolve(r)}}function Ir(n,e){if(!{}.hasOwnProperty.call(n,e))throw new TypeError("attempted to use private field on non-instance");return n}var JD=0;function Vo(n){return"__private_"+JD+++"_"+n}const KD={version:"4.2.2"},u1={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1},GD={limit:20,retryDelays:u1.retryDelays,withCredentials:!1,allowedMetaFields:!0};var to=Vo("retryDelayIterator"),ph=Vo("uploadLocalFile"),mh=Vo("getCompanionClientArgs"),jc=Vo("uploadFiles"),fs=Vo("handleUpload");class c1 extends Lw{constructor(e,t){var r,i;if(super(e,{...GD,...t}),Object.defineProperty(this,jc,{value:QD}),Object.defineProperty(this,mh,{value:XD}),Object.defineProperty(this,ph,{value:YD}),Object.defineProperty(this,to,{writable:!0,value:void 0}),Object.defineProperty(this,fs,{writable:!0,value:async s=>{if(s.length===0){this.uppy.log("[Tus] No files to upload");return}this.opts.limit===0&&this.uppy.log("[Tus] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");const o=this.uppy.getFilesByIds(s);await Ir(this,jc)[jc](o)}}),this.type="uploader",this.id=this.opts.id||"Tus",t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in t)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=(r=this.opts.rateLimitedQueue)!=null?r:new DD(this.opts.limit),Ir(this,to)[to]=(i=this.opts.retryDelays)==null?void 0:i.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}resetUploaderReferences(e,t){const r=this.uploaders[e];r&&(r.abort(),t!=null&&t.abort&&r.abort(!0),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}onReceiveUploadUrl(e,t){const r=this.uppy.getFile(e.id);r&&(!r.tus||r.tus.uploadUrl!==t)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:{...r.tus,uploadUrl:t}}))}install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(Ir(this,fs)[fs])}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(Ir(this,fs)[fs])}}function YD(n){return this.resetUploaderReferences(n.id),new Promise((e,t)=>{let r,i,s;const o={...this.opts,...n.tus||{}};typeof o.headers=="function"&&(o.headers=o.headers(n));const{onShouldRetry:a,onBeforeRequest:l,...u}=o,c={...u1,...u};c.fingerprint=WD(n),c.onBeforeRequest=async g=>{const y=g.getUnderlyingObject();y.withCredentials=!!o.withCredentials;let v;if(typeof l=="function"&&(v=l(g,n)),qc(r,"shouldBeRequeued")){if(!r.shouldBeRequeued)return Promise.reject();let k;const b=new Promise(x=>{k=x});r=this.requests.run(()=>(n.isPaused&&r.abort(),k(),()=>{})),await Promise.all([b,v]);return}return v},c.onError=g=>{var y;this.uppy.log(g);const v=g.originalRequest!=null?g.originalRequest.getUnderlyingObject():null;RD(v)&&(g=new _D(g,v)),this.resetUploaderReferences(n.id),(y=r)==null||y.abort(),typeof o.onError=="function"&&o.onError(g),t(g)},c.onProgress=(g,y)=>{var v;this.onReceiveUploadUrl(n,s.url),typeof o.onProgress=="function"&&o.onProgress(g,y);const k=this.uppy.getFile(n.id);this.uppy.emit("upload-progress",k,{uploadStarted:(v=k.progress.uploadStarted)!=null?v:0,bytesUploaded:g,bytesTotal:y})},c.onSuccess=g=>{var y;const v={uploadURL:(y=s.url)!=null?y:void 0,status:200,body:{xhr:g.lastResponse.getUnderlyingObject()}};if(this.uppy.emit("upload-success",this.uppy.getFile(n.id),v),this.resetUploaderReferences(n.id),r.done(),s.url){const{name:k}=s.file;this.uppy.log(`Download ${k} from ${s.url}`)}typeof o.onSuccess=="function"&&o.onSuccess(g),e(s)};const d=g=>{var y;const v=g==null||(y=g.originalResponse)==null?void 0:y.getStatus();if(v===429){if(!this.requests.isPaused){var k;const b=(k=Ir(this,to)[to])==null?void 0:k.next();if(b==null||b.done)return!1;this.requests.rateLimit(b.value)}}else{if(v!=null&&v>=400&&v<500&&v!==409&&v!==423)return!1;typeof navigator<"u"&&navigator.onLine===!1&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",()=>{this.requests.resume()},{once:!0})))}return r.abort(),r={shouldBeRequeued:!0,abort(){this.shouldBeRequeued=!1},done(){throw new Error("Cannot mark a queued request as done: this indicates a bug")},fn(){throw new Error("Cannot run a queued request: this indicates a bug")}},!0};a!=null?c.onShouldRetry=(g,y)=>a(g,y,o,d):c.onShouldRetry=d;const h=(g,y,v)=>{qc(g,y)&&!qc(g,v)&&(g[v]=g[y])},f={};VD(o.allowedMetaFields,n.meta).forEach(g=>{f[g]=String(n.meta[g])}),h(f,"type","filetype"),h(f,"name","filename"),c.metadata=f,s=new AD(n.data,c),this.uploaders[n.id]=s;const m=new ND(this.uppy);this.uploaderEvents[n.id]=m,i=()=>(n.isPaused||s.start(),()=>{}),s.findPreviousUploads().then(g=>{const y=g[0];y&&(this.uppy.log(`[Tus] Resuming upload of ${n.id} started at ${y.creationTime}`),s.resumeFromPreviousUpload(y)),r=this.requests.run(i)}),m.onFileRemove(n.id,g=>{r.abort(),this.resetUploaderReferences(n.id,{abort:!!s.url}),e(`upload ${g} was removed`)}),m.onPause(n.id,g=>{r.abort(),g?s.abort():r=this.requests.run(i)}),m.onPauseAll(n.id,()=>{r.abort(),s.abort()}),m.onCancelAll(n.id,()=>{r.abort(),this.resetUploaderReferences(n.id,{abort:!!s.url}),e(`upload ${n.id} was canceled`)}),m.onResumeAll(n.id,()=>{r.abort(),n.error&&s.abort(),r=this.requests.run(i)})}).catch(e=>{throw this.uppy.emit("upload-error",n,e),e})}function XD(n){var e;const t={...this.opts};return n.tus&&Object.assign(t,n.tus),typeof t.headers=="function"&&(t.headers=t.headers(n)),{...(e=n.remote)==null?void 0:e.body,endpoint:t.endpoint,uploadUrl:t.uploadUrl,protocol:"tus",size:n.data.size,headers:t.headers,metadata:n.meta}}async function QD(n){const e=UD(n),t=HD(e);this.uppy.emit("upload-start",t),await Promise.allSettled(e.map(r=>{if(r.isRemote){const i=()=>this.requests,s=new AbortController,o=l=>{l.id===r.id&&s.abort()};this.uppy.on("file-removed",o);const a=this.uppy.getRequestClientForFile(r).uploadRemoteFile(r,Ir(this,mh)[mh](r),{signal:s.signal,getQueue:i});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",o)},{priority:-1})(),a}return Ir(this,ph)[ph](r)}))}c1.VERSION=KD.version;const d1={name:"DpUpload",emits:["file-added","file-error","upload","uploads-completed","upload-success"],props:{allowedFileTypes:{type:[Array,String],required:!1,default:"pdf"},allowedFileTypesWarning:{type:String,default:tg().strings.warningFileType},allowMultipleUploads:{type:Boolean,default:!1},basicAuth:{type:String,required:!1,default:""},chunkSize:{type:Number,default:1/0,required:!1},dataCy:{type:String,required:!1,default:"upload"},maxFileSize:{type:Number,default:1e7},maxNumberOfFiles:{type:Number,required:!1,default:1},translations:{type:Object,required:!1,default:()=>({})},tusEndpoint:{type:String,required:!0}},data(){return{currentFileHash:"",currentFileId:"",uppy:null,uppyTranslations:{strings:{...tg().strings,...this.translations}}}},computed:{allowedFileTypeArray(){return Pk(this.allowedFileTypes)}},methods:{getCookieValue(n){const e=document.cookie.match("(^|[^;]+)\\s*"+n+"\\s*=\\s*([^;]+)");return e?e.pop():""},handleOnBeforeFileAdded(n,e){let t=n.name;const r=["?","#","&","'",'"',"/",":","\\"];for(let i=0;i<r.length;i++)t.includes(r[i])&&(t=t.replace(r[i],"_"));return t!==n.name?{...n,name:t,meta:{...n.meta,name:t}}:n},initialize(){this.uppy=new Au({disabled:!0,autoProceed:!0,allowMultipleUploads:this.allowMultipleUploads,restrictions:{allowedFileTypes:this.allowedFileTypeArray,maxFileSize:this.maxFileSize,maxNumberOfFiles:this.maxNumberOfFiles},onBeforeFileAdded:this.handleOnBeforeFileAdded,locale:this.uppyTranslations}),this.uppy.use(_u,{target:this.$refs.fileInput,width:"100%",note:null,locale:this.uppyTranslations}),this.uppy.use(Uw,{target:this.$refs.fileInput,fixed:!1,hideAfterFinish:!1});let n=null;typeof dplan<"u"&&Ch(dplan,"procedureId")&&(n=dplan.procedureId);const e={};n!==null&&n!=="0"&&(e["X-Demosplan-Procedure-Id"]=n),this.basicAuth!==""&&(e.Authorization=this.basicAuth),this.uppy.use(c1,{endpoint:this.tusEndpoint,chunkSize:this.chunkSize,limit:5,onAfterResponse:(r,i)=>{this.currentFileHash=i.getHeader("X-Demosplan-File-Hash"),this.currentFileId=i.getHeader("X-Demosplan-File-Id")},removeFingerprintOnSuccess:!0,headers:e});const t=document.querySelectorAll(".uppy-DragDrop-input");t&&t.forEach((r,i)=>{r.setAttribute("data-cy",`uppyDragDropInput:${i}`)})}},mounted(){this.initialize(),this.uppy.on("complete",n=>{setTimeout(()=>{this.uppy.cancelAll()},2e3),this.$emit("uploads-completed",n)}),this.uppy.on("upload-error",(n,e,t)=>{console.error(e),dplan.notify.error(this.uppyTranslations.strings.errorFileUpload),this.$emit("file-error",{file:n,error:e,response:t})}),this.uppy.on("file-added",n=>{this.$emit("file-added",n)}),this.uppy.on("upload",n=>{this.$emit("upload",n)}),this.uppy.on("restriction-failed",()=>{dplan.notify.warning(this.allowedFileTypesWarning)}),this.uppy.on("upload-success",n=>{const{name:e,size:t,type:r}=n.data,i={name:e,hash:this.currentFileHash,size:t,type:r,id:n.id,fileId:this.currentFileId};this.currentFileHash="",this.currentFileId="",this.$emit("upload-success",i)})},beforeUnmount(){this.uppy&&this.uppy.clear()}},ZD=["data-cy"];function eL(n,e,t,r,i,s){return z(),V("div",{ref:"fileInput","data-cy":t.dataCy},null,8,ZD)}const tL=vt(d1,[["render",eL]]);d1.__docgenInfo={displayName:"DpUpload",exportName:"default",description:"",tags:{},props:[{name:"allowedFileTypes",description:"Array of mimeTypes or a defined preset as String",tags:{see:[{description:"'@DemosPlanCoreBundle/lib/FileInfo'",title:"see"}]},type:{name:"array|string"},required:!1,defaultValue:{func:!1,value:"'pdf'"}},{name:"allowedFileTypesWarning",description:"Warning message that will be rendered if files are added that are not allowed in `allowedFileTypes`.",type:{name:"string"},defaultValue:{func:!1,value:"de().strings.warningFileType"}},{name:"allowMultipleUploads",description:"Allow users to upload more files after uploading some",type:{name:"boolean"},defaultValue:{func:!1,value:"false"}},{name:"basicAuth",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"chunkSize",description:`Define chunk size for huge files like PDFs.
|
|
112
|
-
Important: Only change the default value if you are very sure about the consequences.
|
|
113
|
-
It is recommended to change the value via setting the chunkSize prop instead of adjusting
|
|
114
|
-
the default here, which basically allows the upload chunks to be as big as possible.`,type:{name:"number"},required:!1,defaultValue:{func:!1,value:"Infinity"}},{name:"dataCy",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"'upload'"}},{name:"maxFileSize",description:"Maximum file size in bytes for each individual file.",type:{name:"number"},defaultValue:{func:!1,value:"10000000"}},{name:"maxNumberOfFiles",description:`Maximum number of files that can be uploaded.
|
|
115
|
-
By default, it's allowed to upload a single file.`,type:{name:"number"},required:!1,defaultValue:{func:!1,value:"1"}},{name:"translations",type:{name:"object"},required:!1,defaultValue:{func:!1,value:"{}"}},{name:"tusEndpoint",description:"Global path for file uploader endpoint.",type:{name:"string"},required:!0}],events:[{name:"file-added",type:{names:["undefined"]}},{name:"file-error",type:{names:["undefined"]}},{name:"upload",type:{names:["undefined"]}},{name:"uploads-completed",type:{names:["undefined"]}},{name:"upload-success",type:{names:["undefined"]}}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpUploadFiles/DpUpload.vue"]};const h1={name:"DpUploadedFile",mixins:[lu],props:{file:{type:Object,required:!0}},emits:["file-remove"],inject:["getFileByHash"],data(){return{translations:{imagePreview:W.image.preview,removeFile:W.file.remove}}},computed:{fileIcon(){const n=this.file.mimeType==="txt"?"fa-file-text-o":"fa-folder-o";return this.prefixClass("fa "+n)},fileSize(){return fy("KB",this.file.size)},isImage(){return typeof["png","jpg","gif","bmp","ico","tiff","svg"].find(e=>e===this.file.mimeType)<"u"}},methods:{removeFile(){this.$emit("file-remove",this.file)}}},nL={"data-cy":"uploadFile:uploadedFileItem"},rL={key:0,"aria-hidden":"true"},iL={key:1},sL=["alt","src","aria-label"],oL={class:"break-words"},aL=["aria-label"];function lL(n,e,t,r,i,s){return z(),V("li",nL,[t.file.mimeType==="txt"?(z(),V("span",rL,[ne("i",{class:q(s.fileIcon)},null,2)])):ye("",!0),s.isImage?(z(),V("span",iL,[ne("img",{alt:t.file.name,src:s.getFileByHash(t.file.hash),"aria-label":i.translations.imagePreview,width:"50px"},null,8,sL)])):ye("",!0),ne("span",{class:q(n.prefixClass("inline-block u-pl-0_5")),style:{width:"calc(100% - 62px)"}},[ne("span",oL,qe(t.file.name),1),An(" ("+qe(s.fileSize)+") ",1),ne("button",{type:"button",class:q(n.prefixClass("btn-icns u-m-0")),"aria-label":i.translations.removeFile,"data-cy":"uploadFile:uploadedFileDeleteItem",onClick:e[0]||(e[0]=(...o)=>s.removeFile&&s.removeFile(...o))},[ne("i",{class:q(n.prefixClass("fa fa-trash")),"aria-hidden":"true"},null,2)],10,aL)],2)])}const uL=vt(h1,[["render",lL]]);h1.__docgenInfo={exportName:"default",displayName:"DpUploadedFile",description:"",tags:{},props:[{name:"file",type:{name:"object"},required:!0}],events:[{name:"file-remove",type:{names:["undefined"]}}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpUploadFiles/DpUploadedFile.vue","/home/florian/Dev/demosplan-ui/src/mixins/prefixClassMixin/prefixClassMixin.js"]};const f1={name:"DpUploadedFileList",components:{DpUploadedFile:uL},mixins:[lu],props:{files:{type:Array,required:!1,default:()=>[]}},emits:["file-remove"],data(){return{translations:{uploadedFiles:W.upload.uploadedFiles}}}};function cL(n,e,t,r,i,s){const o=je("dp-uploaded-file");return z(),V("div",null,[ne("h4",{class:q(n.prefixClass("u-mb-0_25")),"data-cy":"uploadFile:uploadedFiles"},qe(i.translations.uploadedFiles),3),ne("ul",{class:q(n.prefixClass("o-list space-stack-xs"))},[(z(!0),V(Lt,null,Rn(t.files,(a,l)=>(z(),an(o,{key:l,file:a,onFileRemove:u=>n.$emit("file-remove",u)},null,8,["file","onFileRemove"]))),128))],2)])}const dL=vt(f1,[["render",cL]]);f1.__docgenInfo={exportName:"default",displayName:"DpUploadedFileList",description:"",tags:{},props:[{name:"files",type:{name:"array"},required:!1,defaultValue:{func:!1,value:"[]"}}],events:[{name:"file-remove"}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpUploadFiles/DpUploadedFileList.vue","/home/florian/Dev/demosplan-ui/src/mixins/prefixClassMixin/prefixClassMixin.js"]};const p1={name:"DpUploadFiles",components:{DpLabel:Ek,DpUpload:tL,DpUploadedFileList:dL},mixins:[lu,Ck],props:{allowedFileTypes:{type:[Array,String],required:!0,default:"pdf"},allowMultipleUploads:{type:Boolean,default:!1},basicAuth:{type:String,required:!1,default:""},chunkSize:{type:Number,default:1/0,required:!1},clearAllFiles:{type:Boolean,required:!1,default:!1},dataCy:{type:String,required:!1,default:"uploadFile"},dataDpValidateIf:{type:[Boolean,String],required:!1,default:!1},getFileByHash:{type:Function,required:!0},id:{type:String,required:!1,default:""},label:{type:Object,default:()=>({}),validator:n=>Object.keys(n).every(e=>["hint","text","tooltip"].includes(e))},maxFileSize:{type:Number,required:!1,default:1e7},maxNumberOfFiles:{type:Number,required:!1,default:1},name:{type:String,required:!1,default:"uploadedFiles"},needsHiddenInput:{type:Boolean,default:!1},required:{type:Boolean,required:!1,default:!1},translations:{type:Object,required:!1,default:()=>({})},sideBySide:{type:Boolean,required:!1,default:!1},storageName:{type:String,required:!1,default:""},tusEndpoint:{type:String,required:!0}},emits:["upload-success"],provide(){return{getFileByHash:this.getFileByHash}},data(){return{fileHashes:[],defaultTranslations:{uploadFiles:W.upload.files},mergedTranslations:{},uploadedFiles:[]}},watch:{clearAllFiles(){this.clearAllFiles&&this.clearFilesList()},storageName(){this.updateSessionStorage(this.storageName,this.uploadedFiles)}},methods:{addFile(n){this.maxNumberOfFiles<=this.uploadedFiles.length&&(this.fileHashes.shift(),this.uploadedFiles.shift()),this.needsHiddenInput&&this.fileHashes.push(n.hash),this.uploadedFiles.push(n),this.updateSessionStorage(this.storageName,this.uploadedFiles)},clearFilesList(){this.uploadedFiles.forEach(n=>{this.removeFile(n)})},handleRemove(n){this.removeFile(n),this.$emit("file-remove",n)},handleUpload(n){this.addFile(n),this.$emit("upload-success",n),document.dispatchEvent(new CustomEvent("uploadSuccess",{detail:{file:n,fieldName:this.name}}))},removeFile(n){this.needsHiddenInput&&(this.fileHashes=this.fileHashes.filter(e=>e!==n.hash)),this.uploadedFiles=this.uploadedFiles.filter(e=>e.hash!==n.hash),this.updateSessionStorage(this.storageName,this.uploadedFiles)}},created(){this.mergedTranslations={...this.defaultTranslations,...this.translations}},mounted(){this.uploadedFiles=this.getItemFromSessionStorage(this.storageName)||[]}},hL=["textContent"],fL=["name","required","data-dp-validate-if","value"];function pL(n,e,t,r,i,s){const o=je("dp-label"),a=je("dp-upload"),l=je("dp-uploaded-file-list");return z(),V("fieldset",{class:q(n.prefixClass("layout"))},[ne("legend",{class:"sr-only",textContent:qe(i.mergedTranslations.uploadFiles)},null,8,hL),t.label.text?(z(),an(o,mk({key:0,class:"layout__item"},{for:t.id,required:t.required,...t.label}),null,16)):ye("",!0),sn(a,{"allowed-file-types":t.allowedFileTypes,"allow-multiple-uploads":t.allowMultipleUploads,"basic-auth":t.basicAuth,"chunk-size":t.chunkSize,class:q([n.prefixClass("layout__item u-1-of-1-palm"),n.prefixClass(t.sideBySide?"u-1-of-2":"u-1-of-1")]),"data-cy":t.dataCy,"max-number-of-files":t.maxNumberOfFiles,"max-file-size":t.maxFileSize,translations:i.mergedTranslations,"tus-endpoint":t.tusEndpoint,onUploadSuccess:s.handleUpload},null,8,["allowed-file-types","allow-multiple-uploads","basic-auth","chunk-size","class","data-cy","max-number-of-files","max-file-size","translations","tus-endpoint","onUploadSuccess"]),i.uploadedFiles.length>0?(z(),an(l,{key:1,class:q([n.prefixClass("layout__item u-1-of-1-palm"),n.prefixClass(t.sideBySide?"u-1-of-2":"u-1-of-1 u-mt")]),files:i.uploadedFiles,onFileRemove:s.handleRemove},null,8,["class","files","onFileRemove"])):ye("",!0),t.needsHiddenInput?(z(),V("input",{key:2,type:"hidden",name:t.name!=="uploadedFiles"?`uploadedFiles[${t.name}]`:"uploadedFiles",required:t.required,"data-dp-validate-if":t.dataDpValidateIf?!0:null,value:i.fileHashes},null,8,fL)):ye("",!0)],2)}const mL=vt(p1,[["render",pL]]);p1.__docgenInfo={exportName:"default",displayName:"DpUploadFiles",description:"",tags:{},props:[{name:"allowedFileTypes",description:"Array of mimeTypes or a defined preset as String",tags:{see:[{description:"./src/lib/FileInfo.js",title:"see"}]},type:{name:"array|string"},required:!0,defaultValue:{func:!1,value:"'pdf'"}},{name:"allowMultipleUploads",description:"Allow users to upload more files after uploading some",type:{name:"boolean"},defaultValue:{func:!1,value:"false"}},{name:"basicAuth",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"chunkSize",description:"Define chunk size for huge files like PDFs",type:{name:"number"},required:!1,defaultValue:{func:!1,value:"Infinity"}},{name:"clearAllFiles",type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"dataCy",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"'uploadFile'"}},{name:"dataDpValidateIf",description:`Use to conditionally validate a required upload field
|
|
116
|
-
"required" and "needsHiddenInput" need to be set to true in that case`,type:{name:"boolean|string"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"getFileByHash",description:"Use as routing function that receives a file hash as parameter and returns a route to that file.",type:{name:"func"},required:!0},{name:"id",description:"The ID of the upload files component is derived from this prop.",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"label",description:`The label is passed to the DpUploadFiles component.
|
|
117
|
-
This prop as Object, has 3 keys:
|
|
118
|
-
text: use as label text.
|
|
119
|
-
hint: use as description text.
|
|
120
|
-
tooltip: use as tooltip text.`,type:{name:"object"},defaultValue:{func:!1,value:"{}"}},{name:"maxFileSize",description:"Sets the maximally allowed file size for a single file in bytes.",type:{name:"number"},required:!1,defaultValue:{func:!1,value:"10000000"}},{name:"maxNumberOfFiles",description:`Maximum number of files that can be uploaded
|
|
121
|
-
Defaults to single file upload`,type:{name:"number"},required:!1,defaultValue:{func:!1,value:"1"}},{name:"name",description:"Used to set the name of the hidden input field if the backend needs a specific name.",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"'uploadedFiles'"}},{name:"needsHiddenInput",description:`Adds a hidden input with fileHash(es) as its value to the DOM.
|
|
122
|
-
Must be set to true if the uploaded file(s) are intended to be saved via form post, or if the "required"
|
|
123
|
-
prop is set to true (because dpValidate uses the input field to check the validity).`,type:{name:"boolean"},defaultValue:{func:!1,value:"false"}},{name:"required",description:`If set to true, dpValidate checks if at least one file has been uploaded.
|
|
124
|
-
"needsHiddenInput" must also be true in that case.`,type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"translations",description:`Use to overwrite the default translations
|
|
125
|
-
you can find all available keys here`,tags:{see:[{description:`https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/de_DE.js
|
|
126
|
-
some are already overwritten here`,title:"see"},{description:"./src/components/DpUploadFiles/utils/UppyTranslations.js",title:"see"}]},type:{name:"object"},required:!1,defaultValue:{func:!1,value:"{}"}},{name:"sideBySide",description:`If true the uploaded files list will be displayed next to the dropzone
|
|
127
|
-
if false it will be displayed below`,type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"storageName",description:`Set a storageName if you want the uploaded files to be stored
|
|
128
|
-
in the sessionStorage (i.e., be available across page reloads)`,type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"tusEndpoint",description:"Global path for file uploader endpoint.",type:{name:"string"},required:!0}],events:[{name:"upload-success",type:{names:["undefined"]}},{name:"file-remove",type:{names:["undefined"]}}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpUploadFiles/DpUploadFiles.vue","/home/florian/Dev/demosplan-ui/src/mixins/prefixClassMixin/prefixClassMixin.js","/home/florian/Dev/demosplan-ui/src/mixins/sessionStorageMixin.js"]};const m1={name:"DpUploadModal",components:{DpInput:ly,DpModal:uy,DpUploadFiles:mL},props:{basicAuth:{type:String,required:!1,default:""},getFileByHash:{type:Function,required:!0},tusEndpoint:{type:String,required:!0}},emits:["add-alt","close","insert-image"],data(){return{fileUrl:"",altText:"",editAltTextOnly:!1,imgSrc:"",translations:{altText:W.altText.default,altTextHint:W.image.alt.explanation,abort:W.operations.abort,editImage:W.image.edit,insert:W.operations.insert,insertImage:W.image.insert,save:W.operations.save,uploadImage:W.upload.select.image}}},methods:{closeAndReset(){this.reset(),this.$emit("close"),this.toggleModal()},emitAndClose(){this.editAltTextOnly?this.$emit("add-alt",this.altText):this.fileUrl&&this.$emit("insert-image",this.fileUrl,this.altText),this.closeAndReset()},reset(){this.altText="",this.fileUrl="",this.editAltTextOnly=!1},setFile({hash:n}){this.fileUrl=this.getFileByHash(n),this.$forceUpdate()},toggleModal(n){n&&(this.editAltTextOnly=n.editAltOnly,this.altText=n.currentAlt,this.imgSrc=n.imgSrc),this.$refs.uploadModal.toggle()}}},gL={key:0,class:"u-mb"},yL={key:1,class:"mb-2"},bL={key:2,class:"mb-2"},vL={key:3},wL=["alt","src"],kL={class:"u-mt text-right w-full space-inline-s"},SL=["textContent"];function xL(n,e,t,r,i,s){const o=je("dp-upload-files"),a=je("dp-input"),l=je("dp-modal");return z(),an(l,{ref:"uploadModal","content-classes":"w-fit","data-cy":"editor:uploadModal","onModal:toggled":e[3]||(e[3]=u=>{u||s.reset()})},{default:au(()=>[i.editAltTextOnly?(z(),V("h3",gL,qe(i.translations.editImage),1)):(z(),V("h3",yL,qe(i.translations.insertImage),1)),i.editAltTextOnly?(z(),V("div",vL,[ne("img",{alt:i.altText,class:"mb-4",src:i.imgSrc},null,8,wL)])):(z(),V("div",bL,[sn(o,{id:"imageFile",ref:"uploader","allowed-file-types":"img","basic-auth":t.basicAuth,"get-file-by-hash":t.getFileByHash,"max-file-size":20*1024*1024,"max-number-of-files":1,translations:{dropHereOr:i.translations.uploadImage("20MB")},"tus-endpoint":t.tusEndpoint,onUploadSuccess:s.setFile},null,8,["basic-auth","get-file-by-hash","translations","tus-endpoint","onUploadSuccess"])])),sn(a,{id:"altText",modelValue:i.altText,"onUpdate:modelValue":e[0]||(e[0]=u=>i.altText=u),class:"u-mb","data-cy":"uploadModal:altText",label:{hint:i.translations.altTextHint,text:i.translations.altText}},null,8,["modelValue","label"]),ne("div",kL,[ne("button",{class:"btn btn--primary","data-cy":"uploadModal:save",type:"button",onClick:e[1]||(e[1]=(...u)=>s.emitAndClose&&s.emitAndClose(...u)),textContent:qe(i.editAltTextOnly?i.translations.save:i.translations.insert)},null,8,SL),ne("button",{class:"btn btn--secondary","data-cy":"uploadModal:abort",type:"button",onClick:e[2]||(e[2]=u=>s.closeAndReset())},qe(i.translations.abort),1)])]),_:1},512)}const TL=vt(m1,[["render",xL]]);m1.__docgenInfo={displayName:"DpUploadModal",exportName:"default",description:"",tags:{},props:[{name:"basicAuth",description:"The Tus endpoint requires basicAuth to be added to the file header.",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"getFileByHash",type:{name:"func"},required:!0},{name:"tusEndpoint",description:"Global path for file uploader endpoint.",type:{name:"string"},required:!0}],events:[{name:"add-alt",type:{names:["undefined"]}},{name:"close"},{name:"insert-image",type:{names:["undefined"]},properties:[{type:{names:["undefined"]},name:"<anonymous1>"}]}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpEditor/DpUploadModal.vue"]};function CL(n){return/class="?Mso|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument|office:wo/i.test(n)}function EL(n){return/class="OutlineElement/.test(n)}function ML(n){const e=parseInt(n.getAttribute("data-aria-level")),t=parseInt(n.getAttribute("data-listid")),r=n.parentElement.nodeName,i=n.innerHTML.replace(/ /gmi," ");return{listId:t,indent:e,type:r,content:i}}function AL(n){const e=n.getAttribute("style").match(/mso-list:([^'|^"|^;]*)/i)[0],t=parseInt(e.match(/level\d+/i)[0].slice(5)),r=e.match(/lfo\d+/i)[0]||"",i="ul",s=n.querySelector("[data-val-supportLists]")?.getAttribute("data-val-supportLists")||"",o=n.innerHTML;return{listId:r,indent:t,type:i,content:o,listStyleType:s}}function OL(n){return Object.values(n).forEach(e=>{let t=ol();const r=[t],i=[t];let s=0;n[e[0].listId].forEach((o,a)=>{a>0&&e[a-1].indent<e[a].indent&&(t=ol(),s++,r[s]=t,i.push(t)),a>0&&e[a-1].indent>e[a].indent&&s--,o.sublistId=r[s],o.idx=a}),i.forEach(o=>{const a=e.filter(l=>l.sublistId===o);a.length>1&&a.map(u=>{const c=a[0].listStyleType===a[1].listStyleType?"ul":"ol";return{...u,type:c}}).forEach(u=>{n[e[0].listId][u.idx]=u}),a.length===1&&/(\d+|\w+)/i.test(a[0].listStyleType)&&a[0].listStyleType!=="o"&&(n[e[0].listId][a[0].idx].type="ol")})}),n}function NL(n,e){let t={};return(e?n.querySelectorAll("[class^=MsoList]"):n.querySelectorAll("li")).forEach(i=>{const s=e?AL(i):ML(i);Object.keys(t).includes(s.listId.toString())===!1&&(t[s.listId]=[]),i.setAttribute("data-list-indicator",s.listId),t[s.listId].push(s)}),e&&(t=OL(t)),t}function Wg(n){const e=[n[0].type];let t=`<${n[0].type}>`;for(let r=0;r<n.length;r++){const i=n[r];t+=`<li>${i.content}`;const s=r+1<n.length&&n[r+1].indent>i.indent,o=r+1<n.length&&n[r+1].indent<i.indent,a=r+1===n.length;if(s?(t+=`<${n[r+1].type}>`,e.unshift(n[r+1].type)):t+="</li>",o){let l=0;for(;n[r+1].indent+l<i.indent;)t+=`</${e[0]}></li>`,e.shift(),l++}if(a)for(let l=i.indent;l>1;l--)t+=`</${e[0]}></li>`,e.shift()}return t+=`</${n[0].type}>`,t}function _L(n){return n.replace(/( |\r|\n)/gmi," ").replace(/<head>(.|\n|\r)*?<\/head>/mi,"").replace(/<(\/)?(html|o:p)[^>]*>/gmi,"").replace(/<!\[if !(.*?)\]>(.*?)<span(.*?)style='mso-list:Ignore'>(.*?)<!\[endif\]>/gmi,(e,t,r,i,s)=>{const o=s.replace(/<span[^>]*>/gmi,"").replace(/<\/span>/gmi,"").replace(/( |\s|\\r|\\n|\r|\n)/gmi,"");return`<span data-val-${t}="${o}" />`})}function RL(n){const e=CL(n),t=EL(n);if((e||t)===!1)return n;n=n.replace(/<meta[^>]*>/mi,""),e&&(n=_L(n));const i=new DOMParser().parseFromString(n,"text/html"),s=NL(i,e);return Object.keys(s).forEach(o=>{const a=i.querySelector('[data-list-indicator="'+o+'"]');a.parentElement.nodeName.toLowerCase()==="ul"||a.parentElement.nodeName.toLowerCase()==="ol"?a.parentElement.before(Wg(s[o])):a.before(Wg(s[o])),i.querySelectorAll('[data-list-indicator="'+o+'"]').forEach(l=>{l.parentElement.nodeName.toLowerCase()==="ul"||l.parentElement.nodeName.toLowerCase()==="ol"?l.parentElement.remove():l.remove()})}),i.documentElement.outerHTML.replace(/>/gmi,">").replace(/</gmi,"<").replace(/<div[^>]*?class="ListContainerWrapper[^>]*?><ul[^>]*?><\/ul><\/div>/gm,"").replace(/<ul[^>]*?><\/ul>/gm,"")}const g1={name:"DpEditor",components:{DpIcon:vk,EditorContent:u0,DpLinkModal:kR,DpResizableImage:f0,DpUploadModal:TL},directives:{cleanhtml:ay,tooltip:ry},mixins:[lu],props:{basicAuth:{type:String,required:!1,default:""},dataDpValidateErrorFieldname:{type:String,required:!1,default:""},dataDpValidateIf:{type:String,default:"",required:!1},editorId:{type:String,required:!1,default:""},tusEndpoint:{type:String,required:!1,default:""},hiddenInput:{type:String,required:!1,default:""},required:{type:Boolean,required:!1,default:!1},toolbarItems:{required:!1,type:Object,default:()=>({})},maxlength:{type:[Number,null],default:null},obscure:{type:Boolean,required:!1,default:!1},readonly:{required:!1,default:!1,type:Boolean},routes:{type:Object,required:!1,default:()=>({}),validator:n=>Object.keys(n).every(e=>["getFileByHash"].includes(e))},suggestions:{type:Array,validator:n=>Array.isArray(n)&&n.filter(e=>{let t=e.matcher&&e.suggestions;return t=t&&typeof e.matcher.char=="string",t=t&&typeof e.matcher.allowSpaces=="boolean",t=t&&typeof e.matcher.startOfLine=="boolean",t=t&&e.suggestions.filter(r=>typeof r.id=="string"&&typeof r.name=="string").length===e.suggestions.length,t}).length===n.length,required:!1,default:()=>[]},value:{type:String,required:!0}},data(){return{currentValue:"",diffMenu:{isOpen:!1,buttons:[]},imageId:null,editor:null,editorHeight:"",isDiffMenuOpen:!1,isFullscreen:!1,isTableMenuOpen:!1,linkUrl:"",manuallyResetForm:!0,tableMenu:{isOpen:!1,buttons:[{label:W.editor.table.create,command:()=>this.editor.commands.insertTable({rowsCount:3,colsCount:3,withHeaderRow:!1}),name:"createTable"},{label:W.editor.table.delete,command:()=>this.editor.commands.deleteTable(),name:"deleteTable"},{label:W.editor.table.addColumnBefore,command:()=>this.editor.commands.addColumnBefore(),name:"addColumnBefore"},{label:W.editor.table.addColumnAfter,command:()=>this.editor.commands.addColumnAfter(),name:"addColumnAfter"},{label:W.editor.table.deleteColumn,command:()=>this.editor.commands.deleteColumn(),name:"deleteColumn"},{label:W.editor.table.addRowBefore,command:()=>this.editor.commands.addRowBefore(),name:"addRowBefore"},{label:W.editor.table.addRowAfter,command:()=>this.editor.commands.addRowAfter(),name:"addRowAfter"},{label:W.editor.table.deleteRow,command:()=>this.editor.commands.deleteRow(),name:"deleteRow"},{label:W.editor.table.toggleCellMerge,command:()=>this.editor.commands.mergeOrSplit(),name:"toggleCellMerge"}]},toolbar:Object.assign({headings:[],imageButton:!1,insertAndDelete:!1,fullscreenButton:!0,linkButton:!1,listButtons:!0,mark:!1,obscure:this.obscure,strikethrough:!1,table:!1,textDecoration:!0},this.toolbarItems),translations:{...W.editor,headingLevel:n=>W.editor.headingLevel({level:n}),insertImage:W.image.insert,obscureTitle:W.obscure.title}}},computed:{counterText(){return Mk(this.hiddenInputValue.length,this.maxlength)},hiddenInputValue(){return this.currentValue.replace("<p></p>","")===""?"":this.currentValue},obscureEnabled(){return this.toolbar.obscure}},watch:{value(n){!this.editor.focused&&this.editor.getHTML()!==n&&(this.currentValue=n,this.editor.commands.setContent(n,!1))},readonly(){this.editor.setOptions({editable:!this.readonly})}},methods:{addAltTextToImage(n){this.$root.$emit("update-image:"+this.imageId,{alt:n}),this.resetImageId(),this.emitValue()},appendText(n){let e;const t=this.startsWithTag(this.currentValue,"p")||this.startsWithTag(n,"p");this.currentValue==="k.A."||this.currentValue===""?e=n:this.currentValue!=="k.A"&&this.currentValue!==""&&t?e=this.currentValue+n:this.currentValue!=="k.A"&&this.currentValue!==""&&(e=this.currentValue+"<br>"+n),this.editor.commands.setContent(e),this.currentValue=e,this.$emit("input",this.currentValue)},collectExtensions(){const n=[D0,j0,gw,U0,L0,Hd.configure({levels:this.toolbar.headings}),LO];return this.suggestions.length>0&&this.suggestions.forEach(e=>{n.push(Bm.configure({renderHTML({node:t,HTMLAttributes:r}){const i=Bm;return["span",ve({class:"suggestion__node","data-id":t.attrs.id,"data-label":t.attrs.label,"data-suggestion-id":t.attrs.id,"data-type":i.name},r),i.options.renderText({options:{suggestion:{char:e.matcher.char}},node:t})]},suggestion:iO(e)}))}),this.toolbar.headings.length>0&&n.push(Hd.configure({levels:this.toolbar.headings})),this.toolbar.imageButton&&n.push(uO),this.toolbar.linkButton&&n.push(IO.configure({openOnClick:!1})),this.toolbar.obscure&&n.push(T0),this.toolbar.listButtons&&(n.push(I0),n.push(q0),n.push(V0)),this.toolbar.table&&(n.push(mw.configure({resizable:!0})),n.push(lR),n.push(aR),n.push(uR)),this.toolbar.insertAndDelete&&(n.push(sO),n.push(cO),this.diffMenu.buttons=[{label:W.editor.mark.insert,command:()=>this.editor.chain().focus().toggleInsert().run(),name:"insert"},{label:W.editor.mark.delete,command:()=>this.editor.chain().focus().toggleDelete().run(),name:"delete"}]),this.toolbar.mark&&(n.push(DO),this.diffMenu.buttons.unshift({label:W.editor.mark.element,command:()=>this.editor.chain().focus().toggleMarkText().run(),name:"mark"})),this.toolbar.textDecoration&&(n.push(C0),n.push(H0),n.push(yw)),this.toolbar.strikethrough&&n.push($N),n},async cut(){const n=window.getSelection();if(navigator.clipboard)try{await navigator.clipboard.writeText(n.toString()),n.deleteFromDocument()}catch(e){console.error(e)}else try{document.execCommand("cut"),n.deleteFromDocument()}catch(e){console.error(e)}},executeSubMenuButtonAction(n,e,t=!1){t?this[e].buttons.forEach(r=>{(this.editor.isActive(r.name)||r===n)&&r.command(this.editor.commands)}):n.command(this.editor.commands),this[e].isOpen=!1},fullscreen(n){const e=n.target.parentElement.parentElement.parentElement.querySelector(".tiptap .editor__content");this.isFullscreen===!1&&e.hasAttribute("style")&&(this.editorHeight=e.getAttribute("style"),e.removeAttribute("style")),this.isFullscreen=!this.isFullscreen,this.isFullscreen===!1&&this.editorHeight!==""&&e.setAttribute("style",this.editorHeight)},getLinkMark(n){return n.marks&&n.marks.find(e=>e.type.name==="customLink")},handleInsertText(n){n=n.replace(/\n/g,"<br>"),this.editor.view.input.lastClick.x===0&&this.editor.view.input.lastClick.y===0?this.appendText(n):this.insertTextAtCursorPos(n)},insertTextAtCursorPos(n){this.startsWithTag(n,"p")&&(n=n.slice(3,-4)),this.editor.commands.insertContent(n),this.currentValue=this.editor.getHTML()},insertImage(n,e){this.editor.commands.insertImage({src:n,alt:e})},insertUrl(n,e,t){if(n===null||n==="")this.editor.commands.unsetCustomLink({extendEmptyMarkRange:!0});else if(t!==""){const r=this.editor.view.state.selection;this.editor.commands.insertContent({type:r.node?r.node.type.name:"text",text:t,marks:[{type:"customLink",attrs:{href:n,target:e?"_blank":null}}]})}},openUploadModal(n){this.$refs.uploadModal.toggleModal(n)},prepareInitText(){this.currentValue=this.replaceLinebreaks(this.currentValue),this.currentValue=this.replacePlaceholdersWithImages(this.currentValue)},replaceLinebreaks(n){let e=n;return e=e.replace(/<\/p>[\n\r\s\\n\\r]*?<p>/g,"</p><p>"),e=e.replace(/<ul>[\n\r\s\\n\\r]*?<li>/g,"<ul><li>"),e.replace(/<\/li>[\n\r\s\\n\\r]*?<li>/g,"</li><li>")},replacePlaceholdersWithImages(n=this.currentValue){const e=W.image.placeholder,t=e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e,r=new RegExp(`(\\[${t}\\].*?-->)`,"gm");try{return n.replace(r,(i,s)=>{const o=s.match(/{([^}]*?)}/)[1]===W.image.alt.placeholder?"":s.match(/{([^}]*?)}/)[1],a=s.match(/<!-- (.*?) -->/)[1],l=a.substr(7,36),u=a.match(/width=(\d*?)&/)[1],c=a.match(/height=(\d*?)$/)[1];return`<img src="${this.routes.getFileByHash(l)}" width="${u}" height="${c}" alt="${o}">`})}catch{return n}},resetImageId(){this.imageId=null},resizeVertically(n){const e=n.target.parentElement.querySelector(".tiptap .editor__content");n.preventDefault();const t=parseFloat(getComputedStyle(e,null).getPropertyValue("height").replace("px","")),r=n.pageY;window.addEventListener("mousemove",i),window.addEventListener("mouseup",s);function i(o){const a=t+(o.pageY-r);e.style.height=a+"px"}function s(){window.removeEventListener("mousemove",i)}},resetEditor(){this.editor.commands.setContent("")},setSelectionByEditor(n,e,t){const r=this.editor.view.state.tr;if(n){const i=this.getLinkMark(n);i&&i.attrs.href===t.href&&this.editor.commands.setTextSelection({from:r.selection.anchor-r.selection.$anchor.nodeBefore.nodeSize,to:r.selection.anchor})}if(e){const i=this.getLinkMark(e);i&&i.attrs.href===t.href&&this.editor.commands.setTextSelection({from:r.selection.anchor,to:r.selection.anchor+r.selection.$anchor.nodeAfter.nodeSize})}},transformObscureTag(n){const e=new RegExp(`<span class="${this.prefixClass("u-obscure")}">(.*?)<\\/span>`,"g");return n.replace(e,"<dp-obscure>$1</dp-obscure>")},emitValue(){this.currentValue=this.editor.getHTML();const n=this.currentValue.split("<p>").join("").split("</p>").join("").trim()==="";this.currentValue=this.transformObscureTag(this.currentValue),this.$emit("input",n?"":this.currentValue)},showLinkPrompt(n,e){this.linkUrl=e.href?e.href:"";const t=this.editor.view.state.tr.selection;if(e.href){const i=t.anchor>t.head,s=i?"$head":"$anchor",o=i?"$anchor":"$head",a=t[s].nodeBefore,l=t[o].nodeAfter;this.setSelectionByEditor(a,l,e)}const r=this.editor.state.doc.textBetween(this.editor.view.state.tr.selection.from,this.editor.view.state.tr.selection.to," ");this.$refs.linkModal.toggleModal(this.linkUrl,r,e.target)},startsWithTag(n,e){const t=document.createElement("div");return t.innerHTML=n,(t.firstChild&&t.firstChild.nodeName)===e.toUpperCase()},toggleSubMenu(n,e){if(this[n].isOpen=e,e===!0){const t=n==="tableMenu"?"diffMenu":"tableMenu";this[t].isOpen=!1;const r=()=>{this[n].isOpen=!1,document.removeEventListener("click",r)};document.addEventListener("click",r)}}},created(){this.currentValue=this.value,this.prepareInitText()},mounted(){this.editor=new l0({id:ol(),editable:!this.readonly,extensions:this.collectExtensions(),content:this.currentValue,disableInputRules:!0,disablePasteRules:!0,onUpdate:()=>{this.emitValue()},editorProps:{attributes:{role:"textbox"},handleDrop:(n,e,t,r)=>{if(!r)return!0},transformPastedHTML:n=>{n=RL(n);const e=this.prefixClass("u-obscure"),t=LL(e);let r=n;return n.includes(`span style="color: ${t}`)&&(r=n.replace(/(?:<meta [^>]*>\s*<span [^>]*>\s*)([^<]*?)(?:\s*<\/span>)/g,"$1"),r='<span class="'+e+'">'+r+"</span>"),this.toolbar.linkButton===!1&&(r=r.replace(/<a[^>]*>(.*?)<\/a>/g,"$1")),r=r.replace(/<img.*?>/g,""),r=this.transformObscureTag(r),r}},onInit:({view:n})=>{this.currentValue=this.transformObscureTag(this.editor.getHTML()),n._props.handleScrollToSelection=DL}}),this.$root.$on("open-image-alt-modal",({event:n,imgId:e,editorId:t})=>{this.editor.options.id===t&&(this.imageId=e,this.openUploadModal({editAltOnly:!0,currentAlt:n.target.getAttribute("alt"),imgSrc:n.target.getAttribute("src")}))}),this.manuallyResetForm=this.hiddenInput!==""&&this.$el.closest("form")!==null,this.manuallyResetForm&&this.$el.closest("form").addEventListener("reset",this.resetEditor),this.toolbar.imageButton^!!this.tusEndpoint&&console.warn("DpEditor is called with only one of toolbar.imageButton or tusEndpoint set. Both must be used.")},beforeUnmount(){this.editor&&(this.editor.destroy(),this.manuallyResetForm&&this.$el.closest("form").removeEventListener("reset",this.resetEditor))}};function PL(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function jn(n,e){return typeof n=="number"?n:n[e]}const IL=function(n){const e=n.parentNode;return e&&e.nodeType===11?e.host:e};function DL(n,e=n.coordsAtPos(n.state.selection.head),t=n.docView.dom){const r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument.defaultView;for(let a=t||n.dom;a;a=IL(a)){if(a.nodeType!==1)continue;const l=window.getComputedStyle(a,null),u=l["overflow-y"]==="auto"||l["overflow-y"]==="scroll"||a.nodeType!==1,c=u?PL(o):a.getBoundingClientRect();let d=0,h=0;if(e.top<c.top+jn(r,"top")?h=-(c.top-e.top+jn(i,"top")):e.bottom>c.bottom-jn(r,"bottom")&&(h=e.bottom-c.bottom+jn(i,"bottom")),e.left<c.left+jn(r,"left")?d=-(c.left-e.left+jn(i,"left")):e.right>c.right-jn(r,"right")&&(d=e.right-c.right+jn(i,"right")),h&&(a.scrollTop+=h),d&&(a.scrollLeft+=d),u)break}}function LL(n){const e=document.getElementsByTagName("body")[0],t=document.createElement("div");t.className=n,t.id="tmpIdToGetColor",e.appendChild(t);const r=document.getElementById("tmpIdToGetColor"),i=window.getComputedStyle(r).getPropertyValue("color");return e.removeChild(r),i}const FL={class:"o-form__control-tiptap"},$L=["aria-label","disabled"],BL=["aria-label","disabled"],zL=["aria-label","disabled"],UL=["aria-label","disabled"],HL=["aria-label","disabled"],VL=["aria-label","disabled"],qL=["aria-label","disabled"],jL=["disabled"],WL=["disabled","onKeydown","onClick"],JL=["disabled","aria-label","onKeydown","onClick"],KL=["aria-label","disabled"],GL=["aria-label","disabled"],YL=["disabled","onClick"],XL=["disabled"],QL=["disabled"],ZL=["disabled"],eF=["disabled","onKeydown","onClick"],tF=["aria-label"],nF=["id","data-dp-validate-if","data-dp-validate-error-fieldname","name","data-dp-validate-maxlength","value"];function rF(n,e,t,r,i,s){const o=je("dp-link-modal"),a=je("dp-upload-modal"),l=je("dp-icon"),u=je("editor-content"),c=al("cleanhtml"),d=al("tooltip");return z(),V("div",FL,[t.maxlength!==0?Le((z(),V("div",{key:0,class:q(n.prefixClass("lbl__hint"))},null,2)),[[c,s.counterText]]):ye("",!0),i.toolbar.linkButton?(z(),an(o,{key:1,ref:"linkModal",onInsert:s.insertUrl},null,8,["onInsert"])):ye("",!0),i.toolbar.imageButton&&t.tusEndpoint?(z(),an(a,{key:2,ref:"uploadModal","basic-auth":t.basicAuth,"get-file-by-hash":t.routes.getFileByHash,"tus-endpoint":t.tusEndpoint,onInsertImage:s.insertImage,onAddAlt:s.addAltTextToImage,onClose:s.resetImageId},null,8,["basic-auth","get-file-by-hash","tus-endpoint","onInsertImage","onAddAlt","onClose"])):ye("",!0),Hr(n.$slots,"modal",{appendText:s.appendText,handleInsertText:s.handleInsertText}),i.editor?(z(),V("div",{key:3,class:q(n.prefixClass("row tiptap"))},[ne("div",{class:q(n.prefixClass("col"))},[ne("div",{class:q([i.isFullscreen?"fullscreen":"",n.prefixClass("editor")])},[ne("div",{class:q([t.readonly?n.prefixClass("readonly"):"",n.prefixClass("menubar")])},[Le((z(),V("button",{"aria-label":i.translations.cut,class:q(n.prefixClass("menubar__button")),"data-cy":"editor:cut",disabled:t.readonly,type:"button",onClick:e[0]||(e[0]=(...h)=>s.cut&&s.cut(...h))},[ne("i",{class:q(n.prefixClass("fa fa-scissors")),"aria-hidden":"true"},null,2)],10,$L)),[[d,i.translations.cut]]),e[22]||(e[22]=An(" ❘ ")),Le((z(),V("button",{"aria-label":i.translations.undo,class:q(n.prefixClass("menubar__button")),"data-cy":"editor:undo",disabled:t.readonly,type:"button",onClick:e[1]||(e[1]=h=>i.editor.chain().focus().undo().run())},[ne("i",{class:q(n.prefixClass("fa fa-reply")),"aria-hidden":"true"},null,2)],10,BL)),[[d,i.translations.undo]]),Le((z(),V("button",{"aria-label":i.translations.redo,class:q(n.prefixClass("menubar__button")),"data-cy":"editor:redo",disabled:t.readonly,type:"button",onClick:e[2]||(e[2]=h=>i.editor.chain().focus().redo().run())},[ne("i",{class:q(n.prefixClass("fa fa-share")),"aria-hidden":"true"},null,2)],10,zL)),[[d,i.translations.redo]]),i.toolbar.textDecoration?(z(),V(Lt,{key:0},[e[18]||(e[18]=An(" ❘ ")),Le((z(),V("button",{"aria-label":i.translations.bold,class:q([i.editor.isActive("bold")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),"data-cy":"editor:bold",disabled:t.readonly,type:"button",onClick:e[3]||(e[3]=h=>i.editor.chain().focus().toggleBold().run())},[ne("i",{class:q(n.prefixClass("fa fa-bold")),"aria-hidden":"true"},null,2)],10,UL)),[[d,i.translations.bold]]),Le((z(),V("button",{"aria-label":i.translations.italic,class:q([i.editor.isActive("italic")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),"data-cy":"editor:italic",disabled:t.readonly,type:"button",onClick:e[4]||(e[4]=h=>i.editor.chain().focus().toggleItalic().run())},[ne("i",{class:q(n.prefixClass("fa fa-italic")),"aria-hidden":"true"},null,2)],10,HL)),[[d,i.translations.italic]]),Le((z(),V("button",{"aria-label":i.translations.underline,class:q([i.editor.isActive("underline")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),"data-cy":"editor:underline",disabled:t.readonly,type:"button",onClick:e[5]||(e[5]=h=>i.editor.chain().focus().toggleUnderline().run())},[ne("i",{class:q(n.prefixClass("fa fa-underline")),"aria-hidden":"true"},null,2)],10,VL)),[[d,i.translations.underline]])],64)):ye("",!0),i.toolbar.strikethrough?Le((z(),V("button",{key:1,"aria-label":i.translations.strikethrough,class:q([i.editor.isActive("strike")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),"data-cy":"editor:strikethrough",disabled:t.readonly,type:"button",onClick:e[6]||(e[6]=h=>i.editor.chain().focus().toggleStrike().run())},[ne("i",{class:q(n.prefixClass("fa fa-strikethrough")),"aria-hidden":"true"},null,2)],10,qL)),[[d,i.translations.strikethrough]]):ye("",!0),i.toolbar.insertAndDelete?(z(),V("div",{key:2,class:q(n.prefixClass("inline-block relative"))},[ne("button",{class:q([i.editor.isActive("insert")||i.editor.isActive("delete")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),disabled:t.readonly,type:"button",onClick:e[7]||(e[7]=Ue(h=>s.toggleSubMenu("diffMenu",!i.diffMenu.isOpen),["stop"])),onKeydown:e[8]||(e[8]=Sn(Ue(h=>s.toggleSubMenu("diffMenu",!1),["shift","exact"]),["tab"]))},[sn(l,{class:"inline-block mr-0.5",icon:"highlighter"}),ne("i",{class:q(n.prefixClass("fa fa-caret-down"))},null,2)],42,jL),i.diffMenu.isOpen?(z(),V("div",{key:0,class:q(n.prefixClass("button_submenu"))},[(z(!0),V(Lt,null,Rn(i.diffMenu.buttons,(h,f)=>(z(),V("button",{key:`diffMenu_${f}`,class:q({"is-active":i.editor.isActive(h.name)}),type:"button",disabled:t.readonly,onKeydown:[Sn(Ue(()=>{f===i.diffMenu.buttons.length-1&&s.toggleSubMenu("diffMenu",!1)},["exact"]),["tab"]),Sn(Ue(()=>{f===0&&s.toggleSubMenu("diffMenu",!1)},["shift","exact"]),["tab"])],onClick:Ue(p=>s.executeSubMenuButtonAction(h,"diffMenu",!0),["stop"])},qe(h.label),43,WL))),128))],2)):ye("",!0),e[19]||(e[19]=An(" ❘ "))],2)):i.toolbar.mark?(z(),V("div",{key:3,class:q(n.prefixClass("inline-block relative"))},[(z(!0),V(Lt,null,Rn(i.diffMenu.buttons,(h,f)=>Le((z(),V("button",{key:`diffMenu_${f}`,class:q([i.editor.isActive(h.name)?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),type:"button",disabled:t.readonly,"aria-label":h.label,onKeydown:[Sn(Ue(()=>{f===i.diffMenu.buttons.length-1&&s.toggleSubMenu("diffMenu",!1)},["exact"]),["tab"]),Sn(Ue(()=>{f===0&&s.toggleSubMenu("diffMenu",!1)},["shift","exact"]),["tab"])],onClick:Ue(p=>s.executeSubMenuButtonAction(h,"diffMenu",!0),["stop"])},[sn(l,{class:"inline-block",icon:"highlighter"})],42,JL)),[[d,h.label]])),128))],2)):ye("",!0),i.toolbar.listButtons?(z(),V(Lt,{key:4},[Le((z(),V("button",{class:q([i.editor.isActive("bullet_list")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),type:"button","aria-label":i.translations.unorderedList,disabled:t.readonly,onClick:e[9]||(e[9]=h=>i.editor.chain().focus().toggleBulletList().run())},[ne("i",{class:q(n.prefixClass("fa fa-list-ul"))},null,2)],10,KL)),[[d,i.translations.unorderedList]]),Le((z(),V("button",{class:q([i.editor.isActive("ordered_list")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),type:"button","aria-label":i.translations.orderedList,disabled:t.readonly,onClick:e[10]||(e[10]=h=>i.editor.chain().focus().toggleOrderedList().run())},[ne("i",{class:q(n.prefixClass("fa fa-list-ol"))},null,2)],10,GL)),[[d,i.translations.orderedList]]),e[20]||(e[20]=An(" ❘ "))],64)):ye("",!0),i.toolbar.headings.length>0?(z(),V(Lt,{key:5},[(z(!0),V(Lt,null,Rn(i.toolbar.headings,h=>Le((z(),V("button",{key:"heading_"+h,class:q([i.editor.isActive("heading",{level:h})?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),disabled:t.readonly,type:"button",onClick:f=>i.editor.chain().focus().toggleHeading({level:h}).run()},[An(qe(`H${h}`),1)],10,YL)),[[d,i.translations.headingLevel(h)]])),128)),e[21]||(e[21]=An(" ❘ "))],64)):ye("",!0),s.obscureEnabled?Le((z(),V("button",{key:6,class:q([i.editor.isActive("obscure")?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),type:"button",disabled:t.readonly,onClick:e[11]||(e[11]=h=>i.editor.chain().focus().toggleObscure().run())},[ne("i",{class:q(n.prefixClass("fa fa-pencil-square")),"aria-hidden":"true"},null,2)],10,XL)),[[d,i.translations.obscureTitle]]):ye("",!0),i.toolbar.linkButton?Le((z(),V("button",{key:7,class:q(n.prefixClass("menubar__button")),type:"button",onClick:e[12]||(e[12]=Ue(h=>s.showLinkPrompt(i.editor.commands.toggleLink,i.editor.getAttributes("customLink")),["stop"]))},[ne("i",{class:q(n.prefixClass("fa fa-link"))},null,2)],2)),[[d,i.translations.link.editOrInsert]]):ye("",!0),i.toolbar.imageButton?Le((z(),V("button",{key:8,class:q(n.prefixClass("menubar__button")),type:"button",disabled:t.readonly,onClick:e[13]||(e[13]=Ue(h=>s.openUploadModal(null),["stop"]))},[ne("i",{class:q(n.prefixClass("fa fa-picture-o"))},null,2)],10,QL)),[[d,i.translations.insertImage]]):ye("",!0),i.toolbar.table?(z(),V("div",{key:9,class:q(n.prefixClass("inline-block relative"))},[ne("button",{class:q([i.tableMenu.isOpen?n.prefixClass("is-active"):"",n.prefixClass("menubar__button")]),type:"button",disabled:t.readonly,onClick:e[14]||(e[14]=Ue(h=>s.toggleSubMenu("tableMenu",!i.tableMenu.isOpen),["stop"])),onKeydown:e[15]||(e[15]=Sn(Ue(h=>s.toggleSubMenu("tableMenu",!1),["shift","exact"]),["tab"]))},[ne("i",{class:q(n.prefixClass("fa fa-table mr-0.5"))},null,2),ne("i",{class:q(n.prefixClass("fa fa-caret-down"))},null,2)],42,ZL),i.tableMenu.isOpen?(z(),V("div",{key:0,class:q(n.prefixClass("button_submenu"))},[(z(!0),V(Lt,null,Rn(i.tableMenu.buttons,(h,f)=>(z(),V("button",{key:`tableMenu_${f}`,type:"button",disabled:t.readonly,onKeydown:[Sn(Ue(()=>{f===i.tableMenu.buttons.length-1&&s.toggleSubMenu("tableMenu",!1)},["exact"]),["tab"]),Sn(Ue(()=>{f===0&&s.toggleSubMenu("tableMenu",!1)},["shift","exact"]),["tab"])],onClick:Ue(p=>s.executeSubMenuButtonAction(h,"tableMenu"),["stop"])},qe(h.label),41,eF))),128))],2)):ye("",!0)],2)):ye("",!0),i.toolbar.fullscreenButton?Le((z(),V("button",{key:10,class:q([i.isFullscreen?n.prefixClass("is-active"):"",n.prefixClass("menubar__button float-right")]),type:"button","aria-label":i.translations.fullscreen,onClick:e[16]||(e[16]=(...h)=>s.fullscreen&&s.fullscreen(...h))},[ne("i",{class:q(n.prefixClass("fa fa-arrows-alt")),"aria-hidden":"true"},null,2)],10,tF)),[[d,i.translations.fullscreen]]):ye("",!0),Hr(n.$slots,"button")],2),i.editor?(z(),an(u,{key:0,"data-cy":`editor${t.editorId}`,editor:i.editor,class:q(n.prefixClass("editor__content overflow-hidden"))},null,8,["data-cy","editor","class"])):ye("",!0),t.hiddenInput!==""?(z(),V("input",{key:1,id:t.hiddenInput,"data-dp-validate-if":t.dataDpValidateIf?!0:null,type:"hidden","data-dp-validate-error-fieldname":t.dataDpValidateErrorFieldname||null,name:t.hiddenInput,class:q([t.required?n.prefixClass("is-required"):"",n.prefixClass("tiptap__input--hidden")]),"data-dp-validate-maxlength":t.maxlength,value:s.hiddenInputValue},null,10,nF)):ye("",!0),i.isFullscreen?ye("",!0):(z(),V("i",{key:2,"aria-hidden":"true",class:q(n.prefixClass("fa fa-angle-down resizeVertical")),draggable:"true",onMousedown:e[17]||(e[17]=(...h)=>s.resizeVertically&&s.resizeVertically(...h))},null,34))],2)],2)],2)):ye("",!0)])}const h$=vt(g1,[["render",rF]]);g1.__docgenInfo={exportName:"default",displayName:"DpEditor",description:"",tags:{},props:[{name:"basicAuth",description:"The Tus endpoint requires basicAuth to be added to the file header.",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"dataDpValidateErrorFieldname",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"dataDpValidateIf",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"editorId",description:"Only needed for testing purposes with data-cy",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"tusEndpoint",description:"Global path for file uploader endpoint.",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"hiddenInput",description:`To send data with submit form action we sometimes need to have a hidden input with tiptap's content. If the
|
|
129
|
-
hidden input should be added, the prop should be a string with input name (e.g. r_name)`,type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"required",type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"toolbarItems",description:`Defaults will be set in this.toolbar:
|
|
130
|
-
{
|
|
131
|
-
headings: [], # Array of numbers 1-6
|
|
132
|
-
imageButton: false,
|
|
133
|
-
insertAndDelete: false,
|
|
134
|
-
fullscreenButton: true,
|
|
135
|
-
linkButton: false,
|
|
136
|
-
listButtons: true,
|
|
137
|
-
mark: false,
|
|
138
|
-
strikethrough: false,
|
|
139
|
-
table: false,
|
|
140
|
-
textDecoration: true
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
and can be overwritten`,type:{name:"object"},required:!1,defaultValue:{func:!1,value:"{}"}},{name:"maxlength",type:{name:"number|null"},defaultValue:{func:!1,value:"null"}},{name:"obscure",description:"Set to true if you want to use the 'obscure text' button",type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"readonly",type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"routes",description:`GetFileByHash: (Optional) function that receives a file hash as parameter
|
|
144
|
-
and returns a route to that file. Used for displaying images.`,type:{name:"object"},required:!1,defaultValue:{func:!1,value:"{}"}},{name:"suggestions",description:"Pass in an Array of suggestions if you would like to use the suggestion plugin in tiptap.",type:{name:"array"},required:!1,defaultValue:{func:!1,value:"[]"}},{name:"value",type:{name:"string"},required:!0}],events:[{name:"input",type:{names:["undefined"]}}],slots:[{name:"modal",scoped:!0,bindings:[{name:"append-text",title:"binding"},{name:"handle-insert-text",title:"binding"}]},{name:"button"}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpEditor/DpEditor.vue","/home/florian/Dev/demosplan-ui/src/mixins/prefixClassMixin/prefixClassMixin.js"]};const y1={name:"DpObscure",data(){return{title:W.obscure.title}}},iF=["title"];function sF(n,e,t,r,i,s){return z(),V("span",{class:"u-obscure",title:i.title},[Hr(n.$slots,"default")],8,iF)}const f$=vt(y1,[["render",sF]]);y1.__docgenInfo={displayName:"DpObscure",exportName:"default",description:"",tags:{},slots:[{name:"default"}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpObscure/DpObscure.vue"]};const b1={name:"DpSplitButton",directives:{onClickOutside:Ak},data(){return{isOpen:!1,hasDropdownContent:!1,translations:{open:W.dropdown.open,close:W.dropdown.close}}},methods:{close(){this.isOpen=!1},toggleDropdown(){this.isOpen=this.isOpen===!1}},mounted(){this.hasDropdownContent=typeof this.$slots.dropdown<"u"}},oF={class:"c-splitbutton"},aF=["aria-expanded"],lF={class:"sr-only"};function uF(n,e,t,r,i,s){const o=al("on-click-outside");return Le((z(),V("div",oF,[Hr(n.$slots,"default",{},()=>[e[2]||(e[2]=ne("button",{class:"btn btn--primary",type:"button"}," Primary Action Button ",-1))]),i.hasDropdownContent?(z(),V("button",{key:0,"data-cy":"splitButtonTrigger",class:q(["c-splitbutton__trigger",{"is-open":i.isOpen}]),type:"button","aria-haspopup":"true","aria-expanded":i.isOpen,onClick:e[0]||(e[0]=(...a)=>s.toggleDropdown&&s.toggleDropdown(...a)),onKeyup:e[1]||(e[1]=Sn(Ue(a=>i.isOpen?i.isOpen=!i.isOpen:"",["prevent"]),["esc"]))},[e[3]||(e[3]=ne("i",{class:"fa fa-caret-down c-splitbutton__trigger-icon"},null,-1)),ne("span",lF,qe(i.isOpen?i.translations.close:i.translations.open),1)],42,aF)):ye("",!0),i.hasDropdownContent?(z(),V("div",{key:1,class:q(["c-splitbutton__dropdown",{"is-open":i.isOpen}]),role:"menu"},[Hr(n.$slots,"dropdown",{},()=>[e[4]||(e[4]=An(" Dropdown Actions "))])],2)):ye("",!0)])),[[o,s.close]])}const p$=vt(b1,[["render",uF]]);b1.__docgenInfo={displayName:"DpSplitButton",exportName:"default",description:"",tags:{},slots:[{name:"default"},{name:"dropdown"}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpSplitButton/DpSplitButton.vue"]};const v1={name:"DpTab",props:{id:{type:String,required:!0},isActive:{type:Boolean,default:!1},label:{type:String,required:!0},suffix:{type:String,required:!1,default:null}}},cF=["id"];function dF(n,e,t,r,i,s){return Le((z(),V("section",{id:t.id,role:"tabpanel"},[Hr(n.$slots,"default")],8,cF)),[[gk,t.isActive]])}const m$=vt(v1,[["render",dF]]);v1.__docgenInfo={displayName:"DpTab",exportName:"default",description:"",tags:{},props:[{name:"id",type:{name:"string"},required:!0},{name:"isActive",type:{name:"boolean"},defaultValue:{func:!1,value:"false"}},{name:"label",description:`The label is passed to the DpTab child component, but then it is used
|
|
145
|
-
in the parent component DpTabs.`,type:{name:"string"},required:!0},{name:"suffix",description:"An html string may be passed here which is appended to the tab label.",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"null"}}],slots:[{name:"default"}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpTabs/DpTab.vue"]};const hF={class:"flex space-inline-m list-style-none border--bottom",role:"tablist"},fF=["aria-selected","aria-controls","data-cy","onClick"],pF={key:0},mF={__name:"DpTabs",props:{activeId:{type:String,required:!1,default:null},tabSize:{type:String,required:!1,default:"large",validator:n=>["medium","large"].includes(n)},useUrlFragment:{type:Boolean,required:!1,default:!1}},emits:["change"],setup(n,{emit:e}){const t=n,r=e,i=yk(),s=ou(null),o=bk(()=>i.default()[0].children.filter(h=>h.type.name==="DpTab")),a=()=>{const h=window.location.hash.slice(1);u(h)&&c(h)},l=h=>{r("change",h),c(h),t.useUrlFragment&&history.pushState(null,null,`#${h}`)},u=h=>o.value.map(f=>f.props.id).includes(h),c=h=>{s.value=h},d=()=>{const h=window.location.hash.slice(1);t.useUrlFragment&&u(h)?l(h):t.activeId?l(t.activeId):l(o.value[0].props.id)};return oy(()=>{d(),t.useUrlFragment&&window.addEventListener("hashchange",a)}),Th(()=>{t.useUrlFragment&&window.removeEventListener("hashchange",a)}),(h,f)=>(z(),V("div",null,[ne("ul",hF,[(z(!0),V(Lt,null,Rn(o.value,(p,m)=>(z(),V("li",{key:`tab:${m}`,class:q({"is-active":s.value===p.props.id})},[ne("button",{role:"tab",class:q(["btn--blank o-link--default u-pb-0_5 border--bottom",[s.value===p.props.id?"color-interactive border-interactive":"border--none color-text-muted",n.tabSize==="large"?"font-size-larger":"font-size-large"]]),"aria-selected":s.value===p.props.id,"aria-controls":p.props.id,"data-cy":p.props.id,onClick:Ue(g=>l(p.props.id),["prevent"])},[An(qe(p.props.label)+" ",1),p.props.suffix?Le((z(),V("span",pF,null,512)),[[sy(ay),p.props.suffix]]):ye("",!0)],10,fF)],2))),128))]),ne("div",null,[Hr(h.$slots,"default",{activeTabId:s.value})])]))}};mF.__docgenInfo={exportName:"default",displayName:"DpTabs",description:"",tags:{},props:[{name:"activeId",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"null"}},{name:"tabSize",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"'large'"},values:["medium","large"]},{name:"useUrlFragment",description:`Active tab state may be persisted via a url fragment. Also, all clicks are pushed
|
|
146
|
-
to the browser history to enable state change when browser navigation is used.`,type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}}],events:[{name:"change"}],slots:[{name:"default",scoped:!0,bindings:[{name:"active-tab-id",title:"binding"}]}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpTabs/DpTabs.vue"]};(function(){if(typeof window<"u")try{var n=new window.CustomEvent("test",{cancelable:!0});if(n.preventDefault(),n.defaultPrevented!==!0)throw new Error("Could not prevent default")}catch{var e=function(r,i){var s,o;return(i=i||{}).bubbles=!!i.bubbles,i.cancelable=!!i.cancelable,(s=document.createEvent("CustomEvent")).initCustomEvent(r,i.bubbles,i.cancelable,i.detail),o=s.preventDefault,s.preventDefault=function(){o.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch{this.defaultPrevented=!0}},s};e.prototype=window.Event.prototype,window.CustomEvent=e}})();var hi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gF(n,e){return n(e={exports:{}},e.exports),e.exports}function H(n,e,t){return(e=bF(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yF(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function bF(n){var e=yF(n,"string");return typeof e=="symbol"?e:String(e)}function vF(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Jg(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function wF(n,e,t){return e&&Jg(n.prototype,e),t&&Jg(n,t),n}function kF(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kg(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Gg(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kg(Object(t),!0).forEach(function(r){kF(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Kg(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}(function(n){var e=function(){try{return!!Symbol.iterator}catch{return!1}}(),t=function(o){var a={next:function(){var l=o.shift();return{done:l===void 0,value:l}}};return e&&(a[Symbol.iterator]=function(){return a}),a},r=function(o){return encodeURIComponent(o).replace(/%20/g,"+")},i=function(o){return decodeURIComponent(String(o).replace(/\+/g," "))};(function(){try{var o=n.URLSearchParams;return new o("?a=1").toString()==="a=1"&&typeof o.prototype.set=="function"&&typeof o.prototype.entries=="function"}catch{return!1}})()||function(){var o=function(l){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var u=typeof l;if(u!=="undefined")if(u==="string")l!==""&&this._fromString(l);else if(l instanceof o){var c=this;l.forEach(function(p,m){c.append(m,p)})}else{if(l===null||u!=="object")throw new TypeError("Unsupported input's type for URLSearchParams");if(Object.prototype.toString.call(l)==="[object Array]")for(var d=0;d<l.length;d++){var h=l[d];if(Object.prototype.toString.call(h)!=="[object Array]"&&h.length===2)throw new TypeError("Expected [string, any] as entry at index "+d+" of URLSearchParams's input");this.append(h[0],h[1])}else for(var f in l)l.hasOwnProperty(f)&&this.append(f,l[f])}},a=o.prototype;a.append=function(l,u){l in this._entries?this._entries[l].push(String(u)):this._entries[l]=[String(u)]},a.delete=function(l){delete this._entries[l]},a.get=function(l){return l in this._entries?this._entries[l][0]:null},a.getAll=function(l){return l in this._entries?this._entries[l].slice(0):[]},a.has=function(l){return l in this._entries},a.set=function(l,u){this._entries[l]=[String(u)]},a.forEach=function(l,u){var c;for(var d in this._entries)if(this._entries.hasOwnProperty(d)){c=this._entries[d];for(var h=0;h<c.length;h++)l.call(u,c[h],d,this)}},a.keys=function(){var l=[];return this.forEach(function(u,c){l.push(c)}),t(l)},a.values=function(){var l=[];return this.forEach(function(u){l.push(u)}),t(l)},a.entries=function(){var l=[];return this.forEach(function(u,c){l.push([c,u])}),t(l)},e&&(a[Symbol.iterator]=a.entries),a.toString=function(){var l=[];return this.forEach(function(u,c){l.push(r(c)+"="+r(u))}),l.join("&")},n.URLSearchParams=o}();var s=n.URLSearchParams.prototype;typeof s.sort!="function"&&(s.sort=function(){var o=this,a=[];this.forEach(function(u,c){a.push([c,u]),o._entries||o.delete(c)}),a.sort(function(u,c){return u[0]<c[0]?-1:u[0]>c[0]?1:0}),o._entries&&(o._entries={});for(var l=0;l<a.length;l++)this.append(a[l][0],a[l][1])}),typeof s._fromString!="function"&&Object.defineProperty(s,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(o){if(this._entries)this._entries={};else{var a=[];this.forEach(function(d,h){a.push(h)});for(var l=0;l<a.length;l++)this.delete(a[l])}var u,c=(o=o.replace(/^\?/,"")).split("&");for(l=0;l<c.length;l++)u=c[l].split("="),this.append(i(u[0]),u.length>1?i(u[1]):"")}})})(hi!==void 0?hi:typeof window<"u"?window:typeof self<"u"?self:hi),function(n){if(function(){try{var t=new n.URL("b","http://a");return t.pathname="c d",t.href==="http://a/c%20d"&&t.searchParams}catch{return!1}}()||function(){var t=n.URL,r=function(s,o){typeof s!="string"&&(s=String(s)),o&&typeof o!="string"&&(o=String(o));var a,l=document;if(o&&(n.location===void 0||o!==n.location.href)){o=o.toLowerCase(),(a=(l=document.implementation.createHTMLDocument("")).createElement("base")).href=o,l.head.appendChild(a);try{if(a.href.indexOf(o)!==0)throw new Error(a.href)}catch(g){throw new Error("URL unable to set base "+o+" due to "+g)}}var u=l.createElement("a");u.href=s,a&&(l.body.appendChild(u),u.href=u.href);var c=l.createElement("input");if(c.type="url",c.value=s,u.protocol===":"||!/:/.test(u.href)||!c.checkValidity()&&!o)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:u});var d=new n.URLSearchParams(this.search),h=!0,f=!0,p=this;["append","delete","set"].forEach(function(g){var y=d[g];d[g]=function(){y.apply(d,arguments),h&&(f=!1,p.search=d.toString(),f=!0)}}),Object.defineProperty(this,"searchParams",{value:d,enumerable:!0});var m=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==m&&(m=this.search,f&&(h=!1,this.searchParams._fromString(this.search),h=!0))}})},i=r.prototype;["hash","host","hostname","port","protocol"].forEach(function(s){(function(o){Object.defineProperty(i,o,{get:function(){return this._anchorElement[o]},set:function(a){this._anchorElement[o]=a},enumerable:!0})})(s)}),Object.defineProperty(i,"search",{get:function(){return this._anchorElement.search},set:function(s){this._anchorElement.search=s,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(i,{toString:{get:function(){var s=this;return function(){return s.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(s){this._anchorElement.href=s,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(s){this._anchorElement.pathname=s},enumerable:!0},origin:{get:function(){var s={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],o=this._anchorElement.port!=s&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(o?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(s){},enumerable:!0},username:{get:function(){return""},set:function(s){},enumerable:!0}}),r.createObjectURL=function(s){return t.createObjectURL.apply(t,arguments)},r.revokeObjectURL=function(s){return t.revokeObjectURL.apply(t,arguments)},n.URL=r}(),n.location!==void 0&&!("origin"in n.location)){var e=function(){return n.location.protocol+"//"+n.location.hostname+(n.location.port?":"+n.location.port:"")};try{Object.defineProperty(n.location,"origin",{get:e,enumerable:!0})}catch{setInterval(function(){n.location.origin=e()},100)}}}(hi!==void 0?hi:typeof window<"u"?window:typeof self<"u"?self:hi);var Yg={addCSS:!0,thumbWidth:15,watch:!0};function SF(n,e){return(function(){return Array.from(document.querySelectorAll(e)).includes(this)}).call(n,e)}function xF(n,e){if(n&&e){var t=new Event(e,{bubbles:!0});n.dispatchEvent(t)}}var qo=function(n){return n!=null?n.constructor:null},Ff=function(n,e){return!!(n&&e&&n instanceof e)},w1=function(n){return n==null},k1=function(n){return qo(n)===Object},TF=function(n){return qo(n)===Number&&!Number.isNaN(n)},S1=function(n){return qo(n)===String},CF=function(n){return qo(n)===Boolean},EF=function(n){return qo(n)===Function},x1=function(n){return Array.isArray(n)},T1=function(n){return Ff(n,NodeList)},MF=function(n){return Ff(n,Element)},AF=function(n){return Ff(n,Event)},OF=function(n){return w1(n)||(S1(n)||x1(n)||T1(n))&&!n.length||k1(n)&&!Object.keys(n).length},et={nullOrUndefined:w1,object:k1,number:TF,string:S1,boolean:CF,function:EF,array:x1,nodeList:T1,element:MF,event:AF,empty:OF};function NF(n){var e="".concat(n).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function _F(n,e){if(1>e){var t=NF(e);return parseFloat(n.toFixed(t))}return Math.round(n/e)*e}var RF=function(){function n(e,t){vF(this,n),et.element(e)?this.element=e:et.string(e)&&(this.element=document.querySelector(e)),et.element(this.element)&&et.empty(this.element.rangeTouch)&&(this.config=Gg({},Yg,{},t),this.init())}return wF(n,[{key:"init",value:function(){n.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){n.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,r=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(i){t.element[r](i,function(s){return t.set(s)},!1)})}},{key:"get",value:function(e){if(!n.enabled||!et.event(e))return null;var t,r=e.target,i=e.changedTouches[0],s=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,a=parseFloat(r.getAttribute("step"))||1,l=r.getBoundingClientRect(),u=100/l.width*(this.config.thumbWidth/2)/100;return 0>(t=100/l.width*(i.clientX-l.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*u:50<t&&(t+=2*(t-50)*u),s+_F(t/100*(o-s),a)}},{key:"set",value:function(e){n.enabled&&et.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),xF(e.target,e.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},r=null;if(et.empty(e)||et.string(e)?r=Array.from(document.querySelectorAll(et.string(e)?e:'input[type="range"]')):et.element(e)?r=[e]:et.nodeList(e)?r=Array.from(e):et.array(e)&&(r=e.filter(et.element)),et.empty(r))return null;var i=Gg({},Yg,{},t);if(et.string(e)&&i.watch){var s=new MutationObserver(function(o){Array.from(o).forEach(function(a){Array.from(a.addedNodes).forEach(function(l){et.element(l)&&SF(l,e)&&new n(l,i)})})});s.observe(document.body,{childList:!0,subtree:!0})}return r.map(function(o){return new n(o,t)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),n}();const jo=n=>n!=null?n.constructor:null,zn=(n,e)=>!!(n&&e&&n instanceof e),$f=n=>n==null,C1=n=>jo(n)===Object,PF=n=>jo(n)===Number&&!Number.isNaN(n),Ru=n=>jo(n)===String,IF=n=>jo(n)===Boolean,E1=n=>typeof n=="function",M1=n=>Array.isArray(n),DF=n=>zn(n,WeakMap),A1=n=>zn(n,NodeList),LF=n=>jo(n)===Text,FF=n=>zn(n,Event),$F=n=>zn(n,KeyboardEvent),BF=n=>zn(n,window.TextTrackCue)||zn(n,window.VTTCue),zF=n=>zn(n,TextTrack)||!$f(n)&&Ru(n.kind),UF=n=>zn(n,Promise)&&E1(n.then),HF=n=>n!==null&&typeof n=="object"&&n.nodeType===1&&typeof n.style=="object"&&typeof n.ownerDocument=="object",O1=n=>$f(n)||(Ru(n)||M1(n)||A1(n))&&!n.length||C1(n)&&!Object.keys(n).length,VF=n=>{if(zn(n,window.URL))return!0;if(!Ru(n))return!1;let e=n;n.startsWith("http://")&&n.startsWith("https://")||(e=`http://${n}`);try{return!O1(new URL(e).hostname)}catch{return!1}};var w={nullOrUndefined:$f,object:C1,number:PF,string:Ru,boolean:IF,function:E1,array:M1,weakMap:DF,nodeList:A1,element:HF,textNode:LF,event:FF,keyboardEvent:$F,cue:BF,track:zF,promise:UF,url:VF,empty:O1};const gh=(()=>{const n=document.createElement("span"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},t=Object.keys(e).find(r=>n.style[r]!==void 0);return!!w.string(t)&&e[t]})();function N1(n,e){setTimeout(()=>{try{n.hidden=!0,n.offsetHeight,n.hidden=!1}catch{}},e)}const qF=!!window.document.documentMode,jF=/Edge/g.test(navigator.userAgent),WF="WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),JF=/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,KF=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,GF=/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1;var Ve={isIE:qF,isEdge:jF,isWebKit:WF,isIPhone:JF,isIPadOS:KF,isIos:GF};function YF(n){return JSON.parse(JSON.stringify(n))}function _1(n,e){return e.split(".").reduce((t,r)=>t&&t[r],n)}function Ie(n={},...e){if(!e.length)return n;const t=e.shift();return w.object(t)?(Object.keys(t).forEach(r=>{w.object(t[r])?(Object.keys(n).includes(r)||Object.assign(n,{[r]:{}}),Ie(n[r],t[r])):Object.assign(n,{[r]:t[r]})}),Ie(n,...e)):n}function R1(n,e){const t=n.length?n:[n];Array.from(t).reverse().forEach((r,i)=>{const s=i>0?e.cloneNode(!0):e,o=r.parentNode,a=r.nextSibling;s.appendChild(r),a?o.insertBefore(s,a):o.appendChild(s)})}function yh(n,e){w.element(n)&&!w.empty(e)&&Object.entries(e).filter(([,t])=>!w.nullOrUndefined(t)).forEach(([t,r])=>n.setAttribute(t,r))}function Q(n,e,t){const r=document.createElement(n);return w.object(e)&&yh(r,e),w.string(t)&&(r.innerText=t),r}function XF(n,e){w.element(n)&&w.element(e)&&e.parentNode.insertBefore(n,e.nextSibling)}function Xg(n,e,t,r){w.element(e)&&e.appendChild(Q(n,t,r))}function Dn(n){w.nodeList(n)||w.array(n)?Array.from(n).forEach(Dn):w.element(n)&&w.element(n.parentNode)&&n.parentNode.removeChild(n)}function rl(n){if(!w.element(n))return;let{length:e}=n.childNodes;for(;e>0;)n.removeChild(n.lastChild),e-=1}function ru(n,e){return w.element(e)&&w.element(e.parentNode)&&w.element(n)?(e.parentNode.replaceChild(n,e),n):null}function tn(n,e){if(!w.string(n)||w.empty(n))return{};const t={},r=Ie({},e);return n.split(",").forEach(i=>{const s=i.trim(),o=s.replace(".",""),a=s.replace(/[[\]]/g,"").split("="),[l]=a,u=a.length>1?a[1].replace(/["']/g,""):"";switch(s.charAt(0)){case".":w.string(r.class)?t.class=`${r.class} ${o}`:t.class=o;break;case"#":t.id=s.replace("#","");break;case"[":t[l]=u}}),Ie(r,t)}function wr(n,e){if(!w.element(n))return;let t=e;w.boolean(t)||(t=!n.hidden),n.hidden=t}function pe(n,e,t){if(w.nodeList(n))return Array.from(n).map(r=>pe(r,e,t));if(w.element(n)){let r="toggle";return t!==void 0&&(r=t?"add":"remove"),n.classList[r](e),n.classList.contains(e)}return!1}function iu(n,e){return w.element(n)&&n.classList.contains(e)}function Dr(n,e){const{prototype:t}=Element;return(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||function(){return Array.from(document.querySelectorAll(e)).includes(this)}).call(n,e)}function QF(n,e){const{prototype:t}=Element;return(t.closest||function(){let r=this;do{if(Dr.matches(r,e))return r;r=r.parentElement||r.parentNode}while(r!==null&&r.nodeType===1);return null}).call(n,e)}function Oo(n){return this.elements.container.querySelectorAll(n)}function Be(n){return this.elements.container.querySelector(n)}function Wc(n=null,e=!1){w.element(n)&&n.focus({preventScroll:!0,focusVisible:e})}const Qg={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},De={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(n,e){const t=De[n]||e!=="html5";return{api:t,ui:t&&De.rangeInput}},pip:!(Ve.isIPhone||!w.function(Q("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||Q("video").disablePictureInPicture)),airplay:w.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(n){if(w.empty(n))return!1;const[e]=n.split("/");let t=n;if(!this.isHTML5||e!==this.type)return!1;Object.keys(Qg).includes(t)&&(t+=`; codecs="${Qg[n]}"`);try{return!!(t&&this.media.canPlayType(t).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const n=document.createElement("input");return n.type="range",n.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:gh!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},ZF=(()=>{let n=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(n=!0,null)});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return n})();function No(n,e,t,r=!1,i=!0,s=!1){if(!n||!("addEventListener"in n)||w.empty(e)||!w.function(t))return;const o=e.split(" ");let a=s;ZF&&(a={passive:i,capture:s}),o.forEach(l=>{this&&this.eventListeners&&r&&this.eventListeners.push({element:n,type:l,callback:t,options:a}),n[r?"addEventListener":"removeEventListener"](l,t,a)})}function de(n,e="",t,r=!0,i=!1){No.call(this,n,e,t,!0,r,i)}function Pu(n,e="",t,r=!0,i=!1){No.call(this,n,e,t,!1,r,i)}function Bf(n,e="",t,r=!0,i=!1){const s=(...o)=>{Pu(n,e,s,r,i),t.apply(this,o)};No.call(this,n,e,s,!0,r,i)}function te(n,e="",t=!1,r={}){if(!w.element(n)||w.empty(e))return;const i=new CustomEvent(e,{bubbles:t,detail:{...r,plyr:this}});n.dispatchEvent(i)}function e2(){this&&this.eventListeners&&(this.eventListeners.forEach(n=>{const{element:e,type:t,callback:r,options:i}=n;e.removeEventListener(t,r,i)}),this.eventListeners=[])}function t2(){return new Promise(n=>this.ready?setTimeout(n,0):de.call(this,this.elements.container,"ready",n)).then(()=>{})}function rn(n){w.promise(n)&&n.then(null,()=>{})}function bh(n){return w.array(n)?n.filter((e,t)=>n.indexOf(e)===t):n}function P1(n,e){return w.array(n)&&n.length?n.reduce((t,r)=>Math.abs(r-e)<Math.abs(t-e)?r:t):null}function I1(n){return!(!window||!window.CSS)&&window.CSS.supports(n)}const Zg=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((n,[e,t])=>({...n,[e/t]:[e,t]}),{});function D1(n){return w.array(n)||w.string(n)&&n.includes(":")?(w.array(n)?n:n.split(":")).map(Number).every(w.number):!1}function su(n){if(!w.array(n)||!n.every(w.number))return null;const[e,t]=n,r=(s,o)=>o===0?s:r(o,s%o),i=r(e,t);return[e/i,t/i]}function zf(n){const e=r=>D1(r)?r.split(":").map(Number):null;let t=e(n);if(t===null&&(t=e(this.config.ratio)),t===null&&!w.empty(this.embed)&&w.array(this.embed.ratio)&&({ratio:t}=this.embed),t===null&&this.isHTML5){const{videoWidth:r,videoHeight:i}=this.media;t=[r,i]}return su(t)}function Hi(n){if(!this.isVideo)return{};const{wrapper:e}=this.elements,t=zf.call(this,n);if(!w.array(t))return{};const[r,i]=su(t),s=100/r*i;if(I1(`aspect-ratio: ${r}/${i}`)?e.style.aspectRatio=`${r}/${i}`:e.style.paddingBottom=`${s}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const o=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),a=(o-s)/(o/50);this.fullscreen.active?e.style.paddingBottom=null:this.media.style.transform=`translateY(-${a}%)`}else this.isHTML5&&e.classList.add(this.config.classNames.videoFixedRatio);return{padding:s,ratio:t}}function L1(n,e,t=.05){const r=n/e,i=P1(Object.keys(Zg),r);return Math.abs(i-r)<=t?Zg[i]:[n,e]}function n2(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const sr={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(n=>{const e=n.getAttribute("type");return!!w.empty(e)||De.mime.call(this,e)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:sr.getSources.call(this).map(n=>Number(n.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const n=this;n.options.speed=n.config.speed.options,w.empty(this.config.ratio)||Hi.call(n),Object.defineProperty(n.media,"quality",{get(){const e=sr.getSources.call(n).find(t=>t.getAttribute("src")===n.source);return e&&Number(e.getAttribute("size"))},set(e){if(n.quality!==e){if(n.config.quality.forced&&w.function(n.config.quality.onChange))n.config.quality.onChange(e);else{const t=sr.getSources.call(n).find(l=>Number(l.getAttribute("size"))===e);if(!t)return;const{currentTime:r,paused:i,preload:s,readyState:o,playbackRate:a}=n.media;n.media.src=t.getAttribute("src"),(s!=="none"||o)&&(n.once("loadedmetadata",()=>{n.speed=a,n.currentTime=r,i||rn(n.play())}),n.media.load())}te.call(n,n.media,"qualitychange",!1,{quality:e})}}})},cancelRequests(){this.isHTML5&&(Dn(sr.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function r2(n){return`${n}-${Math.floor(1e4*Math.random())}`}function vh(n,...e){return w.empty(n)?n:n.toString().replace(/{(\d+)}/g,(t,r)=>e[r].toString())}function i2(n,e){return n===0||e===0||Number.isNaN(n)||Number.isNaN(e)?0:(n/e*100).toFixed(2)}const no=(n="",e="",t="")=>n.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),t.toString()),F1=(n="")=>n.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function s2(n=""){let e=n.toString();return e=no(e,"-"," "),e=no(e,"_"," "),e=F1(e),no(e," ","")}function o2(n=""){let e=n.toString();return e=s2(e),e.charAt(0).toLowerCase()+e.slice(1)}function a2(n){const e=document.createDocumentFragment(),t=document.createElement("div");return e.appendChild(t),t.innerHTML=n,e.firstChild.innerText}function l2(n){const e=document.createElement("div");return e.appendChild(n),e.innerHTML}const ey={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},He={get(n="",e={}){if(w.empty(n)||w.empty(e))return"";let t=_1(e.i18n,n);if(w.empty(t))return Object.keys(ey).includes(n)?ey[n]:"";const r={"{seektime}":e.seekTime,"{title}":e.title};return Object.entries(r).forEach(([i,s])=>{t=no(t,i,s)}),t}};class _o{constructor(e){H(this,"get",t=>{if(!_o.supported||!this.enabled)return null;const r=window.localStorage.getItem(this.key);if(w.empty(r))return null;const i=JSON.parse(r);return w.string(t)&&t.length?i[t]:i}),H(this,"set",t=>{if(!_o.supported||!this.enabled||!w.object(t))return;let r=this.get();w.empty(r)&&(r={}),Ie(r,t);try{window.localStorage.setItem(this.key,JSON.stringify(r))}catch{}}),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}}function Wo(n,e="text"){return new Promise((t,r)=>{try{const i=new XMLHttpRequest;if(!("withCredentials"in i))return;i.addEventListener("load",()=>{if(e==="text")try{t(JSON.parse(i.responseText))}catch{t(i.responseText)}else t(i.response)}),i.addEventListener("error",()=>{throw new Error(i.status)}),i.open("GET",n,!0),i.responseType=e,i.send()}catch(i){r(i)}})}function $1(n,e){if(!w.string(n))return;const t="cache",r=w.string(e);let i=!1;const s=()=>document.getElementById(e)!==null,o=(a,l)=>{a.innerHTML=l,r&&s()||document.body.insertAdjacentElement("afterbegin",a)};if(!r||!s()){const a=_o.supported,l=document.createElement("div");if(l.setAttribute("hidden",""),r&&l.setAttribute("id",e),a){const u=window.localStorage.getItem(`${t}-${e}`);if(i=u!==null,i){const c=JSON.parse(u);o(l,c.content)}}Wo(n).then(u=>{if(!w.empty(u)){if(a)try{window.localStorage.setItem(`${t}-${e}`,JSON.stringify({content:u}))}catch{}o(l,u)}}).catch(()=>{})}}const B1=n=>Math.trunc(n/60/60%60,10),u2=n=>Math.trunc(n/60%60,10),c2=n=>Math.trunc(n%60,10);function Iu(n=0,e=!1,t=!1){if(!w.number(n))return Iu(void 0,e,t);const r=a=>`0${a}`.slice(-2);let i=B1(n);const s=u2(n),o=c2(n);return i=e||i>0?`${i}:`:"",`${t&&n>0?"-":""}${i}${r(s)}:${r(o)}`}const U={getIconUrl(){const n=new URL(this.config.iconUrl,window.location),e=window.location.host?window.location.host:window.top.location.host,t=n.host!==e||Ve.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:t}},findElements(){try{return this.elements.controls=Be.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:Oo.call(this,this.config.selectors.buttons.play),pause:Be.call(this,this.config.selectors.buttons.pause),restart:Be.call(this,this.config.selectors.buttons.restart),rewind:Be.call(this,this.config.selectors.buttons.rewind),fastForward:Be.call(this,this.config.selectors.buttons.fastForward),mute:Be.call(this,this.config.selectors.buttons.mute),pip:Be.call(this,this.config.selectors.buttons.pip),airplay:Be.call(this,this.config.selectors.buttons.airplay),settings:Be.call(this,this.config.selectors.buttons.settings),captions:Be.call(this,this.config.selectors.buttons.captions),fullscreen:Be.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=Be.call(this,this.config.selectors.progress),this.elements.inputs={seek:Be.call(this,this.config.selectors.inputs.seek),volume:Be.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:Be.call(this,this.config.selectors.display.buffer),currentTime:Be.call(this,this.config.selectors.display.currentTime),duration:Be.call(this,this.config.selectors.display.duration)},w.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(n){return this.debug.warn("It looks like there is a problem with your custom controls HTML",n),this.toggleNativeControls(!0),!1}},createIcon(n,e){const t="http://www.w3.org/2000/svg",r=U.getIconUrl.call(this),i=`${r.cors?"":r.url}#${this.config.iconPrefix}`,s=document.createElementNS(t,"svg");yh(s,Ie(e,{"aria-hidden":"true",focusable:"false"}));const o=document.createElementNS(t,"use"),a=`${i}-${n}`;return"href"in o&&o.setAttributeNS("http://www.w3.org/1999/xlink","href",a),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),s.appendChild(o),s},createLabel(n,e={}){const t=He.get(n,this.config);return Q("span",{...e,class:[e.class,this.config.classNames.hidden].filter(Boolean).join(" ")},t)},createBadge(n){if(w.empty(n))return null;const e=Q("span",{class:this.config.classNames.menu.value});return e.appendChild(Q("span",{class:this.config.classNames.menu.badge},n)),e},createButton(n,e){const t=Ie({},e);let r=o2(n);const i={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(o=>{Object.keys(t).includes(o)&&(i[o]=t[o],delete t[o])}),i.element!=="button"||Object.keys(t).includes("type")||(t.type="button"),Object.keys(t).includes("class")?t.class.split(" ").some(o=>o===this.config.classNames.control)||Ie(t,{class:`${t.class} ${this.config.classNames.control}`}):t.class=this.config.classNames.control,n){case"play":i.toggle=!0,i.label="play",i.labelPressed="pause",i.icon="play",i.iconPressed="pause";break;case"mute":i.toggle=!0,i.label="mute",i.labelPressed="unmute",i.icon="volume",i.iconPressed="muted";break;case"captions":i.toggle=!0,i.label="enableCaptions",i.labelPressed="disableCaptions",i.icon="captions-off",i.iconPressed="captions-on";break;case"fullscreen":i.toggle=!0,i.label="enterFullscreen",i.labelPressed="exitFullscreen",i.icon="enter-fullscreen",i.iconPressed="exit-fullscreen";break;case"play-large":t.class+=` ${this.config.classNames.control}--overlaid`,r="play",i.label="play",i.icon="play";break;default:w.empty(i.label)&&(i.label=r),w.empty(i.icon)&&(i.icon=n)}const s=Q(i.element);return i.toggle?(s.appendChild(U.createIcon.call(this,i.iconPressed,{class:"icon--pressed"})),s.appendChild(U.createIcon.call(this,i.icon,{class:"icon--not-pressed"})),s.appendChild(U.createLabel.call(this,i.labelPressed,{class:"label--pressed"})),s.appendChild(U.createLabel.call(this,i.label,{class:"label--not-pressed"}))):(s.appendChild(U.createIcon.call(this,i.icon)),s.appendChild(U.createLabel.call(this,i.label))),Ie(t,tn(this.config.selectors.buttons[r],t)),yh(s,t),r==="play"?(w.array(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(s)):this.elements.buttons[r]=s,s},createRange(n,e){const t=Q("input",Ie(tn(this.config.selectors.inputs[n]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":He.get(n,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},e));return this.elements.inputs[n]=t,U.updateRangeFill.call(this,t),RF.setup(t),t},createProgress(n,e){const t=Q("progress",Ie(tn(this.config.selectors.display[n]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},e));if(n!=="volume"){t.appendChild(Q("span",null,"0"));const r={played:"played",buffer:"buffered"}[n],i=r?He.get(r,this.config):"";t.innerText=`% ${i.toLowerCase()}`}return this.elements.display[n]=t,t},createTime(n,e){const t=tn(this.config.selectors.display[n],e),r=Q("div",Ie(t,{class:`${t.class?t.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":He.get(n,this.config),role:"timer"}),"00:00");return this.elements.display[n]=r,r},bindMenuItemShortcuts(n,e){de.call(this,n,"keydown keyup",t=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(t.key)||(t.preventDefault(),t.stopPropagation(),t.type==="keydown"))return;const r=Dr(n,'[role="menuitemradio"]');if(!r&&[" ","ArrowRight"].includes(t.key))U.showMenuPanel.call(this,e,!0);else{let i;t.key!==" "&&(t.key==="ArrowDown"||r&&t.key==="ArrowRight"?(i=n.nextElementSibling,w.element(i)||(i=n.parentNode.firstElementChild)):(i=n.previousElementSibling,w.element(i)||(i=n.parentNode.lastElementChild)),Wc.call(this,i,!0))}},!1),de.call(this,n,"keyup",t=>{t.key==="Return"&&U.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:n,list:e,type:t,title:r,badge:i=null,checked:s=!1}){const o=tn(this.config.selectors.inputs[t]),a=Q("button",Ie(o,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${o.class?o.class:""}`.trim(),"aria-checked":s,value:n})),l=Q("span");l.innerHTML=r,w.element(i)&&l.appendChild(i),a.appendChild(l),Object.defineProperty(a,"checked",{enumerable:!0,get:()=>a.getAttribute("aria-checked")==="true",set(u){u&&Array.from(a.parentNode.children).filter(c=>Dr(c,'[role="menuitemradio"]')).forEach(c=>c.setAttribute("aria-checked","false")),a.setAttribute("aria-checked",u?"true":"false")}}),this.listeners.bind(a,"click keyup",u=>{if(!w.keyboardEvent(u)||u.key===" "){switch(u.preventDefault(),u.stopPropagation(),a.checked=!0,t){case"language":this.currentTrack=Number(n);break;case"quality":this.quality=n;break;case"speed":this.speed=parseFloat(n)}U.showMenuPanel.call(this,"home",w.keyboardEvent(u))}},t,!1),U.bindMenuItemShortcuts.call(this,a,t),e.appendChild(a)},formatTime(n=0,e=!1){return w.number(n)?Iu(n,B1(this.duration)>0,e):n},updateTimeDisplay(n=null,e=0,t=!1){w.element(n)&&w.number(e)&&(n.innerText=U.formatTime(e,t))},updateVolume(){this.supported.ui&&(w.element(this.elements.inputs.volume)&&U.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),w.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(n,e=0){w.element(n)&&(n.value=e,U.updateRangeFill.call(this,n))},updateProgress(n){if(!this.supported.ui||!w.event(n))return;let e=0;const t=(r,i)=>{const s=w.number(i)?i:0,o=w.element(r)?r:this.elements.display.buffer;if(w.element(o)){o.value=s;const a=o.getElementsByTagName("span")[0];w.element(a)&&(a.childNodes[0].nodeValue=s)}};if(n)switch(n.type){case"timeupdate":case"seeking":case"seeked":e=i2(this.currentTime,this.duration),n.type==="timeupdate"&&U.setRange.call(this,this.elements.inputs.seek,e);break;case"playing":case"progress":t(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(n){const e=w.event(n)?n.target:n;if(w.element(e)&&e.getAttribute("type")==="range"){if(Dr(e,this.config.selectors.inputs.seek)){e.setAttribute("aria-valuenow",this.currentTime);const t=U.formatTime(this.currentTime),r=U.formatTime(this.duration),i=He.get("seekLabel",this.config);e.setAttribute("aria-valuetext",i.replace("{currentTime}",t).replace("{duration}",r))}else if(Dr(e,this.config.selectors.inputs.volume)){const t=100*e.value;e.setAttribute("aria-valuenow",t),e.setAttribute("aria-valuetext",`${t.toFixed(1)}%`)}else e.setAttribute("aria-valuenow",e.value);(Ve.isWebKit||Ve.isIPadOS)&&e.style.setProperty("--value",e.value/e.max*100+"%")}},updateSeekTooltip(n){var e,t;if(!this.config.tooltips.seek||!w.element(this.elements.inputs.seek)||!w.element(this.elements.display.seekTooltip)||this.duration===0)return;const r=this.elements.display.seekTooltip,i=`${this.config.classNames.tooltip}--visible`,s=c=>pe(r,i,c);if(this.touch)return void s(!1);let o=0;const a=this.elements.progress.getBoundingClientRect();if(w.event(n))o=100/a.width*(n.pageX-a.left);else{if(!iu(r,i))return;o=parseFloat(r.style.left,10)}o<0?o=0:o>100&&(o=100);const l=this.duration/100*o;r.innerText=U.formatTime(l);const u=(e=this.config.markers)===null||e===void 0||(t=e.points)===null||t===void 0?void 0:t.find(({time:c})=>c===Math.round(l));u&&r.insertAdjacentHTML("afterbegin",`${u.label}<br>`),r.style.left=`${o}%`,w.event(n)&&["mouseenter","mouseleave"].includes(n.type)&&s(n.type==="mouseenter")},timeUpdate(n){const e=!w.element(this.elements.display.duration)&&this.config.invertTime;U.updateTimeDisplay.call(this,this.elements.display.currentTime,e?this.duration-this.currentTime:this.currentTime,e),n&&n.type==="timeupdate"&&this.media.seeking||U.updateProgress.call(this,n)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return wr(this.elements.display.currentTime,!0),void wr(this.elements.progress,!0);w.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const n=w.element(this.elements.display.duration);!n&&this.config.displayDuration&&this.paused&&U.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),n&&U.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&U.setMarkers.call(this),U.updateSeekTooltip.call(this)},toggleMenuButton(n,e){wr(this.elements.settings.buttons[n],!e)},updateSetting(n,e,t){const r=this.elements.settings.panels[n];let i=null,s=e;if(n==="captions")i=this.currentTrack;else{if(i=w.empty(t)?this[n]:t,w.empty(i)&&(i=this.config[n].default),!w.empty(this.options[n])&&!this.options[n].includes(i))return void this.debug.warn(`Unsupported value of '${i}' for ${n}`);if(!this.config[n].options.includes(i))return void this.debug.warn(`Disabled value of '${i}' for ${n}`)}if(w.element(s)||(s=r&&r.querySelector('[role="menu"]')),!w.element(s))return;this.elements.settings.buttons[n].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=U.getLabel.call(this,n,i);const o=s&&s.querySelector(`[value="${i}"]`);w.element(o)&&(o.checked=!0)},getLabel(n,e){switch(n){case"speed":return e===1?He.get("normal",this.config):`${e}×`;case"quality":if(w.number(e)){const t=He.get(`qualityLabel.${e}`,this.config);return t.length?t:`${e}p`}return F1(e);case"captions":return he.getLabel.call(this);default:return null}},setQualityMenu(n){if(!w.element(this.elements.settings.panels.quality))return;const e="quality",t=this.elements.settings.panels.quality.querySelector('[role="menu"]');w.array(n)&&(this.options.quality=bh(n).filter(s=>this.config.quality.options.includes(s)));const r=!w.empty(this.options.quality)&&this.options.quality.length>1;if(U.toggleMenuButton.call(this,e,r),rl(t),U.checkMenu.call(this),!r)return;const i=s=>{const o=He.get(`qualityBadge.${s}`,this.config);return o.length?U.createBadge.call(this,o):null};this.options.quality.sort((s,o)=>{const a=this.config.quality.options;return a.indexOf(s)>a.indexOf(o)?1:-1}).forEach(s=>{U.createMenuItem.call(this,{value:s,list:t,type:e,title:U.getLabel.call(this,"quality",s),badge:i(s)})}),U.updateSetting.call(this,e,t)},setCaptionsMenu(){if(!w.element(this.elements.settings.panels.captions))return;const n="captions",e=this.elements.settings.panels.captions.querySelector('[role="menu"]'),t=he.getTracks.call(this),r=!!t.length;if(U.toggleMenuButton.call(this,n,r),rl(e),U.checkMenu.call(this),!r)return;const i=t.map((s,o)=>({value:o,checked:this.captions.toggled&&this.currentTrack===o,title:he.getLabel.call(this,s),badge:s.language&&U.createBadge.call(this,s.language.toUpperCase()),list:e,type:"language"}));i.unshift({value:-1,checked:!this.captions.toggled,title:He.get("disabled",this.config),list:e,type:"language"}),i.forEach(U.createMenuItem.bind(this)),U.updateSetting.call(this,n,e)},setSpeedMenu(){if(!w.element(this.elements.settings.panels.speed))return;const n="speed",e=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(r=>r>=this.minimumSpeed&&r<=this.maximumSpeed);const t=!w.empty(this.options.speed)&&this.options.speed.length>1;U.toggleMenuButton.call(this,n,t),rl(e),U.checkMenu.call(this),t&&(this.options.speed.forEach(r=>{U.createMenuItem.call(this,{value:r,list:e,type:n,title:U.getLabel.call(this,"speed",r)})}),U.updateSetting.call(this,n,e))},checkMenu(){const{buttons:n}=this.elements.settings,e=!w.empty(n)&&Object.values(n).some(t=>!t.hidden);wr(this.elements.settings.menu,!e)},focusFirstMenuItem(n,e=!1){if(this.elements.settings.popup.hidden)return;let t=n;w.element(t)||(t=Object.values(this.elements.settings.panels).find(i=>!i.hidden));const r=t.querySelector('[role^="menuitem"]');Wc.call(this,r,e)},toggleMenu(n){const{popup:e}=this.elements.settings,t=this.elements.buttons.settings;if(!w.element(e)||!w.element(t))return;const{hidden:r}=e;let i=r;if(w.boolean(n))i=n;else if(w.keyboardEvent(n)&&n.key==="Escape")i=!1;else if(w.event(n)){const s=w.function(n.composedPath)?n.composedPath()[0]:n.target,o=e.contains(s);if(o||!o&&n.target!==t&&i)return}t.setAttribute("aria-expanded",i),wr(e,!i),pe(this.elements.container,this.config.classNames.menu.open,i),i&&w.keyboardEvent(n)?U.focusFirstMenuItem.call(this,null,!0):i||r||Wc.call(this,t,w.keyboardEvent(n))},getMenuSize(n){const e=n.cloneNode(!0);e.style.position="absolute",e.style.opacity=0,e.removeAttribute("hidden"),n.parentNode.appendChild(e);const t=e.scrollWidth,r=e.scrollHeight;return Dn(e),{width:t,height:r}},showMenuPanel(n="",e=!1){const t=this.elements.container.querySelector(`#plyr-settings-${this.id}-${n}`);if(!w.element(t))return;const r=t.parentNode,i=Array.from(r.children).find(s=>!s.hidden);if(De.transitions&&!De.reducedMotion){r.style.width=`${i.scrollWidth}px`,r.style.height=`${i.scrollHeight}px`;const s=U.getMenuSize.call(this,t),o=a=>{a.target===r&&["width","height"].includes(a.propertyName)&&(r.style.width="",r.style.height="",Pu.call(this,r,gh,o))};de.call(this,r,gh,o),r.style.width=`${s.width}px`,r.style.height=`${s.height}px`}wr(i,!0),wr(t,!1),U.focusFirstMenuItem.call(this,t,e)},setDownloadUrl(){const n=this.elements.buttons.download;w.element(n)&&n.setAttribute("href",this.download)},create(n){const{bindMenuItemShortcuts:e,createButton:t,createProgress:r,createRange:i,createTime:s,setQualityMenu:o,setSpeedMenu:a,showMenuPanel:l}=U;this.elements.controls=null,w.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(t.call(this,"play-large"));const u=Q("div",tn(this.config.selectors.controls.wrapper));this.elements.controls=u;const c={class:"plyr__controls__item"};return bh(w.array(this.config.controls)?this.config.controls:[]).forEach(d=>{if(d==="restart"&&u.appendChild(t.call(this,"restart",c)),d==="rewind"&&u.appendChild(t.call(this,"rewind",c)),d==="play"&&u.appendChild(t.call(this,"play",c)),d==="fast-forward"&&u.appendChild(t.call(this,"fast-forward",c)),d==="progress"){const h=Q("div",{class:`${c.class} plyr__progress__container`}),f=Q("div",tn(this.config.selectors.progress));if(f.appendChild(i.call(this,"seek",{id:`plyr-seek-${n.id}`})),f.appendChild(r.call(this,"buffer")),this.config.tooltips.seek){const p=Q("span",{class:this.config.classNames.tooltip},"00:00");f.appendChild(p),this.elements.display.seekTooltip=p}this.elements.progress=f,h.appendChild(this.elements.progress),u.appendChild(h)}if(d==="current-time"&&u.appendChild(s.call(this,"currentTime",c)),d==="duration"&&u.appendChild(s.call(this,"duration",c)),d==="mute"||d==="volume"){let{volume:h}=this.elements;if(w.element(h)&&u.contains(h)||(h=Q("div",Ie({},c,{class:`${c.class} plyr__volume`.trim()})),this.elements.volume=h,u.appendChild(h)),d==="mute"&&h.appendChild(t.call(this,"mute")),d==="volume"&&!Ve.isIos&&!Ve.isIPadOS){const f={max:1,step:.05,value:this.config.volume};h.appendChild(i.call(this,"volume",Ie(f,{id:`plyr-volume-${n.id}`})))}}if(d==="captions"&&u.appendChild(t.call(this,"captions",c)),d==="settings"&&!w.empty(this.config.settings)){const h=Q("div",Ie({},c,{class:`${c.class} plyr__menu`.trim(),hidden:""}));h.appendChild(t.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${n.id}`,"aria-expanded":!1}));const f=Q("div",{class:"plyr__menu__container",id:`plyr-settings-${n.id}`,hidden:""}),p=Q("div"),m=Q("div",{id:`plyr-settings-${n.id}-home`}),g=Q("div",{role:"menu"});m.appendChild(g),p.appendChild(m),this.elements.settings.panels.home=m,this.config.settings.forEach(y=>{const v=Q("button",Ie(tn(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));e.call(this,v,y),de.call(this,v,"click",()=>{l.call(this,y,!1)});const k=Q("span",null,He.get(y,this.config)),b=Q("span",{class:this.config.classNames.menu.value});b.innerHTML=n[y],k.appendChild(b),v.appendChild(k),g.appendChild(v);const x=Q("div",{id:`plyr-settings-${n.id}-${y}`,hidden:""}),A=Q("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});A.appendChild(Q("span",{"aria-hidden":!0},He.get(y,this.config))),A.appendChild(Q("span",{class:this.config.classNames.hidden},He.get("menuBack",this.config))),de.call(this,x,"keydown",O=>{O.key==="ArrowLeft"&&(O.preventDefault(),O.stopPropagation(),l.call(this,"home",!0))},!1),de.call(this,A,"click",()=>{l.call(this,"home",!1)}),x.appendChild(A),x.appendChild(Q("div",{role:"menu"})),p.appendChild(x),this.elements.settings.buttons[y]=v,this.elements.settings.panels[y]=x}),f.appendChild(p),h.appendChild(f),u.appendChild(h),this.elements.settings.popup=f,this.elements.settings.menu=h}if(d==="pip"&&De.pip&&u.appendChild(t.call(this,"pip",c)),d==="airplay"&&De.airplay&&u.appendChild(t.call(this,"airplay",c)),d==="download"){const h=Ie({},c,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(h.download="");const{download:f}=this.config.urls;!w.url(f)&&this.isEmbed&&Ie(h,{icon:`logo-${this.provider}`,label:this.provider}),u.appendChild(t.call(this,"download",h))}d==="fullscreen"&&u.appendChild(t.call(this,"fullscreen",c))}),this.isHTML5&&o.call(this,sr.getQualityOptions.call(this)),a.call(this),u},inject(){if(this.config.loadSprite){const i=U.getIconUrl.call(this);i.cors&&$1(i.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let n=null;this.elements.controls=null;const e={id:this.id,seektime:this.config.seekTime,title:this.config.title};let t=!0;w.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,e)),this.config.controls||(this.config.controls=[]),w.element(this.config.controls)||w.string(this.config.controls)?n=this.config.controls:(n=U.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:he.getLabel.call(this)}),t=!1);let r;if(t&&w.string(this.config.controls)&&(n=(i=>{let s=i;return Object.entries(e).forEach(([o,a])=>{s=no(s,`{${o}}`,a)}),s})(n)),w.string(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),w.element(r)||(r=this.elements.container),r[w.element(n)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",n),w.element(this.elements.controls)||U.findElements.call(this),!w.empty(this.elements.buttons)){const i=s=>{const o=this.config.classNames.controlPressed;s.setAttribute("aria-pressed","false"),Object.defineProperty(s,"pressed",{configurable:!0,enumerable:!0,get:()=>iu(s,o),set(a=!1){pe(s,o,a),s.setAttribute("aria-pressed",a?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach(s=>{w.array(s)||w.nodeList(s)?Array.from(s).filter(Boolean).forEach(i):i(s)})}if(Ve.isEdge&&N1(r),this.config.tooltips.controls){const{classNames:i,selectors:s}=this.config,o=`${s.controls.wrapper} ${s.labels} .${i.hidden}`,a=Oo.call(this,o);Array.from(a).forEach(l=>{pe(l,this.config.classNames.hidden,!1),pe(l,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){var n,e;if(!this.duration||this.elements.markers)return;const t=(n=this.config.markers)===null||n===void 0||(e=n.points)===null||e===void 0?void 0:e.filter(({time:l})=>l>0&&l<this.duration);if(t==null||!t.length)return;const r=document.createDocumentFragment(),i=document.createDocumentFragment();let s=null;const o=`${this.config.classNames.tooltip}--visible`,a=l=>pe(s,o,l);t.forEach(l=>{const u=Q("span",{class:this.config.classNames.marker},""),c=l.time/this.duration*100+"%";s&&(u.addEventListener("mouseenter",()=>{l.label||(s.style.left=c,s.innerHTML=l.label,a(!0))}),u.addEventListener("mouseleave",()=>{a(!1)})),u.addEventListener("click",()=>{this.currentTime=l.time}),u.style.left=c,i.appendChild(u)}),r.appendChild(i),this.config.tooltips.seek||(s=Q("span",{class:this.config.classNames.tooltip},""),r.appendChild(s)),this.elements.markers={points:i,tip:s},this.elements.progress.appendChild(r)}};function z1(n,e=!0){let t=n;if(e){const r=document.createElement("a");r.href=t,t=r.href}try{return new URL(t)}catch{return null}}function U1(n){const e=new URLSearchParams;return w.object(n)&&Object.entries(n).forEach(([t,r])=>{e.set(t,r)}),e}const he={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!De.textTracks)return void(w.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&U.setCaptionsMenu.call(this));if(w.element(this.elements.captions)||(this.elements.captions=Q("div",tn(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),XF(this.elements.captions,this.elements.wrapper)),Ve.isIE&&window.URL){const r=this.media.querySelectorAll("track");Array.from(r).forEach(i=>{const s=i.getAttribute("src"),o=z1(s);o!==null&&o.hostname!==window.location.href.hostname&&["http:","https:"].includes(o.protocol)&&Wo(s,"blob").then(a=>{i.setAttribute("src",window.URL.createObjectURL(a))}).catch(()=>{Dn(i)})})}const n=bh((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(r=>r.split("-")[0]));let e=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();e==="auto"&&([e]=n);let t=this.storage.get("captions");if(w.boolean(t)||({active:t}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:t,language:e,languages:n}),this.isHTML5){const r=this.config.captions.update?"addtrack removetrack":"removetrack";de.call(this,this.media.textTracks,r,he.update.bind(this))}setTimeout(he.update.bind(this),0)},update(){const n=he.getTracks.call(this,!0),{active:e,language:t,meta:r,currentTrackNode:i}=this.captions,s=!!n.find(o=>o.language===t);this.isHTML5&&this.isVideo&&n.filter(o=>!r.get(o)).forEach(o=>{this.debug.log("Track added",o),r.set(o,{default:o.mode==="showing"}),o.mode==="showing"&&(o.mode="hidden"),de.call(this,o,"cuechange",()=>he.updateCues.call(this))}),(s&&this.language!==t||!n.includes(i))&&(he.setLanguage.call(this,t),he.toggle.call(this,e&&s)),this.elements&&pe(this.elements.container,this.config.classNames.captions.enabled,!w.empty(n)),w.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&U.setCaptionsMenu.call(this)},toggle(n,e=!0){if(!this.supported.ui)return;const{toggled:t}=this.captions,r=this.config.classNames.captions.active,i=w.nullOrUndefined(n)?!t:n;if(i!==t){if(e||(this.captions.active=i,this.storage.set({captions:i})),!this.language&&i&&!e){const s=he.getTracks.call(this),o=he.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=o.language,void he.set.call(this,s.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=i),pe(this.elements.container,r,i),this.captions.toggled=i,U.updateSetting.call(this,"captions"),te.call(this,this.media,i?"captionsenabled":"captionsdisabled")}setTimeout(()=>{i&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(n,e=!0){const t=he.getTracks.call(this);if(n!==-1)if(w.number(n))if(n in t){if(this.captions.currentTrack!==n){this.captions.currentTrack=n;const r=t[n],{language:i}=r||{};this.captions.currentTrackNode=r,U.updateSetting.call(this,"captions"),e||(this.captions.language=i,this.storage.set({language:i})),this.isVimeo&&this.embed.enableTextTrack(i),te.call(this,this.media,"languagechange")}he.toggle.call(this,!0,e),this.isHTML5&&this.isVideo&&he.updateCues.call(this)}else this.debug.warn("Track not found",n);else this.debug.warn("Invalid caption argument",n);else he.toggle.call(this,!1,e)},setLanguage(n,e=!0){if(!w.string(n))return void this.debug.warn("Invalid language argument",n);const t=n.toLowerCase();this.captions.language=t;const r=he.getTracks.call(this),i=he.findTrack.call(this,[t]);he.set.call(this,r.indexOf(i),e)},getTracks(n=!1){return Array.from((this.media||{}).textTracks||[]).filter(e=>!this.isHTML5||n||this.captions.meta.has(e)).filter(e=>["captions","subtitles"].includes(e.kind))},findTrack(n,e=!1){const t=he.getTracks.call(this),r=o=>Number((this.captions.meta.get(o)||{}).default),i=Array.from(t).sort((o,a)=>r(a)-r(o));let s;return n.every(o=>(s=i.find(a=>a.language===o),!s)),s||(e?i[0]:void 0)},getCurrentTrack(){return he.getTracks.call(this)[this.currentTrack]},getLabel(n){let e=n;return!w.track(e)&&De.textTracks&&this.captions.toggled&&(e=he.getCurrentTrack.call(this)),w.track(e)?w.empty(e.label)?w.empty(e.language)?He.get("enabled",this.config):n.language.toUpperCase():e.label:He.get("disabled",this.config)},updateCues(n){if(!this.supported.ui)return;if(!w.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!w.nullOrUndefined(n)&&!Array.isArray(n))return void this.debug.warn("updateCues: Invalid input",n);let e=n;if(!e){const r=he.getCurrentTrack.call(this);e=Array.from((r||{}).activeCues||[]).map(i=>i.getCueAsHTML()).map(l2)}const t=e.map(r=>r.trim()).join(`
|
|
147
|
-
`);if(t!==this.elements.captions.innerHTML){rl(this.elements.captions);const r=Q("span",tn(this.config.selectors.caption));r.innerHTML=t,this.elements.captions.appendChild(r),te.call(this,this.media,"cuechange")}}},H1={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},Jc={active:"picture-in-picture",inactive:"inline"},er={html5:"html5",youtube:"youtube",vimeo:"vimeo"},Kc={audio:"audio",video:"video"};function d2(n){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(n)?er.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(n)?er.vimeo:null}const Gc=()=>{};class h2{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):Gc}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):Gc}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):Gc}}class qt{constructor(e){H(this,"onChange",()=>{if(!this.supported)return;const t=this.player.elements.buttons.fullscreen;w.element(t)&&(t.pressed=this.active);const r=this.target===this.player.media?this.target:this.player.elements.container;te.call(this.player,r,this.active?"enterfullscreen":"exitfullscreen",!0)}),H(this,"toggleFallback",(t=!1)=>{if(t?this.scrollPosition={x:window.scrollX??0,y:window.scrollY??0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=t?"hidden":"",pe(this.target,this.player.config.classNames.fullscreen.fallback,t),Ve.isIos){let r=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";r||(r=document.createElement("meta"),r.setAttribute("name","viewport"));const s=w.string(r.content)&&r.content.includes(i);t?(this.cleanupViewport=!s,s||(r.content+=`,${i}`)):this.cleanupViewport&&(r.content=r.content.split(",").filter(o=>o.trim()!==i).join(","))}this.onChange()}),H(this,"trapFocus",t=>{if(Ve.isIos||Ve.isIPadOS||!this.active||t.key!=="Tab")return;const r=document.activeElement,i=Oo.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,o=i[i.length-1];r!==o||t.shiftKey?r===s&&t.shiftKey&&(o.focus(),t.preventDefault()):(s.focus(),t.preventDefault())}),H(this,"update",()=>{if(this.supported){let t;t=this.forceFallback?"Fallback (forced)":qt.nativeSupported?"Native":"Fallback",this.player.debug.log(`${t} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");pe(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)}),H(this,"enter",()=>{this.supported&&(Ve.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!qt.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?w.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),H(this,"exit",()=>{if(this.supported)if(Ve.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),rn(this.player.play());else if(!qt.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!w.empty(this.prefix)){const t=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${t}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),H(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=e,this.prefix=qt.prefix,this.property=qt.property,this.scrollPosition={x:0,y:0},this.forceFallback=e.config.fullscreen.fallback==="force",this.player.elements.fullscreen=e.config.fullscreen.container&&QF(this.player.elements.container,e.config.fullscreen.container),de.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),de.call(this.player,this.player.elements.container,"dblclick",t=>{w.element(this.player.elements.controls)&&this.player.elements.controls.contains(t.target)||this.player.listeners.proxy(t,this.toggle,"fullscreen")}),de.call(this,this.player.elements.container,"keydown",t=>this.trapFocus(t)),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return qt.nativeSupported&&!this.forceFallback}static get prefix(){if(w.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some(t=>!(!w.function(document[`${t}ExitFullscreen`])&&!w.function(document[`${t}CancelFullScreen`]))&&(e=t,!0)),e}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,qt.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||qt.nativeSupported||!Ve.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!qt.nativeSupported||this.forceFallback)return iu(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return Ve.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}function il(n,e=1){return new Promise((t,r)=>{const i=new Image,s=()=>{delete i.onload,delete i.onerror,(i.naturalWidth>=e?t:r)(i)};Object.assign(i,{onload:s,onerror:s,src:n})})}const be={addStyleHook(){pe(this.elements.container,this.config.selectors.container.replace(".",""),!0),pe(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(n=!1){n&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void be.toggleNativeControls.call(this,!0);w.element(this.elements.controls)||(U.inject.call(this),this.listeners.controls()),be.toggleNativeControls.call(this),this.isHTML5&&he.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,U.updateVolume.call(this),U.timeUpdate.call(this),U.durationUpdate.call(this),be.checkPlaying.call(this),pe(this.elements.container,this.config.classNames.pip.supported,De.pip&&this.isHTML5&&this.isVideo),pe(this.elements.container,this.config.classNames.airplay.supported,De.airplay&&this.isHTML5),pe(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{te.call(this,this.media,"ready")},0),be.setTitle.call(this),this.poster&&be.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&U.durationUpdate.call(this),this.config.mediaMetadata&&U.setMediaMetadata.call(this)},setTitle(){let n=He.get("play",this.config);if(w.string(this.config.title)&&!w.empty(this.config.title)&&(n+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(e=>{e.setAttribute("aria-label",n)}),this.isEmbed){const e=Be.call(this,"iframe");if(!w.element(e))return;const t=w.empty(this.config.title)?"video":this.config.title,r=He.get("frameTitle",this.config);e.setAttribute("title",r.replace("{title}",t))}},togglePoster(n){pe(this.elements.container,this.config.classNames.posterEnabled,n)},setPoster(n,e=!0){return e&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",n),this.elements.poster.removeAttribute("hidden"),t2.call(this).then(()=>il(n)).catch(t=>{throw n===this.poster&&be.togglePoster.call(this,!1),t}).then(()=>{if(n!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${n}')`,backgroundSize:""}),be.togglePoster.call(this,!0),n)))},checkPlaying(n){pe(this.elements.container,this.config.classNames.playing,this.playing),pe(this.elements.container,this.config.classNames.paused,this.paused),pe(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",He.get(this.playing?"pause":"play",this.config))}),w.event(n)&&n.type==="timeupdate"||be.toggleControls.call(this)},checkLoading(n){this.loading=["stalled","waiting"].includes(n.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{pe(this.elements.container,this.config.classNames.loading,this.loading),be.toggleControls.call(this)},this.loading?250:0)},toggleControls(n){const{controls:e}=this.elements;if(e&&this.config.hideControls){const t=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(!!(n||this.loading||this.paused||e.pressed||e.hover||t))}},migrateStyles(){Object.values({...this.media.style}).filter(n=>!w.empty(n)&&w.string(n)&&n.startsWith("--plyr")).forEach(n=>{this.elements.container.style.setProperty(n,this.media.style.getPropertyValue(n)),this.media.style.removeProperty(n)}),w.empty(this.media.style)&&this.media.removeAttribute("style")}};class f2{constructor(e){H(this,"firstTouch",()=>{const{player:t}=this,{elements:r}=t;t.touch=!0,pe(r.container,t.config.classNames.isTouch,!0)}),H(this,"global",(t=!0)=>{const{player:r}=this;r.config.keyboard.global&&No.call(r,window,"keydown keyup",this.handleKey,t,!1),No.call(r,document.body,"click",this.toggleMenu,t),Bf.call(r,document.body,"touchstart",this.firstTouch)}),H(this,"container",()=>{const{player:t}=this,{config:r,elements:i,timers:s}=t;!r.keyboard.global&&r.keyboard.focused&&de.call(t,i.container,"keydown keyup",this.handleKey,!1),de.call(t,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",l=>{const{controls:u}=i;u&&l.type==="enterfullscreen"&&(u.pressed=!1,u.hover=!1);let c=0;["touchstart","touchmove","mousemove"].includes(l.type)&&(be.toggleControls.call(t,!0),c=t.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout(()=>be.toggleControls.call(t,!1),c)});const o=()=>{if(!t.isVimeo||t.config.vimeo.premium)return;const l=i.wrapper,{active:u}=t.fullscreen,[c,d]=zf.call(t),h=I1(`aspect-ratio: ${c} / ${d}`);if(!u)return void(h?(l.style.width=null,l.style.height=null):(l.style.maxWidth=null,l.style.margin=null));const[f,p]=n2(),m=f/p>c/d;h?(l.style.width=m?"auto":"100%",l.style.height=m?"100%":"auto"):(l.style.maxWidth=m?p/d*c+"px":null,l.style.margin=m?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(o,50)};de.call(t,i.container,"enterfullscreen exitfullscreen",l=>{const{target:u}=t.fullscreen;u===i.container&&(!t.isEmbed&&w.empty(t.config.ratio)||(o(),(l.type==="enterfullscreen"?de:Pu).call(t,window,"resize",a)))})}),H(this,"media",()=>{const{player:t}=this,{elements:r}=t;if(de.call(t,t.media,"timeupdate seeking seeked",s=>U.timeUpdate.call(t,s)),de.call(t,t.media,"durationchange loadeddata loadedmetadata",s=>U.durationUpdate.call(t,s)),de.call(t,t.media,"ended",()=>{t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())}),de.call(t,t.media,"progress playing seeking seeked",s=>U.updateProgress.call(t,s)),de.call(t,t.media,"volumechange",s=>U.updateVolume.call(t,s)),de.call(t,t.media,"playing play pause ended emptied timeupdate",s=>be.checkPlaying.call(t,s)),de.call(t,t.media,"waiting canplay seeked playing",s=>be.checkLoading.call(t,s)),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){const s=Be.call(t,`.${t.config.classNames.video}`);if(!w.element(s))return;de.call(t,r.container,"click",o=>{([r.container,s].includes(o.target)||s.contains(o.target))&&(t.touch&&t.config.hideControls||(t.ended?(this.proxy(o,t.restart,"restart"),this.proxy(o,()=>{rn(t.play())},"play")):this.proxy(o,()=>{rn(t.togglePlay())},"play")))})}t.supported.ui&&t.config.disableContextMenu&&de.call(t,r.wrapper,"contextmenu",s=>{s.preventDefault()},!1),de.call(t,t.media,"volumechange",()=>{t.storage.set({volume:t.volume,muted:t.muted})}),de.call(t,t.media,"ratechange",()=>{U.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})}),de.call(t,t.media,"qualitychange",s=>{U.updateSetting.call(t,"quality",null,s.detail.quality)}),de.call(t,t.media,"ready qualitychange",()=>{U.setDownloadUrl.call(t)});const i=t.config.events.concat(["keyup","keydown"]).join(" ");de.call(t,t.media,i,s=>{let{detail:o={}}=s;s.type==="error"&&(o=t.media.error),te.call(t,r.container,s.type,!0,o)})}),H(this,"proxy",(t,r,i)=>{const{player:s}=this,o=s.config.listeners[i];let a=!0;w.function(o)&&(a=o.call(s,t)),a!==!1&&w.function(r)&&r.call(s,t)}),H(this,"bind",(t,r,i,s,o=!0)=>{const{player:a}=this,l=a.config.listeners[s],u=w.function(l);de.call(a,t,r,c=>this.proxy(c,i,s),o&&!u)}),H(this,"controls",()=>{const{player:t}=this,{elements:r}=t,i=Ve.isIE?"change":"input";if(r.buttons.play&&Array.from(r.buttons.play).forEach(s=>{this.bind(s,"click",()=>{rn(t.togglePlay())},"play")}),this.bind(r.buttons.restart,"click",t.restart,"restart"),this.bind(r.buttons.rewind,"click",()=>{t.lastSeekTime=Date.now(),t.rewind()},"rewind"),this.bind(r.buttons.fastForward,"click",()=>{t.lastSeekTime=Date.now(),t.forward()},"fastForward"),this.bind(r.buttons.mute,"click",()=>{t.muted=!t.muted},"mute"),this.bind(r.buttons.captions,"click",()=>t.toggleCaptions()),this.bind(r.buttons.download,"click",()=>{te.call(t,t.media,"download")},"download"),this.bind(r.buttons.fullscreen,"click",()=>{t.fullscreen.toggle()},"fullscreen"),this.bind(r.buttons.pip,"click",()=>{t.pip="toggle"},"pip"),this.bind(r.buttons.airplay,"click",t.airplay,"airplay"),this.bind(r.buttons.settings,"click",s=>{s.stopPropagation(),s.preventDefault(),U.toggleMenu.call(t,s)},null,!1),this.bind(r.buttons.settings,"keyup",s=>{[" ","Enter"].includes(s.key)&&(s.key!=="Enter"?(s.preventDefault(),s.stopPropagation(),U.toggleMenu.call(t,s)):U.focusFirstMenuItem.call(t,null,!0))},null,!1),this.bind(r.settings.menu,"keydown",s=>{s.key==="Escape"&&U.toggleMenu.call(t,s)}),this.bind(r.inputs.seek,"mousedown mousemove",s=>{const o=r.progress.getBoundingClientRect(),a=100/o.width*(s.pageX-o.left);s.currentTarget.setAttribute("seek-value",a)}),this.bind(r.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",s=>{const o=s.currentTarget,a="play-on-seeked";if(w.keyboardEvent(s)&&!["ArrowLeft","ArrowRight"].includes(s.key))return;t.lastSeekTime=Date.now();const l=o.hasAttribute(a),u=["mouseup","touchend","keyup"].includes(s.type);l&&u?(o.removeAttribute(a),rn(t.play())):!u&&t.playing&&(o.setAttribute(a,""),t.pause())}),Ve.isIos){const s=Oo.call(t,'input[type="range"]');Array.from(s).forEach(o=>this.bind(o,i,a=>N1(a.target)))}this.bind(r.inputs.seek,i,s=>{const o=s.currentTarget;let a=o.getAttribute("seek-value");w.empty(a)&&(a=o.value),o.removeAttribute("seek-value"),t.currentTime=a/o.max*t.duration},"seek"),this.bind(r.progress,"mouseenter mouseleave mousemove",s=>U.updateSeekTooltip.call(t,s)),this.bind(r.progress,"mousemove touchmove",s=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.startMove(s)}),this.bind(r.progress,"mouseleave touchend click",()=>{const{previewThumbnails:s}=t;s&&s.loaded&&s.endMove(!1,!0)}),this.bind(r.progress,"mousedown touchstart",s=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.startScrubbing(s)}),this.bind(r.progress,"mouseup touchend",s=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.endScrubbing(s)}),Ve.isWebKit&&Array.from(Oo.call(t,'input[type="range"]')).forEach(s=>{this.bind(s,"input",o=>U.updateRangeFill.call(t,o.target))}),t.config.toggleInvert&&!w.element(r.display.duration)&&this.bind(r.display.currentTime,"click",()=>{t.currentTime!==0&&(t.config.invertTime=!t.config.invertTime,U.timeUpdate.call(t))}),this.bind(r.inputs.volume,i,s=>{t.volume=s.target.value},"volume"),this.bind(r.controls,"mouseenter mouseleave",s=>{r.controls.hover=!t.touch&&s.type==="mouseenter"}),r.fullscreen&&Array.from(r.fullscreen.children).filter(s=>!s.contains(r.container)).forEach(s=>{this.bind(s,"mouseenter mouseleave",o=>{r.controls&&(r.controls.hover=!t.touch&&o.type==="mouseenter")})}),this.bind(r.controls,"mousedown mouseup touchstart touchend touchcancel",s=>{r.controls.pressed=["mousedown","touchstart"].includes(s.type)}),this.bind(r.controls,"focusin",()=>{const{config:s,timers:o}=t;pe(r.controls,s.classNames.noTransition,!0),be.toggleControls.call(t,!0),setTimeout(()=>{pe(r.controls,s.classNames.noTransition,!1)},0);const a=this.touch?3e3:4e3;clearTimeout(o.controls),o.controls=setTimeout(()=>be.toggleControls.call(t,!1),a)}),this.bind(r.inputs.volume,"wheel",s=>{const o=s.webkitDirectionInvertedFromDevice,[a,l]=[s.deltaX,-s.deltaY].map(d=>o?-d:d),u=Math.sign(Math.abs(a)>Math.abs(l)?a:l);t.increaseVolume(u/50);const{volume:c}=t.media;(u===1&&c<1||u===-1&&c>0)&&s.preventDefault()},"volume",!1)}),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:r}=t,{key:i,type:s,altKey:o,ctrlKey:a,metaKey:l,shiftKey:u}=e,c=s==="keydown",d=c&&i===this.lastKey;if(!(o||a||l||u)&&i){if(c){const f=document.activeElement;if(w.element(f)){const{editable:p}=t.config.selectors,{seek:m}=r.inputs;if(f!==m&&Dr(f,p)||e.key===" "&&Dr(f,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(i)&&(e.preventDefault(),e.stopPropagation()),i){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":d||(h=parseInt(i,10),t.currentTime=t.duration/10*h);break;case" ":case"k":d||rn(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":d||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":d||t.toggleCaptions();break;case"l":t.loop=!t.loop}i==="Escape"&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=i}else this.lastKey=null;var h}}toggleMenu(e){U.toggleMenu.call(this.player,e)}}var p2=gF(function(n,e){n.exports=function(){var t=function(){},r={},i={},s={};function o(h,f){h=h.push?h:[h];var p,m,g,y=[],v=h.length,k=v;for(p=function(b,x){x.length&&y.push(b),--k||f(y)};v--;)m=h[v],(g=i[m])?p(m,g):(s[m]=s[m]||[]).push(p)}function a(h,f){if(h){var p=s[h];if(i[h]=f,p)for(;p.length;)p[0](h,f),p.splice(0,1)}}function l(h,f){h.call&&(h={success:h}),f.length?(h.error||t)(f):(h.success||t)(h)}function u(h,f,p,m){var g,y,v=document,k=p.async,b=(p.numRetries||0)+1,x=p.before||t,A=h.replace(/[\?|#].*$/,""),O=h.replace(/^(css|img)!/,"");m=m||0,/(^css!|\.css$)/.test(A)?((y=v.createElement("link")).rel="stylesheet",y.href=O,(g="hideFocus"in y)&&y.relList&&(g=0,y.rel="preload",y.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(A)?(y=v.createElement("img")).src=O:((y=v.createElement("script")).src=h,y.async=k===void 0||k),y.onload=y.onerror=y.onbeforeload=function(_){var I=_.type[0];if(g)try{y.sheet.cssText.length||(I="e")}catch($){$.code!=18&&(I="e")}if(I=="e"){if((m+=1)<b)return u(h,f,p,m)}else if(y.rel=="preload"&&y.as=="style")return y.rel="stylesheet";f(h,I,_.defaultPrevented)},x(h,y)!==!1&&v.head.appendChild(y)}function c(h,f,p){var m,g,y=(h=h.push?h:[h]).length,v=y,k=[];for(m=function(b,x,A){if(x=="e"&&k.push(b),x=="b"){if(!A)return;k.push(b)}--y||f(k)},g=0;g<v;g++)u(h[g],m,p)}function d(h,f,p){var m,g;if(f&&f.trim&&(m=f),g=(m?p:f)||{},m){if(m in r)throw"LoadJS";r[m]=!0}function y(v,k){c(h,function(b){l(g,b),v&&l({success:v,error:k},b),a(m,b)},g)}if(g.returnPromise)return new Promise(y);y()}return d.ready=function(h,f){return o(h,function(p){l(f,p)}),d},d.done=function(h){a(h,[])},d.reset=function(){r={},i={},s={}},d.isDefined=function(h){return h in r},d}()});function Uf(n){return new Promise((e,t)=>{p2(n,{success:e,error:t})})}function m2(n){return w.empty(n)?null:w.number(Number(n))?n:n.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:n}function g2(n){const e=n.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return e&&e.length===5?e[4]:null}function ps(n){n&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===n&&(this.media.paused=!n,te.call(this,this.media,n?"play":"pause"))}const wh={setup(){const n=this;pe(n.elements.wrapper,n.config.classNames.embed,!0),n.options.speed=n.config.speed.options,Hi.call(n),w.object(window.Vimeo)?wh.ready.call(n):Uf(n.config.urls.vimeo.sdk).then(()=>{wh.ready.call(n)}).catch(e=>{n.debug.warn("Vimeo SDK (player.js) failed to load",e)})},ready(){const n=this,e=n.config.vimeo,{premium:t,referrerPolicy:r,...i}=e;let s=n.media.getAttribute("src"),o="";w.empty(s)?(s=n.media.getAttribute(n.config.attributes.embed.id),o=n.media.getAttribute(n.config.attributes.embed.hash)):o=g2(s);const a=o?{h:o}:{};t&&Object.assign(i,{controls:!1,sidedock:!1});const l=U1({loop:n.config.loop.active,autoplay:n.autoplay,muted:n.muted,gesture:"media",playsinline:n.config.playsinline,...a,...i}),u=m2(s),c=Q("iframe"),d=vh(n.config.urls.vimeo.iframe,u,l);if(c.setAttribute("src",d),c.setAttribute("allowfullscreen",""),c.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),w.empty(r)||c.setAttribute("referrerPolicy",r),t||!e.customControls)c.setAttribute("data-poster",n.poster),n.media=ru(c,n.media);else{const v=Q("div",{class:n.config.classNames.embedContainer,"data-poster":n.poster});v.appendChild(c),n.media=ru(v,n.media)}e.customControls||Wo(vh(n.config.urls.vimeo.api,d)).then(v=>{!w.empty(v)&&v.thumbnail_url&&be.setPoster.call(n,v.thumbnail_url).catch(()=>{})}),n.embed=new window.Vimeo.Player(c,{autopause:n.config.autopause,muted:n.muted}),n.media.paused=!0,n.media.currentTime=0,n.supported.ui&&n.embed.disableTextTrack(),n.media.play=()=>(ps.call(n,!0),n.embed.play()),n.media.pause=()=>(ps.call(n,!1),n.embed.pause()),n.media.stop=()=>{n.pause(),n.currentTime=0};let{currentTime:h}=n.media;Object.defineProperty(n.media,"currentTime",{get:()=>h,set(v){const{embed:k,media:b,paused:x,volume:A}=n,O=x&&!k.hasPlayed;b.seeking=!0,te.call(n,b,"seeking"),Promise.resolve(O&&k.setVolume(0)).then(()=>k.setCurrentTime(v)).then(()=>O&&k.pause()).then(()=>O&&k.setVolume(A)).catch(()=>{})}});let f=n.config.speed.selected;Object.defineProperty(n.media,"playbackRate",{get:()=>f,set(v){n.embed.setPlaybackRate(v).then(()=>{f=v,te.call(n,n.media,"ratechange")}).catch(()=>{n.options.speed=[1]})}});let{volume:p}=n.config;Object.defineProperty(n.media,"volume",{get:()=>p,set(v){n.embed.setVolume(v).then(()=>{p=v,te.call(n,n.media,"volumechange")})}});let{muted:m}=n.config;Object.defineProperty(n.media,"muted",{get:()=>m,set(v){const k=!!w.boolean(v)&&v;n.embed.setMuted(!!k||n.config.muted).then(()=>{m=k,te.call(n,n.media,"volumechange")})}});let g,{loop:y}=n.config;Object.defineProperty(n.media,"loop",{get:()=>y,set(v){const k=w.boolean(v)?v:n.config.loop.active;n.embed.setLoop(k).then(()=>{y=k})}}),n.embed.getVideoUrl().then(v=>{g=v,U.setDownloadUrl.call(n)}).catch(v=>{this.debug.warn(v)}),Object.defineProperty(n.media,"currentSrc",{get:()=>g}),Object.defineProperty(n.media,"ended",{get:()=>n.currentTime===n.duration}),Promise.all([n.embed.getVideoWidth(),n.embed.getVideoHeight()]).then(v=>{const[k,b]=v;n.embed.ratio=L1(k,b),Hi.call(this)}),n.embed.setAutopause(n.config.autopause).then(v=>{n.config.autopause=v}),n.embed.getVideoTitle().then(v=>{n.config.title=v,be.setTitle.call(this)}),n.embed.getCurrentTime().then(v=>{h=v,te.call(n,n.media,"timeupdate")}),n.embed.getDuration().then(v=>{n.media.duration=v,te.call(n,n.media,"durationchange")}),n.embed.getTextTracks().then(v=>{n.media.textTracks=v,he.setup.call(n)}),n.embed.on("cuechange",({cues:v=[]})=>{const k=v.map(b=>a2(b.text));he.updateCues.call(n,k)}),n.embed.on("loaded",()=>{n.embed.getPaused().then(v=>{ps.call(n,!v),v||te.call(n,n.media,"playing")}),w.element(n.embed.element)&&n.supported.ui&&n.embed.element.setAttribute("tabindex",-1)}),n.embed.on("bufferstart",()=>{te.call(n,n.media,"waiting")}),n.embed.on("bufferend",()=>{te.call(n,n.media,"playing")}),n.embed.on("play",()=>{ps.call(n,!0),te.call(n,n.media,"playing")}),n.embed.on("pause",()=>{ps.call(n,!1)}),n.embed.on("timeupdate",v=>{n.media.seeking=!1,h=v.seconds,te.call(n,n.media,"timeupdate")}),n.embed.on("progress",v=>{n.media.buffered=v.percent,te.call(n,n.media,"progress"),parseInt(v.percent,10)===1&&te.call(n,n.media,"canplaythrough"),n.embed.getDuration().then(k=>{k!==n.media.duration&&(n.media.duration=k,te.call(n,n.media,"durationchange"))})}),n.embed.on("seeked",()=>{n.media.seeking=!1,te.call(n,n.media,"seeked")}),n.embed.on("ended",()=>{n.media.paused=!0,te.call(n,n.media,"ended")}),n.embed.on("error",v=>{n.media.error=v,te.call(n,n.media,"error")}),e.customControls&&setTimeout(()=>be.build.call(n),0)}};function y2(n){return w.empty(n)?null:n.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:n}function ms(n){n&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===n&&(this.media.paused=!n,te.call(this,this.media,n?"play":"pause"))}function b2(n){return n.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const sl={setup(){if(pe(this.elements.wrapper,this.config.classNames.embed,!0),w.object(window.YT)&&w.function(window.YT.Player))sl.ready.call(this);else{const n=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{w.function(n)&&n(),sl.ready.call(this)},Uf(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(n){Wo(vh(this.config.urls.youtube.api,n)).then(e=>{if(w.object(e)){const{title:t,height:r,width:i}=e;this.config.title=t,be.setTitle.call(this),this.embed.ratio=L1(i,r)}Hi.call(this)}).catch(()=>{Hi.call(this)})},ready(){const n=this,e=n.config.youtube,t=n.media&&n.media.getAttribute("id");if(!w.empty(t)&&t.startsWith("youtube-"))return;let r=n.media.getAttribute("src");w.empty(r)&&(r=n.media.getAttribute(this.config.attributes.embed.id));const i=y2(r),s=Q("div",{id:r2(n.provider),"data-poster":e.customControls?n.poster:void 0});if(n.media=ru(s,n.media),e.customControls){const o=a=>`https://i.ytimg.com/vi/${i}/${a}default.jpg`;il(o("maxres"),121).catch(()=>il(o("sd"),121)).catch(()=>il(o("hq"))).then(a=>be.setPoster.call(n,a.src)).then(a=>{a.includes("maxres")||(n.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}n.embed=new window.YT.Player(n.media,{videoId:i,host:b2(e),playerVars:Ie({},{autoplay:n.config.autoplay?1:0,hl:n.config.hl,controls:n.supported.ui&&e.customControls?0:1,disablekb:1,playsinline:n.config.playsinline&&!n.config.fullscreen.iosNative?1:0,cc_load_policy:n.captions.active?1:0,cc_lang_pref:n.config.captions.language,widget_referrer:window?window.location.href:null},e),events:{onError(o){if(!n.media.error){const a=o.data,l={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[a]||"An unknown error occurred";n.media.error={code:a,message:l},te.call(n,n.media,"error")}},onPlaybackRateChange(o){const a=o.target;n.media.playbackRate=a.getPlaybackRate(),te.call(n,n.media,"ratechange")},onReady(o){if(w.function(n.media.play))return;const a=o.target;sl.getTitle.call(n,i),n.media.play=()=>{ms.call(n,!0),a.playVideo()},n.media.pause=()=>{ms.call(n,!1),a.pauseVideo()},n.media.stop=()=>{a.stopVideo()},n.media.duration=a.getDuration(),n.media.paused=!0,n.media.currentTime=0,Object.defineProperty(n.media,"currentTime",{get:()=>Number(a.getCurrentTime()),set(d){n.paused&&!n.embed.hasPlayed&&n.embed.mute(),n.media.seeking=!0,te.call(n,n.media,"seeking"),a.seekTo(d)}}),Object.defineProperty(n.media,"playbackRate",{get:()=>a.getPlaybackRate(),set(d){a.setPlaybackRate(d)}});let{volume:l}=n.config;Object.defineProperty(n.media,"volume",{get:()=>l,set(d){l=d,a.setVolume(100*l),te.call(n,n.media,"volumechange")}});let{muted:u}=n.config;Object.defineProperty(n.media,"muted",{get:()=>u,set(d){const h=w.boolean(d)?d:u;u=h,a[h?"mute":"unMute"](),a.setVolume(100*l),te.call(n,n.media,"volumechange")}}),Object.defineProperty(n.media,"currentSrc",{get:()=>a.getVideoUrl()}),Object.defineProperty(n.media,"ended",{get:()=>n.currentTime===n.duration});const c=a.getAvailablePlaybackRates();n.options.speed=c.filter(d=>n.config.speed.options.includes(d)),n.supported.ui&&e.customControls&&n.media.setAttribute("tabindex",-1),te.call(n,n.media,"timeupdate"),te.call(n,n.media,"durationchange"),clearInterval(n.timers.buffering),n.timers.buffering=setInterval(()=>{n.media.buffered=a.getVideoLoadedFraction(),(n.media.lastBuffered===null||n.media.lastBuffered<n.media.buffered)&&te.call(n,n.media,"progress"),n.media.lastBuffered=n.media.buffered,n.media.buffered===1&&(clearInterval(n.timers.buffering),te.call(n,n.media,"canplaythrough"))},200),e.customControls&&setTimeout(()=>be.build.call(n),50)},onStateChange(o){const a=o.target;switch(clearInterval(n.timers.playing),n.media.seeking&&[1,2].includes(o.data)&&(n.media.seeking=!1,te.call(n,n.media,"seeked")),o.data){case-1:te.call(n,n.media,"timeupdate"),n.media.buffered=a.getVideoLoadedFraction(),te.call(n,n.media,"progress");break;case 0:ms.call(n,!1),n.media.loop?(a.stopVideo(),a.playVideo()):te.call(n,n.media,"ended");break;case 1:e.customControls&&!n.config.autoplay&&n.media.paused&&!n.embed.hasPlayed?n.media.pause():(ms.call(n,!0),te.call(n,n.media,"playing"),n.timers.playing=setInterval(()=>{te.call(n,n.media,"timeupdate")},50),n.media.duration!==a.getDuration()&&(n.media.duration=a.getDuration(),te.call(n,n.media,"durationchange")));break;case 2:n.muted||n.embed.unMute(),ms.call(n,!1);break;case 3:te.call(n,n.media,"waiting")}te.call(n,n.elements.container,"statechange",!1,{code:o.data})}}})}},V1={setup(){this.media?(pe(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),pe(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&pe(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=Q("div",{class:this.config.classNames.video}),R1(this.media,this.elements.wrapper),this.elements.poster=Q("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?sr.setup.call(this):this.isYouTube?sl.setup.call(this):this.isVimeo&&wh.setup.call(this)):this.debug.warn("No media element found!")}};class v2{constructor(e){H(this,"load",()=>{this.enabled&&(w.object(window.google)&&w.object(window.google.ima)?this.ready():Uf(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),H(this,"ready",()=>{var t;this.enabled||((t=this).manager&&t.manager.destroy(),t.elements.displayContainer&&t.elements.displayContainer.destroy(),t.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),H(this,"setupIMA",()=>{this.elements.container=Q("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,t=>this.onAdsManagerLoaded(t),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t=>this.onAdError(t),!1),this.requestAds()}),H(this,"requestAds",()=>{const{container:t}=this.player.elements;try{const r=new google.ima.AdsRequest;r.adTagUrl=this.tagUrl,r.linearAdSlotWidth=t.offsetWidth,r.linearAdSlotHeight=t.offsetHeight,r.nonLinearAdSlotWidth=t.offsetWidth,r.nonLinearAdSlotHeight=t.offsetHeight,r.forceNonLinearFullSlot=!1,r.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(r)}catch(r){this.onAdError(r)}}),H(this,"pollCountdown",(t=!1)=>{if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const r=Iu(Math.max(this.manager.getRemainingTime(),0)),i=`${He.get("advertisement",this.player.config)} - ${r}`;this.elements.container.setAttribute("data-badge-text",i)},100)}),H(this,"onAdsManagerLoaded",t=>{if(!this.enabled)return;const r=new google.ima.AdsRenderingSettings;r.restoreCustomPlaybackStateOnAdBreakComplete=!0,r.enablePreloading=!0,this.manager=t.getAdsManager(this.player,r),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,i=>this.onAdError(i)),Object.keys(google.ima.AdEvent.Type).forEach(i=>{this.manager.addEventListener(google.ima.AdEvent.Type[i],s=>this.onAdEvent(s))}),this.trigger("loaded")}),H(this,"addCuePoints",()=>{w.empty(this.cuePoints)||this.cuePoints.forEach(t=>{if(t!==0&&t!==-1&&t<this.player.duration){const r=this.player.elements.progress;if(w.element(r)){const i=100/this.player.duration*t,s=Q("span",{class:this.player.config.classNames.cues});s.style.left=`${i.toString()}%`,r.appendChild(s)}}})}),H(this,"onAdEvent",t=>{const{container:r}=this.player.elements,i=t.getAd(),s=t.getAdData();switch((o=>{te.call(this.player,this.player.media,`ads${o.replace(/_/g,"").toLowerCase()}`)})(t.type),t.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=r.offsetWidth,i.height=r.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}}),H(this,"onAdError",t=>{this.cancel(),this.player.debug.warn("Ads error",t)}),H(this,"listeners",()=>{const{container:t}=this.player.elements;let r;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{r=this.player.currentTime}),this.player.on("seeked",()=>{const i=this.player.currentTime;w.empty(this.cuePoints)||this.cuePoints.forEach((s,o)=>{r<s&&s<i&&(this.manager.discardAdBreak(),this.cuePoints.splice(o,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL)})}),H(this,"play",()=>{const{container:t}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(r){this.onAdError(r)}}).catch(()=>{})}),H(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,rn(this.player.media.play())}),H(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),H(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),H(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(t=>{this.on("loaded",t),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),H(this,"trigger",(t,...r)=>{const i=this.events[t];w.array(i)&&i.forEach(s=>{w.function(s)&&s.apply(this,r)})}),H(this,"on",(t,r)=>(w.array(this.events[t])||(this.events[t]=[]),this.events[t].push(r),this)),H(this,"startSafetyTimer",(t,r)=>{this.player.debug.log(`Safety timer invoked from: ${r}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},t)}),H(this,"clearSafetyTimer",t=>{w.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${t}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((t,r)=>{this.on("loaded",t),this.on("error",r)}),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!w.empty(e.publisherId)||w.url(e.tagUrl))}get tagUrl(){const{config:e}=this;return w.url(e.tagUrl)?e.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${U1({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function q1(n=0,e=0,t=255){return Math.min(Math.max(n,e),t)}const w2=n=>{const e=[];return n.split(/\r\n\r\n|\n\n|\r\r/).forEach(t=>{const r={};t.split(/\r\n|\n|\r/).forEach(i=>{if(w.number(r.startTime)){if(!w.empty(i.trim())&&w.empty(r.text)){const s=i.trim().split("#xywh=");[r.text]=s,s[1]&&([r.x,r.y,r.w,r.h]=s[1].split(","))}}else{const s=i.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);s&&(r.startTime=60*Number(s[1]||0)*60+60*Number(s[2])+Number(s[3])+ +`0.${s[4]}`,r.endTime=60*Number(s[6]||0)*60+60*Number(s[7])+Number(s[8])+ +`0.${s[9]}`)}}),r.text&&e.push(r)}),e},ty=(n,e)=>{const t={};return n>e.width/e.height?(t.width=e.width,t.height=1/n*e.width):(t.height=e.height,t.width=n*e.height),t};class kh{constructor(e){H(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)})}),H(this,"getThumbnails",()=>new Promise(t=>{const{src:r}=this.player.config.previewThumbnails;if(w.empty(r))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort((s,o)=>s.height-o.height),this.player.debug.log("Preview thumbnails",this.thumbnails),t()};if(w.function(r))r(s=>{this.thumbnails=s,i()});else{const s=(w.string(r)?[r]:r).map(o=>this.getThumbnail(o));Promise.all(s).then(i)}})),H(this,"getThumbnail",t=>new Promise(r=>{Wo(t).then(i=>{const s={frames:w2(i),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||s.frames[0].text.startsWith("http://")||s.frames[0].text.startsWith("https://")||(s.urlPrefix=t.substring(0,t.lastIndexOf("/")+1));const o=new Image;o.onload=()=>{s.height=o.naturalHeight,s.width=o.naturalWidth,this.thumbnails.push(s),r()},o.src=s.urlPrefix+s.frames[0].text})})),H(this,"startMove",t=>{if(this.loaded&&w.event(t)&&["touchmove","mousemove"].includes(t.type)&&this.player.media.duration){if(t.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var r,i;const s=this.player.elements.progress.getBoundingClientRect(),o=100/s.width*(t.pageX-s.left);this.seekTime=this.player.media.duration*(o/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=t.pageX,this.elements.thumb.time.innerText=Iu(this.seekTime);const a=(r=this.player.config.markers)===null||r===void 0||(i=r.points)===null||i===void 0?void 0:i.find(({time:l})=>l===Math.round(this.seekTime));a&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${a.label}<br>`)}this.showImageAtCurrentTime()}}),H(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),H(this,"startScrubbing",t=>{(w.nullOrUndefined(t.button)||t.button===!1||t.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),H(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Bf.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),H(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),H(this,"render",()=>{this.elements.thumb.container=Q("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=Q("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const t=Q("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=Q("span",{},"00:00"),t.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(t),w.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=Q("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),H(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),H(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const t=this.thumbnails[0].frames.findIndex(s=>this.seekTime>=s.startTime&&this.seekTime<=s.endTime),r=t>=0;let i=0;this.mouseDown||this.toggleThumbContainer(r),r&&(this.thumbnails.forEach((s,o)=>{this.loadedImages.includes(s.frames[t].text)&&(i=o)}),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(i)))}),H(this,"loadImage",(t=0)=>{const r=this.showingThumb,i=this.thumbnails[t],{urlPrefix:s}=i,o=i.frames[r],a=i.frames[r].text,l=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,o,t,r,a,!1),this.currentImageElement.dataset.index=r,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const u=new Image;u.src=l,u.dataset.index=r,u.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${l}`),u.onload=()=>this.showImage(u,o,t,r,a,!0),this.loadingImage=u,this.removeOldImages(u)}}),H(this,"showImage",(t,r,i,s,o,a=!0)=>{this.player.debug.log(`Showing thumb: ${o}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(t,r),a&&(this.currentImageContainer.appendChild(t),this.currentImageElement=t,this.loadedImages.includes(o)||this.loadedImages.push(o)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,t,r,o))}),H(this,"removeOldImages",t=>{Array.from(this.currentImageContainer.children).forEach(r=>{if(r.tagName.toLowerCase()!=="img")return;const i=this.usingSprites?500:1e3;if(r.dataset.index!==t.dataset.index&&!r.dataset.deleting){r.dataset.deleting=!0;const{currentImageContainer:s}=this;setTimeout(()=>{s.removeChild(r),this.player.debug.log(`Removing thumb: ${r.dataset.filename}`)},i)}})}),H(this,"preloadNearby",(t,r=!0)=>new Promise(i=>{setTimeout(()=>{const s=this.thumbnails[0].frames[t].text;if(this.showingThumbFilename===s){let o;o=r?this.thumbnails[0].frames.slice(t):this.thumbnails[0].frames.slice(0,t).reverse();let a=!1;o.forEach(l=>{const u=l.text;if(u!==s&&!this.loadedImages.includes(u)){a=!0,this.player.debug.log(`Preloading thumb filename: ${u}`);const{urlPrefix:c}=this.thumbnails[0],d=c+u,h=new Image;h.src=d,h.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${u}`),this.loadedImages.includes(u)||this.loadedImages.push(u),i()}}}),a||i()}},300)})),H(this,"getHigherQuality",(t,r,i,s)=>{if(t<this.thumbnails.length-1){let o=r.naturalHeight;this.usingSprites&&(o=i.h),o<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(t+1))},300)}}),H(this,"toggleThumbContainer",(t=!1,r=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,t),!t&&r&&(this.showingThumb=null,this.showingThumbFilename=null)}),H(this,"toggleScrubbingContainer",(t=!1)=>{const r=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(r,t),t||(this.showingThumb=null,this.showingThumbFilename=null)}),H(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),H(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:t}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(t.clientHeight>20&&t.clientWidth<20){const r=Math.floor(t.clientHeight*this.thumbAspectRatio);t.style.width=`${r}px`}else if(t.clientHeight<20&&t.clientWidth>20){const r=Math.floor(t.clientWidth/this.thumbAspectRatio);t.style.height=`${r}px`}}else{const r=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);t.style.height=`${this.thumbContainerHeight}px`,t.style.width=`${r}px`}this.setThumbContainerPos()}),H(this,"setThumbContainerPos",()=>{const t=this.player.elements.progress.getBoundingClientRect(),r=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=r.left-t.left+10,o=r.right-t.left-i.clientWidth-10,a=this.mousePosX-t.left-i.clientWidth/2,l=q1(a,s,o);i.style.left=`${l}px`,i.style.setProperty("--preview-arrow-offset",a-l+"px")}),H(this,"setScrubbingContainerSize",()=>{const{width:t,height:r}=ty(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${t}px`,this.elements.scrubbing.container.style.height=`${r}px`}),H(this,"setImageSizeAndOffset",(t,r)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/r.h;t.style.height=t.naturalHeight*i+"px",t.style.width=t.naturalWidth*i+"px",t.style.left=`-${r.x*i}px`,t.style.top=`-${r.y*i}px`}),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=ty(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const Sh={insertElements(n,e){w.string(e)?Xg(n,this.media,{src:e}):w.array(e)&&e.forEach(t=>{Xg(n,this.media,t)})},change(n){_1(n,"sources.length")?(sr.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],Dn(this.media),this.media=null,w.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:e,type:t}=n,[{provider:r=er.html5,src:i}]=e,s=r==="html5"?t:"div",o=r==="html5"?{}:{src:i};Object.assign(this,{provider:r,type:t,supported:De.check(t,r,this.config.playsinline),media:Q(s,o)}),this.elements.container.appendChild(this.media),w.boolean(n.autoplay)&&(this.config.autoplay=n.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),w.empty(n.poster)||(this.poster=n.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),be.addStyleHook.call(this),this.isHTML5&&Sh.insertElements.call(this,"source",e),this.config.title=n.title,V1.setup.call(this),this.isHTML5&&Object.keys(n).includes("tracks")&&Sh.insertElements.call(this,"track",n.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&be.build.call(this),this.isHTML5&&this.media.load(),w.empty(n.previewThumbnails)||(Object.assign(this.config.previewThumbnails,n.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new kh(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class Ro{constructor(e,t){if(H(this,"play",()=>w.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>rn(this.media.play())),this.media.play()):null),H(this,"pause",()=>this.playing&&w.function(this.media.pause)?this.media.pause():null),H(this,"togglePlay",a=>(w.boolean(a)?a:!this.playing)?this.play():this.pause()),H(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):w.function(this.media.stop)&&this.media.stop()}),H(this,"restart",()=>{this.currentTime=0}),H(this,"rewind",a=>{this.currentTime-=w.number(a)?a:this.config.seekTime}),H(this,"forward",a=>{this.currentTime+=w.number(a)?a:this.config.seekTime}),H(this,"increaseVolume",a=>{const l=this.media.muted?0:this.volume;this.volume=l+(w.number(a)?a:0)}),H(this,"decreaseVolume",a=>{this.increaseVolume(-a)}),H(this,"airplay",()=>{De.airplay&&this.media.webkitShowPlaybackTargetPicker()}),H(this,"toggleControls",a=>{if(this.supported.ui&&!this.isAudio){const l=iu(this.elements.container,this.config.classNames.hideControls),u=a===void 0?void 0:!a,c=pe(this.elements.container,this.config.classNames.hideControls,u);if(c&&w.array(this.config.controls)&&this.config.controls.includes("settings")&&!w.empty(this.config.settings)&&U.toggleMenu.call(this,!1),c!==l){const d=c?"controlshidden":"controlsshown";te.call(this,this.media,d)}return!c}return!1}),H(this,"on",(a,l)=>{de.call(this,this.elements.container,a,l)}),H(this,"once",(a,l)=>{Bf.call(this,this.elements.container,a,l)}),H(this,"off",(a,l)=>{Pu(this.elements.container,a,l)}),H(this,"destroy",(a,l=!1)=>{if(!this.ready)return;const u=()=>{document.body.style.overflow="",this.embed=null,l?(Object.keys(this.elements).length&&(Dn(this.elements.buttons.play),Dn(this.elements.captions),Dn(this.elements.controls),Dn(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),w.function(a)&&a()):(e2.call(this),sr.cancelRequests.call(this),ru(this.elements.original,this.elements.container),te.call(this,this.elements.original,"destroyed",!0),w.function(a)&&a.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(be.toggleNativeControls.call(this,!0),u()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&w.function(this.embed.destroy)&&this.embed.destroy(),u()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(u),setTimeout(u,200))}),H(this,"supports",a=>De.mime.call(this,a)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=De.touch,this.media=e,w.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||w.nodeList(this.media)||w.array(this.media))&&(this.media=this.media[0]),this.config=Ie({},H1,Ro.defaults,t||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new h2(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",De),w.nullOrUndefined(this.media)||!w.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!De.check().api)return void this.debug.error("Setup failed: no support");const r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;const i=this.media.tagName.toLowerCase();let s=null,o=null;switch(i){case"div":if(s=this.media.querySelector("iframe"),w.element(s)){if(o=z1(s.getAttribute("src")),this.provider=d2(o.toString()),this.elements.container=this.media,this.media=s,this.elements.container.className="",o.search.length){const a=["1","true"];a.includes(o.searchParams.get("autoplay"))&&(this.config.autoplay=!0),a.includes(o.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=a.includes(o.searchParams.get("playsinline")),this.config.youtube.hl=o.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(w.empty(this.provider)||!Object.values(er).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=Kc.video;break;case"video":case"audio":this.type=i,this.provider=er.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=De.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new f2(this),this.storage=new _o(this),this.media.plyr=this,w.element(this.elements.container)||(this.elements.container=Q("div"),R1(this.media,this.elements.container)),be.migrateStyles.call(this),be.addStyleHook.call(this),V1.setup.call(this),this.config.debug&&de.call(this,this.elements.container,this.config.events.join(" "),a=>{this.debug.log(`event: ${a.type}`)}),this.fullscreen=new qt(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&be.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new v2(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>rn(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new kh(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===er.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===er.youtube}get isVimeo(){return this.provider===er.vimeo}get isVideo(){return this.type===Kc.video}get isAudio(){return this.type===Kc.audio}get playing(){return!!(this.ready&&!this.paused&&!this.ended)}get paused(){return!!this.media.paused}get stopped(){return!!(this.paused&&this.currentTime===0)}get ended(){return!!this.media.ended}set currentTime(e){if(!this.duration)return;const t=w.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return w.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return!!this.media.seeking}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,r=w.number(t)&&t!==1/0?t:0;return e||r}set volume(e){let t=e;w.string(t)&&(t=Number(t)),w.number(t)||(t=this.storage.get("volume")),w.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!w.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;w.boolean(t)||(t=this.storage.get("muted")),w.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return!!this.media.muted}get hasAudio(){return!this.isHTML5||!!this.isAudio||!!this.media.mozHasAudio||!!this.media.webkitAudioDecodedByteCount||!!(this.media.audioTracks&&this.media.audioTracks.length)}set speed(e){let t=null;w.number(e)&&(t=e),w.number(t)||(t=this.storage.get("speed")),w.number(t)||(t=this.config.speed.selected);const{minimumSpeed:r,maximumSpeed:i}=this;t=q1(t,r,i),this.config.speed.selected=t,setTimeout(()=>{this.media&&(this.media.playbackRate=t)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,r=this.options.quality;if(!r.length)return;let i=[!w.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(w.number),s=!0;if(!r.includes(i)){const o=P1(r,i);this.debug.warn(`Unsupported quality option: ${i}, using ${o} instead`),i=o,s=!1}t.selected=i,this.media.quality=i,s&&this.storage.set({quality:i})}get quality(){return this.media.quality}set loop(e){const t=w.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return!!this.media.loop}set source(e){Sh.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return w.url(e)?e:this.source}set download(e){w.url(e)&&(this.config.urls.download=e,U.setDownloadUrl.call(this))}set poster(e){this.isVideo?be.setPoster.call(this,e,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=su(zf.call(this));return w.array(e)?e.join(":"):e}set ratio(e){this.isVideo?w.string(e)&&D1(e)?(this.config.ratio=su(e),Hi.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=w.boolean(e)?e:this.config.autoplay}get autoplay(){return!!this.config.autoplay}toggleCaptions(e){he.toggle.call(this,e,!1)}set currentTrack(e){he.set.call(this,e,!1),he.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){he.setLanguage.call(this,e,!1)}get language(){return(he.getCurrentTrack.call(this)||{}).language}set pip(e){if(!De.pip)return;const t=w.boolean(e)?e:!this.pip;w.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Jc.active:Jc.inactive),w.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return De.pip?w.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Jc.active:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new kh(this))}static supported(e,t){return De.check(e,t)}static loadSprite(e,t){return $1(e,t)}static setup(e,t={}){let r=null;return w.string(e)?r=Array.from(document.querySelectorAll(e)):w.nodeList(e)?r=Array.from(e):w.array(e)&&(r=e.filter(w.element)),w.empty(r)?null:r.map(i=>new Ro(i,t))}}Ro.defaults=YF(H1);const j1=Po({name:"DpVideoPlayer",props:{dataCy:{type:String,required:!1,default:"videoPlayer"},ariaLabelledby:{type:[String,Boolean],required:!1,default:!1},iconUrl:{type:String,required:!0},id:{type:String,required:!0},isEmbedded:{type:Boolean,required:!1,default:!1},poster:{type:String,required:!1,default:""},sources:{required:!1,validator:n=>Array.isArray(n)&&n.every(e=>e.src&&e.type||e.embedId&&e.provider),default:()=>[]},tracks:{required:!1,validator:n=>Array.isArray(n)&&n.filter(e=>e.kind&&e.srclang&&e.label&&e.src).length===n.length,default:()=>[]}},data(){return{player:{}}},computed:{isEmbeddedSource(){return this.primarySource&&this.primarySource.embedId&&this.primarySource.provider},primarySource(){return this.sources[0]||null}},mounted(){this.player=new Ro("#"+this.id,{iconUrl:this.iconUrl,controls:["play-large","play","progress","duration","mute","volume","captions","settings","download","fullscreen"]})}}),k2={class:"relative"},S2=["id","data-cy","data-plyr-embed-id","data-plyr-provider"],x2=["id","aria-labelledby","data-cy","data-poster"],T2=["src","type"],C2=["default","kind","label","src","srclang"];function E2(n,e,t,r,i,s){return z(),V("div",k2,[n.isEmbeddedSource?(z(),V("div",{key:0,id:n.id,"data-cy":n.dataCy,"data-plyr-embed-id":n.primarySource.embedId,"data-plyr-provider":n.primarySource.provider},null,8,S2)):(z(),V("video",{key:1,id:n.id,"aria-labelledby":n.ariaLabelledby,"data-cy":n.dataCy,playsinline:"","data-poster":n.poster},[(z(!0),V(Lt,null,Rn(n.sources,o=>(z(),V("source",{key:o.src,src:o.src,type:o.type},null,8,T2))),128)),(z(!0),V(Lt,null,Rn(n.tracks,o=>(z(),V("track",{key:o.src,default:!!o.default,kind:o.kind,label:o.label,src:o.src,srclang:o.srclang},null,8,C2))),128))],8,x2))])}const g$=vt(j1,[["render",E2]]);j1.__docgenInfo={displayName:"DpVideoPlayer",exportName:"default",description:"",tags:{},props:[{name:"dataCy",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"'videoPlayer'"}},{name:"ariaLabelledby",description:"You may pass the id of an element containing content that describes the video.",type:{name:"string|boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"iconUrl",description:"See: https://github.com/sampotts/plyr#using-the-iconurl-option",type:{name:"string"},required:!0},{name:"id",type:{name:"string"},required:!0},{name:"isEmbedded",type:{name:"boolean"},required:!1,defaultValue:{func:!1,value:"false"}},{name:"poster",type:{name:"string"},required:!1,defaultValue:{func:!1,value:"''"}},{name:"sources",description:`An array of video sources to be used by the player.
|
|
148
|
-
|
|
149
|
-
This prop can handle both embedded video sources (e.g., YouTube, Vimeo)
|
|
150
|
-
and traditional HTML5 video sources. The first source in the array is
|
|
151
|
-
considered the \`primarySource\`, and it is used by the player first.
|
|
152
|
-
|
|
153
|
-
For embedded videos:
|
|
154
|
-
- \`provider\`: The video platform (e.g., 'youtube', 'vimeo').
|
|
155
|
-
- \`embedId\`: The unique video ID or URL for the embedded video.
|
|
156
|
-
|
|
157
|
-
For HTML5 videos:
|
|
158
|
-
- \`src\`: The URL to the video file.
|
|
159
|
-
- \`type\`: The MIME type of the video (e.g., 'video/mp4', 'video/webm').
|
|
160
|
-
|
|
161
|
-
The player will automatically detect whether the source is for an embedded
|
|
162
|
-
video or an HTML5 video and render the appropriate player markup.`,tags:{type:[{title:"type",type:{name:"Array<Object>"}}],default:[{description:"[]",title:"default"}]},type:{name:"func"},required:!1,defaultValue:{func:!0,value:"() => ([])"}},{name:"tracks",type:{name:"func"},required:!1,defaultValue:{func:!0,value:"() => ([])"}}],sourceFiles:["/home/florian/Dev/demosplan-ui/src/components/DpVideoPlayer/DpVideoPlayer.vue"]};export{h$ as D,mF as _,m$ as a,g$ as b,c$ as c,d$ as d,f$ as e,p$ as f,tL as g,mL as h};
|