ht-emr 0.5.2 → 0.5.3
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.id="canvas-editor-style",e.appendChild(document.createTextNode(`.ce-select-control-popup{max-width:160px;min-width:69px;max-height:225px;position:absolute;z-index:1;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;box-shadow:0 2px 12px #0000001a;box-sizing:border-box;margin:5px 0;overflow-y:auto}.ce-select-control-popup ul{list-style:none;padding:3px 0;margin:0;box-sizing:border-box}.ce-select-control-popup ul li{font-size:13px;padding:0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#666;height:36px;line-height:36px;box-sizing:border-box;cursor:pointer}.ce-select-control-popup ul li:hover{background-color:#eef2fd}.ce-select-control-popup ul li.active{color:var(--COLOR-HOVER, #5175f4);font-weight:700}.ce-calculator{position:absolute;z-index:1;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;box-shadow:0 2px 12px #0000001a;box-sizing:border-box;margin:5px 0;padding:8px;width:200px}.ce-calculator-display{width:100%;height:40px;line-height:40px;text-align:right;padding:0 10px;margin-bottom:8px;border:1px solid #e4e7ed;border-radius:4px;background-color:#f5f7fa;font-size:16px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}.ce-calculator-buttons{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ce-calculator-button{width:100%;height:36px;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;font-size:14px;cursor:pointer;transition:all .2s;box-sizing:border-box}.ce-calculator-button:hover{background-color:#eef2fd;border-color:#c6d1ff}.ce-calculator-button:active{background-color:#e1e8ff}.ce-calculator-button.operator{background-color:#f5f7fa}.ce-calculator-button.operator:hover{background-color:#eef2fd}.ce-calculator-button.equal{background-color:var(--COLOR-HOVER, #5175f4);color:#fff;border-color:var(--COLOR-HOVER, #5175f4)}.ce-calculator-button.equal:hover{background-color:var(--COLOR-HOVER, #6a84ff);border-color:var(--COLOR-HOVER, #6a84ff)}.ce-calculator-button.utility{background-color:#f0f2f5}.ce-calculator-button.utility:hover{background-color:#e6e8eb}.ce-date-container{display:none;width:300px;overflow:hidden;left:0;right:0;position:absolute;z-index:1;color:#606266;background:#fff;border-radius:4px;padding:10px;-webkit-user-select:none;user-select:none;border:1px solid #e4e7ed;box-shadow:0 2px 12px #0000001a}.ce-date-container.active{display:block}.ce-date-wrap{display:none}.ce-date-wrap.active{display:block}.ce-date-title{display:flex;justify-content:center;align-items:center;text-align:center;color:#606266;font-size:16px}.ce-date-title>span{display:inline-block}.ce-date-title>span:not(.ce-date-title__now){font-family:cursive;cursor:pointer}.ce-date-title>span:not(.ce-date-title__now):hover{color:#5175f4}.ce-date-title .ce-date-title__pre-year,.ce-date-title .ce-date-title__pre-month{width:15%}.ce-date-title .ce-date-title__now{width:40%}.ce-date-title .ce-date-title__next-year,.ce-date-title .ce-date-title__next-month{width:15%}.ce-date-week{width:100%;display:flex;justify-content:center;margin-top:15px;padding-bottom:5px;border-bottom:1px solid #e4e7ed}.ce-date-week>span{list-style:none;width:calc(100%/7);text-align:center;color:#606266;font-size:14px}.ce-date-day{width:100%;display:flex;flex-wrap:wrap;align-items:center;margin-top:5px}.ce-date-day>div{width:calc(100%/7);height:40px;text-align:center;color:#606266;font-size:14px;cursor:pointer;line-height:40px;border-radius:4px}.ce-date-day>div:hover{color:#5175f4;opacity:.8}.ce-date-day>div.active{color:#5175f4;font-weight:700}.ce-date-day>div.disable{color:#c0c4cc}.ce-date-day>div.select{color:#fff;background-color:#5175f4}.ce-time-wrap{display:none;padding:10px;height:286px}.ce-time-wrap ::-webkit-scrollbar{width:0}.ce-time-wrap.active{display:flex}.ce-time-wrap li{list-style:none}.ce-time-wrap>li{width:33.3%;height:100%;text-align:center}.ce-time-wrap>li>span{transform:translateY(-5px);display:inline-block}.ce-time-wrap>li>ol{height:calc(100% - 20px);overflow-y:auto;border:1px solid #e2e2e2;position:relative}.ce-time-wrap>li:first-child>ol{border-right:0}.ce-time-wrap>li:last-child>ol{border-left:0}.ce-time-wrap>li>ol>li{line-height:30px;cursor:pointer;transition:all .3s}.ce-time-wrap>li>ol>li:hover{background-color:#eaeaea}.ce-time-wrap>li>ol>li.active{color:#fff;background:#5175f4}.ce-date-menu{width:100%;height:28px;display:flex;justify-content:flex-end;align-items:center;padding-top:10px;position:relative;border-top:1px solid #e4e7ed}.ce-date-menu button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;appearance:none;text-align:center;box-sizing:border-box;outline:none;transition:.1s;font-weight:500;-webkit-user-select:none;user-select:none;padding:7px 15px;font-size:12px;border-radius:3px;margin:0 0 0 10px}.ce-date-menu button:hover{color:#5175f4;border-color:#5175f4}.ce-date-menu button.ce-date-menu__time{border:1px solid transparent;position:absolute;left:0;margin-left:0}.ce-date-menu button.ce-date-menu__time:hover{color:#5175f4}.ce-block-item{position:absolute;z-index:0;background-color:#fff;border:1px solid rgb(235 236 240)}.ce-block-item .ce-resizer-selection{width:100%;height:100%}.ce-block-item .ce-resizer-mask{position:absolute;inset:0;z-index:1;background-color:transparent}.ce-table-tool__row{position:absolute;width:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed}.ce-table-tool__row .ce-table-tool__row__item{width:100%;position:relative;cursor:pointer;transition:all .3s}.ce-table-tool__row .ce-table-tool__row__item:after{content:"";position:absolute;bottom:0;left:2px;width:8px;height:1px;background-color:#c0c6cf}.ce-table-tool__row .ce-table-tool__row__item:hover{background-color:#dadce0}.ce-table-tool__row .ce-table-tool__row__item:last-child:after{display:none}.ce-table-tool__quick__add{width:16px;height:16px;position:absolute;border-radius:50%;background-color:#e2e6ed;cursor:pointer}.ce-table-tool__quick__add:after{content:"+";color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%,-55%)}.ce-table-tool__select{width:16px;height:18px;position:absolute;border-radius:3px;cursor:pointer}.ce-table-tool__select:hover{background-color:#e2e6ed}.ce-table-tool__select:after{content:":::";color:#aaaaab;position:absolute;top:50%;left:50%;transform:translate(-75%,-50%) rotate(-90deg)}.ce-table-tool__col{position:absolute;height:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed;display:flex}.ce-table-tool__col .ce-table-tool__col__item{height:100%;position:relative;cursor:pointer;transition:all .3s}.ce-table-tool__col .ce-table-tool__col__item:after{content:"";position:absolute;top:2px;left:-1px;width:1px;height:8px;z-index:1;background-color:#c0c6cf}.ce-table-tool__col .ce-table-tool__col__item:hover{background-color:#dadce0}.ce-table-tool__col .ce-table-tool__col__item:first-child:after{display:none}.ce-table-tool__row .ce-table-tool__row__item.active,.ce-table-tool__col .ce-table-tool__col__item.active{background-color:#c4d7fa}.ce-table-tool__col .ce-table-tool__anchor{right:-5px;width:10px;height:12px;z-index:9;position:absolute;cursor:col-resize}.ce-table-tool__row .ce-table-tool__anchor{bottom:-5px;left:0;width:12px;height:10px;z-index:9;position:absolute;cursor:row-resize}.ce-table-anchor__line{z-index:9;position:absolute;border:1px dotted #000000}.ce-table-tool__border{position:absolute;z-index:1;background:transparent;pointer-events:none}.ce-table-tool__border__row{position:absolute;cursor:row-resize;pointer-events:auto}.ce-table-tool__border__col{position:absolute;cursor:col-resize;pointer-events:auto}.ce-resizer-selection{position:absolute;border:1px solid;pointer-events:none}.ce-resizer-selection .resizer-handle{position:absolute;z-index:9;width:10px;height:10px;box-shadow:0 1px 4px #0000004d;border-radius:5px;border:2px solid #ffffff;box-sizing:border-box;pointer-events:initial}.ce-resizer-selection .handle-0{cursor:nw-resize}.ce-resizer-selection .handle-1{cursor:n-resize}.ce-resizer-selection .handle-2{cursor:ne-resize}.ce-resizer-selection .handle-3{cursor:e-resize}.ce-resizer-selection .handle-4{cursor:se-resize}.ce-resizer-selection .handle-5{cursor:s-resize}.ce-resizer-selection .handle-6{cursor:sw-resize}.ce-resizer-selection .handle-7{cursor:w-resize}.ce-resizer-size-view{display:flex;align-items:center;height:20px;white-space:nowrap;position:absolute;z-index:9;top:-30px;left:0;opacity:.9;background-color:#000;padding:0 5px;border-radius:4px}.ce-resizer-size-view span{color:#fff;font-size:12px}.ce-resizer-image{position:absolute;opacity:.5}.ce-image-previewer{position:fixed;left:0;top:0;z-index:1000;width:100%;height:100%;overflow:hidden;background:#f2f4f7;display:flex;align-items:center;justify-content:center;animation:previewerAnimation .3s}@keyframes previewerAnimation{0%{opacity:.1}to{opacity:1}}.ce-image-previewer .image-close{width:24px;height:24px;display:inline-block;position:absolute;right:50px;top:30px;z-index:99;cursor:pointer;background:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M23.97%207l1.415%201.414-7.779%207.778%207.779%207.779-1.414%201.414-7.779-7.779-7.778%207.779L7%2023.97l7.778-7.779L7%208.414%208.414%207l7.778%207.778L23.971%207z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e") no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.ce-image-previewer .image-close:hover{background-color:#e2e6ed}.ce-image-previewer .ce-image-container{position:relative}.ce-image-previewer .ce-image-container img{cursor:move;position:relative}.ce-image-previewer .ce-image-menu{height:50px;position:absolute;bottom:50px;z-index:99;display:flex;align-items:center;justify-content:center}.ce-image-previewer .ce-image-menu i{width:32px;height:32px;margin:0 8px;cursor:pointer;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.ce-image-previewer .ce-image-menu i:hover{background-color:#e2e6ed}.ce-image-previewer .ce-image-menu i.zoom-in{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%2014v-4h2v4h4v2h-4v4h-2v-4h-4v-2h4zm8.749%2010.163A11.952%2011.952%200%200115%2027C8.373%2027%203%2021.627%203%2015S8.373%203%2015%203s12%205.373%2012%2012c0%202.954-1.067%205.658-2.837%207.749l4.908%204.908-1.414%201.414-4.908-4.908zM15%2025c5.523%200%2010-4.477%2010-10S20.523%205%2015%205%205%209.477%205%2015s4.477%2010%2010%2010z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.zoom-out{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M22.749%2024.163A11.952%2011.952%200%200115%2027C8.373%2027%203%2021.627%203%2015S8.373%203%2015%203s12%205.373%2012%2012c0%202.954-1.067%205.658-2.837%207.749l4.908%204.908-1.414%201.414-4.908-4.908zM15%2025c5.523%200%2010-4.477%2010-10S20.523%205%2015%205%205%209.477%205%2015s4.477%2010%2010%2010zm-5-11h10v2H10v-2z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.rotate{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M16%204c6.627%200%2012%205.373%2012%2012a11.97%2011.97%200%2001-4%208.944V23h-.86A9.968%209.968%200%200026%2016c0-5.523-4.477-10-10-10S6%2010.477%206%2016c0%205.185%203.947%209.449%209%209.95v2.009C8.84%2027.451%204%2022.291%204%2016%204%209.373%209.373%204%2016%204z'%20fill-rule='nonzero'/%3e%3cpath%20d='M19.879%2027.328l1.767-6.717%204.95%204.95z'/%3e%3c/g%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.original-size{background-image:url("data:image/svg+xml,%3csvg%20width='32'%20height='32'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%204h24v24H4V4zm2%202v20h20V6H6zm4%205h2v10h-2V11zm5%202h2v2h-2v-2zm0%204h2v2h-2v-2zm5-6h2v10h-2V11z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.image-download{background-image:url("data:image/svg+xml,%3csvg%20width='24'%20height='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.5%2015v3.5h15V15H21v5H3v-5h1.5zm8.232-11.226v9.196l4.05-4.05%201.06%201.06-5.834%205.834-5.833-5.833%201.06-1.06%203.998%203.996V3.774h1.5z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu .image-navigate{display:flex;align-items:center;justify-content:center}.ce-image-previewer .ce-image-menu i.image-pre{background-image:url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.5%204.063L6.875%2010l5.625%205.938'%20stroke='%233D4757'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu i.image-next{background-image:url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.5%204.063L13.125%2010%207.5%2015.938'%20stroke='%233D4757'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e")}.ce-image-previewer .ce-image-menu .image-count{color:#000;font-size:20px}.ce-image-previewer .ce-image-menu i.disabled{cursor:not-allowed;opacity:.5}.ce-contextmenu-container{z-index:9;position:fixed;display:none;padding:4px;overflow-x:hidden;overflow-y:auto;background:#fff;box-shadow:0 2px 12px #38383833;border:1px solid #e2e6ed;border-radius:2px}.ce-contextmenu-content{display:flex;flex-direction:column}.ce-contextmenu-content .ce-contextmenu-sub-item:after{position:absolute;content:"";width:16px;height:16px;right:12px;background:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M0%200h16v16H0z'/%3e%3cg%20fill='%23767C85'%3e%3cpath%20d='M7%2012.243l-.707-.707%204.243-4.243.707.707z'/%3e%3cpath%20d='M6.293%204.464L7%203.757%2011.243%208l-.707.707z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-content .ce-contextmenu-item{min-width:140px;padding:0 32px 0 16px;height:30px;display:flex;align-items:center;white-space:nowrap;box-sizing:border-box;cursor:pointer}.ce-contextmenu-content .ce-contextmenu-item.hover{background:#1937580a}.ce-contextmenu-content .ce-contextmenu-item span{max-width:300px;font-size:12px;color:#3d4757;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ce-contextmenu-content .ce-contextmenu-item span.ce-shortcut{color:#767c85;height:30px;flex:1;text-align:right;line-height:30px;margin-left:20px}.ce-contextmenu-content .ce-contextmenu-item i{width:16px;height:16px;vertical-align:middle;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;flex-shrink:0;margin-right:8px}.ce-contextmenu-divider{background-color:#e2e6ed;margin:4px 16px;height:1px}.ce-contextmenu-print{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M12%204h-1V2H5v2H4V2a1%201%200%20011-1h6a1%201%200%20011%201v2zm0%205v4a1%201%200%2001-1%201H5a1%201%200%2001-1-1V9h1v4h6V9h1z'/%3e%3cpath%20d='M12%2012v-1h2V5H2v6h2v1H2a1%201%200%2001-1-1V5a1%201%200%20011-1h12a1%201%200%20011%201v6a1%201%200%2001-1%201h-2z'/%3e%3cpath%20d='M3%208h10v1H3zm8-2h2v1h-2z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-image{background-image:url("data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_插入图片-16px-'%3e%3cg%20id='Group-19'%20transform='translate(1%201)'%3e%3cpath%20id='Combined-Shape'%20class='st0'%20d='M1%200h12c.6%200%201%20.4%201%201v11c0%20.6-.4%201-1%201H1c-.6%200-1-.4-1-1V1c0-.6.4-1%201-1zm0%201v11h12V1H1z'/%3e%3ccircle%20id='椭圆形'%20class='st0'%20cx='10'%20cy='4'%20r='1'/%3e%3cpath%20id='Path'%20class='st0'%20d='M8.5%2011.2l-4-4.1L1%2010.7V9.2c1.7-1.6%202.7-2.5%203-2.8.4-.5.7-.4%201%200L8.5%2010%2011%207.3c.4-.5.6-.5%201-.1l2%202.8v1.5l-2.5-3.4-3%203.1z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-image-change{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20transform='translate(2%204)'%20fill='%233D4757'%3e%3ccircle%20fill-rule='nonzero'%20cx='3'%20cy='1'%20r='1'/%3e%3cpath%20d='M7.473%208.223L3.47%204.107%200%207.667v-1.5C1.715%204.6%202.707%203.664%202.975%203.358c.402-.457.651-.39%201.042%200L7.473%207%209.96%204.349c.414-.462.62-.462%201.011-.071L13%207.06v1.5l-2.51-3.41-3.017%203.072z'/%3e%3c/g%3e%3cpath%20d='M6%201.5H1.5v12h13v-4V13a.5.5%200%2001-.5.5H2a.5.5%200%2001-.5-.5V2a.5.5%200%2001.5-.5h4zm8.5%208V6l-.5.5h1l-.5-.5v3.5zM6%201.5h4L9.5%201v1l.5-.5H6z'%20stroke='%233D4757'/%3e%3cpath%20d='M13.085%201.316l-3.814%204a1%201%200%20001.458%201.368l3.815-4a1%201%200%2010-1.459-1.368z'%20fill='%233D4757'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-row-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%233D4757'%20d='M8.5%205.5h6v4h-6z'/%3e%3cpath%20fill='%233D4757'%20d='M4%207v1h2V7zm-3%20.5L4%205v5zM1%201h12v1H1zm0%2012h12v1H1z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-top-row{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M8%205H7v3h1zm-.5-3L10%205H5z'/%3e%3crect%20stroke='%233D4757'%20x='1.5'%20y='10.5'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-bottom-row{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M7%2011h1V8H7zm.5%203L5%2011h5z'/%3e%3crect%20stroke='%233D4757'%20x='1.5'%20y='2.5'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-left-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M11%207v1h3V7zm-3%20.5L11%205v5z'/%3e%3crect%20stroke='%233D4757'%20transform='rotate(90%204%207.5)'%20x='-2'%20y='6'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-insert-right-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M5%208V7H2v1zm3-.5L5%2010V5z'/%3e%3crect%20stroke='%233D4757'%20transform='rotate(90%2012%207.5)'%20x='6'%20y='6'%20width='12'%20height='3'%20rx='1'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-row-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%23929AA8'%20d='M8.5%206.5h6v2h-6z'/%3e%3cpath%20fill='%233D4757'%20d='M2%2012h11v1H2zM2%202h11v1H2zm.63%203L7%209.35l-.635.65L2%205.63z'/%3e%3cpath%20fill='%233D4757'%20d='M2%209.363L6.355%205%207%205.707%202.695%2010z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-row{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%23929AA8'%20d='M8.5%205.5h6v4h-6z'/%3e%3cpath%20fill='%233D4757'%20d='M1%2013h12v1H1zM1%201h12v1H1zm0%204h1v1H1zm1%201h1v1H2zm1%201h1v1H3zm1-1h1v1H4zm1-1h1v1H5zM4%208h1v1H4zM2%208h1v1H2zm3%201h1v1H5zM1%209h1v1H1z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-col{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20stroke='%23929AA8'%20d='M5.5%207.5v-6h4v6z'/%3e%3cpath%20fill='%233D4757'%20d='M13%2015V3h1v12zM1%2015V3h1v12zm4%200v-1h1v1zm1-1v-1h1v1zm1-1v-1h1v1zm-1-1v-1h1v1zm-1-1v-1h1v1zm3%201v-1h1v1zm0%202v-1h1v1zm1-3v-1h1v1zm0%204v-1h1v1z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-delete-table{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M14%2013h-1v-3H2v3H1v-3a1%201%200%20011-1h11a1%201%200%20011%201v3z'%20fill-rule='nonzero'/%3e%3cpath%20d='M5.625%202L10%206.375%209.375%207%205%202.625z'/%3e%3cpath%20d='M5%206.375L9.375%202l.625.625L5.625%207z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-merge-cell{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M6%201v1H2v11h4v1H2a1%201%200%2001-1-1V2a1%201%200%20011-1h4zm3%200h4a1%201%200%20011%201v11a1%201%200%2001-1%201H9v-1h4V2H9V1z'/%3e%3cpath%20fill-rule='nonzero'%20d='M6%201h1v4H6zm2%200h1v4H8z'/%3e%3cpath%20d='M8%207.5L10%206v3zm-1%200L5%206v3z'/%3e%3cpath%20d='M9%207h3v1H9zM3%207h3v1H3z'/%3e%3cpath%20fill-rule='nonzero'%20d='M8%2010h1v4H8zm-2%200h1v4H6z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-merge-cancel-cell{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M6%201v1H2v11h4v1H2a1%201%200%2001-1-1V2a1%201%200%20011-1h4zm3%200h4a1%201%200%20011%201v11a1%201%200%2001-1%201H9v-1h4V2H9V1z'/%3e%3cpath%20fill-rule='nonzero'%20d='M6%201h1v4H6zm2%200h1v4H8z'/%3e%3cpath%20d='M3%207.5L5%206v3zm9%200L10%206v3z'/%3e%3cpath%20d='M4%207h3v1H4zm4%200h3v1H8z'/%3e%3cpath%20fill-rule='nonzero'%20d='M8%2010h1v4H8zm-2%200h1v4H6z'/%3e%3c/g%3e%3c/svg%3e")}.ce-contextmenu-vertical-align{background-image:url("data:image/svg+xml,%3csvg%20height='16'%20viewBox='0%200%2016%2016'%20width='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2zm0-3h8v1H2zm0-3h12v1H2zm0-6h12v1H2zm0%203h8v1H2z'%20fill='%233d4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-vertical-align-top{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8%208H7v6h1zm-.5-3L10%208H5zM2%203h11v1H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-vertical-align-middle{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8%2012H7v3h1zm-.5-3l2.5%203H5zM7%203h1V0H7zm.5%203L5%203h5zM2%207h11v1H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-vertical-align-bottom{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7%209h1V3H7zm.5%203L5%209h5zM2%2013h11v1H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.ce-contextmenu-border-all{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M3%208h11v1H3z'/%3e%3cpath%20fill='%233D4757'%20d='M9%203v11H8V3z'/%3e%3c/svg%3e")}.ce-contextmenu-border-empty{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%203h-1V2h1a1%201%200%20011%201v1h-1V3zm-3-1v1H8.5v2h-1V3H6V2h4zM4%202v1H3v1H2V3a1%201%200%20011-1h1zM2%206h1v1.5h2v1H3V10H2V6zm0%206h1v1h1v1H3a1%201%200%2001-1-1v-1zm4%202v-1h1.5v-2h1v2H10v1H6zm6%200v-1h1v-1h1v1a1%201%200%2001-1%201h-1zm2-4h-1V8.5h-2v-1h2V6h1v4zM8.5%207.5v-1h-1v1h-1v1h1v1h1v-1h1v-1h-1z'%20fill='%23AAACB0'/%3e%3c/svg%3e")}.ce-contextmenu-border-dash{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13%203h-1V2h1a1%201%200%20011%201v1h-1V3zm-3-1v1H8.5v2h-1V3H6V2h4zM4%202v1H3v1H2V3a1%201%200%20011-1h1zM2%206h1v1.5h2v1H3V10H2V6zm0%206h1v1h1v1H3a1%201%200%2001-1-1v-1zm4%202v-1h1.5v-2h1v2H10v1H6zm6%200v-1h1v-1h1v1a1%201%200%2001-1%201h-1zm2-4h-1V8.5h-2v-1h2V6h1v4zM8.5%207.5v-1h-1v1h-1v1h1v1h1v-1h1v-1h-1z'%20fill='%23000000'/%3e%3c/svg%3e")}.ce-contextmenu-border-external{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%233D4757'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M9%205V3H8v2h1zm0%209v-2H8v2h1zM5%208H3v1h2V8zm9%200h-2v1h2V8zM9%207v1h1v1H9v1H8V9H7V8h1V7h1z'%20fill='%23AAACB0'/%3e%3c/svg%3e")}.ce-contextmenu-border-internal{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M9%205V3H8v2h1zm0%209v-2H8v2h1zM5%208H3v1h2V8zm9%200h-2v1h2V8zM9%207v1h1v1H9v1H8V9H7V8h1V7h1z'%20fill='%233D4757'/%3e%3c/svg%3e")}.ce-contextmenu-border-td{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20d='M8.5%202.5%20v6%20h-6'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-top{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M2.5%203%20h12'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-left{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M3%203%20v11'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-bottom{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M2.5%2014%20h12'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-right{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'/%3e%3cpath%20stroke='%233D4757'%20stroke-width='2'%20d='M14%203%20v11'/%3e%3c/svg%3e")}.ce-contextmenu-border-td-forward{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'%20/%3e%3cpath%20stroke='%233D4757'%20d='M14%203%20l-11%2011'%20/%3e%3c/svg%3e")}.ce-contextmenu-border-td-back{background-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.5%203a.5.5%200%2001.5-.5h11a.5.5%200%2001.5.5v11a.5.5%200%2001-.5.5H3a.5.5%200%2001-.5-.5V3z'%20stroke='%23AAACB0'%20/%3e%3cpath%20stroke='%233D4757'%20d='M3%203%20l11%2011'%20/%3e%3c/svg%3e")}.ce-hyperlink-popup{background:#fff;box-shadow:0 2px 12px #626b8433;border-radius:2px;color:#3d4757;padding:12px 16px;position:absolute;z-index:1;text-align:center;display:none}.ce-hyperlink-popup a{min-width:100px;max-width:300px;font-size:12px;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;text-decoration:none;border-bottom-width:1px;border-bottom-style:solid;color:#00f}.ce-zone-indicator>div{padding:3px 6px;color:#000;font-size:12px;background:#dae7fc;position:absolute;transform-origin:0 0}.ce-zone-indicator-border__top,.ce-zone-indicator-border__bottom,.ce-zone-indicator-border__left,.ce-zone-indicator-border__right{display:block;position:absolute;z-index:0}.ce-zone-indicator-border__top{border-top:2px dashed rgb(238,238,238)}.ce-zone-indicator-border__bottom{border-top:2px dashed rgb(238,238,238);width:100%}.ce-zone-indicator-border__left{border-left:2px dashed rgb(238,238,238)}.ce-zone-indicator-border__right{border-right:2px dashed rgb(238,238,238)}.ce-zone-tip{display:none;align-items:center;height:30px;white-space:nowrap;position:fixed;opacity:.9;background-color:#000;padding:0 5px;border-radius:4px;z-index:9;transition:all .3s;outline:none;-webkit-user-select:none;user-select:none;pointer-events:none;transform:translate(10px,10px)}.ce-zone-tip.show{display:flex}.ce-zone-tip span{color:#fff;font-size:12px}.ce-inputarea{min-width:60px!important;min-height:0;margin:0;padding:0;left:0;top:0;letter-spacing:0;font-size:12px;position:absolute;z-index:-1;outline:none;resize:none;border:none;overflow:hidden;color:transparent;-webkit-user-select:none;user-select:none;caret-color:transparent;background-color:transparent;white-space:pre}.ce-cursor{width:1px;height:20px;left:0;right:0;position:absolute;outline:none;background-color:#000;pointer-events:none}.ce-cursor.ce-cursor--animation{animation-duration:1s;animation-iteration-count:infinite;animation-name:cursorAnimation}@keyframes cursorAnimation{0%{opacity:1}13%{opacity:0}50%{opacity:0}63%{opacity:1}to{opacity:1}}.ce-float-image{position:absolute;opacity:.5;pointer-events:none}.ce-button-input-modal{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;display:flex;justify-content:center;align-items:center;z-index:1000}.ce-button-input-modal__content{background:#fff;border-radius:8px;padding:20px;min-width:320px;max-width:480px;box-shadow:0 4px 20px #00000026}.ce-button-input-modal__title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px}.ce-button-input-modal__textarea{width:100%;min-height:100px;padding:10px 12px;border:1px solid #dcdfe6;border-radius:4px;font-size:13px;line-height:1.5;resize:vertical;outline:none;box-sizing:border-box;font-family:inherit}.ce-button-input-modal__textarea:focus{border-color:#5175f4}.ce-button-input-modal__textarea::placeholder{color:#c0c4cc}.ce-button-input-modal__buttons{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.ce-button-input-modal__cancel,.ce-button-input-modal__confirm{padding:8px 16px;font-size:13px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.ce-button-input-modal__cancel:hover{color:#5175f4;border-color:#5175f4}.ce-button-input-modal__confirm{background:#5175f4;border-color:#5175f4;color:#fff}.ce-button-input-modal__confirm:hover{background:#409eff;border-color:#409eff}.ce-button-edit-modal{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;display:flex;justify-content:center;align-items:center;z-index:1000}.ce-button-edit-modal__content{background:#fff;border-radius:8px;padding:20px;min-width:320px;max-width:480px;box-shadow:0 4px 20px #00000026}.ce-button-edit-modal__title{font-size:14px;font-weight:500;color:#333;margin-bottom:16px}.ce-button-edit-modal__form{display:flex;flex-direction:column;gap:12px}.ce-button-edit-modal__field{display:flex;align-items:center;gap:8px}.ce-button-edit-modal__field label{min-width:80px;font-size:13px;color:#606266}.ce-button-edit-modal__field input{flex:1;padding:8px 12px;border:1px solid #dcdfe6;border-radius:4px;font-size:13px;outline:none;box-sizing:border-box}.ce-button-edit-modal__field input:focus{border-color:#5175f4}.ce-button-edit-modal__field input::placeholder{color:#c0c4cc}.ce-button-edit-modal__buttons{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.ce-button-edit-modal__cancel,.ce-button-edit-modal__confirm{padding:8px 16px;font-size:13px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.ce-button-edit-modal__cancel:hover{color:#5175f4;border-color:#5175f4}.ce-button-edit-modal__confirm{background:#5175f4;border-color:#5175f4;color:#fff}.ce-button-edit-modal__confirm:hover{background:#409eff;border-color:#409eff}.ce-number-input-modal{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;display:flex;justify-content:center;align-items:center;z-index:1000}.ce-number-input-modal__content{background:#fff;border-radius:8px;padding:20px;min-width:300px;max-width:400px;box-shadow:0 4px 20px #00000026}.ce-number-input-modal__title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px}.ce-number-input-modal__hint{font-size:12px;color:#909399;margin-bottom:12px}.ce-number-input-modal__input{width:100%;padding:10px 12px;border:1px solid #dcdfe6;border-radius:4px;font-size:13px;outline:none;box-sizing:border-box}.ce-number-input-modal__input:focus{border-color:#5175f4}.ce-number-input-modal__input::placeholder{color:#c0c4cc}.ce-number-input-modal__error{font-size:12px;color:#f56c6c;margin-top:8px}.ce-number-input-modal__buttons{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.ce-number-input-modal__cancel,.ce-number-input-modal__confirm{padding:8px 16px;font-size:13px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.ce-number-input-modal__cancel:hover{color:#5175f4;border-color:#5175f4}.ce-number-input-modal__confirm{background:#5175f4;border-color:#5175f4;color:#fff}.ce-number-input-modal__confirm:hover{background:#409eff;border-color:#409eff}.tooth-position-edit-modal,.tooth-position-create-modal{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000}.tooth-position-modal__mask{position:absolute;top:0;left:0;width:100%;height:100%;background:#00000080}.tooth-position-modal__container{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;border-radius:8px;box-shadow:0 4px 12px #00000026;min-width:400px;max-width:90vw}.tooth-position-modal__header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid #e8e8e8}.tooth-position-modal__header span{font-size:16px;font-weight:500;color:#333}.tooth-position-modal__close{font-size:20px;cursor:pointer;color:#999;line-height:1}.tooth-position-modal__close:hover{color:#333}.tooth-position-modal__content{padding:20px;max-height:60vh;overflow-y:auto}.tooth-section{margin-bottom:20px}.tooth-section:last-child{margin-bottom:0}.tooth-section-title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px;padding-left:8px;border-left:3px solid #1890ff}.tooth-row{display:flex;align-items:center;margin-bottom:8px}.tooth-row:last-child{margin-bottom:0}.tooth-row-label{width:30px;font-size:13px;color:#666}.tooth-buttons{display:flex;gap:8px;flex-wrap:wrap}.letter-buttons{margin-left:30px}.tooth-checkbox{display:flex;align-items:center;cursor:pointer}.tooth-checkbox input{display:none}.tooth-checkbox span{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d9d9d9;border-radius:4px;background:#f5f5f5;font-size:14px;color:#333;transition:all .2s}.tooth-checkbox input:checked+span{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-checkbox:hover span{border-color:#1890ff}.tooth-position-modal__footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 20px;border-top:1px solid #e8e8e8}.tooth-position-modal__footer .btn-cancel,.tooth-position-modal__footer .btn-confirm{padding:8px 20px;font-size:14px;border-radius:4px;cursor:pointer;border:1px solid #dcdfe6;background:#fff;color:#606266;transition:all .2s}.tooth-position-modal__footer .btn-cancel:hover{color:#1890ff;border-color:#1890ff}.tooth-position-modal__footer .btn-confirm{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-position-modal__footer .btn-confirm:hover{background:#40a9ff;border-color:#40a9ff}.tooth-grid-container{display:flex;flex-direction:column;align-items:center;padding:15px 20px;background:#fafafa;border-radius:8px;margin-bottom:15px;position:relative}.tooth-quick-buttons{display:flex;gap:6px;margin-bottom:16px}.tooth-quick-buttons-left{display:flex;flex-direction:column;gap:6px;flex:1}.tooth-quick-buttons-row{display:flex;gap:6px}.tooth-quick-btn{padding:6px 12px;font-size:12px;border:1px solid #d9d9d9;border-radius:4px;cursor:pointer;background:#fff;color:#333;transition:all .2s;white-space:nowrap}.tooth-quick-btn:hover{border-color:#1890ff;color:#1890ff}.tooth-quick-btn.selected{background:#0ff;border-color:#0ff;color:#fff}.tooth-quick-btn--clear{background:#ff6b6b;border-color:#ff6b6b;color:#fff}.tooth-quick-btn--clear:hover{background:#ff5252;border-color:#ff5252;color:#fff}.tooth-grid-container:before{content:"";position:absolute;left:50%;top:20px;bottom:20px;width:2px;background:#000;transform:translate(-50%);z-index:1}.tooth-grid-container:after{content:"";position:absolute;left:20px;right:20px;top:50%;height:2px;background:#000;transform:translateY(-50%);z-index:1}.tooth-grid-letter-row,.tooth-grid-number-row{display:flex;align-items:center;justify-content:center;position:relative;z-index:2}.tooth-grid-half{display:flex;align-items:center;justify-content:center;gap:4px}.tooth-grid-half.left{justify-content:flex-end;padding-right:15px}.tooth-grid-half.right{justify-content:flex-start;padding-left:15px}.tooth-grid-divider-v,.tooth-grid-divider-h{display:none}.tooth-grid-number-item{width:34px;height:32px;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:500;color:#333;cursor:pointer;background:#fff;transition:all .2s;box-sizing:border-box;border:1px solid #d9d9d9;border-radius:12px}.upper-number-row .tooth-grid-number-item{border-top:none;border-radius:0 0 12px 12px}.lower-number-row .tooth-grid-number-item{border-bottom:none;border-radius:12px 12px 0 0}.tooth-grid-number-item[data-value="1"],.tooth-grid-number-item[data-value="2"],.tooth-grid-number-item[data-value="3"]{border-radius:50px}.upper-number-row .tooth-grid-number-item[data-value="1"],.upper-number-row .tooth-grid-number-item[data-value="2"],.upper-number-row .tooth-grid-number-item[data-value="3"]{border-top:none!important;border-radius:0 0 50px 50px!important}.lower-number-row .tooth-grid-number-item[data-value="1"],.lower-number-row .tooth-grid-number-item[data-value="2"],.lower-number-row .tooth-grid-number-item[data-value="3"]{border-bottom:none!important;border-radius:50px 50px 0 0!important}.tooth-grid-number-item:hover{border-color:#1890ff;color:#1890ff}.tooth-grid-number-item.selected{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-grid-letter-item{width:34px;height:32px;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:500;color:#333;cursor:pointer;background:#fff;border:1px solid #d9d9d9;transition:all .2s;box-sizing:border-box;border-radius:12px}.upper-letter-row .tooth-grid-letter-item{border-top:none;border-radius:0 0 12px 12px}.lower-letter-row .tooth-grid-letter-item{border-bottom:none;border-radius:12px 12px 0 0}.tooth-grid-letter-item[data-value=A],.tooth-grid-letter-item[data-value=B],.tooth-grid-letter-item[data-value=C]{border-radius:50px}.upper-letter-row .tooth-grid-letter-item[data-value=A],.upper-letter-row .tooth-grid-letter-item[data-value=B],.upper-letter-row .tooth-grid-letter-item[data-value=C]{border-top:none!important;border-radius:0 0 50px 50px!important}.lower-letter-row .tooth-grid-letter-item[data-value=A],.lower-letter-row .tooth-grid-letter-item[data-value=B],.lower-letter-row .tooth-grid-letter-item[data-value=C]{border-bottom:none!important;border-radius:50px 50px 0 0!important}.tooth-grid-letter-item:hover{border-color:#1890ff;color:#1890ff}.tooth-grid-letter-item.selected{background:#1890ff;border-color:#1890ff;color:#fff}.tooth-grid-letter-row.hidden,.tooth-grid-number-row.hidden{display:none}.tooth-grid-letter-row{margin-bottom:8px}.tooth-grid-number-row.upper-number-row{margin-bottom:15px}.tooth-grid-number-row.lower-number-row{margin-top:15px}.tooth-grid-letter-row.lower-letter-row{margin-top:8px}.tooth-preview-section{padding-top:10px;border-top:1px solid #e8e8e8}.tooth-preview-title{font-size:14px;font-weight:500;color:#333;margin-bottom:12px}.tooth-preview-wrapper{display:flex;gap:15px}.tooth-preview-container{display:flex;justify-content:center;align-items:center;padding:10px;background:#fafafa;border-radius:8px;flex:1;min-height:60px}.tooth-preview-grid{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:0;width:100%;min-height:70px;position:relative}.tooth-preview-grid:before{content:"";position:absolute;left:50%;top:0;bottom:0;width:1px;background:#000;transform:translate(-50%)}.tooth-preview-grid:after{content:"";position:absolute;top:50%;left:0;right:0;height:1px;background:#000;transform:translateY(-50%)}.tooth-preview-quadrant{display:flex;align-items:center;padding:5px 10px;font-size:12px;flex-wrap:wrap;gap:4px;justify-content:center}.tooth-preview-upper-left{justify-content:flex-end}.tooth-preview-upper-right{justify-content:flex-start}.tooth-preview-lower-left{justify-content:flex-end}.tooth-preview-lower-right{justify-content:flex-start}.tooth-preview-tooth{position:relative;display:inline;margin:0 4px}.tooth-preview-tooth-value{font-size:12px}.tooth-preview-tooth-value--deciduous{font-size:10px}.tooth-preview-tooth-bracket{font-size:12px}.tooth-preview-supernumerary{font-size:9px;vertical-align:super;margin:0 1px}.tooth-preview-surface{font-size:9px;vertical-align:super;margin-left:1px}.tooth-extra-panel{width:100px;display:flex;flex-direction:column;gap:10px}.tooth-surface-panel{background:#fafafa;border-radius:8px;padding:10px 20px}.tooth-surface-title{font-size:12px;font-weight:500;color:#333;margin-bottom:8px;text-align:center}.tooth-surface-grid{display:flex;flex-direction:column;gap:4px;align-items:center}.tooth-surface-row{display:flex;gap:4px;justify-content:center}.tooth-surface-item{width:30px;height:30px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;color:#333;cursor:pointer;background:#fff;border:1px dashed #d9d9d9;border-radius:5px;transition:all .2s;box-sizing:border-box}.tooth-surface-item--indent{margin-left:17px}.tooth-surface-item:hover{border-color:#1890ff;color:#1890ff}.tooth-surface-item.selected{background:#1890ff;border-color:#1890ff;border-style:solid;color:#fff}.tooth-supernumerary-panel{background:#fafafa;border-radius:8px;padding:10px 20px}.tooth-supernumerary-title{font-size:12px;font-weight:500;color:#333;margin-bottom:4px;text-align:center}.tooth-supernumerary-hint{font-size:10px;color:#999;font-weight:400}.tooth-supernumerary-grid{display:flex;gap:8px;justify-content:center;margin-top:8px}.tooth-supernumerary-item{width:30px;height:35px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;color:#333;cursor:pointer;background:#fff;border:1px solid #d9d9d9;border-bottom:none;border-radius:50px;transition:all .2s;box-sizing:border-box}.tooth-supernumerary-item:hover{border-color:#1890ff;color:#1890ff}.tooth-supernumerary-item.selected{background:#1890ff;border-color:#1890ff;color:#fff}.dialog-mask{position:fixed;left:0;top:0;width:100%;height:100%;opacity:.5;background:#000;z-index:99}.dialog-container{position:fixed;inset:0;overflow:auto;z-index:999;margin:0;display:flex;justify-content:center;align-items:center}.dialog{position:absolute;padding:0 30px 30px;background:#fff;box-shadow:0 2px 12px #38383833;border:1px solid #e2e6ed;border-radius:2px}.dialog-title{position:relative;border-bottom:1px solid #e2e6ed;margin-bottom:30px;height:60px;display:flex;align-items:center;justify-content:space-between}.dialog-title i{width:16px;height:16px;cursor:pointer;display:inline-block;background:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.9%208.192l4.242%204.243-.707.707L8.192%208.9%203.95%2013.142l-.707-.707%204.242-4.243L3.243%203.95l.707-.707%204.242%204.242%204.243-4.242.707.707L8.9%208.192z'%20fill='%236A6A6A'%20fill-rule='evenodd'/%3e%3c/svg%3e")}.dialog-option__item{margin-bottom:18px;display:flex;align-items:center;justify-content:space-between}.dialog-option__item span{margin-right:12px;font-size:14px;color:#3d4757;position:relative}.dialog-option__item input,.dialog-option__item textarea,.dialog-option__item select{width:276px;height:30px;border-radius:2px;border:1px solid #d3d3d3;min-height:30px;padding:5px;box-sizing:border-box;outline:none;appearance:none;-webkit-user-select:none;user-select:none;font-family:inherit}.dialog-option__item input:focus,.dialog-option__item textarea:focus{border-color:#4991f2}.dialog-option__item--require:before{content:"*";color:#f56c6c;margin-right:4px;position:absolute;left:-8px}.dialog-menu{display:flex;align-items:center;justify-content:flex-end}.dialog-menu button{position:relative;display:inline-block;border:1px solid #e2e6ed;border-radius:2px;background:#fff;line-height:22px;padding:0 16px;white-space:nowrap;cursor:pointer}.dialog-menu button:hover{background:#1937580a}.dialog-menu__cancel{margin-right:16px}.dialog-menu button[type=submit]{color:#fff;background:#4991f2;border-color:#4991f2}.dialog-menu button[type=submit]:hover{background:#5b9cf3;border-color:#5b9cf3}.dialog-radio-group{display:flex;flex-direction:column;gap:8px}.dialog-radio-group--horizontal{flex-direction:row;gap:16px}.dialog-radio-item{display:flex;align-items:center;cursor:pointer;font-size:14px;color:#3d4757}.dialog-radio-item input[type=radio]{width:16px;height:16px;margin:0 6px 0 0;cursor:pointer;appearance:auto}.dialog-radio-item span{margin:0}`)),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
(function(l,we){typeof exports=="object"&&typeof module<"u"?we(exports):typeof define=="function"&&define.amd?define(["exports"],we):(l=typeof globalThis<"u"?globalThis:l||self,we(l["canvas-editor"]={}))})(this,(function(l){"use strict";const we="0.5.
|
|
2
|
+
(function(l,we){typeof exports=="object"&&typeof module<"u"?we(exports):typeof define=="function"&&define.amd?define(["exports"],we):(l=typeof globalThis<"u"?globalThis:l||self,we(l["canvas-editor"]={}))})(this,(function(l){"use strict";const we="0.5.3";l.MaxHeightRatio=void 0,(function(o){o.HALF="half",o.ONE_THIRD="one-third",o.QUARTER="quarter"})(l.MaxHeightRatio||(l.MaxHeightRatio={})),l.NumberType=void 0,(function(o){o.ARABIC="arabic",o.CHINESE="chinese"})(l.NumberType||(l.NumberType={})),l.ImageDisplay=void 0,(function(o){o.INLINE="inline",o.BLOCK="block",o.SURROUND="surround",o.FLOAT_TOP="float-top",o.FLOAT_BOTTOM="float-bottom"})(l.ImageDisplay||(l.ImageDisplay={})),l.LocationPosition=void 0,(function(o){o.BEFORE="before",o.AFTER="after",o.OUTER_BEFORE="outer-before",o.OUTER_AFTER="outer-after"})(l.LocationPosition||(l.LocationPosition={})),l.FlexDirection=void 0,(function(o){o.ROW="row",o.COLUMN="column"})(l.FlexDirection||(l.FlexDirection={}));const x="",Ei=`
|
|
3
3
|
`,ho=" ",Xi=" ",Nr=["·","、",":",":",",",",",".","。",";",";","?","?","!","!"],Ni={[l.MaxHeightRatio.HALF]:1/2,[l.MaxHeightRatio.ONE_THIRD]:1/3,[l.MaxHeightRatio.QUARTER]:1/4},go={ENGLISH:"A-Za-z",NUMBER:"0-9.$¥",SPANISH:"A-Za-zÁÉÍÓÚáéíóúÑñÜü",FRENCH:"A-Za-zÀÂÇàâçÉéÈèÊêËëÎîÏïÔôÙùÛûŸÿ",GERMAN:"A-Za-zÄäÖöÜüß",RUSSIAN:"А-Яа-яЁё",PORTUGUESE:"A-Za-zÁÉÍÓÚáéíóúÃÕãõÇç",ITALIAN:"A-Za-zÀàÈèÉéÌìÍíÎîÓóÒòÙù",DUTCH:"A-Za-zÀàÁáÂâÄäÈèÉéÊêËëÌìÍíÎîÏïÓóÒòÔôÖöÙùÛûÜü",SWEDISH:"A-Za-zÅåÄäÖö",GREEK:"ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσςΤτΥυΦφΧχΨψΩω"},Fr="中";l.RowFlex=void 0,(function(o){o.LEFT="left",o.CENTER="center",o.RIGHT="right",o.ALIGNMENT="alignment",o.JUSTIFY="justify"})(l.RowFlex||(l.RowFlex={}));const fo=/[0-9.]/,yr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/,Wr=/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,Vr=new RegExp(`${Wr.source}|${yr.source}`,"g"),br=/[、,。?!;:……「」“”‘’*()【】〔〕〖〗〘〙〚〛《》———﹝﹞–—\\/·.,!?;:`~<>()[\]{}'"|]/,To=new RegExp(`^[${x}
|
|
4
4
|
]`),Yr=/[^0-9\+\-\.eE,]/,Dr=/\s/;function Ur(o,t){let e;return function(...n){e&&window.clearTimeout(e),e=window.setTimeout(()=>{o.apply(this,n)},t)}}function wr(o,t){let e=0,n;return function(...i){const r=Date.now();r-e>=t?(window.clearTimeout(n),o.apply(this,i),e=r):(window.clearTimeout(n),n=window.setTimeout(()=>{o.apply(this,i),e=r},t))}}function mo(o,t){if(!o||typeof o!="object")return o;let e={};return Array.isArray(o)?e=o.map(n=>mo(n,t)):Object.keys(o).forEach(n=>{t.includes(n)||(e[n]=mo(o[n],t))}),e}function dt(o){if(typeof structuredClone=="function")return structuredClone(o);if(!o||typeof o!="object")return o;let t={};return Array.isArray(o)?t=o.map(e=>dt(e)):Object.keys(o).forEach(e=>{t[e]=dt(o[e])}),t}function po(o){return o&&o.nodeType===1&&o.tagName.toLowerCase()==="body"}function Lo(o,t,e){if(o&&!po(o))for(o=o;o;){if(!t||t(o)||po(o))return t&&!t(o)&&po(o)?null:o;o=o.parentNode}return null}function rt(){function o(){return((1+Math.random())*65536|0).toString(16).substring(1)}return o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()}function Rt(o){const t=[];if(Intl.Segmenter){const n=new Intl.Segmenter().segment(o);for(const{segment:i}of n)t.push(i)}else{const e=new Map;for(const i of o.matchAll(Vr))e.set(i.index,i[0]);let n=0;for(;n<o.length;){const i=e.get(n);i?(t.push(i),n+=i.length):(t.push(o[n]),n++)}}return t}function Fi(o,t){const e=document.createElement("a");e.href=o,e.download=t,e.click()}function Zr(o,t){Qr(3,o,t)}function Qr(o,t,e){let n=0,i=0;const r=function(s){n=new Date().getTime()-i<300?n+1:0,i=new Date().getTime(),n>=o-1&&(e(s),n=0)};t.addEventListener("click",r)}function bn(o){return Object.prototype.toString.call(o)==="[object Object]"}function Io(o){return Array.isArray(o)}function Po(o){return Object.prototype.toString.call(o)==="[object Number]"}function vr(o){return Object.prototype.toString.call(o)==="[object String]"}function yi(o,t){if(bn(o)&&bn(t)){const e=t;for(const[n,i]of Object.entries(o))e[n]?e[n]=yi(i,e[n]):e[n]=i}else Io(o)&&Io(t)&&t.push(...o);return t}function Mo(o){setTimeout(()=>{o()},0)}function Kr(o){const t=["零","一","二","三","四","五","六","七","八","九"],e=["","十","百","千","万","十","百","千","亿","十","百","千","万","十","百","千","亿"];if(!o||isNaN(o))return"零";const n=o.toString().split("");let i="";for(let r=0;r<n.length;r++){const s=n.length-1-r;i=`${e[r]}${i}`,i=`${t[Number(n[s])]}${i}`}return i=i.replace(/零(千|百|十)/g,"零").replace(/十零/g,"十"),i=i.replace(/零+/g,"零"),i=i.replace(/零亿/g,"亿").replace(/零万/g,"万"),i=i.replace(/亿万/g,"亿"),i=i.replace(/零+$/,""),i=i.replace(/^一十/g,"十"),i}function Ve(o,t,e){for(let n=0;n<o.length;n++){const i=o[n],r=t[i];r!==void 0?e[i]=r:delete e[i]}}function Wi(o,t){if(!(!t.length||!o.length))for(let e=o.length-1;e>=0;e--)t.includes(o[e])&&o.splice(e,1)}function bt(o,t){const e={};for(const n in o)t.includes(n)&&(e[n]=o[n]);return e}function oe(o,t){const e={};for(const n in o)t.includes(n)||(e[n]=o[n]);return e}function Hr(o){const e=new TextEncoder().encode(o),n=Array.from(e,r=>String.fromCharCode(r));return window.btoa(n.join(""))}function _r(o){let t=o.parentElement;for(;t;){const n=window.getComputedStyle(t).getPropertyValue("overflow-y");if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"))return t;t=t.parentElement}return document.documentElement}function Vi(o,t){return o.length!==t.length?!1:!o.some(e=>!t.includes(e))}function xr(o,t){if(!bn(o)||!bn(t))return!1;const e=Object.keys(o),n=Object.keys(t);return e.length!==n.length?!1:!e.some(i=>t[i]!==o[i])}function Gr(o,t){const e=o.x,n=o.x+o.width,i=o.y,r=o.y+o.height,s=t.x,a=t.x+t.width,c=t.y,d=t.y+t.height;return!(e>a||n<s||i>d||r<c)}function bi(o){return o==null}function Yn(o){return o.replace(/\r\n|\r/g,`
|
|
5
5
|
`)}function Yi(o,t,e=0){const n=Math.max(0,Math.floor(e));if(n>=o.length)return typeof t=="string"&&t===""?{index:o.length,length:0}:{index:-1,length:0};if(typeof t=="string"){if(t==="")return{index:n,length:0};const c=o.indexOf(t,n);return c===-1?{index:-1,length:0}:{index:c,length:t.length}}const i=t.flags,r=i.includes("g")?i:i+"g",s=new RegExp(t.source,r);s.lastIndex=n;const a=s.exec(o);return a?{index:a.index,length:a[0].length}:{index:-1,length:0}}function Di(o,t){if(!t){o.scrollTop=0;return}const e=[];let n=t.offsetParent;for(;n&&o!==n&&o.contains(n);)e.push(n),n=n.offsetParent;const i=t.offsetTop+e.reduce((c,d)=>c+d.offsetTop,0),r=i+t.offsetHeight,s=o.scrollTop,a=s+o.clientHeight;i<s?o.scrollTop=i:r>a&&(o.scrollTop=r-o.clientHeight)}const Ar=12,kr={width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},ce="editor-component",B="ce",gn=`${B}-clipboard`,Oo={print:{imagePreviewerDisabled:!1,backgroundDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}};var Ut;(function(o){o.UP="top",o.DOWN="down",o.LEFT="left",o.RIGHT="right"})(Ut||(Ut={}));const Ze=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),Jr=typeof navigator<"u"&&/iPad|iPhone/.test(navigator.userAgent),Br=/Mobile|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),$r=typeof navigator<"u"&&/Firefox/.test(navigator.userAgent);l.ElementType=void 0,(function(o){o.TEXT="text",o.TEXTFIELD="TextField",o.BUTTON="button",o.IMAGE="image",o.TABLE="table",o.HYPERLINK="hyperlink",o.SUPERSCRIPT="superscript",o.SUBSCRIPT="subscript",o.SEPARATOR="separator",o.PAGE_BREAK="pageBreak",o.CONTROL="control",o.AREA="area",o.CHECKBOX="checkbox",o.RADIO="radio",o.LATEX="latex",o.TAB="tab",o.DATE="date",o.BLOCK="block",o.TITLE="title",o.LIST="list",o.SPLIT_TAG="splitTag",o.LABEL="label",o.MENSTRUAL_HISTORY="menstrualHistory",o.FETAL_HEART_POSITION="fetalHeartPosition",o.TOOTH_POSITION="toothPosition",o.SPECIAL_SYMBOLS="specialSymbols",o.MACRO="macro",o.CUSTOM_MACRO="customMacro",o.REUSABLE_ITEM="reusableItem"})(l.ElementType||(l.ElementType={}));const de=["bold","color","highlight","font","size","italic","underline","strikeout","textDecoration","deletePerson","newElEditPerson","deleteTime","newElEditTime"],Jt=["rowFlex","rowMargin"],zr=["type","font","size","bold","color","italic","highlight","underline","strikeout","rowFlex","url","areaId","hyperlinkId","dateId","dateFormat","groupIds","rowMargin","textDecoration","deletePerson","newElEditPerson","deleteTime","newElEditTime"],jr=["type","font","size","bold","color","italic","highlight","underline","strikeout","rowFlex","rowMargin","dashArray","trList","tdPadding","tableToolDisabled","borderType","borderColor","borderWidth","borderExternalWidth","translateX","width","height","url","colgroup","valueList","control","checkbox","radio","dateFormat","block","level","title","listType","listStyle","listWrap","groupIds","conceptId","imgDisplay","imgFloatPosition","imgToolDisabled","imgPreviewDisabled","imgCrop","imgCaption","textDecoration","extension","externalId","areaId","area","hide","label","labelId","lineWidth","deletePerson","newElEditPerson","deleteTime","newElEditTime","dictCode","macroConfig","menstrualData","menstrualHistoryId","fetalHeartData","fetalHeartPositionId","toothPositionData","toothPositionId","reusableItemConfig"],qr=["conceptId","extension","externalId","verticalAlign","backgroundColor","borderTypes","slashTypes","disabled","deletable"],ke=["tdId","trId","tableId"],Co=["level","titleId","title"],fn=["listId","listType","listStyle"],So=["control","controlId","controlComponent"],_t=["font","size","bold","highlight","italic","strikeout","deletePerson","newElEditPerson","deleteTime","color","newElEditTime"],Qe=["areaId","area"],Eo=[...ke,...Co,...fn,...Qe],Bt=[l.ElementType.TEXT,l.ElementType.HYPERLINK,l.ElementType.SUBSCRIPT,l.ElementType.SUPERSCRIPT,l.ElementType.CONTROL,l.ElementType.DATE],tl=[l.ElementType.IMAGE,l.ElementType.LATEX],el=[l.ElementType.BLOCK,l.ElementType.PAGE_BREAK,l.ElementType.SEPARATOR,l.ElementType.TABLE],nl=["HR","TABLE","UL","OL"],ol=[l.ElementType.TITLE,l.ElementType.LIST];class Je{static sandbox=["allow-scripts","allow-same-origin"];static allow=["fullscreen"];element;constructor(t){this.element=t}_defineIframeProperties(t){Object.defineProperties(t,{parent:{get:()=>null},__POWERED_BY_CANVAS_EDITOR__:{get:()=>!0}})}render(t){const{iframeBlock:e}=this.element.block||{},n=document.createElement("iframe");n.setAttribute("data-id",this.element.id),n.sandbox.add(...e?.sandbox||Je.sandbox),n.setAttribute("allow",[e?.allow||Je.allow].join(" ")),n.style.border="none",n.style.width="100%",n.style.height="100%",e?.src?n.src=e.src:e?.srcdoc&&(n.srcdoc=e.srcdoc),t.append(n),this._defineIframeProperties(n.contentWindow)}}class Ui{draw;options;imageCache;container;floatImageContainer;floatImage;constructor(t){this.draw=t,this.options=t.getOptions(),this.container=t.getContainer(),this.imageCache=new Map,this.floatImageContainer=null,this.floatImage=null}getOriginalMainImageList(){const t=[],e=n=>{for(const i of n)if(i.type===l.ElementType.TABLE){const r=i.trList;for(let s=0;s<r.length;s++){const a=r[s];for(let c=0;c<a.tdList.length;c++){const d=a.tdList[c];e(d.value)}}}else i.type===l.ElementType.IMAGE&&t.push(i)};return e(this.draw.getOriginalMainElementList()),t}_countImagesBeforeTarget(t,e){let n=0;for(const i of t){if(i===e)break;if(i.type===l.ElementType.TABLE){const r=i.trList;for(const s of r)for(const a of s.tdList)n+=this._countImagesBeforeTarget(a.value,e)}else i.type===l.ElementType.IMAGE&&n++}return n}createFloatImage(t){const{scale:e}=this.options;let n=this.floatImageContainer,i=this.floatImage;n||(n=document.createElement("div"),n.classList.add(`${B}-float-image`),this.container.append(n),this.floatImageContainer=n),i||(i=document.createElement("img"),n.append(i),this.floatImage=i),n.style.display="none",i.style.width=`${t.width*e}px`,i.style.height=`${t.height*e}px`;const r=this.draw.getHeight(),s=this.draw.getPageGap(),a=this.draw.getPageNo()*(r+s),c=t.imgFloatPosition;n.style.left=`${c.x*e}px`,n.style.top=`${a+c.y*e}px`,i.src=t.value}dragFloatImage(t,e){if(!this.floatImageContainer)return;this.floatImageContainer.style.display="block";const n=parseFloat(this.floatImageContainer.style.left)+t,i=parseFloat(this.floatImageContainer.style.top)+e;this.floatImageContainer.style.left=`${n}px`,this.floatImageContainer.style.top=`${i}px`}destroyFloatImage(){this.floatImageContainer&&(this.floatImageContainer.style.display="none")}addImageObserver(t){this.draw.getImageObserver().add(t)}getFallbackImage(t,e){const i=(t-Math.ceil(t/8)*8)/2,r=(e-Math.ceil(e/8)*8)/2,s=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${e}" viewBox="0 0 ${t} ${e}">
|
|
@@ -181,7 +181,7 @@ ${u} `}textToElements(t){const e=[],n=t.split(`
|
|
|
181
181
|
<button class="btn-confirm">确认</button>
|
|
182
182
|
</div>
|
|
183
183
|
</div>
|
|
184
|
-
`,document.body.appendChild(this.inputModal);const e=this.inputModal.querySelector(".menstrual-history-modal__mask"),n=this.inputModal.querySelector(".menstrual-history-modal__container"),i=this.inputModal.querySelector(".menstrual-history-modal__close"),r=this.inputModal.querySelector(".btn-cancel"),s=this.inputModal.querySelector(".btn-confirm"),a=this.inputModal.querySelector("#mh-edit-notMenopause"),c=this.inputModal.querySelector("#mh-edit-isMenopauseForm"),d=this.inputModal.querySelectorAll('input[name="mh-edit-isMenopause"]'),R=()=>{this.closeModal()};n.addEventListener("click",u=>{u.stopPropagation()}),e.addEventListener("click",R),i.addEventListener("click",R),r.addEventListener("click",R),d.forEach(u=>{u.addEventListener("change",()=>{const h=u.value==="true";a.style.display=h?"none":"block",c.style.display=h?"block":"none"})}),s.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation();const h=this.inputModal;if(!h)return;const g=h.querySelector('input[name="mh-edit-isMenopause"]:checked')?.value==="true";let f;g?f={isMenopause:!0,periodMin:h.querySelector("#mh-edit-periodMin2")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax2")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge2")?.value||"_",menopauseAge:h.querySelector("#mh-edit-menopauseAge")?.value||"_",cycleMin:h.querySelector("#mh-edit-cycleMin2")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax2")?.value||"_"}:f={isMenopause:!1,periodMin:h.querySelector("#mh-edit-periodMin")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge1")?.value||"_",lastPeriod:h.querySelector("#mh-edit-lastPeriod")?.value||"____-__-__",cycleMin:h.querySelector("#mh-edit-cycleMin")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax")?.value||"_"};const T=this.control.getElementList(),m=this.element.controlId;for(let M=0;M<T.length;M++){const O=T[M];O.controlId===m&&O.control&&(O.control.menstrualData=f)}const p=this.generateDisplayText(f),I=this.textToElements(p);this.closeModal();const L=this.setValue(I);L!==-1&&(this.control.repaintControl({curIndex:L}),this.control.emitControlContentChange({}))})}closeModal(){this.inputModal&&(this.inputModal.remove(),this.inputModal=null),this.isPopup=!1}destroy(){this.closeModal()}}class Rh{controlBorder;textFieldUnderline;draw;range;listener;eventBus;controlSearch;options;controlOptions;activeControl;activeControlValue;preElement;constructor(t){this.controlBorder=new lc(t),this.textFieldUnderline=new uh(t),this.draw=t,this.range=t.getRange(),this.listener=t.getListener(),this.eventBus=t.getEventBus(),this.controlSearch=new rc(this),this.options=t.getOptions(),this.controlOptions=this.options.control,this.activeControl=null,this.activeControlValue=[],this.preElement=null}setHighlightList(t){this.controlSearch.setHighlightList(t)}computeHighlightList(){this.controlSearch.getHighlightList().length&&this.controlSearch.computeHighlightList()}renderHighlightList(t,e){this.controlSearch.getHighlightMatchResult().length&&this.controlSearch.renderHighlightList(t,e)}getDraw(){return this.draw}filterAssistElement(t){return t.filter((e,n)=>{if(e.type===l.ElementType.TABLE){const i=e.trList;for(let r=0;r<i.length;r++){const s=i[r];for(let a=0;a<s.tdList.length;a++){const c=s.tdList[a];c.value=this.filterAssistElement(c.value)}}}if(!e.controlId)return!0;if(e.control?.type===l.ControlType.MENSTRUAL_HISTORY&&this.options.mode===l.EditorMode.PRINT&&(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)||e.control?.type===l.ControlType.SELECT&&this.options.mode===l.EditorMode.PRINT&&(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)||e.control?.type===l.ControlType.NUMBER&&this.options.mode===l.EditorMode.PRINT&&(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)||e.control?.type===l.ControlType.TEXT&&this.options.mode===l.EditorMode.PRINT&&e.strikeout&&e.deletePerson)return!1;if(e.control?.minWidth){if(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)return e.value="",!0}else{const i=this.options.mode===l.EditorMode.FORM;if(e.control?.preText&&e.controlComponent===l.ControlComponent.PRE_TEXT){if(i)return!0;let r=!1,s=n+1;for(;s<t.length;){const a=t[s];if(e.controlId!==a.controlId)break;if(a.controlComponent===l.ControlComponent.VALUE){r=!0;break}s++}return r}if(e.control?.postText&&e.controlComponent===l.ControlComponent.POST_TEXT){if(i)return!0;let r=!1,s=n-1;for(;s<t.length;){const a=t[s];if(e.controlId!==a.controlId)break;if(a.controlComponent===l.ControlComponent.VALUE){r=!0;break}s--}return r}}if(e.control?.preTextFix&&e.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){let i=!1,r=n+1;for(;r<t.length;){const s=t[r];if(e.controlId!==s.controlId)break;if(s.controlComponent===l.ControlComponent.VALUE){i=!0;break}r++}return i}if(e.control?.postTextFix&&e.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){let i=!1,r=n-1;for(;r<t.length;){const s=t[r];if(e.controlId!==s.controlId)break;if(s.controlComponent===l.ControlComponent.VALUE){i=!0;break}r--}return i}return e.controlComponent!==l.ControlComponent.PREFIX&&e.controlComponent!==l.ControlComponent.POSTFIX&&e.controlComponent!==l.ControlComponent.PLACEHOLDER&&e.controlComponent!==l.ControlComponent.PRETEXTFIX&&e.controlComponent!==l.ControlComponent.POSTTEXTFIX&&e.controlComponent!==l.ControlComponent.TEXTFIXLABEL})}getIsRangeCanCaptureEvent(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(!~t&&!~e)return!1;const n=this.getElementList(),i=n[t];if(i.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;if(t===e&&t>0){const s=n[t-1],a=s?.controlComponent===l.ControlComponent.POSTFIX||s?.controlComponent===l.ControlComponent.POSTTEXTFIX,c=s?.controlComponent===l.ControlComponent.PLACEHOLDER,d=!!s?.controlId,R=!!s?.originControlId;let u=!1;if(R){const p=s.originControlId;for(let I=t;I<n.length;I++){const L=n[I];if(L.controlId===p&&!L.originControlId){u=!0;break}if(L.controlId&&L.controlId!==p&&L.originControlId!==p)break}}const g=this.draw.getPosition().getPositionList(),f=g[t],T=g[t-1],m=f&&T&&f.rowIndex===T.rowIndex;if((a||c)&&d&&m&&!u)return!1}if(t===e&&(i.controlComponent===l.ControlComponent.POSTFIX||i.controlComponent===l.ControlComponent.POSTTEXTFIX))return!0;const r=n[e];return!!(i.controlId&&i.controlId===r.controlId&&r.controlComponent!==l.ControlComponent.POSTFIX&&r.controlComponent!==l.ControlComponent.POSTTEXTFIX)}getIsRangeInPostfix(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(t!==e)return!1;const i=this.getElementList()[t];return i.controlComponent===l.ControlComponent.POSTFIX||i.controlComponent===l.ControlComponent.POSTTEXTFIX}getIsRangeWithinControl(){const{range:{startIndex:t,endIndex:e},elementList:n}=this.range.getRangeElement();if(!~t&&!~e)return!1;const i=n[t],r=n[e];if(i?.controlId&&i.controlId===r.controlId&&r.controlComponent!==l.ControlComponent.POSTFIX&&r.controlComponent!==l.ControlComponent.POSTTEXTFIX&&r.controlComponent!==l.ControlComponent.POSTTEXTFIX_TEXT&&r.controlComponent!==l.ControlComponent.POST_TEXT)return!0;if(r?.originControlId&&(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)){const s=r.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===s)return!0;if(c.controlId&&c.controlId!==s&&c.originControlId!==s)break}}if(!r?.originControlId&&r?.controlId&&(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)){const s=n[e+1];if(s?.controlId&&s.controlId!==r.controlId&&(s.controlComponent===l.ControlComponent.PREFIX||s.controlComponent===l.ControlComponent.PRETEXTFIX))return!0;if(s?.controlId&&s.controlId!==r.controlId&&(s.controlComponent===l.ControlComponent.POSTFIX||s.controlComponent===l.ControlComponent.POSTTEXTFIX))return s.originControlId,!0;for(let a=e;a>=0;a--){const c=n[a];if(c.controlId===r.controlId&&(c.controlComponent===l.ControlComponent.PREFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX)){for(let d=a-1;d>=0;d--){const R=n[d];if(R.controlId&&R.controlId!==r.controlId&&(R.controlComponent===l.ControlComponent.PRETEXTFIX||R.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||R.controlComponent===l.ControlComponent.PREFIX||R.controlComponent===l.ControlComponent.PRE_TEXT))return!0;if(R.controlId&&R.controlId!==r.controlId&&(R.controlComponent===l.ControlComponent.POSTFIX||R.controlComponent===l.ControlComponent.POSTTEXTFIX))break}break}}}if(r?.originControlId){const s=r.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===s)return!0;if(c.controlId&&c.controlId!==s&&c.originControlId!==s)break}}if(!i?.controlId&&this.activeControl){const a=this.activeControl.getElement()?.controlId;if(a)for(let c=t;c>=0;c--){const d=n[c];if(d.controlId===a&&!d.originControlId){if(d.controlComponent===l.ControlComponent.PRETEXTFIX||d.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||d.controlComponent===l.ControlComponent.PREFIX||d.controlComponent===l.ControlComponent.PRE_TEXT)for(let R=e;R<n.length;R++){const u=n[R];if(u.controlId===a&&!u.originControlId){if(u.controlComponent===l.ControlComponent.POSTTEXTFIX||u.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||u.controlComponent===l.ControlComponent.POSTFIX||u.controlComponent===l.ControlComponent.POST_TEXT)return!0;break}}break}}}return!1}getIsElementListContainFullControl(t){if(!t.some(i=>i.controlId))return!1;let e=0,n=0;for(let i=0;i<t.length;i++){const r=t[i];r.controlComponent===l.ControlComponent.PREFIX||r.controlComponent===l.ControlComponent.PRETEXTFIX?e++:(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)&&n++}return!e||!n?!1:e===n}getIsDisabledControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();if(e===n&&~e&&~n){const r=(t.elementList||this.getElementList())[e];if(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)return!1}return!!this.activeControl.getElement()?.control?.disabled}getIsDisabledPasteControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();return e===n&&~e&&~n&&(t.elementList||this.getElementList())[e].controlComponent===l.ControlComponent.POSTFIX?!1:!!this.activeControl.getElement()?.control?.pasteDisabled}getIsExistValueByElementListIndex(t,e){const n=t[e];if(!n.controlId)return!1;if(n.control?.type===l.ControlType.CHECKBOX||n.control?.type===l.ControlType.RADIO)return!!n.control?.code;if(n.controlComponent===l.ControlComponent.VALUE)return!0;if(n.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;if(n.controlComponent===l.ControlComponent.PREFIX||n.controlComponent===l.ControlComponent.PRE_TEXT){let i=e+1;for(;i<t.length;){const r=t[i];if(r.controlId!==n.controlId)return!1;if(r.controlComponent===l.ControlComponent.VALUE)return!0;if(r.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;i++}}if(n.controlComponent===l.ControlComponent.PRETEXTFIX||n.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){let i=e+1;for(;i<t.length;){const r=t[i];if(r.controlId!==n.controlId)return!1;if(r.controlComponent===l.ControlComponent.VALUE)return!0;if(r.controlComponent===l.ControlComponent.PLACEHOLDER||r.controlComponent===l.ControlComponent.TEXTFIXLABEL)return!1;i++}}if(n.controlComponent===l.ControlComponent.POSTFIX||n.controlComponent===l.ControlComponent.POSTTEXTFIX){let i=e-1;for(;i>=0;){const r=t[i];if(r.controlId!==n.controlId)return!1;if(r.controlComponent===l.ControlComponent.VALUE)return!0;if(r.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;i--}}return!1}getControlHighlight(t,e){return this.controlSearch.getControlHighlight(t,e)}getContainer(){return this.draw.getContainer()}getElementList(){return this.draw.getElementList()}getPosition(){const t=this.draw.getPosition().getPositionList(),{endIndex:e}=this.range.getRange();return t[e]||null}getPreY(){const t=this.draw.getHeight(),e=this.draw.getPageGap();return(this.getPosition()?.pageNo??this.draw.getPageNo())*(t+e)}getRange(){return this.range.getRange()}getValueRange(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];let r=n;for(;r>0;){const a=e[r];if(a.controlId!==i.controlId||a.controlComponent===l.ControlComponent.PREFIX||a.controlComponent===l.ControlComponent.PRE_TEXT||a.controlComponent===l.ControlComponent.PRETEXTFIX||a.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)break;r--}let s=n+1;for(;s<e.length;){const a=e[s];if(a.controlId!==i.controlId||a.controlComponent===l.ControlComponent.POSTFIX||a.controlComponent===l.ControlComponent.POST_TEXT||a.controlComponent===l.ControlComponent.POSTTEXTFIX||a.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT)break;s++}return r===s?null:{startIndex:r,endIndex:s-1}}shrinkBoundary(t={}){this.range.shrinkBoundary(t)}getActiveControl(){return this.activeControl}getActiveTextControlLimit(){if(!this.activeControl)return null;const t=this.activeControl.getElement(),e=t?.controlId,n=t?.originControlId||null;if(!e||t.control?.type!==l.ControlType.TEXT)return null;const i=this.getElementList(),r=n||null;let s=-1,a=-1,c=-1,d=-1;for(let h=0;h<i.length;h++){const g=i[h];g.controlId!==e||(n?g.originControlId!==n:g.originControlId)||(s===-1&&(s=h),a=h,(g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT||g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)&&(c=h),d===-1&&(g.controlComponent===l.ControlComponent.POSTFIX||g.controlComponent===l.ControlComponent.POST_TEXT||g.controlComponent===l.ControlComponent.POSTTEXTFIX||g.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT)&&(d=h))}if(s===-1)return null;const R=c!==-1?c:s,u=d!==-1?d-1:a;return{controlId:e,originControlId:n,parentControlId:r,startIndex:R,endIndex:u<R?R:u}}getActiveNestedTextLimit(){const t=this.getActiveTextControlLimit();return!t?.parentControlId||!this.getElementList().some(n=>n.controlId===t.parentControlId&&!n.originControlId&&n.control?.type===l.ControlType.TEXTFIELD)?null:{controlId:t.controlId,parentControlId:t.parentControlId,startIndex:t.startIndex,endIndex:t.endIndex}}getControlElementList(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];if(!i?.controlId)return[];const r=[];let s=n;for(;s>0;){const c=e[s];if(c.controlId!==i.controlId)break;r.unshift(c),s--}let a=n+1;for(;a<e.length;){const c=e[a];if(c.controlId!==i.controlId)break;r.push(c),a++}return r}updateActiveControlValue(){this.activeControl&&(this.activeControlValue=this.getControlElementList())}emitControlChange(t){if(!this.activeControl)return;const e=this.eventBus.isSubscribe("controlChange");if(!this.listener.controlChange&&!e)return;let n;const i=this.activeControlValue,r=this.activeControl.getElement();i?.length?n=i[0].control:(n=be(dt(r)).control,n.value=[]);const s={state:t,control:n,controlId:r.controlId};this.listener.controlChange?.(s),e&&this.eventBus.emit("controlChange",s)}initControl(){const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex];if(this.activeControl){if(this.activeControl instanceof pn||this.activeControl instanceof yn||this.activeControl instanceof Wn||this.activeControl instanceof Ge){const g=this.activeControl.getElement();n?.controlId!==g?.controlId?this.destroyControl():n.controlComponent===l.ControlComponent.POSTFIX?this.activeControl.destroy():this.activeControl.awake()}const R=this.activeControl.getElement(),u=n.controlId,h=R.controlId;if(u&&u===h){this.updateActiveControlValue(),this.preElement=n;return}if(n.originControlId&&n.originControlId===h&&!(this.activeControl.getElement()?.control?.type===l.ControlType.TEXTFIELD&&n.controlId!==h)){this.updateActiveControlValue(),this.preElement=n;return}if(n.originControlId&&n.controlId&&n.controlId,!n.originControlId&&n.controlId&&n.controlId!==h&&(this.activeControl.getElement()?.originControlId,n.controlId),n.controlId&&n.controlId===h&&n.originControlId){this.updateActiveControlValue(),this.preElement=n;return}if(!u){const g=this.getElementList(),f=this.getRange(),{startIndex:T}=f;let m=null;for(let p=T;p>=0;p--){const I=g[p];if(I.controlComponent===l.ControlComponent.PRETEXTFIX||I.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||I.controlComponent===l.ControlComponent.PREFIX||I.controlComponent===l.ControlComponent.PRE_TEXT){m=I.controlId||null;break}if(I.controlId&&I.controlId!==h||I.controlComponent===l.ControlComponent.POSTTEXTFIX||I.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||I.controlComponent===l.ControlComponent.POSTFIX||I.controlComponent===l.ControlComponent.POST_TEXT)break}if(m===h){this.updateActiveControlValue(),this.preElement=n;return}}}if(this.destroyControl(),this.draw.isReadonly())return;let r=n.control,s=n;if(n.originControlId&&!r){const R=n.originControlId;for(let u=this.range.getRange().startIndex;u>=0;u--){const h=t[u];if(h.controlId===R&&!h.originControlId&&h.control){r=h.control,s=h;break}if(h.controlId===R&&!h.originControlId&&(h.controlComponent===l.ControlComponent.PRETEXTFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||h.controlComponent===l.ControlComponent.PREFIX||h.controlComponent===l.ControlComponent.PRE_TEXT)){h.control&&(r=h.control,s=h);break}}}else if(!r&&n.controlId){const R=this.getElementList();for(let u=this.range.getRange().startIndex;u>=0;u--){const h=R[u];if(h.controlId!==n.controlId)break;if(h.control){r=h.control,s=h;break}if(h.controlComponent===l.ControlComponent.PRETEXTFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||h.controlComponent===l.ControlComponent.PREFIX||h.controlComponent===l.ControlComponent.PRE_TEXT)break}}if(!r)return;if(r?.type===l.ControlType.TEXTFIELD&&this.draw.getMode()!==l.EditorMode.EDIT)if(n.originControlId){const R=n.controlId;for(let u=this.range.getRange().startIndex;u>=0;u--){const h=t[u];if(h.controlId===R&&h.originControlId===n.originControlId&&h.control&&h.control.type!==l.ControlType.TEXTFIELD){r=h.control,s=h;break}if(h.controlComponent===l.ControlComponent.PREFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX)break}if(r?.type===l.ControlType.TEXTFIELD)return}else return;const a=this.draw.getPosition().getPositionContext(),c=this.range.getRange().startIndex,d=!!(a.isDirectHit&&a.index===c&&t[a.index]?.controlId===s.controlId);if(r?.type===l.ControlType.TEXTFIELD)this.activeControl=new ar(s,this);else if(r.type===l.ControlType.TEXT)this.activeControl=new Mi(s,this);else if(r.type===l.ControlType.SELECT){const R=new pn(s,this);this.activeControl=R,(d||this.draw.getMode()===l.EditorMode.FORM)&&R.awake()}else if(r.type===l.ControlType.CHECKBOX)this.activeControl=new vn(s,this);else if(r.type===l.ControlType.RADIO)this.activeControl=new Zo(s,this);else if(r.type===l.ControlType.DATE){const R=new yn(s,this);this.activeControl=R,R.awake()}else if(r.type===l.ControlType.NUMBER){const R=new Wn(s,this);this.activeControl=R,d&&R.awake()}else if(r.type===l.ControlType.BUTTON){const R=new Ge(s,this);if(this.activeControl=R,d){R.awake();return}}else if(r.type===l.ControlType.MENSTRUAL_HISTORY){const R=new cr(s,this);this.activeControl=R,R.awake()}this.updateActiveControlValue(),this.preElement=s,s.controlComponent!==l.ControlComponent.POSTFIX&&s.controlComponent!==l.ControlComponent.POSTTEXTFIX&&this.emitControlChange(l.ControlState.ACTIVE)}destroyControl(t={}){if(!this.activeControl)return;const{isEmitEvent:e=!0}=t;(this.activeControl instanceof pn||this.activeControl instanceof yn||this.activeControl instanceof Wn||this.activeControl instanceof cr)&&this.activeControl.destroy(),e&&this.preElement?.controlComponent!==l.ControlComponent.POSTFIX&&this.preElement?.controlComponent!==l.ControlComponent.POSTTEXTFIX&&this.emitControlChange(l.ControlState.INACTIVE),this.preElement=null,this.activeControl=null,this.activeControlValue=[]}repaintControl(t={}){const{curIndex:e,isCompute:n=!0,isSubmitHistory:i=!0,isSetCursor:r=!0}=t;e===void 0?(this.range.clearRange(),this.draw.render({isCompute:n,isSubmitHistory:i,isSetCursor:!1})):(this.range.setRange(e,e),this.draw.render({curIndex:e,isCompute:n,isSetCursor:r,isSubmitHistory:i}))}emitControlContentChange(t){const e=this.eventBus.isSubscribe("controlContentChange");if(!e&&!this.listener.controlContentChange)return;const n=t?.controlElement||this.activeControl?.getElement();if(!n)return;const i=t?.context?.elementList||this.getElementList(),{startIndex:r}=t?.context?.range||this.getRange();if(!i[r]?.controlId)return;const s=t?.controlValue||this.getControlElementList(t?.context);let a;if(s?.length?a=Pt(s)[0].control:(a=n.control,a.value=[]),!a)return;const c={control:a,controlId:n.controlId};this.listener.controlContentChange?.(c),e&&this.eventBus.emit("controlContentChange",c)}reAwakeControl(){if(!this.activeControl)return;const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex];this.activeControl.setElement(n),(this.activeControl instanceof yn||this.activeControl instanceof pn)&&this.activeControl.getIsPopup()&&(this.activeControl.destroy(),this.activeControl.awake())}selectValue(){const t=this.getElementList(),{startIndex:e}=this.getRange(),n=t[e];if(!n?.controlId||n.controlComponent!==l.ControlComponent.VALUE&&t[e+1]?.controlComponent===l.ControlComponent.VALUE)return!1;let i=e;for(;i>0&&t[i].controlComponent===l.ControlComponent.VALUE;)i--;let r=e+1;for(;r<t.length;){if(t[r].controlComponent!==l.ControlComponent.VALUE){r--;break}r++}if(i!==r){const s=this.range.getRange();return this.range.replaceRange({...s,startIndex:i,endIndex:r}),this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1}),!0}return!1}moveCursor(t){const{index:e,trIndex:n,tdIndex:i,tdValueIndex:r}=t;let s=this.draw.getOriginalElementList(),a;const c=t.isTable?r:e;if(t.isTable?(s=s[e].trList[n].tdList[i].value,a=s[r]):a=s[e],a.control?.hide||a.area?.hide){const d=mn(s,c);return{newIndex:d,newElement:s[d]}}if(a.controlComponent===l.ControlComponent.VALUE)return{newIndex:c,newElement:a};if(a.controlComponent===l.ControlComponent.POSTFIX){let d=c+1;for(;d<s.length;){if(s[d].controlId!==a.controlId)return{newIndex:d-1,newElement:s[d-1]};if(d===s.length-1)return{newIndex:d,newElement:s[d]};d++}}else if(a.controlComponent===l.ControlComponent.PREFIX||a.controlComponent===l.ControlComponent.PRE_TEXT){let d=c+1;for(;d<s.length;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent!==l.ControlComponent.PREFIX&&R.controlComponent!==l.ControlComponent.PRE_TEXT)return{newIndex:d-1,newElement:s[d-1]};d++}}else if(a.controlComponent===l.ControlComponent.PLACEHOLDER){let d=c-1;for(;d>0;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent===l.ControlComponent.VALUE||R.controlComponent===l.ControlComponent.PREFIX||R.controlComponent===l.ControlComponent.PRE_TEXT||R.controlComponent===l.ControlComponent.PRETEXTFIX||R.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:s[d]};d--}}else if(a.controlComponent===l.ControlComponent.POST_TEXT||a.controlComponent===l.ControlComponent.TEXTFIXLABEL||a.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){let d=c-1;for(;d>0;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent===l.ControlComponent.VALUE||R.controlComponent===l.ControlComponent.PREFIX||R.controlComponent===l.ControlComponent.PRE_TEXT||R.controlComponent===l.ControlComponent.PRETEXTFIX||R.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:s[d]};d--}}else if(a.controlComponent===l.ControlComponent.POSTTEXTFIX){let d=c+1;for(;d<s.length;){if(s[d].controlId!==a.controlId)return{newIndex:d-1,newElement:s[d-1]};if(d===s.length-1)return{newIndex:d,newElement:s[d]};d++}}else if(a.controlComponent===l.ControlComponent.PRETEXTFIX||a.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){let d=c+1;for(;d<s.length;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent!==l.ControlComponent.PRETEXTFIX&&R.controlComponent!==l.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d-1,newElement:s[d-1]};d++}}return{newIndex:c,newElement:a}}removeControl(t,e={}){const n=e.elementList||this.getElementList(),i=n[t];if(!this.draw.isDesignMode()&&!i?.control?.hide&&!i?.area?.hide){const{deletable:L=!0}=i.control;if(!L)return null;const M=this.draw.getMode();if(M===l.EditorMode.FORM&&this.options.modeRule[M].controlDeletableDisabled)return null}let r=-1,s=-1;const a=!!i.originControlId,c=i.controlId,d=i.originControlId,R=i.control?.type===l.ControlType.BUTTON&&!i.control?.buttonText?`${c}_text`:"";let u=t;for(;u>=0;){const L=n[u];let M=!1;if(a?M=L.controlId===c&&L.originControlId===d:M=L.controlId===c&&!L.originControlId,!M){r=u;break}u--}let h=t;for(;h<n.length;){const L=n[h];let M=!1;if(a?M=L.controlId===c&&L.originControlId===d:M=L.controlId===c&&!L.originControlId,!M){s=h-1;break}h++}if(h===n.length&&(s=h-1),!~r&&!~s)return t;r=~r?r:0;const g=n[r+1],f=g.control,T=f?.type&&[l.ControlType.TEXT,l.ControlType.TEXTFIELD,l.ControlType.DATE,l.ControlType.NUMBER,l.ControlType.SELECT,l.ControlType.BUTTON].includes(f.type);let m=n[0]?.type===l.ElementType.SPLIT_TAG;if(!e.removeNext&&T&&!a&&g.controlComponent!==l.ControlComponent.PREFIX&&g.type!==l.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const L=this.draw.getTd();L&&this.createRemoveControlHandler(L,i.controlId,!0)}if(!e.removeNext&&T&&!a&&g.controlComponent!==l.ControlComponent.PRETEXTFIX&&g.type!==l.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const L=this.draw.getTd();L&&this.createRemoveControlHandler(L,i.controlId,!0)}if(!e.removePrev&&T&&!a&&n[s].controlComponent!==l.ControlComponent.POSTFIX)if(e.removeNext)e.removeNext();else{const L=this.draw.getTd();m=!!L?.linkTdNextId,L&&this.createRemoveControlHandler(L,i.controlId,!1)}if(!e.removePrev&&T&&!a&&n[s].controlComponent!==l.ControlComponent.POSTTEXTFIX)if(e.removeNext)e.removeNext();else{const L=this.draw.getTd();m=!!L?.linkTdNextId,L&&this.createRemoveControlHandler(L,i.controlId,!1)}this.draw.spliceElementList(n,r+1,s-r);let p=0;if(R)for(let L=n.length-1;L>=0;L--)n[L].controlId===R&&(L<=r&&p++,n.splice(L,1));const I=r-p;return!e.elementList&&m&&r===0?this.draw.fixPosition(!0)??I:I}createRemoveControlHandler(t,e,n){if(n){const i=this.draw.getTdById(t.linkTdPrevId);i&&i.value.splice(-1)[0]?.controlId===e&&this.removeControl(i.value.length-1,{elementList:i.value,removePrev:()=>{this.createRemoveControlHandler(i,e,n)}})}else{const i=this.draw.getTdById(t.linkTdNextId);i&&i.value[1]?.controlId===e&&this.removeControl(1,{elementList:i.value,removeNext:()=>{this.createRemoveControlHandler(i,e,n)}})}}removePlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],r=n[t+1];if(i.controlComponent===l.ControlComponent.PLACEHOLDER||i.controlComponent===l.ControlComponent.TEXTFIXLABEL||r?.controlComponent===l.ControlComponent.PLACEHOLDER||r?.controlComponent===l.ControlComponent.TEXTFIXLABEL){let s=!1,a=t;for(;a<n.length;){const c=n[a];if(c.controlId!==i.controlId)break;c.controlComponent===l.ControlComponent.PLACEHOLDER||c.controlComponent===l.ControlComponent.TEXTFIXLABEL?(s||(s=!0,this.draw.getHistoryManager().popUndo(),this.draw.submitHistory(t)),n.splice(a,1)):a++}}}addPlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],r=i.control;if(!r.placeholder)return;let s=t;for(;s>=0;){const g=n[s];if(g.controlId!==i.controlId){s++;break}if(g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT||g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)break;s--}s<0&&(s=0);const a=s+1;if(a<n.length){const g=n[a];if(g.controlId===i.controlId&&(g.controlComponent===l.ControlComponent.PLACEHOLDER||g.controlComponent===l.ControlComponent.VALUE))return}let c=!1,d=s+1;for(;d<n.length;){const g=n[d];if(g.controlId===i.controlId){if(g.controlComponent===l.ControlComponent.POSTFIX||g.controlComponent===l.ControlComponent.POST_TEXT||g.controlComponent===l.ControlComponent.POSTTEXTFIX||g.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT)break}else if(g.controlId!==i.controlId&&(g.controlComponent===l.ControlComponent.VALUE||g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT)){c=!0;break}d++}if(c)return;const R=Rt(r.placeholder),u=bt(i,_t),h=s+1;for(let g=0;g<R.length;g++){const f=R[g],T={...u,value:f===`
|
|
184
|
+
`,document.body.appendChild(this.inputModal);const e=this.inputModal.querySelector(".menstrual-history-modal__mask"),n=this.inputModal.querySelector(".menstrual-history-modal__container"),i=this.inputModal.querySelector(".menstrual-history-modal__close"),r=this.inputModal.querySelector(".btn-cancel"),s=this.inputModal.querySelector(".btn-confirm"),a=this.inputModal.querySelector("#mh-edit-notMenopause"),c=this.inputModal.querySelector("#mh-edit-isMenopauseForm"),d=this.inputModal.querySelectorAll('input[name="mh-edit-isMenopause"]'),R=()=>{this.closeModal()};n.addEventListener("click",u=>{u.stopPropagation()}),e.addEventListener("click",R),i.addEventListener("click",R),r.addEventListener("click",R),d.forEach(u=>{u.addEventListener("change",()=>{const h=u.value==="true";a.style.display=h?"none":"block",c.style.display=h?"block":"none"})}),s.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation();const h=this.inputModal;if(!h)return;const g=h.querySelector('input[name="mh-edit-isMenopause"]:checked')?.value==="true";let f;g?f={isMenopause:!0,periodMin:h.querySelector("#mh-edit-periodMin2")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax2")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge2")?.value||"_",menopauseAge:h.querySelector("#mh-edit-menopauseAge")?.value||"_",cycleMin:h.querySelector("#mh-edit-cycleMin2")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax2")?.value||"_"}:f={isMenopause:!1,periodMin:h.querySelector("#mh-edit-periodMin")?.value||"_",periodMax:h.querySelector("#mh-edit-periodMax")?.value||"_",menarcheAge:h.querySelector("#mh-edit-menarcheAge1")?.value||"_",lastPeriod:h.querySelector("#mh-edit-lastPeriod")?.value||"____-__-__",cycleMin:h.querySelector("#mh-edit-cycleMin")?.value||"_",cycleMax:h.querySelector("#mh-edit-cycleMax")?.value||"_"};const T=this.control.getElementList(),m=this.element.controlId;for(let M=0;M<T.length;M++){const O=T[M];O.controlId===m&&O.control&&(O.control.menstrualData=f)}const p=this.generateDisplayText(f),I=this.textToElements(p);this.closeModal();const L=this.setValue(I);L!==-1&&(this.control.repaintControl({curIndex:L}),this.control.emitControlContentChange({}))})}closeModal(){this.inputModal&&(this.inputModal.remove(),this.inputModal=null),this.isPopup=!1}destroy(){this.closeModal()}}class Rh{controlBorder;textFieldUnderline;draw;range;listener;eventBus;controlSearch;options;controlOptions;activeControl;activeControlValue;preElement;constructor(t){this.controlBorder=new lc(t),this.textFieldUnderline=new uh(t),this.draw=t,this.range=t.getRange(),this.listener=t.getListener(),this.eventBus=t.getEventBus(),this.controlSearch=new rc(this),this.options=t.getOptions(),this.controlOptions=this.options.control,this.activeControl=null,this.activeControlValue=[],this.preElement=null}setHighlightList(t){this.controlSearch.setHighlightList(t)}computeHighlightList(){this.controlSearch.getHighlightList().length&&this.controlSearch.computeHighlightList()}renderHighlightList(t,e){this.controlSearch.getHighlightMatchResult().length&&this.controlSearch.renderHighlightList(t,e)}getDraw(){return this.draw}filterAssistElement(t){return t.filter((e,n)=>{if(e.type===l.ElementType.TABLE){const i=e.trList;for(let r=0;r<i.length;r++){const s=i[r];for(let a=0;a<s.tdList.length;a++){const c=s.tdList[a];c.value=this.filterAssistElement(c.value)}}}if(!e.controlId)return!0;if(e.control?.type===l.ControlType.MENSTRUAL_HISTORY&&this.options.mode===l.EditorMode.PRINT&&(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)||e.control?.type===l.ControlType.SELECT&&this.options.mode===l.EditorMode.PRINT&&(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)||e.control?.type===l.ControlType.NUMBER&&this.options.mode===l.EditorMode.PRINT&&(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)||e.control?.type===l.ControlType.TEXT&&this.options.mode===l.EditorMode.PRINT&&e.strikeout&&e.deletePerson)return!1;if(e.control?.minWidth){if(e.controlComponent===l.ControlComponent.PREFIX||e.controlComponent===l.ControlComponent.POSTFIX)return e.value="",!0}else{const i=this.options.mode===l.EditorMode.FORM;if(e.control?.preText&&e.controlComponent===l.ControlComponent.PRE_TEXT){if(i)return!0;let r=!1,s=n+1;for(;s<t.length;){const a=t[s];if(e.controlId!==a.controlId)break;if(a.controlComponent===l.ControlComponent.VALUE){r=!0;break}s++}return r}if(e.control?.postText&&e.controlComponent===l.ControlComponent.POST_TEXT){if(i)return!0;let r=!1,s=n-1;for(;s<t.length;){const a=t[s];if(e.controlId!==a.controlId)break;if(a.controlComponent===l.ControlComponent.VALUE){r=!0;break}s--}return r}}if(e.control?.preTextFix&&e.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){let i=!1,r=n+1;for(;r<t.length;){const s=t[r];if(e.controlId!==s.controlId)break;if(s.controlComponent===l.ControlComponent.VALUE){i=!0;break}r++}return i}if(e.control?.postTextFix&&e.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){let i=!1,r=n-1;for(;r<t.length;){const s=t[r];if(e.controlId!==s.controlId)break;if(s.controlComponent===l.ControlComponent.VALUE){i=!0;break}r--}return i}return e.controlComponent!==l.ControlComponent.PREFIX&&e.controlComponent!==l.ControlComponent.POSTFIX&&e.controlComponent!==l.ControlComponent.PLACEHOLDER&&e.controlComponent!==l.ControlComponent.PRETEXTFIX&&e.controlComponent!==l.ControlComponent.POSTTEXTFIX&&e.controlComponent!==l.ControlComponent.TEXTFIXLABEL})}getIsRangeCanCaptureEvent(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(!~t&&!~e)return!1;const n=this.getElementList(),i=n[t];if(i.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;if(t===e&&t>0){const s=n[t-1],a=s?.controlComponent===l.ControlComponent.POSTFIX||s?.controlComponent===l.ControlComponent.POSTTEXTFIX,c=s?.controlComponent===l.ControlComponent.PLACEHOLDER,d=!!s?.controlId,R=!!s?.originControlId;let u=!1;if(R){const p=s.originControlId;for(let I=t;I<n.length;I++){const L=n[I];if(L.controlId===p&&!L.originControlId){u=!0;break}if(L.controlId&&L.controlId!==p&&L.originControlId!==p)break}}const g=this.draw.getPosition().getPositionList(),f=g[t],T=g[t-1],m=f&&T&&f.rowIndex===T.rowIndex;if((a||c)&&d&&m&&!u)return!1}if(t===e&&(i.controlComponent===l.ControlComponent.POSTFIX||i.controlComponent===l.ControlComponent.POSTTEXTFIX))return!0;const r=n[e];return!!(i.controlId&&i.controlId===r.controlId&&r.controlComponent!==l.ControlComponent.POSTFIX&&r.controlComponent!==l.ControlComponent.POSTTEXTFIX)}getIsRangeInPostfix(){if(!this.activeControl)return!1;const{startIndex:t,endIndex:e}=this.getRange();if(t!==e)return!1;const i=this.getElementList()[t];return i.controlComponent===l.ControlComponent.POSTFIX||i.controlComponent===l.ControlComponent.POSTTEXTFIX}getIsRangeWithinControl(){const{range:{startIndex:t,endIndex:e},elementList:n}=this.range.getRangeElement();if(!~t&&!~e)return!1;const i=n[t],r=n[e];if(i?.controlId&&i.controlId===r.controlId&&r.controlComponent!==l.ControlComponent.POSTFIX&&r.controlComponent!==l.ControlComponent.POSTTEXTFIX&&r.controlComponent!==l.ControlComponent.POSTTEXTFIX_TEXT&&r.controlComponent!==l.ControlComponent.POST_TEXT)return!0;if(r?.originControlId&&(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)){const s=r.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===s)return!0;if(c.controlId&&c.controlId!==s&&c.originControlId!==s)break}}if(!r?.originControlId&&r?.controlId&&(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)){const s=n[e+1];if(s?.controlId&&s.controlId!==r.controlId&&(s.controlComponent===l.ControlComponent.PREFIX||s.controlComponent===l.ControlComponent.PRETEXTFIX))return!0;if(s?.controlId&&s.controlId!==r.controlId&&(s.controlComponent===l.ControlComponent.POSTFIX||s.controlComponent===l.ControlComponent.POSTTEXTFIX))return s.originControlId,!0;for(let a=e;a>=0;a--){const c=n[a];if(c.controlId===r.controlId&&(c.controlComponent===l.ControlComponent.PREFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX)){for(let d=a-1;d>=0;d--){const R=n[d];if(R.controlId&&R.controlId!==r.controlId&&(R.controlComponent===l.ControlComponent.PRETEXTFIX||R.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||R.controlComponent===l.ControlComponent.PREFIX||R.controlComponent===l.ControlComponent.PRE_TEXT))return!0;if(R.controlId&&R.controlId!==r.controlId&&(R.controlComponent===l.ControlComponent.POSTFIX||R.controlComponent===l.ControlComponent.POSTTEXTFIX))break}break}}}if(r?.originControlId){const s=r.originControlId;for(let a=e+1;a<n.length;a++){const c=n[a];if(c.controlId===s)return!0;if(c.controlId&&c.controlId!==s&&c.originControlId!==s)break}}if(!i?.controlId&&this.activeControl){const a=this.activeControl.getElement()?.controlId;if(a)for(let c=t;c>=0;c--){const d=n[c];if(d.controlId===a&&!d.originControlId){if(d.controlComponent===l.ControlComponent.PRETEXTFIX||d.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||d.controlComponent===l.ControlComponent.PREFIX||d.controlComponent===l.ControlComponent.PRE_TEXT)for(let R=e;R<n.length;R++){const u=n[R];if(u.controlId===a&&!u.originControlId){if(u.controlComponent===l.ControlComponent.POSTTEXTFIX||u.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||u.controlComponent===l.ControlComponent.POSTFIX||u.controlComponent===l.ControlComponent.POST_TEXT)return!0;break}}break}}}return!1}getIsElementListContainFullControl(t){if(!t.some(i=>i.controlId))return!1;let e=0,n=0;for(let i=0;i<t.length;i++){const r=t[i];r.controlComponent===l.ControlComponent.PREFIX||r.controlComponent===l.ControlComponent.PRETEXTFIX?e++:(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)&&n++}return!e||!n?!1:e===n}getIsDisabledControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();if(e===n&&~e&&~n){const r=(t.elementList||this.getElementList())[e];if(r.controlComponent===l.ControlComponent.POSTFIX||r.controlComponent===l.ControlComponent.POSTTEXTFIX)return!1}return!!this.activeControl.getElement()?.control?.disabled}getIsDisabledPasteControl(t={}){if(this.draw.isDesignMode()||!this.activeControl)return!1;const{startIndex:e,endIndex:n}=t.range||this.range.getRange();return e===n&&~e&&~n&&(t.elementList||this.getElementList())[e].controlComponent===l.ControlComponent.POSTFIX?!1:!!this.activeControl.getElement()?.control?.pasteDisabled}getIsExistValueByElementListIndex(t,e){const n=t[e];if(!n.controlId)return!1;if(n.control?.type===l.ControlType.CHECKBOX||n.control?.type===l.ControlType.RADIO)return!!n.control?.code;if(n.controlComponent===l.ControlComponent.VALUE)return!0;if(n.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;if(n.controlComponent===l.ControlComponent.PREFIX||n.controlComponent===l.ControlComponent.PRE_TEXT){let i=e+1;for(;i<t.length;){const r=t[i];if(r.controlId!==n.controlId)return!1;if(r.controlComponent===l.ControlComponent.VALUE)return!0;if(r.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;i++}}if(n.controlComponent===l.ControlComponent.PRETEXTFIX||n.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){let i=e+1;for(;i<t.length;){const r=t[i];if(r.controlId!==n.controlId)return!1;if(r.controlComponent===l.ControlComponent.VALUE)return!0;if(r.controlComponent===l.ControlComponent.PLACEHOLDER||r.controlComponent===l.ControlComponent.TEXTFIXLABEL)return!1;i++}}if(n.controlComponent===l.ControlComponent.POSTFIX||n.controlComponent===l.ControlComponent.POSTTEXTFIX){let i=e-1;for(;i>=0;){const r=t[i];if(r.controlId!==n.controlId)return!1;if(r.controlComponent===l.ControlComponent.VALUE)return!0;if(r.controlComponent===l.ControlComponent.PLACEHOLDER)return!1;i--}}return!1}getControlHighlight(t,e){return this.controlSearch.getControlHighlight(t,e)}getContainer(){return this.draw.getContainer()}getElementList(){return this.draw.getElementList()}getPosition(){const t=this.draw.getPosition().getPositionList(),{endIndex:e}=this.range.getRange();return t[e]||null}getPreY(){const t=this.draw.getHeight(),e=this.draw.getPageGap();return(this.getPosition()?.pageNo??this.draw.getPageNo())*(t+e)}getRange(){return this.range.getRange()}getValueRange(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];let r=n;for(;r>0;){const a=e[r];if(a.controlId!==i.controlId||a.controlComponent===l.ControlComponent.PREFIX||a.controlComponent===l.ControlComponent.PRE_TEXT||a.controlComponent===l.ControlComponent.PRETEXTFIX||a.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)break;r--}let s=n+1;for(;s<e.length;){const a=e[s];if(a.controlId!==i.controlId||a.controlComponent===l.ControlComponent.POSTFIX||a.controlComponent===l.ControlComponent.POST_TEXT||a.controlComponent===l.ControlComponent.POSTTEXTFIX||a.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT)break;s++}return r===s?null:{startIndex:r,endIndex:s-1}}shrinkBoundary(t={}){this.range.shrinkBoundary(t)}getActiveControl(){return this.activeControl}getActiveTextControlLimit(){if(!this.activeControl)return null;const t=this.activeControl.getElement(),e=t?.controlId,n=t?.originControlId||null;if(!e||t.control?.type!==l.ControlType.TEXT)return null;const i=this.getElementList(),r=n||null;let s=-1,a=-1,c=-1,d=-1;for(let h=0;h<i.length;h++){const g=i[h];g.controlId!==e||(n?g.originControlId!==n:g.originControlId)||(s===-1&&(s=h),a=h,(g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT||g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)&&(c=h),d===-1&&(g.controlComponent===l.ControlComponent.POSTFIX||g.controlComponent===l.ControlComponent.POST_TEXT||g.controlComponent===l.ControlComponent.POSTTEXTFIX||g.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT)&&(d=h))}if(s===-1)return null;const R=c!==-1?c:s,u=d!==-1?d-1:a;return{controlId:e,originControlId:n,parentControlId:r,startIndex:R,endIndex:u<R?R:u}}getActiveNestedTextLimit(){const t=this.getActiveTextControlLimit();return!t?.parentControlId||!this.getElementList().some(n=>n.controlId===t.parentControlId&&!n.originControlId&&n.control?.type===l.ControlType.TEXTFIELD)?null:{controlId:t.controlId,parentControlId:t.parentControlId,startIndex:t.startIndex,endIndex:t.endIndex}}getControlElementList(t={}){const e=t.elementList||this.getElementList(),{startIndex:n}=t.range||this.getRange(),i=e[n];if(!i?.controlId)return[];const r=[];let s=n;for(;s>0;){const c=e[s];if(c.controlId!==i.controlId)break;r.unshift(c),s--}let a=n+1;for(;a<e.length;){const c=e[a];if(c.controlId!==i.controlId)break;r.push(c),a++}return r}updateActiveControlValue(){this.activeControl&&(this.activeControlValue=this.getControlElementList())}emitControlChange(t){if(!this.activeControl)return;const e=this.eventBus.isSubscribe("controlChange");if(!this.listener.controlChange&&!e)return;let n;const i=this.activeControlValue,r=this.activeControl.getElement();i?.length?n=i[0].control:(n=be(dt(r)).control,n.value=[]);const s={state:t,control:n,controlId:r.controlId};this.listener.controlChange?.(s),e&&this.eventBus.emit("controlChange",s)}initControl(){const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex];if(this.activeControl){if(this.activeControl instanceof pn||this.activeControl instanceof yn||this.activeControl instanceof Wn||this.activeControl instanceof Ge){const R=this.activeControl.getElement();n?.controlId!==R?.controlId?this.destroyControl():n.controlComponent===l.ControlComponent.POSTFIX?this.activeControl.destroy():this.activeControl.awake()}if(this.activeControl){const R=this.activeControl.getElement(),u=n.controlId,h=R.controlId;if(u&&u===h){this.updateActiveControlValue(),this.preElement=n;return}if(n.originControlId&&n.originControlId===h&&!(this.activeControl.getElement()?.control?.type===l.ControlType.TEXTFIELD&&n.controlId!==h)){this.updateActiveControlValue(),this.preElement=n;return}if(n.originControlId&&n.controlId&&n.controlId,!n.originControlId&&n.controlId&&n.controlId!==h&&(this.activeControl.getElement()?.originControlId,n.controlId),n.controlId&&n.controlId===h&&n.originControlId){this.updateActiveControlValue(),this.preElement=n;return}if(!u){const g=this.getElementList(),f=this.getRange(),{startIndex:T}=f;let m=null;for(let p=T;p>=0;p--){const I=g[p];if(I.controlComponent===l.ControlComponent.PRETEXTFIX||I.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||I.controlComponent===l.ControlComponent.PREFIX||I.controlComponent===l.ControlComponent.PRE_TEXT){m=I.controlId||null;break}if(I.controlId&&I.controlId!==h||I.controlComponent===l.ControlComponent.POSTTEXTFIX||I.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||I.controlComponent===l.ControlComponent.POSTFIX||I.controlComponent===l.ControlComponent.POST_TEXT)break}if(m===h){this.updateActiveControlValue(),this.preElement=n;return}}}}if(this.destroyControl(),this.draw.isReadonly())return;let r=n.control,s=n;if(n.originControlId&&!r){const R=n.originControlId;for(let u=this.range.getRange().startIndex;u>=0;u--){const h=t[u];if(h.controlId===R&&!h.originControlId&&h.control){r=h.control,s=h;break}if(h.controlId===R&&!h.originControlId&&(h.controlComponent===l.ControlComponent.PRETEXTFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||h.controlComponent===l.ControlComponent.PREFIX||h.controlComponent===l.ControlComponent.PRE_TEXT)){h.control&&(r=h.control,s=h);break}}}else if(!r&&n.controlId){const R=this.getElementList();for(let u=this.range.getRange().startIndex;u>=0;u--){const h=R[u];if(h.controlId!==n.controlId)break;if(h.control){r=h.control,s=h;break}if(h.controlComponent===l.ControlComponent.PRETEXTFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||h.controlComponent===l.ControlComponent.PREFIX||h.controlComponent===l.ControlComponent.PRE_TEXT)break}}if(!r)return;if(r?.type===l.ControlType.TEXTFIELD&&this.draw.getMode()!==l.EditorMode.EDIT)if(n.originControlId){const R=n.controlId;for(let u=this.range.getRange().startIndex;u>=0;u--){const h=t[u];if(h.controlId===R&&h.originControlId===n.originControlId&&h.control&&h.control.type!==l.ControlType.TEXTFIELD){r=h.control,s=h;break}if(h.controlComponent===l.ControlComponent.PREFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX)break}if(r?.type===l.ControlType.TEXTFIELD)return}else return;const a=this.draw.getPosition().getPositionContext(),c=this.range.getRange().startIndex,d=!!(a.isDirectHit&&a.index===c&&t[a.index]?.controlId===s.controlId);if(r?.type===l.ControlType.TEXTFIELD)this.activeControl=new ar(s,this);else if(r.type===l.ControlType.TEXT)this.activeControl=new Mi(s,this);else if(r.type===l.ControlType.SELECT){const R=new pn(s,this);this.activeControl=R,(d||this.draw.getMode()===l.EditorMode.FORM)&&R.awake()}else if(r.type===l.ControlType.CHECKBOX)this.activeControl=new vn(s,this);else if(r.type===l.ControlType.RADIO)this.activeControl=new Zo(s,this);else if(r.type===l.ControlType.DATE){const R=new yn(s,this);this.activeControl=R,R.awake()}else if(r.type===l.ControlType.NUMBER){const R=new Wn(s,this);this.activeControl=R,d&&R.awake()}else if(r.type===l.ControlType.BUTTON){const R=new Ge(s,this);if(this.activeControl=R,d){R.awake();return}}else if(r.type===l.ControlType.MENSTRUAL_HISTORY){const R=new cr(s,this);this.activeControl=R,R.awake()}this.updateActiveControlValue(),this.preElement=s,s.controlComponent!==l.ControlComponent.POSTFIX&&s.controlComponent!==l.ControlComponent.POSTTEXTFIX&&this.emitControlChange(l.ControlState.ACTIVE)}destroyControl(t={}){if(!this.activeControl)return;const{isEmitEvent:e=!0}=t;(this.activeControl instanceof pn||this.activeControl instanceof yn||this.activeControl instanceof Wn||this.activeControl instanceof cr)&&this.activeControl.destroy(),e&&this.preElement?.controlComponent!==l.ControlComponent.POSTFIX&&this.preElement?.controlComponent!==l.ControlComponent.POSTTEXTFIX&&this.emitControlChange(l.ControlState.INACTIVE),this.preElement=null,this.activeControl=null,this.activeControlValue=[]}repaintControl(t={}){const{curIndex:e,isCompute:n=!0,isSubmitHistory:i=!0,isSetCursor:r=!0}=t;e===void 0?(this.range.clearRange(),this.draw.render({isCompute:n,isSubmitHistory:i,isSetCursor:!1})):(this.range.setRange(e,e),this.draw.render({curIndex:e,isCompute:n,isSetCursor:r,isSubmitHistory:i}))}emitControlContentChange(t){const e=this.eventBus.isSubscribe("controlContentChange");if(!e&&!this.listener.controlContentChange)return;const n=t?.controlElement||this.activeControl?.getElement();if(!n)return;const i=t?.context?.elementList||this.getElementList(),{startIndex:r}=t?.context?.range||this.getRange();if(!i[r]?.controlId)return;const s=t?.controlValue||this.getControlElementList(t?.context);let a;if(s?.length?a=Pt(s)[0].control:(a=n.control,a.value=[]),!a)return;const c={control:a,controlId:n.controlId};this.listener.controlContentChange?.(c),e&&this.eventBus.emit("controlContentChange",c)}reAwakeControl(){if(!this.activeControl)return;const t=this.getElementList(),e=this.getRange(),n=t[e.startIndex];this.activeControl.setElement(n),(this.activeControl instanceof yn||this.activeControl instanceof pn)&&this.activeControl.getIsPopup()&&(this.activeControl.destroy(),this.activeControl.awake())}selectValue(){const t=this.getElementList(),{startIndex:e}=this.getRange(),n=t[e];if(!n?.controlId||n.controlComponent!==l.ControlComponent.VALUE&&t[e+1]?.controlComponent===l.ControlComponent.VALUE)return!1;let i=e;for(;i>0&&t[i].controlComponent===l.ControlComponent.VALUE;)i--;let r=e+1;for(;r<t.length;){if(t[r].controlComponent!==l.ControlComponent.VALUE){r--;break}r++}if(i!==r){const s=this.range.getRange();return this.range.replaceRange({...s,startIndex:i,endIndex:r}),this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1}),!0}return!1}moveCursor(t){const{index:e,trIndex:n,tdIndex:i,tdValueIndex:r}=t;let s=this.draw.getOriginalElementList(),a;const c=t.isTable?r:e;if(t.isTable?(s=s[e].trList[n].tdList[i].value,a=s[r]):a=s[e],a.control?.hide||a.area?.hide){const d=mn(s,c);return{newIndex:d,newElement:s[d]}}if(a.controlComponent===l.ControlComponent.VALUE)return{newIndex:c,newElement:a};if(a.controlComponent===l.ControlComponent.POSTFIX){let d=c+1;for(;d<s.length;){if(s[d].controlId!==a.controlId)return{newIndex:d-1,newElement:s[d-1]};if(d===s.length-1)return{newIndex:d,newElement:s[d]};d++}}else if(a.controlComponent===l.ControlComponent.PREFIX||a.controlComponent===l.ControlComponent.PRE_TEXT){let d=c+1;for(;d<s.length;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent!==l.ControlComponent.PREFIX&&R.controlComponent!==l.ControlComponent.PRE_TEXT)return{newIndex:d-1,newElement:s[d-1]};d++}}else if(a.controlComponent===l.ControlComponent.PLACEHOLDER){let d=c-1;for(;d>0;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent===l.ControlComponent.VALUE||R.controlComponent===l.ControlComponent.PREFIX||R.controlComponent===l.ControlComponent.PRE_TEXT||R.controlComponent===l.ControlComponent.PRETEXTFIX||R.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:s[d]};d--}}else if(a.controlComponent===l.ControlComponent.POST_TEXT||a.controlComponent===l.ControlComponent.TEXTFIXLABEL||a.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){let d=c-1;for(;d>0;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent===l.ControlComponent.VALUE||R.controlComponent===l.ControlComponent.PREFIX||R.controlComponent===l.ControlComponent.PRE_TEXT||R.controlComponent===l.ControlComponent.PRETEXTFIX||R.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d,newElement:s[d]};d--}}else if(a.controlComponent===l.ControlComponent.POSTTEXTFIX){let d=c+1;for(;d<s.length;){if(s[d].controlId!==a.controlId)return{newIndex:d-1,newElement:s[d-1]};if(d===s.length-1)return{newIndex:d,newElement:s[d]};d++}}else if(a.controlComponent===l.ControlComponent.PRETEXTFIX||a.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){let d=c+1;for(;d<s.length;){const R=s[d];if(R.controlId!==a.controlId||R.controlComponent!==l.ControlComponent.PRETEXTFIX&&R.controlComponent!==l.ControlComponent.PRETEXTFIX_TEXT)return{newIndex:d-1,newElement:s[d-1]};d++}}return{newIndex:c,newElement:a}}removeControl(t,e={}){const n=e.elementList||this.getElementList(),i=n[t];if(!this.draw.isDesignMode()&&!i?.control?.hide&&!i?.area?.hide){const{deletable:L=!0}=i.control;if(!L)return null;const M=this.draw.getMode();if(M===l.EditorMode.FORM&&this.options.modeRule[M].controlDeletableDisabled)return null}let r=-1,s=-1;const a=!!i.originControlId,c=i.controlId,d=i.originControlId,R=i.control?.type===l.ControlType.BUTTON&&!i.control?.buttonText?`${c}_text`:"";let u=t;for(;u>=0;){const L=n[u];let M=!1;if(a?M=L.controlId===c&&L.originControlId===d:M=L.controlId===c&&!L.originControlId,!M){r=u;break}u--}let h=t;for(;h<n.length;){const L=n[h];let M=!1;if(a?M=L.controlId===c&&L.originControlId===d:M=L.controlId===c&&!L.originControlId,!M){s=h-1;break}h++}if(h===n.length&&(s=h-1),!~r&&!~s)return t;r=~r?r:0;const g=n[r+1],f=g.control,T=f?.type&&[l.ControlType.TEXT,l.ControlType.TEXTFIELD,l.ControlType.DATE,l.ControlType.NUMBER,l.ControlType.SELECT,l.ControlType.BUTTON].includes(f.type);let m=n[0]?.type===l.ElementType.SPLIT_TAG;if(!e.removeNext&&T&&!a&&g.controlComponent!==l.ControlComponent.PREFIX&&g.type!==l.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const L=this.draw.getTd();L&&this.createRemoveControlHandler(L,i.controlId,!0)}if(!e.removeNext&&T&&!a&&g.controlComponent!==l.ControlComponent.PRETEXTFIX&&g.type!==l.ElementType.SPLIT_TAG)if(e.removePrev)e.removePrev();else{const L=this.draw.getTd();L&&this.createRemoveControlHandler(L,i.controlId,!0)}if(!e.removePrev&&T&&!a&&n[s].controlComponent!==l.ControlComponent.POSTFIX)if(e.removeNext)e.removeNext();else{const L=this.draw.getTd();m=!!L?.linkTdNextId,L&&this.createRemoveControlHandler(L,i.controlId,!1)}if(!e.removePrev&&T&&!a&&n[s].controlComponent!==l.ControlComponent.POSTTEXTFIX)if(e.removeNext)e.removeNext();else{const L=this.draw.getTd();m=!!L?.linkTdNextId,L&&this.createRemoveControlHandler(L,i.controlId,!1)}this.draw.spliceElementList(n,r+1,s-r);let p=0;if(R)for(let L=n.length-1;L>=0;L--)n[L].controlId===R&&(L<=r&&p++,n.splice(L,1));const I=r-p;return!e.elementList&&m&&r===0?this.draw.fixPosition(!0)??I:I}createRemoveControlHandler(t,e,n){if(n){const i=this.draw.getTdById(t.linkTdPrevId);i&&i.value.splice(-1)[0]?.controlId===e&&this.removeControl(i.value.length-1,{elementList:i.value,removePrev:()=>{this.createRemoveControlHandler(i,e,n)}})}else{const i=this.draw.getTdById(t.linkTdNextId);i&&i.value[1]?.controlId===e&&this.removeControl(1,{elementList:i.value,removeNext:()=>{this.createRemoveControlHandler(i,e,n)}})}}removePlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],r=n[t+1];if(i.controlComponent===l.ControlComponent.PLACEHOLDER||i.controlComponent===l.ControlComponent.TEXTFIXLABEL||r?.controlComponent===l.ControlComponent.PLACEHOLDER||r?.controlComponent===l.ControlComponent.TEXTFIXLABEL){let s=!1,a=t;for(;a<n.length;){const c=n[a];if(c.controlId!==i.controlId)break;c.controlComponent===l.ControlComponent.PLACEHOLDER||c.controlComponent===l.ControlComponent.TEXTFIXLABEL?(s||(s=!0,this.draw.getHistoryManager().popUndo(),this.draw.submitHistory(t)),n.splice(a,1)):a++}}}addPlaceholder(t,e={}){const n=e.elementList||this.getElementList(),i=n[t],r=i.control;if(!r.placeholder)return;let s=t;for(;s>=0;){const g=n[s];if(g.controlId!==i.controlId){s++;break}if(g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT||g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)break;s--}s<0&&(s=0);const a=s+1;if(a<n.length){const g=n[a];if(g.controlId===i.controlId&&(g.controlComponent===l.ControlComponent.PLACEHOLDER||g.controlComponent===l.ControlComponent.VALUE))return}let c=!1,d=s+1;for(;d<n.length;){const g=n[d];if(g.controlId===i.controlId){if(g.controlComponent===l.ControlComponent.POSTFIX||g.controlComponent===l.ControlComponent.POST_TEXT||g.controlComponent===l.ControlComponent.POSTTEXTFIX||g.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT)break}else if(g.controlId!==i.controlId&&(g.controlComponent===l.ControlComponent.VALUE||g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT)){c=!0;break}d++}if(c)return;const R=Rt(r.placeholder),u=bt(i,_t),h=s+1;for(let g=0;g<R.length;g++){const f=R[g],T={...u,value:f===`
|
|
185
185
|
`?x:f,controlId:i.controlId,type:l.ElementType.CONTROL,control:i.control,controlComponent:l.ControlComponent.PLACEHOLDER,color:this.controlOptions.placeholderColor};Et(n,[T],s,{editorOptions:this.options}),this.draw.spliceElementList(n,h+g,0,[T])}}setValue(t){if(!this.activeControl)throw new Error("active control is null");return this.activeControl.setValue(t)}setControlProperties(t,e={}){const n=e.elementList||this.getElementList(),{startIndex:i}=e.range||this.getRange(),r=n[i];let s=i;for(;s>0;){const c=n[s];if(c.controlId!==r.controlId)break;c.control={...c.control,...t},s--}let a=i+1;for(;a<n.length;){const c=n[a];if(c.controlId!==r.controlId)break;c.control={...c.control,...t},a++}}keydown(t){if(!this.activeControl)throw new Error("active control is null");return this.activeControl.keydown(t)}cut(){if(!this.activeControl)throw new Error("active control is null");return this.activeControl.cut()}getValueById(t){const{id:e,groupId:n,conceptId:i,areaId:r}=t,s=[];if(!e&&!i&&!n)return s;const a=new Set,c=(R,u)=>{let h=0;for(;h<R.length;){const g=R[h];if(h++,g.type===l.ElementType.TABLE){const M=g.trList;for(let O=0;O<M.length;O++){const C=M[O];for(let y=0;y<C.tdList.length;y++){const X=C.tdList[y],V=X.originalId??X.id;a.has(V)||(a.add(V),X.linkTdNextId?c(this.draw.getSplitTdValues(V),u):c(X.value,u))}}}if(!g.control||n&&g.control.groupId!==n||e&&g.controlId!==e||i&&g.control.conceptId!==i||r&&g.areaId!==r)continue;const{type:f,code:T,valueSets:m}=g.control;let p=h,I="";const L=[];for(;p<R.length;){const M=R[p];if(M.controlId!==g.controlId)break;(f===l.ControlType.TEXT||f===l.ControlType.TEXTFIELD||f===l.ControlType.DATE||f===l.ControlType.NUMBER)&&M.controlComponent===l.ControlComponent.VALUE&&(I+=M.value,L.push(oe(M,So))),p++}if(f===l.ControlType.TEXT||f===l.ControlType.TEXTFIELD||f===l.ControlType.DATE||f===l.ControlType.NUMBER)s.push({...g.control,zone:u,value:I||null,innerText:I||null,elementList:Pt(L)});else if(f===l.ControlType.SELECT||f===l.ControlType.CHECKBOX||f===l.ControlType.RADIO){const M=T?.split(",").map(O=>m?.find(C=>C.code===O)?.value).filter(Boolean).join("");s.push({...g.control,zone:u,value:T||null,innerText:M||null})}h=p}},d=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:R,elementList:u}of d)c(u,R);return s}setValueListById(t){if(!t.length)return;let e=!1,n=!1;const i=(s,a)=>{let c=0;for(;c<s.length;){const d=s[c];if(c++,d.type===l.ElementType.TABLE){const L=d.trList;for(let M=0;M<L.length;M++){const O=L[M];for(let C=0;C<O.tdList.length;C++){const y=O.tdList[C];i(y.value,y.id)}}}if(!d.control||d.type===l.ElementType.SPLIT_TAG)continue;const R=t.find(L=>(!L.groupId||L.groupId===d.control?.groupId)&&(L.id&&d.controlId===L.id||L.conceptId&&d.control.conceptId===L.conceptId||L.areaId&&d.areaId===L.areaId));if(!R)continue;const{value:u,isSubmitHistory:h=!0}=R;e=!0,h&&(n=!0);const{type:g}=d.control,{range:f,fullRange:T}=this.mergeControl({elementList:s,range:{startIndex:c,endIndex:c},tdId:a}),m={range:T??f,elementList:s,tdId:a},p={isIgnoreDisabledRule:!0,isIgnoreDeletedRule:!0};if(g===l.ControlType.TEXTFIELD){const L=Array.isArray(u)?u:u?[{value:u}]:[];L.length&&Yt(L,{isHandleFirstElement:!1,editorOptions:this.options});const M=new ar(d,this);this.activeControl=M,L.length?M.setValue(L,m,p):M.clearValue(m,p)}else if(g===l.ControlType.TEXT){const L=Array.isArray(u)?u:u?[{value:u}]:[];L.length&&Yt(L,{isHandleFirstElement:!1,editorOptions:this.options});const M=new Mi(d,this);this.activeControl=M,L.length?M.setValue(L,m,p):M.clearValue(m,p)}else if(g===l.ControlType.SELECT){if(Array.isArray(u))continue;const L=new pn(d,this);this.activeControl=L,u?L.setSelect(u,m,p):L.clearSelect(m,p)}else if(g===l.ControlType.CHECKBOX){if(Array.isArray(u))continue;const L=new vn(d,this);this.activeControl=L;const M=u?u.split(","):[];L.setSelect(M,m,p)}else if(g===l.ControlType.RADIO){if(Array.isArray(u))continue;const L=new Zo(d,this);this.activeControl=L;const M=u?[u]:[];L.setSelect(M,m,p)}else if(g===l.ControlType.DATE){const L=new yn(d,this);this.activeControl=L,Io(u)?(u.length&&Yt(u,{isHandleFirstElement:!1,editorOptions:this.options}),L.setValue(u,m,p)):vr(u)?L.setSelect(u,m,p):L.clearSelect(m,p)}else if(g===l.ControlType.NUMBER){const L=Array.isArray(u)?u:u?[{value:u}]:[];L.length&&Yt(L,{isHandleFirstElement:!1,editorOptions:this.options});const M=new Wn(d,this);this.activeControl=M,L.length?M.setValue(L,m,p):M.clearValue(m,p)}else if(g===l.ControlType.BUTTON){const L=Array.isArray(u)?u:u?[{value:u}]:[];L.length&&Yt(L,{isHandleFirstElement:!1,editorOptions:this.options});const M=new Ge(d,this);this.activeControl=M,L.length?M.setValue(L,m,p):M.clearSelect(m,p)}this.emitControlContentChange({context:m}),this.activeControl=null;let I=c;for(;I<s.length&&s[I].controlId===d.controlId;)I++;c=I}};this.destroyControl({isEmitEvent:!1});const r=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const s of r)i(s);e&&(n||this.draw.getHistoryManager().recovery(),this.draw.render({isSubmitHistory:n,isSetCursor:!1}))}setExtensionListById(t){if(!t.length)return;const e=i=>{let r=0;for(;r<i.length;){const s=i[r];if(r++,s.type===l.ElementType.TABLE){const R=s.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];e(f.value)}}}if(!s.control)continue;const a=t.find(R=>R.id&&s.controlId===R.id||R.conceptId&&s.control.conceptId===R.conceptId||R.areaId&&s.areaId===R.areaId);if(!a)continue;const{extension:c}=a;this.setControlProperties({extension:c},{elementList:i,range:{startIndex:r,endIndex:r}});let d=r;for(;d<i.length&&i[d].controlId===s.controlId;)d++;r=d}},n=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const i of n)e(i)}setPropertiesListById(t){if(!t.length)return;let e=!1,n=!1;const i=s=>{let a=0;for(;a<s.length;){const c=s[a];if(a++,c.type===l.ElementType.TABLE){const g=c.trList;for(let f=0;f<g.length;f++){const T=g[f];for(let m=0;m<T.tdList.length;m++){const p=T.tdList[m];i(p.value)}}}if(!c.control)continue;const d=t.find(g=>g.id&&c.controlId===g.id||g.conceptId&&c.control.conceptId===g.conceptId||g.areaId&&c.areaId===g.areaId);if(!d)continue;const{properties:R,isSubmitHistory:u=!0}=d;if(e=!0,u&&(n=!0),this.setControlProperties({...c.control,...R,value:c.control.value},{elementList:s,range:{startIndex:a-1,endIndex:a-1}}),_t.forEach(g=>{const f=R[g];f&&Reflect.set(c,g,f)}),c.control?.type===l.ControlType.NUMBER&&R.numberExclusiveOptions){const g={...c.control.numberExclusiveOptions,...R.numberExclusiveOptions},f=g?.minValue,T=g?.maxValue,m=new Wn(c,this),p=m.getValue({elementList:s,range:{startIndex:a-1,endIndex:a-1}});if(p.length>0){const I=p.map(M=>M.value).join(""),L=Number(I);!Number.isNaN(L)&&Number.isFinite(L)&&(f!=null&&L<f||T!=null&&L>T)&&m.clearValue({elementList:s,range:{startIndex:a-1,endIndex:a-1}},{isAddPlaceholder:!0})}}let h=a;for(;h<s.length&&s[h].controlId===c.controlId;)h++;a=h}},r={header:this.draw.getHeaderElementList(),main:this.draw.getOriginalMainElementList(),footer:this.draw.getFooterElementList()};for(const s in r){const a=r[s];i(a)}if(e){for(const s in r){const a=s,c=Pt(r[a],{isClassifyArea:!0,extraPickAttrs:["id","controlId"]});r[a]=c,Yt(c,{editorOptions:this.options,isForceCompensation:!0})}this.draw.setEditorData(r),n||this.draw.getHistoryManager().recovery(),this.draw.render({isSubmitHistory:n,isSetCursor:!1})}}getList(){const t=[];function e(i){for(let r=0;r<i.length;r++){const s=i[r];if(s.type===l.ElementType.TABLE){const a=s.trList;for(let c=0;c<a.length;c++){const d=a[c];for(let R=0;R<d.tdList.length;R++){const h=d.tdList[R].value;e(h)}}}if(s.controlId){const a=oe(s,[...Co,...fn]);t.push(a)}}}const n=[this.draw.getHeader().getElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooter().getElementList()];for(const i of n)e(i);return Pt(t,{extraPickAttrs:["controlId"]})}recordBorderInfo(t,e,n,i){this.controlBorder.recordBorderInfo(t,e,n,i)}drawBorder(t){this.controlBorder.render(t)}startTextFieldUnderline(t,e,n){this.textFieldUnderline.startTextFieldValue(t,e,n)}recordTextFieldUnderlineWidth(t){this.textFieldUnderline.recordValueWidth(t)}drawTextFieldUnderline(t){this.textFieldUnderline.endTextFieldValue(t)}getPreControlContext(){if(!this.activeControl)return null;const e=this.draw.getPosition().getPositionContext();if(!e)return null;const n=this.activeControl.getElement();function i(c,d){for(let R=d;R>0;R--){const u=c[R];if(u.type===l.ElementType.TABLE){const g=u.trList||[];for(let f=g.length-1;f>=0;f--){const T=g[f],m=T.tdList;for(let p=m.length-1;p>=0;p--){const I=m[p],L=i(I.value,I.value.length-1);if(L)return{positionContext:{isTable:!0,index:R,trIndex:f,tdIndex:p,tdId:I.id,trId:T.id,tableId:u.id},nextIndex:L.nextIndex}}}}if(!u.controlId||u.controlId===n.controlId)continue;let h=R;for(;h>0;){const g=c[h];if(g.controlComponent===l.ControlComponent.VALUE||g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT||g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)break;h--}return{positionContext:{isTable:!1},nextIndex:h}}return null}const{startIndex:r}=this.range.getRange(),s=this.getElementList(),a=i(s,r);if(a)return{positionContext:e.isTable?e:a.positionContext,nextIndex:a.nextIndex};if(n.tableId){const c=this.draw.getOriginalElementList(),{index:d,trIndex:R,tdIndex:u}=e,h=c[d].trList;for(let f=R;f>=0;f--){const T=h[f],m=T.tdList;for(let p=m.length-1;p>=0;p--){if(R===f&&p>=u)continue;const I=m[p],L=i(I.value,I.value.length-1);if(L)return{positionContext:{isTable:!0,index:e.index,trIndex:f,tdIndex:p,tdId:I.id,trId:T.id,tableId:n.tableId},nextIndex:L.nextIndex}}}const g=i(c,d-1);if(g)return{positionContext:{isTable:!1},nextIndex:g.nextIndex}}return null}getNextControlContext(){if(!this.activeControl)return null;const e=this.draw.getPosition().getPositionContext();if(!e)return null;const n=this.activeControl.getElement();function i(c,d){for(let R=d;R<c.length;R++){const u=c[R];if(u.type===l.ElementType.TABLE){const h=u.trList||[];for(let g=0;g<h.length;g++){const f=h[g],T=f.tdList;for(let m=0;m<T.length;m++){const p=T[m],I=i(p.value,0);if(I)return{positionContext:{isTable:!0,index:R,trIndex:g,tdIndex:m,tdId:p.id,trId:f.id,tableId:u.id},nextIndex:I.nextIndex}}}}if(!(!u.controlId||u.controlId===n.controlId||c[R+1]?.controlComponent===l.ControlComponent.PREFIX||c[R+1]?.controlComponent===l.ControlComponent.PRE_TEXT||c[R+1]?.controlComponent===l.ControlComponent.PRETEXTFIX||c[R+1]?.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT))return{positionContext:{isTable:!1},nextIndex:R}}return null}const{endIndex:r}=this.range.getRange(),s=this.getElementList(),a=i(s,r);if(a)return{positionContext:e.isTable?e:a.positionContext,nextIndex:a.nextIndex};if(n.tableId){const c=this.draw.getOriginalElementList(),{index:d,trIndex:R,tdIndex:u}=e,h=c[d].trList;for(let f=R;f<h.length;f++){const T=h[f],m=T.tdList;for(let p=0;p<m.length;p++){if(R===f&&p<=u)continue;const I=m[p],L=i(I.value,0);if(L)return{positionContext:{isTable:!0,index:e.index,trIndex:f,tdIndex:p,tdId:I.id,trId:T.id,tableId:n.tableId},nextIndex:L.nextIndex}}}const g=i(c,d+1);if(g)return{positionContext:{isTable:!1},nextIndex:g.nextIndex}}return null}initNextControl(t={}){const{direction:e=Ut.DOWN}=t;let n=null;if(e===Ut.UP?n=this.getPreControlContext():n=this.getNextControlContext(),!n)return;const{nextIndex:i,positionContext:r}=n,s=this.draw.getPosition();s.setPositionContext(r),this.draw.getRange().replaceRange({startIndex:i,endIndex:i}),this.draw.render({curIndex:i,isCompute:!1,isSetCursor:!0,isSubmitHistory:!1});const a=s.getPositionList();this.draw.getCursor().moveCursorToVisible({cursorPosition:a[i],direction:e})}setMinWidthControlInfo(t){const{row:e,rowElement:n,controlRealWidth:i,availableWidth:r}=t;if(!n.control?.minWidth)return;const{scale:s}=this.options,a=n.control.minWidth*s;let c=null;if(n.control?.minWidth&&(n.control?.rowFlex===l.RowFlex.CENTER||n.control?.rowFlex===l.RowFlex.RIGHT)){let R=n.metrics.width,u=e.elementList.length-1;for(;u>=0;){const h=e.elementList[u];if(R+=h.metrics.width,e.elementList[u-1]?.controlComponent===l.ControlComponent.PREFIX){c=h;break}u--}c&&R<a&&(n.control.rowFlex===l.RowFlex.CENTER?c.left=(a-R)/2:n.control.rowFlex===l.RowFlex.RIGHT&&(c.left=a-R-n.metrics.width))}const d=a-i;if(d>0){const R=c?.left||0,u=r-e.width-n.metrics.width,h=Math.min(u,d);n.left=h-R,e.width+=h-R}}mergeControl(t={}){const e=t.elementList||this.getElementList(),n=t.range||this.getRange(),{startIndex:i}=n,r=t.tdId??this.draw.getPosition().getPositionContext().tdId,s=r?this.draw.getTdById(r):void 0,a=e[i];if(!a?.controlId)return{range:n,elementList:[],tdId:r};const c={startIndex:i,endIndex:i},d=[];let R=!1,u=i,h=s,g=e;for(;u>=0;){const p=g[u];if(p.controlId!==a.controlId)break;if(p.type!==l.ElementType.SPLIT_TAG&&(d.unshift(p),R&&(g.splice(u,1),e[0].type===l.ElementType.SPLIT_TAG?e.splice(0,1):(n.startIndex++,n.endIndex++),e.unshift(p)),c.startIndex=u),u===0&&p.controlComponent!==l.ControlComponent.PREFIX&&h?.linkTdPrevId&&(h=this.draw.getTdById(h.linkTdPrevId),h)){g=h.value,u=h.value.length-1,R=!0;continue}if(u===0&&p.controlComponent!==l.ControlComponent.PRETEXTFIX&&h?.linkTdPrevId&&(h=this.draw.getTdById(h.linkTdPrevId),h)){g=h.value,u=h.value.length-1,R=!0;continue}u--}R=!1;let f=i+1,T=s,m=e;for(;f<m.length;){const p=m[f];if(p.controlId!==a.controlId)break;if(p.type!==l.ElementType.SPLIT_TAG&&(d.push(p),R&&(m.splice(f,1),e.push(p),f--)),f===m.length-1&&p.controlComponent!==l.ControlComponent.POSTFIX&&T?.linkTdNextId&&(T=this.draw.getTdById(T.linkTdNextId),T)){m=T.value,f=0,R=!0;continue}if(f===m.length-1&&p.controlComponent!==l.ControlComponent.POSTTEXTFIX&&T?.linkTdNextId&&(T=this.draw.getTdById(T.linkTdNextId),T)){m=T.value,f=0,R=!0;continue}f++}return c.endIndex=c.startIndex+d.length,{range:n,elementList:e,tdId:r,fullRange:{startIndex:c.startIndex,endIndex:c.endIndex-2}}}}class uh{options;currentTextFieldId=null;valueStartX=0;valueWidth=0;valueY=0;constructor(t){this.options=t.getOptions()}startTextFieldValue(t,e,n){this.currentTextFieldId=t,this.valueStartX=e,this.valueY=n,this.valueWidth=0}recordValueWidth(t){this.valueWidth+=t}endTextFieldValue(t){if(!this.currentTextFieldId||this.valueWidth<=0){this.reset();return}const{scale:e}=this.options;t.save(),t.strokeStyle=this.options.defaultColor,t.lineWidth=e,t.beginPath();const n=this.valueY-.5*e;t.moveTo(this.valueStartX,n),t.lineTo(this.valueStartX+this.valueWidth,n),t.stroke(),t.restore(),this.reset()}reset(){this.currentTextFieldId=null,this.valueStartX=0,this.valueWidth=0,this.valueY=0}}class hh{draw;options;constructor(t){this.draw=t,this.options=t.getOptions()}setSelect(t){const{checkbox:e}=t;e?e.value=!e.value:t.checkbox={value:!0},this.draw.render({isCompute:!1,isSetCursor:!1})}render(t){const{ctx:e,x:n,index:i,row:r}=t;let{y:s}=t;const{checkbox:{gap:a,lineWidth:c,fillStyle:d,strokeStyle:R,verticalAlign:u},scale:h}=this.options,{metrics:g,checkbox:f}=r.elementList[i];if(u===l.VerticalAlign.TOP||u===l.VerticalAlign.MIDDLE){let L=i+1,M=null;for(;L<r.elementList.length&&(M=r.elementList[L],!(M.value!==x&&M.value!==ho));)L++;if(M){const{metrics:{boundingBoxAscent:O,boundingBoxDescent:C}}=M,y=O+C;y>g.height&&(u===l.VerticalAlign.TOP?s-=O-g.height:u===l.VerticalAlign.MIDDLE&&(s-=(y-g.height)/2))}}const T=Math.round(n+a*h),m=Math.round(s-g.height+c),p=g.width-a*2*h,I=g.height;e.save(),e.beginPath(),e.translate(.5,.5),f?.value?(e.lineWidth=c,e.strokeStyle=d,e.rect(T,m,p,I),e.stroke(),e.beginPath(),e.fillStyle=d,e.fillRect(T,m,p,I),e.beginPath(),e.strokeStyle=R,e.lineWidth=c*2*h,e.moveTo(T+2*h,m+I/2),e.lineTo(T+p/2,m+I-3*h),e.lineTo(T+p-2*h,m+3*h),e.stroke()):(e.lineWidth=c,e.rect(T,m,p,I),e.stroke()),e.closePath(),e.restore()}}class gh{draw;options;constructor(t){this.draw=t,this.options=t.getOptions()}setSelect(t){const{radio:e}=t;e?e.value=!e.value:t.radio={value:!0},this.draw.render({isCompute:!1,isSetCursor:!1})}render(t){const{ctx:e,x:n,index:i,row:r}=t;let{y:s}=t;const{radio:{gap:a,lineWidth:c,fillStyle:d,strokeStyle:R,verticalAlign:u},scale:h}=this.options,{metrics:g,radio:f}=r.elementList[i];if(u===l.VerticalAlign.TOP||u===l.VerticalAlign.MIDDLE){let L=i+1,M=null;for(;L<r.elementList.length&&(M=r.elementList[L],!(M.value!==x&&M.value!==ho));)L++;if(M){const{metrics:{boundingBoxAscent:O,boundingBoxDescent:C}}=M,y=O+C;y>g.height&&(u===l.VerticalAlign.TOP?s-=O-g.height:u===l.VerticalAlign.MIDDLE&&(s-=(y-g.height)/2))}}const T=Math.round(n+a*h),m=Math.round(s-g.height+c),p=g.width-a*2*h,I=g.height;e.save(),e.beginPath(),e.translate(.5,.5),e.strokeStyle=f?.value?d:R,e.lineWidth=c,e.arc(T+p/2,m+I/2,p/2,0,Math.PI*2),e.stroke(),f?.value&&(e.beginPath(),e.fillStyle=d,e.arc(T+p/2,m+I/2,p/3,0,Math.PI*2),e.fill()),e.closePath(),e.restore()}}const Ro={fontSize:11,smallFontSize:9,lineHeight:12,dividerWidth:40,gap:4,totalHeight:36};class fh{draw;options;inputModal=null;isPopup=!1;constructor(t){this.draw=t,this.options=t.getOptions()}computeSize(t){const e=Ro,n=this.options.scale,i=e.fontSize*n,r=e.smallFontSize*n,s=e.gap*n,a=e.dividerWidth*n,d=document.createElement("canvas").getContext("2d"),R=t.menstrualData;d.font=`${i}px "Microsoft YaHei", sans-serif`;let u=a;d.font=`${r}px "Microsoft YaHei", sans-serif`;let h=0;if(R){const f=this.getValue(R.menarcheAge);d.font=`${i}px "Microsoft YaHei", sans-serif`,f&&(u+=d.measureText(`${f}岁`).width+s);let T="";if(R.isMenopause){const M=this.getValue(R.menopauseAge);M&&(T=`${M}岁`)}else{const M=this.getValue(R.lastPeriod);M&&(T=M)}T&&(u+=d.measureText(T).width+s),d.font=`${r}px "Microsoft YaHei", sans-serif`;const m=this.getValue(R.periodMin),p=this.getValue(R.periodMax);if(m||p){const M=`${m||""}~${p||""}`;h=Math.max(h,d.measureText(M).width)}const I=this.getValue(R.cycleMin),L=this.getValue(R.cycleMax);if(I||L){const M=`${I||""}~${L||""}`;h=Math.max(h,d.measureText(M).width)}}else d.font=`${i}px "Microsoft YaHei", sans-serif`,h=d.measureText("~").width;return{width:Math.max(u,h),height:e.totalHeight*n}}getValue(t){return!t||t===""||t==="_"||t==="____-__-__"?"":t}render(t){const{ctx:e,x:n,y:i,element:r}=t,s=r.menstrualData,a=this.options.scale;e.save(),e.font=`${Ro.fontSize*a}px "Microsoft YaHei", sans-serif`,e.fillStyle=this.options.defaultColor,e.textBaseline="bottom",s?this.renderWithData(e,n,i,s,a):this.renderEmpty(e,n,i,a),e.restore()}renderEmpty(t,e,n,i){const r=Ro,s=r.fontSize*i,a=r.lineHeight*i,c=r.dividerWidth*i,d=n-a*1.5,R=e+c/2;t.font=`${s}px "Microsoft YaHei", sans-serif`;const u=t.measureText("~").width,h=R-u/2;t.fillText("~",h,d+a);const g=d+a*2;this.drawDivider(t,e,g-s/2,c,i),t.fillText("~",h,g+a)}renderWithData(t,e,n,i,r){const s=Ro,a=s.fontSize*r,c=s.smallFontSize*r,d=s.lineHeight*r,R=s.gap*r,u=s.dividerWidth*r,h=n-d*2,g=h+d*2;t.font=`${a}px "Microsoft YaHei", sans-serif`;const f=this.getValue(i.menarcheAge);let T=e;if(f){const P=`${f}岁`;t.fillText(P,e,g),T=e+t.measureText(P).width+R}const m=T+u/2,p=h+d;t.font=`${c}px "Microsoft YaHei", sans-serif`;const I=this.getValue(i.periodMin),L=this.getValue(i.periodMax);let M="";I||L?M=`${I||""}~${L||""}`:(t.font=`${a}px "Microsoft YaHei", sans-serif`,M="~");const O=t.measureText(M).width,C=m-O/2;t.fillText(M,C,p),this.drawDivider(t,T,g-a/2,u,r),t.font=`${a}px "Microsoft YaHei", sans-serif`;let y="";if(i.isMenopause){const P=this.getValue(i.menopauseAge);P&&(y=`${P}岁`)}else{const P=this.getValue(i.lastPeriod);P&&(y=P)}y&&t.fillText(y,T+u+R,g);const X=g+d;t.font=`${c}px "Microsoft YaHei", sans-serif`;const V=this.getValue(i.cycleMin),b=this.getValue(i.cycleMax);let S="";V||b?S=`${V||""}~${b||""}`:(t.font=`${a}px "Microsoft YaHei", sans-serif`,S="~");const W=t.measureText(S).width,N=m-W/2;t.fillText(S,N,X)}drawDivider(t,e,n,i,r){t.save(),t.beginPath(),t.strokeStyle=this.options.defaultColor,t.lineWidth=.5*r,t.moveTo(e,n),t.lineTo(e+i,n),t.stroke(),t.restore()}clearMenstrualHistoryEditor(){this.inputModal&&(this.inputModal.remove(),this.inputModal=null),this.isPopup=!1}renderMenstrualHistoryEditor(t,e){if(this.options.mode===l.EditorMode.PRINT)return;(this.isPopup||this.inputModal)&&this.clearMenstrualHistoryEditor(),this.isPopup=!0;const n=t.menstrualData;this.inputModal=document.createElement("div"),this.inputModal.className="menstrual-history-edit-modal",this.inputModal.setAttribute("editor-component","menstrual-history-edit-modal"),this.inputModal.innerHTML=`
|
|
186
186
|
<div class="menstrual-history-modal__mask"></div>
|
|
187
187
|
<div class="menstrual-history-modal__container">
|
|
@@ -545,5 +545,5 @@ ${u} `}textToElements(t){const e=[],n=t.split(`
|
|
|
545
545
|
size: ${d.size} ${i===l.PaperDirection.HORIZONTAL?"landscape":"portrait"};
|
|
546
546
|
}`;R.append(document.createTextNode(u)),setTimeout(()=>{a.write(`${R.outerHTML}${c.innerHTML}`),s.print(),a.close(),window.addEventListener("mouseover",()=>{r?.remove()},{once:!0})})}const Jh=[l.ControlType.TEXT,l.ControlType.TEXTFIELD],Or=["id","titleId","listId","areaId","hyperlinkId","dateId","labelId","tableId","trId","tdId","pagingId","menstrualHistoryId","fetalHeartPositionId","toothPositionId"];function uo(o,t){for(let e=0;e<o.length;e++){const n=o[e];if(n.type===l.ElementType.CONTROL&&n.controlId===t&&n.control)return dt(n);if(n.control?.value?.length){const i=uo(n.control.value,t);if(i)return i}if(n.valueList?.length){const i=uo(n.valueList,t);if(i)return i}if(n.type===l.ElementType.TABLE&&n.trList?.length)for(let i=0;i<n.trList.length;i++){const r=n.trList[i];for(let s=0;s<r.tdList.length;s++){const a=r.tdList[s],c=uo(a.value,t);if(c)return c}}}return null}function Bh(o){const t=new Map,e=new Map,n=a=>a&&(t.has(a)||t.set(a,rt()),t.get(a)),i=a=>a&&(e.has(a)||e.set(a,rt()),e.get(a)),r=a=>{a.controlId&&(a.controlId=n(a.controlId)),a.originControlId&&(a.originControlId=n(a.originControlId));for(let c=0;c<Or.length;c++){const d=Or[c],R=a[d];if(typeof R=="string"){const u=a;u[d]=i(R)}}a.groupIds?.length&&(a.groupIds=a.groupIds.map(c=>i(c))),a.valueList?.length&&a.valueList.forEach(r),a.control?.value?.length&&a.control.value.forEach(r),a.trList?.length&&a.trList.forEach(c=>{const d=c;typeof d.id=="string"&&(d.id=i(d.id)),c.tdList.forEach(R=>{const u=R;typeof u.id=="string"&&(u.id=i(u.id)),R.value.forEach(r)})})},s=dt(o);return r(s),s}function $h(o,t,e){let n=-1;const i=!!e;for(let r=0;r<o.length;r++){const s=o[r];if(i?s.controlId===t&&s.originControlId===e:s.controlId===t&&!s.originControlId)n=r;else if(~n)break}return n}class zh{draw;range;position;historyManager;canvasEvent;options;control;workerManager;searchManager;i18n;zone;tableOperate;constructor(t){this.draw=t,this.range=t.getRange(),this.position=t.getPosition(),this.historyManager=t.getHistoryManager(),this.canvasEvent=t.getCanvasEvent(),this.options=t.getOptions(),this.control=t.getControl(),this.workerManager=t.getWorkerManager(),this.searchManager=t.getSearch(),this.i18n=t.getI18n(),this.zone=t.getZone(),this.tableOperate=t.getTableOperate()}getIsRangeInTextField(){const{startIndex:t}=this.range.getRange(),e=this.draw.getElementList(),n=e[t];if(!n)return!1;let i=null;const r=s=>{if(!s)return null;for(let a=t;a>=0;a--){const c=e[a];if(c.controlId===s&&c.control?.type===l.ControlType.TEXTFIELD&&(c.controlComponent===l.ControlComponent.PRETEXTFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||c.controlComponent===l.ControlComponent.PREFIX||c.controlComponent===l.ControlComponent.PRE_TEXT))return s}return null};return i=r(n.controlId)||r(n.originControlId),!!i}mode(t){this.draw.setMode(t)}async cut(){this.draw.isReadonly()||this.draw.isDisabled()||await this.canvasEvent.cut()}async copy(t){await this.canvasEvent.copy(t)}paste(t){this.draw.isReadonly()||this.draw.isDisabled()||ql(this.canvasEvent,t)}copyControl(t){if(!t)return;const e=Pt(this.draw.getElementList(),{editorOptions:this.options}),n=uo(e,t);n&&Jl({element:n})}pasteControl(){if(this.draw.isReadonly()||this.draw.isDisabled())return;const e=ji();if(!e?.element)return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.draw.getElementList(),s=Bh(e.element),a=s.controlId;if(!a)return;const c=bo([s]);if(!c.length)return;Yt(c,{isHandleFirstElement:!1,editorOptions:this.options});let d=n,R=n,u=i,h=!1,g;const f=n===i;let T=this.control.getActiveControl();!T&&this.control.getIsRangeWithinControl()&&(this.control.initControl(),T=this.control.getActiveControl());const m=T?.getElement();if(m?.control?.type&&Jh.includes(m.control.type)&&this.control.getIsRangeWithinControl()){h=!0,g=m.controlId;const L=r[n];f&&(L?.control?.type===l.ControlType.TEXTFIELD||L?.control?.type===l.ControlType.TEXT)&&this.control.removePlaceholder(n)}else if(m?.controlId){const L=$h(r,m.controlId,m.originControlId);~L&&(d=L,R=L,u=L)}Et(r,c,d,{isBreakWhenWrap:!0,editorOptions:this.options}),g&&c.forEach(L=>{L.controlId===a&&!L.originControlId&&(L.originControlId=g)});const p=d+1;R!==u&&this.draw.spliceElementList(r,R+1,u-R),this.draw.spliceElementList(r,p,0,c);const I=d+c.length;this.range.setRange(I,I),this.draw.render({curIndex:I}),h&&this.control.emitControlContentChange()}selectAll(){this.canvasEvent.selectAll()}backspace(){if(this.draw.isReadonly()||this.draw.isDisabled())return;const e=this.draw.getElementList(),{startIndex:n,endIndex:i}=this.range.getRange(),r=n===i;if(r&&e[n].value===x&&n===0)return;r?this.draw.spliceElementList(e,n,1):this.draw.spliceElementList(e,n+1,i-n);const s=r?n-1:n;this.range.setRange(s,s),this.draw.render({curIndex:s})}setRange(t,e,n,i,r,s,a){if(t<0||e<0||e<t)return;this.range.setRange(t,e,n,i,r,s,a);const c=t===e;this.draw.render({curIndex:c?t:void 0,isCompute:!1,isSubmitHistory:!1,isSetCursor:c})}replaceRange(t){this.setRange(t.startIndex,t.endIndex,t.tableId,t.startTdIndex,t.endTdIndex,t.startTrIndex,t.endTrIndex)}setPositionContext(t){const{tableId:e,startTrIndex:n,startTdIndex:i}=t,r=this.draw.getOriginalElementList();if(e){const s=r.findIndex(R=>R.id===e);if(!~s)return;const c=r[s].trList[n],d=c.tdList[i];this.position.setPositionContext({isTable:!0,index:s,trIndex:n,tdIndex:i,tdId:d.id,trId:c.id,tableId:e})}else this.position.setPositionContext({isTable:!1})}forceUpdate(t){const{isSubmitHistory:e=!1}=t||{};this.range.clearRange(),this.draw.render({isSubmitHistory:e,isSetCursor:!1})}blur(){this.range.clearRange(),this.draw.getCursor().recoveryCursor()}hideCursor(){this.draw.getCursor().recoveryCursor()}undo(){this.draw.isReadonly()||this.historyManager.undo()}redo(){this.draw.isReadonly()||this.historyManager.redo()}painter(t){if(!t.isDblclick&&this.draw.getPainterStyle()){this.canvasEvent.clearPainterStyle();return}const e=this.range.getSelection();if(!e)return;const n={};e.forEach(i=>{de.forEach(s=>{const a=s;n[a]===void 0&&Reflect.set(n,a,i[a])})}),this.draw.setPainterStyle(n,t)}applyPainterStyle(){this.draw.isReadonly()||this.draw.isDisabled()||this.canvasEvent.applyPainterStyle()}format(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();let r={},s=[];if(i?.length)s=i,r={isSetCursor:!1};else{const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];d?.value===x&&(s.push(d),r={curIndex:a})}s.length&&(s.forEach(a=>{de.forEach(c=>{delete a[c]})}),this.draw.render(r))}buttonText(t){if(t)if([...t.element].filter(i=>i.newButtonValue&&i.newButtonValue.length>0).length){const i=t.controlId;this.removeButtonElementsByControlId(i+"_text").then(()=>{setTimeout(()=>{this.insertButtonValue(t)},500)})}else{const i=t.controlId;i&&this.removeButtonElementsByControlId(i+"_text")}}triggerControlEditAttribute(t){const n=this.draw.getElementList().filter(r=>r.controlId===t);this.draw.getEventBus().emit("controlEditAttribute",{controlId:t,element:n})}editElementAttribute(t){const e=this.draw.getElementList();if(t.controlId&&t.type==="button"){const n=[];e.forEach((h,g)=>{h.controlId===t.controlId&&h.control?.type==="button"&&n.push(g)});const i=[];let r=null;n.forEach(h=>{const g=e[h];g.controlComponent===l.ControlComponent.VALUE&&(i.push(h),r||(r=g))}),i.sort((h,g)=>g-h).forEach(h=>{e.splice(h,1)});let s=-1;for(let h=0;h<e.length;h++){const g=e[h];if(g.controlId===t.controlId&&g.control?.type==="button"){if(g.controlComponent===l.ControlComponent.PREFIX||g.controlComponent===l.ControlComponent.PRE_TEXT){s=h+1;break}s===-1&&(s=h+1)}}if(s===-1&&n.length>0){const h=[];e.forEach((g,f)=>{g.controlId===t.controlId&&g.control?.type==="button"&&h.push(f)}),h.length>0&&(s=h[0]+1)}const a=t.label||"";for(let h=0;h<a.length;h++){const g={value:a[h],controlId:t.controlId,type:l.ElementType.CONTROL,control:{type:"button",buttonLabel:a,code:t.code,value:[{value:a}],label:a,hide:!1},controlComponent:l.ControlComponent.VALUE,color:r?.color||"#fff",highlight:r?.highlight||"#1677FF",style:r?.style||"16px Microsoft YaHei",hide:!1};e.splice(s+h,0,g)}e.filter(h=>h.controlId===t.controlId&&h.control?.type==="button").forEach(h=>{h.control&&(h.control.buttonLabel=t.label,h.control.label=t.label,h.control.code=t.code,h.control.hide=!1,h.control.value=[{value:t.label}]),h.hide=!1});const{startIndex:c,endIndex:d}=this.range.getRange(),R=!0,u=d;this.draw.render({curIndex:u,isSetCursor:R})}else if(t.controlId){const n=t.controlId;if(e.forEach(r=>{r.controlId===n&&r.control&&(t.label!==void 0&&(r.control.label=t.label),t.placeholder!==void 0&&(r.control.placeholder=t.placeholder),t.code!==void 0&&(r.control.code=t.code),t.value!==void 0&&(r.control.value=t.value?[{value:t.value}]:null),t.valueSets!==void 0&&(r.control.valueSets=t.valueSets),t.dateFormat!==void 0&&(r.control.dateFormat=t.dateFormat),t.numberExclusiveOptions!==void 0&&(r.control.numberExclusiveOptions=t.numberExclusiveOptions),t.underline!==void 0&&(r.control.underline=t.underline))}),t.placeholder!==void 0){const r=t.placeholder,s=[];if(e.forEach((a,c)=>{a.controlId===n&&a.controlComponent==="placeholder"&&s.push({element:a,index:c})}),s.length===r.length)s.forEach((a,c)=>{a.element.value=r[c]===`
|
|
547
547
|
`?x:r[c]});else if(s.length>0){const a={...s[0].element};s.sort((d,R)=>R.index-d.index).forEach(d=>{e.splice(d.index,1)});const c=Math.min(...s.map(d=>d.index));for(let d=0;d<r.length;d++){const R=r[d]===`
|
|
548
|
-
`?x:r[d];e.splice(c+d,0,{...a,value:R})}}}const{endIndex:i}=this.range.getRange();this.draw.render({curIndex:i,isSetCursor:!0})}}delButton(t,e){return new Promise(n=>{for(let i=t.length-1;i>=0;i--)e.some(s=>s.controlId===t[i].controlId&&s.type===t[i].type)&&t.splice(i,1);n(!0)})}editButton(t,e,n){const i=this.draw.getElementList();n=n+1;for(let d=0;d<e.label.length;d++){const R={value:e.label[d],controlId:e.controlId,type:l.ElementType.CONTROL,control:{type:"button",buttonLabel:e.label,code:e.code,value:[{value:e.label}],label:e.label,hide:!1},controlComponent:"value",color:"#fff",highlight:"#1677FF",style:"16px Microsoft YaHei",hide:!1};i.splice(n+d,0,R)}const{startIndex:r,endIndex:s}=this.range.getRange(),a=!0,c=s;this.draw.render({curIndex:c,isSetCursor:a})}removeButtonElementsByControlId(t){return new Promise(e=>{const n=this.draw.getElementList();for(let c=n.length-1;c>=0;c--)n[c].controlId===t&&n.splice(c,1);const{startIndex:i,endIndex:r}=this.range.getRange(),s=!0,a=r;this.draw.render({curIndex:a,isSetCursor:s}),e(!0)})}removeByValue(t,e){return new Promise(n=>{for(let c=t.length-1;c>=0;c--)(t[c].type=="control"||t[c].type=="text"||t[c].type=="buttonText")&&t[c].control?.buttonLabel===e&&t[c].control?.buttonText&&t.splice(c,1);const{startIndex:i,endIndex:r}=this.range.getRange(),s=!0,a=r;this.draw.render({curIndex:a,isSetCursor:s}),n(!0)})}insertButtonValue(t){const e=this.draw.getElementList(),n=t.controlId,i=t.element[0].newButtonValue,r=t.element[0].control.buttonLabel,s=t.element[0].control.code;if(!i||!i.length)return;let a=-1;for(let m=0;m<e.length;m++)if(e[m].controlId===n&&e[m].control?.type==="button"){a=m;break}if(a===-1)return;const c=n+"_text",d=[];for(let m=0;m<i.length;m++){const p=i[m];d.push({value:p.value,code:p.code})}const R={type:"button",buttonLabel:r,buttonText:!0,label:r,code:s,value:d,hide:!1},u=[];u.push({value:"[",controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.PREFIX,color:"#1677FF",hide:!1});for(let m=0;m<i.length;m++){const p=i[m],I=i.length>1?`${m+1}.${p.value}`:p.value,L=Rt(I);for(let M=0;M<L.length;M++)u.push({value:L[M],controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.VALUE,color:"#000",hide:!1});i.length>1&&m<i.length-1&&u.push({value:x,controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.VALUE,color:"#000",hide:!1})}u.push({value:"]",controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.POSTFIX,color:"#1677FF",hide:!1});for(let m=0;m<u.length;m++)e.splice(a+m,0,u[m]);const{startIndex:h,endIndex:g}=this.range.getRange(),f=!0,T=g;this.draw.render({curIndex:T,isSetCursor:f})}font(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length)r.forEach(s=>{s.font=t}),this.draw.render({isSetCursor:!1});else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({font:t}),d?.value===x?d.font=t:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}size(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const{minSize:r,maxSize:s,defaultSize:a}=this.options;if(t<r||t>s)return;let c={},d=[];const R=this.range.getTextLikeSelectionElementList();if(R?.length)d=R,c={isSetCursor:!1};else{const{endIndex:h}=this.range.getRange(),f=this.draw.getElementList()[h];this.range.setDefaultStyle({size:t}),f?.value===x?(d.push(f),c={curIndex:h}):this.draw.render({curIndex:h,isCompute:!1,isSubmitHistory:!1})}if(!d.length)return;let u=!1;d.forEach(h=>{!h.size&&t===a||h.size&&h.size===t||(h.size=t,u=!0)}),u&&this.draw.render(c)}sizeAdd(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const{defaultSize:i,maxSize:r}=this.options,s=this.range.getTextLikeSelectionElementList();let a={},c=[];if(s?.length)c=s,a={isSetCursor:!1};else{const{endIndex:R}=this.range.getRange(),h=this.draw.getElementList()[R],f=this.range.getDefaultStyle()?.size||h.size||i;this.range.setDefaultStyle({size:f+2>r?r:f+2}),h?.value===x?(c.push(h),a={curIndex:R}):this.draw.render({curIndex:R,isCompute:!1,isSubmitHistory:!1})}if(!c.length)return;let d=!1;c.forEach(R=>{R.size||(R.size=i),!(R.size>=r)&&(R.size+2>r?R.size=r:R.size+=2,d=!0)}),d&&this.draw.render(a)}sizeMinus(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const{defaultSize:i,minSize:r}=this.options,s=this.range.getTextLikeSelectionElementList();let a={},c=[];if(s?.length)c=s,a={isSetCursor:!1};else{const{endIndex:R}=this.range.getRange(),h=this.draw.getElementList()[R],f=this.range.getDefaultStyle()?.size||h.size||i;this.range.setDefaultStyle({size:f-2<r?r:f-2}),h?.value===x?(c.push(h),a={curIndex:R}):this.draw.render({curIndex:R,isCompute:!1,isSubmitHistory:!1})}if(!c.length)return;let d=!1;c.forEach(R=>{R.size||(R.size=i),!(R.size<=r)&&(R.size-2<r?R.size=r:R.size-=2,d=!0)}),d&&this.draw.render(a)}bold(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(i?.length){const r=i.findIndex(s=>!s.bold);i.forEach(s=>{s.bold=!!~r}),this.draw.render({isSetCursor:!1})}else{let r=!0;const{endIndex:s}=this.range.getRange(),c=this.draw.getElementList()[s];this.range.setDefaultStyle({bold:c.bold?!1:!this.range.getDefaultStyle()?.bold}),c?.value===x?c.bold=!c.bold:r=!1,this.draw.render({isSubmitHistory:r,curIndex:s,isCompute:!1})}}italic(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(i?.length){const r=i.findIndex(s=>!s.italic);i.forEach(s=>{s.italic=!!~r}),this.draw.render({isSetCursor:!1})}else{let r=!0;const{endIndex:s}=this.range.getRange(),c=this.draw.getElementList()[s];this.range.setDefaultStyle({italic:c.italic?!1:!this.range.getDefaultStyle()?.italic}),c?.value===x?c.italic=!c.italic:r=!1,this.draw.render({isSubmitHistory:r,curIndex:s,isCompute:!1})}}underline(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length){const s=r.some(a=>!a.underline||!t&&a.textDecoration||t&&!a.textDecoration||t&&a.textDecoration&&!xr(a.textDecoration,t));r.forEach(a=>{a.underline=s,s&&t?a.textDecoration=t:delete a.textDecoration}),this.draw.render({isSetCursor:!1,isCompute:!1})}else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({underline:d?.underline?!1:!this.range.getDefaultStyle()?.underline}),d?.value===x?d.underline=!d.underline:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}strikeout(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(i?.length){const r=i.findIndex(s=>!s.strikeout);i.forEach(s=>{s.strikeout=!!~r}),this.draw.render({isSetCursor:!1,isCompute:!1})}else{let r=!0;const{endIndex:s}=this.range.getRange(),c=this.draw.getElementList()[s];this.range.setDefaultStyle({strikeout:c.strikeout?!1:!this.range.getDefaultStyle()?.strikeout}),c?.value===x?c.strikeout=!c.strikeout:r=!1,this.draw.render({isSubmitHistory:r,curIndex:s,isCompute:!1})}}superscript(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(!i)return;const r=i.findIndex(s=>s.type===l.ElementType.SUPERSCRIPT);i.forEach(s=>{~r?s.type===l.ElementType.SUPERSCRIPT&&(s.type=l.ElementType.TEXT,delete s.actualSize):(!s.type||s.type===l.ElementType.TEXT||s.type===l.ElementType.SUBSCRIPT)&&(s.type=l.ElementType.SUPERSCRIPT)}),this.draw.render({isSetCursor:!1})}subscript(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(!i)return;const r=i.findIndex(s=>s.type===l.ElementType.SUBSCRIPT);i.forEach(s=>{~r?s.type===l.ElementType.SUBSCRIPT&&(s.type=l.ElementType.TEXT,delete s.actualSize):(!s.type||s.type===l.ElementType.TEXT||s.type===l.ElementType.SUPERSCRIPT)&&(s.type=l.ElementType.SUBSCRIPT)}),this.draw.render({isSetCursor:!1})}color(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length)r.forEach(s=>{t?s.color=t:delete s.color}),this.draw.render({isSetCursor:!1,isCompute:!1});else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({color:t||void 0}),d?.value===x?t?d.color=t:delete d.color:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}highlight(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length)r.forEach(s=>{t?s.highlight=t:delete s.highlight}),this.draw.render({isSetCursor:!1,isCompute:!1});else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({highlight:t||void 0}),d?.value===x?t?d.highlight=t:delete d.highlight:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}title(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.draw.getElementList(),s=n===i?this.range.getRangeParagraphElementList():r.slice(n+1,i+1);if(!s||!s.length)return;const a=rt(),c=this.draw.getOptions().title;s.forEach(u=>{!u.type&&u.value===x||(t?(u.level=t,u.titleId=a,Zn(u)&&(u.size=c[Ki[t]],u.bold=!0)):u.titleId&&(delete u.titleId,delete u.title,delete u.level,delete u.size,delete u.bold))});const d=n===i,R=d?i:n;this.draw.render({curIndex:R,isSetCursor:d})}list(t,e){this.draw.isReadonly()||this.draw.getListParticle().setList(t,e)}rowFlex(t){if(this.draw.isReadonly())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.range.getRangeRowElementList();if(!r)return;r.forEach(c=>{c.rowFlex=t});const s=n===i,a=s?i:n;this.draw.render({curIndex:a,isSetCursor:s})}vertical(t){if(this.draw.isReadonly())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.range.getRangeRowElementList();if(!r)return;r.forEach(c=>{c.vertical=t});const s=n===i,a=s?i:n;this.draw.render({curIndex:a,isSetCursor:s})}rowMargin(t){if(this.draw.isReadonly())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.range.getRangeRowElementList();if(!r)return;r.forEach(c=>{c.rowMargin=t});const s=n===i,a=s?i:n;this.draw.render({curIndex:a,isSetCursor:s})}insertTable(t,e){this.draw.isReadonly()||this.draw.isDisabled()||this.getIsRangeInTextField()||this.control.getActiveControl()||this.tableOperate.insertTable(t,e)}insertTableTopRow(){this.draw.isReadonly()||this.tableOperate.insertTableTopRow()}insertTableBottomRow(){this.draw.isReadonly()||this.tableOperate.insertTableBottomRow()}insertTableLeftCol(){this.draw.isReadonly()||this.tableOperate.insertTableLeftCol()}insertTableRightCol(){this.draw.isReadonly()||this.tableOperate.insertTableRightCol()}deleteTableRow(){this.draw.isReadonly()||this.tableOperate.deleteTableRow()}deleteTableCol(){this.draw.isReadonly()||this.tableOperate.deleteTableCol()}deleteTable(){this.draw.isReadonly()||this.tableOperate.deleteTable()}mergeTableCell(){this.draw.isReadonly()||this.tableOperate.mergeTableCell()}cancelMergeTableCell(){this.draw.isReadonly()||this.tableOperate.cancelMergeTableCell()}splitVerticalTableCell(){this.draw.isReadonly()||this.tableOperate.splitVerticalTableCell()}splitHorizontalTableCell(){this.draw.isReadonly()||this.tableOperate.splitHorizontalTableCell()}tableTdVerticalAlign(t){this.draw.isReadonly()||this.tableOperate.tableTdVerticalAlign(t)}tableBorderType(t){this.draw.isReadonly()||this.tableOperate.tableBorderType(t)}tableBorderColor(t){this.draw.isReadonly()||this.tableOperate.tableBorderColor(t)}tableTdBorderType(t){this.draw.isReadonly()||this.tableOperate.tableTdBorderType(t)}tableTdSlashType(t){this.draw.isReadonly()||this.tableOperate.tableTdSlashType(t)}tableTdBackgroundColor(t){this.draw.isReadonly()||this.tableOperate.tableTdBackgroundColor(t)}tableSelectAll(){this.tableOperate.tableSelectAll()}tableProperties(){this.draw.isReadonly()||this.tableOperate.tableProperties()}hyperlink(t){const{valueList:e,url:n,hyperlinkId:i}=t;if(!n||!e?.length||this.draw.isReadonly()||this.draw.isDisabled()||this.control.getActiveControl())return;const{startIndex:a,endIndex:c}=this.range.getRange();!~a&&!~c||this.insertElementList([{type:l.ElementType.HYPERLINK,value:"",valueList:e,url:n,hyperlinkId:i||rt()}])}getHyperlinkRange(){let t=-1,e=-1;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return null;const r=this.draw.getElementList(),s=r[n];if(s.type!==l.ElementType.HYPERLINK)return null;let a=n;for(;a>0;){if(r[a].hyperlinkId!==s.hyperlinkId){t=a+1;break}a--}let c=n+1;for(;c<r.length;){if(r[c].hyperlinkId!==s.hyperlinkId){e=c-1;break}c++}return c===r.length&&(e=c-1),!~t||!~e?null:[t,e]}deleteHyperlink(){if(this.draw.isReadonly()||this.draw.isDisabled())return;const e=this.getHyperlinkRange();if(!e)return;const n=this.draw.getElementList(),[i,r]=e;this.draw.spliceElementList(n,i,r-i+1),this.draw.getHyperlinkParticle().clearHyperlinkPopup();const s=i-1;this.range.setRange(s,s),this.draw.render({curIndex:s})}cancelHyperlink(){if(this.draw.isReadonly()||this.draw.isDisabled())return;const e=this.getHyperlinkRange();if(!e)return;const n=this.draw.getElementList(),[i,r]=e;for(let a=i;a<=r;a++){const c=n[a];delete c.type,delete c.url,delete c.hyperlinkId,delete c.underline}this.draw.getHyperlinkParticle().clearHyperlinkPopup();const{endIndex:s}=this.range.getRange();this.draw.render({curIndex:s,isCompute:!1})}editHyperlink(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const n=this.getHyperlinkRange();if(!n)return;const i=this.draw.getElementList(),[r,s]=n;for(let c=r;c<=s;c++){const d=i[c];d.url=t}this.draw.getHyperlinkParticle().clearHyperlinkPopup();const{endIndex:a}=this.range.getRange();this.draw.render({curIndex:a,isCompute:!1})}separator(t,e){if(this.draw.isReadonly()||this.draw.isDisabled()||this.getIsRangeInTextField()||this.control.getActiveControl())return;const{startIndex:r,endIndex:s}=this.range.getRange();if(!~r&&!~s)return;const a=this.draw.getElementList();let c=-1;const d=a[s+1];if(d&&d.type===l.ElementType.SEPARATOR){if(d.dashArray&&d.dashArray.join()===t.join())return;c=s,Object.assign(d,{dashArray:t,...e})}else{const R={value:Ei,type:l.ElementType.SEPARATOR,dashArray:t,...e};Et(a,[R],r,{editorOptions:this.options}),r!==0&&a[r].value===x?(this.draw.spliceElementList(a,r,1,[R]),c=r-1):(this.draw.spliceElementList(a,r+1,0,[R]),c=r)}this.range.setRange(c,c),this.draw.render({curIndex:c})}pageBreak(){this.draw.isReadonly()||this.draw.isDisabled()||this.control.getActiveControl()||this.insertElementList([{type:l.ElementType.PAGE_BREAK,value:Ei}])}addWatermark(t){if(this.draw.isReadonly())return;const n=this.draw.getOptions(),{color:i,size:r,opacity:s,font:a,gap:c}=Wo;n.watermark.data=t.data,n.watermark.type=t.type||l.WatermarkType.TEXT,t.width&&(n.watermark.width=t.width),t.height&&(n.watermark.height=t.height),n.watermark.color=t.color||i,n.watermark.opacity=t.opacity||s,n.watermark.size=t.size||r,n.watermark.font=t.font||a,n.watermark.repeat=!!t.repeat,t.numberType&&(n.watermark.numberType=t.numberType),n.watermark.gap=t.gap||c,this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1})}deleteWatermark(){if(this.draw.isReadonly())return;const e=this.draw.getOptions();e.watermark&&e.watermark.data&&(e.watermark={...Wo},this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1}))}image(t){if(this.draw.isReadonly()||this.draw.isDisabled())return null;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return null;const r=t.id||rt();return this.insertElementList([{...t,id:r,type:l.ElementType.IMAGE}]),r}search(t,e){this.searchManager.setSearchKeyword(t,e),this.draw.render({isSubmitHistory:!1})}searchNavigatePre(){this.searchManager.searchNavigatePre()!==null&&this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1,isLazy:!1})}searchNavigateNext(){this.searchManager.searchNavigateNext()!==null&&this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1,isLazy:!1})}getSearchNavigateInfo(){return this.searchManager.getSearchNavigateInfo()}replace(t,e){this.draw.getSearch().replace(t,e)}async print(){const{scale:t,printPixelRatio:e,paperDirection:n,width:i,height:r}=this.options;t!==1&&this.draw.setPageScale(1);const s=await this.draw.getDataURL({pixelRatio:e,mode:l.EditorMode.PRINT});kh(s,{width:i,height:r,direction:n}),t!==1&&this.draw.setPageScale(t)}replaceImageElement(t){const{startIndex:e}=this.range.getRange(),i=this.draw.getElementList()[e];!i||i.type!==l.ElementType.IMAGE||(i.value=t,this.draw.render({isSetCursor:!1}))}saveAsImageElement(){const{startIndex:t}=this.range.getRange(),n=this.draw.getElementList()[t];!n||n.type!==l.ElementType.IMAGE||Fi(n.value,`${n.id}.png`)}setImageCrop(t){const{startIndex:e}=this.range.getRange(),i=this.draw.getElementList()[e];!i||i.type!==l.ElementType.IMAGE||(i.imgCrop=t,this.draw.render({isSetCursor:!1,isCompute:!1}))}setImageCaption(t){const{startIndex:e}=this.range.getRange(),i=this.draw.getElementList()[e];i?.type===l.ElementType.IMAGE&&(i.imgCaption=t,this.draw.render({isSetCursor:!1}))}changeImageDisplay(t,e){if(t.imgDisplay===e)return;t.imgDisplay=e;const{startIndex:n,endIndex:i}=this.range.getRange();if(e===l.ImageDisplay.SURROUND||e===l.ImageDisplay.FLOAT_TOP||e===l.ImageDisplay.FLOAT_BOTTOM){const r=this.position.getPositionList(),{pageNo:s,coordinate:{leftTop:a}}=r[n];t.imgFloatPosition={pageNo:s,x:a[0],y:a[1]}}else delete t.imgFloatPosition;this.draw.getPreviewer().clearResizer(),this.draw.render({isSetCursor:!0,curIndex:i})}getImage(t){return this.draw.getDataURL(t)}getPageMode(){return this.options}getOptions(){return this.options}getValue(t){return this.draw.getValue(t)}getValueAsync(t){return this.draw.getWorkerManager().getValue(t)}getAreaValue(t){return this.draw.getArea().getAreaValue(t)}getHTML(){const t=this.options,e=this.draw.getHeaderElementList(),n=this.draw.getOriginalMainElementList(),i=this.draw.getFooterElementList();return{header:ze(e,t).innerHTML,main:ze(n,t).innerHTML,footer:ze(i,t).innerHTML}}getText(){const t=this.draw.getHeaderElementList(),e=this.draw.getOriginalMainElementList(),n=this.draw.getFooterElementList();return{header:qe(t),main:qe(e),footer:qe(n)}}getWordCount(){return this.workerManager.getWordCount()}getCursorPosition(){return this.position.getCursorPosition()}getRemainingContentHeight(){if(!this.draw.getIsPagingMode())return 0;const t=this.draw.getPageRowList(),e=t.length-1,i=(t[e]||[]).reduce((c,d)=>c+d.height+(d.offsetY||0),0),r=this.draw.getHeight(),s=this.draw.getMainOuterHeight(),a=r-(s+i);return a>0?a:0}computeElementListHeight(t){if(!t.length)return 0;const e=this.draw.getInnerWidth();if(e<=0)return 0;const n=dt(t);Yt(n,{isHandleFirstElement:!1,editorOptions:this.options});const i=Do(n);return this.draw.computeRowList({innerWidth:e,elementList:n,surroundElementList:i}).reduce((s,a)=>s+a.height+(a.offsetY||0),0)}getRange(){return dt(this.range.getRange())}getRangeText(){return this.range.toString()}getRangeContext(){const t=this.range.getRange(),{startIndex:e,endIndex:n}=t;if(!~e&&!~n)return null;const i=e===n,r=this.range.toString(),s=Pt(this.range.getSelectionElementList()||[]),a=this.draw.getElementList(),c=be(a[i?e:e+1],{extraPickAttrs:["id","controlComponent"]}),d=be(a[n],{extraPickAttrs:["id","controlComponent"]}),R=this.draw.getRowList(),u=this.position.getPositionList(),h=u[e],g=u[n],f=h?.pageNo,T=g?.pageNo,m=h?.rowIndex,p=g?.rowIndex,I=R[m],L=R[p];let M=0,O=0;this.draw.getCursor().getHitLineStartIndex()||(M=I?.elementList[0]?.value===x?h?.index-I?.startIndex:h?.index-I?.startIndex+1),h===g?O=M:O=L.elementList[0]?.value===x?g.index-L.startIndex:g.index-L.startIndex+1;const C=[],y=this.draw.getOriginalHeight(),X=this.draw.getOriginalPageGap(),V=this.position.getSelectionPositionList();if(V){let U=null,Z=0,_=null;for(let K=0;K<V.length;K++){const{rowNo:$,pageNo:lt,coordinate:{leftTop:j,rightTop:H},lineHeight:J}=V[K];U===null||U!==$?(_&&C.push(_),_={x:j[0],y:j[1]+lt*(y+X),width:H[0]-j[0],height:J},U=$,Z=j[0]):_.width=H[0]-Z,K===V.length-1&&_&&C.push(_)}}else{const Z=this.position.getPositionList()[n],{coordinate:{rightTop:_},pageNo:K,lineHeight:$}=Z;C.push({x:_[0],y:_[1]+K*(y+X),width:0,height:$})}const b=this.draw.getZone().getZone(),{isTable:S,trIndex:W,tdIndex:N,index:P}=this.position.getPositionContext();let F=null;if(S){const Z=this.draw.getOriginalElementList()[P]||null;Z&&(F=Pt([Z])[0])}let E=null,D=null,Y=e-1;for(;Y>0;){const U=a[Y],Z=a[Y-1];if(U.titleId&&U.titleId!==Z?.titleId){E=U.titleId,D=u[Y].pageNo;break}Y--}return dt({isCollapsed:i,startElement:c,endElement:d,startPageNo:f,endPageNo:T,startRowNo:m,endRowNo:p,startColNo:M,endColNo:O,rangeRects:C,zone:b,isTable:S,trIndex:W??null,tdIndex:N??null,tableElement:F,selectionText:r,selectionElementList:s,titleId:E,titleStartPageNo:D})}getRangeRow(){const t=this.range.getRangeRowElementList();return t?Pt(t):null}getRangeParagraph(){const t=this.range.getRangeParagraphElementList();return t?Pt(t):null}getKeywordRangeList(t){return this.range.getKeywordRangeList(t)}getKeywordContext(t){const e=this.getKeywordRangeList(t);if(!e.length)return null;const n=[],i=this.position.getOriginalMainPositionList(),r=this.draw.getOriginalMainElementList();for(let s=0;s<e.length;s++){const a=e[s],{startIndex:c,endIndex:d,tableId:R,startTrIndex:u,startTdIndex:h}=a;let g=i;if(a.tableId){const m=r.find(p=>p.id===R);m&&(g=m.trList?.[u]?.tdList?.[h]?.positionList||[])}const f=dt(g[c]),T=dt(g[d]);n.push({range:a,startPosition:f,endPosition:T})}return n}pageMode(t){this.draw.setPageMode(t)}pageScale(t){t!==this.options.scale&&this.draw.setPageScale(t)}pageScaleRecovery(){const{scale:t}=this.options;t!==1&&this.draw.setPageScale(1)}pageScaleMinus(){const{scale:t}=this.options,e=t*10-1;e>=5&&this.draw.setPageScale(e/10)}pageScaleAdd(){const{scale:t}=this.options,e=t*10+1;e<=30&&this.draw.setPageScale(e/10)}paperSize(t,e){this.draw.setPaperSize(t,e)}paperDirection(t){this.draw.setPaperDirection(t)}getPaperMargin(){return this.options.margins}setPaperMargin(t){return this.draw.setPaperMargin(t)}setMainBadge(t){this.draw.getBadge().setMainBadge(t),this.draw.render({isCompute:!1,isSubmitHistory:!1})}setAreaBadge(t){this.draw.getBadge().setAreaBadgeMap(t),this.draw.render({isCompute:!1,isSubmitHistory:!1})}insertElementList(t,e={}){if(!t.length||this.draw.isReadonly()||this.draw.isDisabled())return;const{isReplace:i=!0,ignoreContextKeys:r}=e;i||this.range.shrinkRange(),console.log(t,"payload");const s=dt(t),{startIndex:a}=this.range.getRange(),c=this.draw.getElementList();Et(c,s,a,{ignoreContextKeys:r,isBreakWhenWrap:!0,editorOptions:this.options}),console.log(s,"cloneElementList"),this.draw.insertElementList(s,e),setTimeout(()=>{console.log(c,"elementList")},500)}appendElementList(t,e){!t.length||this.draw.isReadonly()||this.draw.appendElementList(dt(t),e)}updateElementById(t){const{id:e,conceptId:n}=t;if(!e&&!n)return;const i=[];function r(a,c=!1){let d=0;for(;d<a.length;){const R=a[d];if(d++,R.type===l.ElementType.TABLE){const u=R.trList;for(let h=0;h<u.length;h++){const g=u[h];for(let f=0;f<g.tdList.length;f++){const T=g.tdList[f];r(T.value,c)}}}R.type===l.ElementType.CONTROL&&R.control?.value&&r(R.control.value,!0),(e&&R.id===e||n&&R.conceptId===n)&&i.push({elementList:a,index:d-1,isInsideControl:c})}}const s=[this.draw.getOriginalMainElementList(),this.draw.getHeaderElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);if(i.length){for(let a=0;a<i.length;a++){const{elementList:c,index:d,isInsideControl:R}=i[a],u=c[d],h=u.controlId&&u.controlComponent===l.ControlComponent.VALUE;if(R||h){if(Object.assign(u,t.properties),u.id){const g=Zl(u.id);g&&Object.assign(g,t.properties)}}else{const g=Pt([{...u,...t.properties}],{extraPickAttrs:["id"]});g.length>0&&g[0]?(Ve(Qe,u,g[0]),Yt(g,{isHandleFirstElement:!1,editorOptions:this.options}),c[d]=g[0]):Object.assign(u,t.properties)}}this.draw.render({isSetCursor:!1})}}deleteElementById(t){const{id:e,conceptId:n}=t;if(!e&&!n)return;let i=!1;function r(a){let c=0;for(;c<a.length;){const d=a[c];if(d.type===l.ElementType.TABLE){const R=d.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];r(f.value)}}}d.type===l.ElementType.CONTROL&&d.control?.value&&r(d.control.value),(e&&d.id===e||n&&d.conceptId===n)&&(i=!0,a.splice(c,1),c--),c++}}const s=[this.draw.getOriginalMainElementList(),this.draw.getHeaderElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);i&&this.draw.render({isSetCursor:!1})}getElementById(t){const{id:e,conceptId:n}=t,i=[];if(!e&&!n)return i;const r=a=>{let c=0;for(;c<a.length;){const d=a[c];if(c++,d.type===l.ElementType.TABLE){const R=d.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];r(f.value)}}}e&&d.id!==e||n&&d.conceptId!==n||i.push(d)}},s=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);return Pt(i,{extraPickAttrs:["id"]})}setValue(t,e){this.draw.setValue(t,e)}removeControl(t){if(t?.id||t?.conceptId){const{id:e,conceptId:n}=t;let i=!1;const r=a=>{let c=a.length-1;for(;c>=0;){const d=a[c];if(d.type===l.ElementType.TABLE){const R=d.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];r(f.value)}}}c--,!(!d.control||e&&d.controlId!==e||n&&d.control.conceptId!==n)&&(i=!0,a.splice(c+1,1))}},s=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);i&&this.draw.render({isSetCursor:!1})}else{const{startIndex:e,endIndex:n}=this.range.getRange();if(e!==n||!this.draw.getElementList()[e].controlId)return;const a=this.draw.getControl().removeControl(e);if(a===null)return;this.range.setRange(a,a),this.draw.render({curIndex:a})}}translate(t){return this.i18n.t(t)}setLocale(t){this.i18n.setLocale(t)}getLocale(){return this.i18n.getLocale()}getCatalog(){return this.workerManager.getCatalog()}locationCatalog(t){const e=this.draw.getOriginalElementList();function n(p,I){for(let L=0;L<p.length;L++){const M=p[L];if(M.type===l.ElementType.TABLE){const O=M.trList;for(let C=0;C<O.length;C++){const y=O[C];for(let X=0;X<y.tdList.length;X++){const V=y.tdList[X],b=n(V.value,I);if(b)return{...b,isTable:!0,index:L,trIndex:C,tdIndex:X,tdId:V.id,trId:y.id,tableId:M.id}}}}if(M.titleId===I){let O=L;for(;O<p.length;){if(p[O+1]?.titleId!==I)return{isTable:!1,startIndex:O,endIndex:O};O++}}}return null}const i=n(e,t);if(!i)return;const{isTable:r,index:s,startTdIndex:a,endTdIndex:c,startTrIndex:d,endTrIndex:R,trIndex:u,tdIndex:h,tdId:g,trId:f,tableId:T,endIndex:m}=i;this.position.setPositionContext({isTable:r,index:s,trIndex:u,tdIndex:h,tdId:g,trId:f,tableId:T}),this.range.setRange(m,m,T,a,c,d,R),this.draw.render({curIndex:m,isCompute:!1,isSubmitHistory:!1})}wordTool(){const t=this.draw.getMainElementList();let e=!1;for(let n=0;n<t.length;n++)if(t[n].value===x)for(;n+1<t.length;){const r=t[n+1];if(r.value!==x&&r.value!==ho)break;t.splice(n+1,1),e=!0}if(e)this.draw.render({isSetCursor:!1});else{const n=this.range.getIsCollapsed();this.draw.getCursor().drawCursor({isShow:n})}}setHTML(t){const{header:e,main:n,footer:i}=t,r=this.draw.getOriginalInnerWidth(),s=a=>a!==void 0?je(a,{innerWidth:r}):void 0;this.setValue({header:s(e),main:s(n),footer:s(i)})}setGroup(){return this.draw.isReadonly()?null:this.draw.getGroup().setGroup()}deleteGroup(t){this.draw.isReadonly()||this.draw.getGroup().deleteGroup(t)}getGroupIds(){return this.draw.getWorkerManager().getGroupIds()}locationGroup(t){const e=this.draw.getOriginalMainElementList(),n=this.draw.getGroup().getContextByGroupId(e,t);if(!n)return;const{isTable:i,index:r,trIndex:s,tdIndex:a,tdId:c,trId:d,tableId:R,endIndex:u}=n;this.position.setPositionContext({isTable:i,index:r,trIndex:s,tdIndex:a,tdId:c,trId:d,tableId:R}),this.range.setRange(u,u),this.draw.render({curIndex:u,isCompute:!1,isSubmitHistory:!1})}setZone(t){this.draw.getZone().setZone(t)}getControlValue(t){return this.draw.getControl().getValueById(t)}setControlValue(t){this.draw.getControl().setValueListById([t])}setControlValueList(t){this.draw.getControl().setValueListById(t)}setControlExtension(t){this.draw.getControl().setExtensionListById([t])}setControlExtensionList(t){this.draw.getControl().setExtensionListById(t)}setControlProperties(t){this.draw.getControl().setPropertiesListById([t])}setControlPropertiesList(t){this.draw.getControl().setPropertiesListById(t)}setControlHighlight(t){this.draw.getControl().setHighlightList(t),this.draw.render({isSubmitHistory:!1})}updateOptions(t){const e=Vo(t);Object.entries(e).forEach(([n,i])=>{Reflect.set(this.options,n,i)}),this.forceUpdate()}getControlList(){return this.draw.getControl().getList()}locationControl(t,e){function n(r,s){let a=0;for(;a<r.length;){const c=r[a];if(a++,c.type===l.ElementType.TABLE){const R=c.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g],T=n(f.value,s);if(T)return{...T,positionContext:{isTable:!0,index:a-1,trIndex:u,tdIndex:g,tdId:c.tdId,trId:c.trId,tableId:c.tableId}}}}}if(c?.controlId!==t)continue;let d=a-1;if(e?.position===l.LocationPosition.OUTER_AFTER){if(!(c.controlComponent===l.ControlComponent.POSTFIX&&r[a+1]?.controlComponent!==l.ControlComponent.POST_TEXT))continue}else if(e?.position===l.LocationPosition.OUTER_BEFORE)d-=1;else if(e?.position===l.LocationPosition.AFTER){if(d-=1,c.controlComponent!==l.ControlComponent.PLACEHOLDER&&c.controlComponent!==l.ControlComponent.POSTFIX&&c.controlComponent!==l.ControlComponent.POST_TEXT)continue}else if(c.controlComponent!==l.ControlComponent.PREFIX&&c.controlComponent!==l.ControlComponent.PRE_TEXT||r[a]?.controlComponent===l.ControlComponent.PREFIX||r[a]?.controlComponent===l.ControlComponent.PRE_TEXT)continue;return{zone:s,range:{startIndex:d,endIndex:d},positionContext:{isTable:!1}}}return null}const i=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const r of i){const s=n(r.elementList,r.zone);if(s){this.setZone(s.zone),this.position.setPositionContext(s.positionContext),this.range.replaceRange(s.range),this.draw.render({curIndex:s.range.startIndex,isCompute:!1,isSubmitHistory:!1});break}}}insertTextField(t){if(this.draw.isReadonly()||this.draw.isDisabled()||!t)return;const n=dt(t),{startIndex:i}=this.range.getRange(),r=this.draw.getElementList(),s=$e(r,i);if(!s)return;const a=[...ke,...Jt,...fn,...Qe];Ve(a,s,n),this.draw.insertElementTextField([n])}insertControl(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const n=dt(t),{startIndex:i}=this.range.getRange(),r=this.draw.getElementList(),s=$e(r,i);if(!s)return;const a=r[i],c=a?.controlComponent===l.ControlComponent.POSTFIX||a?.controlComponent===l.ControlComponent.POSTTEXTFIX;let d=!1;if(a?.controlId&&!c)for(let u=i;u>=0;u--){const h=r[u];if(h.controlId!==a.controlId)break;if(h.controlComponent===l.ControlComponent.PRETEXTFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){h.control?.type===l.ControlType.TEXTFIELD&&(d=!0);break}}if(!d&&!c){const u=r[i-1];if(u?.controlId)for(let h=i-1;h>=0;h--){const g=r[h];if(g.controlId!==u.controlId)break;if(g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){g.control?.type===l.ControlType.TEXTFIELD&&(d=!0);break}}}if(d&&t.control?.type===l.ControlType.TEXTFIELD)return;const R=[...ke,...Jt,...fn,...Qe];Ve(R,s,n),this.draw.insertElementList([n])}jumpControl(t){this.draw.getControl().initNextControl({direction:t?.direction})}getContainer(){return this.draw.getContainer()}getTitleValue(t){const{conceptId:e}=t,n=[],i=(s,a)=>{let c=0;for(;c<s.length;){const d=s[c];if(c++,d.type===l.ElementType.TABLE){const h=d.trList;for(let g=0;g<h.length;g++){const f=h[g];for(let T=0;T<f.tdList.length;T++){const m=f.tdList[T];i(m.value,a)}}}if(d?.title?.conceptId!==e)continue;const R=[];let u=c;for(;u<s.length;){const h=s[u];if(u++,d.titleId!==h.titleId){if(h.level&&yo[h.level]<=yo[d.level])break;R.push(h)}}n.push({...d.title,value:qe(R),elementList:Pt(R),zone:a}),c=u}},r=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:s,elementList:a}of r)i(a,s);return n}getPositionContextByEvent(t,e={}){const n=t.target?.dataset.index;if(!n)return null;const{isMustDirectHit:i=!0}=e,r=Number(n),s=this.position.getPositionByXY({x:t.offsetX,y:t.offsetY,pageNo:r}),{isDirectHit:a,isTable:c,index:d,trIndex:R,tdIndex:u,tdValueIndex:h,zone:g}=s;if(i&&!a||g&&g!==this.zone.getZone())return null;let f=null,T=null;const m=this.draw.getOriginalElementList();let p=null;const I=this.position.getOriginalPositionList();if(c){const M=m[d].trList?.[R].tdList[u];T=M?.value[h]||null,p=M?.positionList?.[h]||null,f={element:m[d],trIndex:R,tdIndex:u}}else T=m[d]||null,p=I[d]||null;let L=null;if(p){const{pageNo:M,coordinate:{leftTop:O,rightTop:C},lineHeight:y}=p,X=this.draw.getOriginalHeight(),V=this.draw.getOriginalPageGap();L={x:O[0],y:O[1]+M*(X+V),width:C[0]-O[0],height:y}}return{pageNo:r,element:T,rangeRect:L,tableInfo:f}}insertTitle(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const n=dt(t),{startIndex:i}=this.range.getRange(),r=this.draw.getElementList(),s=$e(r,i);if(!s)return;const a=[...ke,...Jt,...fn,...Qe];n.valueList?.forEach(c=>{Ve(a,s,c)}),this.draw.insertElementList([n])}focus(t){const{position:e=l.LocationPosition.AFTER,isMoveCursorToVisible:n=!0,rowNo:i,range:r}=t||{};let s=-1;if(r)this.range.replaceRange(r),s=e===l.LocationPosition.BEFORE?r.startIndex:r.endIndex;else if(Po(i)){const c=this.draw.getOriginalRowList();if(s=e===l.LocationPosition.BEFORE?c[i]?.startIndex:c[i+1]?.startIndex-1,!Po(s))return;this.range.setRange(s,s)}else s=e===l.LocationPosition.BEFORE?0:this.draw.getOriginalMainElementList().length-1,this.range.setRange(s,s);const a={isCompute:!1,isSetCursor:!1,isSubmitHistory:!1};n&&~s&&this.range.getIsCollapsed()&&(a.curIndex=s,a.isSetCursor=!0),this.draw.render(a)}insertArea(t){return this.draw.getArea().insertArea(t)}setAreaValue(t){return this.draw.getArea().setAreaValue(t)}setAreaProperties(t){this.draw.getArea().setAreaProperties(t)}locationArea(t,e){if(e?.isAppendLastLineBreak&&e?.position===l.LocationPosition.OUTER_AFTER){const r=this.draw.getOriginalMainElementList();r[r.length-1].areaId===t&&this.draw.appendElementList([{value:x}],{isSubmitHistory:!1})}const n=this.draw.getArea().getContextByAreaId(t,e);if(!n)return;const{range:{endIndex:i}}=n;this.position.setPositionContext({isTable:!1}),this.range.setRange(i,i),this.draw.render({curIndex:i,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1})}clearGraffiti(){this.draw.getGraffiti().clear(),this.draw.isGraffitiMode()&&this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1})}getMacroValue(t){const{id:e,dictCode:n,label:i,areaId:r}=t,s=[],a=(d,R)=>{for(const u of d){if(u.type===l.ElementType.TABLE){const g=u.trList;for(const f of g)for(const T of f.tdList)a(T.value,R);continue}if(u.type!==l.ElementType.MACRO&&u.type!==l.ElementType.CUSTOM_MACRO&&u.type!==l.ElementType.REUSABLE_ITEM||e&&u.id!==e||n&&u.dictCode!==n||i&&u.label!==i||r&&u.areaId!==r)continue;const h={id:u.id,type:u.type,label:u.label,dictCode:u.dictCode,zone:R};u.type===l.ElementType.MACRO?h.value=u.value:u.type===l.ElementType.CUSTOM_MACRO?(h.macroConfig=u.macroConfig,h.value=u.macroConfig?.value):u.type===l.ElementType.REUSABLE_ITEM&&(h.reusableItemConfig=u.reusableItemConfig,h.value=u.reusableItemConfig?.value),s.push(h)}},c=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:d,elementList:R}of c)a(R,d);return s}getMacroList(){const t=[],e=i=>{for(const r of i){if(r.type===l.ElementType.TABLE){const s=r.trList;for(const a of s)for(const c of a.tdList)e(c.value);continue}(r.type===l.ElementType.MACRO||r.type===l.ElementType.CUSTOM_MACRO||r.type===l.ElementType.REUSABLE_ITEM)&&t.push(r)}},n=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const i of n)e(i);return t}setMacroValue(t){const{id:e,dictCode:n,label:i,areaId:r,value:s,code:a,isSubmitHistory:c=!0}=t;let d=!1;const R=h=>{for(let g=0;g<h.length;g++){const f=h[g];if(f.type===l.ElementType.TABLE){const T=f.trList;for(const m of T)for(const p of m.tdList)R(p.value);continue}f.type!==l.ElementType.MACRO&&f.type!==l.ElementType.CUSTOM_MACRO&&f.type!==l.ElementType.REUSABLE_ITEM||e&&f.id!==e||n&&f.dictCode!==n||i&&f.label!==i||r&&f.areaId!==r||(d=!0,f.type===l.ElementType.MACRO?f.value=s:f.type===l.ElementType.CUSTOM_MACRO?f.macroConfig?(f.macroConfig.value=s,a!==void 0&&(f.macroConfig.code=a)):f.macroConfig={type:"text",value:s}:f.type===l.ElementType.REUSABLE_ITEM&&(f.reusableItemConfig?f.reusableItemConfig.value=s:f.reusableItemConfig={value:s}))}},u=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const h of u)R(h);d&&this.draw.render({isSubmitHistory:c,isSetCursor:!1})}setMacroValueList(t){if(!t.length)return;let e=!1,n=!1;const i=s=>{for(let a=0;a<s.length;a++){const c=s[a];if(c.type===l.ElementType.TABLE){const g=c.trList;for(const f of g)for(const T of f.tdList)i(T.value);continue}if(c.type!==l.ElementType.MACRO&&c.type!==l.ElementType.CUSTOM_MACRO&&c.type!==l.ElementType.REUSABLE_ITEM)continue;const d=t.find(g=>g.id&&c.id===g.id||g.dictCode&&c.dictCode===g.dictCode||g.label&&c.label===g.label||g.areaId&&c.areaId===g.areaId);if(!d)continue;const{value:R,code:u,isSubmitHistory:h=!0}=d;e=!0,h&&(n=!0),c.type===l.ElementType.MACRO?c.value=R:c.type===l.ElementType.CUSTOM_MACRO?c.macroConfig?(c.macroConfig.value=R,u!==void 0&&(c.macroConfig.code=u)):c.macroConfig={type:"text",value:R}:c.type===l.ElementType.REUSABLE_ITEM&&(c.reusableItemConfig?c.reusableItemConfig.value=R:c.reusableItemConfig={value:R})}},r=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const s of r)i(s);e&&(n||this.draw.getHistoryManager().recovery(),this.draw.render({isSubmitHistory:n,isSetCursor:!1}))}updateMacroProperties(t){const{id:e,dictCode:n,label:i,areaId:r,properties:s,isSubmitHistory:a=!0}=t;let c=!1;const d=u=>{for(let h=0;h<u.length;h++){const g=u[h];if(g.type===l.ElementType.TABLE){const f=g.trList;for(const T of f)for(const m of T.tdList)d(m.value);continue}g.type!==l.ElementType.MACRO&&g.type!==l.ElementType.CUSTOM_MACRO&&g.type!==l.ElementType.REUSABLE_ITEM||e&&g.id!==e||n&&g.dictCode!==n||i&&g.label!==i||r&&g.areaId!==r||(c=!0,Object.assign(g,s))}},R=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const u of R)d(u);c&&this.draw.render({isSubmitHistory:a,isSetCursor:!1})}locationMacro(t){const{id:e,dictCode:n,label:i,areaId:r}=t,s=(c,d)=>{for(let R=0;R<c.length;R++){const u=c[R];if(u.type===l.ElementType.TABLE){const h=u.trList;for(let g=0;g<h.length;g++){const f=h[g];for(let T=0;T<f.tdList.length;T++){const m=f.tdList[T],p=s(m.value,d);if(p)return{...p,isTable:!0,index:R,trIndex:g,tdIndex:T,tableId:u.tableId,trId:f.id,tdId:m.id}}}}if(!(u.type!==l.ElementType.MACRO&&u.type!==l.ElementType.CUSTOM_MACRO&&u.type!==l.ElementType.REUSABLE_ITEM)&&!(e&&u.id!==e)&&!(n&&u.dictCode!==n)&&!(i&&u.label!==i)&&!(r&&u.areaId!==r))return{zone:d,index:R}}return null},a=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:c,elementList:d}of a){const R=s(d,c);if(R){this.setZone(R.zone),this.position.setPositionContext({isTable:R.isTable||!1,index:R.index,trIndex:R.trIndex,tdIndex:R.tdIndex,tableId:R.tableId,trId:R.trId,tdId:R.tdId}),this.range.replaceRange({startIndex:R.index,endIndex:R.index}),this.draw.render({curIndex:R.index,isCompute:!1,isSubmitHistory:!1});break}}}}class jh{rangeStyleChange;visiblePageNoListChange;intersectionPageNoChange;pageSizeChange;pageScaleChange;saved;contentChange;controlChange;controlContentChange;pageModeChange;zoneChange;constructor(){this.rangeStyleChange=null,this.visiblePageNoListChange=null,this.intersectionPageNoChange=null,this.pageSizeChange=null,this.pageScaleChange=null,this.saved=null,this.contentChange=null,this.controlChange=null,this.controlContentChange=null,this.pageModeChange=null,this.zoneChange=null}}class qh{contextMenu;contextMenuList;getContextMenuList;shortcutList;langMap;constructor(t){const{contextMenu:e,shortcut:n,i18n:i}=t;this.contextMenu=e,this.contextMenuList=e.registerContextMenuList.bind(e),this.getContextMenuList=e.getContextMenuList.bind(e),this.shortcutList=n.registerShortcutList.bind(n),this.langMap=i.registerLangMap.bind(i)}disposeContextMenu(){this.contextMenu.dispose()}}const Cr={SELECTED_TEXT:"%s"},hn={GLOBAL:{CUT:"globalCut",COPY:"globalCopy",PASTE:"globalPaste",SELECT_ALL:"globalSelectAll",PRINT:"globalPrint"},CONTROL:{DELETE:"controlDelete",EDIT_ATTRIBUTE:"controlEditAttribute",COPY:"controlCopy",PASTE:"controlPaste"},HYPERLINK:{DELETE:"hyperlinkDelete",CANCEL:"hyperlinkCancel",EDIT:"hyperlinkEdit"},IMAGE:{CHANGE:"imageChange",SAVE_AS:"imageSaveAs",TEXT_WRAP:"imageTextWrap",TEXT_WRAP_EMBED:"imageTextWrapEmbed",TEXT_WRAP_UP_DOWN:"imageTextWrapUpDown",TEXT_WRAP_SURROUND:"imageTextWrapSurround",TEXT_WRAP_FLOAT_TOP:"imageTextWrapFloatTop",TEXT_WRAP_FLOAT_BOTTOM:"imageTextWrapFloatBottom"},TABLE:{BORDER:"border",BORDER_ALL:"tableBorderAll",BORDER_EMPTY:"tableBorderEmpty",BORDER_DASH:"tableBorderDash",BORDER_EXTERNAL:"tableBorderExternal",BORDER_INTERNAL:"tableBorderInternal",BORDER_TD:"tableBorderTd",BORDER_TD_TOP:"tableBorderTdTop",BORDER_TD_RIGHT:"tableBorderTdRight",BORDER_TD_BOTTOM:"tableBorderTdBottom",BORDER_TD_LEFT:"tableBorderTdLeft",BORDER_TD_FORWARD:"tableBorderTdForward",BORDER_TD_BACK:"tableBorderTdBack",VERTICAL_ALIGN:"tableVerticalAlign",VERTICAL_ALIGN_TOP:"tableVerticalAlignTop",VERTICAL_ALIGN_MIDDLE:"tableVerticalAlignMiddle",VERTICAL_ALIGN_BOTTOM:"tableVerticalAlignBottom",INSERT_ROW_COL:"tableInsertRowCol",INSERT_TOP_ROW:"tableInsertTopRow",INSERT_BOTTOM_ROW:"tableInsertBottomRow",INSERT_LEFT_COL:"tableInsertLeftCol",INSERT_RIGHT_COL:"tableInsertRightCol",DELETE_ROW_COL:"tableDeleteRowCol",DELETE_ROW:"tableDeleteRow",DELETE_COL:"tableDeleteCol",DELETE_TABLE:"tableDeleteTable",MERGE_CELL:"tableMergeCell",CANCEL_MERGE_CELL:"tableCancelMergeCell",TABLE_PROPERTIES:"tableProperties"}},{CONTROL:{DELETE:tg,EDIT_ATTRIBUTE:eg,COPY:ng,PASTE:og}}=hn;function Sr(o,t){if(t!==l.EditorMode.EDIT)return!1;const n=o?.control?.type,i=o?.controlComponent,r=n===l.ControlType.TEXT||n===l.ControlType.TEXTFIELD||n===l.ControlType.NUMBER||n===l.ControlType.SELECT||n===l.ControlType.DATE||n===l.ControlType.CHECKBOX||n===l.ControlType.RADIO||n===l.ControlType.BUTTON,s=i==="prefix"||i==="preText"||i==="preTextFix"||i==="textFixLabel"||n===l.ControlType.BUTTON&&i==="value";return r&&s}const ig=[{key:ng,name:"复制控件",when:o=>!o.isReadonly&&!o.editorHasSelection&&!!o.startElement?.controlId&&Sr(o.startElement,o.options.mode),callback:(o,t)=>{const e=t.startElement?.controlId;e&&o.executeCopyControl(e)}},{key:og,name:"粘贴控件",when:o=>!o.isReadonly&&!o.editorHasSelection&&o.editorTextFocus&&o.options.mode===l.EditorMode.EDIT&&Bl(),callback:o=>{o.executePasteControl()}},{key:tg,i18nPath:"contextmenu.control.delete",when:o=>!o.isReadonly&&!o.editorHasSelection&&!!o.startElement?.controlId&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeRemoveControl()}},{key:eg,i18nPath:"contextmenu.control.editAttribute",when:o=>!o.isReadonly&&!o.editorHasSelection&&!!o.startElement?.controlId&&Sr(o.startElement,o.options.mode),callback:(o,t)=>{const e=t.startElement?.controlId;e&&o.executeTriggerControlEditAttribute(e)}}],{GLOBAL:{CUT:sg,COPY:rg,PASTE:lg,SELECT_ALL:ag,PRINT:cg}}=hn,dg=[{key:sg,i18nPath:"contextmenu.global.cut",shortCut:`${Ze?"⌘":"Ctrl"} + X`,when:o=>!o.isReadonly,callback:o=>{o.executeCut()}},{key:rg,i18nPath:"contextmenu.global.copy",shortCut:`${Ze?"⌘":"Ctrl"} + C`,when:o=>o.editorHasSelection||o.isCrossRowCol,callback:o=>{o.executeCopy()}},{key:lg,i18nPath:"contextmenu.global.paste",shortCut:`${Ze?"⌘":"Ctrl"} + V`,when:o=>!o.isReadonly&&o.editorTextFocus,callback:o=>{o.executePaste()}},{key:ag,i18nPath:"contextmenu.global.selectAll",shortCut:`${Ze?"⌘":"Ctrl"} + A`,when:o=>o.editorTextFocus,callback:o=>{o.executeSelectAll()}},{isDivider:!0},{key:cg,i18nPath:"contextmenu.global.print",icon:"print",when:()=>!0,callback:o=>{o.executePrint()}}],{HYPERLINK:{DELETE:Rg,CANCEL:ug,EDIT:hg}}=hn,gg=[{key:Rg,i18nPath:"contextmenu.hyperlink.delete",when:o=>!o.isReadonly&&o.startElement?.type===l.ElementType.HYPERLINK,callback:o=>{o.executeDeleteHyperlink()}},{key:ug,i18nPath:"contextmenu.hyperlink.cancel",when:o=>!o.isReadonly&&o.startElement?.type===l.ElementType.HYPERLINK,callback:o=>{o.executeCancelHyperlink()}},{key:hg,i18nPath:"contextmenu.hyperlink.edit",when:o=>!o.isReadonly&&o.startElement?.type===l.ElementType.HYPERLINK,callback:(o,t)=>{const e=window.prompt(o.executeTranslate("contextmenu.hyperlink.edit"),t.startElement?.url);e&&o.executeEditHyperlink(e)}}],{IMAGE:{CHANGE:fg,SAVE_AS:Tg,TEXT_WRAP:mg,TEXT_WRAP_EMBED:pg,TEXT_WRAP_UP_DOWN:Lg,TEXT_WRAP_SURROUND:Ig,TEXT_WRAP_FLOAT_TOP:Pg,TEXT_WRAP_FLOAT_BOTTOM:Mg}}=hn,Og=[{key:fg,i18nPath:"contextmenu.image.change",icon:"image-change",when:o=>!o.isReadonly&&!o.editorHasSelection&&o.startElement?.type===l.ElementType.IMAGE,callback:o=>{const t=document.createElement("input");t.type="file",t.accept=".png, .jpg, .jpeg",t.onchange=()=>{const e=t.files[0],n=new FileReader;n.readAsDataURL(e),n.onload=()=>{const i=n.result;o.executeReplaceImageElement(i)}},t.click()}},{key:Tg,i18nPath:"contextmenu.image.saveAs",icon:"image",when:o=>!o.editorHasSelection&&o.startElement?.type===l.ElementType.IMAGE,callback:o=>{o.executeSaveAsImageElement()}},{key:mg,i18nPath:"contextmenu.image.textWrap",when:o=>!o.isReadonly&&!o.editorHasSelection&&o.startElement?.type===l.ElementType.IMAGE,childMenus:[{key:pg,i18nPath:"contextmenu.image.textWrapType.embed",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.BLOCK)}},{key:Lg,i18nPath:"contextmenu.image.textWrapType.upDown",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.INLINE)}},{key:Ig,i18nPath:"contextmenu.image.textWrapType.surround",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.SURROUND)}},{key:Pg,i18nPath:"contextmenu.image.textWrapType.floatTop",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.FLOAT_TOP)}},{key:Mg,i18nPath:"contextmenu.image.textWrapType.floatBottom",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.FLOAT_BOTTOM)}}]}],{TABLE:{BORDER:Cg,BORDER_ALL:Sg,BORDER_EMPTY:Eg,BORDER_DASH:Xg,BORDER_EXTERNAL:Ng,BORDER_INTERNAL:Fg,BORDER_TD:yg,BORDER_TD_TOP:Wg,BORDER_TD_LEFT:Vg,BORDER_TD_BOTTOM:bg,BORDER_TD_RIGHT:Yg,BORDER_TD_BACK:Dg,BORDER_TD_FORWARD:Ug,VERTICAL_ALIGN:wg,VERTICAL_ALIGN_TOP:Zg,VERTICAL_ALIGN_MIDDLE:Qg,VERTICAL_ALIGN_BOTTOM:vg,INSERT_ROW_COL:Kg,INSERT_TOP_ROW:Hg,INSERT_BOTTOM_ROW:_g,INSERT_LEFT_COL:xg,INSERT_RIGHT_COL:Gg,DELETE_ROW_COL:Ag,DELETE_ROW:kg,DELETE_COL:Jg,DELETE_TABLE:Bg,MERGE_CELL:$g,CANCEL_MERGE_CELL:zg,TABLE_PROPERTIES:jg}}=hn,qg=[{isDivider:!0},{key:Cg,i18nPath:"contextmenu.table.border",icon:"border-all",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:Sg,i18nPath:"contextmenu.table.borderAll",icon:"border-all",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.ALL)}},{key:Eg,i18nPath:"contextmenu.table.borderEmpty",icon:"border-empty",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.EMPTY)}},{key:Xg,i18nPath:"contextmenu.table.borderDash",icon:"border-dash",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.DASH)}},{key:Ng,i18nPath:"contextmenu.table.borderExternal",icon:"border-external",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.EXTERNAL)}},{key:Fg,i18nPath:"contextmenu.table.borderInternal",icon:"border-internal",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.INTERNAL)}},{key:yg,i18nPath:"contextmenu.table.borderTd",icon:"border-td",when:()=>!0,childMenus:[{key:Wg,i18nPath:"contextmenu.table.borderTdTop",icon:"border-td-top",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.TOP)}},{key:Yg,i18nPath:"contextmenu.table.borderTdRight",icon:"border-td-right",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.RIGHT)}},{key:bg,i18nPath:"contextmenu.table.borderTdBottom",icon:"border-td-bottom",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.BOTTOM)}},{key:Vg,i18nPath:"contextmenu.table.borderTdLeft",icon:"border-td-left",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.LEFT)}},{key:Ug,i18nPath:"contextmenu.table.borderTdForward",icon:"border-td-forward",when:()=>!0,callback:o=>{o.executeTableTdSlashType(l.TdSlash.FORWARD)}},{key:Dg,i18nPath:"contextmenu.table.borderTdBack",icon:"border-td-back",when:()=>!0,callback:o=>{o.executeTableTdSlashType(l.TdSlash.BACK)}}]}]},{key:wg,i18nPath:"contextmenu.table.verticalAlign",icon:"vertical-align",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:Zg,i18nPath:"contextmenu.table.verticalAlignTop",icon:"vertical-align-top",when:()=>!0,callback:o=>{o.executeTableTdVerticalAlign(l.VerticalAlign.TOP)}},{key:Qg,i18nPath:"contextmenu.table.verticalAlignMiddle",icon:"vertical-align-middle",when:()=>!0,callback:o=>{o.executeTableTdVerticalAlign(l.VerticalAlign.MIDDLE)}},{key:vg,i18nPath:"contextmenu.table.verticalAlignBottom",icon:"vertical-align-bottom",when:()=>!0,callback:o=>{o.executeTableTdVerticalAlign(l.VerticalAlign.BOTTOM)}}]},{key:Kg,i18nPath:"contextmenu.table.insertRowCol",icon:"insert-row-col",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:Hg,i18nPath:"contextmenu.table.insertTopRow",icon:"insert-top-row",when:()=>!0,callback:o=>{o.executeInsertTableTopRow()}},{key:_g,i18nPath:"contextmenu.table.insertBottomRow",icon:"insert-bottom-row",when:()=>!0,callback:o=>{o.executeInsertTableBottomRow()}},{key:xg,i18nPath:"contextmenu.table.insertLeftCol",icon:"insert-left-col",when:()=>!0,callback:o=>{o.executeInsertTableLeftCol()}},{key:Gg,i18nPath:"contextmenu.table.insertRightCol",icon:"insert-right-col",when:()=>!0,callback:o=>{o.executeInsertTableRightCol()}}]},{key:Ag,i18nPath:"contextmenu.table.deleteRowCol",icon:"delete-row-col",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:kg,i18nPath:"contextmenu.table.deleteRow",icon:"delete-row",when:()=>!0,callback:o=>{o.executeDeleteTableRow()}},{key:Jg,i18nPath:"contextmenu.table.deleteCol",icon:"delete-col",when:()=>!0,callback:o=>{o.executeDeleteTableCol()}},{key:Bg,i18nPath:"contextmenu.table.deleteTable",icon:"delete-table",when:()=>!0,callback:o=>{o.executeDeleteTable()}}]},{key:$g,i18nPath:"contextmenu.table.mergeCell",icon:"merge-cell",when:o=>!o.isReadonly&&o.isCrossRowCol&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeMergeTableCell()}},{key:zg,i18nPath:"contextmenu.table.mergeCancelCell",icon:"merge-cancel-cell",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeCancelMergeTableCell()}},{key:jg,i18nPath:"contextmenu.table.tableProperties",icon:"table-properties",when:o=>!1,callback:o=>{o.executeTableProperties()}}];class tf{options;draw;command;range;position;i18n;container;contextMenuList;contextMenuContainerList;contextMenuRelationShip;context;constructor(t,e){this.options=t.getOptions(),this.draw=t,this.command=e,this.range=t.getRange(),this.position=t.getPosition(),this.i18n=t.getI18n(),this.container=t.getContainer(),this.context=null,this.contextMenuList=[...dg,...qg,...Og,...ig,...gg],this.contextMenuContainerList=[],this.contextMenuRelationShip=new Map,this._addEvent()}getContextMenuList(){return this.contextMenuList}_addEvent(){this.container.addEventListener("contextmenu",this._proxyContextMenuEvent),document.addEventListener("mousedown",this._handleSideEffect)}removeEvent(){this.container.removeEventListener("contextmenu",this._proxyContextMenuEvent),document.removeEventListener("mousedown",this._handleSideEffect)}_filterMenuList(t){const{contextMenuDisableKeys:e}=this.options,n=[];for(let i=0;i<t.length;i++){const r=t[i];r.disable||r.key&&e.includes(r.key)||(r.isDivider||r.when?.(this.context))&&n.push(r)}return n}_proxyContextMenuEvent=t=>{this.context=this._getContext();const e=this._filterMenuList(this.contextMenuList);e.some(i=>!i.isDivider)&&(this.dispose(),this._render({contextMenuList:e,left:t.x,top:t.y})),t.preventDefault()};_handleSideEffect=t=>{const e=t.target;this.contextMenuContainerList.some(i=>i.contains(e))||this.dispose()};_getContext(){const t=this.draw.isReadonly(),{isCrossRowCol:e,startIndex:n,endIndex:i}=this.range.getRange(),r=!!(~n||~i),s=r&&n!==i,{isTable:a,trIndex:c,tdIndex:d,index:R}=this.position.getPositionContext();let u=null;if(a){const I=this.draw.getOriginalElementList()[R]||null;I&&(u=Pt([I],{extraPickAttrs:["id"]})[0])}const h=a&&!!e,g=this.draw.getElementList(),f=g[n]||null,T=g[i]||null,m=this.draw.getZone().getZone();return{startElement:f,endElement:T,isReadonly:t,editorHasSelection:s,editorTextFocus:r,isCrossRowCol:h,zone:m,isInTable:a,trIndex:c??null,tdIndex:d??null,tableElement:u,options:this.options}}_createContextMenuContainer(){const t=document.createElement("div");return t.classList.add(`${B}-contextmenu-container`),t.setAttribute(ce,l.EditorComponent.CONTEXTMENU),this.container.append(t),t}_render(t){const{contextMenuList:e,left:n,top:i,parentMenuContainer:r}=t,s=this._createContextMenuContainer(),a=document.createElement("div");a.classList.add(`${B}-contextmenu-content`);let c=null;r&&this.contextMenuRelationShip.set(r,s);for(let M=0;M<e.length;M++){const O=e[M];if(O.isDivider){if(M!==0&&M!==e.length-1&&!e[M-1]?.isDivider){const C=document.createElement("div");C.classList.add(`${B}-contextmenu-divider`),a.append(C)}}else{const C=document.createElement("div");if(C.classList.add(`${B}-contextmenu-item`),O.childMenus){const b=this._filterMenuList(O.childMenus);b.some(W=>!W.isDivider)&&(C.classList.add(`${B}-contextmenu-sub-item`),C.onmouseenter=()=>{this._setHoverStatus(C,!0),this._removeSubMenu(s);const W=C.getBoundingClientRect(),N=W.left+W.width,P=W.top;c=this._render({contextMenuList:b,left:N,top:P,parentMenuContainer:s})},C.onmouseleave=W=>{(!c||!c.contains(W.relatedTarget))&&this._setHoverStatus(C,!1)})}else C.onmouseenter=()=>{this._setHoverStatus(C,!0),this._removeSubMenu(s)},C.onmouseleave=()=>{this._setHoverStatus(C,!1)},C.onclick=()=>{O.callback&&this.context&&O.callback(this.command,this.context),this.dispose()};const y=document.createElement("i");C.append(y),O.icon&&y.classList.add(`${B}-contextmenu-${O.icon}`);const X=document.createElement("span"),V=O.i18nPath?this._formatName(this.i18n.t(O.i18nPath)):this._formatName(O.name||"");if(X.append(document.createTextNode(V)),C.append(X),O.shortCut){const b=document.createElement("span");b.classList.add(`${B}-shortcut`),b.append(document.createTextNode(O.shortCut)),C.append(b)}a.append(C)}}const d=document.createElement("div");d.classList.add(`${B}-contextmenu-divider`),a.append(d);const R=document.createElement("div");R.classList.add(`${B}-contextmenu-item`),R.onmouseenter=()=>{this._setHoverStatus(R,!0),this._removeSubMenu(s)},R.onmouseleave=()=>{this._setHoverStatus(R,!1)},R.onclick=()=>{this.dispose()};const u=document.createElement("i");R.append(u);const h=document.createElement("span");h.append(document.createTextNode(this.i18n.t("contextmenu.global.cancel"))),R.append(h),a.append(R),s.append(a),s.style.display="block";const g=window.innerWidth,f=s.getBoundingClientRect(),T=f.width,m=n+T>g?n-T:n;s.style.left=`${m}px`;const p=window.innerHeight,I=f.height,L=i+I>p?i-I:i;return s.style.top=`${L}px`,this.contextMenuContainerList.push(s),s}_removeSubMenu(t){const e=this.contextMenuRelationShip.get(t);e&&(this._removeSubMenu(e),e.remove(),this.contextMenuRelationShip.delete(t))}_setHoverStatus(t,e){e?(t.parentNode?.querySelectorAll(`${B}-contextmenu-item`).forEach(n=>n.classList.remove("hover")),t.classList.add("hover")):t.classList.remove("hover")}_formatName(t){const e=Object.values(Cr),n=new RegExp(`${e.join("|")}`);let i=t;if(n.test(i)){const r=new RegExp(Cr.SELECTED_TEXT,"g");if(r.test(i)){const s=this.range.toString();i=i.replace(r,s)}}return i}registerContextMenuList(t){this.contextMenuList.push(...t)}dispose(){this.contextMenuContainerList.forEach(t=>t.remove()),this.contextMenuContainerList=[],this.contextMenuRelationShip.clear()}}const ef=[{key:l.KeyMap.X,ctrl:!0,shift:!0,callback:o=>{o.executeStrikeout()}},{key:l.KeyMap.LEFT_BRACKET,mod:!0,callback:o=>{o.executeSizeAdd()}},{key:l.KeyMap.RIGHT_BRACKET,mod:!0,callback:o=>{o.executeSizeMinus()}},{key:l.KeyMap.B,mod:!0,callback:o=>{o.executeBold()}},{key:l.KeyMap.I,mod:!0,callback:o=>{o.executeItalic()}},{key:l.KeyMap.U,mod:!0,callback:o=>{o.executeUnderline()}},{key:Ze?l.KeyMap.COMMA:l.KeyMap.RIGHT_ANGLE_BRACKET,mod:!0,shift:!0,callback:o=>{o.executeSuperscript()}},{key:Ze?l.KeyMap.PERIOD:l.KeyMap.LEFT_ANGLE_BRACKET,mod:!0,shift:!0,callback:o=>{o.executeSubscript()}},{key:l.KeyMap.L,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.LEFT)}},{key:l.KeyMap.E,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.CENTER)}},{key:l.KeyMap.R,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.RIGHT)}},{key:l.KeyMap.J,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.ALIGNMENT)}},{key:l.KeyMap.J,mod:!0,shift:!0,callback:o=>{o.executeRowFlex(l.RowFlex.JUSTIFY)}}],nf=[{key:l.KeyMap.ZERO,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(null)}},{key:l.KeyMap.ONE,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.FIRST)}},{key:l.KeyMap.TWO,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.SECOND)}},{key:l.KeyMap.THREE,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.THIRD)}},{key:l.KeyMap.FOUR,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.FOURTH)}},{key:l.KeyMap.FIVE,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.FIFTH)}},{key:l.KeyMap.SIX,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.SIXTH)}}],of=[{key:l.KeyMap.I,shift:!0,mod:!0,callback:o=>{o.executeList(l.ListType.UL,l.ListStyle.DISC)}},{key:l.KeyMap.U,shift:!0,mod:!0,callback:o=>{o.executeList(l.ListType.OL)}}];class sf{command;globalShortcutList;agentShortcutList;constructor(t,e){this.command=e,this.globalShortcutList=[],this.agentShortcutList=[],this._addShortcutList([...ef,...nf,...of]),this._addEvent(),t.getCursor().getAgentDom().addEventListener("keydown",this._agentKeydown.bind(this))}_addEvent(){document.addEventListener("keydown",this._globalKeydown)}removeEvent(){document.removeEventListener("keydown",this._globalKeydown)}_addShortcutList(t){for(let e=t.length-1;e>=0;e--){const n=t[e];n.isGlobal?this.globalShortcutList.unshift(n):this.agentShortcutList.unshift(n)}}registerShortcutList(t){this._addShortcutList(t)}_globalKeydown=t=>{this.globalShortcutList.length&&this._execute(t,this.globalShortcutList)};_agentKeydown(t){this.agentShortcutList.length&&this._execute(t,this.agentShortcutList)}_execute(t,e){for(let n=0;n<e.length;n++){const i=e[n];if((i.mod?ge(t)===!!i.mod:t.ctrlKey===!!i.ctrl&&t.metaKey===!!i.meta)&&t.shiftKey===!!i.shift&&t.altKey===!!i.alt&&t.key.toLowerCase()===i.key.toLowerCase()){i.disable||(i?.callback?.(this.command),t.preventDefault());break}}}}class rf{editor;constructor(t){this.editor=t}use(t,e){t(this.editor,e)}}class lf{eventHub;constructor(){this.eventHub=new Map}on(t,e){if(!t||typeof e!="function")return;const n=this.eventHub.get(t)||new Set;n.add(e),this.eventHub.set(t,n)}emit(t,e){if(!t)return;const n=this.eventHub.get(t);if(n){if(n.size===1)return[...n][0](e);n.forEach(i=>i(e))}}off(t,e){if(!t||typeof e!="function")return;const n=this.eventHub.get(t);n&&n.delete(e)}isSubscribe(t){const e=this.eventHub.get(t);return!!e&&e.size>0}dangerouslyClearAll(){this.eventHub.clear()}}class af{paste;copy;drop}class Er{command;version;listener;eventBus;override;register;destroy;use;constructor(t,e,n={}){const i=Vo(n);e=dt(e);let r=[],s=[],a=[],c=[];Array.isArray(e)?s=e:(r=e.header||[],s=e.main,a=e.footer||[],c=e.graffiti||[]),[r,s,a].forEach(f=>{Yt(f,{editorOptions:i,isForceCompensation:!0})}),this.version=we,this.listener=new jh,this.eventBus=new lf,this.override=new af;const R=new Gh(t,i,{header:r,main:s,footer:a,graffiti:c},this.listener,this.eventBus,this.override);this.command=new Mr(new zh(R)),R.setCommand(this.command);const u=new tf(R,this.command),h=new sf(R,this.command);this.register=new qh({contextMenu:u,shortcut:h,i18n:R.getI18n()}),this.destroy=()=>{R.destroy(),h.removeEvent(),u.removeEvent(),this.eventBus.dangerouslyClearAll()};const g=new rf(this);this.use=g.use.bind(g)}}l.Command=Mr,l.EDITOR_CLIPBOARD=gn,l.EDITOR_COMPONENT=ce,l.Editor=Er,l.INTERNAL_CONTEXT_MENU_KEY=hn,l.INTERNAL_SHORTCUT_KEY=cs,l.LETTER_CLASS=go,l.createDomFromElementList=ze,l.default=Er,l.getElementListByHTML=je,l.getTextFromElementList=qe,l.splitText=Rt,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
548
|
+
`?x:r[d];e.splice(c+d,0,{...a,value:R})}}}const{endIndex:i}=this.range.getRange();this.draw.render({curIndex:i,isSetCursor:!0})}}delButton(t,e){return new Promise(n=>{for(let i=t.length-1;i>=0;i--)e.some(s=>s.controlId===t[i].controlId&&s.type===t[i].type)&&t.splice(i,1);n(!0)})}editButton(t,e,n){const i=this.draw.getElementList();n=n+1;for(let d=0;d<e.label.length;d++){const R={value:e.label[d],controlId:e.controlId,type:l.ElementType.CONTROL,control:{type:"button",buttonLabel:e.label,code:e.code,value:[{value:e.label}],label:e.label,hide:!1},controlComponent:"value",color:"#fff",highlight:"#1677FF",style:"16px Microsoft YaHei",hide:!1};i.splice(n+d,0,R)}const{startIndex:r,endIndex:s}=this.range.getRange(),a=!0,c=s;this.draw.render({curIndex:c,isSetCursor:a})}removeButtonElementsByControlId(t){return new Promise(e=>{const n=this.draw.getElementList();for(let c=n.length-1;c>=0;c--)n[c].controlId===t&&n.splice(c,1);const{startIndex:i,endIndex:r}=this.range.getRange(),s=!0,a=r;this.draw.render({curIndex:a,isSetCursor:s}),e(!0)})}removeByValue(t,e){return new Promise(n=>{for(let c=t.length-1;c>=0;c--)(t[c].type=="control"||t[c].type=="text"||t[c].type=="buttonText")&&t[c].control?.buttonLabel===e&&t[c].control?.buttonText&&t.splice(c,1);const{startIndex:i,endIndex:r}=this.range.getRange(),s=!0,a=r;this.draw.render({curIndex:a,isSetCursor:s}),n(!0)})}insertButtonValue(t){const e=this.draw.getElementList(),n=t.controlId,i=t.element[0].newButtonValue,r=t.element[0].control.buttonLabel,s=t.element[0].control.code;if(!i||!i.length)return;let a=-1;for(let m=0;m<e.length;m++)if(e[m].controlId===n&&e[m].control?.type==="button"){a=m;break}if(a===-1)return;const c=n+"_text",d=[];for(let m=0;m<i.length;m++){const p=i[m];d.push({value:p.value,code:p.code})}const R={type:"button",buttonLabel:r,buttonText:!0,label:r,code:s,value:d,hide:!1},u=[];u.push({value:"[",controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.PREFIX,color:"#1677FF",hide:!1});for(let m=0;m<i.length;m++){const p=i[m],I=i.length>1?`${m+1}.${p.value}`:p.value,L=Rt(I);for(let M=0;M<L.length;M++)u.push({value:L[M],controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.VALUE,color:"#000",hide:!1});i.length>1&&m<i.length-1&&u.push({value:x,controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.VALUE,color:"#000",hide:!1})}u.push({value:"]",controlId:c,type:l.ElementType.CONTROL,control:R,controlComponent:l.ControlComponent.POSTFIX,color:"#1677FF",hide:!1});for(let m=0;m<u.length;m++)e.splice(a+m,0,u[m]);const{startIndex:h,endIndex:g}=this.range.getRange(),f=!0,T=g;this.draw.render({curIndex:T,isSetCursor:f})}font(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length)r.forEach(s=>{s.font=t}),this.draw.render({isSetCursor:!1});else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({font:t}),d?.value===x?d.font=t:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}size(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const{minSize:r,maxSize:s,defaultSize:a}=this.options;if(t<r||t>s)return;let c={},d=[];const R=this.range.getTextLikeSelectionElementList();if(R?.length)d=R,c={isSetCursor:!1};else{const{endIndex:h}=this.range.getRange(),f=this.draw.getElementList()[h];this.range.setDefaultStyle({size:t}),f?.value===x?(d.push(f),c={curIndex:h}):this.draw.render({curIndex:h,isCompute:!1,isSubmitHistory:!1})}if(!d.length)return;let u=!1;d.forEach(h=>{!h.size&&t===a||h.size&&h.size===t||(h.size=t,u=!0)}),u&&this.draw.render(c)}sizeAdd(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const{defaultSize:i,maxSize:r}=this.options,s=this.range.getTextLikeSelectionElementList();let a={},c=[];if(s?.length)c=s,a={isSetCursor:!1};else{const{endIndex:R}=this.range.getRange(),h=this.draw.getElementList()[R],f=this.range.getDefaultStyle()?.size||h.size||i;this.range.setDefaultStyle({size:f+2>r?r:f+2}),h?.value===x?(c.push(h),a={curIndex:R}):this.draw.render({curIndex:R,isCompute:!1,isSubmitHistory:!1})}if(!c.length)return;let d=!1;c.forEach(R=>{R.size||(R.size=i),!(R.size>=r)&&(R.size+2>r?R.size=r:R.size+=2,d=!0)}),d&&this.draw.render(a)}sizeMinus(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const{defaultSize:i,minSize:r}=this.options,s=this.range.getTextLikeSelectionElementList();let a={},c=[];if(s?.length)c=s,a={isSetCursor:!1};else{const{endIndex:R}=this.range.getRange(),h=this.draw.getElementList()[R],f=this.range.getDefaultStyle()?.size||h.size||i;this.range.setDefaultStyle({size:f-2<r?r:f-2}),h?.value===x?(c.push(h),a={curIndex:R}):this.draw.render({curIndex:R,isCompute:!1,isSubmitHistory:!1})}if(!c.length)return;let d=!1;c.forEach(R=>{R.size||(R.size=i),!(R.size<=r)&&(R.size-2<r?R.size=r:R.size-=2,d=!0)}),d&&this.draw.render(a)}bold(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(i?.length){const r=i.findIndex(s=>!s.bold);i.forEach(s=>{s.bold=!!~r}),this.draw.render({isSetCursor:!1})}else{let r=!0;const{endIndex:s}=this.range.getRange(),c=this.draw.getElementList()[s];this.range.setDefaultStyle({bold:c.bold?!1:!this.range.getDefaultStyle()?.bold}),c?.value===x?c.bold=!c.bold:r=!1,this.draw.render({isSubmitHistory:r,curIndex:s,isCompute:!1})}}italic(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(i?.length){const r=i.findIndex(s=>!s.italic);i.forEach(s=>{s.italic=!!~r}),this.draw.render({isSetCursor:!1})}else{let r=!0;const{endIndex:s}=this.range.getRange(),c=this.draw.getElementList()[s];this.range.setDefaultStyle({italic:c.italic?!1:!this.range.getDefaultStyle()?.italic}),c?.value===x?c.italic=!c.italic:r=!1,this.draw.render({isSubmitHistory:r,curIndex:s,isCompute:!1})}}underline(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length){const s=r.some(a=>!a.underline||!t&&a.textDecoration||t&&!a.textDecoration||t&&a.textDecoration&&!xr(a.textDecoration,t));r.forEach(a=>{a.underline=s,s&&t?a.textDecoration=t:delete a.textDecoration}),this.draw.render({isSetCursor:!1,isCompute:!1})}else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({underline:d?.underline?!1:!this.range.getDefaultStyle()?.underline}),d?.value===x?d.underline=!d.underline:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}strikeout(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(i?.length){const r=i.findIndex(s=>!s.strikeout);i.forEach(s=>{s.strikeout=!!~r}),this.draw.render({isSetCursor:!1,isCompute:!1})}else{let r=!0;const{endIndex:s}=this.range.getRange(),c=this.draw.getElementList()[s];this.range.setDefaultStyle({strikeout:c.strikeout?!1:!this.range.getDefaultStyle()?.strikeout}),c?.value===x?c.strikeout=!c.strikeout:r=!1,this.draw.render({isSubmitHistory:r,curIndex:s,isCompute:!1})}}superscript(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(!i)return;const r=i.findIndex(s=>s.type===l.ElementType.SUPERSCRIPT);i.forEach(s=>{~r?s.type===l.ElementType.SUPERSCRIPT&&(s.type=l.ElementType.TEXT,delete s.actualSize):(!s.type||s.type===l.ElementType.TEXT||s.type===l.ElementType.SUBSCRIPT)&&(s.type=l.ElementType.SUPERSCRIPT)}),this.draw.render({isSetCursor:!1})}subscript(t){const{isIgnoreDisabledRule:e=!1}=t||{};if(!e&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const i=this.range.getSelectionElementList();if(!i)return;const r=i.findIndex(s=>s.type===l.ElementType.SUBSCRIPT);i.forEach(s=>{~r?s.type===l.ElementType.SUBSCRIPT&&(s.type=l.ElementType.TEXT,delete s.actualSize):(!s.type||s.type===l.ElementType.TEXT||s.type===l.ElementType.SUPERSCRIPT)&&(s.type=l.ElementType.SUBSCRIPT)}),this.draw.render({isSetCursor:!1})}color(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length)r.forEach(s=>{t?s.color=t:delete s.color}),this.draw.render({isSetCursor:!1,isCompute:!1});else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({color:t||void 0}),d?.value===x?t?d.color=t:delete d.color:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}highlight(t,e){const{isIgnoreDisabledRule:n=!1}=e||{};if(!n&&(this.draw.isReadonly()||this.draw.isDisabled()))return;const r=this.range.getSelectionElementList();if(r?.length)r.forEach(s=>{t?s.highlight=t:delete s.highlight}),this.draw.render({isSetCursor:!1,isCompute:!1});else{let s=!0;const{endIndex:a}=this.range.getRange(),d=this.draw.getElementList()[a];this.range.setDefaultStyle({highlight:t||void 0}),d?.value===x?t?d.highlight=t:delete d.highlight:s=!1,this.draw.render({isSubmitHistory:s,curIndex:a,isCompute:!1})}}title(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.draw.getElementList(),s=n===i?this.range.getRangeParagraphElementList():r.slice(n+1,i+1);if(!s||!s.length)return;const a=rt(),c=this.draw.getOptions().title;s.forEach(u=>{!u.type&&u.value===x||(t?(u.level=t,u.titleId=a,Zn(u)&&(u.size=c[Ki[t]],u.bold=!0)):u.titleId&&(delete u.titleId,delete u.title,delete u.level,delete u.size,delete u.bold))});const d=n===i,R=d?i:n;this.draw.render({curIndex:R,isSetCursor:d})}list(t,e){this.draw.isReadonly()||this.draw.getListParticle().setList(t,e)}rowFlex(t){if(this.draw.isReadonly())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.range.getRangeRowElementList();if(!r)return;r.forEach(c=>{c.rowFlex=t});const s=n===i,a=s?i:n;this.draw.render({curIndex:a,isSetCursor:s})}vertical(t){if(this.draw.isReadonly())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.range.getRangeRowElementList();if(!r)return;r.forEach(c=>{c.vertical=t});const s=n===i,a=s?i:n;this.draw.render({curIndex:a,isSetCursor:s})}rowMargin(t){if(this.draw.isReadonly())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.range.getRangeRowElementList();if(!r)return;r.forEach(c=>{c.rowMargin=t});const s=n===i,a=s?i:n;this.draw.render({curIndex:a,isSetCursor:s})}insertTable(t,e){this.draw.isReadonly()||this.draw.isDisabled()||this.getIsRangeInTextField()||this.control.getActiveControl()||this.tableOperate.insertTable(t,e)}insertTableTopRow(){this.draw.isReadonly()||this.tableOperate.insertTableTopRow()}insertTableBottomRow(){this.draw.isReadonly()||this.tableOperate.insertTableBottomRow()}insertTableLeftCol(){this.draw.isReadonly()||this.tableOperate.insertTableLeftCol()}insertTableRightCol(){this.draw.isReadonly()||this.tableOperate.insertTableRightCol()}deleteTableRow(){this.draw.isReadonly()||this.tableOperate.deleteTableRow()}deleteTableCol(){this.draw.isReadonly()||this.tableOperate.deleteTableCol()}deleteTable(){this.draw.isReadonly()||this.tableOperate.deleteTable()}mergeTableCell(){this.draw.isReadonly()||this.tableOperate.mergeTableCell()}cancelMergeTableCell(){this.draw.isReadonly()||this.tableOperate.cancelMergeTableCell()}splitVerticalTableCell(){this.draw.isReadonly()||this.tableOperate.splitVerticalTableCell()}splitHorizontalTableCell(){this.draw.isReadonly()||this.tableOperate.splitHorizontalTableCell()}tableTdVerticalAlign(t){this.draw.isReadonly()||this.tableOperate.tableTdVerticalAlign(t)}tableBorderType(t){this.draw.isReadonly()||this.tableOperate.tableBorderType(t)}tableBorderColor(t){this.draw.isReadonly()||this.tableOperate.tableBorderColor(t)}tableTdBorderType(t){this.draw.isReadonly()||this.tableOperate.tableTdBorderType(t)}tableTdSlashType(t){this.draw.isReadonly()||this.tableOperate.tableTdSlashType(t)}tableTdBackgroundColor(t){this.draw.isReadonly()||this.tableOperate.tableTdBackgroundColor(t)}tableSelectAll(){this.tableOperate.tableSelectAll()}tableProperties(){this.draw.isReadonly()||this.tableOperate.tableProperties()}hyperlink(t){const{valueList:e,url:n,hyperlinkId:i}=t;if(!n||!e?.length||this.draw.isReadonly()||this.draw.isDisabled()||this.control.getActiveControl())return;const{startIndex:a,endIndex:c}=this.range.getRange();!~a&&!~c||this.insertElementList([{type:l.ElementType.HYPERLINK,value:"",valueList:e,url:n,hyperlinkId:i||rt()}])}getHyperlinkRange(){let t=-1,e=-1;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return null;const r=this.draw.getElementList(),s=r[n];if(s.type!==l.ElementType.HYPERLINK)return null;let a=n;for(;a>0;){if(r[a].hyperlinkId!==s.hyperlinkId){t=a+1;break}a--}let c=n+1;for(;c<r.length;){if(r[c].hyperlinkId!==s.hyperlinkId){e=c-1;break}c++}return c===r.length&&(e=c-1),!~t||!~e?null:[t,e]}deleteHyperlink(){if(this.draw.isReadonly()||this.draw.isDisabled())return;const e=this.getHyperlinkRange();if(!e)return;const n=this.draw.getElementList(),[i,r]=e;this.draw.spliceElementList(n,i,r-i+1),this.draw.getHyperlinkParticle().clearHyperlinkPopup();const s=i-1;this.range.setRange(s,s),this.draw.render({curIndex:s})}cancelHyperlink(){if(this.draw.isReadonly()||this.draw.isDisabled())return;const e=this.getHyperlinkRange();if(!e)return;const n=this.draw.getElementList(),[i,r]=e;for(let a=i;a<=r;a++){const c=n[a];delete c.type,delete c.url,delete c.hyperlinkId,delete c.underline}this.draw.getHyperlinkParticle().clearHyperlinkPopup();const{endIndex:s}=this.range.getRange();this.draw.render({curIndex:s,isCompute:!1})}editHyperlink(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const n=this.getHyperlinkRange();if(!n)return;const i=this.draw.getElementList(),[r,s]=n;for(let c=r;c<=s;c++){const d=i[c];d.url=t}this.draw.getHyperlinkParticle().clearHyperlinkPopup();const{endIndex:a}=this.range.getRange();this.draw.render({curIndex:a,isCompute:!1})}separator(t,e){if(this.draw.isReadonly()||this.draw.isDisabled()||this.getIsRangeInTextField()||this.control.getActiveControl())return;const{startIndex:r,endIndex:s}=this.range.getRange();if(!~r&&!~s)return;const a=this.draw.getElementList();let c=-1;const d=a[s+1];if(d&&d.type===l.ElementType.SEPARATOR){if(d.dashArray&&d.dashArray.join()===t.join())return;c=s,Object.assign(d,{dashArray:t,...e})}else{const R={value:Ei,type:l.ElementType.SEPARATOR,dashArray:t,...e};Et(a,[R],r,{editorOptions:this.options}),r!==0&&a[r].value===x?(this.draw.spliceElementList(a,r,1,[R]),c=r-1):(this.draw.spliceElementList(a,r+1,0,[R]),c=r)}this.range.setRange(c,c),this.draw.render({curIndex:c})}pageBreak(){this.draw.isReadonly()||this.draw.isDisabled()||this.control.getActiveControl()||this.insertElementList([{type:l.ElementType.PAGE_BREAK,value:Ei}])}addWatermark(t){if(this.draw.isReadonly())return;const n=this.draw.getOptions(),{color:i,size:r,opacity:s,font:a,gap:c}=Wo;n.watermark.data=t.data,n.watermark.type=t.type||l.WatermarkType.TEXT,t.width&&(n.watermark.width=t.width),t.height&&(n.watermark.height=t.height),n.watermark.color=t.color||i,n.watermark.opacity=t.opacity||s,n.watermark.size=t.size||r,n.watermark.font=t.font||a,n.watermark.repeat=!!t.repeat,t.numberType&&(n.watermark.numberType=t.numberType),n.watermark.gap=t.gap||c,this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1})}deleteWatermark(){if(this.draw.isReadonly())return;const e=this.draw.getOptions();e.watermark&&e.watermark.data&&(e.watermark={...Wo},this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1}))}image(t){if(this.draw.isReadonly()||this.draw.isDisabled())return null;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return null;const r=t.id||rt();return this.insertElementList([{...t,id:r,type:l.ElementType.IMAGE}]),r}search(t,e){this.searchManager.setSearchKeyword(t,e),this.draw.render({isSubmitHistory:!1})}searchNavigatePre(){this.searchManager.searchNavigatePre()!==null&&this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1,isLazy:!1})}searchNavigateNext(){this.searchManager.searchNavigateNext()!==null&&this.draw.render({isSetCursor:!1,isSubmitHistory:!1,isCompute:!1,isLazy:!1})}getSearchNavigateInfo(){return this.searchManager.getSearchNavigateInfo()}replace(t,e){this.draw.getSearch().replace(t,e)}async print(){const{scale:t,printPixelRatio:e,paperDirection:n,width:i,height:r}=this.options;t!==1&&this.draw.setPageScale(1);const s=await this.draw.getDataURL({pixelRatio:e,mode:l.EditorMode.PRINT});kh(s,{width:i,height:r,direction:n}),t!==1&&this.draw.setPageScale(t)}replaceImageElement(t){const{startIndex:e}=this.range.getRange(),i=this.draw.getElementList()[e];!i||i.type!==l.ElementType.IMAGE||(i.value=t,this.draw.render({isSetCursor:!1}))}saveAsImageElement(){const{startIndex:t}=this.range.getRange(),n=this.draw.getElementList()[t];!n||n.type!==l.ElementType.IMAGE||Fi(n.value,`${n.id}.png`)}setImageCrop(t){const{startIndex:e}=this.range.getRange(),i=this.draw.getElementList()[e];!i||i.type!==l.ElementType.IMAGE||(i.imgCrop=t,this.draw.render({isSetCursor:!1,isCompute:!1}))}setImageCaption(t){const{startIndex:e}=this.range.getRange(),i=this.draw.getElementList()[e];i?.type===l.ElementType.IMAGE&&(i.imgCaption=t,this.draw.render({isSetCursor:!1}))}changeImageDisplay(t,e){if(t.imgDisplay===e)return;t.imgDisplay=e;const{startIndex:n,endIndex:i}=this.range.getRange();if(e===l.ImageDisplay.SURROUND||e===l.ImageDisplay.FLOAT_TOP||e===l.ImageDisplay.FLOAT_BOTTOM){const r=this.position.getPositionList(),{pageNo:s,coordinate:{leftTop:a}}=r[n];t.imgFloatPosition={pageNo:s,x:a[0],y:a[1]}}else delete t.imgFloatPosition;this.draw.getPreviewer().clearResizer(),this.draw.render({isSetCursor:!0,curIndex:i})}getImage(t){return this.draw.getDataURL(t)}getPageMode(){return this.options}getOptions(){return this.options}getValue(t){return this.draw.getValue(t)}getValueAsync(t){return this.draw.getWorkerManager().getValue(t)}getAreaValue(t){return this.draw.getArea().getAreaValue(t)}getHTML(){const t=this.options,e=this.draw.getHeaderElementList(),n=this.draw.getOriginalMainElementList(),i=this.draw.getFooterElementList();return{header:ze(e,t).innerHTML,main:ze(n,t).innerHTML,footer:ze(i,t).innerHTML}}getText(){const t=this.draw.getHeaderElementList(),e=this.draw.getOriginalMainElementList(),n=this.draw.getFooterElementList();return{header:qe(t),main:qe(e),footer:qe(n)}}getWordCount(){return this.workerManager.getWordCount()}getCursorPosition(){return this.position.getCursorPosition()}getRemainingContentHeight(){if(!this.draw.getIsPagingMode())return 0;const t=this.draw.getPageRowList(),e=t.length-1,i=(t[e]||[]).reduce((c,d)=>c+d.height+(d.offsetY||0),0),r=this.draw.getHeight(),s=this.draw.getMainOuterHeight(),a=r-(s+i);return a>0?a:0}computeElementListHeight(t){if(!t.length)return 0;const e=this.draw.getInnerWidth();if(e<=0)return 0;const n=dt(t);Yt(n,{isHandleFirstElement:!1,editorOptions:this.options});const i=Do(n);return this.draw.computeRowList({innerWidth:e,elementList:n,surroundElementList:i}).reduce((s,a)=>s+a.height+(a.offsetY||0),0)}getRange(){return dt(this.range.getRange())}getRangeText(){return this.range.toString()}getRangeContext(){const t=this.range.getRange(),{startIndex:e,endIndex:n}=t;if(!~e&&!~n)return null;const i=e===n,r=this.range.toString(),s=Pt(this.range.getSelectionElementList()||[]),a=this.draw.getElementList(),c=be(a[i?e:e+1],{extraPickAttrs:["id","controlComponent"]}),d=be(a[n],{extraPickAttrs:["id","controlComponent"]}),R=this.draw.getRowList(),u=this.position.getPositionList(),h=u[e],g=u[n],f=h?.pageNo,T=g?.pageNo,m=h?.rowIndex,p=g?.rowIndex,I=R[m],L=R[p];let M=0,O=0;this.draw.getCursor().getHitLineStartIndex()||(M=I?.elementList[0]?.value===x?h?.index-I?.startIndex:h?.index-I?.startIndex+1),h===g?O=M:O=L.elementList[0]?.value===x?g.index-L.startIndex:g.index-L.startIndex+1;const C=[],y=this.draw.getOriginalHeight(),X=this.draw.getOriginalPageGap(),V=this.position.getSelectionPositionList();if(V){let U=null,Z=0,_=null;for(let K=0;K<V.length;K++){const{rowNo:$,pageNo:lt,coordinate:{leftTop:j,rightTop:H},lineHeight:J}=V[K];U===null||U!==$?(_&&C.push(_),_={x:j[0],y:j[1]+lt*(y+X),width:H[0]-j[0],height:J},U=$,Z=j[0]):_.width=H[0]-Z,K===V.length-1&&_&&C.push(_)}}else{const Z=this.position.getPositionList()[n],{coordinate:{rightTop:_},pageNo:K,lineHeight:$}=Z;C.push({x:_[0],y:_[1]+K*(y+X),width:0,height:$})}const b=this.draw.getZone().getZone(),{isTable:S,trIndex:W,tdIndex:N,index:P}=this.position.getPositionContext();let F=null;if(S){const Z=this.draw.getOriginalElementList()[P]||null;Z&&(F=Pt([Z])[0])}let E=null,D=null,Y=e-1;for(;Y>0;){const U=a[Y],Z=a[Y-1];if(U.titleId&&U.titleId!==Z?.titleId){E=U.titleId,D=u[Y].pageNo;break}Y--}return dt({isCollapsed:i,startElement:c,endElement:d,startPageNo:f,endPageNo:T,startRowNo:m,endRowNo:p,startColNo:M,endColNo:O,rangeRects:C,zone:b,isTable:S,trIndex:W??null,tdIndex:N??null,tableElement:F,selectionText:r,selectionElementList:s,titleId:E,titleStartPageNo:D})}getRangeRow(){const t=this.range.getRangeRowElementList();return t?Pt(t):null}getRangeParagraph(){const t=this.range.getRangeParagraphElementList();return t?Pt(t):null}getKeywordRangeList(t){return this.range.getKeywordRangeList(t)}getKeywordContext(t){const e=this.getKeywordRangeList(t);if(!e.length)return null;const n=[],i=this.position.getOriginalMainPositionList(),r=this.draw.getOriginalMainElementList();for(let s=0;s<e.length;s++){const a=e[s],{startIndex:c,endIndex:d,tableId:R,startTrIndex:u,startTdIndex:h}=a;let g=i;if(a.tableId){const m=r.find(p=>p.id===R);m&&(g=m.trList?.[u]?.tdList?.[h]?.positionList||[])}const f=dt(g[c]),T=dt(g[d]);n.push({range:a,startPosition:f,endPosition:T})}return n}pageMode(t){this.draw.setPageMode(t)}pageScale(t){t!==this.options.scale&&this.draw.setPageScale(t)}pageScaleRecovery(){const{scale:t}=this.options;t!==1&&this.draw.setPageScale(1)}pageScaleMinus(){const{scale:t}=this.options,e=t*10-1;e>=5&&this.draw.setPageScale(e/10)}pageScaleAdd(){const{scale:t}=this.options,e=t*10+1;e<=30&&this.draw.setPageScale(e/10)}paperSize(t,e){this.draw.setPaperSize(t,e)}paperDirection(t){this.draw.setPaperDirection(t)}getPaperMargin(){return this.options.margins}setPaperMargin(t){return this.draw.setPaperMargin(t)}setMainBadge(t){this.draw.getBadge().setMainBadge(t),this.draw.render({isCompute:!1,isSubmitHistory:!1})}setAreaBadge(t){this.draw.getBadge().setAreaBadgeMap(t),this.draw.render({isCompute:!1,isSubmitHistory:!1})}insertElementList(t,e={}){if(!t.length||this.draw.isReadonly()||this.draw.isDisabled())return;const{isReplace:i=!0,ignoreContextKeys:r}=e;i||this.range.shrinkRange(),console.log(t,"payload");const s=dt(t),{startIndex:a}=this.range.getRange(),c=this.draw.getElementList();Et(c,s,a,{ignoreContextKeys:r,isBreakWhenWrap:!0,editorOptions:this.options}),console.log(s,"cloneElementList"),this.draw.insertElementList(s,e),setTimeout(()=>{console.log(c,"elementList")},500)}appendElementList(t,e){!t.length||this.draw.isReadonly()||this.draw.appendElementList(dt(t),e)}updateElementById(t){const{id:e,conceptId:n}=t;if(!e&&!n)return;const i=[];function r(a,c=!1){let d=0;for(;d<a.length;){const R=a[d];if(d++,R.type===l.ElementType.TABLE){const u=R.trList;for(let h=0;h<u.length;h++){const g=u[h];for(let f=0;f<g.tdList.length;f++){const T=g.tdList[f];r(T.value,c)}}}R.type===l.ElementType.CONTROL&&R.control?.value&&r(R.control.value,!0),(e&&R.id===e||n&&R.conceptId===n)&&i.push({elementList:a,index:d-1,isInsideControl:c})}}const s=[this.draw.getOriginalMainElementList(),this.draw.getHeaderElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);if(i.length){for(let a=0;a<i.length;a++){const{elementList:c,index:d,isInsideControl:R}=i[a],u=c[d],h=u.controlId&&u.controlComponent===l.ControlComponent.VALUE;if(R||h){if(Object.assign(u,t.properties),u.id){const g=Zl(u.id);g&&Object.assign(g,t.properties)}}else{const g=Pt([{...u,...t.properties}],{extraPickAttrs:["id"]});g.length>0&&g[0]?(Ve(Qe,u,g[0]),Yt(g,{isHandleFirstElement:!1,editorOptions:this.options}),c[d]=g[0]):Object.assign(u,t.properties)}}this.draw.render({isSetCursor:!1})}}deleteElementById(t){const{id:e,conceptId:n}=t;if(!e&&!n)return;let i=!1;function r(a){let c=0;for(;c<a.length;){const d=a[c];if(d.type===l.ElementType.TABLE){const R=d.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];r(f.value)}}}d.type===l.ElementType.CONTROL&&d.control?.value&&r(d.control.value),(e&&d.id===e||n&&d.conceptId===n)&&(i=!0,a.splice(c,1),c--),c++}}const s=[this.draw.getOriginalMainElementList(),this.draw.getHeaderElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);i&&this.draw.render({isSetCursor:!1})}getElementById(t){const{id:e,conceptId:n}=t,i=[];if(!e&&!n)return i;const r=a=>{let c=0;for(;c<a.length;){const d=a[c];if(c++,d.type===l.ElementType.TABLE){const R=d.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];r(f.value)}}}e&&d.id!==e||n&&d.conceptId!==n||i.push(d)}},s=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);return Pt(i,{extraPickAttrs:["id"]})}setValue(t,e){this.draw.setValue(t,e)}removeControl(t){if(t?.id||t?.conceptId){const{id:e,conceptId:n}=t;let i=!1;const r=a=>{let c=a.length-1;for(;c>=0;){const d=a[c];if(d.type===l.ElementType.TABLE){const R=d.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g];r(f.value)}}}c--,!(!d.control||e&&d.controlId!==e||n&&d.control.conceptId!==n)&&(i=!0,a.splice(c+1,1))}},s=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const a of s)r(a);i&&this.draw.render({isSetCursor:!1})}else{const{startIndex:e,endIndex:n}=this.range.getRange();if(e!==n||!this.draw.getElementList()[e].controlId)return;const a=this.draw.getControl().removeControl(e);if(a===null)return;this.range.setRange(a,a),this.draw.render({curIndex:a})}}translate(t){return this.i18n.t(t)}setLocale(t){this.i18n.setLocale(t)}getLocale(){return this.i18n.getLocale()}getCatalog(){return this.workerManager.getCatalog()}locationCatalog(t){const e=this.draw.getOriginalElementList();function n(p,I){for(let L=0;L<p.length;L++){const M=p[L];if(M.type===l.ElementType.TABLE){const O=M.trList;for(let C=0;C<O.length;C++){const y=O[C];for(let X=0;X<y.tdList.length;X++){const V=y.tdList[X],b=n(V.value,I);if(b)return{...b,isTable:!0,index:L,trIndex:C,tdIndex:X,tdId:V.id,trId:y.id,tableId:M.id}}}}if(M.titleId===I){let O=L;for(;O<p.length;){if(p[O+1]?.titleId!==I)return{isTable:!1,startIndex:O,endIndex:O};O++}}}return null}const i=n(e,t);if(!i)return;const{isTable:r,index:s,startTdIndex:a,endTdIndex:c,startTrIndex:d,endTrIndex:R,trIndex:u,tdIndex:h,tdId:g,trId:f,tableId:T,endIndex:m}=i;this.position.setPositionContext({isTable:r,index:s,trIndex:u,tdIndex:h,tdId:g,trId:f,tableId:T}),this.range.setRange(m,m,T,a,c,d,R),this.draw.render({curIndex:m,isCompute:!1,isSubmitHistory:!1})}wordTool(){const t=this.draw.getMainElementList();let e=!1;for(let n=0;n<t.length;n++)if(t[n].value===x)for(;n+1<t.length;){const r=t[n+1];if(r.value!==x&&r.value!==ho)break;t.splice(n+1,1),e=!0}if(e)this.draw.render({isSetCursor:!1});else{const n=this.range.getIsCollapsed();this.draw.getCursor().drawCursor({isShow:n})}}setHTML(t){const{header:e,main:n,footer:i}=t,r=this.draw.getOriginalInnerWidth(),s=a=>a!==void 0?je(a,{innerWidth:r}):void 0;this.setValue({header:s(e),main:s(n),footer:s(i)})}setGroup(){return this.draw.isReadonly()?null:this.draw.getGroup().setGroup()}deleteGroup(t){this.draw.isReadonly()||this.draw.getGroup().deleteGroup(t)}getGroupIds(){return this.draw.getWorkerManager().getGroupIds()}locationGroup(t){const e=this.draw.getOriginalMainElementList(),n=this.draw.getGroup().getContextByGroupId(e,t);if(!n)return;const{isTable:i,index:r,trIndex:s,tdIndex:a,tdId:c,trId:d,tableId:R,endIndex:u}=n;this.position.setPositionContext({isTable:i,index:r,trIndex:s,tdIndex:a,tdId:c,trId:d,tableId:R}),this.range.setRange(u,u),this.draw.render({curIndex:u,isCompute:!1,isSubmitHistory:!1})}setZone(t){this.draw.getZone().setZone(t)}getControlValue(t){return this.draw.getControl().getValueById(t)}setControlValue(t){this.draw.getControl().setValueListById([t])}setControlValueList(t){this.draw.getControl().setValueListById(t)}setControlExtension(t){this.draw.getControl().setExtensionListById([t])}setControlExtensionList(t){this.draw.getControl().setExtensionListById(t)}setControlProperties(t){this.draw.getControl().setPropertiesListById([t])}setControlPropertiesList(t){this.draw.getControl().setPropertiesListById(t)}setControlHighlight(t){this.draw.getControl().setHighlightList(t),this.draw.render({isSubmitHistory:!1})}updateOptions(t){const e=Vo(t);Object.entries(e).forEach(([n,i])=>{Reflect.set(this.options,n,i)}),this.forceUpdate()}getControlList(){return this.draw.getControl().getList()}locationControl(t,e){function n(r,s){let a=0;for(;a<r.length;){const c=r[a];if(a++,c.type===l.ElementType.TABLE){const R=c.trList;for(let u=0;u<R.length;u++){const h=R[u];for(let g=0;g<h.tdList.length;g++){const f=h.tdList[g],T=n(f.value,s);if(T)return{...T,positionContext:{isTable:!0,index:a-1,trIndex:u,tdIndex:g,tdId:c.tdId,trId:c.trId,tableId:c.tableId}}}}}if(c?.controlId!==t)continue;let d=a-1;if(e?.position===l.LocationPosition.OUTER_AFTER){if(!(c.controlComponent===l.ControlComponent.POSTFIX&&r[a+1]?.controlComponent!==l.ControlComponent.POST_TEXT))continue}else if(e?.position===l.LocationPosition.OUTER_BEFORE)d-=1;else if(e?.position===l.LocationPosition.AFTER){if(d-=1,c.controlComponent!==l.ControlComponent.PLACEHOLDER&&c.controlComponent!==l.ControlComponent.POSTFIX&&c.controlComponent!==l.ControlComponent.POST_TEXT)continue}else if(c.controlComponent!==l.ControlComponent.PREFIX&&c.controlComponent!==l.ControlComponent.PRE_TEXT||r[a]?.controlComponent===l.ControlComponent.PREFIX||r[a]?.controlComponent===l.ControlComponent.PRE_TEXT)continue;return{zone:s,range:{startIndex:d,endIndex:d},positionContext:{isTable:!1}}}return null}const i=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const r of i){const s=n(r.elementList,r.zone);if(s){this.setZone(s.zone),this.position.setPositionContext(s.positionContext),this.range.replaceRange(s.range),this.draw.render({curIndex:s.range.startIndex,isCompute:!1,isSubmitHistory:!1});break}}}insertTextField(t){if(this.draw.isReadonly()||this.draw.isDisabled()||!t)return;const n=dt(t),{startIndex:i}=this.range.getRange(),r=this.draw.getElementList(),s=$e(r,i);if(!s)return;const a=[...ke,...Jt,...fn,...Qe];Ve(a,s,n),this.draw.insertElementTextField([n])}insertControl(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const n=dt(t),{startIndex:i}=this.range.getRange(),r=this.draw.getElementList(),s=$e(r,i);if(!s)return;const a=r[i],c=a?.controlComponent===l.ControlComponent.POSTFIX||a?.controlComponent===l.ControlComponent.POSTTEXTFIX;let d=!1;if(a?.controlId&&!c)for(let u=i;u>=0;u--){const h=r[u];if(h.controlId!==a.controlId)break;if(h.controlComponent===l.ControlComponent.PRETEXTFIX||h.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){h.control?.type===l.ControlType.TEXTFIELD&&(d=!0);break}}if(!d&&!c){const u=r[i-1];if(u?.controlId)for(let h=i-1;h>=0;h--){const g=r[h];if(g.controlId!==u.controlId)break;if(g.controlComponent===l.ControlComponent.PRETEXTFIX||g.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){g.control?.type===l.ControlType.TEXTFIELD&&(d=!0);break}}}if(d&&t.control?.type===l.ControlType.TEXTFIELD)return;const R=[...ke,...Jt,...fn,...Qe];Ve(R,s,n),this.draw.insertElementList([n])}jumpControl(t){this.draw.getControl().initNextControl({direction:t?.direction})}getContainer(){return this.draw.getContainer()}getTitleValue(t){const{conceptId:e}=t,n=[],i=(s,a)=>{let c=0;for(;c<s.length;){const d=s[c];if(c++,d.type===l.ElementType.TABLE){const h=d.trList;for(let g=0;g<h.length;g++){const f=h[g];for(let T=0;T<f.tdList.length;T++){const m=f.tdList[T];i(m.value,a)}}}if(d?.title?.conceptId!==e)continue;const R=[];let u=c;for(;u<s.length;){const h=s[u];if(u++,d.titleId!==h.titleId){if(h.level&&yo[h.level]<=yo[d.level])break;R.push(h)}}n.push({...d.title,value:qe(R),elementList:Pt(R),zone:a}),c=u}},r=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:s,elementList:a}of r)i(a,s);return n}getPositionContextByEvent(t,e={}){const n=t.target?.dataset.index;if(!n)return null;const{isMustDirectHit:i=!0}=e,r=Number(n),s=this.position.getPositionByXY({x:t.offsetX,y:t.offsetY,pageNo:r}),{isDirectHit:a,isTable:c,index:d,trIndex:R,tdIndex:u,tdValueIndex:h,zone:g}=s;if(i&&!a||g&&g!==this.zone.getZone())return null;let f=null,T=null;const m=this.draw.getOriginalElementList();let p=null;const I=this.position.getOriginalPositionList();if(c){const M=m[d].trList?.[R].tdList[u];T=M?.value[h]||null,p=M?.positionList?.[h]||null,f={element:m[d],trIndex:R,tdIndex:u}}else T=m[d]||null,p=I[d]||null;let L=null;if(p){const{pageNo:M,coordinate:{leftTop:O,rightTop:C},lineHeight:y}=p,X=this.draw.getOriginalHeight(),V=this.draw.getOriginalPageGap();L={x:O[0],y:O[1]+M*(X+V),width:C[0]-O[0],height:y}}return{pageNo:r,element:T,rangeRect:L,tableInfo:f}}insertTitle(t){if(this.draw.isReadonly()||this.draw.isDisabled())return;const n=dt(t),{startIndex:i}=this.range.getRange(),r=this.draw.getElementList(),s=$e(r,i);if(!s)return;const a=[...ke,...Jt,...fn,...Qe];n.valueList?.forEach(c=>{Ve(a,s,c)}),this.draw.insertElementList([n])}focus(t){const{position:e=l.LocationPosition.AFTER,isMoveCursorToVisible:n=!0,rowNo:i,range:r}=t||{};let s=-1;if(r)this.range.replaceRange(r),s=e===l.LocationPosition.BEFORE?r.startIndex:r.endIndex;else if(Po(i)){const c=this.draw.getOriginalRowList();if(s=e===l.LocationPosition.BEFORE?c[i]?.startIndex:c[i+1]?.startIndex-1,!Po(s))return;this.range.setRange(s,s)}else s=e===l.LocationPosition.BEFORE?0:this.draw.getOriginalMainElementList().length-1,this.range.setRange(s,s);const a={isCompute:!1,isSetCursor:!1,isSubmitHistory:!1};n&&~s&&this.range.getIsCollapsed()&&(a.curIndex=s,a.isSetCursor=!0),this.draw.render(a)}insertArea(t){return this.draw.getArea().insertArea(t)}setAreaValue(t){return this.draw.getArea().setAreaValue(t)}setAreaProperties(t){this.draw.getArea().setAreaProperties(t)}locationArea(t,e){if(e?.isAppendLastLineBreak&&e?.position===l.LocationPosition.OUTER_AFTER){const r=this.draw.getOriginalMainElementList();r[r.length-1].areaId===t&&this.draw.appendElementList([{value:x}],{isSubmitHistory:!1})}const n=this.draw.getArea().getContextByAreaId(t,e);if(!n)return;const{range:{endIndex:i}}=n;this.position.setPositionContext({isTable:!1}),this.range.setRange(i,i),this.draw.render({curIndex:i,isSetCursor:!0,isCompute:!1,isSubmitHistory:!1})}clearGraffiti(){this.draw.getGraffiti().clear(),this.draw.isGraffitiMode()&&this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1})}getMacroValue(t){const{id:e,dictCode:n,label:i,areaId:r}=t,s=[],a=(d,R)=>{for(const u of d){if(u.type===l.ElementType.TABLE){const g=u.trList;for(const f of g)for(const T of f.tdList)a(T.value,R);continue}if(u.type!==l.ElementType.MACRO&&u.type!==l.ElementType.CUSTOM_MACRO&&u.type!==l.ElementType.REUSABLE_ITEM||e&&u.id!==e||n&&u.dictCode!==n||i&&u.label!==i||r&&u.areaId!==r)continue;const h={id:u.id,type:u.type,label:u.label,dictCode:u.dictCode,zone:R};u.type===l.ElementType.MACRO?h.value=u.value:u.type===l.ElementType.CUSTOM_MACRO?(h.macroConfig=u.macroConfig,h.value=u.macroConfig?.value):u.type===l.ElementType.REUSABLE_ITEM&&(h.reusableItemConfig=u.reusableItemConfig,h.value=u.reusableItemConfig?.value),s.push(h)}},c=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:d,elementList:R}of c)a(R,d);return s}getMacroList(){const t=[],e=i=>{for(const r of i){if(r.type===l.ElementType.TABLE){const s=r.trList;for(const a of s)for(const c of a.tdList)e(c.value);continue}(r.type===l.ElementType.MACRO||r.type===l.ElementType.CUSTOM_MACRO||r.type===l.ElementType.REUSABLE_ITEM)&&t.push(r)}},n=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const i of n)e(i);return t}setMacroValue(t){const{id:e,dictCode:n,label:i,areaId:r,value:s,code:a,isSubmitHistory:c=!0}=t;let d=!1;const R=h=>{for(let g=0;g<h.length;g++){const f=h[g];if(f.type===l.ElementType.TABLE){const T=f.trList;for(const m of T)for(const p of m.tdList)R(p.value);continue}f.type!==l.ElementType.MACRO&&f.type!==l.ElementType.CUSTOM_MACRO&&f.type!==l.ElementType.REUSABLE_ITEM||e&&f.id!==e||n&&f.dictCode!==n||i&&f.label!==i||r&&f.areaId!==r||(d=!0,f.type===l.ElementType.MACRO?f.value=s:f.type===l.ElementType.CUSTOM_MACRO?f.macroConfig?(f.macroConfig.value=s,a!==void 0&&(f.macroConfig.code=a)):f.macroConfig={type:"text",value:s}:f.type===l.ElementType.REUSABLE_ITEM&&(f.reusableItemConfig?f.reusableItemConfig.value=s:f.reusableItemConfig={value:s}))}},u=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const h of u)R(h);d&&this.draw.render({isSubmitHistory:c,isSetCursor:!1})}setMacroValueList(t){if(!t.length)return;let e=!1,n=!1;const i=s=>{for(let a=0;a<s.length;a++){const c=s[a];if(c.type===l.ElementType.TABLE){const g=c.trList;for(const f of g)for(const T of f.tdList)i(T.value);continue}if(c.type!==l.ElementType.MACRO&&c.type!==l.ElementType.CUSTOM_MACRO&&c.type!==l.ElementType.REUSABLE_ITEM)continue;const d=t.find(g=>g.id&&c.id===g.id||g.dictCode&&c.dictCode===g.dictCode||g.label&&c.label===g.label||g.areaId&&c.areaId===g.areaId);if(!d)continue;const{value:R,code:u,isSubmitHistory:h=!0}=d;e=!0,h&&(n=!0),c.type===l.ElementType.MACRO?c.value=R:c.type===l.ElementType.CUSTOM_MACRO?c.macroConfig?(c.macroConfig.value=R,u!==void 0&&(c.macroConfig.code=u)):c.macroConfig={type:"text",value:R}:c.type===l.ElementType.REUSABLE_ITEM&&(c.reusableItemConfig?c.reusableItemConfig.value=R:c.reusableItemConfig={value:R})}},r=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const s of r)i(s);e&&(n||this.draw.getHistoryManager().recovery(),this.draw.render({isSubmitHistory:n,isSetCursor:!1}))}updateMacroProperties(t){const{id:e,dictCode:n,label:i,areaId:r,properties:s,isSubmitHistory:a=!0}=t;let c=!1;const d=u=>{for(let h=0;h<u.length;h++){const g=u[h];if(g.type===l.ElementType.TABLE){const f=g.trList;for(const T of f)for(const m of T.tdList)d(m.value);continue}g.type!==l.ElementType.MACRO&&g.type!==l.ElementType.CUSTOM_MACRO&&g.type!==l.ElementType.REUSABLE_ITEM||e&&g.id!==e||n&&g.dictCode!==n||i&&g.label!==i||r&&g.areaId!==r||(c=!0,Object.assign(g,s))}},R=[this.draw.getHeaderElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooterElementList()];for(const u of R)d(u);c&&this.draw.render({isSubmitHistory:a,isSetCursor:!1})}locationMacro(t){const{id:e,dictCode:n,label:i,areaId:r}=t,s=(c,d)=>{for(let R=0;R<c.length;R++){const u=c[R];if(u.type===l.ElementType.TABLE){const h=u.trList;for(let g=0;g<h.length;g++){const f=h[g];for(let T=0;T<f.tdList.length;T++){const m=f.tdList[T],p=s(m.value,d);if(p)return{...p,isTable:!0,index:R,trIndex:g,tdIndex:T,tableId:u.tableId,trId:f.id,tdId:m.id}}}}if(!(u.type!==l.ElementType.MACRO&&u.type!==l.ElementType.CUSTOM_MACRO&&u.type!==l.ElementType.REUSABLE_ITEM)&&!(e&&u.id!==e)&&!(n&&u.dictCode!==n)&&!(i&&u.label!==i)&&!(r&&u.areaId!==r))return{zone:d,index:R}}return null},a=[{zone:l.EditorZone.HEADER,elementList:this.draw.getHeaderElementList()},{zone:l.EditorZone.MAIN,elementList:this.draw.getOriginalMainElementList()},{zone:l.EditorZone.FOOTER,elementList:this.draw.getFooterElementList()}];for(const{zone:c,elementList:d}of a){const R=s(d,c);if(R){this.setZone(R.zone),this.position.setPositionContext({isTable:R.isTable||!1,index:R.index,trIndex:R.trIndex,tdIndex:R.tdIndex,tableId:R.tableId,trId:R.trId,tdId:R.tdId}),this.range.replaceRange({startIndex:R.index,endIndex:R.index}),this.draw.render({curIndex:R.index,isCompute:!1,isSubmitHistory:!1});break}}}}class jh{rangeStyleChange;visiblePageNoListChange;intersectionPageNoChange;pageSizeChange;pageScaleChange;saved;contentChange;controlChange;controlContentChange;pageModeChange;zoneChange;constructor(){this.rangeStyleChange=null,this.visiblePageNoListChange=null,this.intersectionPageNoChange=null,this.pageSizeChange=null,this.pageScaleChange=null,this.saved=null,this.contentChange=null,this.controlChange=null,this.controlContentChange=null,this.pageModeChange=null,this.zoneChange=null}}class qh{contextMenu;contextMenuList;getContextMenuList;shortcutList;langMap;constructor(t){const{contextMenu:e,shortcut:n,i18n:i}=t;this.contextMenu=e,this.contextMenuList=e.registerContextMenuList.bind(e),this.getContextMenuList=e.getContextMenuList.bind(e),this.shortcutList=n.registerShortcutList.bind(n),this.langMap=i.registerLangMap.bind(i)}disposeContextMenu(){this.contextMenu.dispose()}}const Cr={SELECTED_TEXT:"%s"},hn={GLOBAL:{CUT:"globalCut",COPY:"globalCopy",PASTE:"globalPaste",SELECT_ALL:"globalSelectAll",PRINT:"globalPrint"},CONTROL:{DELETE:"controlDelete",EDIT_ATTRIBUTE:"controlEditAttribute",COPY:"controlCopy",PASTE:"controlPaste"},HYPERLINK:{DELETE:"hyperlinkDelete",CANCEL:"hyperlinkCancel",EDIT:"hyperlinkEdit"},IMAGE:{CHANGE:"imageChange",SAVE_AS:"imageSaveAs",TEXT_WRAP:"imageTextWrap",TEXT_WRAP_EMBED:"imageTextWrapEmbed",TEXT_WRAP_UP_DOWN:"imageTextWrapUpDown",TEXT_WRAP_SURROUND:"imageTextWrapSurround",TEXT_WRAP_FLOAT_TOP:"imageTextWrapFloatTop",TEXT_WRAP_FLOAT_BOTTOM:"imageTextWrapFloatBottom"},TABLE:{BORDER:"border",BORDER_ALL:"tableBorderAll",BORDER_EMPTY:"tableBorderEmpty",BORDER_DASH:"tableBorderDash",BORDER_EXTERNAL:"tableBorderExternal",BORDER_INTERNAL:"tableBorderInternal",BORDER_TD:"tableBorderTd",BORDER_TD_TOP:"tableBorderTdTop",BORDER_TD_RIGHT:"tableBorderTdRight",BORDER_TD_BOTTOM:"tableBorderTdBottom",BORDER_TD_LEFT:"tableBorderTdLeft",BORDER_TD_FORWARD:"tableBorderTdForward",BORDER_TD_BACK:"tableBorderTdBack",VERTICAL_ALIGN:"tableVerticalAlign",VERTICAL_ALIGN_TOP:"tableVerticalAlignTop",VERTICAL_ALIGN_MIDDLE:"tableVerticalAlignMiddle",VERTICAL_ALIGN_BOTTOM:"tableVerticalAlignBottom",INSERT_ROW_COL:"tableInsertRowCol",INSERT_TOP_ROW:"tableInsertTopRow",INSERT_BOTTOM_ROW:"tableInsertBottomRow",INSERT_LEFT_COL:"tableInsertLeftCol",INSERT_RIGHT_COL:"tableInsertRightCol",DELETE_ROW_COL:"tableDeleteRowCol",DELETE_ROW:"tableDeleteRow",DELETE_COL:"tableDeleteCol",DELETE_TABLE:"tableDeleteTable",MERGE_CELL:"tableMergeCell",CANCEL_MERGE_CELL:"tableCancelMergeCell",TABLE_PROPERTIES:"tableProperties"}},{CONTROL:{DELETE:tg,EDIT_ATTRIBUTE:eg,COPY:ng,PASTE:og}}=hn;function Sr(o,t){if(t!==l.EditorMode.EDIT)return!1;const n=o?.control?.type,i=o?.controlComponent,r=n===l.ControlType.TEXT||n===l.ControlType.TEXTFIELD||n===l.ControlType.NUMBER||n===l.ControlType.SELECT||n===l.ControlType.DATE||n===l.ControlType.CHECKBOX||n===l.ControlType.RADIO||n===l.ControlType.BUTTON,s=i==="prefix"||i==="preText"||i==="preTextFix"||i==="textFixLabel"||n===l.ControlType.BUTTON&&i==="value";return r&&s}const ig=[{key:ng,name:"复制控件",when:o=>!o.isReadonly&&!o.editorHasSelection&&!!o.startElement?.controlId&&Sr(o.startElement,o.options.mode),callback:(o,t)=>{const e=t.startElement?.controlId;e&&o.executeCopyControl(e)}},{key:og,name:"粘贴控件",when:o=>!o.isReadonly&&!o.editorHasSelection&&o.editorTextFocus&&o.options.mode===l.EditorMode.EDIT&&Bl(),callback:o=>{o.executePasteControl()}},{key:tg,i18nPath:"contextmenu.control.delete",when:o=>!o.isReadonly&&!o.editorHasSelection&&!!o.startElement?.controlId&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeRemoveControl()}},{key:eg,i18nPath:"contextmenu.control.editAttribute",when:o=>!o.isReadonly&&!o.editorHasSelection&&!!o.startElement?.controlId&&Sr(o.startElement,o.options.mode),callback:(o,t)=>{const e=t.startElement?.controlId;e&&o.executeTriggerControlEditAttribute(e)}}],{GLOBAL:{CUT:sg,COPY:rg,PASTE:lg,SELECT_ALL:ag,PRINT:cg}}=hn,dg=[{key:sg,i18nPath:"contextmenu.global.cut",shortCut:`${Ze?"⌘":"Ctrl"} + X`,when:o=>!o.isReadonly,callback:o=>{o.executeCut()}},{key:rg,i18nPath:"contextmenu.global.copy",shortCut:`${Ze?"⌘":"Ctrl"} + C`,when:o=>o.editorHasSelection||o.isCrossRowCol,callback:o=>{o.executeCopy()}},{key:lg,i18nPath:"contextmenu.global.paste",shortCut:`${Ze?"⌘":"Ctrl"} + V`,when:o=>!o.isReadonly&&o.editorTextFocus,callback:o=>{o.executePaste()}},{key:ag,i18nPath:"contextmenu.global.selectAll",shortCut:`${Ze?"⌘":"Ctrl"} + A`,when:o=>o.editorTextFocus,callback:o=>{o.executeSelectAll()}},{isDivider:!0},{key:cg,i18nPath:"contextmenu.global.print",icon:"print",when:()=>!0,callback:o=>{o.executePrint()}}],{HYPERLINK:{DELETE:Rg,CANCEL:ug,EDIT:hg}}=hn,gg=[{key:Rg,i18nPath:"contextmenu.hyperlink.delete",when:o=>!o.isReadonly&&o.startElement?.type===l.ElementType.HYPERLINK,callback:o=>{o.executeDeleteHyperlink()}},{key:ug,i18nPath:"contextmenu.hyperlink.cancel",when:o=>!o.isReadonly&&o.startElement?.type===l.ElementType.HYPERLINK,callback:o=>{o.executeCancelHyperlink()}},{key:hg,i18nPath:"contextmenu.hyperlink.edit",when:o=>!o.isReadonly&&o.startElement?.type===l.ElementType.HYPERLINK,callback:(o,t)=>{const e=window.prompt(o.executeTranslate("contextmenu.hyperlink.edit"),t.startElement?.url);e&&o.executeEditHyperlink(e)}}],{IMAGE:{CHANGE:fg,SAVE_AS:Tg,TEXT_WRAP:mg,TEXT_WRAP_EMBED:pg,TEXT_WRAP_UP_DOWN:Lg,TEXT_WRAP_SURROUND:Ig,TEXT_WRAP_FLOAT_TOP:Pg,TEXT_WRAP_FLOAT_BOTTOM:Mg}}=hn,Og=[{key:fg,i18nPath:"contextmenu.image.change",icon:"image-change",when:o=>!o.isReadonly&&!o.editorHasSelection&&o.startElement?.type===l.ElementType.IMAGE,callback:o=>{const t=document.createElement("input");t.type="file",t.accept=".png, .jpg, .jpeg",t.onchange=()=>{const e=t.files[0],n=new FileReader;n.readAsDataURL(e),n.onload=()=>{const i=n.result;o.executeReplaceImageElement(i)}},t.click()}},{key:Tg,i18nPath:"contextmenu.image.saveAs",icon:"image",when:o=>!o.editorHasSelection&&o.startElement?.type===l.ElementType.IMAGE,callback:o=>{o.executeSaveAsImageElement()}},{key:mg,i18nPath:"contextmenu.image.textWrap",when:o=>!o.isReadonly&&!o.editorHasSelection&&o.startElement?.type===l.ElementType.IMAGE,childMenus:[{key:pg,i18nPath:"contextmenu.image.textWrapType.embed",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.BLOCK)}},{key:Lg,i18nPath:"contextmenu.image.textWrapType.upDown",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.INLINE)}},{key:Ig,i18nPath:"contextmenu.image.textWrapType.surround",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.SURROUND)}},{key:Pg,i18nPath:"contextmenu.image.textWrapType.floatTop",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.FLOAT_TOP)}},{key:Mg,i18nPath:"contextmenu.image.textWrapType.floatBottom",when:()=>!0,callback:(o,t)=>{o.executeChangeImageDisplay(t.startElement,l.ImageDisplay.FLOAT_BOTTOM)}}]}],{TABLE:{BORDER:Cg,BORDER_ALL:Sg,BORDER_EMPTY:Eg,BORDER_DASH:Xg,BORDER_EXTERNAL:Ng,BORDER_INTERNAL:Fg,BORDER_TD:yg,BORDER_TD_TOP:Wg,BORDER_TD_LEFT:Vg,BORDER_TD_BOTTOM:bg,BORDER_TD_RIGHT:Yg,BORDER_TD_BACK:Dg,BORDER_TD_FORWARD:Ug,VERTICAL_ALIGN:wg,VERTICAL_ALIGN_TOP:Zg,VERTICAL_ALIGN_MIDDLE:Qg,VERTICAL_ALIGN_BOTTOM:vg,INSERT_ROW_COL:Kg,INSERT_TOP_ROW:Hg,INSERT_BOTTOM_ROW:_g,INSERT_LEFT_COL:xg,INSERT_RIGHT_COL:Gg,DELETE_ROW_COL:Ag,DELETE_ROW:kg,DELETE_COL:Jg,DELETE_TABLE:Bg,MERGE_CELL:$g,CANCEL_MERGE_CELL:zg,TABLE_PROPERTIES:jg}}=hn,qg=[{isDivider:!0},{key:Cg,i18nPath:"contextmenu.table.border",icon:"border-all",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:Sg,i18nPath:"contextmenu.table.borderAll",icon:"border-all",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.ALL)}},{key:Eg,i18nPath:"contextmenu.table.borderEmpty",icon:"border-empty",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.EMPTY)}},{key:Xg,i18nPath:"contextmenu.table.borderDash",icon:"border-dash",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.DASH)}},{key:Ng,i18nPath:"contextmenu.table.borderExternal",icon:"border-external",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.EXTERNAL)}},{key:Fg,i18nPath:"contextmenu.table.borderInternal",icon:"border-internal",when:()=>!0,callback:o=>{o.executeTableBorderType(l.TableBorder.INTERNAL)}},{key:yg,i18nPath:"contextmenu.table.borderTd",icon:"border-td",when:()=>!0,childMenus:[{key:Wg,i18nPath:"contextmenu.table.borderTdTop",icon:"border-td-top",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.TOP)}},{key:Yg,i18nPath:"contextmenu.table.borderTdRight",icon:"border-td-right",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.RIGHT)}},{key:bg,i18nPath:"contextmenu.table.borderTdBottom",icon:"border-td-bottom",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.BOTTOM)}},{key:Vg,i18nPath:"contextmenu.table.borderTdLeft",icon:"border-td-left",when:()=>!0,callback:o=>{o.executeTableTdBorderType(l.TdBorder.LEFT)}},{key:Ug,i18nPath:"contextmenu.table.borderTdForward",icon:"border-td-forward",when:()=>!0,callback:o=>{o.executeTableTdSlashType(l.TdSlash.FORWARD)}},{key:Dg,i18nPath:"contextmenu.table.borderTdBack",icon:"border-td-back",when:()=>!0,callback:o=>{o.executeTableTdSlashType(l.TdSlash.BACK)}}]}]},{key:wg,i18nPath:"contextmenu.table.verticalAlign",icon:"vertical-align",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:Zg,i18nPath:"contextmenu.table.verticalAlignTop",icon:"vertical-align-top",when:()=>!0,callback:o=>{o.executeTableTdVerticalAlign(l.VerticalAlign.TOP)}},{key:Qg,i18nPath:"contextmenu.table.verticalAlignMiddle",icon:"vertical-align-middle",when:()=>!0,callback:o=>{o.executeTableTdVerticalAlign(l.VerticalAlign.MIDDLE)}},{key:vg,i18nPath:"contextmenu.table.verticalAlignBottom",icon:"vertical-align-bottom",when:()=>!0,callback:o=>{o.executeTableTdVerticalAlign(l.VerticalAlign.BOTTOM)}}]},{key:Kg,i18nPath:"contextmenu.table.insertRowCol",icon:"insert-row-col",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:Hg,i18nPath:"contextmenu.table.insertTopRow",icon:"insert-top-row",when:()=>!0,callback:o=>{o.executeInsertTableTopRow()}},{key:_g,i18nPath:"contextmenu.table.insertBottomRow",icon:"insert-bottom-row",when:()=>!0,callback:o=>{o.executeInsertTableBottomRow()}},{key:xg,i18nPath:"contextmenu.table.insertLeftCol",icon:"insert-left-col",when:()=>!0,callback:o=>{o.executeInsertTableLeftCol()}},{key:Gg,i18nPath:"contextmenu.table.insertRightCol",icon:"insert-right-col",when:()=>!0,callback:o=>{o.executeInsertTableRightCol()}}]},{key:Ag,i18nPath:"contextmenu.table.deleteRowCol",icon:"delete-row-col",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,childMenus:[{key:kg,i18nPath:"contextmenu.table.deleteRow",icon:"delete-row",when:()=>!0,callback:o=>{o.executeDeleteTableRow()}},{key:Jg,i18nPath:"contextmenu.table.deleteCol",icon:"delete-col",when:()=>!0,callback:o=>{o.executeDeleteTableCol()}},{key:Bg,i18nPath:"contextmenu.table.deleteTable",icon:"delete-table",when:()=>!0,callback:o=>{o.executeDeleteTable()}}]},{key:$g,i18nPath:"contextmenu.table.mergeCell",icon:"merge-cell",when:o=>!o.isReadonly&&o.isCrossRowCol&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeMergeTableCell()}},{key:zg,i18nPath:"contextmenu.table.mergeCancelCell",icon:"merge-cancel-cell",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeCancelMergeTableCell()}},{key:jg,i18nPath:"contextmenu.table.tableProperties",icon:"table-properties",when:o=>!o.isReadonly&&o.isInTable&&o.options.mode!==l.EditorMode.FORM,callback:o=>{o.executeTableProperties()}}];class tf{options;draw;command;range;position;i18n;container;contextMenuList;contextMenuContainerList;contextMenuRelationShip;context;constructor(t,e){this.options=t.getOptions(),this.draw=t,this.command=e,this.range=t.getRange(),this.position=t.getPosition(),this.i18n=t.getI18n(),this.container=t.getContainer(),this.context=null,this.contextMenuList=[...dg,...qg,...Og,...ig,...gg],this.contextMenuContainerList=[],this.contextMenuRelationShip=new Map,this._addEvent()}getContextMenuList(){return this.contextMenuList}_addEvent(){this.container.addEventListener("contextmenu",this._proxyContextMenuEvent),document.addEventListener("mousedown",this._handleSideEffect)}removeEvent(){this.container.removeEventListener("contextmenu",this._proxyContextMenuEvent),document.removeEventListener("mousedown",this._handleSideEffect)}_filterMenuList(t){const{contextMenuDisableKeys:e}=this.options,n=[];for(let i=0;i<t.length;i++){const r=t[i];r.disable||r.key&&e.includes(r.key)||(r.isDivider||r.when?.(this.context))&&n.push(r)}return n}_proxyContextMenuEvent=t=>{this.context=this._getContext();const e=this._filterMenuList(this.contextMenuList);e.some(i=>!i.isDivider)&&(this.dispose(),this._render({contextMenuList:e,left:t.x,top:t.y})),t.preventDefault()};_handleSideEffect=t=>{const e=t.target;this.contextMenuContainerList.some(i=>i.contains(e))||this.dispose()};_getContext(){const t=this.draw.isReadonly(),{isCrossRowCol:e,startIndex:n,endIndex:i}=this.range.getRange(),r=!!(~n||~i),s=r&&n!==i,{isTable:a,trIndex:c,tdIndex:d,index:R}=this.position.getPositionContext();let u=null;if(a){const I=this.draw.getOriginalElementList()[R]||null;I&&(u=Pt([I],{extraPickAttrs:["id"]})[0])}const h=a&&!!e,g=this.draw.getElementList(),f=g[n]||null,T=g[i]||null,m=this.draw.getZone().getZone();return{startElement:f,endElement:T,isReadonly:t,editorHasSelection:s,editorTextFocus:r,isCrossRowCol:h,zone:m,isInTable:a,trIndex:c??null,tdIndex:d??null,tableElement:u,options:this.options}}_createContextMenuContainer(){const t=document.createElement("div");return t.classList.add(`${B}-contextmenu-container`),t.setAttribute(ce,l.EditorComponent.CONTEXTMENU),this.container.append(t),t}_render(t){const{contextMenuList:e,left:n,top:i,parentMenuContainer:r}=t,s=this._createContextMenuContainer(),a=document.createElement("div");a.classList.add(`${B}-contextmenu-content`);let c=null;r&&this.contextMenuRelationShip.set(r,s);for(let M=0;M<e.length;M++){const O=e[M];if(O.isDivider){if(M!==0&&M!==e.length-1&&!e[M-1]?.isDivider){const C=document.createElement("div");C.classList.add(`${B}-contextmenu-divider`),a.append(C)}}else{const C=document.createElement("div");if(C.classList.add(`${B}-contextmenu-item`),O.childMenus){const b=this._filterMenuList(O.childMenus);b.some(W=>!W.isDivider)&&(C.classList.add(`${B}-contextmenu-sub-item`),C.onmouseenter=()=>{this._setHoverStatus(C,!0),this._removeSubMenu(s);const W=C.getBoundingClientRect(),N=W.left+W.width,P=W.top;c=this._render({contextMenuList:b,left:N,top:P,parentMenuContainer:s})},C.onmouseleave=W=>{(!c||!c.contains(W.relatedTarget))&&this._setHoverStatus(C,!1)})}else C.onmouseenter=()=>{this._setHoverStatus(C,!0),this._removeSubMenu(s)},C.onmouseleave=()=>{this._setHoverStatus(C,!1)},C.onclick=()=>{O.callback&&this.context&&O.callback(this.command,this.context),this.dispose()};const y=document.createElement("i");C.append(y),O.icon&&y.classList.add(`${B}-contextmenu-${O.icon}`);const X=document.createElement("span"),V=O.i18nPath?this._formatName(this.i18n.t(O.i18nPath)):this._formatName(O.name||"");if(X.append(document.createTextNode(V)),C.append(X),O.shortCut){const b=document.createElement("span");b.classList.add(`${B}-shortcut`),b.append(document.createTextNode(O.shortCut)),C.append(b)}a.append(C)}}const d=document.createElement("div");d.classList.add(`${B}-contextmenu-divider`),a.append(d);const R=document.createElement("div");R.classList.add(`${B}-contextmenu-item`),R.onmouseenter=()=>{this._setHoverStatus(R,!0),this._removeSubMenu(s)},R.onmouseleave=()=>{this._setHoverStatus(R,!1)},R.onclick=()=>{this.dispose()};const u=document.createElement("i");R.append(u);const h=document.createElement("span");h.append(document.createTextNode(this.i18n.t("contextmenu.global.cancel"))),R.append(h),a.append(R),s.append(a),s.style.display="block";const g=window.innerWidth,f=s.getBoundingClientRect(),T=f.width,m=n+T>g?n-T:n;s.style.left=`${m}px`;const p=window.innerHeight,I=f.height,L=i+I>p?i-I:i;return s.style.top=`${L}px`,this.contextMenuContainerList.push(s),s}_removeSubMenu(t){const e=this.contextMenuRelationShip.get(t);e&&(this._removeSubMenu(e),e.remove(),this.contextMenuRelationShip.delete(t))}_setHoverStatus(t,e){e?(t.parentNode?.querySelectorAll(`${B}-contextmenu-item`).forEach(n=>n.classList.remove("hover")),t.classList.add("hover")):t.classList.remove("hover")}_formatName(t){const e=Object.values(Cr),n=new RegExp(`${e.join("|")}`);let i=t;if(n.test(i)){const r=new RegExp(Cr.SELECTED_TEXT,"g");if(r.test(i)){const s=this.range.toString();i=i.replace(r,s)}}return i}registerContextMenuList(t){this.contextMenuList.push(...t)}dispose(){this.contextMenuContainerList.forEach(t=>t.remove()),this.contextMenuContainerList=[],this.contextMenuRelationShip.clear()}}const ef=[{key:l.KeyMap.X,ctrl:!0,shift:!0,callback:o=>{o.executeStrikeout()}},{key:l.KeyMap.LEFT_BRACKET,mod:!0,callback:o=>{o.executeSizeAdd()}},{key:l.KeyMap.RIGHT_BRACKET,mod:!0,callback:o=>{o.executeSizeMinus()}},{key:l.KeyMap.B,mod:!0,callback:o=>{o.executeBold()}},{key:l.KeyMap.I,mod:!0,callback:o=>{o.executeItalic()}},{key:l.KeyMap.U,mod:!0,callback:o=>{o.executeUnderline()}},{key:Ze?l.KeyMap.COMMA:l.KeyMap.RIGHT_ANGLE_BRACKET,mod:!0,shift:!0,callback:o=>{o.executeSuperscript()}},{key:Ze?l.KeyMap.PERIOD:l.KeyMap.LEFT_ANGLE_BRACKET,mod:!0,shift:!0,callback:o=>{o.executeSubscript()}},{key:l.KeyMap.L,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.LEFT)}},{key:l.KeyMap.E,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.CENTER)}},{key:l.KeyMap.R,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.RIGHT)}},{key:l.KeyMap.J,mod:!0,callback:o=>{o.executeRowFlex(l.RowFlex.ALIGNMENT)}},{key:l.KeyMap.J,mod:!0,shift:!0,callback:o=>{o.executeRowFlex(l.RowFlex.JUSTIFY)}}],nf=[{key:l.KeyMap.ZERO,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(null)}},{key:l.KeyMap.ONE,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.FIRST)}},{key:l.KeyMap.TWO,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.SECOND)}},{key:l.KeyMap.THREE,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.THIRD)}},{key:l.KeyMap.FOUR,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.FOURTH)}},{key:l.KeyMap.FIVE,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.FIFTH)}},{key:l.KeyMap.SIX,alt:!0,ctrl:!0,callback:o=>{o.executeTitle(l.TitleLevel.SIXTH)}}],of=[{key:l.KeyMap.I,shift:!0,mod:!0,callback:o=>{o.executeList(l.ListType.UL,l.ListStyle.DISC)}},{key:l.KeyMap.U,shift:!0,mod:!0,callback:o=>{o.executeList(l.ListType.OL)}}];class sf{command;globalShortcutList;agentShortcutList;constructor(t,e){this.command=e,this.globalShortcutList=[],this.agentShortcutList=[],this._addShortcutList([...ef,...nf,...of]),this._addEvent(),t.getCursor().getAgentDom().addEventListener("keydown",this._agentKeydown.bind(this))}_addEvent(){document.addEventListener("keydown",this._globalKeydown)}removeEvent(){document.removeEventListener("keydown",this._globalKeydown)}_addShortcutList(t){for(let e=t.length-1;e>=0;e--){const n=t[e];n.isGlobal?this.globalShortcutList.unshift(n):this.agentShortcutList.unshift(n)}}registerShortcutList(t){this._addShortcutList(t)}_globalKeydown=t=>{this.globalShortcutList.length&&this._execute(t,this.globalShortcutList)};_agentKeydown(t){this.agentShortcutList.length&&this._execute(t,this.agentShortcutList)}_execute(t,e){for(let n=0;n<e.length;n++){const i=e[n];if((i.mod?ge(t)===!!i.mod:t.ctrlKey===!!i.ctrl&&t.metaKey===!!i.meta)&&t.shiftKey===!!i.shift&&t.altKey===!!i.alt&&t.key.toLowerCase()===i.key.toLowerCase()){i.disable||(i?.callback?.(this.command),t.preventDefault());break}}}}class rf{editor;constructor(t){this.editor=t}use(t,e){t(this.editor,e)}}class lf{eventHub;constructor(){this.eventHub=new Map}on(t,e){if(!t||typeof e!="function")return;const n=this.eventHub.get(t)||new Set;n.add(e),this.eventHub.set(t,n)}emit(t,e){if(!t)return;const n=this.eventHub.get(t);if(n){if(n.size===1)return[...n][0](e);n.forEach(i=>i(e))}}off(t,e){if(!t||typeof e!="function")return;const n=this.eventHub.get(t);n&&n.delete(e)}isSubscribe(t){const e=this.eventHub.get(t);return!!e&&e.size>0}dangerouslyClearAll(){this.eventHub.clear()}}class af{paste;copy;drop}class Er{command;version;listener;eventBus;override;register;destroy;use;constructor(t,e,n={}){const i=Vo(n);e=dt(e);let r=[],s=[],a=[],c=[];Array.isArray(e)?s=e:(r=e.header||[],s=e.main,a=e.footer||[],c=e.graffiti||[]),[r,s,a].forEach(f=>{Yt(f,{editorOptions:i,isForceCompensation:!0})}),this.version=we,this.listener=new jh,this.eventBus=new lf,this.override=new af;const R=new Gh(t,i,{header:r,main:s,footer:a,graffiti:c},this.listener,this.eventBus,this.override);this.command=new Mr(new zh(R)),R.setCommand(this.command);const u=new tf(R,this.command),h=new sf(R,this.command);this.register=new qh({contextMenu:u,shortcut:h,i18n:R.getI18n()}),this.destroy=()=>{R.destroy(),h.removeEvent(),u.removeEvent(),this.eventBus.dangerouslyClearAll()};const g=new rf(this);this.use=g.use.bind(g)}}l.Command=Mr,l.EDITOR_CLIPBOARD=gn,l.EDITOR_COMPONENT=ce,l.Editor=Er,l.INTERNAL_CONTEXT_MENU_KEY=hn,l.INTERNAL_SHORTCUT_KEY=cs,l.LETTER_CLASS=go,l.createDomFromElementList=ze,l.default=Er,l.getElementListByHTML=je,l.getTextFromElementList=qe,l.splitText=Rt,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
549
549
|
//# sourceMappingURL=canvas-editor.umd.cjs.map
|