ht-emr 0.7.0 → 0.7.1
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,ve){typeof exports=="object"&&typeof module<"u"?ve(exports):typeof define=="function"&&define.amd?define(["exports"],ve):(l=typeof globalThis<"u"?globalThis:l||self,ve(l["canvas-editor"]={}))})(this,(function(l){"use strict";const ve="0.7.
|
|
2
|
+
(function(l,ve){typeof exports=="object"&&typeof module<"u"?ve(exports):typeof define=="function"&&define.amd?define(["exports"],ve):(l=typeof globalThis<"u"?globalThis:l||self,ve(l["canvas-editor"]={}))})(this,(function(l){"use strict";const ve="0.7.1";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 _="",Fi=`
|
|
3
3
|
`,To=" ",yi=" ",Ur=["·","、",":",":",",",",",".","。",";",";","?","?","!","!"],bi={[l.MaxHeightRatio.HALF]:1/2,[l.MaxHeightRatio.ONE_THIRD]:1/3,[l.MaxHeightRatio.QUARTER]:1/4},mo={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:"ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσςΤτΥυΦφΧχΨψΩω"},wr="中";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 po=/[0-9.]/,Zr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/,Qr=/[#*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(`${Qr.source}|${Zr.source}`,"g"),Kr=/[、,。?!;:……「」“”‘’*()【】〔〕〖〗〘〙〚〛《》———﹝﹞–—\\/·.,!?;:`~<>()[\]{}'"|]/,Lo=new RegExp(`^[${_}
|
|
4
4
|
]`),Hr=/[^0-9\+\-\.eE,]/,_r=/\s/;function xr(o,t){let e;return function(...n){e&&window.clearTimeout(e),e=window.setTimeout(()=>{o.apply(this,n)},t)}}function Gr(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 Io(o,t){if(!o||typeof o!="object")return o;let e={};return Array.isArray(o)?e=o.map(n=>Io(n,t)):Object.keys(o).forEach(n=>{t.includes(n)||(e[n]=Io(o[n],t))}),e}function at(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=>at(e)):Object.keys(o).forEach(e=>{t[e]=at(o[e])}),t}function Po(o){return o&&o.nodeType===1&&o.tagName.toLowerCase()==="body"}function Wi(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 lt(){function o(){return((1+Math.random())*65536|0).toString(16).substring(1)}return o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()}function ct(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 Vi(o,t){const e=document.createElement("a");e.href=o,e.download=t,e.click()}function Ar(o,t){kr(3,o,t)}function kr(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 wn(o){return Object.prototype.toString.call(o)==="[object Object]"}function Mo(o){return Array.isArray(o)}function Oo(o){return Object.prototype.toString.call(o)==="[object Number]"}function Jr(o){return Object.prototype.toString.call(o)==="[object String]"}function Yi(o,t){if(wn(o)&&wn(t)){const e=t;for(const[n,i]of Object.entries(o))e[n]?e[n]=Yi(i,e[n]):e[n]=i}else Mo(o)&&Mo(t)&&t.push(...o);return t}function Co(o){if(typeof queueMicrotask=="function"){queueMicrotask(()=>{o()});return}if(typeof Promise<"u"){Promise.resolve().then(()=>{o()});return}setTimeout(()=>{o()},0)}function Br(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 De(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 Di(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 Dt(o,t){const e={};for(const n in o)t.includes(n)&&(e[n]=o[n]);return e}function se(o,t){const e={};for(const n in o)t.includes(n)||(e[n]=o[n]);return e}function $r(o){const e=new TextEncoder().encode(o),n=Array.from(e,r=>String.fromCharCode(r));return window.btoa(n.join(""))}function zr(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 Ui(o,t){return o.length!==t.length?!1:!o.some(e=>!t.includes(e))}function jr(o,t){if(!wn(o)||!wn(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 qr(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 wi(o){return o==null}function Zn(o){return o.replace(/\r\n|\r/g,`
|
|
5
5
|
`)}function Zi(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 Qi(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)}function Vt(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function tl(o,t){return o.performance.enabled&&t>=o.performance.threshold}function So(o,t,e,n=[],i){if(!tl(o,e))return;const r={duration:Number(e.toFixed(2)),breakdown:n.map(s=>({label:s.label,duration:Number(s.duration.toFixed(2))})),...i};console.log(`[canvas-editor perf] ${t}`,r)}const el=12,nl={width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},ue="editor-component",z="ce",Ln=`${z}-clipboard`,Eo={print:{imagePreviewerDisabled:!1,backgroundDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1,inputTraceEnabled:!0,deleteTraceEnabled:!0}};var Ut;(function(o){o.UP="top",o.DOWN="down",o.LEFT="left",o.RIGHT="right"})(Ut||(Ut={}));const Ke=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ol=typeof navigator<"u"&&/iPad|iPhone/.test(navigator.userAgent),il=/Mobile|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sl=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",o.SUB_TEMPLATE="subTemplate"})(l.ElementType||(l.ElementType={}));const Re=["bold","color","highlight","font","size","italic","underline","strikeout","textDecoration","deletePerson","newElEditPerson","deleteTime","newElEditTime"],$t=["rowFlex","rowMargin"],rl=["type","font","size","bold","color","italic","highlight","underline","strikeout","rowFlex","url","areaId","hyperlinkId","dateId","dateFormat","groupIds","templateId","subTemplateContent","subTemplateRelation","subTemplateConditions","rowMargin","textDecoration","deletePerson","newElEditPerson","deleteTime","newElEditTime"],ll=["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","templateId","subTemplateContent","subTemplateRelation","subTemplateConditions","subTemplateExpanded"],al=["conceptId","extension","externalId","verticalAlign","backgroundColor","borderTypes","slashTypes","disabled","deletable"],ze=["tdId","trId","tableId"],Xo=["level","titleId","title"],In=["listId","listType","listStyle"],No=["control","controlId","controlComponent"],At=["font","size","bold","highlight","italic","strikeout","deletePerson","newElEditPerson","deleteTime","color","newElEditTime"],He=["areaId","area"],Fo=[...ze,...Xo,...In,...He],zt=[l.ElementType.TEXT,l.ElementType.HYPERLINK,l.ElementType.SUBSCRIPT,l.ElementType.SUPERSCRIPT,l.ElementType.CONTROL,l.ElementType.DATE],cl=[l.ElementType.IMAGE,l.ElementType.LATEX],dl=[l.ElementType.BLOCK,l.ElementType.PAGE_BREAK,l.ElementType.SEPARATOR,l.ElementType.TABLE],ul=["HR","TABLE","UL","OL"],Rl=[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 vi{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(`${z}-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 @@ ${R} `}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"]'),u=()=>{this.closeModal()};n.addEventListener("click",R=>{R.stopPropagation()}),e.addEventListener("click",u),i.addEventListener("click",u),r.addEventListener("click",u),d.forEach(R=>{R.addEventListener("change",()=>{const h=R.value==="true";a.style.display=h?"none":"block",c.style.display=h?"block":"none"})}),s.addEventListener("click",R=>{R.preventDefault(),R.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 P=0;P<T.length;P++){const C=T[P];C.controlId===m&&C.control&&(C.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()}}l.AreaMode=void 0,(function(o){o.EDIT="edit",o.READONLY="readonly",o.FORM="form"})(l.AreaMode||(l.AreaMode={}));class Ih{controlBorder;textFieldUnderline;draw;range;listener;eventBus;controlSearch;options;controlOptions;activeControl;activeControlValue;preElement;constructor(t){this.controlBorder=new Tc(t),this.textFieldUnderline=new Ph(t),this.draw=t,this.range=t.getRange(),this.listener=t.getListener(),this.eventBus=t.getEventBus(),this.controlSearch=new fc(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,u=!!s?.originControlId;let R=!1;if(u){const p=s.originControlId;for(let I=t;I<n.length;I++){const L=n[I];if(L.controlId===p&&!L.originControlId){R=!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&&!R)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 u=n[d];if(u.controlId&&u.controlId!==r.controlId&&(u.controlComponent===l.ControlComponent.PRETEXTFIX||u.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||u.controlComponent===l.ControlComponent.PREFIX||u.controlComponent===l.ControlComponent.PRE_TEXT))return!0;if(u.controlId&&u.controlId!==r.controlId&&(u.controlComponent===l.ControlComponent.POSTFIX||u.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 u=e;u<n.length;u++){const R=n[u];if(R.controlId===a&&!R.originControlId){if(R.controlComponent===l.ControlComponent.POSTTEXTFIX||R.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||R.controlComponent===l.ControlComponent.POSTFIX||R.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 u=c!==-1?c:s,R=d!==-1?d-1:a;return{controlId:e,originControlId:n,parentControlId:r,startIndex:u,endIndex:R<u?u:R}}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=Ue(at(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 Mn||this.activeControl instanceof Yn||this.activeControl instanceof Dn||this.activeControl instanceof Be){const u=this.activeControl.getElement();n?.controlId!==u?.controlId?this.destroyControl():n.controlComponent===l.ControlComponent.POSTFIX?this.activeControl.destroy():this.activeControl.awake()}if(this.activeControl){const u=this.activeControl.getElement(),R=n.controlId,h=u.controlId;if(R&&R===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(!R){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 u=n.originControlId;for(let R=this.range.getRange().startIndex;R>=0;R--){const h=t[R];if(h.controlId===u&&!h.originControlId&&h.control){r=h.control,s=h;break}if(h.controlId===u&&!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 u=this.getElementList();for(let R=this.range.getRange().startIndex;R>=0;R--){const h=u[R];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 u=n.controlId;for(let R=this.range.getRange().startIndex;R>=0;R--){const h=t[R];if(h.controlId===u&&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 Rr(s,this);else if(r.type===l.ControlType.TEXT)this.activeControl=new Si(s,this);else if(r.type===l.ControlType.SELECT){const u=new Mn(s,this);this.activeControl=u,(d||this.draw.getMode()===l.EditorMode.FORM)&&u.awake()}else if(r.type===l.ControlType.CHECKBOX)this.activeControl=new _n(s,this);else if(r.type===l.ControlType.RADIO)this.activeControl=new Ko(s,this);else if(r.type===l.ControlType.DATE){const u=new Yn(s,this);this.activeControl=u,u.awake()}else if(r.type===l.ControlType.NUMBER){const u=new Dn(s,this);this.activeControl=u,d&&u.awake()}else if(r.type===l.ControlType.BUTTON){const u=new Be(s,this);if(this.activeControl=u,d){u.awake();return}}else if(r.type===l.ControlType.MENSTRUAL_HISTORY){const u=new hr(s,this);this.activeControl=u,u.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 Mn||this.activeControl instanceof Yn||this.activeControl instanceof Dn||this.activeControl instanceof hr)&&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=Mt(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 Mn)&&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=sn(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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent!==l.ControlComponent.PREFIX&&u.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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent===l.ControlComponent.VALUE||u.controlComponent===l.ControlComponent.PREFIX||u.controlComponent===l.ControlComponent.PRE_TEXT||u.controlComponent===l.ControlComponent.PRETEXTFIX||u.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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent===l.ControlComponent.VALUE||u.controlComponent===l.ControlComponent.PREFIX||u.controlComponent===l.ControlComponent.PRE_TEXT||u.controlComponent===l.ControlComponent.PRETEXTFIX||u.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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent!==l.ControlComponent.PRETEXTFIX&&u.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 P=this.draw.getMode();if(P===l.EditorMode.FORM&&this.options.modeRule[P].controlDeletableDisabled)return null}let r=-1,s=-1;const a=!!i.originControlId,c=i.controlId,d=i.originControlId,u=i.control?.type===l.ControlType.BUTTON&&!i.control?.buttonText?`${c}_text`:"";let R=t;for(;R>=0;){const L=n[R];let P=!1;if(a?P=L.controlId===c&&L.originControlId===d:P=L.controlId===c&&!L.originControlId,!P){r=R;break}R--}let h=t;for(;h<n.length;){const L=n[h];let P=!1;if(a?P=L.controlId===c&&L.originControlId===d:P=L.controlId===c&&!L.originControlId,!P){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(u)for(let L=n.length-1;L>=0;L--)n[L].controlId===u&&(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 u=ct(r.placeholder),R=Dt(i,At),h=s+1;for(let g=0;g<u.length;g++){const f=u[g],T={...R,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"]'),u=()=>{this.closeModal()};n.addEventListener("click",R=>{R.stopPropagation()}),e.addEventListener("click",u),i.addEventListener("click",u),r.addEventListener("click",u),d.forEach(R=>{R.addEventListener("change",()=>{const h=R.value==="true";a.style.display=h?"none":"block",c.style.display=h?"block":"none"})}),s.addEventListener("click",R=>{R.preventDefault(),R.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 P=0;P<T.length;P++){const C=T[P];C.controlId===m&&C.control&&(C.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()}}l.AreaMode=void 0,(function(o){o.EDIT="edit",o.READONLY="readonly",o.FORM="form"})(l.AreaMode||(l.AreaMode={}));class Ih{controlBorder;textFieldUnderline;draw;range;listener;eventBus;controlSearch;options;controlOptions;activeControl;activeControlValue;preElement;constructor(t){this.controlBorder=new Tc(t),this.textFieldUnderline=new Ph(t),this.draw=t,this.range=t.getRange(),this.listener=t.getListener(),this.eventBus=t.getEventBus(),this.controlSearch=new fc(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,u=!!s?.originControlId;let R=!1;if(u){const p=s.originControlId;for(let I=t;I<n.length;I++){const L=n[I];if(L.controlId===p&&!L.originControlId){R=!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&&!R)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 u=n[d];if(u.controlId&&u.controlId!==r.controlId&&(u.controlComponent===l.ControlComponent.PRETEXTFIX||u.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||u.controlComponent===l.ControlComponent.PREFIX||u.controlComponent===l.ControlComponent.PRE_TEXT))return!0;if(u.controlId&&u.controlId!==r.controlId&&(u.controlComponent===l.ControlComponent.POSTFIX||u.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 u=e;u<n.length;u++){const R=n[u];if(R.controlId===a&&!R.originControlId){if(R.controlComponent===l.ControlComponent.POSTTEXTFIX||R.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||R.controlComponent===l.ControlComponent.POSTFIX||R.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 u=c!==-1?c:s,R=d!==-1?d-1:a;return{controlId:e,originControlId:n,parentControlId:r,startIndex:u,endIndex:R<u?u:R}}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=Ue(at(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 Mn||this.activeControl instanceof Yn||this.activeControl instanceof Dn||this.activeControl instanceof Be){const u=this.activeControl.getElement();n?.controlId!==u?.controlId?this.destroyControl():n.controlComponent===l.ControlComponent.POSTFIX?this.activeControl.destroy():this.activeControl.awake()}if(this.activeControl){const u=this.activeControl.getElement(),R=n.controlId,h=u.controlId;if(R&&R===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(!R){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 u=n.originControlId;for(let R=this.range.getRange().startIndex;R>=0;R--){const h=t[R];if(h.controlId===u&&!h.originControlId&&h.control){r=h.control,s=h;break}if(h.controlId===u&&!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 u=this.getElementList();for(let R=this.range.getRange().startIndex;R>=0;R--){const h=u[R];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 u=n.controlId;for(let R=this.range.getRange().startIndex;R>=0;R--){const h=t[R];if(h.controlId===u&&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 Rr(s,this);else if(r.type===l.ControlType.TEXT)this.activeControl=new Si(s,this);else if(r.type===l.ControlType.SELECT){const u=new Mn(s,this);this.activeControl=u,(d||this.draw.getMode()===l.EditorMode.FORM)&&u.awake()}else if(r.type===l.ControlType.CHECKBOX)this.activeControl=new _n(s,this);else if(r.type===l.ControlType.RADIO)this.activeControl=new Ko(s,this);else if(r.type===l.ControlType.DATE){const u=new Yn(s,this);this.activeControl=u,u.awake()}else if(r.type===l.ControlType.NUMBER){const u=new Dn(s,this);this.activeControl=u,d&&u.awake()}else if(r.type===l.ControlType.BUTTON){const u=new Be(s,this);if(this.activeControl=u,d){u.awake();return}}else if(r.type===l.ControlType.MENSTRUAL_HISTORY){const u=new hr(s,this);this.activeControl=u,u.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 Mn||this.activeControl instanceof Yn||this.activeControl instanceof Dn||this.activeControl instanceof hr)&&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=Mt(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 Mn)&&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.hide||a.control?.hide||a.area?.hide){const d=sn(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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent!==l.ControlComponent.PREFIX&&u.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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent===l.ControlComponent.VALUE||u.controlComponent===l.ControlComponent.PREFIX||u.controlComponent===l.ControlComponent.PRE_TEXT||u.controlComponent===l.ControlComponent.PRETEXTFIX||u.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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent===l.ControlComponent.VALUE||u.controlComponent===l.ControlComponent.PREFIX||u.controlComponent===l.ControlComponent.PRE_TEXT||u.controlComponent===l.ControlComponent.PRETEXTFIX||u.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 u=s[d];if(u.controlId!==a.controlId||u.controlComponent!==l.ControlComponent.PRETEXTFIX&&u.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 P=this.draw.getMode();if(P===l.EditorMode.FORM&&this.options.modeRule[P].controlDeletableDisabled)return null}let r=-1,s=-1;const a=!!i.originControlId,c=i.controlId,d=i.originControlId,u=i.control?.type===l.ControlType.BUTTON&&!i.control?.buttonText?`${c}_text`:"";let R=t;for(;R>=0;){const L=n[R];let P=!1;if(a?P=L.controlId===c&&L.originControlId===d:P=L.controlId===c&&!L.originControlId,!P){r=R;break}R--}let h=t;for(;h<n.length;){const L=n[h];let P=!1;if(a?P=L.controlId===c&&L.originControlId===d:P=L.controlId===c&&!L.originControlId,!P){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(u)for(let L=n.length-1;L>=0;L--)n[L].controlId===u&&(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 u=ct(r.placeholder),R=Dt(i,At),h=s+1;for(let g=0;g<u.length;g++){const f=u[g],T={...R,value:f===`
|
|
185
185
|
`?_:f,controlId:i.controlId,type:l.ElementType.CONTROL,control:i.control,controlComponent:l.ControlComponent.PLACEHOLDER,color:this.controlOptions.placeholderColor};wt(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=(u,R)=>{let h=0;for(;h<u.length;){const g=u[h];if(h++,g.type===l.ElementType.TABLE){const P=g.trList;for(let C=0;C<P.length;C++){const S=P[C];for(let F=0;F<S.tdList.length;F++){const N=S.tdList[F],V=N.originalId??N.id;a.has(V)||(a.add(V),N.linkTdNextId?c(this.draw.getSplitTdValues(V),R):c(N.value,R))}}}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<u.length;){const P=u[p];if(P.controlId!==g.controlId)break;(f===l.ControlType.TEXT||f===l.ControlType.TEXTFIELD||f===l.ControlType.DATE||f===l.ControlType.NUMBER)&&P.controlComponent===l.ControlComponent.VALUE&&(I+=P.value,L.push(se(P,No))),p++}if(f===l.ControlType.TEXT||f===l.ControlType.TEXTFIELD||f===l.ControlType.DATE||f===l.ControlType.NUMBER)s.push({...g.control,zone:R,value:I||null,innerText:I||null,elementList:Mt(L)});else if(f===l.ControlType.SELECT||f===l.ControlType.CHECKBOX||f===l.ControlType.RADIO){const P=T?.split(",").map(C=>m?.find(S=>S.code===C)?.value).filter(Boolean).join("");s.push({...g.control,zone:R,value:T||null,innerText:P||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:u,elementList:R}of d)c(R,u);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 P=0;P<L.length;P++){const C=L[P];for(let S=0;S<C.tdList.length;S++){const F=C.tdList[S];i(F.value,F.id)}}}if(!d.control||d.type===l.ElementType.SPLIT_TAG)continue;const u=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(!u)continue;const{value:R,isSubmitHistory:h=!0}=u;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(R)?R:R?[{value:R}]:[];L.length&&bt(L,{isHandleFirstElement:!1,editorOptions:this.options});const P=new Rr(d,this);this.activeControl=P,L.length?P.setValue(L,m,p):P.clearValue(m,p)}else if(g===l.ControlType.TEXT){const L=Array.isArray(R)?R:R?[{value:R}]:[];L.length&&bt(L,{isHandleFirstElement:!1,editorOptions:this.options});const P=new Si(d,this);this.activeControl=P,L.length?P.setValue(L,m,p):P.clearValue(m,p)}else if(g===l.ControlType.SELECT){if(Array.isArray(R))continue;const L=new Mn(d,this);this.activeControl=L,R?L.setSelect(R,m,p):L.clearSelect(m,p)}else if(g===l.ControlType.CHECKBOX){if(Array.isArray(R))continue;const L=new _n(d,this);this.activeControl=L;const P=R?R.split(","):[];L.setSelect(P,m,p)}else if(g===l.ControlType.RADIO){if(Array.isArray(R))continue;const L=new Ko(d,this);this.activeControl=L;const P=R?[R]:[];L.setSelect(P,m,p)}else if(g===l.ControlType.DATE){const L=new Yn(d,this);this.activeControl=L,Mo(R)?(R.length&&bt(R,{isHandleFirstElement:!1,editorOptions:this.options}),L.setValue(R,m,p)):Jr(R)?L.setSelect(R,m,p):L.clearSelect(m,p)}else if(g===l.ControlType.NUMBER){const L=Array.isArray(R)?R:R?[{value:R}]:[];L.length&&bt(L,{isHandleFirstElement:!1,editorOptions:this.options});const P=new Dn(d,this);this.activeControl=P,L.length?P.setValue(L,m,p):P.clearValue(m,p)}else if(g===l.ControlType.BUTTON){const L=Array.isArray(R)?R:R?[{value:R}]:[];L.length&&bt(L,{isHandleFirstElement:!1,editorOptions:this.options});const P=new Be(d,this);this.activeControl=P,L.length?P.setValue(L,m,p):P.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 u=s.trList;for(let R=0;R<u.length;R++){const h=u[R];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(u=>u.id&&s.controlId===u.id||u.conceptId&&s.control.conceptId===u.conceptId||u.areaId&&s.areaId===u.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:u,isSubmitHistory:R=!0}=d;if(e=!0,R&&(n=!0),this.setControlProperties({...c.control,...u,value:c.control.value},{elementList:s,range:{startIndex:a-1,endIndex:a-1}}),At.forEach(g=>{const f=u[g];f&&Reflect.set(c,g,f)}),c.control?.type===l.ControlType.NUMBER&&u.numberExclusiveOptions){const g={...c.control.numberExclusiveOptions,...u.numberExclusiveOptions},f=g?.minValue,T=g?.maxValue,m=new Dn(c,this),p=m.getValue({elementList:s,range:{startIndex:a-1,endIndex:a-1}});if(p.length>0){const I=p.map(P=>P.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=Mt(r[a],{isClassifyArea:!0,extraPickAttrs:["id","controlId"]});r[a]=c,bt(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 u=0;u<d.tdList.length;u++){const h=d.tdList[u].value;e(h)}}}if(s.controlId){const a=se(s,[...Xo,...In]);t.push(a)}}}const n=[this.draw.getHeader().getElementList(),this.draw.getOriginalMainElementList(),this.draw.getFooter().getElementList()];for(const i of n)e(i);return Mt(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 t=this.activeControl.getElement(),e=this.getControlKey(t);if(!e)return null;const n=this.getOrderedNavigableControlContexts(),i=n.findIndex(r=>r.controlKey===e);return i<=0?null:n[i-1]}getNextControlContext(){if(!this.activeControl)return null;const t=this.activeControl.getElement(),e=this.getControlKey(t);if(!e)return null;const n=this.getOrderedNavigableControlContexts(),i=n.findIndex(r=>r.controlKey===e);return i===-1||i>=n.length-1?null:n[i+1]}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})}getControlKey(t){return t?.controlId?`${t.controlId}_${t.originControlId||""}`:null}getControlStartIndex(t,e){const n=this.getControlKey(t[e]);if(!n)return e;let i=e;for(;i>0&&this.getControlKey(t[i-1])===n;)i--;return i}getControlEnterIndex(t,e){const n=this.getControlStartIndex(t,e),i=this.getControlKey(t[n]);if(!i)return e;let r=n,s=n;for(;s<t.length;){const a=t[s];if(this.getControlKey(a)!==i)break;if(a.controlComponent===l.ControlComponent.PREFIX||a.controlComponent===l.ControlComponent.PRE_TEXT||a.controlComponent===l.ControlComponent.PRETEXTFIX||a.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT){r=s,s++;continue}return r}return r}isNavigableControlElement(t,e){return!t?.controlId||!t.control?!1:this.options.mode!==l.EditorMode.FORM?!0:!(_t(t)||e?.disabled||t.area?.mode===l.AreaMode.READONLY||t.control.disabled||t.control.readonly||t.control.buttonText||t.control.type===l.ControlType.TEXTFIELD&&!t.originControlId)}getOrderedNavigableControlContexts(){const t=[],e=(n,i,r)=>{let s=0;for(;s<n.length;){const a=n[s];if(a.type===l.ElementType.TABLE){const d=a.trList||[];for(let u=0;u<d.length;u++){const R=d[u],h=R.tdList;for(let g=0;g<h.length;g++){const f=h[g];e(f.value,{isTable:!0,index:s,trIndex:u,tdIndex:g,tdId:f.id,trId:R.id,tableId:a.id},f)}}s++;continue}const c=this.getControlKey(a);c&&this.isNavigableControlElement(a,r)&&t[t.length-1]?.controlKey!==c&&t.push({controlKey:c,positionContext:{...i},nextIndex:this.getControlEnterIndex(n,s)}),s++}};return e(this.draw.getOriginalElementList(),{isTable:!1}),t}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 u=n.metrics.width,R=e.elementList.length-1;for(;R>=0;){const h=e.elementList[R];if(u+=h.metrics.width,e.elementList[R-1]?.controlComponent===l.ControlComponent.PREFIX){c=h;break}R--}c&&u<a&&(n.control.rowFlex===l.RowFlex.CENTER?c.left=(a-u)/2:n.control.rowFlex===l.RowFlex.RIGHT&&(c.left=a-u-n.metrics.width))}const d=a-i;if(d>0){const u=c?.left||0,R=r-e.width-n.metrics.width,h=Math.min(R,d);n.left=h-u,e.width+=h-u}}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 u=!1,R=i,h=s,g=e;for(;R>=0;){const p=g[R];if(p.controlId!==a.controlId)break;if(p.type!==l.ElementType.SPLIT_TAG&&(d.unshift(p),u&&(g.splice(R,1),e[0].type===l.ElementType.SPLIT_TAG?e.splice(0,1):(n.startIndex++,n.endIndex++),e.unshift(p)),c.startIndex=R),R===0&&p.controlComponent!==l.ControlComponent.PREFIX&&h?.linkTdPrevId&&(h=this.draw.getTdById(h.linkTdPrevId),h)){g=h.value,R=h.value.length-1,u=!0;continue}if(R===0&&p.controlComponent!==l.ControlComponent.PRETEXTFIX&&h?.linkTdPrevId&&(h=this.draw.getTdById(h.linkTdPrevId),h)){g=h.value,R=h.value.length-1,u=!0;continue}R--}u=!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),u&&(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,u=!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,u=!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 Ph{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}}function gr(o,t){const e=n=>{for(let i=0;i<n.length;i++){const r=n[i];if(t(r),r.valueList?.length&&e(r.valueList),r.control?.value?.length&&e(r.control.value),r.type===l.ElementType.TABLE&&r.trList?.length)for(let s=0;s<r.trList.length;s++){const a=r.trList[s];for(let c=0;c<a.tdList.length;c++)e(a.tdList[c].value)}}};e(o)}function Mh(o){const t=o.control;return t?t.type===l.ControlType.TEXT||t.type===l.ControlType.TEXTFIELD||t.type===l.ControlType.DATE||t.type===l.ControlType.NUMBER?xe(t.value||[])||null:(t.type===l.ControlType.SELECT||t.type===l.ControlType.CHECKBOX||t.type===l.ControlType.RADIO)&&t.code?.split(",").map(e=>t.valueSets?.find(n=>n.code===e)?.value).filter(Boolean).join("")||null:null}function Oh(o){const t=new Map,e=new Set,n=new Set,i=(r,s,a)=>{if(!r||s==null)return;const c=t.get(r)||[];c.push({label:r,source:a,value:s}),t.set(r,c)};return gr(o,r=>{r.control&&r.controlId&&!e.has(r.controlId)&&(e.add(r.controlId),i(r.control.label,Mh(r),"control"));const s=r.id;if(s&&!n.has(s)&&(r.type===l.ElementType.MACRO||r.type===l.ElementType.CUSTOM_MACRO||r.type===l.ElementType.REUSABLE_ITEM)){n.add(s);let a;r.type===l.ElementType.MACRO?a=r.value:r.type===l.ElementType.CUSTOM_MACRO?a=r.macroConfig?.value:r.type===l.ElementType.REUSABLE_ITEM&&(a=r.reusableItemConfig?.value),i(r.label,a,"macro")}}),t}function fr(o,t){const{label:e,regex:n,source:i="all"}=o;if(!e||!n)return!1;const r=t.get(e);if(!r?.length)return!1;let s;try{s=new RegExp(n)}catch(a){return console.warn("子模板匹配正则无效:",n,a),!1}return r.some(a=>i!=="all"&&a.source!==i?!1:s.test(a.value))}function Ch(o,t,e="and"){return o?.length?e==="or"?o.some(n=>fr(n,t)):o.every(n=>fr(n,t)):!0}class Sh{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:u,verticalAlign:R},scale:h}=this.options,{metrics:g,checkbox:f}=r.elementList[i];if(R===l.VerticalAlign.TOP||R===l.VerticalAlign.MIDDLE){let L=i+1,P=null;for(;L<r.elementList.length&&(P=r.elementList[L],!(P.value!==_&&P.value!==To));)L++;if(P){const{metrics:{boundingBoxAscent:C,boundingBoxDescent:S}}=P,F=C+S;F>g.height&&(R===l.VerticalAlign.TOP?s-=C-g.height:R===l.VerticalAlign.MIDDLE&&(s-=(F-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=u,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 Eh{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:u,verticalAlign:R},scale:h}=this.options,{metrics:g,radio:f}=r.elementList[i];if(R===l.VerticalAlign.TOP||R===l.VerticalAlign.MIDDLE){let L=i+1,P=null;for(;L<r.elementList.length&&(P=r.elementList[L],!(P.value!==_&&P.value!==To));)L++;if(P){const{metrics:{boundingBoxAscent:C,boundingBoxDescent:S}}=P,F=C+S;F>g.height&&(R===l.VerticalAlign.TOP?s-=C-g.height:R===l.VerticalAlign.MIDDLE&&(s-=(F-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:u,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 go={fontSize:11,smallFontSize:9,lineHeight:12,dividerWidth:40,gap:4,totalHeight:36};class Xh{draw;options;inputModal=null;isPopup=!1;constructor(t){this.draw=t,this.options=t.getOptions()}computeSize(t){const e=go,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"),u=t.menstrualData;d.font=`${i}px "Microsoft YaHei", sans-serif`;let R=a;d.font=`${r}px "Microsoft YaHei", sans-serif`;let h=0;if(u){const f=this.getValue(u.menarcheAge);d.font=`${i}px "Microsoft YaHei", sans-serif`,f&&(R+=d.measureText(`${f}岁`).width+s);let T="";if(u.isMenopause){const P=this.getValue(u.menopauseAge);P&&(T=`${P}岁`)}else{const P=this.getValue(u.lastPeriod);P&&(T=P)}T&&(R+=d.measureText(T).width+s),d.font=`${r}px "Microsoft YaHei", sans-serif`;const m=this.getValue(u.periodMin),p=this.getValue(u.periodMax);if(m||p){const P=`${m||""}~${p||""}`;h=Math.max(h,d.measureText(P).width)}const I=this.getValue(u.cycleMin),L=this.getValue(u.cycleMax);if(I||L){const P=`${I||""}~${L||""}`;h=Math.max(h,d.measureText(P).width)}}else d.font=`${i}px "Microsoft YaHei", sans-serif`,h=d.measureText("~").width;return{width:Math.max(R,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=`${go.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=go,s=r.fontSize*i,a=r.lineHeight*i,c=r.dividerWidth*i,d=n-a*1.5,u=e+c/2;t.font=`${s}px "Microsoft YaHei", sans-serif`;const R=t.measureText("~").width,h=u-R/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=go,a=s.fontSize*r,c=s.smallFontSize*r,d=s.lineHeight*r,u=s.gap*r,R=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 O=`${f}岁`;t.fillText(O,e,g),T=e+t.measureText(O).width+u}const m=T+R/2,p=h+d;t.font=`${c}px "Microsoft YaHei", sans-serif`;const I=this.getValue(i.periodMin),L=this.getValue(i.periodMax);let P="";I||L?P=`${I||""}~${L||""}`:(t.font=`${a}px "Microsoft YaHei", sans-serif`,P="~");const C=t.measureText(P).width,S=m-C/2;t.fillText(P,S,p),this.drawDivider(t,T,g-a/2,R,r),t.font=`${a}px "Microsoft YaHei", sans-serif`;let F="";if(i.isMenopause){const O=this.getValue(i.menopauseAge);O&&(F=`${O}岁`)}else{const O=this.getValue(i.lastPeriod);O&&(F=O)}F&&t.fillText(F,T+R+u,g);const N=g+d;t.font=`${c}px "Microsoft YaHei", sans-serif`;const V=this.getValue(i.cycleMin),Y=this.getValue(i.cycleMax);let E="";V||Y?E=`${V||""}~${Y||""}`:(t.font=`${a}px "Microsoft YaHei", sans-serif`,E="~");const W=t.measureText(E).width,X=m-W/2;t.fillText(E,X,N)}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">
|
|
@@ -535,7 +535,7 @@ ${R} `}textToElements(t){const e=[],n=t.split(`
|
|
|
535
535
|
<button class="btn-confirm">确定</button>
|
|
536
536
|
</div>
|
|
537
537
|
</div>
|
|
538
|
-
`,document.body.appendChild(a);const c=a.querySelector(".table-properties-modal__mask"),d=a.querySelector(".table-properties-modal__close"),u=a.querySelector(".btn-cancel"),R=a.querySelector(".btn-confirm"),h=()=>{a.remove()};c.addEventListener("click",h),d.addEventListener("click",h),u.addEventListener("click",h),R.addEventListener("click",()=>{const g=parseInt(a.querySelector("#tdPaddingTop").value)||0,f=parseInt(a.querySelector("#tdPaddingRight").value)||0,T=parseInt(a.querySelector("#tdPaddingBottom").value)||0,m=parseInt(a.querySelector("#tdPaddingLeft").value)||0;i.tdPadding=[g,f,T,m],h();const{endIndex:p}=this.range.getRange();this.draw.render({curIndex:p,isCompute:!0})})}}class tg{draw;zone;range;position;options;areaInfoMap=new Map;constructor(t){this.draw=t,this.options=t.getOptions(),this.zone=t.getZone(),this.range=t.getRange(),this.position=t.getPosition()}getAreaInfo(){return this.areaInfoMap}getActiveAreaId(){if(!this.areaInfoMap.size)return null;const{startIndex:t}=this.range.getRange();return this.draw.getElementList()[t]?.areaId||null}getActiveAreaInfo(){const t=this.getActiveAreaId();return t&&this.areaInfoMap.get(t)||null}isReadonly(){const t=this.getActiveAreaInfo();if(!t?.area)return!1;switch(t.area.mode){case l.AreaMode.EDIT:return!1;case l.AreaMode.READONLY:return!0;case l.AreaMode.FORM:return!this.draw.getControl().getIsRangeWithinControl();default:return!1}}insertArea(t){const{id:e,value:n,area:i,position:r,range:s}=t;if(this.zone.getZone()!==l.EditorZone.MAIN&&this.zone.setZone(l.EditorZone.MAIN),this.draw.getPosition().setPositionContext({isTable:!1}),s&&!this.getActiveAreaId()){const{startIndex:c,endIndex:d}=s,u=this.draw.getOriginalMainElementList();if(!u[c]||!u[d])return null;this.range.setRange(s.startIndex,s.endIndex)}else if(r===l.LocationPosition.BEFORE)this.range.setRange(0,0);else{const d=this.draw.getOriginalMainElementList().length-1;this.range.setRange(d,d)}const a=e||lt();return this.draw.insertElementList([{type:l.ElementType.AREA,value:"",areaId:a,valueList:n,area:at(i)}]),a}render(t,e){if(!this.areaInfoMap.size)return;t.save();const n=this.draw.getMargins(),i=this.draw.getInnerWidth();for(const r of this.areaInfoMap){const{area:s,positionList:a}=r[1];if(s?.hide||!s?.backgroundColor&&!s?.borderColor&&!s?.placeholder)continue;const c=a.filter(f=>f.pageNo===e);if(!c.length)continue;t.translate(.5,.5);const d=c[0],u=c[c.length-1],R=n[3],h=Math.ceil(d.coordinate.leftTop[1]),g=Math.ceil(u.coordinate.rightBottom[1]-h);t.textBaseline="middle",s.backgroundColor&&(t.fillStyle=s.backgroundColor,t.fillRect(R,h,i,g)),s.borderColor&&(t.strokeStyle=s.borderColor,t.strokeRect(R,h,i,g)),s.placeholder&&a.length<=1&&new Xr(this.draw).render(t,{placeholder:{...ki,...s.placeholder},startY:d.coordinate.leftTop[1]}),t.translate(-.5,-.5)}t.restore()}compute(){this.areaInfoMap.clear();const t=this.draw.getOriginalMainElementList(),e=this.position.getOriginalMainPositionList();for(let n=0;n<t.length;n++){const i=t[n],r=i.areaId;if(r){const s=this.areaInfoMap.get(r);s?(s.elementList.push(i),s.positionList.push(e[n])):this.areaInfoMap.set(r,{id:r,area:i.area,elementList:[i],positionList:[e[n]]})}}}getAreaValue(t={}){const e=t.id||this.getActiveAreaId();if(!e)return null;const n=this.areaInfoMap.get(e);return n?{area:n.area,id:n.id,startPageNo:n.positionList[0].pageNo,endPageNo:n.positionList[n.positionList.length-1].pageNo,value:Mt(n.elementList)}:null}getContextByAreaId(t,e){const n=this.draw.getOriginalMainElementList();for(let i=0;i<n.length;i++){const r=n[i];if(e?.position===l.LocationPosition.OUTER_BEFORE){if(n[i+1]?.areaId!==t)continue}else if(e?.position===l.LocationPosition.AFTER){if(!(r.areaId===t&&n[i+1]?.areaId!==t))continue}else if(e?.position===l.LocationPosition.OUTER_AFTER){if(!(r.areaId!==t&&n[i-1]?.areaId===t))continue}else if(r.areaId!==t)continue;const s=this.position.getOriginalMainPositionList();return{range:{startIndex:i,endIndex:i},elementPosition:s[i]}}return null}setAreaProperties(t){const e=t.id||this.getActiveAreaId();if(!e)return;const n=this.areaInfoMap.get(e);if(!n)return;n.area||(n.area={});let i=!1;const r=["top","hide"];Object.entries(t.properties).forEach(([s,a])=>{if(wi(a))return;const c=s;n.area[c]=a,r.includes(c)&&(i=!0)}),this.draw.render({isCompute:i,isSetCursor:!1})}setAreaValue(t){const e=t.id||this.getActiveAreaId();if(!e)return;const n=this.areaInfoMap.get(e);if(!n)return;const{positionList:i}=n,r=this.draw.getOriginalMainElementList(),s=t.value;bt([{type:l.ElementType.AREA,value:"",valueList:s,areaId:n.id,area:n.area}],{editorOptions:this.options}),this.draw.spliceElementList(r,i[0].index,i.length,s,{isIgnoreDeletedRule:!0}),this.draw.render({isSetCursor:!1})}}class eg{draw;options;imageCache;mainBadge;areaBadgeMap;constructor(t){this.draw=t,this.options=t.getOptions(),this.imageCache=new Map,this.mainBadge=null,this.areaBadgeMap=new Map}setMainBadge(t){this.mainBadge=t}setAreaBadgeMap(t){this.areaBadgeMap.clear(),t.forEach(e=>{this.areaBadgeMap.set(e.areaId,e.badge)})}_drawImage(t,e,n,i,r,s){if(this.imageCache.has(s)){const a=this.imageCache.get(s);t.drawImage(a,e,n,i,r)}else{const a=new Image;a.setAttribute("crossOrigin","Anonymous"),a.src=s,a.onload=()=>{this.imageCache.set(s,a),t.drawImage(a,e,n,i,r)}}}render(t,e){if(e===0&&this.mainBadge){const{scale:n,badge:i}=this.options,{left:r,top:s,width:a,height:c,value:d}=this.mainBadge,u=this.draw.getMargins()[0]+this.draw.getHeader().getExtraHeight(),R=(r||i.left)*n,h=(s||i.top)*n+u;this._drawImage(t,R,h,a*n,c*n,d)}if(this.areaBadgeMap.size){const n=this.draw.getArea().getAreaInfo();if(n.size){const{scale:i,badge:r}=this.options;for(const s of n){const{positionList:a}=s[1],c=a[0];if(c.pageNo!==e)continue;const d=this.areaBadgeMap.get(s[0]);if(!d)continue;const{left:u,top:R,width:h,height:g,value:f}=d,T=(u||r.left)*i,m=(R||r.top)*i+c.coordinate.leftTop[1];this._drawImage(t,T,m,h*i,g*i,f)}}}}}class ng{draw;options;data;pageContainer;isDrawing=!1;startStroke=null;constructor(t,e){this.draw=t,this.options=t.getOptions(),this.data=e||[],this.pageContainer=t.getPageContainer(),this.register()}register(){this.pageContainer.addEventListener("mousedown",this.start.bind(this)),this.pageContainer.addEventListener("mouseup",this.stop.bind(this)),this.pageContainer.addEventListener("mouseleave",this.stop.bind(this)),this.pageContainer.addEventListener("mousemove",this.drawing.bind(this))}start(t){if(!this.draw.isGraffitiMode())return;this.isDrawing=!0;const{scale:e}=this.options;this.startStroke={lineColor:this.options.graffiti.defaultLineColor,lineWidth:this.options.graffiti.defaultLineWidth,points:[t.offsetX/e,t.offsetY/e]}}stop(){this.isDrawing=!1}drawing(t){if(!this.isDrawing||!this.draw.isGraffitiMode())return;const{offsetX:e,offsetY:n}=t,i=2;if(this.startStroke&&Math.abs(this.startStroke.points[0]-e)<i&&Math.abs(this.startStroke.points[1]-n)<i)return;const r=this.draw.getPageNo();let s=this.data.find(d=>d.pageNo===r);if(this.startStroke&&(s||(s={pageNo:r,strokes:[]},this.data.push(s)),s.strokes.push(this.startStroke),this.startStroke=null),!s?.strokes?.length)return;const{scale:a}=this.options;s.strokes[s.strokes.length-1].points.push(e/a,n/a),this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1})}getValue(){return this.data}compute(){const t=this.draw.getPageRowList().length;for(let e=this.data.length-1;e>=0;e--)this.data[e].pageNo>t-1&&this.data.splice(e,1)}clear(){this.data=[]}render(t,e){const n=this.data.find(a=>a.pageNo===e)?.strokes;if(!n?.length)return;const{graffiti:{defaultLineColor:i,defaultLineWidth:r},scale:s}=this.options;t.save();for(let a=0;a<n.length;a++){const c=n[a];t.beginPath(),t.strokeStyle=c.lineColor||i,t.lineWidth=(c.lineWidth||r)*s,t.moveTo(c.points[0]*s,c.points[1]*s);for(let d=2;d<c.points.length;d+=2)t.lineTo(c.points[d]*s,c.points[d+1]*s);t.stroke()}t.restore()}}const Nr=1024,og=['[aria-modal="true"]','[role="dialog"]','[data-overlay-active="true"]',".ant-modal-root",".ant-modal-wrap",".ant-modal",".ant-drawer",".ant-select-dropdown",".ant-picker-dropdown",".ant-dropdown",".ant-popover",".ant-tooltip",".ant-cascader-dropdown",".ant-mentions-dropdown"].join(", ");function Fr(o,t,e){for(let n=0;n<e.length;n+=Nr){const i=e.slice(n,n+Nr);o.splice(t+n,0,...i)}}class ig{container;pageContainer;pageList;ctxList;pageNo;renderCount;pagePixelRatio;mode;options;position;zone;elementList;listener;eventBus;override;i18n;canvasEvent;globalEvent;cursor;range;margin;background;badge;search;group;area;underline;strikeout;highlight;historyManager;previewer;imageParticle;laTexParticle;textParticle;tableParticle;tableTool;tableOperate;pageNumber;lineNumber;waterMark;placeholder;header;footer;hyperlinkParticle;labelParticle;macroParticle;dateParticle;separatorParticle;pageBreakParticle;superscriptParticle;subscriptParticle;checkboxParticle;radioParticle;menstrualHistoryParticle;fetalHeartPositionParticle;toothPositionParticle;blockParticle;listParticle;lineBreakParticle;whiteSpaceParticle;control;pageBorder;workerManager;scrollObserver;selectionObserver;imageObserver;graffiti;command;interactionPaused;overlayActiveCount;globalShortcutSuspended;LETTER_REG;WORD_LIKE_REG;rowList;pageRowList;painterStyle;painterOptions;visiblePageNoList;intersectionPageNo;lazyRenderIntersectionObserver;printModeData;splitTdValueMap=new Map;tdMap=new Map;constructor(t,e,n,i,r,s){this.container=this._wrapContainer(t),this.pageList=[],this.ctxList=[],this.pageNo=0,this.renderCount=0,this.pagePixelRatio=null,this.mode=e.mode,this.options=e,this.elementList=n.main,this.listener=i,this.eventBus=r,this.override=s,this._formatContainer(),this.pageContainer=this._createPageContainer(),this._createPage(0),this.i18n=new vh(e.locale),this.historyManager=new Aa(this),this.position=new ka(this),this.zone=new _h(this),this.range=new Ja(this),this.margin=new za(this),this.background=new Ba(this),this.badge=new eg(this),this.search=new ja(this),this.group=new Ah(this),this.area=new tg(this),this.underline=new tc(this),this.strikeout=new qa(this),this.highlight=new $a(this),this.previewer=new Dh(this),this.imageParticle=new vi(this),this.laTexParticle=new _i(this),this.textParticle=new ec(this),this.tableParticle=new ic(this),this.tableTool=new sc(this),this.tableOperate=new qh(this),this.pageNumber=new an(this),this.lineNumber=new Bh(this),this.waterMark=new gc(this),this.placeholder=new Xr(this),this.header=new cc(this,n.header),this.footer=new xh(this,n.footer),this.hyperlinkParticle=new rc(this),this.labelParticle=new lc(this),this.macroParticle=new ac(this),this.dateParticle=new Uh(this),this.separatorParticle=new Rc(this),this.pageBreakParticle=new hc(this),this.superscriptParticle=new dc,this.subscriptParticle=new uc,this.checkboxParticle=new Sh(this),this.radioParticle=new Eh(this),this.menstrualHistoryParticle=new Xh(this),this.fetalHeartPositionParticle=new Nh(this),this.toothPositionParticle=new Fh(this),this.blockParticle=new Zh(this),this.listParticle=new Gh(this),this.lineBreakParticle=new Un(this),this.whiteSpaceParticle=new kh(this),this.control=new Ih(this),this.pageBorder=new $h(this),this.graffiti=new ng(this,n.graffiti),this.scrollObserver=new nc(this),this.selectionObserver=new oc(this),this.imageObserver=new Kh,new Jh(this),this.canvasEvent=new xa(this),this.cursor=new da(this,this.canvasEvent),this.canvasEvent.register(),this.globalEvent=new Ga(this,this.canvasEvent),this.globalEvent.register(),this.workerManager=new Yh(this),new jh(this);const{letterClass:a}=e;this.LETTER_REG=new RegExp(`[${a.join("")}]`),this.WORD_LIKE_REG=new RegExp(`${a.map(c=>`[^${c}][${c}]`).join("|")}`),this.rowList=[],this.pageRowList=[],this.painterStyle=null,this.painterOptions=null,this.visiblePageNoList=[],this.intersectionPageNo=0,this.lazyRenderIntersectionObserver=null,this.printModeData=null,this.interactionPaused=!1,this.overlayActiveCount=0,this.globalShortcutSuspended=!1,this.mode===l.EditorMode.PRINT&&this.setPrintData(),this.mode,l.EditorMode.FORM,this.render({isInit:!0,isSetCursor:!1,isFirstRender:!0})}setPrintData(){this.printModeData={header:this.header.getElementList(),main:this.elementList,footer:this.footer.getElementList()};const t=at(this.printModeData);["header","main","footer"].forEach(r=>{t[r]=this.control.filterAssistElement(t[r])});const n=t,i=this.removeStrikeout(n);t.main=i.main.filter(r=>!r.strikeout),this.setEditorData(i)}removeStrikeout(t){if(Array.isArray(t))return t.map(e=>this.removeStrikeout(e)).filter(e=>!(e&&typeof e=="object"&&"strikeout"in e&&e.strikeout===!0));if(t&&typeof t=="object"){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=this.removeStrikeout(t[n]));return e}return t}clearPrintData(){this.printModeData&&(this.setEditorData(this.printModeData),this.printModeData=null)}getLetterReg(){return this.LETTER_REG}getMode(){return this.mode}setMode(t){if(this.mode===t)return;this.macroParticle.clearInlineEditor({isSubmitHistory:!1}),this.mode=t,this.options.mode=t;const e=new Map,n=r=>{r.forEach(s=>{s.controlId&&(s.controlComponent==="value"&&e.set(s.controlId,!0),s.checked&&e.set(s.controlId,!0))})};n(this.elementList),this.elementList.forEach(r=>{r.type==="table"&&r.trList?.forEach(s=>{s.tdList?.forEach(a=>{n(a.value)})})});const i=r=>{r.forEach(s=>{if(!(!s.control&&!s.controlId)&&(s.controlComponent==="value"&&s.strikeout&&(t===l.EditorMode.PRINT?s.hide=!0:s.hide=!1),!!s.control&&!(s.type!=="control"&&s.control.type!=="button"))){if(s.control.type==="TextField"&&(s.controlComponent==="placeholder"||s.controlComponent==="preTextFix"||s.controlComponent==="preTextFixText"||s.controlComponent==="postTextFix"||s.controlComponent==="postTextFixText"||s.controlComponent==="textFixLabel")&&(t===l.EditorMode.EDIT?s.hide=!1:s.hide=!0),s.control.type==="text"&&(s.controlComponent==="placeholder"||s.controlComponent==="prefix"||s.controlComponent==="postfix")&&(t===l.EditorMode.EDIT||t===l.EditorMode.FORM?s.hide=!1:s.hide=!0),s.control.type==="number"||s.control.type==="select"||s.control.type==="date"||s.control.type==="checkbox"||s.control.type==="radio"){if(s.controlComponent==="placeholder"||s.controlComponent==="prefix"||s.controlComponent==="postfix"){const c=e.get(s.controlId);s.control.type==="select"&&t===l.EditorMode.PRINT||t===l.EditorMode.PRINT&&!c?s.hide=!0:s.hide=!1}s.control.type==="number"&&s.controlComponent==="value"&&(t===l.EditorMode.PRINT&&s.strikeout?s.hide=!0:t!==l.EditorMode.PRINT&&s.strikeout&&(s.hide=!1))}s.control.type==="button"&&(s.hide=!1,s.control.hide=!1),s.control.type==="menstrualHistory"&&(s.controlComponent==="prefix"||s.controlComponent==="postfix")&&(t===l.EditorMode.PRINT?s.hide=!0:s.hide=!1)}})};i(this.elementList),this.elementList.forEach(r=>{r.type==="table"&&r.trList.forEach(s=>{s.tdList.forEach(a=>{i(a.value)})})}),t===l.EditorMode.FORM?(this.elementList.filter(r=>r.type==="control").map(r=>{r.control?.type==="button"&&r.control.buttonText&&(r.color="#1677FF",r.highlight="transparent")}),this.hideTextFieldWhitespace(this.elementList,!0),this.updateTextFieldPlaceholderVisibility(this.elementList,!0,!1)):t===l.EditorMode.EDIT?(this.hideTextFieldWhitespace(this.elementList,!1),this.updateTextFieldPlaceholderVisibility(this.elementList,!0,!1)):(this.hideTextFieldWhitespace(this.elementList,!1),this.updateTextFieldPlaceholderVisibility(this.elementList,!1,!0)),t===l.EditorMode.PRINT?(this.elementList.filter(r=>r?.control?.type==="button").map(r=>{(r?.controlComponent==="prefix"||r?.controlComponent==="postfix")&&(r.color="transparent",r.highlight="transparent"),r?.controlComponent==="value"&&!r.control.buttonText&&(r.color="transparent",r.highlight="transparent")}),this.setPrintData()):(this.clearPrintData(),this.elementList.filter(r=>r?.control?.type==="button").map(r=>{(r?.controlComponent==="prefix"||r?.controlComponent==="postfix")&&!r.control.buttonText&&r.type==="control"&&(r.color="transparent",r.highlight="#1677FF"),r?.controlComponent==="value"&&!r.control.buttonText&&(r.color="#fff",r.highlight="#1677FF"),r?.type==="text"&&r.control.buttonText&&(r.color="#000"),r?.type==="control"&&r?.controlComponent==="value"&&r.control.buttonText&&(r.color="#000",r.highlight="transparent")})),this.mode===l.EditorMode.PRINT&&this.clearPrintData(),this.clearSideEffect(),this.control.destroyControl(),this.range.clearRange(),this.render({isSetCursor:!1,isSubmitHistory:!1})}hideTextFieldWhitespace(t,e){const n=r=>r?/^[\s\u00A0\u2000-\u200B\u3000\n\r\t]+$/.test(r):!1;(r=>{for(let s=0;s<r.length;s++){const a=r[s];if(a.type===l.ElementType.TABLE&&a.trList)for(const c of a.trList)for(const d of c.tdList)this.hideTextFieldWhitespace(d.value,e);a.control?.type===l.ControlType.TEXTFIELD&&a.controlComponent===l.ControlComponent.VALUE&&n(a.value)&&(a.hide=e)}})(t)}getSubTemplateRuntimeEndIndex(t,e,n){let i=e+1;for(;i<t.length&&t[i].subTemplateParentId===n;)i++;return i}syncSubTemplateExpandedState(t,e,n,i,r){let s=!1;const a=this.getSubTemplateRuntimeEndIndex(t,e,n.id);if(i&&!n.subTemplateContent?.length&&(i=!1),n.subTemplateExpanded!==i&&(n.subTemplateExpanded=i,s=!0),!!n.hide!==r&&(n.hide=r,s=!0),!i)return a>e+1&&(t.splice(e+1,a-e-1),s=!0),s;if(a===e+1){const c=at(n.subTemplateContent||[]);bt(c,{isHandleFirstElement:!1,editorOptions:this.options});for(let d=0;d<c.length;d++)c[d].subTemplateParentId=n.id;c.length&&(t.splice(e+1,0,...c),s=!0)}return s}applySubTemplateRuntimeState(t,e){const n=i=>{let r=!1,s=0;for(;s<i.length;){const a=i[s];if(a.type===l.ElementType.SUB_TEMPLATE){const c=!!a.subTemplateConditions?.length;if(this.mode===l.EditorMode.EDIT&&c)r=this.syncSubTemplateExpandedState(i,s,a,!0,!0)||r;else if((this.mode===l.EditorMode.FORM||this.mode===l.EditorMode.PRINT)&&c){const d=e?Ch(a.subTemplateConditions,e,a.subTemplateRelation):!1;r=this.syncSubTemplateExpandedState(i,s,a,d,!0)||r}else this.mode!==l.EditorMode.FORM&&this.mode!==l.EditorMode.PRINT&&(r=this.syncSubTemplateExpandedState(i,s,a,!1,!1)||r)}if(a.valueList?.length&&(r=n(a.valueList)||r),a.control?.value?.length&&(r=n(a.control.value)||r),a.type===l.ElementType.TABLE&&a.trList?.length)for(let c=0;c<a.trList.length;c++){const d=a.trList[c];for(let u=0;u<d.tdList.length;u++)r=n(d.tdList[u].value)||r}s++}return r};return n(t)}updateTextFieldPlaceholderVisibility(t,e,n){const i=[l.ControlType.TEXT,l.ControlType.TEXTFIELD,l.ControlType.SELECT,l.ControlType.DATE,l.ControlType.CHECKBOX,l.ControlType.RADIO,l.ControlType.NUMBER];(s=>{let a=0;for(;a<s.length;){const c=s[a];if(c.type===l.ElementType.TABLE&&c.trList)for(const d of c.trList)for(const u of d.tdList)this.updateTextFieldPlaceholderVisibility(u.value,e,n);if(c.control?.type&&i.includes(c.control.type)&&(c.controlComponent===l.ControlComponent.PREFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||c.controlComponent===l.ControlComponent.PRE_TEXT)){const d=c.controlId,u=c.control.type;let R=!1,h=!1,g=!1;const f=[],T=[],m=[];let p=-1,I=a;for(;I<s.length;){const L=s[I];if(L.controlId!==d)break;if((L.controlComponent===l.ControlComponent.PREFIX||L.controlComponent===l.ControlComponent.PRETEXTFIX||L.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)&&T.push(I),L.controlComponent===l.ControlComponent.VALUE&&L.value&&L.value.trim()&&(R=!0),L.controlComponent===l.ControlComponent.VALUE&&(L.type===l.ElementType.MENSTRUAL_HISTORY||L.type===l.ElementType.FETAL_HEART_POSITION||L.type===l.ElementType.TOOTH_POSITION||L.type===l.ElementType.MACRO||L.type===l.ElementType.CUSTOM_MACRO)&&(R=!0),L.controlComponent===l.ControlComponent.VALUE&&L.control&&L.control.type!==u&&(h=!0),L.controlComponent===l.ControlComponent.PLACEHOLDER&&(g=!0,f.push(I)),L.controlComponent===l.ControlComponent.POSTFIX||L.controlComponent===l.ControlComponent.POSTTEXTFIX||L.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){m.push(I),p=I;break}I++}if(!R&&!h)if(g&&f.length>0)for(const L of f)s[L].hide=!e;else e&&c.control?.placeholder&&(p>0?this.control.addPlaceholder(p-1):this.control.addPlaceholder(a));if(n)if(e&&R){for(const L of T)s[L].hide=!0;for(const L of m)s[L].hide=!0}else if(e){for(const L of T)s[L].hide=!1;for(const L of m)s[L].hide=!1}else{for(const L of T)s[L].hide=!0;for(const L of m)s[L].hide=!0}else{for(const L of T)s[L].hide=!1;for(const L of m)s[L].hide=!1}a=I}a++}})(t)}isReadonly(){if(this.area.getActiveAreaInfo()?.area?.mode)return this.area.isReadonly();switch(this.mode){case l.EditorMode.DESIGN:return!1;case l.EditorMode.READONLY:case l.EditorMode.PRINT:case l.EditorMode.GRAFFITI:return!0;case l.EditorMode.FORM:if(this.control.getIsRangeWithinControl()){const t=this.getElementList(),{startIndex:e}=this.range.getRange();if(t[e]?.control?.type===l.ControlType.TEXTFIELD)return!0}return!this.control.getIsRangeWithinControl();default:return!1}}isDisabled(){if(this.mode===l.EditorMode.DESIGN)return!1;const{startIndex:t,endIndex:e}=this.range.getRange(),n=this.getElementList();if(this.getTd()?.disabled)return!0;if(t===e){const r=n[t],s=n[t+1];return!!(r?.title?.disabled&&s?.title?.disabled&&r.titleId===s.titleId||r?.control?.disabled&&s?.control?.disabled&&r.controlId===s.controlId)}return n.slice(t+1,e+1).some(r=>r.title?.disabled||r.control?.disabled)}isDesignMode(){return this.mode===l.EditorMode.DESIGN}isPrintMode(){return this.mode===l.EditorMode.PRINT}isGraffitiMode(){return this.mode===l.EditorMode.GRAFFITI}getOriginalWidth(){const{paperDirection:t,width:e,height:n}=this.options;return t===l.PaperDirection.VERTICAL?e:n}getOriginalHeight(){const{paperDirection:t,width:e,height:n}=this.options;return t===l.PaperDirection.VERTICAL?n:e}getWidth(){return Math.floor(this.getOriginalWidth()*this.options.scale)}getHeight(){return Math.floor(this.getOriginalHeight()*this.options.scale)}getMainHeight(){return this.getHeight()-this.getMainOuterHeight()}getMainOuterHeight(){const t=this.getMargins(),e=this.header.getExtraHeight(),n=this.footer.getExtraHeight();return t[0]+t[2]+e+n}getCanvasWidth(t=-1){return this.getPage(t).width}getCanvasHeight(t=-1){return this.getPage(t).height}getInnerWidth(){const t=this.getWidth(),e=this.getMargins();return t-e[1]-e[3]}getOriginalInnerWidth(){const t=this.getOriginalWidth(),e=this.getOriginalMargins();return t-e[1]-e[3]}getContextInnerWidth(){const t=this.position.getPositionContext();if(t.isTable){const{index:e,trIndex:n,tdIndex:i}=t,s=this.getOriginalElementList()[e],a=s.trList[n].tdList[i],c=this.getTdPadding(s);return a.width-c[1]-c[3]}return this.getOriginalInnerWidth()}getMargins(){return this.getOriginalMargins().map(t=>t*this.options.scale)}getOriginalMargins(){const{margins:t,paperDirection:e}=this.options;return e===l.PaperDirection.VERTICAL?t:[t[1],t[2],t[3],t[0]]}getPageGap(){return this.options.pageGap*this.options.scale}getOriginalPageGap(){return this.options.pageGap}getPageNumberBottom(){const{pageNumber:{bottom:t},scale:e}=this.options;return t*e}getMarginIndicatorSize(){return this.options.marginIndicatorSize*this.options.scale}getDefaultBasicRowMarginHeight(){return this.options.defaultBasicRowMarginHeight*this.options.scale}getHighlightMarginHeight(){return this.options.highlightMarginHeight*this.options.scale}getTdPadding(t){const{table:{tdPadding:e},scale:n}=this.options;return(t?.tdPadding||e).map(r=>r*n)}getContainer(){return this.container}getPageContainer(){return this.pageContainer}getEventTarget(t){return t instanceof Element?t:t instanceof Node?t.parentElement:null}isTargetInsideEditor(t){const e=this.getEventTarget(t);return e?this.container.contains(e)?!0:!!Wi(e,n=>!!n&&n.nodeType===1&&!!n.getAttribute(ue)):!1}isTargetInsideExternalOverlay(t){const e=this.getEventTarget(t);return!e||this.isTargetInsideEditor(e)?!1:!!e.closest(og)}pauseInteraction(){this.interactionPaused=!0,this.cursor?.getAgentDom().blur(),this.globalEvent?.resetSideEffect()}resumeInteraction(){this.interactionPaused=!1}setOverlayActive(t){this.overlayActiveCount=t?1:0,t&&(this.cursor?.getAgentDom().blur(),this.globalEvent?.resetSideEffect())}suspendGlobalShortcut(t){this.globalShortcutSuspended=t}isInteractionSuspended(){return this.interactionPaused||this.overlayActiveCount>0}isGlobalShortcutActive(){return!this.globalShortcutSuspended&&!this.isInteractionSuspended()}getVisiblePageNoList(){return this.visiblePageNoList}setVisiblePageNoList(t){this.visiblePageNoList=t,this.listener.visiblePageNoListChange&&this.listener.visiblePageNoListChange(this.visiblePageNoList),this.eventBus.isSubscribe("visiblePageNoListChange")&&this.eventBus.emit("visiblePageNoListChange",this.visiblePageNoList)}getIntersectionPageNo(){return this.intersectionPageNo}setIntersectionPageNo(t){this.intersectionPageNo=t,this.listener.intersectionPageNoChange&&this.listener.intersectionPageNoChange(this.intersectionPageNo),this.eventBus.isSubscribe("intersectionPageNoChange")&&this.eventBus.emit("intersectionPageNoChange",this.intersectionPageNo)}getPageNo(){return this.pageNo}setPageNo(t){this.pageNo=t}getRenderCount(){return this.renderCount}getPage(t=-1){return this.pageList[~t?t:this.pageNo]}getPageList(){return this.pageList}getPageCount(){return this.pageList.length}getTableRowList(t){const e=this.position.getPositionContext(),{index:n,trIndex:i,tdIndex:r}=e;return t[n].trList[i].tdList[r].rowList}getOriginalRowList(){const t=this.getZone();return t.isHeaderActive()?this.header.getRowList():t.isFooterActive()?this.footer.getRowList():this.rowList}getRowList(){return this.position.getPositionContext().isTable?this.getTableRowList(this.getOriginalElementList()):this.getOriginalRowList()}getPageRowList(){return this.pageRowList}getCtx(){return this.ctxList[this.pageNo]}getOptions(){return this.options}getSearch(){return this.search}getGroup(){return this.group}getArea(){return this.area}getBadge(){return this.badge}getHistoryManager(){return this.historyManager}getPosition(){return this.position}getZone(){return this.zone}getRange(){return this.range}getLineBreakParticle(){return this.lineBreakParticle}getTextParticle(){return this.textParticle}getHeaderElementList(){return this.header.getElementList()}getTableElementList(t){const e=this.position.getPositionContext(),{index:n,trIndex:i,tdIndex:r}=e;return t[n]?.trList?.[i].tdList[r].value||[]}getElementList(){const t=this.position.getPositionContext(),e=this.getOriginalElementList();return t.isTable?this.getTableElementList(e):e}getMainElementList(){return this.position.getPositionContext().isTable?this.getTableElementList(this.elementList):this.elementList}getOriginalElementList(){const t=this.getZone();return t.isHeaderActive()?this.getHeaderElementList():t.isFooterActive()?this.getFooterElementList():this.elementList}getOriginalMainElementList(){return this.elementList}getFooterElementList(){return this.footer.getElementList()}getTd(){const t=this.position.getPositionContext(),{index:e,trIndex:n,tdIndex:i,isTable:r}=t;return r?this.getOriginalElementList()[e].trList[n].tdList[i]:null}getTdByPosition(t){const{index:e,trIndex:n,tdIndex:i,isTable:r}=t;return r?this.getOriginalElementList()[e].trList[n].tdList[i]:null}insertElementTextField(t,e={}){if(!t.length||!this.range.getIsCanInput())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.getElementList(),{isSubmitHistory:s=!0}=e;bt(t,{isHandleFirstElement:!1,editorOptions:this.options});let a=-1,c=this.control.getActiveControl();if(!c&&this.control.getIsRangeWithinControl()&&(this.control.initControl(),c=this.control.getActiveControl()),c&&this.control.getIsRangeWithinControl()){const d=n===i,u=n+1;d||this.newSpliceElementList(r,u,i-n),this.newSpliceElementList(r,u,0,t),a=n+t.length}else{const d=n===i,u=n+1;d||this.newSpliceElementList(r,u,i-n),this.newSpliceElementList(r,u,0,t),a=n+t.length;const R=r[u-1];t[0].listId&&R&&!R.listId&&R?.value===_&&(!R.type||R.type===l.ElementType.TEXTFIELD)&&(r.splice(n,1),a-=1)}this.control.destroyControl(),~a&&(this.range.setRange(a,a),this.render({curIndex:a,isSubmitHistory:s}))}insertElementList(t,e={}){if(!t.length||!this.range.getIsCanInput())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const{isSubmitHistory:r=!0}=e;bt(t,{isHandleFirstElement:!1,editorOptions:this.options});let s=-1,a=this.control.getActiveControl();if(!a&&this.control.getIsRangeWithinControl()&&(this.control.initControl(),a=this.control.getActiveControl()),a&&this.control.getIsRangeWithinControl()){const c=this.getElementList(),d=n===i,u=n+1,R=c[n];if(R?.controlComponent===l.ControlComponent.PRE_TEXT||R?.controlComponent===l.ControlComponent.POST_TEXT||R?.controlComponent===l.ControlComponent.PREFIX||R?.controlComponent===l.ControlComponent.POSTFIX)for(let f=0;f<t.length;f++)t[f].control||(t[f].color=this.options.defaultColor);d&&(c[n]?.control?.type===l.ControlType.TEXTFIELD||c[n]?.control?.type===l.ControlType.TEXT)&&this.control.removePlaceholder(n),d||this.newSpliceElementList(c,u,i-n);const g=c[n]?.controlId||c[n-1]?.controlId||c[n+1]?.controlId;for(let f=0;f<t.length;f++){if(t[f]?.control?.type=="button"&&!t[f]?.control?.buttonText&&(t[f]?.controlComponent==="prefix"||t[f]?.controlComponent==="postfix"?(t[f].color="transparent",t[f].highlight="#1677FF"):(t[f].color="#fff",t[f].highlight="#1677FF")),t[f]?.type===l.ElementType.MENSTRUAL_HISTORY||t[f]?.type===l.ElementType.FETAL_HEART_POSITION||t[f]?.type===l.ElementType.TOOTH_POSITION||t[f]?.type===l.ElementType.MACRO||t[f]?.type===l.ElementType.CUSTOM_MACRO||t[f]?.type===l.ElementType.REUSABLE_ITEM||t[f]?.type===l.ElementType.SUB_TEMPLATE||t[f]?.type===l.ElementType.SPECIAL_SYMBOLS){t[f].controlComponent=l.ControlComponent.VALUE;let T=c[n]?.controlId;T||(T=c[n-1]?.controlId),T||(T=c[n+1]?.controlId),!t[f].controlId&&T&&(t[f].controlId=T)}g&&t[f]?.control&&t[f].controlId&&t[f].controlId!==g&&(t[f].originControlId=g)}this.newSpliceElementList(c,u,0,t),s=n+t.length}else{const c=this.getElementList(),d=n===i,u=n+1;if(c[u]?.control?.type=="TextField"||c[n]?.control?.type=="TextField"){d||this.newSpliceElementList(c,u,i-n);for(let R=0;R<t.length;R++)if(t[R]?.type===l.ElementType.MENSTRUAL_HISTORY||t[R]?.type===l.ElementType.FETAL_HEART_POSITION||t[R]?.type===l.ElementType.TOOTH_POSITION||t[R]?.type===l.ElementType.MACRO||t[R]?.type===l.ElementType.CUSTOM_MACRO||t[R]?.type===l.ElementType.REUSABLE_ITEM||t[R]?.type===l.ElementType.SUB_TEMPLATE||t[R]?.type===l.ElementType.SPECIAL_SYMBOLS){t[R].controlComponent=l.ControlComponent.VALUE;const h=c[n]?.controlId||c[u]?.controlId;!t[R].controlId&&h&&(t[R].controlId=h)}this.newSpliceElementList(c,u,0,t),s=n+t.length}else{d||this.spliceElementList(c,u,i-n);for(let h=0;h<t.length;h++)t[h]?.control?.type=="button"&&!t[h]?.control?.buttonText&&(t[h]?.controlComponent==="prefix"||t[h]?.controlComponent==="postfix"?(t[h].color="transparent",t[h].highlight="#1677FF"):(t[h].color="#fff",t[h].highlight="#1677FF"));this.spliceElementList(c,u,0,t),s=n+t.length;const R=c[u-1];t[0].listId&&R&&!R.listId&&R?.value===_&&(!R.type||R.type===l.ElementType.TEXT)&&(c.splice(n,1),s-=1)}}~s&&(this.range.setRange(s,s),this.render({curIndex:s,isSubmitHistory:r}))}appendElementList(t,e={}){if(!t.length)return;bt(t,{isHandleFirstElement:!1,editorOptions:this.options});let n;const{isPrepend:i,isSubmitHistory:r=!0}=e;i?(this.elementList.splice(1,0,...t),n=t.length):(this.elementList.push(...t),n=this.elementList.length-1),this.range.setRange(n,n),this.render({curIndex:n,isSubmitHistory:r})}spliceElementList(t,e,n,i,r){const{isIgnoreDeletedRule:s=!1}=r||{},{group:a,modeRule:c}=this.options;if(n>0){const d=e+n,R=t[d]?.listId;if(R&&t[e-1]?.listId!==R){let h=d;for(;h<t.length;){const g=t[h];if(g.listId!==R||g.value===_)break;delete g.listId,delete g.listType,delete g.listStyle,h++}}if(!s&&!this.isDesignMode()&&!this.control.getIsRangeWithinControl()){const h=this.getTd()?.deletable;let g=d-1;for(;g>=e;){const f=t[g];(_t(f)||h!==!1&&f?.control?.deletable!==!1&&(!f.controlId||this.mode!==l.EditorMode.FORM||!c[this.mode].controlDeletableDisabled)&&f?.title?.deletable!==!1&&(a.deletable!==!1||!f.groupIds?.length)&&(f?.area?.deletable!==!1||f?.areaIndex!==0))&&t.splice(g,1),g--}}else t.splice(e,n)}if(i?.length){let d=t[e];for(let u=0;u<i.length;u++)!i[u].controlComponent&&d?.controlComponent&&(i[u].controlId=d.controlId,i[u].control=d.control,i[u].controlComponent=d.controlComponent),d=i[u];Fr(t,e,i)}}newSpliceElementList(t,e,n,i,r){const{isIgnoreDeletedRule:s=!1}=r||{},{group:a,modeRule:c}=this.options;if(n>0){const u=e+n,h=t[u]?.listId;if(h&&t[e-1]?.listId!==h){let g=u;for(;g<t.length;){const f=t[g];if(f.listId!==h||f.value===_)break;delete f.listId,delete f.listType,delete f.listStyle,g++}}if(!s&&!this.isDesignMode()&&!this.control.getIsRangeWithinControl()){const g=this.getTd()?.deletable;let f=u-1;for(;f>=e;){const T=t[f];(_t(T)||g!==!1&&T?.control?.deletable!==!1&&(!T.controlId||this.mode!==l.EditorMode.FORM||!c[this.mode].controlDeletableDisabled)&&T?.title?.deletable!==!1&&(a.deletable!==!1||!T.groupIds?.length)&&(T?.area?.deletable!==!1||T?.areaIndex!==0))&&t.splice(f,1),f--}}else t.splice(e,n)}const d=t[e]?.controlId;if(i?.length){for(let u=0;u<i.length;u++)d&&(i[u].originControlId=d);Fr(t,e,i)}}getCanvasEvent(){return this.canvasEvent}getGlobalEvent(){return this.globalEvent}getListener(){return this.listener}getEventBus(){return this.eventBus}getOverride(){return this.override}getCursor(){return this.cursor}getPreviewer(){return this.previewer}getImageParticle(){return this.imageParticle}getTableTool(){return this.tableTool}getTableOperate(){return this.tableOperate}getTableParticle(){return this.tableParticle}getHeader(){return this.header}getFooter(){return this.footer}getHyperlinkParticle(){return this.hyperlinkParticle}getMacroParticle(){return this.macroParticle}getDateParticle(){return this.dateParticle}getListParticle(){return this.listParticle}getCheckboxParticle(){return this.checkboxParticle}getRadioParticle(){return this.radioParticle}getMenstrualHistoryParticle(){return this.menstrualHistoryParticle}getFetalHeartPositionParticle(){return this.fetalHeartPositionParticle}getToothPositionParticle(){return this.toothPositionParticle}getControl(){return this.control}getWorkerManager(){return this.workerManager}getImageObserver(){return this.imageObserver}getI18n(){return this.i18n}getGraffiti(){return this.graffiti}setCommand(t){this.command=t}getCommand(){return this.command}getRowCount(){return this.getRowList().length}async getDataURL(t={}){const{pixelRatio:e,mode:n}=t;e&&this.setPagePixelRatio(e);const i=this.mode,r=!!n&&i!==n;r&&this.setMode(n),this.render({isLazy:!1,isCompute:!1,isSetCursor:!1,isSubmitHistory:!1}),await this.imageObserver.allSettled();const s=this.pageList.map(a=>a.toDataURL());return e&&this.setPagePixelRatio(null),r&&this.setMode(i),s}getPainterStyle(){return this.painterStyle&&Object.keys(this.painterStyle).length?this.painterStyle:null}getPainterOptions(){return this.painterOptions}setPainterStyle(t,e){this.painterStyle=t,this.painterOptions=e||null,this.getPainterStyle()&&this.pageList.forEach(n=>n.style.cursor="copy")}setDefaultRange(){this.elementList.length&&setTimeout(()=>{const t=this.elementList.length-1;this.range.setRange(t,t),this.range.setRangeStyle()})}getIsPagingMode(){return this.options.pageMode===l.PageMode.PAGING}setPageMode(t){if(!t||this.options.pageMode===t)return;if(this.options.pageMode=t,t===l.PageMode.PAGING){const{height:i}=this.options,r=this.getPagePixelRatio(),s=this.pageList[0];s.style.height=`${i}px`,s.height=i*r,this._initPageContext(this.ctxList[0])}else this._disconnectLazyRender(),this.header.recovery(),this.footer.recovery(),this.zone.setZone(l.EditorZone.MAIN);const{startIndex:e}=this.range.getRange(),n=this.range.getIsCollapsed();this.render({isSetCursor:!0,curIndex:e,isSubmitHistory:!1}),n||this.cursor.drawCursor({isShow:!1}),setTimeout(()=>{this.listener.pageModeChange&&this.listener.pageModeChange(t),this.eventBus.isSubscribe("pageModeChange")&&this.eventBus.emit("pageModeChange",t)})}setPageScale(t){const e=this.getPagePixelRatio();this.options.scale=t;const n=this.getWidth(),i=this.getHeight();this.container.style.width=`${n}px`,this.pageList.forEach((s,a)=>{s.width=n*e,s.height=i*e,s.style.width=`${n}px`,s.style.height=`${i}px`,s.style.marginBottom=`${this.getPageGap()}px`,this._initPageContext(this.ctxList[a])});const r=this.position.getCursorPosition();this.render({isSubmitHistory:!1,isSetCursor:!!r,curIndex:r?.index}),this.listener.pageScaleChange&&this.listener.pageScaleChange(t),this.eventBus.isSubscribe("pageScaleChange")&&this.eventBus.emit("pageScaleChange",t)}getPagePixelRatio(){return this.pagePixelRatio||window.devicePixelRatio}setPagePixelRatio(t){!this.pagePixelRatio&&t===window.devicePixelRatio||t===this.pagePixelRatio||(this.pagePixelRatio=t,this.setPageDevicePixel())}setPageDevicePixel(){const t=this.getPagePixelRatio(),e=this.getWidth(),n=this.getHeight();this.pageList.forEach((i,r)=>{i.width=e*t,i.height=n*t,this._initPageContext(this.ctxList[r])}),this.render({isSubmitHistory:!1,isSetCursor:!1})}setPaperSize(t,e){this.options.width=t,this.options.height=e;const n=this.getPagePixelRatio(),i=this.getWidth(),r=this.getHeight();this.container.style.width=`${i}px`,this.pageList.forEach((s,a)=>{s.width=i*n,s.height=r*n,s.style.width=`${i}px`,s.style.height=`${r}px`,this._initPageContext(this.ctxList[a])}),this.render({isSubmitHistory:!1,isSetCursor:!1})}setPaperDirection(t){const e=this.getPagePixelRatio();this.options.paperDirection=t;const n=this.getWidth(),i=this.getHeight();this.container.style.width=`${n}px`,this.pageList.forEach((r,s)=>{r.width=n*e,r.height=i*e,r.style.width=`${n}px`,r.style.height=`${i}px`,this._initPageContext(this.ctxList[s])}),this.render({isSubmitHistory:!1,isSetCursor:!1})}setPaperMargin(t){this.options.margins=t,this.render({isSubmitHistory:!1,isSetCursor:!1})}getOriginValue(t={}){const{pageNo:e}=t;let n=this.elementList;return Number.isInteger(e)&&e>=0&&e<this.pageRowList.length&&(n=this.pageRowList[e].flatMap(r=>r.elementList)),{header:this.getHeaderElementList(),main:n,footer:this.getFooterElementList(),graffiti:this.graffiti.getValue()}}getValue(t={}){const e=this.getOriginValue(t);console.log(this.elementList,"所有元素");const{extraPickAttrs:n}=t,i={header:Mt(e.header,{extraPickAttrs:n,editorOptions:this.options}),main:Mt(e.main,{extraPickAttrs:n,isClassifyArea:!0,editorOptions:this.options}),footer:Mt(e.footer,{extraPickAttrs:n,editorOptions:this.options}),graffiti:e.graffiti};return{version:ve,data:i,options:at(this.options)}}setValue(t,e){const{header:n,main:i,footer:r}=at(t);if(!n&&!i&&!r)return;const{isSetCursor:s=!1}=e||{};[n,i,r].forEach(d=>{d&&bt(d,{editorOptions:this.options,isForceCompensation:!0})}),this.setEditorData({header:n,main:i,footer:r}),this.historyManager.recovery();const c=s?i?.length?i.length-1:0:void 0;c!==void 0&&this.range.setRange(c,c),this.render({curIndex:c,isSetCursor:s,isFirstRender:!0})}setEditorData(t){const{header:e,main:n,footer:i}=t;e&&this.header.setElementList(e),n&&(this.elementList=n),i&&this.footer.setElementList(i)}_wrapContainer(t){const e=document.createElement("div");return t.append(e),e}_formatContainer(){this.container.style.position="relative",this.container.style.width=`${this.getWidth()}px`,this.container.setAttribute(ue,l.EditorComponent.MAIN)}_createPageContainer(){const t=document.createElement("div");return t.classList.add(`${z}-page-container`),this.container.append(t),t}_createPage(t){const e=this.getWidth(),n=this.getHeight(),i=document.createElement("canvas");i.style.width=`${e}px`,i.style.height=`${n}px`,i.style.display="block",i.style.backgroundColor="#ffffff",i.style.marginBottom=`${this.getPageGap()}px`,i.setAttribute("data-index",String(t)),this.pageContainer.append(i);const r=this.getPagePixelRatio();i.width=e*r,i.height=n*r,i.style.cursor="text";const s=i.getContext("2d");this._initPageContext(s),this.pageList.push(i),this.ctxList.push(s)}_initPageContext(t){const e=this.getPagePixelRatio();t.scale(e,e),t.letterSpacing="0px",t.wordSpacing="0px",t.direction="ltr"}getElementFont(t,e=1){const{defaultSize:n,defaultFont:i}=this.options,r=t.font||i,s=t.actualSize||t.size||n;return`${t.italic?"italic ":""}${t.bold?"bold ":""}${s*e}px ${r}`}getElementSize(t){return t.actualSize||t.size||this.options.defaultSize}getElementRowMargin(t){const{defaultSize:e,defaultBasicRowMarginHeight:n,defaultRowMargin:i,scale:r}=this.options,s=t.size||e;let a=1;return s<12?a=s/12:s>30&&(a=1+(s-30)/30),n*a*(t.rowMargin??i)*r}computeRowList(t){const{innerWidth:e,elementList:n,isPagingMode:i=!1,isFromTable:r=!1,startX:s=0,startY:a=0,pageHeight:c=0,mainOuterHeight:d=0,surroundElementList:u=[]}=t,{defaultSize:R,scale:h,imgCaption:g,table:{tdPadding:f,defaultTrMinHeight:T},defaultTabWidth:m}=this.options,p=this.getDefaultBasicRowMarginHeight(),L=document.createElement("canvas").getContext("2d"),P=this.listParticle.computeListStyle(L,n),C=[],S=this._collectTextControlValueSet(n);n.length&&C.push({width:0,height:0,ascent:0,elementList:[],startIndex:0,rowIndex:0,rowFlex:n?.[0]?.rowFlex||n?.[1]?.rowFlex});let F=s,N=a,V=0,Y,E=0,W=0;for(let X=0;X<n.length;X++){const O=C[C.length-1],M=n[X];this.clearElementEffect(M);const b=this.getElementRowMargin(M),y={width:0,height:0,boundingBoxAscent:0,boundingBoxDescent:0},D=O.offsetX||M.listId&&P.get(M.listId)||0,U=e-D,Q=O.elementList.length===1;if(F+=Q?D:0,N+=Q&&O.offsetY||0,(M.control?.type===l.ControlType.TEXTFIELD||M.control?.type===l.ControlType.TEXT)&&!this.isDesignMode()&&(M.controlComponent===l.ControlComponent.PRETEXTFIX||M.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||M.controlComponent===l.ControlComponent.POSTTEXTFIX||M.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||M.controlComponent===l.ControlComponent.TEXTFIXLABEL||M.controlComponent===l.ControlComponent.PLACEHOLDER||M.controlComponent===l.ControlComponent.PREFIX||M.controlComponent===l.ControlComponent.POSTFIX)){const K=M.control?.type===l.ControlType.TEXTFIELD,v=M.controlId,w=!!v&&!!S?.has(v);K?this.mode===l.EditorMode.EDIT?M.hide=!1:M.hide=!0:this.mode===l.EditorMode.EDIT?M.hide=!1:this.mode===l.EditorMode.FORM?M.controlComponent===l.ControlComponent.PLACEHOLDER||M.controlComponent===l.ControlComponent.TEXTFIXLABEL?M.hide=w:M.hide=!1:M.hide=!0}if(_t(M)&&!this.isDesignMode()){const K=O.elementList[O.elementList.length-1];y.height=K?.metrics.height||this.options.defaultSize*h,y.boundingBoxAscent=K?.metrics.boundingBoxAscent||0,y.boundingBoxDescent=K?.metrics.boundingBoxDescent||0}else if(M.type===l.ElementType.IMAGE||M.type===l.ElementType.LATEX)if(M.imgDisplay===l.ImageDisplay.SURROUND||M.imgDisplay===l.ImageDisplay.FLOAT_TOP||M.imgDisplay===l.ImageDisplay.FLOAT_BOTTOM)y.width=0,y.height=0,y.boundingBoxDescent=0;else{const K=M.width*h,v=M.height*h;if(K>U){const w=v*U/K;M.width=U/h,M.height=w/h,y.width=U,y.height=w,y.boundingBoxDescent=w}else y.width=K,y.height=v,y.boundingBoxDescent=v;if(M.imgCaption?.value){const w=M.imgCaption.size||g.size,Z=M.imgCaption.top??g.top,J=(w+Z)*h;y.boundingBoxAscent+=J}}else if(M.type===l.ElementType.TABLE){const K=M.tdPadding||f;if(M.pagingId){let x=X+1,A=0;for(;x<n.length;){const $=n[x];if($.pagingId===M.pagingId){const B=$.trList.filter(pt=>!pt.pagingRepeat).filter(pt=>(pt.tdList=pt.tdList.filter(Xt=>{if(Xt.originalId){for(let Lt=0;Lt<M.trList.length;Lt++){const yt=M.trList[Lt],Yt=yt.tdList.find(({id:St})=>St===Xt.originalId);if(Yt){Xt.value[0]?.type===l.ElementType.SPLIT_TAG&&Xt.value.splice(0,1),Yt.value.push(...Xt.value.map(St=>this.updateElementTableInfo(St,M,yt,Yt))),Yt.rowspan=Yt.originalRowspan??Yt.rowspan;break}}return!1}return!0}),!pt.originalId));M.trList.push(...B),M.height+=$.height,x++,A++}else break}A&&n.splice(X+1,A)}M.pagingIndex=M.pagingIndex??0,this.tableParticle.computeTrHeight(M,x=>this.computeRowList({innerWidth:(x.width-(K[1]+K[3]))*h,elementList:x.value,isFromTable:!0,isPagingMode:i})),M.trList?.forEach(x=>{x.tdList.forEach(A=>{this.tdMap.set(A.id,A)})});const v=this.tableParticle.getTableHeight(M),w=this.tableParticle.getTableWidth(M);M.width=w,M.height=v;const Z=w*h,J=v*h;if(y.width=Z,y.height=J,y.boundingBoxDescent=J,y.boundingBoxAscent=-b,n[X+1]?.type===l.ElementType.TABLE&&(y.boundingBoxAscent-=b),i){const x=this.getHeight(),A=this.getMainOuterHeight();let $=A;for(let Lt=0;Lt<C.length;Lt++){const yt=C[Lt],Yt=yt.offsetY||0;yt.height+$+Yt>x||C[Lt-1]?.isPageBreak?$=A+yt.height+Yt:$+=yt.height+Yt}const B=b*2,pt=M.trList[0].height*h;($+pt+B>x||M.pagingIndex!==0&&M.trList[0].pagingRepeat||n[X-1]?.type===l.ElementType.PAGE_BREAK)&&($=A);let Xt=x-($+B);if(J>Xt){const Lt=M.trList;let yt=0,Yt=0,St=0;for(let Tt=0;Tt<Lt.length;Tt++){const Pt=Lt[Tt],Kt=Pt.height*h;if($+B+St+Kt>x){const Qt=Pt;let Ve=0;const qt={...at(Qt),id:lt(),originalId:Qt.originalId??Qt.id,minHeight:void 0,tdList:M.colgroup.map((mt,ie)=>{if(Ve--,Ve>0)return;const Ht=Qt.tdList.find(Ye=>Ye.colIndex===ie),Bt=Ht??this.tableParticle.findPreRowSpanTd(Lt,Tt,ie);Ht&&(Ve=Ht.colspan);const $e=lt();return Bt.originalRowspan=Bt.rowspan,Ht?{...Ht,id:$e,originalId:Ht.originalId??Ht.id,linkTdPrevId:Ht.id,tdIndex:ie,original:Bt}:{id:$e,originalId:Bt.originalId??Bt.id,linkTdPrevId:Bt.id,tdIndex:ie,colIndex:ie,colspan:1,rowspan:1,value:[],rowList:[],original:Bt}}).filter(mt=>!!mt)},de=qt.tdList,xt=de.map(mt=>mt.original);xt.forEach((mt,ie)=>{const Ht=[];let Bt=Xt;if(mt.rowspan>1){const Ye=Lt.slice(mt.trIndex,mt.trIndex+Tt-mt.trIndex);Bt+=Ye.reduce((Pf,Mf)=>Mf.height*h+Pf,0)}for(;mt.mainHeight*h>Bt&&mt.rowList?.length;){const Ye=mt.rowList.pop();mt.value.splice(mt.value.length-Ye.elementList.length),Ht.unshift(Ye),mt.mainHeight-=Ye.height}const $e=de[ie];$e.rowList=Ht,$e.value=Ht.map(Ye=>Ye.elementList).flat()});let Me=!0;const Xi=Qt.tdList.some(mt=>mt.rowList?.length),Dr=qt.tdList.some(mt=>mt.rowList?.length),Ni=Qt.minHeight>Xt;if(Dr||Ni){(Xi||!Dr&&Ni)&&(Ni&&(Qt.originalMinHeight=Qt.minHeight,Qt.minHeight=Xt,qt.minHeight=Math.max(Qt.originalMinHeight-Xt,T)),qt.tdList.forEach(mt=>{mt.original.linkTdNextId=mt.id,mt.value.length&&mt.value[0].value!==_&&mt.value.unshift({...mt.original.value.slice(-1).pop(),value:_,type:l.ElementType.SPLIT_TAG})}),Lt.splice(yt+1,0,qt),yt+=1,Yt=Lt.length-yt,Me=!1),xt.forEach(mt=>{if(mt.rowspan>1){const ie=mt.rowspan-(Tt-mt.trIndex);mt.rowspan=Tt-mt.trIndex+(Xi?1:0);const Ht=qt.tdList.find(Bt=>Bt.colIndex===mt.colIndex);Xi?Ht.rowspan=ie:(Ht.original.linkTdNextId=Ht.id,Qt.tdList.push({...mt,...Ht,rowspan:ie}),Qt.tdList.sort((Bt,$e)=>Bt.colIndex-$e.colIndex),Ht.value=[])}}),Me&&xt.forEach((mt,ie)=>{mt.value.push(...de[ie].value)});break}}yt=Tt+1,Yt=Lt.length-yt,St+=Kt,Xt-=Kt}if(Yt){const Tt=Lt.splice(yt,Yt),Pt=M.pagingId||lt();M.pagingId=Pt;const Kt=at(M);Kt.originalId=M.originalId??M.id,Kt.pagingId=Pt,Kt.pagingIndex=M.pagingIndex+1;const Qt=Lt.filter(de=>de.pagingRepeat);if(Qt.length){const de=at(Qt);de.forEach(xt=>xt.id=lt()),Tt.unshift(...de)}Kt.trList=Tt,Kt.id=lt(),Kt.trList?.forEach(de=>{de.tdList.forEach(xt=>{if(delete xt.valueStartIndex,xt.linkTdPrevId){const Me=this.getTdById(xt.linkTdPrevId);xt.valueStartIndex=Me?(Me.valueStartIndex??0)+Me.value.length:0,this.splitTdValueMap.has(xt.originalId)?this.splitTdValueMap.get(xt.originalId).push(...xt.value):Me&&this.splitTdValueMap.set(xt.originalId,[...Me.value,...xt.value])}xt.value.forEach(Me=>this.updateElementTableInfo(Me,Kt,de,xt))})}),this.spliceElementList(n,X+1,0,[Kt]),this.tableParticle.computeTrHeight(M);const Ve=this.tableParticle.getTableHeight(M),qt=Ve*h;M.height=Ve,y.height=qt,y.boundingBoxDescent=qt}}if(M.pagingId){const Lt=this.position.getPositionContext();if(Lt.isTable){let yt=-1,Yt=-1,St=X;for(;St<n.length;){const Tt=n[St];if(Tt.pagingId!==M.pagingId)break;const Pt=Tt.trList.findIndex(Kt=>Kt.id===Lt.trId);if(~Pt){yt=St,Yt=Pt;break}St++}~yt&&(Lt.index=yt,Lt.trIndex=Yt,this.position.setPositionContext(Lt))}}}this.initTableElementIndex(M,X)}else if(M.type===l.ElementType.SEPARATOR){const{separator:{lineWidth:K}}=this.options,v=M.lineWidth||K;M.width=U/h,y.width=U,y.height=v*h,y.boundingBoxAscent=-b,y.boundingBoxDescent=-b+y.height}else if(M.type===l.ElementType.PAGE_BREAK)M.width=U/h,y.width=U,y.height=R;else if(M.type===l.ElementType.RADIO||M.controlComponent===l.ControlComponent.RADIO){const{width:K,height:v,gap:w}=this.options.radio,Z=K+w*2;M.width=Z,y.width=Z*h,y.height=v*h}else if(M.type===l.ElementType.CHECKBOX||M.controlComponent===l.ControlComponent.CHECKBOX){const{width:K,height:v,gap:w}=this.options.checkbox,Z=K+w*2;M.width=Z,y.width=Z*h,y.height=v*h}else if(M.type===l.ElementType.MENSTRUAL_HISTORY){const K=this.menstrualHistoryParticle.computeSize(M);M.width=K.width/h,y.width=K.width,y.height=K.height,y.boundingBoxAscent=K.height,y.boundingBoxDescent=0}else if(M.type===l.ElementType.FETAL_HEART_POSITION){const K=this.fetalHeartPositionParticle.computeSize();M.width=K.width/h,y.width=K.width,y.height=K.height,y.boundingBoxAscent=K.height/2,y.boundingBoxDescent=K.height/2}else if(M.type===l.ElementType.TOOTH_POSITION){const K=this.toothPositionParticle.computeSize(M);M.width=K.width/h,y.width=K.width,y.height=K.height,y.boundingBoxAscent=K.height/2,y.boundingBoxDescent=K.height/2}else if(M.type===l.ElementType.TAB)y.width=m*h,y.height=R*h,y.boundingBoxDescent=0,y.boundingBoxAscent=this.textParticle.getBasisWordBoundingBoxAscent(L,L.font);else if(M.type===l.ElementType.BLOCK){if(!M.width)y.width=U;else{const K=M.width*h;y.width=Math.min(K,U)}y.height=M.height*h,y.boundingBoxDescent=y.height,y.boundingBoxAscent=0}else if(M.type===l.ElementType.LABEL){const{defaultSize:K,label:{defaultPadding:v}}=this.options;L.font=this.getElementFont(M);const w=this.textParticle.measureText(L,M);y.width=(w.width+v[1]+v[3])*h,y.height=(M.size||K)*h,y.boundingBoxDescent=0,y.boundingBoxAscent=(v[0]+w.actualBoundingBoxAscent)*h}else if(M.type===l.ElementType.MACRO||M.type===l.ElementType.CUSTOM_MACRO||M.type===l.ElementType.REUSABLE_ITEM||M.type===l.ElementType.SUB_TEMPLATE){const{defaultSize:K}=this.options;L.font=this.getElementFont(M);const v=this.getMode(),w=v===l.EditorMode.EDIT,Z=v===l.EditorMode.FORM;if(w){const J=M.label||M.value||"";L.font=this.getElementFont(M);const x=L.measureText(J),A=8*h,$=4*h;y.width=x.width+A*2;const B=x.actualBoundingBoxAscent+x.actualBoundingBoxDescent;y.height=B+$*2;const pt=this.textParticle.measureBasisWord(L,this.getElementFont(M));y.boundingBoxAscent=pt.actualBoundingBoxAscent*h,y.boundingBoxDescent=pt.actualBoundingBoxDescent*h}else if(M.type===l.ElementType.CUSTOM_MACRO){const J=M.macroConfig,x=J?.value||"";if(Z){const A=J?.type||"text",$=this.textParticle.measureText(L,M),B=M.label||"";if(A==="select"){const pt=x||`请选择${B}`,Xt=L.measureText(pt),Lt=L.measureText("[").width,yt=6*h+2*h;y.width=Lt+Xt.width+yt+Lt}else{const pt=x||`请输入${B}`,Xt=L.measureText(pt),Lt=L.measureText("[").width;y.width=Lt+Xt.width+Lt}y.height=(M.size||K)*h,y.boundingBoxDescent=$.actualBoundingBoxDescent*h,y.boundingBoxAscent=$.actualBoundingBoxAscent*h}else{const A=M.label||"",$=x||`请输入${A}`,B=L.measureText($);y.width=B.width,y.height=(M.size||K)*h,y.boundingBoxDescent=B.actualBoundingBoxDescent,y.boundingBoxAscent=B.actualBoundingBoxAscent}}else if(M.type===l.ElementType.REUSABLE_ITEM){const x=M.reusableItemConfig?.value||"",A=M.label||"";if(Z){const $=this.textParticle.measureText(L,M),B=x||`获取 ${A}`,pt=L.measureText(B),Xt=L.measureText("[").width;y.width=Xt+pt.width+Xt,y.height=(M.size||K)*h,y.boundingBoxDescent=$.actualBoundingBoxDescent*h,y.boundingBoxAscent=$.actualBoundingBoxAscent*h}else{const $=x||`获取 ${A}`,B=L.measureText($);y.width=B.width,y.height=(M.size||K)*h,y.boundingBoxDescent=B.actualBoundingBoxDescent,y.boundingBoxAscent=B.actualBoundingBoxAscent}}else if(M.type===l.ElementType.SUB_TEMPLATE){const J=M.label||"子模板";if(Z){const x=L.measureText(J),A=8*h,$=4*h,B=x.actualBoundingBoxAscent+x.actualBoundingBoxDescent;y.width=x.width+A*2,y.height=B+$*2;const pt=this.textParticle.measureBasisWord(L,this.getElementFont(M));y.boundingBoxAscent=pt.actualBoundingBoxAscent*h,y.boundingBoxDescent=pt.actualBoundingBoxDescent*h}else{const x=L.measureText(J);y.width=x.width,y.height=(M.size||K)*h,y.boundingBoxDescent=x.actualBoundingBoxDescent,y.boundingBoxAscent=x.actualBoundingBoxAscent}}else{const J=M.label||"",x=M.value||`获取 ${J}`,A=L.measureText(x);y.width=A.width,y.height=(M.size||K)*h,y.boundingBoxDescent=A.actualBoundingBoxDescent,y.boundingBoxAscent=A.actualBoundingBoxAscent}}else{const K=M.size||R;(M.type===l.ElementType.SUPERSCRIPT||M.type===l.ElementType.SUBSCRIPT)&&(M.actualSize=Math.ceil(K*.6)),y.height=(M.actualSize||K)*h,L.font=this.getElementFont(M);const v=this.textParticle.measureText(L,M);y.width=v.width*h,M.letterSpacing&&(y.width+=M.letterSpacing*h);const w=this.textParticle.measureBasisWord(L,M.font);y.boundingBoxAscent=w.actualBoundingBoxAscent*h,y.boundingBoxDescent=w.actualBoundingBoxDescent*h,M.type===l.ElementType.SUPERSCRIPT?y.boundingBoxAscent+=y.height/2:M.type===l.ElementType.SUBSCRIPT&&(y.boundingBoxDescent+=y.height/2)}const G=!_t(M)&&(M.imgDisplay!==l.ImageDisplay.INLINE&&M.type===l.ElementType.IMAGE||M.type===l.ElementType.LATEX)?y.height+b:y.boundingBoxAscent+b,H=b+y.boundingBoxAscent+y.boundingBoxDescent+b,tt=Object.assign(M,{metrics:y,left:0,style:this.getElementFont(M,h)});tt.control?.minWidth&&(tt.controlComponent&&(W+=y.width),tt.controlComponent===l.ControlComponent.POSTFIX&&(this.control.setMinWidthControlInfo({row:O,rowElement:tt,availableWidth:U,controlRealWidth:W}),W=0));const st=n[X-1];let et=n[X+1],nt=O.width+y.width;if(this.options.wordBreak===l.WordBreak.BREAK_WORD&&(!st?.type||st?.type===l.ElementType.TEXT)&&(!M.type||M.type===l.ElementType.TEXT)){const K=`${st?.value||""}${M.value}`;if(this.WORD_LIKE_REG.test(K)){const{width:w,endElement:Z}=this.textParticle.measureWord(L,n,X),J=w*h;Z&&J<=U?(nt+=J,et=Z):st&&(nt+=J)}const v=this.textParticle.measurePunctuationWidth(L,et);nt+=v*h}M.listId&&(M.listId!==Y?E=0:M.value===_&&!M.listWrap&&E++),Y=M.listId;const q=this.position.setSurroundPosition({pageNo:V,rowElement:tt,row:O,rowElementRect:{x:F,y:N,height:H,width:y.width},availableWidth:U,surroundElementList:u});F=q.x,nt+=q.rowIncreaseWidth,F+=y.width;let dt=!1;if(this.mode===l.EditorMode.FORM&&M.control?.type===l.ControlType.BUTTON&&M.controlComponent===l.ControlComponent.PREFIX&&O.elementList.filter(K=>K.controlId!==M.controlId).length>0){const K=M.controlId;if(n.some(w=>w.controlId===`${K}_text`&&w.control?.type===l.ControlType.BUTTON)){let w=0;for(let Z=X;Z<n.length;Z++){const J=n[Z];if(J.controlId!==K)break;L.font=this.getElementFont(J);const x=this.textParticle.measureText(L,J);if(w+=x.width*h,J.controlComponent===l.ControlComponent.POSTFIX)break}for(let Z=0;Z<n.length;Z++){const J=n[Z];if(J.controlId===`${K}_text`){L.font=this.getElementFont(J);const x=this.textParticle.measureText(L,J);w+=x.width*h}}dt=O.width+w>U}}const ot=M.type===l.ElementType.SEPARATOR||M.type===l.ElementType.TABLE||st?.type===l.ElementType.TABLE||st?.type===l.ElementType.BLOCK||M.type===l.ElementType.BLOCK||st?.imgDisplay===l.ImageDisplay.INLINE||M.imgDisplay===l.ImageDisplay.INLINE||st?.listId!==M.listId||st?.areaId!==M.areaId&&!M.area?.hide||M.control?.flexDirection===l.FlexDirection.COLUMN&&(M.controlComponent===l.ControlComponent.CHECKBOX||M.controlComponent===l.ControlComponent.RADIO)&&st?.controlComponent===l.ControlComponent.VALUE||X!==0&&M.value===_&&!M.area?.hide||dt,ut=nt>U,ht=ot||ut;if(ht){const K={width:y.width,height:H,startIndex:X,elementList:[tt],ascent:G,rowIndex:O.rowIndex+1,rowFlex:n[X]?.rowFlex||n[X+1]?.rowFlex,isPageBreak:M.type===l.ElementType.PAGE_BREAK};if(tt.controlComponent!==l.ControlComponent.PREFIX&&tt.control?.indentation===l.ControlIndentation.VALUE_START){const v=O.elementList.findIndex(w=>w.controlId===tt.controlId&&w.controlComponent!==l.ControlComponent.PREFIX);if(~v){const Z=this.position.computeRowPosition({row:O,innerWidth:this.getInnerWidth()})[v];Z&&(K.offsetX=Z.coordinate.leftTop[0])}}M.listId&&(K.isList=!0,K.offsetX=P.get(M.listId),K.listIndex=E),K.offsetY=!r&&M.area?.top&&M.areaId!==n[X-1]?.areaId?M.area.top*h:0,C.push(K)}else O.width+=y.width,X===0&&(on(n[1])||n[1]?.areaId)?(O.height=p,O.ascent=p):O.height<H&&(O.height=H,O.ascent=G),O.elementList.push(tt);if((ht||X===n.length-1)&&(O.isWidthNotEnough=ut&&!ot,!O.isSurround&&(st?.rowFlex===l.RowFlex.JUSTIFY||st?.rowFlex===l.RowFlex.ALIGNMENT&&O.isWidthNotEnough))){const K=O.elementList[0]?.value===_?O.elementList.slice(1):O.elementList,v=(U-O.width)/(K.length-1);for(let w=0;w<K.length-1;w++){const Z=K[w];Z.metrics.width+=v}O.width=U}if(ht){F=s,N+=O.height,i&&!r&&c&&(N-a+d+H>c||M.type===l.ElementType.PAGE_BREAK)&&(N=a,ea(u,V),V+=1),tt.left=0;const K=C[C.length-1];F=this.position.setSurroundPosition({pageNo:V,rowElement:tt,row:K,rowElementRect:{x:F,y:N,height:H,width:y.width},availableWidth:U,surroundElementList:u}).x,F+=y.width}}return C}_collectTextControlValueSet(t){if(this.isDesignMode()||this.mode===l.EditorMode.EDIT)return null;const e=new Set;for(let i=0;i<t.length;i++){const r=t[i];r.controlId&&(r.control?.type===l.ControlType.TEXT||r.control?.type===l.ControlType.TEXTFIELD)&&e.add(r.controlId)}const n=new Set;for(let i=0;i<t.length;i++){const r=t[i];r.controlId&&r.controlComponent===l.ControlComponent.VALUE&&e.has(r.controlId)&&n.add(r.controlId)}return n}_computePageList(){const t=[[]],{pageMode:e,pageNumber:{maxPageNo:n}}=this.options,i=this.getHeight(),r=this.getMainOuterHeight();let s=r,a=0;if(e===l.PageMode.CONTINUITY){t[0]=this.rowList,s+=this.rowList.reduce((R,h)=>R+h.height+(h.offsetY||0),0);const c=this.getPagePixelRatio(),d=this.pageList[0],u=Number(d.style.height.replace("px",""));if(s>u)d.style.height=`${s}px`,d.height=s*c;else{const R=s<i?i:s;d.style.height=`${R}px`,d.height=R*c}this._initPageContext(this.ctxList[0])}else for(let c=0;c<this.rowList.length;c++){const d=this.rowList[c],u=d.offsetY||0;if(d.height+u+s>i||this.rowList[c-1]?.isPageBreak){if(Number.isInteger(n)&&a>=n){this.elementList=this.elementList.slice(0,d.startIndex);break}s=r+d.height+u,t.push([d]),a++}else s+=d.height+u,t[a].push(d)}return t}_drawHighlight(t,e){const{rowList:n,positionList:i,elementList:r}=e,s=this.getDefaultBasicRowMarginHeight(),a=this.getHighlightMarginHeight();for(let c=0;c<n.length;c++){const d=n[c];for(let u=0;u<d.elementList.length;u++){const R=d.elementList[u],h=d.elementList[u-1],g=R.highlight||this.control.getControlHighlight(r,d.startIndex+u);if(g){h&&h.highlight&&h.highlight!==R.highlight&&this.highlight.render(t);const{coordinate:{leftTop:[f,T]}}=i[d.startIndex+u],m=R.left||0;this.highlight.recordFillInfo(t,f-m,T+s-a,R.metrics.width+m,d.height-2*s+2*a,g)}else h?.highlight&&this.highlight.render(t)}this.highlight.render(t)}}validateNumber(t){return/^\d+$/.test(t)}drawRow(t,e){this._drawHighlight(t,e);const{scale:n,table:{tdPadding:i},group:r,lineBreak:s,whiteSpace:a}=this.options,{rowList:c,pageNo:d,elementList:u,positionList:R,startIndex:h,zone:g,isDrawLineBreak:f=!s.disabled,td:T,isDrawWhiteSpace:m=!a.disabled}=e,p=this.isPrintMode(),I=this.isGraffitiMode(),{isCrossRowCol:L,tableId:P}=this.range.getRange();let C=h;for(let S=0;S<c.length;S++){const F=c[S],N={x:0,y:0,width:0,height:0};let V=null;for(let Y=0;Y<F.elementList.length;Y++){const E=F.elementList[Y],W=E.metrics,{ascent:X,coordinate:{leftTop:[O,M]}}=R[F.startIndex+Y],b=F.elementList[Y-1];if(_t(E)&&!this.isDesignMode())this.textParticle.complete();else if(E.type===l.ElementType.IMAGE)this.textParticle.complete(),E.imgDisplay!==l.ImageDisplay.SURROUND&&E.imgDisplay!==l.ImageDisplay.FLOAT_TOP&&E.imgDisplay!==l.ImageDisplay.FLOAT_BOTTOM&&this.imageParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.LATEX)this.textParticle.complete(),this.laTexParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.TABLE)L&&(N.x=O,N.y=M,V=E),this.tableParticle.render(t,E,O,M);else if(E.type===l.ElementType.HYPERLINK)this.textParticle.complete(),this.hyperlinkParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.LABEL)this.textParticle.complete(),this.labelParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.MACRO||E.type===l.ElementType.CUSTOM_MACRO||E.type===l.ElementType.REUSABLE_ITEM||E.type===l.ElementType.SUB_TEMPLATE)this.textParticle.complete(),this.macroParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.DATE){const H=F.elementList[Y+1];(!b||b.dateId!==E.dateId)&&this.textParticle.complete(),this.textParticle.record(t,E,O,M+X),(!H||H.dateId!==E.dateId)&&this.textParticle.complete()}else E.type===l.ElementType.SUPERSCRIPT?(this.textParticle.complete(),this.superscriptParticle.render(t,E,O,M+X)):E.type===l.ElementType.SUBSCRIPT?(this.underline.render(t),this.textParticle.complete(),this.subscriptParticle.render(t,E,O,M+X)):E.type===l.ElementType.SEPARATOR?this.separatorParticle.render(t,E,O,M):E.type===l.ElementType.PAGE_BREAK?this.mode!==l.EditorMode.CLEAN&&!p&&this.pageBreakParticle.render(t,E,O,M):E.type===l.ElementType.CHECKBOX||E.controlComponent===l.ControlComponent.CHECKBOX?(this.textParticle.complete(),this.checkboxParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F})):E.type===l.ElementType.RADIO||E.controlComponent===l.ControlComponent.RADIO?(this.textParticle.complete(),this.radioParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F})):E.type===l.ElementType.MENSTRUAL_HISTORY?(this.textParticle.complete(),this.menstrualHistoryParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F,element:E})):E.type===l.ElementType.FETAL_HEART_POSITION?(this.textParticle.complete(),this.fetalHeartPositionParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F,element:E})):E.type===l.ElementType.TOOTH_POSITION?(this.textParticle.complete(),this.toothPositionParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F,element:E})):E.type===l.ElementType.TAB?this.textParticle.complete():E.rowFlex===l.RowFlex.ALIGNMENT||E.rowFlex===l.RowFlex.JUSTIFY?(this.textParticle.record(t,E,O,M+X),this.textParticle.complete()):E.type===l.ElementType.BLOCK?(this.textParticle.complete(),this.blockParticle.render(t,d,E,O,M+X)):(E.left&&this.textParticle.complete(),this.textParticle.record(t,E,O,M+X),(E.width||E.letterSpacing||Kr.test(E.value))&&this.textParticle.complete());if(f&&!p&&this.mode!==l.EditorMode.CLEAN&&!F.isWidthNotEnough&&Y===F.elementList.length-1&&this.lineBreakParticle.render(t,E,O,M+F.height/2),m&&_r.test(E.value)&&this.whiteSpaceParticle.render(t,E,O,M+F.height/2),E.control?.border){b?.control?.border&&b.controlId!==E.controlId&&this.control.drawBorder(t);const H=this.getElementRowMargin(E);this.control.recordBorderInfo(O,M+H,E.metrics.width,F.height-2*H)}else b?.control?.border&&this.control.drawBorder(t);if(E.control?.type===l.ControlType.TEXT){const H=E.controlComponent===l.ControlComponent.VALUE,tt=E.controlComponent===l.ControlComponent.POSTFIX||E.controlComponent===l.ControlComponent.POST_TEXT;H&&E.control?.underline&&((!b||b.controlId!==E.controlId||b.controlComponent!==l.ControlComponent.VALUE&&b.controlComponent!==l.ControlComponent.PLACEHOLDER)&&this.control.startTextFieldUnderline(E.controlId,O,M+F.height),this.control.recordTextFieldUnderlineWidth(E.metrics.width)),tt&&this.control.drawTextFieldUnderline(t)}else b?.control?.type===l.ControlType.TEXT&&this.control.drawTextFieldUnderline(t);if((E.underline||E.control?.underline)&&E.controlComponent!==l.ControlComponent.PLACEHOLDER&&!(E.control?.type===l.ControlType.TEXT&&E.control?.underline)){b?.type===l.ElementType.SUBSCRIPT&&E.type!==l.ElementType.SUBSCRIPT&&this.underline.render(t);const H=this.getElementRowMargin(E),tt=E.left||0;let st=0;E.type===l.ElementType.SUBSCRIPT&&(st=this.subscriptParticle.getOffsetY(E));const et=E.control?.underline?this.options.underlineColor:E.color;this.underline.recordFillInfo(t,O-tt,M+F.height-H+st,W.width+tt,0,et,E.textDecoration?.style)}else(b?.underline||b?.control?.underline)&&(b?.control?.type===l.ControlType.TEXT&&b?.control?.underline||this.underline.render(t));if(E.strikeout){if(!E.type||zt.includes(E.type)){b&&(b.type===l.ElementType.SUBSCRIPT&&E.type!==l.ElementType.SUBSCRIPT||b.type===l.ElementType.SUPERSCRIPT&&E.type!==l.ElementType.SUPERSCRIPT||this.getElementSize(b)!==this.getElementSize(E))&&this.strikeout.render(t);const H=this.textParticle.measureBasisWord(t,this.getElementFont(E));let tt=M+X+H.actualBoundingBoxDescent*n-W.height/2;E.type===l.ElementType.SUBSCRIPT?tt+=this.subscriptParticle.getOffsetY(E):E.type===l.ElementType.SUPERSCRIPT&&(tt+=this.superscriptParticle.getOffsetY(E)),this.strikeout.recordFillInfo(t,O,tt,W.width)}}else b?.strikeout&&this.strikeout.render(t);const{zone:y,splitTdRange:D}=this.range.getRange();let{startIndex:U,endIndex:Q}=this.range.getRange(),G=!1;if(T&&D&&[T.originalId,T.id].includes(D.originalId)&&(G=!0,U=D.startIndex-(T.valueStartIndex??0),Q=D.endIndex-(T.valueStartIndex??0)),y===g&&U!==Q&&U<=C&&C<=Q){const H=this.position.getPositionContext();if(!H.isTable&&!E.tdId||H.tdId===E.tdId||G)if(U===C){const tt=u[U+1];tt&&tt.value===_&&(N.x=O+W.width,N.y=M,N.height=F.height,N.width+=this.options.rangeMinWidth)}else{let tt=W.width;tt===0&&F.elementList.length===1&&(tt=this.options.rangeMinWidth),N.width||(N.x=O,N.y=M,N.height=F.height),N.width+=tt}}if(!r.disabled&&E.groupIds&&this.group.recordFillInfo(E,O,M,W.width,F.height),C++,E.type===l.ElementType.TABLE&&!_t(E)){const H=E.tdPadding||i,tt=H[1]+H[3];for(let st=0;st<E.trList.length;st++){const et=E.trList[st];for(let nt=0;nt<et.tdList.length;nt++){const q=et.tdList[nt];this.drawRow(t,{elementList:q.value,positionList:q.positionList,rowList:q.rowList,pageNo:d,startIndex:0,innerWidth:(q.width-tt)*n,zone:g,isDrawLineBreak:f,td:q})}}}}if(F.isList&&this.listParticle.drawListStyle(t,F,R[F.startIndex]),this.textParticle.complete(),this.control.drawBorder(t),this.underline.render(t),this.strikeout.render(t),this.group.render(t),!p&&!I){if(N.width&&N.height){const{x:Y,y:E,width:W,height:X}=N;this.range.render(t,Y,E,W,X)}if(L&&V&&V.id===P){const{coordinate:{leftTop:[Y,E]}}=R[F.startIndex];this.tableParticle.drawRange(t,V,Y,E)}}}}_drawFloat(t,e){const{scale:n}=this.options,i=this.position.getFloatPositionList(),{imgDisplays:r,pageNo:s}=e;for(let a=0;a<i.length;a++){const c=i[a],d=c.element;if((s===c.pageNo||c.zone===l.EditorZone.HEADER||c.zone==l.EditorZone.FOOTER)&&d.imgDisplay&&r.includes(d.imgDisplay)&&d.type===l.ElementType.IMAGE){const u=d.imgFloatPosition;this.imageParticle.render(t,d,u.x*n,u.y*n)}}}_clearPage(t){const e=this.ctxList[t],n=this.pageList[t];e.clearRect(0,0,Math.max(n.width,this.getWidth()),Math.max(n.height,this.getHeight())),this.blockParticle.clear()}_drawPage(t){const{elementList:e,positionList:n,rowList:i,pageNo:r}=t,{inactiveAlpha:s,pageMode:a,header:c,footer:d,pageNumber:u,lineNumber:R,pageBorder:h}=this.options,g=this.mode===l.EditorMode.PRINT,f=this.getInnerWidth(),T=this.ctxList[r];T.globalAlpha=this.zone.isMainActive()?1:s,this._clearPage(r),(!g||!this.options.modeRule[l.EditorMode.PRINT]?.backgroundDisabled)&&this.background.render(T,r),g||this.area.render(T,r),a!==l.PageMode.CONTINUITY&&this.options.watermark.data&&this.waterMark.render(T,r),g||this.margin.render(T,r),this._drawFloat(T,{pageNo:r,imgDisplays:[l.ImageDisplay.FLOAT_BOTTOM]}),g||this.control.renderHighlightList(T,r);const m=i[0]?.startIndex;this.drawRow(T,{elementList:e,positionList:n,rowList:i,pageNo:r,startIndex:m,innerWidth:f,zone:l.EditorZone.MAIN}),this.getIsPagingMode()&&(c.disabled||this.header.render(T,r),u.disabled||this.pageNumber.render(T,r),d.disabled||this.footer.render(T,r)),this._drawFloat(T,{pageNo:r,imgDisplays:[l.ImageDisplay.FLOAT_TOP,l.ImageDisplay.SURROUND]}),!g&&this.search.getSearchKeyword()&&this.search.render(T,r),this.elementList.length<=1&&!this.elementList[0]?.listId&&this.placeholder.render(T),R.disabled||this.lineNumber.render(T,r),h.disabled||this.pageBorder.render(T),this.badge.render(T,r),this.isGraffitiMode()&&this.graffiti.render(T,r)}_disconnectLazyRender(){this.lazyRenderIntersectionObserver?.disconnect()}_lazyRender(){const t=this.position.getOriginalMainPositionList(),e=this.getOriginalMainElementList();this._disconnectLazyRender(),this.lazyRenderIntersectionObserver=new IntersectionObserver(n=>{n.forEach(i=>{if(i.isIntersecting){const r=Number(i.target.dataset.index);this._drawPage({elementList:e,positionList:t,rowList:this.pageRowList[r],pageNo:r})}})}),this.pageList.forEach(n=>{this.lazyRenderIntersectionObserver.observe(n)})}_immediateRender(){const t=this.position.getOriginalMainPositionList(),e=this.getOriginalMainElementList();for(let n=0;n<this.pageRowList.length;n++)this._drawPage({elementList:e,positionList:t,rowList:this.pageRowList[n],pageNo:n})}render(t){const e=Vt(),n=[],i=(O,M)=>{n.push({label:O,duration:Vt()-M})};this.renderCount++;const r=this.mode===l.EditorMode.EDIT||this.mode===l.EditorMode.FORM||this.mode===l.EditorMode.PRINT?Oh([...this.getHeaderElementList(),...this.elementList,...this.getFooterElementList()]):null,s=this.applySubTemplateRuntimeState(this.getHeaderElementList(),r)||this.applySubTemplateRuntimeState(this.elementList,r)||this.applySubTemplateRuntimeState(this.getFooterElementList(),r);let{endIndex:a}=this.range.getRange();const{isCrossRowCol:c}=this.range.getRange();if(!c&&~a){const O=this.getElementList(),M=sn(O,a);M!==a&&!_t(O[M])&&(this.range.setRange(M,M),a=M)}let d;const u=this.position.getPositionContext();if(c)d=this.getOriginalElementList()[u.index];else{const O=~a?a:0,M=this.getElementList();d=tn(M,O)}const{header:R,footer:h}=this.options,{isSubmitHistory:g=!0,isSetCursor:f=!0,isLazy:T=!0,isInit:m=!1,isSourceHistory:p=!1,isFirstRender:I=!1,isDel:L=!1}=t||{};let{isCompute:P=!0}=t||{};s&&(P=!0);let{curIndex:C}=t||{};const{traceLabel:S}=t||{},F=this.getInnerWidth(),N=this.getIsPagingMode(),V=this.pageRowList.length;if(P){if(this.splitTdValueMap.clear(),this.tdMap.clear(),this.position.setFloatPositionList([]),N){if(!R.disabled){const et=Vt();this.header.compute(),i("header.compute",et)}if(!h.disabled){const et=Vt();this.footer.compute(),i("footer.compute",et)}}const O=this.getMargins(),M=this.getHeight(),b=this.header.getExtraHeight(),y=this.getMainOuterHeight(),D=O[3],U=O[0]+b,Q=Zo(this.elementList),G=Vt();this.rowList=this.computeRowList({startX:D,startY:U,pageHeight:M,mainOuterHeight:y,isPagingMode:N,innerWidth:F,surroundElementList:Q,elementList:this.elementList}),i("computeRowList",G);const H=Vt();this.pageRowList=this._computePageList(),i("computePageList",H);const tt=Vt();this.position.computePositionList(),i("computePositionList",tt);const st=Vt();if(this.area.compute(),i("area.compute",st),!this.isPrintMode()){const et=this.search.getSearchKeyword();if(et){const q=Vt();this.search.compute(et),i("search.compute",q)}const nt=Vt();this.control.computeHighlightList(),i("control.computeHighlightList",nt)}if(this.isGraffitiMode()){const et=Vt();this.graffiti.compute(),i("graffiti.compute",et)}}this.imageObserver.clearAll(),this.cursor.recoveryCursor();for(let O=0;O<this.pageRowList.length;O++)this.pageList[O]||this._createPage(O);const Y=this.pageRowList.length,E=this.pageList.length;if(E>Y){const O=E-Y;this.ctxList.splice(Y,O),this.pageList.splice(Y,O).forEach(M=>M.remove())}const W=Vt();if(T&&N?this._lazyRender():this._immediateRender(),i(T&&N?"lazyRender":"immediateRender",W),f){if(P&&d?.tableId){const{index:O}=u,b=this.getOriginalElementList()[O];if(d.tableId!==b?.id){const D=this.findTableChildrenElement(!0,d.tableId,d);D&&u.index!==D.originalIndex&&(u.index=D.originalIndex,u.tableId=D.table.id,u.trIndex=D.trIndex,u.trId=D.tr.id,u.tdIndex=D.tdIndex,u.tdId=D.td.id,C=D.elementIndex,this.position.setPositionContext(u),this.range.setRange(C,C),this.updateTableTool())}const y=this.getElementList();y[a]!==d&&(C=y.findIndex(D=>D===d))}C=this.setCursor(C)}else this.range.getIsSelection()&&this.cursor.focus();if(L){let O;const M=this.position.getPositionContext();O=this.range.getRange().startIndex-1,M.index=O}(g&&!I||C!==void 0&&this.historyManager.isStackEmpty())&&this.submitHistory(C);const X=Vt();Co(()=>{const O=Vt();this.range.setRangeStyle(),P&&this.control.getActiveControl()&&this.control.reAwakeControl(),P&&!this.isReadonly()&&this.getMode()!==l.EditorMode.FORM&&u.isTable&&this.getOriginalElementList()[u.index].type===l.ElementType.TABLE&&this.tableTool.render(),P&&!this.zone.isMainActive()&&this.zone.drawZoneIndicator(),V!==this.pageRowList.length&&(this.listener.pageSizeChange&&this.listener.pageSizeChange(this.pageRowList.length),this.eventBus.isSubscribe("pageSizeChange")&&this.eventBus.emit("pageSizeChange",this.pageRowList.length)),(g||p)&&!m&&(this.listener.contentChange&&this.listener.contentChange(),this.eventBus.isSubscribe("contentChange")&&this.eventBus.emit("contentChange"));const M=Vt();So(this.options,S||"render",M-e,[...n,{label:"nextTick.wait",duration:O-X},{label:"nextTick.callback",duration:M-O}],{isCompute:P,pageCount:this.pageRowList.length})}),f&&this.fixPosition()}fixPosition(t=!1){let e;const n=this.position.getPositionContext();if(n.isTable){const i=this.getElementList(),r=this.range.getRange().startIndex;if(t||r>=i.length){const s=this.getTd(),a=n.index+(t?-1:1),d=this.getOriginalElementList()[a];if(!d?.trList)return;e=r-i.length;for(let u=0;u<d.trList.length;u++){const R=d.trList[u],h=R.tdList.find(g=>t?s?.linkTdPrevId===g.id:s?.id===g.linkTdPrevId);if(h){n.index=a,n.trIndex=u,n.tableId=d.id,n.trId=R.id,n.tdId=h?.id,e=t?h.value.length-1:e+(h.value[0]?.type===l.ElementType.SPLIT_TAG?1:0);break}}if(this.position.setPositionContext(n),this.range.setRange(e,e),this.setCursor(e),e===0)return this.fixPosition(t);this.updateTableTool()}}return e}setCursor(t){const e=this.position.getPositionContext(),n=this.position.getPositionList(),i=this.getElementList();if(e.isTable){const{index:s,trIndex:a,tdIndex:c}=e,u=this.getOriginalElementList()[s].trList?.[a].tdList[c].positionList;t===void 0&&u&&(t=u.length-1);const R=u?.[t];this.position.setCursorPosition(R||null)}else t!==void 0&&t>=n.length&&(t=n.length-1),this.position.setCursorPosition(t!==void 0&&t>=0?n[t]:null);let r=!0;if(t!==void 0&&e.isImage&&e.isDirectHit){const s=i[t];if(s&&cl.includes(s.type)){r=!1;const a=this.position.getCursorPosition();this.previewer.updateResizer(s,a)}}return this.cursor.drawCursor({isShow:r}),t}submitHistory(t){const e=this.position.getPositionContext(),n=wo(this.elementList),i=wo(this.header.getElementList()),r=wo(this.footer.getElementList()),s=at(this.range.getRange()),a=this.pageNo,c=at(e),d=this.zone.getZone();this.historyManager.execute(()=>{this.zone.setZone(d),this.setPageNo(a),this.position.setPositionContext(at(c)),this.header.setElementList(at(i)),this.footer.setElementList(at(r)),this.elementList=at(n),this.range.replaceRange(at(s)),this.render({curIndex:t,isSubmitHistory:!1,isSourceHistory:!0})})}destroy(){this.macroParticle.clearInlineEditor({isSubmitHistory:!1}),this.container.remove(),this.globalEvent.removeEvent(),this.scrollObserver.removeEvent(),this.selectionObserver.removeEvent()}clearSideEffect(){this.getMacroParticle().clearInlineEditor({isSubmitHistory:!1}),this.getPreviewer().clearResizer(),this.getTableTool().dispose(),this.getHyperlinkParticle().clearHyperlinkPopup(),this.getDateParticle().clearDatePicker()}updateTableTool(){if(this.getMode()===l.EditorMode.FORM){this.getTableTool().dispose();return}if(this.position.getPositionContext().isTable){const t=this.position.getPositionList();t.length&&(this.setPageNo(t[0].pageNo),this.getTableTool().render())}}initTableElementIndex(t,e){t.trList?.forEach((n,i)=>{n.tdList.forEach((r,s)=>{r.tableIndex=e,r.tableId=t.id,r.trIndex=i,r.trId=n.id,r.tdIndex=s,this.tdMap.set(r.id,r)})})}clearElementEffect(t){t.trList?.forEach(e=>{e.minHeight=e.originalMinHeight??e.minHeight,delete e.originalMinHeight,e.tdList.forEach(n=>{delete n.linkTdNextId})})}updateElementTableInfo(t,e,n,i){return t.tableId=e.id,t.trId=n.id,t.tdId=i.id,t}findTableChildrenElement(t,e,n){const i=this.position.getPositionContext(),{index:r}=i,s=this.getOriginalElementList();let a=r;t&&(a=r>s.length?s.length-1:r);for(let c=a;t?c>=0:c<s.length;t?c--:c++){const d=s[c];if(d&&[d.originalId,d.id].includes(e))for(const[u,R]of d.trList.entries())for(const[h,g]of R.tdList.entries()){const f=g.value.findIndex(typeof n=="function"?n:T=>T===n);if(f>=0)return{originalIndex:c,table:d,tr:R,trIndex:u,td:g,tdIndex:h,elementIndex:f}}}}getTdById(t){return this.tdMap.get(t)}getLinkTdPrevHasValue(t){const e=this.getTdById(t);if(e)return e.value.length?e:this.getLinkTdPrevHasValue(e.linkTdPrevId)}getFirstLinkTd(t){const e=this.getTdById(t);return e?.linkTdPrevId?this.getLastLinkTd(e.linkTdPrevId):e}getLastLinkTd(t){const e=this.getTdById(t);return e?.linkTdNextId?this.getLastLinkTd(e.linkTdNextId):e}removeLinkTd(t,e){const n=this.getTdById(e);if(n){if(n.linkTdPrevId){const i=this.getTdById(n.linkTdPrevId);i&&(delete i.linkTdNextId,this.removeLinkTd(t,n.linkTdPrevId))}if(n.linkTdNextId){const i=this.getTdById(n.linkTdNextId);i&&(delete i.linkTdPrevId,this.removeLinkTd(t,n.linkTdNextId))}t[n.tableIndex].trList[n.trIndex].tdList.splice(n.tdIndex,1),this.initTableElementIndex(t[n.tableIndex],n.tableIndex)}}removeLinkTdControl(t,e){const n=this.getTdById(t);if(n){for(let i=0;i<n.value.length;i++)n.value[i].control===e&&(n.value.splice(i,1),i--);n.linkTdNextId&&this.removeLinkTdControl(n.linkTdNextId,e)}}isSplitTd(t,e){return(!!t?.originalId||!!e?.originalId)&&(t?.originalId===e?.originalId||t?.id===e?.originalId||t?.originalId===e?.id)}getSplitTdValues(t){return this.splitTdValueMap.get(t)}removeSplitTdOtherRangeElements(){const{splitTdRange:t}=this.range.getRange();if(!t)return;const{startIndex:e,endIndex:n}=t;let i=this.getTd();if(i)if((i.valueStartIndex??0)>=e){let r=-1;for(;r<0;){const s=this.getTdById(i.linkTdPrevId);if(s){r=e-(s.valueStartIndex??0);const a=Math.max(0,r);this.spliceElementList(s.value,a+1,s.value.length-a-1),i=s}else r=0}}else{let r=1;for(;r>0;){const s=this.getTdById(i.linkTdNextId);if(s){const a=s.valueStartIndex??0;r=n-(a+s.value.length);const c=Math.min(s.value.length,n-a+1);this.spliceElementList(s.value,0,c),i=s}else r=0}}}getTablesByPagingId(t,e,n){const i=[],r=[];if(t[n].pagingId===e){i.push(n),r.push(t[n]);for(let s=n-1;s>=0&&t[s].pagingId===e;s--)r.unshift(t[s]),i.push(s);for(let s=n+1;s<t.length&&t[s].pagingId===e;s++)r.push(t[s]),i.push(s)}return{list:r,startIndex:i.sort()[0]}}}class yr{executeMode;executeCut;executeCopy;executePaste;executeSelectAll;executeBackspace;executeSetRange;executeReplaceRange;executeSetPositionContext;executeForceUpdate;executeBlur;executeHideCursor;executeUndo;executeRedo;executePainter;executeApplyPainterStyle;executeFormat;executeFont;executeButton;executeEditElementAttribute;executeTriggerControlEditAttribute;executeCopyControl;executePasteControl;executeSize;executeSizeAdd;executeSizeMinus;executeBold;executeItalic;executeUnderline;executeStrikeout;executeSuperscript;executeSubscript;executeColor;executeHighlight;executeTitle;executeList;executeRowFlex;executeVertical;executeRowMargin;executeInsertTable;executeInsertTableTopRow;executeInsertTableBottomRow;executeInsertTableLeftCol;executeInsertTableRightCol;executeDeleteTableRow;executeDeleteTableCol;executeDeleteTable;executeMergeTableCell;executeCancelMergeTableCell;executeSplitVerticalTableCell;executeSplitHorizontalTableCell;executeTableTdVerticalAlign;executeTableBorderType;executeTableBorderColor;executeTableTdBorderType;executeTableTdSlashType;executeTableTdBackgroundColor;executeTableSelectAll;executeTableProperties;executeImage;executeHyperlink;executeDeleteHyperlink;executeCancelHyperlink;executeEditHyperlink;executeSeparator;executePageBreak;executeAddWatermark;executeDeleteWatermark;executeSearch;executeSearchNavigatePre;executeSearchNavigateNext;executeReplace;executePrint;executeReplaceImageElement;executeSaveAsImageElement;executeSetImageCrop;executeSetImageCaption;executeChangeImageDisplay;executePageMode;executePageScale;executePageScaleRecovery;executePageScaleMinus;executePageScaleAdd;executePaperSize;executePaperDirection;executeSetPaperMargin;executeSetMainBadge;executeSetAreaBadge;executeInsertElementList;executeInsertArea;executeSetAreaValue;executeSetAreaProperties;executeLocationArea;executeClearGraffiti;executeAppendElementList;executeUpdateElementById;executeDeleteElementById;executeSetValue;executeRemoveControl;executeTranslate;executeSetLocale;executeLocationCatalog;executeWordTool;executeSetHTML;executeSetGroup;executeDeleteGroup;executeLocationGroup;executeSetZone;executeSetControlValue;executeSetControlValueList;executeSetControlExtension;executeSetControlExtensionList;executeSetControlProperties;executeSetControlPropertiesList;executeSetControlHighlight;executeLocationControl;executeInsertControl;executeInsertTextField;executeJumpControl;executeUpdateOptions;executeSetFormModeTrace;executeInsertTitle;executeFocus;executeComputeElementListHeight;getCatalog;getImage;getPageMode;getOptions;getValue;getValueAsync;getAreaValue;getHTML;getText;getWordCount;getCursorPosition;getRemainingContentHeight;getRange;getRangeText;getRangeContext;getRangeRow;getRangeParagraph;getKeywordRangeList;getKeywordContext;getPaperMargin;getSearchNavigateInfo;getLocale;getGroupIds;getControlValue;getControlList;getContainer;getTitleValue;getPositionContextByEvent;getElementById;getMacroValue;getMacroList;setMacroValue;setMacroValueList;updateMacroProperties;locationMacro;insertSubTemplate;updateSubTemplate;expandSubTemplate;collapseSubTemplate;toggleSubTemplate;constructor(t){this.executeMode=t.mode.bind(t),this.executeCut=t.cut.bind(t),this.executeCopy=t.copy.bind(t),this.executePaste=t.paste.bind(t),this.executeSelectAll=t.selectAll.bind(t),this.executeBackspace=t.backspace.bind(t),this.executeSetRange=t.setRange.bind(t),this.executeReplaceRange=t.replaceRange.bind(t),this.executeSetPositionContext=t.setPositionContext.bind(t),this.executeForceUpdate=t.forceUpdate.bind(t),this.executeBlur=t.blur.bind(t),this.executeHideCursor=t.hideCursor.bind(t),this.executeUndo=t.undo.bind(t),this.executeRedo=t.redo.bind(t),this.executePainter=t.painter.bind(t),this.executeApplyPainterStyle=t.applyPainterStyle.bind(t),this.executeFormat=t.format.bind(t),this.executeFont=t.font.bind(t),this.executeButton=t.buttonText.bind(t),this.executeEditElementAttribute=t.editElementAttribute.bind(t),this.executeTriggerControlEditAttribute=t.triggerControlEditAttribute.bind(t),this.executeCopyControl=t.copyControl.bind(t),this.executePasteControl=t.pasteControl.bind(t),this.executeSize=t.size.bind(t),this.executeSizeAdd=t.sizeAdd.bind(t),this.executeSizeMinus=t.sizeMinus.bind(t),this.executeBold=t.bold.bind(t),this.executeItalic=t.italic.bind(t),this.executeUnderline=t.underline.bind(t),this.executeStrikeout=t.strikeout.bind(t),this.executeSuperscript=t.superscript.bind(t),this.executeSubscript=t.subscript.bind(t),this.executeColor=t.color.bind(t),this.executeHighlight=t.highlight.bind(t),this.executeTitle=t.title.bind(t),this.executeList=t.list.bind(t),this.executeRowFlex=t.rowFlex.bind(t),this.executeVertical=t.vertical.bind(t),this.executeRowMargin=t.rowMargin.bind(t),this.executeInsertTable=t.insertTable.bind(t),this.executeInsertTableTopRow=t.insertTableTopRow.bind(t),this.executeInsertTableBottomRow=t.insertTableBottomRow.bind(t),this.executeInsertTableLeftCol=t.insertTableLeftCol.bind(t),this.executeInsertTableRightCol=t.insertTableRightCol.bind(t),this.executeDeleteTableRow=t.deleteTableRow.bind(t),this.executeDeleteTableCol=t.deleteTableCol.bind(t),this.executeDeleteTable=t.deleteTable.bind(t),this.executeMergeTableCell=t.mergeTableCell.bind(t),this.executeCancelMergeTableCell=t.cancelMergeTableCell.bind(t),this.executeSplitVerticalTableCell=t.splitVerticalTableCell.bind(t),this.executeSplitHorizontalTableCell=t.splitHorizontalTableCell.bind(t),this.executeTableTdVerticalAlign=t.tableTdVerticalAlign.bind(t),this.executeTableBorderType=t.tableBorderType.bind(t),this.executeTableBorderColor=t.tableBorderColor.bind(t),this.executeTableTdBorderType=t.tableTdBorderType.bind(t),this.executeTableTdSlashType=t.tableTdSlashType.bind(t),this.executeTableTdBackgroundColor=t.tableTdBackgroundColor.bind(t),this.executeTableSelectAll=t.tableSelectAll.bind(t),this.executeTableProperties=t.tableProperties.bind(t),this.executeImage=t.image.bind(t),this.executeHyperlink=t.hyperlink.bind(t),this.executeDeleteHyperlink=t.deleteHyperlink.bind(t),this.executeCancelHyperlink=t.cancelHyperlink.bind(t),this.executeEditHyperlink=t.editHyperlink.bind(t),this.executeSeparator=t.separator.bind(t),this.executePageBreak=t.pageBreak.bind(t),this.executeAddWatermark=t.addWatermark.bind(t),this.executeDeleteWatermark=t.deleteWatermark.bind(t),this.executeSearch=t.search.bind(t),this.executeSearchNavigatePre=t.searchNavigatePre.bind(t),this.executeSearchNavigateNext=t.searchNavigateNext.bind(t),this.executeReplace=t.replace.bind(t),this.executePrint=t.print.bind(t),this.executeReplaceImageElement=t.replaceImageElement.bind(t),this.executeSaveAsImageElement=t.saveAsImageElement.bind(t),this.executeSetImageCrop=t.setImageCrop.bind(t),this.executeSetImageCaption=t.setImageCaption.bind(t),this.executeChangeImageDisplay=t.changeImageDisplay.bind(t),this.executePageMode=t.pageMode.bind(t),this.executePageScale=t.pageScale.bind(t),this.executePageScaleRecovery=t.pageScaleRecovery.bind(t),this.executePageScaleMinus=t.pageScaleMinus.bind(t),this.executePageScaleAdd=t.pageScaleAdd.bind(t),this.executePaperSize=t.paperSize.bind(t),this.executePaperDirection=t.paperDirection.bind(t),this.executeSetPaperMargin=t.setPaperMargin.bind(t),this.executeSetMainBadge=t.setMainBadge.bind(t),this.executeSetAreaBadge=t.setAreaBadge.bind(t),this.getAreaValue=t.getAreaValue.bind(t),this.executeInsertArea=t.insertArea.bind(t),this.executeSetAreaValue=t.setAreaValue.bind(t),this.executeSetAreaProperties=t.setAreaProperties.bind(t),this.executeLocationArea=t.locationArea.bind(t),this.executeClearGraffiti=t.clearGraffiti.bind(t),this.executeInsertElementList=t.insertElementList.bind(t),this.executeAppendElementList=t.appendElementList.bind(t),this.executeUpdateElementById=t.updateElementById.bind(t),this.executeDeleteElementById=t.deleteElementById.bind(t),this.executeSetValue=t.setValue.bind(t),this.executeRemoveControl=t.removeControl.bind(t),this.executeTranslate=t.translate.bind(t),this.executeSetLocale=t.setLocale.bind(t),this.executeLocationCatalog=t.locationCatalog.bind(t),this.executeWordTool=t.wordTool.bind(t),this.executeSetHTML=t.setHTML.bind(t),this.executeSetGroup=t.setGroup.bind(t),this.executeDeleteGroup=t.deleteGroup.bind(t),this.executeLocationGroup=t.locationGroup.bind(t),this.executeSetZone=t.setZone.bind(t),this.executeUpdateOptions=t.updateOptions.bind(t),this.executeSetFormModeTrace=t.setFormModeTrace.bind(t),this.executeInsertTitle=t.insertTitle.bind(t),this.executeFocus=t.focus.bind(t),this.executeComputeElementListHeight=t.computeElementListHeight.bind(t),this.getImage=t.getImage.bind(t),this.getPageMode=t.getPageMode.bind(t),this.getOptions=t.getOptions.bind(t),this.getValue=t.getValue.bind(t),this.getValueAsync=t.getValueAsync.bind(t),this.getHTML=t.getHTML.bind(t),this.getText=t.getText.bind(t),this.getWordCount=t.getWordCount.bind(t),this.getCursorPosition=t.getCursorPosition.bind(t),this.getRemainingContentHeight=t.getRemainingContentHeight.bind(t),this.getRange=t.getRange.bind(t),this.getRangeText=t.getRangeText.bind(t),this.getRangeContext=t.getRangeContext.bind(t),this.getRangeRow=t.getRangeRow.bind(t),this.getRangeParagraph=t.getRangeParagraph.bind(t),this.getKeywordRangeList=t.getKeywordRangeList.bind(t),this.getKeywordContext=t.getKeywordContext.bind(t),this.getCatalog=t.getCatalog.bind(t),this.getPaperMargin=t.getPaperMargin.bind(t),this.getSearchNavigateInfo=t.getSearchNavigateInfo.bind(t),this.getLocale=t.getLocale.bind(t),this.getGroupIds=t.getGroupIds.bind(t),this.getContainer=t.getContainer.bind(t),this.getTitleValue=t.getTitleValue.bind(t),this.getPositionContextByEvent=t.getPositionContextByEvent.bind(t),this.getElementById=t.getElementById.bind(t),this.executeSetControlValue=t.setControlValue.bind(t),this.executeSetControlValueList=t.setControlValueList.bind(t),this.executeSetControlExtension=t.setControlExtension.bind(t),this.executeSetControlExtensionList=t.setControlExtensionList.bind(t),this.executeSetControlProperties=t.setControlProperties.bind(t),this.executeSetControlPropertiesList=t.setControlPropertiesList.bind(t),this.executeSetControlHighlight=t.setControlHighlight.bind(t),this.getControlValue=t.getControlValue.bind(t),this.getControlList=t.getControlList.bind(t),this.executeLocationControl=t.locationControl.bind(t),this.executeInsertControl=t.insertControl.bind(t),this.executeInsertTextField=t.insertTextField.bind(t),this.executeJumpControl=t.jumpControl.bind(t),this.getMacroValue=t.getMacroValue.bind(t),this.getMacroList=t.getMacroList.bind(t),this.setMacroValue=t.setMacroValue.bind(t),this.setMacroValueList=t.setMacroValueList.bind(t),this.updateMacroProperties=t.updateMacroProperties.bind(t),this.locationMacro=t.locationMacro.bind(t),this.insertSubTemplate=t.insertSubTemplate.bind(t),this.updateSubTemplate=t.updateSubTemplate.bind(t),this.expandSubTemplate=t.expandSubTemplate.bind(t),this.collapseSubTemplate=t.collapseSubTemplate.bind(t),this.toggleSubTemplate=t.toggleSubTemplate.bind(t)}}function sg(o,t){return o===1125&&t===1593?{size:"a3",width:"297mm",height:"420mm"}:o===794&&t===1123?{size:"a4",width:"210mm",height:"297mm"}:o===565&&t===796?{size:"a5",width:"148mm",height:"210mm"}:{size:"",width:`${o}px`,height:`${t}px`}}function rg(o,t){const{width:e,height:n,direction:i=l.PaperDirection.VERTICAL}=t,r=document.createElement("iframe");r.style.visibility="hidden",r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width="0",r.style.height="0",r.style.border="none",document.body.append(r);const s=r.contentWindow,a=s.document;a.open();const c=document.createElement("div"),d=sg(e,n);o.forEach(h=>{const g=document.createElement("img");g.style.width=i===l.PaperDirection.HORIZONTAL?d.height:d.width,g.style.height=i===l.PaperDirection.HORIZONTAL?d.width:d.height,g.src=h,c.append(g)});const u=document.createElement("style"),R=`
|
|
538
|
+
`,document.body.appendChild(a);const c=a.querySelector(".table-properties-modal__mask"),d=a.querySelector(".table-properties-modal__close"),u=a.querySelector(".btn-cancel"),R=a.querySelector(".btn-confirm"),h=()=>{a.remove()};c.addEventListener("click",h),d.addEventListener("click",h),u.addEventListener("click",h),R.addEventListener("click",()=>{const g=parseInt(a.querySelector("#tdPaddingTop").value)||0,f=parseInt(a.querySelector("#tdPaddingRight").value)||0,T=parseInt(a.querySelector("#tdPaddingBottom").value)||0,m=parseInt(a.querySelector("#tdPaddingLeft").value)||0;i.tdPadding=[g,f,T,m],h();const{endIndex:p}=this.range.getRange();this.draw.render({curIndex:p,isCompute:!0})})}}class tg{draw;zone;range;position;options;areaInfoMap=new Map;constructor(t){this.draw=t,this.options=t.getOptions(),this.zone=t.getZone(),this.range=t.getRange(),this.position=t.getPosition()}getAreaInfo(){return this.areaInfoMap}getActiveAreaId(){if(!this.areaInfoMap.size)return null;const{startIndex:t}=this.range.getRange();return this.draw.getElementList()[t]?.areaId||null}getActiveAreaInfo(){const t=this.getActiveAreaId();return t&&this.areaInfoMap.get(t)||null}isReadonly(){const t=this.getActiveAreaInfo();if(!t?.area)return!1;switch(t.area.mode){case l.AreaMode.EDIT:return!1;case l.AreaMode.READONLY:return!0;case l.AreaMode.FORM:return!this.draw.getControl().getIsRangeWithinControl();default:return!1}}insertArea(t){const{id:e,value:n,area:i,position:r,range:s}=t;if(this.zone.getZone()!==l.EditorZone.MAIN&&this.zone.setZone(l.EditorZone.MAIN),this.draw.getPosition().setPositionContext({isTable:!1}),s&&!this.getActiveAreaId()){const{startIndex:c,endIndex:d}=s,u=this.draw.getOriginalMainElementList();if(!u[c]||!u[d])return null;this.range.setRange(s.startIndex,s.endIndex)}else if(r===l.LocationPosition.BEFORE)this.range.setRange(0,0);else{const d=this.draw.getOriginalMainElementList().length-1;this.range.setRange(d,d)}const a=e||lt();return this.draw.insertElementList([{type:l.ElementType.AREA,value:"",areaId:a,valueList:n,area:at(i)}]),a}render(t,e){if(!this.areaInfoMap.size)return;t.save();const n=this.draw.getMargins(),i=this.draw.getInnerWidth();for(const r of this.areaInfoMap){const{area:s,positionList:a}=r[1];if(s?.hide||!s?.backgroundColor&&!s?.borderColor&&!s?.placeholder)continue;const c=a.filter(f=>f.pageNo===e);if(!c.length)continue;t.translate(.5,.5);const d=c[0],u=c[c.length-1],R=n[3],h=Math.ceil(d.coordinate.leftTop[1]),g=Math.ceil(u.coordinate.rightBottom[1]-h);t.textBaseline="middle",s.backgroundColor&&(t.fillStyle=s.backgroundColor,t.fillRect(R,h,i,g)),s.borderColor&&(t.strokeStyle=s.borderColor,t.strokeRect(R,h,i,g)),s.placeholder&&a.length<=1&&new Xr(this.draw).render(t,{placeholder:{...ki,...s.placeholder},startY:d.coordinate.leftTop[1]}),t.translate(-.5,-.5)}t.restore()}compute(){this.areaInfoMap.clear();const t=this.draw.getOriginalMainElementList(),e=this.position.getOriginalMainPositionList();for(let n=0;n<t.length;n++){const i=t[n],r=i.areaId;if(r){const s=this.areaInfoMap.get(r);s?(s.elementList.push(i),s.positionList.push(e[n])):this.areaInfoMap.set(r,{id:r,area:i.area,elementList:[i],positionList:[e[n]]})}}}getAreaValue(t={}){const e=t.id||this.getActiveAreaId();if(!e)return null;const n=this.areaInfoMap.get(e);return n?{area:n.area,id:n.id,startPageNo:n.positionList[0].pageNo,endPageNo:n.positionList[n.positionList.length-1].pageNo,value:Mt(n.elementList)}:null}getContextByAreaId(t,e){const n=this.draw.getOriginalMainElementList();for(let i=0;i<n.length;i++){const r=n[i];if(e?.position===l.LocationPosition.OUTER_BEFORE){if(n[i+1]?.areaId!==t)continue}else if(e?.position===l.LocationPosition.AFTER){if(!(r.areaId===t&&n[i+1]?.areaId!==t))continue}else if(e?.position===l.LocationPosition.OUTER_AFTER){if(!(r.areaId!==t&&n[i-1]?.areaId===t))continue}else if(r.areaId!==t)continue;const s=this.position.getOriginalMainPositionList();return{range:{startIndex:i,endIndex:i},elementPosition:s[i]}}return null}setAreaProperties(t){const e=t.id||this.getActiveAreaId();if(!e)return;const n=this.areaInfoMap.get(e);if(!n)return;n.area||(n.area={});let i=!1;const r=["top","hide"];Object.entries(t.properties).forEach(([s,a])=>{if(wi(a))return;const c=s;n.area[c]=a,r.includes(c)&&(i=!0)}),this.draw.render({isCompute:i,isSetCursor:!1})}setAreaValue(t){const e=t.id||this.getActiveAreaId();if(!e)return;const n=this.areaInfoMap.get(e);if(!n)return;const{positionList:i}=n,r=this.draw.getOriginalMainElementList(),s=t.value;bt([{type:l.ElementType.AREA,value:"",valueList:s,areaId:n.id,area:n.area}],{editorOptions:this.options}),this.draw.spliceElementList(r,i[0].index,i.length,s,{isIgnoreDeletedRule:!0}),this.draw.render({isSetCursor:!1})}}class eg{draw;options;imageCache;mainBadge;areaBadgeMap;constructor(t){this.draw=t,this.options=t.getOptions(),this.imageCache=new Map,this.mainBadge=null,this.areaBadgeMap=new Map}setMainBadge(t){this.mainBadge=t}setAreaBadgeMap(t){this.areaBadgeMap.clear(),t.forEach(e=>{this.areaBadgeMap.set(e.areaId,e.badge)})}_drawImage(t,e,n,i,r,s){if(this.imageCache.has(s)){const a=this.imageCache.get(s);t.drawImage(a,e,n,i,r)}else{const a=new Image;a.setAttribute("crossOrigin","Anonymous"),a.src=s,a.onload=()=>{this.imageCache.set(s,a),t.drawImage(a,e,n,i,r)}}}render(t,e){if(e===0&&this.mainBadge){const{scale:n,badge:i}=this.options,{left:r,top:s,width:a,height:c,value:d}=this.mainBadge,u=this.draw.getMargins()[0]+this.draw.getHeader().getExtraHeight(),R=(r||i.left)*n,h=(s||i.top)*n+u;this._drawImage(t,R,h,a*n,c*n,d)}if(this.areaBadgeMap.size){const n=this.draw.getArea().getAreaInfo();if(n.size){const{scale:i,badge:r}=this.options;for(const s of n){const{positionList:a}=s[1],c=a[0];if(c.pageNo!==e)continue;const d=this.areaBadgeMap.get(s[0]);if(!d)continue;const{left:u,top:R,width:h,height:g,value:f}=d,T=(u||r.left)*i,m=(R||r.top)*i+c.coordinate.leftTop[1];this._drawImage(t,T,m,h*i,g*i,f)}}}}}class ng{draw;options;data;pageContainer;isDrawing=!1;startStroke=null;constructor(t,e){this.draw=t,this.options=t.getOptions(),this.data=e||[],this.pageContainer=t.getPageContainer(),this.register()}register(){this.pageContainer.addEventListener("mousedown",this.start.bind(this)),this.pageContainer.addEventListener("mouseup",this.stop.bind(this)),this.pageContainer.addEventListener("mouseleave",this.stop.bind(this)),this.pageContainer.addEventListener("mousemove",this.drawing.bind(this))}start(t){if(!this.draw.isGraffitiMode())return;this.isDrawing=!0;const{scale:e}=this.options;this.startStroke={lineColor:this.options.graffiti.defaultLineColor,lineWidth:this.options.graffiti.defaultLineWidth,points:[t.offsetX/e,t.offsetY/e]}}stop(){this.isDrawing=!1}drawing(t){if(!this.isDrawing||!this.draw.isGraffitiMode())return;const{offsetX:e,offsetY:n}=t,i=2;if(this.startStroke&&Math.abs(this.startStroke.points[0]-e)<i&&Math.abs(this.startStroke.points[1]-n)<i)return;const r=this.draw.getPageNo();let s=this.data.find(d=>d.pageNo===r);if(this.startStroke&&(s||(s={pageNo:r,strokes:[]},this.data.push(s)),s.strokes.push(this.startStroke),this.startStroke=null),!s?.strokes?.length)return;const{scale:a}=this.options;s.strokes[s.strokes.length-1].points.push(e/a,n/a),this.draw.render({isCompute:!1,isSetCursor:!1,isSubmitHistory:!1})}getValue(){return this.data}compute(){const t=this.draw.getPageRowList().length;for(let e=this.data.length-1;e>=0;e--)this.data[e].pageNo>t-1&&this.data.splice(e,1)}clear(){this.data=[]}render(t,e){const n=this.data.find(a=>a.pageNo===e)?.strokes;if(!n?.length)return;const{graffiti:{defaultLineColor:i,defaultLineWidth:r},scale:s}=this.options;t.save();for(let a=0;a<n.length;a++){const c=n[a];t.beginPath(),t.strokeStyle=c.lineColor||i,t.lineWidth=(c.lineWidth||r)*s,t.moveTo(c.points[0]*s,c.points[1]*s);for(let d=2;d<c.points.length;d+=2)t.lineTo(c.points[d]*s,c.points[d+1]*s);t.stroke()}t.restore()}}const Nr=1024,og=['[aria-modal="true"]','[role="dialog"]','[data-overlay-active="true"]',".ant-modal-root",".ant-modal-wrap",".ant-modal",".ant-drawer",".ant-select-dropdown",".ant-picker-dropdown",".ant-dropdown",".ant-popover",".ant-tooltip",".ant-cascader-dropdown",".ant-mentions-dropdown"].join(", ");function Fr(o,t,e){for(let n=0;n<e.length;n+=Nr){const i=e.slice(n,n+Nr);o.splice(t+n,0,...i)}}class ig{container;pageContainer;pageList;ctxList;pageNo;renderCount;pagePixelRatio;mode;options;position;zone;elementList;listener;eventBus;override;i18n;canvasEvent;globalEvent;cursor;range;margin;background;badge;search;group;area;underline;strikeout;highlight;historyManager;previewer;imageParticle;laTexParticle;textParticle;tableParticle;tableTool;tableOperate;pageNumber;lineNumber;waterMark;placeholder;header;footer;hyperlinkParticle;labelParticle;macroParticle;dateParticle;separatorParticle;pageBreakParticle;superscriptParticle;subscriptParticle;checkboxParticle;radioParticle;menstrualHistoryParticle;fetalHeartPositionParticle;toothPositionParticle;blockParticle;listParticle;lineBreakParticle;whiteSpaceParticle;control;pageBorder;workerManager;scrollObserver;selectionObserver;imageObserver;graffiti;command;interactionPaused;overlayActiveCount;globalShortcutSuspended;LETTER_REG;WORD_LIKE_REG;rowList;pageRowList;painterStyle;painterOptions;visiblePageNoList;intersectionPageNo;lazyRenderIntersectionObserver;printModeData;splitTdValueMap=new Map;tdMap=new Map;constructor(t,e,n,i,r,s){this.container=this._wrapContainer(t),this.pageList=[],this.ctxList=[],this.pageNo=0,this.renderCount=0,this.pagePixelRatio=null,this.mode=e.mode,this.options=e,this.elementList=n.main,this.listener=i,this.eventBus=r,this.override=s,this._formatContainer(),this.pageContainer=this._createPageContainer(),this._createPage(0),this.i18n=new vh(e.locale),this.historyManager=new Aa(this),this.position=new ka(this),this.zone=new _h(this),this.range=new Ja(this),this.margin=new za(this),this.background=new Ba(this),this.badge=new eg(this),this.search=new ja(this),this.group=new Ah(this),this.area=new tg(this),this.underline=new tc(this),this.strikeout=new qa(this),this.highlight=new $a(this),this.previewer=new Dh(this),this.imageParticle=new vi(this),this.laTexParticle=new _i(this),this.textParticle=new ec(this),this.tableParticle=new ic(this),this.tableTool=new sc(this),this.tableOperate=new qh(this),this.pageNumber=new an(this),this.lineNumber=new Bh(this),this.waterMark=new gc(this),this.placeholder=new Xr(this),this.header=new cc(this,n.header),this.footer=new xh(this,n.footer),this.hyperlinkParticle=new rc(this),this.labelParticle=new lc(this),this.macroParticle=new ac(this),this.dateParticle=new Uh(this),this.separatorParticle=new Rc(this),this.pageBreakParticle=new hc(this),this.superscriptParticle=new dc,this.subscriptParticle=new uc,this.checkboxParticle=new Sh(this),this.radioParticle=new Eh(this),this.menstrualHistoryParticle=new Xh(this),this.fetalHeartPositionParticle=new Nh(this),this.toothPositionParticle=new Fh(this),this.blockParticle=new Zh(this),this.listParticle=new Gh(this),this.lineBreakParticle=new Un(this),this.whiteSpaceParticle=new kh(this),this.control=new Ih(this),this.pageBorder=new $h(this),this.graffiti=new ng(this,n.graffiti),this.scrollObserver=new nc(this),this.selectionObserver=new oc(this),this.imageObserver=new Kh,new Jh(this),this.canvasEvent=new xa(this),this.cursor=new da(this,this.canvasEvent),this.canvasEvent.register(),this.globalEvent=new Ga(this,this.canvasEvent),this.globalEvent.register(),this.workerManager=new Yh(this),new jh(this);const{letterClass:a}=e;this.LETTER_REG=new RegExp(`[${a.join("")}]`),this.WORD_LIKE_REG=new RegExp(`${a.map(c=>`[^${c}][${c}]`).join("|")}`),this.rowList=[],this.pageRowList=[],this.painterStyle=null,this.painterOptions=null,this.visiblePageNoList=[],this.intersectionPageNo=0,this.lazyRenderIntersectionObserver=null,this.printModeData=null,this.interactionPaused=!1,this.overlayActiveCount=0,this.globalShortcutSuspended=!1,this.mode===l.EditorMode.PRINT&&this.setPrintData(),this.mode,l.EditorMode.FORM,this.render({isInit:!0,isSetCursor:!1,isFirstRender:!0})}setPrintData(){this.printModeData={header:this.header.getElementList(),main:this.elementList,footer:this.footer.getElementList()};const t=at(this.printModeData);["header","main","footer"].forEach(r=>{t[r]=this.control.filterAssistElement(t[r])});const n=t,i=this.removeStrikeout(n);t.main=i.main.filter(r=>!r.strikeout),this.setEditorData(i)}removeStrikeout(t){if(Array.isArray(t))return t.map(e=>this.removeStrikeout(e)).filter(e=>!(e&&typeof e=="object"&&"strikeout"in e&&e.strikeout===!0));if(t&&typeof t=="object"){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=this.removeStrikeout(t[n]));return e}return t}clearPrintData(){this.printModeData&&(this.setEditorData(this.printModeData),this.printModeData=null)}getLetterReg(){return this.LETTER_REG}getMode(){return this.mode}setMode(t){if(this.mode===t)return;this.macroParticle.clearInlineEditor({isSubmitHistory:!1}),this.mode=t,this.options.mode=t;const e=new Map,n=r=>{r.forEach(s=>{s.controlId&&(s.controlComponent==="value"&&e.set(s.controlId,!0),s.checked&&e.set(s.controlId,!0))})};n(this.elementList),this.elementList.forEach(r=>{r.type==="table"&&r.trList?.forEach(s=>{s.tdList?.forEach(a=>{n(a.value)})})});const i=r=>{r.forEach(s=>{if(!(!s.control&&!s.controlId)&&(s.controlComponent==="value"&&s.strikeout&&(t===l.EditorMode.PRINT?s.hide=!0:s.hide=!1),!!s.control&&!(s.type!=="control"&&s.control.type!=="button"))){if(s.control.type==="TextField"&&(s.controlComponent==="placeholder"||s.controlComponent==="preTextFix"||s.controlComponent==="preTextFixText"||s.controlComponent==="postTextFix"||s.controlComponent==="postTextFixText"||s.controlComponent==="textFixLabel")&&(t===l.EditorMode.EDIT?s.hide=!1:s.hide=!0),s.control.type==="text"&&(s.controlComponent==="placeholder"||s.controlComponent==="prefix"||s.controlComponent==="postfix")&&(t===l.EditorMode.EDIT||t===l.EditorMode.FORM?s.hide=!1:s.hide=!0),s.control.type==="number"||s.control.type==="select"||s.control.type==="date"||s.control.type==="checkbox"||s.control.type==="radio"){if(s.controlComponent==="placeholder"||s.controlComponent==="prefix"||s.controlComponent==="postfix"){const c=e.get(s.controlId);s.control.type==="select"&&t===l.EditorMode.PRINT||t===l.EditorMode.PRINT&&!c?s.hide=!0:s.hide=!1}s.control.type==="number"&&s.controlComponent==="value"&&(t===l.EditorMode.PRINT&&s.strikeout?s.hide=!0:t!==l.EditorMode.PRINT&&s.strikeout&&(s.hide=!1))}s.control.type==="button"&&(s.hide=!1,s.control.hide=!1),s.control.type==="menstrualHistory"&&(s.controlComponent==="prefix"||s.controlComponent==="postfix")&&(t===l.EditorMode.PRINT?s.hide=!0:s.hide=!1)}})};i(this.elementList),this.elementList.forEach(r=>{r.type==="table"&&r.trList.forEach(s=>{s.tdList.forEach(a=>{i(a.value)})})}),t===l.EditorMode.FORM?(this.elementList.filter(r=>r.type==="control").map(r=>{r.control?.type==="button"&&r.control.buttonText&&(r.color="#1677FF",r.highlight="transparent")}),this.hideTextFieldWhitespace(this.elementList,!0),this.updateTextFieldPlaceholderVisibility(this.elementList,!0,!1)):t===l.EditorMode.EDIT?(this.hideTextFieldWhitespace(this.elementList,!1),this.updateTextFieldPlaceholderVisibility(this.elementList,!0,!1)):(this.hideTextFieldWhitespace(this.elementList,!1),this.updateTextFieldPlaceholderVisibility(this.elementList,!1,!0)),t===l.EditorMode.PRINT?(this.elementList.filter(r=>r?.control?.type==="button").map(r=>{(r?.controlComponent==="prefix"||r?.controlComponent==="postfix")&&(r.color="transparent",r.highlight="transparent"),r?.controlComponent==="value"&&!r.control.buttonText&&(r.color="transparent",r.highlight="transparent")}),this.setPrintData()):(this.clearPrintData(),this.elementList.filter(r=>r?.control?.type==="button").map(r=>{(r?.controlComponent==="prefix"||r?.controlComponent==="postfix")&&!r.control.buttonText&&r.type==="control"&&(r.color="transparent",r.highlight="#1677FF"),r?.controlComponent==="value"&&!r.control.buttonText&&(r.color="#fff",r.highlight="#1677FF"),r?.type==="text"&&r.control.buttonText&&(r.color="#000"),r?.type==="control"&&r?.controlComponent==="value"&&r.control.buttonText&&(r.color="#000",r.highlight="transparent")})),this.mode===l.EditorMode.PRINT&&this.clearPrintData(),this.clearSideEffect(),this.control.destroyControl(),this.range.clearRange(),this.render({isSetCursor:!1,isSubmitHistory:!1})}hideTextFieldWhitespace(t,e){const n=r=>r?/^[\s\u00A0\u2000-\u200B\u3000\n\r\t]+$/.test(r):!1;(r=>{for(let s=0;s<r.length;s++){const a=r[s];if(a.type===l.ElementType.TABLE&&a.trList)for(const c of a.trList)for(const d of c.tdList)this.hideTextFieldWhitespace(d.value,e);a.control?.type===l.ControlType.TEXTFIELD&&a.controlComponent===l.ControlComponent.VALUE&&n(a.value)&&(a.hide=e)}})(t)}getSubTemplateRuntimeEndIndex(t,e,n){let i=e+1;for(;i<t.length&&t[i].subTemplateParentId===n;)i++;return i}syncSubTemplateExpandedState(t,e,n,i,r){let s=!1;const a=this.getSubTemplateRuntimeEndIndex(t,e,n.id);if(i&&!n.subTemplateContent?.length&&(i=!1),n.subTemplateExpanded!==i&&(n.subTemplateExpanded=i,s=!0),!!n.hide!==r&&(n.hide=r,s=!0),!i)return a>e+1&&(t.splice(e+1,a-e-1),s=!0),s;if(a===e+1){const c=at(n.subTemplateContent||[]);bt(c,{isHandleFirstElement:!1,editorOptions:this.options});for(let d=0;d<c.length;d++)c[d].subTemplateParentId=n.id;c.length&&(t.splice(e+1,0,...c),s=!0)}return s}applySubTemplateRuntimeState(t,e){const n=i=>{let r=!1,s=0;for(;s<i.length;){const a=i[s];if(a.type===l.ElementType.SUB_TEMPLATE){const c=!!a.subTemplateConditions?.length;if(this.mode===l.EditorMode.EDIT&&c)r=this.syncSubTemplateExpandedState(i,s,a,!0,!0)||r;else if((this.mode===l.EditorMode.FORM||this.mode===l.EditorMode.PRINT)&&c){const d=e?Ch(a.subTemplateConditions,e,a.subTemplateRelation):!1;r=this.syncSubTemplateExpandedState(i,s,a,d,!0)||r}else this.mode!==l.EditorMode.FORM&&this.mode!==l.EditorMode.PRINT&&(r=this.syncSubTemplateExpandedState(i,s,a,!1,!1)||r)}if(a.valueList?.length&&(r=n(a.valueList)||r),a.control?.value?.length&&(r=n(a.control.value)||r),a.type===l.ElementType.TABLE&&a.trList?.length)for(let c=0;c<a.trList.length;c++){const d=a.trList[c];for(let u=0;u<d.tdList.length;u++)r=n(d.tdList[u].value)||r}s++}return r};return n(t)}updateTextFieldPlaceholderVisibility(t,e,n){const i=[l.ControlType.TEXT,l.ControlType.TEXTFIELD,l.ControlType.SELECT,l.ControlType.DATE,l.ControlType.CHECKBOX,l.ControlType.RADIO,l.ControlType.NUMBER];(s=>{let a=0;for(;a<s.length;){const c=s[a];if(c.type===l.ElementType.TABLE&&c.trList)for(const d of c.trList)for(const u of d.tdList)this.updateTextFieldPlaceholderVisibility(u.value,e,n);if(c.control?.type&&i.includes(c.control.type)&&(c.controlComponent===l.ControlComponent.PREFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX||c.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||c.controlComponent===l.ControlComponent.PRE_TEXT)){const d=c.controlId,u=c.control.type;let R=!1,h=!1,g=!1;const f=[],T=[],m=[];let p=-1,I=a;for(;I<s.length;){const L=s[I];if(L.controlId!==d)break;if((L.controlComponent===l.ControlComponent.PREFIX||L.controlComponent===l.ControlComponent.PRETEXTFIX||L.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT)&&T.push(I),L.controlComponent===l.ControlComponent.VALUE&&L.value&&L.value.trim()&&(R=!0),L.controlComponent===l.ControlComponent.VALUE&&(L.type===l.ElementType.MENSTRUAL_HISTORY||L.type===l.ElementType.FETAL_HEART_POSITION||L.type===l.ElementType.TOOTH_POSITION||L.type===l.ElementType.MACRO||L.type===l.ElementType.CUSTOM_MACRO)&&(R=!0),L.controlComponent===l.ControlComponent.VALUE&&L.control&&L.control.type!==u&&(h=!0),L.controlComponent===l.ControlComponent.PLACEHOLDER&&(g=!0,f.push(I)),L.controlComponent===l.ControlComponent.POSTFIX||L.controlComponent===l.ControlComponent.POSTTEXTFIX||L.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT){m.push(I),p=I;break}I++}if(!R&&!h)if(g&&f.length>0)for(const L of f)s[L].hide=!e;else e&&c.control?.placeholder&&(p>0?this.control.addPlaceholder(p-1):this.control.addPlaceholder(a));if(n)if(e&&R){for(const L of T)s[L].hide=!0;for(const L of m)s[L].hide=!0}else if(e){for(const L of T)s[L].hide=!1;for(const L of m)s[L].hide=!1}else{for(const L of T)s[L].hide=!0;for(const L of m)s[L].hide=!0}else{for(const L of T)s[L].hide=!1;for(const L of m)s[L].hide=!1}a=I}a++}})(t)}isReadonly(){if(this.area.getActiveAreaInfo()?.area?.mode)return this.area.isReadonly();switch(this.mode){case l.EditorMode.DESIGN:return!1;case l.EditorMode.READONLY:case l.EditorMode.PRINT:case l.EditorMode.GRAFFITI:return!0;case l.EditorMode.FORM:if(this.control.getIsRangeWithinControl()){const t=this.getElementList(),{startIndex:e}=this.range.getRange();if(t[e]?.control?.type===l.ControlType.TEXTFIELD)return!0}return!this.control.getIsRangeWithinControl();default:return!1}}isDisabled(){if(this.mode===l.EditorMode.DESIGN)return!1;const{startIndex:t,endIndex:e}=this.range.getRange(),n=this.getElementList();if(this.getTd()?.disabled)return!0;if(t===e){const r=n[t],s=n[t+1];return!!(r?.title?.disabled&&s?.title?.disabled&&r.titleId===s.titleId||r?.control?.disabled&&s?.control?.disabled&&r.controlId===s.controlId)}return n.slice(t+1,e+1).some(r=>r.title?.disabled||r.control?.disabled)}isDesignMode(){return this.mode===l.EditorMode.DESIGN}isPrintMode(){return this.mode===l.EditorMode.PRINT}isGraffitiMode(){return this.mode===l.EditorMode.GRAFFITI}getOriginalWidth(){const{paperDirection:t,width:e,height:n}=this.options;return t===l.PaperDirection.VERTICAL?e:n}getOriginalHeight(){const{paperDirection:t,width:e,height:n}=this.options;return t===l.PaperDirection.VERTICAL?n:e}getWidth(){return Math.floor(this.getOriginalWidth()*this.options.scale)}getHeight(){return Math.floor(this.getOriginalHeight()*this.options.scale)}getMainHeight(){return this.getHeight()-this.getMainOuterHeight()}getMainOuterHeight(){const t=this.getMargins(),e=this.header.getExtraHeight(),n=this.footer.getExtraHeight();return t[0]+t[2]+e+n}getCanvasWidth(t=-1){return this.getPage(t).width}getCanvasHeight(t=-1){return this.getPage(t).height}getInnerWidth(){const t=this.getWidth(),e=this.getMargins();return t-e[1]-e[3]}getOriginalInnerWidth(){const t=this.getOriginalWidth(),e=this.getOriginalMargins();return t-e[1]-e[3]}getContextInnerWidth(){const t=this.position.getPositionContext();if(t.isTable){const{index:e,trIndex:n,tdIndex:i}=t,s=this.getOriginalElementList()[e],a=s.trList[n].tdList[i],c=this.getTdPadding(s);return a.width-c[1]-c[3]}return this.getOriginalInnerWidth()}getMargins(){return this.getOriginalMargins().map(t=>t*this.options.scale)}getOriginalMargins(){const{margins:t,paperDirection:e}=this.options;return e===l.PaperDirection.VERTICAL?t:[t[1],t[2],t[3],t[0]]}getPageGap(){return this.options.pageGap*this.options.scale}getOriginalPageGap(){return this.options.pageGap}getPageNumberBottom(){const{pageNumber:{bottom:t},scale:e}=this.options;return t*e}getMarginIndicatorSize(){return this.options.marginIndicatorSize*this.options.scale}getDefaultBasicRowMarginHeight(){return this.options.defaultBasicRowMarginHeight*this.options.scale}getHighlightMarginHeight(){return this.options.highlightMarginHeight*this.options.scale}getTdPadding(t){const{table:{tdPadding:e},scale:n}=this.options;return(t?.tdPadding||e).map(r=>r*n)}getContainer(){return this.container}getPageContainer(){return this.pageContainer}getEventTarget(t){return t instanceof Element?t:t instanceof Node?t.parentElement:null}isTargetInsideEditor(t){const e=this.getEventTarget(t);return e?this.container.contains(e)?!0:!!Wi(e,n=>!!n&&n.nodeType===1&&!!n.getAttribute(ue)):!1}isTargetInsideExternalOverlay(t){const e=this.getEventTarget(t);return!e||this.isTargetInsideEditor(e)?!1:!!e.closest(og)}pauseInteraction(){this.interactionPaused=!0,this.cursor?.getAgentDom().blur(),this.globalEvent?.resetSideEffect()}resumeInteraction(){this.interactionPaused=!1}setOverlayActive(t){this.overlayActiveCount=t?1:0,t&&(this.cursor?.getAgentDom().blur(),this.globalEvent?.resetSideEffect())}suspendGlobalShortcut(t){this.globalShortcutSuspended=t}isInteractionSuspended(){return this.interactionPaused||this.overlayActiveCount>0}isGlobalShortcutActive(){return!this.globalShortcutSuspended&&!this.isInteractionSuspended()}getVisiblePageNoList(){return this.visiblePageNoList}setVisiblePageNoList(t){this.visiblePageNoList=t,this.listener.visiblePageNoListChange&&this.listener.visiblePageNoListChange(this.visiblePageNoList),this.eventBus.isSubscribe("visiblePageNoListChange")&&this.eventBus.emit("visiblePageNoListChange",this.visiblePageNoList)}getIntersectionPageNo(){return this.intersectionPageNo}setIntersectionPageNo(t){this.intersectionPageNo=t,this.listener.intersectionPageNoChange&&this.listener.intersectionPageNoChange(this.intersectionPageNo),this.eventBus.isSubscribe("intersectionPageNoChange")&&this.eventBus.emit("intersectionPageNoChange",this.intersectionPageNo)}getPageNo(){return this.pageNo}setPageNo(t){this.pageNo=t}getRenderCount(){return this.renderCount}getPage(t=-1){return this.pageList[~t?t:this.pageNo]}getPageList(){return this.pageList}getPageCount(){return this.pageList.length}getTableRowList(t){const e=this.position.getPositionContext(),{index:n,trIndex:i,tdIndex:r}=e;return t[n].trList[i].tdList[r].rowList}getOriginalRowList(){const t=this.getZone();return t.isHeaderActive()?this.header.getRowList():t.isFooterActive()?this.footer.getRowList():this.rowList}getRowList(){return this.position.getPositionContext().isTable?this.getTableRowList(this.getOriginalElementList()):this.getOriginalRowList()}getPageRowList(){return this.pageRowList}getCtx(){return this.ctxList[this.pageNo]}getOptions(){return this.options}getSearch(){return this.search}getGroup(){return this.group}getArea(){return this.area}getBadge(){return this.badge}getHistoryManager(){return this.historyManager}getPosition(){return this.position}getZone(){return this.zone}getRange(){return this.range}getLineBreakParticle(){return this.lineBreakParticle}getTextParticle(){return this.textParticle}getHeaderElementList(){return this.header.getElementList()}getTableElementList(t){const e=this.position.getPositionContext(),{index:n,trIndex:i,tdIndex:r}=e;return t[n]?.trList?.[i].tdList[r].value||[]}getElementList(){const t=this.position.getPositionContext(),e=this.getOriginalElementList();return t.isTable?this.getTableElementList(e):e}getMainElementList(){return this.position.getPositionContext().isTable?this.getTableElementList(this.elementList):this.elementList}getOriginalElementList(){const t=this.getZone();return t.isHeaderActive()?this.getHeaderElementList():t.isFooterActive()?this.getFooterElementList():this.elementList}getOriginalMainElementList(){return this.elementList}getFooterElementList(){return this.footer.getElementList()}getTd(){const t=this.position.getPositionContext(),{index:e,trIndex:n,tdIndex:i,isTable:r}=t;return r?this.getOriginalElementList()[e].trList[n].tdList[i]:null}getTdByPosition(t){const{index:e,trIndex:n,tdIndex:i,isTable:r}=t;return r?this.getOriginalElementList()[e].trList[n].tdList[i]:null}insertElementTextField(t,e={}){if(!t.length||!this.range.getIsCanInput())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const r=this.getElementList(),{isSubmitHistory:s=!0}=e;bt(t,{isHandleFirstElement:!1,editorOptions:this.options});let a=-1,c=this.control.getActiveControl();if(!c&&this.control.getIsRangeWithinControl()&&(this.control.initControl(),c=this.control.getActiveControl()),c&&this.control.getIsRangeWithinControl()){const d=n===i,u=n+1;d||this.newSpliceElementList(r,u,i-n),this.newSpliceElementList(r,u,0,t),a=n+t.length}else{const d=n===i,u=n+1;d||this.newSpliceElementList(r,u,i-n),this.newSpliceElementList(r,u,0,t),a=n+t.length;const R=r[u-1];t[0].listId&&R&&!R.listId&&R?.value===_&&(!R.type||R.type===l.ElementType.TEXTFIELD)&&(r.splice(n,1),a-=1)}this.control.destroyControl(),~a&&(this.range.setRange(a,a),this.render({curIndex:a,isSubmitHistory:s}))}insertElementList(t,e={}){if(!t.length||!this.range.getIsCanInput())return;const{startIndex:n,endIndex:i}=this.range.getRange();if(!~n&&!~i)return;const{isSubmitHistory:r=!0}=e;bt(t,{isHandleFirstElement:!1,editorOptions:this.options});let s=-1,a=this.control.getActiveControl();if(!a&&this.control.getIsRangeWithinControl()&&(this.control.initControl(),a=this.control.getActiveControl()),a&&this.control.getIsRangeWithinControl()){const c=this.getElementList(),d=n===i,u=n+1,R=c[n];if(R?.controlComponent===l.ControlComponent.PRE_TEXT||R?.controlComponent===l.ControlComponent.POST_TEXT||R?.controlComponent===l.ControlComponent.PREFIX||R?.controlComponent===l.ControlComponent.POSTFIX)for(let f=0;f<t.length;f++)t[f].control||(t[f].color=this.options.defaultColor);d&&(c[n]?.control?.type===l.ControlType.TEXTFIELD||c[n]?.control?.type===l.ControlType.TEXT)&&this.control.removePlaceholder(n),d||this.newSpliceElementList(c,u,i-n);const g=c[n]?.controlId||c[n-1]?.controlId||c[n+1]?.controlId;for(let f=0;f<t.length;f++){if(t[f]?.control?.type=="button"&&!t[f]?.control?.buttonText&&(t[f]?.controlComponent==="prefix"||t[f]?.controlComponent==="postfix"?(t[f].color="transparent",t[f].highlight="#1677FF"):(t[f].color="#fff",t[f].highlight="#1677FF")),t[f]?.type===l.ElementType.MENSTRUAL_HISTORY||t[f]?.type===l.ElementType.FETAL_HEART_POSITION||t[f]?.type===l.ElementType.TOOTH_POSITION||t[f]?.type===l.ElementType.MACRO||t[f]?.type===l.ElementType.CUSTOM_MACRO||t[f]?.type===l.ElementType.REUSABLE_ITEM||t[f]?.type===l.ElementType.SUB_TEMPLATE||t[f]?.type===l.ElementType.SPECIAL_SYMBOLS){t[f].controlComponent=l.ControlComponent.VALUE;let T=c[n]?.controlId;T||(T=c[n-1]?.controlId),T||(T=c[n+1]?.controlId),!t[f].controlId&&T&&(t[f].controlId=T)}g&&t[f]?.control&&t[f].controlId&&t[f].controlId!==g&&(t[f].originControlId=g)}this.newSpliceElementList(c,u,0,t),s=n+t.length}else{const c=this.getElementList(),d=n===i,u=n+1;if(c[u]?.control?.type=="TextField"||c[n]?.control?.type=="TextField"){d||this.newSpliceElementList(c,u,i-n);for(let R=0;R<t.length;R++)if(t[R]?.type===l.ElementType.MENSTRUAL_HISTORY||t[R]?.type===l.ElementType.FETAL_HEART_POSITION||t[R]?.type===l.ElementType.TOOTH_POSITION||t[R]?.type===l.ElementType.MACRO||t[R]?.type===l.ElementType.CUSTOM_MACRO||t[R]?.type===l.ElementType.REUSABLE_ITEM||t[R]?.type===l.ElementType.SUB_TEMPLATE||t[R]?.type===l.ElementType.SPECIAL_SYMBOLS){t[R].controlComponent=l.ControlComponent.VALUE;const h=c[n]?.controlId||c[u]?.controlId;!t[R].controlId&&h&&(t[R].controlId=h)}this.newSpliceElementList(c,u,0,t),s=n+t.length}else{d||this.spliceElementList(c,u,i-n);for(let h=0;h<t.length;h++)t[h]?.control?.type=="button"&&!t[h]?.control?.buttonText&&(t[h]?.controlComponent==="prefix"||t[h]?.controlComponent==="postfix"?(t[h].color="transparent",t[h].highlight="#1677FF"):(t[h].color="#fff",t[h].highlight="#1677FF"));this.spliceElementList(c,u,0,t),s=n+t.length;const R=c[u-1];t[0].listId&&R&&!R.listId&&R?.value===_&&(!R.type||R.type===l.ElementType.TEXT)&&(c.splice(n,1),s-=1)}}~s&&(this.range.setRange(s,s),this.render({curIndex:s,isSubmitHistory:r}))}appendElementList(t,e={}){if(!t.length)return;bt(t,{isHandleFirstElement:!1,editorOptions:this.options});let n;const{isPrepend:i,isSubmitHistory:r=!0}=e;i?(this.elementList.splice(1,0,...t),n=t.length):(this.elementList.push(...t),n=this.elementList.length-1),this.range.setRange(n,n),this.render({curIndex:n,isSubmitHistory:r})}spliceElementList(t,e,n,i,r){const{isIgnoreDeletedRule:s=!1}=r||{},{group:a,modeRule:c}=this.options;if(n>0){const d=e+n,R=t[d]?.listId;if(R&&t[e-1]?.listId!==R){let h=d;for(;h<t.length;){const g=t[h];if(g.listId!==R||g.value===_)break;delete g.listId,delete g.listType,delete g.listStyle,h++}}if(!s&&!this.isDesignMode()&&!this.control.getIsRangeWithinControl()){const h=this.getTd()?.deletable;let g=d-1;for(;g>=e;){const f=t[g];(_t(f)||h!==!1&&f?.control?.deletable!==!1&&(!f.controlId||this.mode!==l.EditorMode.FORM||!c[this.mode].controlDeletableDisabled)&&f?.title?.deletable!==!1&&(a.deletable!==!1||!f.groupIds?.length)&&(f?.area?.deletable!==!1||f?.areaIndex!==0))&&t.splice(g,1),g--}}else t.splice(e,n)}if(i?.length){let d=t[e];for(let u=0;u<i.length;u++)!i[u].controlComponent&&d?.controlComponent&&(i[u].controlId=d.controlId,i[u].control=d.control,i[u].controlComponent=d.controlComponent),d=i[u];Fr(t,e,i)}}newSpliceElementList(t,e,n,i,r){const{isIgnoreDeletedRule:s=!1}=r||{},{group:a,modeRule:c}=this.options;if(n>0){const u=e+n,h=t[u]?.listId;if(h&&t[e-1]?.listId!==h){let g=u;for(;g<t.length;){const f=t[g];if(f.listId!==h||f.value===_)break;delete f.listId,delete f.listType,delete f.listStyle,g++}}if(!s&&!this.isDesignMode()&&!this.control.getIsRangeWithinControl()){const g=this.getTd()?.deletable;let f=u-1;for(;f>=e;){const T=t[f];(_t(T)||g!==!1&&T?.control?.deletable!==!1&&(!T.controlId||this.mode!==l.EditorMode.FORM||!c[this.mode].controlDeletableDisabled)&&T?.title?.deletable!==!1&&(a.deletable!==!1||!T.groupIds?.length)&&(T?.area?.deletable!==!1||T?.areaIndex!==0))&&t.splice(f,1),f--}}else t.splice(e,n)}const d=t[e]?.controlId;if(i?.length){for(let u=0;u<i.length;u++)d&&(i[u].originControlId=d);Fr(t,e,i)}}getCanvasEvent(){return this.canvasEvent}getGlobalEvent(){return this.globalEvent}getListener(){return this.listener}getEventBus(){return this.eventBus}getOverride(){return this.override}getCursor(){return this.cursor}getPreviewer(){return this.previewer}getImageParticle(){return this.imageParticle}getTableTool(){return this.tableTool}getTableOperate(){return this.tableOperate}getTableParticle(){return this.tableParticle}getHeader(){return this.header}getFooter(){return this.footer}getHyperlinkParticle(){return this.hyperlinkParticle}getMacroParticle(){return this.macroParticle}getDateParticle(){return this.dateParticle}getListParticle(){return this.listParticle}getCheckboxParticle(){return this.checkboxParticle}getRadioParticle(){return this.radioParticle}getMenstrualHistoryParticle(){return this.menstrualHistoryParticle}getFetalHeartPositionParticle(){return this.fetalHeartPositionParticle}getToothPositionParticle(){return this.toothPositionParticle}getControl(){return this.control}getWorkerManager(){return this.workerManager}getImageObserver(){return this.imageObserver}getI18n(){return this.i18n}getGraffiti(){return this.graffiti}setCommand(t){this.command=t}getCommand(){return this.command}getRowCount(){return this.getRowList().length}async getDataURL(t={}){const{pixelRatio:e,mode:n}=t;e&&this.setPagePixelRatio(e);const i=this.mode,r=!!n&&i!==n;r&&this.setMode(n),this.render({isLazy:!1,isCompute:!1,isSetCursor:!1,isSubmitHistory:!1}),await this.imageObserver.allSettled();const s=this.pageList.map(a=>a.toDataURL());return e&&this.setPagePixelRatio(null),r&&this.setMode(i),s}getPainterStyle(){return this.painterStyle&&Object.keys(this.painterStyle).length?this.painterStyle:null}getPainterOptions(){return this.painterOptions}setPainterStyle(t,e){this.painterStyle=t,this.painterOptions=e||null,this.getPainterStyle()&&this.pageList.forEach(n=>n.style.cursor="copy")}setDefaultRange(){this.elementList.length&&setTimeout(()=>{const t=this.elementList.length-1;this.range.setRange(t,t),this.range.setRangeStyle()})}getIsPagingMode(){return this.options.pageMode===l.PageMode.PAGING}setPageMode(t){if(!t||this.options.pageMode===t)return;if(this.options.pageMode=t,t===l.PageMode.PAGING){const{height:i}=this.options,r=this.getPagePixelRatio(),s=this.pageList[0];s.style.height=`${i}px`,s.height=i*r,this._initPageContext(this.ctxList[0])}else this._disconnectLazyRender(),this.header.recovery(),this.footer.recovery(),this.zone.setZone(l.EditorZone.MAIN);const{startIndex:e}=this.range.getRange(),n=this.range.getIsCollapsed();this.render({isSetCursor:!0,curIndex:e,isSubmitHistory:!1}),n||this.cursor.drawCursor({isShow:!1}),setTimeout(()=>{this.listener.pageModeChange&&this.listener.pageModeChange(t),this.eventBus.isSubscribe("pageModeChange")&&this.eventBus.emit("pageModeChange",t)})}setPageScale(t){const e=this.getPagePixelRatio();this.options.scale=t;const n=this.getWidth(),i=this.getHeight();this.container.style.width=`${n}px`,this.pageList.forEach((s,a)=>{s.width=n*e,s.height=i*e,s.style.width=`${n}px`,s.style.height=`${i}px`,s.style.marginBottom=`${this.getPageGap()}px`,this._initPageContext(this.ctxList[a])});const r=this.position.getCursorPosition();this.render({isSubmitHistory:!1,isSetCursor:!!r,curIndex:r?.index}),this.listener.pageScaleChange&&this.listener.pageScaleChange(t),this.eventBus.isSubscribe("pageScaleChange")&&this.eventBus.emit("pageScaleChange",t)}getPagePixelRatio(){return this.pagePixelRatio||window.devicePixelRatio}setPagePixelRatio(t){!this.pagePixelRatio&&t===window.devicePixelRatio||t===this.pagePixelRatio||(this.pagePixelRatio=t,this.setPageDevicePixel())}setPageDevicePixel(){const t=this.getPagePixelRatio(),e=this.getWidth(),n=this.getHeight();this.pageList.forEach((i,r)=>{i.width=e*t,i.height=n*t,this._initPageContext(this.ctxList[r])}),this.render({isSubmitHistory:!1,isSetCursor:!1})}setPaperSize(t,e){this.options.width=t,this.options.height=e;const n=this.getPagePixelRatio(),i=this.getWidth(),r=this.getHeight();this.container.style.width=`${i}px`,this.pageList.forEach((s,a)=>{s.width=i*n,s.height=r*n,s.style.width=`${i}px`,s.style.height=`${r}px`,this._initPageContext(this.ctxList[a])}),this.render({isSubmitHistory:!1,isSetCursor:!1})}setPaperDirection(t){const e=this.getPagePixelRatio();this.options.paperDirection=t;const n=this.getWidth(),i=this.getHeight();this.container.style.width=`${n}px`,this.pageList.forEach((r,s)=>{r.width=n*e,r.height=i*e,r.style.width=`${n}px`,r.style.height=`${i}px`,this._initPageContext(this.ctxList[s])}),this.render({isSubmitHistory:!1,isSetCursor:!1})}setPaperMargin(t){this.options.margins=t,this.render({isSubmitHistory:!1,isSetCursor:!1})}getOriginValue(t={}){const{pageNo:e}=t;let n=this.elementList;return Number.isInteger(e)&&e>=0&&e<this.pageRowList.length&&(n=this.pageRowList[e].flatMap(r=>r.elementList)),{header:this.getHeaderElementList(),main:n,footer:this.getFooterElementList(),graffiti:this.graffiti.getValue()}}getValue(t={}){const e=this.getOriginValue(t);console.log(this.elementList,"所有元素");const{extraPickAttrs:n}=t,i={header:Mt(e.header,{extraPickAttrs:n,editorOptions:this.options}),main:Mt(e.main,{extraPickAttrs:n,isClassifyArea:!0,editorOptions:this.options}),footer:Mt(e.footer,{extraPickAttrs:n,editorOptions:this.options}),graffiti:e.graffiti};return{version:ve,data:i,options:at(this.options)}}setValue(t,e){const{header:n,main:i,footer:r}=at(t);if(!n&&!i&&!r)return;const{isSetCursor:s=!1}=e||{};[n,i,r].forEach(d=>{d&&bt(d,{editorOptions:this.options,isForceCompensation:!0})}),this.setEditorData({header:n,main:i,footer:r}),this.historyManager.recovery();const c=s?i?.length?i.length-1:0:void 0;c!==void 0&&this.range.setRange(c,c),this.render({curIndex:c,isSetCursor:s,isFirstRender:!0})}setEditorData(t){const{header:e,main:n,footer:i}=t;e&&this.header.setElementList(e),n&&(this.elementList=n),i&&this.footer.setElementList(i)}_wrapContainer(t){const e=document.createElement("div");return t.append(e),e}_formatContainer(){this.container.style.position="relative",this.container.style.width=`${this.getWidth()}px`,this.container.setAttribute(ue,l.EditorComponent.MAIN)}_createPageContainer(){const t=document.createElement("div");return t.classList.add(`${z}-page-container`),this.container.append(t),t}_createPage(t){const e=this.getWidth(),n=this.getHeight(),i=document.createElement("canvas");i.style.width=`${e}px`,i.style.height=`${n}px`,i.style.display="block",i.style.backgroundColor="#ffffff",i.style.marginBottom=`${this.getPageGap()}px`,i.setAttribute("data-index",String(t)),this.pageContainer.append(i);const r=this.getPagePixelRatio();i.width=e*r,i.height=n*r,i.style.cursor="text";const s=i.getContext("2d");this._initPageContext(s),this.pageList.push(i),this.ctxList.push(s)}_initPageContext(t){const e=this.getPagePixelRatio();t.scale(e,e),t.letterSpacing="0px",t.wordSpacing="0px",t.direction="ltr"}getElementFont(t,e=1){const{defaultSize:n,defaultFont:i}=this.options,r=t.font||i,s=t.actualSize||t.size||n;return`${t.italic?"italic ":""}${t.bold?"bold ":""}${s*e}px ${r}`}getElementSize(t){return t.actualSize||t.size||this.options.defaultSize}getElementRowMargin(t){const{defaultSize:e,defaultBasicRowMarginHeight:n,defaultRowMargin:i,scale:r}=this.options,s=t.size||e;let a=1;return s<12?a=s/12:s>30&&(a=1+(s-30)/30),n*a*(t.rowMargin??i)*r}computeRowList(t){const{innerWidth:e,elementList:n,isPagingMode:i=!1,isFromTable:r=!1,startX:s=0,startY:a=0,pageHeight:c=0,mainOuterHeight:d=0,surroundElementList:u=[]}=t,{defaultSize:R,scale:h,imgCaption:g,table:{tdPadding:f,defaultTrMinHeight:T},defaultTabWidth:m}=this.options,p=this.getDefaultBasicRowMarginHeight(),L=document.createElement("canvas").getContext("2d"),P=this.listParticle.computeListStyle(L,n),C=[],S=this._collectTextControlValueSet(n);n.length&&C.push({width:0,height:0,ascent:0,elementList:[],startIndex:0,rowIndex:0,rowFlex:n?.[0]?.rowFlex||n?.[1]?.rowFlex});let F=s,N=a,V=0,Y,E=0,W=0;for(let X=0;X<n.length;X++){const O=C[C.length-1],M=n[X];this.clearElementEffect(M);const b=this.getElementRowMargin(M),y={width:0,height:0,boundingBoxAscent:0,boundingBoxDescent:0},D=O.offsetX||M.listId&&P.get(M.listId)||0,U=e-D,Q=O.elementList.length===1;if(F+=Q?D:0,N+=Q&&O.offsetY||0,(M.control?.type===l.ControlType.TEXTFIELD||M.control?.type===l.ControlType.TEXT)&&!this.isDesignMode()&&(M.controlComponent===l.ControlComponent.PRETEXTFIX||M.controlComponent===l.ControlComponent.PRETEXTFIX_TEXT||M.controlComponent===l.ControlComponent.POSTTEXTFIX||M.controlComponent===l.ControlComponent.POSTTEXTFIX_TEXT||M.controlComponent===l.ControlComponent.TEXTFIXLABEL||M.controlComponent===l.ControlComponent.PLACEHOLDER||M.controlComponent===l.ControlComponent.PREFIX||M.controlComponent===l.ControlComponent.POSTFIX)){const K=M.control?.type===l.ControlType.TEXTFIELD,v=M.controlId,w=!!v&&!!S?.has(v);K?this.mode===l.EditorMode.EDIT?M.hide=!1:M.hide=!0:this.mode===l.EditorMode.EDIT?M.hide=!1:this.mode===l.EditorMode.FORM?M.controlComponent===l.ControlComponent.PLACEHOLDER||M.controlComponent===l.ControlComponent.TEXTFIXLABEL?M.hide=w:M.hide=!1:M.hide=!0}if(_t(M)&&!this.isDesignMode()){const K=O.elementList[O.elementList.length-1];y.height=K?.metrics.height||this.options.defaultSize*h,y.boundingBoxAscent=K?.metrics.boundingBoxAscent||0,y.boundingBoxDescent=K?.metrics.boundingBoxDescent||0}else if(M.type===l.ElementType.IMAGE||M.type===l.ElementType.LATEX)if(M.imgDisplay===l.ImageDisplay.SURROUND||M.imgDisplay===l.ImageDisplay.FLOAT_TOP||M.imgDisplay===l.ImageDisplay.FLOAT_BOTTOM)y.width=0,y.height=0,y.boundingBoxDescent=0;else{const K=M.width*h,v=M.height*h;if(K>U){const w=v*U/K;M.width=U/h,M.height=w/h,y.width=U,y.height=w,y.boundingBoxDescent=w}else y.width=K,y.height=v,y.boundingBoxDescent=v;if(M.imgCaption?.value){const w=M.imgCaption.size||g.size,Z=M.imgCaption.top??g.top,J=(w+Z)*h;y.boundingBoxAscent+=J}}else if(M.type===l.ElementType.TABLE){const K=M.tdPadding||f;if(M.pagingId){let x=X+1,A=0;for(;x<n.length;){const $=n[x];if($.pagingId===M.pagingId){const B=$.trList.filter(pt=>!pt.pagingRepeat).filter(pt=>(pt.tdList=pt.tdList.filter(Xt=>{if(Xt.originalId){for(let Lt=0;Lt<M.trList.length;Lt++){const yt=M.trList[Lt],Yt=yt.tdList.find(({id:St})=>St===Xt.originalId);if(Yt){Xt.value[0]?.type===l.ElementType.SPLIT_TAG&&Xt.value.splice(0,1),Yt.value.push(...Xt.value.map(St=>this.updateElementTableInfo(St,M,yt,Yt))),Yt.rowspan=Yt.originalRowspan??Yt.rowspan;break}}return!1}return!0}),!pt.originalId));M.trList.push(...B),M.height+=$.height,x++,A++}else break}A&&n.splice(X+1,A)}M.pagingIndex=M.pagingIndex??0,this.tableParticle.computeTrHeight(M,x=>this.computeRowList({innerWidth:(x.width-(K[1]+K[3]))*h,elementList:x.value,isFromTable:!0,isPagingMode:i})),M.trList?.forEach(x=>{x.tdList.forEach(A=>{this.tdMap.set(A.id,A)})});const v=this.tableParticle.getTableHeight(M),w=this.tableParticle.getTableWidth(M);M.width=w,M.height=v;const Z=w*h,J=v*h;if(y.width=Z,y.height=J,y.boundingBoxDescent=J,y.boundingBoxAscent=-b,n[X+1]?.type===l.ElementType.TABLE&&(y.boundingBoxAscent-=b),i){const x=this.getHeight(),A=this.getMainOuterHeight();let $=A;for(let Lt=0;Lt<C.length;Lt++){const yt=C[Lt],Yt=yt.offsetY||0;yt.height+$+Yt>x||C[Lt-1]?.isPageBreak?$=A+yt.height+Yt:$+=yt.height+Yt}const B=b*2,pt=M.trList[0].height*h;($+pt+B>x||M.pagingIndex!==0&&M.trList[0].pagingRepeat||n[X-1]?.type===l.ElementType.PAGE_BREAK)&&($=A);let Xt=x-($+B);if(J>Xt){const Lt=M.trList;let yt=0,Yt=0,St=0;for(let Tt=0;Tt<Lt.length;Tt++){const Pt=Lt[Tt],Kt=Pt.height*h;if($+B+St+Kt>x){const Qt=Pt;let Ve=0;const qt={...at(Qt),id:lt(),originalId:Qt.originalId??Qt.id,minHeight:void 0,tdList:M.colgroup.map((mt,ie)=>{if(Ve--,Ve>0)return;const Ht=Qt.tdList.find(Ye=>Ye.colIndex===ie),Bt=Ht??this.tableParticle.findPreRowSpanTd(Lt,Tt,ie);Ht&&(Ve=Ht.colspan);const $e=lt();return Bt.originalRowspan=Bt.rowspan,Ht?{...Ht,id:$e,originalId:Ht.originalId??Ht.id,linkTdPrevId:Ht.id,tdIndex:ie,original:Bt}:{id:$e,originalId:Bt.originalId??Bt.id,linkTdPrevId:Bt.id,tdIndex:ie,colIndex:ie,colspan:1,rowspan:1,value:[],rowList:[],original:Bt}}).filter(mt=>!!mt)},de=qt.tdList,xt=de.map(mt=>mt.original);xt.forEach((mt,ie)=>{const Ht=[];let Bt=Xt;if(mt.rowspan>1){const Ye=Lt.slice(mt.trIndex,mt.trIndex+Tt-mt.trIndex);Bt+=Ye.reduce((Pf,Mf)=>Mf.height*h+Pf,0)}for(;mt.mainHeight*h>Bt&&mt.rowList?.length;){const Ye=mt.rowList.pop();mt.value.splice(mt.value.length-Ye.elementList.length),Ht.unshift(Ye),mt.mainHeight-=Ye.height}const $e=de[ie];$e.rowList=Ht,$e.value=Ht.map(Ye=>Ye.elementList).flat()});let Me=!0;const Xi=Qt.tdList.some(mt=>mt.rowList?.length),Dr=qt.tdList.some(mt=>mt.rowList?.length),Ni=Qt.minHeight>Xt;if(Dr||Ni){(Xi||!Dr&&Ni)&&(Ni&&(Qt.originalMinHeight=Qt.minHeight,Qt.minHeight=Xt,qt.minHeight=Math.max(Qt.originalMinHeight-Xt,T)),qt.tdList.forEach(mt=>{mt.original.linkTdNextId=mt.id,mt.value.length&&mt.value[0].value!==_&&mt.value.unshift({...mt.original.value.slice(-1).pop(),value:_,type:l.ElementType.SPLIT_TAG})}),Lt.splice(yt+1,0,qt),yt+=1,Yt=Lt.length-yt,Me=!1),xt.forEach(mt=>{if(mt.rowspan>1){const ie=mt.rowspan-(Tt-mt.trIndex);mt.rowspan=Tt-mt.trIndex+(Xi?1:0);const Ht=qt.tdList.find(Bt=>Bt.colIndex===mt.colIndex);Xi?Ht.rowspan=ie:(Ht.original.linkTdNextId=Ht.id,Qt.tdList.push({...mt,...Ht,rowspan:ie}),Qt.tdList.sort((Bt,$e)=>Bt.colIndex-$e.colIndex),Ht.value=[])}}),Me&&xt.forEach((mt,ie)=>{mt.value.push(...de[ie].value)});break}}yt=Tt+1,Yt=Lt.length-yt,St+=Kt,Xt-=Kt}if(Yt){const Tt=Lt.splice(yt,Yt),Pt=M.pagingId||lt();M.pagingId=Pt;const Kt=at(M);Kt.originalId=M.originalId??M.id,Kt.pagingId=Pt,Kt.pagingIndex=M.pagingIndex+1;const Qt=Lt.filter(de=>de.pagingRepeat);if(Qt.length){const de=at(Qt);de.forEach(xt=>xt.id=lt()),Tt.unshift(...de)}Kt.trList=Tt,Kt.id=lt(),Kt.trList?.forEach(de=>{de.tdList.forEach(xt=>{if(delete xt.valueStartIndex,xt.linkTdPrevId){const Me=this.getTdById(xt.linkTdPrevId);xt.valueStartIndex=Me?(Me.valueStartIndex??0)+Me.value.length:0,this.splitTdValueMap.has(xt.originalId)?this.splitTdValueMap.get(xt.originalId).push(...xt.value):Me&&this.splitTdValueMap.set(xt.originalId,[...Me.value,...xt.value])}xt.value.forEach(Me=>this.updateElementTableInfo(Me,Kt,de,xt))})}),this.spliceElementList(n,X+1,0,[Kt]),this.tableParticle.computeTrHeight(M);const Ve=this.tableParticle.getTableHeight(M),qt=Ve*h;M.height=Ve,y.height=qt,y.boundingBoxDescent=qt}}if(M.pagingId){const Lt=this.position.getPositionContext();if(Lt.isTable){let yt=-1,Yt=-1,St=X;for(;St<n.length;){const Tt=n[St];if(Tt.pagingId!==M.pagingId)break;const Pt=Tt.trList.findIndex(Kt=>Kt.id===Lt.trId);if(~Pt){yt=St,Yt=Pt;break}St++}~yt&&(Lt.index=yt,Lt.trIndex=Yt,this.position.setPositionContext(Lt))}}}this.initTableElementIndex(M,X)}else if(M.type===l.ElementType.SEPARATOR){const{separator:{lineWidth:K}}=this.options,v=M.lineWidth||K;M.width=U/h,y.width=U,y.height=v*h,y.boundingBoxAscent=-b,y.boundingBoxDescent=-b+y.height}else if(M.type===l.ElementType.PAGE_BREAK)M.width=U/h,y.width=U,y.height=R;else if(M.type===l.ElementType.RADIO||M.controlComponent===l.ControlComponent.RADIO){const{width:K,height:v,gap:w}=this.options.radio,Z=K+w*2;M.width=Z,y.width=Z*h,y.height=v*h}else if(M.type===l.ElementType.CHECKBOX||M.controlComponent===l.ControlComponent.CHECKBOX){const{width:K,height:v,gap:w}=this.options.checkbox,Z=K+w*2;M.width=Z,y.width=Z*h,y.height=v*h}else if(M.type===l.ElementType.MENSTRUAL_HISTORY){const K=this.menstrualHistoryParticle.computeSize(M);M.width=K.width/h,y.width=K.width,y.height=K.height,y.boundingBoxAscent=K.height,y.boundingBoxDescent=0}else if(M.type===l.ElementType.FETAL_HEART_POSITION){const K=this.fetalHeartPositionParticle.computeSize();M.width=K.width/h,y.width=K.width,y.height=K.height,y.boundingBoxAscent=K.height/2,y.boundingBoxDescent=K.height/2}else if(M.type===l.ElementType.TOOTH_POSITION){const K=this.toothPositionParticle.computeSize(M);M.width=K.width/h,y.width=K.width,y.height=K.height,y.boundingBoxAscent=K.height/2,y.boundingBoxDescent=K.height/2}else if(M.type===l.ElementType.TAB)y.width=m*h,y.height=R*h,y.boundingBoxDescent=0,y.boundingBoxAscent=this.textParticle.getBasisWordBoundingBoxAscent(L,L.font);else if(M.type===l.ElementType.BLOCK){if(!M.width)y.width=U;else{const K=M.width*h;y.width=Math.min(K,U)}y.height=M.height*h,y.boundingBoxDescent=y.height,y.boundingBoxAscent=0}else if(M.type===l.ElementType.LABEL){const{defaultSize:K,label:{defaultPadding:v}}=this.options;L.font=this.getElementFont(M);const w=this.textParticle.measureText(L,M);y.width=(w.width+v[1]+v[3])*h,y.height=(M.size||K)*h,y.boundingBoxDescent=0,y.boundingBoxAscent=(v[0]+w.actualBoundingBoxAscent)*h}else if(M.type===l.ElementType.MACRO||M.type===l.ElementType.CUSTOM_MACRO||M.type===l.ElementType.REUSABLE_ITEM||M.type===l.ElementType.SUB_TEMPLATE){const{defaultSize:K}=this.options;L.font=this.getElementFont(M);const v=this.getMode(),w=v===l.EditorMode.EDIT,Z=v===l.EditorMode.FORM;if(w){const J=M.label||M.value||"";L.font=this.getElementFont(M);const x=L.measureText(J),A=8*h,$=4*h;y.width=x.width+A*2;const B=x.actualBoundingBoxAscent+x.actualBoundingBoxDescent;y.height=B+$*2;const pt=this.textParticle.measureBasisWord(L,this.getElementFont(M));y.boundingBoxAscent=pt.actualBoundingBoxAscent*h,y.boundingBoxDescent=pt.actualBoundingBoxDescent*h}else if(M.type===l.ElementType.CUSTOM_MACRO){const J=M.macroConfig,x=J?.value||"";if(Z){const A=J?.type||"text",$=this.textParticle.measureText(L,M),B=M.label||"";if(A==="select"){const pt=x||`请选择${B}`,Xt=L.measureText(pt),Lt=L.measureText("[").width,yt=6*h+2*h;y.width=Lt+Xt.width+yt+Lt}else{const pt=x||`请输入${B}`,Xt=L.measureText(pt),Lt=L.measureText("[").width;y.width=Lt+Xt.width+Lt}y.height=(M.size||K)*h,y.boundingBoxDescent=$.actualBoundingBoxDescent*h,y.boundingBoxAscent=$.actualBoundingBoxAscent*h}else{const A=M.label||"",$=x||`请输入${A}`,B=L.measureText($);y.width=B.width,y.height=(M.size||K)*h,y.boundingBoxDescent=B.actualBoundingBoxDescent,y.boundingBoxAscent=B.actualBoundingBoxAscent}}else if(M.type===l.ElementType.REUSABLE_ITEM){const x=M.reusableItemConfig?.value||"",A=M.label||"";if(Z){const $=this.textParticle.measureText(L,M),B=x||`获取 ${A}`,pt=L.measureText(B),Xt=L.measureText("[").width;y.width=Xt+pt.width+Xt,y.height=(M.size||K)*h,y.boundingBoxDescent=$.actualBoundingBoxDescent*h,y.boundingBoxAscent=$.actualBoundingBoxAscent*h}else{const $=x||`获取 ${A}`,B=L.measureText($);y.width=B.width,y.height=(M.size||K)*h,y.boundingBoxDescent=B.actualBoundingBoxDescent,y.boundingBoxAscent=B.actualBoundingBoxAscent}}else if(M.type===l.ElementType.SUB_TEMPLATE){const J=M.label||"子模板";if(Z){const x=L.measureText(J),A=8*h,$=4*h,B=x.actualBoundingBoxAscent+x.actualBoundingBoxDescent;y.width=x.width+A*2,y.height=B+$*2;const pt=this.textParticle.measureBasisWord(L,this.getElementFont(M));y.boundingBoxAscent=pt.actualBoundingBoxAscent*h,y.boundingBoxDescent=pt.actualBoundingBoxDescent*h}else{const x=L.measureText(J);y.width=x.width,y.height=(M.size||K)*h,y.boundingBoxDescent=x.actualBoundingBoxDescent,y.boundingBoxAscent=x.actualBoundingBoxAscent}}else{const J=M.label||"",x=M.value||`获取 ${J}`,A=L.measureText(x);y.width=A.width,y.height=(M.size||K)*h,y.boundingBoxDescent=A.actualBoundingBoxDescent,y.boundingBoxAscent=A.actualBoundingBoxAscent}}else{const K=M.size||R;(M.type===l.ElementType.SUPERSCRIPT||M.type===l.ElementType.SUBSCRIPT)&&(M.actualSize=Math.ceil(K*.6)),y.height=(M.actualSize||K)*h,L.font=this.getElementFont(M);const v=this.textParticle.measureText(L,M);y.width=v.width*h,M.letterSpacing&&(y.width+=M.letterSpacing*h);const w=this.textParticle.measureBasisWord(L,M.font);y.boundingBoxAscent=w.actualBoundingBoxAscent*h,y.boundingBoxDescent=w.actualBoundingBoxDescent*h,M.type===l.ElementType.SUPERSCRIPT?y.boundingBoxAscent+=y.height/2:M.type===l.ElementType.SUBSCRIPT&&(y.boundingBoxDescent+=y.height/2)}const G=!_t(M)&&(M.imgDisplay!==l.ImageDisplay.INLINE&&M.type===l.ElementType.IMAGE||M.type===l.ElementType.LATEX)?y.height+b:y.boundingBoxAscent+b,H=b+y.boundingBoxAscent+y.boundingBoxDescent+b,tt=Object.assign(M,{metrics:y,left:0,style:this.getElementFont(M,h)});tt.control?.minWidth&&(tt.controlComponent&&(W+=y.width),tt.controlComponent===l.ControlComponent.POSTFIX&&(this.control.setMinWidthControlInfo({row:O,rowElement:tt,availableWidth:U,controlRealWidth:W}),W=0));const st=n[X-1];let et=n[X+1],nt=O.width+y.width;if(this.options.wordBreak===l.WordBreak.BREAK_WORD&&(!st?.type||st?.type===l.ElementType.TEXT)&&(!M.type||M.type===l.ElementType.TEXT)){const K=`${st?.value||""}${M.value}`;if(this.WORD_LIKE_REG.test(K)){const{width:w,endElement:Z}=this.textParticle.measureWord(L,n,X),J=w*h;Z&&J<=U?(nt+=J,et=Z):st&&(nt+=J)}const v=this.textParticle.measurePunctuationWidth(L,et);nt+=v*h}M.listId&&(M.listId!==Y?E=0:M.value===_&&!M.listWrap&&E++),Y=M.listId;const q=this.position.setSurroundPosition({pageNo:V,rowElement:tt,row:O,rowElementRect:{x:F,y:N,height:H,width:y.width},availableWidth:U,surroundElementList:u});F=q.x,nt+=q.rowIncreaseWidth,F+=y.width;let dt=!1;if(this.mode===l.EditorMode.FORM&&M.control?.type===l.ControlType.BUTTON&&M.controlComponent===l.ControlComponent.PREFIX&&O.elementList.filter(K=>K.controlId!==M.controlId).length>0){const K=M.controlId;if(n.some(w=>w.controlId===`${K}_text`&&w.control?.type===l.ControlType.BUTTON)){let w=0;for(let Z=X;Z<n.length;Z++){const J=n[Z];if(J.controlId!==K)break;L.font=this.getElementFont(J);const x=this.textParticle.measureText(L,J);if(w+=x.width*h,J.controlComponent===l.ControlComponent.POSTFIX)break}for(let Z=0;Z<n.length;Z++){const J=n[Z];if(J.controlId===`${K}_text`){L.font=this.getElementFont(J);const x=this.textParticle.measureText(L,J);w+=x.width*h}}dt=O.width+w>U}}const ot=M.type===l.ElementType.SEPARATOR||M.type===l.ElementType.TABLE||st?.type===l.ElementType.TABLE||st?.type===l.ElementType.BLOCK||M.type===l.ElementType.BLOCK||st?.imgDisplay===l.ImageDisplay.INLINE||M.imgDisplay===l.ImageDisplay.INLINE||st?.listId!==M.listId||st?.areaId!==M.areaId&&!M.area?.hide||M.control?.flexDirection===l.FlexDirection.COLUMN&&(M.controlComponent===l.ControlComponent.CHECKBOX||M.controlComponent===l.ControlComponent.RADIO)&&st?.controlComponent===l.ControlComponent.VALUE||X!==0&&M.value===_&&!M.area?.hide||dt,ut=nt>U,ht=ot||ut;if(ht){const K={width:y.width,height:H,startIndex:X,elementList:[tt],ascent:G,rowIndex:O.rowIndex+1,rowFlex:n[X]?.rowFlex||n[X+1]?.rowFlex,isPageBreak:M.type===l.ElementType.PAGE_BREAK};if(tt.controlComponent!==l.ControlComponent.PREFIX&&tt.control?.indentation===l.ControlIndentation.VALUE_START){const v=O.elementList.findIndex(w=>w.controlId===tt.controlId&&w.controlComponent!==l.ControlComponent.PREFIX);if(~v){const Z=this.position.computeRowPosition({row:O,innerWidth:this.getInnerWidth()})[v];Z&&(K.offsetX=Z.coordinate.leftTop[0])}}M.listId&&(K.isList=!0,K.offsetX=P.get(M.listId),K.listIndex=E),K.offsetY=!r&&M.area?.top&&M.areaId!==n[X-1]?.areaId?M.area.top*h:0,C.push(K)}else O.width+=y.width,X===0&&(on(n[1])||n[1]?.areaId)?(O.height=p,O.ascent=p):O.height<H&&(O.height=H,O.ascent=G),O.elementList.push(tt);if((ht||X===n.length-1)&&(O.isWidthNotEnough=ut&&!ot,!O.isSurround&&(st?.rowFlex===l.RowFlex.JUSTIFY||st?.rowFlex===l.RowFlex.ALIGNMENT&&O.isWidthNotEnough))){const K=O.elementList[0]?.value===_?O.elementList.slice(1):O.elementList,v=(U-O.width)/(K.length-1);for(let w=0;w<K.length-1;w++){const Z=K[w];Z.metrics.width+=v}O.width=U}if(ht){F=s,N+=O.height,i&&!r&&c&&(N-a+d+H>c||M.type===l.ElementType.PAGE_BREAK)&&(N=a,ea(u,V),V+=1),tt.left=0;const K=C[C.length-1];F=this.position.setSurroundPosition({pageNo:V,rowElement:tt,row:K,rowElementRect:{x:F,y:N,height:H,width:y.width},availableWidth:U,surroundElementList:u}).x,F+=y.width}}return C}_collectTextControlValueSet(t){if(this.isDesignMode()||this.mode===l.EditorMode.EDIT)return null;const e=new Set;for(let i=0;i<t.length;i++){const r=t[i];r.controlId&&(r.control?.type===l.ControlType.TEXT||r.control?.type===l.ControlType.TEXTFIELD)&&e.add(r.controlId)}const n=new Set;for(let i=0;i<t.length;i++){const r=t[i];r.controlId&&r.controlComponent===l.ControlComponent.VALUE&&e.has(r.controlId)&&n.add(r.controlId)}return n}_computePageList(){const t=[[]],{pageMode:e,pageNumber:{maxPageNo:n}}=this.options,i=this.getHeight(),r=this.getMainOuterHeight();let s=r,a=0;if(e===l.PageMode.CONTINUITY){t[0]=this.rowList,s+=this.rowList.reduce((R,h)=>R+h.height+(h.offsetY||0),0);const c=this.getPagePixelRatio(),d=this.pageList[0],u=Number(d.style.height.replace("px",""));if(s>u)d.style.height=`${s}px`,d.height=s*c;else{const R=s<i?i:s;d.style.height=`${R}px`,d.height=R*c}this._initPageContext(this.ctxList[0])}else for(let c=0;c<this.rowList.length;c++){const d=this.rowList[c],u=d.offsetY||0;if(d.height+u+s>i||this.rowList[c-1]?.isPageBreak){if(Number.isInteger(n)&&a>=n){this.elementList=this.elementList.slice(0,d.startIndex);break}s=r+d.height+u,t.push([d]),a++}else s+=d.height+u,t[a].push(d)}return t}_drawHighlight(t,e){const{rowList:n,positionList:i,elementList:r}=e,s=this.getDefaultBasicRowMarginHeight(),a=this.getHighlightMarginHeight();for(let c=0;c<n.length;c++){const d=n[c];for(let u=0;u<d.elementList.length;u++){const R=d.elementList[u],h=d.elementList[u-1],g=R.highlight||this.control.getControlHighlight(r,d.startIndex+u);if(g){h&&h.highlight&&h.highlight!==R.highlight&&this.highlight.render(t);const{coordinate:{leftTop:[f,T]}}=i[d.startIndex+u],m=R.left||0;this.highlight.recordFillInfo(t,f-m,T+s-a,R.metrics.width+m,d.height-2*s+2*a,g)}else h?.highlight&&this.highlight.render(t)}this.highlight.render(t)}}validateNumber(t){return/^\d+$/.test(t)}drawRow(t,e){this._drawHighlight(t,e);const{scale:n,table:{tdPadding:i},group:r,lineBreak:s,whiteSpace:a}=this.options,{rowList:c,pageNo:d,elementList:u,positionList:R,startIndex:h,zone:g,isDrawLineBreak:f=!s.disabled,td:T,isDrawWhiteSpace:m=!a.disabled}=e,p=this.isPrintMode(),I=this.isGraffitiMode(),{isCrossRowCol:L,tableId:P}=this.range.getRange();let C=h;for(let S=0;S<c.length;S++){const F=c[S],N={x:0,y:0,width:0,height:0};let V=null;for(let Y=0;Y<F.elementList.length;Y++){const E=F.elementList[Y],W=E.metrics,{ascent:X,coordinate:{leftTop:[O,M]}}=R[F.startIndex+Y],b=F.elementList[Y-1];if(_t(E)&&!this.isDesignMode())this.textParticle.complete();else if(E.type===l.ElementType.IMAGE)this.textParticle.complete(),E.imgDisplay!==l.ImageDisplay.SURROUND&&E.imgDisplay!==l.ImageDisplay.FLOAT_TOP&&E.imgDisplay!==l.ImageDisplay.FLOAT_BOTTOM&&this.imageParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.LATEX)this.textParticle.complete(),this.laTexParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.TABLE)L&&(N.x=O,N.y=M,V=E),this.tableParticle.render(t,E,O,M);else if(E.type===l.ElementType.HYPERLINK)this.textParticle.complete(),this.hyperlinkParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.LABEL)this.textParticle.complete(),this.labelParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.MACRO||E.type===l.ElementType.CUSTOM_MACRO||E.type===l.ElementType.REUSABLE_ITEM||E.type===l.ElementType.SUB_TEMPLATE)this.textParticle.complete(),this.macroParticle.render(t,E,O,M+X);else if(E.type===l.ElementType.DATE){const H=F.elementList[Y+1];(!b||b.dateId!==E.dateId)&&this.textParticle.complete(),this.textParticle.record(t,E,O,M+X),(!H||H.dateId!==E.dateId)&&this.textParticle.complete()}else E.type===l.ElementType.SUPERSCRIPT?(this.textParticle.complete(),this.superscriptParticle.render(t,E,O,M+X)):E.type===l.ElementType.SUBSCRIPT?(this.underline.render(t),this.textParticle.complete(),this.subscriptParticle.render(t,E,O,M+X)):E.type===l.ElementType.SEPARATOR?this.separatorParticle.render(t,E,O,M):E.type===l.ElementType.PAGE_BREAK?this.mode!==l.EditorMode.CLEAN&&!p&&this.pageBreakParticle.render(t,E,O,M):E.type===l.ElementType.CHECKBOX||E.controlComponent===l.ControlComponent.CHECKBOX?(this.textParticle.complete(),this.checkboxParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F})):E.type===l.ElementType.RADIO||E.controlComponent===l.ControlComponent.RADIO?(this.textParticle.complete(),this.radioParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F})):E.type===l.ElementType.MENSTRUAL_HISTORY?(this.textParticle.complete(),this.menstrualHistoryParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F,element:E})):E.type===l.ElementType.FETAL_HEART_POSITION?(this.textParticle.complete(),this.fetalHeartPositionParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F,element:E})):E.type===l.ElementType.TOOTH_POSITION?(this.textParticle.complete(),this.toothPositionParticle.render({ctx:t,x:O,y:M+X,index:Y,row:F,element:E})):E.type===l.ElementType.TAB?this.textParticle.complete():E.rowFlex===l.RowFlex.ALIGNMENT||E.rowFlex===l.RowFlex.JUSTIFY?(this.textParticle.record(t,E,O,M+X),this.textParticle.complete()):E.type===l.ElementType.BLOCK?(this.textParticle.complete(),this.blockParticle.render(t,d,E,O,M+X)):(E.left&&this.textParticle.complete(),this.textParticle.record(t,E,O,M+X),(E.width||E.letterSpacing||Kr.test(E.value))&&this.textParticle.complete());if(f&&!p&&this.mode!==l.EditorMode.CLEAN&&!F.isWidthNotEnough&&Y===F.elementList.length-1&&this.lineBreakParticle.render(t,E,O,M+F.height/2),m&&_r.test(E.value)&&this.whiteSpaceParticle.render(t,E,O,M+F.height/2),E.control?.border){b?.control?.border&&b.controlId!==E.controlId&&this.control.drawBorder(t);const H=this.getElementRowMargin(E);this.control.recordBorderInfo(O,M+H,E.metrics.width,F.height-2*H)}else b?.control?.border&&this.control.drawBorder(t);if(E.control?.type===l.ControlType.TEXT){const H=E.controlComponent===l.ControlComponent.VALUE,tt=E.controlComponent===l.ControlComponent.POSTFIX||E.controlComponent===l.ControlComponent.POST_TEXT;H&&E.control?.underline&&((!b||b.controlId!==E.controlId||b.controlComponent!==l.ControlComponent.VALUE&&b.controlComponent!==l.ControlComponent.PLACEHOLDER)&&this.control.startTextFieldUnderline(E.controlId,O,M+F.height),this.control.recordTextFieldUnderlineWidth(E.metrics.width)),tt&&this.control.drawTextFieldUnderline(t)}else b?.control?.type===l.ControlType.TEXT&&this.control.drawTextFieldUnderline(t);if((E.underline||E.control?.underline)&&E.controlComponent!==l.ControlComponent.PLACEHOLDER&&!(E.control?.type===l.ControlType.TEXT&&E.control?.underline)){b?.type===l.ElementType.SUBSCRIPT&&E.type!==l.ElementType.SUBSCRIPT&&this.underline.render(t);const H=this.getElementRowMargin(E),tt=E.left||0;let st=0;E.type===l.ElementType.SUBSCRIPT&&(st=this.subscriptParticle.getOffsetY(E));const et=E.control?.underline?this.options.underlineColor:E.color;this.underline.recordFillInfo(t,O-tt,M+F.height-H+st,W.width+tt,0,et,E.textDecoration?.style)}else(b?.underline||b?.control?.underline)&&(b?.control?.type===l.ControlType.TEXT&&b?.control?.underline||this.underline.render(t));if(E.strikeout){if(!E.type||zt.includes(E.type)){b&&(b.type===l.ElementType.SUBSCRIPT&&E.type!==l.ElementType.SUBSCRIPT||b.type===l.ElementType.SUPERSCRIPT&&E.type!==l.ElementType.SUPERSCRIPT||this.getElementSize(b)!==this.getElementSize(E))&&this.strikeout.render(t);const H=this.textParticle.measureBasisWord(t,this.getElementFont(E));let tt=M+X+H.actualBoundingBoxDescent*n-W.height/2;E.type===l.ElementType.SUBSCRIPT?tt+=this.subscriptParticle.getOffsetY(E):E.type===l.ElementType.SUPERSCRIPT&&(tt+=this.superscriptParticle.getOffsetY(E)),this.strikeout.recordFillInfo(t,O,tt,W.width)}}else b?.strikeout&&this.strikeout.render(t);const{zone:y,splitTdRange:D}=this.range.getRange();let{startIndex:U,endIndex:Q}=this.range.getRange(),G=!1;if(T&&D&&[T.originalId,T.id].includes(D.originalId)&&(G=!0,U=D.startIndex-(T.valueStartIndex??0),Q=D.endIndex-(T.valueStartIndex??0)),y===g&&U!==Q&&U<=C&&C<=Q){const H=this.position.getPositionContext();if(!H.isTable&&!E.tdId||H.tdId===E.tdId||G)if(U===C){const tt=u[U+1];tt&&tt.value===_&&(N.x=O+W.width,N.y=M,N.height=F.height,N.width+=this.options.rangeMinWidth)}else{let tt=W.width;tt===0&&F.elementList.length===1&&(tt=this.options.rangeMinWidth),N.width||(N.x=O,N.y=M,N.height=F.height),N.width+=tt}}if(!r.disabled&&E.groupIds&&this.group.recordFillInfo(E,O,M,W.width,F.height),C++,E.type===l.ElementType.TABLE&&!_t(E)){const H=E.tdPadding||i,tt=H[1]+H[3];for(let st=0;st<E.trList.length;st++){const et=E.trList[st];for(let nt=0;nt<et.tdList.length;nt++){const q=et.tdList[nt];this.drawRow(t,{elementList:q.value,positionList:q.positionList,rowList:q.rowList,pageNo:d,startIndex:0,innerWidth:(q.width-tt)*n,zone:g,isDrawLineBreak:f,td:q})}}}}if(F.isList&&this.listParticle.drawListStyle(t,F,R[F.startIndex]),this.textParticle.complete(),this.control.drawBorder(t),this.underline.render(t),this.strikeout.render(t),this.group.render(t),!p&&!I){if(N.width&&N.height){const{x:Y,y:E,width:W,height:X}=N;this.range.render(t,Y,E,W,X)}if(L&&V&&V.id===P){const{coordinate:{leftTop:[Y,E]}}=R[F.startIndex];this.tableParticle.drawRange(t,V,Y,E)}}}}_drawFloat(t,e){const{scale:n}=this.options,i=this.position.getFloatPositionList(),{imgDisplays:r,pageNo:s}=e;for(let a=0;a<i.length;a++){const c=i[a],d=c.element;if((s===c.pageNo||c.zone===l.EditorZone.HEADER||c.zone==l.EditorZone.FOOTER)&&d.imgDisplay&&r.includes(d.imgDisplay)&&d.type===l.ElementType.IMAGE){const u=d.imgFloatPosition;this.imageParticle.render(t,d,u.x*n,u.y*n)}}}_clearPage(t){const e=this.ctxList[t],n=this.pageList[t];e.clearRect(0,0,Math.max(n.width,this.getWidth()),Math.max(n.height,this.getHeight())),this.blockParticle.clear()}_drawPage(t){const{elementList:e,positionList:n,rowList:i,pageNo:r}=t,{inactiveAlpha:s,pageMode:a,header:c,footer:d,pageNumber:u,lineNumber:R,pageBorder:h}=this.options,g=this.mode===l.EditorMode.PRINT,f=this.getInnerWidth(),T=this.ctxList[r];T.globalAlpha=this.zone.isMainActive()?1:s,this._clearPage(r),(!g||!this.options.modeRule[l.EditorMode.PRINT]?.backgroundDisabled)&&this.background.render(T,r),g||this.area.render(T,r),a!==l.PageMode.CONTINUITY&&this.options.watermark.data&&this.waterMark.render(T,r),g||this.margin.render(T,r),this._drawFloat(T,{pageNo:r,imgDisplays:[l.ImageDisplay.FLOAT_BOTTOM]}),g||this.control.renderHighlightList(T,r);const m=i[0]?.startIndex;this.drawRow(T,{elementList:e,positionList:n,rowList:i,pageNo:r,startIndex:m,innerWidth:f,zone:l.EditorZone.MAIN}),this.getIsPagingMode()&&(c.disabled||this.header.render(T,r),u.disabled||this.pageNumber.render(T,r),d.disabled||this.footer.render(T,r)),this._drawFloat(T,{pageNo:r,imgDisplays:[l.ImageDisplay.FLOAT_TOP,l.ImageDisplay.SURROUND]}),!g&&this.search.getSearchKeyword()&&this.search.render(T,r),this.elementList.length<=1&&!this.elementList[0]?.listId&&this.placeholder.render(T),R.disabled||this.lineNumber.render(T,r),h.disabled||this.pageBorder.render(T),this.badge.render(T,r),this.isGraffitiMode()&&this.graffiti.render(T,r)}_disconnectLazyRender(){this.lazyRenderIntersectionObserver?.disconnect()}_lazyRender(){const t=this.position.getOriginalMainPositionList(),e=this.getOriginalMainElementList();this._disconnectLazyRender(),this.lazyRenderIntersectionObserver=new IntersectionObserver(n=>{n.forEach(i=>{if(i.isIntersecting){const r=Number(i.target.dataset.index);this._drawPage({elementList:e,positionList:t,rowList:this.pageRowList[r],pageNo:r})}})}),this.pageList.forEach(n=>{this.lazyRenderIntersectionObserver.observe(n)})}_immediateRender(){const t=this.position.getOriginalMainPositionList(),e=this.getOriginalMainElementList();for(let n=0;n<this.pageRowList.length;n++)this._drawPage({elementList:e,positionList:t,rowList:this.pageRowList[n],pageNo:n})}render(t){const e=Vt(),n=[],i=(O,M)=>{n.push({label:O,duration:Vt()-M})};this.renderCount++;const r=this.mode===l.EditorMode.EDIT||this.mode===l.EditorMode.FORM||this.mode===l.EditorMode.PRINT?Oh([...this.getHeaderElementList(),...this.elementList,...this.getFooterElementList()]):null,s=this.applySubTemplateRuntimeState(this.getHeaderElementList(),r)||this.applySubTemplateRuntimeState(this.elementList,r)||this.applySubTemplateRuntimeState(this.getFooterElementList(),r);let{endIndex:a}=this.range.getRange();const{isCrossRowCol:c}=this.range.getRange();if(!c&&~a){const O=this.getElementList(),M=O[a],y=M?.type===l.ElementType.SUB_TEMPLATE&&M.subTemplateExpanded?l.LocationPosition.AFTER:l.LocationPosition.BEFORE,D=sn(O,a,y);D!==a&&!_t(O[D])&&(this.range.setRange(D,D),a=D)}let d;const u=this.position.getPositionContext();if(c)d=this.getOriginalElementList()[u.index];else{const O=~a?a:0,M=this.getElementList();d=tn(M,O)}const{header:R,footer:h}=this.options,{isSubmitHistory:g=!0,isSetCursor:f=!0,isLazy:T=!0,isInit:m=!1,isSourceHistory:p=!1,isFirstRender:I=!1,isDel:L=!1}=t||{};let{isCompute:P=!0}=t||{};s&&(P=!0);let{curIndex:C}=t||{};const{traceLabel:S}=t||{},F=this.getInnerWidth(),N=this.getIsPagingMode(),V=this.pageRowList.length;if(P){if(this.splitTdValueMap.clear(),this.tdMap.clear(),this.position.setFloatPositionList([]),N){if(!R.disabled){const et=Vt();this.header.compute(),i("header.compute",et)}if(!h.disabled){const et=Vt();this.footer.compute(),i("footer.compute",et)}}const O=this.getMargins(),M=this.getHeight(),b=this.header.getExtraHeight(),y=this.getMainOuterHeight(),D=O[3],U=O[0]+b,Q=Zo(this.elementList),G=Vt();this.rowList=this.computeRowList({startX:D,startY:U,pageHeight:M,mainOuterHeight:y,isPagingMode:N,innerWidth:F,surroundElementList:Q,elementList:this.elementList}),i("computeRowList",G);const H=Vt();this.pageRowList=this._computePageList(),i("computePageList",H);const tt=Vt();this.position.computePositionList(),i("computePositionList",tt);const st=Vt();if(this.area.compute(),i("area.compute",st),!this.isPrintMode()){const et=this.search.getSearchKeyword();if(et){const q=Vt();this.search.compute(et),i("search.compute",q)}const nt=Vt();this.control.computeHighlightList(),i("control.computeHighlightList",nt)}if(this.isGraffitiMode()){const et=Vt();this.graffiti.compute(),i("graffiti.compute",et)}}this.imageObserver.clearAll(),this.cursor.recoveryCursor();for(let O=0;O<this.pageRowList.length;O++)this.pageList[O]||this._createPage(O);const Y=this.pageRowList.length,E=this.pageList.length;if(E>Y){const O=E-Y;this.ctxList.splice(Y,O),this.pageList.splice(Y,O).forEach(M=>M.remove())}const W=Vt();if(T&&N?this._lazyRender():this._immediateRender(),i(T&&N?"lazyRender":"immediateRender",W),f){if(P&&d?.tableId){const{index:O}=u,b=this.getOriginalElementList()[O];if(d.tableId!==b?.id){const D=this.findTableChildrenElement(!0,d.tableId,d);D&&u.index!==D.originalIndex&&(u.index=D.originalIndex,u.tableId=D.table.id,u.trIndex=D.trIndex,u.trId=D.tr.id,u.tdIndex=D.tdIndex,u.tdId=D.td.id,C=D.elementIndex,this.position.setPositionContext(u),this.range.setRange(C,C),this.updateTableTool())}const y=this.getElementList();y[a]!==d&&(C=y.findIndex(D=>D===d))}C=this.setCursor(C)}else this.range.getIsSelection()&&this.cursor.focus();if(L){let O;const M=this.position.getPositionContext();O=this.range.getRange().startIndex-1,M.index=O}(g&&!I||C!==void 0&&this.historyManager.isStackEmpty())&&this.submitHistory(C);const X=Vt();Co(()=>{const O=Vt();this.range.setRangeStyle(),P&&this.control.getActiveControl()&&this.control.reAwakeControl(),P&&!this.isReadonly()&&this.getMode()!==l.EditorMode.FORM&&u.isTable&&this.getOriginalElementList()[u.index].type===l.ElementType.TABLE&&this.tableTool.render(),P&&!this.zone.isMainActive()&&this.zone.drawZoneIndicator(),V!==this.pageRowList.length&&(this.listener.pageSizeChange&&this.listener.pageSizeChange(this.pageRowList.length),this.eventBus.isSubscribe("pageSizeChange")&&this.eventBus.emit("pageSizeChange",this.pageRowList.length)),(g||p)&&!m&&(this.listener.contentChange&&this.listener.contentChange(),this.eventBus.isSubscribe("contentChange")&&this.eventBus.emit("contentChange"));const M=Vt();So(this.options,S||"render",M-e,[...n,{label:"nextTick.wait",duration:O-X},{label:"nextTick.callback",duration:M-O}],{isCompute:P,pageCount:this.pageRowList.length})}),f&&this.fixPosition()}fixPosition(t=!1){let e;const n=this.position.getPositionContext();if(n.isTable){const i=this.getElementList(),r=this.range.getRange().startIndex;if(t||r>=i.length){const s=this.getTd(),a=n.index+(t?-1:1),d=this.getOriginalElementList()[a];if(!d?.trList)return;e=r-i.length;for(let u=0;u<d.trList.length;u++){const R=d.trList[u],h=R.tdList.find(g=>t?s?.linkTdPrevId===g.id:s?.id===g.linkTdPrevId);if(h){n.index=a,n.trIndex=u,n.tableId=d.id,n.trId=R.id,n.tdId=h?.id,e=t?h.value.length-1:e+(h.value[0]?.type===l.ElementType.SPLIT_TAG?1:0);break}}if(this.position.setPositionContext(n),this.range.setRange(e,e),this.setCursor(e),e===0)return this.fixPosition(t);this.updateTableTool()}}return e}setCursor(t){const e=this.position.getPositionContext(),n=this.position.getPositionList(),i=this.getElementList();if(e.isTable){const{index:s,trIndex:a,tdIndex:c}=e,u=this.getOriginalElementList()[s].trList?.[a].tdList[c].positionList;t===void 0&&u&&(t=u.length-1);const R=u?.[t];this.position.setCursorPosition(R||null)}else t!==void 0&&t>=n.length&&(t=n.length-1),this.position.setCursorPosition(t!==void 0&&t>=0?n[t]:null);let r=!0;if(t!==void 0&&e.isImage&&e.isDirectHit){const s=i[t];if(s&&cl.includes(s.type)){r=!1;const a=this.position.getCursorPosition();this.previewer.updateResizer(s,a)}}return this.cursor.drawCursor({isShow:r}),t}submitHistory(t){const e=this.position.getPositionContext(),n=wo(this.elementList),i=wo(this.header.getElementList()),r=wo(this.footer.getElementList()),s=at(this.range.getRange()),a=this.pageNo,c=at(e),d=this.zone.getZone();this.historyManager.execute(()=>{this.zone.setZone(d),this.setPageNo(a),this.position.setPositionContext(at(c)),this.header.setElementList(at(i)),this.footer.setElementList(at(r)),this.elementList=at(n),this.range.replaceRange(at(s)),this.render({curIndex:t,isSubmitHistory:!1,isSourceHistory:!0})})}destroy(){this.macroParticle.clearInlineEditor({isSubmitHistory:!1}),this.container.remove(),this.globalEvent.removeEvent(),this.scrollObserver.removeEvent(),this.selectionObserver.removeEvent()}clearSideEffect(){this.getMacroParticle().clearInlineEditor({isSubmitHistory:!1}),this.getPreviewer().clearResizer(),this.getTableTool().dispose(),this.getHyperlinkParticle().clearHyperlinkPopup(),this.getDateParticle().clearDatePicker()}updateTableTool(){if(this.getMode()===l.EditorMode.FORM){this.getTableTool().dispose();return}if(this.position.getPositionContext().isTable){const t=this.position.getPositionList();t.length&&(this.setPageNo(t[0].pageNo),this.getTableTool().render())}}initTableElementIndex(t,e){t.trList?.forEach((n,i)=>{n.tdList.forEach((r,s)=>{r.tableIndex=e,r.tableId=t.id,r.trIndex=i,r.trId=n.id,r.tdIndex=s,this.tdMap.set(r.id,r)})})}clearElementEffect(t){t.trList?.forEach(e=>{e.minHeight=e.originalMinHeight??e.minHeight,delete e.originalMinHeight,e.tdList.forEach(n=>{delete n.linkTdNextId})})}updateElementTableInfo(t,e,n,i){return t.tableId=e.id,t.trId=n.id,t.tdId=i.id,t}findTableChildrenElement(t,e,n){const i=this.position.getPositionContext(),{index:r}=i,s=this.getOriginalElementList();let a=r;t&&(a=r>s.length?s.length-1:r);for(let c=a;t?c>=0:c<s.length;t?c--:c++){const d=s[c];if(d&&[d.originalId,d.id].includes(e))for(const[u,R]of d.trList.entries())for(const[h,g]of R.tdList.entries()){const f=g.value.findIndex(typeof n=="function"?n:T=>T===n);if(f>=0)return{originalIndex:c,table:d,tr:R,trIndex:u,td:g,tdIndex:h,elementIndex:f}}}}getTdById(t){return this.tdMap.get(t)}getLinkTdPrevHasValue(t){const e=this.getTdById(t);if(e)return e.value.length?e:this.getLinkTdPrevHasValue(e.linkTdPrevId)}getFirstLinkTd(t){const e=this.getTdById(t);return e?.linkTdPrevId?this.getLastLinkTd(e.linkTdPrevId):e}getLastLinkTd(t){const e=this.getTdById(t);return e?.linkTdNextId?this.getLastLinkTd(e.linkTdNextId):e}removeLinkTd(t,e){const n=this.getTdById(e);if(n){if(n.linkTdPrevId){const i=this.getTdById(n.linkTdPrevId);i&&(delete i.linkTdNextId,this.removeLinkTd(t,n.linkTdPrevId))}if(n.linkTdNextId){const i=this.getTdById(n.linkTdNextId);i&&(delete i.linkTdPrevId,this.removeLinkTd(t,n.linkTdNextId))}t[n.tableIndex].trList[n.trIndex].tdList.splice(n.tdIndex,1),this.initTableElementIndex(t[n.tableIndex],n.tableIndex)}}removeLinkTdControl(t,e){const n=this.getTdById(t);if(n){for(let i=0;i<n.value.length;i++)n.value[i].control===e&&(n.value.splice(i,1),i--);n.linkTdNextId&&this.removeLinkTdControl(n.linkTdNextId,e)}}isSplitTd(t,e){return(!!t?.originalId||!!e?.originalId)&&(t?.originalId===e?.originalId||t?.id===e?.originalId||t?.originalId===e?.id)}getSplitTdValues(t){return this.splitTdValueMap.get(t)}removeSplitTdOtherRangeElements(){const{splitTdRange:t}=this.range.getRange();if(!t)return;const{startIndex:e,endIndex:n}=t;let i=this.getTd();if(i)if((i.valueStartIndex??0)>=e){let r=-1;for(;r<0;){const s=this.getTdById(i.linkTdPrevId);if(s){r=e-(s.valueStartIndex??0);const a=Math.max(0,r);this.spliceElementList(s.value,a+1,s.value.length-a-1),i=s}else r=0}}else{let r=1;for(;r>0;){const s=this.getTdById(i.linkTdNextId);if(s){const a=s.valueStartIndex??0;r=n-(a+s.value.length);const c=Math.min(s.value.length,n-a+1);this.spliceElementList(s.value,0,c),i=s}else r=0}}}getTablesByPagingId(t,e,n){const i=[],r=[];if(t[n].pagingId===e){i.push(n),r.push(t[n]);for(let s=n-1;s>=0&&t[s].pagingId===e;s--)r.unshift(t[s]),i.push(s);for(let s=n+1;s<t.length&&t[s].pagingId===e;s++)r.push(t[s]),i.push(s)}return{list:r,startIndex:i.sort()[0]}}}class yr{executeMode;executeCut;executeCopy;executePaste;executeSelectAll;executeBackspace;executeSetRange;executeReplaceRange;executeSetPositionContext;executeForceUpdate;executeBlur;executeHideCursor;executeUndo;executeRedo;executePainter;executeApplyPainterStyle;executeFormat;executeFont;executeButton;executeEditElementAttribute;executeTriggerControlEditAttribute;executeCopyControl;executePasteControl;executeSize;executeSizeAdd;executeSizeMinus;executeBold;executeItalic;executeUnderline;executeStrikeout;executeSuperscript;executeSubscript;executeColor;executeHighlight;executeTitle;executeList;executeRowFlex;executeVertical;executeRowMargin;executeInsertTable;executeInsertTableTopRow;executeInsertTableBottomRow;executeInsertTableLeftCol;executeInsertTableRightCol;executeDeleteTableRow;executeDeleteTableCol;executeDeleteTable;executeMergeTableCell;executeCancelMergeTableCell;executeSplitVerticalTableCell;executeSplitHorizontalTableCell;executeTableTdVerticalAlign;executeTableBorderType;executeTableBorderColor;executeTableTdBorderType;executeTableTdSlashType;executeTableTdBackgroundColor;executeTableSelectAll;executeTableProperties;executeImage;executeHyperlink;executeDeleteHyperlink;executeCancelHyperlink;executeEditHyperlink;executeSeparator;executePageBreak;executeAddWatermark;executeDeleteWatermark;executeSearch;executeSearchNavigatePre;executeSearchNavigateNext;executeReplace;executePrint;executeReplaceImageElement;executeSaveAsImageElement;executeSetImageCrop;executeSetImageCaption;executeChangeImageDisplay;executePageMode;executePageScale;executePageScaleRecovery;executePageScaleMinus;executePageScaleAdd;executePaperSize;executePaperDirection;executeSetPaperMargin;executeSetMainBadge;executeSetAreaBadge;executeInsertElementList;executeInsertArea;executeSetAreaValue;executeSetAreaProperties;executeLocationArea;executeClearGraffiti;executeAppendElementList;executeUpdateElementById;executeDeleteElementById;executeSetValue;executeRemoveControl;executeTranslate;executeSetLocale;executeLocationCatalog;executeWordTool;executeSetHTML;executeSetGroup;executeDeleteGroup;executeLocationGroup;executeSetZone;executeSetControlValue;executeSetControlValueList;executeSetControlExtension;executeSetControlExtensionList;executeSetControlProperties;executeSetControlPropertiesList;executeSetControlHighlight;executeLocationControl;executeInsertControl;executeInsertTextField;executeJumpControl;executeUpdateOptions;executeSetFormModeTrace;executeInsertTitle;executeFocus;executeComputeElementListHeight;getCatalog;getImage;getPageMode;getOptions;getValue;getValueAsync;getAreaValue;getHTML;getText;getWordCount;getCursorPosition;getRemainingContentHeight;getRange;getRangeText;getRangeContext;getRangeRow;getRangeParagraph;getKeywordRangeList;getKeywordContext;getPaperMargin;getSearchNavigateInfo;getLocale;getGroupIds;getControlValue;getControlList;getContainer;getTitleValue;getPositionContextByEvent;getElementById;getMacroValue;getMacroList;setMacroValue;setMacroValueList;updateMacroProperties;locationMacro;insertSubTemplate;updateSubTemplate;expandSubTemplate;collapseSubTemplate;toggleSubTemplate;constructor(t){this.executeMode=t.mode.bind(t),this.executeCut=t.cut.bind(t),this.executeCopy=t.copy.bind(t),this.executePaste=t.paste.bind(t),this.executeSelectAll=t.selectAll.bind(t),this.executeBackspace=t.backspace.bind(t),this.executeSetRange=t.setRange.bind(t),this.executeReplaceRange=t.replaceRange.bind(t),this.executeSetPositionContext=t.setPositionContext.bind(t),this.executeForceUpdate=t.forceUpdate.bind(t),this.executeBlur=t.blur.bind(t),this.executeHideCursor=t.hideCursor.bind(t),this.executeUndo=t.undo.bind(t),this.executeRedo=t.redo.bind(t),this.executePainter=t.painter.bind(t),this.executeApplyPainterStyle=t.applyPainterStyle.bind(t),this.executeFormat=t.format.bind(t),this.executeFont=t.font.bind(t),this.executeButton=t.buttonText.bind(t),this.executeEditElementAttribute=t.editElementAttribute.bind(t),this.executeTriggerControlEditAttribute=t.triggerControlEditAttribute.bind(t),this.executeCopyControl=t.copyControl.bind(t),this.executePasteControl=t.pasteControl.bind(t),this.executeSize=t.size.bind(t),this.executeSizeAdd=t.sizeAdd.bind(t),this.executeSizeMinus=t.sizeMinus.bind(t),this.executeBold=t.bold.bind(t),this.executeItalic=t.italic.bind(t),this.executeUnderline=t.underline.bind(t),this.executeStrikeout=t.strikeout.bind(t),this.executeSuperscript=t.superscript.bind(t),this.executeSubscript=t.subscript.bind(t),this.executeColor=t.color.bind(t),this.executeHighlight=t.highlight.bind(t),this.executeTitle=t.title.bind(t),this.executeList=t.list.bind(t),this.executeRowFlex=t.rowFlex.bind(t),this.executeVertical=t.vertical.bind(t),this.executeRowMargin=t.rowMargin.bind(t),this.executeInsertTable=t.insertTable.bind(t),this.executeInsertTableTopRow=t.insertTableTopRow.bind(t),this.executeInsertTableBottomRow=t.insertTableBottomRow.bind(t),this.executeInsertTableLeftCol=t.insertTableLeftCol.bind(t),this.executeInsertTableRightCol=t.insertTableRightCol.bind(t),this.executeDeleteTableRow=t.deleteTableRow.bind(t),this.executeDeleteTableCol=t.deleteTableCol.bind(t),this.executeDeleteTable=t.deleteTable.bind(t),this.executeMergeTableCell=t.mergeTableCell.bind(t),this.executeCancelMergeTableCell=t.cancelMergeTableCell.bind(t),this.executeSplitVerticalTableCell=t.splitVerticalTableCell.bind(t),this.executeSplitHorizontalTableCell=t.splitHorizontalTableCell.bind(t),this.executeTableTdVerticalAlign=t.tableTdVerticalAlign.bind(t),this.executeTableBorderType=t.tableBorderType.bind(t),this.executeTableBorderColor=t.tableBorderColor.bind(t),this.executeTableTdBorderType=t.tableTdBorderType.bind(t),this.executeTableTdSlashType=t.tableTdSlashType.bind(t),this.executeTableTdBackgroundColor=t.tableTdBackgroundColor.bind(t),this.executeTableSelectAll=t.tableSelectAll.bind(t),this.executeTableProperties=t.tableProperties.bind(t),this.executeImage=t.image.bind(t),this.executeHyperlink=t.hyperlink.bind(t),this.executeDeleteHyperlink=t.deleteHyperlink.bind(t),this.executeCancelHyperlink=t.cancelHyperlink.bind(t),this.executeEditHyperlink=t.editHyperlink.bind(t),this.executeSeparator=t.separator.bind(t),this.executePageBreak=t.pageBreak.bind(t),this.executeAddWatermark=t.addWatermark.bind(t),this.executeDeleteWatermark=t.deleteWatermark.bind(t),this.executeSearch=t.search.bind(t),this.executeSearchNavigatePre=t.searchNavigatePre.bind(t),this.executeSearchNavigateNext=t.searchNavigateNext.bind(t),this.executeReplace=t.replace.bind(t),this.executePrint=t.print.bind(t),this.executeReplaceImageElement=t.replaceImageElement.bind(t),this.executeSaveAsImageElement=t.saveAsImageElement.bind(t),this.executeSetImageCrop=t.setImageCrop.bind(t),this.executeSetImageCaption=t.setImageCaption.bind(t),this.executeChangeImageDisplay=t.changeImageDisplay.bind(t),this.executePageMode=t.pageMode.bind(t),this.executePageScale=t.pageScale.bind(t),this.executePageScaleRecovery=t.pageScaleRecovery.bind(t),this.executePageScaleMinus=t.pageScaleMinus.bind(t),this.executePageScaleAdd=t.pageScaleAdd.bind(t),this.executePaperSize=t.paperSize.bind(t),this.executePaperDirection=t.paperDirection.bind(t),this.executeSetPaperMargin=t.setPaperMargin.bind(t),this.executeSetMainBadge=t.setMainBadge.bind(t),this.executeSetAreaBadge=t.setAreaBadge.bind(t),this.getAreaValue=t.getAreaValue.bind(t),this.executeInsertArea=t.insertArea.bind(t),this.executeSetAreaValue=t.setAreaValue.bind(t),this.executeSetAreaProperties=t.setAreaProperties.bind(t),this.executeLocationArea=t.locationArea.bind(t),this.executeClearGraffiti=t.clearGraffiti.bind(t),this.executeInsertElementList=t.insertElementList.bind(t),this.executeAppendElementList=t.appendElementList.bind(t),this.executeUpdateElementById=t.updateElementById.bind(t),this.executeDeleteElementById=t.deleteElementById.bind(t),this.executeSetValue=t.setValue.bind(t),this.executeRemoveControl=t.removeControl.bind(t),this.executeTranslate=t.translate.bind(t),this.executeSetLocale=t.setLocale.bind(t),this.executeLocationCatalog=t.locationCatalog.bind(t),this.executeWordTool=t.wordTool.bind(t),this.executeSetHTML=t.setHTML.bind(t),this.executeSetGroup=t.setGroup.bind(t),this.executeDeleteGroup=t.deleteGroup.bind(t),this.executeLocationGroup=t.locationGroup.bind(t),this.executeSetZone=t.setZone.bind(t),this.executeUpdateOptions=t.updateOptions.bind(t),this.executeSetFormModeTrace=t.setFormModeTrace.bind(t),this.executeInsertTitle=t.insertTitle.bind(t),this.executeFocus=t.focus.bind(t),this.executeComputeElementListHeight=t.computeElementListHeight.bind(t),this.getImage=t.getImage.bind(t),this.getPageMode=t.getPageMode.bind(t),this.getOptions=t.getOptions.bind(t),this.getValue=t.getValue.bind(t),this.getValueAsync=t.getValueAsync.bind(t),this.getHTML=t.getHTML.bind(t),this.getText=t.getText.bind(t),this.getWordCount=t.getWordCount.bind(t),this.getCursorPosition=t.getCursorPosition.bind(t),this.getRemainingContentHeight=t.getRemainingContentHeight.bind(t),this.getRange=t.getRange.bind(t),this.getRangeText=t.getRangeText.bind(t),this.getRangeContext=t.getRangeContext.bind(t),this.getRangeRow=t.getRangeRow.bind(t),this.getRangeParagraph=t.getRangeParagraph.bind(t),this.getKeywordRangeList=t.getKeywordRangeList.bind(t),this.getKeywordContext=t.getKeywordContext.bind(t),this.getCatalog=t.getCatalog.bind(t),this.getPaperMargin=t.getPaperMargin.bind(t),this.getSearchNavigateInfo=t.getSearchNavigateInfo.bind(t),this.getLocale=t.getLocale.bind(t),this.getGroupIds=t.getGroupIds.bind(t),this.getContainer=t.getContainer.bind(t),this.getTitleValue=t.getTitleValue.bind(t),this.getPositionContextByEvent=t.getPositionContextByEvent.bind(t),this.getElementById=t.getElementById.bind(t),this.executeSetControlValue=t.setControlValue.bind(t),this.executeSetControlValueList=t.setControlValueList.bind(t),this.executeSetControlExtension=t.setControlExtension.bind(t),this.executeSetControlExtensionList=t.setControlExtensionList.bind(t),this.executeSetControlProperties=t.setControlProperties.bind(t),this.executeSetControlPropertiesList=t.setControlPropertiesList.bind(t),this.executeSetControlHighlight=t.setControlHighlight.bind(t),this.getControlValue=t.getControlValue.bind(t),this.getControlList=t.getControlList.bind(t),this.executeLocationControl=t.locationControl.bind(t),this.executeInsertControl=t.insertControl.bind(t),this.executeInsertTextField=t.insertTextField.bind(t),this.executeJumpControl=t.jumpControl.bind(t),this.getMacroValue=t.getMacroValue.bind(t),this.getMacroList=t.getMacroList.bind(t),this.setMacroValue=t.setMacroValue.bind(t),this.setMacroValueList=t.setMacroValueList.bind(t),this.updateMacroProperties=t.updateMacroProperties.bind(t),this.locationMacro=t.locationMacro.bind(t),this.insertSubTemplate=t.insertSubTemplate.bind(t),this.updateSubTemplate=t.updateSubTemplate.bind(t),this.expandSubTemplate=t.expandSubTemplate.bind(t),this.collapseSubTemplate=t.collapseSubTemplate.bind(t),this.toggleSubTemplate=t.toggleSubTemplate.bind(t)}}function sg(o,t){return o===1125&&t===1593?{size:"a3",width:"297mm",height:"420mm"}:o===794&&t===1123?{size:"a4",width:"210mm",height:"297mm"}:o===565&&t===796?{size:"a5",width:"148mm",height:"210mm"}:{size:"",width:`${o}px`,height:`${t}px`}}function rg(o,t){const{width:e,height:n,direction:i=l.PaperDirection.VERTICAL}=t,r=document.createElement("iframe");r.style.visibility="hidden",r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width="0",r.style.height="0",r.style.border="none",document.body.append(r);const s=r.contentWindow,a=s.document;a.open();const c=document.createElement("div"),d=sg(e,n);o.forEach(h=>{const g=document.createElement("img");g.style.width=i===l.PaperDirection.HORIZONTAL?d.height:d.width,g.style.height=i===l.PaperDirection.HORIZONTAL?d.width:d.height,g.src=h,c.append(g)});const u=document.createElement("style"),R=`
|
|
539
539
|
* {
|
|
540
540
|
margin: 0;
|
|
541
541
|
padding: 0;
|