@vervedoc/core 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +405 -0
- package/dist/DocxEditor.d.ts +17 -0
- package/dist/actuator/Actuator.d.ts +22 -0
- package/dist/assets/runtime.worker-BUGfHnel.js.map +1 -0
- package/dist/core.js +3997 -0
- package/dist/core.js.map +1 -0
- package/dist/core.umd.cjs +135 -0
- package/dist/core.umd.cjs.map +1 -0
- package/dist/docxParser/constants.d.ts +42 -0
- package/dist/docxParser/docx.parser.d.ts +13 -0
- package/dist/docxParser/index.d.ts +13 -0
- package/dist/docxParser/types.d.ts +170 -0
- package/dist/docxParser/worker/builder/element.builder.d.ts +6 -0
- package/dist/docxParser/worker/docx.parse.worker.d.ts +1 -0
- package/dist/docxParser/worker/numbering.resolver.d.ts +29 -0
- package/dist/docxParser/worker/parsers/chart.parser.d.ts +16 -0
- package/dist/docxParser/worker/parsers/comment.parser.d.ts +5 -0
- package/dist/docxParser/worker/parsers/hyperlink.parser.d.ts +14 -0
- package/dist/docxParser/worker/parsers/image.parser.d.ts +12 -0
- package/dist/docxParser/worker/parsers/list.parser.d.ts +6 -0
- package/dist/docxParser/worker/parsers/ooxml.chart.parser.d.ts +4 -0
- package/dist/docxParser/worker/parsers/paragraph.parser.d.ts +10 -0
- package/dist/docxParser/worker/parsers/run.parser.d.ts +22 -0
- package/dist/docxParser/worker/parsers/section.parser.d.ts +20 -0
- package/dist/docxParser/worker/parsers/table.parser.d.ts +11 -0
- package/dist/docxParser/worker/parsers/toc.parser.d.ts +13 -0
- package/dist/docxParser/worker/relationship.resolver.d.ts +17 -0
- package/dist/docxParser/worker/style.resolver.d.ts +33 -0
- package/dist/docxParser/worker/theme.resolver.d.ts +21 -0
- package/dist/docxParser/worker/xml.helper.d.ts +36 -0
- package/dist/export/ExportComponent.d.ts +9 -0
- package/dist/i18n/I18n.d.ts +8 -0
- package/dist/index-OrDfS8Mp.js +16762 -0
- package/dist/index-OrDfS8Mp.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/table-contextmenu/TableContextMenu.d.ts +48 -0
- package/dist/table-contextmenu/TableContextMenuComponent.d.ts +7 -0
- package/dist/utils/clipboard.d.ts +11 -0
- package/dist/utils/print.d.ts +7 -0
- package/dist/worker/WorkerComponent.d.ts +8 -0
- package/dist/worker/WorkerManager.d.ts +21 -0
- package/dist/worker/WorkerMessage.d.ts +21 -0
- package/dist/worker/runtime.worker.d.ts +1 -0
- package/package.json +60 -0
package/dist/core.js
ADDED
|
@@ -0,0 +1,3997 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.id="docx-editor-core-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-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;-webkit-appearance:none;-moz-appearance:none;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;overflow:hidden;border-radius:8px;background-color:#fff;border:1px solid rgb(235 236 240)}.ce-table-tool__row{position:absolute;width:14px;border-radius:2px;overflow:visible;background-color:transparent}.ce-table-tool__row .ce-table-tool__row__item{width:100%;position:relative;cursor:pointer;transition:all .2s;background-color:transparent}.ce-table-tool__row .ce-table-tool__row__item:after{display:none}.ce-table-tool__row .ce-table-tool__row__item:hover{background-color:#409eff1a}.ce-table-tool__row .ce-table-tool__row__item:last-child:after{display:none}.ce-table-tool__quick__add{width:20px;height:20px;position:absolute;border-radius:3px;background-color:#fff;border:1px solid #d0d0d0;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;box-shadow:0 1px 3px #00000014}.ce-table-tool__quick__add:hover{border-color:#409eff;background-color:#ecf5ff}.ce-table-tool__quick__add:after{content:"+";color:#606266;font-size:16px;font-weight:300;line-height:1;position:static;transform:none}.ce-table-tool__quick__add:hover:after{color:#409eff}.ce-table-tool__select{width:20px;height:20px;position:absolute;border-radius:3px;cursor:pointer;background-color:#fff;border:1px solid #d0d0d0;display:flex;align-items:center;justify-content:center;transition:all .2s;box-shadow:0 1px 3px #00000014}.ce-table-tool__select:hover{border-color:#409eff;background-color:#ecf5ff}.ce-table-tool__select:after{content:"";width:10px;height:10px;border:1.5px solid #606266;border-radius:1px;position:static;transform:none;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr}.ce-table-tool__select:before{content:"";position:absolute;width:10px;height:10px;background:linear-gradient(to right,#606266 1px,transparent 1px) center/50% 100%,linear-gradient(to bottom,#606266 1px,transparent 1px) center/100% 50%}.ce-table-tool__select:hover:after{border-color:#409eff}.ce-table-tool__select:hover:before{background:linear-gradient(to right,#409eff 1px,transparent 1px) center/50% 100%,linear-gradient(to bottom,#409eff 1px,transparent 1px) center/100% 50%}.ce-table-tool__col{position:absolute;height:14px;border-radius:2px;overflow:visible;background-color:transparent;display:flex}.ce-table-tool__col .ce-table-tool__col__item{height:100%;position:relative;cursor:pointer;transition:all .2s;background-color:transparent}.ce-table-tool__col .ce-table-tool__col__item:after{display:none}.ce-table-tool__col .ce-table-tool__col__item:hover{background-color:#409eff1a}.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:#409eff26}.ce-table-tool__col .ce-table-tool__anchor{right:-5px;width:10px;height:14px;z-index:9;position:absolute;cursor:col-resize}.ce-table-tool__row .ce-table-tool__anchor{bottom:-5px;left:0;width:14px;height:10px;z-index:9;position:absolute;cursor:row-resize}.ce-table-anchor__line{z-index:9;position:absolute;border:1px dashed #409eff}.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-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-toolbar{display:flex;justify-content:space-between;align-items:center;padding:0!important;background:transparent!important;height:24px;position:absolute}.ce-zone-toolbar-label{padding:2px 8px;font-size:12px;color:#0078d4;background:#dae7fc;border-radius:2px;white-space:nowrap}.ce-zone-toolbar-btn{display:flex;align-items:center;gap:4px;padding:4px 8px;font-size:12px;color:#0078d4;background:#dae7fc;border-radius:2px;cursor:pointer;transition:background-color .2s;white-space:nowrap}.ce-zone-toolbar-btn:hover{background:#c6d8f8}.ce-zone-toolbar-btn span{margin:0 2px}.ce-zone-toolbar-btn svg{flex-shrink:0}.ce-zone-pagenumber-menu{position:fixed;background:#fff;border:1px solid #e0e0e0;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000;min-width:140px;padding:4px 0}.ce-zone-pagenumber-menu-item{padding:8px 16px;font-size:13px;color:#333;cursor:pointer;transition:background-color .15s}.ce-zone-pagenumber-menu-item:hover{background-color:#f5f5f5}.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-floating-toolbar{display:none;position:fixed;background:#fff;border-radius:8px;padding:4px 8px;box-shadow:0 2px 10px #00000026;border:1px solid #dadce0;z-index:2000;gap:2px;align-items:center}.ce-floating-toolbar.show{display:flex}.ce-floating-toolbar .fb-btn{width:32px;height:32px;border:none;background:transparent;border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#444746;padding:0}.ce-floating-toolbar .fb-btn:hover{background:#f1f3f4}.ce-floating-toolbar .fb-btn.active{background:#e8f0fe;color:#1a73e8}.ce-floating-toolbar .fb-btn svg{width:18px;height:18px}.ce-floating-toolbar .fb-divider{width:1px;height:20px;background:#dadce0;margin:0 4px}.ce-floating-toolbar .fb-select{height:28px;padding:0 8px;border:1px solid #dadce0;background:#fff;border-radius:4px;font-size:12px;color:#444746;cursor:pointer;outline:none}.ce-floating-toolbar .fb-select:hover{background:#f1f3f4}.ce-floating-toolbar .fb-color{width:28px;height:28px;padding:2px;border:1px solid #dadce0;background:transparent;border-radius:4px;cursor:pointer}.ce-floating-toolbar .fb-color-picker{position:relative}.ce-floating-toolbar .fb-color-btn{position:relative;flex-direction:column;height:36px;padding-bottom:2px}.ce-floating-toolbar .fb-color-indicator{display:block;width:16px;height:3px;border-radius:1px;margin-top:1px}.ce-floating-toolbar .fb-color-input{position:absolute;width:0;height:0;opacity:0;pointer-events:none}.ce-floating-toolbar .fb-label{font-size:12px;color:#5f6368;padding:0 4px}.ce-table-context-menu{position:fixed;background:#fff;border:1px solid #e7e7e7;border-radius:0;box-shadow:0 10px 28px #0f172a1f;padding:6px 0;min-width:176px;z-index:9999;font-family:Microsoft YaHei,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px;color:#303133;-webkit-user-select:none;user-select:none;overflow:hidden}.ce-table-context-menu__item{min-height:33px;padding:0 12px;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:16px;line-height:1;white-space:nowrap;transition:background-color .15s ease,color .15s ease}.ce-table-context-menu__item:hover{background-color:#f5f7fa}.ce-table-context-menu__item.disabled{opacity:.45;cursor:not-allowed;pointer-events:none}.ce-table-context-menu__item.disabled:hover{background-color:transparent}.ce-table-context-menu__item.active{background-color:#f5f7fa}.ce-table-context-menu__item.danger .ce-table-context-menu__label,.ce-table-context-menu__item.danger .ce-table-context-menu__icon svg,.ce-table-context-menu__item.danger .ce-table-context-menu__arrow{color:#d14343}.ce-table-context-menu__main,.ce-table-context-menu__meta{display:inline-flex;align-items:center}.ce-table-context-menu__main{gap:10px;min-width:0;flex:1 1 auto}.ce-table-context-menu__meta{gap:8px;flex:0 0 auto}.ce-table-context-menu__icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0}.ce-table-context-menu__icon svg{width:16px;height:16px;color:#646a73}.ce-table-context-menu__item:hover .ce-table-context-menu__icon svg{color:#303133}.ce-table-context-menu__label{font-size:12px;color:#303133;font-weight:400;letter-spacing:0}.ce-table-context-menu__shortcut{color:#909399;font-size:11px}.ce-table-context-menu__arrow{color:#909399;font-size:12px;font-family:Segoe UI,sans-serif;font-weight:600;line-height:1}.ce-table-context-menu__divider{height:1px;background-color:#ebeef5;margin:6px 0}.ce-table-context-menu__input-number{width:54px;height:22px;padding:0 6px;border:1px solid #dcdfe6;border-radius:0;font-size:11px;outline:none;transition:border-color .15s ease,box-shadow .15s ease;color:#303133;background:#fff;text-align:center}.ce-table-context-menu__input-number:focus{border-color:#409eff;box-shadow:0 0 0 2px #409eff1f}.ce-table-context-menu__input-number:hover{border-color:#c0c4cc}.ce-table-context-menu__unit{font-size:11px;color:#606266;flex-shrink:0}.ce-table-context-menu__color-preview{width:14px;height:14px;border:1px solid #dcdfe6;border-radius:0;box-sizing:border-box;background-image:linear-gradient(45deg,#f2f3f5 25%,transparent 25%),linear-gradient(-45deg,#f2f3f5 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#f2f3f5 75%),linear-gradient(-45deg,transparent 75%,#f2f3f5 75%);background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0}.ce-table-context-menu--sub{min-width:190px}.ce-table-context-menu--icon-grid{display:grid;grid-template-columns:repeat(3,28px);gap:6px;min-width:auto;padding:8px}.ce-table-context-menu--icon-grid .ce-table-context-menu__item{width:28px;min-width:28px;min-height:28px;padding:0;justify-content:center;gap:0;border:1px solid #9fa3a9;box-sizing:border-box}.ce-table-context-menu--icon-grid .ce-table-context-menu__main,.ce-table-context-menu--icon-grid .ce-table-context-menu__meta{flex:none}.ce-table-context-menu--icon-grid .ce-table-context-menu__main{justify-content:center}.ce-table-context-menu--icon-grid .ce-table-context-menu__icon{width:16px;height:16px}.ce-table-context-menu--icon-grid .ce-table-context-menu__item:hover,.ce-table-context-menu--icon-grid .ce-table-context-menu__item.active{background-color:#f0f0f0}.ce-table-context-menu__color-panel{position:fixed;width:250px;padding:8px;background:#fff;border:1px solid #e7e7e7;border-radius:0;box-shadow:0 10px 28px #0f172a1f;z-index:10001;box-sizing:border-box}.ce-table-context-menu__picker-host{width:100%}.ce-table-context-menu__picker-host .picker_wrapper{width:100%;margin:0;border:none;box-shadow:none;background:transparent}.ce-table-context-menu__picker-host .picker_editor input,.ce-table-context-menu__picker-host .picker_done button,.ce-table-context-menu__picker-host .picker_cancel button{font-size:12px}.ce-table-context-menu__picker-host .picker_done button,.ce-table-context-menu__picker-host .picker_cancel button{min-width:56px;height:28px;padding:0 10px;border-radius:0;line-height:28px}.ce-table-context-menu__picker-host .picker_done{margin-top:6px}.ce-table-context-menu__picker-host .picker_cancel{display:none}.ce-inputarea{width:100px;height:30px;min-width:0;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}.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}`)),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
var ue = Object.defineProperty;
|
|
3
|
+
var de = (i, t, e) => t in i ? ue(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
4
|
+
var I = (i, t, e) => de(i, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { DOCX_EDITOR_SCHEMA_VERSION as mt, DOCX_EDITOR_DATA_VERSION as bt, getTextFromElementList as pe, ElementType as he, TableBorder as J, VerticalAlign as U, RowFlex as W, TdBorder as nt, TdSlash as Gt, EDITOR_PREFIX as P, PaperDirection as rt, mergeOption as fe, deepClone as me, formatElementList as be, EDITOR_CLIPBOARD as Qt } from "@vervedoc/docx-editor-schema";
|
|
6
|
+
export * from "@vervedoc/docx-editor-schema";
|
|
7
|
+
import { Override as ge, Draw as we, pasteByApi as ye, FloatingBar as Se, Register as Te, Plugin as ve } from "@vervedoc/docx-editor-view";
|
|
8
|
+
import { AbstractRichText as Or, Area as Dr, Background as zr, Badge as jr, CanvasEvent as $r, CheckboxParticle as qr, Cursor as ti, CursorAgent as ei, Draw as ni, FloatingBar as ri, Footer as ii, GlobalEvent as oi, Group as si, Header as li, Highlight as ai, HyperlinkParticle as ci, ImageObserver as ui, ImageParticle as di, LineBreakParticle as pi, LineNumber as hi, ListParticle as fi, Margin as mi, MouseObserver as bi, Override as gi, PageBorder as wi, PageBreakParticle as yi, PageNumber as Si, ParagraphColor as Ti, Placeholder as vi, Position as ki, Previewer as Ci, RadioParticle as xi, Register as Ii, ScrollObserver as Li, SelectionObserver as Ei, SeparatorParticle as Vi, Strikeout as Zi, SubscriptParticle as Ni, SuperscriptParticle as Ri, TableOperate as Wi, TableParticle as Ui, TableTool as Pi, TextParticle as Gi, Underline as Fi, Watermark as _i } from "@vervedoc/docx-editor-view";
|
|
9
|
+
import { CommandAdapt as ke, Command as Ce } from "@vervedoc/docx-editor-transform";
|
|
10
|
+
import { BaseAdapter as Ai, BaseCommandAdapter as Hi, Command as Ji, CommandAdapt as Yi, PageAdapter as Bi, ParagraphAdapter as Mi, TableAdapter as Ki, TextStyleAdapter as Qi } from "@vervedoc/docx-editor-transform";
|
|
11
|
+
import { Listener as xe, EventBus as Ie } from "@vervedoc/docx-editor-state";
|
|
12
|
+
import { EventBus as Di, Listener as zi, RangeManager as ji } from "@vervedoc/docx-editor-state";
|
|
13
|
+
import { HistoryComponent as Le } from "@vervedoc/docx-editor-history";
|
|
14
|
+
export * from "@vervedoc/docx-editor-history";
|
|
15
|
+
import { KeymapComponent as Ee } from "@vervedoc/docx-editor-keymap";
|
|
16
|
+
import { KeymapComponent as to, Shortcut as eo } from "@vervedoc/docx-editor-keymap";
|
|
17
|
+
import { BlockParticle as Ve, ControlComponent as Ze, GadgetComponent as Ne } from "@vervedoc/docx-editor-commands";
|
|
18
|
+
import { BlockParticle as ro, CheckboxControl as io, Control as oo, ControlBorder as so, ControlComponent as lo, ControlSearch as ao, DateControl as co, DateParticle as uo, DatePicker as po, GadgetComponent as ho, LaTexParticle as fo, NumberControl as mo, RadioControl as bo, Search as go, SelectControl as wo, TextControl as yo } from "@vervedoc/docx-editor-commands";
|
|
19
|
+
import { CommentComponent as Re, RevisionComponent as We } from "@vervedoc/docx-editor-comment";
|
|
20
|
+
import { CommentComponent as To, RevisionComponent as vo } from "@vervedoc/docx-editor-comment";
|
|
21
|
+
import Ue from "jszip";
|
|
22
|
+
const Ot = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBfPShlPT4oZS5DT05UQUlOPSJjb250YWluIixlLkNPVkVSPSJjb3ZlciIsZSkpKF98fHt9KSxCPShlPT4oZS5SRVBFQVQ9InJlcGVhdCIsZS5OT19SRVBFQVQ9Im5vLXJlcGVhdCIsZS5SRVBFQVRfWD0icmVwZWF0LXgiLGUuUkVQRUFUX1k9InJlcGVhdC15IixlKSkoQnx8e30pLFI9KGU9PihlLkhBTEY9ImhhbGYiLGUuT05FX1RISVJEPSJvbmUtdGhpcmQiLGUuUVVBUlRFUj0icXVhcnRlciIsZSkpKFJ8fHt9KSx5PShlPT4oZS5BUkFCSUM9ImFyYWJpYyIsZS5DSElORVNFPSJjaGluZXNlIixlKSkoeXx8e30pLEM9KGU9PihlLlBSRUZJWD0icHJlZml4IixlLlBPU1RGSVg9InBvc3RmaXgiLGUuUFJFX1RFWFQ9InByZVRleHQiLGUuUE9TVF9URVhUPSJwb3N0VGV4dCIsZS5QTEFDRUhPTERFUj0icGxhY2Vob2xkZXIiLGUuVkFMVUU9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Z2UoaSl9fX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXJ1bnRpbWUud29ya2VyLUJVR2ZIbmVsLmpzLm1hcAo=", Pe = (i) => Uint8Array.from(atob(i), (t) => t.charCodeAt(0)), Ft = typeof self < "u" && self.Blob && new Blob([Pe(Ot)], { type: "text/javascript;charset=utf-8" });
|
|
23
|
+
function Ge(i) {
|
|
24
|
+
let t;
|
|
25
|
+
try {
|
|
26
|
+
if (t = Ft && (self.URL || self.webkitURL).createObjectURL(Ft), !t) throw "";
|
|
27
|
+
const e = new Worker(t, {
|
|
28
|
+
name: i == null ? void 0 : i.name
|
|
29
|
+
});
|
|
30
|
+
return e.addEventListener("error", () => {
|
|
31
|
+
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
32
|
+
}), e;
|
|
33
|
+
} catch {
|
|
34
|
+
return new Worker(
|
|
35
|
+
"data:text/javascript;base64," + Ot,
|
|
36
|
+
{
|
|
37
|
+
name: i == null ? void 0 : i.name
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
} finally {
|
|
41
|
+
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function xt(i, t = /* @__PURE__ */ new Set(), e = []) {
|
|
45
|
+
for (const n of i) {
|
|
46
|
+
if (Array.isArray(n == null ? void 0 : n.groupIds))
|
|
47
|
+
for (const r of n.groupIds)
|
|
48
|
+
r && !t.has(r) && (t.add(r), e.push(r));
|
|
49
|
+
if ((n == null ? void 0 : n.type) === he.TABLE) {
|
|
50
|
+
for (const r of n.trList || [])
|
|
51
|
+
for (const o of r.tdList || [])
|
|
52
|
+
xt(o.value || [], t, e);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
Array.isArray(n == null ? void 0 : n.valueList) && xt(n.valueList, t, e);
|
|
56
|
+
}
|
|
57
|
+
return e;
|
|
58
|
+
}
|
|
59
|
+
class Fe {
|
|
60
|
+
constructor(t) {
|
|
61
|
+
I(this, "draw");
|
|
62
|
+
I(this, "worker", null);
|
|
63
|
+
I(this, "pendingTaskMap", /* @__PURE__ */ new Map());
|
|
64
|
+
I(this, "warnedFallbackSet", /* @__PURE__ */ new Set());
|
|
65
|
+
I(this, "requestSeed", 0);
|
|
66
|
+
I(this, "_handleMessage", (t) => {
|
|
67
|
+
const { id: e, success: n, data: r, error: o } = t.data, s = this.pendingTaskMap.get(e);
|
|
68
|
+
s && (this.pendingTaskMap.delete(e), n ? s.resolve(r) : s.reject(new Error(o || "Worker task failed")));
|
|
69
|
+
});
|
|
70
|
+
I(this, "_handleError", () => {
|
|
71
|
+
this._warnFallback("worker-runtime-error", "Worker 运行时异常,后续任务将降级为主线程执行。"), this.terminate();
|
|
72
|
+
});
|
|
73
|
+
this.draw = t, this._initWorker();
|
|
74
|
+
}
|
|
75
|
+
getValue(t) {
|
|
76
|
+
return this._runTask(
|
|
77
|
+
"getValue",
|
|
78
|
+
{
|
|
79
|
+
dataVersion: bt,
|
|
80
|
+
schemaVersion: mt,
|
|
81
|
+
editorOptions: this.draw.getOptions(),
|
|
82
|
+
valueOptions: t,
|
|
83
|
+
originData: this.draw.getOriginValue(t)
|
|
84
|
+
},
|
|
85
|
+
() => Promise.resolve(this.draw.getValue(t))
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
getGroupIds() {
|
|
89
|
+
return this._runTask(
|
|
90
|
+
"getGroupIds",
|
|
91
|
+
{
|
|
92
|
+
dataVersion: bt,
|
|
93
|
+
schemaVersion: mt,
|
|
94
|
+
mainElementList: this.draw.getOriginalMainElementList()
|
|
95
|
+
},
|
|
96
|
+
() => Promise.resolve(xt(this.draw.getOriginalMainElementList()))
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
getWordCount() {
|
|
100
|
+
return this._runTask(
|
|
101
|
+
"getWordCount",
|
|
102
|
+
{
|
|
103
|
+
dataVersion: bt,
|
|
104
|
+
schemaVersion: mt,
|
|
105
|
+
mainElementList: this.draw.getOriginalMainElementList()
|
|
106
|
+
},
|
|
107
|
+
() => {
|
|
108
|
+
const t = pe(this.draw.getOriginalMainElementList()).replace(/\u200B/g, "");
|
|
109
|
+
return Promise.resolve(t.replace(/\s/g, "").length);
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
terminate() {
|
|
114
|
+
var t;
|
|
115
|
+
(t = this.worker) == null || t.terminate(), this.worker = null, this._rejectPendingTasks(new Error("Worker terminated"));
|
|
116
|
+
}
|
|
117
|
+
_initWorker() {
|
|
118
|
+
if (typeof Worker > "u") {
|
|
119
|
+
this._warnFallback("worker-unavailable", "当前环境不支持 Worker,已降级为主线程执行。");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
this.worker = new Ge(), this.worker.onmessage = this._handleMessage, this.worker.onerror = this._handleError;
|
|
124
|
+
} catch (t) {
|
|
125
|
+
this.worker = null, this._warnFallback(
|
|
126
|
+
"worker-init-failed",
|
|
127
|
+
"Worker 初始化失败,已降级为主线程执行。",
|
|
128
|
+
t
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
_runTask(t, e, n) {
|
|
133
|
+
if (!this.worker)
|
|
134
|
+
return this._warnFallback(`fallback-${t}`, `${t} 未使用 Worker,已降级为主线程执行。`), n();
|
|
135
|
+
const r = `${Date.now()}-${this.requestSeed++}`, o = { id: r, type: t, payload: e };
|
|
136
|
+
return new Promise((s, a) => {
|
|
137
|
+
this.pendingTaskMap.set(r, { resolve: s, reject: a });
|
|
138
|
+
try {
|
|
139
|
+
this.worker.postMessage(o);
|
|
140
|
+
} catch (l) {
|
|
141
|
+
this.pendingTaskMap.delete(r), a(l);
|
|
142
|
+
}
|
|
143
|
+
}).catch((s) => (this._warnFallback(`fallback-${t}`, `${t} 的 Worker 执行失败,已降级为主线程执行。`, s), n()));
|
|
144
|
+
}
|
|
145
|
+
_rejectPendingTasks(t) {
|
|
146
|
+
for (const [, e] of this.pendingTaskMap)
|
|
147
|
+
e.reject(t);
|
|
148
|
+
this.pendingTaskMap.clear();
|
|
149
|
+
}
|
|
150
|
+
_warnFallback(t, e, n) {
|
|
151
|
+
this.warnedFallbackSet.has(t) || (this.warnedFallbackSet.add(t), n ? console.warn(`[WorkerManager] ${e}`, n) : console.warn(`[WorkerManager] ${e}`));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
class _e {
|
|
155
|
+
constructor() {
|
|
156
|
+
I(this, "workerManager", null);
|
|
157
|
+
}
|
|
158
|
+
install(t) {
|
|
159
|
+
return this.workerManager = new Fe(t), typeof t.setWorkerManager == "function" && t.setWorkerManager(this.workerManager), this;
|
|
160
|
+
}
|
|
161
|
+
getWorkerManager() {
|
|
162
|
+
return this.workerManager;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function Xe(i) {
|
|
166
|
+
const t = atob(i.replace(/^data:[^;]+;base64,/, "")), e = new Uint8Array(t.length);
|
|
167
|
+
for (let n = 0; n < t.length; n++)
|
|
168
|
+
e[n] = t.charCodeAt(n);
|
|
169
|
+
return e.buffer;
|
|
170
|
+
}
|
|
171
|
+
function Dt(i) {
|
|
172
|
+
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
173
|
+
}
|
|
174
|
+
function Ae(i) {
|
|
175
|
+
if (!i.trList || !Array.isArray(i.trList)) return "";
|
|
176
|
+
const t = Number.isFinite(Number(i.borderWidth)) ? Number(i.borderWidth) : 1, e = typeof i.borderColor == "string" && i.borderColor ? i.borderColor : "#000000", n = i.borderType === "dash" ? "dashed" : "solid", r = i.borderType === "empty", o = i.borderType === "external", s = r ? "border: none;" : o ? `border: ${t}px ${n} ${e};` : "border: none;", a = r || o ? "border: none;" : `border: ${t}px ${n} ${e};`;
|
|
177
|
+
let l = `<table style="border-collapse: collapse; width: 100%; ${s}">`;
|
|
178
|
+
for (const c of i.trList) {
|
|
179
|
+
if (l += "<tr>", c.tdList && Array.isArray(c.tdList))
|
|
180
|
+
for (const u of c.tdList) {
|
|
181
|
+
const p = u.colspan ? ` colspan="${u.colspan}"` : "", f = u.rowspan ? ` rowspan="${u.rowspan}"` : "";
|
|
182
|
+
if (l += `<td${p}${f} style="${a} padding: 4px 8px;">`, u.value && Array.isArray(u.value))
|
|
183
|
+
for (const w of u.value)
|
|
184
|
+
w.value && (l += Dt(w.value));
|
|
185
|
+
l += "</td>";
|
|
186
|
+
}
|
|
187
|
+
l += "</tr>";
|
|
188
|
+
}
|
|
189
|
+
return l += "</table>", l;
|
|
190
|
+
}
|
|
191
|
+
class He {
|
|
192
|
+
constructor() {
|
|
193
|
+
I(this, "_command", null);
|
|
194
|
+
}
|
|
195
|
+
install(t, e) {
|
|
196
|
+
this._command = e;
|
|
197
|
+
const n = t.__structureAdapter;
|
|
198
|
+
return n && (n.exportDocx = this.exportDocx.bind(this), n.previewHtml = this.previewHtml.bind(this)), this;
|
|
199
|
+
}
|
|
200
|
+
async exportDocx(t) {
|
|
201
|
+
var n, r;
|
|
202
|
+
const e = t == null ? void 0 : t.callback;
|
|
203
|
+
try {
|
|
204
|
+
const o = this._command.getValue(), { Document: s, Packer: a, Paragraph: l, TextRun: c, ImageRun: u, Table: p, TableRow: f, TableCell: w, WidthType: h, BorderStyle: m } = await import("./index-OrDfS8Mp.js"), g = [], v = o.data.main || [];
|
|
205
|
+
let T = [];
|
|
206
|
+
for (const y of v) {
|
|
207
|
+
const V = y != null && y.extension && typeof y.extension == "object" ? y.extension.bookmarkMarker : null;
|
|
208
|
+
if (!(V != null && V.name)) {
|
|
209
|
+
if (y.value === `
|
|
210
|
+
` || y.type === "pageBreak")
|
|
211
|
+
T.length > 0 && (g.push(new l({ children: T })), T = []), y.type === "pageBreak" && g.push(new l({ pageBreakBefore: !0 }));
|
|
212
|
+
else if (y.type === "image" && y.value) {
|
|
213
|
+
T.length > 0 && (g.push(new l({ children: T })), T = []);
|
|
214
|
+
try {
|
|
215
|
+
const S = Xe(y.value), L = y.width || 200, F = y.height || 200;
|
|
216
|
+
g.push(new l({
|
|
217
|
+
children: [
|
|
218
|
+
new u({
|
|
219
|
+
data: S,
|
|
220
|
+
transformation: { width: L, height: F },
|
|
221
|
+
type: "png"
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
}));
|
|
225
|
+
} catch (S) {
|
|
226
|
+
console.warn("[ExportComponent] 图片导出失败:", S);
|
|
227
|
+
}
|
|
228
|
+
} else if (y.type === "table" && y.trList) {
|
|
229
|
+
T.length > 0 && (g.push(new l({ children: T })), T = []);
|
|
230
|
+
try {
|
|
231
|
+
const S = (A) => {
|
|
232
|
+
if (typeof A != "string") return "000000";
|
|
233
|
+
const H = A.trim();
|
|
234
|
+
return H ? H.startsWith("#") ? H.slice(1) : H : "000000";
|
|
235
|
+
}, L = (A) => (A === "dash" ? "dash" : "single") === "dash" ? m.DASHED ?? "dashed" : m.SINGLE ?? "single", F = m.NONE ?? m.NIL ?? "none", N = (A) => {
|
|
236
|
+
const H = Number(A);
|
|
237
|
+
return !Number.isFinite(H) || H <= 0 ? 8 : Math.max(1, Math.round(H * 8));
|
|
238
|
+
}, z = (A) => ({
|
|
239
|
+
style: A.style,
|
|
240
|
+
size: A.size,
|
|
241
|
+
color: A.color
|
|
242
|
+
}), j = y.borderType ?? "all", ft = S(y.borderColor), Wt = N(y.borderWidth), oe = y.borderExternalWidth !== void 0 ? N(y.borderExternalWidth) : Wt, Ut = L(j), X = z({ style: F, size: 0, color: ft }), K = z({ style: Ut, size: Wt, color: ft }), Q = z({ style: Ut, size: oe, color: ft }), se = j === "empty" ? { top: X, bottom: X, left: X, right: X, insideHorizontal: X, insideVertical: X } : j === "external" ? { top: Q, bottom: Q, left: Q, right: Q, insideHorizontal: X, insideVertical: X } : j === "internal" ? { top: X, bottom: X, left: X, right: X, insideHorizontal: K, insideVertical: K } : { top: Q, bottom: Q, left: Q, right: Q, insideHorizontal: K, insideVertical: K }, le = y.trList.map((A) => {
|
|
243
|
+
const H = (A.tdList || []).map((M) => {
|
|
244
|
+
const ae = (M.value || []).map((ce) => ce.value || "").join(""), Pt = Array.isArray(M.borderTypes) && M.borderTypes.length ? {
|
|
245
|
+
...M.borderTypes.includes("top") ? { top: K } : {},
|
|
246
|
+
...M.borderTypes.includes("right") ? { right: K } : {},
|
|
247
|
+
...M.borderTypes.includes("bottom") ? { bottom: K } : {},
|
|
248
|
+
...M.borderTypes.includes("left") ? { left: K } : {}
|
|
249
|
+
} : void 0;
|
|
250
|
+
return new w({
|
|
251
|
+
children: [new l({ children: [new c(ae)] })],
|
|
252
|
+
columnSpan: M.colspan || 1,
|
|
253
|
+
rowSpan: M.rowspan || 1,
|
|
254
|
+
...Pt ? { borders: Pt } : {}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
return new f({ children: H });
|
|
258
|
+
});
|
|
259
|
+
g.push(new p({ rows: le, width: { size: 100, type: h.PERCENTAGE }, borders: se }));
|
|
260
|
+
} catch (S) {
|
|
261
|
+
console.warn("[ExportComponent] 表格导出失败:", S);
|
|
262
|
+
}
|
|
263
|
+
} else if (y.value) {
|
|
264
|
+
const S = {
|
|
265
|
+
text: y.value,
|
|
266
|
+
bold: y.bold,
|
|
267
|
+
italics: y.italic,
|
|
268
|
+
size: (y.size || 10.5) * 2,
|
|
269
|
+
font: ((n = y.font) == null ? void 0 : n.split(",")[0]) || "SimSun",
|
|
270
|
+
color: (r = y.color) == null ? void 0 : r.replace("#", ""),
|
|
271
|
+
underline: y.underline ? {} : void 0,
|
|
272
|
+
strike: y.strikeout
|
|
273
|
+
};
|
|
274
|
+
y.revisionType && y.revisionId && (S.revision = {
|
|
275
|
+
id: y.revisionId,
|
|
276
|
+
author: y.revisionAuthor || "",
|
|
277
|
+
date: y.revisionDate || "",
|
|
278
|
+
type: y.revisionType === "insert" ? "insert" : "delete"
|
|
279
|
+
}), T.push(new c(S));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
T.length > 0 && g.push(new l({ children: T }));
|
|
284
|
+
const C = new s({ sections: [{ children: g }] }), k = await a.toBlob(C);
|
|
285
|
+
return e && e(k), k;
|
|
286
|
+
} catch (o) {
|
|
287
|
+
return console.error("[ExportComponent] 导出 Docx 失败:", o), null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
previewHtml(t) {
|
|
291
|
+
const e = t == null ? void 0 : t.callback;
|
|
292
|
+
try {
|
|
293
|
+
const r = this._command.getValue().data.main || [];
|
|
294
|
+
let o = "";
|
|
295
|
+
for (const s of r)
|
|
296
|
+
if (s.value === `
|
|
297
|
+
`)
|
|
298
|
+
o += "<br>";
|
|
299
|
+
else if (s.type === "pageBreak")
|
|
300
|
+
o += '<div style="page-break-after: always;"></div>';
|
|
301
|
+
else if (s.type === "image" && s.value)
|
|
302
|
+
o += `<img src="${s.value}" style="max-width: 100%; height: auto;" />`;
|
|
303
|
+
else if (s.type === "table")
|
|
304
|
+
o += Ae(s);
|
|
305
|
+
else if (s.value) {
|
|
306
|
+
const a = [];
|
|
307
|
+
s.bold && a.push("font-weight: bold"), s.italic && a.push("font-style: italic"), s.underline && a.push("text-decoration: underline"), s.strikeout && a.push("text-decoration: line-through"), s.color && a.push(`color: ${s.color}`), s.highlight && a.push(`background-color: ${s.highlight}`), s.size && a.push(`font-size: ${s.size}px`), s.font && a.push(`font-family: ${s.font}`);
|
|
308
|
+
const l = a.length > 0 ? ` style="${a.join("; ")}"` : "";
|
|
309
|
+
o += `<span${l}>${Dt(s.value)}</span>`;
|
|
310
|
+
}
|
|
311
|
+
return e && e(o), o;
|
|
312
|
+
} catch (n) {
|
|
313
|
+
return console.error("[ExportComponent] 预览 HTML 失败:", n), e && e("<p>预览失败</p>"), "<p>预览失败</p>";
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/*!
|
|
318
|
+
* vanilla-picker v2.12.3
|
|
319
|
+
* https://vanilla-picker.js.org
|
|
320
|
+
*
|
|
321
|
+
* Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
|
|
322
|
+
* Released under the ISC license.
|
|
323
|
+
*/
|
|
324
|
+
var Et = function(i, t) {
|
|
325
|
+
if (!(i instanceof t))
|
|
326
|
+
throw new TypeError("Cannot call a class as a function");
|
|
327
|
+
}, Vt = /* @__PURE__ */ function() {
|
|
328
|
+
function i(t, e) {
|
|
329
|
+
for (var n = 0; n < e.length; n++) {
|
|
330
|
+
var r = e[n];
|
|
331
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return function(t, e, n) {
|
|
335
|
+
return e && i(t.prototype, e), n && i(t, n), t;
|
|
336
|
+
};
|
|
337
|
+
}(), it = /* @__PURE__ */ function() {
|
|
338
|
+
function i(t, e) {
|
|
339
|
+
var n = [], r = !0, o = !1, s = void 0;
|
|
340
|
+
try {
|
|
341
|
+
for (var a = t[Symbol.iterator](), l; !(r = (l = a.next()).done) && (n.push(l.value), !(e && n.length === e)); r = !0)
|
|
342
|
+
;
|
|
343
|
+
} catch (c) {
|
|
344
|
+
o = !0, s = c;
|
|
345
|
+
} finally {
|
|
346
|
+
try {
|
|
347
|
+
!r && a.return && a.return();
|
|
348
|
+
} finally {
|
|
349
|
+
if (o) throw s;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return n;
|
|
353
|
+
}
|
|
354
|
+
return function(t, e) {
|
|
355
|
+
if (Array.isArray(t))
|
|
356
|
+
return t;
|
|
357
|
+
if (Symbol.iterator in Object(t))
|
|
358
|
+
return i(t, e);
|
|
359
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
360
|
+
};
|
|
361
|
+
}();
|
|
362
|
+
String.prototype.startsWith = String.prototype.startsWith || function(i) {
|
|
363
|
+
return this.indexOf(i) === 0;
|
|
364
|
+
};
|
|
365
|
+
String.prototype.padStart = String.prototype.padStart || function(i, t) {
|
|
366
|
+
for (var e = this; e.length < i; )
|
|
367
|
+
e = t + e;
|
|
368
|
+
return e;
|
|
369
|
+
};
|
|
370
|
+
var Je = { cb: "0f8ff", tqw: "aebd7", q: "-ffff", qmrn: "7fffd4", zr: "0ffff", bg: "5f5dc", bsq: "e4c4", bck: "---", nch: "ebcd", b: "--ff", bvt: "8a2be2", brwn: "a52a2a", brw: "deb887", ctb: "5f9ea0", hrt: "7fff-", chcT: "d2691e", cr: "7f50", rnw: "6495ed", crns: "8dc", crms: "dc143c", cn: "-ffff", Db: "--8b", Dcn: "-8b8b", Dgnr: "b8860b", Dgr: "a9a9a9", Dgrn: "-64-", Dkhk: "bdb76b", Dmgn: "8b-8b", Dvgr: "556b2f", Drng: "8c-", Drch: "9932cc", Dr: "8b--", Dsmn: "e9967a", Dsgr: "8fbc8f", DsTb: "483d8b", DsTg: "2f4f4f", Dtrq: "-ced1", Dvt: "94-d3", ppnk: "1493", pskb: "-bfff", mgr: "696969", grb: "1e90ff", rbrc: "b22222", rwht: "af0", stg: "228b22", chs: "-ff", gnsb: "dcdcdc", st: "8f8ff", g: "d7-", gnr: "daa520", gr: "808080", grn: "-8-0", grnw: "adff2f", hnw: "0fff0", htpn: "69b4", nnr: "cd5c5c", ng: "4b-82", vr: "0", khk: "0e68c", vnr: "e6e6fa", nrb: "0f5", wngr: "7cfc-", mnch: "acd", Lb: "add8e6", Lcr: "08080", Lcn: "e0ffff", Lgnr: "afad2", Lgr: "d3d3d3", Lgrn: "90ee90", Lpnk: "b6c1", Lsmn: "a07a", Lsgr: "20b2aa", Lskb: "87cefa", LsTg: "778899", Lstb: "b0c4de", Lw: "e0", m: "-ff-", mgrn: "32cd32", nn: "af0e6", mgnt: "-ff", mrn: "8--0", mqm: "66cdaa", mmb: "--cd", mmrc: "ba55d3", mmpr: "9370db", msg: "3cb371", mmsT: "7b68ee", "": "-fa9a", mtr: "48d1cc", mmvt: "c71585", mnLb: "191970", ntc: "5fffa", mstr: "e4e1", mccs: "e4b5", vjw: "dead", nv: "--80", c: "df5e6", v: "808-0", vrb: "6b8e23", rng: "a5-", rngr: "45-", rch: "da70d6", pgnr: "eee8aa", pgrn: "98fb98", ptrq: "afeeee", pvtr: "db7093", ppwh: "efd5", pchp: "dab9", pr: "cd853f", pnk: "c0cb", pm: "dda0dd", pwrb: "b0e0e6", prp: "8-080", cc: "663399", r: "--", sbr: "bc8f8f", rb: "4169e1", sbrw: "8b4513", smn: "a8072", nbr: "4a460", sgrn: "2e8b57", ssh: "5ee", snn: "a0522d", svr: "c0c0c0", skb: "87ceeb", sTb: "6a5acd", sTgr: "708090", snw: "afa", n: "-ff7f", stb: "4682b4", tn: "d2b48c", t: "-8080", thst: "d8bfd8", tmT: "6347", trqs: "40e0d0", vt: "ee82ee", whT: "5deb3", wht: "", hts: "5f5f5", w: "-", wgrn: "9acd32" };
|
|
371
|
+
function _t(i) {
|
|
372
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, e = t > 0 ? i.toFixed(t).replace(/0+$/, "").replace(/\.$/, "") : i.toString();
|
|
373
|
+
return e || "0";
|
|
374
|
+
}
|
|
375
|
+
var Ye = function() {
|
|
376
|
+
function i(t, e, n, r) {
|
|
377
|
+
Et(this, i);
|
|
378
|
+
var o = this;
|
|
379
|
+
function s(l) {
|
|
380
|
+
if (l.startsWith("hsl")) {
|
|
381
|
+
var c = l.match(/([\-\d\.e]+)/g).map(Number), u = it(c, 4), p = u[0], f = u[1], w = u[2], h = u[3];
|
|
382
|
+
h === void 0 && (h = 1), p /= 360, f /= 100, w /= 100, o.hsla = [p, f, w, h];
|
|
383
|
+
} else if (l.startsWith("rgb")) {
|
|
384
|
+
var m = l.match(/([\-\d\.e]+)/g).map(Number), g = it(m, 4), v = g[0], T = g[1], C = g[2], k = g[3];
|
|
385
|
+
k === void 0 && (k = 1), o.rgba = [v, T, C, k];
|
|
386
|
+
} else
|
|
387
|
+
l.startsWith("#") ? o.rgba = i.hexToRgb(l) : o.rgba = i.nameToRgb(l) || i.hexToRgb(l);
|
|
388
|
+
}
|
|
389
|
+
if (t !== void 0) if (Array.isArray(t))
|
|
390
|
+
this.rgba = t;
|
|
391
|
+
else if (n === void 0) {
|
|
392
|
+
var a = t && "" + t;
|
|
393
|
+
a && s(a.toLowerCase());
|
|
394
|
+
} else
|
|
395
|
+
this.rgba = [t, e, n, r === void 0 ? 1 : r];
|
|
396
|
+
}
|
|
397
|
+
return Vt(i, [{
|
|
398
|
+
key: "printRGB",
|
|
399
|
+
value: function(e) {
|
|
400
|
+
var n = e ? this.rgba : this.rgba.slice(0, 3), r = n.map(function(o, s) {
|
|
401
|
+
return _t(o, s === 3 ? 3 : 0);
|
|
402
|
+
});
|
|
403
|
+
return e ? "rgba(" + r + ")" : "rgb(" + r + ")";
|
|
404
|
+
}
|
|
405
|
+
}, {
|
|
406
|
+
key: "printHSL",
|
|
407
|
+
value: function(e) {
|
|
408
|
+
var n = [360, 100, 100, 1], r = ["", "%", "%", ""], o = e ? this.hsla : this.hsla.slice(0, 3), s = o.map(function(a, l) {
|
|
409
|
+
return _t(a * n[l], l === 3 ? 3 : 1) + r[l];
|
|
410
|
+
});
|
|
411
|
+
return e ? "hsla(" + s + ")" : "hsl(" + s + ")";
|
|
412
|
+
}
|
|
413
|
+
}, {
|
|
414
|
+
key: "printHex",
|
|
415
|
+
value: function(e) {
|
|
416
|
+
var n = this.hex;
|
|
417
|
+
return e ? n : n.substring(0, 7);
|
|
418
|
+
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "rgba",
|
|
421
|
+
get: function() {
|
|
422
|
+
if (this._rgba)
|
|
423
|
+
return this._rgba;
|
|
424
|
+
if (!this._hsla)
|
|
425
|
+
throw new Error("No color is set");
|
|
426
|
+
return this._rgba = i.hslToRgb(this._hsla);
|
|
427
|
+
},
|
|
428
|
+
set: function(e) {
|
|
429
|
+
e.length === 3 && (e[3] = 1), this._rgba = e, this._hsla = null;
|
|
430
|
+
}
|
|
431
|
+
}, {
|
|
432
|
+
key: "rgbString",
|
|
433
|
+
get: function() {
|
|
434
|
+
return this.printRGB();
|
|
435
|
+
}
|
|
436
|
+
}, {
|
|
437
|
+
key: "rgbaString",
|
|
438
|
+
get: function() {
|
|
439
|
+
return this.printRGB(!0);
|
|
440
|
+
}
|
|
441
|
+
}, {
|
|
442
|
+
key: "hsla",
|
|
443
|
+
get: function() {
|
|
444
|
+
if (this._hsla)
|
|
445
|
+
return this._hsla;
|
|
446
|
+
if (!this._rgba)
|
|
447
|
+
throw new Error("No color is set");
|
|
448
|
+
return this._hsla = i.rgbToHsl(this._rgba);
|
|
449
|
+
},
|
|
450
|
+
set: function(e) {
|
|
451
|
+
e.length === 3 && (e[3] = 1), this._hsla = e, this._rgba = null;
|
|
452
|
+
}
|
|
453
|
+
}, {
|
|
454
|
+
key: "hslString",
|
|
455
|
+
get: function() {
|
|
456
|
+
return this.printHSL();
|
|
457
|
+
}
|
|
458
|
+
}, {
|
|
459
|
+
key: "hslaString",
|
|
460
|
+
get: function() {
|
|
461
|
+
return this.printHSL(!0);
|
|
462
|
+
}
|
|
463
|
+
}, {
|
|
464
|
+
key: "hex",
|
|
465
|
+
get: function() {
|
|
466
|
+
var e = this.rgba, n = e.map(function(r, o) {
|
|
467
|
+
return o < 3 ? r.toString(16) : Math.round(r * 255).toString(16);
|
|
468
|
+
});
|
|
469
|
+
return "#" + n.map(function(r) {
|
|
470
|
+
return r.padStart(2, "0");
|
|
471
|
+
}).join("");
|
|
472
|
+
},
|
|
473
|
+
set: function(e) {
|
|
474
|
+
this.rgba = i.hexToRgb(e);
|
|
475
|
+
}
|
|
476
|
+
}], [{
|
|
477
|
+
key: "hexToRgb",
|
|
478
|
+
value: function(e) {
|
|
479
|
+
var n = (e.startsWith("#") ? e.slice(1) : e).replace(/^(\w{3})$/, "$1F").replace(/^(\w)(\w)(\w)(\w)$/, "$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/, "$1FF");
|
|
480
|
+
if (!n.match(/^([0-9a-fA-F]{8})$/))
|
|
481
|
+
throw new Error("Unknown hex color; " + e);
|
|
482
|
+
var r = n.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(o) {
|
|
483
|
+
return parseInt(o, 16);
|
|
484
|
+
});
|
|
485
|
+
return r[3] = r[3] / 255, r;
|
|
486
|
+
}
|
|
487
|
+
}, {
|
|
488
|
+
key: "nameToRgb",
|
|
489
|
+
value: function(e) {
|
|
490
|
+
var n = e.toLowerCase().replace("at", "T").replace(/[aeiouyldf]/g, "").replace("ght", "L").replace("rk", "D").slice(-5, 4), r = Je[n];
|
|
491
|
+
return r === void 0 ? r : i.hexToRgb(r.replace(/\-/g, "00").padStart(6, "f"));
|
|
492
|
+
}
|
|
493
|
+
}, {
|
|
494
|
+
key: "rgbToHsl",
|
|
495
|
+
value: function(e) {
|
|
496
|
+
var n = it(e, 4), r = n[0], o = n[1], s = n[2], a = n[3];
|
|
497
|
+
r /= 255, o /= 255, s /= 255;
|
|
498
|
+
var l = Math.max(r, o, s), c = Math.min(r, o, s), u = void 0, p = void 0, f = (l + c) / 2;
|
|
499
|
+
if (l === c)
|
|
500
|
+
u = p = 0;
|
|
501
|
+
else {
|
|
502
|
+
var w = l - c;
|
|
503
|
+
switch (p = f > 0.5 ? w / (2 - l - c) : w / (l + c), l) {
|
|
504
|
+
case r:
|
|
505
|
+
u = (o - s) / w + (o < s ? 6 : 0);
|
|
506
|
+
break;
|
|
507
|
+
case o:
|
|
508
|
+
u = (s - r) / w + 2;
|
|
509
|
+
break;
|
|
510
|
+
case s:
|
|
511
|
+
u = (r - o) / w + 4;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
u /= 6;
|
|
515
|
+
}
|
|
516
|
+
return [u, p, f, a];
|
|
517
|
+
}
|
|
518
|
+
}, {
|
|
519
|
+
key: "hslToRgb",
|
|
520
|
+
value: function(e) {
|
|
521
|
+
var n = it(e, 4), r = n[0], o = n[1], s = n[2], a = n[3], l = void 0, c = void 0, u = void 0;
|
|
522
|
+
if (o === 0)
|
|
523
|
+
l = c = u = s;
|
|
524
|
+
else {
|
|
525
|
+
var p = function(g, v, T) {
|
|
526
|
+
return T < 0 && (T += 1), T > 1 && (T -= 1), T < 0.16666666666666666 ? g + (v - g) * 6 * T : T < 0.5 ? v : T < 0.6666666666666666 ? g + (v - g) * (0.6666666666666666 - T) * 6 : g;
|
|
527
|
+
}, f = s < 0.5 ? s * (1 + o) : s + o - s * o, w = 2 * s - f;
|
|
528
|
+
l = p(w, f, r + 1 / 3), c = p(w, f, r), u = p(w, f, r - 1 / 3);
|
|
529
|
+
}
|
|
530
|
+
var h = [l * 255, c * 255, u * 255].map(Math.round);
|
|
531
|
+
return h[3] = a, h;
|
|
532
|
+
}
|
|
533
|
+
}]), i;
|
|
534
|
+
}(), Be = function() {
|
|
535
|
+
function i() {
|
|
536
|
+
Et(this, i), this._events = [];
|
|
537
|
+
}
|
|
538
|
+
return Vt(i, [{
|
|
539
|
+
key: "add",
|
|
540
|
+
value: function(e, n, r) {
|
|
541
|
+
e.addEventListener(n, r, !1), this._events.push({
|
|
542
|
+
target: e,
|
|
543
|
+
type: n,
|
|
544
|
+
handler: r
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}, {
|
|
548
|
+
key: "remove",
|
|
549
|
+
value: function(e, n, r) {
|
|
550
|
+
this._events = this._events.filter(function(o) {
|
|
551
|
+
var s = !0;
|
|
552
|
+
return e && e !== o.target && (s = !1), n && n !== o.type && (s = !1), r && r !== o.handler && (s = !1), s && i._doRemove(o.target, o.type, o.handler), !s;
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}, {
|
|
556
|
+
key: "destroy",
|
|
557
|
+
value: function() {
|
|
558
|
+
this._events.forEach(function(e) {
|
|
559
|
+
return i._doRemove(e.target, e.type, e.handler);
|
|
560
|
+
}), this._events = [];
|
|
561
|
+
}
|
|
562
|
+
}], [{
|
|
563
|
+
key: "_doRemove",
|
|
564
|
+
value: function(e, n, r) {
|
|
565
|
+
e.removeEventListener(n, r, !1);
|
|
566
|
+
}
|
|
567
|
+
}]), i;
|
|
568
|
+
}();
|
|
569
|
+
function Me(i) {
|
|
570
|
+
var t = document.createElement("div");
|
|
571
|
+
return t.innerHTML = i, t.firstElementChild;
|
|
572
|
+
}
|
|
573
|
+
function gt(i, t, e) {
|
|
574
|
+
var n = !1;
|
|
575
|
+
function r(l, c, u) {
|
|
576
|
+
return Math.max(c, Math.min(l, u));
|
|
577
|
+
}
|
|
578
|
+
function o(l, c, u) {
|
|
579
|
+
if (u && (n = !0), !!n) {
|
|
580
|
+
l.preventDefault();
|
|
581
|
+
var p = t.getBoundingClientRect(), f = p.width, w = p.height, h = c.clientX, m = c.clientY, g = r(h - p.left, 0, f), v = r(m - p.top, 0, w);
|
|
582
|
+
e(g / f, v / w);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function s(l, c) {
|
|
586
|
+
var u = l.buttons === void 0 ? l.which : l.buttons;
|
|
587
|
+
u === 1 ? o(l, l, c) : n = !1;
|
|
588
|
+
}
|
|
589
|
+
function a(l, c) {
|
|
590
|
+
l.touches.length === 1 ? o(l, l.touches[0], c) : n = !1;
|
|
591
|
+
}
|
|
592
|
+
i.add(t, "mousedown", function(l) {
|
|
593
|
+
s(l, !0);
|
|
594
|
+
}), i.add(t, "touchstart", function(l) {
|
|
595
|
+
a(l, !0);
|
|
596
|
+
}), i.add(window, "mousemove", s), i.add(t, "touchmove", a), i.add(window, "mouseup", function(l) {
|
|
597
|
+
n = !1;
|
|
598
|
+
}), i.add(t, "touchend", function(l) {
|
|
599
|
+
n = !1;
|
|
600
|
+
}), i.add(t, "touchcancel", function(l) {
|
|
601
|
+
n = !1;
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
var Ke = `linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,
|
|
605
|
+
linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`, Qe = 360, zt = "keydown", ot = "mousedown", wt = "focusin";
|
|
606
|
+
function Y(i, t) {
|
|
607
|
+
return (t || document).querySelector(i);
|
|
608
|
+
}
|
|
609
|
+
function Oe(i) {
|
|
610
|
+
i.preventDefault(), i.stopPropagation();
|
|
611
|
+
}
|
|
612
|
+
function yt(i, t, e, n, r) {
|
|
613
|
+
i.add(t, zt, function(o) {
|
|
614
|
+
e.indexOf(o.key) >= 0 && n(o);
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
var jt = function() {
|
|
618
|
+
function i(t) {
|
|
619
|
+
Et(this, i), this.settings = {
|
|
620
|
+
popup: "right",
|
|
621
|
+
layout: "default",
|
|
622
|
+
alpha: !0,
|
|
623
|
+
editor: !0,
|
|
624
|
+
editorFormat: "hex",
|
|
625
|
+
cancelButton: !1,
|
|
626
|
+
defaultColor: "#0cf"
|
|
627
|
+
}, this._events = new Be(), this.onChange = null, this.onDone = null, this.onOpen = null, this.onClose = null, this.setOptions(t);
|
|
628
|
+
}
|
|
629
|
+
return Vt(i, [{
|
|
630
|
+
key: "setOptions",
|
|
631
|
+
value: function(e) {
|
|
632
|
+
var n = this;
|
|
633
|
+
if (!e)
|
|
634
|
+
return;
|
|
635
|
+
var r = this.settings;
|
|
636
|
+
function o(c, u, p) {
|
|
637
|
+
for (var f in c)
|
|
638
|
+
u[f] = c[f];
|
|
639
|
+
}
|
|
640
|
+
if (e instanceof HTMLElement)
|
|
641
|
+
r.parent = e;
|
|
642
|
+
else {
|
|
643
|
+
r.parent && e.parent && r.parent !== e.parent && (this._events.remove(r.parent), this._popupInited = !1), o(e, r), e.onChange && (this.onChange = e.onChange), e.onDone && (this.onDone = e.onDone), e.onOpen && (this.onOpen = e.onOpen), e.onClose && (this.onClose = e.onClose);
|
|
644
|
+
var s = e.color || e.colour;
|
|
645
|
+
s && this._setColor(s);
|
|
646
|
+
}
|
|
647
|
+
var a = r.parent;
|
|
648
|
+
if (a && r.popup && !this._popupInited) {
|
|
649
|
+
var l = function(u) {
|
|
650
|
+
return n.openHandler(u);
|
|
651
|
+
};
|
|
652
|
+
this._events.add(a, "click", l), yt(this._events, a, [" ", "Spacebar", "Enter"], l), this._popupInited = !0;
|
|
653
|
+
} else e.parent && !r.popup && this.show();
|
|
654
|
+
}
|
|
655
|
+
}, {
|
|
656
|
+
key: "openHandler",
|
|
657
|
+
value: function(e) {
|
|
658
|
+
if (this.show()) {
|
|
659
|
+
e && e.preventDefault(), this.settings.parent.style.pointerEvents = "none";
|
|
660
|
+
var n = e && e.type === zt ? this._domEdit : this.domElement;
|
|
661
|
+
setTimeout(function() {
|
|
662
|
+
return n.focus();
|
|
663
|
+
}, 100), this.onOpen && this.onOpen(this.colour);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}, {
|
|
667
|
+
key: "closeHandler",
|
|
668
|
+
value: function(e) {
|
|
669
|
+
var n = e && e.type, r = !1;
|
|
670
|
+
if (!e)
|
|
671
|
+
r = !0;
|
|
672
|
+
else if (n === ot || n === wt) {
|
|
673
|
+
var o = (this.__containedEvent || 0) + 100;
|
|
674
|
+
e.timeStamp > o && (r = !0);
|
|
675
|
+
} else
|
|
676
|
+
Oe(e), r = !0;
|
|
677
|
+
r && this.hide() && (this.settings.parent.style.pointerEvents = "", n !== ot && this.settings.parent.focus(), this.onClose && this.onClose(this.colour));
|
|
678
|
+
}
|
|
679
|
+
}, {
|
|
680
|
+
key: "movePopup",
|
|
681
|
+
value: function(e, n) {
|
|
682
|
+
this.closeHandler(), this.setOptions(e), n && this.openHandler();
|
|
683
|
+
}
|
|
684
|
+
}, {
|
|
685
|
+
key: "setColor",
|
|
686
|
+
value: function(e, n) {
|
|
687
|
+
this._setColor(e, { silent: n });
|
|
688
|
+
}
|
|
689
|
+
}, {
|
|
690
|
+
key: "_setColor",
|
|
691
|
+
value: function(e, n) {
|
|
692
|
+
if (typeof e == "string" && (e = e.trim()), !!e) {
|
|
693
|
+
n = n || {};
|
|
694
|
+
var r = void 0;
|
|
695
|
+
try {
|
|
696
|
+
r = new Ye(e);
|
|
697
|
+
} catch (s) {
|
|
698
|
+
if (n.failSilently)
|
|
699
|
+
return;
|
|
700
|
+
throw s;
|
|
701
|
+
}
|
|
702
|
+
if (!this.settings.alpha) {
|
|
703
|
+
var o = r.hsla;
|
|
704
|
+
o[3] = 1, r.hsla = o;
|
|
705
|
+
}
|
|
706
|
+
this.colour = this.color = r, this._setHSLA(null, null, null, null, n);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}, {
|
|
710
|
+
key: "setColour",
|
|
711
|
+
value: function(e, n) {
|
|
712
|
+
this.setColor(e, n);
|
|
713
|
+
}
|
|
714
|
+
}, {
|
|
715
|
+
key: "show",
|
|
716
|
+
value: function() {
|
|
717
|
+
var e = this.settings.parent;
|
|
718
|
+
if (!e)
|
|
719
|
+
return !1;
|
|
720
|
+
if (this.domElement) {
|
|
721
|
+
var n = this._toggleDOM(!0);
|
|
722
|
+
return this._setPosition(), n;
|
|
723
|
+
}
|
|
724
|
+
var r = this.settings.template || '<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>', o = Me(r);
|
|
725
|
+
return this.domElement = o, this._domH = Y(".picker_hue", o), this._domSL = Y(".picker_sl", o), this._domA = Y(".picker_alpha", o), this._domEdit = Y(".picker_editor input", o), this._domSample = Y(".picker_sample", o), this._domOkay = Y(".picker_done button", o), this._domCancel = Y(".picker_cancel button", o), o.classList.add("layout_" + this.settings.layout), this.settings.alpha || o.classList.add("no_alpha"), this.settings.editor || o.classList.add("no_editor"), this.settings.cancelButton || o.classList.add("no_cancel"), this._ifPopup(function() {
|
|
726
|
+
return o.classList.add("popup");
|
|
727
|
+
}), this._setPosition(), this.colour ? this._updateUI() : this._setColor(this.settings.defaultColor), this._bindEvents(), !0;
|
|
728
|
+
}
|
|
729
|
+
}, {
|
|
730
|
+
key: "hide",
|
|
731
|
+
value: function() {
|
|
732
|
+
return this._toggleDOM(!1);
|
|
733
|
+
}
|
|
734
|
+
}, {
|
|
735
|
+
key: "destroy",
|
|
736
|
+
value: function() {
|
|
737
|
+
this._events.destroy(), this.domElement && this.settings.parent.removeChild(this.domElement);
|
|
738
|
+
}
|
|
739
|
+
}, {
|
|
740
|
+
key: "_bindEvents",
|
|
741
|
+
value: function() {
|
|
742
|
+
var e = this, n = this, r = this.domElement, o = this._events;
|
|
743
|
+
function s(c, u, p) {
|
|
744
|
+
o.add(c, u, p);
|
|
745
|
+
}
|
|
746
|
+
s(r, "click", function(c) {
|
|
747
|
+
return c.preventDefault();
|
|
748
|
+
}), gt(o, this._domH, function(c, u) {
|
|
749
|
+
return n._setHSLA(c);
|
|
750
|
+
}), gt(o, this._domSL, function(c, u) {
|
|
751
|
+
return n._setHSLA(null, c, 1 - u);
|
|
752
|
+
}), this.settings.alpha && gt(o, this._domA, function(c, u) {
|
|
753
|
+
return n._setHSLA(null, null, null, 1 - u);
|
|
754
|
+
});
|
|
755
|
+
var a = this._domEdit;
|
|
756
|
+
s(a, "input", function(c) {
|
|
757
|
+
n._setColor(this.value, { fromEditor: !0, failSilently: !0 });
|
|
758
|
+
}), s(a, "focus", function(c) {
|
|
759
|
+
var u = this;
|
|
760
|
+
u.selectionStart === u.selectionEnd && u.select();
|
|
761
|
+
}), this._ifPopup(function() {
|
|
762
|
+
var c = function(f) {
|
|
763
|
+
return e.closeHandler(f);
|
|
764
|
+
};
|
|
765
|
+
s(window, ot, c), s(window, wt, c), yt(o, r, ["Esc", "Escape"], c);
|
|
766
|
+
var u = function(f) {
|
|
767
|
+
e.__containedEvent = f.timeStamp;
|
|
768
|
+
};
|
|
769
|
+
s(r, ot, u), s(r, wt, u), s(e._domCancel, "click", c);
|
|
770
|
+
});
|
|
771
|
+
var l = function(u) {
|
|
772
|
+
e._ifPopup(function() {
|
|
773
|
+
return e.closeHandler(u);
|
|
774
|
+
}), e.onDone && e.onDone(e.colour);
|
|
775
|
+
};
|
|
776
|
+
s(this._domOkay, "click", l), yt(o, r, ["Enter"], l);
|
|
777
|
+
}
|
|
778
|
+
}, {
|
|
779
|
+
key: "_setPosition",
|
|
780
|
+
value: function() {
|
|
781
|
+
var e = this.settings.parent, n = this.domElement;
|
|
782
|
+
e !== n.parentNode && e.appendChild(n), this._ifPopup(function(r) {
|
|
783
|
+
getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
784
|
+
var o = r === !0 ? "popup_right" : "popup_" + r;
|
|
785
|
+
["popup_top", "popup_bottom", "popup_left", "popup_right"].forEach(function(s) {
|
|
786
|
+
s === o ? n.classList.add(s) : n.classList.remove(s);
|
|
787
|
+
}), n.classList.add(o);
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
}, {
|
|
791
|
+
key: "_setHSLA",
|
|
792
|
+
value: function(e, n, r, o, s) {
|
|
793
|
+
s = s || {};
|
|
794
|
+
var a = this.colour, l = a.hsla;
|
|
795
|
+
[e, n, r, o].forEach(function(c, u) {
|
|
796
|
+
(c || c === 0) && (l[u] = c);
|
|
797
|
+
}), a.hsla = l, this._updateUI(s), this.onChange && !s.silent && this.onChange(a);
|
|
798
|
+
}
|
|
799
|
+
}, {
|
|
800
|
+
key: "_updateUI",
|
|
801
|
+
value: function(e) {
|
|
802
|
+
if (!this.domElement)
|
|
803
|
+
return;
|
|
804
|
+
e = e || {};
|
|
805
|
+
var n = this.colour, r = n.hsla, o = "hsl(" + r[0] * Qe + ", 100%, 50%)", s = n.hslString, a = n.hslaString, l = this._domH, c = this._domSL, u = this._domA, p = Y(".picker_selector", l), f = Y(".picker_selector", c), w = Y(".picker_selector", u);
|
|
806
|
+
function h(V, S, L) {
|
|
807
|
+
S.style.left = L * 100 + "%";
|
|
808
|
+
}
|
|
809
|
+
function m(V, S, L) {
|
|
810
|
+
S.style.top = L * 100 + "%";
|
|
811
|
+
}
|
|
812
|
+
h(l, p, r[0]), this._domSL.style.backgroundColor = this._domH.style.color = o, h(c, f, r[1]), m(c, f, 1 - r[2]), c.style.color = s, m(u, w, 1 - r[3]);
|
|
813
|
+
var g = s, v = g.replace("hsl", "hsla").replace(")", ", 0)"), T = "linear-gradient(" + [g, v] + ")";
|
|
814
|
+
if (this._domA.style.background = T + ", " + Ke, !e.fromEditor) {
|
|
815
|
+
var C = this.settings.editorFormat, k = this.settings.alpha, y = void 0;
|
|
816
|
+
switch (C) {
|
|
817
|
+
case "rgb":
|
|
818
|
+
y = n.printRGB(k);
|
|
819
|
+
break;
|
|
820
|
+
case "hsl":
|
|
821
|
+
y = n.printHSL(k);
|
|
822
|
+
break;
|
|
823
|
+
default:
|
|
824
|
+
y = n.printHex(k);
|
|
825
|
+
}
|
|
826
|
+
this._domEdit.value = y;
|
|
827
|
+
}
|
|
828
|
+
this._domSample.style.color = a;
|
|
829
|
+
}
|
|
830
|
+
}, {
|
|
831
|
+
key: "_ifPopup",
|
|
832
|
+
value: function(e, n) {
|
|
833
|
+
this.settings.parent && this.settings.popup ? e && e(this.settings.popup) : n && n();
|
|
834
|
+
}
|
|
835
|
+
}, {
|
|
836
|
+
key: "_toggleDOM",
|
|
837
|
+
value: function(e) {
|
|
838
|
+
var n = this.domElement;
|
|
839
|
+
if (!n)
|
|
840
|
+
return !1;
|
|
841
|
+
var r = e ? "" : "none", o = n.style.display !== r;
|
|
842
|
+
return o && (n.style.display = r), o;
|
|
843
|
+
}
|
|
844
|
+
}]), i;
|
|
845
|
+
}();
|
|
846
|
+
{
|
|
847
|
+
var St = document.createElement("style");
|
|
848
|
+
St.textContent = '.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}', document.documentElement.firstElementChild.appendChild(St), jt.StyleElement = St;
|
|
849
|
+
}
|
|
850
|
+
const Z = (i) => `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">${i}</svg>`, B = (i, t) => {
|
|
851
|
+
const e = i === "center" ? 5.5 : 4, n = i === "left" ? 5 : i === "center" ? 9 - e / 2 : 13 - e;
|
|
852
|
+
return Z(`
|
|
853
|
+
<rect x="3.25" y="3.25" width="11.5" height="11.5" stroke="currentColor" stroke-width="1.1"/>
|
|
854
|
+
<path d="M${n} ${t === "top" ? 5.2 : t === "middle" ? 9 : 12.8}H${n + e}" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
855
|
+
`);
|
|
856
|
+
}, x = {
|
|
857
|
+
tableBorder: Z(`
|
|
858
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
859
|
+
<path d="M9 2.75V15.25M2.75 9H15.25" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/>
|
|
860
|
+
`),
|
|
861
|
+
borderAll: Z(`
|
|
862
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
863
|
+
<path d="M9 2.75V15.25M2.75 9H15.25" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
864
|
+
`),
|
|
865
|
+
borderExternal: Z(`
|
|
866
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
|
|
867
|
+
`),
|
|
868
|
+
borderInternal: Z(`
|
|
869
|
+
<path d="M9 2.75V15.25M2.75 9H15.25" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
|
|
870
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="0.8" stroke-dasharray="2 2" opacity="0.45"/>
|
|
871
|
+
`),
|
|
872
|
+
borderDash: Z(`
|
|
873
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2" stroke-dasharray="2 2"/>
|
|
874
|
+
<path d="M9 2.75V15.25M2.75 9H15.25" stroke="currentColor" stroke-width="1.1" stroke-dasharray="2 2" stroke-linecap="round"/>
|
|
875
|
+
`),
|
|
876
|
+
borderNone: Z(`
|
|
877
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2" stroke-dasharray="2 2"/>
|
|
878
|
+
<path d="M4 4L14 14" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
879
|
+
`),
|
|
880
|
+
borderColor: Z(`
|
|
881
|
+
<path d="M4 12L9.5 6.5L12 9L6.5 14.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
882
|
+
<path d="M10.8 5.2L12.8 3.2L14.8 5.2L12.8 7.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
883
|
+
<path d="M4 15H14" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
884
|
+
`),
|
|
885
|
+
borderWidth: Z(`
|
|
886
|
+
<path d="M4 5H14" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
887
|
+
<path d="M4 9H14" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
888
|
+
<path d="M4 13H14" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>
|
|
889
|
+
`),
|
|
890
|
+
cellAlign: B("center", "middle"),
|
|
891
|
+
alignTopLeft: B("left", "top"),
|
|
892
|
+
alignTopCenter: B("center", "top"),
|
|
893
|
+
alignTopRight: B("right", "top"),
|
|
894
|
+
alignMiddleLeft: B("left", "middle"),
|
|
895
|
+
alignMiddleCenter: B("center", "middle"),
|
|
896
|
+
alignMiddleRight: B("right", "middle"),
|
|
897
|
+
alignBottomLeft: B("left", "bottom"),
|
|
898
|
+
alignBottomCenter: B("center", "bottom"),
|
|
899
|
+
alignBottomRight: B("right", "bottom"),
|
|
900
|
+
insert: Z(`
|
|
901
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
902
|
+
<path d="M9 5.25V12.75M5.25 9H12.75" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
903
|
+
`),
|
|
904
|
+
insertColLeft: Z(`
|
|
905
|
+
<rect x="6.2" y="2.75" width="8.05" height="12.5" rx="1.2" stroke="currentColor" stroke-width="1.2"/>
|
|
906
|
+
<path d="M2.8 9H6.2M4.5 7.3V10.7" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
907
|
+
`),
|
|
908
|
+
insertColRight: Z(`
|
|
909
|
+
<rect x="2.75" y="2.75" width="8.05" height="12.5" rx="1.2" stroke="currentColor" stroke-width="1.2"/>
|
|
910
|
+
<path d="M11.8 9H15.2M13.5 7.3V10.7" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
911
|
+
`),
|
|
912
|
+
insertRowAbove: Z(`
|
|
913
|
+
<rect x="2.75" y="6.2" width="12.5" height="8.05" rx="1.2" stroke="currentColor" stroke-width="1.2"/>
|
|
914
|
+
<path d="M9 2.8V6.2M7.3 4.5H10.7" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
915
|
+
`),
|
|
916
|
+
insertRowBelow: Z(`
|
|
917
|
+
<rect x="2.75" y="2.75" width="12.5" height="8.05" rx="1.2" stroke="currentColor" stroke-width="1.2"/>
|
|
918
|
+
<path d="M9 11.8V15.2M7.3 13.5H10.7" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
919
|
+
`),
|
|
920
|
+
delete: Z(`
|
|
921
|
+
<path d="M5 5L13 13M13 5L5 13" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
|
922
|
+
`),
|
|
923
|
+
deleteRow: Z(`
|
|
924
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
925
|
+
<path d="M5 9H13" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
|
926
|
+
`),
|
|
927
|
+
deleteTable: Z(`
|
|
928
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
929
|
+
<path d="M5 5L13 13M13 5L5 13" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
930
|
+
`),
|
|
931
|
+
cancelMerge: Z(`
|
|
932
|
+
<rect x="3" y="4" width="5" height="10" rx="1" stroke="currentColor" stroke-width="1.2"/>
|
|
933
|
+
<rect x="10" y="4" width="5" height="10" rx="1" stroke="currentColor" stroke-width="1.2"/>
|
|
934
|
+
<path d="M8.5 9H9.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
|
935
|
+
`),
|
|
936
|
+
merge: Z(`
|
|
937
|
+
<rect x="3" y="4" width="5" height="10" rx="1" stroke="currentColor" stroke-width="1.2"/>
|
|
938
|
+
<rect x="10" y="4" width="5" height="10" rx="1" stroke="currentColor" stroke-width="1.2"/>
|
|
939
|
+
<path d="M7.5 9H10.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
|
940
|
+
`),
|
|
941
|
+
split: Z(`
|
|
942
|
+
<rect x="3" y="4" width="12" height="10" rx="1.4" stroke="currentColor" stroke-width="1.2"/>
|
|
943
|
+
<path d="M9 4V14" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
944
|
+
`),
|
|
945
|
+
selectAll: Z(`
|
|
946
|
+
<rect x="2.75" y="2.75" width="12.5" height="12.5" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
947
|
+
<rect x="5" y="5" width="2.8" height="2.8" fill="currentColor" opacity="0.5"/>
|
|
948
|
+
<rect x="10.2" y="5" width="2.8" height="2.8" fill="currentColor" opacity="0.5"/>
|
|
949
|
+
<rect x="5" y="10.2" width="2.8" height="2.8" fill="currentColor" opacity="0.5"/>
|
|
950
|
+
<rect x="10.2" y="10.2" width="2.8" height="2.8" fill="currentColor" opacity="0.5"/>
|
|
951
|
+
`),
|
|
952
|
+
backgroundColor: Z(`
|
|
953
|
+
<rect x="3" y="3" width="12" height="12" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
954
|
+
<rect x="5.5" y="5.5" width="7" height="7" rx="1" fill="currentColor" opacity="0.35"/>
|
|
955
|
+
`),
|
|
956
|
+
cellBorder: Z(`
|
|
957
|
+
<rect x="3" y="3" width="12" height="12" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
958
|
+
<path d="M6 6H12M6 9H12M6 12H12" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
959
|
+
`),
|
|
960
|
+
slash: Z(`
|
|
961
|
+
<rect x="3" y="3" width="12" height="12" rx="1.5" stroke="currentColor" stroke-width="1.2"/>
|
|
962
|
+
<path d="M5 13L13 5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
963
|
+
`)
|
|
964
|
+
};
|
|
965
|
+
class De {
|
|
966
|
+
constructor(t) {
|
|
967
|
+
I(this, "draw");
|
|
968
|
+
I(this, "menuElement", null);
|
|
969
|
+
I(this, "_removeContextmenuHandler", null);
|
|
970
|
+
I(this, "subMenuElement", null);
|
|
971
|
+
I(this, "_hideSubMenuTimer", null);
|
|
972
|
+
I(this, "activeColorPanel", null);
|
|
973
|
+
I(this, "activePicker", null);
|
|
974
|
+
this.draw = t;
|
|
975
|
+
}
|
|
976
|
+
show(t, e, n) {
|
|
977
|
+
this.close();
|
|
978
|
+
const r = this._buildMenuItems(n);
|
|
979
|
+
this.menuElement = this._createMenuElement(r, t, e), document.body.appendChild(this.menuElement), this._bindGlobalEvents();
|
|
980
|
+
}
|
|
981
|
+
close() {
|
|
982
|
+
this._destroyActiveColorPanel(), this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.subMenuElement && (this.subMenuElement.remove(), this.subMenuElement = null), this._removeContextmenuHandler && (this._removeContextmenuHandler(), this._removeContextmenuHandler = null);
|
|
983
|
+
}
|
|
984
|
+
_buildMenuItems(t) {
|
|
985
|
+
const e = this._getCurrentTd(t), n = t.borderColor || this._getDefaultBorderColor(), r = Number(t.borderWidth ?? 0.5), o = Number(t.borderExternalWidth ?? 0), s = (e == null ? void 0 : e.backgroundColor) || "#ffffff", a = !!this.draw.getRange().getRange().isCrossRowCol, l = this._canCancelMerge(e);
|
|
986
|
+
return [
|
|
987
|
+
{
|
|
988
|
+
label: "表格边框",
|
|
989
|
+
icon: x.tableBorder,
|
|
990
|
+
children: [
|
|
991
|
+
{
|
|
992
|
+
label: "全部边框",
|
|
993
|
+
icon: x.borderAll,
|
|
994
|
+
active: (t.borderType || J.ALL) === J.ALL,
|
|
995
|
+
action: () => this._setBorderType(J.ALL)
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
label: "外侧边框",
|
|
999
|
+
icon: x.borderExternal,
|
|
1000
|
+
active: t.borderType === J.EXTERNAL,
|
|
1001
|
+
action: () => this._setBorderType(J.EXTERNAL)
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
label: "内部边框",
|
|
1005
|
+
icon: x.borderInternal,
|
|
1006
|
+
active: t.borderType === J.INTERNAL,
|
|
1007
|
+
action: () => this._setBorderType(J.INTERNAL)
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
label: "虚线边框",
|
|
1011
|
+
icon: x.borderDash,
|
|
1012
|
+
active: t.borderType === J.DASH,
|
|
1013
|
+
action: () => this._setBorderType(J.DASH)
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
label: "无边框",
|
|
1017
|
+
icon: x.borderNone,
|
|
1018
|
+
active: t.borderType === J.EMPTY,
|
|
1019
|
+
action: () => this._setBorderType(J.EMPTY)
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
divider: !0
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
label: "边框颜色",
|
|
1026
|
+
icon: x.borderColor,
|
|
1027
|
+
previewColor: n,
|
|
1028
|
+
closeOnClick: !1,
|
|
1029
|
+
action: (c) => this._showBorderColorPicker(n, c)
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
label: "边框宽度",
|
|
1033
|
+
icon: x.borderWidth,
|
|
1034
|
+
inputType: "number",
|
|
1035
|
+
inputDefault: r,
|
|
1036
|
+
inputMin: 0,
|
|
1037
|
+
inputMax: 12,
|
|
1038
|
+
inputStep: 0.5,
|
|
1039
|
+
inputAction: (c) => this._setBorderWidth(c)
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
label: "外边框宽度",
|
|
1043
|
+
icon: x.borderExternal,
|
|
1044
|
+
inputType: "number",
|
|
1045
|
+
inputDefault: o,
|
|
1046
|
+
inputMin: 0,
|
|
1047
|
+
inputMax: 12,
|
|
1048
|
+
inputStep: 0.5,
|
|
1049
|
+
inputAction: (c) => this._setBorderExternalWidth(c)
|
|
1050
|
+
}
|
|
1051
|
+
]
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
label: "单元格对齐方式",
|
|
1055
|
+
icon: x.cellAlign,
|
|
1056
|
+
childrenLayout: "icon-grid",
|
|
1057
|
+
children: [
|
|
1058
|
+
{
|
|
1059
|
+
title: "左上对齐",
|
|
1060
|
+
icon: x.alignTopLeft,
|
|
1061
|
+
iconOnly: !0,
|
|
1062
|
+
active: this._isCellAlignActive(e, U.TOP, W.LEFT),
|
|
1063
|
+
action: () => this._setCellAlign(U.TOP, W.LEFT)
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
title: "中上对齐",
|
|
1067
|
+
icon: x.alignTopCenter,
|
|
1068
|
+
iconOnly: !0,
|
|
1069
|
+
active: this._isCellAlignActive(e, U.TOP, W.CENTER),
|
|
1070
|
+
action: () => this._setCellAlign(U.TOP, W.CENTER)
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
title: "右上对齐",
|
|
1074
|
+
icon: x.alignTopRight,
|
|
1075
|
+
iconOnly: !0,
|
|
1076
|
+
active: this._isCellAlignActive(e, U.TOP, W.RIGHT),
|
|
1077
|
+
action: () => this._setCellAlign(U.TOP, W.RIGHT)
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
title: "左中对齐",
|
|
1081
|
+
icon: x.alignMiddleLeft,
|
|
1082
|
+
iconOnly: !0,
|
|
1083
|
+
active: this._isCellAlignActive(e, U.MIDDLE, W.LEFT),
|
|
1084
|
+
action: () => this._setCellAlign(U.MIDDLE, W.LEFT)
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
title: "居中对齐",
|
|
1088
|
+
icon: x.alignMiddleCenter,
|
|
1089
|
+
iconOnly: !0,
|
|
1090
|
+
active: this._isCellAlignActive(e, U.MIDDLE, W.CENTER),
|
|
1091
|
+
action: () => this._setCellAlign(U.MIDDLE, W.CENTER)
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
title: "右中对齐",
|
|
1095
|
+
icon: x.alignMiddleRight,
|
|
1096
|
+
iconOnly: !0,
|
|
1097
|
+
active: this._isCellAlignActive(e, U.MIDDLE, W.RIGHT),
|
|
1098
|
+
action: () => this._setCellAlign(U.MIDDLE, W.RIGHT)
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
title: "左下对齐",
|
|
1102
|
+
icon: x.alignBottomLeft,
|
|
1103
|
+
iconOnly: !0,
|
|
1104
|
+
active: this._isCellAlignActive(e, U.BOTTOM, W.LEFT),
|
|
1105
|
+
action: () => this._setCellAlign(U.BOTTOM, W.LEFT)
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
title: "中下对齐",
|
|
1109
|
+
icon: x.alignBottomCenter,
|
|
1110
|
+
iconOnly: !0,
|
|
1111
|
+
active: this._isCellAlignActive(e, U.BOTTOM, W.CENTER),
|
|
1112
|
+
action: () => this._setCellAlign(U.BOTTOM, W.CENTER)
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
title: "右下对齐",
|
|
1116
|
+
icon: x.alignBottomRight,
|
|
1117
|
+
iconOnly: !0,
|
|
1118
|
+
active: this._isCellAlignActive(e, U.BOTTOM, W.RIGHT),
|
|
1119
|
+
action: () => this._setCellAlign(U.BOTTOM, W.RIGHT)
|
|
1120
|
+
}
|
|
1121
|
+
]
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
label: "插入行列",
|
|
1125
|
+
icon: x.insert,
|
|
1126
|
+
children: [
|
|
1127
|
+
{
|
|
1128
|
+
label: "在左侧插入",
|
|
1129
|
+
icon: x.insertColLeft,
|
|
1130
|
+
inputType: "number",
|
|
1131
|
+
inputDefault: 1,
|
|
1132
|
+
inputMin: 1,
|
|
1133
|
+
inputMax: 100,
|
|
1134
|
+
inputStep: 1,
|
|
1135
|
+
inputAction: (c) => this._repeatAction(c, () => {
|
|
1136
|
+
this.draw.getTableOperate().insertTableLeftCol();
|
|
1137
|
+
}),
|
|
1138
|
+
unit: "列"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
label: "在右侧插入",
|
|
1142
|
+
icon: x.insertColRight,
|
|
1143
|
+
inputType: "number",
|
|
1144
|
+
inputDefault: 1,
|
|
1145
|
+
inputMin: 1,
|
|
1146
|
+
inputMax: 100,
|
|
1147
|
+
inputStep: 1,
|
|
1148
|
+
inputAction: (c) => this._repeatAction(c, () => {
|
|
1149
|
+
this.draw.getTableOperate().insertTableRightCol();
|
|
1150
|
+
}),
|
|
1151
|
+
unit: "列"
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
label: "在上方插入",
|
|
1155
|
+
icon: x.insertRowAbove,
|
|
1156
|
+
inputType: "number",
|
|
1157
|
+
inputDefault: 1,
|
|
1158
|
+
inputMin: 1,
|
|
1159
|
+
inputMax: 100,
|
|
1160
|
+
inputStep: 1,
|
|
1161
|
+
inputAction: (c) => this._repeatAction(c, () => {
|
|
1162
|
+
this.draw.getTableOperate().insertTableTopRow();
|
|
1163
|
+
}),
|
|
1164
|
+
unit: "行"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
label: "在下方插入",
|
|
1168
|
+
icon: x.insertRowBelow,
|
|
1169
|
+
inputType: "number",
|
|
1170
|
+
inputDefault: 1,
|
|
1171
|
+
inputMin: 1,
|
|
1172
|
+
inputMax: 100,
|
|
1173
|
+
inputStep: 1,
|
|
1174
|
+
inputAction: (c) => this._repeatAction(c, () => {
|
|
1175
|
+
this.draw.getTableOperate().insertTableBottomRow();
|
|
1176
|
+
}),
|
|
1177
|
+
unit: "行"
|
|
1178
|
+
}
|
|
1179
|
+
]
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
label: "删除行列",
|
|
1183
|
+
icon: x.delete,
|
|
1184
|
+
children: [
|
|
1185
|
+
{
|
|
1186
|
+
label: "删除当前行",
|
|
1187
|
+
icon: x.deleteRow,
|
|
1188
|
+
action: () => this._deleteRow()
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
label: "删除当前列",
|
|
1192
|
+
icon: x.deleteRow,
|
|
1193
|
+
action: () => this._deleteColumn()
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
label: "删除表格",
|
|
1197
|
+
icon: x.deleteTable,
|
|
1198
|
+
danger: !0,
|
|
1199
|
+
action: () => this._deleteTable()
|
|
1200
|
+
}
|
|
1201
|
+
]
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
label: "取消合并",
|
|
1205
|
+
icon: x.cancelMerge,
|
|
1206
|
+
disabled: !l,
|
|
1207
|
+
action: () => this._cancelMergeTableCell()
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
divider: !0
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
label: "合并单元格",
|
|
1214
|
+
icon: x.merge,
|
|
1215
|
+
disabled: !a,
|
|
1216
|
+
action: () => this._mergeTableCell()
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
label: "拆分单元格",
|
|
1220
|
+
icon: x.split,
|
|
1221
|
+
children: [
|
|
1222
|
+
{
|
|
1223
|
+
label: "左右拆分",
|
|
1224
|
+
icon: x.split,
|
|
1225
|
+
action: () => this._splitVerticalTableCell()
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
label: "上下拆分",
|
|
1229
|
+
icon: x.split,
|
|
1230
|
+
action: () => this._splitHorizontalTableCell()
|
|
1231
|
+
}
|
|
1232
|
+
]
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
label: "单元格边框",
|
|
1236
|
+
icon: x.cellBorder,
|
|
1237
|
+
children: [
|
|
1238
|
+
{
|
|
1239
|
+
label: "上边框",
|
|
1240
|
+
icon: x.cellBorder,
|
|
1241
|
+
action: () => this._toggleTdBorderType(nt.TOP)
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
label: "右边框",
|
|
1245
|
+
icon: x.cellBorder,
|
|
1246
|
+
action: () => this._toggleTdBorderType(nt.RIGHT)
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
label: "下边框",
|
|
1250
|
+
icon: x.cellBorder,
|
|
1251
|
+
action: () => this._toggleTdBorderType(nt.BOTTOM)
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
label: "左边框",
|
|
1255
|
+
icon: x.cellBorder,
|
|
1256
|
+
action: () => this._toggleTdBorderType(nt.LEFT)
|
|
1257
|
+
}
|
|
1258
|
+
]
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
label: "斜线样式",
|
|
1262
|
+
icon: x.slash,
|
|
1263
|
+
children: [
|
|
1264
|
+
{
|
|
1265
|
+
label: "正斜线",
|
|
1266
|
+
icon: x.slash,
|
|
1267
|
+
action: () => this._toggleTdSlashType(Gt.FORWARD)
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
label: "反斜线",
|
|
1271
|
+
icon: x.slash,
|
|
1272
|
+
action: () => this._toggleTdSlashType(Gt.BACK)
|
|
1273
|
+
}
|
|
1274
|
+
]
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
label: "单元格底纹",
|
|
1278
|
+
icon: x.backgroundColor,
|
|
1279
|
+
previewColor: s,
|
|
1280
|
+
closeOnClick: !1,
|
|
1281
|
+
action: (c) => this._showBackgroundColorPicker(s, c)
|
|
1282
|
+
},
|
|
1283
|
+
{
|
|
1284
|
+
divider: !0
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
label: "全选表格",
|
|
1288
|
+
icon: x.selectAll,
|
|
1289
|
+
action: () => this._selectAllTable()
|
|
1290
|
+
}
|
|
1291
|
+
];
|
|
1292
|
+
}
|
|
1293
|
+
_createMenuElement(t, e, n) {
|
|
1294
|
+
const r = document.createElement("div");
|
|
1295
|
+
r.classList.add(`${P}-table-context-menu`), t.forEach((l) => {
|
|
1296
|
+
if (l.divider) {
|
|
1297
|
+
const c = document.createElement("div");
|
|
1298
|
+
c.classList.add(`${P}-table-context-menu__divider`), r.appendChild(c);
|
|
1299
|
+
} else {
|
|
1300
|
+
const c = this._createMenuItem(l);
|
|
1301
|
+
r.appendChild(c);
|
|
1302
|
+
}
|
|
1303
|
+
}), r.style.left = `${e}px`, r.style.top = `${n}px`;
|
|
1304
|
+
const o = r.getBoundingClientRect(), s = window.innerWidth, a = window.innerHeight;
|
|
1305
|
+
return e + o.width > s && (r.style.left = `${s - o.width - 10}px`), n + o.height > a && (r.style.top = `${a - o.height - 10}px`), r;
|
|
1306
|
+
}
|
|
1307
|
+
_createMenuItem(t) {
|
|
1308
|
+
const e = document.createElement("div");
|
|
1309
|
+
e.classList.add(`${P}-table-context-menu__item`), t.iconOnly && e.classList.add(`${P}-table-context-menu__item--icon-only`), (t.title || t.label) && (e.title = t.title || t.label || ""), t.disabled && e.classList.add("disabled"), t.danger && e.classList.add("danger"), t.active && e.classList.add("active");
|
|
1310
|
+
const n = document.createElement("div");
|
|
1311
|
+
n.classList.add(`${P}-table-context-menu__main`), e.appendChild(n);
|
|
1312
|
+
const r = document.createElement("div");
|
|
1313
|
+
if (r.classList.add(`${P}-table-context-menu__meta`), e.appendChild(r), t.icon) {
|
|
1314
|
+
const o = document.createElement("span");
|
|
1315
|
+
o.classList.add(`${P}-table-context-menu__icon`), o.innerHTML = t.icon, n.appendChild(o);
|
|
1316
|
+
}
|
|
1317
|
+
if (t.label && !t.iconOnly) {
|
|
1318
|
+
const o = document.createElement("span");
|
|
1319
|
+
o.classList.add(`${P}-table-context-menu__label`), o.textContent = t.label, n.appendChild(o);
|
|
1320
|
+
}
|
|
1321
|
+
if (t.inputType === "number") {
|
|
1322
|
+
const o = document.createElement("input");
|
|
1323
|
+
if (o.type = "number", o.min = String(t.inputMin ?? 1), o.max = String(t.inputMax ?? 100), o.step = String(t.inputStep ?? 1), o.value = String(t.inputDefault || 1), o.classList.add(`${P}-table-context-menu__input-number`), o.addEventListener("click", (s) => s.stopPropagation()), o.addEventListener("mousedown", (s) => s.stopPropagation()), r.appendChild(o), t.unit) {
|
|
1324
|
+
const s = document.createElement("span");
|
|
1325
|
+
s.classList.add(`${P}-table-context-menu__unit`), s.textContent = t.unit, r.appendChild(s);
|
|
1326
|
+
}
|
|
1327
|
+
t.inputAction && e.addEventListener("click", (s) => {
|
|
1328
|
+
const a = Number.parseFloat(o.value);
|
|
1329
|
+
s.stopPropagation(), t.inputAction(Number.isFinite(a) ? a : t.inputDefault || 1), this.close();
|
|
1330
|
+
});
|
|
1331
|
+
} else {
|
|
1332
|
+
if (t.previewColor) {
|
|
1333
|
+
const o = document.createElement("span");
|
|
1334
|
+
o.classList.add(`${P}-table-context-menu__color-preview`), o.style.backgroundColor = t.previewColor, r.appendChild(o);
|
|
1335
|
+
}
|
|
1336
|
+
if (t.shortcut) {
|
|
1337
|
+
const o = document.createElement("span");
|
|
1338
|
+
o.classList.add(`${P}-table-context-menu__shortcut`), o.textContent = t.shortcut, r.appendChild(o);
|
|
1339
|
+
}
|
|
1340
|
+
if (t.children && t.children.length > 0) {
|
|
1341
|
+
const o = document.createElement("span");
|
|
1342
|
+
o.classList.add(`${P}-table-context-menu__arrow`), o.textContent = ">", r.appendChild(o), e.addEventListener("mouseenter", (s) => {
|
|
1343
|
+
this._hideSubMenuTimer && (clearTimeout(this._hideSubMenuTimer), this._hideSubMenuTimer = null), this._showSubMenu(
|
|
1344
|
+
s.currentTarget,
|
|
1345
|
+
t.children,
|
|
1346
|
+
t.childrenLayout || "default"
|
|
1347
|
+
);
|
|
1348
|
+
}), e.addEventListener("mouseleave", () => {
|
|
1349
|
+
this._delayHideSubMenu();
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
t.action && !t.disabled && e.addEventListener("click", (o) => {
|
|
1353
|
+
o.stopPropagation(), t.action(e), t.closeOnClick !== !1 && this.close();
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
return e;
|
|
1357
|
+
}
|
|
1358
|
+
_showSubMenu(t, e, n = "default") {
|
|
1359
|
+
this._hideSubMenu();
|
|
1360
|
+
const r = document.createElement("div");
|
|
1361
|
+
r.classList.add(`${P}-table-context-menu`), r.classList.add(`${P}-table-context-menu--sub`), n === "icon-grid" && r.classList.add(`${P}-table-context-menu--icon-grid`), e.forEach((u) => {
|
|
1362
|
+
if (u.divider) {
|
|
1363
|
+
const p = document.createElement("div");
|
|
1364
|
+
p.classList.add(`${P}-table-context-menu__divider`), r.appendChild(p);
|
|
1365
|
+
} else {
|
|
1366
|
+
const p = this._createMenuItem(u);
|
|
1367
|
+
r.appendChild(p);
|
|
1368
|
+
}
|
|
1369
|
+
});
|
|
1370
|
+
const o = t.getBoundingClientRect(), s = 5;
|
|
1371
|
+
let a = o.right + s, l = o.top;
|
|
1372
|
+
document.body.appendChild(r);
|
|
1373
|
+
const c = r.getBoundingClientRect();
|
|
1374
|
+
a + c.width > window.innerWidth && (a = o.left - c.width - s), l + c.height > window.innerHeight && (l = window.innerHeight - c.height - 10), r.style.left = `${a}px`, r.style.top = `${l}px`, r.addEventListener("mouseenter", () => {
|
|
1375
|
+
this._hideSubMenuTimer && (clearTimeout(this._hideSubMenuTimer), this._hideSubMenuTimer = null);
|
|
1376
|
+
}), r.addEventListener("mouseleave", () => {
|
|
1377
|
+
this._delayHideSubMenu();
|
|
1378
|
+
}), this.subMenuElement = r;
|
|
1379
|
+
}
|
|
1380
|
+
_delayHideSubMenu() {
|
|
1381
|
+
this._hideSubMenuTimer && clearTimeout(this._hideSubMenuTimer), this._hideSubMenuTimer = window.setTimeout(() => {
|
|
1382
|
+
this._hideSubMenu(), this._hideSubMenuTimer = null;
|
|
1383
|
+
}, 150);
|
|
1384
|
+
}
|
|
1385
|
+
_hideSubMenu() {
|
|
1386
|
+
this._hideSubMenuTimer && (clearTimeout(this._hideSubMenuTimer), this._hideSubMenuTimer = null), this.subMenuElement && (this.subMenuElement.remove(), this.subMenuElement = null);
|
|
1387
|
+
}
|
|
1388
|
+
_bindGlobalEvents() {
|
|
1389
|
+
const t = (r) => {
|
|
1390
|
+
var a, l, c;
|
|
1391
|
+
const o = r.target;
|
|
1392
|
+
!!((a = this.menuElement) != null && a.contains(o)) || !!((l = this.subMenuElement) != null && l.contains(o)) || !!((c = this.activeColorPanel) != null && c.contains(o)) || this.close();
|
|
1393
|
+
}, e = (r) => {
|
|
1394
|
+
r.key === "Escape" && this.close();
|
|
1395
|
+
}, n = () => {
|
|
1396
|
+
this.close();
|
|
1397
|
+
};
|
|
1398
|
+
document.addEventListener("click", t), document.addEventListener("keydown", e), window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), this._removeContextmenuHandler = () => {
|
|
1399
|
+
document.removeEventListener("click", t), document.removeEventListener("keydown", e), window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n);
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
_repeatAction(t, e) {
|
|
1403
|
+
const n = Math.max(1, Math.floor(t));
|
|
1404
|
+
for (let r = 0; r < n; r++)
|
|
1405
|
+
e();
|
|
1406
|
+
}
|
|
1407
|
+
_getCurrentTd(t) {
|
|
1408
|
+
var n, r;
|
|
1409
|
+
const e = this.draw.getPosition().getPositionContext();
|
|
1410
|
+
return !e.isTable || e.trIndex === void 0 || e.tdIndex === void 0 ? null : ((r = (n = t.trList) == null ? void 0 : n[e.trIndex]) == null ? void 0 : r.tdList[e.tdIndex]) || null;
|
|
1411
|
+
}
|
|
1412
|
+
_canCancelMerge(t) {
|
|
1413
|
+
return t ? t.rowspan > 1 || t.colspan > 1 : !1;
|
|
1414
|
+
}
|
|
1415
|
+
_getDefaultBorderColor() {
|
|
1416
|
+
return this.draw.getOptions().table.defaultBorderColor;
|
|
1417
|
+
}
|
|
1418
|
+
_deleteTable() {
|
|
1419
|
+
this.draw.getTableOperate().deleteTable();
|
|
1420
|
+
}
|
|
1421
|
+
_deleteRow() {
|
|
1422
|
+
this.draw.getTableOperate().deleteTableRow();
|
|
1423
|
+
}
|
|
1424
|
+
_deleteColumn() {
|
|
1425
|
+
this.draw.getTableOperate().deleteTableCol();
|
|
1426
|
+
}
|
|
1427
|
+
_selectAllTable() {
|
|
1428
|
+
this.draw.getTableOperate().tableSelectAll();
|
|
1429
|
+
}
|
|
1430
|
+
_setBorderType(t) {
|
|
1431
|
+
this.draw.getTableOperate().tableBorderType(t);
|
|
1432
|
+
}
|
|
1433
|
+
_setBorderWidth(t) {
|
|
1434
|
+
this.draw.getTableOperate().tableBorderWidth(t);
|
|
1435
|
+
}
|
|
1436
|
+
_setBorderExternalWidth(t) {
|
|
1437
|
+
this.draw.getTableOperate().tableBorderExternalWidth(t);
|
|
1438
|
+
}
|
|
1439
|
+
_isCellAlignActive(t, e, n) {
|
|
1440
|
+
const r = (t == null ? void 0 : t.verticalAlign) || U.TOP, o = this._getTdRowFlex(t);
|
|
1441
|
+
return r === e && o === n;
|
|
1442
|
+
}
|
|
1443
|
+
_getTdRowFlex(t) {
|
|
1444
|
+
var n;
|
|
1445
|
+
return ((n = t == null ? void 0 : t.value.find((r) => r.rowFlex)) == null ? void 0 : n.rowFlex) || W.LEFT;
|
|
1446
|
+
}
|
|
1447
|
+
_getSelectedTds() {
|
|
1448
|
+
const t = this.draw.getTableParticle().getRangeRowCol();
|
|
1449
|
+
if (!t) return [];
|
|
1450
|
+
const e = [], n = /* @__PURE__ */ new Set();
|
|
1451
|
+
for (let r = 0; r < t.length; r++) {
|
|
1452
|
+
const o = t[r];
|
|
1453
|
+
for (let s = 0; s < o.length; s++) {
|
|
1454
|
+
const a = o[s];
|
|
1455
|
+
if (!a) continue;
|
|
1456
|
+
const l = a.id || `${a.rowIndex}-${a.colIndex}-${a.trIndex}-${a.tdIndex}`;
|
|
1457
|
+
n.has(l) || (n.add(l), e.push(a));
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
return e;
|
|
1461
|
+
}
|
|
1462
|
+
_setCellAlign(t, e) {
|
|
1463
|
+
const n = this._getSelectedTds();
|
|
1464
|
+
if (!n.length) return;
|
|
1465
|
+
let r = !1;
|
|
1466
|
+
for (let s = 0; s < n.length; s++) {
|
|
1467
|
+
const a = n[s];
|
|
1468
|
+
(a.verticalAlign || U.TOP) !== t && (a.verticalAlign = t, r = !0);
|
|
1469
|
+
for (let c = 0; c < a.value.length; c++) {
|
|
1470
|
+
const u = a.value[c];
|
|
1471
|
+
(u.rowFlex || W.LEFT) !== e && (e === W.LEFT ? delete u.rowFlex : u.rowFlex = e, r = !0);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
if (!r) return;
|
|
1475
|
+
const { endIndex: o } = this.draw.getRange().getRange();
|
|
1476
|
+
this.draw.render({
|
|
1477
|
+
curIndex: o
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
_toggleTdBorderType(t) {
|
|
1481
|
+
this.draw.getTableOperate().tableTdBorderType(t);
|
|
1482
|
+
}
|
|
1483
|
+
_toggleTdSlashType(t) {
|
|
1484
|
+
this.draw.getTableOperate().tableTdSlashType(t);
|
|
1485
|
+
}
|
|
1486
|
+
_mergeTableCell() {
|
|
1487
|
+
this.draw.getTableOperate().mergeTableCell();
|
|
1488
|
+
}
|
|
1489
|
+
_cancelMergeTableCell() {
|
|
1490
|
+
this.draw.getTableOperate().cancelMergeTableCell();
|
|
1491
|
+
}
|
|
1492
|
+
_splitVerticalTableCell() {
|
|
1493
|
+
this.draw.getTableOperate().splitVerticalTableCell();
|
|
1494
|
+
}
|
|
1495
|
+
_splitHorizontalTableCell() {
|
|
1496
|
+
this.draw.getTableOperate().splitHorizontalTableCell();
|
|
1497
|
+
}
|
|
1498
|
+
_showBorderColorPicker(t, e) {
|
|
1499
|
+
this._showColorPanel(t, e, (n) => {
|
|
1500
|
+
this.draw.getTableOperate().tableBorderColor(n);
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
_showBackgroundColorPicker(t, e) {
|
|
1504
|
+
this._showColorPanel(t, e, (n) => {
|
|
1505
|
+
this.draw.getTableOperate().tableTdBackgroundColor(n);
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
_showColorPanel(t, e, n) {
|
|
1509
|
+
this._destroyActiveColorPanel();
|
|
1510
|
+
const r = this._normalizeColorValue(t), o = document.createElement("div");
|
|
1511
|
+
o.classList.add(`${P}-table-context-menu__color-panel`);
|
|
1512
|
+
const s = document.createElement("div");
|
|
1513
|
+
s.classList.add(`${P}-table-context-menu__picker-host`), o.appendChild(s), document.body.appendChild(o), this.activeColorPanel = o, this._positionColorPanel(o, e);
|
|
1514
|
+
const a = new jt({
|
|
1515
|
+
parent: s,
|
|
1516
|
+
popup: !1,
|
|
1517
|
+
color: r,
|
|
1518
|
+
editor: !0,
|
|
1519
|
+
editorFormat: "hex",
|
|
1520
|
+
cancelButton: !1,
|
|
1521
|
+
onChange: (c) => {
|
|
1522
|
+
n(c.hex);
|
|
1523
|
+
},
|
|
1524
|
+
onDone: () => {
|
|
1525
|
+
this.close();
|
|
1526
|
+
},
|
|
1527
|
+
onClose: () => {
|
|
1528
|
+
this.close();
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
this.activePicker = a;
|
|
1532
|
+
const l = s.querySelector(".picker_done button");
|
|
1533
|
+
l && (l.textContent = "确认");
|
|
1534
|
+
}
|
|
1535
|
+
_destroyActiveColorPanel() {
|
|
1536
|
+
if (this.activePicker) {
|
|
1537
|
+
const t = this.activePicker;
|
|
1538
|
+
this.activePicker = null, t.destroy();
|
|
1539
|
+
}
|
|
1540
|
+
this.activeColorPanel && (this.activeColorPanel.remove(), this.activeColorPanel = null);
|
|
1541
|
+
}
|
|
1542
|
+
_positionColorPanel(t, e) {
|
|
1543
|
+
const n = e || this.subMenuElement || this.menuElement;
|
|
1544
|
+
if (!n) return;
|
|
1545
|
+
const r = 8, o = 8, s = n.getBoundingClientRect(), a = t.getBoundingClientRect();
|
|
1546
|
+
let l = s.right + r, c = s.top;
|
|
1547
|
+
l + a.width > window.innerWidth - o && (l = s.left - a.width - r), l < o && (l = Math.max(o, window.innerWidth - a.width - o)), c + a.height > window.innerHeight - o && (c = window.innerHeight - a.height - o), c < o && (c = o), t.style.left = `${l}px`, t.style.top = `${c}px`;
|
|
1548
|
+
}
|
|
1549
|
+
_normalizeColorValue(t, e = !0) {
|
|
1550
|
+
const n = t.trim(), r = n.startsWith("#") ? n : `#${n}`;
|
|
1551
|
+
return /^#[0-9a-fA-F]{6}$/.test(r) ? r : e ? "#000000" : "";
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
class ze {
|
|
1555
|
+
constructor() {
|
|
1556
|
+
I(this, "_contextMenu");
|
|
1557
|
+
}
|
|
1558
|
+
install(t) {
|
|
1559
|
+
return this._contextMenu = new De(t), t.__tableContextMenu = this._contextMenu, this;
|
|
1560
|
+
}
|
|
1561
|
+
getContextMenu() {
|
|
1562
|
+
return this._contextMenu;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
function je(i, t) {
|
|
1566
|
+
return i === 1125 && t === 1593 ? {
|
|
1567
|
+
size: "a3",
|
|
1568
|
+
width: "297mm",
|
|
1569
|
+
height: "420mm"
|
|
1570
|
+
} : i === 794 && t === 1123 ? {
|
|
1571
|
+
size: "a4",
|
|
1572
|
+
width: "210mm",
|
|
1573
|
+
height: "297mm"
|
|
1574
|
+
} : i === 565 && t === 796 ? {
|
|
1575
|
+
size: "a5",
|
|
1576
|
+
width: "148mm",
|
|
1577
|
+
height: "210mm"
|
|
1578
|
+
} : {
|
|
1579
|
+
size: "",
|
|
1580
|
+
width: `${i}px`,
|
|
1581
|
+
height: `${t}px`
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
function $e(i, t) {
|
|
1585
|
+
const { width: e, height: n, direction: r = rt.VERTICAL } = t, o = document.createElement("iframe");
|
|
1586
|
+
o.style.visibility = "hidden", o.style.position = "absolute", o.style.left = "0", o.style.top = "0", o.style.width = "0", o.style.height = "0", o.style.border = "none", document.body.append(o);
|
|
1587
|
+
const s = o.contentWindow, a = s.document;
|
|
1588
|
+
a.open();
|
|
1589
|
+
const l = document.createElement("div"), c = je(e, n);
|
|
1590
|
+
i.forEach((f) => {
|
|
1591
|
+
const w = document.createElement("img");
|
|
1592
|
+
w.style.width = r === rt.HORIZONTAL ? c.height : c.width, w.style.height = r === rt.HORIZONTAL ? c.width : c.height, w.src = f, l.append(w);
|
|
1593
|
+
});
|
|
1594
|
+
const u = document.createElement("style"), p = `
|
|
1595
|
+
* {
|
|
1596
|
+
margin: 0;
|
|
1597
|
+
padding: 0;
|
|
1598
|
+
}
|
|
1599
|
+
@page {
|
|
1600
|
+
margin: 0;
|
|
1601
|
+
size: ${c.size} ${r === rt.HORIZONTAL ? "landscape" : "portrait"};
|
|
1602
|
+
}
|
|
1603
|
+
/* 隐藏浏览器默认的页眉页脚 */
|
|
1604
|
+
@media print {
|
|
1605
|
+
@page {
|
|
1606
|
+
margin: 0;
|
|
1607
|
+
}
|
|
1608
|
+
body {
|
|
1609
|
+
margin: 0;
|
|
1610
|
+
padding: 0;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
`;
|
|
1614
|
+
u.append(document.createTextNode(p)), setTimeout(() => {
|
|
1615
|
+
a.write(`${u.outerHTML}${l.innerHTML}`), s.print(), a.close(), window.addEventListener(
|
|
1616
|
+
"mouseover",
|
|
1617
|
+
() => {
|
|
1618
|
+
o == null || o.remove();
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
once: !0
|
|
1622
|
+
}
|
|
1623
|
+
);
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
class Fr {
|
|
1627
|
+
constructor(t, e, n = {}) {
|
|
1628
|
+
I(this, "command");
|
|
1629
|
+
I(this, "listener");
|
|
1630
|
+
I(this, "eventBus");
|
|
1631
|
+
I(this, "override");
|
|
1632
|
+
I(this, "register");
|
|
1633
|
+
I(this, "comment");
|
|
1634
|
+
I(this, "revision");
|
|
1635
|
+
I(this, "destroy");
|
|
1636
|
+
I(this, "use");
|
|
1637
|
+
var v;
|
|
1638
|
+
const r = fe(n);
|
|
1639
|
+
e = me(e);
|
|
1640
|
+
let o = [], s = [], a = [];
|
|
1641
|
+
Array.isArray(e) ? s = e : (o = e.header || [], s = e.main, a = e.footer || []), [
|
|
1642
|
+
o,
|
|
1643
|
+
s,
|
|
1644
|
+
a
|
|
1645
|
+
].forEach((T) => {
|
|
1646
|
+
be(T, {
|
|
1647
|
+
editorOptions: r,
|
|
1648
|
+
isForceCompensation: !0
|
|
1649
|
+
});
|
|
1650
|
+
}), this.listener = new xe(), this.eventBus = new Ie(), this.override = new ge();
|
|
1651
|
+
const c = new we(
|
|
1652
|
+
t,
|
|
1653
|
+
r,
|
|
1654
|
+
{
|
|
1655
|
+
header: o,
|
|
1656
|
+
main: s,
|
|
1657
|
+
footer: a
|
|
1658
|
+
},
|
|
1659
|
+
this.listener,
|
|
1660
|
+
this.eventBus,
|
|
1661
|
+
this.override
|
|
1662
|
+
);
|
|
1663
|
+
c.setBlockParticle(new Ve(c)), new Le().install(c), new Ze().install(c);
|
|
1664
|
+
const u = new _e().install(c), p = new ke(c, {
|
|
1665
|
+
pasteByApi: ye,
|
|
1666
|
+
printImageBase64: $e
|
|
1667
|
+
});
|
|
1668
|
+
this.command = new Ce(p), c.__structureAdapter = p._structure, new Ne().install(c, this.command), new He().install(c, this.command), new ze().install(c), this.comment = new Re().install(this.command), this.revision = new We();
|
|
1669
|
+
const f = new Ee().install(c, this.command), h = ((v = r.floatingBar) == null ? void 0 : v.enabled) !== !1 ? new Se(c, this.command) : null, m = f.getShortcut();
|
|
1670
|
+
this.register = new Te({
|
|
1671
|
+
shortcut: m,
|
|
1672
|
+
i18n: c.getI18n()
|
|
1673
|
+
}), c.setRegister(this.register), this.destroy = () => {
|
|
1674
|
+
var T;
|
|
1675
|
+
c.destroy(), m.removeEvent(), h == null || h.destroy(), (T = u.getWorkerManager()) == null || T.terminate();
|
|
1676
|
+
};
|
|
1677
|
+
const g = new ve(this);
|
|
1678
|
+
this.use = g.use.bind(g);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
class _r {
|
|
1682
|
+
install(t) {
|
|
1683
|
+
return this;
|
|
1684
|
+
}
|
|
1685
|
+
setLang(t, e) {
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
class Xr {
|
|
1689
|
+
constructor() {
|
|
1690
|
+
I(this, "_saveTimer", null);
|
|
1691
|
+
I(this, "_saving", !1);
|
|
1692
|
+
I(this, "_pendingSave", !1);
|
|
1693
|
+
I(this, "_autoSaveOptions", null);
|
|
1694
|
+
}
|
|
1695
|
+
install() {
|
|
1696
|
+
return this;
|
|
1697
|
+
}
|
|
1698
|
+
configureAutoSave(t) {
|
|
1699
|
+
this._autoSaveOptions = {
|
|
1700
|
+
interval: 800,
|
|
1701
|
+
enabled: !0,
|
|
1702
|
+
...t
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
async saveNow(t) {
|
|
1706
|
+
var n, r;
|
|
1707
|
+
if (this._saving) {
|
|
1708
|
+
this._pendingSave = !0;
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
if (!this._autoSaveOptions || (r = (n = this._autoSaveOptions).isReadonly) != null && r.call(n)) return;
|
|
1712
|
+
const e = this._autoSaveOptions.getContent();
|
|
1713
|
+
if (e) {
|
|
1714
|
+
this._saving = !0, this._pendingSave = !1;
|
|
1715
|
+
try {
|
|
1716
|
+
await this._autoSaveOptions.onSave(e);
|
|
1717
|
+
} finally {
|
|
1718
|
+
this._saving = !1, this._pendingSave && this.scheduleSave();
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
scheduleSave() {
|
|
1723
|
+
var t, e;
|
|
1724
|
+
!this._autoSaveOptions || !this._autoSaveOptions.enabled || (e = (t = this._autoSaveOptions).isReadonly) != null && e.call(t) || (this._saveTimer && clearTimeout(this._saveTimer), this._saveTimer = setTimeout(() => {
|
|
1725
|
+
this.saveNow({ silent: !0 });
|
|
1726
|
+
}, this._autoSaveOptions.interval || 800));
|
|
1727
|
+
}
|
|
1728
|
+
stopAutoSave() {
|
|
1729
|
+
this._saveTimer && (clearTimeout(this._saveTimer), this._saveTimer = null);
|
|
1730
|
+
}
|
|
1731
|
+
isSaving() {
|
|
1732
|
+
return this._saving;
|
|
1733
|
+
}
|
|
1734
|
+
destroy() {
|
|
1735
|
+
this.stopAutoSave(), this._autoSaveOptions = null;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
function Ar() {
|
|
1739
|
+
const i = localStorage.getItem(Qt);
|
|
1740
|
+
return i ? JSON.parse(i) : null;
|
|
1741
|
+
}
|
|
1742
|
+
function Hr() {
|
|
1743
|
+
localStorage.removeItem(Qt);
|
|
1744
|
+
}
|
|
1745
|
+
function Jr(i) {
|
|
1746
|
+
let t = !1;
|
|
1747
|
+
for (let e = 0; e < i.items.length; e++)
|
|
1748
|
+
if (i.items[e].kind === "file") {
|
|
1749
|
+
t = !0;
|
|
1750
|
+
break;
|
|
1751
|
+
}
|
|
1752
|
+
return t;
|
|
1753
|
+
}
|
|
1754
|
+
const Yr = "3.0.10", qe = {
|
|
1755
|
+
preserveStyles: !0,
|
|
1756
|
+
defaultFont: "SimSun, serif",
|
|
1757
|
+
defaultSize: 12,
|
|
1758
|
+
tableWidthMode: "fit",
|
|
1759
|
+
defaultTableRowHeight: 32,
|
|
1760
|
+
defaultTableTdPadding: [0, 4, 0, 4],
|
|
1761
|
+
forceDefaultLineHeight: 1
|
|
1762
|
+
}, d = {
|
|
1763
|
+
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
1764
|
+
r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
1765
|
+
a: "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
1766
|
+
wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
|
|
1767
|
+
c: "http://schemas.openxmlformats.org/drawingml/2006/chart",
|
|
1768
|
+
v: "urn:schemas-microsoft-com:vml",
|
|
1769
|
+
pic: "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
|
1770
|
+
mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
1771
|
+
wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
|
|
1772
|
+
rel: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
1773
|
+
m: "http://schemas.openxmlformats.org/officeDocument/2006/math"
|
|
1774
|
+
};
|
|
1775
|
+
function G(i) {
|
|
1776
|
+
return i / 1440 * 96;
|
|
1777
|
+
}
|
|
1778
|
+
function tn(i) {
|
|
1779
|
+
return i * (96 / 144);
|
|
1780
|
+
}
|
|
1781
|
+
function $(i) {
|
|
1782
|
+
return i / 9525;
|
|
1783
|
+
}
|
|
1784
|
+
function en(i) {
|
|
1785
|
+
return i / 8 * (96 / 72);
|
|
1786
|
+
}
|
|
1787
|
+
const nn = {
|
|
1788
|
+
yellow: "#FFFF00",
|
|
1789
|
+
green: "#00FF00",
|
|
1790
|
+
cyan: "#00FFFF",
|
|
1791
|
+
magenta: "#FF00FF",
|
|
1792
|
+
blue: "#0000FF",
|
|
1793
|
+
red: "#FF0000",
|
|
1794
|
+
darkBlue: "#000080",
|
|
1795
|
+
darkCyan: "#008080",
|
|
1796
|
+
darkGreen: "#008000",
|
|
1797
|
+
darkMagenta: "#800080",
|
|
1798
|
+
darkRed: "#800000",
|
|
1799
|
+
darkYellow: "#808000",
|
|
1800
|
+
darkGray: "#808080",
|
|
1801
|
+
lightGray: "#C0C0C0",
|
|
1802
|
+
black: "#000000",
|
|
1803
|
+
white: "#FFFFFF"
|
|
1804
|
+
}, rn = {
|
|
1805
|
+
// 宋体系列
|
|
1806
|
+
宋体: "SimSun",
|
|
1807
|
+
"Song Ti": "SimSun",
|
|
1808
|
+
新宋体: "NSimSun",
|
|
1809
|
+
// 黑体系列
|
|
1810
|
+
黑体: "SimHei",
|
|
1811
|
+
"Hei Ti": "SimHei",
|
|
1812
|
+
// 楷体系列
|
|
1813
|
+
楷体: "KaiTi",
|
|
1814
|
+
楷体_GB2312: "KaiTi",
|
|
1815
|
+
"Kai Ti": "KaiTi",
|
|
1816
|
+
// 仿宋系列
|
|
1817
|
+
仿宋: "FangSong",
|
|
1818
|
+
仿宋_GB2312: "FangSong",
|
|
1819
|
+
"Fang Song": "FangSong",
|
|
1820
|
+
// 微软雅黑
|
|
1821
|
+
微软雅黑: "Microsoft YaHei",
|
|
1822
|
+
"Microsoft YaHei": "Microsoft YaHei",
|
|
1823
|
+
// 等线
|
|
1824
|
+
等线: "DengXian",
|
|
1825
|
+
"等线 Light": "DengXian Light",
|
|
1826
|
+
"等线 Regular": "DengXian",
|
|
1827
|
+
// 幼圆
|
|
1828
|
+
幼圆: "YouYuan",
|
|
1829
|
+
// 华文系列
|
|
1830
|
+
华文细黑: "STXihei",
|
|
1831
|
+
华文宋体: "STSong",
|
|
1832
|
+
华文仿宋: "STFangsong",
|
|
1833
|
+
华文楷体: "STKaiti",
|
|
1834
|
+
华文中宋: "STZhongsong",
|
|
1835
|
+
华文琥珀: "STHupo",
|
|
1836
|
+
华文新魏: "STXinwei",
|
|
1837
|
+
华文彩云: "STCaiyun",
|
|
1838
|
+
华文行楷: "STXingkai",
|
|
1839
|
+
华文隶书: "STLiti",
|
|
1840
|
+
// 方正系列
|
|
1841
|
+
方正舒体: "FZShuTi",
|
|
1842
|
+
方正姚体: "FZYaoti",
|
|
1843
|
+
// 西文通用(保留原名)
|
|
1844
|
+
"Times New Roman": "Times New Roman",
|
|
1845
|
+
Calibri: "Calibri",
|
|
1846
|
+
"Calibri Light": "Calibri Light",
|
|
1847
|
+
Arial: "Arial",
|
|
1848
|
+
"Arial Narrow": "Arial Narrow",
|
|
1849
|
+
Verdana: "Verdana",
|
|
1850
|
+
Tahoma: "Tahoma",
|
|
1851
|
+
"Courier New": "Courier New",
|
|
1852
|
+
Georgia: "Georgia",
|
|
1853
|
+
"Comic Sans MS": "Comic Sans MS",
|
|
1854
|
+
Impact: "Impact",
|
|
1855
|
+
"Trebuchet MS": "Trebuchet MS",
|
|
1856
|
+
"Palatino Linotype": "Palatino Linotype",
|
|
1857
|
+
Garamond: "Garamond",
|
|
1858
|
+
Century: "Century",
|
|
1859
|
+
Cambria: "Cambria",
|
|
1860
|
+
"Cambria Math": "Cambria Math",
|
|
1861
|
+
Consolas: "Consolas",
|
|
1862
|
+
"Franklin Gothic Medium": "Franklin Gothic Medium"
|
|
1863
|
+
};
|
|
1864
|
+
function st(i) {
|
|
1865
|
+
if (i)
|
|
1866
|
+
return rn[i] ?? i;
|
|
1867
|
+
}
|
|
1868
|
+
const on = {
|
|
1869
|
+
bullet: { listType: "ul", listStyle: "disc" },
|
|
1870
|
+
decimal: { listType: "ol", listStyle: "decimal" },
|
|
1871
|
+
lowerLetter: { listType: "ol", listStyle: "lower-alpha" },
|
|
1872
|
+
upperLetter: { listType: "ol", listStyle: "upper-alpha" },
|
|
1873
|
+
lowerRoman: { listType: "ol", listStyle: "lower-roman" },
|
|
1874
|
+
upperRoman: { listType: "ol", listStyle: "upper-roman" },
|
|
1875
|
+
chineseCounting: { listType: "ol", listStyle: "cjk-ideographic" },
|
|
1876
|
+
chineseCountingThousand: { listType: "ol", listStyle: "cjk-ideographic" },
|
|
1877
|
+
ideographTraditional: { listType: "ol", listStyle: "cjk-ideographic" },
|
|
1878
|
+
japaneseCounting: { listType: "ol", listStyle: "decimal" },
|
|
1879
|
+
ordinal: { listType: "ol", listStyle: "decimal" },
|
|
1880
|
+
cardinalText: { listType: "ol", listStyle: "decimal" },
|
|
1881
|
+
none: { listType: "ul", listStyle: "none" }
|
|
1882
|
+
}, sn = {
|
|
1883
|
+
left: "left",
|
|
1884
|
+
center: "center",
|
|
1885
|
+
right: "right",
|
|
1886
|
+
both: "justify",
|
|
1887
|
+
justify: "justify",
|
|
1888
|
+
distribute: "justify",
|
|
1889
|
+
numTab: "left",
|
|
1890
|
+
highKashida: "left",
|
|
1891
|
+
lowKashida: "left",
|
|
1892
|
+
thaiDistribute: "justify"
|
|
1893
|
+
}, ln = {
|
|
1894
|
+
none: 0,
|
|
1895
|
+
nil: 0,
|
|
1896
|
+
single: 1,
|
|
1897
|
+
thick: 1,
|
|
1898
|
+
double: 2,
|
|
1899
|
+
dotted: 3,
|
|
1900
|
+
dashed: 4,
|
|
1901
|
+
dashSmallGap: 4,
|
|
1902
|
+
dotDash: 5,
|
|
1903
|
+
dotDotDash: 6,
|
|
1904
|
+
triple: 7,
|
|
1905
|
+
wave: 8,
|
|
1906
|
+
thinThickSmallGap: 1,
|
|
1907
|
+
thickThinSmallGap: 1,
|
|
1908
|
+
thinThickThinSmallGap: 1
|
|
1909
|
+
}, dt = {
|
|
1910
|
+
background1: "lt1",
|
|
1911
|
+
background2: "lt2",
|
|
1912
|
+
text1: "dk1",
|
|
1913
|
+
text2: "dk2",
|
|
1914
|
+
// 以下为别名,部分文档直接用语义名
|
|
1915
|
+
light1: "lt1",
|
|
1916
|
+
light2: "lt2",
|
|
1917
|
+
dark1: "dk1",
|
|
1918
|
+
dark2: "dk2"
|
|
1919
|
+
};
|
|
1920
|
+
function D(i) {
|
|
1921
|
+
return new DOMParser().parseFromString(i, "application/xml");
|
|
1922
|
+
}
|
|
1923
|
+
function pt(i, t, e) {
|
|
1924
|
+
const n = [];
|
|
1925
|
+
for (let r = 0; r < i.childNodes.length; r++) {
|
|
1926
|
+
const o = i.childNodes[r];
|
|
1927
|
+
o.nodeType === 1 && o.localName === e && o.namespaceURI === t && n.push(o);
|
|
1928
|
+
}
|
|
1929
|
+
return n;
|
|
1930
|
+
}
|
|
1931
|
+
function b(i, t, e) {
|
|
1932
|
+
for (let n = 0; n < i.childNodes.length; n++) {
|
|
1933
|
+
const r = i.childNodes[n];
|
|
1934
|
+
if (r.nodeType === 1 && r.localName === e && r.namespaceURI === t)
|
|
1935
|
+
return r;
|
|
1936
|
+
}
|
|
1937
|
+
return null;
|
|
1938
|
+
}
|
|
1939
|
+
function E(i) {
|
|
1940
|
+
return i && (i.getAttributeNS(d.w, "val") || i.getAttribute("w:val")) || null;
|
|
1941
|
+
}
|
|
1942
|
+
function R(i, t) {
|
|
1943
|
+
for (let e = 0; e < i.childNodes.length; e++) {
|
|
1944
|
+
const n = i.childNodes[e];
|
|
1945
|
+
n.nodeType === 1 && t(n);
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
function Tt(i, t, e) {
|
|
1949
|
+
return b(i, t, e) !== null;
|
|
1950
|
+
}
|
|
1951
|
+
function an(i) {
|
|
1952
|
+
const t = {
|
|
1953
|
+
colors: /* @__PURE__ */ new Map(),
|
|
1954
|
+
majorFont: null,
|
|
1955
|
+
minorFont: null
|
|
1956
|
+
};
|
|
1957
|
+
if (!i) return t;
|
|
1958
|
+
const n = D(i).documentElement;
|
|
1959
|
+
return cn(n, t), un(n, t), t;
|
|
1960
|
+
}
|
|
1961
|
+
function cn(i, t) {
|
|
1962
|
+
const e = i.getElementsByTagNameNS(d.a, "clrScheme");
|
|
1963
|
+
if (e.length === 0) return;
|
|
1964
|
+
const n = e[0];
|
|
1965
|
+
R(n, (r) => {
|
|
1966
|
+
const o = r.localName, s = b(r, d.a, "srgbClr");
|
|
1967
|
+
if (s) {
|
|
1968
|
+
const l = s.getAttribute("val");
|
|
1969
|
+
if (l) {
|
|
1970
|
+
t.colors.set(o, l.toUpperCase());
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
const a = b(r, d.a, "sysClr");
|
|
1975
|
+
if (a) {
|
|
1976
|
+
const l = a.getAttribute("lastClr");
|
|
1977
|
+
l && t.colors.set(o, l.toUpperCase());
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
function un(i, t) {
|
|
1982
|
+
const e = i.getElementsByTagNameNS(d.a, "fontScheme");
|
|
1983
|
+
if (e.length === 0) return;
|
|
1984
|
+
const n = e[0], r = b(n, d.a, "majorFont");
|
|
1985
|
+
r && (t.majorFont = Xt(r));
|
|
1986
|
+
const o = b(n, d.a, "minorFont");
|
|
1987
|
+
o && (t.minorFont = Xt(o));
|
|
1988
|
+
}
|
|
1989
|
+
function Xt(i) {
|
|
1990
|
+
const t = b(i, d.a, "ea");
|
|
1991
|
+
if (t) {
|
|
1992
|
+
const n = t.getAttribute("typeface");
|
|
1993
|
+
if (n && n !== "") return n;
|
|
1994
|
+
}
|
|
1995
|
+
const e = b(i, d.a, "latin");
|
|
1996
|
+
if (e) {
|
|
1997
|
+
const n = e.getAttribute("typeface");
|
|
1998
|
+
if (n && n !== "") return n;
|
|
1999
|
+
}
|
|
2000
|
+
return null;
|
|
2001
|
+
}
|
|
2002
|
+
function ht(i, t, e, n) {
|
|
2003
|
+
const r = dt[t] ?? t, o = i.colors.get(r);
|
|
2004
|
+
if (!o) return null;
|
|
2005
|
+
if (!e && !n)
|
|
2006
|
+
return `#${o}`;
|
|
2007
|
+
const s = parseInt(o.substring(0, 2), 16) / 255, a = parseInt(o.substring(2, 4), 16) / 255, l = parseInt(o.substring(4, 6), 16) / 255, [c, u, p] = pn(s, a, l);
|
|
2008
|
+
let f = p;
|
|
2009
|
+
if (e) {
|
|
2010
|
+
const g = parseInt(e, 16) / 255;
|
|
2011
|
+
f = p + (1 - p) * g;
|
|
2012
|
+
}
|
|
2013
|
+
if (n) {
|
|
2014
|
+
const g = parseInt(n, 16) / 255;
|
|
2015
|
+
f = p * g;
|
|
2016
|
+
}
|
|
2017
|
+
f = Math.min(1, Math.max(0, f));
|
|
2018
|
+
const [w, h, m] = hn(c, u, f);
|
|
2019
|
+
return `#${kt(w)}${kt(h)}${kt(m)}`.toUpperCase();
|
|
2020
|
+
}
|
|
2021
|
+
function dn(i, t) {
|
|
2022
|
+
if (!t) return null;
|
|
2023
|
+
const e = t.toLowerCase();
|
|
2024
|
+
return e.startsWith("major") ? i.majorFont : e.startsWith("minor") ? i.minorFont : null;
|
|
2025
|
+
}
|
|
2026
|
+
function pn(i, t, e) {
|
|
2027
|
+
const n = Math.max(i, t, e), r = Math.min(i, t, e), o = n - r;
|
|
2028
|
+
let s = 0, a = 0;
|
|
2029
|
+
const l = (n + r) / 2;
|
|
2030
|
+
return o !== 0 && (a = l > 0.5 ? o / (2 - n - r) : o / (n + r), n === i ? s = ((t - e) / o + (t < e ? 6 : 0)) / 6 : n === t ? s = ((e - i) / o + 2) / 6 : s = ((i - t) / o + 4) / 6), [s, a, l];
|
|
2031
|
+
}
|
|
2032
|
+
function hn(i, t, e) {
|
|
2033
|
+
if (t === 0) {
|
|
2034
|
+
const o = Math.round(e * 255);
|
|
2035
|
+
return [o, o, o];
|
|
2036
|
+
}
|
|
2037
|
+
const n = e < 0.5 ? e * (1 + t) : e + t - e * t, r = 2 * e - n;
|
|
2038
|
+
return [
|
|
2039
|
+
Math.round(vt(r, n, i + 1 / 3) * 255),
|
|
2040
|
+
Math.round(vt(r, n, i) * 255),
|
|
2041
|
+
Math.round(vt(r, n, i - 1 / 3) * 255)
|
|
2042
|
+
];
|
|
2043
|
+
}
|
|
2044
|
+
function vt(i, t, e) {
|
|
2045
|
+
return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? i + (t - i) * 6 * e : e < 1 / 2 ? t : e < 2 / 3 ? i + (t - i) * (2 / 3 - e) * 6 : i;
|
|
2046
|
+
}
|
|
2047
|
+
function kt(i) {
|
|
2048
|
+
return Math.min(255, Math.max(0, i)).toString(16).padStart(2, "0");
|
|
2049
|
+
}
|
|
2050
|
+
class fn {
|
|
2051
|
+
constructor(t, e) {
|
|
2052
|
+
I(this, "styleMap", /* @__PURE__ */ new Map());
|
|
2053
|
+
I(this, "defaultParagraphStyle", {});
|
|
2054
|
+
I(this, "defaultRunStyle", {});
|
|
2055
|
+
I(this, "theme");
|
|
2056
|
+
this.theme = e, t && this.parseStylesXml(t);
|
|
2057
|
+
}
|
|
2058
|
+
// ---- 公开方法 ----
|
|
2059
|
+
/**
|
|
2060
|
+
* 解析段落属性 <w:pPr>,返回局部 ParagraphStyle(不含继承链)
|
|
2061
|
+
*/
|
|
2062
|
+
parseParagraphProperties(t) {
|
|
2063
|
+
const e = {}, n = b(t, d.w, "jc");
|
|
2064
|
+
if (n) {
|
|
2065
|
+
const l = E(n);
|
|
2066
|
+
l && (e.rowFlex = l);
|
|
2067
|
+
}
|
|
2068
|
+
mn(t, e), bn(t, e);
|
|
2069
|
+
const r = b(t, d.w, "shd");
|
|
2070
|
+
if (r) {
|
|
2071
|
+
const l = It(r, this.theme);
|
|
2072
|
+
e.paragraphColor = l ?? "";
|
|
2073
|
+
}
|
|
2074
|
+
const o = b(t, d.w, "outlineLvl");
|
|
2075
|
+
if (o) {
|
|
2076
|
+
const l = E(o);
|
|
2077
|
+
if (l !== null) {
|
|
2078
|
+
const c = parseInt(l, 10);
|
|
2079
|
+
c >= 0 && c <= 5 && (e.titleLevel = c + 1);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
const s = b(t, d.w, "numPr");
|
|
2083
|
+
if (s) {
|
|
2084
|
+
const l = b(s, d.w, "numId"), c = b(s, d.w, "ilvl");
|
|
2085
|
+
if (l && (e.numId = E(l) ?? void 0), c) {
|
|
2086
|
+
const u = E(c);
|
|
2087
|
+
u !== null && (e.listLevel = parseInt(u, 10));
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
const a = b(t, d.w, "tabs");
|
|
2091
|
+
return a && (e.tabStops = gn(a)), e;
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* 解析 Run 属性 <w:rPr>,返回局部 RunStyle(不含继承链)
|
|
2095
|
+
*/
|
|
2096
|
+
parseRunProperties(t) {
|
|
2097
|
+
const e = {};
|
|
2098
|
+
if (Tt(t, d.w, "b")) {
|
|
2099
|
+
const u = b(t, d.w, "b"), p = u ? E(u) : null;
|
|
2100
|
+
e.bold = p !== "0" && p !== "false";
|
|
2101
|
+
}
|
|
2102
|
+
if (Tt(t, d.w, "i")) {
|
|
2103
|
+
const u = b(t, d.w, "i"), p = u ? E(u) : null;
|
|
2104
|
+
e.italic = p !== "0" && p !== "false";
|
|
2105
|
+
}
|
|
2106
|
+
const n = b(t, d.w, "u");
|
|
2107
|
+
if (n) {
|
|
2108
|
+
const u = E(n);
|
|
2109
|
+
e.underline = u !== "none" && u !== "0";
|
|
2110
|
+
}
|
|
2111
|
+
if (Tt(t, d.w, "strike")) {
|
|
2112
|
+
const u = b(t, d.w, "strike"), p = u ? E(u) : null;
|
|
2113
|
+
e.strikeout = p !== "0" && p !== "false";
|
|
2114
|
+
}
|
|
2115
|
+
const r = b(t, d.w, "sz") ?? b(t, d.w, "szCs");
|
|
2116
|
+
if (r) {
|
|
2117
|
+
const u = E(r);
|
|
2118
|
+
u && (e.size = tn(parseInt(u, 10)));
|
|
2119
|
+
}
|
|
2120
|
+
const o = b(t, d.w, "rFonts");
|
|
2121
|
+
o && (e.font = wn(o, this.theme));
|
|
2122
|
+
const s = b(t, d.w, "color");
|
|
2123
|
+
s && (e.color = yn(s, this.theme));
|
|
2124
|
+
const a = b(t, d.w, "highlight");
|
|
2125
|
+
if (a) {
|
|
2126
|
+
const u = E(a);
|
|
2127
|
+
u && u !== "none" && (e.highlight = nn[u] ?? `#${u}`);
|
|
2128
|
+
}
|
|
2129
|
+
if (!e.highlight) {
|
|
2130
|
+
const u = b(t, d.w, "shd");
|
|
2131
|
+
if (u) {
|
|
2132
|
+
const p = It(u, this.theme);
|
|
2133
|
+
p && (e.highlight = p);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
const l = b(t, d.w, "spacing");
|
|
2137
|
+
if (l) {
|
|
2138
|
+
const u = E(l);
|
|
2139
|
+
if (u) {
|
|
2140
|
+
const p = parseInt(u, 10), f = G(p);
|
|
2141
|
+
Math.abs(f) >= 0.5 && (e.letterSpacing = f);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
const c = b(t, d.w, "vertAlign");
|
|
2145
|
+
if (c) {
|
|
2146
|
+
const u = E(c);
|
|
2147
|
+
(u === "superscript" || u === "subscript") && (e.vertAlign = u);
|
|
2148
|
+
}
|
|
2149
|
+
return e;
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* 根据 styleId 解析完整样式(含 docDefaults + 完整继承链)
|
|
2153
|
+
*/
|
|
2154
|
+
resolveStyle(t) {
|
|
2155
|
+
const e = {
|
|
2156
|
+
paragraph: { ...this.defaultParagraphStyle },
|
|
2157
|
+
run: { ...this.defaultRunStyle }
|
|
2158
|
+
};
|
|
2159
|
+
if (!t) return e;
|
|
2160
|
+
const n = [];
|
|
2161
|
+
let r = t;
|
|
2162
|
+
const o = /* @__PURE__ */ new Set();
|
|
2163
|
+
for (; r && !o.has(r); ) {
|
|
2164
|
+
o.add(r);
|
|
2165
|
+
const s = this.styleMap.get(r);
|
|
2166
|
+
if (!s) break;
|
|
2167
|
+
n.unshift(s), r = s.basedOnId;
|
|
2168
|
+
}
|
|
2169
|
+
for (const s of n)
|
|
2170
|
+
At(e.paragraph, s.paragraphStyle), At(e.run, s.runStyle);
|
|
2171
|
+
return e;
|
|
2172
|
+
}
|
|
2173
|
+
getDefaultRunStyle() {
|
|
2174
|
+
return { ...this.defaultRunStyle };
|
|
2175
|
+
}
|
|
2176
|
+
getDefaultParagraphStyle() {
|
|
2177
|
+
return { ...this.defaultParagraphStyle };
|
|
2178
|
+
}
|
|
2179
|
+
// ---- 私有方法 ----
|
|
2180
|
+
parseStylesXml(t) {
|
|
2181
|
+
const n = D(t).documentElement, r = b(n, d.w, "docDefaults");
|
|
2182
|
+
r && this.parseDocDefaults(r);
|
|
2183
|
+
const o = n.getElementsByTagNameNS(d.w, "style");
|
|
2184
|
+
for (let s = 0; s < o.length; s++)
|
|
2185
|
+
this.parseStyleElement(o[s]);
|
|
2186
|
+
}
|
|
2187
|
+
parseDocDefaults(t) {
|
|
2188
|
+
const e = b(t, d.w, "rPrDefault");
|
|
2189
|
+
if (e) {
|
|
2190
|
+
const r = b(e, d.w, "rPr");
|
|
2191
|
+
r && (this.defaultRunStyle = this.parseRunProperties(r));
|
|
2192
|
+
}
|
|
2193
|
+
const n = b(t, d.w, "pPrDefault");
|
|
2194
|
+
if (n) {
|
|
2195
|
+
const r = b(n, d.w, "pPr");
|
|
2196
|
+
r && (this.defaultParagraphStyle = this.parseParagraphProperties(r));
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
parseStyleElement(t) {
|
|
2200
|
+
const e = t.getAttributeNS(d.w, "styleId") ?? t.getAttribute("w:styleId") ?? t.getAttribute("styleId") ?? "";
|
|
2201
|
+
if (!e) return;
|
|
2202
|
+
const n = b(t, d.w, "name"), r = E(n) ?? "", o = b(t, d.w, "basedOn"), s = E(o);
|
|
2203
|
+
let a = {}, l = {};
|
|
2204
|
+
const c = b(t, d.w, "pPr");
|
|
2205
|
+
if (c && (a = this.parseParagraphProperties(c)), a.titleLevel === void 0) {
|
|
2206
|
+
const p = Tn(r, e);
|
|
2207
|
+
p !== void 0 && (a.titleLevel = p);
|
|
2208
|
+
}
|
|
2209
|
+
const u = b(t, d.w, "rPr");
|
|
2210
|
+
u && (l = this.parseRunProperties(u)), this.styleMap.set(e, { id: e, name: r, basedOnId: s, paragraphStyle: a, runStyle: l });
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
function mn(i, t) {
|
|
2214
|
+
const e = b(i, d.w, "spacing");
|
|
2215
|
+
if (!e) return;
|
|
2216
|
+
const n = e.getAttributeNS(d.w, "before") ?? e.getAttribute("w:before"), r = e.getAttributeNS(d.w, "after") ?? e.getAttribute("w:after"), o = e.getAttributeNS(d.w, "line") ?? e.getAttribute("w:line"), s = e.getAttributeNS(d.w, "lineRule") ?? e.getAttribute("w:lineRule");
|
|
2217
|
+
if (n && (t.spacingBefore = G(parseInt(n, 10))), r && (t.spacingAfter = G(parseInt(r, 10))), o) {
|
|
2218
|
+
const a = parseInt(o, 10);
|
|
2219
|
+
!s || s === "auto" ? (t.lineHeight = a / 240, t.lineHeightRule = "auto") : s === "exact" ? (t.lineHeight = G(a), t.lineHeightRule = "exact") : s === "atLeast" && (t.lineHeight = G(a), t.lineHeightRule = "atLeast");
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
function bn(i, t) {
|
|
2223
|
+
const e = b(i, d.w, "ind");
|
|
2224
|
+
if (!e) return;
|
|
2225
|
+
const n = e.getAttributeNS(d.w, "left") ?? e.getAttribute("w:left"), r = e.getAttributeNS(d.w, "right") ?? e.getAttribute("w:right"), o = e.getAttributeNS(d.w, "firstLine") ?? e.getAttribute("w:firstLine"), s = e.getAttributeNS(d.w, "hanging") ?? e.getAttribute("w:hanging"), a = n ? G(parseInt(n, 10)) : 0, l = s ? G(parseInt(s, 10)) : 0;
|
|
2226
|
+
n && s && Math.abs(a - l) < 2 || (n && (t.indentLeft = a), r && (t.indentRight = G(parseInt(r, 10))), o ? t.firstLineIndent = G(parseInt(o, 10)) : s && (t.indentLeft = a + l, t.firstLineIndent = -l));
|
|
2227
|
+
}
|
|
2228
|
+
function gn(i) {
|
|
2229
|
+
const t = [], e = i.getElementsByTagNameNS(d.w, "tab");
|
|
2230
|
+
for (let n = 0; n < e.length; n++) {
|
|
2231
|
+
const r = e[n], o = r.getAttributeNS(d.w, "val") ?? r.getAttribute("w:val") ?? "left", s = r.getAttributeNS(d.w, "pos") ?? r.getAttribute("w:pos");
|
|
2232
|
+
s && t.push({ pos: G(parseInt(s, 10)), type: o });
|
|
2233
|
+
}
|
|
2234
|
+
return t;
|
|
2235
|
+
}
|
|
2236
|
+
function wn(i, t) {
|
|
2237
|
+
const e = i.getAttributeNS(d.w, "eastAsia") ?? i.getAttribute("w:eastAsia");
|
|
2238
|
+
if (e) return st(e);
|
|
2239
|
+
const n = i.getAttributeNS(d.w, "ascii") ?? i.getAttribute("w:ascii");
|
|
2240
|
+
if (n) return st(n);
|
|
2241
|
+
const r = i.getAttributeNS(d.w, "hAnsi") ?? i.getAttribute("w:hAnsi");
|
|
2242
|
+
if (r) return st(r);
|
|
2243
|
+
const o = i.getAttributeNS(d.w, "eastAsiaTheme") ?? i.getAttribute("w:eastAsiaTheme"), s = i.getAttributeNS(d.w, "asciiTheme") ?? i.getAttribute("w:asciiTheme"), a = dn(t, o ?? s);
|
|
2244
|
+
if (a) return st(a);
|
|
2245
|
+
}
|
|
2246
|
+
function yn(i, t) {
|
|
2247
|
+
const e = i.getAttributeNS(d.w, "themeColor") ?? i.getAttribute("w:themeColor");
|
|
2248
|
+
if (e) {
|
|
2249
|
+
const r = dt[e] ?? e, o = i.getAttributeNS(d.w, "themeTint") ?? i.getAttribute("w:themeTint") ?? void 0, s = i.getAttributeNS(d.w, "themeShade") ?? i.getAttribute("w:themeShade") ?? void 0;
|
|
2250
|
+
return ht(t, r, o, s) ?? void 0;
|
|
2251
|
+
}
|
|
2252
|
+
const n = E(i);
|
|
2253
|
+
if (!(!n || n === "auto"))
|
|
2254
|
+
return `#${n}`;
|
|
2255
|
+
}
|
|
2256
|
+
function It(i, t) {
|
|
2257
|
+
const e = i.getAttributeNS(d.w, "val") ?? i.getAttribute("w:val");
|
|
2258
|
+
if (e === "nil") return null;
|
|
2259
|
+
if (e === "solid")
|
|
2260
|
+
return Sn(i, t);
|
|
2261
|
+
const n = i.getAttributeNS(d.w, "themeFill") ?? i.getAttribute("w:themeFill");
|
|
2262
|
+
if (n) {
|
|
2263
|
+
const o = dt[n] ?? n, s = i.getAttributeNS(d.w, "themeFillTint") ?? i.getAttribute("w:themeFillTint") ?? void 0, a = i.getAttributeNS(d.w, "themeFillShade") ?? i.getAttribute("w:themeFillShade") ?? void 0, l = ht(t, o, s, a);
|
|
2264
|
+
return l ? lt(l) ? null : l : null;
|
|
2265
|
+
}
|
|
2266
|
+
const r = i.getAttributeNS(d.w, "fill") ?? i.getAttribute("w:fill");
|
|
2267
|
+
return !r || r === "auto" || lt(`#${r}`) ? null : `#${r}`;
|
|
2268
|
+
}
|
|
2269
|
+
function Sn(i, t) {
|
|
2270
|
+
const e = i.getAttributeNS(d.w, "themeColor") ?? i.getAttribute("w:themeColor");
|
|
2271
|
+
if (e) {
|
|
2272
|
+
const r = dt[e] ?? e, o = i.getAttributeNS(d.w, "themeTint") ?? i.getAttribute("w:themeTint") ?? void 0, s = i.getAttributeNS(d.w, "themeShade") ?? i.getAttribute("w:themeShade") ?? void 0, a = ht(t, r, o, s);
|
|
2273
|
+
return a ? lt(a) ? null : a : null;
|
|
2274
|
+
}
|
|
2275
|
+
const n = i.getAttributeNS(d.w, "color") ?? i.getAttribute("w:color");
|
|
2276
|
+
return !n || n === "auto" || lt(`#${n}`) ? null : `#${n}`;
|
|
2277
|
+
}
|
|
2278
|
+
function lt(i) {
|
|
2279
|
+
const t = i.toUpperCase().replace("#", "");
|
|
2280
|
+
return t === "FFFFFF" || t === "FFF" || t === "AUTO";
|
|
2281
|
+
}
|
|
2282
|
+
function Tn(i, t) {
|
|
2283
|
+
const e = [
|
|
2284
|
+
/^heading\s*(\d+)$/i,
|
|
2285
|
+
/^标题\s*(\d+)$/
|
|
2286
|
+
];
|
|
2287
|
+
for (const n of e) {
|
|
2288
|
+
const r = i.match(n) ?? t.match(n);
|
|
2289
|
+
if (r) {
|
|
2290
|
+
const o = parseInt(r[1], 10);
|
|
2291
|
+
if (o >= 1 && o <= 6) return o;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
function At(i, t) {
|
|
2296
|
+
for (const e of Object.keys(t))
|
|
2297
|
+
t[e] !== void 0 && (i[e] = t[e]);
|
|
2298
|
+
}
|
|
2299
|
+
class vn {
|
|
2300
|
+
constructor(t) {
|
|
2301
|
+
I(this, "abstractNums", /* @__PURE__ */ new Map());
|
|
2302
|
+
I(this, "numRefs", /* @__PURE__ */ new Map());
|
|
2303
|
+
t && this.parseNumberingXml(t);
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* 根据 numId 和列表层级解析编号信息
|
|
2307
|
+
* 返回 null 表示找不到对应定义
|
|
2308
|
+
*/
|
|
2309
|
+
resolve(t, e) {
|
|
2310
|
+
const n = this.numRefs.get(t);
|
|
2311
|
+
if (!n) return null;
|
|
2312
|
+
const r = this.abstractNums.get(n.abstractNumId);
|
|
2313
|
+
if (!r) return null;
|
|
2314
|
+
const o = n.levelOverrides.get(e);
|
|
2315
|
+
if (o != null && o.overrideLevelDef)
|
|
2316
|
+
return this.mapLevelToInfo(o.overrideLevelDef, e);
|
|
2317
|
+
const s = r.levels.get(e);
|
|
2318
|
+
if (!s) {
|
|
2319
|
+
const a = r.levels.get(0);
|
|
2320
|
+
return a ? this.mapLevelToInfo(a, e) : null;
|
|
2321
|
+
}
|
|
2322
|
+
return this.mapLevelToInfo(s, e);
|
|
2323
|
+
}
|
|
2324
|
+
// ---- 私有方法 ----
|
|
2325
|
+
parseNumberingXml(t) {
|
|
2326
|
+
const n = D(t).documentElement;
|
|
2327
|
+
this.parseAbstractNums(n), this.parseNumReferences(n);
|
|
2328
|
+
}
|
|
2329
|
+
parseAbstractNums(t) {
|
|
2330
|
+
const e = t.getElementsByTagNameNS(d.w, "abstractNum");
|
|
2331
|
+
for (let n = 0; n < e.length; n++) {
|
|
2332
|
+
const r = e[n], o = r.getAttributeNS(d.w, "abstractNumId") ?? r.getAttribute("w:abstractNumId") ?? "", s = /* @__PURE__ */ new Map(), a = r.getElementsByTagNameNS(d.w, "lvl");
|
|
2333
|
+
for (let l = 0; l < a.length; l++) {
|
|
2334
|
+
const c = a[l];
|
|
2335
|
+
if (c.parentElement !== r) continue;
|
|
2336
|
+
const u = c.getAttributeNS(d.w, "ilvl") ?? c.getAttribute("w:ilvl") ?? "0", p = parseInt(u, 10);
|
|
2337
|
+
s.set(p, Ht(c));
|
|
2338
|
+
}
|
|
2339
|
+
this.abstractNums.set(o, { abstractNumId: o, levels: s });
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
parseNumReferences(t) {
|
|
2343
|
+
const e = t.getElementsByTagNameNS(d.w, "num");
|
|
2344
|
+
for (let n = 0; n < e.length; n++) {
|
|
2345
|
+
const r = e[n], o = r.getAttributeNS(d.w, "numId") ?? r.getAttribute("w:numId") ?? "", s = b(r, d.w, "abstractNumId"), a = E(s) ?? "", l = /* @__PURE__ */ new Map(), c = r.getElementsByTagNameNS(d.w, "lvlOverride");
|
|
2346
|
+
for (let u = 0; u < c.length; u++) {
|
|
2347
|
+
const p = c[u], f = p.getAttributeNS(d.w, "ilvl") ?? p.getAttribute("w:ilvl") ?? "0", w = parseInt(f, 10), h = { ilvl: w }, m = b(p, d.w, "startOverride");
|
|
2348
|
+
if (m) {
|
|
2349
|
+
const v = E(m);
|
|
2350
|
+
v && (h.startOverride = parseInt(v, 10));
|
|
2351
|
+
}
|
|
2352
|
+
const g = b(p, d.w, "lvl");
|
|
2353
|
+
g && (h.overrideLevelDef = Ht(g), h.startOverride !== void 0 && (h.overrideLevelDef.start = h.startOverride)), l.set(w, h);
|
|
2354
|
+
}
|
|
2355
|
+
this.numRefs.set(o, { numId: o, abstractNumId: a, levelOverrides: l });
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
mapLevelToInfo(t, e) {
|
|
2359
|
+
const n = on[t.numFmt];
|
|
2360
|
+
return n ? {
|
|
2361
|
+
listType: n.listType,
|
|
2362
|
+
listStyle: n.listStyle,
|
|
2363
|
+
level: e,
|
|
2364
|
+
indentLeft: t.indentLeft,
|
|
2365
|
+
indentHanging: t.indentHanging
|
|
2366
|
+
} : kn(t.lvlText) ? { listType: "ul", listStyle: "disc", level: e } : { listType: "ol", listStyle: "decimal", level: e };
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
function Ht(i) {
|
|
2370
|
+
const t = b(i, d.w, "numFmt"), e = E(t) ?? "decimal", n = b(i, d.w, "lvlText"), r = E(n) ?? "", o = b(i, d.w, "start"), s = o ? parseInt(E(o) ?? "1", 10) : 1;
|
|
2371
|
+
let a, l;
|
|
2372
|
+
const c = b(i, d.w, "pPr");
|
|
2373
|
+
if (c) {
|
|
2374
|
+
const u = b(c, d.w, "ind");
|
|
2375
|
+
if (u) {
|
|
2376
|
+
const p = u.getAttributeNS(d.w, "left") ?? u.getAttribute("w:left"), f = u.getAttributeNS(d.w, "hanging") ?? u.getAttribute("w:hanging");
|
|
2377
|
+
p && (a = G(parseInt(p, 10))), f && (l = G(parseInt(f, 10)));
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
return { numFmt: e, lvlText: r, start: s, indentLeft: a, indentHanging: l };
|
|
2381
|
+
}
|
|
2382
|
+
function kn(i) {
|
|
2383
|
+
return i === "" ? !0 : ["·", "o", "–", "•", "-", "●", "○", "■", "□", "◆", "◇", "★", "☆"].includes(i.trim());
|
|
2384
|
+
}
|
|
2385
|
+
function $t(i) {
|
|
2386
|
+
const t = /* @__PURE__ */ new Map(), n = D(i).documentElement;
|
|
2387
|
+
return R(n, (r) => {
|
|
2388
|
+
if (r.localName === "Relationship") {
|
|
2389
|
+
const o = r.getAttribute("Id") || "", s = r.getAttribute("Type") || "", a = r.getAttribute("Target") || "";
|
|
2390
|
+
o && t.set(o, { id: o, type: s, target: a });
|
|
2391
|
+
}
|
|
2392
|
+
}), t;
|
|
2393
|
+
}
|
|
2394
|
+
const Lt = { value: 0 };
|
|
2395
|
+
function q(i, t, e, n) {
|
|
2396
|
+
const r = [], o = b(i, d.w, "rPr"), s = o ? t.parseRunProperties(o) : {}, a = xn(n, s);
|
|
2397
|
+
let l = null;
|
|
2398
|
+
return R(i, (c) => {
|
|
2399
|
+
const u = c.localName;
|
|
2400
|
+
if (u === "t") {
|
|
2401
|
+
const p = c.textContent ?? "";
|
|
2402
|
+
p !== "" && r.push({ type: "text", value: p, style: { ...a } }), l = null;
|
|
2403
|
+
} else if (u === "delText") {
|
|
2404
|
+
const p = c.textContent ?? "";
|
|
2405
|
+
p !== "" && r.push({ type: "text", value: p, style: { ...a } }), l = null;
|
|
2406
|
+
} else if (u === "br") {
|
|
2407
|
+
const p = c.getAttributeNS(d.w, "type") ?? c.getAttribute("w:type"), f = Cn(p);
|
|
2408
|
+
f !== l && (r.push({ type: "break", breakType: f }), l = f);
|
|
2409
|
+
} else if (u === "tab")
|
|
2410
|
+
r.push({ type: "tab" }), l = null;
|
|
2411
|
+
else if (u === "sym") {
|
|
2412
|
+
const p = c.getAttributeNS(d.w, "char") ?? c.getAttribute("w:char");
|
|
2413
|
+
if (p) {
|
|
2414
|
+
const f = parseInt(p, 16), w = f >= 61440 && f <= 61695 ? f - 61440 : f;
|
|
2415
|
+
r.push({
|
|
2416
|
+
type: "text",
|
|
2417
|
+
value: String.fromCharCode(w),
|
|
2418
|
+
style: { ...a }
|
|
2419
|
+
});
|
|
2420
|
+
}
|
|
2421
|
+
l = null;
|
|
2422
|
+
} else u === "softHyphen" ? l = null : u === "noBreakHyphen" ? (r.push({ type: "text", value: "-", style: { ...a } }), l = null) : (u === "footnoteReference" || u === "endnoteReference") && (Lt.value++, r.push({
|
|
2423
|
+
type: "text",
|
|
2424
|
+
value: String(Lt.value),
|
|
2425
|
+
style: { ...a, vertAlign: "superscript" }
|
|
2426
|
+
}), l = null);
|
|
2427
|
+
}), r;
|
|
2428
|
+
}
|
|
2429
|
+
function Cn(i) {
|
|
2430
|
+
return i === "page" ? "page" : i === "column" ? "column" : "line";
|
|
2431
|
+
}
|
|
2432
|
+
function xn(i, t) {
|
|
2433
|
+
const e = { ...i };
|
|
2434
|
+
for (const n of Object.keys(t))
|
|
2435
|
+
t[n] !== void 0 && (e[n] = t[n]);
|
|
2436
|
+
return e;
|
|
2437
|
+
}
|
|
2438
|
+
function qt(i, t, e, n) {
|
|
2439
|
+
const r = b(i, d.wp, "inline"), o = b(i, d.wp, "anchor"), s = r || o;
|
|
2440
|
+
if (!s)
|
|
2441
|
+
return null;
|
|
2442
|
+
const a = b(s, d.wp, "extent");
|
|
2443
|
+
let l = 100, c = 100;
|
|
2444
|
+
if (a) {
|
|
2445
|
+
const C = a.getAttribute("cx"), k = a.getAttribute("cy");
|
|
2446
|
+
C && (l = $(parseInt(C, 10))), k && (c = $(parseInt(k, 10)));
|
|
2447
|
+
}
|
|
2448
|
+
const u = s.getElementsByTagNameNS(d.a, "blip");
|
|
2449
|
+
if (u.length === 0)
|
|
2450
|
+
return null;
|
|
2451
|
+
const p = u[0], f = p.getAttributeNS(d.r, "embed") || p.getAttribute("r:embed") || p.getAttributeNS(d.r, "link") || p.getAttribute("r:link") || "";
|
|
2452
|
+
if (!f)
|
|
2453
|
+
return null;
|
|
2454
|
+
const w = t.get(f);
|
|
2455
|
+
if (!w)
|
|
2456
|
+
return null;
|
|
2457
|
+
const h = w.target.replace(/^\.\.\//, ""), m = h.startsWith("word/") ? h : `word/${h}`, g = e[m] || e[h];
|
|
2458
|
+
if (!g)
|
|
2459
|
+
return null;
|
|
2460
|
+
let v, T;
|
|
2461
|
+
if (o) {
|
|
2462
|
+
v = En(o);
|
|
2463
|
+
const C = n || { top: 72, bottom: 72, left: 90, right: 90 }, k = b(o, d.wp, "positionH"), y = b(o, d.wp, "positionV");
|
|
2464
|
+
let V = C.left, S = C.top;
|
|
2465
|
+
if (k) {
|
|
2466
|
+
const L = k.getAttribute("relativeFrom") || "column", F = b(k, d.wp, "posOffset");
|
|
2467
|
+
if (F != null && F.textContent) {
|
|
2468
|
+
const N = $(parseInt(F.textContent, 10));
|
|
2469
|
+
L === "page" ? V = N : V = C.left + N;
|
|
2470
|
+
} else {
|
|
2471
|
+
const N = b(k, d.wp, "align");
|
|
2472
|
+
N != null && N.textContent && (V = In(N.textContent.trim(), C, Math.round(l)));
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
if (y) {
|
|
2476
|
+
const L = y.getAttribute("relativeFrom") || "paragraph", F = b(y, d.wp, "posOffset");
|
|
2477
|
+
if (F != null && F.textContent) {
|
|
2478
|
+
const N = $(parseInt(F.textContent, 10));
|
|
2479
|
+
L === "page" ? S = N : S = C.top + N;
|
|
2480
|
+
} else {
|
|
2481
|
+
const N = b(y, d.wp, "align");
|
|
2482
|
+
N != null && N.textContent && (S = Ln(N.textContent.trim(), C, Math.round(c)));
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
T = { x: V, y: S };
|
|
2486
|
+
} else r && (v = "inline");
|
|
2487
|
+
return {
|
|
2488
|
+
type: "image",
|
|
2489
|
+
src: g,
|
|
2490
|
+
width: Math.round(l),
|
|
2491
|
+
height: Math.round(c),
|
|
2492
|
+
display: v,
|
|
2493
|
+
floatPosition: T
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
function In(i, t, e) {
|
|
2497
|
+
const r = 794 - t.left - t.right;
|
|
2498
|
+
switch (i) {
|
|
2499
|
+
case "left":
|
|
2500
|
+
return t.left;
|
|
2501
|
+
case "center":
|
|
2502
|
+
return t.left + (r - e) / 2;
|
|
2503
|
+
case "right":
|
|
2504
|
+
return t.left + r - e;
|
|
2505
|
+
default:
|
|
2506
|
+
return t.left;
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
function Ln(i, t, e) {
|
|
2510
|
+
const r = 1123 - t.top - t.bottom;
|
|
2511
|
+
switch (i) {
|
|
2512
|
+
case "top":
|
|
2513
|
+
return t.top;
|
|
2514
|
+
case "center":
|
|
2515
|
+
return t.top + (r - e) / 2;
|
|
2516
|
+
case "bottom":
|
|
2517
|
+
return t.top + r - e;
|
|
2518
|
+
default:
|
|
2519
|
+
return t.top;
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
function En(i) {
|
|
2523
|
+
const t = i.getAttribute("behindDoc") === "1", e = b(i, d.wp, "wrapNone"), n = b(i, d.wp, "wrapSquare"), r = b(i, d.wp, "wrapTight"), o = b(i, d.wp, "wrapThrough"), s = b(i, d.wp, "wrapTopAndBottom");
|
|
2524
|
+
return n || r || o ? "surround" : t ? "float-bottom" : "float-top";
|
|
2525
|
+
}
|
|
2526
|
+
function Vn(i, t, e, n) {
|
|
2527
|
+
const r = i.getElementsByTagNameNS(d.c, "chart");
|
|
2528
|
+
if (r.length === 0) return null;
|
|
2529
|
+
const o = r[0], s = o.getAttributeNS(d.r, "id") || o.getAttribute("r:id") || "";
|
|
2530
|
+
if (!s)
|
|
2531
|
+
return null;
|
|
2532
|
+
const a = t.get(s);
|
|
2533
|
+
if (!a)
|
|
2534
|
+
return null;
|
|
2535
|
+
const l = a.target.startsWith("word/") ? a.target : `word/${a.target.replace(/^\.\.\//, "")}`;
|
|
2536
|
+
let c = 400, u = 300;
|
|
2537
|
+
const p = b(i, d.wp, "inline") || b(i, d.wp, "anchor");
|
|
2538
|
+
if (p) {
|
|
2539
|
+
const m = b(p, d.wp, "extent");
|
|
2540
|
+
if (m) {
|
|
2541
|
+
const g = m.getAttribute("cx"), v = m.getAttribute("cy");
|
|
2542
|
+
g && (c = $(parseInt(g, 10))), v && (u = $(parseInt(v, 10)));
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
const f = l.replace(
|
|
2546
|
+
/\/([^/]+)$/,
|
|
2547
|
+
"/_rels/$1.rels"
|
|
2548
|
+
), w = e[f];
|
|
2549
|
+
if (w) {
|
|
2550
|
+
const m = $t(w);
|
|
2551
|
+
for (const g of m.values())
|
|
2552
|
+
if (g.type.includes("image") || g.target.match(/\.(png|jpg|jpeg|gif|bmp|tiff)$/i)) {
|
|
2553
|
+
const v = Zn(l, g.target), T = n[v] || n[g.target];
|
|
2554
|
+
if (T)
|
|
2555
|
+
return {
|
|
2556
|
+
type: "image",
|
|
2557
|
+
src: T,
|
|
2558
|
+
width: Math.round(c),
|
|
2559
|
+
height: Math.round(u)
|
|
2560
|
+
};
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
const h = i.getElementsByTagNameNS(d.a, "blip");
|
|
2564
|
+
for (let m = 0; m < h.length; m++) {
|
|
2565
|
+
const g = h[m], v = g.getAttributeNS(d.r, "embed") || g.getAttribute("r:embed") || "";
|
|
2566
|
+
if (v) {
|
|
2567
|
+
const T = t.get(v);
|
|
2568
|
+
if (T) {
|
|
2569
|
+
const C = T.target.replace(/^\.\.\//, ""), k = C.startsWith("word/") ? C : `word/${C}`, y = n[k] || n[C];
|
|
2570
|
+
if (y)
|
|
2571
|
+
return {
|
|
2572
|
+
type: "image",
|
|
2573
|
+
src: y,
|
|
2574
|
+
width: Math.round(c),
|
|
2575
|
+
height: Math.round(u)
|
|
2576
|
+
};
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
return null;
|
|
2581
|
+
}
|
|
2582
|
+
function te(i) {
|
|
2583
|
+
return i.getElementsByTagNameNS(d.c, "chart").length > 0;
|
|
2584
|
+
}
|
|
2585
|
+
function Zn(i, t) {
|
|
2586
|
+
const e = i.substring(0, i.lastIndexOf("/")), n = t.split("/"), r = e.split("/");
|
|
2587
|
+
for (const o of n)
|
|
2588
|
+
o === ".." ? r.pop() : o !== "." && r.push(o);
|
|
2589
|
+
return r.join("/");
|
|
2590
|
+
}
|
|
2591
|
+
const Nn = "#0563C1";
|
|
2592
|
+
function Rn(i, t, e, n, r) {
|
|
2593
|
+
const o = Wn(i, r), s = [];
|
|
2594
|
+
return R(i, (a) => {
|
|
2595
|
+
var l, c;
|
|
2596
|
+
if (a.localName === "r" && a.namespaceURI === d.w) {
|
|
2597
|
+
const u = q(a, t, e, n);
|
|
2598
|
+
for (const p of u)
|
|
2599
|
+
p.type === "text" && s.push(Ct(p, a, t));
|
|
2600
|
+
} else if (a.localName === "ins" && a.namespaceURI === d.w) {
|
|
2601
|
+
const u = a.getAttributeNS(d.w, "id") ?? a.getAttribute("w:id") ?? "", p = a.getAttributeNS(d.w, "author") ?? a.getAttribute("w:author") ?? "", f = a.getAttributeNS(d.w, "date") ?? a.getAttribute("w:date") ?? "";
|
|
2602
|
+
let w = u || `rev_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2603
|
+
for (let m = s.length - 1; m >= 0; m--) {
|
|
2604
|
+
const g = s[m];
|
|
2605
|
+
if (g.type === "text" && ((l = g.revision) == null ? void 0 : l.type) === "delete" && g.revision.author === p && g.revision.date === f) {
|
|
2606
|
+
g.revision.id !== w && (w = g.revision.id);
|
|
2607
|
+
break;
|
|
2608
|
+
}
|
|
2609
|
+
if (!(g.type === "text" && ((c = g.revision) == null ? void 0 : c.type) === "delete") && !(g.type === "text" && !g.revision))
|
|
2610
|
+
break;
|
|
2611
|
+
}
|
|
2612
|
+
const h = { id: w, type: "insert", author: p, date: f };
|
|
2613
|
+
R(a, (m) => {
|
|
2614
|
+
if (m.localName === "r" && m.namespaceURI === d.w) {
|
|
2615
|
+
const g = q(m, t, e, n);
|
|
2616
|
+
for (const v of g)
|
|
2617
|
+
v.type === "text" && (v.revision = h, s.push(Ct(v, m, t)));
|
|
2618
|
+
}
|
|
2619
|
+
});
|
|
2620
|
+
} else if (a.localName === "del" && a.namespaceURI === d.w) {
|
|
2621
|
+
const u = a.getAttributeNS(d.w, "id") ?? a.getAttribute("w:id") ?? `rev_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`, p = a.getAttributeNS(d.w, "author") ?? a.getAttribute("w:author") ?? "", f = a.getAttributeNS(d.w, "date") ?? a.getAttribute("w:date") ?? "", w = { id: u, type: "delete", author: p, date: f };
|
|
2622
|
+
R(a, (h) => {
|
|
2623
|
+
if (h.localName === "r" && h.namespaceURI === d.w) {
|
|
2624
|
+
const m = q(h, t, e, n);
|
|
2625
|
+
for (const g of m)
|
|
2626
|
+
g.type === "text" && (g.revision = w, s.push(Ct(g, h, t)));
|
|
2627
|
+
}
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
}), s.length === 0 ? null : { type: "hyperlink", url: o, children: s };
|
|
2631
|
+
}
|
|
2632
|
+
function Wn(i, t) {
|
|
2633
|
+
const e = i.getAttributeNS(d.r, "id") ?? i.getAttribute("r:id") ?? "";
|
|
2634
|
+
if (e) {
|
|
2635
|
+
const r = t.get(e);
|
|
2636
|
+
if (r != null && r.target) return r.target;
|
|
2637
|
+
}
|
|
2638
|
+
const n = i.getAttributeNS(d.w, "anchor") ?? i.getAttribute("w:anchor");
|
|
2639
|
+
return n ? `#${n}` : "";
|
|
2640
|
+
}
|
|
2641
|
+
function Ct(i, t, e) {
|
|
2642
|
+
const n = b(t, d.w, "rPr"), r = n ? e.parseRunProperties(n) : {}, o = { ...i.style };
|
|
2643
|
+
return r.color === void 0 && !o.color && (o.color = Nn), r.underline === void 0 && o.underline === void 0 && (o.underline = !0), { ...i, style: o };
|
|
2644
|
+
}
|
|
2645
|
+
function tt(i, t, e, n, r, o, s, a) {
|
|
2646
|
+
const l = b(i, d.w, "pPr");
|
|
2647
|
+
let c = {}, u = {}, p = null;
|
|
2648
|
+
if (l) {
|
|
2649
|
+
const h = b(l, d.w, "pStyle");
|
|
2650
|
+
p = E(h);
|
|
2651
|
+
}
|
|
2652
|
+
if (p) {
|
|
2653
|
+
const h = t.resolveStyle(p);
|
|
2654
|
+
c = { ...h.paragraph }, u = { ...h.run };
|
|
2655
|
+
}
|
|
2656
|
+
if (l) {
|
|
2657
|
+
const h = t.parseParagraphProperties(l);
|
|
2658
|
+
Jt(c, h);
|
|
2659
|
+
const m = b(l, d.w, "rPr");
|
|
2660
|
+
if (m) {
|
|
2661
|
+
const g = t.parseRunProperties(m);
|
|
2662
|
+
Jt(u, g);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
if (!c.titleLevel && p) {
|
|
2666
|
+
const h = _n(p);
|
|
2667
|
+
h !== void 0 && (c.titleLevel = h);
|
|
2668
|
+
}
|
|
2669
|
+
if (c.numId && c.numId !== "0") {
|
|
2670
|
+
const h = c.listLevel ?? 0, m = n.resolve(c.numId, h);
|
|
2671
|
+
m && (c.listType = m.listType, c.listStyle = m.listStyle, c.listLevel = m.level);
|
|
2672
|
+
}
|
|
2673
|
+
const f = [];
|
|
2674
|
+
let w = "none";
|
|
2675
|
+
if (R(i, (h) => {
|
|
2676
|
+
var v, T;
|
|
2677
|
+
const m = h.localName, g = h.namespaceURI;
|
|
2678
|
+
if (m !== "pPr") {
|
|
2679
|
+
if (m === "r" && g === d.w) {
|
|
2680
|
+
if (Un(h, w, (C) => {
|
|
2681
|
+
w = C;
|
|
2682
|
+
}))
|
|
2683
|
+
return;
|
|
2684
|
+
if (w === "cached") {
|
|
2685
|
+
const C = Pn(h, (k) => ({ type: "text", value: k, style: { ...u } }), t, e, u);
|
|
2686
|
+
f.push(...C);
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2689
|
+
et(h, f, r, o, t, e, u, s);
|
|
2690
|
+
} else if (m === "ins" && g === d.w) {
|
|
2691
|
+
const C = h.getAttributeNS(d.w, "id") ?? h.getAttribute("w:id") ?? "", k = h.getAttributeNS(d.w, "author") ?? h.getAttribute("w:author") ?? "", y = h.getAttributeNS(d.w, "date") ?? h.getAttribute("w:date") ?? "";
|
|
2692
|
+
let V = C || `rev_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2693
|
+
for (let S = f.length - 1; S >= 0; S--) {
|
|
2694
|
+
const L = f[S];
|
|
2695
|
+
if (L.type === "text" && ((v = L.revision) == null ? void 0 : v.type) === "delete" && L.revision.author === k && L.revision.date === y) {
|
|
2696
|
+
L.revision.id !== V && (V = L.revision.id);
|
|
2697
|
+
break;
|
|
2698
|
+
}
|
|
2699
|
+
if (!(L.type === "text" && ((T = L.revision) == null ? void 0 : T.type) === "delete") && !(L.type === "text" && !L.revision))
|
|
2700
|
+
break;
|
|
2701
|
+
}
|
|
2702
|
+
R(h, (S) => {
|
|
2703
|
+
S.localName === "r" && S.namespaceURI === d.w && et(S, f, r, o, t, e, u, s, { id: V, type: "insert", author: k, date: y });
|
|
2704
|
+
});
|
|
2705
|
+
} else if (m === "del" && g === d.w) {
|
|
2706
|
+
const C = h.getAttributeNS(d.w, "id") ?? h.getAttribute("w:id") ?? `rev_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`, k = h.getAttributeNS(d.w, "author") ?? h.getAttribute("w:author") ?? "", y = h.getAttributeNS(d.w, "date") ?? h.getAttribute("w:date") ?? "";
|
|
2707
|
+
R(h, (V) => {
|
|
2708
|
+
V.localName === "r" && V.namespaceURI === d.w && et(V, f, r, o, t, e, u, s, { id: C, type: "delete", author: k, date: y });
|
|
2709
|
+
});
|
|
2710
|
+
} else if (m === "hyperlink" && g === d.w) {
|
|
2711
|
+
const C = Rn(h, t, e, u, r);
|
|
2712
|
+
C && f.push(C);
|
|
2713
|
+
} else if (m === "AlternateContent" && g === d.mc)
|
|
2714
|
+
Gn(h, f, r, o, t, e, u, s);
|
|
2715
|
+
else if (m === "oMath" && g === d.m) {
|
|
2716
|
+
const C = Fn(h, u);
|
|
2717
|
+
f.push(...C);
|
|
2718
|
+
} else if (m === "commentRangeStart" && g === d.w) {
|
|
2719
|
+
const C = h.getAttributeNS(d.w, "id") ?? h.getAttribute("w:id") ?? "";
|
|
2720
|
+
C && f.push({ type: "commentMarker", markType: "start", commentId: C });
|
|
2721
|
+
} else if (m === "commentRangeEnd" && g === d.w) {
|
|
2722
|
+
const C = h.getAttributeNS(d.w, "id") ?? h.getAttribute("w:id") ?? "";
|
|
2723
|
+
C && f.push({ type: "commentMarker", markType: "end", commentId: C });
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}), f.length === 0) {
|
|
2727
|
+
const h = u.size ?? a ?? 12;
|
|
2728
|
+
f.push({
|
|
2729
|
+
type: "text",
|
|
2730
|
+
value: "",
|
|
2731
|
+
style: { ...u, size: h }
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
return {
|
|
2735
|
+
type: "paragraph",
|
|
2736
|
+
chunks: f,
|
|
2737
|
+
style: c
|
|
2738
|
+
};
|
|
2739
|
+
}
|
|
2740
|
+
function Un(i, t, e) {
|
|
2741
|
+
const n = b(i, d.w, "fldChar"), r = b(i, d.w, "instrText");
|
|
2742
|
+
if (n) {
|
|
2743
|
+
const o = n.getAttributeNS(d.w, "fldCharType") ?? n.getAttribute("w:fldCharType");
|
|
2744
|
+
return o === "begin" ? (e("instr"), !0) : o === "separate" ? (e("cached"), !0) : (o === "end" && e("none"), !0);
|
|
2745
|
+
}
|
|
2746
|
+
return !!(r && t === "instr");
|
|
2747
|
+
}
|
|
2748
|
+
function Pn(i, t, e, n, r) {
|
|
2749
|
+
return q(i, e, n, r);
|
|
2750
|
+
}
|
|
2751
|
+
function et(i, t, e, n, r, o, s, a, l) {
|
|
2752
|
+
let c = b(i, d.w, "drawing"), u = b(i, d.w, "pict");
|
|
2753
|
+
if (!c && !u) {
|
|
2754
|
+
const p = b(i, d.mc, "AlternateContent");
|
|
2755
|
+
if (p) {
|
|
2756
|
+
const f = b(p, d.mc, "Choice");
|
|
2757
|
+
if (f && (c = b(f, d.w, "drawing")), !c) {
|
|
2758
|
+
const w = b(p, d.mc, "Fallback");
|
|
2759
|
+
w && (u = b(w, d.w, "pict"));
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
if (c) {
|
|
2764
|
+
if (!te(c)) {
|
|
2765
|
+
const p = qt(c, e, n, a);
|
|
2766
|
+
p ? t.push(p) : t.push(...at(c, r, o, s));
|
|
2767
|
+
}
|
|
2768
|
+
} else if (u) {
|
|
2769
|
+
const p = ee(u, e, n);
|
|
2770
|
+
p ? t.push(p) : t.push(...at(u, r, o, s));
|
|
2771
|
+
} else {
|
|
2772
|
+
const p = q(i, r, o, s);
|
|
2773
|
+
if (l)
|
|
2774
|
+
for (const f of p)
|
|
2775
|
+
f.type === "text" && (f.revision = l);
|
|
2776
|
+
t.push(...p);
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
function Gn(i, t, e, n, r, o, s, a) {
|
|
2780
|
+
const l = b(i, d.mc, "Choice");
|
|
2781
|
+
if (l) {
|
|
2782
|
+
let u = !1;
|
|
2783
|
+
if (R(l, (p) => {
|
|
2784
|
+
if (p.localName === "r" && p.namespaceURI === d.w)
|
|
2785
|
+
et(p, t, e, n, r, o, s, a), u = !0;
|
|
2786
|
+
else if (p.localName === "drawing" && p.namespaceURI === d.w) {
|
|
2787
|
+
if (!te(p)) {
|
|
2788
|
+
const f = qt(p, e, n, a);
|
|
2789
|
+
f ? t.push(f) : t.push(...at(p, r, o, s));
|
|
2790
|
+
}
|
|
2791
|
+
u = !0;
|
|
2792
|
+
}
|
|
2793
|
+
}), u) return;
|
|
2794
|
+
}
|
|
2795
|
+
const c = b(i, d.mc, "Fallback");
|
|
2796
|
+
c && R(c, (u) => {
|
|
2797
|
+
if (u.localName === "r" && u.namespaceURI === d.w)
|
|
2798
|
+
et(u, t, e, n, r, o, s, a);
|
|
2799
|
+
else if (u.localName === "pict" && u.namespaceURI === d.w) {
|
|
2800
|
+
const p = ee(u, e, n);
|
|
2801
|
+
p ? t.push(p) : t.push(...at(u, r, o, s));
|
|
2802
|
+
}
|
|
2803
|
+
});
|
|
2804
|
+
}
|
|
2805
|
+
function at(i, t, e, n) {
|
|
2806
|
+
const r = i.getElementsByTagNameNS(d.w, "txbxContent");
|
|
2807
|
+
if (r.length === 0) return [];
|
|
2808
|
+
const o = [], s = r[0];
|
|
2809
|
+
let a = !0;
|
|
2810
|
+
return R(s, (l) => {
|
|
2811
|
+
l.localName === "p" && l.namespaceURI === d.w && (a || o.push({ type: "break", breakType: "line" }), a = !1, R(l, (c) => {
|
|
2812
|
+
c.localName === "r" && c.namespaceURI === d.w && o.push(...q(c, t, e, n));
|
|
2813
|
+
}));
|
|
2814
|
+
}), o;
|
|
2815
|
+
}
|
|
2816
|
+
function ee(i, t, e) {
|
|
2817
|
+
const n = "urn:schemas-microsoft-com:vml", r = i.getElementsByTagNameNS(n, "imagedata");
|
|
2818
|
+
if (r.length === 0) return null;
|
|
2819
|
+
const o = r[0], s = o.getAttributeNS(d.r, "id") ?? o.getAttribute("r:id") ?? o.getAttributeNS(d.r, "href") ?? "";
|
|
2820
|
+
if (!s) return null;
|
|
2821
|
+
const a = t.get(s);
|
|
2822
|
+
if (!a) return null;
|
|
2823
|
+
const l = a.target.replace(/^\.\.\//, ""), c = l.startsWith("word/") ? l : `word/${l}`, u = e[c] ?? e[l];
|
|
2824
|
+
if (!u) return null;
|
|
2825
|
+
const p = i.getElementsByTagNameNS(n, "shape");
|
|
2826
|
+
let f = 100, w = 100;
|
|
2827
|
+
if (p.length > 0) {
|
|
2828
|
+
const h = p[0].getAttribute("style") ?? "", m = h.match(/width:\s*([\d.]+)pt/), g = h.match(/height:\s*([\d.]+)pt/);
|
|
2829
|
+
m && (f = parseFloat(m[1]) * (96 / 72)), g && (w = parseFloat(g[1]) * (96 / 72));
|
|
2830
|
+
}
|
|
2831
|
+
return { type: "image", src: u, width: Math.round(f), height: Math.round(w) };
|
|
2832
|
+
}
|
|
2833
|
+
function Fn(i, t) {
|
|
2834
|
+
const e = i.getElementsByTagNameNS(d.m, "t"), n = [];
|
|
2835
|
+
for (let o = 0; o < e.length; o++) {
|
|
2836
|
+
const s = e[o].textContent ?? "";
|
|
2837
|
+
s.trim() && n.push(s);
|
|
2838
|
+
}
|
|
2839
|
+
return [{
|
|
2840
|
+
type: "text",
|
|
2841
|
+
value: n.length > 0 ? n.join("") : "[公式]",
|
|
2842
|
+
style: { ...t, italic: !0 }
|
|
2843
|
+
}];
|
|
2844
|
+
}
|
|
2845
|
+
function _n(i) {
|
|
2846
|
+
const t = i.match(/^heading\s*(\d+)$/i);
|
|
2847
|
+
if (t) {
|
|
2848
|
+
const n = parseInt(t[1], 10);
|
|
2849
|
+
if (n >= 1 && n <= 6) return n;
|
|
2850
|
+
}
|
|
2851
|
+
const e = i.match(/^标题\s*(\d+)$/);
|
|
2852
|
+
if (e) {
|
|
2853
|
+
const n = parseInt(e[1], 10);
|
|
2854
|
+
if (n >= 1 && n <= 6) return n;
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
function Jt(i, t) {
|
|
2858
|
+
for (const e of Object.keys(t))
|
|
2859
|
+
t[e] !== void 0 && (i[e] = t[e]);
|
|
2860
|
+
}
|
|
2861
|
+
function ct(i, t, e, n, r, o, s) {
|
|
2862
|
+
const a = Xn(i), { borderType: l, borderColor: c, borderWidth: u } = An(i, e), p = pt(i, d.w, "tr"), f = [];
|
|
2863
|
+
for (const h of p)
|
|
2864
|
+
f.push(
|
|
2865
|
+
Hn(h, t, e, n, r, o, s)
|
|
2866
|
+
);
|
|
2867
|
+
return { type: "table", rows: Mn(f), colWidths: a, borderType: l, borderColor: c, borderWidth: u };
|
|
2868
|
+
}
|
|
2869
|
+
function Xn(i) {
|
|
2870
|
+
const t = [], e = b(i, d.w, "tblGrid");
|
|
2871
|
+
if (!e) return t;
|
|
2872
|
+
for (const n of pt(e, d.w, "gridCol")) {
|
|
2873
|
+
const r = n.getAttributeNS(d.w, "w") ?? n.getAttribute("w:w");
|
|
2874
|
+
t.push(r ? G(parseInt(r, 10)) : 100);
|
|
2875
|
+
}
|
|
2876
|
+
return t;
|
|
2877
|
+
}
|
|
2878
|
+
function An(i, t) {
|
|
2879
|
+
const e = b(i, d.w, "tblPr");
|
|
2880
|
+
if (!e) return {};
|
|
2881
|
+
const n = b(e, d.w, "tblBorders");
|
|
2882
|
+
if (!n) return {};
|
|
2883
|
+
const r = b(n, d.w, "top");
|
|
2884
|
+
if (!r) return {};
|
|
2885
|
+
const o = E(r), s = o === "none" || o === "nil" ? "EMPTY" : "ALL", a = r.getAttributeNS(d.w, "themeColor") ?? r.getAttribute("w:themeColor");
|
|
2886
|
+
let l;
|
|
2887
|
+
if (a) {
|
|
2888
|
+
const p = ht(t, a);
|
|
2889
|
+
p && (l = p);
|
|
2890
|
+
} else {
|
|
2891
|
+
const p = r.getAttributeNS(d.w, "color") ?? r.getAttribute("w:color");
|
|
2892
|
+
p && p !== "auto" && (l = `#${p}`);
|
|
2893
|
+
}
|
|
2894
|
+
const c = r.getAttributeNS(d.w, "sz") ?? r.getAttribute("w:sz"), u = c ? en(parseInt(c, 10)) : void 0;
|
|
2895
|
+
return { borderType: s, borderColor: l, borderWidth: u };
|
|
2896
|
+
}
|
|
2897
|
+
function Hn(i, t, e, n, r, o, s) {
|
|
2898
|
+
let a;
|
|
2899
|
+
const l = b(i, d.w, "trPr");
|
|
2900
|
+
if (l) {
|
|
2901
|
+
const u = b(l, d.w, "trHeight");
|
|
2902
|
+
if (u) {
|
|
2903
|
+
const p = u.getAttributeNS(d.w, "val") ?? u.getAttribute("w:val"), f = u.getAttributeNS(d.w, "hRule") ?? u.getAttribute("w:hRule");
|
|
2904
|
+
if (p) {
|
|
2905
|
+
const w = G(parseInt(p, 10));
|
|
2906
|
+
f === "exact" ? a = w : a = Math.min(w, 200);
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
const c = [];
|
|
2911
|
+
for (const u of pt(i, d.w, "tc"))
|
|
2912
|
+
c.push(Jn(u, t, e, n, r, o, s));
|
|
2913
|
+
return { height: a, cells: c };
|
|
2914
|
+
}
|
|
2915
|
+
function Jn(i, t, e, n, r, o, s) {
|
|
2916
|
+
const a = b(i, d.w, "tcPr");
|
|
2917
|
+
let l = 1;
|
|
2918
|
+
if (a) {
|
|
2919
|
+
const m = b(a, d.w, "gridSpan");
|
|
2920
|
+
if (m) {
|
|
2921
|
+
const g = E(m);
|
|
2922
|
+
g && (l = parseInt(g, 10));
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
let c = null;
|
|
2926
|
+
if (a) {
|
|
2927
|
+
const m = b(a, d.w, "vMerge");
|
|
2928
|
+
m && (c = E(m) === "restart" ? "restart" : "continue");
|
|
2929
|
+
}
|
|
2930
|
+
let u;
|
|
2931
|
+
if (a) {
|
|
2932
|
+
const m = b(a, d.w, "shd");
|
|
2933
|
+
m && (u = It(m, e) ?? void 0);
|
|
2934
|
+
}
|
|
2935
|
+
let p;
|
|
2936
|
+
if (a) {
|
|
2937
|
+
const m = b(a, d.w, "vAlign");
|
|
2938
|
+
m && (p = E(m) ?? void 0);
|
|
2939
|
+
}
|
|
2940
|
+
let f;
|
|
2941
|
+
if (a) {
|
|
2942
|
+
const m = b(a, d.w, "tcW");
|
|
2943
|
+
if (m) {
|
|
2944
|
+
const g = m.getAttributeNS(d.w, "w") ?? m.getAttribute("w:w"), v = m.getAttributeNS(d.w, "type") ?? m.getAttribute("w:type");
|
|
2945
|
+
g && v === "dxa" && (f = G(parseInt(g, 10)));
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
const w = Yn(a), h = [];
|
|
2949
|
+
return Bn(i, h, t, e, n, r, o, s), { paragraphs: h, colspan: l, vMerge: c, backgroundColor: u, verticalAlign: p, borderTypes: w, width: f };
|
|
2950
|
+
}
|
|
2951
|
+
function Yn(i) {
|
|
2952
|
+
if (!i) return;
|
|
2953
|
+
const t = b(i, d.w, "tcBorders");
|
|
2954
|
+
if (!t) return;
|
|
2955
|
+
const e = ["top", "right", "bottom", "left"], n = [];
|
|
2956
|
+
let r = !1;
|
|
2957
|
+
for (const o of e) {
|
|
2958
|
+
const s = b(t, d.w, o);
|
|
2959
|
+
if (s) {
|
|
2960
|
+
const a = E(s) ?? "single";
|
|
2961
|
+
n.push(ln[a] ?? 1), r = !0;
|
|
2962
|
+
} else
|
|
2963
|
+
n.push(-1);
|
|
2964
|
+
}
|
|
2965
|
+
return r ? n : void 0;
|
|
2966
|
+
}
|
|
2967
|
+
function Bn(i, t, e, n, r, o, s, a) {
|
|
2968
|
+
R(i, (l) => {
|
|
2969
|
+
if (l.localName === "p" && l.namespaceURI === d.w)
|
|
2970
|
+
t.push(
|
|
2971
|
+
tt(l, e, n, r, o, s, a)
|
|
2972
|
+
);
|
|
2973
|
+
else if (l.localName === "tbl" && l.namespaceURI === d.w) {
|
|
2974
|
+
const c = ct(l, e, n, r, o, s, a);
|
|
2975
|
+
t.push({
|
|
2976
|
+
type: "paragraph",
|
|
2977
|
+
chunks: [{ type: "nestedTable", table: c }],
|
|
2978
|
+
style: {}
|
|
2979
|
+
});
|
|
2980
|
+
} else if (l.localName === "sdt" && l.namespaceURI === d.w) {
|
|
2981
|
+
const c = b(l, d.w, "sdtContent");
|
|
2982
|
+
c && R(c, (u) => {
|
|
2983
|
+
u.localName === "p" && u.namespaceURI === d.w && t.push(
|
|
2984
|
+
tt(u, e, n, r, o, s, a)
|
|
2985
|
+
);
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
function Mn(i) {
|
|
2991
|
+
const t = [], e = /* @__PURE__ */ new Map();
|
|
2992
|
+
for (let n = 0; n < i.length; n++) {
|
|
2993
|
+
const r = i[n], o = [];
|
|
2994
|
+
let s = 0;
|
|
2995
|
+
for (const a of r.cells) {
|
|
2996
|
+
if (a.vMerge === "restart")
|
|
2997
|
+
e.set(s, { rowIdx: t.length, cellIdx: o.length }), o.push(Yt(a, 1));
|
|
2998
|
+
else if (a.vMerge === "continue") {
|
|
2999
|
+
const l = e.get(s);
|
|
3000
|
+
l && t[l.rowIdx].cells[l.cellIdx].rowspan++;
|
|
3001
|
+
} else
|
|
3002
|
+
e.delete(s), o.push(Yt(a, 1));
|
|
3003
|
+
s += a.colspan;
|
|
3004
|
+
}
|
|
3005
|
+
t.push({ height: r.height, cells: o });
|
|
3006
|
+
}
|
|
3007
|
+
return t;
|
|
3008
|
+
}
|
|
3009
|
+
function Yt(i, t) {
|
|
3010
|
+
return {
|
|
3011
|
+
paragraphs: i.paragraphs,
|
|
3012
|
+
colspan: i.colspan,
|
|
3013
|
+
rowspan: t,
|
|
3014
|
+
backgroundColor: i.backgroundColor,
|
|
3015
|
+
verticalAlign: i.verticalAlign,
|
|
3016
|
+
borderTypes: i.borderTypes,
|
|
3017
|
+
width: i.width
|
|
3018
|
+
};
|
|
3019
|
+
}
|
|
3020
|
+
function Kn(i) {
|
|
3021
|
+
const t = b(i, d.w, "sdtPr");
|
|
3022
|
+
if (!t) return !1;
|
|
3023
|
+
const e = b(t, d.w, "docPartObj");
|
|
3024
|
+
if (e) {
|
|
3025
|
+
const l = b(e, d.w, "docPartGallery"), c = E(l);
|
|
3026
|
+
if (c && c.toLowerCase().includes("table of contents")) return !0;
|
|
3027
|
+
}
|
|
3028
|
+
const n = b(t, d.w, "alias"), r = E(n);
|
|
3029
|
+
if (r) {
|
|
3030
|
+
const l = r.toLowerCase();
|
|
3031
|
+
if (l.includes("目录") || l.includes("toc") || l.includes("table of contents")) return !0;
|
|
3032
|
+
}
|
|
3033
|
+
const o = b(t, d.w, "tag"), s = E(o);
|
|
3034
|
+
if (s) {
|
|
3035
|
+
const l = s.toLowerCase();
|
|
3036
|
+
if (l.includes("目录") || l.includes("toc")) return !0;
|
|
3037
|
+
}
|
|
3038
|
+
const a = b(i, d.w, "sdtContent");
|
|
3039
|
+
if (a) {
|
|
3040
|
+
const l = a.getElementsByTagNameNS(d.w, "instrText");
|
|
3041
|
+
for (let c = 0; c < l.length; c++)
|
|
3042
|
+
if ((l[c].textContent || "").trim().startsWith("TOC")) return !0;
|
|
3043
|
+
}
|
|
3044
|
+
return !1;
|
|
3045
|
+
}
|
|
3046
|
+
function Qn(i, t, e, n, r, o) {
|
|
3047
|
+
const s = [], a = b(i, d.w, "sdtContent");
|
|
3048
|
+
return a && R(a, (l) => {
|
|
3049
|
+
l.localName === "p" && l.namespaceURI === d.w && s.push(
|
|
3050
|
+
tt(l, t, e, n, r, o)
|
|
3051
|
+
);
|
|
3052
|
+
}), s;
|
|
3053
|
+
}
|
|
3054
|
+
function Bt(i) {
|
|
3055
|
+
const t = {
|
|
3056
|
+
breakType: "nextPage",
|
|
3057
|
+
columns: 1,
|
|
3058
|
+
colWidths: [],
|
|
3059
|
+
colSpace: 0,
|
|
3060
|
+
separator: !1
|
|
3061
|
+
}, e = b(i, d.w, "type");
|
|
3062
|
+
if (e) {
|
|
3063
|
+
const a = e.getAttributeNS(d.w, "val") ?? e.getAttribute("w:val");
|
|
3064
|
+
(a === "continuous" || a === "nextColumn" || a === "evenPage" || a === "oddPage" || a === "nextPage") && (t.breakType = a);
|
|
3065
|
+
}
|
|
3066
|
+
const n = b(i, d.w, "cols");
|
|
3067
|
+
if (!n) return t;
|
|
3068
|
+
const r = n.getAttributeNS(d.w, "num") ?? n.getAttribute("w:num"), o = n.getAttributeNS(d.w, "space") ?? n.getAttribute("w:space"), s = n.getAttributeNS(d.w, "sep") ?? n.getAttribute("w:sep");
|
|
3069
|
+
r && (t.columns = Math.max(1, parseInt(r, 10))), o && (t.colSpace = G(parseInt(o, 10))), t.separator = s === "1" || s === "true";
|
|
3070
|
+
for (const a of pt(n, d.w, "col")) {
|
|
3071
|
+
const l = a.getAttributeNS(d.w, "w") ?? a.getAttribute("w:w");
|
|
3072
|
+
l && t.colWidths.push(G(parseInt(l, 10)));
|
|
3073
|
+
}
|
|
3074
|
+
return t;
|
|
3075
|
+
}
|
|
3076
|
+
function Mt(i, t, e) {
|
|
3077
|
+
const { columns: n, colWidths: r, colSpace: o, separator: s } = t, a = On(n, r, o, e), l = Dn(i, n);
|
|
3078
|
+
return {
|
|
3079
|
+
type: "column",
|
|
3080
|
+
columns: n,
|
|
3081
|
+
colWidths: a,
|
|
3082
|
+
colSpace: o,
|
|
3083
|
+
separator: s,
|
|
3084
|
+
groups: l
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
function On(i, t, e, n) {
|
|
3088
|
+
if (t.length >= i)
|
|
3089
|
+
return t.slice(0, i);
|
|
3090
|
+
const r = e * Math.max(0, i - 1), o = (n - r) / i;
|
|
3091
|
+
return Array.from({ length: i }, () => Math.max(o, 50));
|
|
3092
|
+
}
|
|
3093
|
+
function Dn(i, t) {
|
|
3094
|
+
const e = [[]];
|
|
3095
|
+
for (const n of i)
|
|
3096
|
+
if (n.chunks.some(
|
|
3097
|
+
(o) => o.type === "break" && o.breakType === "column"
|
|
3098
|
+
) && e.length < t) {
|
|
3099
|
+
const o = n.chunks.filter(
|
|
3100
|
+
(s) => !(s.type === "break" && s.breakType === "column")
|
|
3101
|
+
);
|
|
3102
|
+
o.length > 0 ? e.push([{ ...n, chunks: o }]) : e.push([]);
|
|
3103
|
+
} else
|
|
3104
|
+
e[e.length - 1].push(n);
|
|
3105
|
+
return e;
|
|
3106
|
+
}
|
|
3107
|
+
const _ = "http://schemas.openxmlformats.org/drawingml/2006/chart", zn = d.a;
|
|
3108
|
+
function jn(i) {
|
|
3109
|
+
try {
|
|
3110
|
+
const t = $n(i);
|
|
3111
|
+
return !t || t.series.length === 0 ? null : ir(t);
|
|
3112
|
+
} catch (t) {
|
|
3113
|
+
return console.error("[ooxmlChartParser] parse error:", t), null;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
function $n(i) {
|
|
3117
|
+
const n = D(i).documentElement.getElementsByTagNameNS(_, "chart");
|
|
3118
|
+
if (n.length === 0) return null;
|
|
3119
|
+
const r = n[0], o = qn(r), s = r.getElementsByTagNameNS(_, "plotArea");
|
|
3120
|
+
if (s.length === 0) return null;
|
|
3121
|
+
const a = s[0], l = {
|
|
3122
|
+
barChart: "bar",
|
|
3123
|
+
bar3DChart: "bar",
|
|
3124
|
+
lineChart: "line",
|
|
3125
|
+
line3DChart: "line",
|
|
3126
|
+
pieChart: "pie",
|
|
3127
|
+
pie3DChart: "pie",
|
|
3128
|
+
areaChart: "area",
|
|
3129
|
+
area3DChart: "area",
|
|
3130
|
+
scatterChart: "scatter",
|
|
3131
|
+
radarChart: "radar",
|
|
3132
|
+
doughnutChart: "doughnut",
|
|
3133
|
+
ofPieChart: "pie"
|
|
3134
|
+
};
|
|
3135
|
+
for (const [c, u] of Object.entries(l)) {
|
|
3136
|
+
const p = a.getElementsByTagNameNS(_, c);
|
|
3137
|
+
if (p.length > 0) {
|
|
3138
|
+
const f = tr(p[0]);
|
|
3139
|
+
if (f.series.length > 0)
|
|
3140
|
+
return {
|
|
3141
|
+
type: u,
|
|
3142
|
+
title: o,
|
|
3143
|
+
categories: f.categories,
|
|
3144
|
+
series: f.series
|
|
3145
|
+
};
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
return null;
|
|
3149
|
+
}
|
|
3150
|
+
function qn(i) {
|
|
3151
|
+
const t = i.getElementsByTagNameNS(_, "title");
|
|
3152
|
+
if (t.length === 0) return "";
|
|
3153
|
+
const e = t[0].getElementsByTagNameNS(zn, "t");
|
|
3154
|
+
if (e.length > 0)
|
|
3155
|
+
return Array.from(e).map((r) => r.textContent || "").join("");
|
|
3156
|
+
const n = t[0].getElementsByTagNameNS(_, "v");
|
|
3157
|
+
return n.length > 0 && n[0].textContent || "";
|
|
3158
|
+
}
|
|
3159
|
+
function tr(i) {
|
|
3160
|
+
const t = i.getElementsByTagNameNS(_, "ser"), e = [];
|
|
3161
|
+
let n = [];
|
|
3162
|
+
for (let r = 0; r < t.length; r++) {
|
|
3163
|
+
const o = t[r], s = er(o) || `系列${r + 1}`;
|
|
3164
|
+
n.length === 0 && (n = nr(o));
|
|
3165
|
+
const a = rr(o);
|
|
3166
|
+
a.length > 0 && e.push({ name: s, values: a });
|
|
3167
|
+
}
|
|
3168
|
+
if (n.length === 0 && e.length > 0) {
|
|
3169
|
+
const r = Math.max(...e.map((o) => o.values.length));
|
|
3170
|
+
n = Array.from({ length: r }, (o, s) => `${s + 1}`);
|
|
3171
|
+
}
|
|
3172
|
+
return { categories: n, series: e };
|
|
3173
|
+
}
|
|
3174
|
+
function er(i) {
|
|
3175
|
+
const t = Zt(i, _, "tx");
|
|
3176
|
+
if (t.length === 0) return "";
|
|
3177
|
+
const e = ut(t[0], "strCache");
|
|
3178
|
+
if (e.length > 0) return e[0];
|
|
3179
|
+
const n = t[0].getElementsByTagNameNS(_, "v");
|
|
3180
|
+
return n.length > 0 && n[0].textContent || "";
|
|
3181
|
+
}
|
|
3182
|
+
function nr(i) {
|
|
3183
|
+
const t = Zt(i, _, "cat");
|
|
3184
|
+
if (t.length === 0) return [];
|
|
3185
|
+
const e = ut(t[0], "strCache");
|
|
3186
|
+
if (e.length > 0) return e;
|
|
3187
|
+
const n = ut(t[0], "numCache");
|
|
3188
|
+
return n.length > 0 ? n : [];
|
|
3189
|
+
}
|
|
3190
|
+
function rr(i) {
|
|
3191
|
+
const t = Zt(i, _, "val");
|
|
3192
|
+
return t.length === 0 ? [] : ut(t[0], "numCache").map((n) => parseFloat(n) || 0);
|
|
3193
|
+
}
|
|
3194
|
+
function ut(i, t) {
|
|
3195
|
+
const e = i.getElementsByTagNameNS(_, t);
|
|
3196
|
+
if (e.length === 0) return [];
|
|
3197
|
+
const r = e[0].getElementsByTagNameNS(_, "pt");
|
|
3198
|
+
if (r.length === 0) return [];
|
|
3199
|
+
const o = [];
|
|
3200
|
+
for (let a = 0; a < r.length; a++) {
|
|
3201
|
+
const l = r[a], c = parseInt(l.getAttribute("idx") || "0", 10), u = l.getElementsByTagNameNS(_, "v"), p = u.length > 0 && u[0].textContent || "";
|
|
3202
|
+
o.push({ idx: c, val: p });
|
|
3203
|
+
}
|
|
3204
|
+
o.sort((a, l) => a.idx - l.idx);
|
|
3205
|
+
const s = [];
|
|
3206
|
+
for (const a of o) {
|
|
3207
|
+
for (; s.length < a.idx; ) s.push("");
|
|
3208
|
+
s.push(a.val);
|
|
3209
|
+
}
|
|
3210
|
+
return s;
|
|
3211
|
+
}
|
|
3212
|
+
function Zt(i, t, e) {
|
|
3213
|
+
const n = [];
|
|
3214
|
+
for (let r = 0; r < i.childNodes.length; r++) {
|
|
3215
|
+
const o = i.childNodes[r];
|
|
3216
|
+
o.nodeType === 1 && o.localName === e && o.namespaceURI === t && n.push(o);
|
|
3217
|
+
}
|
|
3218
|
+
return n;
|
|
3219
|
+
}
|
|
3220
|
+
function ir(i) {
|
|
3221
|
+
const { type: t, title: e, categories: n, series: r } = i, s = {
|
|
3222
|
+
animation: !1,
|
|
3223
|
+
color: ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc"],
|
|
3224
|
+
grid: {
|
|
3225
|
+
left: "3%",
|
|
3226
|
+
right: "4%",
|
|
3227
|
+
bottom: "12%",
|
|
3228
|
+
top: e ? "15%" : "10%",
|
|
3229
|
+
containLabel: !0
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3232
|
+
if (e && (s.title = { text: e, left: "center", textStyle: { fontSize: 14 } }), r.length > 1 && (s.legend = {
|
|
3233
|
+
show: !0,
|
|
3234
|
+
bottom: 0,
|
|
3235
|
+
data: r.map((l) => l.name)
|
|
3236
|
+
}), t === "pie" || t === "doughnut") {
|
|
3237
|
+
const l = n.map((u, p) => {
|
|
3238
|
+
var f;
|
|
3239
|
+
return {
|
|
3240
|
+
name: u,
|
|
3241
|
+
value: ((f = r[0]) == null ? void 0 : f.values[p]) || 0
|
|
3242
|
+
};
|
|
3243
|
+
});
|
|
3244
|
+
return {
|
|
3245
|
+
...s,
|
|
3246
|
+
tooltip: { trigger: "item", formatter: "{b}: {c} ({d}%)" },
|
|
3247
|
+
series: [{
|
|
3248
|
+
type: "pie",
|
|
3249
|
+
radius: t === "doughnut" ? ["40%", "70%"] : "55%",
|
|
3250
|
+
data: l,
|
|
3251
|
+
label: { formatter: "{b}: {d}%" }
|
|
3252
|
+
}]
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
if (t === "radar") {
|
|
3256
|
+
const l = Math.max(...r.flatMap((u) => u.values)) * 1.2 || 100, c = n.map((u) => ({ name: u, max: l }));
|
|
3257
|
+
return {
|
|
3258
|
+
...s,
|
|
3259
|
+
tooltip: { trigger: "item" },
|
|
3260
|
+
radar: { indicator: c, shape: "circle" },
|
|
3261
|
+
series: [{
|
|
3262
|
+
type: "radar",
|
|
3263
|
+
data: r.map((u) => ({
|
|
3264
|
+
name: u.name,
|
|
3265
|
+
value: u.values
|
|
3266
|
+
}))
|
|
3267
|
+
}]
|
|
3268
|
+
};
|
|
3269
|
+
}
|
|
3270
|
+
if (t === "scatter")
|
|
3271
|
+
return {
|
|
3272
|
+
...s,
|
|
3273
|
+
tooltip: { trigger: "item" },
|
|
3274
|
+
xAxis: { type: "value" },
|
|
3275
|
+
yAxis: { type: "value" },
|
|
3276
|
+
series: r.map((l) => ({
|
|
3277
|
+
name: l.name,
|
|
3278
|
+
type: "scatter",
|
|
3279
|
+
data: l.values.map((c, u) => [n[u] && parseFloat(n[u]) || u, c])
|
|
3280
|
+
}))
|
|
3281
|
+
};
|
|
3282
|
+
const a = t === "area" ? "line" : t === "bar" || t === "line" ? t : "bar";
|
|
3283
|
+
return {
|
|
3284
|
+
...s,
|
|
3285
|
+
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
|
|
3286
|
+
xAxis: {
|
|
3287
|
+
type: "category",
|
|
3288
|
+
data: n,
|
|
3289
|
+
axisLabel: { rotate: n.length > 8 ? 45 : 0 }
|
|
3290
|
+
},
|
|
3291
|
+
yAxis: { type: "value" },
|
|
3292
|
+
series: r.map((l) => ({
|
|
3293
|
+
name: l.name,
|
|
3294
|
+
type: a,
|
|
3295
|
+
data: l.values,
|
|
3296
|
+
...t === "area" ? { areaStyle: {} } : {}
|
|
3297
|
+
}))
|
|
3298
|
+
};
|
|
3299
|
+
}
|
|
3300
|
+
function or(i) {
|
|
3301
|
+
const t = /* @__PURE__ */ new Map();
|
|
3302
|
+
if (!i) return t;
|
|
3303
|
+
const r = D(i).documentElement.getElementsByTagNameNS(d.w, "comment");
|
|
3304
|
+
for (let o = 0; o < r.length; o++) {
|
|
3305
|
+
const s = r[o], a = s.getAttributeNS(d.w, "id") || s.getAttribute("w:id") || "", l = s.getAttributeNS(d.w, "author") || s.getAttribute("w:author") || "", c = s.getAttributeNS(d.w, "date") || s.getAttribute("w:date") || "", u = s.getAttributeNS(d.w, "initials") || s.getAttribute("w:initials") || void 0;
|
|
3306
|
+
if (!a) continue;
|
|
3307
|
+
const p = sr(s);
|
|
3308
|
+
t.set(a, { id: a, author: l, date: c, initials: u, content: p });
|
|
3309
|
+
}
|
|
3310
|
+
return t;
|
|
3311
|
+
}
|
|
3312
|
+
function sr(i) {
|
|
3313
|
+
const t = [];
|
|
3314
|
+
return R(i, (e) => {
|
|
3315
|
+
if (e.localName === "p" && e.namespaceURI === d.w) {
|
|
3316
|
+
const n = [];
|
|
3317
|
+
R(e, (r) => {
|
|
3318
|
+
r.localName === "r" && r.namespaceURI === d.w && R(r, (o) => {
|
|
3319
|
+
o.localName === "t" && o.namespaceURI === d.w && n.push(o.textContent || "");
|
|
3320
|
+
});
|
|
3321
|
+
}), t.push(n.join(""));
|
|
3322
|
+
}
|
|
3323
|
+
}), t.join(`
|
|
3324
|
+
`);
|
|
3325
|
+
}
|
|
3326
|
+
const O = "", lr = {
|
|
3327
|
+
1: "first",
|
|
3328
|
+
2: "second",
|
|
3329
|
+
3: "third",
|
|
3330
|
+
4: "fourth",
|
|
3331
|
+
5: "fifth",
|
|
3332
|
+
6: "sixth"
|
|
3333
|
+
}, ar = {
|
|
3334
|
+
top: "top",
|
|
3335
|
+
center: "middle",
|
|
3336
|
+
bottom: "bottom"
|
|
3337
|
+
};
|
|
3338
|
+
let cr = 0;
|
|
3339
|
+
function Nt() {
|
|
3340
|
+
return `docx_${Date.now()}_${++cr}`;
|
|
3341
|
+
}
|
|
3342
|
+
function ur(i, t, e) {
|
|
3343
|
+
const n = [], r = /* @__PURE__ */ new Set(), o = t.defaultSize ?? 12, s = dr(i, o);
|
|
3344
|
+
let a = o;
|
|
3345
|
+
for (let l = 0; l < s.length; l++) {
|
|
3346
|
+
const c = s[l], u = n.length === 0;
|
|
3347
|
+
c.type === "paragraph" ? a = Rt(
|
|
3348
|
+
c,
|
|
3349
|
+
n,
|
|
3350
|
+
t,
|
|
3351
|
+
u,
|
|
3352
|
+
r,
|
|
3353
|
+
a
|
|
3354
|
+
) : c.type === "table" ? (re(c, n, t, r), a = o) : c.type === "column" && (Tr(c, n, t, r), a = o);
|
|
3355
|
+
}
|
|
3356
|
+
return n.length === 0 && n.push({ value: O }), n;
|
|
3357
|
+
}
|
|
3358
|
+
function dr(i, t) {
|
|
3359
|
+
const e = [];
|
|
3360
|
+
let n = 0;
|
|
3361
|
+
const r = () => {
|
|
3362
|
+
if (n <= 0) return;
|
|
3363
|
+
const o = n;
|
|
3364
|
+
n = 0, e.push({
|
|
3365
|
+
type: "paragraph",
|
|
3366
|
+
chunks: [{
|
|
3367
|
+
type: "text",
|
|
3368
|
+
value: O,
|
|
3369
|
+
style: { size: t }
|
|
3370
|
+
}],
|
|
3371
|
+
style: {
|
|
3372
|
+
spacingAfter: o > 1 ? (o - 1) * t * 1.2 : 0
|
|
3373
|
+
}
|
|
3374
|
+
});
|
|
3375
|
+
};
|
|
3376
|
+
for (const o of i)
|
|
3377
|
+
o.type === "paragraph" && pr(o) ? n++ : (r(), e.push(o));
|
|
3378
|
+
return r(), e;
|
|
3379
|
+
}
|
|
3380
|
+
function pr(i) {
|
|
3381
|
+
if (i.chunks.length === 0) return !0;
|
|
3382
|
+
if (i.chunks.length === 1) {
|
|
3383
|
+
const t = i.chunks[0];
|
|
3384
|
+
return t.type === "text" && t.value === O;
|
|
3385
|
+
}
|
|
3386
|
+
return !1;
|
|
3387
|
+
}
|
|
3388
|
+
function Rt(i, t, e, n, r, o) {
|
|
3389
|
+
const { style: s, chunks: a } = i, l = e.defaultSize ?? 12, c = e.forceDefaultLineHeight, u = {};
|
|
3390
|
+
if (s.rowFlex) {
|
|
3391
|
+
const h = sn[s.rowFlex];
|
|
3392
|
+
h && (u.rowFlex = h);
|
|
3393
|
+
}
|
|
3394
|
+
s.spacingBefore !== void 0 && (u.paragraphSpacingBefore = s.spacingBefore), s.spacingAfter !== void 0 && (u.paragraphSpacingAfter = s.spacingAfter), c ? u.lineHeight = c : s.lineHeight !== void 0 && (u.lineHeight = s.lineHeight), s.indentLeft !== void 0 && (u.paragraphIndentLeft = s.indentLeft), s.firstLineIndent !== void 0 && (u.paragraphFirstLineIndent = s.firstLineIndent), s.paragraphColor && (u.paragraphColor = s.paragraphColor);
|
|
3395
|
+
const p = s.titleLevel !== void 0 && s.titleLevel >= 1 && s.titleLevel <= 6, f = !!s.listType;
|
|
3396
|
+
if (!n && t.length > 0) {
|
|
3397
|
+
const h = { value: O, size: o };
|
|
3398
|
+
t.push(h);
|
|
3399
|
+
}
|
|
3400
|
+
const w = [];
|
|
3401
|
+
for (const h of a)
|
|
3402
|
+
fr(h, w, e, r);
|
|
3403
|
+
if (w.length === 0 && w.push({ value: O, size: l }), p) {
|
|
3404
|
+
Kt(w, u);
|
|
3405
|
+
const h = {
|
|
3406
|
+
value: "",
|
|
3407
|
+
type: "title",
|
|
3408
|
+
level: lr[s.titleLevel],
|
|
3409
|
+
valueList: w,
|
|
3410
|
+
...u
|
|
3411
|
+
};
|
|
3412
|
+
t.push(h);
|
|
3413
|
+
} else if (f) {
|
|
3414
|
+
Kt(w, u);
|
|
3415
|
+
const h = {
|
|
3416
|
+
value: "",
|
|
3417
|
+
type: "list",
|
|
3418
|
+
listType: s.listType,
|
|
3419
|
+
listStyle: s.listStyle,
|
|
3420
|
+
listLevel: s.listLevel,
|
|
3421
|
+
valueList: w,
|
|
3422
|
+
...u
|
|
3423
|
+
};
|
|
3424
|
+
t.push(h);
|
|
3425
|
+
} else
|
|
3426
|
+
for (let h = 0; h < w.length; h++) {
|
|
3427
|
+
const m = w[h];
|
|
3428
|
+
h === 0 ? Object.assign(m, u) : (u.rowFlex && (m.rowFlex = u.rowFlex), u.paragraphColor && (m.paragraphColor = u.paragraphColor)), t.push(m);
|
|
3429
|
+
}
|
|
3430
|
+
return hr(w, l);
|
|
3431
|
+
}
|
|
3432
|
+
function Kt(i, t) {
|
|
3433
|
+
for (const e of i)
|
|
3434
|
+
t.rowFlex && (e.rowFlex = t.rowFlex), t.paragraphColor && (e.paragraphColor = t.paragraphColor);
|
|
3435
|
+
}
|
|
3436
|
+
function hr(i, t) {
|
|
3437
|
+
for (let e = i.length - 1; e >= 0; e--) {
|
|
3438
|
+
const n = i[e].size;
|
|
3439
|
+
if (typeof n == "number" && n > 0) return n;
|
|
3440
|
+
}
|
|
3441
|
+
return t;
|
|
3442
|
+
}
|
|
3443
|
+
function fr(i, t, e, n) {
|
|
3444
|
+
switch (i.type) {
|
|
3445
|
+
case "text":
|
|
3446
|
+
mr(i, t, e, n);
|
|
3447
|
+
break;
|
|
3448
|
+
case "image":
|
|
3449
|
+
br(i, t, n);
|
|
3450
|
+
break;
|
|
3451
|
+
case "hyperlink":
|
|
3452
|
+
wr(i, t, e, n);
|
|
3453
|
+
break;
|
|
3454
|
+
case "break":
|
|
3455
|
+
yr(i, t);
|
|
3456
|
+
break;
|
|
3457
|
+
case "tab":
|
|
3458
|
+
t.push({ value: "", type: "tab" });
|
|
3459
|
+
break;
|
|
3460
|
+
case "commentMarker":
|
|
3461
|
+
i.markType === "start" ? n.add(`comment_${i.commentId}`) : n.delete(`comment_${i.commentId}`);
|
|
3462
|
+
break;
|
|
3463
|
+
case "bookmark":
|
|
3464
|
+
break;
|
|
3465
|
+
default:
|
|
3466
|
+
i.type;
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
function mr(i, t, e, n) {
|
|
3470
|
+
const { value: r, style: o } = i, s = e.defaultSize ?? 12;
|
|
3471
|
+
for (const a of r) {
|
|
3472
|
+
const l = { value: a };
|
|
3473
|
+
ne(l, o), o.vertAlign === "superscript" ? (l.type = "superscript", l.actualSize = (o.size ?? s) * 0.6) : o.vertAlign === "subscript" && (l.type = "subscript", l.actualSize = (o.size ?? s) * 0.6), n.size > 0 && (l.groupIds = [...n]), i.revision && (l.revisionId = i.revision.id, l.revisionType = i.revision.type, l.revisionAuthor = i.revision.author, l.revisionDate = i.revision.date, i.revision.type === "insert" ? l.color = l.color || "#1a73e8" : i.revision.type === "delete" && (l.color = l.color || "#f56c6c")), t.push(l);
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
function br(i, t, e) {
|
|
3477
|
+
const n = {
|
|
3478
|
+
value: i.src,
|
|
3479
|
+
type: "image",
|
|
3480
|
+
width: i.width,
|
|
3481
|
+
height: i.height,
|
|
3482
|
+
id: Nt()
|
|
3483
|
+
};
|
|
3484
|
+
i.display && (n.imgDisplay = gr(i.display), i.floatPosition && n.imgDisplay !== "inline" && n.imgDisplay !== "block" && (n.imgFloatPosition = i.floatPosition)), e.size > 0 && (n.groupIds = [...e]), t.push(n);
|
|
3485
|
+
}
|
|
3486
|
+
function gr(i) {
|
|
3487
|
+
return {
|
|
3488
|
+
inline: "inline",
|
|
3489
|
+
block: "block",
|
|
3490
|
+
surround: "surround",
|
|
3491
|
+
"float-top": "float-top",
|
|
3492
|
+
"float-bottom": "float-bottom",
|
|
3493
|
+
floatTop: "float-top"
|
|
3494
|
+
// 兼容旧值
|
|
3495
|
+
}[i] ?? "inline";
|
|
3496
|
+
}
|
|
3497
|
+
function wr(i, t, e, n) {
|
|
3498
|
+
e.defaultSize;
|
|
3499
|
+
const r = [];
|
|
3500
|
+
for (const s of i.children)
|
|
3501
|
+
for (const a of s.value) {
|
|
3502
|
+
const l = { value: a };
|
|
3503
|
+
ne(l, s.style), n.size > 0 && (l.groupIds = [...n]), s.revision && (l.revisionId = s.revision.id, l.revisionType = s.revision.type, l.revisionAuthor = s.revision.author, l.revisionDate = s.revision.date, s.revision.type === "insert" ? l.color = l.color || "#1a73e8" : s.revision.type === "delete" && (l.color = l.color || "#f56c6c")), r.push(l);
|
|
3504
|
+
}
|
|
3505
|
+
if (r.length === 0) return;
|
|
3506
|
+
const o = {
|
|
3507
|
+
value: "",
|
|
3508
|
+
type: "hyperlink",
|
|
3509
|
+
url: i.url,
|
|
3510
|
+
hyperlinkId: Nt(),
|
|
3511
|
+
valueList: r
|
|
3512
|
+
};
|
|
3513
|
+
n.size > 0 && (o.groupIds = [...n]), t.push(o);
|
|
3514
|
+
}
|
|
3515
|
+
function yr(i, t) {
|
|
3516
|
+
i.breakType === "page" ? t.push({ value: `
|
|
3517
|
+
`, type: "pageBreak" }) : i.breakType === "line" && t.push({ value: `
|
|
3518
|
+
` });
|
|
3519
|
+
}
|
|
3520
|
+
function ne(i, t, e) {
|
|
3521
|
+
t.bold && (i.bold = !0), t.italic && (i.italic = !0), t.underline !== void 0 && (i.underline = t.underline), t.strikeout && (i.strikeout = !0), t.font && (i.font = t.font), t.size && (i.size = t.size), t.color && (i.color = t.color), t.highlight && (i.highlight = t.highlight), t.letterSpacing && (i.letterSpacing = t.letterSpacing);
|
|
3522
|
+
}
|
|
3523
|
+
function re(i, t, e, n) {
|
|
3524
|
+
const r = e.targetInnerWidth, o = e.tableWidthMode ?? "fit", s = e.defaultTableRowHeight ?? 32, a = e.defaultTableTdPadding ?? [0, 4, 0, 4];
|
|
3525
|
+
let l = [...i.colWidths];
|
|
3526
|
+
if (r && o === "fit" && l.length > 0) {
|
|
3527
|
+
const f = l.reduce((w, h) => w + h, 0);
|
|
3528
|
+
if (f > 0) {
|
|
3529
|
+
const w = r / f;
|
|
3530
|
+
l = l.map((h) => Math.round(h * w));
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
const c = l.map((f) => ({ width: f })), u = [];
|
|
3534
|
+
for (const f of i.rows) {
|
|
3535
|
+
const w = [];
|
|
3536
|
+
for (const h of f.cells) {
|
|
3537
|
+
const m = [];
|
|
3538
|
+
for (let v = 0; v < h.paragraphs.length; v++) {
|
|
3539
|
+
const T = h.paragraphs[v];
|
|
3540
|
+
if (Sr(T)) {
|
|
3541
|
+
const C = T.chunks[0].table;
|
|
3542
|
+
re(C, m, e, n);
|
|
3543
|
+
} else
|
|
3544
|
+
Rt(T, m, e, v === 0 && m.length === 0, n, e.defaultSize ?? 12);
|
|
3545
|
+
}
|
|
3546
|
+
m.length === 0 && m.push({ value: O });
|
|
3547
|
+
const g = {
|
|
3548
|
+
value: m,
|
|
3549
|
+
colspan: h.colspan,
|
|
3550
|
+
rowspan: h.rowspan
|
|
3551
|
+
};
|
|
3552
|
+
h.backgroundColor && (g.backgroundColor = h.backgroundColor), h.verticalAlign && (g.verticalAlign = ar[h.verticalAlign] ?? "top"), h.borderTypes && (g.borderTypes = h.borderTypes), h.width && (g.width = h.width), w.push(g);
|
|
3553
|
+
}
|
|
3554
|
+
u.push({
|
|
3555
|
+
height: f.height ?? s,
|
|
3556
|
+
tdList: w
|
|
3557
|
+
});
|
|
3558
|
+
}
|
|
3559
|
+
const p = {
|
|
3560
|
+
value: "",
|
|
3561
|
+
type: "table",
|
|
3562
|
+
colgroup: c,
|
|
3563
|
+
trList: u,
|
|
3564
|
+
tdPadding: a
|
|
3565
|
+
};
|
|
3566
|
+
i.borderType === "EMPTY" ? p.borderType = 0 : i.borderType === "ALL" && (p.borderType = 1), i.borderColor && (p.borderColor = i.borderColor), i.borderWidth && (p.borderWidth = i.borderWidth), t.push(p);
|
|
3567
|
+
}
|
|
3568
|
+
function Sr(i) {
|
|
3569
|
+
return i.chunks.length === 1 && i.chunks[0].type === "nestedTable";
|
|
3570
|
+
}
|
|
3571
|
+
function Tr(i, t, e, n) {
|
|
3572
|
+
const r = Nt();
|
|
3573
|
+
t.push({
|
|
3574
|
+
value: O,
|
|
3575
|
+
columnId: r,
|
|
3576
|
+
columnCount: i.columns,
|
|
3577
|
+
columnGap: i.colSpace,
|
|
3578
|
+
columnSeparator: i.separator,
|
|
3579
|
+
columnWidths: i.colWidths
|
|
3580
|
+
});
|
|
3581
|
+
for (let o = 0; o < i.groups.length; o++) {
|
|
3582
|
+
const s = i.groups[o];
|
|
3583
|
+
o > 0 && t.push({
|
|
3584
|
+
value: `
|
|
3585
|
+
`,
|
|
3586
|
+
type: "columnBreak",
|
|
3587
|
+
columnId: r
|
|
3588
|
+
});
|
|
3589
|
+
let a = e.defaultSize ?? 12;
|
|
3590
|
+
for (let l = 0; l < s.length; l++) {
|
|
3591
|
+
const c = l === 0 && o === 0;
|
|
3592
|
+
a = Rt(s[l], t, e, c, n, a);
|
|
3593
|
+
const p = t[t.length - 1];
|
|
3594
|
+
p && !p.columnId && (p.columnId = r);
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
t.push({ value: O });
|
|
3598
|
+
}
|
|
3599
|
+
class vr {
|
|
3600
|
+
constructor(t) {
|
|
3601
|
+
I(this, "options");
|
|
3602
|
+
this.options = { ...t };
|
|
3603
|
+
}
|
|
3604
|
+
async parse(t) {
|
|
3605
|
+
try {
|
|
3606
|
+
const e = await Ue.loadAsync(t), [
|
|
3607
|
+
n,
|
|
3608
|
+
r,
|
|
3609
|
+
o,
|
|
3610
|
+
s,
|
|
3611
|
+
a,
|
|
3612
|
+
l
|
|
3613
|
+
] = await Promise.all([
|
|
3614
|
+
this.readZipEntry(e, "word/document.xml"),
|
|
3615
|
+
this.readZipEntry(e, "word/styles.xml"),
|
|
3616
|
+
this.readZipEntry(e, "word/numbering.xml"),
|
|
3617
|
+
this.readZipEntry(e, "word/theme/theme1.xml"),
|
|
3618
|
+
this.readZipEntry(e, "word/_rels/document.xml.rels"),
|
|
3619
|
+
this.readZipEntry(e, "word/comments.xml")
|
|
3620
|
+
]);
|
|
3621
|
+
if (!n)
|
|
3622
|
+
return { success: !1, elements: [], error: "Missing word/document.xml" };
|
|
3623
|
+
const c = await this.extractMediaFiles(e), u = await this.extractChartRelFiles(e), p = await this.extractChartXmlFiles(e), f = {
|
|
3624
|
+
documentXml: n,
|
|
3625
|
+
stylesXml: r,
|
|
3626
|
+
numberingXml: o,
|
|
3627
|
+
themeXml: s,
|
|
3628
|
+
documentRels: a,
|
|
3629
|
+
commentsXml: l,
|
|
3630
|
+
chartRelsMap: u,
|
|
3631
|
+
chartXmlMap: p,
|
|
3632
|
+
mediaMap: c,
|
|
3633
|
+
options: this.getMergedOptions()
|
|
3634
|
+
};
|
|
3635
|
+
return this.parseDocumentSync(f);
|
|
3636
|
+
} catch (e) {
|
|
3637
|
+
const n = e instanceof Error ? e.message : String(e);
|
|
3638
|
+
return { success: !1, elements: [], error: n };
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
async parseFromFile(t) {
|
|
3642
|
+
const e = await t.arrayBuffer();
|
|
3643
|
+
return this.parse(e);
|
|
3644
|
+
}
|
|
3645
|
+
async parseDocumentSync(t) {
|
|
3646
|
+
try {
|
|
3647
|
+
Lt.value = 0;
|
|
3648
|
+
let e = null;
|
|
3649
|
+
if (t.options.chartRenderer && Object.keys(t.chartXmlMap).length > 0) {
|
|
3650
|
+
const k = t.options.chartRenderer;
|
|
3651
|
+
e = (y, V, S, L) => k.renderToDataUrl(y, V, S, L);
|
|
3652
|
+
}
|
|
3653
|
+
const n = an(t.themeXml), r = new fn(t.stylesXml, n), o = new vn(t.numberingXml), s = or(t.commentsXml), a = t.documentRels ? $t(t.documentRels) : /* @__PURE__ */ new Map(), c = D(t.documentXml).documentElement.getElementsByTagNameNS(d.w, "body");
|
|
3654
|
+
if (c.length === 0)
|
|
3655
|
+
return { success: !1, elements: [], error: "No <w:body> found" };
|
|
3656
|
+
const u = c[0], p = xr(u, d.w, b), f = t.options.defaultSize ?? 12, w = [];
|
|
3657
|
+
let h = [];
|
|
3658
|
+
const m = [], g = () => {
|
|
3659
|
+
for (const k of h) w.push(k);
|
|
3660
|
+
h = [];
|
|
3661
|
+
}, v = (k) => {
|
|
3662
|
+
m.length > 0 && (k.chunks.unshift(...m), m.length = 0);
|
|
3663
|
+
};
|
|
3664
|
+
R(u, (k) => {
|
|
3665
|
+
const y = k.localName, V = k.namespaceURI;
|
|
3666
|
+
if (y === "p" && V === d.w) {
|
|
3667
|
+
const S = tt(
|
|
3668
|
+
k,
|
|
3669
|
+
r,
|
|
3670
|
+
n,
|
|
3671
|
+
o,
|
|
3672
|
+
a,
|
|
3673
|
+
t.mediaMap,
|
|
3674
|
+
p,
|
|
3675
|
+
f
|
|
3676
|
+
);
|
|
3677
|
+
v(S), kr(
|
|
3678
|
+
k,
|
|
3679
|
+
S,
|
|
3680
|
+
a,
|
|
3681
|
+
t.chartRelsMap,
|
|
3682
|
+
t.chartXmlMap,
|
|
3683
|
+
t.mediaMap,
|
|
3684
|
+
e,
|
|
3685
|
+
{ c: d.c, r: d.r, wp: d.wp, w: d.w },
|
|
3686
|
+
b
|
|
3687
|
+
);
|
|
3688
|
+
const L = b(k, d.w, "pPr"), F = L ? b(L, d.w, "sectPr") : null;
|
|
3689
|
+
if (F) {
|
|
3690
|
+
const N = Bt(F);
|
|
3691
|
+
if (N.columns > 1) {
|
|
3692
|
+
h.push(S);
|
|
3693
|
+
const j = t.options.targetInnerWidth ?? 600;
|
|
3694
|
+
w.push(Mt(h, N, j)), h = [];
|
|
3695
|
+
} else
|
|
3696
|
+
g(), w.push(S);
|
|
3697
|
+
const z = N.breakType;
|
|
3698
|
+
z !== "continuous" && z !== "nextColumn" && w.push({
|
|
3699
|
+
type: "paragraph",
|
|
3700
|
+
chunks: [{ type: "break", breakType: "page" }],
|
|
3701
|
+
style: {}
|
|
3702
|
+
});
|
|
3703
|
+
} else
|
|
3704
|
+
h.push(S);
|
|
3705
|
+
} else if (y === "tbl" && V === d.w)
|
|
3706
|
+
g(), w.push(
|
|
3707
|
+
ct(k, r, n, o, a, t.mediaMap, p)
|
|
3708
|
+
);
|
|
3709
|
+
else if (y === "sdt" && V === d.w)
|
|
3710
|
+
ie(
|
|
3711
|
+
k,
|
|
3712
|
+
h,
|
|
3713
|
+
w,
|
|
3714
|
+
g,
|
|
3715
|
+
r,
|
|
3716
|
+
n,
|
|
3717
|
+
o,
|
|
3718
|
+
a,
|
|
3719
|
+
t.mediaMap,
|
|
3720
|
+
p,
|
|
3721
|
+
f,
|
|
3722
|
+
d.w,
|
|
3723
|
+
b,
|
|
3724
|
+
R
|
|
3725
|
+
);
|
|
3726
|
+
else if (y === "customXml" && V === d.w)
|
|
3727
|
+
R(k, (S) => {
|
|
3728
|
+
S.localName === "p" && S.namespaceURI === d.w ? h.push(
|
|
3729
|
+
tt(S, r, n, o, a, t.mediaMap, p, f)
|
|
3730
|
+
) : S.localName === "tbl" && S.namespaceURI === d.w && (g(), w.push(
|
|
3731
|
+
ct(S, r, n, o, a, t.mediaMap, p)
|
|
3732
|
+
));
|
|
3733
|
+
});
|
|
3734
|
+
else if (y === "sectPr" && V === d.w) {
|
|
3735
|
+
const S = Bt(k);
|
|
3736
|
+
if (S.columns > 1 && h.length > 0) {
|
|
3737
|
+
const L = t.options.targetInnerWidth ?? 600;
|
|
3738
|
+
w.push(Mt(h, S, L)), h = [];
|
|
3739
|
+
}
|
|
3740
|
+
} else if (y === "commentRangeStart" && V === d.w) {
|
|
3741
|
+
const S = k.getAttributeNS(d.w, "id") ?? k.getAttribute("w:id") ?? "";
|
|
3742
|
+
S && m.push({ type: "commentMarker", markType: "start", commentId: S });
|
|
3743
|
+
} else if (y === "commentRangeEnd" && V === d.w) {
|
|
3744
|
+
const S = k.getAttributeNS(d.w, "id") ?? k.getAttribute("w:id") ?? "";
|
|
3745
|
+
S && m.push({ type: "commentMarker", markType: "end", commentId: S });
|
|
3746
|
+
}
|
|
3747
|
+
}), g();
|
|
3748
|
+
const T = ur(w, t.options, s), C = s.size > 0 ? [...s.values()] : void 0;
|
|
3749
|
+
return { success: !0, elements: T, comments: C };
|
|
3750
|
+
} catch (e) {
|
|
3751
|
+
const n = e instanceof Error ? e.message : String(e);
|
|
3752
|
+
return { success: !1, elements: [], error: `Parse failed: ${n}` };
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
async readZipEntry(t, e) {
|
|
3756
|
+
const n = t.file(e);
|
|
3757
|
+
return n ? n.async("string") : null;
|
|
3758
|
+
}
|
|
3759
|
+
async extractMediaFiles(t) {
|
|
3760
|
+
const e = {}, n = {
|
|
3761
|
+
png: "image/png",
|
|
3762
|
+
jpg: "image/jpeg",
|
|
3763
|
+
jpeg: "image/jpeg",
|
|
3764
|
+
gif: "image/gif",
|
|
3765
|
+
bmp: "image/bmp",
|
|
3766
|
+
tiff: "image/tiff",
|
|
3767
|
+
tif: "image/tiff",
|
|
3768
|
+
svg: "image/svg+xml",
|
|
3769
|
+
emf: "image/x-emf",
|
|
3770
|
+
wmf: "image/x-wmf"
|
|
3771
|
+
}, r = [];
|
|
3772
|
+
return t.forEach((o, s) => {
|
|
3773
|
+
o.startsWith("word/media/") && !s.dir && r.push(
|
|
3774
|
+
s.async("base64").then((a) => {
|
|
3775
|
+
var p;
|
|
3776
|
+
const l = ((p = o.split(".").pop()) == null ? void 0 : p.toLowerCase()) ?? "png", u = `data:${n[l] ?? "image/png"};base64,${a}`;
|
|
3777
|
+
e[o] = u, e[o.replace("word/", "")] = u;
|
|
3778
|
+
})
|
|
3779
|
+
);
|
|
3780
|
+
}), await Promise.all(r), e;
|
|
3781
|
+
}
|
|
3782
|
+
async extractChartRelFiles(t) {
|
|
3783
|
+
const e = {}, n = [];
|
|
3784
|
+
return t.forEach((r, o) => {
|
|
3785
|
+
r.includes("charts/_rels/") && r.endsWith(".rels") && !o.dir && n.push(
|
|
3786
|
+
o.async("string").then((s) => {
|
|
3787
|
+
e[r] = s;
|
|
3788
|
+
})
|
|
3789
|
+
);
|
|
3790
|
+
}), await Promise.all(n), e;
|
|
3791
|
+
}
|
|
3792
|
+
async extractChartXmlFiles(t) {
|
|
3793
|
+
const e = {}, n = [];
|
|
3794
|
+
return t.forEach((r, o) => {
|
|
3795
|
+
r.match(/^word\/charts\/chart\d+\.xml$/) && !o.dir && n.push(
|
|
3796
|
+
o.async("string").then((s) => {
|
|
3797
|
+
e[r] = s;
|
|
3798
|
+
})
|
|
3799
|
+
);
|
|
3800
|
+
}), await Promise.all(n), e;
|
|
3801
|
+
}
|
|
3802
|
+
getMergedOptions() {
|
|
3803
|
+
return { ...qe, ...this.options };
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
function ie(i, t, e, n, r, o, s, a, l, c, u, p, f, w) {
|
|
3807
|
+
if (Kn(i)) {
|
|
3808
|
+
const m = Qn(
|
|
3809
|
+
i,
|
|
3810
|
+
r,
|
|
3811
|
+
o,
|
|
3812
|
+
s,
|
|
3813
|
+
a,
|
|
3814
|
+
l
|
|
3815
|
+
);
|
|
3816
|
+
for (const g of m) t.push(g);
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
const h = f(i, p, "sdtContent");
|
|
3820
|
+
h && w(h, (m) => {
|
|
3821
|
+
m.localName === "p" && m.namespaceURI === p ? t.push(
|
|
3822
|
+
tt(m, r, o, s, a, l, c, u)
|
|
3823
|
+
) : m.localName === "tbl" && m.namespaceURI === p ? (n(), e.push(
|
|
3824
|
+
ct(m, r, o, s, a, l, c)
|
|
3825
|
+
)) : m.localName === "sdt" && m.namespaceURI === p && ie(
|
|
3826
|
+
m,
|
|
3827
|
+
t,
|
|
3828
|
+
e,
|
|
3829
|
+
n,
|
|
3830
|
+
r,
|
|
3831
|
+
o,
|
|
3832
|
+
s,
|
|
3833
|
+
a,
|
|
3834
|
+
l,
|
|
3835
|
+
c,
|
|
3836
|
+
u,
|
|
3837
|
+
p,
|
|
3838
|
+
f,
|
|
3839
|
+
w
|
|
3840
|
+
);
|
|
3841
|
+
});
|
|
3842
|
+
}
|
|
3843
|
+
function kr(i, t, e, n, r, o, s, a, l) {
|
|
3844
|
+
const c = i.getElementsByTagNameNS(a.w, "drawing");
|
|
3845
|
+
for (let u = 0; u < c.length; u++) {
|
|
3846
|
+
const p = c[u];
|
|
3847
|
+
if (!p.getElementsByTagNameNS(a.c, "chart").length) continue;
|
|
3848
|
+
let f = Vn(p, e, n, o);
|
|
3849
|
+
!f && s && (f = Cr(
|
|
3850
|
+
p,
|
|
3851
|
+
e,
|
|
3852
|
+
r,
|
|
3853
|
+
s,
|
|
3854
|
+
a,
|
|
3855
|
+
l
|
|
3856
|
+
)), f && t.chunks.push(f);
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
function Cr(i, t, e, n, r, o) {
|
|
3860
|
+
const s = i.getElementsByTagNameNS(r.c, "chart");
|
|
3861
|
+
if (s.length === 0) return null;
|
|
3862
|
+
const a = s[0].getAttributeNS(r.r, "id") ?? s[0].getAttribute("r:id") ?? "";
|
|
3863
|
+
if (!a) return null;
|
|
3864
|
+
const l = t.get(a);
|
|
3865
|
+
if (!l) return null;
|
|
3866
|
+
const c = l.target.startsWith("word/") ? l.target : `word/${l.target.replace(/^\.\.\//, "")}`, u = e[c];
|
|
3867
|
+
if (!u) return null;
|
|
3868
|
+
let p = 400, f = 300;
|
|
3869
|
+
const w = o(i, r.wp, "inline") ?? o(i, r.wp, "anchor");
|
|
3870
|
+
if (w) {
|
|
3871
|
+
const m = o(w, r.wp, "extent");
|
|
3872
|
+
if (m) {
|
|
3873
|
+
const g = m.getAttribute("cx"), v = m.getAttribute("cy");
|
|
3874
|
+
g && (p = Math.round(parseInt(g, 10) / 9525)), v && (f = Math.round(parseInt(v, 10) / 9525));
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
const h = jn(u);
|
|
3878
|
+
if (!h) return null;
|
|
3879
|
+
try {
|
|
3880
|
+
return { type: "image", src: n(h, p, f, 2), width: p, height: f };
|
|
3881
|
+
} catch {
|
|
3882
|
+
return null;
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
function xr(i, t, e) {
|
|
3886
|
+
const n = { top: 72, bottom: 72, left: 90, right: 90 }, r = e(i, t, "sectPr");
|
|
3887
|
+
if (!r) return n;
|
|
3888
|
+
const o = e(r, t, "pgMar");
|
|
3889
|
+
if (!o) return n;
|
|
3890
|
+
const s = (f) => f ? parseInt(f, 10) : null, a = (f) => f / 1440 * 96, l = s(o.getAttributeNS(t, "top") ?? o.getAttribute("w:top")), c = s(o.getAttributeNS(t, "bottom") ?? o.getAttribute("w:bottom")), u = s(o.getAttributeNS(t, "left") ?? o.getAttribute("w:left")), p = s(o.getAttributeNS(t, "right") ?? o.getAttribute("w:right"));
|
|
3891
|
+
return {
|
|
3892
|
+
top: l !== null ? a(l) : n.top,
|
|
3893
|
+
bottom: c !== null ? a(c) : n.bottom,
|
|
3894
|
+
left: u !== null ? a(u) : n.left,
|
|
3895
|
+
right: p !== null ? a(p) : n.right
|
|
3896
|
+
};
|
|
3897
|
+
}
|
|
3898
|
+
function Ir(i) {
|
|
3899
|
+
return new vr(i);
|
|
3900
|
+
}
|
|
3901
|
+
async function Br(i, t) {
|
|
3902
|
+
const e = Ir(t);
|
|
3903
|
+
return i instanceof File ? e.parseFromFile(i) : e.parse(i);
|
|
3904
|
+
}
|
|
3905
|
+
export {
|
|
3906
|
+
Or as AbstractRichText,
|
|
3907
|
+
Xr as Actuator,
|
|
3908
|
+
Dr as Area,
|
|
3909
|
+
zr as Background,
|
|
3910
|
+
jr as Badge,
|
|
3911
|
+
Ai as BaseAdapter,
|
|
3912
|
+
Hi as BaseCommandAdapter,
|
|
3913
|
+
ro as BlockParticle,
|
|
3914
|
+
$r as CanvasEvent,
|
|
3915
|
+
io as CheckboxControl,
|
|
3916
|
+
qr as CheckboxParticle,
|
|
3917
|
+
Ji as Command,
|
|
3918
|
+
Yi as CommandAdapt,
|
|
3919
|
+
To as CommentComponent,
|
|
3920
|
+
oo as Control,
|
|
3921
|
+
so as ControlBorder,
|
|
3922
|
+
lo as ControlComponent,
|
|
3923
|
+
ao as ControlSearch,
|
|
3924
|
+
ti as Cursor,
|
|
3925
|
+
ei as CursorAgent,
|
|
3926
|
+
co as DateControl,
|
|
3927
|
+
uo as DateParticle,
|
|
3928
|
+
po as DatePicker,
|
|
3929
|
+
vr as DocxParser,
|
|
3930
|
+
ni as Draw,
|
|
3931
|
+
Fr as Editor,
|
|
3932
|
+
Di as EventBus,
|
|
3933
|
+
He as ExportComponent,
|
|
3934
|
+
ri as FloatingBar,
|
|
3935
|
+
ii as Footer,
|
|
3936
|
+
ho as GadgetComponent,
|
|
3937
|
+
oi as GlobalEvent,
|
|
3938
|
+
si as Group,
|
|
3939
|
+
li as Header,
|
|
3940
|
+
ai as Highlight,
|
|
3941
|
+
ci as HyperlinkParticle,
|
|
3942
|
+
_r as I18n,
|
|
3943
|
+
ui as ImageObserver,
|
|
3944
|
+
di as ImageParticle,
|
|
3945
|
+
to as KeymapComponent,
|
|
3946
|
+
fo as LaTexParticle,
|
|
3947
|
+
pi as LineBreakParticle,
|
|
3948
|
+
hi as LineNumber,
|
|
3949
|
+
fi as ListParticle,
|
|
3950
|
+
zi as Listener,
|
|
3951
|
+
mi as Margin,
|
|
3952
|
+
bi as MouseObserver,
|
|
3953
|
+
mo as NumberControl,
|
|
3954
|
+
gi as Override,
|
|
3955
|
+
Bi as PageAdapter,
|
|
3956
|
+
wi as PageBorder,
|
|
3957
|
+
yi as PageBreakParticle,
|
|
3958
|
+
Si as PageNumber,
|
|
3959
|
+
Mi as ParagraphAdapter,
|
|
3960
|
+
Ti as ParagraphColor,
|
|
3961
|
+
vi as Placeholder,
|
|
3962
|
+
ki as Position,
|
|
3963
|
+
Ci as Previewer,
|
|
3964
|
+
bo as RadioControl,
|
|
3965
|
+
xi as RadioParticle,
|
|
3966
|
+
ji as RangeManager,
|
|
3967
|
+
Ii as Register,
|
|
3968
|
+
vo as RevisionComponent,
|
|
3969
|
+
Li as ScrollObserver,
|
|
3970
|
+
go as Search,
|
|
3971
|
+
wo as SelectControl,
|
|
3972
|
+
Ei as SelectionObserver,
|
|
3973
|
+
Vi as SeparatorParticle,
|
|
3974
|
+
eo as Shortcut,
|
|
3975
|
+
Zi as Strikeout,
|
|
3976
|
+
Ni as SubscriptParticle,
|
|
3977
|
+
Ri as SuperscriptParticle,
|
|
3978
|
+
Ki as TableAdapter,
|
|
3979
|
+
Wi as TableOperate,
|
|
3980
|
+
Ui as TableParticle,
|
|
3981
|
+
Pi as TableTool,
|
|
3982
|
+
yo as TextControl,
|
|
3983
|
+
Gi as TextParticle,
|
|
3984
|
+
Qi as TextStyleAdapter,
|
|
3985
|
+
Fi as Underline,
|
|
3986
|
+
_i as Watermark,
|
|
3987
|
+
_e as WorkerComponent,
|
|
3988
|
+
Fe as WorkerManager,
|
|
3989
|
+
Ir as createDocxParser,
|
|
3990
|
+
Fr as default,
|
|
3991
|
+
Ar as getClipboardData,
|
|
3992
|
+
Jr as getIsClipboardContainFile,
|
|
3993
|
+
Br as parseDocx,
|
|
3994
|
+
Hr as removeClipboardData,
|
|
3995
|
+
Yr as version
|
|
3996
|
+
};
|
|
3997
|
+
//# sourceMappingURL=core.js.map
|